Ejemplo n.º 1
0
    def generate_dts(self, locale, timezone, units):
        """ Return a dict with all the DTS for this event. """
        raid_end_time = get_time_as_str(self.raid_end, timezone)
        dts = self.custom_dts.copy()

        form_name = locale.get_form_name(self.mon_id, self.form_id)
        costume_name = locale.get_costume_name(self.mon_id, self.costume_id)

        boosted_weather_name = locale.get_weather_name(self.boosted_weather_id)
        weather_name = locale.get_weather_name(self.weather_id)

        type1 = locale.get_type_name(self.types[0])
        type2 = locale.get_type_name(self.types[1])

        cp_range = get_pokemon_cp_range(self.mon_id, self.boss_level)
        dts.update({
            # Identification
            'gym_id':
            self.gym_id,

            # Time Remaining
            'raid_time_left':
            raid_end_time[0],
            '12h_raid_end':
            raid_end_time[1],
            '24h_raid_end':
            raid_end_time[2],

            # Time Remaining Without Seconds
            'raid_time_no_secs':
            raid_end_time[3],
            '12h_raid_end_no_secs':
            raid_end_time[4],
            '24h_raid_end_no_secs':
            raid_end_time[5],

            # Raw time remaining values
            'raid_time_raw_hours':
            raid_end_time[6],
            'raid_time_raw_minutes':
            raid_end_time[7],
            'raid_time_raw_seconds':
            raid_end_time[8],

            # Type
            'type1':
            type1,
            'type1_or_empty':
            Unknown.or_empty(type1),
            'type1_emoji':
            Unknown.or_empty(get_type_emoji(self.types[0])),
            'type2':
            type2,
            'type2_or_empty':
            Unknown.or_empty(type2),
            'type2_emoji':
            Unknown.or_empty(get_type_emoji(self.types[1])),
            'types':
            ("{}/{}".format(type1, type2) if Unknown.is_not(type2) else type1),
            'types_emoji':
            ("{}{}".format(get_type_emoji(self.types[0]),
                           get_type_emoji(self.types[1]))
             if Unknown.is_not(type2) else get_type_emoji(self.types[0])),

            # Form
            'form':
            form_name,
            'form_or_empty':
            Unknown.or_empty(form_name),
            'form_id':
            self.form_id,
            'form_id_2':
            "{:02d}".format(self.form_id),
            'form_id_3':
            "{:03d}".format(self.form_id),

            # Costume
            'costume':
            costume_name,
            'costume_or_empty':
            Unknown.or_empty(costume_name),
            'costume_id':
            self.costume_id,
            'costume_id_2':
            "{:02d}".format(self.costume_id),
            'costume_id_3':
            "{:03d}".format(self.costume_id),

            # Location
            'lat':
            self.lat,
            'lng':
            self.lng,
            'lat_5':
            "{:.5f}".format(self.lat),
            'lng_5':
            "{:.5f}".format(self.lng),
            'distance': (get_dist_as_str(self.distance, units)
                         if Unknown.is_not(self.distance) else Unknown.SMALL),
            'direction':
            self.direction,
            'gmaps':
            get_gmaps_link(self.lat, self.lng),
            'applemaps':
            get_applemaps_link(self.lat, self.lng),
            'waze':
            get_waze_link(self.lat, self.lng),
            'geofence':
            self.geofence,

            # Weather
            'weather_id':
            self.weather_id,
            'weather':
            weather_name,
            'weather_or_empty':
            Unknown.or_empty(weather_name),
            'weather_emoji':
            get_weather_emoji(self.weather_id),
            'boosted_weather_id':
            self.boosted_weather_id,
            'boosted_weather':
            boosted_weather_name,
            'boosted_weather_or_empty':
            ('' if self.boosted_weather_id == 0 else
             Unknown.or_empty(boosted_weather_name)),
            'boosted_weather_emoji':
            get_weather_emoji(self.boosted_weather_id),
            'boosted_or_empty':
            locale.get_boosted_text() if self.boss_level == 25 else '',

            # Raid Info
            'raid_lvl':
            self.raid_lvl,
            'mon_name':
            locale.get_pokemon_name(self.mon_id),
            'mon_id':
            self.mon_id,
            'mon_id_3':
            "{:03}".format(self.mon_id),
            'gender':
            self.gender,
            # TODO: Form?

            # Quick Move
            'quick_move':
            locale.get_move_name(self.quick_id),
            'quick_id':
            self.quick_id,
            'quick_type_id':
            self.quick_type,
            'quick_type':
            locale.get_type_name(self.quick_type),
            'quick_type_emoji':
            get_type_emoji(self.quick_type),
            'quick_damage':
            self.quick_damage,
            'quick_dps':
            self.quick_dps,
            'quick_duration':
            self.quick_duration,
            'quick_energy':
            self.quick_energy,

            # Charge Move
            'charge_move':
            locale.get_move_name(self.charge_id),
            'charge_id':
            self.charge_id,
            'charge_type_id':
            self.charge_type,
            'charge_type':
            locale.get_type_name(self.charge_type),
            'charge_type_emoji':
            get_type_emoji(self.charge_type),
            'charge_damage':
            self.charge_damage,
            'charge_dps':
            self.charge_dps,
            'charge_duration':
            self.charge_duration,
            'charge_energy':
            self.charge_energy,

            # CP info
            'cp':
            self.cp,
            'min_cp':
            cp_range[0],
            'max_cp':
            cp_range[1],

            # Gym Details
            'gym_name':
            self.gym_name,
            'gym_description':
            self.gym_description,
            'gym_image':
            self.gym_image,
            'sponsor_id':
            self.sponsor_id,
            'sponsored':
            self.sponsor_id > 0
            if Unknown.is_not(self.sponsor_id) else Unknown.REGULAR,
            'ex_eligible':
            self.ex_eligible > 0
            if Unknown.is_not(self.ex_eligible) else Unknown.REGULAR,
            'ex_eligible_emoji':
            get_ex_eligible_emoji(self.ex_eligible),
            'park':
            self.park,
            'team_id':
            self.current_team_id,
            'team_emoji':
            get_team_emoji(self.current_team_id),
            'team_name':
            locale.get_team_name(self.current_team_id),
            'team_color':
            locale.get_team_color(self.current_team_id),
            'team_leader':
            locale.get_leader_name(self.current_team_id)
        })
        return dts
