class CostumeWindow(ui.ScriptWindow):
def __init__(self, wndInventory):
if not app.ENABLE_COSTUME_SYSTEM:
exception.Abort("What do you do?")
return
if not wndInventory:
exception.Abort("wndInventory parameter must be set to InventoryWindow")
return
ui.ScriptWindow.__init__(self)
self.wndInventory = wndInventory
if app.ENABLE_HIDE_COSTUME_SYSTEM:
self.elemets_world = {}
self.__LoadWindow()
def __del__(self):
ui.ScriptWindow.__del__(self)
def Open(self):
self.RefreshCostumeSlot()
self.Show()
def Destroy(self):
self.toolTip = None
self.wndInventory = None
if app.ENABLE_HIDE_COSTUME_SYSTEM:
self.elemets_world = {}
self.elemets_hide = {}
self.slot = {}
def Close(self):
self.SetOverOutEvent2()
self.Hide()
def __LoadWindow(self):
try:
pyScrLoader = ui.PythonScriptLoader()
pyScrLoader.LoadScriptFile(self, "UIScript/CostumeWindow.py")
except:
exception.Abort("CostumeWindow.LoadWindow.LoadObject")
self.GetChild("TitleBar").SetCloseEvent(ui.__mem_func__(self.Close))
self.toolTip = uiToolTip.ToolTip()
self.toolTip.ClearToolTip()
self.slot = {
item.COSTUME_SLOT_START + 2 : [self.__MakeSlot(item.COSTUME_SLOT_START + 2, 1, 1, 100, 6), localeInfo.COSTUME_SLOT_MOUNT],
item.EQUIPMENT_PET : [self.__MakeSlot(item.EQUIPMENT_PET, 1, 1, 100, 38), localeInfo.COSTUME_SLOT_PET_OFICIAL],
item.SLOT_MOUNT_SKIN : [self.__MakeSlot(item.SLOT_MOUNT_SKIN, 1, 1, 100+34, 38), localeInfo.COSTUME_SLOT_MOUNT_SKIN],
item.EQUIPMENT_OLDPET : [self.__MakeSlot(item.EQUIPMENT_OLDPET, 1, 1, 100, 70), localeInfo.COSTUME_SLOT_PET],
item.COSTUME_SLOT_START : [self.__MakeSlot(item.COSTUME_SLOT_START, 1, 1, 53, 40, 64), localeInfo.COSTUME_SLOT_COSTUME_ARMOR],
item.COSTUME_SLOT_START + 1 : [self.__MakeSlot(item.COSTUME_SLOT_START + 1, 1, 1, 53, 0), localeInfo.COSTUME_SLOT_COSTUME_HAIR],
item.SKIN_SASH_SLOT_START : [self.__MakeSlot(item.SKIN_SASH_SLOT_START, 1, 1, 134, 70), localeInfo.COSTUME_SLOT_COSTUME_SASH],
item.COSTUME_SLOT_WEAPON : [self.__MakeSlot(item.COSTUME_SLOT_WEAPON, 1, 1, 5, 6, 96), localeInfo.COSTUME_SLOT_COSTUME_WEAPON],
player.EQUIPMENT_SLOT_START+9 : [self.__MakeSlot(player.EQUIPMENT_SLOT_START+9, 1, 1, 101 + 32, 5), localeInfo.COSTUME_SLOT_CARCAJ],
# shining
#Weapon
item.SHINING_SLOT_START : [self.__MakeSlot(item.SHINING_SLOT_START, 1, 1, 32, 119), localeInfo.COSTUME_SLOT_EFECT_WEAPON],
item.SHINING_SLOT_START + 1 : [self.__MakeSlot(item.SHINING_SLOT_START + 1, 1, 1, 68, 119), localeInfo.COSTUME_SLOT_EFECT_ARMOR],
# item.SHINING_SLOT_START + 2 : [self.__MakeSlot(item.SHINING_SLOT_START + 2, 1, 1, 103, 119), localeInfo.COSTUME_SLOT_EFECT_WEAPON],
#Armor
# item.SHINING_SLOT_START + 3 : [self.__MakeSlot(item.SHINING_SLOT_START + 3, 3, 1, 32, 150), localeInfo.COSTUME_SLOT_EFECT_ARMOR],
# item.SHINING_SLOT_START + 4 : [self.__MakeSlot(item.SHINING_SLOT_START + 4, 1, 1, 68, 150), localeInfo.COSTUME_SLOT_EFECT_ARMOR],
# item.SHINING_SLOT_START + 5 : [self.__MakeSlot(item.SHINING_SLOT_START + 5, 1, 1, 103, 150), localeInfo.COSTUME_SLOT_EFECT_ARMOR],
#Special
item.SHINING_SLOT_START + 6 : [self.__MakeSlot(item.SHINING_SLOT_START + 6, 1, 1, 1000, 1210), localeInfo.COSTUME_SLOT_EFECT_ARMOR],
}
def __MakeSlot(self, StartIndex, xCount, yCount, pX, pY, sy = 32):
slot = ui.SlotWindow()
slot.SetParent(self.GetChild("Costume_Base"))
slot.SetPosition(pX + 3, pY + 3)
slot.SetSize(32, sy)
slot.AppendSlot(StartIndex, xCount, yCount, 32, sy)
slot.SetOverInEvent2(ui.__mem_func__(self.SetOverInEvent2))
slot.SetOverOutEvent2(ui.__mem_func__(self.SetOverOutEvent2))
slot.SetOverInItemEvent(ui.__mem_func__(self.wndInventory.OverInItem))
slot.SetOverOutItemEvent(ui.__mem_func__(self.wndInventory.OverOutItem))
slot.SetUnselectItemSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlotNew))
slot.SetUseSlotEvent(ui.__mem_func__(self.wndInventory.UseItemSlotNew))
slot.SetSelectEmptySlotEvent(ui.__mem_func__(self.wndInventory.SelectEmptySlot))
slot.SetSelectItemSlotEvent(ui.__mem_func__(self.wndInventory.SelectItemSlot))
slot.Show()
return slot
def SetOverInEvent2(self, slotNumber):
if slotNumber in self.slot:
self.toolTip.ClearToolTip()
self.toolTip.AlignHorizonalCenter()
self.toolTip.AutoAppendNewTextLine(self.slot[slotNumber][1], grp.GenerateColor(1.0, 1.0, 0.0, 1.0))
self.toolTip.Show()
def SetOverOutEvent2(self):
self.toolTip.Hide()
def RefreshCostumeSlot(self):
for key, v in self.slot.items():
v[0].SetItemSlot(key, player.GetItemIndex(key), 0)
v[0].RefreshSlot()
if app.ENABLE_HIDE_COSTUME_SYSTEM:
self.elemets_hide = self.wndInventory.get_costume_hide_list()
self.ButtonsHideCostume()
self.costume_hide_load()
if app.ENABLE_HIDE_COSTUME_SYSTEM:
def ButtonsHideCostume(self):
self.elemets_world["position"] = [
[61 - 10,45 - 10], # 0
[61 - 10,8 - 10], # 1
[13- 10,15- 15], # 2
[62 + 22, 126 - 15], # 3
[134, 68] # 4 hide shash
# [33 ,118], # 5 hide efect weapon 1
# [66 ,118], # 6 hide efect weapon 2
# [99 ,118], # 7 hide efect weapon 3
# [33 ,150], # 8 hide efect body 1
# [33 ,170], # 8 hide efect body 2
# [33 ,180] # 8 hide efect body 3
]
for i in xrange(self.GetSlotCount()):
if i == 3:
continue
self.elemets_world["hide_button_%d"%i] = ui.Button()
self.elemets_world["hide_button_%d"%i].SetParent(self)
self.elemets_world["hide_button_%d"%i].SetPosition(self.elemets_world["position"][i][0]+12,self.elemets_world["position"][i][1]+37)
self.elemets_world["hide_button_%d"%i].SetUpVisual("Modulo/HideCostume/button_show_0.tga")
self.elemets_world["hide_button_%d"%i].SetOverVisual("Modulo/HideCostume/button_show_1.tga")
self.elemets_world["hide_button_%d"%i].SetDownVisual("Modulo/HideCostume/button_show_0.tga")
self.elemets_world["hide_button_%d"%i].SetEvent(self.FuncHide,i)
self.elemets_world["hide_button_%d"%i].Hide()
def FuncHide(self,index):
net.SendChatPacket("/costume_hide %d" %index)
def costume_hide_load(self):
for i in xrange(self.GetSlotCount()):
if i == 3:
continue
if len(self.elemets_hide) > 0:
self.elemets_world["hide_button_%d"%self.elemets_hide[i][0]].SetUpVisual("Modulo/HideCostume/button_%s_0.tga"%self.ButtonInfoHide(self.elemets_hide[i][1]))
self.elemets_world["hide_button_%d"%self.elemets_hide[i][0]].SetOverVisual("Modulo/HideCostume/button_%s_1.tga"%self.ButtonInfoHide(self.elemets_hide[i][1]))
self.elemets_world["hide_button_%d"%self.elemets_hide[i][0]].SetDownVisual("Modulo/HideCostume/button_%s_0.tga"%self.ButtonInfoHide(self.elemets_hide[i][1]))
self.elemets_world["hide_button_%d"%i].Show()