Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def build(): return ogame.build(const.solar_plant.metal_mine, id)
def build(): return ogame.build(const.buildings.missile_silo, id)
def get_code(name):
if name in constants.Buildings.keys():
return constants.Buildings[name]
if name in constants.Facilities.keys():
return constants.Facilities[name]
if name in constants.Defense.keys():
return constants.Defense[name]
if name in constants.Ships.keys():
return constants.Ships[name]
if name in constants.Research.keys():
return constants.Research[name]
print('Couldn\'t find code for {}'.format(name))
return None
if not self.is_logged(res):
raise NOT_LOGGED
payload = {}
payload.update(get_hidden_fields(res))
for name, value in ships:
payload['am{}'.format(name)] = value
res = self.session.post(self.get_url('fleet2'), data=payload).content
payload = {}
payload.update(get_hidden_fields(res))
payload.update({'speed': speed,
'galaxy': where.get('galaxy'),
'system': where.get('system'),
'position': where.get('position'),
'type': where.get('type', 1)})
if mission == constants.Missions['RecycleDebrisField']:
# planet type: 1
# debris type: 2
# moon type: 3
payload.update({'type': 2}) # Send to debris field
res = self.session.post(self.get_url('fleet3'), data=payload).content
payload = {}
payload.update(get_hidden_fields(res))
payload.update({'crystal': resources.get('crystal'),
'deuterium': resources.get('deuterium'),
'metal': resources.get('metal'),
'mission': mission})
res = self.session.post(self.get_url('movement'), data=payload).content
res = self.session.get(self.get_url('movement')).content
soup = BeautifulSoup(res, 'html.parser')
def facilities(self, id):
response = self.session.get(self.index_php + 'page=ingame&component=facilities&cp={}'.format(id)).text
html = OGame.HTML(response)
levels = [int(level) for level in html.find_all('class', 'level', 'attribute', 'data-value', exact=True)]
status = html.find_all('data-technology', '', 'attribute', 'data-status')
class robotics_factory_class:
level = levels[0]
data = OGame.collect_status(status[0])
is_possible = data[0]
in_construction = data[1]
cost = const.price(const.buildings.robotics_factory, level=level)
class shipyard_class:
level = levels[1]
data = OGame.collect_status(status[1])
is_possible = data[0]
in_construction = data[1]
cost = const.price(const.buildings.shipyard, level=level)
class research_laboratory_class:
level = levels[2]
data = OGame.collect_status(status[2])
is_possible = data[0]
in_construction = data[1]
cost = const.price(const.buildings.research_laboratory, level=level)
class alliance_depot_class: