Advertisement
Guest User

Yang Bug MT2

a guest
Jan 31st, 2017
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.73 KB | None | 0 0
  1. # File: b (Python 2.2)
  2.  
  3. import ui
  4. import dbg
  5. import chat
  6. import net
  7. import time
  8. BugYangV = 0
  9.  
  10. class Dialog1(ui.BoardWithTitleBar):
  11.  
  12. def __init__(self):
  13. ui.BoardWithTitleBar.__init__(self)
  14. self.BuildWindow()
  15.  
  16.  
  17. def __del__(self):
  18. ui.BoardWithTitleBar.__del__(self)
  19.  
  20.  
  21. def BuildWindow(self):
  22. self.SetSize(162, 100)
  23. self.SetCenterPosition()
  24. self.AddFlag('movable')
  25. self.AddFlag('float')
  26. self.SetTitleName('Bug yang bot')
  27. self.SetCloseEvent(self.Close)
  28. self.comp = Component()
  29. self.btnbugyang = self.comp.Button(self, 'Aktivovat', '', 83, 37, self.btnbugyang_func, 'd:/ymir work/ui/public/middle_button_01.sub', 'd:/ymir work/ui/public/middle_button_02.sub', 'd:/ymir work/ui/public/middle_button_03.sub')
  30. (self.slotbar_editlugar, self.editlugar) = self.comp.EditLine(self, '', 54, 39, 20, 15, 2)
  31. self.txtlugar = self.comp.TextLine(self, 'Pole:', 18, 39, self.comp.RGB(255, 255, 255))
  32. self.txtcredit = self.comp.TextLine(self, 'deny.g6.cz', 55, 73, self.comp.RGB(255, 255, 255))
  33.  
  34.  
  35. def btnbugyang_func(self):
  36. global BugYangV
  37. if BugYangV == 0:
  38. LugarBugYang = self.editlugar.GetText()
  39. if LugarBugYang == '':
  40. chat.AppendChat(chat.CHAT_TYPE_INFO, 'Vyplnte pole.')
  41. else:
  42. BugYangV = 1
  43. self.btnbugyang.SetText('Deaktivovat')
  44. chat.AppendChat(chat.CHAT_TYPE_NOTICE, 'Nechte první dva místa v Inventáři volné.')
  45. chat.AppendChat(chat.CHAT_TYPE_NOTICE, 'Nechte první dva místa v Inventáři volné.')
  46. self.BugYangActivado()
  47. else:
  48. BugYangV = 0
  49. self.btnbugyang.SetText('Aktivovat')
  50. self.BugYangDesactivado()
  51.  
  52.  
  53. def BugYangActivado(self):
  54. LugarBugYang = self.editlugar.GetText()
  55. net.SendShopBuyPacket(int(LugarBugYang))
  56. net.SendShopBuyPacket(int(LugarBugYang))
  57. net.SendShopSellPacket(0)
  58. net.SendShopSellPacket(1)
  59. self.BugYangSegundos = WaitingDialog()
  60. self.BugYangSegundos.Open(float(1e-070))
  61. self.BugYangSegundos.SAFE_SetTimeOverEvent(self.BugYangActivado)
  62.  
  63.  
  64. def BugYangDesactivado(self):
  65. self.BugYangSegundos = WaitingDialog()
  66. self.BugYangSegundos.Open(int(0x47BF19673DF52E37F2410011D0FFFFFFFFFFFL))
  67. self.BugYangSegundos.SAFE_SetTimeOverEvent(self.BugYangDesactivado)
  68.  
  69.  
  70. def Close(self):
  71. self.Hide()
  72.  
  73.  
  74.  
  75. class Component:
  76.  
  77. def Button(self, parent, buttonName, tooltipText, x, y, func, UpVisual, OverVisual, DownVisual):
  78. button = ui.Button()
  79. button.SetParent(parent)
  80. button.SetPosition(x, y)
  81. button.SetUpVisual(UpVisual)
  82. button.SetOverVisual(OverVisual)
  83. button.SetDownVisual(DownVisual)
  84. button.SetText(buttonName)
  85. button.SetToolTipText(tooltipText)
  86. button.Show()
  87. button.SetEvent(func)
  88. return button
  89.  
  90.  
  91. def ToggleButton(self, parent, buttonName, tooltipText, x, y, funcUp, funcDown, UpVisual, OverVisual, DownVisual):
  92. button = ui.ToggleButton()
  93. button.SetParent(parent)
  94. button.SetPosition(x, y)
  95. button.SetUpVisual(UpVisual)
  96. button.SetOverVisual(OverVisual)
  97. button.SetDownVisual(DownVisual)
  98. button.SetText(buttonName)
  99. button.SetToolTipText(tooltipText)
  100. button.Show()
  101. button.SetToggleUpEvent(funcUp)
  102. button.SetToggleDownEvent(funcDown)
  103. return button
  104.  
  105.  
  106. def EditLine(self, parent, editlineText, x, y, width, heigh, max):
  107. SlotBar = ui.SlotBar()
  108. SlotBar.SetParent(parent)
  109. SlotBar.SetSize(width, heigh)
  110. SlotBar.SetPosition(x, y)
  111. SlotBar.Show()
  112. Value = ui.EditLine()
  113. Value.SetParent(SlotBar)
  114. Value.SetSize(width, heigh)
  115. Value.SetPosition(5, 1)
  116. Value.SetMax(max)
  117. Value.SetText(editlineText)
  118. Value.Show()
  119. return (SlotBar, Value)
  120.  
  121.  
  122. def TextLine(self, parent, textlineText, x, y, color):
  123. textline = ui.TextLine()
  124. textline.SetParent(parent)
  125. textline.SetPosition(x, y)
  126. if color != None:
  127. textline.SetFontColor(color[0], color[1], color[2])
  128.  
  129. textline.SetText(textlineText)
  130. textline.Show()
  131. return textline
  132.  
  133.  
  134. def RGB(self, r, g, b):
  135. return (r * 255, g * 255, b * 255)
  136.  
  137.  
  138. def SliderBar(self, parent, sliderPos, func, x, y):
  139. Slider = ui.SliderBar()
  140. Slider.SetParent(parent)
  141. Slider.SetPosition(x, y)
  142. Slider.SetSliderPos(sliderPos / 100)
  143. Slider.Show()
  144. Slider.SetEvent(func)
  145. return Slider
  146.  
  147.  
  148. def ExpandedImage(self, parent, x, y, img):
  149. image = ui.ExpandedImageBox()
  150. image.SetParent(parent)
  151. image.SetPosition(x, y)
  152. image.LoadImage(img)
  153. image.Show()
  154. return image
  155.  
  156.  
  157. def ComboBox(self, parent, text, x, y, width):
  158. combo = ui.ComboBox()
  159. combo.SetParent(parent)
  160. combo.SetPosition(x, y)
  161. combo.SetSize(width, 15)
  162. combo.SetCurrentItem(text)
  163. combo.Show()
  164. return combo
  165.  
  166.  
  167. def ThinBoard(self, parent, moveable, x, y, width, heigh, center):
  168. thin = ui.ThinBoard()
  169. if parent != None:
  170. thin.SetParent(parent)
  171.  
  172. if moveable == TRUE:
  173. thin.AddFlag('movable')
  174. thin.AddFlag('float')
  175.  
  176. thin.SetSize(width, heigh)
  177. thin.SetPosition(x, y)
  178. if center == TRUE:
  179. thin.SetCenterPosition()
  180.  
  181. thin.Show()
  182. return thin
  183.  
  184.  
  185.  
  186. class WaitingDialog(ui.ScriptWindow):
  187.  
  188. def __init__(self):
  189. ui.ScriptWindow.__init__(self)
  190.  
  191. self.eventTimeOver = lambda *arg: None
  192.  
  193. self.eventExit = lambda *arg: None
  194.  
  195.  
  196. def __del__(self):
  197. ui.ScriptWindow.__del__(self)
  198.  
  199.  
  200. def Open(self, waitTime):
  201. curTime = time.clock()
  202. self.endTime = curTime + waitTime
  203. self.Show()
  204.  
  205.  
  206. def Close(self):
  207. self.Hide()
  208.  
  209.  
  210. def Destroy(self):
  211. self.Hide()
  212.  
  213.  
  214. def SAFE_SetTimeOverEvent(self, event):
  215. self.eventTimeOver = ui.__mem_func__(event)
  216.  
  217.  
  218. def SAFE_SetExitEvent(self, event):
  219. self.eventExit = ui.__mem_func__(event)
  220.  
  221.  
  222. def OnUpdate(self):
  223. lastTime = max(0, self.endTime - time.clock())
  224. if 0 == lastTime:
  225. self.Close()
  226. self.eventTimeOver()
  227. else:
  228. return None
  229.  
  230.  
  231. Dialog1().Show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement