//////////////////////////////////////////////////
//	Author: Drammel								//
//	Date: 6/2/2009								//
//	Title: gui_unlearn_maneuver					//
//	Description: Removes a maneuver from the	//
//	list of maneuvers the PC chooses to learn at//
//	levelup.									//
//////////////////////////////////////////////////

#include "bot9s_inc_levelup"
#include "bot9s_inc_levelup2"

void main(string sData)
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int nManeuver = StringToInt(sData);
	int nKnown = GetLocalInt(oToB, "KnownManeuverTotal");
	int nLevel = GetLocalInt(oToB, "CurrentLevelupLevel");
	int nClass = GetLocalInt(oToB, "LevelupClass");
	int nLearn = GetLocalInt(oToB, "LevelupLearn");
	int nStance = GetLocalInt(oToB, "LevelupStance");
	int nLevelCap = GetLocalInt(oToB, "LevelupCap");
	int nDiscipline;

	ClearListBox(oPC, "SCREEN_LEVELUP_MANEUVERS", "AVAILABLE_MANEUVER_LIST");
	ClearListBox(oPC, "SCREEN_LEVELUP_MANEUVERS", "ADDED_MANEUVER_LIST");

	if ((nManeuver > 0) && (nManeuver < 28)) // Determine the maneuver's Discipline.
	{
		nDiscipline = 1;
	}
	else if ((nManeuver > 27) && (nManeuver < 54))
	{
		nDiscipline = 2;
	}
	else if ((nManeuver > 53) && (nManeuver < 76))
	{
		nDiscipline = 3;
	}
	else if ((nManeuver > 75) && (nManeuver < 97))
	{
		nDiscipline = 4;
	}
	else if (((nManeuver > 96) && (nManeuver < 116)) || nManeuver == 209)
	{
		nDiscipline = 5;
	}
	else if ((nManeuver > 115) && (nManeuver < 141))
	{
		nDiscipline = 6;
	}
	else if ((nManeuver > 140) && (nManeuver < 165))
	{
		nDiscipline = 7;
	}
	else if ((nManeuver > 164) && (nManeuver < 188))
	{
		nDiscipline = 8;
	}
	else if ((nManeuver > 187) && (nManeuver < 208))
	{
		nDiscipline = 9;
	}

	if (GetIsStance(nManeuver))
	{	
		SetLocalInt(oToB, "LevelupStance", nStance + 1);
		int nNew = GetLocalInt(oToB, "LevelupStance");
		SetGUIObjectText(oPC, "SCREEN_LEVELUP_MANEUVERS", "POINT_POOL_TEXT", -1, IntToString(nNew));
	}
	else if (!GetIsStance(nManeuver))
	{
		SetLocalInt(oToB, "LevelupLearn", nLearn + 1);
		int nNew = GetLocalInt(oToB, "LevelupLearn");
		SetGUIObjectText(oPC, "SCREEN_LEVELUP_MANEUVERS", "POINT_POOL_TEXT", -1, IntToString(nNew));
	}

	if ((GetLocalInt(oToB, "LevelupStance") > 0) || (GetLocalInt(oToB, "LevelupLearn") > 0))
	{
		SetGUIObjectDisabled(oPC, "SCREEN_LEVELUP_MANEUVERS", "CHOICE_NEXT", TRUE);
	}

	UnlearnManeuver(nManeuver);
	GenerateKnownManeuvers(oPC);
	SetLocalString(oToB, "AddedManeuver" + sData, "");
	SetLocalInt(oToB, "KnownManeuverTotal", nKnown - 1);
	PredictDisciplineStatus(nDiscipline, FALSE);
	DisplayManeuversByClass(nLevel, nClass, nLevelCap);
	DisplayAddedManeuvers();
}