Advertisement
Guest User

Untitled

a guest
Nov 20th, 2017
806
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 20.76 KB | None | 0 0
  1. #######################################################
  2. # Metin2 | Farm | Level | Buff | Bot | (c) 2017 iPUSH #
  3. #######################################################
  4.  
  5. import app,item,chr,net,player,time,ui,os,textTail,math
  6.  
  7. ### Modules substitute ###
  8. """ Function list """
  9. class MyFunc:
  10.  
  11. ### AutoTP ###
  12. @staticmethod
  13. def autoTP(threshold):
  14. if (float(player.GetStatus(player.HP)) / (float(player.GetStatus(player.MAX_HP))) * 100) < int(threshold):
  15. if not MyFunc.useItem(27001):
  16. if not MyFunc.useItem(27002):
  17. MyFunc.useItem(27003)
  18.  
  19. ### AutoMP ###
  20. @staticmethod
  21. def autoMP(threshold):
  22. if (float(player.GetStatus(player.SP)) / (float(player.GetStatus(player.MAX_SP))) * 100) < int(threshold):
  23. if not MyFunc.useItem(27004):
  24. if not MyFunc.useItem(27005):
  25. MyFunc.useItem(27006)
  26.  
  27. ### AutoAttack ###
  28. @staticmethod
  29. def autoAttack(type):
  30. nearestEnemey = MyFunc.walkToEnemy(type)
  31. isAlive = MyFunc.isAlive(nearestEnemey)
  32. isInRange = player.GetCharacterDistance(nearestEnemey) < 300
  33. tp = (float(player.GetStatus(player.HP)) / (float(player.GetStatus(player.MAX_HP))) * 100)
  34. if (isAlive and isInRange) or tp < 90:
  35. MyFunc.setCharDirection(nearestEnemey)
  36. chr.SetRotation(MyFunc.getDegree(nearestEnemey))
  37. player.SetAttackKeyState(TRUE)
  38. else:
  39. player.SetAttackKeyState(FALSE)
  40.  
  41. ### Follow target ###
  42. targetVID = 0
  43. @staticmethod
  44. def followTar():
  45. if MyFunc.targetVID == 0:
  46. MyFunc.targetVID = player.GetTargetVID()
  47. player.SetTarget(MyFunc.targetVID)
  48. if player.GetCharacterDistance(MyFunc.targetVID) >= 1000:
  49. MyFunc.charMoveToPos(MyFunc.targetVID)
  50.  
  51. ### Horse ###
  52. horseCount = 0
  53. @staticmethod
  54. def useHorse(autoAttack):
  55. tp = (float(player.GetStatus(player.HP)) / (float(player.GetStatus(player.MAX_HP))) * 100)
  56. if player.IsMountingHorse() == TRUE:
  57. MyFunc.horseCount = 0
  58. if tp > 0 and tp < 30:
  59. autoAttack.pauseEvent(2)
  60. chr.SetDirection(app.GetRandom(0,7))
  61. player.SetTarget(player.GetMainCharacterIndex())
  62. player.ClickSkillSlot(9)
  63. else:
  64. if tp > 0:
  65. net.SendChatPacket("/ride")
  66. MyFunc.horseCount += 1
  67. if MyFunc.horseCount > 2:
  68. net.SendItemUsePacket(0)
  69. MyFunc.horseCount = 0
  70.  
  71. ### BuffBot ###
  72. @staticmethod
  73. def loadBuffBot(board, horse):
  74. btn = []
  75. editline = []
  76. for i in xrange(1, 7, 1):
  77. editline.append(Gui.addEditLine(board, 50, (i * 20) + 1, 25, 16, "5", 3))
  78. btn.append(Gui.addToggleButton(board, str(i), 5, i * 20, "small", MyFunc.buffBot, None, 5))
  79. btn[i-1].setEventDownArgs(btn[i-1], editline[i-1], i, horse)
  80. return btn, editline
  81.  
  82. @staticmethod
  83. def buffBot(buffBtn, buffDelay, skill, horseBtn):
  84. horse = False
  85. tp = (float(player.GetStatus(player.HP)) / (float(player.GetStatus(player.MAX_HP))) * 100)
  86. if player.IsSkillCoolTime(skill) == 0 and tp > 30:
  87. if player.IsMountingHorse() == TRUE:
  88. horse = True
  89. horseBtn.pauseEvent(2)
  90. net.SendChatPacket("/ride")
  91. MyFunc.callFnc(1, player.ClickSkillSlot, skill)
  92. if horse:
  93. MyFunc.callFnc(2, net.SendChatPacket, "/ride")
  94. buffBtn.setEventDelay(int(buffDelay[1].GetText()))
  95.  
  96. ### UseItem ###
  97. @staticmethod
  98. def showUseItem(board, btn):
  99. board.SetSize(130, (len(btn) + 2) * 25)
  100. board.Show()
  101.  
  102. @staticmethod
  103. def addUseItem(board, btn, time):
  104. item.SelectItem(player.GetItemIndex(0))
  105. itemName = str(item.GetItemName())
  106. itemTime = int(time[1].GetText())
  107. itemID = int(player.GetItemIndex(0))
  108. MyFunc.writeFile("Bot-Settings.txt", itemName, itemID, itemTime)
  109. btn.append(Gui.addToggleButton(board, itemName, 20, (len(btn) + 2) * 25, "large", MyFunc.useItem, None, itemTime))
  110. btn[-1].setEventDownArgs(itemID)
  111. MyFunc.showUseItem(board, btn)
  112.  
  113. @staticmethod
  114. def removeUseItem(board, btn):
  115. MyFunc.removeLastLines()
  116. btn[-1].close()
  117. del btn[-1]
  118. MyFunc.showUseItem(board, btn)
  119.  
  120. @staticmethod
  121. def loadUseItem(board):
  122. settings = MyFunc.readFile("Bot-Settings.txt")
  123. btn = []
  124. count = 0
  125. if settings != None:
  126. for i in range(0,len(settings),4):
  127. itemName = str(settings[i].split('=')[1])
  128. itemID = int(settings[i+1].split('=')[1])
  129. itemTime = int(settings[i+2].split('=')[1])
  130. btn.append(Gui.addToggleButton(board, itemName, 20, (count + 2) * 25, "large", MyFunc.useItem, None, itemTime))
  131. btn[count].setEventDownArgs(itemID)
  132. count += 1
  133. return btn
  134.  
  135. ### PickUp ###
  136. @staticmethod
  137. def pickUpBot():
  138. try:
  139. for vid in MyFunc.getItemsVID():
  140. net.SendItemPickUpPacket(vid)
  141. except:
  142. player.PickCloseItem()
  143.  
  144. ### RestartHere ###
  145. @staticmethod
  146. def restartHere(autoAttack, useItemList, horse):
  147. if player.GetStatus(player.HP) <= 0:
  148. if autoAttack.getState():
  149. player.SetAttackKeyState(FALSE)
  150. autoAttack.pauseEvent(10)
  151. for item in useItemList:
  152. if item.getEventDownArgs()[0] == 70038 and item.getState():
  153. item.pauseEvent(10)
  154. net.SendChatPacket("/restart_here")
  155. for i in xrange(5):
  156. MyFunc.callFnc(1+i*0.1, net.SendItemUsePacket, i)
  157. if horse.getState() and player.GetStatus(player.HP) > 0:
  158. MyFunc.callFnc(2, net.SendChatPacket, "/ride")
  159. MyFunc.callFnc(4, player.ClickSkillSlot, 9)
  160.  
  161. ''''''''''''''''''''''''''' Misc functions '''''''''''''''''''''''''''
  162.  
  163. ### Call function with delay and args ###
  164. callFncList = []
  165. @staticmethod
  166. def callFnc(delay, fnc, *args):
  167. MyFunc.callFncList = [x for x in MyFunc.callFncList if not x.state]
  168. MyFunc.callFncList.append(CallFnc(delay, fnc, *args))
  169.  
  170. ### Read & write file ###
  171. @staticmethod
  172. def readFile(path):
  173. if(os.path.isfile(path) and os.path.getsize(path) > 0):
  174. f = open(path, 'r')
  175. return f.readlines()
  176. else:
  177. return None
  178.  
  179. @staticmethod
  180. def writeFile(path, name, id, time):
  181. f = open(path, 'a')
  182. f.write("Name=%s\n"%(name))
  183. f.write("ID=%i\n"%(id))
  184. f.write("Time=%i\n\n"%(time))
  185. f.close()
  186.  
  187. @staticmethod
  188. def removeLastLines():
  189. settings = MyFunc.readFile("Bot-Settings.txt")
  190. f = open("Bot-Settings.txt", "w")
  191. f.writelines(settings[:-4])
  192. f.close()
  193.  
  194. ### Use item from inventory ###
  195. @staticmethod
  196. def useItem(itemID):
  197. for i in xrange(player.INVENTORY_PAGE_SIZE*5):
  198. if player.GetItemIndex(i) == itemID:
  199. net.SendItemUsePacket(i)
  200. return True
  201.  
  202. ### Get VID of near items ###
  203. @staticmethod
  204. def getItemsVID():
  205. itemList = []
  206. for y in xrange(125,600,9):
  207. for x in xrange(300,825,25):
  208. iVID = textTail.Pick(x, y)
  209. if iVID != -1 and iVID not in itemList:
  210. itemList.append(iVID)
  211. return itemList
  212.  
  213. ### Check if target is alive ###
  214. @staticmethod
  215. def isAlive(vid):
  216. player.SetTarget(vid)
  217. if player.GetTargetVID() != 0:
  218. return True
  219.  
  220. ### Get degree in between char and target ###
  221. @staticmethod
  222. def getDegree(vid):
  223. mobX, mobY = chr.GetPixelPosition(vid)[:2]
  224. playerX, playerY = player.GetMainCharacterPosition()[:2]
  225. try:
  226. rada = 180 * (math.acos((mobY-playerY)/math.sqrt((mobX - playerX)**2 + (mobY - playerY)**2))) / math.pi + 180
  227. if playerX >= mobX:
  228. rada = 360 - rada
  229. except:
  230. rada = 0
  231. return rada
  232.  
  233. ### Char move to position and check if get stucked ###
  234. charIsMoving = [False]
  235. getStuckedCounter = 0
  236. @staticmethod
  237. def charMoveToPos(vid):
  238. if player.GetCharacterDistance(vid) > 500:
  239. MyFunc.getStuckedCounter += 1
  240.  
  241. if not MyFunc.charIsMoving[0] and MyFunc.getStuckedCounter > 5:
  242. MyFunc.charIsMoving[0] = True
  243. MyFunc.getStuckedCounter = 0
  244. MyFunc.charMoveRandom()
  245. MyFunc.callFnc(2, lambda : MyFunc.charIsMoving.__setitem__(0,False))
  246. else:
  247. x, y = chr.GetPixelPosition(vid)[:2]
  248. myX, myY = player.GetMainCharacterPosition()[:2]
  249.  
  250. if myX < x:
  251. x -= 135
  252. else:
  253. x += 135
  254. if myY < y:
  255. y -= 135
  256. else:
  257. y += 135
  258.  
  259. chr.MoveToDestPosition(player.GetMainCharacterIndex(), x, y)
  260.  
  261. ### Char move random direction ###
  262. @staticmethod
  263. def charMoveRandom():
  264. x, y = (0, 0)
  265. myX, myY = player.GetMainCharacterPosition()[:2]
  266.  
  267. direction = app.GetRandom(1,4)
  268. if direction == 1:
  269. x = myX
  270. y = myY - 1000
  271. elif direction == 2:
  272. x = myX + 1000
  273. y = myY
  274. elif direction == 3:
  275. x = myX
  276. y = myY + 1000
  277. elif direction == 4:
  278. x = myX - 1000
  279. y = myY
  280.  
  281. chr.MoveToDestPosition(player.GetMainCharacterIndex(), x, y)
  282.  
  283. ### Find the vid range with the most enemys ###
  284. @staticmethod
  285. def setVidRange(type):
  286. start = 0
  287. end = 1000
  288. limit = 1000
  289. range = 50000
  290. minVid = 0
  291. maxVid = 0
  292. vidList = []
  293.  
  294. for i in xrange(limit):
  295. for j in xrange(start, end):
  296. if chr.GetInstanceType(j) == type:
  297. vidList.append(j)
  298. start = end
  299. end += 1000
  300. if not vidList and limit < 10000:
  301. limit += 1000
  302.  
  303. if vidList:
  304. common = 0
  305. rangeDigitNum = len(str(range))
  306.  
  307. for i in xrange(1, rangeDigitNum):
  308. tmp = [x / (10 ** i) for x in vidList]
  309. common = max(set(tmp), key=tmp.count)
  310.  
  311. minVid = (common * (10 ** (rangeDigitNum - 1))) - range
  312. maxVid = (common * (10 ** (rangeDigitNum - 1))) + range
  313.  
  314. if minVid < range:
  315. minVid = 0
  316. maxVid = range * 2
  317.  
  318. return minVid, maxVid
  319.  
  320. ### Walk to nearest enemey ###
  321. vidStart = 0
  322. vidEnd = 0
  323. scanRangeCounter = 0
  324. @staticmethod
  325. def walkToEnemy(type):
  326. enemyList = []
  327. nearestEnemey = 0
  328.  
  329. if MyFunc.vidEnd == 0 or MyFunc.scanRangeCounter > 3:
  330. MyFunc.scanRangeCounter = 0
  331. MyFunc.vidStart, MyFunc.vidEnd = MyFunc.setVidRange(type)
  332.  
  333. for i in xrange(MyFunc.vidStart, MyFunc.vidEnd):
  334. if chr.GetInstanceType(i) == type:
  335. enemyList.append(i)
  336.  
  337. if enemyList:
  338. counter = 0
  339. enemyDistanceList = [player.GetCharacterDistance(enemy) for enemy in enemyList]
  340. while counter < len(enemyList) and not MyFunc.isAlive(nearestEnemey):
  341. nearestEnemey = enemyList[enemyDistanceList.index(sorted(enemyDistanceList)[counter])]
  342. counter += 1
  343. if player.GetCharacterDistance(nearestEnemey) > 200:
  344. MyFunc.charMoveToPos(nearestEnemey)
  345. else:
  346. app.RotateCamera(1)
  347. MyFunc.callFnc(4, app.RotateCamera, 0)
  348. MyFunc.charMoveRandom()
  349. MyFunc.scanRangeCounter += 1
  350.  
  351. return nearestEnemey
  352.  
  353. ### Press an arrow key ###
  354. @staticmethod
  355. def pressArrowKey(key):
  356. if key == "UP":
  357. player.SetSingleDIKKeyState(app.DIK_UP, TRUE)
  358. MyFunc.callFnc(0.5, player.SetSingleDIKKeyState, app.DIK_UP, FALSE)
  359. elif key == "DOWN":
  360. player.SetSingleDIKKeyState(app.DIK_DOWN, TRUE)
  361. MyFunc.callFnc(0.5, player.SetSingleDIKKeyState, app.DIK_DOWN, FALSE)
  362. elif key == "RIGHT":
  363. player.SetSingleDIKKeyState(app.DIK_RIGHT, TRUE)
  364. MyFunc.callFnc(0.5, player.SetSingleDIKKeyState, app.DIK_RIGHT, FALSE)
  365. elif key == "LEFT":
  366. player.SetSingleDIKKeyState(app.DIK_LEFT, TRUE)
  367. MyFunc.callFnc(0.5, player.SetSingleDIKKeyState, app.DIK_LEFT, FALSE)
  368.  
  369. ### Set char direction ###
  370. @staticmethod
  371. def setCharDirection(vid):
  372. x, y = chr.GetPixelPosition(vid)[:2]
  373. myX, myY = player.GetMainCharacterPosition()[:2]
  374. rotation = app.GetCameraRotation()
  375. direction = ""
  376.  
  377. if abs(x - myX) > abs(y - myY):
  378. if myX < x:
  379. if rotation > -45 and rotation < 45:
  380. direction = "RIGHT"
  381. elif rotation > 45 and rotation < 135:
  382. direction = "UP"
  383. elif rotation > 135 and rotation < 180 or rotation < -145 and rotation > -180:
  384. direction = "LEFT"
  385. elif rotation > -145 and rotation < -45:
  386. direction = "DOWN"
  387. else:
  388. if rotation > -45 and rotation < 45:
  389. direction = "LEFT"
  390. elif rotation > 45 and rotation < 135:
  391. direction = "DOWN"
  392. elif rotation > 135 and rotation < 180 or rotation < -145 and rotation > -180:
  393. direction = "RIGHT"
  394. elif rotation > -145 and rotation < -45:
  395. direction = "UP"
  396. else:
  397. if myY < y:
  398. if rotation > -45 and rotation < 45:
  399. direction = "DOWN"
  400. elif rotation > 45 and rotation < 135:
  401. direction = "RIGHT"
  402. elif rotation > 135 and rotation < 180 or rotation < -145 and rotation > -180:
  403. direction = "UP"
  404. elif rotation > -145 and rotation < -45:
  405. direction = "LEFT"
  406. else:
  407. if rotation > -45 and rotation < 45:
  408. direction = "UP"
  409. elif rotation > 45 and rotation < 135:
  410. direction = "LEFT"
  411. elif rotation > 135 and rotation < 180 or rotation < -145 and rotation > -180:
  412. direction = "DOWN"
  413. elif rotation > -145 and rotation < -45:
  414. direction = "RIGHT"
  415.  
  416. MyFunc.pressArrowKey(direction)
  417.  
  418. """ Gui wrapper """
  419. class Gui:
  420.  
  421. @staticmethod
  422. def addThinBoard(parent, x, y, width, heigh):
  423. board = ui.ThinBoard()
  424. if parent != None:
  425. board.SetParent(parent)
  426. board.AddFlag('movable')
  427. board.AddFlag('float')
  428. board.SetSize(width, heigh)
  429. board.SetPosition(x, y)
  430. board.Hide()
  431. return board
  432.  
  433. @staticmethod
  434. def addTextLine(parent, textlineText, x, y, color):
  435. textline = ui.TextLine()
  436. if parent != None:
  437. textline.SetParent(parent)
  438. textline.SetPosition(x, y)
  439. if color != None:
  440. textline.SetFontColor(color[0]*255, color[1]*255, color[2]*255)
  441. textline.SetText(textlineText)
  442. textline.SetOutline()
  443. textline.Show()
  444. return textline
  445.  
  446. @staticmethod
  447. def addEditLine(parent, x, y, width, heigh, editlineText, max):
  448. SlotBar = ui.SlotBar()
  449. if parent != None:
  450. SlotBar.SetParent(parent)
  451. SlotBar.SetSize(width, heigh)
  452. SlotBar.SetPosition(x, y)
  453. SlotBar.Show()
  454. EditLine = ui.EditLine()
  455. EditLine.SetParent(SlotBar)
  456. EditLine.SetSize(width, heigh)
  457. EditLine.SetPosition(6, 2)
  458. EditLine.SetMax(max)
  459. EditLine.SetNumberMode()
  460. EditLine.SetText(editlineText)
  461. EditLine.Show()
  462. return SlotBar, EditLine
  463.  
  464. @staticmethod
  465. def addButton(parent, label, x, y, size, func, *args):
  466. button = ui.Button()
  467. if parent != None:
  468. button.SetParent(parent)
  469. button.SetPosition(x, y)
  470. button.SetUpVisual('d:/ymir work/ui/public/' + size + '_button_01.sub')
  471. button.SetOverVisual('d:/ymir work/ui/public/' + size + '_button_02.sub')
  472. button.SetDownVisual('d:/ymir work/ui/public/' + size + '_button_03.sub')
  473. button.SetText(label)
  474. button.SetEvent(func, *args)
  475. button.Show()
  476. return button
  477.  
  478. @staticmethod
  479. def addToggleButton(parent, label, x, y, size, eventDown, eventUp, time):
  480. button = ToggleButton()
  481. if parent != None:
  482. button.SetParent(parent)
  483. button.SetPosition(x, y)
  484. button.SetUpVisual('d:/ymir work/ui/public/' + size + '_button_01.sub')
  485. button.SetOverVisual('d:/ymir work/ui/public/' + size + '_button_02.sub')
  486. button.SetDownVisual('d:/ymir work/ui/public/' + size + '_button_03.sub')
  487. button.SetText(label)
  488. button.setEventDown(eventDown)
  489. button.setEventUp(eventUp)
  490. button.setEventDelay(time)
  491. button.SetToggleDownEvent(button.startEvent)
  492. button.SetToggleUpEvent(button.stopEvent)
  493. button.Show()
  494. return button
  495.  
  496. """ Extended ToggleButton """
  497. class ToggleButton(ui.ToggleButton):
  498.  
  499. def __init__(self):
  500. ui.ToggleButton.__init__(self)
  501. self.timer = WaitingDialog()
  502. self.delay = None
  503. self.event_down = None
  504. self.event_up = None
  505. self.eventDownArgs = None
  506. self.eventUpArgs = None
  507. self.eventDownReturnValue = None
  508. self.eventUpReturnValue = None
  509. self.state = False
  510. self.pause = False
  511. self.pauseTimer = None
  512.  
  513. def __del__(self):
  514. ui.ToggleButton.__del__(self)
  515.  
  516. def close(self):
  517. self.timer.Close()
  518. self.eventDownReturnValue = None
  519. self.eventUpReturnValue = None
  520. self.Hide()
  521.  
  522. def setEventDown(self, event):
  523. self.event_down = event
  524.  
  525. def setEventUp(self, event):
  526. self.event_up = event
  527.  
  528. def setEventDelay(self, time):
  529. self.delay = time
  530.  
  531. def setEventDownArgs(self, *args):
  532. self.eventDownArgs = args
  533.  
  534. def setEventUpArgs(self, *args):
  535. self.eventUpArgs = args
  536.  
  537. def getState(self):
  538. return self.state
  539.  
  540. def getEventDownArgs(self):
  541. return self.eventDownArgs
  542.  
  543. def getEventUpArgs(self):
  544. return self.eventUpArgs
  545.  
  546. def getEventDownReturnValue(self):
  547. return self.eventDownReturnValue
  548.  
  549. def getEventUpReturnValue(self):
  550. return self.eventUpReturnValue
  551.  
  552. def isPause(self):
  553. return self.pause
  554.  
  555. def pauseEvent(self, time):
  556. self.pause = True
  557. self.pauseTimer = WaitingDialog()
  558. self.pauseTimer.Open(time)
  559. self.pauseTimer.SAFE_SetTimeOverEvent(self.resumeEvent)
  560.  
  561. def resumeEvent(self):
  562. self.pause = False
  563.  
  564. def startEvent(self):
  565. self.state = True
  566. if self.event_down != None and not self.pause:
  567. if self.eventDownArgs != None:
  568. self.eventDownReturnValue = self.event_down(*self.eventDownArgs)
  569. else:
  570. self.eventDownReturnValue = self.event_down()
  571. if self.delay != None:
  572. self.timer.Open(self.delay)
  573. self.timer.SAFE_SetTimeOverEvent(self.startEvent)
  574.  
  575. def stopEvent(self):
  576. self.state = False
  577. if self.event_up != None:
  578. if self.eventUpArgs != None:
  579. self.eventUpReturnValue = self.event_up(*self.eventUpArgs)
  580. else:
  581. self.eventUpReturnValue = self.event_up()
  582. self.timer.Close()
  583.  
  584. """ Call function with agrs and delay """
  585. class CallFnc:
  586.  
  587. def __init__(self, time, fnc, *args):
  588. self.event = fnc
  589. self.eventArgs = args
  590. self.state = False
  591. self.timer = WaitingDialog()
  592. self.timer.Open(time)
  593. self.timer.SAFE_SetTimeOverEvent(self.startEvent)
  594.  
  595. def close(self):
  596. self.state = True
  597. self.timer.Close()
  598.  
  599. def startEvent(self):
  600. if self.event != None:
  601. if self.eventArgs != None:
  602. self.event(*self.eventArgs)
  603. else:
  604. self.event()
  605. self.close()
  606.  
  607. """ Call function with delay """
  608. class WaitingDialog(ui.ScriptWindow):
  609.  
  610. def __init__(self):
  611. ui.ScriptWindow.__init__(self)
  612. self.eventTimeOver = lambda *arg: None
  613. self.eventExit = lambda *arg: None
  614.  
  615. def __del__(self):
  616. ui.ScriptWindow.__del__(self)
  617.  
  618. def Open(self, waitTime):
  619. curTime = time.clock()
  620. self.endTime = curTime + waitTime
  621. self.Show()
  622.  
  623. def Close(self):
  624. self.Hide()
  625.  
  626. def Destroy(self):
  627. self.Hide()
  628.  
  629. def SAFE_SetTimeOverEvent(self, event):
  630. self.eventTimeOver = ui.__mem_func__(event)
  631.  
  632. def SAFE_SetExitEvent(self, event):
  633. self.eventExit = ui.__mem_func__(event)
  634.  
  635. def OnUpdate(self):
  636. lastTime = max(0, self.endTime - time.clock())
  637. if 0 == lastTime:
  638. self.Close()
  639. self.eventTimeOver()
  640. else:
  641. return
  642.  
  643. ### Main Modul ###
  644. pos = 10
  645.  
  646. ### Main ###
  647. mainBoard = Gui.addThinBoard(None, 15, 100, 100, 220)
  648. mainBtn = Gui.addToggleButton(None, "iPUSH", 20, 75, "large", mainBoard.Show, mainBoard.Hide, None)
  649. # mainLabel = Gui.addTextLine(mainBoard, "iPUSH", 35, 5, (248, 24, 58))
  650. ### AutoTP ###
  651. autoTPEditLine = Gui.addEditLine(mainBoard, 70, pos+1, 20, 16, "90", 2)
  652. autoTPBtn = Gui.addToggleButton(mainBoard, "AutoTP", 5, pos, "middle", lambda : MyFunc.autoTP(autoTPEditLine[1].GetText()), None, 1); pos += 20
  653. ### AutoMP ###
  654. autoMPEditLine = Gui.addEditLine(mainBoard, 70, pos+1, 20, 16, "90", 2)
  655. autoMPBtn = Gui.addToggleButton(mainBoard, "AutoMP", 5, pos, "middle", lambda : MyFunc.autoMP(autoMPEditLine[1].GetText()), None, 1); pos += 20
  656. ### AutoAttack ###
  657. autoAttackEditLine = Gui.addEditLine(mainBoard, 70, pos+1, 20, 16, "0", 2) # 0 = Mobs | 2 = Metins | 6 = Players
  658. autoAttackBtn = Gui.addToggleButton(mainBoard, "AutoAttack", 5, pos, "middle", lambda : MyFunc.autoAttack(int(autoAttackEditLine[1].GetText())), lambda : player.SetAttackKeyState(FALSE), 1); pos += 20
  659. ### Follow target ###
  660. followTarBtn = Gui.addToggleButton(mainBoard, "Follow", 5, pos, "large", MyFunc.followTar, None, 1); pos += 20
  661. ### Horse ###
  662. useHorseBtn = Gui.addToggleButton(mainBoard, "Horse", 5, pos, "large", lambda : MyFunc.useHorse(autoAttackBtn), None, 1); pos += 20
  663. ### BuffBot ###
  664. buffBotBoard = Gui.addThinBoard(None, 115, 100, 85, 160)
  665. buffBotMainBtn = Gui.addToggleButton(mainBoard, "BuffBot", 5, pos, "large", buffBotBoard.Show, buffBotBoard.Hide, None); pos += 20
  666. buffBotBtnList, buffBotEditLineList = MyFunc.loadBuffBot(buffBotBoard, useHorseBtn)
  667. ### UseItem ###
  668. useItemBoard = Gui.addThinBoard(None, 115, 100, 100, 200)
  669. useItemBtnList = MyFunc.loadUseItem(useItemBoard)
  670. useItemBtn = Gui.addToggleButton(mainBoard, "UseItem", 5, pos, "large", lambda : MyFunc.showUseItem(useItemBoard, useItemBtnList), useItemBoard.Hide, None); pos += 20
  671. useItemEditLine = Gui.addEditLine(useItemBoard, 95, 11, 25, 16, "5", 3)
  672. addUseItemBtn = Gui.addButton(useItemBoard, "+", 5, 10, "small", lambda : MyFunc.addUseItem(useItemBoard, useItemBtnList, useItemEditLine))
  673. delUseItemBtn = Gui.addButton(useItemBoard, "-", 50, 10, "small", lambda : MyFunc.removeUseItem(useItemBoard, useItemBtnList))
  674. ### PickUp ###
  675. pickUpBtn = Gui.addToggleButton(mainBoard, "PickUp", 5, pos, "large", MyFunc.pickUpBot, None, 1); pos += 20
  676. ### Restart here###
  677. restartBtn = Gui.addToggleButton(mainBoard, "Restart", 5, pos, "large", lambda : MyFunc.restartHere(autoAttackBtn, useItemBtnList, useHorseBtn), None, 5); pos += 20
  678. ### Ghost ###
  679. ghostBtn = Gui.addButton(mainBoard, "Ghost", 5, pos, "large", chr.Revive); pos += 20
  680. # repeatFncs = {"TP":autoTPBtn, "MP":autoMPBtn, "Horse":useHorseBtn, "Buff":buffBotBtnList, "Items":useItemBtnList, "Attack":autoAttackBtn, "Pickup":pickUpBtn, "Follow":followTarBtn, "Restart":restartBtn}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement