class BottomBar extends UICommonAPI;

const TIMER_ID_SUPPRESS = 1;
const ITEM_ID_A_COIN = 97145;
const ITEM_ID_GIRAN_COIN = 92314;

enum EBottomBarBtnType 
{
	TypeNone,
	PostBox,
	Clan,
	Party,
	PcCafePoint,
	LCoinShop,
	adena,
	Inventory,
	Suppress,
	MagicLamp,
	RandomCraft,
	LCoinCraft,
	VitaminManager,
	DualInventory
};

enum EExpBoostType 
{
	ExpBoostNone,
	ExpBoostVital,
	ExpBoostBuff,
	ExpBoostPassive,
	ExpBoostMax
};

struct BottomBarInfo
{
	var UIPacket._S_EX_USER_BOOST_STAT expBoostInfos[4];
	var float expPercentRate;
	var int unreadMailCnt;
	var bool isClanMember;
	var int clanMemberCnt;
	var INT64 bloodyCoinCnt;
	var INT64 adenaCnt;
	var INT64 aCoinCnt;
	var INT64 giranCoinCnt;
	var int PcCafePoint;
	var int invenCnt;
	var int invenMaxCnt;
	var int suppressId;
	var int suppressKeyCnt;
	var bool isSuppressMaxKey;
	var bool isSuppressHotTime;
	var string suppressName;
	var int suppressPoint;
	var int suppressMaxPoint;
	var bool isSuppressAlarm;
	var float magicLampPercent;
	var int magicLampBoostPercent;
	var int magicLampBoostCnt;
	var bool isMagicLampNormalEffect;
	var bool isMagicLampCompleteEffect;
	var int randomCraftPoint;
	var int randomCraftCharge;
	var bool isRandomCraftAlarm;
	var int carringWeight;
	var int carryWeight;
	var bool isPartyOnState;
	var bool isPartyAlarm;
	var bool isPartyWndMinimized;
};

struct BottomBarBtnInfo
{
	var EBottomBarBtnType Type;
	var WindowHandle btnWnd;
	var Rect defaultRect;
};

var array<BottomBarBtnInfo> _bottomBarBtns;
var array<EBottomBarBtnType> _availableBtnGroup;
var BottomBarInfo _bottomBarInfo;
var WindowHandle Me;
var ButtonHandle expBoostBtn;
var StatusBarHandle expStatusBar;
var WindowHandle expInfoWnd;
var TextBoxHandle expTextBox;
var TextBoxHandle expBoostTextBox;
var TextureHandle expBoostOnTex;
var TextureHandle expBoostOffTex;

static function BottomBar Inst()
{
	return BottomBar(GetScript("BottomBar"));	
}

function Initialize()
{
	InitControls();	
}

function InitControls()
{
	local string ownerFullPath;
	local WindowHandle btnContainerWnd;

	ownerFullPath = m_hOwnerWnd.m_WindowNameWithFullPath;
	InitAvailableBtnGroupInfo();
	Me = GetWindowHandle(ownerFullPath);
	expStatusBar = GetStatusBarHandle(ownerFullPath $ ".ExpStatusBar");
	expStatusBar.SetDrawPoint(false);
	btnContainerWnd = GetWindowHandle(ownerFullPath $ ".btnContainer");
	expInfoWnd = GetWindowHandle(ownerFullPath $ ".ExpInfoWnd");
	expTextBox = GetTextBoxHandle(ownerFullPath $ ".ExpInfoWnd.ExpPercentWnd.ExpPercent_txt");
	expBoostTextBox = GetTextBoxHandle(ownerFullPath $ ".ExpInfoWnd.ExpBoostingWnd.ExpBoosting_txt");
	expBoostBtn = GetButtonHandle(ownerFullPath $ ".ExpInfoWnd.ExpBoostingWnd.ExpBoostingBg");
	expBoostOnTex = GetTextureHandle(ownerFullPath $ ".ExpInfoWnd.ExpBoostingWnd.BoostingArrowOn_tex");
	expBoostOffTex = GetTextureHandle(ownerFullPath $ ".ExpInfoWnd.ExpBoostingWnd.BoostingArrowOff_tex");
	_bottomBarBtns.Length = 0;
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "postBoxBtnWnd", EBottomBarBtnType.PostBox/*1*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "clanBtnWnd", EBottomBarBtnType.Clan/*2*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "partyBtnWnd", EBottomBarBtnType.Party/*3*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "suppressBtnWnd", EBottomBarBtnType.Suppress/*8*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "magicLampBtnWnd", EBottomBarBtnType.MagicLamp/*9*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "randomCraftBtnWnd", EBottomBarBtnType.RandomCraft/*10*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "LCoinCraftBtnWnd", EBottomBarBtnType.LCoinCraft/*11*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "vitaminManagerBtnWnd", EBottomBarBtnType.VitaminManager/*12*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "pcCafePointBtnWnd", EBottomBarBtnType.PcCafePoint/*4*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "LCoinShopBtnWnd", EBottomBarBtnType.LCoinShop/*5*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "adenaBtnWnd", EBottomBarBtnType.adena/*6*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "inventoryBtnWnd", EBottomBarBtnType.Inventory/*7*/);
	AddBottomBarBtnControls(_bottomBarBtns, ownerFullPath, "dualInventoryBtnWnd", EBottomBarBtnType.DualInventory/*13*/);
	InitShowBtns();	
}

function InitAvailableBtnGroupInfo()
{
	local int isEinhasad;

	_availableBtnGroup.Length = 0;
	if(getInstanceUIData().getIsClassicServer())
	{
		_availableBtnGroup[_availableBtnGroup.Length] = Clan;
		_availableBtnGroup[_availableBtnGroup.Length] = Suppress;
		if(IsAdenServer())
		{
			_availableBtnGroup[_availableBtnGroup.Length] = MagicLamp;
		}
		_availableBtnGroup[_availableBtnGroup.Length] = RandomCraft;
		_availableBtnGroup[_availableBtnGroup.Length] = LCoinCraft;
		if(IsShowPcCafe())
		{
			_availableBtnGroup[_availableBtnGroup.Length] = PcCafePoint;
		}
		_availableBtnGroup[_availableBtnGroup.Length] = LCoinShop;
		_availableBtnGroup[_availableBtnGroup.Length] = adena;
		_availableBtnGroup[_availableBtnGroup.Length] = DualInventory;		
	}
	else
	{
		_availableBtnGroup[_availableBtnGroup.Length] = PostBox;
		_availableBtnGroup[_availableBtnGroup.Length] = Clan;
		_availableBtnGroup[_availableBtnGroup.Length] = Party;
		if(IsShowPcCafe())
		{
			_availableBtnGroup[_availableBtnGroup.Length] = PcCafePoint;
		}
		GetINIBool("Localize", "UseEinhasad", isEinhasad, "L2.ini");
		if(bool(isEinhasad))
		{
			_availableBtnGroup[_availableBtnGroup.Length] = LCoinShop;
		}
		_availableBtnGroup[_availableBtnGroup.Length] = adena;
		_availableBtnGroup[_availableBtnGroup.Length] = Inventory;
	}	
}

