//------------------------------------------------------------------------------------------------------------------------
//
// Б¦ёс         : АьБч°иєёµµ - SCALEFORM UI
//
//------------------------------------------------------------------------------------------------------------------------
class JobTreeWnd extends L2UIGFxScript;

var int targetCurrentSubjobClassID;
var bool isTargetNpc;

event OnRegisterEvent()
{
	RegisterEvent(EV_TargetUpdate);
}

event OnEvent(int a_EventID, string a_Param)
{
	switch(a_EventID)
	{
		case EV_TargetUpdate:
			OnTargetUpdate();
			break;
	}
}

event OnLoad()
{
	AddState("GAMINGSTATE");
	SetContainerWindow(WINDOWTYPE_DECO_NORMAL, 2704);
}

event OnCallUCFunction(string funcName, string param)
{
	switch(funcName)
	{
		case "ucExecuteCommand":
			ucExecuteCommand(param);
			break;
	}
}

private function OnTargetUpdate()
{
	if(! IsShowWindow("JobTreeWnd"))
	{
		return;
	}
	SetTargetCurrentSubjobClassID();
	CallGFxFunction("JobTreeWnd", "changeTargetClassID", "");
}

function SetTargetCurrentSubjobClassID()
{
	local UserInfo Info;

	if(! GetTargetInfo(Info))
	{
		return;
	}
	isTargetNpc = Info.bNpc;
	if(isTargetNpc)
	{
		targetCurrentSubjobClassID = Info.nClassID;		
	}
	else
	{
		targetCurrentSubjobClassID = Info.nSubClass;
	}
}

function ucExecuteCommand(string param)
{
	if(param == "")
	{
		return;
	}
	ExecuteCommand(param);
}
