Skip to content

Commit

Permalink
Fix spell card ID
Browse files Browse the repository at this point in the history
  • Loading branch information
n-rook committed Apr 28, 2024
1 parent f037fbf commit 04a3c26
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 3 additions & 3 deletions project/thscoreboard/replays/replay_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ def _Parse095(rep_raw):
encrypted_replay = th095_encrypted.Th095Encrypted.from_bytes(rep_raw)

# This is goofy and probably not a good idea
spell_card_id = int(encrypted_replay.userdata.level.value) << 8 + int(
encrypted_replay.userdata.scene.value
)
spell_level = int(encrypted_replay.userdata.level.value)
spell_scene = int(encrypted_replay.userdata.scene.value)
spell_card_id = (spell_level << 8) + spell_scene

return ReplayInfo(
game=game_ids.GameIDs.TH095,
Expand Down
4 changes: 4 additions & 0 deletions project/thscoreboard/replays/test_replay_parsing.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,8 @@ def testOne(self):
r.timestamp,
datetime.datetime(2024, 4, 27, 16, 42, tzinfo=datetime.timezone.utc),
)
self.assertEqual(r.spell_card_id >> 8, 3)
self.assertEqual(r.spell_card_id & 0xFF, 1)
self.assertEqual(r.name, "nrook3.1")
self.assertEqual(r.slowdown, 0.00)

Expand All @@ -229,6 +231,8 @@ def testTwo(self):
r.timestamp,
datetime.datetime(2024, 4, 27, 19, 54, tzinfo=datetime.timezone.utc),
)
self.assertEqual(r.spell_card_id >> 8, 2)
self.assertEqual(r.spell_card_id & 0xFF, 5)
self.assertEqual(r.name, "nrook ")
self.assertEqual(r.slowdown, 0.00)

Expand Down

0 comments on commit 04a3c26

Please sign in to comment.