function OnClickItem( string strID, int index )
{
local int i, parrentWndId;
local string parentWndName;
if ( strID == "AutoItemSlot" )
{
parentWndName = ItemWindowHandle(GetHandle("ShortcutWnd."$strID)).GetParentWindowName();
i = Int(Mid(parentWndName, InStr(parentWndName, "ItemWnd") + 7));
if (Len(i) == 1)
parrentWndId = int(0$i);
else
parrentWndId = i;
if ( m_itemAutoUse[i] == 1 )
{
m_itemAutoUse[i] = 0;
if ( i >= AUTO_ITEM_SLOT_ELIXIROFCP )
Me.KillTimer(int(210$parrentWndId));
ShowOnScreenMessage(("Auto use "$AutoItemInfo[i].Name)$": Off", 9, 1.5);
}
else
{
m_itemAutoUse[i] = 1;
if ( i >= AUTO_ITEM_SLOT_ELIXIROFCP )
Me.SetTimer(int(210$parrentWndId), 1000);
ShowOnScreenMessage(("Auto use "$AutoItemInfo[i].Name)$": ON", 9, 1.5);
}
if ( i <= AUTO_ITEM_SLOT_BEAST_SPIRITSHOT )
ExecuteEvent(EV_CUSTOM_TOGGLE_ITEM, "itemid="$AutoItemInfo[i].ClassID$" status="$m_itemAutoUse[i]);
ToggleAutoEffect(i, m_itemAutoUse[i]);
}
}