function AddBottomBarBtnControls(out array<BottomBarBtnInfo> OutArray, string ownerPath, string targetWndName, EBottomBarBtnType Type)
{
	local BottomBarBtnInfo btnInfo;
	local WindowHandle btnWnd;

	btnWnd = GetWindowHandle(ownerPath $ "." $ targetWndName);
	if(btnWnd.m_pTargetWnd != none)
	{
		btnInfo.btnWnd = btnWnd;
		btnInfo.Type = Type;
		btnInfo.defaultRect = btnWnd.GetRect();
		OutArray[OutArray.Length] = btnInfo;
	}	
}

function InitShowBtns()
{
	local int i;
	local BottomBarBtnInfo btnInfo;

	for(i = 0; i < _bottomBarBtns.Length; i++)
	{
		btnInfo = _bottomBarBtns[i];
		if(IsAvailableBtnType(btnInfo.Type))
		{
			btnInfo.btnWnd.ShowWindow();
			btnInfo.btnWnd.SetWindowSize(btnInfo.defaultRect.nWidth, btnInfo.defaultRect.nHeight);
			// [Explicit Continue]
			continue;
		}
		btnInfo.btnWnd.SetWindowSize(0, btnInfo.defaultRect.nHeight);
		btnInfo.btnWnd.HideWindow();
	}	
}

function RegistAndShowBtn(EBottomBarBtnType Type)
{
	local BottomBarBtnInfo btnInfo;

	btnInfo = GetBottomBarBtnInfo(Type);
	if((btnInfo.Type == 0) || btnInfo.btnWnd.m_pTargetWnd == none)
	{
		return;
	}
	if(IsAvailableBtnType(Type))
	{
		if(btnInfo.btnWnd.IsShowWindow() == false)
		{
			btnInfo.btnWnd.ShowWindow();
			btnInfo.btnWnd.SetWindowSize(btnInfo.defaultRect.nWidth, btnInfo.defaultRect.nHeight);
		}		
	}
	else
	{
		_availableBtnGroup[_availableBtnGroup.Length] = Type;
		btnInfo.btnWnd.SetWindowSize(btnInfo.defaultRect.nWidth, btnInfo.defaultRect.nHeight);
		btnInfo.btnWnd.ShowWindow();
	}	
}

function UnregistAndHideBtn(EBottomBarBtnType Type)
{
	local BottomBarBtnInfo btnInfo;

	btnInfo = GetBottomBarBtnInfo(Type);
	if((btnInfo.Type == 0) || btnInfo.btnWnd.m_pTargetWnd == none)
	{
		return;
	}
	if(IsAvailableBtnType(Type) || btnInfo.btnWnd.IsShowWindow() == true)
	{
		btnInfo.btnWnd.SetWindowSize(0, btnInfo.defaultRect.nHeight);
		btnInfo.btnWnd.HideWindow();
	}	
}

function ResetInfo()
{
	local BottomBarInfo defaultInfo;

	_bottomBarInfo = defaultInfo;	
}

function WindowHandle GetBottomBarBtnWnd(EBottomBarBtnType Type)
{
	local int i;
	local WindowHandle btnWnd;
	local BottomBarBtnInfo btnInfo;

	for(i = 0; i < _bottomBarBtns.Length; i++)
	{
		btnInfo = _bottomBarBtns[i];
		if(btnInfo.Type == Type)
		{
			btnWnd = btnInfo.btnWnd;
			// [Explicit Break]
			break;
		}
	}
	return btnWnd;	
}

function BottomBarBtnInfo GetBottomBarBtnInfo(EBottomBarBtnType Type)
{
	local int i;
	local BottomBarBtnInfo btnInfo;

	for(i = 0; i < _bottomBarBtns.Length; i++)
	{
		if(_bottomBarBtns[i].Type == Type)
		{
			btnInfo = _bottomBarBtns[i];
			// [Explicit Break]
			break;
		}
	}
	return btnInfo;	
}

function int GetBottomBarBtnsIndex(EBottomBarBtnType Type)
{
	local int i;

	for(i = 0; i < _bottomBarBtns.Length; i++)
	{
		if(_bottomBarBtns[i].Type == Type)
		{
			return i;
		}
	}
	return -1;	
}

function string GetExpBoostString(EExpBoostType Type)
{
	switch(Type)
	{
		case EExpBoostType.ExpBoostVital/*1*/:
			return GetSystemString(13143);
		case EExpBoostType.ExpBoostPassive/*3*/:
			return GetSystemString(13145);
		case EExpBoostType.ExpBoostBuff/*2*/:
			return GetSystemString(13144);
	}
}

function bool IsShowPcCafe()
{
	local int isPcCafe;

	if(GetLanguage() == LANG_Korean)
	{
		return true;		
	}
	else
	{
		GetINIBool("Localize", "UsePCBangPoint", isPcCafe, "L2.ini");
		return bool(isPcCafe);
	}	
}

function bool IsAvailableBtnType(EBottomBarBtnType Type)
{
	local int i;

	for(i = 0; i < _availableBtnGroup.Length; i++)
	{
		if(_availableBtnGroup[i] == Type)
		{
			return true;
		}
	}
	return false;	
}

function bool IsInPeroidWithRemainTime(array<int> Cycle, out int RemainTime)
{
	return SuppressWnd(GetScript("SuppressWnd")).IsInPeroidWithRemainTime(Cycle, RemainTime);	
}

