Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import ui, wndMgr, player, net
- class AutoPotions(ui.ScriptWindow):
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.PotionButton = ui.Button()
- self.PotionButton.SetPosition(wndMgr.GetScreenWidth() - 87, wndMgr.GetScreenHeight() / 5 + 10)
- self.PotionButton.SetUpVisual("d:/ymir work/ui/public/small_Button_01.sub")
- self.PotionButton.SetOverVisual("d:/ymir work/ui/public/small_Button_02.sub")
- self.PotionButton.SetDownVisual("d:/ymir work/ui/public/small_Button_03.sub")
- self.PotionButton.SetText("Potar")
- self.PotionButton.SetEvent(self.SetPotions)
- self.PotionButton.Show()
- self.AutoPotionStatus = 0
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def SetPotions(self):
- if self.AutoPotionStatus == 1:
- self.AutoPotionStatus = 0
- self.PotionButton.SetUpVisual("d:/ymir work/ui/public/small_Button_01.sub")
- else:
- self.AutoPotionStatus = 1
- self.PotionButton.SetUpVisual("d:/ymir work/ui/public/small_Button_03.sub")
- self.AutoPotion()
- def AutoPotion(self):
- if self.AutoPotionStatus == 1:
- RedPotions = [70020]
- red_active = 0
- for i in xrange(90,-1,-1):
- if player.GetItemIndex(i) in RedPotions and player.GetItemMetinSocket(i, 0) == 1:
- red_active = 1
- break
- if red_active == 0:
- for i in xrange(90,-1,-1):
- if player.GetItemIndex(i) in RedPotions:
- net.SendItemUsePacket(i)
- break
- self.delay = WaitingDialog()
- self.delay.Open(0)
- self.delay.SAFE_SetTimeOverEvent(self.AutoPotion)
- class WaitingDialog(ui.ScriptWindow):
- def __init__(self):
- ui.ScriptWindow.__init__(self)
- self.eventTimeOver = lambda *arg: None
- self.eventExit = lambda *arg: None
- def __del__(self):
- ui.ScriptWindow.__del__(self)
- def Open(self, waitTime):
- import time
- curTime = time.clock()
- self.endTime = curTime + waitTime
- self.Show()
- def Close(self):
- self.Hide()
- def Destroy(self):
- self.Hide()
- def SAFE_SetTimeOverEvent(self, event):
- self.eventTimeOver = ui.__mem_func__(event)
- def SAFE_SetExitEvent(self, event):
- self.eventExit = ui.__mem_func__(event)
- def OnUpdate(self):
- import time
- lastTime = max(0, self.endTime - time.clock())
- if 0 == lastTime:
- self.Close()
- self.eventTimeOver()
- else:
- return
- def OnPressExitKey(self):
- self.Close()
- return TRUE
- StartDialog = AutoPotions()
- StartDialog.Show()
Add Comment
Please, Sign In to add comment