Skip to content

Commit

Permalink
Merge pull request #15 from great-majority/fix/character-name
Browse files Browse the repository at this point in the history
Fix Character name in adjacency matrix.
  • Loading branch information
great-majority authored Sep 11, 2024
2 parents 1793187 + 73f6f51 commit 4e473a8
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions kkloader/SummerVacationSaveData.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ def load(cls, filelike):
# The offset position where the player's character data is stored
svs.player_offset = cls._unsigned_int64(data_stream)

svs.names = {}
for c, d in zip(svs.charas, svs.chara_details):
svs.names[d["charasGameParam"]["Index"]] = f"{c['Parameter']['lastname']} {c['Parameter']['firstname']}"

return svs

# Save Data Serialization
Expand Down Expand Up @@ -131,7 +135,6 @@ def save(self, filename):

# Create an adjacency matrix representing the interaction data between characters
def generate_memory_matrix(self, command=0, active=True, decision="yes"):
names = {x["charasGameParam"]["Index"]: x["charasGameParam"]["onesPropertys"][0]["name"] for x in self.chara_details}
interract = "activeCommand" if active else "passiveCommand"

assert interract in ["activeCommand", "passiveCommand"]
Expand All @@ -151,16 +154,14 @@ def generate_memory_matrix(self, command=0, active=True, decision="yes"):
else:
value = None

row[f"{to_index}:{names[to_index]}"] = value
row[f"{to_index}:{self.names[to_index]}"] = value

rows[f"{from_index}:{names[from_index]}"] = row
rows[f"{from_index}:{self.names[from_index]}"] = row

return pd.DataFrame.from_dict(rows).T

# Create an adjacency matrix representing the sexual interaction data between characters
def generate_sexual_memory_matrix(self, command):
names = {x["charasGameParam"]["Index"]: x["charasGameParam"]["onesPropertys"][0]["name"] for x in self.chara_details}

rows = {}
for c in self.chara_details:
from_index = c["charasGameParam"]["Index"]
Expand All @@ -172,8 +173,8 @@ def generate_sexual_memory_matrix(self, command):
if from_index == to_index:
continue
value = table[to_index]["saveInfo"][command]
row[f"{to_index}:{names[to_index]}"] = value
row[f"{to_index}:{self.names[to_index]}"] = value

rows[f"{from_index}:{names[from_index]}"] = row
rows[f"{from_index}:{self.names[from_index]}"] = row

return pd.DataFrame.from_dict(rows).T

0 comments on commit 4e473a8

Please sign in to comment.