class UICommonAPI extends UIConstants;

const EV_USER_CharacterSelectionChanged = 50000;

//FileWnd FileHandler TYPE
enum _FileHandler
{
	FH_NONE,
	FH_PLEDGE_CREST_UPLOAD,
	FH_PLEDGE_EMBLEM_UPLOAD,
	FH_ALLIANCE_CREST_UPLOAD,
	FH_WEBBROWSER_FILE_UPLOAD,
	FH_MAX
	// ЖДАПА©µµїмїЎј­ ЖДАПА» Гіё®ЗТ ЗФјцё¦ Б¤ЗП°н ЅНА»¶§ їлµµїЎ µы¶у ГЯ°ЎЗХЅГґЩ 
};

var bool bDoNotUseDebug;

static function UICommonAPI InstanceUICommonAPI()
{
	return UICommonAPI(GetScript("UICommonAPI"));
}

//ЖДАПА©µµїмё¦ єёї©БШґЩ. ЗЪµй·Їё¦ БцБ¤ЗП°н, 
//FileWnd.ucАЗ UploadЗФјцё¦ јцБ¤ЗШј­ ЖДАПµо·ПЅГ ЅЗЗаµЙ ЗФјцё¦ БцБ¤ЗШ БЦАЪ.
function FileRegisterWndShow(_FileHandler filehandlertype) 
{
	local FileRegisterWnd script;
	script = FileRegisterWnd(GetScript("FileRegisterWnd"));
	script.ShowFileRegisterWnd(filehandlertype);
}

function AddFileRegisterWndFileExt(string Str, array<string> strArray)
{
	local FileRegisterWnd script;

	script = FileRegisterWnd(GetScript("FileRegisterWnd"));
	script.AddFileExt(Str, strArray);
}

function ClearFileRegisterWndFileExt()
{
	local FileRegisterWnd script;

	script = FileRegisterWnd(GetScript("FileRegisterWnd"));
	script.ClearFileExt();
}

//ЖДАПА©µµїмё¦ јы°ЬБШґЩ
function FileRegisterWndHide()
{
	local FileRegisterWnd script;

	script = FileRegisterWnd(GetScript("FileRegisterWnd"));
	script.HideFileRegisterWnd();
}

//
// ґЩАМѕу·О±Чё¦ єёї©БШґЩ. strMessage : ЗФІІ єёї©БЩ ЅєЖ®ёµ(ї№ё¦µйѕо "°іјцё¦ АФ·ВЗШ БЦјјїд")
// №«Гґ °ЈґЬЗС ґЩАМѕу·О±Ч°Ў ѕЖґС АМ»у DialogSetID() °°АМ єТ·ЇБаѕЯ ЗСґЩ.
// 
//  - ґЩАМѕу·О±Ч ±вґЙ ГЯ°Ў - 
//
// dialogHeight : ґЩАМѕу·О±Ч јј·О »зАМБо, 0 , -1 °°АМ 0єёґЩ АЫАє °ЄА» іЦАёёй ±вє» »зАМБо·О јјЖГµИґЩ.
// bUseHtml : true ¶уёй, strMessage і»їлА» html ЕЧ±Чё¦ »зїл ЗТјц АЦ°Ф µИґЩ. <html><body> .. ґВ іЦА» ЗКїд ѕшґЩ
// 
// isXMLOKDialogShow : ЗцАз »зїлЗПБц ѕК°н АЦАЅ, XML ґЩАМѕу·О±Чё¦ єёї©БЩ°НАО°Ў?, ±вБё UIµйА» ЅєДЙАПЖы Effect UI [И®АО] Аё·О єЇ°ж --
//
// БЯ±№ №цАьїЎј­ °ЎБ®їИ, param ГЯ°Ў dialogWeight
static function DialogShow(EDialogModalType modalType, EDialogType dialogType, string strMessage, string strControlName, optional int dialogWeight, optional int dialogHeight, optional bool bUseHtml, optional string customIconTexture)//, optional bool isXMLOKDialogShow)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.ShowDialog(modalType, dialogType, strMessage, strControlName, dialogWeight, dialogHeight, bUseHtml);
	if(customIconTexture != "")
	{
		script.SetIconTexture(customIconTexture);
	}
}

static function DialogSetCancelD(int targetCancelDialogID)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetDialogCancelD(targetCancelDialogID);
}

//ґЩАМѕу·О±Ч №цЖ° АМё§ јцБ¤
static function DialogSetButtonName(int indexOK, optional int indexCancel)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetButtonName(indexOK, indexCancel);
}

//ґЩАМѕу·О±Ч №цЖ° °Ў·О»зАМБо јцБ¤
static function DialogSetButtonWidthSize(int indexOK, optional int indexCancel)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetButtonWidthSize(indexOK, indexCancel);
}

// іфАМ єЇ°ж °ЎґЙЗС ґЩАМѕу·О±Ч
static function DialogShowWithResize(EDialogModalType modalType, EDialogType dialogType, string strMessage, int changeWidth, int changeHeight, string strControlName)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.ShowDialog(modalType, dialogType, strMessage, strControlName, changeWidth, changeHeight);
}

// ґЩАМѕу·О±Чё¦ °ЁГбґЩ. ґЩАМѕу·О±Ч°Ў ¶° АЦґВ »уИІїЎј­ ґЩёҐ ґЩАМѕу·О±Чё¦ єёї©БЦ·Бёй DialogHide() ё¦ ёХАъ ИЈГвЗШѕЯЗСґЩ.
static function DialogHide()
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.HideDialog();
}

// ґЩАМѕу·О±Ч°Ў ѕо¶І µїАЫА» ГлЗТБцё¦ default °ЄА» Б¤ЗШБЦґВ °НАё·О 
// ЗС№ш »зїлµЗ°ніЄёй ГК±вИ­ µЗ№З·О µрЖъЖ® ѕЧјЗА» OK·О ЗП°нЅНАёёй ёЕ№ш ґЩАМѕу·О±Ч ¶зїп ¶§ ё¶ґЩ єТ·ЇБаѕЯЗСґЩ.
static function DialogSetDefaultOK()
{
	local DialogBox script;
	script = DialogBox(GetScript("DialogBox"));
	script.SetDefaultAction(EDefaultOK);
}

//±Ч№Эґл·О cancel·О АОЅДЗСґЩ
static function DialogSetDefaultCancle()
{
	local DialogBox script;
	script = DialogBox(GetScript("DialogBox"));
	script.SetDefaultAction(EDefaultCancel);
}

// їЈЕНЕ° ґ©ёЈёй ґЩАМѕу·О±Ч µїАЫАє №«ЅГ
static function DialogSetEnterDoNothing()
{
	local DialogBox script;
	script = DialogBox(GetScript("DialogBox"));
	script.SetEnterAction(EEnterDoNothing);
}

// їЈЕНЕ° ґ©ёЈёй ґЩАМѕу·О±Ч µїАЫАє Ok
static function DialogSetEnterOK()
{
	local DialogBox script;
	script = DialogBox(GetScript("DialogBox"));
	script.SetEnterAction(EEnterOK);
}

// їЈЕНЕ° ґ©ёЈёй ґЩАМѕу·О±Ч µїАЫАє Cancel
static function DialogSetEnterCancle()
{
	local DialogBox script;
	script = DialogBox(GetScript("DialogBox"));
	script.SetEnterAction(EEnterCancel);
}

// EV_DialogOK µоАЗ ґЩАМѕу·О±Ч АМєҐЖ®°Ў їФА» ¶§, АМ ґЩАМѕу·О±Ч°Ў АЪЅЕАМ ¶зїо ґЩАМѕу·О±Ч АОБцё¦ ЖЗє°ЗТ ¶§ ѕІАОґЩ. іІАМ ¶зїо ґЩАМѕу·О±Ч¶уёй ЅЕ°жѕµ ЗКїд°Ў ѕшґЩ~
function bool DialogIsMine()
{
	local DialogBox script;

	// Debug("dialog" @ string(Self));
	script = DialogBox(GetScript("DialogBox"));
	if(script.GetTarget() == string(self))
	{
		return true;
	}
	return false;
}

// ґЩАМѕу·О±Ч
function bool DialogHasPreviousCancelProcess()
{
	local DialogBox script;

	// Debug("dialog" @ string(Self));
	script = DialogBox(GetScript("DialogBox"));

	return script.HasPreviousCancelProcess();
}

function bool DialogCheckCancelByID(int targetDialogID)
{
	local DialogBox script;

	script = DialogBox(GetScript("dialogbox"));
	return script.CheckCancelDialogID(targetDialogID);
}

function _DialogShowHtml(EDialogModalType modalType, EDialogType dialogType, string strMessage, string strControlName, optional int dialogWeight, optional int dialogHeight, optional bool bUseHtml, optional string customIconTexture)
{
	local string htmlStr, iconStr;

	if(customIconTexture == "")
	{
		customIconTexture = "L2UI_ct1.Icon.ICON_DF_Exclamation";
	}
	iconStr = "<img src=\"" $ customIconTexture $ "\" width=32 height=32>";
	htmlStr = "<table><tr><td valign=\"top\">" $ iconStr $ "</td><td valign =\"top\" height=\"80\">" $ strMessage $ "</td></tr></table>";
	DialogShow(modalType, dialogType, htmlStr, strControlName, dialogWeight, dialogHeight, true);	
}

// UICommonAPIё¦ »ујУ№ЮБц ѕКАє Е¬·ЎЅєїЎј­µµ »зїлЗП±в А§ЗШ ГЯ°Ў. ї№: GFx ЅєЕ©ёіЖ®
static function bool DialogIsOwnedBy(string Owner)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	if(script.GetTarget() == Owner)
	{
		return true;
	}
	return false;
}

// ЗС°іАЗ ucїЎј­ ґЩАМѕу·О±Чё¦ ЗС№шёё ¶зїоґЩёй ѕµ ЗКїд°Ў ѕш°ЪБцёё, ґЩАМѕу·О±Чё¦ ї©·Ї »уИІїЎј­ ѕґґЩёй, ї№ё¦ µйѕо ЗчёН.ucїЎј­  ЗчїшѕЖАМµрё¦ №ЇґВµҐµµ ѕІ°н
// Зчїш ИЈДЄА» АФ·В №ЮґВ µҐµµ »зїлЗСґЩёй, ґЩАМѕу·О±Ч АМєҐЖ®°Ў їФА»¶§ АЪЅЕАМ ѕо¶І ґЩАМѕу·О±Чё¦ ¶зїьґВБцё¦ ѕЛ ЗКїд°Ў АЦґЩ.
// АМ·І °жїм ґЩАМѕу·О±Чё¦ ¶зїп ¶§ АыАэЗП°Ф ѕЖ№« јэАЪіЄ DialogSetID() ЗШ БЦ°н АМєҐЖ® Гіё® єОєРїЎј­ DialogGetID()ё¦ ЗШј­ ±ЧїЎ ёВ°Ф ДЪµеё¦ ВҐёйµИґЩ.
static function DialogSetID(int Id)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.setId(Id);
}

// ґЩАМѕо·О±ЧАЗ їЎµрЖ® №ЪЅєАЗ АФ·В ЕёАФА» БцБ¤ЗШ БЩ јц АЦґЩ. АП№Э №®АЪї­, јэАЪ, ЖРЅєїцµе µо, XML ЗБ·ОЕдДЭ №®ј­ ВьБ¶.
static function DialogSetEditType(string strType)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetEditType(strType);
}

// ґЩАМѕу·О±ЧАЗ їЎµрЖ®№ЪЅєїЎ АФ·ВµИ ЅєЖ®ёµА» №ЮѕЖїВґЩ
static function string DialogGetString()
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	return script.GetEditMessage();
}

// ґЩАМѕу·О±ЧАЗ їЎµрЖ®№ЪЅєїЎ ЅєЖ®ёµА» АФ·ВЗСґЩ
static function DialogSetString(string strInput)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetEditMessage(strInput);
}

static function int DialogGetID()
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	return script.GetID();
}

// ParamIntґВ ґЩАМѕу·О±ЧАЗ µїАЫ°ъ °ь·ГµИ »ујцµйА» БцБ¤ЗШ БЦґВµҐ ѕІАОґЩ. ProgressАЗ timeup ЅГ°Ј, NumberPadїЎј­ max°Є µо.
static function DialogSetParamInt64(INT64 param)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.setParamInt64(param);
}

// ReservedXXX °ЄµйАє ґЩАМѕу·О±ЧїЎ іЦѕоіщґЩ°Ў ґЩЅГ ІЁі» єј јц АЦґЩґВ БЎїЎј­ ParamXXXїНґВ ґЩёЈґЩ.
static function DialogSetReservedInt(int Value)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetReservedInt(Value);
}

static function DialogSetReservedInt2(INT64 Value)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetReservedInt2(Value);
}

static function DialogSetReservedInt3(int Value)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetReservedInt3(Value);
}

static function DialogSetReservedItemID(ItemID Id)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetReservedItemID(Id);
}

static function DialogSetReservedItemInfo(ItemInfo Info)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetReservedItemInfo(Info);
}

static function int DialogGetReservedInt()
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	return script.GetReservedInt();
}

static function INT64 DialogGetReservedInt2()
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	return script.GetReservedInt2();
}

static function int DialogGetReservedInt3()
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	return script.GetReservedInt3();
}

static function ItemID DialogGetReservedItemID()
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	return script.GetReservedItemID();
}

static function DialogGetReservedItemInfo(out ItemInfo Info)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.GetReservedItemInfo(Info);
}

static function DialogSetEditBoxMaxLength(int MaxLength)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetEditBoxMaxLength(MaxLength);
}

static function DialogSetIconTexture(string iconTextureStr)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetIconTexture(iconTextureStr);
}

static function DialogSetIconCustomToolTip(CustomTooltip toolTipInfo)
{
	local DialogBox script;

	script = DialogBox(GetScript("DialogBox"));
	script.SetIconCustomToolTip(toolTipInfo);
}

static function DialogSetInputlimit(INT64 inputLimit)
{
	class'DialogBox'.static.Inst().inputLimit = inputLimit;
}

static function int Split(string strInput, string delim, out array<string> arrToken)
{
	local int arrSize;

	while(InStr(strInput, delim) > 0)
	{
		arrToken.Insert(arrToken.Length, 1);
		arrToken[arrToken.Length - 1] = Left(strInput, InStr(strInput, delim));
		strInput = Mid(strInput, InStr(strInput, delim) + 1);
		arrSize = arrSize + 1;
	}
	arrToken.Insert(arrToken.Length, 1);
	arrToken[arrToken.Length - 1] = strInput;
	arrSize = arrSize + 1;
	return arrSize;
}

function ShowWindow(string a_ControlID)
{
	class'UIAPI_WINDOW'.static.ShowWindow(a_ControlID);
}

/** А©µµїмё¦, ї­°н ґЭ°н ЗПґВ ЗФјц */
function toggleWindow(string a_ControlID, optional bool bFocus, optional bool bUseOpenCloseSound)
{
	if(class'UIAPI_WINDOW'.static.IsShowWindow(a_ControlID))
	{
		if(bUseOpenCloseSound)
		{
			PlayConsoleSound(IFST_WINDOW_CLOSE);
		}
		class'UIAPI_WINDOW'.static.HideWindow(a_ControlID);
	}
	else
	{
		if(bUseOpenCloseSound)
		{
			PlayConsoleSound(IFST_WINDOW_CLOSE);
		}
		if(class'MinimizeManager'.static.Inst()._IsMin(a_ControlID))
		{
			class'MinimizeManager'.static.Inst()._MaximizeWindow(a_ControlID);			
		}
		else
		{
			class'UIAPI_WINDOW'.static.ShowWindow(a_ControlID);
		}
		if(bFocus)
		{
			class'UIAPI_WINDOW'.static.SetFocus(a_ControlID);
		}
	}
}

function ShowWindowWithFocus(string a_ControlID)
{
	class'UIAPI_WINDOW'.static.ShowWindow(a_ControlID);
	class'UIAPI_WINDOW'.static.SetFocus(a_ControlID);
}
static function string reverseString(coerce string Str)
{
	local string reverseStr;
	local int i;
	for (i = Len(str) - 1; i >= 0; --i)
	{
		reverseStr = reverseStr $ Mid(Str, i, 1);
	}

	return reverseStr;
}

static final function ReplaceText (out string Text, string Replace, string With)
{
	local int i;
	local string Input;

	if ((Text == "") || (Replace == ""))
	{
		return;
	}
	Input = Text;
	Text = "";
	i = InStr(Input, Replace);
	while(i != -1)
	{
		Text = Text $ Left(Input, i) $ With;
		Input = Mid(Input, i + Len(Replace));
		i = InStr(Input, Replace);
	}
	Text = Text $ Input;
}

static function string trim(string S)
{
	local int i;
	if(Len(S) == 0)
	{
		return S;
	}
	i = 0;
	while (Mid(s,i,1) == " " || Mid(s,i,1) == "\t")		//necessary for adding tab
		++i;

	S = Right(S, Len(S)-i);
	
	if(Len(S) == 0)
	{
		return S;
	}

	i = Len(S) - 1;

	while (Mid(S, i, 1) == " " || Mid(S, i, 1) == "\t")	//necessary for adding tab
		--i;

	S = Left(S, i + 1);

	return S;
}

static function string trimParam(string S)
{
	local int i;
	if(Len(S) == 0)
	{
		return S;
	}
	i = 0;
	while(Mid(S, i, 1) == " " || Mid(S, i, 1) == Chr(127))		//necessary for adding tab
	{
		++i;
	}

	S = Right(S, Len(S) - i);
	
	if(Len(S) == 0)
	{
		return S;
	}

	i = Len(S) - 1;

	while(Mid(S, i, 1) == " " || Mid(S, i, 1) == Chr(127))	//necessary for adding tab
	{
		--i;
    }

	S = Left(S, i + 1);

	return S;
}


static function string deleteEnter(string s)
{
	local int i;
	if (Len(s) == 0) return s;
	i = 0;

	// ДЪµе 13, \n °ЄАМёй
	while (Mid(s,i,1) == Chr(13) || Mid(s,i,1) == Chr(10))
		++i;

	s = Right(s,Len(s)-i);
	
	if (Len(s) == 0) return s;

	i = Len(s) - 1;

	while (Mid(s,i,1) == Chr(13) || Mid(s,i,1) == Chr(10))
		--i;

	s = Left(s, i + 1);

	return s;
}

static function int InStrFromBack(string s, string t)
{
	local string reverseStr;
	local int i;
	reverseStr = reverseString(s);
	i = InStr(reverseStr, t);

	if (i >= 0)
		return Len(s) - 1 - i;
	else
		return i;
}

static function int InStrFromBack2(string S, string t)
{
	local string reverseStr;
	local int i;

	reverseStr = reverseString(S);
	i = InStr(reverseStr, reverseString(t));
	if(i >= 0)
	{
		return (Len(S) - 1) - i;		
	}
	else
	{
		return i;
	}	
}

function HideWindow(string a_ControlID)
{
	class'UIAPI_WINDOW'.static.HideWindow(a_ControlID);
}

function bool IsShowWindow(string a_ControlID)
{
	return class'UIAPI_WINDOW'.static.IsShowWindow(a_ControlID);
}

function ParamToRecord(string param, out LVDataRecord Record)
{
	local int idx, MaxColumn;

	ParseString(param, "szReserved", Record.szReserved);
	ParseINT64(param, "nReserved1", Record.nReserved1);
	ParseINT64(param, "nReserved2", Record.nReserved2);
	ParseINT64(param, "nReserved3", Record.nReserved3);

	ParseInt(param, "MaxColumn", MaxColumn);
	Record.LVDataList.Length = MaxColumn;
	for (idx = 0; idx < MaxColumn; idx++)
	{
		ParseString(param, "szData_" $ idx, Record.LVDataList[idx].szData);
		ParseString(param, "szReserved_" $ idx, Record.LVDataList[idx].szReserved);
		ParseInt(param, "nReserved1_" $ idx, Record.LVDataList[idx].nReserved1);
		ParseInt(param, "nReserved2_" $ idx, Record.LVDataList[idx].nReserved2);
		ParseInt(param, "nReserved3_" $ idx, record.LVDataList[idx].nReserved3);
	}
}

/** 
 *  12.07.05 toopTipWidth ГЯ°Ў - ЕшЖБ°Ў·О»зАМБо јіБ¤, toopTipWidth јіБ¤ЗПёй t_bDrawOneLine true °Ў false ·О јіБ¤µК 
 */
function CustomTooltip MakeTooltipSimpleText(string Text, optional int toolTipWidth)
{
	local CustomTooltip ToolTip;
	local DrawItemInfo Info;
	local bool oneline;

	oneline = true;
	if(toolTipWidth > 0)
	{
		oneline = false;
	}
	ToolTip.DrawList.Length = 1;
	ToolTip.MinimumWidth = toolTipWidth;
	Info.eType = DIT_TEXT;
	Info.t_bDrawOneLine = oneline;
	Info.t_color.R = 230;
	Info.t_color.G = 230;
	Info.t_color.B = 230;
	Info.t_color.A = 255;
	Info.t_strText = Text;
	ToolTip.DrawList[0] = Info;

	return ToolTip;
}

/** 
 *  ЕшЖБїЎ Д®¶у Аыїл
 */
function CustomTooltip MakeTooltipSimpleColorText(string Text, Color TextColor, optional string FontName, optional int toolTipWidth)
{
	local CustomTooltip ToolTip;

	local bool oneline;

	oneline = true;
	if(toolTipWidth > 0)
	{
		oneline = false;
	}
	ToolTip.MinimumWidth = toolTipWidth;
	ToolTip.DrawList[0] = addDrawItemText(Text, TextColor, FontName, oneline);
	return ToolTip;
}

/** 
   ёЦЖј ¶уАО, ДїЅєЕТ ЕшЖБ (»уЗПАМЖАїЎј­ ёёµз °Н)
   
   
   ex)
   		SetTooltipCustomType(MakeTooltipMultiText("1 ЕЧЅєЖ® ЗЧёс", getInstanceL2Util().Yellow, "HS15",false,
												  "2 ЕЧЅєЖ® ЗЧёс", getInstanceL2Util().Yellow, "",true,
												  "3 ЕЧЅєЖ® ЗЧёс", getInstanceL2Util().Blue, "HS12",true));
 */
function CustomTooltip MakeTooltipMultiText(string line1text, Color text1Color, optional string font1Name, optional bool bLine1Break, optional string line2text, optional Color text2Color, optional string font2Name, optional bool bLine2Break, optional string line3text, optional Color text3Color, optional string font3Name, optional bool bLine3Break, optional int toolTipWidth)
{
	local CustomTooltip ToolTip;
	local int countLength, textWidth, textHeight, maxTextWidth;

	countLength = 0;

	if(font1Name == "")
	{
		font1Name = "GameDefault";
	}
	if(font2Name == "")
	{
		font2Name = "GameDefault";
	}
	if(font3Name == "")
	{
		font3Name = "GameDefault";
	}
	if(line1text != "")
	{
		countLength++;
		GetTextSize(line1text, font1Name, textWidth, textHeight);
		if(textWidth > maxTextWidth)
		{
			maxTextWidth = textWidth;
		}
	}
	if(line2text != "")
	{
		countLength++;
		GetTextSize(line2text, font2Name, textWidth, textHeight);
		if(textWidth > maxTextWidth)
		{
			maxTextWidth = textWidth;
		}
	}
	if(line3text != "")
	{
		countLength++;
		GetTextSize(line3text, font3Name, textWidth, textHeight);
		if(textWidth > maxTextWidth)
		{
			maxTextWidth = textWidth;
		}
	}
	ToolTip.DrawList.Length = countLength;
	if(toolTipWidth > 0)
	{
		ToolTip.MinimumWidth = toolTipWidth;
	}
	else
	{
		ToolTip.MinimumWidth = maxTextWidth + 1;
	}
	if(line1text != "")
	{
		ToolTip.DrawList[0] = addDrawItemText(line1text, text1Color, font1Name, bLine1Break);
	}
	if(line2text != "")
	{
		ToolTip.DrawList[1] = addDrawItemText(line2text, text2Color, font2Name, bLine2Break);
	}
	if(line3text != "")
	{
		ToolTip.DrawList[2] = addDrawItemText(line3text, text3Color, font3Name, bLine3Break);
	}
	return ToolTip;
}

function CustomTooltip MakeTooltipMultiTextByArray(array<DrawItemInfo> drawItemInfoArr, optional int toolTipWidth)
{
	local CustomTooltip ToolTip;

	ToolTip.DrawList = drawItemInfoArr;
	if(toolTipWidth > 0)
	{
		ToolTip.MinimumWidth = toolTipWidth;
	}
	return ToolTip;
}


/**
 *  ЕшЖБ ЗЧёс ГЯ°Ўїл
 **/
function DrawItemInfo addDrawItemText(string Text, Color TextColor, optional string FontName, optional bool bLineBreak, optional bool oneline, optional int OffsetX, optional int OffsetY, optional int MaxWidth)
{
	local DrawItemInfo Info;
	local array<TextSectionInfo> TextInfos;
	local string FullText;

	Info.eType = DIT_TEXT;
	Info.t_color.R = TextColor.R;
	Info.t_color.G = TextColor.G;
	Info.t_color.B = TextColor.B;
	Info.t_color.A = TextColor.A;
	GetItemTextSectionInfos(Text, FullText, TextInfos);
	if(TextInfos.Length > 0)
	{
		Text = FullText;
		Info.t_SectionList = TextInfos;
	}
	Info.t_strText = Text;
	if(MaxWidth > 0)
	{
		Info.t_MaxWidth = MaxWidth;
	}
	Info.t_bDrawOneLine = oneline;
	Info.bLineBreak = bLineBreak;
	Info.nOffSetX = OffsetX;
	Info.nOffSetY = OffsetY;
	if(FontName != "")
	{
		Info.t_strFontName = FontName;
	}

	return Info;
}

function DrawItemInfo addDrawItemText_DIAT_Right(string Text, Color TextColor, optional string FontName, optional bool bLineBreak, optional bool oneline, optional int OffsetX, optional int OffsetY, optional int MaxWidth)
{
	local DrawItemInfo Info;
	local array<TextSectionInfo> TextInfos;
	local string FullText;

	Info.eType = DIT_TEXT;
	Info.t_color.R = TextColor.R;
	Info.t_color.G = TextColor.G;
	Info.t_color.B = TextColor.B;
	Info.t_color.A = TextColor.A;
	GetItemTextSectionInfos(Text, FullText, TextInfos);
	if(TextInfos.Length > 0)
	{
		Text = FullText;
		Info.t_SectionList = TextInfos;
	}
	Info.t_strText = Text;
	if(MaxWidth > 0)
	{
		Info.t_MaxWidth = MaxWidth;
	}
	Info.t_bDrawOneLine = oneline;
	Info.bLineBreak = bLineBreak;
	Info.nOffSetX = OffsetX;
	Info.nOffSetY = OffsetY;
	Info.eAlignType = DIAT_RIGHT;
	if(FontName != "")
	{
		Info.t_strFontName = FontName;
	}
	return Info;	
}

function DrawItemInfo addDrawItemText_DIAT_CENTER(string Text, Color TextColor, optional string FontName, optional bool bLineBreak, optional bool oneline, optional int OffsetX, optional int OffsetY, optional int MaxWidth)
{
	local DrawItemInfo Info;
	local array<TextSectionInfo> TextInfos;
	local string FullText;

	Info.eType = DIT_TEXT;
	Info.t_color.R = TextColor.R;
	Info.t_color.G = TextColor.G;
	Info.t_color.B = TextColor.B;
	Info.t_color.A = TextColor.A;
	GetItemTextSectionInfos(Text, FullText, TextInfos);
	if(TextInfos.Length > 0)
	{
		Text = FullText;
		Info.t_SectionList = TextInfos;
	}
	Info.t_strText = Text;
	if(MaxWidth > 0)
	{
		Info.t_MaxWidth = MaxWidth;
	}
	Info.t_bDrawOneLine = oneline;
	Info.bLineBreak = bLineBreak;
	Info.nOffSetX = OffsetX;
	Info.nOffSetY = OffsetY;
	Info.eAlignType = DIAT_CENTER;
	if(FontName != "")
	{
		Info.t_strFontName = FontName;
	}
	return Info;	
}

function DrawItemInfo addDrawItemFormatText(string Text, Color TextColor, optional string FontName, optional bool bLineBreak, optional bool oneline, optional int OffsetX, optional int OffsetY)
{
	local DrawItemInfo Info;

	Info.eType = DIT_FORMATTEXT;
	Info.t_color.R = TextColor.R;
	Info.t_color.G = TextColor.G;
	Info.t_color.B = TextColor.B;
	Info.t_color.A = TextColor.A;
	Info.t_strText = Text;
	Info.t_bDrawOneLine = oneline;
	Info.bLineBreak = bLineBreak;
	Info.nOffSetX = OffsetX;
	Info.nOffSetY = OffsetY;
	if(FontName != "")
	{
		Info.t_strFontName = FontName;
	}
	return Info;
}

function DrawItemInfo addDrawItemTexture(string Texture, optional bool OneLine, optional bool bLineBreak, optional int offSetX, optional int offSetY)
{
	local DrawItemInfo Info;
	Info.eType = DIT_TEXTURE;
	Info.t_bDrawOneLine = OneLine;
	Info.bLineBreak = bLineBreak;
	Info.u_nTextureWidth = 16;
	Info.u_nTextureHeight = 16;
	Info.nOffSetX = offSetX;
	Info.nOffSetY = offSetY;
	Info.u_nTextureUWidth = 32;
	Info.u_nTextureUHeight = 32;
	Info.u_strTexture = Texture;
	
	return Info;
}

function DrawItemInfo addDrawItemTextureCustom(string Texture, optional bool OneLine, optional bool bLineBreak, optional int offSetX, optional int offSetY, optional int u_nTextureWidth, optional int u_nTextureHeight, optional int u_nTextureUWidth, optional int u_nTextureUHeight)
{
	local DrawItemInfo Info;
	Info.eType = DIT_TEXTURE;
	Info.t_bDrawOneLine = OneLine;
	Info.bLineBreak = bLineBreak;
	Info.u_nTextureWidth = u_nTextureWidth;
	Info.u_nTextureHeight = u_nTextureHeight;
	Info.nOffSetX = offSetX;
	Info.nOffSetY = offSetY;
	Info.u_nTextureUWidth = u_nTextureUWidth;
	Info.u_nTextureUHeight = u_nTextureUHeight;
	Info.u_strTexture = Texture;
	
	return Info;
}

function addDrawItemGameItem(out array<DrawItemInfo> drawListArr, ItemInfo Info, optional bool userCount, optional Color tColor, optional int posX, optional int posY, optional int u_nTextureWidth, optional int u_nTextureHeight, optional int u_nTextureUWidth, optional int u_nTextureVHeight)
{
	local Color applyColor;

	if(tColor.R == 0 && tColor.G == 0 && tColor.B == 0 && tColor.A == 0)
	{
		applyColor = getInstanceL2Util().White;
	}
	else
	{
		applyColor = tColor;
	}
	if((u_nTextureWidth + u_nTextureHeight) == 0)
	{
		u_nTextureWidth = 32;
		u_nTextureHeight = 32;
	}
	if((u_nTextureUWidth + u_nTextureVHeight) == 0)
	{
		u_nTextureUWidth = 32;
		u_nTextureVHeight = 32;
	}
	drawListArr[drawListArr.Length] = addDrawItemTextureCustom(Info.IconName, true, false, posX, posY, u_nTextureWidth, u_nTextureHeight, u_nTextureUWidth, u_nTextureVHeight);
	if(Info.IconPanel != "")
	{
		drawListArr[drawListArr.Length] = addDrawItemTextureCustom(Info.IconPanel, true, false, - u_nTextureWidth, 0, u_nTextureHeight, u_nTextureHeight, u_nTextureUWidth, u_nTextureVHeight);
	}
	drawListArr[drawListArr.Length] = addDrawItemText(GetItemNameAll(Info), applyColor, "", false, true, 4, u_nTextureHeight / 5);
	if(userCount)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(" x" $ string(Info.ItemNum), applyColor, "", false, true, 0, u_nTextureHeight / 5);
	}
	drawListArr[drawListArr.Length] = addDrawItemBlank(2);
}

function addDrawItemGameItemColorFul(out array<DrawItemInfo> drawListArr, ItemInfo Info, optional bool userCount, optional Color tColor, optional int posX, optional int posY, optional int u_nTextureWidth, optional int u_nTextureHeight, optional int u_nTextureUWidth, optional int u_nTextureVHeight)
{
	local Color applyColor;

	if(tColor.R == 0 && tColor.G == 0 && tColor.B == 0 && tColor.A == 0)
	{
		applyColor = getInstanceL2Util().White;		
	}
	else
	{
		applyColor = tColor;
	}
	if((u_nTextureWidth + u_nTextureHeight) == 0)
	{
		u_nTextureWidth = 32;
		u_nTextureHeight = 32;
	}
	if((u_nTextureUWidth + u_nTextureVHeight) == 0)
	{
		u_nTextureUWidth = 32;
		u_nTextureVHeight = 32;
	}
	drawListArr[drawListArr.Length] = addDrawItemTextureCustom(Info.IconName, true, false, posX, posY, u_nTextureWidth, u_nTextureHeight, u_nTextureUWidth, u_nTextureVHeight);
	if(Info.IconPanel != "")
	{
		drawListArr[drawListArr.Length] = addDrawItemTextureCustom(Info.IconPanel, true, false, - u_nTextureWidth, 0, u_nTextureHeight, u_nTextureHeight, u_nTextureUWidth, u_nTextureVHeight);
	}
	addDrawItemGameItemNameAll(drawListArr, Info, 4, u_nTextureHeight / 5);
	if(userCount)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(" x" $ string(Info.ItemNum), applyColor, "", false, true, 0, u_nTextureHeight / 5);
	}
	drawListArr[drawListArr.Length] = addDrawItemBlank(2);	
}

function addDrawItemGameItemNameAll(out array<DrawItemInfo> drawListArr, ItemInfo item, optional int posX, optional int posY, optional string FontName)
{
	local string ItemName;
	local Color applyColor;
	local int nAddTooltipItemName, posXAdd, posYadd;

	posXAdd = posX;
	posYadd = posY;
	if(item.Enchanted > 0)
	{
		drawListArr[drawListArr.Length] = addDrawItemText("+" $ string(item.Enchanted), GetColor(170, 110, 230, 255), FontName, false, false, posXAdd, posYadd);
		posXAdd = 0;
		posYadd = 0;
	}
	if(item.IsBlessedItem)
	{
		ItemName = GetSystemString(13403) $ " ";
		drawListArr[drawListArr.Length] = addDrawItemText(ItemName, getInstanceL2Util().Blue, FontName, false, false, posXAdd, posYadd);
		posXAdd = 0;
		posYadd = 0;
	}
	if(getInstanceUIData().getIsLiveServer())
	{
		ItemName = class'UIDATA_ITEM'.static.GetRefineryItemName(item.Name, item.RefineryOp1, item.RefineryOp2);		
	}
	else
	{
		ItemName = item.Name;
	}
	nAddTooltipItemName = class'UIDATA_ITEM'.static.GetItemNameClass(item.Id);
	switch(nAddTooltipItemName)
	{
		case 0:
			applyColor = GetColor(137, 137, 137, 255);
			break;
		case 1:
			applyColor = GetColor(230, 230, 230, 255);
			break;
		case 2:
			applyColor = GetColor(255, 251, 4, 255);
			break;
		case 3:
			applyColor = GetColor(240, 68, 68, 255);
			break;
		case 4:
			applyColor = GetColor(33, 164, 255, 255);
			break;
		case 5:
			applyColor = GetColor(255, 0, 255, 255);
			break;
	}
	drawListArr[drawListArr.Length] = addDrawItemText(ItemName, applyColor, FontName, false, false, posXAdd, posYadd);
	if(Len(item.AdditionalName) > 0)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(" " $ item.AdditionalName, GetColor(255, 217, 105, 255), FontName, false, false, posXAdd, posYadd);
	}	
}

//єу°ш°ЈАЗ TooltipItemА» ГЯ°ЎЗСґЩ.
function DrawItemInfo addDrawItemBlank(int Height)
{
	local DrawItemInfo Info;

	Info.eType = DIT_BLANK;
	Info.b_nHeight = Height;

	return Info;
}

// ЕшЖБ DrawList ГЯ°Ўїл  
function addToolTipDrawList(out CustomTooltip cTooltip, DrawItemInfo DrawItemInfoElement)
{
	cTooltip.DrawList[cTooltip.DrawList.Length] = DrawItemInfoElement;
}


// БЩ ±Чё®±в, ГЦјТ »зАМБоё¦ БцБ¤ °ЎґЙЗПµµ·П јцБ¤
function DrawItemInfo AddCrossLineForCustomToolTip(optional int minimum_width)
{
	local DrawItemInfo Info;
	Info.eType = DIT_SPLITLINE;
	Info.u_nTextureWidth = minimum_width;
	Info.u_nTextureHeight = 1;
	Info.u_strTexture = "L2ui_ch3.tooltip_line";
	return Info;
}


function setCustomToolTipMinimumWidth (out CustomTooltip m_Tooltip)
{
	m_Tooltip.MinimumWidth = customToolTipGetMaxWidth(m_Tooltip);
	customToolTipLineWidthRefresh(m_Tooltip);
}

function customToolTipLineWidthRefresh(out CustomTooltip m_Tooltip)
{
	local int i;

	for (i = 0; i < m_Tooltip.DrawList.Length; i++)
	{
		if(m_Tooltip.DrawList[i].eType == DIT_SPLITLINE)
		{
			m_Tooltip.DrawList[i].u_nTextureWidth = m_Tooltip.MinimumWidth;
			
		}
	}
}

function int customToolTipGetMaxWidth(CustomTooltip m_Tooltip) 
{
	local int i, Width, Height, MaxWidth, tmpWidth;

	MaxWidth = m_Tooltip.MinimumWidth;

	for (i = 0 ; i < m_Tooltip.DrawList.Length ; i ++)
	{
		//Debug("getMaxWidth" @ i @ m_Tooltip.DrawList[i].eType);
		
		if(m_Tooltip.DrawList[i].eType == DIT_TEXT || m_Tooltip.DrawList[i].eType == DIT_TEXTLINK)
		{
			//ЗС БЩАП ¶§ ёё Гв·В ±Ч їЬїЎґВ АЪµї µйї©ѕІ±в ±вґЙАё·О Гіё® µК.
			if(m_Tooltip.DrawList[i].t_bDrawOneLine)
			{
				GetTextSizeDefault(m_Tooltip.DrawList[i].t_strText, Width, Height);
				//bLineBreak Гіё® µЗБц ѕКґВ °жїм ґЩАЅ БЩ·О іСѕо°ЎБц ѕКАЅ.
				if(! m_Tooltip.DrawList[i].bLineBreak)
				{
					Width = Width + tmpWidth;
				}
				//Debug ("getMaxWidth2" @ Width @  m_Tooltip.DrawList[i].t_strText);
			}			
		}
		else if (m_Tooltip.DrawList[i].eType == DIT_TEXTURE || m_Tooltip.DrawList[i].eType == DIT_SPLITLINE) 
		{
			if(m_Tooltip.DrawList[i].t_bDrawOneLine)
			{
				Width = m_Tooltip.DrawList[i].u_nTextureWidth;
				if(! m_Tooltip.DrawList[i].bLineBreak)
				{
					Width = tmpWidth + Width;
				}
			}
		}

		Width = Width + m_Tooltip.DrawList[i].nOffSetX;

		if (Width > MaxWidth) MaxWidth = Width;

		tmpWidth = Width;
	}

	return MaxWidth;
}


