def declineMission(): print '--> decline mission' x, y = image.findImgR(panel.MissionRight, 'img/decline.bmp') mouse.moveTo(x, y) mouse.leftClick() time.sleep(5) x, y = image.findImgR(panel.Full, 'img/yes.bmp') if x > 0: mouse.moveTo(x, y) mouse.leftClick() print 'wait until decline' while not findRequestMission(): time.sleep(0.5) mouse.leftClick() while not findX(): time.sleep(0.2) mouse.leftClick() time.sleep(1) print '<-- decline mission\n' return True
def unloadItem(item): print '--> unload item ' + item x, y = image.findImgR(panel.Inventory, 'img/ship.bmp', 0.2) if x > 0: mouse.moveTo(x, y) mouse.leftClick() time.sleep(1.5) x = -1 x, y = image.findImgR(panel.Inventory, item) while x < 0: mouse.moveToP(panel.middle(panel.Inventory)) mouse.leftClick() mouse.wheel(-12) mouse.move(300, 0) x, y = image.findImgR(panel.Inventory, item) mouse.moveTo(x, y) mouse.leftDown() x, y = image.findImgR(panel.Inventory, 'img/item_hangar.bmp', 0.2) if x < 0: mouse.leftUp() return False mouse.moveTo(x, y) mouse.leftUp() time.sleep(1) print '<-- unload item ' + item + '\n' return True
def autopilot(): print '--> autopilot' arrived = False while not arrived: print 'try to find target stargate or station' finded = '' for retry in range(7): mouse.moveToP(panel.middle(panel.Full)) print 'try: ' + str(retry + 1) if findTargetStation(): finded = 'station' break elif findTargetStarGate(): finded = 'stargate' break else: x, y = panel.middle(panel.Overview) y += random.random() * 200 - 100 mouse.leftClickAt(x, y) mouse.wheel(-12) if finded == '': print "can't find any waypoint" arrived = True break if finded == 'station': print 'target station finded, dock' x, y = image.findImgR(panel.Overview, 'img/target_station.bmp', 0.2) mouse.leftClickAt(x, y) dock() print 'wait until entering station' while not findEnteringStation(): time.sleep(0.1) print 'entering station' time.sleep(4) arrived = True break if finded == 'stargate': print 'target stargate finded, jump' x, y = image.findImgR(panel.Overview, 'img/target_star_gate.bmp', 0.2) mouse.leftClickAt(x, y) jump() print 'wait until entering space' while not findEnteringSpace(): time.sleep(0.1) print 'entering space' time.sleep(4) time.sleep(1) print '<-- autopilot\n'
def findRequestMission(): x, y = image.findImgR(panel.Mission, 'img/request_mission.bmp') if x != -1 and y != -1: mouse.moveTo(x, y) return True return False
def findUndock(): x, y = image.findImgR(panel.Menu, 'img/undock.bmp', 0.2) if x > 0 and y > 0: mouse.moveTo(x, y) return True return False
def findX(): x, y = image.findImgR(panel.Mission, 'img/x.bmp') if x != -1 and y != -1: mouse.moveTo(x, y) return True return False
def findAccept(): x, y = image.findImgR(panel.MissionRight, 'img/accept.bmp') if x != -1 and y != -1: mouse.moveTo(x, y) return True return False
def findAgent(agentPicSource): x, y = image.findImgR(panel.StationServices, agentPicSource) if x != -1 and y != -1: mouse.moveTo(x + 10, y + 10) return True return False
def findEnteringStation(): x, y = image.findImgR(panel.ProcessBar, 'img/entering_station.bmp') if x != -1 and y != -1: mouse.moveTo(x, y) return True return False
def findCompleteMission(): x, y = image.findImgR(panel.MissionRight, 'img/complete_mission.bmp') if x != -1 and y != -1: mouse.moveTo(x, y) return True return False
def openInventory(): print '--> open inventory' x, y = image.findImgR(panel.Menu, 'img/inventory.bmp', 0.2) if x < 0: return False mouse.moveTo(x, y) mouse.leftClick() time.sleep(1) print '<-- open inventory\n' return True
def closeInventory(): print '--> close inventory' mouse.moveToP(panel.middle(panel.Inventory)) x, y = image.findImgR(panel.Inventory, 'img/x.bmp') if x < 0: return False mouse.moveTo(x, y) mouse.leftClick() time.sleep(1) print '<-- close inventory\n' return True
def run(): print "--> mission Eliminate the Pirate Campers" if not station.undock(): return False pilot.autopilot() if not space.warpToMissionLocation(): return False if not space.enableAllLowSlot(): return False if not space.launchDrones(): return False if not space.openMissionDetail(): return False x = -1 while x < 0: x, y = image.findImgR(panel.Full, "img/close.bmp") time.sleep(0.1) mouse.moveTo(x, y) mouse.leftClick() if not space.missionObjectiveComplete(): return False if not space.dronesReturn(): return False if space.setMissionWaypoint(): pilot.autopilot() else: mouse.leftClick() space.exitStartMap() space.backToAgentStation() print "<-- mission Eliminate the Pirate Campers\n" return True
def run(): # if not inStation(): # print 'Error: Must begin at station.' # return False print 'mission bot begin. \n' while True: if not station.startConversation(agent): print 'Error: Could not find target agent.' return False mission = image.extractTextR(panel.MissionName).strip() if mission not in bots: print 'Skip mission \'' + mission + '\'' station.declineMission() continue # if mission in skips: # print 'Skip mission \'' + mission + '\'' # station.declineMission() # continue # else: # print 'Error: Cant find bot for mission \'' + mission + '\'.' # return False bot = bots[mission] print 'Mission - ' + mission if not station.acceptMission(): print 'Error: Accept mission failed.' return False if not space.setMissionWaypoint(): print 'Error: Cant set mission waypoint.' return False # # TODO:test # bot = saving_a_mans_career # # TODO:test # mouse.moveToP(panel.middle(panel.Full)) # mouse.leftClick() if not bot.run(): print 'Error: Mission abort.' return False if not station.startConversation(agent): print 'Error: Could not find target agent.' return False if not station.completeMission(): print 'Error: Complete mission failed' return False if bot == bots['Tenhnalaginal Secrets (2 of 3)']: station.undock() pilot.autopilot() if not space.repair(): return False # TODO # break return False
def inStation(): x, y = image.findImgR(panel.Menu, 'img/undock.bmp', 0.2) if x > 0 and y > 0: return True return False
def findTargetStarGate(): x, y = image.findImgR(panel.Overview, 'img/target_star_gate.bmp', 0.2) if x != -1 and y != -1: return True return False
def run(): print '--> mission Deadly Arrival' if not station.undock(): return False if not space.warpToMissionLocation(): return False if not space.enableAllLowSlot(): return False # in this mission we should approach a Large Collidable Object x, y = image.findImgR(panel.Overview, 'img/overview.bmp') if x < 0 or y < 0: return False mouse.moveTo(x, y) mouse.leftClick() x, y = image.findImgR(panel.Overview, 'img/load_lco.bmp') if x < 0 or y < 0: return False mouse.moveTo(x, y) mouse.leftClick() if not space.lockTarget('img/ruined_structure.bmp'): return False if not space.approach(): return False if not space.openAfterBurn(): return False if not space.openMissionDetail(): return False if not space.missionObjectiveComplete(): return False # reset overview x, y = image.findImgR(panel.Overview, 'img/overview.bmp') if x < 0 or y < 0: return False mouse.moveTo(x, y) mouse.leftClick() x, y = image.findImgR(panel.Overview, 'img/load_kid.bmp') if x < 0 or y < 0: return False mouse.moveTo(x, y) mouse.leftClick() if not space.backToAgentStation(): return False print '<-- mission Deadly Arrival\n' return True
def findInfo(): x, y = image.findImgR(panel.MissionLeft, 'img/info.bmp') if x != -1 and y != -1: return True return False