Advertisement
deadx2

Untitled

Aug 16th, 2017
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 8.37 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.CancelButton2 = uimg.Button()
  55.         self.CancelButton2.SetParent(self)
  56.         self.CancelButton2.SetPosition(self.GetWidth()/2-54, self.GetHeight()/2+190)
  57.         self.CancelButton2.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  58.         self.CancelButton2.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  59.         self.CancelButton2.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  60.         self.CancelButton2.SetText("Start")
  61.         self.CancelButton2.SetEvent(self.Open)
  62.         self.CancelButton2.Show()
  63.        
  64.         self.CancelButton3 = uimg.Button()
  65.         self.CancelButton3.SetParent(self)
  66.         self.CancelButton3.SetPosition(self.GetWidth()/2-95, self.GetHeight()/2+130)
  67.         self.CancelButton3.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  68.         self.CancelButton3.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  69.         self.CancelButton3.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  70.         self.CancelButton3.SetText("Pozostałe")
  71.         self.CancelButton3.SetEvent(self.Reszta)
  72.         self.CancelButton3.Hide()
  73.        
  74.         self.CancelButton4 = uimg.Button()
  75.         self.CancelButton4.SetParent(self)
  76.         self.CancelButton4.SetPosition(self.GetWidth()/2, self.GetHeight()/2+130)
  77.         self.CancelButton4.SetUpVisual("d:/ymir work/ui/public/large_button_01.sub")
  78.         self.CancelButton4.SetOverVisual("d:/ymir work/ui/public/large_button_02.sub")
  79.         self.CancelButton4.SetDownVisual("d:/ymir work/ui/public/large_button_03.sub")
  80.         self.CancelButton4.SetText("Zamknij")
  81.         self.CancelButton4.SetEvent(self.Close)
  82.         self.CancelButton4.Hide()
  83.  
  84.         self.Obrazek1 = uimg.ExpandedImageBox()
  85.         self.Obrazek1.SetParent(self)
  86.         self.Obrazek1.SetPosition((self.GetWidth()/2-172), self.GetHeight()/2+20)
  87.         self.Obrazek1.LoadImage("illumina/nagroda_boss/tlo.tga")
  88.         self.Obrazek1.SetAlpha(0.0)
  89.         self.Obrazek1.Show()
  90.  
  91.         self.Obrazek2 = uimg.ExpandedImageBox()
  92.         self.Obrazek2.SetParent(self)
  93.         self.Obrazek2.SetPosition((self.GetWidth()/2-172)+120, self.GetHeight()/2+20)
  94.         self.Obrazek2.LoadImage("illumina/nagroda_boss/tlo.tga")
  95.         self.Obrazek2.SetAlpha(0.0)
  96.         self.Obrazek2.Show()
  97.  
  98.         self.Obrazek3 = uimg.ExpandedImageBox()
  99.         self.Obrazek3.SetParent(self)
  100.         self.Obrazek3.SetPosition((self.GetWidth()/2-172)+120*2, self.GetHeight()/2+20)
  101.         self.Obrazek3.LoadImage("illumina/nagroda_boss/tlo.tga")
  102.         self.Obrazek3.SetAlpha(0.0)
  103.         self.Obrazek3.Show()
  104.  
  105.         self.Pyt1 = uimg.ExpandedImageBox()
  106.         self.Pyt1.LoadImage("illumina/nagroda_boss/btn_01.tga")
  107.         self.Pyt1.SetParent(self)
  108.         self.Pyt1.SetPosition((self.GetWidth()/2-172), self.GetHeight()/2+20)
  109.         self.Pyt1.SetAlpha(0.0)
  110.         self.Pyt1.Show()
  111.  
  112.         self.Pyt2 = uimg.ExpandedImageBox()
  113.         self.Pyt2.LoadImage("illumina/nagroda_boss/btn_01.tga")
  114.         self.Pyt2.SetParent(self)
  115.         self.Pyt2.SetPosition((self.GetWidth()/2-172)+120, self.GetHeight()/2+20)
  116.         self.Pyt2.SetAlpha(0.0)
  117.         self.Pyt2.Show()
  118.  
  119.         self.Pyt3 = uimg.ExpandedImageBox()
  120.         self.Pyt3.LoadImage("illumina/nagroda_boss/btn_01.tga")
  121.         self.Pyt3.SetParent(self)
  122.         self.Pyt3.SetPosition((self.GetWidth()/2-172)+120*2, self.GetHeight()/2+20)
  123.         self.Pyt3.SetAlpha(0.0)
  124.         self.Pyt3.Show()
  125.  
  126.         self.Btn1 = uimg.Button()
  127.         self.Btn1.SetParent(self)
  128.         self.Btn1.SetPosition((self.GetWidth()/2-172), self.GetHeight()/2+20)
  129.         self.Btn1.SetUpVisual("illumina/nagroda_boss/btn_01.tga")
  130.         self.Btn1.SetOverVisual("illumina/nagroda_boss/btn_02.tga")
  131.         self.Btn1.SetDownVisual("illumina/nagroda_boss/btn_01.tga")
  132.         self.Btn1.SetEvent(uimg.__mem_func__(self.Schowaj), 1)
  133.         self.Btn1.Hide()
  134.  
  135.         self.Btn2 = uimg.Button()
  136.         self.Btn2.SetParent(self)
  137.         self.Btn2.SetPosition((self.GetWidth()/2-172)+120, self.GetHeight()/2+20)
  138.         self.Btn2.SetUpVisual("illumina/nagroda_boss/btn_01.tga")
  139.         self.Btn2.SetOverVisual("illumina/nagroda_boss/btn_02.tga")
  140.         self.Btn2.SetDownVisual("illumina/nagroda_boss/btn_01.tga")
  141.         self.Btn2.SetEvent(uimg.__mem_func__(self.Schowaj), 2)
  142.         self.Btn2.Hide()
  143.  
  144.         self.Btn3 = uimg.Button()
  145.         self.Btn3.SetParent(self)
  146.         self.Btn3.SetPosition((self.GetWidth()/2-172)+120*2, self.GetHeight()/2+20)
  147.         self.Btn3.SetUpVisual("illumina/nagroda_boss/btn_01.tga")
  148.         self.Btn3.SetOverVisual("illumina/nagroda_boss/btn_02.tga")
  149.         self.Btn3.SetDownVisual("illumina/nagroda_boss/btn_01.tga")
  150.         self.Btn3.SetEvent(uimg.__mem_func__(self.Schowaj), 3)
  151.         self.Btn3.Hide()
  152.  
  153.         self.Slot1 = uimg.SlotWindow()
  154.         self.Slot1.SetParent(self.Obrazek1)
  155.         self.Slot1.SetPosition(36, 36)
  156.         self.Slot1.AppendSlot(0, 0, 0, 32, 32)
  157.         self.Slot1.Hide()
  158.  
  159.         self.Slot2 = uimg.SlotWindow()
  160.         self.Slot2.SetParent(self.Obrazek2)
  161.         self.Slot2.SetPosition(36, 36)
  162.         self.Slot2.AppendSlot(0, 0, 0, 32, 32)
  163.         self.Slot2.Hide()
  164.  
  165.         self.Slot3 = uimg.SlotWindow()
  166.         self.Slot3.SetParent(self.Obrazek3)
  167.         self.Slot3.SetPosition(36, 36)
  168.         self.Slot3.AppendSlot(0, 0, 0, 32, 32)
  169.         self.Slot3.Hide()
  170.        
  171.         self.Tlo = uimg.ExpandedImageBox()
  172.         self.Tlo.LoadImage("illumina/nagroda_boss/info.tga")
  173.         self.Tlo.SetParent(self)
  174.         self.Tlo.SetPosition(self.GetWidth()/2-150, self.GetHeight()/2-200)
  175.         self.Tlo.SetAlpha(0.0)
  176.         self.Tlo.Show()
  177.  
  178.     def Schowaj(self, nr):
  179.         self.Btn1.Hide()
  180.         self.Btn2.Hide()
  181.         self.Btn3.Hide()
  182.         if nr == 1:
  183.             self.Schowaj1 = 1
  184.             self.Nagroda = 1
  185.         elif nr == 2:
  186.             self.Schowaj2 = 1
  187.             self.Nagroda = 2
  188.         elif nr == 3:
  189.             self.Schowaj3 = 1
  190.             self.Nagroda = 3
  191.         self.CancelButton3.Show()
  192.         self.CancelButton4.Show()
  193.  
  194.     def Teleportacja(self, id):
  195.         net.SendChatPacket("/teleport " + str(id))
  196.  
  197.     def Reszta(self):
  198.         self.Pozostale = 1
  199.         self.CancelButton3.Hide()
  200.  
  201.     def PokazReszte(self):
  202.         if self.Pozostale == 1:
  203.             self.Schowaj1 = 1
  204.             self.Schowaj2 = 1
  205.             self.Schowaj3 = 1
  206.             self.Pozostale = 0
  207.  
  208.     def Open(self):
  209.         self.Show()
  210.         self.Alpha = 0.0
  211.         self.Animacja = 1
  212.        
  213.     def OnPressEscapeKey(self):
  214.         self.Hide()
  215.         return TRUE
  216.  
  217.     def PrzyciskiShow(self):
  218.         if self.Animacja == 1:
  219.             self.Btn1.Show()
  220.             self.Btn2.Show()
  221.             self.Btn3.Show()
  222.             self.Slot1.Show()
  223.             self.Slot2.Show()
  224.             self.Slot3.Show()
  225.  
  226.     def WyborNagrody(self, nr):
  227.         if self.Schowaj1 == 1 and self.a1 > 0:
  228.             self.Btn1.Hide()
  229.             self.a1 -= 0.05
  230.             self.Pyt1.SetAlpha(self.a1)
  231.        
  232.         if self.Schowaj2 == 1 and self.a2 > 0:
  233.             self.Btn2.Hide()
  234.             self.a2 -= 0.05
  235.             self.Pyt2.SetAlpha(self.a2)
  236.        
  237.         if self.Schowaj3 == 1 and self.a3 > 0:
  238.             self.Btn3.Hide()
  239.             self.a3 -= 0.05
  240.             self.Pyt3.SetAlpha(self.a3)
  241.  
  242.     def WyswietlOkno(self):
  243.         global COLOR_BG
  244.  
  245.         if self.Animacja == 1 and self.Alpha < 0.49:
  246.             self.Alpha += 0.01
  247.             COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, self.Alpha)
  248.             self.SetColor(COLOR_BG)
  249.  
  250.             self.Tlo.SetAlpha(self.Alpha*2)
  251.  
  252.             self.Obrazek1.SetAlpha(self.Alpha*2)
  253.             self.Obrazek2.SetAlpha(self.Alpha*2)
  254.             self.Obrazek3.SetAlpha(self.Alpha*2)
  255.             self.Pyt1.SetAlpha(self.Alpha*2)
  256.             self.Pyt2.SetAlpha(self.Alpha*2)
  257.             self.Pyt3.SetAlpha(self.Alpha*2)
  258.  
  259.         else:
  260.             self.PrzyciskiShow()
  261.             self.Animacja = 0
  262.  
  263.     def Close(self):
  264.         self.Zamknij = 1
  265.         self.CancelButton4.Hide()
  266.  
  267.     def ZamknijCalosc(self):
  268.         global COLOR_BG
  269.  
  270.         if self.Zamknij == 1 and self.Alpha > 0.1:
  271.             self.Alpha -= 0.01
  272.             COLOR_BG = grp.GenerateColor(0.0, 0.0, 0.0, self.Alpha)
  273.             self.SetColor(COLOR_BG)
  274.  
  275.             self.Tlo.SetAlpha(self.Alpha*2)
  276.  
  277.             self.Obrazek1.SetAlpha(self.Alpha*2)
  278.             self.Obrazek2.SetAlpha(self.Alpha*2)
  279.             self.Obrazek3.SetAlpha(self.Alpha*2)
  280.         else:
  281.             self.Slot1.Hide()
  282.             self.Slot2.Hide()
  283.             self.Slot3.Hide()
  284.             self.Schowaj1 = 0
  285.             self.Schowaj2 = 0
  286.             self.Schowaj3 = 0
  287.             self.a1 = 1.0
  288.             self.a2 = 1.0
  289.             self.a3 = 1.0
  290.             self.Hide()
  291.             self.Zamknij = 0
  292.            
  293.     def UstawItemy(self, i1, i2, i3, c1, c2, c3):
  294.         self.Slot1.SetItemSlot(0, int(i1), int(c1))
  295.         self.Slot2.SetItemSlot(0, int(i2), int(c2))
  296.         self.Slot3.SetItemSlot(0, int(i3), int(c3))
  297.  
  298.     def OnUpdate(self):
  299.         self.WyswietlOkno()
  300.  
  301.         self.WyborNagrody(self.Nagroda)
  302.        
  303.         self.PokazReszte()
  304.        
  305.         if self.Zamknij == 1:
  306.             self.ZamknijCalosc()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement