Skip to content

Commit

Permalink
Fix sprays in inventory erroring
Browse files Browse the repository at this point in the history
closes #483
  • Loading branch information
Gobot1234 committed Sep 21, 2024
1 parent 485fb4d commit 59d1285
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion steam/ext/csgo/backpack.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@

@dataclass(slots=True)
class Sticker:
slot: Literal[0, 1, 2, 3, 4, 5]
slot: Literal[0, 1, 2, 3, 4, 5] | None
"""The sticker's slot."""
id: int
"""The sticker's ID."""
Expand Down
6 changes: 5 additions & 1 deletion steam/ext/csgo/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ async def update_backpack(self, *gc_items: base.Item, is_cache_subscribe: bool =
self.set("stickers", stickers)
for i in range(6):
if sticker_id := utils.get(gc_item.attribute, def_index=113 + i):
slot_id = utils.get(gc_item.attribute, def_index=290 + i)
slot = READ_U32(slot_id.value_bytes) if slot_id else None
assert slot in (1, 2, 3, 4, 5, None)

sticker = Sticker(
slot=READ_U32(utils.get(gc_item.attribute, def_index=290 + i)), # type: ignore
slot=slot,
id=READ_U32(sticker_id.value_bytes),
)

Expand Down

0 comments on commit 59d1285

Please sign in to comment.