Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ui
- import dbg
- import app
- import uiToolTip
- import chat
- global MAP_LIST
- global MOB_LIST
- MAP_LIST = {
- # NR : ["NAME", MOB1, MOB2...]
- 0 : ["Wieża Demonów", 0],
- 1 : ["Wieża Wygnańców", 1],
- 2 : ["Komnata Baronówny", 2],
- 3 : ["Grota Wygnańców", 6,7,8],
- 4 : ["Światynia Smoka", 6,7,8],
- 5 : ["Komnata Minotaura", 6,7,8],
- 6 : ["Epicka Dolina", 6,7,8],
- 7 : ["Lodowe Królestwo", 6,7,8],
- 8 : ["Górska Dolina", 6,7,8],
- 9 : ["Ogniste Krańce", 6,7,8],
- 10 : ["Dolina Mrocznych Żab", 6,7,8],
- 11 : ["Dolina Ciemności", 6,7,8],
- 12 : ["Scieżka Mrozu", 6,7,8],
- 13 : ["Wzgórze Czerw. Smoka", 6,7,8],
- 14 : ["Piekielny Labirynt", 6,7,8],
- 15 : ["Dolina Majów", 6,7,8],
- 16 : ["Cmentarz Duchów", 6,7,8],
- 17 : ["Bramy Piekieł", 6,7,8],
- 18 : ["Lodowa Odchłań", 6,7,8],
- 19 : ["Mroczna Odchłań", 6,7,8],
- 20 : ["Przeklęty Labirynt", 6,7,8],
- }
- MOB_LIST = {
- # NR : ["NAME", [ITEM1, SLOT1], [ITEM2, SLOT2]...]
- 0 : ["Umarły Rozpruwacz", [50082, 0], [25041, 1], [25041, 1], [27992, 0], [27993, 1], [27992, 6], [27993, 7], [27994, 8]],
- 1 : ["Niebieska Śmierć", [50075, 0], [25041, 1], [27992, 0], [27993, 1], [27992, 6], [27993, 7], [27994, 8]],
- 2 : ["Baronówna", [14, 0], [15, 1]],
- 3 : ["NAZWA4", [27992, 0], [27993, 1]],
- 4 : ["NAZWA5", [18, 0], [19, 1]],
- 5 : ["NAZWA6", [20, 0], [21, 1]],
- 6 : ["NAZWA7", [22, 0], [23, 1]],
- 7 : ["NAZWA8", [24, 0], [25, 1]],
- 8 : ["NAZWA9", [26, 0], [27, 1]],
- }
- class ItemListBox(ui.ListBoxEx.Item):
- def __init__(self, fileName):
- ui.ListBoxEx.Item.__init__(self)
- self.canLoad=0
- self.text=fileName
- self.textLine=self.__CreateTextLine(fileName)
- def __del__(self):
- ui.ListBoxEx.Item.__del__(self)
- def GetText(self):
- return self.textLine.GetText()
- def SetSize(self, width, height):
- ui.ListBoxEx.Item.SetSize(self, 115, height)
- def __CreateTextLine(self, fileName):
- textLine=ui.TextLine()
- textLine.SetParent(self)
- textLine.SetPosition(5, 0)
- textLine.SetText(fileName)
- textLine.Show()
- return textLine
- class wikipedia(ui.Window):
- def __init__(self):
- ui.Window.__init__(self)
- self.BuildWindow()
- def __del__(self):
- ui.Window.__del__(self)
- def BuildWindow(self):
- self.Board = ui.BoardWithTitleBar()
- self.Board.SetSize(595, 304)
- self.Board.SetCenterPosition()
- self.Board.AddFlag('movable')
- self.Board.AddFlag('float')
- self.Board.SetTitleName('Encyklopedia dropu')
- self.Board.SetCloseEvent(self.Close)
- self.OnPressEscapeKey = self.Close()
- self.comp = Component()
- self.tooltipItem = uiToolTip.ItemToolTip()
- self.tooltipItem.Hide()
- self.slots = {}
- self.bar_maps, self.list_maps = self.comp.ListBoxEx(self.Board, 16, 34, 139, 255)
- self.bar_mobs, self.list_mobs = self.comp.ListBoxEx(self.Board, 185, 34, 139, 255)
- self.Slots = ui.GridSlotWindow()
- self.Slots.SetParent(self.Board)
- self.Slots.SetSize(224, 224)
- self.Slots.SetPosition(343, 50)
- self.Slots.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
- self.Slots.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
- self.Slots.ArrangeSlot(0, 7, 7, 32, 32, 0, 0)
- self.Slots.RefreshSlot()
- self.Slots.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
- self.Slots.Show()
- global MAP_LIST
- global MOB_LIST
- self.list_maps.RemoveAllItems()
- [self.list_maps.AppendItem(ItemListBox(str(MAP_LIST[i][0]))) for i in range(len(MAP_LIST))]
- self.list_maps.SelectIndex(0)
- self.list_maps.SetSelectEvent(self.SelectMap)
- self.SelectMap(0)
- self.list_mobs.SetSelectEvent(self.SelectMob)
- def SelectMap(self, index):
- self.indexMap = self.list_maps.GetItemIndex(self.list_maps.GetSelectedItem())
- self.list_mobs.RemoveAllItems()
- self.new_mobs = []
- for i in range(1, len(MAP_LIST[self.indexMap])):
- self.new_mobs.append(MAP_LIST[self.indexMap][i])
- for x in xrange(len(self.new_mobs)):
- self.list_mobs.AppendItem(ItemListBox(str(MOB_LIST[self.new_mobs[x]][0])))
- self.list_mobs.SelectIndex(0)
- self.SelectMob(0)
- def SelectMob(self, index):
- for i in xrange(49):
- self.Slots.SetItemSlot(i, 0)
- self.Slots.RefreshSlot()
- self.indexMob = self.list_mobs.GetItemIndex(self.list_mobs.GetSelectedItem())
- self.items_id = []
- self.slots_nr = []
- for i in range(1, len(MOB_LIST[MAP_LIST[self.indexMap][self.indexMob+1]])):
- self.items_id.append(MOB_LIST[MAP_LIST[self.indexMap][self.indexMob+1]][i][0])
- self.slots_nr.append(MOB_LIST[MAP_LIST[self.indexMap][self.indexMob+1]][i][1])
- for x in xrange(len(self.items_id)):
- self.Slots.SetItemSlot(self.slots_nr[x], self.items_id[x])
- self.slots[self.slots_nr[x]] = self.items_id[x]
- def OverInItem(self, slot):
- self.tooltipItem.SetItemToolTip(self.slots[slot])
- def OverOutItem(self):
- if self.tooltipItem:
- self.tooltipItem.HideToolTip()
- def Open(self):
- if self.Board.IsShow():
- self.Board.Hide()
- else:
- self.Board.Show()
- def Close(self):
- self.Board.Hide()
- def OnPressEscapeKey(self):
- if self.Board.IsShow():
- self.Close()
- return TRUE
- return FALSE
- class Component:
- def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual):
- button = ui.Button()
- if parent != None:
- button.SetParent(parent)
- button.SetPosition(x, y)
- button.SetUpVisual(UpVisual)
- button.SetOverVisual(OverVisual)
- button.SetDownVisual(DownVisual)
- button.SetText(buttonName)
- button.SetToolTipText(tooltipText)
- button.Show()
- button.SetEvent(func)
- return button
- def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
- button = ui.ToggleButton()
- if parent != None:
- button.SetParent(parent)
- button.SetPosition(x, y)
- button.SetUpVisual(UpVisual)
- button.SetOverVisual(OverVisual)
- button.SetDownVisual(DownVisual)
- button.SetText(buttonName)
- button.SetToolTipText(tooltipText)
- button.Show()
- button.SetToggleUpEvent(funcUp)
- button.SetToggleDownEvent(funcDown)
- return button
- def EditLine(self, parent, editlineText, x, y, width, heigh, max):
- SlotBar = ui.SlotBar()
- if parent != None:
- SlotBar.SetParent(parent)
- SlotBar.SetSize(width, heigh)
- SlotBar.SetPosition(x, y)
- SlotBar.Show()
- Value = ui.EditLine()
- Value.SetParent(SlotBar)
- Value.SetSize(width, heigh)
- Value.SetPosition(1, 1)
- Value.SetMax(max)
- Value.SetLimitWidth(width)
- Value.SetMultiLine()
- Value.SetText(editlineText)
- Value.Show()
- return SlotBar, Value
- def TextLine(self, parent, textlineText, x, y, color):
- textline = ui.TextLine()
- if parent != None:
- textline.SetParent(parent)
- textline.SetPosition(x, y)
- if color != None:
- textline.SetFontColor(color[0], color[1], color[2])
- textline.SetText(textlineText)
- textline.Show()
- return textline
- def RGB(self, r, g, b):
- return (r*255, g*255, b*255)
- def SliderBar(self, parent, sliderPos, func, x, y):
- Slider = ui.SliderBar()
- if parent != None:
- Slider.SetParent(parent)
- Slider.SetPosition(x, y)
- Slider.SetSliderPos(sliderPos / 100)
- Slider.Show()
- Slider.SetEvent(func)
- return Slider
- def ExpandedImage(self, parent, x, y, img):
- image = ui.ExpandedImageBox()
- if parent != None:
- image.SetParent(parent)
- image.SetPosition(x, y)
- image.LoadImage(img)
- image.Show()
- return image
- def ComboBox(self, parent, text, x, y, width):
- combo = ui.ComboBox()
- if parent != None:
- combo.SetParent(parent)
- combo.SetPosition(x, y)
- combo.SetSize(width, 15)
- combo.SetCurrentItem(text)
- combo.Show()
- return combo
- def ThinBoard(self, parent, moveable, x, y, width, heigh, center):
- thin = ui.ThinBoard()
- if parent != None:
- thin.SetParent(parent)
- if moveable == TRUE:
- thin.AddFlag('movable')
- thin.AddFlag('float')
- thin.SetSize(width, heigh)
- thin.SetPosition(x, y)
- if center == TRUE:
- thin.SetCenterPosition()
- thin.Show()
- return thin
- def Gauge(self, parent, width, color, x, y):
- gauge = ui.Gauge()
- if parent != None:
- gauge.SetParent(parent)
- gauge.SetPosition(x, y)
- gauge.MakeGauge(width, color)
- gauge.Show()
- return gauge
- def ListBoxEx(self, parent, x, y, width, heigh):
- bar = ui.Bar()
- if parent != None:
- bar.SetParent(parent)
- bar.SetPosition(x, y)
- bar.SetSize(width, heigh)
- bar.SetColor(0x77000000)
- bar.Show()
- ListBox=ui.ListBoxEx()
- ListBox.SetParent(bar)
- ListBox.SetPosition(0, 0)
- ListBox.SetSize(width, heigh)
- ListBox.Show()
- scroll = ui.ScrollBar()
- scroll.SetParent(ListBox)
- scroll.SetPosition(width-15, 0)
- scroll.SetScrollBarSize(heigh)
- scroll.Show()
- ListBox.SetScrollBar(scroll)
- return bar, ListBox
- class Item(ui.ListBoxEx.Item):
- def __init__(self, text):
- ui.ListBoxEx.Item.__init__(self)
- self.canLoad=0
- self.text=text
- self.textLine=self.__CreateTextLine(text[:50])
- def __del__(self):
- ui.ListBoxEx.Item.__del__(self)
- def GetText(self):
- return self.text
- def SetSize(self, width, height):
- ui.ListBoxEx.Item.SetSize(self, 7*len(self.textLine.GetText()) + 4, height)
- def __CreateTextLine(self, text):
- textLine=ui.TextLine()
- textLine.SetParent(self)
- textLine.SetPosition(0, 0)
- textLine.SetText(text)
- textLine.Show()
- return textLine
- wikipedia().Show()
Advertisement
Add Comment
Please, Sign In to add comment