////////////////////////////////////////////////////////////
//Function For ItemID

static function bool IsValidItemID(ItemID Id)
{
	if(Id.ClassID<1 && Id.ServerID<1)
	{
		return false;
	}
	return true;
}

static function ItemID GetItemID(int Id)
{
	local ItemID cID;
	cID.ClassID = Id;
	return cID;
}

static function ItemInfo GetItemInfoByClassID(int Id)
{
	local ItemID cID;
	local ItemInfo Info;

	cID.ClassID = Id;
	class'UIDATA_ITEM'.static.GetItemInfo(cID, Info);
	return Info;
}

function int getItemCountWithEnchanted(int ClassID, int Enchanted)
{
	local array<ItemInfo> Items;
	local int i, ItemCount;

	GetInstanceL2UIInventory().FindItem(GetItemID(ClassID), Items);

	for(i = 0; i < Items.Length; i++)
	{
		if(Enchanted == Items[i].Enchanted)
		{
			++ ItemCount;
		}
	}
	return ItemCount;
}

function bool ParseItemID(string param, out ItemID ID)
{
	local bool bRet1;
	local bool bRet2;
	bRet1 = ParseInt(param, "ClassID", Id.ClassID);
	bRet2 = ParseInt(param, "ServerID", ID.ServerID);
	return bRet1 || bRet2;
}

function bool ParseItemIDWithIndex(string param, out ItemID ID, int idx)
{
	local bool bRet1;
	local bool bRet2;
	bRet1 = ParseInt(param, "ClassID_" $ idx, ID.ClassID);
	bRet2 = ParseInt(param, "ServerID_" $ idx, ID.ServerID);
	return bRet1 || bRet2;
}

function ParamAddItemID(out string param, ItemID ID)
{
	if (ID.ClassID>0)
		ParamAdd(param, "ClassID", string(ID.ClassID));
	if (ID.ServerID>0)
		ParamAdd(param, "ServerID", string(ID.ServerID));
}

function ParamAddItemIDWithIndex(out string param, ItemID Id, int idx)
{
	if(Id.ClassID > 0)
	{
		ParamAdd(param, "ClassID_" $ idx, string(Id.ClassID));
	}
	if(Id.ServerID > 0)
	{
		ParamAdd(param, "ServerID_" $ idx, string(Id.ServerID));
	}
}

static function ClearItemID(out ItemID Id)
{
	Id.ClassID = -1;
	Id.ServerID = -1;
}

static function bool IsSameItemID(ItemID src, ItemID des)
{
	if(src.ClassID == des.ClassID && src.ServerID == des.ServerID)
	{
		return true;
	}
	return false;
}

static function bool IsSameClassID(ItemID src, ItemID des)
{
	if(src.ClassID == des.ClassID)
	{
		return true;
	}
	return false;
}

static function bool IsSameServerID(ItemID src, ItemID des)
{
	if(src.ServerID == des.ServerID)
	{
		return true;
	}
	return false;
}

static function bool IsAdena(ItemID Id)
{
	if(Id.ClassID == 57)
	{
		return true;
	}
	return false;
}

//branch
function string GetPrimeItemSymbolName()
{
	return "BranchSys.ui.primeitem_symbol";
}
//end of branch

function string ChinaHideName(string UserName)
{
	if(GetLanguage() != LANG_Chinese)
	{
		return UserName;
	}
	if(InStr(UserName, "*") == -1)
	{
		return UserName;
	}
	return GetSystemString(13198);
}

function string ChinaOriginName(string UserName)
{
	local string OriginName;

	if(GetLanguage() != LANG_Chinese)
	{
		return UserName;
	}
	if(InStr(UserName, "*") == -1)
	{
		return UserName;
	}
	OriginName = Left(UserName, InStr(UserName, "*"));
	return OriginName;
}

/** 
 * 
 * А©µµїм АМё§А» №ЮґВґЩ.
 * 
 * getCurrentWindowName (string(Self)) 
 * 
 **/
static function string getCurrentWindowName(string targetString)
{
	local array<string> ArrayStr;

	Split(targetString, ".", ArrayStr);
	return ArrayStr[1];
}

static function L2Util getInstanceL2Util()
{
	local L2Util script;

	script = L2Util(GetScript("L2Util"));
	return script;
}

static function InventoryViewer getInstanceInventoryViewer()
{
	local InventoryViewer script;

	script = InventoryViewer(GetScript("InventoryViewer"));
	return script;
}

static function UIData getInstanceUIData()
{
	local UIData script;

	script = UIData(GetScript("UIData"));
	return script;
}

static function NoticeWnd getInstanceNoticeWnd()
{
	local NoticeWnd script;

	script = NoticeWnd(GetScript("NoticeWnd"));
	return script;
}

static function ContextMenu getInstanceContextMenu()
{
	local ContextMenu script;

	script = ContextMenu(GetScript("ContextMenu"));
	return script;
}

static function L2UIColor GTColor()
{
	local L2UIColor script;

	script = L2UIColor(GetScript("L2UIColor"));
	return script;
}

// ·С ЕёАФАё·О ѕЖАМДЬ №шИЈё¦ №ЮАЅ.
function int getRollIconNum(EClassRoleType rollType)
{
	switch(rollType)
	{
		// іЄАМЖ® (№жЖР)
		case ECRT_KNIGHT:
			return 3;
		// їцё®ѕо (µаѕујТµе) 
		case ECRT_WARRIOR:
			return 8;
		// ·О±Ч   (ґЬ°Л) 
		case ECRT_ROGUE:
			return 1;
		// ѕЖГі   (И°) 
		case ECRT_ARCHOR:
			return 2;
		// А§АЪµе (°рАє БцЖОАМ) 
		case ECRT_WIZARD:
			return 5;
		// ј­ёУіК (јТИЇБш) 
		case ECRT_SUMMONER:
			return 7;
		// Иъ·Ї   (±БАє БцЖОАМ) 
		case ECRT_ENCHANTER:
			return 4;
		// АОГ¦ЕН (єыіЄґВ °Л)
		case ECRT_SUPPORT:
			return 6;
		case ECRT_SHAMAN:
			return 10;
		case ECRT_BARD:
			return 11;
		// ёрЗи°Ў
		case ECRT_NOVICE:
			return 1;
		case ECRT_DEATHKNIGHT:
			return 12;
		case ECRT_HUNTER:
			return 13;
		default:
			return 1;
	}
}

// @fixme : GetClassRoleType() їН GetClassTransferDegree(classID) ё¦ АМїлЗШј­ єР±в ЗПёй µК. #3008 Вь°н - y2jinc
function string GetClassRoleIconName(int classID)
{
	local int degree;
	local EClassRoleType rollType;

	rollType = GetClassRoleType(classID) ;
	degree = GetClassTransferDegree(classID) ;

	// ёрЗи°Ў
	if (rollType == EClassRoleType.ECRT_NOVICE)
		degree = 1;
	else if (rollType == EClassRoleType.ECRT_DEATHKNIGHT && degree == 0)
		degree = 1;
	else if (degree  > 4)
		degree = 4;
	return "L2UI_CH3.PartyWnd.party_styleicon" $ degree $ "_" $ getRollIconNum(rollType);
}

// 20 x 20 Аё·О Б» ґх Е« »зАМБо
function string GetClassRoleIconNameBig(int classID)
{
	local int degree;
	local EClassRoleType rollType;

	rollType = GetClassRoleType(classID) ;
	degree = GetClassTransferDegree(classID) ;

	// ёрЗи°Ў
	if(rollType == EClassRoleType.ECRT_NOVICE)
		degree = 1;
	else if(rollType == EClassRoleType.ECRT_DEATHKNIGHT && degree == 0)
		degree = 1;
	else if(degree  > 4)
		degree = 4;

	return "L2UI_CH3.PartyWnd.party_styleicon" $ degree $ "_" $ getRollIconNum (rollType) $ "_Big";
}

// ЗцАз 4Вч АьБчїл ѕЖАМДЬёё µйѕо°Ў АЦАЅ. (ѕЖ·№іЄґВ 4Вч АьБч Е¬·ЎЅєёё »зїл)
// ѕЖ·№іЄ Аьїл Бчѕч ѕЖАМДЬ == 0 Вч АьБч 
// 1Вч АьБч ёрЗи°Ў ѕЖАМДЬµµ ГЯ°Ў їдГ» ЗФ. ґл±в »уЕВїЎј­ ЗҐЅГїлµµ¤І
function string GetClassArenaRoleIconName(int ClassID)
{
	local EClassRoleType rollType;
	//Debug  ("GetClassArenaRoleIconName" @ classID @ GetClassRoleType(classID));
	rollType = GetClassRoleType(ClassID) ;	
	if (rollType == EClassRoleType.ECRT_NOVICE)
	{
		return "L2UI.TheArena.party_styleicon1_1";
	}
	return "L2UI.TheArena.party_styleicon0_" $ getRollIconNum (GetClassRoleType(ClassID)) ;
}

function Color GetNumericColor(string strCommaAdena)
{
	local Color ResultColor;
	local int l, comma_num, i;

	ResultColor.R = 220;
	ResultColor.G = 220;
	ResultColor.B = 220;
	ResultColor.A = 255;	//Alpha°Ў OАМёй FontDrawInfo::Color°Ў №ЭїµµЗБц ѕКґВґЩ.

	l = Len(strCommaAdena);

	for (i = 0; i < l; ++i)
	{
		if(Mid(strCommaAdena, i, 1) == ",")
		{
			++comma_num;
		}
	}

	l -= comma_num;

	if(l < 5)
	{
		return ResultColor;
	}

	l = l-5;
	
	switch(l)
	{
		case 0:
			ResultColor.R = 105;
			ResultColor.G = 255;
			ResultColor.B = 255;
			break;
		case 1:
			ResultColor.R = 255;
			ResultColor.G = 128;
			ResultColor.B = 255;
			break;
		case 2:
			ResultColor.R = 255;
			ResultColor.G = 255;
			ResultColor.B = 0;
			break;
		case 3:
			ResultColor.R = 0;
			ResultColor.G = 255;
			ResultColor.B = 0;
			break;
		case 4:
			ResultColor.R = 255;
			ResultColor.G = 140;
			ResultColor.B = 0;
			break;
		case 5:
			ResultColor.R = 0;
			ResultColor.G = 110;
			ResultColor.B = 255;
			break;
		case 6:
			ResultColor.R = 255;
			ResultColor.G = 0;
			ResultColor.B = 0;
			break;
		case 7:
			ResultColor.R = 150;
			ResultColor.G = 110;
			ResultColor.B = 255;
			break;
	}

	return ResultColor;
}

function Color GetExpNumericColor(string strCommaAdena)
{
	local Color ResultColor;
	local int L, comma_num, i;

	ResultColor.R = 220;
	ResultColor.G = 220;
	ResultColor.B = 220;
	ResultColor.A = 255;
	L = Len(strCommaAdena);

	for(i = 0; i < L; i++)
	{
		if(Mid(strCommaAdena, i, 1) == ",")
		{
			++ comma_num;
		}
	}
	L -= comma_num;
	if(L < 5)
	{
		return ResultColor;
	}
	L = L - 5;
	switch(L)
	{
		case 4:
			ResultColor.R = 105;
			ResultColor.G = 255;
			ResultColor.B = 255;
			break;
		case 5:
			ResultColor.R = 255;
			ResultColor.G = 128;
			ResultColor.B = 255;
			break;
		case 6:
			ResultColor.R = 255;
			ResultColor.G = 255;
			ResultColor.B = 0;
			break;
		case 7:
			ResultColor.R = 0;
			ResultColor.G = 255;
			ResultColor.B = 0;
			break;
		case 8:
			ResultColor.R = 255;
			ResultColor.G = 140;
			ResultColor.B = 0;
			break;
		case 9:
			ResultColor.R = 0;
			ResultColor.G = 110;
			ResultColor.B = 255;
			break;
		case 10:
			ResultColor.R = 255;
			ResultColor.G = 0;
			ResultColor.B = 0;
			break;
	}
	return ResultColor;	
}

//---------------------------------------------------------------------------------------------------------------
// HTML TAG , Function 
//
// L2 їЎј­ БцїшЗПґВ HTML Ає Б¦ЗСАыАУ 
// WIKI їЎ client Html А» ІА Вь°н ЗП°н Б¦АЫ ЗТ °Н
//---------------------------------------------------------------------------------------------------------------

// m_HtmlViewer.LoadHtmlFromString("<html><body>" $ strMessage $ "</body></html>");

function string htmlSetHtmlStart(string targetHtml)
{
	return "<html><body>" $ targetHtml $ "</body></html>";
}

/**
 *  Ex) htmlAddItemButton(info.ID.ClassID, 32, 32) $ htmlAddText("ЕЧЅєЖ® ЕЧЅєЖ®!","hs22", "0xFF0000") $ "<br>" $ htmlAddLineImg()
 **/

/** Tag , Item Button №цЖ° ѕЖАМЕЫ јУјєАЗ №цЖ° ЕЧ±Ч */
function string htmlAddItemButton(int nItemID, int nWidth, int nHeight)
{
	local string itemTexture;
	local string addItemHtml;

	local itemID cItemID;

	cItemID.ClassID = nItemID;
	itemTexture = class'UIDATA_ITEM'.static.GetItemTextureName(cItemID);

	addItemHtml =  "<button width=" $ nWidth $ " height=" $ nHeight $ " itemtooltip=\"" $ nItemID $ "\"" 
					 $ " High=\"" $ itemTexture $ "\"" $ " back=\"" $ itemTexture $ "\"" $ " fore=\"" $ itemTexture $ "\"> ";

	return addItemHtml;
}

/** 
 *  Tag , Button №цЖ° 
 *  
 *  Ex) htmlAddButton("ЗПАМ", "event inven a=123 b=dongland", 0, 0, 15, 15);
 *  
 **/
function string htmlAddButton(string buttonText, string actionParam, optional int nWidth, optional int nHeight, 
							  optional int buttonAddWidth, optional int buttonAddHeight,
							  optional string textStyle, optional string fontName, optional string fontColor, 
							  optional string backTexture, optional string highTexture, optional string foreTexture)
{
	local string resultHtml, addHtml;
	local int textSizeWidth, textSizeHeight;

	// ЕШЅєЖ® »зАМБо ѕт±в
	if (len(fontName) > 0) GetTextSize(buttonText, fontName, textSizeWidth, textSizeHeight);
	else GetTextSize(buttonText, "GameDefault", textSizeWidth, textSizeHeight);

	// №цЖ° Е©±в АЪµї јјЖГ ї©єО 
	if(nWidth  > 0) addHtml = addHtml $ "width="  $ nWidth  $ " ";
	else addHtml = addHtml $ "width="  $ textSizeWidth + buttonAddWidth $ " ";

	if(nHeight > 0) addHtml = addHtml $ "height=" $ nHeight $ " ";
	else addHtml = addHtml $ "height=" $ textSizeHeight + buttonAddHeight $ " ";

	// ЅєЕёАП, ЖщЖ®, Д®¶у
	if (len(textStyle) > 0) addHtml = addHtml $ "textstyle=\"" $ textStyle $ "\" ";
	if (len(fontName)  > 0) addHtml = addHtml $ "fontName=\""  $ fontName  $ "\" ";
	if (len(fontColor) > 0) addHtml = addHtml $ "fontColor=\"" $ fontColor $ "\" ";

	// №цЖ° ЕШЅєГД 
	if (len(backTexture) > 0) addHtml = addHtml $ "back=\"" $ backTexture $ "\" ";
	else addHtml = addHtml $ "back=\"L2UI_CT1.Button_DF_Down\" ";

	if (len(highTexture) > 0) addHtml = addHtml $ "high=\"" $ highTexture $ "\" ";
	else addHtml = addHtml $ "high=\"L2UI_CT1.Button_DF_Over\" ";

	if (len(foreTexture) > 0) addHtml = addHtml $ "fore=\"" $ foreTexture $ "\" ";
	else addHtml = addHtml $ "fore=\"L2UI_CT1.Button_DF\" ";

	// EV_EVENT_BY_HTML  АМєҐЖ®·О №Я»эЗТ АМєҐЖ® param БцБ¤
	if (len(actionParam) > 0) addHtml = addHtml $ "action=\"" $ actionParam $ "\" ";
	
	resultHtml =  "<button value=\"" $ buttonText $ "\" " $ addHtml $ "> ";

	return resultHtml;
}

/** Tag , Image ЕЧ±Ч ГЯ°Ў */
function string htmlAddImg(string strTexture, int nWidth, int nHeight)
{
	local string addItemHtml;

	addItemHtml = "<img src=\"" $ strTexture $  "\" width=" $ nWidth $ " height=" $ nHeight $ ">";

	return addItemHtml;
}

/** Tag , line АМ№МБц ГЯ°Ў */
function string htmlAddLineImg(optional int lineWidth)
{
	if (lineWidth > 0)
		return "<img src=\"L2UI.SquareWhite\" width=" $ lineWidth $ " height=1>";

	return "<img src=\"L2UI.SquareWhite\" width=270 height=1>";
}

/** Tag , ЕШЅєЖ® font ЕЧ±Ч ГЯ°Ў , FontDefinition.xml Вь°н */
function string htmlAddText(string strText, string fontName, optional string fontColor)
{
	local string targetHtml;
	local string addItemHtml;
	
	if (len(fontColor) > 0) addItemHtml = " color=\"" $ fontColor $ "\" ";

	targetHtml = "<font name=\"" $ fontName $ "\"" $ addItemHtml $ ">" $ strText $ "</font>";

	return targetHtml;
}

/** Tag , ЕШЅєЖ® ЗПАМ·Ї ёµЕ© (їЬєО) 
 *
 * <a action="url http://lineage2.plaync.com">link text</a>
 * 
 * htmlUrlLinkText("ИЁЖдАМБц", "http://lineage2.plaync.com");
 * 
 **/
function string htmlUrlLinkText(string strText, string url)
{
	local string targetHtml;

	targetHtml = "<a action=\"url " $ url $ "\"" $ ">" $ strText $ "</a>";
	return targetHtml;
}

/**
	border  pixels  tableАЗ °ж°иј± ±Ѕ±в  
	width  pixels or %  tableАЗ width  
	height  pixels or %  tableАЗ height  
	bgcolor  XXXXXX  table background color : rgb(x,x,x)  
	cellpadding  pixels  space between the cell wall and the cell content  
	cellspacing  pixels  space between cells  
	background  image file name  background image  
 **/
function string htmlSetTable(out string targetHtml, int border, int width, int height, string backgroundTexture, int cellPadding, int cellspacing)
{
	if (backgroundTexture == "")
		targetHtml = "<table width=" $ width $ " height=" $ height $ " border=" $ border $ " cellpadding=" $ cellPadding $ " cellspacing=" $ cellspacing $ "\">" $ targetHtml $ "</table>";
	else
		targetHtml = "<table width=" $ width $ " height=" $ height $ " border=" $ border $  " cellpadding=" $ cellPadding $ " cellspacing=" $ cellspacing $ " background=\""$ backgroundTexture $ "\">" $ targetHtml $  "</table>";
	return targetHtml;
}

/** ЕЧАМєн ї­ ГЯ°Ў */
function string htmlSetTableTR(out string targetHtml)
{
	targetHtml = "<tr> " $ targetHtml $ "</tr>";
	return targetHtml;
}

/** ЕЧАМєн За ГЯ°Ў */
function string htmlAddTableTD(string strText, string alignStr, string vAlignStr, int width, int height, optional string backgroundTexture, optional bool bWidthFix)
{
	local string addItemHtml;
	
	if (len(alignStr)  > 0) addItemHtml = " align="  $ alignStr  $ " ";
	if (len(vAlignStr) > 0) addItemHtml = " valign=" $ vAlignStr $ " " $ addItemHtml;

	// °нБ¤ width , їш·ЎґВ ±ЫАЪїЎ µы¶уј­ АЪµїАё·О ґГѕо і­ґЩ.
	if (bWidthFix)
	{
		if (width  > 0) addItemHtml = " fixwidth=" $ width $ " " $ addItemHtml;
	}
	else
	{
		if (width  > 0) addItemHtml = " width=" $ width $ " " $ addItemHtml;
	}
	if (height > 0) addItemHtml = " height=" $ height $ " " $ addItemHtml;
	
	if(len(backgroundTexture) > 0) addItemHtml = " background=\"" $ backgroundTexture $ "\" " $ addItemHtml;

	return "<td " $ addItemHtml $">" $ strText $ "</td>";
}
/*
   ex) ЕЧАМєн ї№Б¦

	htmlAdd= "";

	htmlAdd = htmlAddTableTD(htmlAddText("ЕЧЅєЖ® ЕЧЅєЖ® Е©ёЈёЄ!","hs15" , "FF0000"), "Left"  , "center", 40, 0, "", true) $
			  htmlAddTableTD(htmlAddText("ЕЧЅєЖ® ЕЧЅєЖ® Е©ёЈёЄ!","hs8"  , "00FF00"), "center", "Bottom", 80, 0, "", true) $ 
			  htmlAddTableTD(htmlAddText("ґПѕЯїЛ"               ,"hs9"  , "00FF43"), "Right" , "Top"   , 30, 0, "") $
			  htmlAddTableTD(htmlAddText("ёЫёЫ"                 ,"hs16" , "00FF00"), "center", "Bottom", 80, 0, "");

	htmlSetTableTR(htmlAdd);
	htmlSetTable(htmlAdd, 1, 280, 0, "FF0000", 0,0);
 
*/

//<table width=481 height=337 border=0 cellpadding=0 cellspacing=0>
//---------------------------------------------------------------------------------------------------------------

/** ДщЅєЖ® ЕёАФїЎ µыёҐ ЕЧ±Ч ЅєЖ®ёµ */
function string getQuestTypeString(int nQuestType)
{
	local string returnStr;

	switch (nQuestType)
	{
		case 0:
			returnStr = GetSystemString(1795);
			break; // АьБч
		case 1:
			returnStr = GetSystemString(7285);
			break; // ЗчёН
		case 2:
			returnStr = GetSystemString(7286);
			break; // °шјє
		case 3:
			returnStr = GetSystemString(7287);
			break; // їд»хАь
		case 4:
			returnStr = GetSystemString(7288);
			break; // їµБцАь
		case 5:
			returnStr = GetSystemString(7276);
			break; // ёЮАО
		case 6:
			returnStr = GetSystemString(7277);
			break; // ј­єк 
		case 8:
			returnStr = GetSystemString(7278);
			break; // №Эє№
		case 7:
			returnStr = GetSystemString(7279);
			break; // АПАП
		case 9:
			returnStr = GetSystemString(7280);
			break; // ЖДЖј
		case 10:
			returnStr = GetSystemString(7281);
			break; // ї¬ЗХ
		case 11:
			returnStr = GetSystemString(7282);
			break; // їщµе·№АМµе
		case 12:
			returnStr = GetSystemString(7283);
			break; // АОБё
		case 13:
			returnStr = GetSystemString(7284);
			break; // Boss

		default:
			returnStr = ""; // И¤ЅГ[±вЕё] Гіё® ЗТАПАМ АЦА»±о ЗШј­..
			break;
	}

	return returnStr;
}

function string br()
{
	return "<br>";
}

function string brPixel(int nWidth, optional int nHeight, optional int vspace)
{
	return gfxHtmlAddImg("L2UI_CT1.EmptyBtn", nWidth, nHeight, vspace);
}

function string gfxHtmlAddText(string strText, optional string FontColor, optional string FontSize)
{
	local string targetHtml;
	local string addItemHtml;

	if (Len(FontColor) > 0)
		addItemHtml = addItemHtml $ "color='" $ FontColor $ "' ";

	if (Len(FontSize) > 0)
		addItemHtml = addItemHtml $ "size='" $ FontSize $ "' ";

	targetHtml = "<font " $ addItemHtml $ ">" $ strText $ "</font>";
	return targetHtml;
}


function string gfxHtmlAddImg (string strTexture, int nWidth, int nHeight, optional int vspace)
{
	local string addItemHtml;

	addItemHtml = "<img src='img://" $ strTexture $ "' width='" $ string(nWidth) $ "' height='" $ string(nHeight) $ "'" $ "'";
	if (vspace != 0)
	{
		addItemHtml = addItemHtml $ " align='baseline'";
		addItemHtml = addItemHtml $ " vspace='" $ string(vspace) $ "'";
	}
	addItemHtml = addItemHtml $ ">";
	return addItemHtml;
}

function string gfxHtmlAddItemTexture(int nItemClassID, int nWidth, int nHeight, optional int vspace)
{
	local string addItemHtml, strTexture;

	strTexture = class'UIDATA_ITEM'.static.GetItemTextureName(GetItemID(nItemClassID));
	addItemHtml = gfxHtmlAddImg(strTexture, nWidth, nHeight, vspace);
	return addItemHtml;
}

/** 
 *  ё»БЩАУ ... ёёµй±в
 *  
 *  ex) makeShortString("ѕИізЗПјјїд!ЗПіЄµС", 5, "..");  --> ѕИізЗПјјїд..  №®АЪї­ ё®ЕП
 **/
function string makeShortString(string targetString, int maxChar, string dotString)
{
	local string rStr;

	if(Len(targetString) > maxChar)
	{
		rStr =  Mid(targetString, 0, maxChar) $ dotString;
	}
	else
	{
		rStr = targetString;
	}

	return rStr;
}

function textBoxShortStringWithTooltip(TextBoxHandle textBox, optional bool bUseTooltip, optional int addWidth)
{
	local int textWidth, textHeight, wTextWidth, hTextHeight;
	local string Context;

	Context = textBox.GetText();
	textBox.GetWindowSize(wTextWidth, hTextHeight);
	GetTextSize(Context, "GameDefault", textWidth, textHeight);
	if(textWidth > wTextWidth)
	{
		if(bUseTooltip)
		{
			textBox.SetTooltipType("text");
			textBox.SetTooltipText(Context);
		}
		Context = makeShortStringByPixel(Context, (wTextWidth - 8) + addWidth, "..");
	}
	textBox.SetText(Context);
}

function textBoxShortStringLazy(TextBoxHandle targetTextField, string targetString, optional string dotString, optional string FontName)
{
	local string repDotString;

	if(dotString == "")
	{
		repDotString = "..";
	}
	targetTextField.SetText(makeShortStringByPixel(targetString, targetTextField.GetRect().nWidth - 4, repDotString, FontName));
}

/***
 * ЗИјїА» ±вБШАё·О ё»БЩАУА» ЗСґЩ.
 **/
function string makeShortStringByPixel(string targetString, int maxPixel, string dotString, optional string fontName)
{
	local string fixedText, tempStr, prevTempStr;
	local int textWidth, textHeight, prevTextWidth;
	local int dotWidth, dotHeight;
	local int i;

	if (fontName == "") fontName = "GameDefault";

	// ... »зАМБо 
	GetTextSize(dotString, fontName, dotWidth, dotHeight);
	GetTextSize(targetString, fontName, textWidth, textHeight);

	if(textWidth <= maxPixel)
	{
		fixedText = targetString;		
	}
	else
	{
		fixedText = targetString;
		for (i = 0; i < len(targetString); i++)
		{
			tempStr = Mid(targetString, 0 , i);

			GetTextSize(tempStr, fontName, textWidth, textHeight);

			prevTextWidth = textWidth;
			prevTempStr = tempStr;

			// .. єЩАє №®АЪї­ ёёµй±в!
			if (maxPixel < textWidth + dotWidth)
			{
				if (maxPixel > prevTextWidth + dotWidth)
					fixedText = prevTempStr $ dotString;
				else
					fixedText = tempStr $ dotString;
				break;
			}
		}
	}

	// Debug("fixedText" @ fixedText);
	return fixedText;
}

// №йЕН °ЄАМ 0.00 ...°ЄАё·О ёрµО µйѕо їАёй true
function bool isVectorZero(Vector loc)
{
	if (int(loc.X) == 0 && int(loc.Y) == 0 && int(loc.Z) == 0)
	{
		return true;
	}
	else 
	{
		return false;
	}   
}


/**
 * ј­№ц IDё¦ іЦАёёй -> ЗШґз АЇґЦїЎ°Ф Её°Щ 
 **/
function setTargetByServerID (int serverID) 
{
	local UserInfo userinfo;

	if (serverID != -1)
	{
		if (GetPlayerInfo(userinfo))
		{			
			RequestAction(serverID, userinfo.Loc); // -> HandleTargetUpdate()·О АМѕоБь			
		}
	} 
}

/** јэАЪё¦ bool ·О єЇИЇ */
function bool numToBool(int bNum)
{
	if(bNum > 0)
	{
		return true;		
	}
	else
	{
		return false;
	}
}

/** boolё¦ јэАЪ·О єЇИЇ */
function int boolToNum(bool Num)
{
	if(Num)
	{
		return 1;		
	}
	else
	{
		return 0;
	}
}

/** Д®¶у ё¦ ё®ЕПЗСґЩ. */
function Color GetColor(int R, int G, int B, int A)
{
	local Color tColor;

	tColor.R = R;
	tColor.G = G;
	tColor.B = B;
	tColor.A = A;
	return tColor;
}

// АМё§ + AdditionalName
function string GetItemNameWithAdditional(ItemInfo info)
{
	local string fullName, addStr;

	//ensoulOptionAllName = GetEnsoulOptionNameAll(info);

	// АОГ¦Ж®, їЙјЗ, AdditionalName
	// if(info.Enchanted > 0) fullName = "+"$ String(info.Enchanted);	

	if (Len(fullName) > 0)
	{
		fullName = fullName $ " " $ info.name;
	}
	else
	{
		FullName = info.Name;
	}

	if (len(info.AdditionalName) > 0) addStr = addStr $ " " $ info.AdditionalName;
	//if (len(ensoulOptionAllName) > 0) addStr = addStr $ " " $ ensoulOptionAllName;

	
	fullName = fullName $ addStr;
	
	return fullName;
}

function string GetItemNameAllByClassID(int ClassID)
{
	local ItemInfo iInfo;

	if(! class'UIDATA_ITEM'.static.GetItemInfo(GetItemID(ClassID), iInfo))
	{
		return "";
	}
	return GetItemNameAll(iInfo);
}

function string GetItemNameAllBySeverID(int ServerID)
{
	local ItemInfo Info;
	local string itemNameStr;

	class'UIDATA_INVENTORY'.static.FindItem(ServerID, Info);
	itemNameStr = GetItemNameAll(Info);
	return itemNameStr;
}

// ±вє»АыАё·О »зїлЗПґВ °шЕлµИ ѕЖАМЕЫ АМё§А» ё®ЕПЗСґЩ.
function string GetItemNameAll (ItemInfo item, optional bool bNoUseAdditionalName)
{
	local string FullName;
	local string refineryStr;

	if (item.Enchanted > 0)
	{
		FullName = "+" $ string(item.Enchanted) $ " ";
	}
	if (item.IsBlessedItem)
	{
		FullName = FullName $ GetSystemString(13403) $ " ";
	}
	if (getInstanceUIData().getIsLiveServer())
	{
		refineryStr = class'UIDATA_ITEM'.static.GetRefineryItemName(item.Name, item.RefineryOp1, item.RefineryOp2);		
	}
	else
	{
		refineryStr = item.Name;
	}
	if(Len(FullName) > 0)
	{
		FullName = FullName $ refineryStr;		
	}
	else
	{
		FullName = refineryStr;
	}
	if(! bNoUseAdditionalName)
	{
		if(Len(item.AdditionalName) > 0)
		{
			FullName = FullName $ " " $ item.AdditionalName;
		}
	}
	return FullName;
}

// №«±вїЎ АыїлµИ БэИҐј® їЙјЗАЗ АМё§ АьГјё¦ №ЮѕЖїВґЩ.
// ЕшЖБїЎј­ »зїлЗП·Б°н АПґЬ ёёµл. 
function string GetEnsoulOptionNameAll(ItemInfo weaponInfo)
{
	local EnsoulOptionUIInfo eOptionInfo;
	local int i, n, cnt, OptionID;

	local string allName;

	// БэИҐ ЅГЅєЕЫ °іЖн (2015-02-09 ГЯ°Ў)
	for(i=EIST_NORMAL; i<EIST_MAX; i++)
	{
		cnt = weaponInfo.EnsoulOption[i - EIST_NORMAL].OptionArray.Length;

		for(n=EISI_START; n<EISI_START + cnt; n++)		
		{
			OptionID = weaponInfo.EnsoulOption[i - EIST_NORMAL].OptionArray[n - EISI_START];

			// [ЗШїЬ TTP ёУВЎ] - 
			// ttp71868 ГЯГв ИД OptionID°Ў 0АМї©µµ БэИҐ АМё§АМ БЯє№µЗ°Ф іЄїАґВ №®Б¦ јцБ¤. 
			if (OptionID <= 0) continue;

			GetEnsoulOptionUIInfo(OptionID, eOptionInfo);

			if (eOptionInfo.name != "")
			{
				if (allName == "")	
					allName = eOptionInfo.name;     
				else
					allName = allName $ "/" $ eOptionInfo.name;     
			}
		}
	}

	return allName;
}

// БэИҐ їЙјЗАМ ЖчЗФµЗѕо АЦіЄ?
function bool hasEnsoulOption(ItemInfo weaponInfo)
{
	local EnsoulOptionUIInfo eOptionInfo;
	local int i, n, cnt, OptionID;


	// БэИҐ ЅГЅєЕЫ °іЖн (2015-02-09 ГЯ°Ў)
	for(i=EIST_NORMAL; i<EIST_MAX; i++)
	{
		cnt = weaponInfo.EnsoulOption[i - EIST_NORMAL].OptionArray.Length;

		for(n=EISI_START; n<EISI_START + cnt; n++)		
		{
			OptionID = weaponInfo.EnsoulOption[i - EIST_NORMAL].OptionArray[n - EISI_START];

			// Debug("OptionID--------------------->" @ OptionID);
			GetEnsoulOptionUIInfo(OptionID, eOptionInfo);
			if (eOptionInfo.name != "")
			{
				return true;
			}
		}
	}

	return false;
}

// БэИҐ Б¤єё param ЗьЕВ·О ГЯ°Ў 2015-03-18
function addParamEnsoulOptionInfo(ItemInfo info, out string param)
{
	local int i, n, cnt;
	for(i=EIST_NORMAL; i<EIST_MAX; i++)
	{
		cnt = info.EnsoulOption[i - EIST_NORMAL].OptionArray.Length;

		ParamAdd(param, "EnsoulOptionNum_" $ String(i), String(cnt));

		for(n=EISI_START; n < EISI_START + cnt; n++)
		{
			ParamAdd(param, "EnsoulOptionID_" $ String(i) $ "_" $ string(n) , String(info.EnsoulOption[i - EIST_NORMAL].OptionArray[n - EISI_START]));
		}
	}
}

// addParamEnsoulOptionInfo №Эґл, param String їЎј­ info·О Б¤єё ГЯ°Ў
function addEnsoulInfoToItemInfoByParamString(string param, out ItemInfo info)
{
	local int i, n, cnt, tmpInt;

	for(i=EIST_NORMAL; i<EIST_MAX; i++)
	{
		ParseInt(param, "EnsoulOptionNum_" $ i, cnt);
		info.EnsoulOption[i - EIST_NORMAL].OptionArray.Length = cnt;

		for(n = EISI_START; n < EISI_START + cnt; n++)
		{
			ParseInt(param, "EnsoulOptionID_" $ String(i) $ "_" $ string(n) , tmpInt);
			info.EnsoulOption[i - EIST_NORMAL].OptionArray[n - EISI_START] = tmpInt;
		}
	}
}

// 9999+ °°Ає ГЦґл ЗҐЅГё¦ А§ЗС ЗФјц
//EnsoulOptionWnd_Charge3_TextBox.SetText("(" $ maxCountLimitString(InvenJamStoneInfo.ItemNum, 9999, "9999+") $ ")");
function string maxCountLimitString(Int64 Count, Int64 maxCount, string returnStr)
{
	local string RValue;

	if (Count > maxCount)
	{
		RValue = returnStr;
	}
	else
	{
		RValue = string(Count);
	}

	return RValue;
}

function string getSecToDateStr(int Sec, bool onlyDayFlag)
{
	// 86400
	// 1109
	local string returnStr;
	local int RemainSec;
	local int m_timeDay;
	local int m_timeHour;
	local int m_timeMin;

	m_timeDay = Sec / 86400;
	RemainSec = int(Sec % 86400);
	m_timeHour = RemainSec / 60 / 60;
	m_timeMin = int(RemainSec / 60 % 60);
	returnStr = "";
	if(m_timeDay > 0)
	{
		returnStr = string(m_timeDay) $ GetSystemString(1109);
	}
	if(onlyDayFlag == false)
	{
		if(returnStr != "")
		{
			returnStr = returnStr $ "/";
		}
		if(m_timeHour > 0)
		{
			if(m_timeHour < 10)
			{
				returnStr = returnStr $ "0" $ string(m_timeHour);
			}
			else
			{
				returnStr = returnStr $ string(m_timeHour);
			}
		}
		else
		{
			returnStr = returnStr $ "00";
		}
		if(m_timeMin > 0)
		{
			if(m_timeMin < 10)
			{
				returnStr = returnStr $ ":0" $ string(m_timeMin);
			}
			else
			{
				returnStr = returnStr $ ":" $ string(m_timeMin);
			}
		}
		else
		{
			returnStr = returnStr $ ":00";
		}
	}
	return returnStr;
}

// ГКё¦ іЦѕој­, АП ~ 1єР №Мёё ±оБц ЗҐЗц ЗПґВ ЗФјц
function string getStringDayAndTime(int tmpTime)
{
	local int tmpDay;
	local int tmpHou;
	local int tmpMin;	
	local string timeStr;
	
	
	local int minToHou;
	local int minToDay;
	
	minToHou = 60;
	minToDay = minToHou * 24;
	
	tmpMin = tmpTime/60; 

	if (tmpMin > minToDay) {//АП // ЅГ°Јёё		
		tmpHou = tmpMin/60;
		tmpDay = tmpHou/24;
		tmpHou = tmpHou - tmpDay*24;	
		if (tmpHou != 0){
			timeStr = MakeFullSystemMsg(GetSystemMessage(3503), (String(tmpDay)), string (tmpHou));
		} else {
			timeStr = MakeFullSystemMsg(GetSystemMessage(3418),  (String(tmpDay)));
		}
	} else if (tmpMin > 60) {//ЅГ°Ј єРёё
		tmpHou = tmpMin/60;
		tmpMin = tmpMin - tmpHou*60;
		if(tmpMin != 0){
			timeStr = MakeFullSystemMsg(GetSystemMessage(3304), string(tmpHou), string (tmpMin));
		} else {
			timeStr = MakeFullSystemMsg(GetSystemMessage(3406), string(tmpHou));
		}
	} 
	else if (tmpTime > 60) { //єРёё
		timeStr = MakeFullSystemMsg(GetSystemMessage(3390), string (tmpMin));
	}
	else { // 1єР №Мёё
		timeStr = MakeFullSystemMsg(GetSystemMessage(4360), string (1));
	}

	return timeStr;
}

