//////////////////////////////////////////////////
//	Author: Drammel								//
//	Date: 6/1/2009								//
//	Title: gui_tob_cancel_levelup				//
//	Description: Cancels the levelup screens for//
//	the martial adept screens.					//
//////////////////////////////////////////////////

#include "bot9s_inc_levelup2"

void Phase0()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 47)
	{
		DeleteLocalInt(oToB, "L0" + IntToString(i));
		i++;
	}
}

void Phase1()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 21)
	{
		DeleteLocalInt(oToB, "L1" + IntToString(i));
		i++;
	}
}

void Phase2()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 22)
	{
		DeleteLocalInt(oToB, "L2" + IntToString(i));
		i++;
	}
}

void Phase3()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 20)
	{
		DeleteLocalInt(oToB, "L3" + IntToString(i));
		i++;
	}
}

void Phase4()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 22)
	{
		DeleteLocalInt(oToB, "L4" + IntToString(i));
		i++;
	}
}

void Phase5()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 23)
	{
		DeleteLocalInt(oToB, "L5" + IntToString(i));
		i++;
	}
}

void Phase6()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 20)
	{
		DeleteLocalInt(oToB, "L6" + IntToString(i));
		i++;
	}
}

void Phase7()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 18)
	{
		DeleteLocalInt(oToB, "L7" + IntToString(i));
		i++;
	}
}

void Phase8()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 18)
	{
		DeleteLocalInt(oToB, "L8" + IntToString(i));
		i++;
	}
}

void Phase9()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 10)
	{
		DeleteLocalInt(oToB, "L9" + IntToString(i));
		i++;
	}
}

void Phase10()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);

	DeleteLocalInt(oToB, "KnownManeuver1");
	DeleteLocalInt(oToB, "KnownManeuver2");
	DeleteLocalInt(oToB, "KnownManeuver3");
	DeleteLocalInt(oToB, "KnownManeuver4");
	DeleteLocalInt(oToB, "KnownManeuver5");
	DeleteLocalInt(oToB, "KnownManeuver6");
	DeleteLocalInt(oToB, "KnownManeuver7");
	DeleteLocalInt(oToB, "KnownManeuver8");
	DeleteLocalInt(oToB, "KnownManeuver9");
	DeleteLocalInt(oToB, "KnownManeuver10");
	DeleteLocalInt(oToB, "KnownManeuver11");
	DeleteLocalInt(oToB, "KnownManeuver12");
	DeleteLocalInt(oToB, "KnownManeuver13");
	DeleteLocalInt(oToB, "KnownManeuver14");
	DeleteLocalInt(oToB, "KnownManeuver15");
	DeleteLocalInt(oToB, "KnownManeuver16");
	DeleteLocalInt(oToB, "KnownManeuver17");
	DeleteLocalInt(oToB, "KnownManeuver18");
	DeleteLocalInt(oToB, "KnownManeuver19");
	DeleteLocalInt(oToB, "KnownManeuver20");
	DeleteLocalInt(oToB, "KnownManeuver21");
	DeleteLocalInt(oToB, "KnownManeuver22");
	DeleteLocalInt(oToB, "KnownManeuver23");
	DeleteLocalInt(oToB, "KnownManeuver24");
	DeleteLocalInt(oToB, "KnownManeuver25");
	DeleteLocalInt(oToB, "KnownManeuver26");
	DeleteLocalInt(oToB, "KnownManeuver27");
	DeleteLocalInt(oToB, "KnownManeuver28");
	DeleteLocalInt(oToB, "KnownManeuver29");
	DeleteLocalInt(oToB, "KnownManeuver30");
	DeleteLocalInt(oToB, "KnownManeuver31");
	DeleteLocalInt(oToB, "KnownManeuver32");
	DeleteLocalInt(oToB, "KnownManeuver33");
	DeleteLocalInt(oToB, "KnownManeuver34");
	DeleteLocalInt(oToB, "KnownManeuver35");
	DeleteLocalInt(oToB, "KnownManeuver36");
	DeleteLocalInt(oToB, "KnownManeuver37");
	DeleteLocalInt(oToB, "KnownManeuver38");
	DeleteLocalInt(oToB, "KnownManeuverTotal");
	DeleteLocalInt(oToB, "CurrentLevelupLevel");
	DeleteLocalInt(oToB, "LevelupClass");
	DeleteLocalInt(oToB, "LevelupStance");
	DeleteLocalInt(oToB, "LevelupRetrain");
	DeleteLocalInt(oToB, "RetrainManeuver");
	DeleteLocalInt(oToB, "FeatRetrainPhase");
	DeleteLocalInt(oToB, "FeatRetrainAmount");
	DeleteLocalInt(oToB, "AvialableToRetrain");
	DeleteLocalInt(oToB, "FeatRetrain1");
	DeleteLocalInt(oToB, "FeatRetrain2");
	DeleteLocalInt(oToB, "PendingFeat1");
	DeleteLocalInt(oToB, "PendingFeat2");
	DeleteLocalInt(oToB, "SSInsightSwitch");
	DeleteLocalInt(oToB, "MStudy1Pending");
	DeleteLocalInt(oToB, "MStudy2Pending");
	DeleteLocalInt(oToB, "MStudy3Pending");
	DeleteLocalInt(oToB, "MStance1Pending");
	DeleteLocalInt(oToB, "MStance2Pending");
	DeleteLocalInt(oToB, "MStance3Pending");
}

