Skip to content

Commit

Permalink
fix: fix function names in lcu loot
Browse files Browse the repository at this point in the history
  • Loading branch information
pradishb committed Jul 9, 2024
1 parent d71144f commit 66b548c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
25 changes: 13 additions & 12 deletions league_client/lcu/loot.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ def get_loot_by_pattern(connection: LeagueConnection, pattern: str):
res = connection.get("/lol-loot/v1/player-loot-map")
res.raise_for_status()
data = [
s["storeItemId"]
for s in res.json().values()
if re.fullmatch(pattern, s["lootId"])
s for s in res.json().values() if re.fullmatch(pattern, s["lootId"])
]
return data

Expand All @@ -58,15 +56,6 @@ def get_champion_shards(connection: LeagueConnection):
return [l for l in loot if l["type"] in ["CHAMPION", "CHAMPION_RENTAL"]]


def get_orange_essence(connection: LeagueConnection):
res = connection.get("/lol-loot/v1/player-loot-map")
res.raise_for_status()
loot_map = res.json()
if "CURRENCY_cosmetic" not in loot_map:
return 0
return loot_map["CURRENCY_cosmetic"]["count"]


def get_skin_shards(connection: LeagueConnection):
return get_loot_by_pattern(connection, SKIN_SHARD_RE)

Expand All @@ -75,6 +64,14 @@ def get_perma_skin_shards(connection: LeagueConnection):
return get_loot_by_pattern(connection, SKIN_SHARD_PERMA_RE)


def get_skin_shards_ids(connection: LeagueConnection):
return [s["storeItemId"] for s in get_skin_shards(connection)]


def get_perma_skin_shards_ids(connection: LeagueConnection):
return [s["storeItemId"] for s in get_perma_skin_shards(connection)]


def get_key_fragment_count(connection: LeagueConnection) -> int:
return get_loot_count(connection, "MATERIAL_key_fragment")

Expand All @@ -97,3 +94,7 @@ def get_masterwork_chest_count(connection: LeagueConnection) -> int:

def get_blue_essence_count(connection: LeagueConnection) -> int:
return get_loot_count(connection, "CURRENCY_champion")


def get_orange_essence_count(connection: LeagueConnection):
return get_loot_count(connection, "CURRENCY_cosmetic")
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "league-client"
version = "2.0.2"
version = "2.0.3"
dependencies = ["httpx", "psutil", "ucaptcha"]
requires-python = ">=3"
authors = [{ name = "Pradish Bijukchhe", email = "pradishbijukchhe@gmail.com" }]
Expand Down

0 comments on commit 66b548c

Please sign in to comment.