Skip to content

Commit 4417e87

Browse files
committed
Revert "a"
This reverts commit d8c8ef1.
1 parent acb2a86 commit 4417e87

File tree

7 files changed

+78
-505
lines changed

7 files changed

+78
-505
lines changed

source/archipelago/APEntryState.hx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -418,8 +418,12 @@ class APEntryState extends MusicBeatState
418418
deathLink = slotData.deathlink == 0 ? false : true;
419419
victorySong = slotData.victoryLocation;
420420
fullSongCount = slotData.fullSongCount;
421-
APInfo.ticketWinCount = slotData.ticketWinCount;
422-
APInfo.ticketCount = 0;
421+
try { APInfo.ticketCount = slotData.ticketCount;
422+
APInfo.ticketWinCount = slotData.ticketWinCount;}
423+
catch(e) { APInfo.ticketCount = slotData.ticketCount;
424+
APInfo.ticketWinCount = -1;}
425+
426+
APInfo.ticketCount = 0;
423427
closeSubState();
424428
inArchipelagoMode = true;
425429
var FNF = new FlxSave();

source/archipelago/APGameState.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ class APGameState {
288288

289289
for (songName in song)
290290
{
291-
//trace(ItemIndex + " - " + songName.index);
291+
trace(ItemIndex + " - " + songName.index);
292292

293293
var itemName = info().get_item_name(songName.item);
294294

@@ -386,7 +386,7 @@ class APGameState {
386386

387387
for (items in nonSongsNames)
388388
{
389-
if (items == 'Ticket') archipelago.APItem.createItemByName(items);
389+
if (items == 'ticket') archipelago.APItem.createItemByName(items);
390390
else {
391391
if (nonSongs.get(items) <= ItemIndex)
392392
{

source/archipelago/APItem.hx

Lines changed: 29 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ class APItem {
113113
allItems.push(this);
114114
}
115115

116-
public static function popup(desc:String, ?title:String, ?isWhite:Bool = false):Void {
116+
public static function popup(desc:String):Void {
117117
if (!APGameState.haventranyet) {
118-
archipelago.ArchPopup.startPopupCustom(title != null ? title : "AP Item!", desc, !isWhite ? "archColor" : "archWhite", function() {
118+
archipelago.ArchPopup.startPopupCustom("AP Item!", desc, "archColor", function() {
119119
FlxG.sound.playMusic(Paths.sound('secret'));});
120120
}
121121
}
@@ -127,13 +127,12 @@ class APItem {
127127
// Check if shields are available
128128
if (shields > 0) {
129129
shields--;
130-
popup('Shields left: $shields', "Death Avoided!", true);
130+
ArchPopup.startPopupCustom("Death Avoided!", 'Shields left: $shields', "archWhite");
131131
return; // Do nothing else if shields are consumed
132132
}
133133

134134
// Ensure we are in APPlayState
135135
if (!Std.is(FlxG.state, archipelago.APPlayState)) {
136-
popup('Unfortunate...', "APItem: Blue Balls Curse (Trap)", true);
137136
// Switch to APPlayState if not already there
138137
FlxG.switchState(new archipelago.APPlayState());
139138
}
@@ -157,95 +156,88 @@ class APItem {
157156
case "Fake Transition":
158157
return new APItem(name, ConditionHelper.Everywhere(), function() TransitionState.fakeTransition({transitionType:"transparent close"}), true, false);
159158
case "Ticket":
160-
return new APItem(name, ConditionHelper.Everywhere(), function() {popup("One step closer...", "You got a ticket!");
159+
return new APItem(name, ConditionHelper.Everywhere(), function() {popup("You got a ticket!");
161160
archipelago.APInfo.ticketCount++;
162161
}, true, true);
163162
case "SvC Effect":
164-
return new APItem(name, ConditionHelper.PlayState(), function() {
165-
APPlayState.instance.doEffect(APPlayState.instance.effectArray[APPlayState.instance.curEffect]);
166-
popup('Effect: ${APPlayState.instance.effectArray[APPlayState.instance.curEffect]}', "APItem: SvC Effect (Trap)", true);
167-
}, true, false);
163+
return new APItem(name, ConditionHelper.PlayState(), function() APPlayState.instance.doEffect(APPlayState.instance.effectArray[APPlayState.instance.curEffect]), true, false);
168164
case "Ghost Chat":
169-
return new APItem(name, ConditionHelper.PlayState(), function() {
170-
APPlayState.instance.triggerGhostChat();
171-
popup('I wish you luck...', "APItem: SvC Effect (Trap)", true);
172-
}, true, false);
165+
return new APItem(name, ConditionHelper.PlayState(), function() APPlayState.instance.triggerGhostChat(), true, false);
173166
case "Shield":
174167
return new APItem(name, ConditionHelper.Everywhere(), function() {
175168
shields++;
176169
trace("Shield acquired! Current shields: " + shields);
177-
popup('Shields left: $shields', "APItem: Shield");
170+
popup("You got a shield!");
178171
}, true, true);
179172
case "Max HP Up":
180173
return new APItem(name, ConditionHelper.Everywhere(), function() {
181174
maxHPUp++;
182175
trace("Max HP increased! Current max HP: " + maxHPUp);
183-
popup('Current Max HP: +$maxHPUp', "APItem: Max HP Increase");
176+
popup("You got a max HP up!");
184177
}, true, true);
185178
case "Tutorial Trap":
186179
return new APItem(name, ConditionHelper.PlayState(), function() {
187180
// Wait for PlayState's startedCountdown to become active
188181
haxe.Timer.delay(function checkCountdown() {
189182
var playState:archipelago.APPlayState = cast states.PlayState.instance;
190183
if (playState != null && playState.startedCountdown) {
191-
popup('Go relearn the basics and then come back.', "APItem: Tutorial (trap)");
192184
APPlayState.instance.doEffect('songSwitch');
193185
} else {
194186
// Retry after a short delay if countdown hasn't started
195187
haxe.Timer.delay(checkCountdown, 100);
196188
}
197189
}, 100);
198-
}, false, false);
190+
}, true, false);
199191
default:
200192
throw "Unknown item name: " + name;
201193
}
202194
}
203195

204196
public function trigger():Void {
205-
//trace('is Gonna Run Sync: ${APGameState.isSync}');
197+
trace('is Gonna Run Sync: ${APGameState.isSync}');
206198
if (APInfo.ap.firstSync && this.toSync) {
207-
//trace("RUNNING FIRST SYNC!");
208-
//trace("Triggering item: " + this.name);
209-
//trace("Is exception: " + this.isException);
210-
//trace("Condition type: " + this.condition.type);
211-
//trace("Condition check result: " + this.condition.checkFn(this));
199+
trace("RUNNING FIRST SYNC!");
200+
trace("Triggering item: " + this.name);
201+
trace("Is exception: " + this.isException);
202+
trace("Condition type: " + this.condition.type);
203+
trace("Condition check result: " + this.condition.checkFn(this));
212204

213205
if (!this.isException && this.condition.type != ConditionType.Everywhere && this.condition.checkFn(this)) {
214-
//trace("Setting active item to: " + this.name);
206+
trace("Setting active item to: " + this.name);
215207
APItem.activeItem = this;
216208
} else {
217-
//trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
209+
trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
218210
}
219211

220212
if (this.condition.checkFn(this)) {
221-
//trace("Condition passed, executing onTrigger for item: " + this.name);
213+
trace("Condition passed, executing onTrigger for item: " + this.name);
222214
onTrigger();
223215
} else {
224-
//trace("Condition failed, onTrigger not executed for item: " + this.name);
216+
trace("Condition failed, onTrigger not executed for item: " + this.name);
225217
}
226218
} else if (!APInfo.ap.firstSync) {
227-
//trace("RUNNING NORMAL SYNC!");
228-
//trace("Triggering item: " + this.name);
229-
//trace("Is exception: " + this.isException);
230-
// trace("Condition type: " + this.condition.type);
231-
// trace("Condition check result: " + this.condition.checkFn(this));
219+
trace("RUNNING NORMAL SYNC!");
220+
trace("Triggering item: " + this.name);
221+
trace("Is exception: " + this.isException);
222+
trace("Condition type: " + this.condition.type);
223+
trace("Condition check result: " + this.condition.checkFn(this));
232224

233225
if (!this.isException && this.condition.type != ConditionType.Everywhere && this.condition.checkFn(this)) {
234-
//trace("Setting active item to: " + this.name);
226+
trace("Setting active item to: " + this.name);
235227
APItem.activeItem = this;
236228
} else {
237-
//trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
229+
trace("Active item not set due to condition, exception rules, or being an Everywhere item.");
238230
}
239231

240232
if (this.condition.checkFn(this)) {
241-
//trace("Condition passed, executing onTrigger for item: " + this.name);
233+
trace("Condition passed, executing onTrigger for item: " + this.name);
242234
onTrigger();
243235
} else {
244-
//trace("Condition failed, onTrigger not executed for item: " + this.name);
236+
trace("Condition failed, onTrigger not executed for item: " + this.name);
245237
}
246238
}
247239

248-
//trace("Removing item from allItems: " + this.name);
240+
trace("Removing item from allItems: " + this.name);
249241
allItems.remove(this);
250242
}
251243

source/archipelago/APPlayState.hx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,8 +2076,7 @@ class APPlayState extends PlayState {
20762076

20772077
super.endSong();
20782078
paused = true;
2079-
states.FreeplayState.lastSongPlayed = PlayState.SONG.song;
2080-
states.FreeplayState.lastModPlayed = currentMod;
2079+
states.FreeplayState.callVictory = PlayState.SONG.song == APEntryState.victorySong;
20812080
openSubState(new substates.RankingSubstate());
20822081
return true; //why does endsong need this?????
20832082
}

source/backend/TransitionState.hx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,6 @@ class TransitionState {
503503
{
504504
restoreSprites();
505505
CppAPI.setWindowOppacity(1);
506-
archipelago.ArchPopup.startPopupCustom("APItem: Fake Transition (Trap)", 'Gotcha!', "archWhite");
507506
}},
508507
function(num)
509508
{

source/states/FreeplayState.hx

Lines changed: 37 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ import backend.Song;
88
import objects.HealthIcon;
99
import 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

1517
import flixel.addons.ui.FlxUIInputText;
@@ -23,6 +25,7 @@ import flixel.ui.FlxButton;
2325
import flixel.input.keyboard.FlxKey;
2426
import flixel.util.FlxDestroyUtil;
2527
import haxe.Json;
28+
import archipelago.PacketTypes.ClientStatus;
2629
import yutautil.ChanceSelector;
2730
import 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\nFrom Mod: $lastModPlayed\nIs 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

Comments
 (0)