Advertisement
deadx2

Untitled

Aug 16th, 2017
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 7.92 KB | None | 0 0
  1. import app
  2. import constInfo
  3. import uimg
  4. import uiToolTip
  5. import item
  6. import localemg
  7. import player
  8. import grp
  9. import time
  10. import event
  11. import chat
  12. import chr
  13. import net
  14.  
  15. import wndMgr
  16.  
  17. COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, 0.0)
  18.  
  19. class NagrodaBoss(uimg.Bar):
  20.     Schowaj1 = 0
  21.     Schowaj2 = 0
  22.     Schowaj3 = 0
  23.    
  24.     a1 = 1.0
  25.     a2 = 1.0
  26.     a3 = 1.0
  27.    
  28.     Animacja = 0
  29.     Alpha = 0.00
  30.     Alpha2 = 0.00
  31.     Nagroda = 0
  32.     Pozostale = 0
  33.     Zamknij = 0
  34.     def __init__(self):
  35.         uimg.Bar.__init__(self, "TOP_MOST")
  36.         self.ZbudujOkno()
  37.     def SetColor(self,color):
  38.         wndMgr.SetColor(self.hWnd, color)
  39.         self.color = color
  40.  
  41.     def __del__(self):
  42.         uimg.Bar.__del__(self)
  43.  
  44.     def Destroy(self):
  45.         self.Hide()
  46.         return TRUE
  47.  
  48.     def ZbudujOkno(self):
  49.         self.SetPosition(0, 0)
  50.         self.SetSize(wndMgr.GetScreenWidth(), wndMgr.GetScreenHeight())
  51.         self.SetColor(COLOR_BG)
  52.         self.Show()
  53.        
  54.         self.CancelButton3 = uimg.Button()
  55.         self.CancelButton3.SetParent(self)
  56.         self.CancelButton3.SetPosition(self.GetWidth()/2-95, self.GetHeight()/2+130)
  57.         self.CancelButton3.SetUpVisual("illumina/inne/btn_kod2_long_01.tga")
  58.         self.CancelButton3.SetOverVisual("illumina/inne/btn_kod2_long_02.tga")
  59.         self.CancelButton3.SetDownVisual("illumina/inne/btn_kod2_long_03.tga")
  60.         self.CancelButton3.SetText("|cffe6d0a2Pozostałe")
  61.         self.CancelButton3.SetEvent(self.Reszta)
  62.         self.CancelButton3.Hide()
  63.        
  64.         self.CancelButton4 = uimg.Button()
  65.         self.CancelButton4.SetParent(self)
  66.         self.CancelButton4.SetPosition(self.GetWidth()/2, self.GetHeight()/2+130)
  67.         self.CancelButton4.SetUpVisual("illumina/inne/btn_kod2_long_01.tga")
  68.         self.CancelButton4.SetOverVisual("illumina/inne/btn_kod2_long_02.tga")
  69.         self.CancelButton4.SetDownVisual("illumina/inne/btn_kod2_long_03.tga")
  70.         self.CancelButton4.SetText("|cffe6d0a2Zamknij")
  71.         self.CancelButton4.SetEvent(self.Close)
  72.         self.CancelButton4.Hide()
  73.  
  74.         self.Obrazek1 = uimg.ExpandedImageBox()
  75.         self.Obrazek1.SetParent(self)
  76.         self.Obrazek1.SetPosition((self.GetWidth()/2-172), self.GetHeight()/2+20)
  77.         self.Obrazek1.LoadImage("illumina/nagroda_boss/tlo.tga")
  78.         self.Obrazek1.SetAlpha(0.0)
  79.         self.Obrazek1.Show()
  80.  
  81.         self.Obrazek2 = uimg.ExpandedImageBox()
  82.         self.Obrazek2.SetParent(self)
  83.         self.Obrazek2.SetPosition((self.GetWidth()/2-172)+120, self.GetHeight()/2+20)
  84.         self.Obrazek2.LoadImage("illumina/nagroda_boss/tlo.tga")
  85.         self.Obrazek2.SetAlpha(0.0)
  86.         self.Obrazek2.Show()
  87.  
  88.         self.Obrazek3 = uimg.ExpandedImageBox()
  89.         self.Obrazek3.SetParent(self)
  90.         self.Obrazek3.SetPosition((self.GetWidth()/2-172)+120*2, self.GetHeight()/2+20)
  91.         self.Obrazek3.LoadImage("illumina/nagroda_boss/tlo.tga")
  92.         self.Obrazek3.SetAlpha(0.0)
  93.         self.Obrazek3.Show()
  94.  
  95.         self.Pyt1 = uimg.ExpandedImageBox()
  96.         self.Pyt1.LoadImage("illumina/nagroda_boss/btn_01.tga")
  97.         self.Pyt1.SetParent(self)
  98.         self.Pyt1.SetPosition((self.GetWidth()/2-172), self.GetHeight()/2+20)
  99.         self.Pyt1.SetAlpha(0.0)
  100.         self.Pyt1.Show()
  101.  
  102.         self.Pyt2 = uimg.ExpandedImageBox()
  103.         self.Pyt2.LoadImage("illumina/nagroda_boss/btn_01.tga")
  104.         self.Pyt2.SetParent(self)
  105.         self.Pyt2.SetPosition((self.GetWidth()/2-172)+120, self.GetHeight()/2+20)
  106.         self.Pyt2.SetAlpha(0.0)
  107.         self.Pyt2.Show()
  108.  
  109.         self.Pyt3 = uimg.ExpandedImageBox()
  110.         self.Pyt3.LoadImage("illumina/nagroda_boss/btn_01.tga")
  111.         self.Pyt3.SetParent(self)
  112.         self.Pyt3.SetPosition((self.GetWidth()/2-172)+120*2, self.GetHeight()/2+20)
  113.         self.Pyt3.SetAlpha(0.0)
  114.         self.Pyt3.Show()
  115.  
  116.         self.Btn1 = uimg.Button()
  117.         self.Btn1.SetParent(self)
  118.         self.Btn1.SetPosition((self.GetWidth()/2-172), self.GetHeight()/2+20)
  119.         self.Btn1.SetUpVisual("illumina/nagroda_boss/btn_01.tga")
  120.         self.Btn1.SetOverVisual("illumina/nagroda_boss/btn_02.tga")
  121.         self.Btn1.SetDownVisual("illumina/nagroda_boss/btn_01.tga")
  122.         self.Btn1.SetEvent(uimg.__mem_func__(self.Schowaj), 1)
  123.         self.Btn1.Hide()
  124.  
  125.         self.Btn2 = uimg.Button()
  126.         self.Btn2.SetParent(self)
  127.         self.Btn2.SetPosition((self.GetWidth()/2-172)+120, self.GetHeight()/2+20)
  128.         self.Btn2.SetUpVisual("illumina/nagroda_boss/btn_01.tga")
  129.         self.Btn2.SetOverVisual("illumina/nagroda_boss/btn_02.tga")
  130.         self.Btn2.SetDownVisual("illumina/nagroda_boss/btn_01.tga")
  131.         self.Btn2.SetEvent(uimg.__mem_func__(self.Schowaj), 2)
  132.         self.Btn2.Hide()
  133.  
  134.         self.Btn3 = uimg.Button()
  135.         self.Btn3.SetParent(self)
  136.         self.Btn3.SetPosition((self.GetWidth()/2-172)+120*2, self.GetHeight()/2+20)
  137.         self.Btn3.SetUpVisual("illumina/nagroda_boss/btn_01.tga")
  138.         self.Btn3.SetOverVisual("illumina/nagroda_boss/btn_02.tga")
  139.         self.Btn3.SetDownVisual("illumina/nagroda_boss/btn_01.tga")
  140.         self.Btn3.SetEvent(uimg.__mem_func__(self.Schowaj), 3)
  141.         self.Btn3.Hide()
  142.  
  143.         self.Slot1 = uimg.SlotWindow()
  144.         self.Slot1.SetParent(self.Obrazek1)
  145.         self.Slot1.SetPosition(36, 36)
  146.         self.Slot1.AppendSlot(0, 0, 0, 32, 32)
  147.         self.Slot1.Hide()
  148.  
  149.         self.Slot2 = uimg.SlotWindow()
  150.         self.Slot2.SetParent(self.Obrazek2)
  151.         self.Slot2.SetPosition(36, 36)
  152.         self.Slot2.AppendSlot(0, 0, 0, 32, 32)
  153.         self.Slot2.Hide()
  154.  
  155.         self.Slot3 = uimg.SlotWindow()
  156.         self.Slot3.SetParent(self.Obrazek3)
  157.         self.Slot3.SetPosition(36, 36)
  158.         self.Slot3.AppendSlot(0, 0, 0, 32, 32)
  159.         self.Slot3.Hide()
  160.        
  161.         self.Tlo = uimg.ExpandedImageBox()
  162.         self.Tlo.LoadImage("illumina/nagroda_boss/info.tga")
  163.         self.Tlo.SetParent(self)
  164.         self.Tlo.SetPosition(self.GetWidth()/2-150, self.GetHeight()/2-200)
  165.         self.Tlo.SetAlpha(0.0)
  166.         self.Tlo.Show()
  167.  
  168.     def Schowaj(self, nr):
  169.         self.Btn1.Hide()
  170.         self.Btn2.Hide()
  171.         self.Btn3.Hide()
  172.         if nr == 1:
  173.             self.Schowaj1 = 1
  174.         elif nr == 2:
  175.             self.Schowaj2 = 1
  176.         elif nr == 3:
  177.             self.Schowaj3 = 1
  178.         self.Nagroda = nr
  179.  
  180.         event.QuestButtonClick(constInfo.Nagroda_Za_Bossa_Odbierz)
  181.         net.SendQuestInputStringPacket(self.Nagroda)
  182.  
  183.         self.CancelButton3.Show()
  184.         self.CancelButton4.Show()
  185.  
  186.     def Teleportacja(self, id):
  187.         net.SendChatPacket("/teleport " + str(id))
  188.  
  189.     def Reszta(self):
  190.         self.Pozostale = 1
  191.         self.CancelButton3.Hide()
  192.  
  193.     def PokazReszte(self):
  194.         if self.Pozostale == 1:
  195.             self.Schowaj1 = 1
  196.             self.Schowaj2 = 1
  197.             self.Schowaj3 = 1
  198.             self.Pozostale = 0
  199.  
  200.     def Open(self):
  201.         self.Show()
  202.         self.Alpha = 0.0
  203.         self.Animacja = 1
  204.        
  205.     def OnPressEscapeKey(self):
  206.         self.Hide()
  207.         return TRUE
  208.  
  209.     def PrzyciskiShow(self):
  210.         if self.Animacja == 1:
  211.             self.Btn1.Show()
  212.             self.Btn2.Show()
  213.             self.Btn3.Show()
  214.             self.Slot1.Show()
  215.             self.Slot2.Show()
  216.             self.Slot3.Show()
  217.  
  218.     def WyborNagrody(self, nr):
  219.         if self.Schowaj1 == 1 and self.a1 > 0:
  220.             self.Btn1.Hide()
  221.             self.a1 -= 0.05
  222.             self.Pyt1.SetAlpha(self.a1)
  223.        
  224.         elif self.Schowaj2 == 1 and self.a2 > 0:
  225.             self.Btn2.Hide()
  226.             self.a2 -= 0.05
  227.             self.Pyt2.SetAlpha(self.a2)
  228.        
  229.         elif self.Schowaj3 == 1 and self.a3 > 0:
  230.             self.Btn3.Hide()
  231.             self.a3 -= 0.05
  232.             self.Pyt3.SetAlpha(self.a3)
  233.  
  234.     def WyswietlOkno(self):
  235.         global COLOR_BG
  236.  
  237.         if self.Animacja == 1 and self.Alpha < 0.49:
  238.             self.Alpha += 0.01
  239.             COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, self.Alpha)
  240.             self.SetColor(COLOR_BG)
  241.  
  242.             self.Tlo.SetAlpha(self.Alpha*2)
  243.  
  244.             self.Obrazek1.SetAlpha(self.Alpha*2)
  245.             self.Obrazek2.SetAlpha(self.Alpha*2)
  246.             self.Obrazek3.SetAlpha(self.Alpha*2)
  247.             self.Pyt1.SetAlpha(self.Alpha*2)
  248.             self.Pyt2.SetAlpha(self.Alpha*2)
  249.             self.Pyt3.SetAlpha(self.Alpha*2)
  250.  
  251.         else:
  252.             self.PrzyciskiShow()
  253.             self.Animacja = 0
  254.  
  255.     def Close(self):
  256.         self.Zamknij = 1
  257.         self.CancelButton4.Hide()
  258.  
  259.     def ZamknijCalosc(self):
  260.         global COLOR_BG
  261.  
  262.         if self.Zamknij == 1 and self.Alpha > 0.1:
  263.             self.Alpha -= 0.01
  264.             COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, self.Alpha)
  265.             self.SetColor(COLOR_BG)
  266.  
  267.             self.Tlo.SetAlpha(self.Alpha*2)
  268.  
  269.             self.Obrazek1.SetAlpha(self.Alpha*2)
  270.             self.Obrazek2.SetAlpha(self.Alpha*2)
  271.             self.Obrazek3.SetAlpha(self.Alpha*2)
  272.         else:
  273.             self.Slot1.Hide()
  274.             self.Slot2.Hide()
  275.             self.Slot3.Hide()
  276.             self.Schowaj1 = 0
  277.             self.Schowaj2 = 0
  278.             self.Schowaj3 = 0
  279.             self.a1 = 1.0
  280.             self.a2 = 1.0
  281.             self.a3 = 1.0
  282.             self.Hide()
  283.             self.Zamknij = 0
  284.            
  285.     def UstawItemy(self, i1, i2, i3, c1, c2, c3):
  286.         self.Slot1.SetItemSlot(0, int(i1), int(c1))
  287.         self.Slot2.SetItemSlot(0, int(i2), int(c2))
  288.         self.Slot3.SetItemSlot(0, int(i3), int(c3))
  289.  
  290.     def OnUpdate(self):
  291.         self.WyswietlOkno()
  292.  
  293.         self.WyborNagrody(self.Nagroda)
  294.        
  295.         self.PokazReszte()
  296.        
  297.         if self.Zamknij == 1:
  298.             self.ZamknijCalosc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement