Jump to content

Recommended Posts

Posted

Hello how are you?. I need a help please. I am working with an Essence interface in H5. The problem I have is that when I equip any item the RBracelet turns black. When I start the bracelet again it looks good. It only happens with that Item. Could someone help me if they are very kind. thank you

 

 

bracelet.png.0fe862a45e8d9ebe82cf212cd7f

 

My interface.u.

 

 

class InventoryWnd extends UICommonAPI;

const DIALOG_USE_RECIPE				= 1111;				// �����Ǹ� ����� �������� ���� ��
const DIALOG_POPUP					= 2222;				// �����ۻ�� �� ������ �˾��޽����� ��� ��
const DIALOG_DROPITEM				= 3333;				// �������� �ٴڿ� ���� ��(�Ѱ�)
const DIALOG_DROPITEM_ASKCOUNT		= 4444;				// �������� �ٴڿ� ���� ��(������, ������ �����)
const DIALOG_DROPITEM_ALL			= 5555;				// �������� �ٴڿ� ���� ��(MoveAll ������ ��)
const DIALOG_DESTROYITEM			= 6666;				// �������� �����뿡 ���� ��(�Ѱ�)
const DIALOG_DESTROYITEM_ALL		= 7777;				// �������� �����뿡 ���� ��(MoveAll ������ ��)
const DIALOG_DESTROYITEM_ASKCOUNT	= 8888;				// �������� �����뿡 ���� ��(������, ������ �����)
const DIALOG_CRYSTALLIZE			= 9999;				// �������� ����ȭ �Ҷ�
const DIALOG_NOTCRYSTALLIZE		= 9998;				// ����ȭ�� �Ұ����ϴٴ� ���
const DIALOG_DROPITEM_PETASKCOUNT	= 10000;			// ���κ����� �������� ��ӵǾ��� ��

const TIMER_REQUEST_ITEMLIST        = 1718;
const TIMER_REQUEST_ITEMLIST_DELAY  = 1000;

const EQUIPITEM_Underwear = 0;
const EQUIPITEM_Head = 1;
const EQUIPITEM_Hair = 2;
const EQUIPITEM_Hair2 = 3;
const EQUIPITEM_Neck = 4;
const EQUIPITEM_RHand = 5;
const EQUIPITEM_Chest = 6;
const EQUIPITEM_LHand = 7;
const EQUIPITEM_REar = 8;
const EQUIPITEM_LEar = 9;
const EQUIPITEM_Gloves = 10;
const EQUIPITEM_Legs = 11;
const EQUIPITEM_Feet = 12;
const EQUIPITEM_RFinger = 13;
const EQUIPITEM_LFinger = 14;
const EQUIPITEM_LBracelet = 15;
const EQUIPITEM_RBracelet = 16;
const EQUIPITEM_Deco1 = 17;
const EQUIPITEM_Deco2 = 18;
const EQUIPITEM_Deco3 = 19;
const EQUIPITEM_Deco4 = 20;
const EQUIPITEM_Deco5 = 21;
const EQUIPITEM_Deco6 = 22;
const EQUIPITEM_Cloak = 23;
const EQUIPITEM_Waist = 24;
const EQUIPITEM_Max = 25;

const INVENTORY_ITEM_TAB = 0;
const INVENTORY_ITEM_1_TAB = 1;
const INVENTORY_ITEM_2_TAB = 2;
const INVENTORY_ITEM_3_TAB = 3;
const INVENTORY_ITEM_4_TAB = 4;


var WindowHandle		m_hInventoryWnd;
var WindowHandle		m_hTaliWnd;
var WindowHandle		m_hFlightWnd;
var WindowHandle		wnd_CharView;

var	String				m_WindowName;
var	ItemWindowHandle	m_invenItem;


	////////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
var L2Util l2UtilScript;
	
var int m_QuestInvenCount;	// Added by JoeyPark 2010/09/10 ���� ������ �ִ� ����Ʈ���� ����.
var int m_NormalInvenCount;	// Added by JoeyPark 2010/09/10 ���� ������ �ִ� �Ϲ����� ����.

var	ItemWindowHandle	m_invenItem_1;
var	ItemWindowHandle	m_invenItem_2;
var	ItemWindowHandle	m_invenItem_3;
var	ItemWindowHandle	m_invenItem_4;

var bool bIsSavedLocalItemIdx ;
var array<int> itemSwapedServerID;
var array<int> itemSwapedServerID_1;
var array<int> itemSwapedServerID_2;
var array<int> itemSwapedServerID_3;
var array<int> itemSwapedServerID_4;
var array<int> itemSwapedServerID_q;
var array<int> itemSwapedIdx;
var array<int> itemSwapedIdx_1;
var array<int> itemSwapedIdx_2;
var array<int> itemSwapedIdx_3;
var array<int> itemSwapedIdx_4;
var array<int> itemSwapedIdx_q;

var bool bIsQuestItemList;
var bool bIsRequestItemList;

	////////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
	
	
var	ItemWindowHandle	m_questItem;
var	ItemWindowHandle	m_equipItem[ EQUIPITEM_Max ];
var	TextureHandle		tex_Tooltip[ EQUIPITEM_Max ];
var	ItemWindowHandle	m_hHennaItemWindow;

var	TextBoxHandle		m_hAdenaTextBox;
var	TextBoxHandle		txt_ItemCount;

var TextboxHandle			txt_ExpBarAdenaValue;
var TextboxHandle			txt_ExpBarAdenaChangeValue;

//var	TabHandle			m_invenTab;

//var		ButtonHandle		btn_Sort;

var 	TextureHandle		m_CloakSlot_Disable;
var 	TextureHandle		m_Talisman_Disable[ 6 ];


var	Vector				m_clickLocation;			// ������ ����Ҷ� ��� ����� ���� �����ϰ� �ִ´�.

var Array<ItemInfo>		m_EarItemListStart;
var Array<ItemInfo>		m_EarItemList;
var Array<ItemInfo>		m_FingerItemLIstStart;
var Array<ItemInfo>		m_FingerItemLIst;
var Array<ItemInfo>		m_DecoItemList;

//var int m_NormalInvenCount;
var bool m_bCurrentState;
var bool m_bFirstOpen;

var int m_MaxInvenCount;
var int m_MaxQuestItemInvenCount;

var INT64 myAdena;

var ButtonHandle		m_hBtnCrystallize;

//var WindowHandle ColorNickNameWnd;

var int m_selectedItemTab;

//INVENORY EXPAND
var ButtonHandle btn_WindowExpand;
var ButtonHandle btn_AutoAtt;
var ButtonHandle btn_AutoEnchant;

var ButtonHandle btn_CharViewOn;
var ButtonHandle btn_CharViewOff;

var TextureHandle tex_InventoryItemExpandBG;
var TextureHandle tex_QuestItemExpandBG;

var TextureHandle tex_InventoryRoundLineBG;
var TextureHandle tex_InventorySimpleLineBG;
var TextureHandle tex_TalismanAllow;

var TextureHandle tex_InventoryItemDisable1;
var TextureHandle tex_InventoryItemDisable2;
var TextureHandle tex_InventoryItemDisable3;

var int useExtendedInventory;
var int extraSlotsCount;
var int currentInvenCol;
var bool isVert;
var bool isStart;
var ItemInfo TaliInfo1, TaliInfo2, TaliInfo3, TaliInfo4, TaliInfo5, TaliInfo6;

var TaliWnd script_tali;
var ItemControlWnd script_item;
var OnScreenDmg script_osd;
var ExpBarWnd script_expbar;

function OnRegisterEvent()
{
	RegisterEvent(EV_InventoryClear);
	RegisterEvent(EV_InventoryOpenWindow);
	RegisterEvent(EV_InventoryHideWindow);
	RegisterEvent(EV_InventoryAddItem);
	RegisterEvent(EV_InventoryUpdateItem);
	RegisterEvent(EV_InventoryItemListEnd);
	RegisterEvent(EV_InventoryAddHennaInfo);
	RegisterEvent(EV_InventoryToggleWindow);
	RegisterEvent(EV_UpdateHennaInfo);
	RegisterEvent(EV_UpdateUserInfo);
	RegisterEvent(EV_DialogOK);
	RegisterEvent(EV_Restart);
	RegisterEvent(EV_SetMaxCount);
	RegisterEvent(EV_ChatMessage);
}

function OnLoad()
{	
	m_WindowName="InventoryWnd";
		
	l2UtilScript = L2Util(GetScript("L2Util"));
	
	InitHandle();
	InitScrollBar();
		
	GetINIInt("Inventory", "extraSlots", extraSlotsCount, "PatchSettings");
	GetINIInt("Inventory", "useExtender", useExtendedInventory, "PatchSettings");
	
	if (useExtendedInventory == 1)
		currentInvenCol = extraSlotsCount + 8;
	else
		currentInvenCol = 8;

	if ((currentInvenCol < 8) || (currentInvenCol > 14))
	{
		useExtendedInventory = 0;
		SetINIInt("Inventory", "useExtender", useExtendedInventory, "PatchSettings");
		currentInvenCol = 8;
	}
	//m_questItem.SetCol(11);
	//m_questItem.ShowScrollBar(false);
//	m_questItem.SetWindowSize(395, 34);
	//m_questItem.SetScrollBarPosition( 20, 5, -3 );
//	m_questItem.SetScrollBarPosition( 21, -338, -101 );
	m_bFirstOpen = false;
	
	btn_WindowExpand.SetTexture("MonIcaEssence.Frames.frames_df_btn_Expand","MonIcaEssence.Frames.frames_df_btn_Expand_down","MonIcaEssence.Frames.frames_df_btn_Expand_over");
	if (useExtendedInventory == 1)
	{
		resizeInventory(extraSlotsCount);
	}

	m_selectedItemTab = INVENTORY_ITEM_TAB;
	m_bCurrentState = false;
//	m_selectedItemTab = INVENTORY_ITEM_TAB;
	
	btn_CharViewOn.ShowWindow();
	btn_CharViewOff.HideWindow();
	tex_TalismanAllow.HideWindow();
	
	script_tali = TaliWnd(GetScript("TaliWnd"));
	script_item = ItemControlWnd(GetScript("ItemControlWnd"));
	script_osd = OnScreenDmg(GetScript("OnScreenDmg"));
	script_expbar = ExpBarWnd(GetScript("ExpBarWnd"));
	
	btn_CharViewOff.SetTooltipCustomType(MakeTooltipSimpleText("Show/Hide Character"));
	btn_CharViewOn.SetTooltipCustomType(MakeTooltipSimpleText("Show/Hide Character"));
	btn_WindowExpand.SetTooltipCustomType(MakeTooltipSimpleText("Expand/Minimize Inventory"));
	btn_AutoAtt.SetTooltipCustomType(MakeTooltipSimpleText("Attribute Window"));
	btn_AutoEnchant.SetTooltipCustomType(MakeTooltipSimpleText("Enchant Window"));
}

function InitHandle()
{
	local int i;
	m_hInventoryWnd = GetWindowHandle(m_WindowName);
	m_hTaliWnd = GetWindowHandle("TaliWnd");
	m_hFlightWnd = GetWindowHandle("FlightTransformCtrlWnd");
	wnd_CharView = GetWindowHandle("CharacterViewWnd");
	
	m_invenItem	= GetItemWindowHandle(m_WindowName $ ".InventoryItem");
	m_questItem	= GetItemWindowHandle(m_WindowName $ ".QuestItem");
	m_hAdenaTextBox = GetTextBoxHandle( m_WindowName $ ".AdenaText" );
	txt_ItemCount = GetTextBoxHandle(m_WindowName $ ".ItemCount");
	
	for( i = 0; i < EQUIPITEM_MAX; ++i )
	{
		tex_Tooltip[i] = GetTextureHandle( m_WindowName $ ".texTooltip" $ i);
	}

	m_equipItem[ EQUIPITEM_Underwear ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Underwear" );
	tex_Tooltip[ EQUIPITEM_Underwear ].SetTooltipCustomType(MakeTooltipSimpleText("Underwear"));
	m_equipItem[ EQUIPITEM_Head ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Head" );
	tex_Tooltip[ EQUIPITEM_Head ].SetTooltipCustomType(MakeTooltipSimpleText("Headgear"));
	m_equipItem[ EQUIPITEM_Hair ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Hair" );
	tex_Tooltip[ EQUIPITEM_Hair ].SetTooltipCustomType(MakeTooltipSimpleText("Hair Accessory"));
	m_equipItem[ EQUIPITEM_Hair2 ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Hair2" );
	tex_Tooltip[ EQUIPITEM_Hair2 ].SetTooltipCustomType(MakeTooltipSimpleText("Hair Accessory"));
	m_equipItem[ EQUIPITEM_Neck ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Neck" );
	tex_Tooltip[ EQUIPITEM_Neck ].SetTooltipCustomType(MakeTooltipSimpleText("Necklace"));
	m_equipItem[ EQUIPITEM_RHand ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_RHand" );
	tex_Tooltip[ EQUIPITEM_RHand ].SetTooltipCustomType(MakeTooltipSimpleText("Weapon"));
	m_equipItem[ EQUIPITEM_Chest ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Chest" );
	tex_Tooltip[ EQUIPITEM_Chest ].SetTooltipCustomType(MakeTooltipSimpleText("Upper Body"));
	m_equipItem[ EQUIPITEM_LHand ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_LHand" );
	tex_Tooltip[ EQUIPITEM_LHand ].SetTooltipCustomType(MakeTooltipSimpleText("Shield/Sigil"));
	m_equipItem[ EQUIPITEM_REar ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_REar" );
	tex_Tooltip[ EQUIPITEM_REar ].SetTooltipCustomType(MakeTooltipSimpleText("Earring"));
	m_equipItem[ EQUIPITEM_LEar ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_LEar" );
	tex_Tooltip[ EQUIPITEM_LEar ].SetTooltipCustomType(MakeTooltipSimpleText("Earring"));
	m_equipItem[ EQUIPITEM_Gloves ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Gloves" );
	tex_Tooltip[ EQUIPITEM_Gloves ].SetTooltipCustomType(MakeTooltipSimpleText("Gloves"));
	m_equipItem[ EQUIPITEM_Legs ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Legs" );
	tex_Tooltip[ EQUIPITEM_Legs ].SetTooltipCustomType(MakeTooltipSimpleText("Lower Body"));
	m_equipItem[ EQUIPITEM_Feet ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Feet" );
	tex_Tooltip[ EQUIPITEM_Feet ].SetTooltipCustomType(MakeTooltipSimpleText("Boots"));
	m_equipItem[ EQUIPITEM_RFinger ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_RFinger" );
	tex_Tooltip[ EQUIPITEM_RFinger ].SetTooltipCustomType(MakeTooltipSimpleText("Ring"));
	m_equipItem[ EQUIPITEM_LFinger ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_LFinger" );
	tex_Tooltip[ EQUIPITEM_LFinger ].SetTooltipCustomType(MakeTooltipSimpleText("Ring"));
	m_equipItem[ EQUIPITEM_LBracelet ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_LBracelet" );
	tex_Tooltip[ EQUIPITEM_LBracelet ].SetTooltipCustomType(MakeTooltipSimpleText("Left Bracelet"));
	m_equipItem[ EQUIPITEM_RBracelet ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_RBracelet" );
	tex_Tooltip[ EQUIPITEM_RBracelet ] .SetTooltipCustomType(MakeTooltipSimpleText("Right Bracelet"));
	m_equipItem[ EQUIPITEM_Deco1 ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Talisman1" );
	tex_Tooltip[ EQUIPITEM_Deco1 ].SetTooltipCustomType(MakeTooltipSimpleText("Talisman"));
	m_equipItem[ EQUIPITEM_Deco2 ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Talisman2" );
	tex_Tooltip[ EQUIPITEM_Deco2 ].SetTooltipCustomType(MakeTooltipSimpleText("Talisman"));
	m_equipItem[ EQUIPITEM_Deco3 ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Talisman3" );
	tex_Tooltip[ EQUIPITEM_Deco3 ].SetTooltipCustomType(MakeTooltipSimpleText("Talisman"));
	m_equipItem[ EQUIPITEM_Deco4 ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Talisman4" );
	tex_Tooltip[ EQUIPITEM_Deco4 ].SetTooltipCustomType(MakeTooltipSimpleText("Talisman"));
	m_equipItem[ EQUIPITEM_Deco5 ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Talisman5" );
	tex_Tooltip[ EQUIPITEM_Deco5 ].SetTooltipCustomType(MakeTooltipSimpleText("Talisman"));
	m_equipItem[ EQUIPITEM_Deco6 ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Talisman6" );
	tex_Tooltip[ EQUIPITEM_Deco6 ].SetTooltipCustomType(MakeTooltipSimpleText("Talisman"));
	m_equipItem[ EQUIPITEM_Cloak ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Cloak" );
	tex_Tooltip[ EQUIPITEM_Cloak ].SetTooltipCustomType(MakeTooltipSimpleText("Cloack"));
	m_equipItem[ EQUIPITEM_Waist ] = GetItemWindowHandle( m_WindowName $ ".EquipItem_Waist" );
	tex_Tooltip[ EQUIPITEM_Waist ].SetTooltipCustomType(MakeTooltipSimpleText("Belt"));
	
	
	m_equipItem[ EQUIPITEM_LHand ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	m_equipItem[ EQUIPITEM_Head ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	m_equipItem[ EQUIPITEM_Gloves ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	m_equipItem[ EQUIPITEM_Legs ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	m_equipItem[ EQUIPITEM_Feet ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	m_equipItem[ EQUIPITEM_Hair2 ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_LBracelet ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_RBracelet ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_Deco1 ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_Deco2 ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_Deco3 ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_Deco4 ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_Deco5 ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	//~ m_equipItem[ EQUIPITEM_Deco6 ].SetDisableTex( "L2UI.InventoryWnd.Icon_dualcap" );
	m_CloakSlot_Disable = GetTextureHandle(m_WindowName $ ".CloakSlot_Disable");
	m_Talisman_Disable[ 0 ] = GetTextureHandle(m_WindowName $ ".Talisman1_Disable");
	m_Talisman_Disable[ 1 ] = GetTextureHandle(m_WindowName $ ".Talisman2_Disable");
	m_Talisman_Disable[ 2 ] = GetTextureHandle(m_WindowName $ ".Talisman3_Disable");
	m_Talisman_Disable[ 3 ] = GetTextureHandle(m_WindowName $ ".Talisman4_Disable");
	m_Talisman_Disable[ 4 ] = GetTextureHandle(m_WindowName $ ".Talisman5_Disable");
	m_Talisman_Disable[ 5 ] = GetTextureHandle(m_WindowName $ ".Talisman6_Disable");
                                                                                
	m_hHennaItemWindow = GetItemWindowHandle( m_WindowName$".HennaItem"  );
	m_hBtnCrystallize = GetButtonHandle(m_WindowName $ ".CrystallizeButton");
	
	tex_InventoryItemExpandBG = GetTextureHandle("InventoryWnd.texInventoryItemExpandBG");
//	m_tabbg = GetTextureHandle("InventoryWnd.tabbkg");
	tex_QuestItemExpandBG = GetTextureHandle("InventoryWnd.texQuestItemExpandBG");
	tex_InventoryRoundLineBG = GetTextureHandle("InventoryWnd.texInventoryRoundLineBG");
	tex_InventorySimpleLineBG = GetTextureHandle("InventoryWnd.texInventorySimpleLineBG");
	tex_TalismanAllow = GetTextureHandle("InventoryWnd.texTalismanAllow");
	
	tex_InventoryItemDisable1 = GetTextureHandle("InventoryWnd.texInventoryItemDisable1");
	tex_InventoryItemDisable2 = GetTextureHandle("InventoryWnd.texInventoryItemDisable2");
	tex_InventoryItemDisable3 = GetTextureHandle("InventoryWnd.texInventoryItemDisable3");
	
	btn_WindowExpand = GetButtonHandle(m_WindowName $ ".btnWindowExpand");
	btn_AutoAtt = GetButtonHandle(m_WindowName $ ".btnAutoAtt");
	btn_AutoEnchant = GetButtonHandle(m_WindowName $ ".btnAutoEnchant");
		
	btn_CharViewOn = GetButtonHandle("InventoryWnd.btnCharViewOn");
	btn_CharViewOff = GetButtonHandle("InventoryWnd.btnCharViewOff");
	
	txt_ExpBarAdenaValue = GetTextBoxHandle("ExpBarWnd.txtExpBarAdenaValue");
	txt_ExpBarAdenaChangeValue = GetTextBoxHandle("ExpBarWnd.txtExpBarAdenaChangeValue");
	
	
	////////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
	m_invenItem_1 = GetItemWindowHandle(m_WindowName $ ".InventoryItem_1");
	m_invenItem_2 = GetItemWindowHandle(m_WindowName $ ".InventoryItem_2");
	m_invenItem_3 = GetItemWindowHandle(m_WindowName $ ".InventoryItem_3");
	m_invenItem_4 = GetItemWindowHandle(m_WindowName $ ".InventoryItem_4");
	////////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
	///////////////////////// MultiTab Try //////////////////////////
}

function InitScrollBar()
{
	m_invenItem.SetScrollBarPosition( 0, 17, 0 );
	m_invenItem_1.SetScrollBarPosition( 0, 17, 0 );
	m_invenItem_2.SetScrollBarPosition( 0, 17, 0 );
	m_invenItem_3.SetScrollBarPosition( 0, 17, 0 );
	m_invenItem_4.SetScrollBarPosition( 0, 17, 0 );
	m_questItem.SetScrollBarPosition( 0, 3, -3 );
}

function OnEvent(int Event_ID, string param)
{
//	debug("Inven Event ID :" $string(Event_ID)$" "$param);
	switch( Event_ID )
	{
	case EV_InventoryClear:
		HandleClear();
		break;
	case EV_InventoryOpenWindow:
		HandleOpenWindow(param);
		break;
	case EV_InventoryHideWindow:
		HandleHideWindow();
		break;
	case EV_InventoryAddItem:
		//~ debug ("add item");
		HandleAddItem(param);
		break;
	case EV_InventoryUpdateItem:
		//~ debug ("update item" @ param);
		HandleUpdateItem(param);
		//FingerItemUpdate();
		break;
	case EV_InventoryItemListEnd:
		HandleItemListEnd();
		break;
	case EV_InventoryAddHennaInfo:
		HandleAddHennaInfo(param);
		break;
	case EV_UpdateHennaInfo:
		HandleUpdateHennaInfo(param);
		break;
	case EV_InventoryToggleWindow:
		HandleToggleWindow();
		break;
	case EV_DialogOK:
		HandleDialogOK();
		break;
	case EV_UpdateUserInfo:
		HandleUpdateUserInfo();
		break;
	case EV_Restart:
		HandleRestart();
		//~ SaveInventoryOrder();
		break;
	case EV_SetMaxCount:
		HandleSetMaxCount(param);
		break;
	case EV_ChatMessage:
		HandleChatMessage( param );
		break;
	default:
		break;
	};
}


//Check GamingState - Start
function HandleRestart()
{
	myAdena = IntToInt64(0);
	
	m_bCurrentState = false;
	m_bFirstOpen = true;

	m_hInventoryWnd.HideWindow() ;
	bIsRequestItemList = false ;
	
	m_hOwnerWnd.KillTimer( TIMER_REQUEST_ITEMLIST );
}


function OnEnterState( name a_PrevStateName )
{
	isStart = true;
	
	m_bCurrentState = true;
}


function OnExitState( name a_NextStateName )
{
	m_bCurrentState = false;
}


function OnShow()
{	
	m_bFirstOpen = true;
	
//	CheckShowCrystallizeButton();
	SetAdenaText();
	SetItemCount();

	UpdateHennaInfo();

	m_hOwnerWnd.KillTimer(TIMER_REQUEST_ITEMLIST);	
	
	if (btn_CharViewOff.isShowWindow())
		wnd_CharView.ShowWindow();
}


function OnHide()
{
	if( m_bCurrentState )
		SaveInventoryOrder();
	
	if(DialogIsMine()) DialogHide();	
	bIsRequestItemList = false;	
	
	if (wnd_CharView.isShowWindow())
		wnd_CharView.HideWindow();
}


function HandleChatMessage( String param )
{
	local int SysMsgIndex;

	ParseInt(param, "SysMsgIndex", SysMsgIndex);
		
		if ( SysMsgIndex == 34 )
		{
			isStart = false;
			m_hInventoryWnd.SetTimer(1130, 2000);
			script_tali.tal[0].Clear();
			script_tali.tal[1].Clear();
			script_tali.tal[2].Clear();
			script_tali.tal[3].Clear();			
		}
}


function SwitchExtendedInventory()
{
	if (currentInvenCol != 8)
	{
		if (useExtendedInventory == 1)
		{
			useExtendedInventory = 0;
			resizeInventory(0);
		}
		else
		{
			useExtendedInventory = 1;
			resizeInventory(extraSlotsCount);
		}
	} 
	else 
	{
		if (useExtendedInventory == 0)
		{
			useExtendedInventory = 1;
			resizeInventory(extraSlotsCount);
		}
	}
	
	SetINIInt("Inventory", "useExtender", useExtendedInventory, "PatchSettings");
}

function resizeInventory (int nSlotsCount)
{
	local int toExpandWidth;

	if (nSlotsCount > 0)
	{
		btn_WindowExpand.SetTexture("MonIcaEssence.Frames.frames_df_Btn_Minimize","MonIcaEssence.Frames.frames_df_btn_Minimize_down","MonIcaEssence.Frames.frames_df_btn_Minimize_over");
		currentInvenCol = 8 + nSlotsCount;
		toExpandWidth = 36 * nSlotsCount;
	} 
	else 
	{
		btn_WindowExpand.SetTexture("MonIcaEssence.Frames.frames_df_btn_Expand","MonIcaEssence.Frames.frames_df_btn_Expand_down","MonIcaEssence.Frames.frames_df_btn_Expand_over");
		currentInvenCol = 8;
		toExpandWidth = 0;
    }
	
    m_hInventoryWnd.SetWindowSize(545 + toExpandWidth, 467);
		
    m_invenItem.SetWindowSize(304 + toExpandWidth, 288);
	m_invenItem_1.SetWindowSize(304 + toExpandWidth, 288);
	m_invenItem_2.SetWindowSize(304 + toExpandWidth, 288);
	m_invenItem_3.SetWindowSize(304 + toExpandWidth, 288);
	m_invenItem_4.SetWindowSize(304 + toExpandWidth, 288);
	m_questItem.SetWindowSize(306 + toExpandWidth, 34);
	
	tex_InventoryRoundLineBG.SetWindowSize(315 + toExpandWidth, 322);
	tex_InventorySimpleLineBG.SetWindowSize(27 + toExpandWidth, 23);
	
	tex_InventoryItemExpandBG.SetWindowSize(36 + toExpandWidth, 288);
	tex_QuestItemExpandBG.SetWindowSize(36 + toExpandWidth, 36); 
		
	FixDisableTex();
	
    m_invenItem.SetCol(currentInvenCol);
	m_questItem.SetCol(currentInvenCol);
	m_invenItem_1.SetCol(currentInvenCol);
	m_invenItem_2.SetCol(currentInvenCol);
	m_invenItem_3.SetCol(currentInvenCol);
	m_invenItem_4.SetCol(currentInvenCol);
}


function FixDisableTex()
{
	local float x;
	local string y;
	local int z;
	local int toExpandWidth;

	toExpandWidth = 36 * currentInvenCol;	
	
	tex_InventoryItemDisable1.HideWindow();
	tex_InventoryItemDisable2.HideWindow();
	tex_InventoryItemDisable3.HideWindow();
	
	if (useExtendedInventory == 1)
		if (currentInvenCol * 8 - m_MaxInvenCount > currentInvenCol)
		{
			x = (currentInvenCol * 8 - m_MaxInvenCount)/currentInvenCol;
			y = Left(string(x), 1);
			z = int(y);
			if (x != 2.f)
			{
				if (x > 2.f)
				{
					tex_InventoryItemDisable1.SetWindowSize((currentInvenCol*(8 - z) - m_MaxInvenCount)*36, 34);
					tex_InventoryItemDisable2.SetWindowSize(toExpandWidth, 34);
					tex_InventoryItemDisable3.SetWindowSize(toExpandWidth, 34);
					tex_InventoryItemDisable1.ShowWindow();
					tex_InventoryItemDisable2.ShowWindow();
					tex_InventoryItemDisable3.ShowWindow();
					
				}
				else if (x < 2.f)
				{
					tex_InventoryItemDisable2.SetWindowSize((currentInvenCol*(8 - z) - m_MaxInvenCount)*36, 34);
					tex_InventoryItemDisable3.SetWindowSize(toExpandWidth, 34);		
					tex_InventoryItemDisable2.ShowWindow();
					tex_InventoryItemDisable3.ShowWindow();
				}
			}
		}
}


function CheckShowCrystallizeButton()
{
	if( class'UIDATA_PLAYER'.static.HasCrystallizeAbility() )
		m_hBtnCrystallize.ShowWindow();
	else
		m_hBtnCrystallize.HideWindow();
}


// ItemWindow Event
function OnDBClickItemWithHandle( ItemWindowHandle a_hItemWindow, int index )
{
	UseItem( a_hItemWindow, index );
	
}


function OnRClickItemWithHandle( ItemWindowHandle a_hItemWindow, int index )
{
	UseItem( a_hItemWindow, index );
}


function OnSelectItemWithHandle( ItemWindowHandle a_hItemWindow, int a_Index )
{
	local int i;
	local ItemInfo info;
	local string ItemName;
	
	a_hItemWindow.GetSelectedItem( info );
	//printItemInfo(info);
	//TextLink
	if( IsKeyDown( IK_Shift ) )
	{
		a_hItemWindow.GetSelectedItem( info );
		ItemName = class'UIDATA_ITEM'.static.GetRefineryItemName( info.Name, info.RefineryOp1, info.RefineryOp2 );
		if (info.ItemNum > IntToInt64(1)) ItemName = ItemName @ "[" $ MakeCostString(Int64ToString(info.ItemNum)) $ "]";
		if (info.Enchanted > 0) ItemName = "+" $ info.Enchanted @ ItemName;
		SetItemTextLink( info.ID, ItemName );
	}
	
	//DeleteItem
	if( IsKeyDown( IK_Alt ) && IsKeyDown( IK_Ctrl ) )
	{
		if (a_hItemWindow.GetSelectedItem( info ))
		{
			if (a_hItemWindow.FindItem(info.id) != -1)
			{
				if( class'UIDATA_PLAYER'.static.HasCrystallizeAbility() && class'UIDATA_ITEM'.static.IsCrystallizable(info.ID) )
				{	
					RequestCrystallizeItem(info.ID,IntToInt64(1));
					PlayConsoleSound(IFST_TRASH_BASKET);
				}
				else
				{					
					RequestDestroyItem(info.ID, info.ItemNum);
					PlayConsoleSound(IFST_TRASH_BASKET);
				}
			}
		}
	}
		
	switch ( a_hItemWindow ) 
	{
		case m_invenItem :
		case m_invenItem_1 :
		case m_invenItem_2 :
		case m_invenItem_3 :
		case m_invenItem_4 :
		case m_questItem : return;			
	}	

	for( i = 0; i < EQUIPITEM_MAX; ++i )
	{
		if( a_hItemWindow != m_equipItem[ i ] )
			m_equipItem[ i ].ClearSelect();
	}
}


//Ÿ�� �̸��� ���� ������ �ڵ� �ޱ�
function itemWindowHandle getItemWindowHandleBystrTarget( string strTarget )
{
	switch ( strTarget )
	{
		case "InventoryItem":
			return m_invenItem;
		break;	
		case "InventoryItem_1":
			return m_invenItem_1;
		break;
		case "InventoryItem_2":
			return m_invenItem_2;
		break;
		case "InventoryItem_3":
			return m_invenItem_3;
		break;
		case "InventoryItem_4":
			return m_invenItem_4;
		break;		
	}
}


function OnDropItem( String strTarget, ItemInfo info, int x, int y )
{
	local int toIndex, fromIndex;
	local ItemWindowHandle normalinven;
	
	// �κ��丮���� �� ���� �ƴϸ� ó������ �ʴ´�.
	//debug("Inventory OnDropItem dest " $ strTarget $ ", source " $ info.DragSrcName $ " x:" $ x $ ", y:" $ y);
	
	if(! isDragSrcInventory ( info.DragSrcName )) return ;	

	
	if( strTarget == "InventoryItem" || strTarget == "InventoryItem_1" || strTarget == "InventoryItem_2" || strTarget == "InventoryItem_3" || strTarget == "InventoryItem_4" )
	{
		if( info.DragSrcName == strTarget )			// Change Item position
		{
			normalinven = getItemWindowHandleBystrTarget( strTarget );
			toIndex = normalinven.GetIndexAt( x, y, 1, 1 );
			
			// Exchange with another item
			if( toIndex >= 0 )
			{
				fromIndex = normalinven.FindItem(info.ID);
				if( toIndex != fromIndex )
					normalinven.SwapItems( fromIndex, toIndex );
			}
		}
		else if( -1 != InStr( info.DragSrcName, "EquipItem" ) )			// Unequip thie item
		{
			RequestUnequipItem(info.ID, info.SlotBitType);
		}
		else if( info.DragSrcName == "PetInvenWnd" )		// Pet -> Inventory
		{
			if( IsStackableItem(info.ConsumeType) && info.ItemNum > IntToInt64(1) )			// Multiple item?
			{
				if( info.AllItemCount > IntToInt64(0) )					// ���� �ű� ���ΰ�
				{
					if ( CheckItemLimit( info.ID, info.AllItemCount ) )
					{
						class'PetAPI'.static.RequestGetItemFromPet( info.ID, info.AllItemCount, false);
					}
				}
				else
				{
					DialogSetID(DIALOG_DROPITEM_PETASKCOUNT);
					DialogSetReservedItemID(info.ID);	// ServerID
					DialogSetParamInt64(info.ItemNum);
					DialogShow(DIALOG_Modalless, DIALOG_NumberPad, MakeFullSystemMsg( GetSystemMessage(72), info.Name ) );
				}
			}
			else																// Single item?
			{
				class'PetAPI'.static.RequestGetItemFromPet( info.ID, IntToInt64(1), false);
			}
		}
	}
	else if( strTarget == "QuestItem" )
	{
		if( info.DragSrcName == "QuestItem" )			// Change Item position
		{
			toIndex = m_questItem.GetIndexAt( x, y, 1, 1 );
			if( toIndex >= 0 )			// Exchange with another item
			{
				fromIndex = m_questItem.FindItem(info.ID);	// ServerID
				if( toIndex != fromIndex )
				{
					// �ΰ��� while �� �߿� ������ �Ѱ����� ����.
					while( fromIndex < toIndex )		// ������ �����
					{
						m_questItem.SwapItems( fromIndex, fromIndex + 1 );
						++fromIndex;
					}

					while( toIndex < fromIndex )		// �ڷ� �о��
					{
						m_questItem.SwapItems( fromIndex, fromIndex - 1 );
						--fromIndex;
					}
				}
			}
			else						// move this item to last
			{
				return;
				//fromIndex = m_invenItem.GetItemNum();
				//while( toIndex < fromIndex - 1 )
				//{
			//		m_invenItem.SwapItems( toIndex, toIndex + 1 );
			//		++toIndex;
			//	};
			}
		}
	}
	else if( -1 != InStr( strTarget, "EquipItem" ) ||  strTarget == "ObjectViewportDispatchMsg" )		// Equip the item
	{
	//	debug("Inven EquipItem: " $info.DragSrcName $" " $string(info.ItemType));
		if( info.DragSrcName == "PetInvenWnd" )				// Pet -> Equip
		{
			class'PetAPI'.static.RequestGetItemFromPet( info.ID, IntToInt64(1), true );
		}
		else if( -1 != InStr( info.DragSrcName, "EquipItem" ) )	//�ƹ��͵� ���� �ʴ´�. 
		{
		}
		else if( EItemType(info.ItemType) != ITEM_ETCITEM )
		{
		//	debug("RequestuseItem");
			RequestUseItem(info.ID);
		}
	}
	else if( strTarget == "TrashButton" )					// Destroy item( after confirmation )
	{
		if( IsStackableItem(info.ConsumeType) && info.ItemNum > IntToInt64(1) )			// Multiple item?
		{
			if( info.AllItemCount > IntToInt64(0) )				// ���� ���� ���ΰ�
			{				
				DialogSetID(DIALOG_DESTROYITEM_ALL);
				DialogSetReservedItemID(info.ID);	// ServerID
				DialogSetReservedInt2(info.AllItemCount);
				DialogShow(DIALOG_Modalless,DIALOG_Warning, MakeFullSystemMsg(GetSystemMessage(74), info.Name, ""));
			}
			else
			{
				DialogSetID(DIALOG_DESTROYITEM_ASKCOUNT);
				DialogSetReservedItemID(info.ID);	// ServerID
				DialogSetParamInt64(info.ItemNum);
				DialogShow(DIALOG_Modalless, DIALOG_NumberPad, MakeFullSystemMsg( GetSystemMessage(73), info.Name ) );
			}
		}
		else																// Single item?
		{
			// �ļ��Ϸ� �Ҷ�, ����ȭ�� ������ ��Ȳ�̸� �׳� ����ȭ
			if( class'UIDATA_PLAYER'.static.HasCrystallizeAbility() && class'UIDATA_ITEM'.static.IsCrystallizable(info.ID) )			
			{
				DialogSetID(DIALOG_CRYSTALLIZE);
				DialogSetReservedItemID(info.ID);
				DialogShow(DIALOG_Modalless,DIALOG_Warning, MakeFullSystemMsg( GetSystemMessage(2232), info.Name ) );
			}
			else
			{
				DialogSetID(DIALOG_DESTROYITEM);
				DialogSetReservedItemID(info.ID);	// ServerID
				DialogShow(DIALOG_Modalless, DIALOG_Warning, MakeFullSystemMsg( GetSystemMessage(74), info.Name ) );
			}
		}
	}
	else if( strTarget == "CrystallizeButton" )
	{
		if( info.DragSrcName == "InventoryItem" || ( -1 != InStr( info.DragSrcName, "EquipItem" ) ) )
		{
			if( class'UIDATA_PLAYER'.static.HasCrystallizeAbility() && class'UIDATA_ITEM'.static.IsCrystallizable(info.ID) )			// Show Dialog asking confirmation
			{
				DialogSetID(DIALOG_CRYSTALLIZE);
				DialogSetReservedItemID(info.ID);
				DialogShow(DIALOG_Modalless,DIALOG_Warning, MakeFullSystemMsg( GetSystemMessage(336), info.Name ) );
			}
			else
			{
				DialogSetID(DIALOG_NOTCRYSTALLIZE);
				DialogShow(DIALOG_Modalless,DIALOG_Notice, MakeFullSystemMsg( GetSystemMessage(2171), info.Name ) );				
			}
		}
	}	
	//~ SaveInventoryOrder();
}

// ���� ������ â���� �������� �ű�� ���� OnDropItem ���� �ذ��ϵ��� �ϰ� ���⼭�� �ٴڿ� ������ ��Ȳ�� ó���Ѵ�.
function OnDropItemSource( String strTarget, ItemInfo info )
{
	if (strTarget != "Console") return; 
	if (!isDragSrcInventory ( info.DragSrcName)) return;

	m_clickLocation = GetClickLocation();
	if (IsStackableItem(info.ConsumeType) && info.ItemNum > IntToInt64(1))		// ������ �ִ� ������
	{
		if( info.AllItemCount > IntToInt64(0) )				// ���� ���� ���ΰ�
		{
			DialogHide();
			DialogSetID( DIALOG_DROPITEM_ALL );
			DialogSetReservedItemID(info.ID);	// ServerID
			DialogSetReservedInt2(info.AllItemCount);
			DialogShow(DIALOG_Modalless,DIALOG_Warning, MakeFullSystemMsg(GetSystemMessage(1833), info.Name, ""));
		}
		else												// ���ڸ� ��� ���ΰ�
		{
			DialogHide();
			DialogSetID( DIALOG_DROPITEM_ASKCOUNT );
			DialogSetReservedItemID(info.ID);	// ServerID
			DialogSetParamInt64(info.ItemNum);
			DialogShow(DIALOG_Modalless,DIALOG_NumberPad, MakeFullSystemMsg(GetSystemMessage(71), info.Name, ""));
		}
	}
	else
	{
		DialogHide();
		DialogSetID( DIALOG_DROPITEM );
		DialogSetReservedItemID(info.ID);	// ServerID
		DialogShow(DIALOG_Modalless,DIALOG_Warning, MakeFullSystemMsg(GetSystemMessage(400), info.Name, ""));
	}
}


function bool isDragSrcInventory ( string DragSrcName )
{
	switch ( DragSrcName ) 
	{
		case "InventoryItem"   : 
		case "QuestItem"   : 
		case "PetInvenWnd"   : 
		case "InventoryItem_1"   : 
		case "InventoryItem_2"   : 
		case "InventoryItem_3"   : 
		case "InventoryItem_4"   : 
			return true;
	}
	
	if ( -1 != InStr( DragSrcName, "EquipItem" ) ) return true ;

	return false;	
}


function bool IsEquipItem( out ItemInfo info )
{
	return info.bEquipped;
}


function bool IsQuestItem( out ItemInfo info )
{
	return EItemtype(info.ItemType) == ITEM_QUESTITEM;
}
 
 
function HandleClear()
{
	if ( m_hOwnerWnd.IsShowWindow() ) saveLocalItemOrder();	
	
	InvenClear();
	EquipItemClear();
	
	m_EarItemListStart.Length = 0;
	m_EarItemList.Length = 0;
	m_FingerItemLIst.Length = 0;
	m_FingerItemLIstStart.Length = 0;
	m_DecoItemList.Length = 0;
	
	bIsQuestItemList = false;	
}


function int EquipItemGetItemNum()
{
	local int i;
	local int ItemNum;

	for( i = 0; i < EQUIPITEM_Max; ++i )
	{
		if(m_equipItem[ i ].IsEnableWindow())	// ��Ʈ�������� �ϳ��� ����. 
		{
			ItemNum = ItemNum + m_equipItem[ i ].GetItemNum();
		}
	}

	return ItemNum;
}

function EquipItemClear()
{
	local int i;

	for( i = 0; i < EQUIPITEM_Max; ++i )
	{
		m_equipItem[ i ].Clear();
		tex_Tooltip[i].ShowWindow();
	}
}


function bool EquipItemFind( ItemID sID )
{
	local int i;
	local int Index;

	for( i = 0; i < EQUIPITEM_Max; ++i )
	{
		Index = m_equipItem[ i ].FindItem( sID );	// ServerID
		if( -1 != Index )
			return true;
	}

	return false;
}

function EquipItemDelete( ItemID sID )
{
	local int i;
	local int Index;
	local ItemInfo TheItemInfo;

	for( i = 0; i < EQUIPITEM_Max; ++i )
	{
		Index = m_equipItem[ i ].FindItem( sID );	// ServerID
		if( -1 != Index )
		{
			m_equipItem[ i ].Clear();
			tex_Tooltip[i].ShowWindow();
			// ȭ���� ������ ���, ���ڸ��� Ȱ ����� ǥ�õǾ���Ѵ�.
			if( i == EQUIPITEM_LHand )
			{
				if( m_equipItem[ EQUIPITEM_RHand ].GetItem( 0, TheItemInfo ) )
				{
					if( TheItemInfo.SlotBitType == 16384 )
					{
						m_equipItem[ EQUIPITEM_LHand ].Clear();
						m_equipItem[ EQUIPITEM_LHand ].AddItem( TheItemInfo );
						m_equipItem[ EQUIPITEM_LHand ].DisableWindow();
					}
					
				}
			}
			
			if ( i >= EQUIPITEM_Deco1 && i <= EQUIPITEM_Deco6) //TaliWnd
				script_tali.tal[i - 17].Clear();
			else if ( i == EQUIPITEM_REar)
				script_item.item3.Clear();
			else if ( i == EQUIPITEM_RFinger )
				script_item.item2.Clear();
			else if ( ( i == EQUIPITEM_RHand ) )
				script_item.item4.Clear();
			else if ( i == EQUIPITEM_Neck )
				script_item.item1.Clear();
			else if ( i == EQUIPITEM_LHand )
			{
				script_item.item5.Clear();
				script_item.tex5.SetTexture("");
				isVert = GetOptionBool( "Game", "IsShortcutWndVertical" );
				if (!isVert) script_item.Me.SetWindowSize( 145 , 34 );
				else script_item.Me.SetWindowSize( 34 , 145 );
			}
		}
	}
}

function EarItemUpdate()
{
	local int i;
	local int LEarIndex, REarIndex;

	LEarIndex = -1;
	REarIndex = -1;

	for( i = 0; i < m_EarItemList.Length; ++i )
	{
		switch( IsLOrREar( m_EarItemList[i].ID ) )
		{
		case -1:
			LEarIndex = i;
			break;
		case 0:
			m_EarItemList.Remove( i, 1 );
			break;
		case 1:
			REarIndex = i;
			break;
		}
	}

	if( -1 != LEarIndex )
	{
		//~ debug("���� �Ͱ���");
		m_equipItem[ EQUIPITEM_LEar ].Clear();
		tex_Tooltip[ EQUIPITEM_LEar ].HideWindow();
		m_equipItem[ EQUIPITEM_LEar ].AddItem( m_EarItemList[ LEarIndex ] );
	}

	if( -1 != REarIndex )
	{
		//~ debug("������ �Ͱ���");
		m_equipItem[ EQUIPITEM_REar ].Clear();
		tex_Tooltip[ EQUIPITEM_REar ].HideWindow();
		m_equipItem[ EQUIPITEM_REar ].AddItem( m_EarItemList[ REarIndex ] );
		script_item.item3.Clear();
		script_item.item3.AddItem(m_EarItemList[ REarIndex ]);

	}
}

function EarItemUpdateStart()
{
	local int i;
	local int LEarIndex, REarIndex;

	LEarIndex = -1;
	REarIndex = -1;

	for( i = 0; i < m_EarItemListStart.Length; ++i )
	{
		switch( IsLOrREar( m_EarItemListStart[i].ID ) )
		{
		case -1:
			
			LEarIndex = i;
			break;
		case 0:
			m_EarItemList.Remove( i, 1 );
			break;
		case 1:
			REarIndex = i;
			break;
		}
	}

	if( -1 != LEarIndex )
	{
		m_equipItem[ EQUIPITEM_LEar ].Clear();
		tex_Tooltip[ EQUIPITEM_LEar ].HideWindow();
		m_equipItem[ EQUIPITEM_LEar ].AddItem( m_EarItemListStart[ LEarIndex ] );
	}

	if( -1 != REarIndex )
	{
		m_equipItem[ EQUIPITEM_REar ].Clear();
		tex_Tooltip[ EQUIPITEM_REar ].HideWindow();
		m_equipItem[ EQUIPITEM_REar ].AddItem( m_EarItemListStart[ REarIndex ] );
		
		script_item.item3.Clear();
		script_item.item3.AddItem(m_EarItemListStart[ REarIndex ]);
	}
}

//~ Function RBraceletItemUpdate()
//~ {
	//~ local int i;
	//~ if (g_RBraceTurnOn)
	//~ {
		//~ m_equipItem[ EQUIPITEM_Deco1 ].EnableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco2 ].EnableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco3 ].EnableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco4 ].EnableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco5 ].EnableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco6 ].EnableWindow();
	//~ }
	//~ else
	//~ {
		//~ m_equipItem[ EQUIPITEM_Deco1 ].DisableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco2 ].DisableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco3 ].DisableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco4 ].DisableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco5 ].DisableWindow();
		//~ m_equipItem[ EQUIPITEM_Deco6 ].DisableWindow();
	//~ }
//~ }



function FingerItemUpdate()
{
	local int i;
	local int LFingerIndex, RFingerIndex;

	LFingerIndex = -1;
	RFingerIndex = -1;
//	AddSystemMessageString(string(m_FingerItemList.Length) $ " FingerItemUpdate ");
//	AddSystemMessageString(string(m_FingerItemListStart.Length) $ " FingerItemUpdate Start");
	for( i = 0; i < m_FingerItemList.Length; ++i )
	{
		switch( IsLOrRFinger( m_FingerItemList[i].ID ) )
		{
		case -1:
			
			LFingerIndex = i;
//			AddSystemMessageString((m_FingerItemList[i].Name) $ " case -1 " $ string(LFingerIndex));
			break;
		case 0:
//			AddSystemMessageString((m_FingerItemList[i].Name) $"  case 0 remove ");
			m_FingerItemList.Remove( i, 1 );
			break;
		case 1:
			RFingerIndex = i;
//			AddSystemMessageString((m_FingerItemList[i].Name) $ " case 1 " $ string(RFingerIndex));
			break;
		}
	}

	if( -1 != LFingerIndex )
	{
		m_equipItem[ EQUIPITEM_LFinger ].Clear();
		tex_Tooltip[ EQUIPITEM_LFinger ].HideWindow();
		m_equipItem[ EQUIPITEM_LFinger ].AddItem( m_FingerItemList[ LFingerIndex ] );
	}

	if( -1 != RFingerIndex )
	{
		m_equipItem[ EQUIPITEM_RFinger ].Clear();
		tex_Tooltip[ EQUIPITEM_RFinger ].HideWindow();
		m_equipItem[ EQUIPITEM_RFinger ].AddItem( m_FingerItemList[ RFingerIndex ] );
		
		script_item.item2.Clear();
		script_item.item2.AddItem(m_FingerItemList[ RFingerIndex ]);
	}
}


function FingerItemUpdateStart()
{
	local int i;
	local int LFingerIndex, RFingerIndex;

	LFingerIndex = -1;
	RFingerIndex = -1;
//	AddSystemMessageString(string(m_FingerItemList.Length) $ " FingerItemUpdateStart ");
//	AddSystemMessageString(string(m_FingerItemListStart.Length) $ " FingerItemUpdateStart Start");
	for( i = 0; i < m_FingerItemListStart.Length; ++i )
	{
		switch( IsLOrRFinger( m_FingerItemListStart[i].ID ) )
		{
		case -1:
			
			LFingerIndex = i;
	//		AddSystemMessageString((m_FingerItemListStart[i].Name) $ " case -1 " $ string(LFingerIndex));
			break;
		case 0:
	//		AddSystemMessageString((m_FingerItemListStart[i].Name) $"  case 0 remove ");
			m_FingerItemList.Remove( i, 1 );
			break;
		case 1:
			RFingerIndex = i;
	//		AddSystemMessageString((m_FingerItemListStart[i].Name) $ " case 1 " $ string(RFingerIndex));
			break;
		}
	}

	if( -1 != LFingerIndex )
	{
		m_equipItem[ EQUIPITEM_LFinger ].Clear();
		tex_Tooltip[ EQUIPITEM_LFinger ].HideWindow();
		m_equipItem[ EQUIPITEM_LFinger ].AddItem( m_FingerItemListStart[ LFingerIndex ] );
	}

	if( -1 != RFingerIndex )
	{
		m_equipItem[ EQUIPITEM_RFinger ].Clear();
		tex_Tooltip[ EQUIPITEM_RFinger ].HideWindow();
		m_equipItem[ EQUIPITEM_RFinger ].AddItem( m_FingerItemListStart[ RFingerIndex ] );
		
		script_item.item2.Clear();
		script_item.item2.AddItem(m_FingerItemListStart[ RFingerIndex ]);
	}
}


function EquipItemUpdate( ItemInfo a_info )
{
	local ItemWindowHandle hItemWnd;
	local ItemInfo TheItemInfo;
	local bool ClearLHand;
	local ItemInfo RHand;
	local ItemInfo LHand;
	local ItemInfo Legs;
	local ItemInfo Gloves;
	local ItemInfo Feet;
	local ItemInfo Hair2;
	
	local UserInfo InfoUser;
	
	local int i;
	//~ local int j;
	local int decoIndex;

	SetEnchantTex(a_Info);
	
	switch( a_Info.SlotBitType )
	{
	case 1:		// SBT_UNDERWEAR
		hItemWnd = m_equipItem[ EQUIPITEM_Underwear ];
		tex_Tooltip[ EQUIPITEM_Underwear ].HideWindow();
		break;
	case 2:		// SBT_REAR
	case 4:		// SBT_LEAR
	case 6:		// SBT_RLEAR
		for( i = 0; i < m_EarItemList.Length; ++i )
		{
			if( IsSameServerID(m_EarItemList[ i ].ID, a_Info.ID) )
			{
				m_EarItemList[ i ] = a_Info;
				break;
			}
		}

		// �� ã���� ���� �߰�
		if( i == m_EarItemList.Length )
		{
			m_EarItemList.Length = m_EarItemList.Length + 1;
			m_EarItemList[m_EarItemList.Length-1] = a_Info;
			if (m_EarItemListStart.Length<2) 
			{
				m_EarItemListStart.Length = m_EarItemListStart.Length + 1;
				m_EarItemListStart[m_EarItemListStart.Length-1] = a_Info;
			}
		}
		hItemWnd = None;

		if (!isStart) EarItemUpdate();
		
		if (isStart) EarItemUpdateStart();
	
		break;
	case 8:		// SBT_NECK
		hItemWnd = m_equipItem[ EQUIPITEM_Neck ];
		tex_Tooltip[ EQUIPITEM_Neck ].HideWindow();
		break;
	case 16:	// SBT_RFINGER
	case 32:	// SBT_LFINGER
	case 48:	// SBT_RLFINGER
	
//	AddSystemMessageString(string(m_FingerItemList.Length) $ " ItemUpdate ");
//	AddSystemMessageString(string(m_FingerItemListStart.Length) $ " ItemUpdate Start");
		
		for( i = 0; i < m_FingerItemList.Length; ++i )
		{
			if( IsSameServerID(m_FingerItemList[ i ].ID, a_Info.ID) )
			{
				m_FingerItemList[ i ] = a_Info;
	//			AddSystemMessageString((m_FingerItemList[i].Name) );
				break;
			}
		}

		// �� ã���� ���� �߰�
		if( i == m_FingerItemList.Length )
		{
			m_FingerItemList.Length = m_FingerItemList.Length + 1;
			m_FingerItemList[m_FingerItemList.Length-1] = a_Info;
			if (m_FingerItemListStart.Length<2) 
			{
				m_FingerItemListStart.Length = m_FingerItemListStart.Length + 1;
				m_FingerItemListStart[m_FingerItemListStart.Length-1] = a_Info;
			}
		}

		hItemWnd = None;
		
		if (!isStart) FingerItemUpdate();
		
		if (isStart) FingerItemUpdateStart();

		break;
	case 64:	// SBT_HEAD
		hItemWnd = m_equipItem[ EQUIPITEM_Head ];
		tex_Tooltip[ EQUIPITEM_Head ].HideWindow();
		hItemWnd.EnableWindow();
		//~ UpdateCloakSlotActivation();
		break;
	case 128:	// SBT_RHAND
		hItemWnd = m_equipItem[ EQUIPITEM_RHand ];
		tex_Tooltip[ EQUIPITEM_RHand ].HideWindow();
		script_osd.WeapType = a_Info.WeaponType;
		break;
	case 256:	// SBT_LHAND
		hItemWnd = m_equipItem[ EQUIPITEM_LHand ];
		tex_Tooltip[ EQUIPITEM_LHand ].HideWindow();
		hItemWnd.EnableWindow();
		break;
	case 512:	// SBT_GLOVES
		hItemWnd = m_equipItem[ EQUIPITEM_Gloves ];
		tex_Tooltip[ EQUIPITEM_Gloves ].HideWindow();
		hItemWnd.EnableWindow();
		// Updates cloak slot activation when the cloak slot has not equipped. Only applied to Gloves, Chest, Legs, Feet slots.
		//~ if (!m_equipItem[ EQUIPITEM_Cloak ].IsEnableWindow())
		//~ {
			//~ UpdateCloakSlotActivation();
		//~ }
	
		break;
	case 1024:	// SBT_CHEST
		hItemWnd = m_equipItem[ EQUIPITEM_Chest ];
		tex_Tooltip[ EQUIPITEM_Chest ].HideWindow();
		// Updates cloak slot activation when the cloak slot has not equipped. Only applied to Gloves, Chest, Legs, Feet slots.
		//~ if (!m_equipItem[ EQUIPITEM_Cloak ].IsEnableWindow())
		//~ {
			//~ UpdateCloakSlotActivation();
		//~ }
	
		break;
	case 2048:	// SBT_LEGS
		hItemWnd = m_equipItem[ EQUIPITEM_Legs ];
		tex_Tooltip[ EQUIPITEM_Legs ].HideWindow();
		hItemWnd.EnableWindow();
		// Updates cloak slot activation when the cloak slot has not equipped. Only applied to Gloves, Chest, Legs, Feet slots.
		//~ if (!m_equipItem[ EQUIPITEM_Cloak ].IsEnableWindow())
		//~ {
			//~ UpdateCloakSlotActivation();
		//~ }
	
		break;
	case 4096:	// SBT_FEET
		hItemWnd = m_equipItem[ EQUIPITEM_Feet ];
		tex_Tooltip[ EQUIPITEM_Feet ].HideWindow();
		hItemWnd.EnableWindow();
		// Updates cloak slot activation when the cloak slot has not equipped. Only applied to Gloves, Chest, Legs, Feet slots.
		//~ if( m_equipItem[ EQUIPITEM_Cloak ].GetItem( 0, TheItemInfo ) )
		
		//~ {
		//~ if (!m_equipItem[ EQUIPITEM_Cloak ].IsEnableWindow())
		//~ {
			//~ Debug("Equip Item Cloak Check");
			//~ UpdateCloakSlotActivation();
		//~ }
		//~ else
		//~ {
			//~ Debug("Equip Item Cloak None");
		//~ }
	
		break;
	case 8192:	// SBT_BACK
		
		hItemWnd = m_equipItem[ EQUIPITEM_Cloak ];
		tex_Tooltip[ EQUIPITEM_Cloak ].HideWindow();
		//~ Debug ("���� ��Ż");
		hItemWnd.EnableWindow();
		break;
	
	case 16384:	// SBT_RLHAND
		hItemWnd = m_equipItem[ EQUIPITEM_RHand ];
		tex_Tooltip[ EQUIPITEM_RHand ].HideWindow();
		tex_Tooltip[ EQUIPITEM_LHand ].HideWindow();
		ClearLHand = true;
		script_osd.WeapType = a_Info.WeaponType;

		// ������� ���������� ���� ���� ������� ��Ʈ�� �����ش�. 
		if( IsBowOrFishingRod( a_Info ) )
		{
			if( m_equipItem[ EQUIPITEM_LHand ].GetItem( 0, TheItemInfo ) )
			{
				if( IsArrow( TheItemInfo ) )
					ClearLHand = false;
			}
		}
		
		
		
		if( ClearLHand )	//LRHAND ��쿡�� ex1 , ex2 �� �ִ°� �ְ� ���°� �־ ���� ó���� �ʿ��մϴ�. ;; -innowind
		{
			if(Len(a_Info.IconNameEx1) !=0)
			{
				RHand = a_info;
				LHand = a_info;				
				RHand.IconIndex = 1;
				LHand.IconIndex = 2;
				//RHand.IconName = a_Info.IconNameEx1;
				//LHand.IconName = a_Info.IconNameEx2;
				m_equipItem[ EQUIPITEM_RHand ].Clear();
				m_equipItem[ EQUIPITEM_RHand ].AddItem( RHand );
				//m_equipItem[ EQUIPITEM_RHand ].DisableWindow();
				m_equipItem[ EQUIPITEM_LHand ].Clear();
				m_equipItem[ EQUIPITEM_LHand ].AddItem( LHand );
				m_equipItem[ EQUIPITEM_LHand ].DisableWindow();
				script_item.item4.Clear();
				script_item.item4.AddItem(a_Info);
				script_item.item5.Clear();
				isVert = GetOptionBool( "Game", "IsShortcutWndVertical" );
				if (!isVert) script_item.Me.SetWindowSize( 145 , 34 );
				else script_item.Me.SetWindowSize( 34 , 145 );
				script_item.tex5.SetTexture("");
				hItemWnd = None;	// ������ �̹����� ������ �ʵ��� �⺻ ������ �����ش�.
			}
			else	// Ȱ�̳� â���� �������̹����� �Ȱ��� ���.
			{
				m_equipItem[ EQUIPITEM_LHand ].Clear();
				m_equipItem[ EQUIPITEM_LHand ].AddItem( a_Info );
				m_equipItem[ EQUIPITEM_LHand ].DisableWindow();				
			}
			
		}
		break;
	case 32768:	// SBT_ONEPIECE
		hItemWnd = m_equipItem[ EQUIPITEM_Chest ];
		tex_Tooltip[ EQUIPITEM_Chest ].HideWindow();
		tex_Tooltip[ EQUIPITEM_Legs ].HideWindow();
		Legs = a_Info;
		Legs.IconName = a_Info.IconNameEX2;	//���� �������� �׷��ش�. 
		m_equipItem[ EQUIPITEM_Legs ].Clear();		
		m_equipItem[ EQUIPITEM_Legs ].AddItem( Legs );
		m_equipItem[ EQUIPITEM_Legs ].DisableWindow();	
		break;
	case 65536:	// SBT_HAIR
		hItemWnd = m_equipItem[ EQUIPITEM_Hair ];
		tex_Tooltip[ EQUIPITEM_Hair ].HideWindow();
		break;
	case 131072:	// SBT_ALLDRESS
		hItemWnd = m_equipItem[ EQUIPITEM_Chest ];
		Hair2 = a_info;	//������ head�� �����־�� ������ �޸� ������������ hair2�� �ֽ��ϴ�. - innowind
		Gloves = a_info;
		Legs = a_info;
		Feet = a_info;
		Hair2.IconName = a_Info.IconNameEx1;
		Gloves.IconName = a_Info.IconNameEx2;
		Legs.IconName = a_Info.IconNameEx3;
		Feet.IconName = a_Info.IconNameEx4;
		tex_Tooltip[ EQUIPITEM_Head ].HideWindow();
		tex_Tooltip[ EQUIPITEM_Gloves ].HideWindow();
		tex_Tooltip[ EQUIPITEM_Legs ].HideWindow();
		tex_Tooltip[ EQUIPITEM_Feet ].HideWindow();
		m_equipItem[ EQUIPITEM_Head ].Clear();
		m_equipItem[ EQUIPITEM_Head ].AddItem( Hair2 );
		m_equipItem[ EQUIPITEM_Head ].DisableWindow();
		m_equipItem[ EQUIPITEM_Gloves ].Clear();
		m_equipItem[ EQUIPITEM_Gloves ].AddItem( Gloves );
		m_equipItem[ EQUIPITEM_Gloves ].DisableWindow();
		m_equipItem[ EQUIPITEM_Legs ].Clear();
		m_equipItem[ EQUIPITEM_Legs ].AddItem( Legs );
		m_equipItem[ EQUIPITEM_Legs ].DisableWindow();
		m_equipItem[ EQUIPITEM_Feet ].Clear();
		m_equipItem[ EQUIPITEM_Feet ].AddItem( Feet );
		m_equipItem[ EQUIPITEM_Feet ].DisableWindow();
		break;
	case 262144:	// SBT_HAIR2
		hItemWnd = m_equipItem[ EQUIPITEM_Hair2 ];
		tex_Tooltip[ EQUIPITEM_Hair2 ].HideWindow();
		hItemWnd.EnableWindow();
		break;
	case 524288:	// SBT_HAIRALL
		hItemWnd = m_equipItem[ EQUIPITEM_Hair ];
		tex_Tooltip[ EQUIPITEM_Hair ].HideWindow();
		tex_Tooltip[ EQUIPITEM_Hair2 ].HideWindow();
		//Hair2 = a_info;
		//Hair2.IconName = a_Info.IconNameEx2;
		m_equipItem[ EQUIPITEM_Hair2 ].Clear();
		m_equipItem[ EQUIPITEM_Hair2 ].AddItem( a_info );
		m_equipItem[ EQUIPITEM_Hair2 ].DisableWindow();
		break;
	case 1048576: //SBT_RBracelet
		hItemWnd = m_equipItem[ EQUIPITEM_RBracelet ];
		m_equipItem[ EQUIPITEM_RBracelet ].Clear();
		m_equipItem[ EQUIPITEM_RBracelet ].AddItem( a_info );
		m_equipItem[ EQUIPITEM_RBracelet ].EnableWindow();
		switch(a_info.ID.ClassID)
		{
			case 9589:
				m_hTaliWnd.SetWindowSize(45, 42);
				m_hTaliWnd.SetAnchor("FlightTransformCtrlWnd", "TopRight", "TopRight", -93, 8);
			break;
			case 9590:
			case 13295:
				m_hTaliWnd.SetWindowSize(81, 42);
				m_hTaliWnd.SetAnchor("FlightTransformCtrlWnd", "TopRight", "TopRight", -75, 8);
			break;
			case 9591:
			case 10209:
			case 17049:
				m_hTaliWnd.SetWindowSize(117, 42);
				m_hTaliWnd.SetAnchor("FlightTransformCtrlWnd", "TopRight", "TopRight", -57, 8);
			break;
			case 9592:
			case 10210:
				m_hTaliWnd.SetWindowSize(153, 42);
				m_hTaliWnd.SetAnchor("FlightTransformCtrlWnd", "TopRight", "TopRight", -39, 8);
			break;
			case 26500:
				m_hTaliWnd.SetWindowSize(189, 42);
				m_hTaliWnd.SetAnchor("FlightTransformCtrlWnd", "TopRight", "TopRight", -21, 8);
			break;
			case 26501:
				m_hTaliWnd.SetWindowSize(225, 42);
				m_hTaliWnd.SetAnchor("FlightTransformCtrlWnd", "TopRight", "TopRight", -3, 8);
			break;
		}
		
		if (m_hFlightWnd.isShowWindow()) m_hTaliWnd.ShowWindow();
			else  m_hTaliWnd.HideWindow();
		break;

	case  2097152: 	 //SBT_LBracelet
		hItemWnd = m_equipItem[ EQUIPITEM_LBracelet ];
		tex_Tooltip[ EQUIPITEM_LBracelet ].HideWindow();
		m_equipItem[ EQUIPITEM_LBracelet ].Clear();
		m_equipItem[ EQUIPITEM_LBracelet ].AddItem( a_info );
		m_equipItem[ EQUIPITEM_LBracelet ].EnableWindow();
		
		// Updates Talisman Item slot activation when the Bracelet slot has not equipped. 
		//~ if (!m_equipItem[ EQUIPITEM_Deco1 ].IsEnableWindow())
		//~ {
		//~ UpdateTalismanSlotActivation();
		//~ }
			
		break;

	case 4194304:	//SBT_Deco1;
		decoIndex = GetDecoIndex(a_info.Id);
		if (decoIndex == -1)
		{
			for ( i = 0; i < 6; ++i )
			{
				if (script_tali.tal[i].GetItem(0, TheItemInfo))
				{	
					if (a_info.Id.ServerID == TheItemInfo.Id.ServerID)
					{
						return;
					}
				}
				else
				{
					if (i == 0) TaliInfo1 = a_info;
					if (i == 1) TaliInfo2 = a_info;
					if (i == 2) TaliInfo3 = a_info;
					if (i == 3) TaliInfo4 = a_info;
					if (i == 4) TaliInfo5 = a_info;
					if (i == 5) TaliInfo6 = a_info;
					m_equipItem[ EQUIPITEM_Deco1 + i ].Clear();
					m_equipItem[ EQUIPITEM_Deco1 + i ].AddItem( a_info );
					m_equipItem[ EQUIPITEM_Deco1 + i ].EnableWindow();
	
					if (GetTalismanSkillID(a_info.ID.ClassID) != -1)
					{
						a_info.ID.ClassID = GetTalismanSkillID(a_info.ID.ClassID);
						a_info.ItemSubType = int(EShortCutItemType.SCIT_SKILL);
					}				
					script_tali.tal[i].Clear();
					script_tali.tal[i].AddItem(a_info); 
					return;
				}
				
			}
		}
	
		if (decoIndex != -1)
		{
			m_equipItem[ EQUIPITEM_Deco1 + decoIndex ].Clear();
			m_equipItem[ EQUIPITEM_Deco1 + decoIndex ].AddItem( a_info );
			tex_Tooltip[ EQUIPITEM_Deco1 + decoIndex ].HideWindow();
			m_equipItem[ EQUIPITEM_Deco1 + decoIndex ].EnableWindow();


			if (GetTalismanSkillID(a_info.ID.ClassID) != -1)
			{
				a_info.ID.ClassID = GetTalismanSkillID(a_info.ID.ClassID);
				a_info.ItemSubType = int(EShortCutItemType.SCIT_SKILL);
			}

			script_tali.tal[decoIndex].Clear();
			script_tali.tal[decoIndex].AddItem(a_info);
			for (i = 0; i < 6; i++)
			{
				if (!m_equipItem[EQUIPITEM_Deco1+i].GetItem(0,TheItemInfo))					
				script_tali.tal[i].Clear();
			}
		}
		break;
		
	case 268435456:
		hItemWnd = m_equipItem[ EQUIPITEM_Waist ];
		tex_Tooltip[EQUIPITEM_Waist].HideWindow();
		break;	
	}

	if( None != hItemWnd )
	{
		hItemWnd.Clear();
		//~ Debug("IconName="@a_Info.IconName);
		hItemWnd.AddItem( a_Info );
		//AddSystemMessageString("a_Info.Name = "$a_Info.Name);
			

		if ( a_Info.SlotBitType == 8 ) //Necklase
		{
			script_item.item1.Clear();
			script_item.item1.AddItem(a_Info);
		}
		
		
		if ( (a_Info.SlotBitType == 128) || (a_Info.SlotBitType == 16384)) // RLHand wxcept Duals
		{
			script_item.item4.Clear();
			script_item.item4.AddItem(a_Info);
			
			if( IsBowOrFishingRod( a_Info ) )
			{
				if( m_equipItem[ EQUIPITEM_LHand ].GetItem( 0, TheItemInfo ) )
				{
					if( !IsArrow( TheItemInfo ) )
					{	
						script_item.item5.Clear();
						isVert = GetOptionBool( "Game", "IsShortcutWndVertical" );
						if (!isVert) script_item.Me.SetWindowSize( 145 , 34 );
						else script_item.Me.SetWindowSize( 34 , 145 );
						script_item.tex5.SetTexture("");
					}
				}
			}
			else
			{	
				if (a_Info.SlotBitType == 16384)
				{	
					script_item.item5.Clear();
					isVert = GetOptionBool( "Game", "IsShortcutWndVertical" );
					if (!isVert) script_item.Me.SetWindowSize( 145 , 34 );
					else script_item.Me.SetWindowSize( 34 , 145 );
					script_item.tex5.SetTexture("");
				}
			}
		}
	
		
	//	if (a_Info.SlotBitType == 268435456) // Belt
	//	{
//			script_item.item3.Clear();
//			script_item.item3.AddItem(a_Info);
	//	}
		
		if ( (a_Info.SlotBitType == 256) ) // LHand
		{
			script_item.item5.Clear();
			isVert = GetOptionBool( "Game", "IsShortcutWndVertical" );
			if (!isVert) script_item.Me.SetWindowSize( 182 , 34 );
			else script_item.Me.SetWindowSize( 34 , 182 );
			script_item.tex5.SetTexture("L2UI_CH3.etc.menu_outline");
			script_item.item5.AddItem(a_Info);
		}
		
	}
	
	//~ UpdateTalismanSlotActivation();
	//~ UpdateCloakSlotActivation();
}

function HandleOpenWindow(string param)
{
	local int open;

	if ( bIsRequestItemList ) return;

	ParseInt(param, "Open", open);

	if(open==0) return;
	
	OpenWindow();
}

function OpenWindow()
{
	m_hInventoryWnd.ShowWindow();
	m_hInventoryWnd.SetFocus();
}

function HandleHideWindow()
{
	DialogHide();
	HideWindow(m_WindowName);
}

function HandleAddItem(string param)
{
	//local int Order;
	local ItemInfo info;
	
	ParamToItemInfo( param, info );
	//Debug ("HandleAddItem"  );
	if( IsEquipItem(info) )		
	{
		EquipItemUpdate( info );
		
	}
	else if( IsQuestItem(info) )
	{
	//	m_questItem.AddItem( info );
		QuestInvenAddItem(info);
	}
	else
	{
		//ParseInt( param, "Order", Order );
		//debug("InvenOrder: "$string(Order));
		//InvenAddItem( info, Order );
		//InvenAddItem( info );
	//	AddSystemMessageString("HandleAddItem" @ info.Name);
		NormalInvenAddItem( info );
	}
}

function HandleUpdateItem(string param)
{
	local string	type;
	local ItemInfo	info;
	local int		index;
	local ItemWindowHandle detailItemWindowHandle;
	
//	lastHandleAddItemParam = param;	
	ParseString( param, "type", type );
	ParamToItemInfo( param, info );
	
	SetEnchantTex(info);
	
	if( type == "add" )
	{
		if( IsEquipItem(info) )
		{
			EquipItemUpdate( info );
		}
		else if( IsQuestItem(info) )
		{
			QuestInvenAddItem( info );	
			//m_questItem.AddItem(info);
			//index = m_questItem.GetItemNum() - 1;
			//while( index > 0 )						// ���� ������!
			//{
			//	m_questItem.SwapItems(index-1, index);
			//	--index;
			//}
		}
		else
		{
			//InvenAddItem( info );
		//	AddSystemMessageString("HandleUpdateItem add" @ info.Name);
			NormalInvenAddItem( info );
		}
	}
	else if( type == "update" )
	{
//		debug("������Ʈ? " $ param);
		if( IsEquipItem(info) )
		{
//			debug("������������?? " $ param);
			
			if( EquipItemFind(info.ID) )		// match found
			{
			
//				debug("������ ? " $ param);
				EquipItemUpdate( info );
			}
			else			// not found in equipItemList. In this case, move the item from InvenItemList to EquipItemList
			{
//				debug("������ ���� ���μ���1 �κ��丮���� �����.");
//				debug("������?? " $ param);
				InvenDelete( info );
//				debug("������ ���� �����2");
			//	if (info.SlotBitType == 1048576)
				EquipItemUpdate( info );
			}
		}
		else if( IsQuestItem(info) )
		{
			index = m_questItem.FindItem(info.ID);	// ServerID
			if( index != -1 )
			{
				m_questItem.SetItem(index, info);
			}
			else		// In this case, Equipped item is being unequipped.
			{
				EquipItemDelete(info.ID);
				//m_questItem.AddItem(info);
				QuestInvenAddItem( info );
			}
		}
		else
		{
			index = m_invenItem.FindItem(info.ID);	// ServerID
			if( index != -1 )
			{	
				m_invenItem.SetItem( index, info );
				detailItemWindowHandle = getItemWindowHandleByItemType( info );				
				detailItemWindowHandle.SetItem ( detailItemWindowHandle.FindItem( info.ID ) , info ) ;
				if (info.ID.ClassID == 57)
				{
					if (GetAdena() - myAdena > IntToInt64(0))
					{
						MoveAdenaValue(1, MakeCostString(Int64ToString(GetAdena() - myAdena)));
						myAdena = GetAdena();
					}
					else if (GetAdena() - myAdena < IntToInt64(0))
					{
						MoveAdenaValue(0, MakeCostString(Int64ToString( myAdena - GetAdena())));
						myAdena = GetAdena();
					}
				}
			}
			else		// In this case, Equipped item is being unequipped.
			{
				EquipItemDelete(info.ID);
				if (info.SlotBitType == 1048576 && m_hFlightWnd.isShowWindow())
					m_hTaliWnd.HideWindow();
				//InvenAddItem( info, 0 );
				//InvenAddItem( info );
			//	AddSystemMessageString("HandleUpdateItem update" @ info.Name);
				NormalInvenAddItem( info );
			}
		}
	}
	else if( type == "delete" )
	{
		if( IsEquipItem(info) )
		{
			EquipItemDelete(info.ID);
		}
		else if( IsQuestItem(info) )
		{
			//index = m_questItem.FindItem(info.ID);	// ServerID
			//m_questItem.DeleteItem(index);
			QuestInvenDelete( info );
		}
		else
		{
			InvenDelete( info );
		}
	}

	UpdateItemUsability();

	SetAdenaText();
	SetItemCount();
}


function HandleItemListEnd()
{
	// ó�� �Ϸ� �� ����Ʈ ����Ʈ�� ó��
	if ( !bIsQuestItemList ) 
	{
		bIsQuestItemList = true;
		return;
	}
	
	SetAdenaText();
	SetItemCount();
	UpdateItemUsability();
	
	if ( bIsSavedLocalItemIdx ) SaveInventoryOrder() ;
	if ( bIsRequestItemList ) 
	{
		//l2UtilScript.SortItem(m_invenItem_1);
		//l2UtilScript.SortItem(m_invenItem_2);
		//l2UtilScript.SortItem(m_invenItem_3);
		//l2UtilScript.SortItem(m_invenItem_4);	
		bIsRequestItemList = false;
		//m_hOwnerWnd.ShowWindowWithFocus();         
		ShowWindowWithFocus( "InventoryWnd" );
		PlayConsoleSound(IFST_INVENWND_OPEN);
	}	
}


function UpdateItemUsability()
{
	m_invenItem.SetItemUsability();
	m_questItem.SetItemUsability();
}


function HandleAddHennaInfo(string param)
{
	/*
	local int hennaID, isActive;

	ParseInt( param, "ID", hennaID );
	ParseInt( param, "bActive", isActive );
	*/
	UpdateHennaInfo();
}


function HandleUpdateHennaInfo(string param)
{
	UpdateHennaInfo();
}


function QuestInvenAddItem( ItemInfo newItem )
{
	local int idx;
	local int CurLimit;
	local int FindIdx;
	
	local ItemInfo curItem;	

	FindIdx = -1;
	
	if (bIsSavedLocalItemIdx) 
	{
		FindIdx = getLocalItemOrderByItemWindow( m_questItem, newItem.ID.serverID, -1) ;
	}
//	else 
//		if( m_questItem.GetItem( newItem.Order, curItem ) )
//			if( !IsValidItemID( curItem.ID ) ) 
//			{
//				FindIdx = newItem.Order ;
//				AddSystemMessageString("!bIsSavedLocalItemIdx" @ FindIdx);
//			}

	if( FindIdx < 0 )
	{
		CurLimit = m_questItem.GetItemNum();
		for( idx=0; idx<CurLimit; idx++ )
		{
			if( m_questItem.GetItem( idx, curItem ) )
			{
				if( !IsValidItemID( curItem.ID ) )
				{
					FindIdx = idx;
					break;
				}
			}
		}
	}
	
	if( FindIdx > -1 )
		m_questItem.SetItem( FindIdx, newItem );
	else
		m_questItem.AddItem( newItem );

//	m_QuestInvenCount++;
}


function saveLocalItemOrder() 
{
	local int  i ;	
	
	bIsSavedLocalItemIdx = true;
	//Debug ( "saveLocalItemOrder" @ itemSwapedServerID.length ) ;
	for ( i = 0 ; i < m_invenItem.GetItemNum() ; i ++ ) 
	{		
		saveServerID ( m_invenItem, i, itemSwapedServerID, itemSwapedIdx ) ; 		
		saveServerID ( m_invenItem_1, i, itemSwapedServerID_1, itemSwapedIdx_1 ) ; 		
		saveServerID ( m_invenItem_2, i, itemSwapedServerID_2, itemSwapedIdx_2 ) ; 		
		saveServerID ( m_invenItem_3, i, itemSwapedServerID_3, itemSwapedIdx_3 ) ; 		
		saveServerID ( m_invenItem_4, i, itemSwapedServerID_4, itemSwapedIdx_4 ) ; 				
	}

	for ( i = 0 ; i < m_questItem.GetItemNum() ; i ++ ) 		
		saveServerID ( m_questItem, i, itemSwapedServerID_q, itemSwapedIdx_q ) ; 
}

function saveServerID ( ItemWindowHandle targetWindow, int idx,  out array<int> serverIDList, out array<int> SwapedIdx ) 
{		
	local iteminfo invenInfo;	

	targetWindow.GetItem( idx , invenInfo );
	
	if ( invenInfo.ID.serverID != -1 ) 
	{
		invenInfo.Order = idx;
		idx = serverIDList.length;
		serverIDList.length = serverIDList.length  + 1 ;
		serverIDList[ idx ] = invenInfo.ID.serverID;
		SwapedIdx[ idx ] = invenInfo.Order;

		//Debug (  "saveServerID" @ invenInfo.Name @  invenInfo.Order @ targetWindow.GetWindowName()) ;
	}
}

// ������ order�� �
function int getLocalItemOrder( int serverID, array<int> serverIDList, array<int> SwapedIdx, int defaultOrder  ) 
{
	local int i ;
	for ( i = 0 ; i < serverIDList.Length ; i ++ )  	
	{		
		if ( serverIDList[ i ] == serverID ) 
			return SwapedIdx[ i ];
	}

	return defaultOrder;
}


function int getLocalItemOrderByItemWindow ( itemWindowHandle targetWindow, int serverID, int defaultOrder ) 
{
	switch ( targetWindow ) 
	{				
		case m_invenItem_1 :
			return getLocalItemOrder( serverID, itemSwapedServerID_1, itemSwapedIdx_1, defaultOrder ) ;		
		case m_invenItem_2 :
			return getLocalItemOrder( serverID, itemSwapedServerID_2, itemSwapedIdx_2, defaultOrder ) ;		
		case m_invenItem_3 :
			return getLocalItemOrder( serverID, itemSwapedServerID_3, itemSwapedIdx_3, defaultOrder ) ;		
		case m_invenItem_4 :
			return getLocalItemOrder( serverID, itemSwapedServerID_4, itemSwapedIdx_4, defaultOrder ) ;		
		case m_questItem :			
			return getLocalItemOrder( serverID, itemSwapedServerID_q, itemSwapedIdx_q, defaultOrder ) ;
	}
	return defaultOrder ;
}

function QuestInvenDelete( ItemInfo item )
{
	local int FindIdx;
	local ItemInfo ClearItem;

	FindIdx = m_questItem.FindItem( item.ID );
	if( FindIdx != -1 )
	{
		//����� �ٽ� �� ���� ���������� ä���ش�.
		m_questItem.DeleteItem(FindIdx);
	//	m_QuestInvenCount--;

		ClearItemID( ClearItem.ID );
		ClearItem.IconName = "L2ui_ct1.emptyBtn";
		m_questItem.AddItem(ClearItem);		
	}
}



function UpdateHennaInfo()
{
	local int i;
	local int HennaInfoCount;
	local int HennaID;
	local int IsActive;
	local ItemInfo HennaItemInfo;
	local UserInfo PlayerInfo;
	local int ClassStep;

	if( GetPlayerInfo( PlayerInfo ) )
	{
		ClassStep = GetClassStep( PlayerInfo.nSubClass );
		switch( ClassStep )
		{
			case 1:
			case 2:
			case 3:
				m_hHennaItemWindow.SetRow( ClassStep );
			break;
			default:
				m_hHennaItemWindow.SetRow( 0 );
			break;
		}
	}

	m_hHennaItemWindow.Clear();

	HennaInfoCount = class'HennaAPI'.static.GetHennaInfoCount();
	if( HennaInfoCount > ClassStep )
		HennaInfoCount = ClassStep;

	for( i = 0; i < HennaInfoCount; ++i )
	{
		if( class'HennaAPI'.static.GetHennaInfo( i, HennaID, IsActive ) )
		{
			if( !class'UIDATA_HENNA'.static.GetItemName( HennaID, HennaItemInfo.Name ) )
				break;
			if( !class'UIDATA_HENNA'.static.GetDescription( HennaID, HennaItemInfo.Description ) )
				break;
			if( !class'UIDATA_HENNA'.static.GetIconTex( HennaID, HennaItemInfo.IconName ) )
				break;

			if( 0 == IsActive )
				HennaItemInfo.bDisabled = true;
			else
				HennaItemInfo.bDisabled = false;

			m_hHennaItemWindow.AddItem( HennaItemInfo );			
		}
	}
}

function SetAdenaText()
{
	local string adenaString;
	
	adenaString = MakeCostString( Int64ToString(GetAdena()) );

	m_hAdenaTextBox.SetText(adenaString);
	m_hAdenaTextBox.SetTooltipString(ConvertNumToText(Int64ToString(GetAdena())));
	
	script_expbar.txt_ExpBarAdenaValue.SetText(adenaString);
}

function UseItem( ItemWindowHandle a_hItemWindow, int index )
{
	local ItemInfo	info;
	local ItemInfo item1i,item2i,item3i,item4i,item5i;

	if( a_hItemWindow.GetItem(index, info) )
	{
		if( !info.bDisabled )		// lpislhy
		{
			if( info.bRecipe )					// ������(������)�� ����� ������ �����
			{
				DialogSetReservedItemID(info.ID);	// ServerID
				DialogSetID(DIALOG_USE_RECIPE);
				DialogShow(DIALOG_Modalless,DIALOG_Warning, GetSystemMessage(798));
			}
			else if( info.PopMsgNum > 0 )			// �˾� �޽����� �����ش�.
			{
				DialogSetID(DIALOG_POPUP);
				DialogSetReservedItemID(info.ID);	// ServerID
				DialogShow(DIALOG_Modalless,DIALOG_Warning, GetSystemMessage(info.PopMsgNum));
			}
			else
			{
				debug ("Sending Request to Server:");
				RequestUseItem(info.ID);

				script_item.item1.GetItem(0, item1i);
				script_item.item2.GetItem(0, item2i);
				script_item.item3.GetItem(0, item3i);
				script_item.item4.GetItem(0, item4i);
				script_item.item5.GetItem(0, item5i);
				//AddSystemMessageString("GOT ITEM INFO");
				switch (info.ID)
				{
					case item1i.ID:
					script_item.item1.Clear();
					//script_tali.tal4.DisableWindow();
					//AddSystemMessageString("4th ITEM INFO clear");
					break;
					case item2i.ID:
					script_item.item2.Clear();
					//script_tali.tal4.DisableWindow();
					//AddSystemMessageString("4th ITEM INFO clear");
					break;
					case item3i.ID:
					script_item.item3.Clear();
					//script_tali.tal4.DisableWindow();
					//AddSystemMessageString("4th ITEM INFO clear");
					break;
					case item4i.ID:
					script_item.item4.Clear();
					//script_tali.tal4.DisableWindow();
					//AddSystemMessageString("4th ITEM INFO clear");
					break;
					case item5i.ID:
					script_item.item5.Clear();
					isVert = GetOptionBool( "Game", "IsShortcutWndVertical" );
					if (!isVert) script_item.Me.SetWindowSize( 145 , 34 );
					else script_item.Me.SetWindowSize( 34 , 145 );
					script_item.tex5.SetTexture("");
					//script_tali.tal4.DisableWindow();
					//AddSystemMessageString("4th ITEM INFO clear");
					break;
				}
			}
		}
	}
}

function int GetMyInventoryLimit()
{
	//~ debug ("MyInventoryLimit:" @ class'UIDATA_PLAYER'.static.GetInventoryLimit());
	//~ return class'UIDATA_PLAYER'.static.GetInventoryLimit();
	return m_MaxInvenCount;
}

function int GetQuestItemInventoryLimit()
{
	return m_MaxQuestItemInvenCount;
}

function SetItemCount()
{
	local int limit;
	local int count;

	count = m_NormalInvenCount + EquipItemGetItemNum();
	limit = GetMyInventoryLimit();

	txt_ItemCount.SetText("(" $ count $ "/" $ limit $ ")");
	script_expbar.txt_ExpBarInventoryValue.SetText(count $ "/" $ limit);
}

function HandleDialogOK()
{
	local int id;
	local INT64 reserved2;
	local ItemID sID;
	local INT64 number;
	
	if( DialogIsMine() )
	{
		id = DialogGetID();
		reserved2 = DialogGetReservedInt2();
		number = StringToInt64(DialogGetString());
		sID = DialogGetReservedItemID();	// ItemID
		
		if( id == DIALOG_USE_RECIPE || id == DIALOG_POPUP )
		{
			RequestUseItem(sID);
		}
		else if( id == DIALOG_DROPITEM )
		{
			RequestDropItem( sID, IntToInt64(1), m_clickLocation );
		}
		else if( id == DIALOG_DROPITEM_ASKCOUNT )
		{
			if(number == IntToInt64(0)) 
				number = IntToInt64(1);					// �ƹ� ���ڵ� �Է����� ������ 1�� ������� ó��
			RequestDropItem( sID, number, m_clickLocation );
		}
		else if( id == DIALOG_DROPITEM_ALL )
		{
			RequestDropItem( sID, reserved2, m_clickLocation );
		}
		else if( id == DIALOG_DESTROYITEM )
		{
			RequestDestroyItem(sID, IntToInt64(1));
			PlayConsoleSound(IFST_TRASH_BASKET);
		}
		else if( id == DIALOG_DESTROYITEM_ASKCOUNT )
		{
			RequestDestroyItem(sID, number);
			PlayConsoleSound(IFST_TRASH_BASKET);
		}
		else if( id == DIALOG_DESTROYITEM_ALL)
		{
			RequestDestroyItem(sID, reserved2);
			PlayConsoleSound(IFST_TRASH_BASKET);
		}
		else if( id == DIALOG_CRYSTALLIZE )
		{
			RequestCrystallizeItem(sID,IntToInt64(1));
			PlayConsoleSound(IFST_TRASH_BASKET);
		}
		else if ( id == DIALOG_DROPITEM_PETASKCOUNT )
		{
			class'PetAPI'.static.RequestGetItemFromPet( sID, number, false);
		}
	}
}

function HandleUpdateUserInfo()
{
	if( m_hInventoryWnd.IsShowWindow() )
	{
		InvenLimitUpdate();
		EarItemUpdate();
		FingerItemUpdate();
		CheckShowCrystallizeButton();
		UpdateTalismanSlotActivation();
		UpdateCloakSlotActivation();
	}
	else
	{
		EarItemUpdate();
		FingerItemUpdate();
//		UpdateTalismanSlotActivation();
	}
}

function HandleToggleWindow()
{
	if( m_hInventoryWnd.IsShowWindow() )
	{
		m_hInventoryWnd.HideWindow();
		PlayConsoleSound(IFST_INVENWND_CLOSE);
	}
	else
	{		
		if ( bIsRequestItemList ) return;
		bIsRequestItemList = true;
			m_hOwnerWnd.setTimer ( TIMER_REQUEST_ITEMLIST, TIMER_REQUEST_ITEMLIST_DELAY );
			
		if (IsShowInventoryWndUponEvent())
		{
			RequestItemList();
			m_hInventoryWnd.ShowWindow();
		//	PlayConsoleSound(IFST_INVENWND_OPEN);
		}	
	}
}

//����â��, ����â��, ȭ��â��, ��ȯâ, ��������, �Ǹ�â, �����Ǹ�, ���α��� â�� ������ ��� �����ϴ� ��ƾ
//�ٸ������ ���λ��� â���� ���� �����Ҷ��� �������� --;; - innowind
function bool IsShowInventoryWndUponEvent()
{
	local WindowHandle m_warehouseWnd;
	local WindowHandle m_privateShopWnd;
	local WindowHandle m_tradeWnd;
	local WindowHandle m_shopWnd;
	local WindowHandle m_multiSellWnd;
	local WindowHandle m_deliverWnd;
	local PrivateShopWnd m_scriptPrivateShopWnd;
	local WindowHandle m_PostBoxWnd, m_PostWriteWnd, m_PostDetailWnd_General, m_PostDetailWnd_SafetyTrade; 
	//branch
	local WindowHandle m_BR_CashShopWnd;
	local WindowHandle m_BR_BuyingWnd;
	//end of branch

	//��ǰ �κ��丮 �߰�
	local WindowHandle m_ProductInventoryWnd;

	m_warehouseWnd = GetWindowHandle( "WarehouseWnd" );					//����â��, ����â��, ȭ��â��
	m_privateShopWnd = GetWindowHandle( "PrivateShopWnd" );					//�����Ǹ�, ���α���
	m_tradeWnd = GetWindowHandle( "TradeWnd" );							//��ȯ
	m_shopWnd = GetWindowHandle( "ShopWnd" );							//��������, �Ǹ�
	m_multiSellWnd = GetWindowHandle( "MultiSellWnd" );						//��������, �Ǹ�
	m_deliverWnd = GetWindowHandle( "DeliverWnd" );							//ȭ������
	m_scriptPrivateShopWnd = PrivateShopWnd( GetScript("PrivateShopWnd") );

	m_PostBoxWnd = GetWindowHandle( "PostBoxWnd" );
	m_PostWriteWnd = GetWindowHandle( "PostWriteWnd" );
	m_PostDetailWnd_General = GetWindowHandle( "PostDetailWnd_General" );
	m_PostDetailWnd_SafetyTrade = GetWindowHandle( "PostDetailWnd_SafetyTrade" );
		
	//branch
	m_BR_CashShopWnd = GetWindowHandle( "BR_CashShopWnd" );	// ���� ����
	m_BR_BuyingWnd = GetWindowHandle( "BR_BuyingWnd" );	// ���� ����
	//end of branch

	m_ProductInventoryWnd = GetWindowHandle( "ProductInventoryWnd" ); // �ǸŴ���

	if( m_warehouseWnd.IsShowWindow() )
		return false;

	if( m_tradeWnd.IsShowWindow() )
		return false;
	
	if( m_shopWnd.IsShowWindow() )
		return false;
	
	if( m_multiSellWnd.IsShowWindow() )
		return false;
	
	if( m_deliverWnd.IsShowWindow() )
		return false;
	
	if( m_privateShopWnd.IsShowWindow() && m_scriptPrivateShopWnd.m_type == PT_Sell )
		return false;

	if (m_PostBoxWnd.IsShowWindow() || m_PostWriteWnd.IsShowWindow() || m_PostDetailWnd_General.IsShowWindow() || m_PostDetailWnd_SafetyTrade.IsShowWindow() )
		return false;
		
	//branch
	if( m_BR_CashShopWnd.IsShowWindow() || m_BR_BuyingWnd.IsShowWindow() )
		return false;
	//end of branch

	if( m_ProductInventoryWnd.IsShowWindow() )
		return false;

	return true;
}

function int IsLOrREar( ItemID sID )
{
	local ItemID LEar;
	local ItemID REar;
	local ItemID LFinger;
	local ItemID RFinger;

	GetAccessoryItemID( LEar, REar, LFinger, RFinger );

	if( IsSameServerID(sID, LEar) )
		return -1;
	else if( IsSameServerID(sID, REar) )
		return 1;
	else
		return 0;
}

function int IsLOrRFinger( ItemID sID )
{
	local ItemID LEar;
	local ItemID REar;
	local ItemID LFinger;
	local ItemID RFinger;

	GetAccessoryItemID( LEar, REar, LFinger, RFinger );

	if( IsSameServerID(sID, LFinger) )
		return -1;
	else if( IsSameServerID(sID, RFinger) )
		return 1;
	else
		return 0;
}

function bool IsBowOrFishingRod( ItemInfo a_Info )
{
	//~ debug("������� ��ȣ?"@  a_Info.WeaponType);
	
	if( 6 == a_Info.WeaponType || 10 == a_Info.WeaponType || 12 == a_Info.WeaponType )
		return true;

	return false;
}

function int IsDecoItem( ItemInfo a_Info )
{
	return a_Info.SlotBitType;
}

function bool IsArrow( ItemInfo a_Info )
{
	return a_Info.bArrow;
}

// �κ��丮 ���� ǥ�� 
function InvenLimitUpdate()
{
	// Changed by JoeyPark 2010/09/09	

	ItemboxUpdate(m_invenItem, GetMyInventoryLimit() );

	ItemboxUpdate(m_invenItem_1, GetMyInventoryLimit() );
	ItemboxUpdate(m_invenItem_2, GetMyInventoryLimit() );
	ItemboxUpdate(m_invenItem_3, GetMyInventoryLimit() );
	ItemboxUpdate(m_invenItem_4, GetMyInventoryLimit() );

	ItemboxUpdate(m_questItem, GetQuestItemInventoryLimit() );
	// End changing
}


function ItemboxUpdate(ItemWindowHandle hItemWnd, int iInvenLimit)
{
	local int iCount;
	local int iItemCount;
	local int iAddedCount;
	local int iDeletedCount;
	local ItemInfo kClearItem;
	local ItemInfo kCurItem;
	
	kClearItem.IconName = "L2ui_ct1.emptyBtn";
	ClearItemID( kClearItem.ID );
	iItemCount = hItemWnd.GetItemNum();

	if( iItemCount < iInvenLimit )
	{		
		IAddedCount = iInvenLimit - iItemCount;
		for( iCount=0; iCount<iAddedCount; iCount++ )
		{
			hItemWnd.AddItem( kClearItem );	
		}
	}
	else if ( iItemCount > iInvenLimit )
	{
		iDeletedCount = iItemCount - iInvenLimit;
		for ( iCount = hItemWnd.GetItemNum()- 1; iCount >= 0; iCount-- )
		{
			if (iDeletedCount > 0)
			{
				hItemWnd.GetItem(iCount, kCurItem );
				if (!IsValidItemID(kCurItem.ID))
				{
					hItemWnd.DeleteItem(iCount);
					iDeletedCount--;
				}
				if (iDeletedCount <= 0)
				{
					break;
				}					
			}
		}
	}
}

function MoveAdenaValue(int plusminus, string amoutAdena)
{
	local Color adenaColor;
	
	if (txt_ExpBarAdenaValue.isShowWindow())
	{
		txt_ExpBarAdenaChangeValue.SetAlpha(0);
		txt_ExpBarAdenaChangeValue.SetAnchor( "ExpBarWnd.txtExpBarAdenaValue", "BottomRight", "BottomRight", 0, 0);
		
		switch (plusminus)
		{
			case 0:
				adenaColor.R = 255;
				adenaColor.G = 0;
				adenaColor.B = 0;
				txt_ExpBarAdenaChangeValue.SetText("-" $ amoutAdena );
				break;
				
			case 1:
				adenaColor.R = 255;
				adenaColor.G = 255;
				adenaColor.B = 0;
				txt_ExpBarAdenaChangeValue.SetText("+" $ amoutAdena );
				break;
		}
		
		txt_ExpBarAdenaChangeValue.SetTextColor(adenaColor);
		txt_ExpBarAdenaChangeValue.ClearAnchor();
		
		txt_ExpBarAdenaChangeValue.Move(0, -38, 1.5f);
		txt_ExpBarAdenaChangeValue.SetAlpha(255);
		txt_ExpBarAdenaChangeValue.SetAlpha(0, 1.2f);
	}
}


//function InvenAddItem( ItemInfo newItem, int order )
function NormalInvenAddItem(ItemInfo newItem)
{
	local int idx;
	local int CurLimit;
	local int FindIdx;

	local ItemInfo curItem;
	
	local ItemWindowHandle detailItemWindow ;
	
	FindIdx = -1;


	CurLimit = m_invenItem.GetItemNum();
//	if (bIsSavedLocalItemIdx) 
//	{
//		newItem.Order = getLocalItemOrder( newItem.ID.serverID, itemSwapedServerID, itemSwapedIdx, newItem.Order ) ;
//		AddSystemMessageString("bIsSavedLocalItemIdx" @ newItem.Order);
//	}

//	AddSystemMessageString("newItem.Order" @ newItem.Order);
	
	if( m_invenItem.GetItem( newItem.Order, curItem ) )
	{
		if( !IsValidItemID( curItem.ID ) )
		{
			FindIdx = newItem.Order;
			//AddSystemMessageString("!IsValidItemID FindIdx" @ FindIdx);
		}
	}
	
//	AddSystemMessageString("FindIdx" @ FindIdx);
	
	if( FindIdx < 0 )
	{
		//AddSystemMessageString("FindIdx < 0");
		for( idx=0; idx<CurLimit; idx++ )
		{
			if( m_invenItem.GetItem( idx, curItem ) )
			{
				
				if( !IsValidItemID( curItem.ID ) )
				{
					FindIdx = idx;
				//	AddSystemMessageString("FindIdx" @ FindIdx);
	//				AddSystemMessageString("idx" @ idx);
					break;
				}
			}
		}
	}

	SetEnchantTex(newItem);
	
	//AddSystemMessageString("Final FindIdx" @ FindIdx);
	
	if( FindIdx > -1 )
	{	
	//	AddSystemMessageString("SetItem" @ newItem.Name);
		m_invenItem.SetItem(FindIdx, newItem);
		if (newItem.ID.ClassID == 57)
		{
			if (GetAdena() - myAdena > IntToInt64(0))
			{
				MoveAdenaValue(1, MakeCostString(Int64ToString(GetAdena() - myAdena)));
				myAdena = GetAdena();
			}
			else if (GetAdena() - myAdena < IntToInt64(0))
			{
				MoveAdenaValue(0, MakeCostString(Int64ToString(myAdena - GetAdena())));
				myAdena = GetAdena();
			}
		}
	}
	else
	{
	//	AddSystemMessageString("AddItem" @ newItem.Name);
		m_invenItem.AddItem( newItem );
	}
	
	m_NormalInvenCount++;
	
	detailItemWindow = getItemWindowHandleByItemType ( newItem );
	
//	curItem.ID.ClassID = -1;
//	curItem.ID.ServerID = -1;
	
	if (bIsSavedLocalItemIdx)
	{		
		FindIdx = getLocalItemOrderByItemWindow( detailItemWindow, newItem.ID.serverID, -1 ) ;
//			AddSystemMessageString("bIsSavedLocalItemIdx FindIdx" @ FindIdx);
	}
	else 
	{
//		AddSystemMessageString("NOT bIsSavedLocalItemIdx CurLimit" @ CurLimit);
		FindIdx = -1;	
		//Debug ( "addNormalItem 0" @ newItem.Name @ FindIdx ) ;

		for(idx = 0; idx < CurLimit; idx++)
			if (detailItemWindow.GetItem(idx, curItem))
			{
//				AddSystemMessageString("curItemID" @ curItem.ID.ClassID @ curItem.ID.ServerID);
				if (!IsValidItemID(curItem.ID))
				{				
					FindIdx = idx;
	//				AddSystemMessageString("NOT bIsSavedLocalItemIdx FindIdx" @ FindIdx);
					break;
				}
			}
	}

//	AddSystemMessageString("NOT bIsSavedLocalItemIdx FindIdx FINAL" @ FindIdx);
	//Debug ( "addNormalItem 1" @ newItem.Name @ FindIdx ) ;
	if( FindIdx > -1 )	
		detailItemWindow.SetItem( FindIdx, newItem );		
	else
		detailItemWindow.AddItem( newItem );
}



function InvenDelete( ItemInfo item )
{
	local int FindIdx;
	local int DetailFindIdx;
	
	local ItemInfo ClearItem;
	
	local itemWindowHandle detailItemWindow;

	detailItemWindow = getItemWindowHandleByItemType( item );	
	
	ClearItemID( ClearItem.ID );
	
	//������ Ȱ��ȭ �κ� �ؽ��� ó��
	ClearItem.IconName = "L2ui_ct1.emptyBtn";
	FindIdx = m_invenItem.FindItem( item.ID );
	DetailFindIdx = detailItemWindow.FindItem( item.ID );
	if( FindIdx != -1 )
	{
		m_invenItem.SetItem( FindIdx, ClearItem );
		detailItemWindow.SetItem( DetailFindIdx, ClearItem );
		m_NormalInvenCount--;
	}
	
	if (item.ID.ClassID == 57)
	{
		MoveAdenaValue(0, MakeCostString(Int64ToString(myAdena)));
		myAdena = IntToInt64(0);
	}
}


function InvenClear()
{
	m_invenItem.Clear();
	m_invenItem_1.Clear();
	m_invenItem_2.Clear();
	m_invenItem_3.Clear();
	m_invenItem_4.Clear();
	m_questItem.Clear();
	InvenLimitUpdate();
	m_NormalInvenCount = 0;
}


function SaveInventoryOrder()
{
	local int idx;
	local int InvenLimit;
	
	local ItemInfo item;
	local array<ItemID> IDList;
	local array<int> OrderList;

	InvenLimit = m_invenItem.GetItemNum();

	for( idx=0; idx<InvenLimit; idx++ )
	{
		if( m_invenItem.GetItem( idx, item ) )
		{
			if( IsValidItemID( item.ID ) )
			{
				IDList.Insert(IDList.Length, 1);
				IDList[IDList.Length-1] = item.ID;
				
				OrderList.Insert(OrderList.Length, 1);
				OrderList[OrderList.Length-1] = item.Order;
			}
		}
	}

	if( IDList.Length > 0 )
	{
		debug("Saving Inventory");
		RequestSaveInventoryOrder( IDList, OrderList );
	}
//	SetINIInt("Inventory", "extraSlots", extraSlotsCount, "PatchSettings");
	
	bIsSavedLocalItemIdx = false;
	itemSwapedIdx.Length = 0 ;
	itemSwapedIdx_1.Length = 0 ;
	itemSwapedIdx_2.Length = 0 ;
	itemSwapedIdx_3.Length = 0 ;
	itemSwapedIdx_4.Length = 0 ;
	itemSwapedIdx_q.Length = 0 ;
	itemSwapedServerID.Length = 0 ;
	itemSwapedServerID_1.Length = 0 ;
	itemSwapedServerID_2.Length = 0 ;
	itemSwapedServerID_3.Length = 0 ;
	itemSwapedServerID_4.Length = 0 ;
	itemSwapedServerID_q.Length = 0 ;
}


function OnClickButtonWithHandle(ButtonHandle a_ButtonHandle)
{
	switch (a_ButtonHandle)
	{
	
		case btn_CharViewOn:
			wnd_CharView.ShowWindow();
			btn_CharViewOn.HideWindow();
			btn_CharViewOff.ShowWindow();
			break;
			
		case btn_CharViewOff:
			wnd_CharView.HideWindow();
			btn_CharViewOn.ShowWindow();
			btn_CharViewOff.HideWindow();
			break;
	}
}



function ItemWindowHandle getItemWindowHandleByItemType ( ItemInfo item )
{
	if(!IsValidItemID(item.ID))
		return m_invenItem_4;
	
	switch (MySimpleCheckItemType(item.ID.classID )) 
	{
		case 0:	
			return m_questItem;
			break;
		case 1:
			return m_invenItem_1;
			break;
		case 2:
			return m_invenItem_2;
			break;		
		case 3:
			return m_invenItem_3;
			break;
		case 4:
			return m_invenItem_4;
			break;
	}	
}


function int IsLastItemCheck(int CheckID)
{
	switch (CheckID)
	{
		// fish soulshot
		case 6536:
		case 6537:
		case 6538:
		case 6539:
		case 6540:
		// scroll pack
		case 22087:
		case 22088:
		// pet stuff
		case 5262:
		case 9668:
		case 4038:
		case 2515:
		case 5168:
		case 14818:
		case 10517:
		case 10516:
		case 7582:
		case 10425:
		case 10515:
		case 20232:
		case 20233:
		case 20234:
		case 6645:
		case 6646:
		case 6647:
		// spiritshot
		case 21851:	//ng
		case 2509:	//ng
		case 3948:	//d
		case 22077:	//d
		case 2510:	//d
		case 3949:	//c
		case 2511:	//c
		case 22078:	//c
		case 3950:	//b
		case 2512:	//b
		case 22079:	//b
		case 3951:	//a
		case 2513:	//a
		case 22080:	//a
		case 3952:	//s
		case 2514:	//s
		case 22081:	//s
		case 22231:	//s
		//blessed spiritshot
		case 5790:	//ng
		case 3947:	//ng
		case 3948:	//d
		case 22072:	//d
		case 3949:	//c
		case 22073:	//c
		case 3950:	//b
		case 21853:	//b
		case 21854:	//b
		case 22074:	//b
		case 3951:	//a
		case 22075:	//a
		case 21855:	//a
		case 21852:	//a
		case 3952:	//s
		case 21856:	//s
		case 22076:	//s
		//soulshot
		case 21845:	//ng
		case 5789:	//ng
		case 1835:	//ng
		case 1463:	//d
		case 21846:	//d
		case 22082:	//d
		case 1464:	//c
		case 21847:	//c
		case 22083:	//c
		case 1465:	//b
		case 21848:	//b
		case 22084:	//b
		case 1466:	//a
		case 21849:	//a
		case 22085:	//a
		case 1467:	//s	
		case 21850:	//s
		case 22086:	//s
		//ss pack
		case 22104:	//d
		case 22094:	//d
		case 22099:	//d
		case 22095:	//c
		case 22100:	//c
		case 22105:	//c
		case 22106:	//b
		case 22101:	//b
		case 22096:	//b
		case 22107:	//a
		case 22102:	//a
		case 22097:	//a
		case 22098:	//S
		case 22108:	//S
		case 22123:	//S
		case 22232:	//s
		case 22103:	//s
		case 22118:	//s
		case 22233:	//d		
		case 20326:	//pet
		case 20327:	//pet
		case 20328:	//pet		
		//other
		case 15492:	//mahum food
		case 8873:
		case 8874:
		case 8875:
		case 8876:
			return 2;
			break;
			
		case 1462:	//s cry
		case 1461:	//a cry
		case 1460:	//b cry
		case 1459:	//c cry
		case 1458:	//d cry
			return 3;
			break;
			
		default:
			return 4;
			break;
	}
}


function int MySimpleCheckItemType(int CheckID)
{
	local ItemInfo checkItemInfo;
	local ItemID  checkItemID;
	local EItemType eItemType;
	
	checkItemID.ClassID = CheckID;
	
	class'UIDATA_ITEM'.static.GetItemInfo(checkItemID, checkItemInfo);

	if (IsQuestItem(checkItemInfo))
		return 0;
	else
	{
		eItemType = EItemType(checkItemInfo.ItemType);
		
		switch (eItemType)
		{
			case ITEM_ASSET:
			case ITEM_WEAPON:
			case ITEM_ARMOR:
			case ITEM_ACCESSARY:
				return 1;
				break;
				
			case ITEM_ETCITEM:
				switch (EEtcItemType(checkItemInfo.ItemSubType))
				{
					case ITEME_POTION:
					case ITEME_ELIXIR:
					case ITEME_SCROLL:
					case ITEME_ARROW:
					case ITEME_BOLT:
						return 2;
						break;
						
					case ITEME_MATERIAL:
					case ITEME_RECIPE:
						if (CheckID == 8615)	// summon cry
							return 2;
						else
							return 3;
						break;
						
					default:
						return IsLastItemCheck(CheckID);
						break;
				}
				break;
		}
	}
}


function OnClickButton( string strID )
{	

	switch( strID )
	{
		
		case "SortButton":
			switch ( m_selectedItemTab  ) 
			{
				case INVENTORY_ITEM_TAB:
					l2UtilScript.SortItem(m_invenItem);	//�κ��丮 ����
					SaveInventoryOrder();
					break;
					
				case INVENTORY_ITEM_1_TAB:
					l2UtilScript.SortItem(m_invenItem_1);
					break;
					
				case INVENTORY_ITEM_2_TAB:
					l2UtilScript.SortItem(m_invenItem_2);
					break;
					
				case INVENTORY_ITEM_3_TAB:
					l2UtilScript.SortItem(m_invenItem_3);
					break;
					
				case INVENTORY_ITEM_4_TAB:
					l2UtilScript.SortItem(m_invenItem_4);
					break;
					
				default:
					l2UtilScript.SortItem(m_invenItem);	//�κ��丮 ����
					SaveInventoryOrder();
					break;
			}			
			break;
			
		case "InventoryTab0":	//�κ��丮 ������ �� Ŭ��			
			m_selectedItemTab = INVENTORY_ITEM_TAB;
			m_invenItem.SetScrollPosition(0);
			SetItemCount();			
			break;
		case "InventoryTab1":	//�κ��丮 ������ �� Ŭ��			
			m_selectedItemTab = INVENTORY_ITEM_1_TAB;
			m_invenItem_1.SetScrollPosition(0);
			SetItemCount();			
				break;
		case "InventoryTab2":	//�κ��丮 ������ �� Ŭ��			
			m_selectedItemTab = INVENTORY_ITEM_2_TAB;
			m_invenItem_2.SetScrollPosition(0);
			SetItemCount();			
			break;
		case "InventoryTab3":	//�κ��丮 ������ �� Ŭ��			
			m_selectedItemTab = INVENTORY_ITEM_3_TAB;
			m_invenItem_3.SetScrollPosition(0);
			SetItemCount();			
			break;
		case "InventoryTab4":	//�κ��丮 ������ �� Ŭ��			
			m_selectedItemTab = INVENTORY_ITEM_4_TAB;
			m_invenItem_4.SetScrollPosition(0);
			SetItemCount();			
			break;
				
		case "btnAutoAtt":
			if (class'UIAPI_WINDOW'.static.IsShowWindow("AutoAtt"))
			{
				class'UIAPI_WINDOW'.static.HideWindow("AutoAtt");
			}
			else
			{
				class'UIAPI_WINDOW'.static.ShowWindow("AutoAtt");
				class'UIAPI_WINDOW'.static.SetFocus("AutoAtt");
			}
			break;
		
		case "btnAutoEnchant":
			if (!class'UIAPI_WINDOW'.static.IsShowWindow("ItemEnchantWnd"))
			{
				if (class'UIAPI_WINDOW'.static.IsShowWindow("AutoItemEnchant"))
				{
					class'UIAPI_WINDOW'.static.HideWindow("AutoItemEnchant");
				}
				else
				{
					class'UIAPI_WINDOW'.static.ShowWindow("AutoItemEnchant");
					class'UIAPI_WINDOW'.static.SetFocus("AutoItemEnchant");
				}
			}
			break;

		case "BtnWindowExpand":
			SwitchExtendedInventory();
			SetItemCount();
			RequestItemList();
			l2UtilScript.SortItem(m_invenItem);
	//		l2UtilScript.SortItem(m_invenItem_1);
	//		l2UtilScript.SortItem(m_invenItem_2);
	//		l2UtilScript.SortItem(m_invenItem_3);
	//		l2UtilScript.SortItem(m_invenItem_4);	
			SaveInventoryOrder();
			break;
	}
}



function UpdateTalismanSlotActivation()
{
	local int Count;
	local int i;
	local UserInfo user;

	if (GetPlayerInfo(user))
	{
		Count = user.nTalismanNum;
		
		if (Count > 0)
		{
			tex_TalismanAllow.ShowWindow();
			for (i = 0; i < Count; i++)
			{
				m_Talisman_Disable[ i ].HideWindow();
				m_equipItem[ EQUIPITEM_Deco1 + i ].EnableWindow();
			}
		}
		else
		{
			tex_TalismanAllow.HideWindow();
			for (i = 0; i<6; i++)
			{
				m_Talisman_Disable[ i ].ShowWindow();
				m_equipItem[ EQUIPITEM_Deco1 + i ].DisableWindow();
			}
		}
	}
} 
	
function UpdateCloakSlotActivation()
{
	local UserInfo user;
	
	if (GetPlayerInfo(user))
	{
		if (user.nFullArmor > 0)
		{
			m_CloakSlot_Disable.HideWindow();
			m_equipItem[ EQUIPITEM_Cloak ].EnableWindow();
		}
		else
		{
			m_CloakSlot_Disable.ShowWindow();
			m_equipItem[ EQUIPITEM_Cloak ].DisableWindow();
		}
	}
}




function HandleSetMaxCount(string param)
{
	local int ExtraBeltCount;
	ParseInt (param, "Inventory", m_MaxInvenCount);
	ParseInt (param, "questItem", m_MaxQuestItemInvenCount);
	ParseInt (param, "extrabelt", ExtraBeltCount);

	m_invenItem.SetExpandItemNum(0, ExtraBeltCount);
	m_invenItem_1.SetExpandItemNum(0, ExtraBeltCount);
	m_invenItem_2.SetExpandItemNum(0, ExtraBeltCount);
	m_invenItem_3.SetExpandItemNum(0, ExtraBeltCount);
	m_invenItem_4.SetExpandItemNum(0, ExtraBeltCount);
	InvenLimitUpdate();
	FixDisableTex();
	SetItemCount();
}


function OnTimer(int TimerID)
{
	switch (TimerID)
	{
		case TIMER_REQUEST_ITEMLIST:
			bIsRequestItemList = false;
			break;
			
		case 1130: 
			if (GetDecoIndex(TaliInfo1.Id) != -1) EquipItemUpdate(TaliInfo1);
			if (GetDecoIndex(TaliInfo2.Id) != -1) EquipItemUpdate(TaliInfo2);
			if (GetDecoIndex(TaliInfo3.Id) != -1) EquipItemUpdate(TaliInfo3);
			if (GetDecoIndex(TaliInfo4.Id) != -1) EquipItemUpdate(TaliInfo4);	
			if (GetDecoIndex(TaliInfo5.Id) != -1) EquipItemUpdate(TaliInfo5);	
			if (GetDecoIndex(TaliInfo6.Id) != -1) EquipItemUpdate(TaliInfo6);	
			FingerItemUpdateStart();
			EarItemUpdateStart();
			ExecuteEvent(EV_InventoryUpdateItem);
			m_hInventoryWnd.KillTimer(1130);
			break;
	}
}

defaultproperties
{
}

 

 

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...