// ѕЖ·№іЄ °ь·Г ЅєЕЧАМБц АО°Ў?
function bool isAreaState()
{
	local string stateStr;
	local bool bReturn;

	stateStr = GetGameStateName();

	if(stateStr == "ARENAGAMINGSTATE" || stateStr == "ARENABATTLESTATE")
	{
		bReturn = true;
	}
	else
	{
		bReturn = false;
	}
	return bReturn;
}

	//DOMINION,                    //0
	//FIELD_HUNTING_ZONE_SOLO,     //1
	//FIELD_HUNTING_ZONE_PARTY,    //2
	//INSTANCE_ZONE_SOLO,          //3
	//INSTANCE_ZONE_PARTY,         //4
	//AGIT,                        //5
	//VILLAGE,                     //6
	//ETC,                         //7
	//CASTLE,                      //8
	//FORTRESS,                    //9

function string getHuntingZoneTypeString(int nHuntingZoneType)
{
	local string tmpStr;

	if (nHuntingZoneType == 0)      tmpStr = GetSystemString(1312);  //їµБц
	else if (nHuntingZoneType == 1) tmpStr = GetSystemString(3517);  //јЦ·О »зіЙЕН
	else if (nHuntingZoneType == 2) tmpStr = GetSystemString(3518);  //ЖДЖј »зіЙЕН
	else if (nHuntingZoneType == 3) tmpStr = GetSystemString(3542);  //јЦ·О АОЅєЕПЅє Бё
	else if (nHuntingZoneType == 4) tmpStr = GetSystemString(3543);  //ЖДЖј АОЅєЕПЅє Бё
	else if (nHuntingZoneType == 5) tmpStr = GetSystemString(1317);  //ѕЖБцЖ®
	else if (nHuntingZoneType == 6) tmpStr = GetSystemString(1270);  //ё¶А»
	else if (nHuntingZoneType == 7) tmpStr = GetSystemString(7299);  //±вЕё
	else if (nHuntingZoneType == 8) tmpStr = GetSystemString(3546);  //јє
	else if (nHuntingZoneType == 9) tmpStr = GetSystemString(3547);  //їд»х
	else if (nHuntingZoneType == 10) tmpStr = GetSystemString(3548); //јЦ·О/ЖДЖј »зіЙЕН

	return tmpStr;
}

// ·№АМµе ёуЅєЕНАЗ їµБц Б¤єёё¦ ё®ЕП. (ГЯИД °ЎґЙЗПёй Е¬¶у ВКїЎј­ µ№·Б ґЮ¶у°н ЗПґВ°Ф ББ°ЪАЅ)
// ЗФјц АМё§АМ Б» АМ»уЗПґЩ°н »э°ў µК..-_-...
function string getRaidZoneName(int search_zoneid)
{
	local string HuntingZoneName; 
	local int i;

	for(i = 0; i < 500 ; i++)
	{
		//debug("conv_zoneName i=" $ i);
		
		if(class'UIDATA_HUNTINGZONE'.static.IsValidData(i))
		{
			// їµБцїН °°ґЩёй..
			if(class'UIDATA_HUNTINGZONE'.static.GetHuntingZoneType(i) == 0)
			{
				if (class'UIDATA_HUNTINGZONE'.static.GetHuntingZone(i) == search_zoneid)
				{
					HuntingZoneName = class'UIDATA_HUNTINGZONE'.static.GetHuntingZoneName(i); 
				}
			}
		}	
	}
	return HuntingZoneName;
}

// µҐАМЕё°Ў ґх АЦґВµҐ ґл·« АМБ¤µµёй єу ±ёБ¶ГјАОБц И®АО °ЎґЙ
function bool IsValidDataForHuntingZoneUIData(HuntingZoneUIData info)
{
	if(info.strName == "" && 
	   info.nType == 0 &&
	   info.nMinLevel == 0 &&
	   info.nMaxLevel == 0 &&
	   info.nMinLevel == 0 &&
	   info.nSearchZoneID == 0 &&
	   info.nRegionID == 0 &&
	   info.nNpcID == 0) return false;

	return true;
}

// ·№є§ ГјЕ©
function bool tryLevelCheck(int userLevel, int minLevel, int maxLevel)
{
	if(userLevel >= minLevel && userLevel <= maxLevel) 
	{
		return true;
	}

	return false;
}

// є¤ЕН °ЄАМ 0АО°Ў?
function bool isVectorZeroXYZ(float x, float y, float z)
{
	if (x == 0 && y == 0 && z == 0)
	{
		return true;
	}

	return false;
}


//------------------------------------------------------------------------------------------------
// ЗеЖГ Бё °ь·Г ЗФјц
//------------------------------------------------------------------------------------------------
function int getHuntingZoneIndexByName(string huntingZoneName)
{
	local int i, r;

	r = -1;
	for (i = 0; i < 500; i++)
	{
		if(class'UIDATA_HUNTINGZONE'.static.IsValidData(i))
		{
			if(class'UIDATA_HUNTINGZONE'.static.GetHuntingZoneName(i) == huntingZoneName)
			{
				r = i;
				break;
			}
		}
	}

	return r;
}

// ·№АМµе Б¤єё , ±ёБ¶Гј·О №Ю±в
function RaidUIData getRaidDataByIndex(int Index)
{
	local RaidUIData pRaidUIData;

	if(class'UIDATA_RAID'.static.IsValidData(Index))
	{
		pRaidUIData.Id = Index;
		pRaidUIData.nRaidMonsterID = class'UIDATA_RAID'.static.GetRaidMonsterID(Index);
		pRaidUIData.nRaidMonsterLevel = class'UIDATA_RAID'.static.GetRaidMonsterLevel(Index);
		pRaidUIData.nRaidMonsterZone = class'UIDATA_RAID'.static.GetRaidMonsterZone(Index);
		pRaidUIData.raidDesc = class'UIDATA_RAID'.static.GetRaidDescription(Index);
		pRaidUIData.raidMonsterName = class'UIDATA_NPC'.static.GetNPCName(pRaidUIData.nRaidMonsterID);
		pRaidUIData.nWorldLoc = class'UIDATA_RAID'.static.GetRaidLoc(Index);
		pRaidUIData.RaidMonsterZoneName = getRaidZoneName(pRaidUIData.nRaidMonsterZone);
		class'UIDATA_RAID'.static.GetRaidRecommendLevel(Index, pRaidUIData.nMinLevel, pRaidUIData.nMaxLevel);
	}

	return pRaidUIData;
}

function Vector setVector(int x, int y, int z)
{
	local Vector loc;

	loc.x = x;
	loc.y = y;
	loc.z = z;
	return loc;
}

/**
 *  БѕБ·ЅєЖ®ёµА»ё®ЕПЗСґЩ.
 **/
function string getRaceSystemString(int nRace)
{
	local string returnV;

	switch (nRace)
	{
		case 0  : returnV = GetSystemString(2705);   break; // ИЮёХ
		case 1  : returnV = GetSystemString(171);   break;  // ї¤ЗБ
		case 2  : returnV = GetSystemString(172);   break;  // ґЩЕ©ї¤ЗБ
		case 3  : returnV = GetSystemString(173);   break;  // їАЕ©
		case 4  : returnV = GetSystemString(174);   break;  // µеїцЗБ
		case 5  : returnV = GetSystemString(1544);   break;  // Д«ё¶ї¤
		case 6  : returnV = GetSystemString(3273);   break;  // ѕЖёЈЕЧАМѕЖ
		case 30:
			returnV = GetSystemString(13536);
			break;
		default : returnV = "";
	}

	return returnV;
}

/********************************************************************************************
 * ЖЗє° ЗФјц µй
 * ******************************************************************************************/
// ѕЖЖјЖСЖ® АО°Ў? ѕЖЖјЖСЖ® А©µµїм ЖЇјц ·йАОБц ї©єО 
function bool IsArtifactRuneItem(ItemInfo info)
{
	//Debug ("IsArtifactRuneItem0:" @ String(info.slotBitType) @ "/" @ String(info.slotBitType) == "18014398509481984" @ "/" @  info.slotBitType == 18014398509481984) ;
	//Debug ("IsArtifactRuneItem1:" @info.slotBitType == 18014398509481984) ;
	//Debug ("IsArtifactRuneItem2:" @info.slotBitType == 144115188075855872) ;
	//Debug ("IsArtifactRuneItem3:" @info.slotBitType == 1152921504606846976) ;
	//Debug ("IsArtifactRuneItem4:" @info.slotBitType == 4398046511104) ;
	
	switch (info.slotBitType) 
	{   // ѕЖЖјЖСЖ® ЖЇјц·й 1
		case INT64("18014398509481984"): // ARTIFACTTYE_TYPE1 :
		// ѕЖЖјЖСЖ® ЖЇјц·й 2
		case INT64("144115188075855872"): // ARTIFACTTYE_TYPE2 :
		// ѕЖЖјЖСЖ® ЖЇјц·й 3
		case INT64("1152921504606846976"): // ARTIFACTTYE_TYPE3 :
		// ѕЖЖјЖСЖ® АП№Э·й
		case INT64("4398046511104"): // ARTIFACTTYE_NORMAL :
			return true;
		break;
	}
	//Debug ("IsArtifactItem" @ EItemtype(info.ItemType))  ;
	return false;

}

function uDebug(string debugMsg)
{
	// bDoNotUseDebug ґВ ѕЖ№«°Нµµ ѕИЗПёй false, 
	// µр№ц±лА» ѕИЗТ UIїЎ АПєО·Ї true·О ЗШБЦёй µр№ц±л ёЮјјБц ѕИіЄїА°Ф ЗФ.
	if (Self.bDoNotUseDebug == false) Debug(getCurrentWindowName(string(Self)) $ DEBUG_SPLIT_STR $ debugMsg);
}

// ё®ЅєЖ® ДБЖ®·СїЎ ЕГЅєГД ·Оµе Ѕ±°Ф 
// ex)
// record.LVDataList[0].arrTexture.Length = 3;
// lvTextureAdd(record.LVDataList[0].arrTexture[0], "L2UI_CT1.SkillWnd.SkillWnd_DF_ListIcon_Reuse", 2, 2, 14, 14);
// lvTextureAdd(record.LVDataList[0].arrTexture[1], "L2UI_CT1.ENCHANTNUMBER_SMALL_plus", 5, 12, 6, 8);
function lvTextureAdd(out LVTexture LVTexture, string texPath, int X, int Y, int nWeight, int nHeight, optional int U, optional int V)
{
	LVTexture.X = X;
	LVTexture.Y = Y;
	LVTexture.Width = nWeight;
	LVTexture.Height = nHeight;
	if(U > 0)
	{
		LVTexture.U = U;		
	}
	else
	{
		LVTexture.U = 0;
	}
	if(V > 0)
	{
		LVTexture.V = V;		
	}
	else
	{
		LVTexture.V = 0;
	}

	LVTexture.UL = nWeight;
	LVTexture.VL = nHeight;
	LVTexture.objTex = GetTexture(texPath);
	LVTexture.IsFront = true;
}

// ё®ЅєЖ® ДБЖ®·СїЎ АОГ¦Ж® јцДЎ ЗҐЗцЗП±в 
// "0" ~ "9"  "plus"
//	record.LVDataList[0].arrTexture.Length = 3;
//	lvTextureAddItemEnchantedTexture(14, record.LVDataList[0].arrTexture[0], record.LVDataList[0].arrTexture[1],record.LVDataList[0].arrTexture[2], 100, 7);
function lvTextureAddItemEnchantedTexture(int nEnchanted, out LVTexture lvTexture1, out LVTexture lvTexture2, out LVTexture lvTexture3, int X, int Y)
{
	local string s1, s2;
	local string ss;

	if(nEnchanted > 0)
	{
		lvTextureAdd(lvTexture1, "L2UI_CT1.ENCHANTNUMBER_SMALL_plus", X, Y, 6, 8);
	}
	if (nEnchanted > 9)
	{
		ss = string(nEnchanted);
		s1 = Left(ss, 1);
		s2 = Right(ss, 1);
		lvTextureAdd(lvTexture2, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ s1, X + 6, Y, 6, 8);
		lvTextureAdd(lvTexture3, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ s2, X + 12, Y, 6, 8);
	}
	else if (nEnchanted > 0 && nEnchanted < 10)
	{
		lvTextureAdd(lvTexture2, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ String(nEnchanted), X + 6, Y, 6, 8);
	}
}

// Ж®ё®, АОГ¦Ж® јцДЎ ЗҐЗц
function lvTextureTreeEnchantedTexture(string treeName, string NodeName, int nEnchanted, int X, int Y)
{
	local L2Util util;

	local string s1, s2;
	local string ss;

	util = L2Util(GetScript("L2Util"));
	
	if(nEnchanted > 0)
	{
		util.TreeInsertTextureNodeItem(treeName, NodeName, "L2UI_CT1.ENCHANTNUMBER_SMALL_plus", 6, 8, X, Y);
	}
	if (nEnchanted > 9)
	{
		ss = string(nEnchanted);
		s1 = Left(ss, 1);
		s2 = Right(ss, 1);

		util.TreeInsertTextureNodeItem(treeName, NodeName, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ s1, 6, 8, 0, Y);
		util.TreeInsertTextureNodeItem(treeName, NodeName, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ s2, 6, 8, 0, Y);
	}
	else if (nEnchanted > 0 && nEnchanted < 10)
	{
		util.TreeInsertTextureNodeItem(treeName, NodeName, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ String(nEnchanted), 6, 8, 0, Y);
	}
}

//----------------------------------------------------------------------------------------------------------------------
// ё®ДЎ ё®ЅєЖ® ДБЖ®·С
//----------------------------------------------------------------------------------------------------------------------


// ЕШЅєГДё¦ drawItemsїЎ ГЯ°Ў
function addRichListCtrlString(out array<RichListCtrlDrawItem> drawitems, string Text, optional Color TextColor, optional bool bStrNewLine, optional int nPosX, optional int nPosY, optional string FontName)
{
	local int Index;

	if(drawitems.Length > 0)
	{
		drawitems.Length = drawitems.Length + 1;		
	}
	else
	{
		drawitems.Length = 1;
	}

	Index = drawitems.Length - 1;

	if(Index <= -1)
	{
		return;
	}

	drawitems[Index].eType = LCDIT_TEXT;
	drawitems[Index].nPosX = nPosX;
	drawitems[Index].nPosY = nPosY;
	drawitems[Index].strInfo = getRichListCtrlString(Text, TextColor, bStrNewLine, FontName);
}

// ЕШЅєГДё¦ drawItemsїЎ ГЯ°Ў
function addRichListCtrlTexture(out array<RichListCtrlDrawItem> drawitems, string texPath, int nWeight, int nHeight, optional int nPosX, optional int nPosY, optional int U, optional int V)
{
	local int Index;

	if(drawitems.Length > 0)
	{
		drawitems.Length = drawitems.Length + 1;		
	}
	else
	{
		drawitems.Length = 1;
	}
	Index = drawitems.Length - 1;
	if(Index <= -1)
	{
		return;
	}
	drawitems[Index].eType = LCDIT_TEXTURE;
	drawitems[Index].nPosX = nPosX;
	drawitems[Index].nPosY = nPosY;
	drawitems[Index].texInfo = getRichListCtrlTexture(texPath, nWeight, nHeight, U, V);
}

// ѕЖАМЕЫ АОГ¦Ж® јцДЎ (ё®ДЎ ё®ЅєЖ® їл)
// ex) addRichListCtrlItemEnchantedTexture(RowData.cellDataList[0].drawitems, data.ItemEnchant, -32, 24); 
function addRichListCtrlItemEnchantedTexture(out array<RichListCtrlDrawItem> drawitems, int nEnchanted, int X, int Y)
{
	local string s1, S2, ss;

	if(nEnchanted > 0)
	{
		addRichListCtrlTexture(drawitems, "L2UI_CT1.ENCHANTNUMBER_SMALL_plus", 6, 8, X, Y);
	}
	if(nEnchanted > 9)
	{
		ss = string(nEnchanted);
		s1 = Left(ss, 1);
		S2 = Right(ss, 1);
		addRichListCtrlTexture(drawitems, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ s1, 6, 8);
		addRichListCtrlTexture(drawitems, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ S2, 6, 8);
	}
	else if (nEnchanted > 0 && nEnchanted < 10)
	{
		addRichListCtrlTexture(drawitems, "L2UI_CT1.ENCHANTNUMBER_SMALL_" $ string(nEnchanted), 6, 8);
	}
}

function AddRichListCtrlItem(out array<RichListCtrlDrawItem> drawitems, ItemInfo iInfo, optional int nWidth, optional int nHeight, optional int nPosX, optional int nPosY, optional string TooltipTypeString)
{
	local int Index;

	if(drawitems.Length > 0)
	{
		drawitems.Length = drawitems.Length + 1;
	}
	else
	{
		drawitems.Length = 1;
	}
	Index = drawitems.Length - 1;
	if(Index <= -1)
	{
		return;
	}
	drawitems[Index].eType = LCDIT_ITEM;
	if(TooltipTypeString == "")
	{
		TooltipTypeString = "InventoryWithIcon";
	}
	drawitems[Index].TooltipTypeString = TooltipTypeString;
	drawitems[Index].nPosX = nPosX;
	drawitems[Index].nPosY = nPosY;
	if(nWidth == 0)
	{
		nWidth = 32;
	}
	if(nHeight == 0)
	{
		nHeight = 32;
	}
	drawitems[Index].ItemInfo.Width = nWidth;
	drawitems[Index].ItemInfo.Height = nHeight;
	drawitems[Index].ItemInfo.ItemInfo = iInfo;
}

function AddRichListCtrlSkill(out array<RichListCtrlDrawItem> drawitems, ItemInfo iInfo, optional int nWidth, optional int nHeight, optional int nPosX, optional int nPosY, optional string TooltipTypeString)
{
	local int Index;

	Index = drawitems.Length;
	if(TooltipTypeString == "")
	{
		TooltipTypeString = "Skill";
	}
	AddRichListCtrlItem(drawitems, iInfo, nWidth, nHeight, nPosX, nPosY, TooltipTypeString);
	drawitems[Index].eType = LCDIT_SKILL;
}

function AddRichListCtrlSkillBySkillInfo(out array<RichListCtrlDrawItem> drawitems, SkillInfo sInfo, optional int nWidth, optional int nHeight, optional int nPosX, optional int nPosY, optional string TooltipTypeString)
{
	local int Index;
	local ItemInfo iInfo;

	Index = drawitems.Length;
	if(TooltipTypeString == "")
	{
		TooltipTypeString = "Skill";
	}
	class'L2Util'.static.GetSkill2ItemInfo(sInfo, iInfo);
	AddRichListCtrlItem(drawitems, iInfo, nWidth, nHeight, nPosX, nPosY, TooltipTypeString);
	drawitems[Index].eType = LCDIT_SKILL;	
}

