// Talent Bar Handler.
// Worthless Bums 2012.


// Clears talent bar icons.
function clearTalentBarIcons ()
{//echo("clearTalentBarIcons()");
	leaderTalent1.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	leaderTalent2.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	leaderTalent3.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	leaderTalent4.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	leaderTalent5.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	leaderTalent6.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	leaderTalent7.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	leaderTalent8.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	
	scoutTalent1.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	scoutTalent2.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	scoutTalent3.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	scoutTalent4.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	scoutTalent5.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	scoutTalent6.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	scoutTalent7.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	scoutTalent8.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	
	grenadierTalent1.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	grenadierTalent2.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	grenadierTalent3.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	grenadierTalent4.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	grenadierTalent5.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	grenadierTalent6.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	grenadierTalent7.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	grenadierTalent8.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	
	supportTalent1.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	supportTalent2.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	supportTalent3.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	supportTalent4.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	supportTalent5.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	supportTalent6.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	supportTalent7.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	supportTalent8.setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
}

// Updates talent bar icons.
function updateTalentBarIcons ()
{//echo("updateTalentBarIcons()");
	// Initialize active character promotion bitmaps first!
	//setActiveCharacterPromotions();
	
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Get class name for talent bar settings.
	%characterClass = "";
	switch ($activeCharacter)
	{
		case 0:	%characterClass = "leader";
		case 1:	%characterClass = "scout";
		case 2:	%characterClass = "grenadier";
		case 3:	%characterClass = "support";
	}
	
	// Dispatch by active character CLASS.
	switch ($playerSquad[$activeCharacter].characterClass)
	{
		case 0:
			leaderTalentBar.setVisible(false);
			scoutTalentBar.setVisible(false);
			grenadierTalentBar.setVisible(false);
			supportTalentBar.setVisible(false);
			//engineerTalentBar.setVisible(false);
			(%characterClass @ "TalentBar").setVisible(true);
			// Set button icons.
			// PFC talents.
			if (getWord(%talents, 0) == 1)
			{//echo("1");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/Charge");
			}
			else if (getWord(%talents, 1) == 1)
			{//echo("2");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/IronResolve");
			}
			// LCpl talents.
			if (getWord(%talents, 2) == 1)
			{//echo("1");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/SnapShots");
			}
			else if (getWord(%talents, 3) == 1)
			{//echo("2");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/FlakRounds");
			}
			// Cpl talents.
			if (getWord(%talents, 4) == 1)
			{//echo("1");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Radar");
			}
			else if (getWord(%talents, 5) == 1)
			{//echo("2");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Firefighter");
			}
			// Sgt talents.
			if (getWord(%talents, 6) == 1)
			{//echo("1");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Stim");
			}
			else if (getWord(%talents, 7) == 1)
			{//echo("2");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Vigilance");
			}
			/*
			// GYSgt talents.
			if (getWord(%talents, 8) == 1)
			{//echo("1");
				leaderTalent5.setBitmap("^Sprites/assets/images/UI/talents/Leader/Covering-Fire");//gysgtTalent1.bitmap;
			}
			else if (getWord(%talents, 9) == 1)
			{//echo("2");
				leaderTalent5.setBitmap("^Sprites/assets/images/UI/talents/Leader/Suppression-Fire");//gysgtTalent2.bitmap;
			}
			// MSgt talents.
			if (getWord(%talents, 10) == 1)
			{//echo("1");
				leaderTalent6.setBitmap("^Sprites/assets/images/UI/talents/Leader/Dummy-Suit");//msgtTalent1.bitmap;
			}
			else if (getWord(%talents, 11) == 1)
			{//echo("2");
				leaderTalent6.setBitmap("^Sprites/assets/images/UI/talents/Leader/Sentry-Turret");//msgtTalent2.bitmap;
			}
			// 2ndLt talents.
			if (getWord(%talents, 12) == 1)
			{//echo("1");
				leaderTalent7.setBitmap("^Sprites/assets/images/UI/talents/Leader/Pull-Rank");//secondltTalent1.bitmap;
			}
			else if (getWord(%talents, 13) == 1)
			{//echo("2");
				leaderTalent7.setBitmap("^Sprites/assets/images/UI/talents/Leader/Reposition");//secondltTalent2.bitmap;
			}
			// 1stLt talents.
			if (getWord(%talents, 14) == 1)
			{//echo("1");
				leaderTalent8.setBitmap("^Sprites/assets/images/UI/talents/Leader/Tagged");//firstltTalent1.bitmap;
			}
			else if (getWord(%talents, 15) == 1)
			{//echo("2");
				leaderTalent8.setBitmap("^Sprites/assets/images/UI/talents/Leader/Tactics");//firstltTalent2.bitmap;
			}
			*/
			
		case 1:
			leaderTalentBar.setVisible(false);
			scoutTalentBar.setVisible(false);
			grenadierTalentBar.setVisible(false);
			supportTalentBar.setVisible(false);
			//engineerTalentBar.setVisible(false);
			(%characterClass @ "TalentBar").setVisible(true);
			// Set button icons.
			// PFC talents.
			if (getWord(%talents, 0) == 1)
			{//echo("1");
				(%characterClass @ "Talent1").setBitmap( "^Sprites/assets/images/UI/talents/Scoped");
			}
			else if (getWord(%talents, 1) == 1)
			{//echo("2");
				(%characterClass @ "Talent1").setBitmap( "^Sprites/assets/images/UI/talents/SecondSkin");
			}
			// LCpl talents.
			if (getWord(%talents, 2) == 1)
			{//echo("1");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/CalledShot");
			}
			else if (getWord(%talents, 3) == 1)
			{//echo("2");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/Stealthy");
			}
			// Cpl talents.
			if (getWord(%talents, 4) == 1)
			{//echo("1");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Garrote");
			}
			else if (getWord(%talents, 5) == 1)
			{//echo("2");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Autoloader");
			}
			// Sgt talents.
			if (getWord(%talents, 6) == 1)
			{//echo("1");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Stasis");
			}
			else if (getWord(%talents, 7) == 1)
			{//echo("2");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Biohazard");
			}
			/*
			// GYSgt talents.
			if (getWord(%talents, 8) == 1)
			{//echo("1");
				scoutTalent5.setBitmap("^Sprites/assets/images/UI/talents/Scout/Garrote");
			}
			else if (getWord(%talents, 9) == 1)
			{//echo("2");
				scoutTalent5.setBitmap("^Sprites/assets/images/UI/talents/Scout/Disengage");
			}
			// MSgt talents.
			if (getWord(%talents, 10) == 1)
			{//echo("1");
				scoutTalent6.setBitmap("^Sprites/assets/images/UI/talents/Scout/TrickShot");
			}
			else if (getWord(%talents, 11) == 1)
			{//echo("2");
				scoutTalent6.setBitmap("^Sprites/assets/images/UI/talents/Scout/ChargeShot");
			}
			// 2ndLt talents.
			if (getWord(%talents, 12) == 1)
			{//echo("1");
				scoutTalent7.setBitmap("^Sprites/assets/images/UI/talents/Scout/Leapfrog");
			}
			else if (getWord(%talents, 13) == 1)
			{//echo("2");
				scoutTalent7.setBitmap("^Sprites/assets/images/UI/talents/Scout/Sabotage");
			}
			// 1stLt talents.
			if (getWord(%talents, 14) == 1)
			{//echo("1");
				scoutTalent8.setBitmap("^Sprites/assets/images/UI/talents/Scout/Pathfinder");
			}
			else if (getWord(%talents, 15) == 1)
			{//echo("2");
				scoutTalent8.setBitmap("^Sprites/assets/images/UI/talents/Scout/EndlessRound");
			}
			*/
			
		case 2:
			leaderTalentBar.setVisible(false);
			scoutTalentBar.setVisible(false);
			grenadierTalentBar.setVisible(false);
			supportTalentBar.setVisible(false);
			//engineerTalentBar.setVisible(false);
			(%characterClass @ "TalentBar").setVisible(true);
			// Set button icons.
			// PFC talents.
			if (getWord(%talents, 0) == 1)
			{//echo("1");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/Napalm");
			}
			else if (getWord(%talents, 1) == 1)
			{//echo("2");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/Annihilation");
			}
			// LCpl talents.
			if (getWord(%talents, 2) == 1)
			{//echo("1");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/Batter");
			}
			else if (getWord(%talents, 3) == 1)
			{//echo("2");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/MineSweeper");
			}
			// Cpl talents.
			if (getWord(%talents, 4) == 1)
			{//echo("1");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Pincer");
			}
			else if (getWord(%talents, 5) == 1)
			{//echo("2");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/AblativeArmor");
			}
			// Sgt talents.
			if (getWord(%talents, 6) == 1)
			{//echo("1");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/EMP");
			}
			else if (getWord(%talents, 7) == 1)
			{//echo("2");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/SmartBombs");
			}
			/*
			// GYSgt talents.
			if (getWord(%talents, 8) == 1)
			{//echo("1");
				grenadierTalent5.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/ShellShock");
			}
			else if (getWord(%talents, 9) == 1)
			{//echo("2");
				grenadierTalent5.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/BombTurret");
			}
			// MSgt talents.
			if (getWord(%talents, 10) == 1)
			{//echo("1");
				grenadierTalent6.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/Mayhem");
			}
			else if (getWord(%talents, 11) == 1)
			{//echo("2");
				grenadierTalent6.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/Pandemonium");
			}
			// 2ndLt talents.
			if (getWord(%talents, 12) == 1)
			{//echo("1");
				grenadierTalent7.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/EMP");
			}
			else if (getWord(%talents, 13) == 1)
			{//echo("2");
				grenadierTalent7.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/Earthquake");
			}
			// 1stLt talents.
			if (getWord(%talents, 14) == 1)
			{//echo("1");
				grenadierTalent8.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/ShapedCharge");
			}
			else if (getWord(%talents, 15) == 1)
			{//echo("2");
				grenadierTalent8.setBitmap("^Sprites/assets/images/UI/talents/Grenadier/Claymore");
			}
			*/
			
		case 3:
			leaderTalentBar.setVisible(false);
			scoutTalentBar.setVisible(false);
			grenadierTalentBar.setVisible(false);
			supportTalentBar.setVisible(false);
			//engineerTalentBar.setVisible(false);
			(%characterClass @ "TalentBar").setVisible(true);
			// Set button icons.
			// PFC talents.
			if (getWord(%talents, 0) == 1)
			{//echo("1");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/PointBlank");
			}
			else if (getWord(%talents, 1) == 1)
			{//echo("2");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/Hulk");
			}
			// LCpl talents.
			if (getWord(%talents, 2) == 1)
			{//echo("1");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/HailMary");
			}
			else if (getWord(%talents, 3) == 1)
			{//echo("2");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/SharkRounds");
			}
			// Cpl talents.
			if (getWord(%talents, 4) == 1)
			{//echo("1");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Bulwark");
			}
			else if (getWord(%talents, 5) == 1)
			{//echo("2");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Sentry");
			}
			// Sgt talents.
			if (getWord(%talents, 6) == 1)
			{//echo("1");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Turret");
			}
			else if (getWord(%talents, 7) == 1)
			{//echo("2");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Flanker");
			}
			/*
			// GYSgt talents.
			if (getWord(%talents, 8) == 1)
			{//echo("1");
				supportTalent5.setBitmap("^Sprites/assets/images/UI/talents/Support/ShellShock");
			}
			else if (getWord(%talents, 9) == 1)
			{//echo("2");
				supportTalent5.setBitmap("^Sprites/assets/images/UI/talents/Support/BombTurret");
			}
			// MSgt talents.
			if (getWord(%talents, 10) == 1)
			{//echo("1");
				supportTalent6.setBitmap("^Sprites/assets/images/UI/talents/Support/Mayhem");
			}
			else if (getWord(%talents, 11) == 1)
			{//echo("2");
				supportTalent6.setBitmap("^Sprites/assets/images/UI/talents/Support/Pandemonium");
			}
			// 2ndLt talents.
			if (getWord(%talents, 12) == 1)
			{//echo("1");
				supportTalent7.setBitmap("^Sprites/assets/images/UI/talents/Support/EMP");
			}
			else if (getWord(%talents, 13) == 1)
			{//echo("2");
				supportTalent7.setBitmap("^Sprites/assets/images/UI/talents/Support/Earthquake");
			}
			// 1stLt talents.
			if (getWord(%talents, 14) == 1)
			{//echo("1");
				supportTalent8.setBitmap("^Sprites/assets/images/UI/talents/Support/ShapedCharge");
			}
			else if (getWord(%talents, 15) == 1)
			{//echo("2");
				supportTalent8.setBitmap("^Sprites/assets/images/UI/talents/Support/Claymore");
			}
			*/
			
		case 4:
			leaderTalentBar.setVisible(false);
			scoutTalentBar.setVisible(false);
			grenadierTalentBar.setVisible(false);
			supportTalentBar.setVisible(false);
			//engineerTalentBar.setVisible(false);
			(%characterClass @ "TalentBar").setVisible(true);
			// Set button icons.
			// PFC talents.
			if (getWord(%talents, 0) == 1)
			{//echo("1");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/TargetScan");
			}
			else if (getWord(%talents, 1) == 1)
			{//echo("2");
				(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/StunShots");
			}
			// LCpl talents.
			if (getWord(%talents, 2) == 1)
			{//echo("1");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/MagFist");
			}
			else if (getWord(%talents, 3) == 1)
			{//echo("2");
				(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/Hackery");
			}
			// Cpl talents.
			if (getWord(%talents, 4) == 1)
			{//echo("1");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Weld");
			}
			else if (getWord(%talents, 5) == 1)
			{//echo("2");
				(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/ActiveTargeting");
			}
			// Sgt talents.
			if (getWord(%talents, 6) == 1)
			{//echo("1");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Ammosmith");
			}
			else if (getWord(%talents, 7) == 1)
			{//echo("2");
				(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/TechUpgrade");
			}
	}
	
	// Set talent bar tool tips.
	setTalentBarToolTips();
	
	
	// TESTER
	// Re-set talent bars for Hulk Suits!
	/*if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		(%characterClass @ "Talent1").setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
		(%characterClass @ "Talent2").setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
		(%characterClass @ "Talent3").setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
		(%characterClass @ "Talent4").setBitmap("^Sprites/assets/images/UI/talents/Talents-Blank");
	}*/
	// END OF TESTER
	
	
	// Update readout.
	//initializeReadout();
}

// Set talent bar tool tips.
function setTalentBarToolTips ()
{//echo("setTalentBarToolTips()");
	// Initialize Promotion GUI because talent bar tool tips take tool tips from Promotion Gui talents!
	// NOTE: Should change this...
	initializePromotionGUI();
	//setActiveCharacterPromotions();
	
	// Set Leader Talent Bar Tooltips.
	if ($leaderPersist)
	{
		if (getWord($playerSquad[0].talents, 0) == 1)
		{
			leaderTalent1.tooltip = pfcTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 1) == 1)
		{
			leaderTalent1.tooltip = pfcTalent2.tooltip;
		}
		
		if (getWord($playerSquad[0].talents, 2) == 1)
		{
			leaderTalent2.tooltip = lcplTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 3) == 1)
		{
			leaderTalent2.tooltip = lcplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[0].talents, 4) == 1)
		{
			leaderTalent3.tooltip = cplTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 5) == 1)
		{
			leaderTalent3.tooltip = cplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[0].talents, 6) == 1)
		{
			leaderTalent4.tooltip = sgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 7) == 1)
		{
			leaderTalent4.tooltip = sgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[0].talents, 8) == 1)
		{
			leaderTalent5.tooltip = gysgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 9) == 1)
		{
			leaderTalent5.tooltip = gysgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[0].talents, 10) == 1)
		{
			leaderTalent6.tooltip = msgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 11) == 1)
		{
			leaderTalent6.tooltip = msgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[0].talents, 12) == 1)
		{
			leaderTalent7.tooltip = secondltTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 13) == 1)
		{
			leaderTalent7.tooltip = secondltTalent2.tooltip;
		}
		
		if (getWord($playerSquad[0].talents, 14) == 1)
		{
			leaderTalent8.tooltip = firstltTalent1.tooltip;
		}
		else if (getWord($playerSquad[0].talents, 15) == 1)
		{
			leaderTalent8.tooltip = firstltTalent2.tooltip;
		}
	}
	
	// Set Scout Talent Bar Tooltips.
	if ($scoutPersist)
	{
		if (getWord($playerSquad[1].talents, 0) == 1)
		{
			scoutTalent1.tooltip = pfcTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 1) == 1)
		{
			scoutTalent1.tooltip = pfcTalent2.tooltip;
		}
		
		if (getWord($playerSquad[1].talents, 2) == 1)
		{
			scoutTalent2.tooltip = lcplTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 3) == 1)
		{
			scoutTalent2.tooltip = lcplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[1].talents, 4) == 1)
		{
			scoutTalent3.tooltip = cplTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 5) == 1)
		{
			scoutTalent3.tooltip = cplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[1].talents, 6) == 1)
		{
			scoutTalent4.tooltip = sgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 7) == 1)
		{
			scoutTalent4.tooltip = sgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[1].talents, 8) == 1)
		{
			scoutTalent5.tooltip = gysgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 9) == 1)
		{
			scoutTalent5.tooltip = gysgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[1].talents, 10) == 1)
		{
			scoutTalent6.tooltip = msgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 11) == 1)
		{
			scoutTalent6.tooltip = msgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[1].talents, 12) == 1)
		{
			scoutTalent7.tooltip = secondltTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 13) == 1)
		{
			scoutTalent7.tooltip = secondltTalent2.tooltip;
		}
		
		if (getWord($playerSquad[1].talents, 14) == 1)
		{
			scoutTalent8.tooltip = firstltTalent1.tooltip;
		}
		else if (getWord($playerSquad[1].talents, 15) == 1)
		{
			scoutTalent8.tooltip = firstltTalent2.tooltip;
		}
	}
	
	// Set Grenadier Talent Bar Tooltips.
	if ($grenadierPersist)
	{
		if (getWord($playerSquad[2].talents, 0) == 1)
		{
			grenadierTalent1.tooltip = pfcTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 1) == 1)
		{
			grenadierTalent1.tooltip = pfcTalent2.tooltip;
		}
		
		if (getWord($playerSquad[2].talents, 2) == 1)
		{
			grenadierTalent2.tooltip = lcplTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 3) == 1)
		{
			grenadierTalent2.tooltip = lcplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[2].talents, 4) == 1)
		{
			grenadierTalent3.tooltip = cplTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 5) == 1)
		{
			grenadierTalent3.tooltip = cplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[2].talents, 6) == 1)
		{
			grenadierTalent4.tooltip = sgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 7) == 1)
		{
			grenadierTalent4.tooltip = sgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[2].talents, 8) == 1)
		{
			grenadierTalent5.tooltip = gysgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 9) == 1)
		{
			grenadierTalent5.tooltip = gysgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[2].talents, 10) == 1)
		{
			grenadierTalent6.tooltip = msgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 11) == 1)
		{
			grenadierTalent6.tooltip = msgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[2].talents, 12) == 1)
		{
			grenadierTalent7.tooltip = secondltTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 13) == 1)
		{
			grenadierTalent7.tooltip = secondltTalent2.tooltip;
		}
		
		if (getWord($playerSquad[2].talents, 14) == 1)
		{
			grenadierTalent8.tooltip = firstltTalent1.tooltip;
		}
		else if (getWord($playerSquad[2].talents, 15) == 1)
		{
			grenadierTalent8.tooltip = firstltTalent2.tooltip;
		}
	}
	
	// Set Support Talent Bar Tooltips.
	if ($supportPersist)
	{
		if (getWord($playerSquad[3].talents, 0) == 1)
		{
			supportTalent1.tooltip = pfcTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 1) == 1)
		{
			supportTalent1.tooltip = pfcTalent2.tooltip;
		}
		
		if (getWord($playerSquad[3].talents, 2) == 1)
		{
			supportTalent2.tooltip = lcplTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 3) == 1)
		{
			supportTalent2.tooltip = lcplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[3].talents, 4) == 1)
		{
			supportTalent3.tooltip = cplTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 5) == 1)
		{
			supportTalent3.tooltip = cplTalent2.tooltip;
		}
		
		if (getWord($playerSquad[3].talents, 6) == 1)
		{
			supportTalent4.tooltip = sgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 7) == 1)
		{
			supportTalent4.tooltip = sgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[3].talents, 8) == 1)
		{
			supportTalent5.tooltip = gysgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 9) == 1)
		{
			supportTalent5.tooltip = gysgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[3].talents, 10) == 1)
		{
			supportTalent6.tooltip = msgtTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 11) == 1)
		{
			supportTalent6.tooltip = msgtTalent2.tooltip;
		}
		
		if (getWord($playerSquad[3].talents, 12) == 1)
		{
			supportTalent7.tooltip = secondltTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 13) == 1)
		{
			supportTalent7.tooltip = secondltTalent2.tooltip;
		}
		
		if (getWord($playerSquad[3].talents, 14) == 1)
		{
			supportTalent8.tooltip = firstltTalent1.tooltip;
		}
		else if (getWord($playerSquad[3].talents, 15) == 1)
		{
			supportTalent8.tooltip = firstltTalent2.tooltip;
		}
	}
	
	
	// TESTER
	// Re-set talent bars for Hulk Suits!
	/*if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		// Nothing here yet!
	}*/
	// END OF TESTER
}

// Talent Bar Button functions.
// Leader.
function leaderTalent1 ()
{//echo("leaderTalent1()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Determine which talent is in this talent slot, if any.
	// PFC talents.
	if (getWord(%talents, 0) == 1)
	{
		// Charge.
		charge();
	}
}
function leaderTalent2 ()
{//echo("leaderTalent2()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Determine which talent is in this talent slot, if any.
	// LCpl talents.
	if (getWord(%talents, 2) == 1)
	{
		// Snap Shots.
		snapShots();
	}
}
function leaderTalent3 ()
{//echo("leaderTalent3()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Cpl talents.
	if (getWord(%talents, 4) == 1)
	{
		// Radar.
		radar();
	}
}
function leaderTalent4 ()
{//echo("leaderTalent4()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Sgt talents.
	if (getWord(%talents, 6) == 1)
	{
		// Stim.
		stim();
	}
}

// Scout.
function scoutTalent1 ()
{//echo("scoutTalent1()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// PFC talents.
	if (getWord(%talents, 0) == 1)
	{
		// Scoped.
		scoped();
	}
}
function scoutTalent2 ()
{//echo("scoutTalent2()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// LCpl talents.
	if (getWord(%talents, 2) == 1)
	{
		// Called Shot.
		calledShot();
	}
}
function scoutTalent3 ()
{//echo("scoutTalent3()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Cpl talents.
	if (getWord(%talents, 4) == 1)
	{
		// Garrote.
		garrote();
	}
}
function scoutTalent4 ()
{//echo("scoutTalent4()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Sgt talents.
	if (getWord(%talents, 6) == 1)
	{
		// Stasis.
		stasis();
	}
}