function bool GetCurrentSubjugationData(int Id, out SubjugationData outsubjugationData)
{
	local int i;
	local array<SubjugationData> subjugationDatas;

	GetSubjugationList(subjugationDatas);

	for(i = 0; i < subjugationDatas.Length; i++)
	{
		if(subjugationDatas[i].Id == Id)
		{
			outsubjugationData = subjugationDatas[i];
			return true;
		}
	}
	return false;	
}

function SetSuppressEvent()
{
	local int RemainTime;
	local SubjugationData mySubjugationDatas;

	Me.KillTimer(TIMER_ID_SUPPRESS);
	if(! GetCurrentSubjugationData(_bottomBarInfo.suppressId, mySubjugationDatas))
	{
		_bottomBarInfo.isSuppressHotTime = false;		
	}
	else
	{
		_bottomBarInfo.isSuppressHotTime = IsInPeroidWithRemainTime(mySubjugationDatas.HotTimes, RemainTime);
	}
	if(RemainTime > 0)
	{
		Me.SetTimer(TIMER_ID_SUPPRESS, RemainTime * 1000);
	}
	UpdateSuppressControls();	
}


function UpdateExpStatusControls()
{
	expStatusBar.SetPointExpPercentRate(_bottomBarInfo.expPercentRate);	
}

function UpdateExpInfoControls()
{
	local string expPercentStr;

	expPercentStr = ConvertFloatToString(_bottomBarInfo.expPercentRate * 100, 4, false);
	expTextBox.SetText(expPercentStr $ "%");	
}

function UpdateExpBoostInfoControls()
{
	local int i, totalCount, totalPercent;
	local UIPacket._S_EX_USER_BOOST_STAT expBoostInfo;
	local array<DrawItemInfo> drawListArr;
	local L2Util util;

	util = getInstanceL2Util();

	for(i = 1; i < 4; i++)
	{
		expBoostInfo = _bottomBarInfo.expBoostInfos[i];
		if(expBoostInfo.Count > 0 && expBoostInfo.Percent > 0)
		{
			totalCount = totalCount + expBoostInfo.Count;
			totalPercent = totalPercent + expBoostInfo.Percent;
		}
	}
	expBoostTextBox.SetText(string(totalPercent) $ "%");
	if(totalPercent > 0)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13141), string(totalPercent)), util.Yellow, "", false, true);
		expBoostOnTex.ShowWindow();
		expBoostOffTex.HideWindow();		
	}
	else
	{
		drawListArr[drawListArr.Length] = addDrawItemText(GetSystemMessage(13142), util.White, "", false, true);
		expBoostOnTex.HideWindow();
		expBoostOffTex.ShowWindow();
	}
	drawListArr[drawListArr.Length] = addDrawItemBlank(4);
	drawListArr[drawListArr.Length] = AddCrossLineForCustomToolTip(130);
	drawListArr[drawListArr.Length] = addDrawItemBlank(4);
	expBoostInfo = _bottomBarInfo.expBoostInfos[1];
	if(expBoostInfo.Count > 0)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13143), string(expBoostInfo.Percent), string(expBoostInfo.Count)), util.Yellow, "", true, true);
	}
	else
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13143), string(expBoostInfo.Percent), string(expBoostInfo.Count)), util.Gray, "", true, true);
	}
	expBoostInfo = _bottomBarInfo.expBoostInfos[2];
	if(expBoostInfo.Count > 0)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13145), string(expBoostInfo.Percent), string(expBoostInfo.Count)), util.Yellow, "", true, true);		
	}
	else
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13145), string(expBoostInfo.Percent), string(expBoostInfo.Count)), util.Gray, "", true, true);
	}
	expBoostInfo = _bottomBarInfo.expBoostInfos[3];
	if(expBoostInfo.Count > 0)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13144), string(expBoostInfo.Percent), string(expBoostInfo.Count)), util.Yellow, "", true, true);		
	}
	else
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13144), string(expBoostInfo.Percent), string(expBoostInfo.Count)), util.Gray, "", true, true);
	}
	expBoostBtn.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));	
}

function UpdatePostBoxControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.PostBox/*1*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("PostBoxBtn_txt"));
	textBox.SetText(string(_bottomBarInfo.unreadMailCnt));	
}

function UpdateClanControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;
	local TextureHandle Icontex;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.Clan/*2*/);
	if((wnd.m_pTargetWnd == none) || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("ClanBtn_txt"));
	Icontex = TextureHandle(wnd.GetChildWindow("ClanBtn_tex"));
	if(_bottomBarInfo.isClanMember == true)
	{
		Icontex.SetTexture("L2UI_NewTex.Bottombar.BottomBar_Clan");
		textBox.SetText(string(_bottomBarInfo.clanMemberCnt));		
	}
	else
	{
		Icontex.SetTexture("L2UI_NewTex.BottomBar.BottomBar_ClanSearch");
		textBox.SetText(GetSystemString(314));
	}	
}

function UpdatePartyControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;
	local TextureHandle normalTex, alarmTex;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.Party/*3*/);
	if((wnd.m_pTargetWnd == none) || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("PartyBtn_txt"));
	normalTex = TextureHandle(wnd.GetChildWindow("PartyBtn_tex"));
	alarmTex = TextureHandle(wnd.GetChildWindow("PartyMatching_tex"));
	if(_bottomBarInfo.isPartyAlarm == true)
	{
		normalTex.HideWindow();
		alarmTex.ShowWindow();		
	}
	else
	{
		normalTex.ShowWindow();
		alarmTex.HideWindow();
	}
	if(_bottomBarInfo.isPartyOnState == true)
	{
		textBox.SetText("ON");		
	}
	else
	{
		textBox.SetText("OFF");
	}	
}

function SetPartyOnOffState(bool isShow, bool isMinimized)
{
	local bool isOn;

	isOn = isShow;
	if((isShow == false) && _bottomBarInfo.isPartyWndMinimized == true)
	{
		isOn = true;
	}
	_bottomBarInfo.isPartyWndMinimized = isMinimized;
	if(_bottomBarInfo.isPartyOnState != isOn)
	{
		_bottomBarInfo.isPartyOnState = isOn;
		UpdatePartyControls();
	}	
}

function SetPartyAlarmOn(bool isAlarm)
{
	if(_bottomBarInfo.isPartyAlarm != isAlarm)
	{
		_bottomBarInfo.isPartyAlarm = isAlarm;
		UpdatePartyControls();
	}	
}

function UpdatePcCafePointControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.PcCafePoint/*4*/);
	if((wnd.m_pTargetWnd == none) || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("PcCafePointBtn_txt"));
	textBox.SetText(MakeCostString(string(_bottomBarInfo.PcCafePoint)));	
}

function UpdateLCoinShopControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;
	local ButtonHandle btn;
	local array<DrawItemInfo> drawListArr;
	local ItemInfo ItemInfo;
	local TextureHandle Icontex;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.LCoinShop/*5*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("LCoinShopBtn_txt"));
	btn = ButtonHandle(wnd.GetChildWindow("LCoinShopBtn"));
	Icontex = TextureHandle(wnd.GetChildWindow("LCoinShopBtn_tex"));
	textBox.SetText(MakeCostString(string(_bottomBarInfo.bloodyCoinCnt)));
	if(getInstanceUIData().getIsClassicServer())
	{
		Icontex.SetTexture("L2UI_NewTex.BottomBar.BottomBar_Lcoin");
		ItemInfo = GetItemInfoByClassID(ITEM_ID_GIRAN_COIN);
		if(IsAdenServer())
		{
			drawListArr[drawListArr.Length] = addDrawItemText(MakeCostString(string(_bottomBarInfo.aCoinCnt)) @ GetSystemString(13441), getInstanceL2Util().White, "", true, true);
			drawListArr[drawListArr.Length] = addDrawItemBlank(4);
			drawListArr[drawListArr.Length] = AddCrossLineForCustomToolTip(130);
			drawListArr[drawListArr.Length] = addDrawItemBlank(4);
		}
		drawListArr[drawListArr.Length] = addDrawItemText(MakeCostString(string(_bottomBarInfo.giranCoinCnt)) @ ItemInfo.Name, getInstanceL2Util().White, "", true, true);
		drawListArr[drawListArr.Length] = addDrawItemBlank(4);
		drawListArr[drawListArr.Length] = AddCrossLineForCustomToolTip(130);
		drawListArr[drawListArr.Length] = addDrawItemBlank(4);
		drawListArr[drawListArr.Length] = addDrawItemText(MakeCostString(string(_bottomBarInfo.bloodyCoinCnt)) @ GetSystemString(3931), getInstanceL2Util().White, "", true, true);
		btn.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));		
	}
	else
	{
		Icontex.SetTexture("L2UI_NewTex.BottomBar.BottomBar_EinhasadCoin");
		btn.SetTooltipCustomType(MakeTooltipSimpleText(GetSystemString(13535)));
	}	
}

function UpdateAdenaControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;
	local ButtonHandle btn;
	local array<DrawItemInfo> drawListArr;
	local float weightPer;
	local string Adenastring;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.adena/*6*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("AdenaBtn_txt"));
	btn = ButtonHandle(wnd.GetChildWindow("AdenaBtn"));
	if(getInstanceUIData().getIsClassicServer())
	{
		weightPer = (float(_bottomBarInfo.carringWeight) / float(_bottomBarInfo.carryWeight)) * 100;
		if(_bottomBarInfo.adenaCnt != 0)
		{
			drawListArr[drawListArr.Length] = addDrawItemText(ConvertNumToText(string(_bottomBarInfo.adenaCnt)), getInstanceL2Util().White, "", true, true);			
		}
		else
		{
			drawListArr[drawListArr.Length] = addDrawItemText(string(_bottomBarInfo.adenaCnt) @ GetSystemString(469), getInstanceL2Util().White, "", true, true);
		}
		drawListArr[drawListArr.Length] = addDrawItemBlank(4);
		drawListArr[drawListArr.Length] = AddCrossLineForCustomToolTip(130);
		drawListArr[drawListArr.Length] = addDrawItemBlank(4);
		drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(3070) @ string(_bottomBarInfo.invenCnt) $ "/" $ string(_bottomBarInfo.invenMaxCnt), getInstanceL2Util().White, "", true, true);
		drawListArr[drawListArr.Length] = addDrawItemBlank(4);
		drawListArr[drawListArr.Length] = AddCrossLineForCustomToolTip(130);
		drawListArr[drawListArr.Length] = addDrawItemBlank(4);
		drawListArr[drawListArr.Length] = addDrawItemText(GetSystemString(52) @ ConvertFloatToString(weightPer, 2, false) $ "%", getInstanceL2Util().White, "", true, true);
		btn.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
		textBox.SetText(MakeCostString(string(_bottomBarInfo.adenaCnt)));		
	}
	else
	{
		if(GetOptionBool("ExpBarOption", "bIsShowAdenaInfo"))
		{
			textBox.SetText(MakeCostString(string(_bottomBarInfo.adenaCnt)));
		}
		else
		{
			Adenastring = GetSystemString(3121);
			class'L2Util'.static.GetEllipsisString(Adenastring, 105);
			textBox.SetText(Adenastring);
			btn.SetTooltipCustomType(MakeTooltipSimpleText(GetSystemString(3121)));
		}
		btn.SetTooltipCustomType(MakeTooltipSimpleText(ConvertNumToText(string(_bottomBarInfo.adenaCnt))));
	}	
}

function UpdateInventoryControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.Inventory/*7*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("InventoryBtn_txt"));
	textBox.SetText(string(_bottomBarInfo.invenCnt) $ "/" $ string(_bottomBarInfo.invenMaxCnt));	
}

function UpdateSuppressControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;
	local string keyCntStr;
	local ButtonHandle btn;
	local TextureHandle Icontex, alarmTex, hotTimeTex;
	local array<DrawItemInfo> drawListArr;
	local int titleGapX;
	local float expPer;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.Suppress/*8*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("SuppressBtn_txt"));
	btn = ButtonHandle(wnd.GetChildWindow("SuppressBtn"));
	Icontex = TextureHandle(wnd.GetChildWindow("SuppressBtn_tex"));
	alarmTex = TextureHandle(wnd.GetChildWindow("SuppressAlarm_tex"));
	hotTimeTex = TextureHandle(wnd.GetChildWindow("SuppressHotTime_tex"));
	keyCntStr = "x" $ string(_bottomBarInfo.suppressKeyCnt);
	textBox.SetText(keyCntStr);
	if(_bottomBarInfo.suppressId <= 1)
	{
		btn.SetTooltipCustomType(MakeTooltipSimpleText(GetSystemString(13627)));
		Icontex.SetTexture("L2UI_NewTex.BottomBar.BottomBar_Suppress");
		alarmTex.HideWindow();
		hotTimeTex.HideWindow();	
	}
	else
	{
		if(_bottomBarInfo.isSuppressHotTime)
		{
			drawListArr[drawListArr.Length] = addDrawItemTextureCustom("L2UI_NewTex.BottomBar.SuppressHotTime", false, false, 0, 0, 10, 11, 10, 11);
			titleGapX = 4;
			hotTimeTex.ShowWindow();		
		}
		else
		{
			hotTimeTex.HideWindow();
		}
		drawListArr[drawListArr.Length] = addDrawItemText(_bottomBarInfo.suppressName, getInstanceL2Util().Yellow, "", false, true, titleGapX);
		drawListArr[drawListArr.Length] = addDrawItemText((" - " $ GetSystemString(13634)) @ keyCntStr, getInstanceL2Util().White, "", true, true);
		if(_bottomBarInfo.isSuppressMaxKey)
		{
			drawListArr[drawListArr.Length] = addDrawItemText(" - " $ GetSystemString(3451), getInstanceL2Util().White, "", true, true);			
		}
		else
		{
			expPer = (float(_bottomBarInfo.suppressPoint) / float(_bottomBarInfo.suppressMaxPoint)) * 100;
			drawListArr[drawListArr.Length] = addDrawItemText((" - " $ getInstanceL2Util().cutFloat(expPer)) @ GetSystemString(13635), getInstanceL2Util().White, "", true, true);
		}
		btn.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));
		if(_bottomBarInfo.isSuppressAlarm)
		{
			alarmTex.ShowWindow();			
		}
		else
		{
			alarmTex.HideWindow();
		}
	}	
}

function UpdateMagicLampContols()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;
	local ButtonHandle btn;
	local UserInfo myUserInfo;
	local string perStr, tooltipPerStr;
	local AnimTextureHandle completeEffectTex;
	local array<DrawItemInfo> drawListArr;
	local L2Util util;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.MagicLamp/*9*/);
	if((wnd.m_pTargetWnd == none) || wnd.IsShowWindow() == false)
	{
		return;
	}
	if(! GetPlayerInfo(myUserInfo))
	{
		return;
	}
	util = getInstanceL2Util();
	textBox = TextBoxHandle(wnd.GetChildWindow("MagicLampBtn_txt"));
	btn = ButtonHandle(wnd.GetChildWindow("MagicLampBtn"));
	
	completeEffectTex = AnimTextureHandle(wnd.GetChildWindow("MagicLampComplete_tex"));
	perStr = string(int(_bottomBarInfo.magicLampPercent)) $ "%";
	textBox.SetText(perStr);
	if(_bottomBarInfo.isMagicLampCompleteEffect == true)
	{
		completeEffectTex.Stop();
		completeEffectTex.Play();
		_bottomBarInfo.isMagicLampCompleteEffect = false;
	}
	tooltipPerStr = MakeFullSystemMsg(GetSystemMessage(13856), ConvertFloatToString(_bottomBarInfo.magicLampPercent, 4, false));
	if(_bottomBarInfo.magicLampBoostCnt > 0)
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13849), string(_bottomBarInfo.magicLampBoostPercent), string(_bottomBarInfo.magicLampBoostCnt)), util.Yellow, "", true, true);		
	}
	else
	{
		drawListArr[drawListArr.Length] = addDrawItemText(MakeFullSystemMsg(GetSystemMessage(13849), string(_bottomBarInfo.magicLampBoostPercent), string(_bottomBarInfo.magicLampBoostCnt)), util.Gray, "", true, true);
	}
	drawListArr[drawListArr.Length] = addDrawItemText(tooltipPerStr, util.White, "", true, true);
	btn.SetTooltipCustomType(MakeTooltipMultiTextByArray(drawListArr));	
}

function UpdateRandomCraftControls()
{
	local WindowHandle wnd;
	local TextBoxHandle textBox;
	local ButtonHandle btn;
	local float MaxPoint, fPer;
	local int maxGauge, currentCharge;
	local string pointStr, gaugeStr;
	local TextureHandle alarmTex;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.RandomCraft/*10*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("RandomCraftBtn_txt"));
	btn = ButtonHandle(wnd.GetChildWindow("RandomCraftBtn"));
	alarmTex = TextureHandle(wnd.GetChildWindow("RandomCraftAlarm_tex"));
	MaxPoint = float(class'RandomCraftAPI'.static.GetMaxItemPoint());
	maxGauge = class'RandomCraftAPI'.static.GetMaxGaugeValue();
	pointStr = "x" $ string(_bottomBarInfo.randomCraftPoint);
	currentCharge = int(getInstanceL2Util().Get9999Percent(_bottomBarInfo.randomCraftCharge, maxGauge));
	fPer = (float(currentCharge) / float(maxGauge)) * 100;
	gaugeStr = ConvertFloatToString(fPer, 2, false) $ "%";
	textBox.SetText(pointStr);
	btn.SetTooltipCustomType(MakeTooltipMultiText(GetSystemString(13159) @ pointStr, getInstanceL2Util().White, "", true, gaugeStr, getInstanceL2Util().Yellow, "", true));
	if(_bottomBarInfo.isRandomCraftAlarm == true)
	{
		alarmTex.ShowWindow();		
	}
	else
	{
		alarmTex.HideWindow();
	}
}

function UpdateLCoinCraftControls()
{
	local WindowHandle wnd;
	local TextureHandle alarmTex, alarmTagTex;
	local TextBoxHandle textBox;
	local string lcoincrafttext;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.LCoinCraft/*11*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("LCoinCraftBtn_txt"));
	lcoincrafttext = GetSystemString(13683);
	class'L2Util'.static.GetEllipsisString(lcoincrafttext, 50);
	textBox.SetText(lcoincrafttext);
	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.LCoinCraft/*11*/);
	if((wnd.m_pTargetWnd == none) || wnd.IsShowWindow() == false)
	{
		return;
	}
	alarmTex = TextureHandle(wnd.GetChildWindow("LCoinCraftAlarm_Tex"));
	alarmTagTex = TextureHandle(wnd.GetChildWindow("LimitedAlarm_tex"));
	alarmTex.HideWindow();
	alarmTagTex.HideWindow();
}

function UpdateVitaminManagerControls();

