def generate_dts(self, locale, timezone, units): """ Return a dict with all the DTS for this event. """ hatch_time = get_time_as_str(self.hatch_time, timezone) raid_end_time = get_time_as_str(self.raid_end, timezone) weather_name = locale.get_weather_name(self.weather_id) dts = self.custom_dts.copy() dts.update({ # Identification 'gym_id': self.gym_id, # Time Remaining 'hatch_time_left': hatch_time[0], '12h_hatch_time': hatch_time[1], '24h_hatch_time': hatch_time[2], '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, 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_id': self.weather_id, 'weather': weather_name, 'weather_or_empty': Unknown.or_empty(weather_name), 'weather_emoji': get_weather_emoji(self.weather_id), # Egg info 'egg_lvl': self.egg_lvl, # 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, 'park': self.park, '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
def generate_dts(self, locale): """ Return a dict with all the DTS for this event. """ time = get_time_as_str(self.expiration) dts = self.custom_dts.copy() dts.update({ # Identification 'stop_id': self.stop_id, # Time left 'time_left': time[0], '12h_time': time[1], '24h_time': time[2], # Location 'lat': self.lat, 'lng': self.lng, 'lat_5': "{:.5f}".format(self.lat), 'lng_5': "{:.5f}".format(self.lat), '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 }) return dts
def generate_dts(self, locale, timezone, units): """ Return a dict with all the DTS for this event. """ time = get_time_as_str(self.expiration, timezone) dts = self.custom_dts.copy() dts.update({ # Identification 'stop_id': self.stop_id, # Time left 'time_left': time[0], '12h_time': time[1], '24h_time': time[2], # Location 'lat': self.lat, 'lng': self.lng, 'lat_5': "{:.5f}".format(self.lat), 'lng_5': "{:.5f}".format(self.lat), '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 }) return dts
def generate_dts(self, locale, timezone, units): """ Return a dict with all the DTS for this event. """ time_changed = get_time_as_str(self.time_changed) dts = self.custom_dts.copy() dts.update({ # Identification 'alert_type': self.alert_type, 'weather_cell_id': self.weather_cell_id, # Time Remaining '12h_time_weather_changed': time_changed[1], '24h_time_weather_changed': time_changed[2], # Location 'coords': self.coords, 'channel_id': self.channel_id, 'geofence': self.geofence, 'geofence_list': self.geofence_list, # Weather info 'condition': self.condition, 'weather': locale.get_weather_name(self.condition), 'weather_emoji': get_weather_emoji(self.condition), 'alert_severity': self.alert_severity, 'warn': self.warn, 'day': self.day }) return dts
def startup_message(self): if self.__startup_message: timestamps = get_time_as_str(datetime.utcnow()) args = { "status": "{}- PokeAlarm activated!" .format(timestamps[2]) } try_sending(log, self.connect, "Twitter", self.send_tweet, args) log.info("Startup tweet sent!")
def startup_message(self): if self.__startup_message: timestamps = get_time_as_str(datetime.utcnow()) args = { "status": "{}- PokeAlarm activated!" .format(timestamps[2]) } try_sending( self._log, self.connect, "Twitter", self.send_tweet, args) self._log.info("Startup tweet sent!")
def generate_dts(self, locale, timezone, units): """ Return a dict with all the DTS for this event. """ time = get_time_as_str(self.expiration, timezone) dts = self.custom_dts.copy() type_name = locale.get_grunt_type_name(self.type_id) dts.update({ # Identification 'stop_id': self.stop_id, # Details 'stop_name': self.stop_name, 'stop_image': self.stop_image, 'type_id': self.type_id, 'type_id_3': "{:03}".format(self.type_id), 'type_name': type_name, 'type_emoji': get_type_emoji(get_grunt_type_id(type_name)), 'gender_id': self.gender_id, 'gender': self.gender, # ToDo: Add reward (should probably be sent via webhook) # Time left 'time_left': time[0], '12h_time': time[1], '24h_time': time[2], 'time_left_no_secs': time[3], '12h_time_no_secs': time[4], '24h_time_no_secs': time[5], 'time_left_raw_hours': time[6], 'time_left_raw_minutes': time[7], 'time_left_raw_seconds': time[8], # 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 }) return dts
def generate_dts(self, locale): """ Return a dict with all the DTS for this event. """ time = get_time_as_str(self.disappear_time) form_name = locale.get_form_name(self.monster_id, self.form_id) weather_name = locale.get_weather_name(self.weather_id) dts = self.custom_dts.copy() dts.update({ # Identification 'encounter_id': self.enc_id, 'mon_name': locale.get_pokemon_name(self.monster_id), 'mon_id': self.monster_id, 'mon_id_3': "{:03}".format(self.monster_id), # Time Remaining 'time_left': time[0], '12h_time': time[1], '24h_time': time[2], # Spawn Data 'spawn_start': self.spawn_start, 'spawn_end': self.spawn_end, 'spawn_verified': self.spawn_verified, # 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, 'weather_id': self.weather_id, 'weather': weather_name, 'weather_or_empty': Unknown.or_empty(weather_name), 'weather_emoji': get_weather_emoji(self.weather_id), # Encounter Stats 'mon_lvl': self.mon_lvl, 'cp': self.cp, # IVs 'iv_0': ("{:.0f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.TINY), 'iv': ("{:.1f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.SMALL), 'iv_2': ("{:.2f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.SMALL), 'atk': self.atk_iv, 'def': self.def_iv, 'sta': self.sta_iv, # Form 'form': form_name, 'form_or_empty': Unknown.or_empty(form_name), 'form_id': self.form_id, 'form_id_3': "{:03d}".format(self.form_id), # Quick Move 'quick_move': locale.get_move_name(self.quick_move_id), 'quick_id': self.quick_move_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_move_id), 'charge_id': self.charge_move_id, 'charge_damage': self.charge_damage, 'charge_dps': self.charge_dps, 'charge_duration': self.charge_duration, 'charge_energy': self.charge_energy, # Cosmetic 'gender': self.gender, 'height': self.height, 'weight': self.weight, 'size': self.size, # Misc 'big_karp': ('big' if self.monster_id == 129 and Unknown.is_not(self.weight) and self.weight >= 13.13 else ''), 'tiny_rat': ('tiny' if self.monster_id == 19 and Unknown.is_not(self.weight) and self.weight <= 2.41 else '') }) return dts
def generate_dts(self, locale, timezone, units): """ Return a dict with all the DTS for this event. """ time = get_time_as_str(self.disappear_time, timezone) form_name = locale.get_form_name(self.monster_id, self.form_id) costume_name = locale.get_costume_name(self.monster_id, self.costume_id) weather_name = locale.get_weather_name(self.weather_id) boosted_weather_name = locale.get_weather_name(self.boosted_weather_id) type1 = locale.get_type_name(self.types[0]) type2 = locale.get_type_name(self.types[1]) dts = self.custom_dts.copy() dts.update({ # Identification 'encounter_id': self.enc_id, 'mon_name': locale.get_pokemon_name(self.monster_id), 'mon_id': self.monster_id, 'mon_id_3': "{:03}".format(self.monster_id), # Time Remaining 'time_left': time[0], '12h_time': time[1], '24h_time': time[2], # Spawn Data 'spawn_start': self.spawn_start, 'spawn_end': self.spawn_end, 'spawn_verified': self.spawn_verified, # 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, # 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 \ Unknown.is_not(self.boosted_weather_id) and self.boosted_weather_id != 0 else '', # Encounter Stats 'mon_lvl': self.mon_lvl, 'cp': self.cp, # IVs 'iv_0': ( "{:.0f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.TINY), 'iv': ( "{:.1f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.SMALL), 'iv_2': ( "{:.2f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.SMALL), 'atk': self.atk_iv, 'def': self.def_iv, 'sta': self.sta_iv, # 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_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_3': "{:03d}".format(self.costume_id), # 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, # Cosmetic 'gender': self.gender, 'height_0': ( "{:.0f}".format(self.height) if Unknown.is_not(self.height) else Unknown.TINY), 'height': ( "{:.1f}".format(self.height) if Unknown.is_not(self.height) else Unknown.SMALL), 'height_2': ( "{:.2f}".format(self.height) if Unknown.is_not(self.height) else Unknown.SMALL), 'weight_0': ( "{:.0f}".format(self.weight) if Unknown.is_not(self.weight) else Unknown.TINY), 'weight': ( "{:.1f}".format(self.weight) if Unknown.is_not(self.weight) else Unknown.SMALL), 'weight_2': ( "{:.2f}".format(self.weight) if Unknown.is_not(self.weight) else Unknown.SMALL), 'size': locale.get_size_name(self.size_id), # Attack rating 'atk_grade': ( Unknown.or_empty(self.atk_grade, Unknown.TINY)), 'def_grade': ( Unknown.or_empty(self.def_grade, Unknown.TINY)), # Catch Prob 'base_catch_0': ( "{:.0f}".format(self.base_catch * 100) if Unknown.is_not(self.base_catch) else Unknown.TINY), 'base_catch': ( "{:.1f}".format(self.base_catch * 100) if Unknown.is_not(self.base_catch) else Unknown.SMALL), 'base_catch_2': ( "{:.2f}".format(self.base_catch * 100) if Unknown.is_not(self.base_catch) else Unknown.SMALL), 'great_catch_0': ( "{:.0f}".format(self.great_catch * 100) if Unknown.is_not(self.great_catch) else Unknown.TINY), 'great_catch': ( "{:.1f}".format(self.great_catch * 100) if Unknown.is_not(self.great_catch) else Unknown.SMALL), 'great_catch_2': ( "{:.2f}".format(self.great_catch * 100) if Unknown.is_not(self.great_catch) else Unknown.SMALL), 'ultra_catch_0': ( "{:.0f}".format(self.ultra_catch * 100) if Unknown.is_not(self.ultra_catch) else Unknown.TINY), 'ultra_catch': ( "{:.1f}".format(self.ultra_catch * 100) if Unknown.is_not(self.ultra_catch) else Unknown.SMALL), 'ultra_catch_2': ( "{:.2f}".format(self.ultra_catch * 100) if Unknown.is_not(self.ultra_catch) else Unknown.SMALL), # Misc 'big_karp': ( 'big' if self.monster_id == 129 and Unknown.is_not(self.weight) and self.weight >= 13.13 else ''), 'tiny_rat': ( 'tiny' if self.monster_id == 19 and Unknown.is_not(self.weight) and self.weight <= 2.41 else '') }) return dts
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
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
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
def startup_message(self): if self.__startup_message: timestamps = get_time_as_str(datetime.utcnow()) self.post_to_wall("{} - PokeAlarm has initialized!".format( timestamps[2])) log.info("Startup message sent!")
def generate_dts(self, locale, timezone, units): """ Return a dict with all the DTS for this event. """ time = get_time_as_str(self.disappear_time, timezone) form_name = locale.get_form_name(self.monster_id, self.form_id) costume_name = locale.get_costume_name(self.monster_id, self.costume_id) weather_name = locale.get_weather_name(self.weather_id) boosted_weather_name = locale.get_weather_name(self.boosted_weather_id) type1 = locale.get_type_name(self.types[0]) type2 = locale.get_type_name(self.types[1]) dts = self.custom_dts.copy() dts.update({ # Identification 'encounter_id': self.enc_id, 'mon_name': locale.get_pokemon_name(self.monster_id), 'mon_id': self.monster_id, 'mon_id_3': "{:03}".format(self.monster_id), # Time Remaining 'time_left': time[0], '12h_time': time[1], '24h_time': time[2], 'time_left_no_secs': time[3], '12h_time_no_secs': time[4], '24h_time_no_secs': time[5], 'time_left_raw_hours': time[6], 'time_left_raw_minutes': time[7], 'time_left_raw_seconds': time[8], # Spawn Data 'spawn_start': self.spawn_start, 'spawn_end': self.spawn_end, 'spawn_verified': self.spawn_verified > 0 if Unknown.is_not(self.spawn_verified) else Unknown.REGULAR, 'spawn_verified_emoji': get_spawn_verified_emoji(self.spawn_verified), 'spawn_verified_emoji_or_empty': ( '' if self.spawn_verified != 1 else get_spawn_verified_emoji(self.spawn_verified)), 'spawn_unverified_emoji_or_empty': ( '' if self.spawn_verified != 0 else get_spawn_verified_emoji(self.spawn_verified)), # 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 \ Unknown.is_not(self.boosted_weather_id) and self.boosted_weather_id != 0 else '', # Encounter Stats 'mon_lvl': self.mon_lvl, 'cp': self.cp, # IVs 'iv_0': ( "{:.0f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.TINY), 'iv': ( "{:.1f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.SMALL), 'iv_2': ( "{:.2f}".format(self.iv) if Unknown.is_not(self.iv) else Unknown.SMALL), 'atk': self.atk_iv, 'def': self.def_iv, 'sta': self.sta_iv, # PVP Information 'great_mon_id': self.great_id, 'great_product': self.great_product, 'great_mon_name': locale.get_pokemon_name(self.great_id), 'great_cp': self.great_cp, 'great_level': self.great_level, 'great_url': 'https://www.stadiumgaming.gg/rank-checker?' + urlencode({ 'pokemon': re.sub(r'[^A-Za-z0-9\s]+', '', locale.get_english_pokemon_name( self.great_id)), 'league': '1500', 'att_iv': self.atk_iv, 'def_iv': self.def_iv, 'hp_iv': self.sta_iv, 'min_iv': '0', 'include-best-buddy': 'false' }), 'great_pvpoke': 'https://pvpoke.com/rankings/all/1500/overall/{}{}/'.format( re.sub(r'[^A-Za-z0-9\s]+', '', locale.get_english_pokemon_name(self.great_id)) .lower().replace(' ', '_'), '_' + re.sub(r'[^A-Za-z0-9\s]+', '', locale.get_english_form_name( self.great_id, self.form_id) .lower().replace(' ', '_')) if not any(x in locale.get_english_form_name( self.great_id, self.form_id) for x in ['unknown', 'Normal']) else ''), 'ultra_mon_id': self.ultra_id, 'ultra_product': self.ultra_product, 'ultra_mon_name': locale.get_pokemon_name(self.ultra_id), 'ultra_cp': self.ultra_cp, 'ultra_level': self.ultra_level, 'ultra_url': 'https://www.stadiumgaming.gg/rank-checker?' + urlencode({ 'pokemon': re.sub(r'[^A-Za-z0-9\s]+', '', locale.get_english_pokemon_name( self.ultra_id)), 'league': '2500', 'att_iv': self.atk_iv, 'def_iv': self.def_iv, 'hp_iv': self.sta_iv, 'min_iv': '0', 'include-best-buddy': 'false' }), 'ultra_pvpoke': 'https://pvpoke.com/rankings/all/2500/overall/{}{}/'.format( re.sub(r'[^A-Za-z0-9\s]+', '', locale.get_english_pokemon_name(self.ultra_id)) .lower().replace(' ', '_'), '_' + re.sub(r'[^A-Za-z0-9\s]+', '', locale.get_english_form_name( self.ultra_id, self.form_id) .lower().replace(' ', '_')) if not any(x in locale.get_english_form_name( self.ultra_id, self.form_id) for x in ['unknown', 'Normal']) else ''), # 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), # 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, # Cosmetic 'gender': self.gender, 'height_0': ( "{:.0f}".format(self.height) if Unknown.is_not(self.height) else Unknown.TINY), 'height': ( "{:.1f}".format(self.height) if Unknown.is_not(self.height) else Unknown.SMALL), 'height_2': ( "{:.2f}".format(self.height) if Unknown.is_not(self.height) else Unknown.SMALL), 'weight_0': ( "{:.0f}".format(self.weight) if Unknown.is_not(self.weight) else Unknown.TINY), 'weight': ( "{:.1f}".format(self.weight) if Unknown.is_not(self.weight) else Unknown.SMALL), 'weight_2': ( "{:.2f}".format(self.weight) if Unknown.is_not(self.weight) else Unknown.SMALL), 'size': locale.get_size_name(self.size_id), # Misc 'atk_grade': ( Unknown.or_empty(self.atk_grade, Unknown.TINY)), 'def_grade': ( Unknown.or_empty(self.def_grade, Unknown.TINY)), 'rarity_id': self.rarity_id, 'rarity': locale.get_rarity_name(self.rarity_id), # Catch Prob 'base_catch_0': ( "{:.0f}".format(self.base_catch * 100) if Unknown.is_not(self.base_catch) else Unknown.TINY), 'base_catch': ( "{:.1f}".format(self.base_catch * 100) if Unknown.is_not(self.base_catch) else Unknown.SMALL), 'base_catch_2': ( "{:.2f}".format(self.base_catch * 100) if Unknown.is_not(self.base_catch) else Unknown.SMALL), 'great_catch_0': ( "{:.0f}".format(self.great_catch * 100) if Unknown.is_not(self.great_catch) else Unknown.TINY), 'great_catch': ( "{:.1f}".format(self.great_catch * 100) if Unknown.is_not(self.great_catch) else Unknown.SMALL), 'great_catch_2': ( "{:.2f}".format(self.great_catch * 100) if Unknown.is_not(self.great_catch) else Unknown.SMALL), 'ultra_catch_0': ( "{:.0f}".format(self.ultra_catch * 100) if Unknown.is_not(self.ultra_catch) else Unknown.TINY), 'ultra_catch': ( "{:.1f}".format(self.ultra_catch * 100) if Unknown.is_not(self.ultra_catch) else Unknown.SMALL), 'ultra_catch_2': ( "{:.2f}".format(self.ultra_catch * 100) if Unknown.is_not(self.ultra_catch) else Unknown.SMALL), # Misc 'big_karp': ( 'big' if self.monster_id == 129 and Unknown.is_not(self.weight) and self.weight >= 13.13 else ''), 'tiny_rat': ( 'tiny' if self.monster_id == 19 and Unknown.is_not(self.weight) and self.weight <= 2.41 else '') }) return dts
def startup_message(self): if self.__startup_message: timestamps = get_time_as_str(datetime.utcnow()) self.post_to_wall("{} - PokeAlarm has initialized!".format( timestamps[2])) self._log.info("Startup message sent!")