// Grenadier.
function grenadierTalent1 ()
{//echo("grenadierTalent1()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// PFC talents.
	if (getWord(%talents, 0) == 1)
	{
		// Napalm.
		napalm();
	}
}
function grenadierTalent2 ()
{//echo("grenadierTalent2()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// LCpl talents.
	if (getWord(%talents, 2) == 1)
	{
		// Batter.
		Batter();
	}
}
function grenadierTalent3 ()
{//echo("grenadierTalent3()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Cpl talents.
	if (getWord(%talents, 4) == 1)
	{
		// Pincer.
		pincer();
	}
}
function grenadierTalent4 ()
{//echo("grenadierTalent4()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Sgt talents.
	if (getWord(%talents, 6) == 1)
	{
		// EMP.
		emp();
	}
}

// Support.
function supportTalent1 ()
{//echo("supportTalent1()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// PFC talents.
	if (getWord(%talents, 0) == 1)
	{
		// Point Blank.
		pointBlank();
	}
}
function supportTalent2 ()
{//echo("supportTalent2()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// LCpl talents.
	if (getWord(%talents, 2) == 1)
	{
		// Hail Mary.
		hailMary();
	}
}
function supportTalent3 ()
{//echo("supportTalent3()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Cpl talents.
	if (getWord(%talents, 4) == 1)
	{
		// Bulwark.
		bulwark();
	}
}
function supportTalent4 ()
{//echo("supportTalent4()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	// Grab the talents.
	%talents = $playerSquad[$activeCharacter].talents;
	
	// Sgt talents.
	if (getWord(%talents, 6) == 1)
	{
		// Turret.
		turret();
	}
}

// Engineer.
function engineerTalent1 ()
{//echo("engineerTalent1()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	if (getWord($playerSquad[$activeCharacter].talents, 0) == 1)
	{
		targetScan();
	}
}
function engineerTalent2 ()
{//echo("engineerTalent2()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	if (getWord($playerSquad[$activeCharacter].talents, 2) == 1)
	{
		magFist();
	}
}
function engineerTalent3 ()
{//echo("engineerTalent3()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	if (getWord($playerSquad[$activeCharacter].talents, 4) == 1)
	{
		weld();
	}
}
function engineerTalent4 ()
{//echo("engineerTalent4()");
	// Don't allow active talent use in Hulk Suits!
	if (isLargeUnit($playerSquad[$activeCharacter]))
	{
		return;
	}
	if (getWord($playerSquad[$activeCharacter].talents, 6) == 1)
	{
		ammosmith();
	}
}