Skip to content

Commit

Permalink
Add conversion for when numbers are used
Browse files Browse the repository at this point in the history
  • Loading branch information
FluffyOMC committed May 31, 2024
1 parent d6562a8 commit aaad316
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions psychtobase/src/tools/ChartTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,32 @@ def convertEvents(self, file):
fileJson = Paths.parseJson(file)
events_data = fileJson.get("song", {}).get("events", [])

# Sometimes numbers are used instead of names
target_nums = {
"0": "bf",
"1": "dad",
"2": "gf"
}

for event in events_data:
time = event[0]
event_type = event[1][0][0]

if event_type == "Play Animation":
anim = event[1][0][1]
target = event[1][0][2].lower() # When the game is stupid and doesn't like capitalization
if str(target) in target_nums:
target = target_nums[str(target)]
else:
target = target.lower()
self.chart["events"].append(Utils.playAnimation(time, target, anim, True))
elif event_type == "Change Character":
target = event[1][0][1].lower()
char = event[1][0][2]
if str(target) in target_nums:
target = target_nums[str(target)]
else:
target = target.lower()
self.chart["events"].append(Utils.changeCharacter(time, target, char))
else:
logging.warn(f"Conversion for event {event_type} is not implemented!")
Expand Down Expand Up @@ -243,6 +258,12 @@ def convert(self):

# Process events within the chart file becuz fuck us
if self.shouldConvertEvents:
# Sometimes numbers are used instead of names
target_nums = {
"0": "bf",
"1": "dad",
"2": "gf"
}
if "events" in cChart:
for event in cChart["events"]:
time = event[0]
Expand All @@ -255,6 +276,12 @@ def convert(self):
if event_type == "Play Animation":
anim = stacked_event[1]
target = stacked_event[2].lower()

if str(target) in target_nums:
target = target_nums[str(target)]
else:
target = target.lower()

play_animation = (time, target, anim, True)

if play_animation not in existing_events:
Expand All @@ -263,6 +290,12 @@ def convert(self):
elif event_type == "Change Character":
target = stacked_event[1].lower()
char = stacked_event[2]

if str(target) in target_nums:
target = target_nums[str(target)]
else:
target = target.lower()

change_character = (time, target, char)

if change_character not in existing_events:
Expand Down

0 comments on commit aaad316

Please sign in to comment.