function AddRichListCtrlStatusInfo(out array<RichListCtrlDrawItem> drawitems, optional int nWidth, optional int nHeight, optional int nPosX, optional int nPosY, optional bool bNewLine, optional float ForeProgress, optional float OverProgress, optional string Text, optional int nSkinType, optional string FontName, optional Color FontColor)
{
	local int Index;

	if(drawitems.Length > 0)
	{
		drawitems.Length = drawitems.Length + 1;		
	}
	else
	{
		drawitems.Length = 1;
	}
	Index = drawitems.Length - 1;
	if(nWidth == 0)
	{
		nWidth = 165;
	}
	if(nHeight == 0)
	{
		nHeight = 20;
	}
	drawitems[Index].eType = LCDIT_STATUS;
	drawitems[Index].statusInfo.Width = nWidth;
	drawitems[Index].statusInfo.Height = nHeight;
	drawitems[Index].nPosX = nPosX;
	drawitems[Index].nPosY = nPosY;
	drawitems[Index].statusInfo.bNewLine = bNewLine;
	drawitems[Index].statusInfo.TexWidth = 4;
	drawitems[Index].statusInfo.TexHeight = 15;
	if(nSkinType == 1)
	{
		drawitems[Index].statusInfo.sBackLeftTex = "L2UI_EPIC.SuppressWnd.Gauge_Grey_Large_Bg_Left";
		drawitems[Index].statusInfo.sBackCenterTex = "L2UI_EPIC.SuppressWnd.Gauge_Grey_Large_Bg_Center";
		drawitems[Index].statusInfo.sBackRightTex = "L2UI_EPIC.SuppressWnd.Gauge_Grey_Large_Bg_Right";
		drawitems[Index].statusInfo.sForeLeftTex = "L2UI_EPIC.SuppressWnd.Gauge_Grey_Large_left";
		drawitems[Index].statusInfo.sForeCenterTex = "L2UI_EPIC.SuppressWnd.Gauge_Grey_Large_center";
		drawitems[Index].statusInfo.sForeRightTex = "L2UI_EPIC.SuppressWnd.Gauge_Grey_Large_right";
		drawitems[Index].statusInfo.sOverLeftTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Left3";
		drawitems[Index].statusInfo.sOverCenterTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Center3";
		drawitems[Index].statusInfo.sOverRightTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Right3";		
	}
	else if(nSkinType == 2)
	{
		drawitems[Index].statusInfo.sBackLeftTex = "l2ui_ct1.Gauges.Gauge_DF_Large_HP_bg_Left";
		drawitems[Index].statusInfo.sBackCenterTex = "l2ui_ct1.Gauges.Gauge_DF_Large_HP_bg_Center";
		drawitems[Index].statusInfo.sBackRightTex = "l2ui_ct1.Gauges.Gauge_DF_Large_HP_bg_Right";
		drawitems[Index].statusInfo.sForeLeftTex = "l2ui_ct1.Gauges.gauge_df_large_hp_left";
		drawitems[Index].statusInfo.sForeCenterTex = "l2ui_ct1.Gauges.gauge_df_large_hp_center";
		drawitems[Index].statusInfo.sForeRightTex = "l2ui_ct1.Gauges.gauge_df_large_hp_right";
		drawitems[Index].statusInfo.sOverLeftTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Left3";
		drawitems[Index].statusInfo.sOverCenterTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Center3";
		drawitems[Index].statusInfo.sOverRightTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Right3";			
	}
	else if(nSkinType == 3)
	{
		drawitems[Index].statusInfo.sBackLeftTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_Bg_Left";
		drawitems[Index].statusInfo.sBackCenterTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_Bg_Center";
		drawitems[Index].statusInfo.sBackRightTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_Bg_Right";
		drawitems[Index].statusInfo.sForeLeftTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_left";
		drawitems[Index].statusInfo.sForeCenterTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_center";
		drawitems[Index].statusInfo.sForeRightTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_right";
		drawitems[Index].statusInfo.sOverLeftTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Left3";
		drawitems[Index].statusInfo.sOverCenterTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Center3";
		drawitems[Index].statusInfo.sOverRightTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Right3";				
	}
	else
	{
		drawitems[Index].statusInfo.sBackLeftTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_Bg_Left";
		drawitems[Index].statusInfo.sBackCenterTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_Bg_Center";
		drawitems[Index].statusInfo.sBackRightTex = "L2UI_EPIC.SuppressWnd.Gauge_Yellow_Large_Bg_Right";
		drawitems[Index].statusInfo.sForeLeftTex = "L2UI_EPIC.SuppressWnd.Gauge_Red_Large_left";
		drawitems[Index].statusInfo.sForeCenterTex = "L2UI_EPIC.SuppressWnd.Gauge_Red_Large_center";
		drawitems[Index].statusInfo.sForeRightTex = "L2UI_EPIC.SuppressWnd.Gauge_Red_Large_right";
		drawitems[Index].statusInfo.sOverLeftTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Left3";
		drawitems[Index].statusInfo.sOverCenterTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Center3";
		drawitems[Index].statusInfo.sOverRightTex = "L2UI_CT1.Gauges.Gauge_DF_Large_Weight_Right3";
	}
	if(FontName == "")
	{
		drawitems[Index].statusInfo.FontName = "GameDefault";		
	}
	else
	{
		drawitems[Index].statusInfo.FontName = FontName;
	}
	if(FontColor.R == 0 && FontColor.G == 0 && FontColor.B == 0)
	{
		drawitems[Index].statusInfo.FontColor = GTColor().White;		
	}
	else
	{
		drawitems[Index].statusInfo.FontColor = FontColor;
	}
	drawitems[Index].statusInfo.ForeProgress = ForeProgress;
	drawitems[Index].statusInfo.OverProgress = OverProgress;
	drawitems[Index].statusInfo.Text = Text;
}

function AddEllipsisString(out array<RichListCtrlDrawItem> drawitems, string Text, int MaxW, optional Color TextColor, optional bool bStrNewLine, optional bool useDot, optional int nPosX, optional int nPosY, optional string FontName)
{
	local int Len, textW, textH;
	local string Str;
	local bool bEllipsised;

	Str = Text;
	bEllipsised = class'L2Util'.static.GetEllipsisString(Str, MaxW - nPosX);
	if(useDot)
	{
		addRichListCtrlString(drawitems, Str, TextColor, bStrNewLine, nPosX, nPosY, FontName);		
	}
	else
	{
		addRichListCtrlString(drawitems, Text, TextColor, bStrNewLine, nPosX, nPosY, FontName);
	}
	if(bEllipsised)
	{
		GetTextSizeDefault(Str, textW, textH);
		Len = drawitems.Length;
		addRichListCtrlTexture(drawitems, "L2UI_CT1.EmptyBtn", textW, textH, - textW, 0);
		drawitems[Len].nReservedTooltipID = 99999;
		drawitems[Len].TooltipDesc = Text;
	}
}

// LCDIT_TEXT
// ё®ДЎ ё®ЅєЖ® ДБЖ®·САЗ ЅєЖ®ёµ їАєкБ§Ж® return 
function StringDrawItem getRichListCtrlString(string Text, optional Color TextColor, optional bool bStrNewLine, optional string FontName)
{
	local StringDrawItem stringDrawItemInfo;

	stringDrawItemInfo.strData = Text;
	stringDrawItemInfo.strColor = TextColor;
	stringDrawItemInfo.bStrNewLine = bStrNewLine;
	if(FontName != "")
	{
		stringDrawItemInfo.FontName = FontName;
	}

	return stringDrawItemInfo;
}

// LCDIT_TEXTURE
// ё®ДЎ ё®ЅєЖ® ДБЖ®·САЗ ЕШЅєГД їАєкБ§Ж® return 
function TextureDrawItem getRichListCtrlTexture(string texPath, int nWeight, int nHeight, optional int UL, optional int VL)
{
	local TextureDrawItem textureDrawItemInfo;

	textureDrawItemInfo.Width = nWeight;
	textureDrawItemInfo.Height = nHeight;
	textureDrawItemInfo.UL = UL;
	textureDrawItemInfo.VL = VL;
	textureDrawItemInfo.sTex = texPath;
	return textureDrawItemInfo;
}

function ButtonDrawItem getRichListCtrlButton(string buttonStrID, string normalTexStr, string pushedTexStr, int nWeight, int nHeight, optional int UL, optional int VL)
{
	local ButtonDrawItem btnDrawItemInfo;

	btnDrawItemInfo.normalTex.Width = nWeight;
	btnDrawItemInfo.normalTex.Height = nHeight;
	btnDrawItemInfo.pushedTex.Width = nWeight;
	btnDrawItemInfo.pushedTex.Height = nHeight;
	btnDrawItemInfo.normalTex.UL = UL;
	btnDrawItemInfo.normalTex.VL = VL;
	btnDrawItemInfo.pushedTex.UL = UL;
	btnDrawItemInfo.pushedTex.VL = VL;
	btnDrawItemInfo.strID = buttonStrID;
	btnDrawItemInfo.normalTex.sTex = normalTexStr;
	btnDrawItemInfo.pushedTex.sTex = pushedTexStr;
	return btnDrawItemInfo;
}

function addRichListCtrlButton(out array<RichListCtrlDrawItem> drawitems, string buttonStrID, optional int nPosX, optional int nPosY, optional string normalTex, optional string pushedTex, optional string highlightTex, optional int nWeight, optional int nHeight, optional int U, optional int V, optional int nReservedTooltipID, optional string TooltipDesc)
{
	local int Index;

	if(drawitems.Length > 0)
	{
		drawitems.Length = drawitems.Length + 1;		
	}
	else
	{
		drawitems.Length = 1;
	}
	Index = drawitems.Length - 1;
	if(Index <= -1)
	{
		return;
	}

	drawitems[Index].eType = LCDIT_BUTTON;
	drawitems[Index].nPosX = nPosX;
	drawitems[Index].nPosY = nPosY;
	drawitems[Index].nReservedTooltipID = nReservedTooltipID;
	drawitems[Index].TooltipDesc = TooltipDesc;
	drawitems[Index].btnInfo.strID = buttonStrID;
	drawitems[Index].btnInfo.normalTex.sTex = normalTex;
	drawitems[Index].btnInfo.normalTex.Width = nWeight;
	drawitems[Index].btnInfo.normalTex.Height = nHeight;
	drawitems[Index].btnInfo.normalTex.UL = U;
	drawitems[Index].btnInfo.normalTex.VL = V;
	drawitems[Index].btnInfo.pushedTex.sTex = pushedTex;
	drawitems[Index].btnInfo.pushedTex.Width = nWeight;
	drawitems[Index].btnInfo.pushedTex.Height = nHeight;
	drawitems[Index].btnInfo.pushedTex.UL = U;
	drawitems[Index].btnInfo.pushedTex.VL = V;
	drawitems[Index].btnInfo.highlightTex.sTex = highlightTex;
	drawitems[Index].btnInfo.highlightTex.Width = nWeight;
	drawitems[Index].btnInfo.highlightTex.Height = nHeight;
	drawitems[Index].btnInfo.highlightTex.UL = U;
	drawitems[Index].btnInfo.highlightTex.VL = V;
}

function modifyRichListCtrlButton(out array<RichListCtrlDrawItem> drawitems, int drawitemIndex, string buttonStrID, optional int nPosX, optional int nPosY, optional string normalTex, optional string pushedTex, optional string highlightTex, optional int nWeight, optional int nHeight, optional int U, optional int V, optional int nReservedTooltipID, optional string TooltipDesc)
{
	local int Index;

	Index = drawitemIndex;
	if(Index <= -1)
	{
		return;
	}
	drawitems[Index].eType = LCDIT_BUTTON;
	drawitems[Index].nPosX = nPosX;
	drawitems[Index].nPosY = nPosY;
	drawitems[Index].nReservedTooltipID = nReservedTooltipID;
	drawitems[Index].TooltipDesc = TooltipDesc;
	drawitems[Index].btnInfo.strID = buttonStrID;
	drawitems[Index].btnInfo.normalTex.sTex = normalTex;
	drawitems[Index].btnInfo.normalTex.Width = nWeight;
	drawitems[Index].btnInfo.normalTex.Height = nHeight;
	drawitems[Index].btnInfo.normalTex.UL = U;
	drawitems[Index].btnInfo.normalTex.VL = V;
	drawitems[Index].btnInfo.pushedTex.sTex = pushedTex;
	drawitems[Index].btnInfo.pushedTex.Width = nWeight;
	drawitems[Index].btnInfo.pushedTex.Height = nHeight;
	drawitems[Index].btnInfo.pushedTex.UL = U;
	drawitems[Index].btnInfo.pushedTex.VL = V;
	drawitems[Index].btnInfo.highlightTex.sTex = highlightTex;
	drawitems[Index].btnInfo.highlightTex.Width = nWeight;
	drawitems[Index].btnInfo.highlightTex.Height = nHeight;
	drawitems[Index].btnInfo.highlightTex.UL = U;
	drawitems[Index].btnInfo.highlightTex.VL = V;	
}


// ѕЖАМЕЫ јц·® Д«їоЖ® єёАМБЦ±в
function setShowItemCount(out ItemInfo Info)
{
	if (!IsStackableItem(info.ConsumeType) || 
		Info.ID.ClassID == 57 ||        // ѕЖµҐіЄ
		Info.ID.ClassID == 80306 ||     // єн·Їµр ДЪАО
		Info.ID.ClassID == 91663)       // ї¤ДЪАО
		Info.bShowCount = false;
	else
	{
		Info.bShowCount = true;
	}
}

/**
 * №цЖ°АЗ ЕШЅєЖ®ё¦ єЇ°жЗСґЩ. АМ¶§ ЅГЅєЕЫЅєЖ®ёµАЗ АОµ¦Ѕєё¦ БЦѕо ЕШЅєЖ®ё¦ ј±ЕГЗСґЩ
 * 
 * @param
 * controlPath   : xml ДБЖ®·С °ж·О
 * texturePath   : ЖРЕ°ВЎ µИ ЕШЅєГД °ж·О
 * playLoopCount : Аз»эµЗґВ ·зЗБ Д«їоЖ® 
 * 
 * @return
 * void
 * 
 * @example 
 * animTexturePlay("testWnd.montionTexture", "l2_state_l2_...", 1);
 * 
 * */
function AnimTextureLoopPlay(string controlPath, string texturePath, int playLoopCount)
{
	GetAnimTextureHandle(controlPath).SetTexture(texturePath);
	GetAnimTextureHandle(controlPath).ShowWindow();
	GetAnimTextureHandle(controlPath).SetLoopCount(playLoopCount);
	GetAnimTextureHandle(controlPath).Stop();
	GetAnimTextureHandle(controlPath).Play();
}

// ѕЦґП ЕШЅєГД 
function AnimTextureStop(AnimTextureHandle animTexture, optional bool bHide)
{
	if(bHide)
	{
		animTexture.HideWindow();
	}
	animTexture.Stop();
}

function AnimTexturePlay(AnimTextureHandle animTexture, optional bool bShow, optional int playLoopCount)
{
	if(bShow)
	{
		animTexture.ShowWindow();
	}
	if(playLoopCount <= 0)
	{
		playLoopCount = 999999;
	}
	animTexture.SetLoopCount(playLoopCount);
	animTexture.Stop();
	animTexture.Play();
}

function string GetRaceString(int nRace)
{
	local string returnV;

	switch(nRace)
	{
		case 0:
			returnV = "human";
			break;
		case 1:
			returnV = "elf";
			break;
		case 2:
			returnV = "darkelf";
			break;
		case 3:
			returnV = "orc";
			break;
		case 4:
			returnV = "dwarf";
			break;
		case 5:
			returnV = "kamael";
			break;
		case 6:
			returnV = "Ertheia";
			break;
		case 30:
			returnV = "sylph";
			break;
		default:
			returnV = "";
			break;
	}
	return returnV;
}

function INT64 getInventoryItemNumByClassID(int nItemID)
{
	local array<ItemInfo> itemInfoArray;
	local INT64 ItemCount;

	class'UIDATA_INVENTORY'.static.FindItemByClassID(nItemID, itemInfoArray);
	if(itemInfoArray.Length > 0)
	{
		if(IsStackableItem(itemInfoArray[0].ConsumeType))
		{
			ItemCount = itemInfoArray[0].ItemNum;			
		}
		else
		{
			ItemCount = itemInfoArray.Length;
		}
	}
	return ItemCount;
}

function int EV_PacketID(int nServerPacketID)
{
	return EV_ProtocolBegin + nServerPacketID;
}

function bool hasEnoughItem(int ItemClassID, INT64 Amount)
{
	local INT64 invenItemCount;

	invenItemCount = getInventoryItemNumByClassID(ItemClassID);
	if(Amount <= invenItemCount)
	{
		return true;
	}
	return false;
}

static function L2UIInventoryObjectSimple AddItemListenerSimple(int ClassID, optional int ServerID, optional int Index)
{
	local L2UIInventoryObjectSimple iObject;

	iObject = GetInstanceL2UIInventory().NewObjectSimple(ClassID, ServerID, Index);
	return iObject;
}

static function RemObjectSimpleByObject(L2UIInventoryObjectSimple iObject)
{
	GetInstanceL2UIInventory().RemObjectSimpleByObject(iObject);
}

static function RemItemListenerSimple(int ClassID, optional int ServerID)
{
	GetInstanceL2UIInventory().RemObjectSimple(ClassID, ServerID);
}

static function L2UIInventoryObject AddItemListener(optional int Index)
{
	local L2UIInventoryObject iObject;

	iObject = GetInstanceL2UIInventory().NewObject();
	iObject.Index = Index;
	return iObject;
}

static function L2UIInventory GetInstanceL2UIInventory()
{
	return L2UIInventory(GetScript("L2UIInventory"));
}

static function L2UIInventoryObjectFindByCompare GetObjectFindItemByCompare()
{
	return L2UIInventory(GetScript("L2UIInventory")).L2UIInventoryFindByCompare;
}

static function string fillZeroString(int nLen, string sValue)
{
	local int N, i;
	local string rStr;

	N = nLen - Len(sValue);
	for (i = 0;i < N; i++)
	{
		rStr = "0" $ rStr;
	}
	return rStr $ sValue;
}

static function string getColorHexString(Color tColor)
{
	local string colorStr;

	colorStr = fillZeroString(2, decToHex(tColor.R)) $ fillZeroString(2,decToHex(tColor.G)) $ fillZeroString(2, decToHex(tColor.B));
	return colorStr;
}

static function string decToHex(int Value, optional bool bUse0x)
{
	local string returnString, hexStr;
	local int temp1;

	while(Value != 0)
	{
		temp1 = int(Value % 16);
		Value = Value / 16;
		if(temp1 < 10)
		{
			returnString = string(temp1) $ returnString;
		}
		else
		{
			hexStr = Chr(temp1 + 55);
			returnString = hexStr $ returnString;
		}
	}
	if(bUse0x)
	{
		returnString = "0x" $ returnString;
	}
	return returnString;
}

static function bool isNullWindow(WindowHandle checkWindowHandle)
{
	local WindowHandle nullWindow;

	if(checkWindowHandle == nullWindow)
	{
		return true;
	}
	return false;
}

// SkillInfo.IconType, ѕЧЖјєк ЅєЕіАОБц
static function bool isActiveSkill(int IconType)
{
	local bool B;

	switch(IconType)
	{
		//------------------ ѕЧЖјєк
		case 0:
		case 1:
		case 2:
		case 3:
		case 4:
		case 5:
		case 6:	// Ед±Ы ЅєЕі
		case 7:
		case 9: // ЖЇјц ЅєЕі
		case 21:
		case 22:
		case 23:
		case 24:
		case 25:
		case 26:
		case 27:
		case 28:
		case 29:
		case 30:
		case 31:
		case 32:
		case 51: // єЇЅЕГј ЅєЕі
			b = true;
			break;
	}

	return B;
}

function string getSkillTypeString(int nSkillIconType)
{
	local string returnV;

	if(IsUseRenewalSkillWnd())
	{
		switch(nSkillIconType)
		{
			case 3315:
				returnV = GetSystemString(1694);
				break;
			case 3320:
				returnV = GetSystemString(1695);
				break;
			case 3325:
				returnV = GetSystemString(1555);
				break;
			case 3330:
				returnV = GetSystemString(1552);
				break;
			case 3335:
				returnV = GetSystemString(14377);
				break;
			case 3340:
				returnV = GetSystemString(13592);
				break;
			case 3345:
				returnV = GetSystemString(13593);
				break;
			case 3350:
				returnV = GetSystemString(13594);
				break;
			case 3355:
				returnV = GetSystemString(14411);
				break;
			case 3360:
				returnV = GetSystemString(14415);
				break;
			case 3365:
				returnV = GetSystemString(14354);
				break;
			case 3615:
				returnV = GetSystemString(14446);
				break;
			case 3620:
				returnV = GetSystemString(1703);
				break;
			case 3625:
				returnV = GetSystemString(13596);
				break;
			case 3630:
				returnV = GetSystemString(14412);
				break;
			case 3635:
				returnV = GetSystemString(14413);
				break;
			case 6615:
				returnV = GetSystemString(14391);
				break;
			case 6620:
				returnV = GetSystemString(14379);
				break;
			case 6625:
				returnV = GetSystemString(14380);
				break;
			case 6630:
				returnV = GetSystemString(14381);
				break;
			case 6635:
				returnV = GetSystemString(14382);
				break;
			case 6640:
				returnV = GetSystemString(14378);
				break;
			case 6645:
				returnV = GetSystemString(14414);
				break;
			case 6650:
				returnV = GetSystemString(14388);
				break;
			case 51:
				returnV = GetSystemString(5896);
				break;
			default:
				returnV = "Error SkillType";
				break;
		}	
	}
	else
	{
		switch(nSkillIconType)
		{
			case 0:
				returnV = GetSystemString(1694);
				break;
			case 1:
				returnV = GetSystemString(1695);
				break;
			case 2:
				returnV = GetSystemString(1696);
				break;
			case 3:
				returnV = GetSystemString(13597);
				break;
			case 4:
				returnV = GetSystemString(13598);
				break;
			case 5:
				returnV = GetSystemString(1699);
				break;
			case 6:
				returnV = GetSystemString(1700);
				break;
			case 7:
				returnV = GetSystemString(1698);
				break;
			case 9:
				returnV = GetSystemString(1701);
				break;
			case 11:
				returnV = GetSystemString(1702);
				break;
			case 12:
				returnV = GetSystemString(1703);
				break;
			case 13:
				returnV = GetSystemString(1704);
				break;
			case 14:
				returnV = GetSystemString(1705);
				break;
			case 15:
				returnV = GetSystemString(1699);
				break;
			case 16:
				returnV = GetSystemString(1700);
				break;
			case 17:
				returnV = GetSystemString(3877);
				break;
			case 18:
				returnV = GetSystemString(3897);
				break;
			case 21:
				returnV = GetSystemString(1694);
				break;
			case 22:
				returnV = GetSystemString(1695);
				break;
			case 23:
				returnV = GetSystemString(1555);
				break;
			case 24:
				returnV = GetSystemString(1552);
				break;
			case 25:
				returnV = GetSystemString(13589);
				break;
			case 26:
				returnV = GetSystemString(1553);
				break;
			case 27:
				returnV = GetSystemString(1554);
				break;
			case 28:
				returnV = GetSystemString(13592);
				break;
			case 29:
				returnV = GetSystemString(13593);
				break;
			case 30:
				returnV = GetSystemString(13594);
				break;
			case 31:
				returnV = GetSystemString(13595);
				break;
			case 32:
				returnV = GetSystemString(3897);
				break;
			case 35:
				returnV = GetSystemString(1703);
				break;
			case 36:
				returnV = GetSystemString(1702);
				break;
			case 37:
				returnV = GetSystemString(13596);
				break;
			case 38:
				returnV = GetSystemString(13595);
				break;
			case 39:
				returnV = GetSystemString(1700);
				break;
			case 40:
				returnV = GetSystemString(3897);
				break;
			case 50:
				returnV = GetSystemString(313);
				break;
			case 51:
			case 52:
				returnV = GetSystemString(5896);
				break;
			default:
				returnV = "Error SkillType";
				break;
		}
	}
	return returnV;	
}

function string getSkillWeaponString(AttackType eAttackType)
{
	local string returnV;

	if(getInstanceUIData().getIsClassicServer())
	{
		returnV = getSkillWeaponStringClassic(eAttackType);		
	}
	else
	{
		returnV = getSkillWeaponStringLive(eAttackType);
	}
	return returnV;
}

function string getSkillWeaponStringClassic(AttackType eAttackType)
{
	local string returnV;

	switch(eAttackType)
	{
		case AT_SWORD:
		case AT_BUSTER:
			returnV = GetSystemString(13599);
			break;
		case AT_TWOHANDSWORD:
			returnV = GetSystemString(13601);
			break;
		case AT_BLUNT:
		case AT_STAFF:
			returnV = GetSystemString(13600);
			break;
		case AT_TWOHANDBLUNT:
		case AT_TWOHANDSTAFF:
			returnV = GetSystemString(2527);
			break;
		case AT_DAGGER:
			returnV = GetSystemString(45);
			break;
		case AT_POLE:
			returnV = GetSystemString(46);
			break;
		case AT_BOW:
			returnV = GetSystemString(48);
			break;
		case AT_DUAL:
			returnV = GetSystemString(504);
			break;
		case AT_DUALFIST:
			returnV = GetSystemString(2530);
			break;
		case AT_FISHINGROD:
			returnV = GetSystemString(3184);
			break;
		case AT_RAPIER:
			returnV = GetSystemString(1648);
			break;
		case AT_ANCIENTSWORD:
			returnV = GetSystemString(1650);
			break;
		case AT_SHOOTER:
			returnV = GetSystemString(13639);
			break;
		case AT_DUALBLUNT:
		case AT_DUALDAGGER:
		case AT_CROSSBOW:
		case AT_TWOHANDCROSSBOW:
		case AT_FIST:
		case AT_PISTOL:
		case AT_OWNTHING:
		case AT_FLAG:
		case AT_ETC:
			returnV = "";
	}
	return returnV;
}

function string getSkillWeaponStringLive(AttackType eAttackType)
{
	local string returnV;

	switch(eAttackType)
	{
		case AT_SWORD:
		case AT_BUSTER:
			returnV = GetSystemString(13599);
			break;
		case AT_TWOHANDSWORD:
			returnV = GetSystemString(13601);
			break;
		case AT_BLUNT:
		case AT_STAFF:
			returnV = GetSystemString(13600);
			break;
		case AT_TWOHANDBLUNT:
		case AT_TWOHANDSTAFF:
			returnV = GetSystemString(2527);
			break;
		case AT_DAGGER:
			returnV = GetSystemString(45);
			break;
		case AT_POLE:
			returnV = GetSystemString(46);
			break;
		case AT_BOW:
			returnV = GetSystemString(48);
			break;
		case AT_DUAL:
			returnV = GetSystemString(504);
			break;
		case AT_DUALFIST:
		case AT_FIST:
			returnV = GetSystemString(2530);
			break;
		case AT_FISHINGROD:
			returnV = GetSystemString(3184);
			break;
		case AT_RAPIER:
			returnV = GetSystemString(1648);
			break;
		case AT_CROSSBOW:
		case AT_TWOHANDCROSSBOW:
			returnV = GetSystemString(1649);
			break;
		case AT_ANCIENTSWORD:
			returnV = GetSystemString(1650);
			break;
		case AT_DUALDAGGER:
			returnV = GetSystemString(1970);
			break;
		case AT_DUALBLUNT:
			returnV = GetSystemString(2529);
			break;
		case AT_PISTOL:
		case AT_OWNTHING:
		case AT_FLAG:
		case AT_ETC:
			returnV = "";
	}
	return returnV;
}

function string getSkillTraitString(ESkillTraitType skillTraitType)
{
	local string returnV;

	if(getInstanceUIData().getIsClassicServer())
	{
		returnV = getSkillTraitStringClassic(skillTraitType);		
	}
	else
	{
		returnV = getSkillTraitStringLive(skillTraitType);
	}
	return returnV;
}

function string getSkillTraitStringClassic(ESkillTraitType skillTraitType)
{
	local string returnV;

	switch(skillTraitType)
	{
		case ESkillTrait_Hold:
			returnV = GetSystemString(13606);
			break;
		case ESkillTrait_Infection:
			returnV = GetSystemString(13607);
			break;
		case ESkillTrait_Sleep:
			returnV = GetSystemString(13608);
			break;
		case ESkillTrait_Shock:
			returnV = GetSystemString(13609);
			break;
		case ESkillTrait_Paralyze:
			returnV = GetSystemString(13610);
			break;
		case ESkillTrait_Seal:
			returnV = GetSystemString(13611);
			break;
		case ESkillTrait_Pull:
			returnV = GetSystemString(13612);
			break;
		case ESkillTrait_Silence:
			returnV = GetSystemString(13613);
			break;
		case ESkillTrait_Fear:
			returnV = GetSystemString(13614);
			break;
		case ESkillTrait_SlowDown:
			returnV = GetSystemString(13615);
			break;
		default:
			returnV = "";
			break;
	}
	return returnV;
}

function string getSkillTraitStringLive(int nMezType)
{
	local string returnV;

	switch(nMezType)
	{
		case 11:
			returnV = GetSystemString(13616);
			break;
		case 12:
		case 1:
		case 13:
		case 14:
		case 15:
		case 16:
		case 17:
			returnV = GetSystemString(13617);
			break;
		case 18:
		case 19:
			returnV = GetSystemString(13618);
			break;
		case 3:
		case 20:
			returnV = GetSystemString(13619);
			break;
		case 21:
		case 22:
		case 23:
		case 24:
		case 4:
		case 5:
		case 25:
		case 26:
		case 7:
			returnV = GetSystemString(13620);
			break;
		default:
			returnV = "";
			break;
	}
	return returnV;
}

function string getSkillTargetTypeString(ESkillTargetType skillTargetType)
{
	local string returnV;

	switch(skillTargetType)
	{
		case ESkillTargetType.ESkillTarget_Enemy/*1*/:
		case ESkillTargetType.ESkillTarget_EnemyOnly/*2*/:
		case ESkillTargetType.ESkillTarget_RealEnemyOnly/*8*/:
			returnV = GetSystemString(13621);
			break;
		case ESkillTargetType.ESkillTarget_EnemyNot/*3*/:
			returnV = GetSystemString(13622);
			break;
		case ESkillTargetType.ESkillTarget_Self/*4*/:
			returnV = GetSystemString(436);
			break;
		case ESkillTargetType.ESkillTarget_Summon/*5*/:
			returnV = GetSystemString(505);
			break;
		case ESkillTargetType.ESkillTarget_Target/*6*/:
		case ESkillTargetType.ESkillTarget_TargetSelf/*7*/:
			returnV = GetSystemString(13693);
			break;
		default:
			returnV = "";
			break;
	}
	return returnV;	
}

function string getSkillAffectTypeString(ESkillAffectScope skillAffectObject)
{
	local string returnV;

	switch(skillAffectObject)
	{
		case ESkillAffect_Single:
			returnV = GetSystemString(13625);
			break;
		case ESkillAffect_Party:
			returnV = GetSystemString(440);
			break;
		case ESkillAffect_Pledge:
			returnV = GetSystemString(439);
			break;
		case ESkillAffect_Fan:
		case ESkillAffect_PointBlank:
		case ESkillAffect_RangeSortByDist:
		case ESkillAffect_RangeSortByHp:
		case ESkillAffect_Range:
		case ESkillAffect_Square:
        case ESkillAffect_Range_sort_by_block_act:
        case ESkillAffect_Fan_with_relation:
        case ESkillAffect_Point_blank_with_relation:
        case ESkillAffect_Range_with_relation:
        case ESkillAffect_Square_with_relation:
			returnV = GetSystemString(13626);
			break;
		default:
			returnV = "";
			break;
	}
	return returnV;
}

function string getSkillEquipNameStr(int SkillID, int Level, int SubLevel)
{
	local ESkillConditionEquipType o_EquipType;
	local string returnStr;
	local array<AttackType> o_ArrWeapons;

	class'UIDATA_SKILL'.static.GetMSCondEquipType(SkillID, Level, SubLevel, o_EquipType);
	switch(o_EquipType)
	{
		case SCET_SHIELD:
			returnStr = GetSystemString(231);
			break;
		case SCET_WEAPON:
			class'UIDATA_SKILL'.static.GetMSCondWeapons(SkillID, Level, SubLevel, o_ArrWeapons);
			if(getInstanceUIData().getIsClassicServer())
			{
				returnStr = outputFilterAttackTypeClassic(o_ArrWeapons);				
			}
			else
			{
				returnStr = outputFilterAttackTypeLive(o_ArrWeapons);
			}
			break;
	}
	return returnStr;
}

function string outputFilterAttackTypeLive(array<AttackType> ArrWeapons)
{
	local array<int> condition1, condition2, condition3, condition4, condition5, condition6;

	local string returnStr;
	local int i;

	condition1[condition1.Length] = 1;
	condition1[condition1.Length] = 3;
	condition1[condition1.Length] = 2;
	condition1[condition1.Length] = 4;
	condition1[condition1.Length] = 5;
	condition1[condition1.Length] = 6;
	condition1[condition1.Length] = 7;
	condition1[condition1.Length] = 8;
	condition1[condition1.Length] = 9;
	condition1[condition1.Length] = 14;
	condition1[condition1.Length] = 13;
	condition1[condition1.Length] = 20;
	condition1[condition1.Length] = 23;
	condition2[condition2.Length] = 1;
	condition2[condition2.Length] = 3;
	condition2[condition2.Length] = 2;
	condition3[condition3.Length] = 3;
	condition3[condition3.Length] = 5;
	condition4[condition4.Length] = 6;
	condition4[condition4.Length] = 7;
	condition5[condition5.Length] = 10;
	condition5[condition5.Length] = 14;
	condition6[condition6.Length] = 17;
	condition6[condition6.Length] = 22;

	for(i = 0; i < ArrWeapons.Length; i++)
	{
		Debug("ArrWeapons" @ string(i) @ ":" @ string(ArrWeapons[i]));
	}
	if(compareAttackType(ArrWeapons, condition1))
	{
		returnStr = returnStr $ "/" $ GetSystemString(13602);
	}
	Debug("모든 근접 무기 체크" @ returnStr);
	if(compareAttackType(ArrWeapons, condition2))
	{
		returnStr = returnStr $ "/" $ GetSystemString(13603);
	}
	Debug("도검류 체크" @ returnStr);
	if(compareAttackType(ArrWeapons, condition3))
	{
		returnStr = returnStr $ "/" $ GetSystemString(13604);
	}
	Debug("둔기류 체크" @ returnStr);
	if(compareAttackType(ArrWeapons, condition4))
	{
		returnStr = returnStr $ "/" $ GetSystemString(13605);
	}
	Debug("지팡이류  체크" @ returnStr);
	if(compareAttackType(ArrWeapons, condition5))
	{
		returnStr = returnStr $ "/" $ GetSystemString(2530);
	}
	Debug("격투무기 체크" @ returnStr);
	if(compareAttackType(ArrWeapons, condition6))
	{
		returnStr = returnStr $ "/" $ GetSystemString(1649);
	}
	Debug("석궁 체크" @ returnStr);

	for(i = 0; i < ArrWeapons.Length; i++)
	{
		returnStr = returnStr $ "/" $ getSkillWeaponString(ArrWeapons[i]);
	}
	if(Len(returnStr) > 0)
	{
		returnStr = Right(returnStr, Len(returnStr) - 1);
	}
	return returnStr;
}

function string outputFilterAttackTypeClassic(array<AttackType> ArrWeapons)
{
	local array<int> condition1, condition2, condition3, condition4, condition5, condition6,
		condition7, condition8;

	local string returnStr;
	local int i;

	condition1[condition1.Length] = 1;
	condition1[condition1.Length] = 3;
	condition1[condition1.Length] = 2;
	condition1[condition1.Length] = 4;
	condition1[condition1.Length] = 5;
	condition1[condition1.Length] = 6;
	condition1[condition1.Length] = 7;
	condition1[condition1.Length] = 14;
	condition1[condition1.Length] = 11;
	condition1[condition1.Length] = 18;
	condition1[condition1.Length] = 16;
	condition1[condition1.Length] = 9;
	condition1[condition1.Length] = 8;
	condition1[condition1.Length] = 13;
	condition1[condition1.Length] = 25;
	condition2[condition2.Length] = 4;
	condition2[condition2.Length] = 6;
	condition2[condition2.Length] = 5;
	condition2[condition2.Length] = 7;
	condition3[condition3.Length] = 1;
	condition3[condition3.Length] = 3;
	condition3[condition3.Length] = 2;
	condition4[condition4.Length] = 1;
	condition4[condition4.Length] = 2;
	condition5[condition5.Length] = 1;
	condition5[condition5.Length] = 3;
	condition6[condition6.Length] = 4;
	condition6[condition6.Length] = 6;
	condition7[condition7.Length] = 5;
	condition7[condition7.Length] = 7;
	condition8[condition8.Length] = 2;
	condition8[condition8.Length] = 5;
	condition8[condition8.Length] = 7;
	if(compareAttackType(ArrWeapons, condition1))
	{
		returnStr = returnStr $ "/" $ GetSystemString(2520);
	}
	if(compareAttackType(ArrWeapons, condition3))
	{
		returnStr = returnStr $ "/" $ GetSystemString(43);
	}
	if(compareAttackType(ArrWeapons, condition4))
	{
		returnStr = returnStr $ "/" $ GetSystemString(43);
	}
	if(compareAttackType(ArrWeapons, condition5))
	{
		returnStr = returnStr $ "/" $ GetSystemString(13599);
	}
	if(compareAttackType(ArrWeapons, condition2))
	{
		returnStr = returnStr $ "/" $ GetSystemString(44);
	}
	if(compareAttackType(ArrWeapons, condition6))
	{
		returnStr = returnStr $ "/" $ GetSystemString(13600);
	}
	if(compareAttackType(ArrWeapons, condition8))
	{
		returnStr = returnStr $ "/" $ GetSystemString(13601) $ "/" $ GetSystemString(2527);
	}
	if(compareAttackType(ArrWeapons, condition7))
	{
		returnStr = returnStr $ "/" $ GetSystemString(2527);
	}

	for(i = 0; i < ArrWeapons.Length; i++)
	{
		returnStr = returnStr $ "/" $ getSkillWeaponString(ArrWeapons[i]);
	}
	if(Len(returnStr) > 0)
	{
		returnStr = Right(returnStr, Len(returnStr) - 1);
	}
	return returnStr;
}

function bool compareAttackType(out array<AttackType> ArrWeapons, array<int> checkArray)
{
	local int i, N;
	local bool isSame;

	if(ArrWeapons.Length == 0)
	{
		return false;
	}

	for(N = 0; N < checkArray.Length; N++)
	{
		isSame = false;

		for(i = 0; i < ArrWeapons.Length; i++)
		{
			if(ArrWeapons[i] == checkArray[N])
			{
				isSame = true;
				// [Explicit Break]
				break;
			}
		}
		if(! isSame)
		{
			// [Explicit Break]
			break;
		}
	}
	if(! isSame)
	{
		return false;
	}

	for(N = 0; N < checkArray.Length; N++)
	{
		for(i = 0; i < ArrWeapons.Length; i++)
		{
			if(ArrWeapons[i] == checkArray[N])
			{
				ArrWeapons.Remove(i, 1);
				// [Explicit Break]
				break;
			}
		}
	}
	return true;
}

static function float floatMultiply(float P1, float P2)
{
	local int n1, n2, sum;

	n1 = int(P1 * 1000);
	n2 = int(P2 * 1000);
	sum = n1 * n2;
	return sum / 1000000;
}