Ejemplo n.º 2
0
    def generate_dts(self, locale, timezone, units):
        """ Return a dict with all the DTS for this event. """
        raid_end_time = get_time_as_str(self.raid_end, timezone)
        dts = self.custom_dts.copy()

        exraid = self.gym_park
        if exraid == 'unknown':
            exraid = ''
        else:
            exraid = "\n*Potential EX Raid (" + exraid + ")*"

        boosted_weather_name = locale.get_weather_name(self.boosted_weather_id)
        weather_name = locale.get_weather_name(self.weather_id)

        type1 = locale.get_type_name(self.types[0])
        type2 = locale.get_type_name(self.types[1])

        cp_range = get_pokemon_cp_range(self.mon_id, self.boss_level)
        dts.update({
            # Identification
            'gym_id':
            self.gym_id,

            # Time Remaining
            'raid_time_left':
            raid_end_time[0],
            '12h_raid_end':
            raid_end_time[1],
            '24h_raid_end':
            raid_end_time[2],

            # Type
            'type1':
            type1,
            'type1_or_empty':
            Unknown.or_empty(type1),
            'type1_emoji':
            Unknown.or_empty(get_type_emoji(self.types[0])),
            'type2':
            type2,
            'type2_or_empty':
            Unknown.or_empty(type2),
            'type2_emoji':
            Unknown.or_empty(get_type_emoji(self.types[1])),
            'types':
            ("{}/{}".format(type1, type2) if Unknown.is_not(type2) else type1),
            'types_emoji':
            ("{}{}".format(get_type_emoji(self.types[0]),
                           get_type_emoji(self.types[1]))
             if Unknown.is_not(type2) else get_type_emoji(self.types[0])),

            # Location
            'lat':
            self.lat,
            'lng':
            self.lng,
            'lat_5':
            "{:.5f}".format(self.lat),
            'lng_5':
            "{:.5f}".format(self.lng),
            'distance': (get_dist_as_str(self.distance, units)
                         if Unknown.is_not(self.distance) else Unknown.SMALL),
            'direction':
            self.direction,
            'gmaps':
            get_gmaps_link(self.lat, self.lng),
            'applemaps':
            get_applemaps_link(self.lat, self.lng),
            'geofence':
            self.geofence,
            'station':
            self.station,

            # Weather
            'weather_id':
            self.weather_id,
            'weather':
            weather_name,
            'weather_or_empty':
            Unknown.or_empty(weather_name),
            'weather_emoji':
            get_weather_emoji(self.weather_id),
            'boosted_weather_id':
            self.boosted_weather_id,
            'boosted_weather':
            boosted_weather_name,
            'boosted_weather_or_empty':
            ('' if self.boosted_weather_id == 0 else
             Unknown.or_empty(boosted_weather_name)),
            'boosted_weather_emoji':
            get_weather_emoji(self.boosted_weather_id),
            'boosted_or_empty':
            locale.get_boosted_text() if self.boss_level == 25 else '',

            # Raid Info
            'raid_lvl':
            self.raid_lvl,
            'mon_name':
            locale.get_pokemon_name(self.mon_id),
            'mon_id':
            self.mon_id,
            'mon_id_3':
            "{:03}".format(self.mon_id),
            # TODO: Form?

            # Quick Move
            'quick_move':
            locale.get_move_name(self.quick_id),
            'quick_id':
            self.quick_id,
            'quick_damage':
            self.quick_damage,
            'quick_dps':
            self.quick_dps,
            'quick_duration':
            self.quick_duration,
            'quick_energy':
            self.quick_energy,

            # Charge Move
            'charge_move':
            locale.get_move_name(self.charge_id),
            'charge_id':
            self.charge_id,
            'charge_damage':
            self.charge_damage,
            'charge_dps':
            self.charge_dps,
            'charge_duration':
            self.charge_duration,
            'charge_energy':
            self.charge_energy,

            # CP info
            'cp':
            self.cp,
            'min_cp':
            cp_range[0],
            'max_cp':
            cp_range[1],

            # Gym Details
            'gym_name':
            self.gym_name,
            'gym_description':
            self.gym_description,
            'gym_image':
            self.gym_image,
            'gym_sponsor':
            self.gym_sponsor,
            'gym_park':
            exraid,
            'team_id':
            self.current_team_id,
            'team_name':
            locale.get_team_name(self.current_team_id),
            'team_leader':
            locale.get_leader_name(self.current_team_id)
        })
        return dts
