Skip to content

Commit

Permalink
fix: Don't init the m00 dict too early (#183)
Browse files Browse the repository at this point in the history
We need to check the category prior to init'ing the dict. When you
continue passed the "Important notice" screen, the network hook loads.
We don't want the hook to generate the dict until after the player
selects their character as we need to swap some placeholder tags first.
  • Loading branch information
jmctune authored Mar 24, 2024
1 parent c4dcf0f commit 11b9377
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/hooking/network_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,6 @@ def __init__(self, text_address, var_address):
self.text_address = NetworkTextTranslate.writer.unpack_to_int(text_address)
self.var_address = NetworkTextTranslate.writer.unpack_to_int(var_address)

if NetworkTextTranslate.m00_text is None:
NetworkTextTranslate.m00_text = generate_m00_dict()

var_name = self.var_address + 40

try:
Expand All @@ -120,6 +117,12 @@ def __init__(self, text_address, var_address):
category = ""
text = ""

# when we are on the login screen, this hook hits too soon. we don't want to
# prematurely init the dict as the database hasn't replace our placehold tags
# with player names. we see _MVER1, _MVER2, etc when we first log in.
if NetworkTextTranslate.m00_text is None and not category.startswith("_MVER"):
NetworkTextTranslate.m00_text = generate_m00_dict()

if category in NetworkTextTranslate.translate:
# "self" text when a player/monster uses a spell/skill on themselves
if category == "B_TARGET_RPL":
Expand Down

0 comments on commit 11b9377

Please sign in to comment.