Skip to content

Commit fee31e1

Browse files
committed
halfway there
1 parent 7f8de14 commit fee31e1

File tree

2 files changed

+16
-19
lines changed

2 files changed

+16
-19
lines changed

source/archipelago/APGameState.hx

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,6 @@ class APGameState {
112112
public var ItemIndex:Int = -1;
113113

114114
public function locationData(songName:String):Array<Int> {
115-
if (APInfo.unlockMethod != "Note Checks")
116-
return [];
117115
// trace("Starting locationData function with songName: " + songName);
118116
var matchingLocations:Array<Int> = [];
119117
var exactMatch:Int = -1;
@@ -149,8 +147,6 @@ class APGameState {
149147
}
150148

151149
public function noteData(songName:String, modName:String, ?week:String):Array<Int> {
152-
if (APInfo.unlockMethod != "Song Completion")
153-
return [];
154150
//trace("Starting noteData function with songName: " + songName + " and modName: " + modName);
155151
var matchingNotes:Array<Int> = [];
156152
var reg = new EReg("^Note \\d+: " + EReg.escape(songName + (modName != "" ? " (" + modName + ")" : "")) + "$", "");
@@ -169,9 +165,9 @@ class APGameState {
169165

170166
// Fallback logic if no matches are found
171167
if (matchingNotes.length == 0) {
172-
trace("No matches found. Attempting fallback logic...");
168+
//trace("No matches found. Attempting fallback logic...");
173169
for (song in WeekData.getCurrentWeek().songs) {
174-
trace("Checking song in current week: " + song[0]);
170+
//trace("Checking song in current week: " + song[0]);
175171
if ((cast song[0] : String).toLowerCase().trim() == songName.toLowerCase().trim() ||
176172
(cast song[0] : String).toLowerCase().trim().replace(" ", "-") == songName.toLowerCase().trim().replace(" ", "-")) {
177173
var fallbackReg = new EReg("^Note \\d+: " + EReg.escape(song[0] + (modName != "" ? " (" + modName + ")" : "")) + "$", "");
@@ -189,22 +185,22 @@ class APGameState {
189185

190186
// Secondary fallback logic using JSON data
191187
if (matchingNotes.length == 0) {
192-
trace("No matches found in fallback logic. Attempting secondary fallback...");
188+
//trace("No matches found in fallback logic. Attempting secondary fallback...");
193189
for (song in WeekData.getCurrentWeek().songs) {
194-
trace("Checking song in secondary fallback logic: " + song[0]);
190+
//trace("Checking song in secondary fallback logic: " + song[0]);
195191
var songPath = modName.trim() != ""
196192
? "mods/" + modName + "/data/" + song[0] + "/" + song[0] + "-" + Difficulty.getString(PlayState.storyDifficulty) + ".json"
197-
: "assets/shared" + (song[0] + Difficulty.getFilePath());
198-
trace("Constructed songPath: " + songPath);
193+
: "assets/shared/data/" + (song[0] + Difficulty.getFilePath());
194+
//trace("Constructed songPath: " + songPath);
199195

200196
var songJson:backend.Song.SwagSong = null;
201197
var jsonStuff:Array<String> = modName.trim() != ""
202-
? Paths.crawlDirectoryOG("mods/" + modName + "/data", ".json")
203-
: Paths.crawlDirectoryOG("assets/shared/data", ".json");
204-
trace("Retrieved JSON files: " + jsonStuff);
198+
? Paths.crawlDirectory("mods/" + modName + "/data", ".json")
199+
: Paths.crawlDirectory("assets/shared/data", ".json");
200+
//trace("Retrieved JSON files: " + jsonStuff);
205201

206202
for (json in jsonStuff) {
207-
trace("Checking JSON file: " + json);
203+
//trace("Checking JSON file: " + json);
208204
if (json.trim().toLowerCase().replace(" ", "-") == songPath.trim().toLowerCase().replace(" ", "-")) {
209205
trace("Match found for JSON file: " + json);
210206
songJson = backend.Song.parseJSON(File.getContent(json));
@@ -555,6 +551,7 @@ class APGameState {
555551
itemName = item;
556552
}
557553

554+
//var itemsWhitelist:
558555
var isSpecialItem = locationData(itemName).concat(APEntryState.apGame.noteData(itemName, modName)).isEmpty();
559556
if (isSpecialItem) {
560557
specialItems.set(itemName, currentPackages["Friday Night Funkin"].item_name_to_id.get(item));

source/states/FreeplayState.hx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,7 @@ class FreeplayState extends MusicBeatState
517517

518518
for (songName in curUnlocked.keys())
519519
{
520-
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && !isMissing)
520+
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && isMissing)
521521
addSong(song[0], i, song[1], FlxColor.fromRGB(colors[0], colors[1], colors[2]));
522522
}
523523
}
@@ -529,7 +529,7 @@ class FreeplayState extends MusicBeatState
529529
var isMissing:Bool = APEntryState.apGame.areLocationsMissing(locationIds);
530530
for (songName in curUnlocked.keys())
531531
{
532-
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && isMissing)
532+
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && !isMissing)
533533
addSong(song[0], i, song[1], FlxColor.fromRGB(colors[0], colors[1], colors[2]));
534534
}
535535
}
@@ -541,7 +541,7 @@ class FreeplayState extends MusicBeatState
541541
var isMissing:Bool = APEntryState.apGame.areLocationsMissing(locationIds);
542542
for (songName in curHinted.keys())
543543
{
544-
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curHinted.get(songName)) && !isMissing)
544+
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curHinted.get(songName)) && isMissing)
545545
addSong(song[0], i, song[1], FlxColor.fromRGB(colors[0], colors[1], colors[2]));
546546
}
547547

@@ -578,7 +578,7 @@ class FreeplayState extends MusicBeatState
578578
var isMissing:Bool = APEntryState.apGame.areLocationsMissing(locationIds);
579579
for (songName in curUnlocked.keys())
580580
{
581-
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && !isMissing)
581+
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && isMissing)
582582
addSong(song[0], i, song[1], FlxColor.fromRGB(colors[0], colors[1], colors[2]));
583583
}
584584
}
@@ -590,7 +590,7 @@ class FreeplayState extends MusicBeatState
590590
var isMissing:Bool = APEntryState.apGame.areLocationsMissing(locationIds);
591591
for (songName in curUnlocked.keys())
592592
{
593-
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && isMissing)
593+
if (((songNameThing.trim().toLowerCase().replace('-', ' ') == songName.trim().toLowerCase().replace('-', ' ')) && leWeek.folder == curUnlocked.get(songName)) && !isMissing)
594594
addSong(song[0], i, song[1], FlxColor.fromRGB(colors[0], colors[1], colors[2]));
595595
}
596596
}

0 commit comments

Comments
 (0)