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 Quest Event based on the given dict. """ super(QuestEvent, self).__init__('quests') check_for_none = BaseEvent.check_for_none # Identification self.stop_id = data['pokestop_id'] self.stop_name = check_for_none( str, data.get('pokestop_name', data.get('name')), Unknown.REGULAR) self.stop_image = check_for_none( str, data.get('pokestop_url', data.get('url')), Unknown.REGULAR) # 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 = {} # Quest Details self.quest_type_raw = data['quest_type'] self.quest_type_id = data.get('quest_type_raw') self.quest_target = data.get('quest_target') self.quest_task_raw = data.get('quest_task') self.quest_condition_raw = data.get('quest_condition') self.quest_template = data.get('quest_template') self.last_modified = datetime.utcfromtimestamp(data['timestamp']) # Reward Details self.reward_type_id = data['quest_reward_type_raw'] self.reward_type_raw = data.get('quest_reward_type') self.reward_amount = data.get('item_amount', 1) # Monster Reward Details self.monster_id = data.get('pokemon_id', 0) self.monster_form_id = data.get('pokemon_form', 0) self.monster_costume_id = data.get('pokemon_costume', 0) self.monster_types = get_base_types(self.monster_id) \ if self.monster_id != 0 else [0, 0] # Item Reward Details self.item_amount = self.reward_amount self.item_type = data.get('item_type') self.item_id = data.get('item_id', 0)
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 = {}