Beispiel #1
0
 class fleets_class:
     id = int(fleet_id.replace('eventRow-', ''))
     mission = int(fleet_mission)
     if fleet_returns == 'true':
         returns = True
     else:
         returns = False
     arrival = datetime.fromtimestamp(int(fleet_arrival))
     origin = const.convert_to_coordinates(fleet_origin)
     destination = const.convert_to_coordinates(fleet_destination)
     list = [id, mission, returns, arrival, origin, destination]
Beispiel #2
0
 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'))
     researchings = spy_html.find_all('class', 'research', 'attribute')
     for research in researchings:
         if research != 'research_imagefloat_left':
             tech.append(const.convert_tech(int(research.replace('research', '')), 'research'))
     technology = dict((tech, amount) for tech, amount in zip(tech, fright[7:]))
     list = [id, time, coordinates, resources, technology]
Beispiel #3
0
    def fleet_coordinates(self, event, Coords):
        coordinate = [coords.find(class_=Coords).a.text for coords in event]
        coordinate = [
            const.convert_to_coordinates(coords) for coords in coordinate
        ]
        destination = [
            dest.find('figure', {'class': 'planetIcon'}) for dest in event
        ]
        destination = [
            const.convert_to_destinations(dest['class'])
            for dest in destination
        ]
        coordinates = []
        for coords, dest in zip(coordinate, destination):
            coords.append(dest)
            coordinates.append(coords)

        return coordinates
Beispiel #4
0
 class Report:
     name = planet_coords.group(1)
     position = const.convert_to_coordinates(planet_coords.group(2))
     moon = bs4.find('figure', 'moon') is not None
     datetime = report_datetime
     metal = resources_data['metal']
     crystal = resources_data['crystal']
     deuterium = resources_data['deuterium']
     resources = [metal, crystal, deuterium]
     fleet = spied_data['ships']
     defenses = spied_data['defense']
     buildings = spied_data['buildings']
     research = spied_data['research']
     api = re.search(r'value=\'(.+?)\'', api_code).group(1)
     list = [
         name, position, moon, datetime, metal,
         crystal, deuterium, resources, fleet,
         defenses, buildings, research, api
     ]