Skip to content

Commit

Permalink
feat: quickplay wins & losses (#45)
Browse files Browse the repository at this point in the history
Co-authored-by: Pradish Bijukchhe <pradishbijukchhe@gmail.com>
  • Loading branch information
chamanbravo and pradishb authored Aug 25, 2024
1 parent 562d4d8 commit 629ac79
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
6 changes: 5 additions & 1 deletion league_client/rso/match.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ def get_match_data(
puuid: str,
player_platform_edge_url: str,
proxy: Optional[ProxyTypes] = None,
count: int = 30,
):
h = HEADERS.copy()
h["Authorization"] = f"Bearer {access_token}"
res = httpx.get(
f"{player_platform_edge_url}/match-history-query/v1/products/lol/player/{puuid}/SUMMARY?startIndex=0&count=30",
(
f"{player_platform_edge_url}/match-history-query/v1/products"
f"/lol/player/{puuid}/SUMMARY?startIndex=0&count={count}"
),
headers=h,
proxy=proxy,
)
Expand Down
18 changes: 18 additions & 0 deletions league_client/shortcuts/rso.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ def get_account_data(
"division":None,
"wins":0,
"losses":0,
"quickplay_wins":0,
"quickplay_losses":0,
"honor_level":2,
"blue_essence":43015,
"orange_essence":940,
Expand Down Expand Up @@ -198,6 +200,7 @@ def get_account_data(
account_data["puuid"],
dat["ppedge_url"],
proxy,
100,
)

for future in as_completed([future_loginq, future_match]):
Expand Down Expand Up @@ -225,10 +228,25 @@ def get_account_data(

elif future is future_match:
match_data = future.result()
quickplay_wins = 0
quickplay_losses = 0
puuid = account_data["puuid"]

for game in match_data["games"]:
if game["json"]["queueId"] == 490:
for participant in game["json"]["participants"]:
if participant["puuid"] == puuid:
if participant["win"]:
quickplay_wins += 1
else:
quickplay_losses += 1

flash_key = get_flash_key(
match_data, account_data["summoner_id"]
)
account_data["flash_key"] = flash_key
account_data["quickplay_wins"] = quickplay_wins
account_data["quickplay_losses"] = quickplay_losses

with ThreadPoolExecutor(6) as executor:
future_loot = executor.submit(
Expand Down

0 comments on commit 629ac79

Please sign in to comment.