Ejemplo n.º 3
0
    def generate_dts(self, locale):
        """ Return a dict with all the DTS for this event. """
        raid_end_time = get_time_as_str(self.raid_end)
        dts = self.custom_dts.copy()
        cp_range = get_pokemon_cp_range(self.mon_id, 20)
        dts.update({
            # Identification
            'gym_id':
            self.gym_id,

            # Time Remaining
            'raid_time_left':
            raid_end_time[0],
            '12h_raid_end':
            raid_end_time[1],
            '24h_raid_end':
            raid_end_time[2],

            # Location
            'lat':
            self.lat,
            'lng':
            self.lng,
            'lat_5':
            "{:.5f}".format(self.lat),
            'lng_5':
            "{:.5f}".format(self.lng),
            'distance': (get_dist_as_str(self.distance)
                         if Unknown.is_not(self.distance) else Unknown.SMALL),
            'direction':
            self.direction,
            'gmaps':
            get_gmaps_link(self.lat, self.lng),
            'applemaps':
            get_applemaps_link(self.lat, self.lng),
            'geofence':
            self.geofence,

            # Raid Info
            'raid_lvl':
            self.raid_lvl,
            'mon_name':
            locale.get_pokemon_name(self.mon_id),
            'mon_id':
            self.mon_id,
            'mon_id_3':
            "{:03}".format(self.mon_id),
            # TODO: Form?

            # Quick Move
            'quick_move':
            locale.get_move_name(self.quick_id),
            'quick_id':
            self.quick_id,
            'quick_damage':
            self.quick_damage,
            'quick_dps':
            self.quick_dps,
            'quick_duration':
            self.quick_duration,
            'quick_energy':
            self.quick_energy,
            # Charge Move
            'charge_move':
            locale.get_move_name(self.charge_id),
            'charge_id':
            self.charge_id,
            'charge_damage':
            self.charge_damage,
            'charge_dps':
            self.charge_dps,
            'charge_duration':
            self.charge_duration,
            'charge_energy':
            self.charge_energy,
            # Potential CP
            'min_cp':
            cp_range[0],
            'max_cp':
            cp_range[1],

            # Gym Details
            'gym_name':
            self.gym_name,
            'gym_description':
            self.gym_description,
            'gym_image':
            self.gym_image,
            'team_id':
            self.current_team_id,
            'team_name':
            locale.get_team_name(self.current_team_id),
            'team_leader':
            locale.get_leader_name(self.current_team_id)
        })
        return dts