function _UpdateDualInventoryControls()
{
	local TextBoxHandle textBox;
	local WindowHandle wnd;

	wnd = GetBottomBarBtnWnd(EBottomBarBtnType.DualInventory/*13*/);
	if(wnd.m_pTargetWnd == none || wnd.IsShowWindow() == false)
	{
		return;
	}
	textBox = TextBoxHandle(wnd.GetChildWindow("DualInventoryBtn_txt"));
	switch(InventoryWnd(GetScript("InventoryWnd"))._GetSwapSelectButtonIndex())
	{
		case 0:
			textBox.SetText("A");
			break;
		case 1:
			textBox.SetText("B");
			break;
	}
	wnd.GetChildWindow("DualInventoryBtn").SetTooltipCustomType(GetDualEquipCustomTooltip());	
}

private function CustomTooltip GetDualEquipCustomTooltip()
{
	local CustomTooltip mCustomTooltip;
	local array<DrawItemInfo> drawListArr;
	local string A, B;
	local Color colorA, ColorB;

	A = GetSystemString(14274);
	B = GetSystemString(14275);
	switch(InventoryWnd(GetScript("InventoryWnd"))._GetSwapSelectButtonIndex())
	{
		case 0:
			A = A $ "(" $ GetSystemString(3533) $ ")";
			colorA = getInstanceL2Util().Yellow;
			ColorB = getInstanceL2Util().Gray;
			break;
		case 1:
			B = B $ "(" $ GetSystemString(3533) $ ")";
			colorA = getInstanceL2Util().Gray;
			ColorB = getInstanceL2Util().Yellow;
			break;
	}
	drawListArr[drawListArr.Length] = addDrawItemText(A, colorA, "", false, true);
	drawListArr[drawListArr.Length] = addDrawItemBlank(4);
	drawListArr[drawListArr.Length] = addDrawItemText(B, ColorB, "", true, true);
	mCustomTooltip = MakeTooltipMultiTextByArray(drawListArr);
	setCustomToolTipMinimumWidth(mCustomTooltip);
	return mCustomTooltip;	
}

function UpdateUIControls()
{
	UpdateExpStatusControls();
	UpdateExpStatusControls();
	UpdateExpInfoControls();
	UpdateExpBoostInfoControls();
	UpdatePostBoxControls();
	UpdateClanControls();
	UpdatePartyControls();
	UpdatePcCafePointControls();
	UpdateLCoinShopControls();
	UpdateAdenaControls();
	UpdateInventoryControls();
	UpdateSuppressControls();
	UpdateMagicLampContols();
	UpdateRandomCraftControls();
	UpdateLCoinCraftControls();
	UpdateVitaminManagerControls();
	_UpdateDualInventoryControls();	
}

event OnClickButton(string Name)
{
	switch(Name)
	{
		case "PostBoxBtn":
			OnPostBoxBtnClicked();
			break;
		case "ClanBtn":
			OnClanBtnClicked();
			break;
		case "PartyBtn":
			OnPartyBtnClicked();
			break;
		case "LCoinShopBtn":
			OnLCoinShopBtnClicked();
			break;
		case "PcCafePointBtn":
			OnPcCafePointBtnClicked();
			break;
		case "AdenaBtn":
			OnAdenaBtnClicked();
			break;
		case "InventoryBtn":
			OnInventoryBtnClicked();
			break;
		case "SuppressBtn":
			OnSuppressBtnClicked();
			break;
		case "RandomCraftBtn":
			OnRandomCraftBtnClicked();
			break;
		case "RandomCraftChargingBtn":
			OnRandomCraftChargingBtnClicked();
			break;
		case "LCoinCraftBtn":
			OnLCoinCraftBtnClicked();
			break;
		case "VitaminManagerBtn":
			OnVitaminManagerBtnClicked();
			break;
		case "DualInventoryBtn":
			OnDualInventoryBtnClicked();
			break;
	}	
}

event OnMouseOver(WindowHandle W)
{
	if(_bottomBarInfo.isSuppressAlarm == true && W.GetWindowName() == "SuppressBtn")
	{
		_bottomBarInfo.isSuppressAlarm = false;
		UpdateSuppressControls();
	}
	if(_bottomBarInfo.isRandomCraftAlarm == true && W.GetWindowName() == "RandomCraftBtn")
	{
		_bottomBarInfo.isRandomCraftAlarm = false;
		UpdateRandomCraftControls();
	}	
}

event OnPostBoxBtnClicked()
{
	local WindowHandle win;

	win = GetWindowHandle("PostBoxWnd");
	if(win.IsShowWindow())
	{
		win.HideWindow();
		PlayConsoleSound(IFST_WINDOW_CLOSE);		
	}
	else
	{
		PlayConsoleSound(IFST_WINDOW_OPEN);
		RequestRequestReceivedPostList();
	}	
}

event OnClanBtnClicked()
{
	if(_bottomBarInfo.isClanMember == true)
	{
		if(getInstanceUIData().getIsClassicServer())
		{
			if(getInstanceL2Util().isClanV2())
			{
				toggleWindow("ClanGfxWnd", true, true);				
			}
			else
			{
				toggleWindow("ClanWndClassicNew", true, true);
			}			
		}
		else
		{
			if(getInstanceL2Util().isClanV2())
			{
				toggleWindow("ClanGfxWnd", true, true);				
			}
			else
			{
				toggleWindow("ClanWnd", true, true);
			}
		}		
	}
	else
	{
		toggleWindow("ClanSearch", true, true);
	}	
}

event OnPartyBtnClicked()
{
	_bottomBarInfo.isPartyAlarm = false;
	class'PartyMatchAPI'.static.RequestOpenPartyMatch();
}

event OnLCoinShopBtnClicked()
{
	toggleWindow("ShopLcoinWnd", true, true);	
}

event OnPcCafePointBtnClicked()
{
	if(getInstanceL2Util().getIsPrologueGrowType())
	{
		AddSystemMessage(4533);		
	}
	else
	{
		if(GetWindowHandle("NPCDialogWnd").IsShowWindow())
		{
			GetWindowHandle("NPCDialogWnd").HideWindow();			
		}
		else
		{
			RequestOpenWndWithoutNPC(OPEN_PCCAFE_HTML);
		}
	}	
}

