fork download
  1. # File: B (Python 2.2)
  2.  
  3. import ui
  4. import player
  5. import app
  6. import chat
  7. import chr
  8. import net
  9. import time
  10. import chrmgr
  11. import wndMgr
  12. import locale
  13. import skill
  14. BuffbotStatus = 0
  15. BuffDelay = 20
  16. BuffSegen = 0
  17. BuffReflekt = 0
  18. BuffHDD = 0
  19. Follow = 0
  20. Time = 0
  21. Cooltime = 0
  22. TargetVID = 0
  23. Buff = 1
  24.  
  25. class BuffBotDialog(ui.ThinBoard):
  26.  
  27. def __init__(self):
  28. ui.ThinBoard.__init__(self)
  29. self.LoadThinBoard()
  30.  
  31.  
  32. def LoadThinBoard(self):
  33. global BuffbotStatus
  34. self.SetSize(200, 180)
  35. self.SetPosition(52, 40)
  36. self.Show()
  37. self.LoadText()
  38. self.LoadButton()
  39. BuffDelay1 = float(BuffDelay)
  40. BuffDelayPos = BuffDelay1 * 0.01
  41. BuffbotStatus = 0
  42. name = chr.GetNameByVID(TargetVID)
  43. self.TargetNameLabel.SetText(name)
  44. if BuffbotStatus == 0:
  45. self.BuffBotStartButton.Show()
  46. elif BuffbotStatus == 1:
  47. self.BuffBotStopButton.Show()
  48.  
  49. if Follow == 0:
  50. self.FollowOff.Show()
  51. elif Follow == 1:
  52. self.FollowOn.Show()
  53.  
  54. self.BuffDelaySlider.SetSliderPos(BuffDelayPos)
  55. self.BuffDelay()
  56.  
  57.  
  58. def OnPressEscapeKey(self):
  59. self.Close()
  60. return TRUE
  61.  
  62.  
  63. def Close(self):
  64. self.Hide()
  65.  
  66.  
  67. def Show(self):
  68. ui.ThinBoard.Show(self)
  69.  
  70.  
  71. def __del__(self):
  72. ui.ThinBoard.__del__(self)
  73.  
  74.  
  75. def LoadText(self):
  76. self.Title = ui.TextLine()
  77. self.Title.SetParent(self)
  78. self.Title.SetDefaultFontName()
  79. self.Title.SetPosition(-20, 6)
  80. self.Title.SetFeather()
  81. self.Title.SetWindowHorizontalAlignCenter()
  82. self.Title.SetText('Buffbot')
  83. self.Title.SetFontColor(1.0, 0.80000000000000004, 0)
  84. self.Title.SetOutline()
  85. self.Title.Show()
  86. self.NameLabel = ui.TextLine()
  87. self.NameLabel.SetParent(self)
  88. self.NameLabel.SetDefaultFontName()
  89. self.NameLabel.SetPosition(-90, 33)
  90. self.NameLabel.SetFeather()
  91. self.NameLabel.SetWindowHorizontalAlignCenter()
  92. self.NameLabel.SetFontColor(1.0, 0.80000000000000004, 0)
  93. self.NameLabel.SetText('Target Name:')
  94. self.NameLabel.SetOutline()
  95. self.NameLabel.Show()
  96. self.TargetNameLabel = ui.TextLine()
  97. self.TargetNameLabel.SetParent(self)
  98. self.TargetNameLabel.SetDefaultFontName()
  99. self.TargetNameLabel.SetPosition(-20, 33)
  100. self.TargetNameLabel.SetFeather()
  101. self.TargetNameLabel.SetWindowHorizontalAlignCenter()
  102. self.TargetNameLabel.Show()
  103. self.FollowLabel = ui.TextLine()
  104. self.FollowLabel.SetParent(self)
  105. self.FollowLabel.SetDefaultFontName()
  106. self.FollowLabel.SetPosition(-40, 110)
  107. self.FollowLabel.SetFeather()
  108. self.FollowLabel.SetWindowHorizontalAlignCenter()
  109. self.FollowLabel.SetText('Follow Target')
  110. self.FollowLabel.SetOutline()
  111. self.FollowLabel.Show()
  112. self.DelaySlideBarLabel = ui.TextLine()
  113. self.DelaySlideBarLabel.SetParent(self)
  114. self.DelaySlideBarLabel.SetFontColor(1.0, 0.80000000000000004, 0)
  115. self.DelaySlideBarLabel.SetPosition(55, 85)
  116. self.DelaySlideBarLabel.SetText('Buff Delay - 50Sek')
  117. self.DelaySlideBarLabel.Show()
  118. self.DelaySlideBarLabel.SetOutline()
  119.  
  120.  
  121. def LoadButton(self):
  122. self.CloseButton = ui.Button()
  123. self.CloseButton.SetParent(self)
  124. self.CloseButton.SetPosition(177, 6)
  125. self.CloseButton.SetUpVisual('d:/ymir work/ui/public/close_button_01.sub')
  126. self.CloseButton.SetOverVisual('d:/ymir work/ui/public/close_button_02.sub')
  127. self.CloseButton.SetDownVisual('d:/ymir work/ui/public/close_button_03.sub')
  128. self.CloseButton.SetToolTipText('Close', 0, -23)
  129. self.CloseButton.SetEvent(ui.__mem_func__(self.Hide))
  130. self.CloseButton.Show()
  131. self.BuffBotStartButton = ui.Button()
  132. self.BuffBotStartButton.SetParent(self)
  133. self.BuffBotStartButton.SetUpVisual('m2kmod\\Images\\start_0.tga')
  134. self.BuffBotStartButton.SetOverVisual('m2kmod\\Images\\start_1.tga')
  135. self.BuffBotStartButton.SetDownVisual('m2kmod\\Images\\start_2.tga')
  136. self.BuffBotStartButton.SetPosition(84, 135)
  137. self.BuffBotStartButton.SetEvent(ui.__mem_func__(self.CheckBuffs))
  138. self.BuffBotStartButton.Hide()
  139. self.BuffBotStopButton = ui.Button()
  140. self.BuffBotStopButton.SetParent(self)
  141. self.BuffBotStopButton.SetUpVisual('m2kmod\\Images\\stop_0.tga')
  142. self.BuffBotStopButton.SetOverVisual('m2kmod\\Images\\stop_1.tga')
  143. self.BuffBotStopButton.SetDownVisual('m2kmod\\Images\\stop_2.tga')
  144. self.BuffBotStopButton.SetPosition(84, 135)
  145. self.BuffBotStopButton.SetEvent(ui.__mem_func__(self.CheckBuffs))
  146. self.BuffBotStopButton.Hide()
  147. self.BuffDelaySlider = ui.SliderBar()
  148. self.BuffDelaySlider.SetParent(self)
  149. self.BuffDelaySlider.SetPosition(10, 65)
  150. self.BuffDelaySlider.SetEvent(ui.__mem_func__(self.BuffDelay))
  151. self.BuffDelaySlider.SetSliderPos(0.5)
  152. self.BuffDelaySlider.Show()
  153. self.FollowOn = ui.Button()
  154. self.FollowOn.SetParent(self)
  155. self.FollowOn.SetUpVisual('m2kmod\\Images\\on_0.tga')
  156. self.FollowOn.SetOverVisual('m2kmod\\Images\\on_1.tga')
  157. self.FollowOn.SetDownVisual('m2kmod\\Images\\on_2.tga')
  158. self.FollowOn.SetPosition(135, 110)
  159. self.FollowOn.SetEvent(ui.__mem_func__(self.Follow))
  160. self.FollowOn.Hide()
  161. self.FollowOff = ui.Button()
  162. self.FollowOff.SetParent(self)
  163. self.FollowOff.SetUpVisual('m2kmod\\Images\\off_0.tga')
  164. self.FollowOff.SetOverVisual('m2kmod\\Images\\off_1.tga')
  165. self.FollowOff.SetDownVisual('m2kmod\\Images\\off_2.tga')
  166. self.FollowOff.SetPosition(125, 110)
  167. self.FollowOff.SetEvent(ui.__mem_func__(self.Follow))
  168. self.FollowOff.Hide()
  169.  
  170.  
  171. def BuffDelay(self):
  172. global BuffDelay
  173. BuffDelay = int(self.BuffDelaySlider.GetSliderPos() * 100)
  174. self.DelaySlideBarLabel.SetText('Buff Delay - ' + str(BuffDelay) + 'Sec.')
  175.  
  176.  
  177. def GetVID(self):
  178. global TargetVID
  179. if self.TargetNameLabel.GetText() != 'None':
  180. TargetVID = player.GetTargetVID()
  181. else:
  182. chat.AppendChat(7, 'First please set a target!')
  183.  
  184.  
  185. def Follow(self):
  186. global Follow
  187. if Follow == 0:
  188. Follow = 1
  189. self.FollowOn.Show()
  190. self.FollowOff.Hide()
  191. self.FollowTarget_1()
  192. else:
  193. Follow = 0
  194. self.FollowOn.Hide()
  195. self.FollowOff.Show()
  196. self.FollowTarget_0()
  197.  
  198.  
  199. def CheckBuffs(self):
  200. global BuffbotStatus
  201. self.GetVID()
  202. if TargetVID != 0:
  203. if BuffbotStatus == 0:
  204. BuffbotStatus = 1
  205. self.BuffBotStopButton.Show()
  206. self.BuffBotStartButton.Hide()
  207. self.StartBuff()
  208. else:
  209. BuffbotStatus = 0
  210. self.BuffBotStopButton.Hide()
  211. self.BuffBotStartButton.Show()
  212. else:
  213. chat.AppendChat(7, 'Get the VID from you Target!')
  214.  
  215.  
  216. def StartBuff(self):
  217. global Buff
  218. if BuffbotStatus == 0:
  219. return None
  220. else:
  221. player.SetTarget(int(TargetVID))
  222. if Buff == 4:
  223. Buff = 1
  224. self.WaitingDelay = WaitingDialog()
  225. self.WaitingDelay.Open(int(BuffDelay))
  226. self.WaitingDelay.SAFE_SetTimeOverEvent(self.StartBuff)
  227. return None
  228.  
  229. SkillSlotID = Buff + 3
  230. player.ClickSkillSlot(SkillSlotID)
  231. Buff += 1
  232. self.BuffDelay = WaitingDialog()
  233. self.BuffDelay.Open(2.0)
  234. self.BuffDelay.SAFE_SetTimeOverEvent(self.StartBuff)
  235.  
  236.  
  237. def FollowTarget_1(self):
  238. (x, y) = chr.GetPixelPosition(TargetVID)[:2]
  239. charvid = player.GetMainCharacterIndex()
  240. chr.MoveToDestPosition(charvid, int(x), int(y))
  241. self.UpdateFollow = WaitingDialog()
  242. self.UpdateFollow.Open(1.0)
  243. self.UpdateFollow.SAFE_SetTimeOverEvent(self.FollowTarget_1)
  244.  
  245.  
  246. def FollowTarget_0(self):
  247. self.UpdateFollow = WaitingDialog()
  248. self.UpdateFollow.Close()
  249.  
  250.  
  251. def OnUpdate(self):
  252. global TargetVID
  253. if BuffbotStatus == 0:
  254. TargetVID = player.GetTargetVID()
  255. name = chr.GetNameByVID(int(TargetVID))
  256. self.TargetNameLabel.SetText(name)
  257. return None
  258.  
  259.  
  260.  
  261.  
  262. class WaitingDialog(ui.ScriptWindow):
  263.  
  264. def __init__(self):
  265. ui.ScriptWindow.__init__(self)
  266.  
  267. self.eventTimeOver = lambda *arg: None
  268.  
  269. self.eventExit = lambda *arg: None
  270.  
  271.  
  272. def __del__(self):
  273. ui.ScriptWindow.__del__(self)
  274.  
  275.  
  276. def Open(self, waitTime):
  277. curTime = time.clock()
  278. self.endTime = curTime + waitTime
  279. self.Show()
  280.  
  281.  
  282. def Close(self):
  283. self.Hide()
  284.  
  285.  
  286. def SAFE_SetTimeOverEvent(self, event):
  287. self.eventTimeOver = ui.__mem_func__(event)
  288.  
  289.  
  290. def SAFE_SetExitEvent(self, event):
  291. self.eventExit = ui.__mem_func__(event)
  292.  
  293.  
  294. def OnUpdate(self):
  295. lastTime = max(0, self.endTime - time.clock())
  296. if 0 == lastTime:
  297. self.Close()
  298. self.eventTimeOver()
  299. else:
  300. return None
  301.  
  302.  
  303. def OnPressExitKey(self):
  304. self.Close()
  305. return TRUE
  306.  
  307.  
  308.  
Runtime error #stdin #stdout #stderr 0.02s 9016KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 3, in <module>
ImportError: No module named ui