-
-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
separate monster and npc names #72
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,17 +121,19 @@ def scan_for_npc_names(): | |
Also finds names above your party members. | ||
""" | ||
misc_files = "/".join([get_abs_path(__file__), "misc_files"]) | ||
translated_names = merge_jsons([ | ||
f"{misc_files}/subPackage02Client.win32.json", | ||
translated_npc_names = merge_jsons([ | ||
f"{misc_files}/smldt_msg_pkg_NPC_DB.win32.json", | ||
f"{misc_files}/custom_npc_names.json" | ||
]) | ||
translated_monster_names = f"{misc_files}/subPackage02Client.win32.json" | ||
|
||
if npc_list := pattern_scan(pattern=npc_monster_pattern, return_multiple=True): | ||
for address in npc_list: | ||
npc_type = read_bytes(address + 36, 2) | ||
if npc_type == b"\xBC\x71" or npc_type == b"\x6C\x5F": | ||
if npc_type == b"\xBC\x71": | ||
data = "NPC" | ||
elif npc_type == b"\x6C\x5F": | ||
data = "MONSTER" | ||
elif npc_type == b"\xD4\x61": | ||
data = "AI_NAME" | ||
else: | ||
|
@@ -140,7 +142,12 @@ def scan_for_npc_names(): | |
name_addr = address + 48 # jump to name | ||
name = read_string(name_addr) | ||
|
||
if data == "NPC": | ||
if data == "NPC" or data == "MONSTER": | ||
translated_names = '' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You don't need to assign an empty string here as your conditional below is already assigning this variable. It won't end up unassigned with this logic. |
||
if data == "NPC": | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can assign these in the if/else above on lines 133 and 135 to dry this out. |
||
translated_names = translated_npc_names | ||
else: | ||
translated_names = translated_monster_names | ||
if name in translated_names: | ||
value = translated_names.get(name) | ||
if value: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just came to me, but I realized that this isn't actually doing anything other than assigning the path to a string. We need to actually read the contents and assign it to something that we can look up.
For now, the easiest way would be to just call
merge_jsons()
on this string (like above) to produce a separate dict.