function CommonDialogSetScript(string uiControlDialogAsset_path, optional string disable_tex_path, optional bool bUseNeedItem)
{
	local WindowHandle popExpandWnd;
	local UIControlDialogAssets popupExpandScript;

	popExpandWnd = GetWindowHandle(uiControlDialogAsset_path);
	popupExpandScript = class'UIControlDialogAssets'.static.InitScript(popExpandWnd);
	popupExpandScript.SetUseNeedItem(bUseNeedItem);
	if(disable_tex_path != "")
	{
		popupExpandScript.SetDisableWindow(GetWindowHandle(disable_tex_path));
	}
}

function UIControlDialogAssets CommonDialogGetScript(string uiControlDialogAsset_path)
{
	return UIControlDialogAssets(GetWindowHandle(uiControlDialogAsset_path).GetScript());
}

function CommonDialogShow(string uiControlDialogAsset_path, string dialogDesc, optional bool bHtml, optional int okButtonString, optional int cancelButtonString, optional Color TextColor)
{
	local UIControlDialogAssets popupExpandScript;

	popupExpandScript = CommonDialogGetScript(uiControlDialogAsset_path);
	popupExpandScript.SetDialogDesc(dialogDesc, okButtonString, cancelButtonString, bHtml, TextColor);
	popupExpandScript.Show();
}

function CommonDialogHide(string uiControlDialogAsset_path)
{
	local UIControlDialogAssets popupExpandScript;

	popupExpandScript = CommonDialogGetScript(uiControlDialogAsset_path);
	popupExpandScript.Hide();
}

function EAutoNextTargetMode GetNextTargetModeOption()
{
	if(getInstanceUIData().getIsClassicServer())
	{
		switch(GetOptionInt("CommunIcation", "NextTargetModeClassic"))
		{
			case 0:
				return ANTM_DEFAULT;
			case 1:
				return ANTM_HOSTILE_NPC;
			case 2:
				return ANTM_HOSTILE_PC;
			case 3:
				return ANTM_FRIENDLY_NPC;
			case 4:
				return ANTM_DEFAULT_AND_COUNTER_ATTACK;
		}
	}
	switch(GetOptionInt("CommunIcation", "NextTargetMode"))
	{
		case 0:
			return ANTM_DEFAULT;
		case 1:
			return ANTM_HOSTILE_NPC;
		case 2:
			return ANTM_HOSTILE_PC;
		case 3:
			return ANTM_FRIENDLY_NPC;
		default:
			return ANTM_DEFAULT;
	}
}

function bool isCollectionItem(ItemInfo item)
{
	local array<int> collectionidArray;

	GetCollectionIdByItemId(collectionidArray, item.Id.ClassID);
	if(collectionidArray.Length > 0)
	{
		return true;
	}
	return false;
}

function string stringPer(float A, float B)
{
	local string Str, returnStr;
	local array<string> arrSplit;

	Str = string(float(appCeil(((A / B) * 100) * 10)) / 10);
	Split(Str, ".", arrSplit);
	returnStr = (arrSplit[0] $ ".") $ Mid(arrSplit[1], 0, 1);
	return returnStr;
}

function string string0100Per(float A)
{
	local string returnStr;

	if(A <= 0)
	{
		returnStr = "0";		
	}
	else if(A >= 100)
	{
		returnStr = "100";			
	}
	else
	{
		returnStr = string(A);
	}
	return returnStr;	
}

function string GetServerMarkNameSmall(int WorldID)
{
	local string Tex;

	Tex = GetServerMarkName(WorldID);
	if(Tex == "")
	{
		Tex = "L2UI_CT1.EmptyBtn";		
	}
	else
	{
		Tex = "L2UI_EPIC.DethroneWnd.Crest_" $ Tex;
	}
	return Tex;
}

function string GetServerMark(int WorldID)
{
	local string Tex;

	Tex = GetServerMarkName(WorldID);
	if(Tex == "")
	{
		Tex = "L2UI_CT1.EmptyBtn";		
	}
	else
	{
		Tex = "L2UI_EPIC.DethroneWnd.Crest_" $ Tex $ "_Green";
	}
	return Tex;
}

function string GetServerMarkNameTarget(int WorldID, bool bEnemy)
{
	local string Tex;

	Tex = GetServerMarkName(WorldID);
	if(bEnemy)
	{
		Tex = "L2UI_CT1.TargetStatusWnd.TargetStatusWnd_DethroneServerIcon_" $ Tex $ "_Red";		
	}
	else
	{
		Tex = "L2UI_CT1.TargetStatusWnd.TargetStatusWnd_DethroneServerIcon_" $ Tex $ "_Blue";
	}
	return Tex;
}

static function string getWorldNameToLocalName(string worldName)
{
	local string UserName;
	local array<string> arr;

	Split(worldName, "_", arr);
	if(arr.Length > 1)
	{
		UserName = arr[0];		
	}
	else
	{
		UserName = worldName;
	}
	return UserName;
}

static function string getWorldServerFullName(string worldName)
{
	local string UserName;
	local int serverNo;
	local array<string> arr;

	Split(worldName, "_", arr);
	if(arr.Length > 1)
	{
		serverNo = int(arr[1]);
		UserName = arr[0] $ "_" $ getServerNameByWorldID(serverNo);		
	}
	else
	{
		UserName = worldName;
	}
	return UserName;	
}

static function string getServerNameByWorldID(int ServerWorldID)
{
	local ServerInfoUIData sUiData;

	class'UIDataManager'.static.GetServerInfo(ServerWorldID, sUiData);
	return sUiData.ServerName;
}

static function int getServerExtIdByWorldID(int ServerWorldID)
{
	local ServerInfoUIData sUiData;

	class'UIDataManager'.static.GetServerInfo(ServerWorldID, sUiData);
	return sUiData.ServerExtID;
}

function bool isMyServer(int compareServerID)
{
	local UserInfo Info;

	GetPlayerInfo(Info);
	if(Info.nWorldID == compareServerID)
	{
		return true;
	}
	return false;
}

function string GetCenterTable(string htm, int W, int h, optional string Align, optional string VAlign)
{
	if(Align == "")
	{
		Align = "Center";
	}
	if(VAlign == "")
	{
		VAlign = "Center";
	}
	htm = htmlAddTableTD(htm, Align, VAlign, W, h);
	htmlSetTableTR(htm);
	htmlSetTable(htm, 0, 0, 0, "", 0, 0);
	return htm;
}

function string GetNameHtmlFull(ItemInfo item)
{
	local string HTML, textureHtml;
	local int W;

	if(item.Enchanted > 0)
	{
		HTML = GetEnchantedHtml(item.Enchanted) $ " ";
	}
	if(item.IsBlessedItem)
	{
		HTML = HTML $ GetNameHtmlBress() $ " ";
	}
	HTML = HTML $ GetNameHtml(item);
	if(Len(item.AdditionalName) > 0)
	{
		HTML = HTML @ GetNameHtmlAddionalName(item.AdditionalName);
	}
	HTML = htmlAddTableTD(HTML, "Center", "center", 0, 22);
	textureHtml = GetNameHtmlGradeIcon(item.CrystalType, W);
	if(textureHtml != "")
	{
		HTML = HTML $ htmlAddTableTD(" " $ textureHtml, "Center", "Center", W + 5, 22, "", true);
	}
	HTML = htmlSetTableTR(HTML);
	return htmlSetTable(HTML, 0, 0, 16, "", 0, 0);
}

function string GetEnchantedHtml(int Enchanted)
{
	return htmlAddText("+" $ string(Enchanted), "GameDefault", "AA6EE6");
}

function string GetNameHtmlBress()
{
	return htmlAddText(GetSystemString(13403), "GameDefault", "7A96AB");
}

function string GetNameHtml(ItemInfo item)
{
	local string ItemName, collorString;

	if(class'UIData'.static.Inst().getIsLiveServer())
	{
		ItemName = class'UIDATA_ITEM'.static.GetRefineryItemName(item.Name, item.RefineryOp1, item.RefineryOp2);		
	}
	else
	{
		ItemName = item.Name;
	}
	switch(class'UIDATA_ITEM'.static.GetItemNameClass(item.Id))
	{
		case 0:
			collorString = "5F5F5F";
			break;
		case 1:
			collorString = "FFFFFF";
			break;
		case 2:
			collorString = "FFA904";
			break;
		case 3:
			collorString = "F04444";
			break;
		case 4:
			collorString = "21A4FF";
			break;
		case 5:
			collorString = "FF00FF";
			break;
	}
	return htmlAddText(ItemName, "GameDefault", collorString);
}

function string GetNameHtmlAddionalName(string AdditionalName)
{
	return htmlAddText(AdditionalName, "GameDefault", getColorHexString(GetColor(255, 217, 105, 255)));
}

function string GetNameHtmlGradeIcon(int nCrystalType, out int W)
{
	local int h;
	local string gradeTextureName;

	gradeTextureName = GetItemGradeTextureName(nCrystalType);
	if(gradeTextureName == "")
	{
		return "";
	}
	if(nCrystalType == 6 || nCrystalType == 7 || nCrystalType == 9 || nCrystalType == 10 || nCrystalType == 11)
	{
		W = 32;
		h = 16;		
	}
	else
	{
		W = 16;
		h = 16;
	}
	return htmlAddImg(gradeTextureName, W, h);
}

function string cutZeroDecimalStr(string Probability)
{
	local int i;
	local array<string> arrSplit;

	if(float(int(Probability)) < float(Probability))
	{
		Split(Probability, ".", arrSplit);

		for(i = Len(arrSplit[1]); i > 0; i--)
		{
			if(Mid(arrSplit[1], i - 1, 1) != "0")
			{
				arrSplit[1] = Left(arrSplit[1], i);
				// [Explicit Break]
				break;
			}
		}
		return arrSplit[0] $ "." $ arrSplit[1];
	}
	return string(int(Probability));
}

function string cutZeroDecimalFloat(float Probability)
{
	local int i;
	local array<string> arrSplit;

	if(float(int(Probability)) < Probability)
	{
		Split(string(Probability), ".", arrSplit);
		
		for(i = Len(arrSplit[1]); i > 0; i--)
		{
			if(Mid(arrSplit[1], i - 1, 1) != "0")
			{
				arrSplit[1] = Left(arrSplit[1], i);
				// [Explicit Break]
				break;
			}
		}
		return (arrSplit[0] $ ".") $ arrSplit[1];
	}
	return string(int(Probability));
}

function INT64 MAX64(INT64 A, INT64 B)
{
	if(A > B)
	{
		return A;
	}
	return B;
}

function setWindowTitleByString(string windowTitleStr)
{
	if(GetTextBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".FrameHeaderWnd.FrameTitle_txt").m_pTargetWnd == none)
	{
		GetWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath).SetWindowTitle(windowTitleStr);		
	}
	else
	{
		GetTextBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".FrameHeaderWnd.FrameTitle_txt").SetText(windowTitleStr);
	}	
}

function setWindowTitleBySysStringNum(int windowTitleSysStringNum)
{
	if(GetTextBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".FrameHeaderWnd.FrameTitle_txt").m_pTargetWnd == none)
	{
		GetWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath).SetWindowTitle(GetSystemString(windowTitleSysStringNum));		
	}
	else
	{
		GetTextBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ ".FrameHeaderWnd.FrameTitle_txt").SetText(GetSystemString(windowTitleSysStringNum));
	}	
}

function AnimTextureHandle GetMeAnimTexture(string Path)
{
	return GetAnimTextureHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function BarHandle GetMeBar(string Path)
{
	return GetBarHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function ButtonHandle GetMeButton(string Path)
{
	return GetButtonHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function CharacterViewportWindowHandle GetMeCharacterViewportWindow(string Path)
{
	return GetCharacterViewportWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function ChatWindowHandle GetMeChatWindow(string Path)
{
	return GetChatWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function CheckBoxHandle GetMeCheckBox(string Path)
{
	return GetCheckBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function ComboBoxHandle GetMeComboBox(string Path)
{
	return GetComboBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function DrawPanelHandle GetMeDrawPanel(string Path)
{
	return GetDrawPanelHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function EditBoxHandle GetMeEditBox(string Path)
{
	return GetEditBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function EffectViewportWndHandle GetMeEffectViewportWnd(string Path)
{
	return GetEffectViewportWndHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function HtmlHandle GetMeHtml(string Path)
{
	return GetHtmlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function ItemWindowHandle GetMeItemWindow(string Path)
{
	return GetItemWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function ListBoxHandle GetMeListBox(string Path)
{
	return GetListBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function ListCtrlHandle GetMeListCtrl(string Path)
{
	return GetListCtrlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function MinimapCtrlHandle GetMeMinimapCtrl(string Path)
{
	return GetMinimapCtrlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function MultiEditBoxHandle GetMeMultiEditBox(string Path)
{
	return GetMultiEditBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function NameCtrlHandle GetMeNameCtrl(string Path)
{
	return GetNameCtrlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function ProgressCtrlHandle GetMeProgressCtrl(string Path)
{
	return GetProgressCtrlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function PropertyControllerHandle GetMePropertyController(string Path)
{
	return GetPropertyControllerHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function RadarMapCtrlHandle GetMeRadarMapCtrl(string Path)
{
	return GetRadarMapCtrlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function RadioButtonHandle GetMeRadioButton(string Path)
{
	return GetRadioButtonHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function RichListCtrlHandle GetMeRichListCtrl(string Path)
{
	return GetRichListCtrlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function SliderCtrlHandle GetMeSliderCtrl(string Path)
{
	return GetSliderCtrlHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function StatusBarHandle GetMeStatusBar(string Path)
{
	return GetStatusBarHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function StatusRoundHandle GetMeStatusRound(string Path)
{
	return GetStatusRoundHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function TabHandle GetMeTab(string Path)
{
	return GetTabHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function TextBoxHandle GetMeTextBox(string Path)
{
	return GetTextBoxHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function TextureHandle GetMeTexture(string Path)
{
	return GetTextureHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function TreeHandle GetMeTree(string Path)
{
	return GetTreeHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function WebBrowserHandle GetMeWebBrowser(string Path)
{
	return GetWebBrowserHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function WindowHandle GetMeWindow(optional string Path)
{
	if(Path == "")
	{
		return GetWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath);
	}
	return GetWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ Path);	
}

function string selfName(optional string addStringPath)
{
	if(addStringPath == "")
	{
		return m_hOwnerWnd.m_WindowNameWithFullPath;
	}
	return m_hOwnerWnd.m_WindowNameWithFullPath $ "." $ addStringPath;	
}

function closeUI()
{
	PlayConsoleSound(IFST_WINDOW_CLOSE);
	GetWindowHandle(m_hOwnerWnd.m_WindowNameWithFullPath).HideWindow();	
}

function ItemInfo getSkillToItemInfo(SkillInfo rSkilInfo)
{
	local ItemInfo infItem;

	infItem.Id.ClassID = rSkilInfo.SkillID;
	infItem.Level = rSkilInfo.SkillLevel;
	infItem.SubLevel = rSkilInfo.SkillSubLevel;
	infItem.Name = rSkilInfo.SkillName;
	infItem.IconName = rSkilInfo.TexName;
	infItem.IconPanel = rSkilInfo.IconPanel;
	infItem.Description = rSkilInfo.SkillDesc;
	infItem.ShortcutType = 2;
	infItem.ItemType = rSkilInfo.OperateType;
	return infItem;	
}

function SkillInfo GetSkillInfoByValue(int SkillID, int SkillLevel, int SkillSubLevel)
{
	local SkillInfo a_SkillInfo;

	GetSkillInfo(SkillID, SkillLevel, SkillSubLevel, a_SkillInfo);
	return a_SkillInfo;	
}

function int GetTextSizeWidth(string targetString, optional string FontName)
{
	local int nWidth, nHeight;

	if(FontName == "")
	{
		FontName = "GameDefault";
	}
	GetTextSize(targetString, FontName, nWidth, nHeight);
	return nWidth;	
}

function int GetTextSizeHeight(string targetString, optional string FontName)
{
	local int nWidth, nHeight;

	if(FontName == "")
	{
		FontName = "GameDefault";
	}
	GetTextSize(targetString, FontName, nWidth, nHeight);
	return nHeight;	
}

function DrawPanelArray(DrawPanelHandle drawPanel, out array<DrawItemInfo> drawListArr, optional bool bClear)
{
	local int i;

	if(bClear)
	{
		drawPanel.Clear();
	}

	for(i = 0; i < drawListArr.Length; i++)
	{
		drawPanel.InsertDrawItem(drawListArr[i]);
	}	
}

function DrawPanelArrayFixedWidth(DrawPanelHandle drawPanel, out array<DrawItemInfo> drawListArr, optional bool bClear, optional int fixedWidth)
{
	local int i, nH;

	if(bClear)
	{
		drawPanel.Clear();
	}
	if(fixedWidth <= 0)
	{
		drawPanel.GetWindowSize(fixedWidth, nH);
	}
	drawPanel.InsertDrawItem(addDrawItemTextureCustom("L2UI_CT1.EmptyBtn", false, true, 0, 0, fixedWidth, 1, 1, 1));
	drawPanel.InsertDrawItem(addDrawItemBlank(0));

	for(i = 0; i < drawListArr.Length; i++)
	{
		drawPanel.InsertDrawItem(drawListArr[i]);
	}	
}

function MoveRowData(RichListCtrlHandle tlist, int fromIndex, int toIndex)
{
	local RichListCtrlRowData rowData;

	if(fromIndex == toIndex)
	{
		return;
	}
	tlist.GetRec(fromIndex, rowData);
	if(fromIndex < toIndex)
	{
		InsertRowData(tlist, rowData, toIndex);
		tlist.DeleteRecord(fromIndex);		
	}
	else
	{
		tlist.DeleteRecord(fromIndex);
		InsertRowData(tlist, rowData, toIndex);
	}	
}

function InsertRowData(RichListCtrlHandle tlist, RichListCtrlRowData rowDataNew, int Index)
{
	local int i, lastIndex, SelectedIndex;
	local RichListCtrlRowData rowData;

	if(tlist.GetRecordCount() == 0)
	{
		tlist.InsertRecord(rowDataNew);		
	}
	else
	{
		SelectedIndex = tlist.GetSelectedIndex();
		lastIndex = tlist.GetRecordCount() - 1;
		tlist.GetRec(lastIndex, rowData);
		tlist.InsertRecord(rowData);
		
		for(i = lastIndex; i > Index; i--)
		{
			tlist.GetRec(i - 1, rowData);
			tlist.ModifyRecord(i, rowData);
		}
		tlist.ModifyRecord(Index, rowDataNew);
		if(Index <= SelectedIndex)
		{
			tlist.SetSelectedIndex(SelectedIndex + 1, false);
		}
	}	
}

function GetLocalPosition(WindowHandle W, out int X, out int Y)
{
	local Rect rectWnd, rectWndParent;

	rectWnd = W.GetRect();
	if(W.m_pTargetWnd == none)
	{
		X = rectWnd.nX;
		Y = rectWnd.nY;
		return;
	}
	rectWndParent = W.GetParentWindowHandle().GetRect();
	X = rectWnd.nX - rectWndParent.nX;
	Y = rectWnd.nY - rectWndParent.nY;	
}

function Local2Global(WindowHandle W, int locX, int locY, out int GlobalX, out int GlobalY)
{
	local Rect rectWnd;

	rectWnd = W.GetRect();
	GlobalX = rectWnd.nX + locX;
	GlobalY = rectWnd.nY + locY;	
}

function Global2Local(WindowHandle W, int GlobalX, int GlobalY, out int locX, out int locY)
{
	local Rect rectWnd;

	rectWnd = W.GetRect();
	locX = GlobalX - rectWnd.nX;
	locY = GlobalY - rectWnd.nY;	
}
