Advertisement
Guest User

Untitled

a guest
Oct 18th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.93 KB | None | 0 0
  1. import ui
  2. import snd
  3. import uiToolTip
  4. import item
  5. import net
  6. import grp
  7. import wndMgr
  8. import constInfo
  9.  
  10. class Halloween(ui.ScriptWindow):
  11.     # Poziții x,y
  12.     POZITII_X = [226,159,93,28,28,28,28,28,28,91,159,227,292,292,292,292,292,] #stanga-dreapta
  13.     POZITII_Y = [326,326,326,326,276,223,168,113,61,61,61,61,61,114,169,222,277,] #sus-jos
  14.     # Poziții x,y MiniDovleac || Poziții x,y pentru nivele
  15.     X_LEVELS = [224,157,91,26,26,26,26,26,26,89,157,225,290,290,290,290,290,]
  16.     Y_LEVELS = [325,325,325,325,275,222,167,112,60,60,60,60,60,113,168,221,276,]
  17.     # Itemele necesare (ToolTipText)
  18.     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",
  19.     "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
  20.     "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
  21.     "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
  22.     "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
  23.     "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
  24.     "x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre","x2 Pietre",
  25.     ]
  26.  
  27.     def __init__(self):
  28.         ui.ScriptWindow.__init__(self)
  29.  
  30.         self.toolTip = None
  31.         self.tooltipItem = None
  32.         self.haloun_levels = {}
  33.         self.haloun_minidovleac = {}
  34.  
  35.         self.toolTip = uiToolTip.ItemToolTip()
  36.         self.toolTip.HideToolTip()
  37.  
  38.         self.LoadWindow()
  39.        
  40.     def __del__(self):
  41.         ui.ScriptWindow.__del__(self)
  42.        
  43.     def Show(self):
  44.         self.LoadWindow()
  45.         self.SetCenterPosition()
  46.  
  47.         ui.ScriptWindow.Show(self)
  48.        
  49.     def LoadWindow(self):
  50.         try:
  51.             PythonScriptLoader = ui.PythonScriptLoader()
  52.             PythonScriptLoader.LoadScriptFile(self, "UIScript/halloween.py")
  53.         except:
  54.             import exception
  55.             exception.Abort("halloween.LoadWindow.LoadObject")
  56.  
  57.         try:
  58.             self.board = self.GetChild("board")
  59.             self.wndItem = self.GetChild("grid_rewards")
  60.             self.wndMiniGamePoints = self.GetChild("MiniGamePointsText")
  61.             self.wndMiniGameBoard = self.GetChild("MiniGameBoard")
  62.             self.wndMiniGameRewardImg = self.GetChild("MiniGameRewardImage")
  63.         except:
  64.             import exception
  65.             exception.Abort("halloween.__LoadWindow.BindObject")
  66.            
  67.         # Set func, exit game
  68.         # self.board.SetEvent(ui.__mem_func__(self.Close))
  69.         self.wndItem.ArrangeSlot(0, 2, 2, 32, 32, 150, 150)
  70.         self.wndItem.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  71.         self.wndItem.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  72.         self.tooltipItem = uiToolTip.ItemToolTip()
  73.         self.tooltipItem.HideToolTip()
  74.         self.SlotsHalounRewars()
  75.         for i in range(17):
  76.             self.haloun_levels[i] = {}
  77.             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")
  78.         self.haloun_minidovleac[0] = {}
  79.         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")
  80.    
  81.     def Close(self):
  82.         if self.toolTip:
  83.             self.toolTip.HideToolTip()
  84.    
  85.         self.Hide()
  86.        
  87.     def SetItemToolTip(self, tooltipItem):
  88.         self.tooltipItem = tooltipItem
  89.        
  90.     def Destroy(self):
  91.         self.ClearDictionary()
  92.  
  93.         self.tooltipItem = None
  94.         self.toolTip = None
  95.        
  96.     def TakeReward(self):
  97.         net.SendChatPacket("/give_reward")
  98.        
  99.     def OnUpdate(self):
  100.         self.wndMiniGamePoints.SetText(str(constInfo.haloun_points))
  101.         self.UpdateLevel()
  102.         self.UpdateReward()
  103.        
  104.     def UpdateReward(self):
  105.         if int(constInfo.haloun_lvl) == 4 or int(constInfo.haloun_lvl) == 9 or int(constInfo.haloun_lvl) == 13 or int(constInfo.haloun_lvl) == 17:
  106.             self.wndMiniGameRewardImg.LoadImage("d:/ymir work/halloween/takereward_image.tga")
  107.         else:
  108.             self.wndMiniGameRewardImg.LoadImage("d:/ymir work/halloween/w_reward.tga")
  109.        
  110.     def UpdateLevel(self):
  111.         self.index = int(constInfo.haloun_lvl)
  112.         # if constInfo.haloun_lvl == 0:
  113.             # self.haloun_minidovleac[0]["mini_dovleac"].Hide()
  114.         # else:
  115.             # self.haloun_minidovleac[0]["mini_dovleac"].Show()
  116.         ##Levels Positions
  117.         self.haloun_minidovleac[0]["mini_dovleac"].SetPosition(self.POZITII_X[self.index],self.POZITII_Y[self.index])      
  118.    
  119.     # def GetVnum(self,index):
  120.         # try:
  121.             # return int(constInfo.haloun_rewards[int(index)]["iVnum"])
  122.         # except KeyError:
  123.             # return 0
  124.            
  125.     # def GetCount(self,index):
  126.         # try:
  127.             # return int(constInfo.haloun_rewards[int(index)]["iCount"])
  128.         # except KeyError:
  129.             # return 0
  130.    
  131.     def SlotsHalounRewars(self):
  132.         pass
  133.         # for index in range(4):
  134.             # self.wndItem.SetItemSlot(index, self.GetVnum(index), self.GetCount(index))
  135.  
  136.     def OverInItem(self, slotIndex):
  137.         pass
  138.         # if self.tooltipItem:
  139.             # self.tooltipItem.SetItemToolTip(self.GetVnum(slotIndex))
  140.            
  141.     def OverOutItem(self):
  142.         if self.tooltipItem:
  143.             self.tooltipItem.HideToolTip()
  144.  
  145. #-.. .- -.-.     . - ..     .-. . ... . .-.. .-.. . .-. --··--     ... .--. . .-.     ...     -- --- .-. ..     -.     .--. .. --.. -.. .-     -- -····- - .. ..
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement