Skip to content

Commit

Permalink
Added 2 last replays in to the data from get_tcg_basic
Browse files Browse the repository at this point in the history
  • Loading branch information
nitolar committed Jun 5, 2023
1 parent c6046c8 commit bc5232b
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ wishes.py wish history
```

# CHANGELOG
## 1.4.12.6
- Added 2 last replays in to the data from `get_tcg_basic`
## 1.4.12.5
- Added `get_tcg_basic` to access the `basicInfo` endpoint because `cardList` endpoint only works on loged in users NO CARD LIST 😭
- Added a new parameter `tcg_basic` to `get_all_user_data` witch is TRUE by default so that means that it uses `get_tcg_basic` instead of `get_tcg`, but changing it to FALSE will make you use `get_tcg`
Expand Down
12 changes: 5 additions & 7 deletions genshinstats/genshinstats.py
Original file line number Diff line number Diff line change
Expand Up @@ -354,13 +354,9 @@ def get_notes(
def get_tcg_basic(
uid: int, lang: str = "en-us", cookie: Mapping[str, Any] = None
) -> Dict[str, Any]:
"""Gets the cards for Genius Invokation TCG that user UNLOCKED and basic user stats
"""Gets basic user stats and 2 last replays
For every card contains basic info like id, name, description, image, wiki page and card proficiency.
For characters contains info like hp, element, weapon and skills.
For summons and events contains info about cost.
Arena of Champions for now not supported.
"""
server = recognize_server(uid)
data = fetch_game_record_endpoint(
Expand All @@ -375,7 +371,9 @@ def get_tcg_basic(
def get_tcg(
uid: int, lang: str = "en-us", cookie: Mapping[str, Any] = None, characters: bool = True, action: bool = True
) -> Dict[str, Any]:
"""Gets the cards for Genius Invokation TCG that user UNLOCKED and basic user stats
"""ONLY LOGGED IN USER
Gets the cards for Genius Invokation TCG that user UNLOCKED and basic user stats
For every card contains basic info like id, name, description, image, wiki page and card proficiency.
Expand Down
21 changes: 21 additions & 0 deletions genshinstats/pretty.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ def prettyify_tcg(data):

def prettyify_tcg_basic(data):
stats = data
replays = data['replays']
return {
"stats": {
"level": stats['level'],
Expand All @@ -582,4 +583,24 @@ def prettyify_tcg_basic(data):
"actions_unlocked": stats['action_card_num_gained'],
"action_card_total_num": stats['action_card_num_total']
},
"replays": [
{
"id": replay['game_id'],
"player": {
"nick": replay['self']['name'],
"cards": [
i for i in replay['self']['linups']
]
},
"opponent": {
"nick": replay['opposite']['name'],
"cards": [
i for i in replay['opposite']['linups']
]
},
"match_type": replay['match_type'],
"match_time": f"{replay['match_time']['day']}.{replay['match_time']['month']}.{replay['match_time']['year']} {replay['match_time']['hour']}:{replay['match_time']['minute']}:{replay['match_time']['second']}",
"won": replay['is_win']
} for replay in replays
],
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name="genshinstats",
version="1.4.12.5",
version="1.4.12.6",
author="nitolar",
packages=["genshinstats"],
description="A python library that can get the stats of Genshin Impact players using Hoyoverse's API.",
Expand Down

0 comments on commit bc5232b

Please sign in to comment.