How to use the ogame.constants.destination function in ogame

To help you get started, weā€™ve selected a few ogame examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github alaingilbert / pyogame / ogame / __init__.py View on Github external
def celestial_coordinates(self, id):
        celestial = self.landing_page.find_all('title', 'componentgalaxy&cp{}'.format(id), 'attribute')
        coordinates = celestial[0].split('componentgalaxy&cp{}&'.format(id))[1].split('"')[0] \
            .replace('&amp', '').replace('galaxy', '').replace('system', '').replace('position', '').split(';')
        if 'moon' in self.landing_page.find_all('title', 'galaxy&cp{}'.format(id), 'attribute', 'class')[0]:
            coordinates.append(const.destination.moon)
        else:
            coordinates.append(const.destination.planet)
        return coordinates
github alaingilbert / pyogame / ogame / __init__.py View on Github external
def celestial_coordinates(self, id):
        celestial = self.landing_page.find_all('title', 'componentgalaxy&cp{}'.format(id), 'attribute')
        coordinates = celestial[0].split('componentgalaxy&cp{}&'.format(id))[1].split('"')[0] \
            .replace('&amp', '').replace('galaxy', '').replace('system', '').replace('position', '').split(';')
        if 'moon' in self.landing_page.find_all('title', 'galaxy&cp{}'.format(id), 'attribute', 'class')[0]:
            coordinates.append(const.destination.moon)
        else:
            coordinates.append(const.destination.planet)
        return coordinates
github alaingilbert / pyogame / ogame / __init__.py View on Github external
response = self.session.get(
                url=self.index_php + 'page=messages&messageId={}&tabid={}&ajax=1'
                .format(message, const.messages.spy_reports)
            ).text
            spy_html = OGame.HTML(response)
            fright = spy_html.find_all('class', 'fright', 'value')
            fright.pop()
            if len(fright) > 10:  # non Spyreports are less than 10

                class spy_report_class:
                    id = message
                    coordinates = const.convert_to_coordinates(response)
                    if spy_html.find_all('class', 'planetIcon', 'attribute') is not []:
                        coordinates.append(const.destination.planet)
                    else:
                        coordinates.append(const.destination.moon)
                    time = datetime.strptime(fright[5], '%d.%m.%Y%H:%M:%S')
                    resources = spy_html.find_all('class', 'resource_list', 'attribute', 'title')
                    resources = [resources[0], resources[1], resources[2]]
                    resources = [int(resource.replace('.', '')) for resource in resources]
                    tech = []
                    fleets = spy_html.find_all('class', 'tech', 'attribute')
                    for fleet in fleets:
                        tech.append(const.convert_tech(int(fleet.replace('tech', '')), 'shipyard'))
                    defences = spy_html.find_all('class', 'defense', 'attribute')
                    for defence in defences:
                        if defence != 'defense_imagefloat_left':
                            tech.append(const.convert_tech(int(defence.replace('defense', '')), 'defenses'))
                    buildings = spy_html.find_all('class', 'building', 'attribute')
                    for building in buildings:
                        if building != 'building_imagefloat_left':
                            tech.append(const.convert_tech(int(building.replace('building', '')), 'supplies'))
github alaingilbert / pyogame / ogame / constants.py View on Github external
def coordinates(galaxy, system, position=None, dest=destination.planet):
    return [galaxy, system, position, dest]