Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ui
- import snd
- import uiToolTip
- import item
- import net
- import grp
- import wndMgr
- import constInfo
- class Halloween(ui.ScriptWindow):
- # Poziții x,y
- POZITII_X = [0,224,157,91,26,26,26,26,26,26,89,157,225,290,290,290,290,290,]
- POZITII_Y = [0,325,325,325,325,275,222,167,112,60,60,60,60,60,113,168,221,276,]
- # Poziții x,y MiniDovleac || Poziții x,y pentru nivele
- X_LEVELS = [224,157,91,26,26,26,26,26,26,89,157,225,290,290,290,290,290,]
- Y_LEVELS = [325,325,325,325,275,222,167,112,60,60,60,60,60,113,168,221,276,]
- # Itemele necesare (ToolTipText)
- ITEMS = ["Sabie+9 x1 si 10000Yang","Sabie+9 x2 si 10000Yang","Sabie+9 x1 si 10000Yang","Sabie+9 x1 si 10000Yang","Sabie+9 x1 si 10000Yang",
- "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
- "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
- "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
- "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
- "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
- "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
- ]
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.toolTip = None
- self.tooltipItem = None
- self.haloun_levels = {}
- self.haloun_minidovleac = {}
- self.toolTip = uiToolTip.ItemToolTip()
- self.toolTip.HideToolTip()
- self.LoadWindow()
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def Show(self):
- self.LoadWindow()
- self.SetCenterPosition()
- ui.ScriptWindow.Show(self)
- def LoadWindow(self):
- try:
- PythonScriptLoader = ui.PythonScriptLoader()
- PythonScriptLoader.LoadScriptFile(self, "UIScript/halloween.py")
- except:
- import exception
- exception.Abort("halloween.LoadWindow.LoadObject")
- try:
- self.board = self.GetChild("board")
- self.wndItem = self.GetChild("grid_rewards")
- self.wndMiniGamePoints = self.GetChild("MiniGamePointsText")
- self.wndMiniGameBoard = self.GetChild("MiniGameBoard")
- self.wndMiniGameRewardImg = self.GetChild("MiniGameRewardImage")
- except:
- import exception
- exception.Abort("halloween.__LoadWindow.BindObject")
- # Set func, exit game
- # self.board.SetEvent(ui.__mem_func__(self.Close))
- self.wndItem.ArrangeSlot(0, 2, 2, 32, 32, 150, 150)
- self.wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
- self.wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- self.tooltipItem = uiToolTip.ItemToolTip()
- self.tooltipItem.HideToolTip()
- self.SlotsHalounRewars()
- for i in range(17):
- self.haloun_levels[i] = {}
- self.haloun_levels[i]["haloun"] = ui.MakeButtonText(self.board, self.X_LEVELS[i], self.Y_LEVELS[i], "Lv.%d" % (i), "Ai nevoie de: %s" % (self.ITEMS[i]),"d:/ymir work/halloween/w_nivel.tga")
- self.haloun_minidovleac[0] = {}
- self.haloun_minidovleac[0]["mini_dovleac"] = ui.MakeButtonText(self.board, self.X_LEVELS[0], self.Y_LEVELS[0], False, "Nivelul Tau Curent","d:/ymir work/halloween/player_slot.tga")
- def Close(self):
- if self.toolTip:
- self.toolTip.HideToolTip()
- self.Hide()
- def SetItemToolTip(self, tooltipItem):
- self.tooltipItem = tooltipItem
- def Destroy(self):
- self.ClearDictionary()
- self.tooltipItem = None
- self.toolTip = None
- def TakeReward(self):
- net.SendChatPacket("/give_reward")
- def OnUpdate(self):
- self.wndMiniGamePoints.SetText(str(constInfo.haloun_points))
- self.UpdateLevel()
- self.UpdateReward()
- def UpdateReward(self):
- if int(constInfo.haloun_lvl) == 4 or int(constInfo.haloun_lvl) == 9 or int(constInfo.haloun_lvl) == 13 or int(constInfo.haloun_lvl) == 17:
- self.wndMiniGameRewardImg.LoadImage("d:/ymir work/halloween/takereward_image.tga")
- else:
- self.wndMiniGameRewardImg.LoadImage("d:/ymir work/halloween/w_reward.tga")
- def UpdateLevel(self):
- self.index = int(constInfo.haloun_lvl)
- if constInfo.haloun_lvl == 0:
- self.haloun_minidovleac[0]["mini_dovleac"].Hide()
- else:
- self.haloun_minidovleac[0]["mini_dovleac"].Show()
- ##Levels Positions
- self.haloun_minidovleac[0]["mini_dovleac"].SetPosition(self.POZITII_X[self.index],self.POZITII_Y[self.index])
- # def GetVnum(self,index):
- # try:
- # return int(constInfo.haloun_rewards[int(index)]["iVnum"])
- # except KeyError:
- # return 0
- # def GetCount(self,index):
- # try:
- # return int(constInfo.haloun_rewards[int(index)]["iCount"])
- # except KeyError:
- # return 0
- def SlotsHalounRewars(self):
- pass
- # for index in range(4):
- # self.wndItem.SetItemSlot(index, self.GetVnum(index), self.GetCount(index))
- def OverInItem(self, slotIndex):
- pass
- # if self.tooltipItem:
- # self.tooltipItem.SetItemToolTip(self.GetVnum(slotIndex))
- def OverOutItem(self):
- if self.tooltipItem:
- self.tooltipItem.HideToolTip()
- #-.. .- -.-. . - .. .-. . ... . .-.. .-.. . .-. --··-- ... .--. . .-. ... -- --- .-. .. -. .--. .. --.. -.. .- -- -····- - .. ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement