def login(): try: arg = request.get_json() global empire empire = OGame(**arg) return {'login': '******'} except: return {'login': '******'}, 400
def __init__(self, universe, username, password, server, delay=60, gap=60): self.ogame = OGame(universe, username, password, server) self.planet_ids = self.ogame.get_planet_ids() self.delay = delay self.gap = gap self.resources = {} self.resources_buildings = {} self.research = {}
def login(self, universe, user, password): pc.yellow("Logging in with %s" % user, end=" ") try: self.ogame = OGame(universe, user, password) except Exception as e: pp.red("Failed to login %s. Exception: " % user + str(e)) else: if self.ogame.is_logged(): pc.green("Success!") for p in self.planets: p.ogame = self.ogame
def log_in(): return OGame('Indus', '*****@*****.**', '1101982.Password')
from ogame import OGame from ogame.constants import Ships, Speed, Missions, Buildings, Research, Defense, Facilities ogame = OGame("Indus", "*****@*****.**", "1101982.Ogame") def check_energy(planet_name): return (ogame.get_resources( ogame.get_planet_by_name(planet_name)))["energy"] < 0 def building_in_construction(planet_name): return ogame.get_overview( ogame.get_planet_by_name(planet_name))["buildings"] != "" def build_resources(planet_name): """Checking first if needed energy and try to build energy resources, and after, trying for building other resources""" if check_energy(planet_name): print("Trying to create more energy for the planet %s" % planet_name) for i in ["SolarPlant", "FusionReactor"]: ogame.build_building(ogame.get_planet_by_name(planet_name), Buildings[i]) if len(ogame.get_overview(planet_name)["buildings"]) != 0: break else: print("Trying build resources for the planet %s" % planet_name) for k in [ "CrystalMine", "MetalMine",
from ogame import OGame from ogame.constants import Ships, Speed, Missions, Buildings, Research, Defense, Facilities ogame = OGame("Indus", "*****@*****.**", "1101982.Password") def deploy_fleet_to_moon_Milan(planet_name='Milan'): ships = [(Ships['LightFighter'], 999), (Ships['Cruiser'], 999), (Ships['Recycler'], 999), (Ships['Battleship'], 999), (Ships['Bomber'], 999), (Ships['Destroyer'], 999), (Ships['Battlecruiser'], 999)] speed = Speed["100%"] where = {'galaxy': 2, 'system': 335, 'position': 4, 'type': 3} mission = Missions["Park"] resources = {"metal": 99, "crystal": 99, "deuterium": 9999} ogame.send_fleet(ogame.get_planet_by_name(planet_name), ships, speed, where, mission, resources) def deploy_fleet_to_moon_Rome(planet_name='Rome'): ships = [(Ships['LightFighter'], 999), (Ships['Cruiser'], 999), (Ships['Recycler'], 999), (Ships['Battleship'], 999), (Ships['Bomber'], 999), (Ships['Destroyer'], 999), (Ships['Battlecruiser'], 999)] speed = Speed["100%"] where = {'galaxy': 3, 'system': 498, 'position': 6, 'type': 3} mission = Missions["Park"] resources = {"metal": 99, "crystal": 99, "deuterium": 9999} ogame.send_fleet(ogame.get_planet_by_name(planet_name), ships, speed, where, mission, resources)
config = load_config(args.config) client_params = parse_client_config(config) bot_params = parse_bot_config(config) listeners = parse_listener_config(config) expeditions = parse_expedition_config(config) logging.debug('Loaded config from %s', args.config) # Scheduler notifies Cruiser about any new events # (e.g. when it's time to defend a planet!). scheduler = Scheduler() # Client controls the account. It provides an interface to # download and parse information from the OGame server as well as # send commands to the servers. client = OGame(**client_params) # Cruiser makes the decisions. It receives events from the scheduler # and acts accordingly. It's decision making is based on the # information the client provides. bot = OGameBot(client, scheduler, **bot_params) # Add listeners (e.g. Telegram) that will notify users about # important events (e.g. planet under attack). for listener in listeners: bot.add_listener(listener) logging.debug('Added listener: %s', type(listener).__name__) # Schedule expeditions if they were defined. for expedition in expeditions: scheduler.push(
def log_in(): return OGame('Indus', '*****@*****.**', '1101982.Ogame')
def login(): return OGame('Yildun', '*****@*****.**', 'trolona')
import sys from decouple import config from ogame import OGame from ogame.constants import Ships, Speed, Missions, Buildings, Research, Defense ogame = OGame(config('UNIVERSE'), config('USERNAME'), config('PASSWORD')) def farm(origin, destination): ships = [(Ships['SmallCargo'], 100)] ogame.send_fleet(origin['id'], ships, Speed['100%'], destination['coordinates'], Missions['Attack'], {}) print(ships, destination) def fleet(origin, destination): availableShips = ogame.get_ships(origin['id']) availableResources = ogame.get_resources(origin['id']) smallCargoes = largeCargoes = 0 resources = {'metal': 0, 'crystal': 0, 'deuterium': 0} # Prioritize deuterim, then crystal and then metal for resource in ['deuterium', 'crystal', 'metal']: for i in range(availableShips['small_cargo']): if (availableResources[resource] > 0 and availableShips['small_cargo'] > 0): amount = min(10000, availableResources[resource]) resources[resource] += amount availableResources[resource] -= amount
response = empire.session.get('https://gf{}.geo.gfsrv.net/{}/{}'.format( nr, dir, res)).content return send_file(BytesIO(response), attachment_filename=res) @barakis.route('/bot_settings', methods=['POST']) def set_settings(): new_settings = dict(request.form) for setting in bot_settings: bot_settings[setting] = '' for setting, value in new_settings.items(): bot_settings[setting] = value Thread(target=bot.start_tasks, args=(empire, )).start() return redirect('/') if universum == '' or username == '' or password == '': print('PLS input User Info') universum = input('Universum: ') username = input('Usernameor Email: ') password = input('Password: '******'Bad Login') worker = Thread(target=bot.worker, args=(empire, )) worker.start() proxy = WSGIServer((ip_adress, 5000), barakis) print('Visit: http://{}:5000'.format(ip_adress)) proxy.serve_forever()