@@ -8,8 +8,10 @@ import backend.Song;
88import objects .HealthIcon ;
99import objects .MusicPlayer ;
1010
11- import archipelago .* ;
12- import archipelago .PacketTypes .ClientStatus ;
11+ import archipelago .ArchPopup ;
12+ import archipelago .APEntryState ;
13+ import archipelago .APInfo ;
14+
1315// import states.editors.ChartingStateOG;
1416
1517import flixel .addons .ui .FlxUIInputText ;
@@ -23,6 +25,7 @@ import flixel.ui.FlxButton;
2325import flixel .input .keyboard .FlxKey ;
2426import flixel .util .FlxDestroyUtil ;
2527import haxe .Json ;
28+ import archipelago .PacketTypes .ClientStatus ;
2629import yutautil .ChanceSelector ;
2730import yutautil .ChanceSelector .Chance ;
2831
@@ -99,9 +102,6 @@ class FreeplayState extends MusicBeatState
99102 var listChoices : Array <String > = [];
100103 var multiSongs : Array <String > = [];
101104
102- public static var lastSongPlayed : String = " " ;
103- public static var lastModPlayed : String = " " ;
104-
105105 public static var curUnlocked : Map <String , String > = new Map <String , String >();
106106 public static var curMissing : Map <String , String > = new Map <String , String >();
107107 public static var trueMissing : Array <String > = [];
@@ -134,12 +134,19 @@ class FreeplayState extends MusicBeatState
134134 if (APEntryState .apGame != null && APEntryState .apGame .info () != null && APEntryState .gonnaRunSync ) {
135135 APEntryState .apGame .info ().Sync ();
136136 APEntryState .gonnaRunSync = false ;
137- APPlayState .deathByBlueBalls = false ;
138- }
139137
140- if (APEntryState .inArchipelagoMode ) {
141- trace (' Last song: $lastSongPlayed \n From Mod: $lastModPlayed \n Is victory: ${isVictorySong (lastSongPlayed , lastModPlayed )}' );
142- if (isVictorySong (lastSongPlayed , lastModPlayed ))
138+ function getLastParenthesesContent (input : String ): String {
139+ var lastParenIndex = input .lastIndexOf (" (" );
140+ if (lastParenIndex != - 1 ) {
141+ var endIndex = input .indexOf (" )" , lastParenIndex );
142+ if (endIndex != - 1 ) {
143+ return input .substring (lastParenIndex + 1 , endIndex );
144+ }
145+ }
146+ return " " ;
147+ }
148+
149+ if (curUnlocked .exists (APEntryState .victorySong .trim ().toLowerCase ().replace (' -' , ' ' )) && callVictory )
143150 {
144151 trace (" GOAL COMPLETE" );
145152 callVictory = false ;
@@ -583,52 +590,44 @@ class FreeplayState extends MusicBeatState
583590 {
584591 if (refresh )
585592 {
586- if (CategoryState .loadWeekForce == " all" ){
587- // Add them to Wekk 7 so they're below that week
588- addSong (' Small Argument' , 7 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
589- addSong (' Beat Battle' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
590- addSong (' Beat Battle 2' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
591- }
592- else {
593- for (songName in curUnlocked .keys ()) {
594- if (songName .trim ().toLowerCase ().replace (' -' , ' ' ) == ' small argument' .trim ().toLowerCase ().replace (' -' , ' ' ) && curUnlocked .get (songName ) == ' ' )
595- addSong (' Small Argument' , 7 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
596- if (songName .trim ().toLowerCase ().replace (' -' , ' ' ) == ' beat battle' .trim ().toLowerCase ().replace (' -' , ' ' ) && curUnlocked .get (songName ) == ' ' )
597- addSong (' Beat Battle' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
598- if (songName .trim ().toLowerCase ().replace (' -' , ' ' ) == ' beat battle 2' .trim ().toLowerCase ().replace (' -' , ' ' ) && curUnlocked .get (songName ) == ' ' )
599- addSong (' Beat Battle 2' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
600- }
593+ for (songName in (CategoryState .loadWeekForce == " unplayed" ? curMissing : curUnlocked ).keys ()) {
594+ if (songName .trim ().toLowerCase ().replace (' -' , ' ' ) == ' small argument' .trim ().toLowerCase ().replace (' -' , ' ' ) && (CategoryState .loadWeekForce == " unplayed" ? curMissing : curUnlocked ).get (songName ) == ' ' )
595+ addSong (' Small Argument' , 0 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
596+ if (songName .trim ().toLowerCase ().replace (' -' , ' ' ) == ' beat battle' .trim ().toLowerCase ().replace (' -' , ' ' ) && (CategoryState .loadWeekForce == " unplayed" ? curMissing : curUnlocked ).get (songName ) == ' ' )
597+ addSong (' Beat Battle' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
598+ if (songName .trim ().toLowerCase ().replace (' -' , ' ' ) == ' beat battle 2' .trim ().toLowerCase ().replace (' -' , ' ' ) && (CategoryState .loadWeekForce == " unplayed" ? curMissing : curUnlocked ).get (songName ) == ' ' )
599+ addSong (' Beat Battle 2' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
601600 }
602601 }
603602 else
604603 {
605- if (curUnlocked .exists (' Small Argument' .toLowerCase ()) && Std .string (' Small Argument' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
606- addSong (' Small Argument' , 7 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
607- if (curUnlocked .exists (' Beat Battle' .toLowerCase ()) && Std .string (' Beat Battle' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
608- addSong (' Beat Battle' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
609- if (curUnlocked .exists (' Beat Battle 2' .toLowerCase ()) && Std .string (' Beat Battle 2' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
610- addSong (' Beat Battle 2' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
604+ if (( CategoryState . loadWeekForce == " unplayed " ? curMissing : curUnlocked ) .exists (' Small Argument' .toLowerCase ()) && Std .string (' Small Argument' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && FlxG . save . data . gotIntoAnArgument && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
605+ addSong (' Small Argument' , 0 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
606+ if (( CategoryState . loadWeekForce == " unplayed " ? curMissing : curUnlocked ) .exists (' Beat Battle' .toLowerCase ()) && Std .string (' Beat Battle' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && FlxG . save . data . gotbeatbattle && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
607+ addSong (' Beat Battle' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
608+ if (( CategoryState . loadWeekForce == " unplayed " ? curMissing : curUnlocked ) .exists (' Beat Battle 2' .toLowerCase ()) && Std .string (' Beat Battle 2' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && FlxG . save . data . gotbeatbattle2 && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
609+ addSong (' Beat Battle 2' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
611610 }
612611 }
613612 else
614613 {
615614 if (refresh )
616615 {
617616 if (FlxG .save .data .gotIntoAnArgument && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
618- addSong (' Small Argument' , 7 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
617+ addSong (' Small Argument' , 0 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
619618 if (FlxG .save .data .gotbeatbattle && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
620- addSong (' Beat Battle' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
619+ addSong (' Beat Battle' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
621620 if (FlxG .save .data .gotbeatbattle2 && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
622- addSong (' Beat Battle 2' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
621+ addSong (' Beat Battle 2' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
623622 }
624623 else
625624 {
626625 if (Std .string (' Small Argument' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && FlxG .save .data .gotIntoAnArgument && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
627- addSong (' Small Argument' , 7 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
626+ addSong (' Small Argument' , 0 , " gfchibi" , FlxColor .fromRGB (235 , 100 , 161 ));
628627 if (Std .string (' Beat Battle' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && FlxG .save .data .gotbeatbattle && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
629- addSong (' Beat Battle' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
628+ addSong (' Beat Battle' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
630629 if (Std .string (' Beat Battle 2' ).toLowerCase ().trim ().contains (searchBar .text .toLowerCase ().trim ()) && FlxG .save .data .gotbeatbattle2 && (CategoryState .loadWeekForce == " secrets" || CategoryState .loadWeekForce == " all" ))
631- addSong (' Beat Battle 2' , 7 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
630+ addSong (' Beat Battle 2' , 0 , " gf" , FlxColor .fromRGB (165 , 0 , 77 ));
632631 }
633632 }
634633
@@ -1142,7 +1141,7 @@ class FreeplayState extends MusicBeatState
11421141 return ;
11431142 }
11441143
1145- var vicCheck : Bool = isVictorySong (songs [curSelected ].songName , songs [curSelected ].folder ) && APInfo .ticketWinCount - APInfo .ticketCount <= 0 ; // in case you go over and beyon getting the tickets you need
1144+ var vicCheck : Bool = isVictorySong (songs [curSelected ].songName , songs [curSelected ].folder ) && APInfo .ticketWinCount - APInfo .ticketCount == 0 ;
11461145 // You need the song AND the tickets.
11471146 trace (' can play victory song: ${vicCheck }' );
11481147 if (isVictorySong (songs [curSelected ].songName , songs [curSelected ].folder ) && ! vicCheck ) {
0 commit comments