def unloadItem(item): print '--> unload item ' + item result = findAtInventory('ship', 0.5) if not result: return False mouse.leftClickAtP(result) time.sleep(2) result = findAtInventory(item) while not result: mouse.moveToP(panel.center(panel.Inventory)) mouse.wheel(-12) mouse.moveTo(100, 100) result = findAtInventory(item) mouse.leftDownAtP(result) result = findAtInventory('item_hangar', 0.5) if not result: mouse.leftUp() return False mouse.moveToP(result) mouse.leftUp() time.sleep(1) print '<-- unload item ' + item + '\n' return True
def enterStarMap(): print '--> enter star map' key.pressEx(sc.Map) begin = time.time() while findAtProgressBar('initializing_map') or time.time() - begin < 3: time.sleep(0.5) mouse.moveToP(panel.center(panel.Full)) mouse.wheel(100) print '<-- enter star map\n'
def back(): print '--> drones return' key.pressEx(sc.DronesReturn) mouse.moveToP(panel.center(panel.Drones)) mouse.wheel(-100) mouse.moveToP(panel.center(panel.Full)) print 'wait until drones return' while findAtDrones('returning') or findAtDrones('fighting') or findAtDrones('idle'): key.pressEx(sc.DronesReturn) time.sleep(0.2) print '<-- drones return\n' return True
def openMissionDetails(): enterStarMap() print '--> open mission detail' openMissionMenu() result = findAtInfo('read_details') while not result: result = findAtInfo('read_details') time.sleep(0.5) mouse.leftClickAtP(result) print 'wait until find mission objective' while not findAtMissionDetails('o'): mouse.leftClickAt(panel.MissionDetails[0] + 20, panel.MissionDetails[1] + 20) mouse.wheel(-20) print '<-- open mission detail\n' exitStarMap() return True
def findEnemy(): print '--> find enemy' count = 0 result = pic.findColorR(panel.Overview, 'c11313') while result == None and count < 10: if result: break x, y = panel.center(panel.Overview) y += random.random() * 200 - 100 mouse.leftClickAt(x, y) if count < 5: mouse.wheel(-20) else: mouse.wheel(20) count += 1 result = pic.findColorR(panel.Overview, 'c11313') if not result: print 'can not find enemy.' else: print 'target finded.' print '<-- find enemy' return result
def findTarget(target, threashould = 0.1): print '--> find target "' + target + '"' count = 0 result = findAtOverview(target, threashould) while result == None and count < 10: if result: break x, y = panel.center(panel.Overview) y += random.random() * 200 - 100 mouse.leftClickAt(x, y) if count < 5: mouse.wheel(-20) else: mouse.wheel(20) count += 1 result = findAtOverview(target) if not result: print 'can not find target.' else: print 'target finded.' print '<-- find target "' + target + '"\n' return result
def _launch(group): result = None while not result: mouse.moveToP(panel.center(panel.Drones)) mouse.wheel(100) mouse.moveToP(panel.center(panel.Full)) result = findAtDrones('bay') if group == None: mouse.rightClickAtP(result) else: if not findAtDrones(group): mouse.leftClickAtP(result) result = findAtDrones(group) while not result: time.sleep(0.5) result = findAtDrones(group) mouse.rightClickAtP(result) result = findAtDrones('launch_drones') while not result: time.sleep(0.5) result = findAtDrones('launch_drones') mouse.leftClickAtP(result) print 'wait until drones launching..' mouse.moveToP(panel.center(panel.Full)) # time.sleep(5) while not findAtDrones('idle') and not findAtDrones('fighting') and not findAtDrones('returning'): mouse.moveToP(panel.center(panel.Drones)) mouse.wheel(-100) mouse.moveToP(panel.center(panel.Full)) if not findAtDrones('idle') and not findAtDrones('fighting') and not findAtDrones('returning'): result = findAtDrones('local_space') if result: mouse.leftClickAtP(result) mouse.wheel(-100) mouse.leftClickAt(result[0], result[1] + 20) return True
def run(): print '--> mission Intercept The Sabateurs' if not ship.enableDefense(): return False if not drones.launchSmall(): return False overview.seekAndDestory() if not drones.back(): return False ship.enableAfterburn() if not overview.activateAccelerationGate(): return False # pocket 1 # main enemies are 90km away # approach for 85 secs # mean while clean up nearby enemy drones.launchSmall() if not overview.switchTo('battle'): return False if not overview.lockEnemy(20): return False ship.fireOnce() if not overview.lockTarget('transport', 1): return False ship.enableAfterburn() ship.approachFor(85) # wait for stop begin = time.time() while time.time() - begin < 20: ship.stop() key.pressEx(sc.Unlock) mouse.moveToP(panel.center(panel.Drones)) mouse.wheel(-100) while findAtDrones('fighting'): time.sleep(10) drones.back() # use sentry to destory all the smalls for i in range(6): overview.lockTarget('s', 1) drones.launchSentry() begin = time.time() while overview.lockTarget('s', 1) and time.time() - begin < 130: ship.fireOnce() drones.engage() drones.back() # do the rest ship.fireOnce() drones.launchSmall() overview.seekAndDestory() while not overview.pickCargo(): pass drones.back() print '<-- mission Intercept The Sabateurs\n' return True
def autopilot(): print '--> autopilot' overview.switchTo('pilot') while True: print 'try to find target stargate or station' finded = '' result = None for retry in range(3): print 'try: ' + str(retry + 1) result = findAtOverview('target_station', 0.2) if result: print 'station finded' finded = 'station' break result = findAtOverview('target_star_gate', 0.2) if result: print 'stargate finded' finded = 'gate' break x, y = panel.center(panel.Overview) y += random.random() * 200 - 100 mouse.leftClickAt(x, y) mouse.wheel(-12) mouse.moveToP(panel.center(panel.Full)) if finded == '': print "can't find any waypoint" print '<-- autopilot\n' return False if finded == 'station': print 'docking...' mouse.leftClickAtP(result) key.pressEx(sc.Activate) print 'wait until entering station' begin = time.time() result = findAtProgressBar('entering_station', 0.1) while not result and time.time() - begin < 80: result = findAtProgressBar('entering_station', 0.1) time.sleep(0.1) if result: print 'entering station' time.sleep(4) print '<-- autopilot\n' return True if finded == 'gate': print 'jump...' mouse.leftClickAtP(result) key.pressEx(sc.Activate) print 'wait until entering space' begin = time.time() result = findAtProgressBar('entering_space', 0.1) while not result and time.time() - begin < 80: result = findAtProgressBar('entering_space', 0.1) time.sleep(0.1) if result: print 'entering space' time.sleep(3)