Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions mapadroid/db/DbPogoProtoSubmit.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,12 +512,12 @@ def raids(self, origin: str, map_proto: dict, mitm_mapper):

query_raid = (
"INSERT INTO raid (gym_id, level, spawn, start, end, pokemon_id, cp, move_1, move_2, last_scanned, form, "
"is_exclusive, gender, costume) "
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) "
"is_exclusive, gender, costume, evolution) "
"VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s) "
"ON DUPLICATE KEY UPDATE level=VALUES(level), spawn=VALUES(spawn), start=VALUES(start), "
"end=VALUES(end), pokemon_id=VALUES(pokemon_id), cp=VALUES(cp), move_1=VALUES(move_1), "
"move_2=VALUES(move_2), last_scanned=VALUES(last_scanned), is_exclusive=VALUES(is_exclusive), "
"form=VALUES(form), gender=VALUES(gender), costume=VALUES(costume)"
"form=VALUES(form), gender=VALUES(gender), costume=VALUES(costume), evolution=VALUES(evolution)"
)

for cell in cells:
Expand All @@ -532,6 +532,7 @@ def raids(self, origin: str, map_proto: dict, mitm_mapper):
form = gym["gym_details"]["raid_info"]["raid_pokemon"]["display"]["form_value"]
gender = gym["gym_details"]["raid_info"]["raid_pokemon"]["display"]["gender_value"]
costume = gym["gym_details"]["raid_info"]["raid_pokemon"]["display"]["costume_value"]
evolution = gym["gym_details"]["raid_info"]["raid_pokemon"]["display"].get("evolution_value", 0)
else:
pokemon_id = None
cp = 0
Expand All @@ -540,6 +541,7 @@ def raids(self, origin: str, map_proto: dict, mitm_mapper):
form = None
gender = None
costume = None
evolution = 0

raid_end_sec = int(gym["gym_details"]["raid_info"]["raid_end"] / 1000)
raid_spawn_sec = int(gym["gym_details"]["raid_info"]["raid_spawn"] / 1000)
Expand Down Expand Up @@ -572,7 +574,8 @@ def raids(self, origin: str, map_proto: dict, mitm_mapper):
form,
is_exclusive,
gender,
costume
costume,
evolution
)
)
self._db_exec.executemany(query_raid, raid_args, commit=True)
Expand Down
5 changes: 5 additions & 0 deletions mapadroid/db/DbSchemaUpdater.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,11 @@ class DbSchemaUpdater:
"column": "costume",
"ctype": "tinyint(1) NULL"
},
{
"table": "raid",
"column": "evolution",
"ctype": "smallint(6) NULL"
},
{
"table": "gym",
"column": "is_ex_raid_eligible",
Expand Down
7 changes: 4 additions & 3 deletions mapadroid/db/DbWebhookReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def get_raids_changed_since(self, timestamp):
query = (
"SELECT raid.gym_id, raid.level, raid.spawn, raid.start, raid.end, raid.pokemon_id, "
"raid.cp, raid.move_1, raid.move_2, raid.last_scanned, raid.form, raid.is_exclusive, raid.gender, "
"raid.costume, gymdetails.name, gymdetails.url, gym.latitude, gym.longitude, "
"raid.costume, raid.evolution, gymdetails.name, gymdetails.url, gym.latitude, gym.longitude, "
"gym.team_id, weather_boosted_condition, gym.is_ex_raid_eligible "
"FROM raid "
"LEFT JOIN gymdetails ON gymdetails.gym_id = raid.gym_id "
Expand All @@ -33,7 +33,7 @@ def get_raids_changed_since(self, timestamp):
ret = []
for (gym_id, level, spawn, start, end, pokemon_id,
cp, move_1, move_2, last_scanned, form, is_exclusive, gender,
costume, name, url, latitude, longitude, team_id,
costume, evolution, name, url, latitude, longitude, team_id,
weather_boosted_condition, is_ex_raid_eligible) in res:
ret.append({
"gym_id": gym_id,
Expand All @@ -56,7 +56,8 @@ def get_raids_changed_since(self, timestamp):
"is_exclusive": is_exclusive,
"gender": gender,
"is_ex_raid_eligible": is_ex_raid_eligible,
"costume": costume
"costume": costume,
"evolution": evolution
})
return ret

Expand Down
9 changes: 6 additions & 3 deletions mapadroid/db/DbWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,8 @@ def get_gyms_in_rectangle(self, ne_lat, ne_lon, sw_lat, sw_lon, o_ne_lat=None, o
"SELECT gym.gym_id, gym.latitude, gym.longitude, "
"gymdetails.name, gymdetails.url, gym.team_id, "
"gym.last_modified, raid.level, raid.spawn, raid.start, "
"raid.end, raid.pokemon_id, raid.form, gym.last_scanned "
"raid.end, raid.pokemon_id, raid.form, raid.costume, "
"raid.evolution, gym.last_scanned "
"FROM gym "
"INNER JOIN gymdetails ON gym.gym_id = gymdetails.gym_id "
"LEFT JOIN raid ON raid.gym_id = gym.gym_id "
Expand Down Expand Up @@ -541,7 +542,7 @@ def get_gyms_in_rectangle(self, ne_lat, ne_lon, sw_lat, sw_lon, o_ne_lat=None, o
res = self.execute(query + query_where)

for (gym_id, latitude, longitude, name, url, team_id, last_updated,
level, spawn, start, end, mon_id, form, last_scanned) in res:
level, spawn, start, end, mon_id, form, costume, evolution, last_scanned) in res:

nowts = datetime.utcfromtimestamp(time.time()).timestamp()

Expand All @@ -555,7 +556,9 @@ def get_gyms_in_rectangle(self, ne_lat, ne_lon, sw_lat, sw_lon, o_ne_lat=None, o
"end": int(end.replace(tzinfo=timezone.utc).timestamp()),
"mon": mon_id,
"form": form,
"level": level
"level": level,
"costume": costume,
"evolution": evolution
}

gyms[gym_id] = {
Expand Down
3 changes: 2 additions & 1 deletion scripts/SQL/rocketmap.sql
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ CREATE TABLE `raid` (
`is_exclusive` tinyint(1) DEFAULT NULL,
`gender` tinyint(1) DEFAULT NULL,
`costume` tinyint(1) DEFAULT NULL,
`evolution` smallint(6) DEFAULT NULL,
PRIMARY KEY (`gym_id`),
KEY `raid_level` (`level`),
KEY `raid_spawn` (`spawn`),
Expand Down Expand Up @@ -805,4 +806,4 @@ CREATE TABLE `origin_hopper` (
`origin` VARCHAR(128) NOT NULL,
`last_id` int UNSIGNED NOT NULL,
PRIMARY KEY (`origin`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;