Skip to content
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

Fix for negative actorIDs #433

Merged
merged 17 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/game_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,17 @@ def load_character(self, json: dict[str, Any]) -> Character | None:
try:
base_id: str = utils.convert_to_skyrim_hex_format(str(json[comm_consts.KEY_ACTOR_BASEID]))
ref_id: str = utils.convert_to_skyrim_hex_format(str(json[comm_consts.KEY_ACTOR_REFID]))
ref_id = ref_id[-6:].upper() # ignore plugin ID at the start of the ref ID as this can vary by load order

# ignore plugin ID at the start of the ref ID as this can vary by load order
if ref_id.startswith('FE'): #Item from lite mod, statically placed in CK, has 'FEXXX' prefix.
ref_id = ref_id[-3:].rjust(6,"0") #Mask off prefix, pad w/'0'
else:
ref_id = ref_id[-6:]
if base_id.startswith('FE'):
base_id = base_id[-3:].rjust(6,"0")
else:
base_id = base_id[-6:]

character_name: str = str(json[comm_consts.KEY_ACTOR_NAME])
gender: int = int(json[comm_consts.KEY_ACTOR_GENDER])
race: str = str(json[comm_consts.KEY_ACTOR_RACE])
Expand Down
4 changes: 2 additions & 2 deletions src/games/fallout4.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import pandas as pd
from src.http.file_communication_compatibility import file_communication_compatibility
from src.conversation.context import context
from src.audio.audio_playback import audio_playback
#from src.audio.audio_playback import audio_playback
from src.character_manager import Character
from src.config.config_loader import ConfigLoader
from src.llm.sentence import sentence
Expand All @@ -29,7 +29,7 @@ def __init__(self, config: ConfigLoader):
self.__config: ConfigLoader = config
encoding = utils.get_file_encoding(fallout4.FO4_XVASynth_file)
self.__FO4_Voice_folder_and_models_df = pd.read_csv(fallout4.FO4_XVASynth_file, engine='python', encoding=encoding)
self.__playback: audio_playback = audio_playback(config)
#self.__playback: audio_playback = audio_playback(config)
self.__last_played_voiceline: str | None = None


Expand Down
5 changes: 4 additions & 1 deletion src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def cleanup_mei(remove_mei_folders: bool):
logging.warn(f"Warning: {len(mei_files)} previous Mantella.exe runtime folder(s) found in {dir_mei}. See MantellaSoftware/config.ini's remove_mei_folders setting for more information.")

def convert_to_skyrim_hex_format(identifier: str) -> str:
hex_format = f'{int(identifier):x}'
intID = int(identifier)
if intID < 0:
intID += 2**32
hex_format = f'{intID:x}'.upper()
return hex_format.rjust(8,"0")

def get_time_group(in_game_time):
Expand Down