void Phase11()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	i = 1;

	while (i < 210)
	{
		DeleteLocalString(oToB, "AddedManeuver" + IntToString(i));
		i++;
	}
}

void main()
{
	object oOrigin = OBJECT_SELF;
	object oPC = GetControlledCharacter(oOrigin);
	string sToB = GetFirstName(oPC) + "tob";
	object oToB = GetObjectByTag(sToB);
	int i;

	if ((GetPause()) == TRUE)
	{
		SetPause(FALSE);
	}

	AssignCommand(oPC, Phase0()); //TMI prevention.
	AssignCommand(oPC, Phase1());
	AssignCommand(oPC, Phase2());
	AssignCommand(oPC, Phase3());
	AssignCommand(oPC, Phase4());
	AssignCommand(oPC, Phase5());
	AssignCommand(oPC, Phase6());
	AssignCommand(oPC, Phase7());
	AssignCommand(oPC, Phase8());
	AssignCommand(oPC, Phase9());
	AssignCommand(oPC, Phase10());
	AssignCommand(oPC, Phase11());
	AssignCommand(oPC, DetermineDisciplineStatus());
	
	SetGUITexture(oPC, "SCREEN_LEVELUP_MANEUVERS", "INFOPANE_IMAGE", "b_empty.tga");
	SetGUIObjectText(oPC, "SCREEN_LEVELUP_MANEUVERS", "INFOPANE_TITLE", -1, "");
	SetGUIObjectText(oPC, "SCREEN_LEVELUP_MANEUVERS", "INFOPANE_TEXT", -1, "");
	SetGUIObjectText(oPC, "SCREEN_LEVELUP_MANEUVERS", "RETRAIN_POOL_TEXT", -1, "0");
	SetGUITexture(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "INFOPANE_IMAGE", "b_empty.tga");
	SetGUIObjectText(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "INFOPANE_TITLE", -1, "");
	SetGUIObjectText(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "INFOPANE_TEXT", -1, "");
	SetGUIObjectText(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "RETRAIN_POOL_TEXT", -1, "0");
	SetGUIObjectDisabled(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "CHOICE_NEXT", FALSE);
	SetGUIObjectDisabled(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "CHOICE_FINISH", FALSE);
	ClearListBox(oPC, "SCREEN_LEVELUP_MANEUVERS", "ADDED_MANEUVER_LIST");
	ClearListBox(oPC, "SCREEN_LEVELUP_MANEUVERS", "AVAILABLE_MANEUVER_LIST");
	ClearListBox(oPC, "SCREEN_LEVELUP_MANEUVERS", "RETRAIN_MANEUVER_LIST");
	ClearListBox(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "RETRAIN_FEATS_LIST");
	ClearListBox(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "ADDED_RETRAIN_LIST");
	ClearListBox(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS", "AVAILABLE_RETRAIN_LIST");
	CloseGUIScreen(oPC, "SCREEN_LEVELUP_MANEUVERS");
	CloseGUIScreen(oPC, "SCREEN_LEVELUP_RETRAIN_FEATS");
}