event OnAdenaBtnClicked()
{
	local bool isShowAdenaOption;

	if(getInstanceUIData().getIsClassicServer())
	{
		toggleWindow("InventoryWnd", true, true);		
	}
	else
	{
		isShowAdenaOption = GetOptionBool("ExpBarOption", "bIsShowAdenaInfo");
		SetOptionBool("ExpBarOption", "bIsShowAdenaInfo", ! isShowAdenaOption);
		UpdateAdenaControls();
	}	
}

event OnInventoryBtnClicked()
{
	toggleWindow("InventoryWnd", true, true);	
}

event OnSuppressBtnClicked()
{
	toggleWindow("SuppressWnd", true, true);
	SuppressWnd(GetScript("SuppressWnd")).setSelectListByID(_bottomBarInfo.suppressId);
}

event OnRandomCraftBtnClicked()
{
	toggleWindow("RandomCraftWnd", true, true);	
}

event OnRandomCraftChargingBtnClicked()
{
	toggleWindow("RandomCraftChargingWnd", true, true);	
}

event OnLCoinCraftBtnClicked()
{
	toggleWindow("ShopLCoinCraftWnd", true, true);	
}

event OnVitaminManagerBtnClicked()
{
	if(GetWindowHandle("PremiumManagerWnd").IsShowWindow())
	{
		GetWindowHandle("PremiumManagerWnd").HideWindow();		
	}
	else
	{
		RequestOpenWndWithoutNPC(OPEN_PREMIUM_MANAGER);
	}	
}

event OnDualInventoryBtnClicked()
{
	ExecuteEvent(EV_RequestDualInventorySwap, "");	
}

event OnLoad()
{
	Initialize();	
}

event OnRegisterEvent()
{
	if(USE_XML_BOTTOM_BAR_UI == false)
	{
		return;
	}
	RegisterEvent(EV_Restart);
	RegisterEvent(EV_UpdateUserInfo);
	RegisterEvent(EV_PledgeCount);
	RegisterEvent(EV_UnReadMailCount);
	RegisterEvent(EV_ClanDeleteAllMember);
	RegisterEvent(EV_ClanInfo);
	RegisterEvent(EV_AdenaInvenCount);
	RegisterEvent(EV_SetMaxCount);
	RegisterEvent(EV_BloodyCoinCount);
	RegisterEvent(EV_PCCafePointInfo);
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_MAGICLAMP_INFO));
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_USER_BOOST_STAT));
	RegisterEvent(EV_PacketID(class'UIPacket'.const.S_EX_SUBJUGATION_SIDEBAR));	
}

event OnEvent(int Event_ID, string param)
{
	if(USE_XML_BOTTOM_BAR_UI == false)
	{
		return;
	}
	switch(Event_ID)
	{
		case EV_UpdateUserInfo:
			Nt_EV_UpdateUserInfo();
			break;
		case EV_PledgeCount:
			Nt_EV_PledgeCount(param);
			break;
		case EV_UnReadMailCount:
			Nt_EV_UnReadMailCount(param);
			break;
		case EV_ClanDeleteAllMember:
			Nt_EV_ClanDeleteAllMember(param);
			break;
		case EV_ClanInfo:
			Nt_EV_EV_ClanInfo(param);
			break;
		case EV_BloodyCoinCount:
			Nt_EV_BloodyCoinCount(param);
			break;
		case EV_PCCafePointInfo:
			Nt_EV_PCCafePointInfo(param);
			break;
		case EV_AdenaInvenCount:
			Nt_EV_AdenaInvenCount(param);
			break;
		case EV_SetMaxCount:
			Nt_EV_SetMaxCount(param);
			break;
		case EV_PacketID(class'UIPacket'.const.S_EX_MAGICLAMP_INFO):
			Nt_S_EX_MAGICLAMP_INFO();
			break;
		case EV_PacketID(class'UIPacket'.const.S_EX_USER_BOOST_STAT):
			Nt_S_EX_USER_BOOST_STAT();
			break;
		case EV_PacketID(class'UIPacket'.const.S_EX_SUBJUGATION_SIDEBAR):
			Nt_S_EX_SUBJUGATION_SIDEBAR();
			break;
		case EV_Restart:
			ResetInfo();
			break;
	}	
}

event OnTimer(int TimerID)
{
	if(TimerID == TIMER_ID_SUPPRESS)
	{
		SetSuppressEvent();
	}	
}

event OnShow()
{
	if(USE_XML_BOTTOM_BAR_UI == false)
	{
		Me.HideWindow();
		return;
	}
	UpdateUIControls();	
}

function Nt_EV_UpdateUserInfo()
{
	local UserInfo UserInfo;

	GetPlayerInfo(UserInfo);
	if(_bottomBarInfo.expPercentRate != UserInfo.fExpPercentRate)
	{
		_bottomBarInfo.expPercentRate = UserInfo.fExpPercentRate;
		UpdateExpStatusControls();
		UpdateExpInfoControls();
	}
	if(_bottomBarInfo.carringWeight != UserInfo.nCarringWeight || _bottomBarInfo.carryWeight != UserInfo.nCarryWeight)
	{
		_bottomBarInfo.carringWeight = UserInfo.nCarringWeight;
		_bottomBarInfo.carryWeight = UserInfo.nCarryWeight;
		UpdateAdenaControls();
	}
}

function Nt_EV_PledgeCount(string param)
{
	local int clanMemberCnt;

	ParseInt(param, "PledgeCount", clanMemberCnt);
	_bottomBarInfo.clanMemberCnt = clanMemberCnt;
	if(clanMemberCnt > 0)
	{
		_bottomBarInfo.isClanMember = true;
	}
	UpdateClanControls();	
}

function Nt_EV_UnReadMailCount(string param)
{
	local int unreadMailCnt;

	ParseInt(param, "UnReadMailCount", unreadMailCnt);
	_bottomBarInfo.unreadMailCnt = unreadMailCnt;
	UpdatePostBoxControls();	
}

function Nt_EV_ClanDeleteAllMember(string param)
{
	_bottomBarInfo.isClanMember = false;
	UpdateClanControls();	
}

function Nt_EV_EV_ClanInfo(string param)
{
	_bottomBarInfo.isClanMember = true;
	UpdateClanControls();	
}

function Nt_EV_BloodyCoinCount(string param)
{
	local INT64 bloodyCoinCnt;

	ParseINT64(param, "CoinCount", bloodyCoinCnt);
	_bottomBarInfo.bloodyCoinCnt = bloodyCoinCnt;
	UpdateLCoinShopControls();	
}

function Nt_EV_PCCafePointInfo(string param)
{
	local int PcCafePoint, Show;

	ParseInt(param, "TotalPoint", PcCafePoint);
	ParseInt(param, "Show", Show);
	if(Show > 0)
	{
		_bottomBarInfo.PcCafePoint = PcCafePoint;
	}
	UpdatePcCafePointControls();	
}

function Nt_EV_AdenaInvenCount(string param)
{
	local int invenCnt;
	local INT64 adenaCnt, aCoinCnt, giranCoinCnt;
	local bool needUpdateLCoinShopBtn;

	ParseInt(param, "InvenCount", invenCnt);
	if(_bottomBarInfo.invenCnt != invenCnt)
	{
		_bottomBarInfo.invenCnt = invenCnt;
		UpdateInventoryControls();
		if(getInstanceUIData().getIsClassicServer())
		{
			UpdateAdenaControls();
		}
	}
	adenaCnt = GetAdena();
	if(_bottomBarInfo.adenaCnt != adenaCnt)
	{
		_bottomBarInfo.adenaCnt = adenaCnt;
		UpdateAdenaControls();
	}
	if(getInstanceUIData().getIsClassicServer())
	{
		giranCoinCnt = GetInventoryItemCount(GetItemID(ITEM_ID_GIRAN_COIN));
		if(_bottomBarInfo.giranCoinCnt != giranCoinCnt)
		{
			_bottomBarInfo.giranCoinCnt = giranCoinCnt;
			needUpdateLCoinShopBtn = true;
		}
		if(IsAdenServer())
		{
			aCoinCnt = GetInventoryItemCount(GetItemID(ITEM_ID_A_COIN));
			if(_bottomBarInfo.aCoinCnt != aCoinCnt)
			{
				_bottomBarInfo.aCoinCnt = aCoinCnt;
				needUpdateLCoinShopBtn = true;
			}
		}
	}
	if(needUpdateLCoinShopBtn == true)
	{
		UpdateLCoinShopControls();
	}	
}

function Nt_EV_SetMaxCount(string param)
{
	local int invenMaxCnt;

	ParseInt(param, "Inventory", invenMaxCnt);
	if(_bottomBarInfo.invenMaxCnt != invenMaxCnt)
	{
		_bottomBarInfo.invenMaxCnt = invenMaxCnt;
		UpdateInventoryControls();
		UpdateAdenaControls();
	}	
}

function Nt_S_EX_MAGICLAMP_INFO()
{
	local UIPacket._S_EX_MAGICLAMP_INFO packet;
	local float validExpPercent, oldExpPercent;
	local int OldValue, NewValue;

	if(! class'UIPacket'.static.Decode_S_EX_MAGICLAMP_INFO(packet))
	{
		return;
	}
	validExpPercent = float(packet.nExpPercentage) / 10000;
	if(((_bottomBarInfo.magicLampPercent == validExpPercent) && _bottomBarInfo.magicLampBoostPercent == packet.nBoostPercentage) && _bottomBarInfo.magicLampBoostCnt == packet.nBoostCount)
	{
		return;
	}
	oldExpPercent = _bottomBarInfo.magicLampPercent;
	OldValue = int(oldExpPercent / 10);
	_bottomBarInfo.magicLampPercent = validExpPercent;
	_bottomBarInfo.magicLampBoostPercent = packet.nBoostPercentage;
	_bottomBarInfo.magicLampBoostCnt = packet.nBoostCount;
	NewValue = int(_bottomBarInfo.magicLampPercent / 10);
	if(((oldExpPercent != 0) && NewValue == 0) && OldValue == 9)
	{
		_bottomBarInfo.isMagicLampCompleteEffect = true;
	}
	UpdateMagicLampContols();	
}

function Nt_S_EX_USER_BOOST_STAT()
{
	local UIPacket._S_EX_USER_BOOST_STAT packet;

	if(! class'UIPacket'.static.Decode_S_EX_USER_BOOST_STAT(packet))
	{
		return;
	}
	if(packet.Type < 4)
	{
		_bottomBarInfo.expBoostInfos[packet.Type] = packet;
	}
	UpdateExpBoostInfoControls();	
}

function Nt_S_EX_SUBJUGATION_SIDEBAR()
{
	local SubjugationData mySubjugationDatas;
	local UIPacket._S_EX_SUBJUGATION_SIDEBAR packet;

	if(! class'UIPacket'.static.Decode_S_EX_SUBJUGATION_SIDEBAR(packet))
	{
		return;
	}
	_bottomBarInfo.suppressId = packet.nID;
	if(! GetCurrentSubjugationData(packet.nID, mySubjugationDatas))
	{
		_bottomBarInfo.isSuppressHotTime = false;
	}
	if(packet.nGachaPoint == 0)
	{
		_bottomBarInfo.isSuppressAlarm = false;
	}
	if(packet.nGachaPoint != 0 && packet.nGachaPoint != _bottomBarInfo.suppressKeyCnt && packet.nGachaPoint > _bottomBarInfo.suppressKeyCnt)
	{
		_bottomBarInfo.isSuppressAlarm = true;
	}
	_bottomBarInfo.isSuppressMaxKey = packet.nGachaPoint >= mySubjugationDatas.MaxPeriodicGachaPoint;
	_bottomBarInfo.suppressName = mySubjugationDatas.Name;
	_bottomBarInfo.suppressKeyCnt = packet.nGachaPoint;
	_bottomBarInfo.suppressPoint = packet.nPoint;
	_bottomBarInfo.suppressMaxPoint = mySubjugationDatas.MaxSubjugationPoint;
	SetSuppressEvent();	
}

function Nt_S_EX_CRAFT_INFO(UIPacket._S_EX_CRAFT_INFO packet)
{
	if(USE_XML_BOTTOM_BAR_UI == false)
	{
		return;
	}
	if(packet.nPoint == 0)
	{
		_bottomBarInfo.isRandomCraftAlarm = false;
	}
	if(packet.nPoint != 0 && packet.nPoint != _bottomBarInfo.randomCraftPoint && packet.nPoint > _bottomBarInfo.randomCraftPoint)
	{
		_bottomBarInfo.isRandomCraftAlarm = true;
	}
	_bottomBarInfo.randomCraftPoint = packet.nPoint;
	_bottomBarInfo.randomCraftCharge = packet.nCharge;
	UpdateRandomCraftControls();	
}
