Skip to content

Commit

Permalink
try adding hero & equipment data to wars
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTheDev committed Apr 18, 2024
1 parent cd47a31 commit df5aae7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions gamewide/war/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,10 +248,10 @@ async def get_war(clan_tag : str):

war_raw_data: dict = war._raw_data
for member in war_raw_data["clan"]["members"]:
member["heroes"] = player_data.get(member["tag"], {}).get("heroes", [])
member["heroes"] = [{"name" : h.get("name"), "level" : h.get("level"), "equipment" : h.get("equipment")} for h in player_data.get(member["tag"], {}).get("heroes", []) if h.get("village") == "home"]

for member in war_raw_data["opponent"]["members"]:
member["heroes"] = player_data.get(member["tag"], {}).get("heroes", [])
member["heroes"] = [{"name" : h.get("name"), "level" : h.get("level"), "equipment" : h.get("equipment")} for h in player_data.get(member["tag"], {}).get("heroes", []) if h.get("village") == "home"]

custom_id = hashids.encode(int(war.preparation_start_time.time.replace(tzinfo=pend.UTC).timestamp()) + int(pend.now(tz=pend.UTC).timestamp()) + random.randint(1000000000, 9999999999))
await db_client.clan_wars.update_one({"war_id": war_unique_id},
Expand Down

0 comments on commit df5aae7

Please sign in to comment.