def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(StopEvent, self).__init__('stop') # Identification self.stop_id = data['pokestop_id'] # Time left self.expiration = data['lure_expiration'] self.time_left = None if self.expiration is not None: self.expiration = datetime.utcfromtimestamp(self.expiration) self.time_left = get_seconds_remaining(self.expiration) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) # Completed by Manager self.distance = Unknown.SMALL self.direction = Unknown.TINY # Used to reject self.name = self.stop_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(StopEvent, self).__init__('stop') # Identification self.stop_id = data['pokestop_id'] # Time left self.expiration = data['lure_expiration'] self.time_left = None if self.expiration is not None: self.expiration = datetime.utcfromtimestamp(self.expiration) self.time_left = get_seconds_remaining(self.expiration) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) # Completed by Manager self.distance = Unknown.SMALL self.direction = Unknown.TINY # Used to reject self.name = self.stop_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(RaidEvent, self).__init__('raid') check_for_none = BaseEvent.check_for_none # Identification self.gym_id = data.get('gym_id') # Time Remaining self.raid_end = datetime.utcfromtimestamp( data.get('end') or data.get('raid_end')) # RM or Monocle self.time_left = get_seconds_remaining(self.raid_end) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) self.distance = Unknown.SMALL # Completed by Manager self.direction = Unknown.TINY # Completed by Manager self.weather_id = check_for_none( int, data.get('weather'), Unknown.TINY) # Monster Info self.raid_lvl = int(data['level']) self.mon_id = int(data['pokemon_id']) self.cp = int(data['cp']) self.types = get_base_types(self.mon_id) # Quick Move self.quick_id = check_for_none(int, data.get('move_1'), Unknown.TINY) self.quick_damage = get_move_damage(self.quick_id) self.quick_dps = get_move_dps(self.quick_id) self.quick_duration = get_move_duration(self.quick_id) self.quick_energy = get_move_energy(self.quick_id) # Charge Move self.charge_id = check_for_none(int, data.get('move_2'), Unknown.TINY) self.charge_damage = get_move_damage(self.charge_id) self.charge_dps = get_move_dps(self.charge_id) self.charge_duration = get_move_duration(self.quick_id) self.charge_energy = get_move_energy(self.charge_id) # Gym Details (currently only sent from Monocle) self.gym_name = check_for_none( str, data.get('name'), Unknown.REGULAR).strip() self.gym_description = check_for_none( str, data.get('description'), Unknown.REGULAR).strip() self.gym_image = check_for_none( str, data.get('url'), Unknown.REGULAR) # Gym Team (this is only available from cache) self.current_team_id = check_for_none( int, data.get('team'), Unknown.TINY) self.name = self.gym_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(EggEvent, self).__init__('egg') check_for_none = BaseEvent.check_for_none # Identification self.gym_id = data.get('gym_id') # Time Remaining self.hatch_time = datetime.utcfromtimestamp( data.get('start') or data.get('raid_begin')) # RM or Monocle self.time_left = get_seconds_remaining(self.hatch_time) self.raid_end = datetime.utcfromtimestamp( data.get('end') or data.get('raid_end')) # RM or Monocle # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) self.distance = Unknown.SMALL # Completed by Manager self.direction = Unknown.TINY # Completed by Manager self.weather_id = check_for_none(int, data.get('weather'), Unknown.TINY) # Egg Info self.egg_lvl = check_for_none(int, data.get('level'), 0) # Gym Details (currently only sent from Monocle) self.gym_name = check_for_none(str, data.get('name'), Unknown.REGULAR).strip() self.gym_description = check_for_none(str, data.get('description'), Unknown.REGULAR).strip() self.gym_image = check_for_none(str, data.get('url'), Unknown.REGULAR) self.sponsor_id = check_for_none(int, data.get('sponsor'), Unknown.TINY) self.park = check_for_none(str, data.get('park'), Unknown.REGULAR) self.ex_eligible = check_for_none(int, data.get('is_ex_raid_eligible'), Unknown.REGULAR) self.is_exclusive = check_for_none(int, data.get('is_exclusive'), Unknown.REGULAR) # Gym Team (this is only available from cache) self.current_team_id = check_for_none( int, data.get('team_id', data.get('team')), Unknown.TINY) self.name = self.gym_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(EggEvent, self).__init__('egg') check_for_none = BaseEvent.check_for_none # Identification self.gym_id = data.get('gym_id') # Time Remaining self.hatch_time = datetime.utcfromtimestamp( data.get('start') or data.get('raid_begin')) # RM or Monocle self.time_left = get_seconds_remaining(self.hatch_time) self.raid_end = datetime.utcfromtimestamp( data.get('end') or data.get('raid_end')) # RM or Monocle # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) self.distance = Unknown.SMALL # Completed by Manager self.direction = Unknown.TINY # Completed by Manager self.weather_id = check_for_none( int, data.get('weather'), Unknown.TINY) # Egg Info self.egg_lvl = check_for_none(int, data.get('level'), 0) # Gym Details (currently only sent from Monocle) self.gym_name = check_for_none( str, data.get('name'), Unknown.REGULAR).strip() self.gym_description = check_for_none( str, data.get('description'), Unknown.REGULAR).strip() self.gym_image = check_for_none( str, data.get('url'), Unknown.REGULAR) self.sponsor_id = check_for_none( int, data.get('sponsor'), Unknown.TINY) self.park = check_for_none( str, data.get('park'), Unknown.REGULAR) # Gym Team (this is only available from cache) self.current_team_id = check_for_none( int, data.get('team_id', data.get('team')), Unknown.TINY) self.name = self.gym_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(GruntEvent, self).__init__('grunt') check_for_none = BaseEvent.check_for_none # Identification self.stop_id = data['pokestop_id'] # Details self.stop_name = check_for_none( str, data.get('pokestop_name') or data.get('name'), Unknown.REGULAR) self.stop_image = check_for_none( str, data.get('pokestop_url') or data.get('url'), Unknown.REGULAR) # Time left self.expiration = datetime.utcfromtimestamp( data.get('incident_expiration', data.get('incident_expire_timestamp'))) self.type_id = check_for_none( int, data.get('incident_grunt_type', data.get('grunt_type')), 0) # Convert to standard grunt type ID # self.type = int(math.floor(int(self.type_id) / 2)) * 2 self.gender_id = get_grunt_gender(self.type_id) self.gender = get_grunt_gender_sym(self.gender_id) self.time_left = None if self.expiration is not None: self.time_left = get_seconds_remaining(self.expiration) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) # Completed by Manager self.distance = Unknown.SMALL self.direction = Unknown.TINY # Used to reject self.name = self.stop_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(StopEvent, self).__init__('stop') check_for_none = BaseEvent.check_for_none # Identification self.stop_id = data['pokestop_id'] # Details self.stop_name = check_for_none( str, data.get('pokestop_name') or data.get('name'), Unknown.REGULAR) self.stop_image = check_for_none( str, data.get('pokestop_url') or data.get('url'), Unknown.REGULAR) self.lure_type_id = check_for_none(int, data.get('lure_id'), 0) # Time left self.expiration = datetime.utcfromtimestamp( data.get('lure_expiration')) self.time_left = None if self.expiration is not None: self.time_left = get_seconds_remaining(self.expiration) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) # Completed by Manager self.distance = Unknown.SMALL self.direction = Unknown.TINY # Used to reject self.name = self.stop_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Monster Event based on the given dict. """ super(MonEvent, self).__init__('monster') check_for_none = BaseEvent.check_for_none # Identification self.enc_id = data['encounter_id'] self.monster_id = int(data['pokemon_id']) # Time Left self.disappear_time = datetime.utcfromtimestamp(data['disappear_time']) self.time_left = get_seconds_remaining(self.disappear_time) # Spawn Data self.spawn_start = check_for_none(int, data.get('spawn_start'), Unknown.REGULAR) self.spawn_end = check_for_none(int, data.get('spawn_end'), Unknown.REGULAR) self.spawn_verified = check_for_none(bool, data.get('verified'), False) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) self.distance = Unknown.SMALL # Completed by Manager self.direction = Unknown.TINY # Completed by Manager self.weather_id = check_for_none(int, data.get('weather'), Unknown.TINY) self.boosted_weather_id = check_for_none( int, data.get('boosted_weather') or data.get('weather_boosted_condition'), 0) # Encounter Stats self.mon_lvl = check_for_none(int, data.get('pokemon_level'), Unknown.TINY) self.cp = check_for_none(int, data.get('cp'), Unknown.TINY) # IVs self.atk_iv = check_for_none(int, data.get('individual_attack'), Unknown.TINY) self.def_iv = check_for_none(int, data.get('individual_defense'), Unknown.TINY) self.sta_iv = check_for_none(int, data.get('individual_stamina'), Unknown.TINY) if Unknown.is_not(self.atk_iv, self.def_iv, self.sta_iv): self.iv = \ 100 * (self.atk_iv + self.def_iv + self.sta_iv) / float(45) else: self.iv = Unknown.SMALL # Quick Move self.quick_id = check_for_none(int, data.get('move_1'), Unknown.TINY) self.quick_type = get_move_type(self.quick_id) self.quick_damage = get_move_damage(self.quick_id) self.quick_dps = get_move_dps(self.quick_id) self.quick_duration = get_move_duration(self.quick_id) self.quick_energy = get_move_energy(self.quick_id) # Charge Move self.charge_id = check_for_none(int, data.get('move_2'), Unknown.TINY) self.charge_type = get_move_type(self.charge_id) self.charge_damage = get_move_damage(self.charge_id) self.charge_dps = get_move_dps(self.charge_id) self.charge_duration = get_move_duration(self.charge_id) self.charge_energy = get_move_energy(self.charge_id) # Catch Probs self.base_catch = check_for_none(float, data.get('base_catch'), Unknown.TINY) self.great_catch = check_for_none(float, data.get('great_catch'), Unknown.TINY) self.ultra_catch = check_for_none(float, data.get('ultra_catch'), Unknown.TINY) # Attack Rating self.atk_grade = check_for_none(str, data.get('atk_grade'), Unknown.TINY) self.def_grade = check_for_none(str, data.get('def_grade'), Unknown.TINY) # Cosmetic self.gender = MonUtils.get_gender_sym( check_for_none(int, data.get('gender'), Unknown.TINY)) self.height = check_for_none(float, data.get('height'), Unknown.SMALL) self.weight = check_for_none(float, data.get('weight'), Unknown.SMALL) if Unknown.is_not(self.height, self.weight): self.size_id = get_pokemon_size(self.monster_id, self.height, self.weight) else: self.size_id = Unknown.SMALL self.types = get_base_types(self.monster_id) # Form self.form_id = check_for_none(int, data.get('form'), 0) # Costume self.costume_id = check_for_none(int, data.get('costume'), 0) # Correct this later self.name = self.monster_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Monster Event based on the given dict. """ super(MonEvent, self).__init__('monster') check_for_none = BaseEvent.check_for_none # Identification self.enc_id = data['encounter_id'] self.monster_id = int(data['pokemon_id']) # Time Left self.disappear_time = datetime.utcfromtimestamp(data['disappear_time']) self.time_left = get_seconds_remaining(self.disappear_time) # Spawn Data self.spawn_start = check_for_none(int, data.get('spawn_start'), Unknown.REGULAR) self.spawn_end = check_for_none(int, data.get('spawn_end'), Unknown.REGULAR) self.spawn_verified = check_for_none(bool, data.get('verified'), False) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) fence_name = fences.fence_name(self.lat, self.lng) self.location_fence = fence_name if fence_name else "" total = "" for fenceName in personalized_fences.fence_names(self.lat, self.lng): total += '<@' + fenceName + "> " self.distance = Unknown.SMALL # Completed by Manager self.direction = Unknown.TINY # Completed by Manager self.weather_id = check_for_none(int, data.get('weather'), Unknown.TINY) self.boosted_weather_id = check_for_none(int, data.get('boosted_weather'), 0) # Encounter Stats self.mon_lvl = check_for_none(int, data.get('pokemon_level'), Unknown.TINY) self.cp = check_for_none(int, data.get('cp'), Unknown.TINY) # IVs self.atk_iv = check_for_none(int, data.get('individual_attack'), Unknown.TINY) self.def_iv = check_for_none(int, data.get('individual_defense'), Unknown.TINY) self.sta_iv = check_for_none(int, data.get('individual_stamina'), Unknown.TINY) if Unknown.is_not(self.atk_iv, self.def_iv, self.sta_iv): self.iv = \ 100 * (self.atk_iv + self.def_iv + self.sta_iv) / float(45) else: self.iv = Unknown.SMALL if self.iv > 99: total += "<@&315432063937282049>" self.user_notifications = total # Form self.form_id = check_for_none(int, data.get('form'), 0) # Quick Move self.quick_move_id = check_for_none(int, data.get('move_1'), Unknown.TINY) self.quick_damage = get_move_damage(self.quick_move_id) self.quick_dps = get_move_dps(self.quick_move_id) self.quick_duration = get_move_duration(self.quick_move_id) self.quick_energy = get_move_energy(self.quick_move_id) # Charge Move self.charge_move_id = check_for_none(int, data.get('move_2'), Unknown.TINY) self.charge_damage = get_move_damage(self.charge_move_id) self.charge_dps = get_move_dps(self.charge_move_id) self.charge_duration = get_move_duration(self.quick_move_id) self.charge_energy = get_move_energy(self.charge_move_id) # Cosmetic self.gender = MonUtils.get_gender_sym( check_for_none(int, data.get('gender'), Unknown.TINY)) self.height = check_for_none(float, data.get('height'), Unknown.SMALL) self.weight = check_for_none(float, data.get('weight'), Unknown.SMALL) if Unknown.is_not(self.height, self.weight): self.size_id = get_pokemon_size(self.monster_id, self.height, self.weight) else: self.size_id = Unknown.SMALL self.types = get_base_types(self.monster_id) # Correct this later self.name = self.monster_id self.geofence = Unknown.REGULAR self.custom_dts = {}
def __init__(self, data): """ Creates a new Stop Event based on the given dict. """ super(RaidEvent, self).__init__('raid') check_for_none = BaseEvent.check_for_none # Identification self.gym_id = data.get('gym_id') # Time Remaining self.raid_end = datetime.utcfromtimestamp( data.get('end') or data.get('raid_end')) # RM or Monocle self.time_left = get_seconds_remaining(self.raid_end) # Location self.lat = float(data['latitude']) self.lng = float(data['longitude']) self.distance = Unknown.SMALL # Completed by Manager self.direction = Unknown.TINY # Completed by Manager # Monster Info self.raid_lvl = int(data['level']) self.mon_id = int(data['pokemon_id']) self.cp = int(data['cp']) self.types = get_base_types(self.mon_id) self.boss_level = 20 self.gender = MonUtils.get_gender_sym( check_for_none(int, data.get('gender'), Unknown.TINY)) # Form self.form_id = check_for_none(int, data.get('form'), 0) # Evolution self.evolution_id = check_for_none(int, data.get('evolution'), 0) # Costume self.costume_id = check_for_none(int, data.get('costume'), 0) # Weather Info self.weather_id = check_for_none(int, data.get('weather'), Unknown.TINY) self.boosted_weather_id = \ 0 if Unknown.is_not(self.weather_id) else Unknown.TINY if is_weather_boosted(self.mon_id, self.weather_id): self.boosted_weather_id = self.weather_id self.boss_level = 25 # Quick Move self.quick_id = check_for_none(int, data.get('move_1'), Unknown.TINY) self.quick_type = get_move_type(self.quick_id) self.quick_damage = get_move_damage(self.quick_id) self.quick_dps = get_move_dps(self.quick_id) self.quick_duration = get_move_duration(self.quick_id) self.quick_energy = get_move_energy(self.quick_id) # Charge Move self.charge_id = check_for_none(int, data.get('move_2'), Unknown.TINY) self.charge_type = get_move_type(self.charge_id) self.charge_damage = get_move_damage(self.charge_id) self.charge_dps = get_move_dps(self.charge_id) self.charge_duration = get_move_duration(self.charge_id) self.charge_energy = get_move_energy(self.charge_id) # Gym Details (currently only sent from Monocle) self.gym_name = check_for_none(str, data.get('name'), Unknown.REGULAR).strip() self.gym_description = check_for_none(str, data.get('description'), Unknown.REGULAR).strip() self.gym_image = check_for_none(str, data.get('url'), Unknown.REGULAR) self.sponsor_id = check_for_none(int, data.get('sponsor'), Unknown.TINY) self.park = check_for_none(str, data.get('park'), Unknown.REGULAR) self.ex_eligible = check_for_none(int, data.get('is_ex_raid_eligible'), Unknown.REGULAR) # Gym Team (this is only available from cache) self.current_team_id = check_for_none( int, data.get('team_id', data.get('team')), Unknown.TINY) self.name = self.gym_id self.geofence = Unknown.REGULAR self.custom_dts = {}