Guest User

drop_wiki

a guest
Nov 30th, 2015
799
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.22 KB | None | 0 0
  1. import ui
  2. import dbg
  3. import app
  4. import uiToolTip
  5. import chat
  6.  
  7. global MAP_LIST
  8. global MOB_LIST
  9.  
  10. MAP_LIST = {
  11.  
  12. # NR : ["NAME", MOB1, MOB2...]
  13.  
  14. 0 : ["Wieża Demonów", 0],
  15. 1 : ["Wieża Wygnańców", 1],
  16. 2 : ["Komnata Baronówny", 2],
  17. 3 : ["Grota Wygnańców", 6,7,8],
  18. 4 : ["Światynia Smoka", 6,7,8],
  19. 5 : ["Komnata Minotaura", 6,7,8],
  20. 6 : ["Epicka Dolina", 6,7,8],
  21. 7 : ["Lodowe Królestwo", 6,7,8],
  22. 8 : ["Górska Dolina", 6,7,8],
  23. 9 : ["Ogniste Krańce", 6,7,8],
  24. 10 : ["Dolina Mrocznych Żab", 6,7,8],
  25. 11 : ["Dolina Ciemności", 6,7,8],
  26. 12 : ["Scieżka Mrozu", 6,7,8],
  27. 13 : ["Wzgórze Czerw. Smoka", 6,7,8],
  28. 14 : ["Piekielny Labirynt", 6,7,8],
  29. 15 : ["Dolina Majów", 6,7,8],
  30. 16 : ["Cmentarz Duchów", 6,7,8],
  31. 17 : ["Bramy Piekieł", 6,7,8],
  32. 18 : ["Lodowa Odchłań", 6,7,8],
  33. 19 : ["Mroczna Odchłań", 6,7,8],
  34. 20 : ["Przeklęty Labirynt", 6,7,8],
  35.  
  36. }
  37.  
  38.  
  39. MOB_LIST = {
  40.  
  41. # NR : ["NAME", [ITEM1, SLOT1], [ITEM2, SLOT2]...]
  42.  
  43. 0 : ["Umarły Rozpruwacz", [50082, 0], [25041, 1], [25041, 1], [27992, 0], [27993, 1], [27992, 6], [27993, 7], [27994, 8]],
  44. 1 : ["Niebieska Śmierć", [50075, 0], [25041, 1], [27992, 0], [27993, 1], [27992, 6], [27993, 7], [27994, 8]],
  45. 2 : ["Baronówna", [14, 0], [15, 1]],
  46. 3 : ["NAZWA4", [27992, 0], [27993, 1]],
  47. 4 : ["NAZWA5", [18, 0], [19, 1]],
  48. 5 : ["NAZWA6", [20, 0], [21, 1]],
  49. 6 : ["NAZWA7", [22, 0], [23, 1]],
  50. 7 : ["NAZWA8", [24, 0], [25, 1]],
  51. 8 : ["NAZWA9", [26, 0], [27, 1]],
  52.  
  53. }
  54.  
  55. class ItemListBox(ui.ListBoxEx.Item):
  56. def __init__(self, fileName):
  57. ui.ListBoxEx.Item.__init__(self)
  58. self.canLoad=0
  59. self.text=fileName
  60. self.textLine=self.__CreateTextLine(fileName)
  61.  
  62. def __del__(self):
  63. ui.ListBoxEx.Item.__del__(self)
  64.  
  65. def GetText(self):
  66. return self.textLine.GetText()
  67.  
  68. def SetSize(self, width, height):
  69. ui.ListBoxEx.Item.SetSize(self, 115, height)
  70.  
  71. def __CreateTextLine(self, fileName):
  72. textLine=ui.TextLine()
  73. textLine.SetParent(self)
  74. textLine.SetPosition(5, 0)
  75.  
  76. textLine.SetText(fileName)
  77. textLine.Show()
  78. return textLine
  79.  
  80. class wikipedia(ui.Window):
  81. def __init__(self):
  82. ui.Window.__init__(self)
  83. self.BuildWindow()
  84.  
  85. def __del__(self):
  86. ui.Window.__del__(self)
  87.  
  88. def BuildWindow(self):
  89. self.Board = ui.BoardWithTitleBar()
  90. self.Board.SetSize(595, 304)
  91. self.Board.SetCenterPosition()
  92. self.Board.AddFlag('movable')
  93. self.Board.AddFlag('float')
  94. self.Board.SetTitleName('Encyklopedia dropu')
  95. self.Board.SetCloseEvent(self.Close)
  96. self.OnPressEscapeKey = self.Close()
  97.  
  98. self.comp = Component()
  99.  
  100. self.tooltipItem = uiToolTip.ItemToolTip()
  101. self.tooltipItem.Hide()
  102.  
  103. self.slots = {}
  104.  
  105. self.bar_maps, self.list_maps = self.comp.ListBoxEx(self.Board, 16, 34, 139, 255)
  106. self.bar_mobs, self.list_mobs = self.comp.ListBoxEx(self.Board, 185, 34, 139, 255)
  107. self.Slots = ui.GridSlotWindow()
  108. self.Slots.SetParent(self.Board)
  109. self.Slots.SetSize(224, 224)
  110. self.Slots.SetPosition(343, 50)
  111. self.Slots.SetOverInItemEvent(ui.__mem_func__(self.OverInItem))
  112. self.Slots.SetOverOutItemEvent(ui.__mem_func__(self.OverOutItem))
  113. self.Slots.ArrangeSlot(0, 7, 7, 32, 32, 0, 0)
  114. self.Slots.RefreshSlot()
  115. self.Slots.SetSlotBaseImage("d:/ymir work/ui/public/Slot_Base.sub", 1.0, 1.0, 1.0, 1.0)
  116. self.Slots.Show()
  117.  
  118. global MAP_LIST
  119. global MOB_LIST
  120.  
  121. self.list_maps.RemoveAllItems()
  122. [self.list_maps.AppendItem(ItemListBox(str(MAP_LIST[i][0]))) for i in range(len(MAP_LIST))]
  123. self.list_maps.SelectIndex(0)
  124. self.list_maps.SetSelectEvent(self.SelectMap)
  125. self.SelectMap(0)
  126. self.list_mobs.SetSelectEvent(self.SelectMob)
  127.  
  128. def SelectMap(self, index):
  129. self.indexMap = self.list_maps.GetItemIndex(self.list_maps.GetSelectedItem())
  130. self.list_mobs.RemoveAllItems()
  131. self.new_mobs = []
  132. for i in range(1, len(MAP_LIST[self.indexMap])):
  133. self.new_mobs.append(MAP_LIST[self.indexMap][i])
  134. for x in xrange(len(self.new_mobs)):
  135. self.list_mobs.AppendItem(ItemListBox(str(MOB_LIST[self.new_mobs[x]][0])))
  136. self.list_mobs.SelectIndex(0)
  137. self.SelectMob(0)
  138.  
  139. def SelectMob(self, index):
  140. for i in xrange(49):
  141. self.Slots.SetItemSlot(i, 0)
  142. self.Slots.RefreshSlot()
  143. self.indexMob = self.list_mobs.GetItemIndex(self.list_mobs.GetSelectedItem())
  144. self.items_id = []
  145. self.slots_nr = []
  146. for i in range(1, len(MOB_LIST[MAP_LIST[self.indexMap][self.indexMob+1]])):
  147. self.items_id.append(MOB_LIST[MAP_LIST[self.indexMap][self.indexMob+1]][i][0])
  148. self.slots_nr.append(MOB_LIST[MAP_LIST[self.indexMap][self.indexMob+1]][i][1])
  149. for x in xrange(len(self.items_id)):
  150. self.Slots.SetItemSlot(self.slots_nr[x], self.items_id[x])
  151. self.slots[self.slots_nr[x]] = self.items_id[x]
  152.  
  153. def OverInItem(self, slot):
  154. self.tooltipItem.SetItemToolTip(self.slots[slot])
  155.  
  156. def OverOutItem(self):
  157. if self.tooltipItem:
  158. self.tooltipItem.HideToolTip()
  159.  
  160. def Open(self):
  161. if self.Board.IsShow():
  162. self.Board.Hide()
  163. else:
  164. self.Board.Show()
  165.  
  166. def Close(self):
  167. self.Board.Hide()
  168.  
  169. def OnPressEscapeKey(self):
  170. if self.Board.IsShow():
  171. self.Close()
  172. return TRUE
  173. return FALSE
  174.  
  175. class Component:
  176. def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual):
  177. button = ui.Button()
  178. if parent != None:
  179. button.SetParent(parent)
  180. button.SetPosition(x, y)
  181. button.SetUpVisual(UpVisual)
  182. button.SetOverVisual(OverVisual)
  183. button.SetDownVisual(DownVisual)
  184. button.SetText(buttonName)
  185. button.SetToolTipText(tooltipText)
  186. button.Show()
  187. button.SetEvent(func)
  188. return button
  189.  
  190. def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
  191. button = ui.ToggleButton()
  192. if parent != None:
  193. button.SetParent(parent)
  194. button.SetPosition(x, y)
  195. button.SetUpVisual(UpVisual)
  196. button.SetOverVisual(OverVisual)
  197. button.SetDownVisual(DownVisual)
  198. button.SetText(buttonName)
  199. button.SetToolTipText(tooltipText)
  200. button.Show()
  201. button.SetToggleUpEvent(funcUp)
  202. button.SetToggleDownEvent(funcDown)
  203. return button
  204.  
  205. def EditLine(self, parent, editlineText, x, y, width, heigh, max):
  206. SlotBar = ui.SlotBar()
  207. if parent != None:
  208. SlotBar.SetParent(parent)
  209. SlotBar.SetSize(width, heigh)
  210. SlotBar.SetPosition(x, y)
  211. SlotBar.Show()
  212. Value = ui.EditLine()
  213. Value.SetParent(SlotBar)
  214. Value.SetSize(width, heigh)
  215. Value.SetPosition(1, 1)
  216. Value.SetMax(max)
  217. Value.SetLimitWidth(width)
  218. Value.SetMultiLine()
  219. Value.SetText(editlineText)
  220. Value.Show()
  221. return SlotBar, Value
  222.  
  223. def TextLine(self, parent, textlineText, x, y, color):
  224. textline = ui.TextLine()
  225. if parent != None:
  226. textline.SetParent(parent)
  227. textline.SetPosition(x, y)
  228. if color != None:
  229. textline.SetFontColor(color[0], color[1], color[2])
  230. textline.SetText(textlineText)
  231. textline.Show()
  232. return textline
  233.  
  234. def RGB(self, r, g, b):
  235. return (r*255, g*255, b*255)
  236.  
  237. def SliderBar(self, parent, sliderPos, func, x, y):
  238. Slider = ui.SliderBar()
  239. if parent != None:
  240. Slider.SetParent(parent)
  241. Slider.SetPosition(x, y)
  242. Slider.SetSliderPos(sliderPos / 100)
  243. Slider.Show()
  244. Slider.SetEvent(func)
  245. return Slider
  246.  
  247. def ExpandedImage(self, parent, x, y, img):
  248. image = ui.ExpandedImageBox()
  249. if parent != None:
  250. image.SetParent(parent)
  251. image.SetPosition(x, y)
  252. image.LoadImage(img)
  253. image.Show()
  254. return image
  255.  
  256. def ComboBox(self, parent, text, x, y, width):
  257. combo = ui.ComboBox()
  258. if parent != None:
  259. combo.SetParent(parent)
  260. combo.SetPosition(x, y)
  261. combo.SetSize(width, 15)
  262. combo.SetCurrentItem(text)
  263. combo.Show()
  264. return combo
  265.  
  266. def ThinBoard(self, parent, moveable, x, y, width, heigh, center):
  267. thin = ui.ThinBoard()
  268. if parent != None:
  269. thin.SetParent(parent)
  270. if moveable == TRUE:
  271. thin.AddFlag('movable')
  272. thin.AddFlag('float')
  273. thin.SetSize(width, heigh)
  274. thin.SetPosition(x, y)
  275. if center == TRUE:
  276. thin.SetCenterPosition()
  277. thin.Show()
  278. return thin
  279.  
  280. def Gauge(self, parent, width, color, x, y):
  281. gauge = ui.Gauge()
  282. if parent != None:
  283. gauge.SetParent(parent)
  284. gauge.SetPosition(x, y)
  285. gauge.MakeGauge(width, color)
  286. gauge.Show()
  287. return gauge
  288.  
  289. def ListBoxEx(self, parent, x, y, width, heigh):
  290. bar = ui.Bar()
  291. if parent != None:
  292. bar.SetParent(parent)
  293. bar.SetPosition(x, y)
  294. bar.SetSize(width, heigh)
  295. bar.SetColor(0x77000000)
  296. bar.Show()
  297. ListBox=ui.ListBoxEx()
  298. ListBox.SetParent(bar)
  299. ListBox.SetPosition(0, 0)
  300. ListBox.SetSize(width, heigh)
  301. ListBox.Show()
  302. scroll = ui.ScrollBar()
  303. scroll.SetParent(ListBox)
  304. scroll.SetPosition(width-15, 0)
  305. scroll.SetScrollBarSize(heigh)
  306. scroll.Show()
  307. ListBox.SetScrollBar(scroll)
  308. return bar, ListBox
  309.  
  310. class Item(ui.ListBoxEx.Item):
  311. def __init__(self, text):
  312. ui.ListBoxEx.Item.__init__(self)
  313. self.canLoad=0
  314. self.text=text
  315. self.textLine=self.__CreateTextLine(text[:50])
  316. def __del__(self):
  317. ui.ListBoxEx.Item.__del__(self)
  318. def GetText(self):
  319. return self.text
  320. def SetSize(self, width, height):
  321. ui.ListBoxEx.Item.SetSize(self, 7*len(self.textLine.GetText()) + 4, height)
  322. def __CreateTextLine(self, text):
  323. textLine=ui.TextLine()
  324. textLine.SetParent(self)
  325. textLine.SetPosition(0, 0)
  326. textLine.SetText(text)
  327. textLine.Show()
  328. return textLine
  329.  
  330. wikipedia().Show()
Advertisement
Add Comment
Please, Sign In to add comment