Advertisement
deadx2

Untitled

Sep 4th, 2017
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 13.70 KB | None | 0 0
  1. import uimg
  2. import grp
  3. import uiToolTip
  4. import app
  5. import event
  6. import constInfo
  7. import item
  8.  
  9. ILOSC_MISJI = 13
  10. NAZWY_ITEMOW = ["Ząb Orka", "Księga Klątw", "Pamiątka Po Demonie", "Matowy Lód", "Konar Zelkova", "Certyfika Tyguisa", "Czerwony Konar", "Ząb Orka", "Księga Klątw", "Pamiątka Po Demonie", "Matowy Lód", "Konar Zelkova", "Certyfika Tyguisa"]
  11. BIOLOG_TOOLTIP = [
  12.                     "Wymagany Poziom: 30|Lokalizacja: Dolina Orków|Czas oddawania: 5:00 min.|Nagrody:|5% Odporność na trucizny|Tęczowy Kamień (x1)|5.000.000 yang",
  13.                     "Wymagany Poziom: 40|Lokalizacja: Dolina Orków|Czas oddawania: 10:00 min.|Nagrody:|15% Szybkość Ataku|Medal Szczęścia (30 min.)|10.000.000 yang",
  14.                     "Wymagany Poziom: 50|Lokalizacja: Wieża Demonów|Czas oddawania: 20:00 min.|Nagrody:|Obrona +200|Wykrywacz Kamieni Metin (x3)|15.000.000 yang",
  15.                     "Wymagany Poziom: 60|Lokalizacja: Góra Sohan|Czas oddawania: 25:00 min.|Nagrody:|15% Obrażenia Umiejętności|Skrzynia Neshalie (x5)|20.000.000 yang",
  16.                     "Wymagany Poziom: 70|Lokalizacja: Las Duchów|Czas oddawania: 35:00 min.|Nagrody:|+10000 Max PŻ|Każda Perła (x5)|25.000.000 yang",
  17.                     "Wymagany Poziom: 80|Lokalizacja: Kraina Gigantów|Czas oddawania: 50:00 min.|Nagrody:|15% Silny Na Klasy|Złoty Metal (x2)|30.000.000 yang",
  18.                     "Wymagany Poziom: 30|Lokalizacja: Dolina Orków|Czas oddawania: 5:00 min.|Nagrody:|5% Odporność na trucizny|Tęczowy Kamień (x1)|5.000.000 yang",
  19.                     "Wymagany Poziom: 40|Lokalizacja: Dolina Orków|Czas oddawania: 10:00 min.|Nagrody:|15% Szybkość Ataku|Medal Szczęścia (30 min.)|10.000.000 yang",
  20.                     "Wymagany Poziom: 50|Lokalizacja: Wieża Demonów|Czas oddawania: 20:00 min.|Nagrody:|Obrona +200|Wykrywacz Kamieni Metin (x3)|15.000.000 yang",
  21.                     "Wymagany Poziom: 60|Lokalizacja: Góra Sohan|Czas oddawania: 25:00 min.|Nagrody:|15% Obrażenia Umiejętności|Skrzynia Neshalie (x5)|20.000.000 yang",
  22.                     "Wymagany Poziom: 70|Lokalizacja: Las Duchów|Czas oddawania: 35:00 min.|Nagrody:|+10000 Max PŻ|Każda Perła (x5)|25.000.000 yang",
  23.                     "Wymagany Poziom: 80|Lokalizacja: Kraina Gigantów|Czas oddawania: 50:00 min.|Nagrody:|15% Silny Na Klasy|Złoty Metal (x2)|30.000.000 yang",
  24.                     "Wymagany Poziom: 80|Lokalizacja: Kraina Gigantów|Czas oddawania: 50:00 min.|Nagrody:|15% Silny Na Klasy|Złoty Metal (x2)|30.000.000 yang",
  25.                  ]
  26. PRZEDMIOTY = [23001, 23002, 23003, 23004, 23005, 23006, 23007, 23008, 30041, 30041, 30041, 30041, 30041]
  27.  
  28. class VenturisBiolog(uimg.BoardWithTitleBar):
  29.  
  30.     Etap = 3
  31.     WymaganaIlosc = [10, 15, 20, 20, 25, 25, 30, 30, 30, 35, 35, 35, 45]
  32.     Oddane = 7
  33.     Czas = 0
  34.    
  35.  
  36.     UI = {}
  37.     BiologIndex = 0
  38.  
  39.     def __init__(self):
  40.         uimg.BoardWithTitleBar.__init__(self)
  41.        
  42.         self.SetSize(300, 500)
  43.         self.SetTitleName("|cffe6d0a2Badania Biologa")
  44.         self.AddFlag("float")
  45.         self.AddFlag("movable")
  46.         self.SetCloseEvent(self.Close)
  47.         self.Show()
  48.        
  49.         self.LoadWindow()
  50.        
  51.     def __del__(self):
  52.         uimg.BoardWithTitleBar.__del__(self)
  53.        
  54.     def LoadWindow(self):
  55.         self.UI["Suwak"] = uimg.ScrollBar()
  56.         self.UI["Suwak"].SetParent(self)
  57.         self.UI["Suwak"].SetPosition(265, 45)
  58.         self.UI["Suwak"].SetScrollBarSize(265)
  59.         self.UI["Suwak"].SetScrollEvent(uimg.__mem_func__(self.Suwaj))
  60.         self.UI["Suwak"].Show()
  61.        
  62.        
  63.         self.UI["Biolog1"] = SpecialWindow()
  64.         self.UI["Biolog1"].SetParent(self)
  65.         self.UI["Biolog1"].SetPosition(20, 45)
  66.         self.UI["Biolog1"].WczytajDane(10, 12, NAZWY_ITEMOW[0])
  67.         self.UI["Biolog1"].Show()
  68.  
  69.         self.UI["Biolog2"] = SpecialWindow()
  70.         self.UI["Biolog2"].SetParent(self)
  71.         self.UI["Biolog2"].SetPosition(20, 135)
  72.         self.UI["Biolog2"].WczytajDane(8, 20, NAZWY_ITEMOW[1])
  73.         self.UI["Biolog2"].Show()
  74.  
  75.         self.UI["Biolog3"] = SpecialWindow()
  76.         self.UI["Biolog3"].SetParent(self)
  77.         self.UI["Biolog3"].SetPosition(20, 225)
  78.         self.UI["Biolog3"].WczytajDane(12, 15, NAZWY_ITEMOW[2])
  79.         self.UI["Biolog3"].Show()
  80.        
  81.         self.UI["Napis_1"] = uimg.TextLine()
  82.         self.UI["Napis_1"].SetParent(self)
  83.         self.UI["Napis_1"].SetPosition(30, 310)
  84.         self.UI["Napis_1"].SetText("|cffa07970Brak1")
  85.         self.UI["Napis_1"].Show()
  86.        
  87.         self.UI["bar1"] = uimg.SlotBarMG()
  88.         self.UI["bar1"].SetParent(self)
  89.         self.UI["bar1"].SetPosition(30, 330)
  90.         self.UI["bar1"].SetWidth(150)
  91.         self.UI["bar1"].Show()
  92.  
  93.         self.UI["Status"] = uimg.TextLine()
  94.         self.UI["Status"].SetParent(self.UI["bar1"])
  95.         self.UI["Status"].SetPosition(0,4)
  96.         self.UI["Status"].SetText("|cffa07970Brak")
  97.         self.UI["Status"].SetWindowHorizontalAlignCenter()
  98.         self.UI["Status"].SetHorizontalAlignCenter()
  99.         self.UI["Status"].Show()
  100.        
  101.         self.UI["Napis_2"] = uimg.TextLine()
  102.         self.UI["Napis_2"].SetParent(self)
  103.         self.UI["Napis_2"].SetPosition(30, 355)
  104.         self.UI["Napis_2"].SetText("|cffa07970Brak2")
  105.         self.UI["Napis_2"].Show()
  106.        
  107.         self.UI["bar2"] = uimg.SlotBarMG()
  108.         self.UI["bar2"].SetParent(self)
  109.         self.UI["bar2"].SetPosition(30, 375)
  110.         self.UI["bar2"].SetWidth(150)
  111.         self.UI["bar2"].Show()
  112.  
  113.         self.UI["Szansa"] = uimg.TextLine()
  114.         self.UI["Szansa"].SetParent(self.UI["bar2"])
  115.         self.UI["Szansa"].SetPosition(0,4)
  116.         self.UI["Szansa"].SetText("|cffa07970Brak")
  117.         self.UI["Szansa"].SetWindowHorizontalAlignCenter()
  118.         self.UI["Szansa"].SetHorizontalAlignCenter()
  119.         self.UI["Szansa"].Show()
  120.        
  121.         self.UI["Napis_3"] = uimg.TextLine()
  122.         self.UI["Napis_3"].SetParent(self)
  123.         self.UI["Napis_3"].SetPosition(30, 400)
  124.         self.UI["Napis_3"].SetText("|cffa07970Brak3")
  125.         self.UI["Napis_3"].Show()
  126.        
  127.         self.UI["bar3"] = uimg.SlotBarMG()
  128.         self.UI["bar3"].SetParent(self)
  129.         self.UI["bar3"].SetPosition(30, 420)
  130.         self.UI["bar3"].SetWidth(150)
  131.         self.UI["bar3"].Show()
  132.  
  133.         self.UI["Czas"] = uimg.TextLine()
  134.         self.UI["Czas"].SetParent(self.UI["bar3"])
  135.         self.UI["Czas"].SetPosition(0,4)
  136.         self.UI["Czas"].SetText("|cffa07970Brak")
  137.         self.UI["Czas"].SetWindowHorizontalAlignCenter()
  138.         self.UI["Czas"].SetHorizontalAlignCenter()
  139.         self.UI["Czas"].Show()
  140.        
  141.         self.UI["OddajButton"] = uimg.Button()
  142.         self.UI["OddajButton"].SetParent(self)
  143.         self.UI["OddajButton"].SetPosition(0, 445)
  144.         self.UI["OddajButton"].SetUpVisual("d:/ymir work/ui/public/XLarge_Button_01.sub")
  145.         self.UI["OddajButton"].SetOverVisual("d:/ymir work/ui/public/XLarge_button_02.sub")
  146.         self.UI["OddajButton"].SetDownVisual("d:/ymir work/ui/public/XLarge_button_03.sub")
  147.         self.UI["OddajButton"].SetWindowHorizontalAlignCenter()
  148.         self.UI["OddajButton"].SetEvent(uimg.__mem_func__(self.OddajPrzedmiot))
  149.         self.UI["OddajButton"].SetText("Oddaj Przedmiot")
  150.         self.UI["OddajButton"].Show()
  151.        
  152.         self.RefreshBiolog()
  153.         pass
  154.        
  155.        
  156.     def WczytajBiologa(self, etap, oddane, szansa, czas):
  157.         self.Etap = int(etap)
  158.         self.UI["Szansa"].SetText(szansa+"%")
  159.         self.Czas = int(czas)
  160.         self.Oddane = oddane
  161.        
  162.         '''
  163.         test = int(czas) - app.GetGlobalTime()
  164.        
  165.         self.UI["Status"].SetText(czas)
  166.         self.UI["Szansa"].SetText(str(app.GetGlobalTime()))
  167.         self.UI["Czas"].SetText(str(test))
  168.         '''
  169.        
  170.         self.RefreshBiolog()
  171.  
  172.     def Suwaj(self):
  173.         ScrollCount = ILOSC_MISJI - 3
  174.         Index = int(ScrollCount * self.UI["Suwak"].GetPos())
  175.         if Index != self.BiologIndex:
  176.             self.BiologIndex = Index
  177.             self.RefreshBiolog()
  178.  
  179.     def RefreshBiolog(self):
  180.         if self.Etap-1 == self.BiologIndex:
  181.             self.UI["Biolog1"].WczytajDane(self.Oddane, self.WymaganaIlosc[self.BiologIndex], NAZWY_ITEMOW[self.BiologIndex], BIOLOG_TOOLTIP[self.BiologIndex])
  182.         elif self.Etap-1 < self.BiologIndex:
  183.             self.UI["Biolog1"].WczytajDane(0, self.WymaganaIlosc[self.BiologIndex], NAZWY_ITEMOW[self.BiologIndex], BIOLOG_TOOLTIP[self.BiologIndex])
  184.         else:
  185.             self.UI["Biolog1"].WczytajDane(self.WymaganaIlosc[self.BiologIndex], self.WymaganaIlosc[self.BiologIndex], NAZWY_ITEMOW[self.BiologIndex], BIOLOG_TOOLTIP[self.BiologIndex])
  186.  
  187.         if self.Etap-1 == self.BiologIndex+1:
  188.             self.UI["Biolog2"].WczytajDane(self.Oddane, self.WymaganaIlosc[self.BiologIndex+1], NAZWY_ITEMOW[self.BiologIndex+1], BIOLOG_TOOLTIP[self.BiologIndex+1])
  189.         elif self.Etap-1 < self.BiologIndex+1:
  190.             self.UI["Biolog2"].WczytajDane(0, self.WymaganaIlosc[self.BiologIndex+1], NAZWY_ITEMOW[self.BiologIndex+1], BIOLOG_TOOLTIP[self.BiologIndex+1])
  191.         else:
  192.             self.UI["Biolog2"].WczytajDane(self.WymaganaIlosc[self.BiologIndex+1], self.WymaganaIlosc[self.BiologIndex+1], NAZWY_ITEMOW[self.BiologIndex+1], BIOLOG_TOOLTIP[self.BiologIndex+1])
  193.        
  194.         if self.Etap-1 == self.BiologIndex+2:
  195.             self.UI["Biolog3"].WczytajDane(self.Oddane, self.WymaganaIlosc[self.BiologIndex+2], NAZWY_ITEMOW[self.BiologIndex+2], BIOLOG_TOOLTIP[self.BiologIndex+2])
  196.         elif self.Etap-1 < self.BiologIndex+2:
  197.             self.UI["Biolog3"].WczytajDane(0, self.WymaganaIlosc[self.BiologIndex+2], NAZWY_ITEMOW[self.BiologIndex+2], BIOLOG_TOOLTIP[self.BiologIndex+2])
  198.         else:
  199.             self.UI["Biolog3"].WczytajDane(self.WymaganaIlosc[self.BiologIndex+2], self.WymaganaIlosc[self.BiologIndex+2], NAZWY_ITEMOW[self.BiologIndex+2], BIOLOG_TOOLTIP[self.BiologIndex+2])
  200.        
  201.         self.UI["Biolog1"].LoadItemImage(self.BiologIndex)
  202.         self.UI["Biolog2"].LoadItemImage(self.BiologIndex+1)
  203.         self.UI["Biolog3"].LoadItemImage(self.BiologIndex+2)
  204.        
  205.         pass
  206.        
  207.     def OnUpdate(self):
  208.         self.UI["Status"].SetText(str(app.GetTime()))
  209.         czas = self.Czas - app.GetGlobalTimeStamp()
  210.         minuty = czas/60
  211.         sekundy = czas - minuty * 60
  212.         minuty_txt = ""
  213.         sekundy_txt = ""
  214.  
  215.         if minuty < 10:
  216.             minuty_txt = "0"+str(minuty)
  217.         else:
  218.             minuty_txt = str(minuty)
  219.            
  220.         if sekundy < 10:
  221.             sekundy_txt = "0"+str(sekundy)
  222.         else:
  223.             sekundy_txt = str(sekundy)
  224.            
  225.         if self.Czas == 0 or self.Czas < app.GetGlobalTimeStamp():
  226.             self.UI["Czas"].SetText("00:00")
  227.             self.UI["Status"].SetText("Chodź tu.")
  228.         else:
  229.             self.UI["Czas"].SetText(minuty_txt + ":" + sekundy_txt)
  230.             self.UI["Status"].SetText("Odpierdol się!")
  231.  
  232.     def OddajPrzedmiot(self):
  233.         event.QuestButtonClick(constInfo.OddajBiolog)
  234.        
  235.     def Close(self):
  236.         self.Hide()
  237.  
  238.  
  239. class SpecialWindow(uimg.Window):
  240.  
  241.     LIGHT = grp.GenerateColor(0.6, 0.6, 0.6, 0.6)
  242.    
  243.     PROGRESS_COLOR = grp.GenerateColor(1.0, 0.0, 0.0, 0.2)
  244.     FINISHED_COLOR = grp.GenerateColor(0.0, 1.0, 0.0, 0.2)
  245.  
  246.     def __init__(self):
  247.         uimg.Window.__init__(self)
  248.        
  249.         self.CreateWindow()
  250.  
  251.     def __del__(self):
  252.         uimg.Window.__del__(self)
  253.  
  254.     def CreateWindow(self):
  255.         self.SetSize(230, 80)
  256.        
  257.         self.Opis = uiToolTip.ToolTip()
  258.        
  259.         self.Ramka1 = uimg.ImageBox()
  260.         self.Ramka1.SetParent(self)
  261.         self.Ramka1.SetPosition(0, 0)
  262.         self.Ramka1.LoadImage("illumina/inne/biolog_ramka.tga")
  263.         self.Ramka1.Show()
  264.        
  265.         # self.Base = uimg.Bar()
  266.         # self.Base.AddFlag("not_pick")
  267.         # self.Base.SetColor(0xff442200)
  268.         # self.Base.SetSize(230, 80)
  269.         # self.Base.SetParent(self)
  270.         # self.Base.Show()
  271.        
  272.         self.EmptyBar = uimg.Bar()
  273.         self.EmptyBar.SetParent(self.Ramka1)
  274.         self.EmptyBar.SetColor(self.PROGRESS_COLOR)
  275.         self.EmptyBar.SetPosition(5, 62)
  276.         self.EmptyBar.SetSize(229, 21)
  277.         self.EmptyBar.Show()
  278.        
  279.         self.Progress = uimg.Bar()
  280.         self.Progress.SetParent(self.Ramka1)
  281.         self.Progress.SetColor(self.FINISHED_COLOR)
  282.         self.Progress.SetPosition(5, 62)
  283.         self.Progress.SetSize(int(229*0.7), 21)
  284.         self.Progress.Show()
  285.        
  286.         self.Slot = uimg.ImageBox()
  287.         self.Slot.SetParent(self.Ramka1)
  288.         self.Slot.SetPosition(12, 11)
  289.         self.Slot.LoadImage("illumina/controls/common/slot_ellipse/slot.tga")
  290.         self.Slot.Show()
  291.        
  292.         self.ItemImg = uimg.ImageBox()
  293.         self.ItemImg.SetParent(self.Slot)
  294.         self.ItemImg.SetPosition(4, 4)
  295.         self.ItemImg.Show()
  296.        
  297.         self.Info = uimg.ImageBox()
  298.         self.Info.SetParent(self.Ramka1)
  299.         self.Info.SetPosition(203, 12)
  300.         self.Info.SAFE_SetStringEvent("MOUSE_OVER_IN", self.PokazOpis)
  301.         self.Info.SAFE_SetStringEvent("MOUSE_OVER_OUT", self.SchowajOpis)
  302.         self.Info.LoadImage("illumina/inne/icon_info.tga")
  303.         self.Info.Show()
  304.        
  305.         # self.Left = uimg.Bar()
  306.         # self.Left.SetParent(self.Base)
  307.         # self.Left.SetColor(0xff555555)
  308.         # self.Left.SetSize(1, 80)
  309.         # self.Left.Show()
  310.        
  311.         # self.Top = uimg.Bar()
  312.         # self.Top.SetParent(self.Base)
  313.         # self.Top.SetColor(0xff555555)
  314.         # self.Top.SetSize(230, 1)
  315.         # self.Top.Show()
  316.        
  317.         # self.Right = uimg.Bar()
  318.         # self.Right.SetParent(self.Base)
  319.         # self.Right.SetColor(0xff555555)
  320.         # self.Right.SetPosition(229, 0)
  321.         # self.Right.SetSize(1, 80)
  322.         # self.Right.Show()
  323.        
  324.         # self.Middle = uimg.Bar()
  325.         # self.Middle.SetParent(self.Base)
  326.         # self.Middle.SetColor(0xff555555)
  327.         # self.Middle.SetPosition(0, 50)
  328.         # self.Middle.SetSize(229, 1)
  329.         # self.Middle.Show()
  330.        
  331.         # self.Bottom = uimg.Bar()
  332.         # self.Bottom.SetParent(self.Base)
  333.         # self.Bottom.SetColor(0xff555555)
  334.         # self.Bottom.SetPosition(0, 79)
  335.         # self.Bottom.SetSize(229, 1)
  336.         # self.Bottom.Show()
  337.        
  338.         self.Oddane = uimg.TextLine()
  339.         self.Oddane.SetParent(self.Ramka1)
  340.         self.Oddane.SetPosition(0, 65)
  341.         self.Oddane.SetHorizontalAlignCenter()
  342.         self.Oddane.SetWindowHorizontalAlignCenter()
  343.         self.Oddane.SetText("Oddano 7/10")
  344.         self.Oddane.Show()
  345.        
  346.         self.ItemName = uimg.TextLine()
  347.         self.ItemName.SetParent(self.Ramka1)
  348.         self.ItemName.SetPosition(64, 8)
  349.         self.ItemName.SetText("|cffa08784Badany Przedmiot:")
  350.         self.ItemName.Show()
  351.        
  352.         self.TloItemName2 = uimg.ImageBox()
  353.         self.TloItemName2.SetParent(self)
  354.         self.TloItemName2.SetPosition(59, 27)
  355.         self.TloItemName2.LoadImage("illumina/inne/tlo8.tga")
  356.         self.TloItemName2.Show()
  357.        
  358.         self.ItemName2 = uimg.TextLine()
  359.         self.ItemName2.SetParent(self.TloItemName2)
  360.         self.ItemName2.SetPosition(0, 4)
  361.         self.ItemName2.SetHorizontalAlignCenter()
  362.         self.ItemName2.SetWindowHorizontalAlignCenter()
  363.         self.ItemName2.Show()
  364.  
  365.     def WczytajDane(self, current, max, item_name="", opis=""):
  366.         x = 0
  367.         for i in xrange(0, len(opis)):
  368.             if opis[i] == "|":
  369.                 x += 1
  370.                
  371.         self.Opis.ClearToolTip()
  372.  
  373.         for i in xrange(0, x):
  374.             self.Opis.AutoAppendTextLine(opis.split("|")[i])
  375.             self.Opis.AppendSpace(3)
  376.  
  377.         percent = float(current)/float(max)
  378.         self.Oddane.SetText("|cffa08784Oddano |cffa07970" + str(current) + "|cffa08784/|cffa07970" +str(max))
  379.         self.Progress.SetSize(int(229*percent), 21)
  380.         self.ItemName2.SetText("|cffa07970" + item_name)
  381.        
  382.     def LoadItemImage(self, index):
  383.         item.SelectItem(PRZEDMIOTY[index])
  384.         self.ItemImg.LoadImage(item.GetIconImageFileName())
  385.        
  386.     def PokazOpis(self):
  387.         self.Opis.ShowToolTip()
  388.        
  389.     def SchowajOpis(self):
  390.         self.Opis.HideToolTip()
  391.  
  392. #VenturisBiolog().Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement