using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using System.Threading.Tasks; using Archipelago.MultiClient.Net; using Archipelago.MultiClient.Net.Enums; using Archipelago.MultiClient.Net.Helpers; using Archipelago.MultiClient.Net.MessageLog.Messages; using Archipelago.MultiClient.Net.Models; using BaboonAPI.Hooks; using BaboonAPI.Hooks.Initializer; using BaboonAPI.Hooks.Tracks; using BaboonAPI.Hooks.Tracks.Collections; using BaboonAPI.Utility; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Microsoft.FSharp.Core; using Newtonsoft.Json.Linq; using UnityEngine; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("APTromboneChampMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.0.1.0")] [assembly: AssemblyInformationalVersion("0.0.1+1caaa7df41fdce53c53ec6051452c809c1b056e9")] [assembly: AssemblyProduct("AP Trombone")] [assembly: AssemblyTitle("APTromboneChampMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace APTromboneChampMod { public static class APHandler { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func <>9__12_0; public static Func <>9__12_1; public static Func <>9__15_0; public static Func <>9__21_0; public static Func <>9__23_1; public static Func <>9__23_2; public static Func <>9__24_0; public static Func <>9__24_1; public static Func <>9__25_0; public static Func <>9__25_1; public static Func <>9__26_0; public static ItemReceivedHandler <>9__28_0; public static CheckedLocationsUpdatedHandler <>9__28_1; public static Func <>9__28_7; public static Action <>9__28_2; public static SocketClosedHandler <>9__28_3; public static MessageReceivedHandler <>9__28_4; public static Func <>9__28_10; public static Action> <>9__28_5; public static Func <>9__38_1; public static Action> <>9__38_0; internal bool b__12_0(long id) { return id == 1011; } internal bool b__12_1(long id) { return id == 1004; } internal bool b__15_0(long id) { return id == 1001; } internal bool b__21_0(long id) { return id == 1011; } internal bool b__23_1(long id) { return id == 1011; } internal bool b__23_2(Hint hint) { return hint.ReceivingPlayer == APSlot && hint.ItemId == 1011; } internal bool b__24_0(long id) { return id == 1001; } internal bool b__24_1(Hint hint) { return hint.ReceivingPlayer == APSlot && hint.ItemId == 1001; } internal bool b__25_0(long id) { return id == 1004; } internal bool b__25_1(Hint hint) { return hint.ReceivingPlayer == APSlot && hint.ItemId == 1004; } internal bool b__26_0(long id) { return id > 1000; } internal void b__28_0(ReceivedItemsHelper helper) { List list = new List(); while (helper.Any()) { ItemInfo val = helper.PeekItem(); if (val.ItemId == 1003) { if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - LastFunFact > 1000) { LastFunFact = DateTimeOffset.Now.ToUnixTimeMilliseconds(); if (UnseenFacts.Count == 0) { UnseenFacts.AddRange(FunFacts); ListExtensions.Shuffle((IList)UnseenFacts); } APSession.Say("FUN FACT: " + UnseenFacts[0]); UnseenFacts.RemoveAt(0); } } else if (val.ItemId != 1002) { long itemId = val.ItemId; if (((ulong)(itemId - 1005) <= 4uL) ? true : false) { if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - ConnectTime > 10000) { long itemId2 = val.ItemId; long num = itemId2; long num2 = num - 1005; if ((ulong)num2 <= 4uL) { switch (num2) { case 0L: APTrapController.AddTrap(APTrapController.TrapType.FlipControls); break; case 1L: APTrapController.AddTrap(APTrapController.TrapType.SilenceTrack); break; case 2L: APTrapController.AddTrap(APTrapController.TrapType.SilenceTrombone); break; case 3L: APTrapController.AddTrap(APTrapController.TrapType.HideNotes); break; case 4L: APTrapController.AddTrap(APTrapController.TrapType.NoBreath); break; } } } } else { APTrapController.TrapType trap = APTrapController.TrapType.GetTrap(val.ItemId); if (trap != null) { if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - ConnectTime > 10000) { APTrapController.AddTrap(trap); } } else { list.Add(val.ItemId); } } } helper.DequeueItem(); } OnReceivedItems(list); } internal void b__28_1(ReadOnlyCollection locs) { lock (APSentLocations) { using IEnumerator enumerator = locs.GetEnumerator(); while (enumerator.MoveNext()) { <>c__DisplayClass28_0 CS$<>8__locals0 = new <>c__DisplayClass28_0 { loc = enumerator.Current }; if (APSentLocations.Contains(CS$<>8__locals0.loc)) { continue; } APSentLocations.Add(CS$<>8__locals0.loc); Hint[] aPReceivedHints = APReceivedHints; foreach (Hint val in aPReceivedHints) { if (val.FindingPlayer == APSlot && val.LocationId == CS$<>8__locals0.loc) { APReceivedHints = APReceivedHints.Where((Hint it) => it.FindingPlayer != APSlot || it.LocationId != CS$<>8__locals0.loc).ToArray(); break; } } } } OnTrackAvailabilityChanged(); } internal void b__28_2(Hint[] hints) { APReceivedHints = hints.Where((Hint hint) => !hint.Found).ToArray(); OnHintsChanged(); } internal bool b__28_7(Hint hint) { return !hint.Found; } internal void b__28_3(string reason) { ArchipelagoPlugin.Logger.LogInfo((object)("Socket closed: " + reason)); APSlot = -1; APSession = null; OnWorldSettingsChanged(); } internal void b__28_4(LogMessage message) { //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown HintItemSendLogMessage val = (HintItemSendLogMessage)(object)((message is HintItemSendLogMessage) ? message : null); if (val != null) { if (!((ItemSendLogMessage)val).IsRelatedToActivePlayer) { return; } <>c__DisplayClass28_1 CS$<>8__locals1 = new <>c__DisplayClass28_1 { sender = ((ItemSendLogMessage)val).Sender.Slot, receiver = ((ItemSendLogMessage)val).Receiver.Slot }; bool isFound = val.IsFound; long itemId = ((ItemSendLogMessage)val).Item.ItemId; CS$<>8__locals1.location = ((ItemSendLogMessage)val).Item.LocationId; bool flag = false; Hint[] aPReceivedHints = APReceivedHints; foreach (Hint val2 in aPReceivedHints) { if (val2.FindingPlayer != CS$<>8__locals1.sender || val2.ReceivingPlayer != CS$<>8__locals1.receiver || val2.LocationId != CS$<>8__locals1.location) { continue; } flag = true; if (isFound) { APReceivedHints = APReceivedHints.Where((Hint it) => it.FindingPlayer != CS$<>8__locals1.sender || it.ReceivingPlayer != CS$<>8__locals1.receiver || it.LocationId != CS$<>8__locals1.location).ToArray(); } OnHintsChanged(); break; } if (!isFound && !flag) { Hint[] aPReceivedHints2 = APReceivedHints; int num = 0; Hint[] array = (Hint[])(object)new Hint[1 + aPReceivedHints2.Length]; ReadOnlySpan val3 = default(ReadOnlySpan); val3..ctor(aPReceivedHints2); val3.CopyTo(new Span(array).Slice(num, val3.Length)); num += val3.Length; array[num] = new Hint { Entrance = "", FindingPlayer = CS$<>8__locals1.sender, Found = false, ItemFlags = ((ItemSendLogMessage)val).Item.Flags, ItemId = itemId, LocationId = CS$<>8__locals1.location, ReceivingPlayer = CS$<>8__locals1.receiver, Status = (HintStatus)(((((ItemSendLogMessage)val).Item.Flags & 4) != 0) ? 20 : (((int)((ItemSendLogMessage)val).Item.Flags == 0) ? 10 : 30)) }; APReceivedHints = array; OnHintsChanged(); } if (ArchipelagoPlugin.SendChatToLog) { ArchipelagoPlugin.Logger.LogInfo((object)((object)message).ToString()); } return; } ItemSendLogMessage val4 = (ItemSendLogMessage)(object)((message is ItemSendLogMessage) ? message : null); if (val4 != null) { if (!val4.IsRelatedToActivePlayer) { return; } <>c__DisplayClass28_2 CS$<>8__locals0 = new <>c__DisplayClass28_2 { sender = val4.Sender.Slot, receiver = val4.Receiver.Slot, location = val4.Item.LocationId }; Hint[] aPReceivedHints3 = APReceivedHints; foreach (Hint val5 in aPReceivedHints3) { if (val5.FindingPlayer == CS$<>8__locals0.sender && val5.ReceivingPlayer == CS$<>8__locals0.receiver && val5.LocationId == CS$<>8__locals0.location) { APReceivedHints = APReceivedHints.Where((Hint it) => it.FindingPlayer != CS$<>8__locals0.sender || it.ReceivingPlayer != CS$<>8__locals0.receiver || it.LocationId != CS$<>8__locals0.location).ToArray(); OnHintsChanged(); break; } } if (ArchipelagoPlugin.SendChatToLog) { ArchipelagoPlugin.Logger.LogInfo((object)((object)message).ToString()); } } else if (ArchipelagoPlugin.SendChatToLog) { ArchipelagoPlugin.Logger.LogInfo((object)((object)message).ToString()); } } internal void b__28_5(Task task) { if (task.IsCompletedSuccessfully) { APReceivedHints = task.Result.Where((Hint hint) => !hint.Found).ToArray(); OnHintsChanged(); } } internal bool b__28_10(Hint hint) { return !hint.Found; } internal bool b__38_1(TrackCollection coll) { return coll._unique_id == "all"; } internal void b__38_0(FSharpResult _) { } } [CompilerGenerated] private sealed class <>c__DisplayClass28_0 { public long loc; public Func <>9__6; internal bool b__6(Hint it) { return it.FindingPlayer != APSlot || it.LocationId != loc; } } [CompilerGenerated] private sealed class <>c__DisplayClass28_1 { public int sender; public int receiver; public long location; public Func <>9__8; internal bool b__8(Hint it) { return it.FindingPlayer != sender || it.ReceivingPlayer != receiver || it.LocationId != location; } } [CompilerGenerated] private sealed class <>c__DisplayClass28_2 { public int sender; public int receiver; public long location; public Func <>9__9; internal bool b__9(Hint it) { return it.FindingPlayer != sender || it.ReceivingPlayer != receiver || it.LocationId != location; } } public static APSettings WorldSettings = new APSettings(); public static Track[] FilteredTracks = Array.Empty(); public static Track[] AvailableTracks = Array.Empty(); public static Track? GoalTrack = null; public static ArchipelagoSession APSession = null; public static int APTeam = -1; public static int APSlot = -1; public static readonly Version APVersion = new Version(0, 6, 7); public static readonly List APFoundItems = new List(); public static readonly List APSentLocations = new List(); public static Hint[] APReceivedHints = Array.Empty(); private static readonly string[] RatingToString = new string[4] { "C", "B", "A", "S" }; public static long ConnectTime; private static long LastFunFact; private static readonly string[] FunFacts = new string[26] { "It takes one-thousand workers a full year to produce a single trombone.", "The trombone is related to the trumpet (they are cousins).", "The trombone is not related to the French Horn (they are just friends).", "Some claim that Mozart's last words before dying were \"At least I got to use a trombone.\"", "A student's trombone generally costs between $100 and $300, but a professional trombone can cost over two billion dollars.", "To this day, scientists don't really know how a trombone makes sound.", "A professional trombone player is known as a \"tromboner\".", "Thirty-four countries have outlawed the use of the trombone. In six countries, playing trombone is punishable by death.", "Trombones contain \"spit valves\" that allow you to blow gobs of your nasty spit all over the floor.", "Without trombones, there could never have been \"ska\" music. Draw your own conclusions from this factoid.", "The average baboon can live to be over 300 years old.", "There are more baboons on Earth than humans.", "Prehistoric trombones were forty feet long and could weigh over six hundred pounds.", "Trombones do not float in water, so do not accidentally drop your trombone into the river last week.", "Cows love the sound of a trombone (because they are smart).", "Playing trombone in your apartment is a great way to make friends with your neighbors.", "Despite its name, the trombone does not have any bones.", "There are between 2 and 4 spiders living inside the average trombone.", "The first trombone was invented in 20,000,000 B.C.", "If you placed all of the trombones on Earth end-to-end, they would wrap around the solar system 4 times.", "There are more trombones on Earth than there are humans.", "The highest note playable on trombones is so high-pitched that only certain species of bats can hear it.", "The world record for \"Most Trombones Owned\" is held by Mike Brass of Omaha, Nebraska. He owns two trombones.", "It takes over three thousand tons of brass to produce a single trombone.", "In real life, there are over nine songs that feature a trombone.", "In England, \"trombone\" is spelled \"troumboune\"." }; private static List UnseenFacts = new List(); private static List ItemQueue = new List(); private static object ItemQueueProcessLock = new object(); private static object TrackUpdateLock = new object(); public static Track? FindTrack(string name) { Track value = FilteredTracks.FirstOrDefault((Track track) => track.Name == name); if (value.Name != name) { return null; } return value; } public static bool IsTrackAvailable(Track track) { if (APSession == null || APSlot == -1) { return false; } if (!FilteredTracks.Contains(track)) { return false; } if (WorldSettings.TrackGating && !APFoundItems.Contains(track.ID)) { return false; } if (track.Difficulty > WorldSettings.MinDiff) { if (WorldSettings.DifficultyGating == APSettings.DiffGateType.ON && !APFoundItems.Contains(1010L + (long)track.Difficulty)) { return false; } if (WorldSettings.DifficultyGating == APSettings.DiffGateType.PROG) { int num = track.Difficulty - WorldSettings.MinDiff; if (num > APFoundItems.Count((long id) => id == 1011)) { return false; } } } if (track.Name == WorldSettings.GoalTrack) { int num2 = APFoundItems.Count((long id) => id == 1004); if (num2 < WorldSettings.HotDogs) { return false; } } return true; } public static string GetRatingString(int rating) { if (rating < 0) { rating = 0; } if (rating >= RatingToString.Length) { rating = RatingToString.Length - 1; } return RatingToString[rating]; } public static int GetRequiredRating() { int initialRating = WorldSettings.InitialRating; return initialRating - APFoundItems.Count((long id) => id == 1001); } public static void SendTrack(Track track, bool beaten) { if (APSession != null && APSlot != -1 && IsTrackAvailable(track)) { long[] array = ((!beaten) ? new long[1] { track.ID } : new long[2] { track.ID, track.ID + 1000 }); APSession.Locations.CompleteLocationChecksAsync(array); if (beaten && HasGoaled(track.ID)) { APSession.SetGoalAchieved(); } } } public static bool CanHint() { if (APSession == null || APSlot == -1) { return false; } return APSession.RoomState.HintPoints >= APSession.RoomState.HintCost; } public static string FormatItemHint(Hint hint) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (hint == null) { return "-"; } if (hint.ReceivingPlayer == APSlot) { return APSession.Items.GetItemName(hint.ItemId, (string)null); } PlayerInfo playerInfo = APSession.Players.GetPlayerInfo(hint.ReceivingPlayer); string game = playerInfo.Game; string itemName = APSession.Items.GetItemName(hint.ItemId, game); return $"{playerInfo.Alias}'s {itemName} ({hint.Status})"; } public static string FormatLocationString(Hint hint) { if (hint == null) { return "-"; } if (hint.FindingPlayer == APSlot) { return APSession.Locations.GetLocationNameFromId(hint.LocationId, (string)null); } PlayerInfo playerInfo = APSession.Players.GetPlayerInfo(hint.FindingPlayer); string game = playerInfo.Game; string locationNameFromId = APSession.Locations.GetLocationNameFromId(hint.LocationId, game); if (hint.Entrance != "") { return playerInfo.Alias + "'s " + locationNameFromId + " (" + hint.Entrance + ")"; } return playerInfo.Alias + "'s " + locationNameFromId; } public static string FormatFullHint(Hint hint) { //IL_0138: Unknown result type (might be due to invalid IL or missing references) if (hint == null) { return "-"; } PlayerInfo playerInfo = APSession.Players.GetPlayerInfo(hint.FindingPlayer); PlayerInfo playerInfo2 = APSession.Players.GetPlayerInfo(hint.ReceivingPlayer); string locationNameFromId = APSession.Locations.GetLocationNameFromId(hint.LocationId, playerInfo.Game); string itemName = APSession.Items.GetItemName(hint.ItemId, playerInfo2.Game); bool flag = hint.ReceivingPlayer == hint.FindingPlayer; string text = ""; if (hint.Entrance != "") { text = " (" + hint.Entrance + ")"; } if (flag) { return itemName + " is at " + locationNameFromId; } string text2 = playerInfo2.Alias + "'s "; if (playerInfo2.Slot == APSlot) { text2 = ""; } string text3 = playerInfo.Alias + "'s "; if (playerInfo.Slot == APSlot) { text3 = ""; } string text4 = $" ({hint.Status})"; if (playerInfo2.Slot == APSlot) { text4 = ""; } return text2 + itemName + " is at " + text3 + locationNameFromId + text + text4; } public static TrackHints GetTrackHints(Track track) { TrackHints result = new TrackHints(); if (WorldSettings.TrackGating && !APFoundItems.Contains(track.ID)) { Hint trackUnlock = null; Hint[] aPReceivedHints = APReceivedHints; foreach (Hint val in aPReceivedHints) { if (val.ReceivingPlayer == APSlot && val.ItemId == track.ID) { trackUnlock = val; break; } } result.TrackUnlock = trackUnlock; } if (track.Difficulty > WorldSettings.MinDiff) { if (WorldSettings.DifficultyGating == APSettings.DiffGateType.ON && !APFoundItems.Contains(1010L + (long)track.Difficulty)) { Hint val2 = null; Hint[] aPReceivedHints2 = APReceivedHints; foreach (Hint val3 in aPReceivedHints2) { if (val3.ReceivingPlayer == APSlot && val3.ItemId == 1010L + (long)track.Difficulty) { val2 = val3; break; } } result.DifficultyUnlocks = (Hint[])(object)new Hint[1] { val2 }; } if (WorldSettings.DifficultyGating == APSettings.DiffGateType.PROG) { int num = track.Difficulty - WorldSettings.MinDiff; int num2 = APFoundItems.Count((long id) => id == 1011); if (num2 < num) { int num3 = WorldSettings.MaxDiff - WorldSettings.MinDiff; num3 -= num2; Hint[] array = (Hint[])(object)new Hint[num3]; int num4 = 0; Hint[] aPReceivedHints3 = APReceivedHints; foreach (Hint val4 in aPReceivedHints3) { if (val4.ReceivingPlayer == APSlot && val4.ItemId == 1011) { array[num4++] = val4; } } result.DifficultyUnlocks = array; } } } if (!APSentLocations.Contains(track.ID)) { Hint playReward = null; Hint[] aPReceivedHints4 = APReceivedHints; foreach (Hint val5 in aPReceivedHints4) { if (val5.FindingPlayer == APSlot && val5.LocationId == track.ID) { playReward = val5; break; } } result.PlayReward = playReward; } if (!APSentLocations.Contains(track.ID + 1000)) { Hint beatReward = null; Hint[] aPReceivedHints5 = APReceivedHints; foreach (Hint val6 in aPReceivedHints5) { if (val6.FindingPlayer == APSlot && val6.LocationId == track.ID + 1000) { beatReward = val6; break; } } result.BeatReward = beatReward; } return result; } public static void TryHintTrack(Track track) { if (WorldSettings.TrackGating && CanHint() && !APReceivedHints.Any((Hint hint) => hint.ReceivingPlayer == APSlot && hint.ItemId == track.ID)) { string itemName = APSession.Items.GetItemName(track.ID, (string)null); if (itemName != null) { APSession.Say("!hint " + itemName); } } } public static void TryHintDifficulty(int diff) { if (WorldSettings.DifficultyGating == APSettings.DiffGateType.OFF || !CanHint() || (WorldSettings.DifficultyGating == APSettings.DiffGateType.ON && APReceivedHints.Any((Hint hint) => hint.ReceivingPlayer == APSlot && hint.ItemId == 1010L + (long)diff))) { return; } if (WorldSettings.DifficultyGating == APSettings.DiffGateType.PROG) { diff = 1; int num = WorldSettings.MaxDiff - WorldSettings.MinDiff - APFoundItems.Count((long id) => id == 1011); if (num == 0) { return; } int num2 = APReceivedHints.Count((Hint hint) => hint.ReceivingPlayer == APSlot && hint.ItemId == 1011); if (num2 >= num) { return; } } string itemName = APSession.Items.GetItemName(1010L + (long)diff, (string)null); if (itemName != null) { APSession.Say("!hint " + itemName); } } public static void TryHintRankReduction() { if (WorldSettings.GoalRating == WorldSettings.InitialRating || !CanHint()) { return; } int num = WorldSettings.InitialRating - WorldSettings.GoalRating - APFoundItems.Count((long id) => id == 1001); if (num == 0) { return; } int num2 = APReceivedHints.Count((Hint hint) => hint.ReceivingPlayer == APSlot && hint.ItemId == 1001); if (num2 < num) { string itemName = APSession.Items.GetItemName(1001L, (string)null); if (itemName != null) { APSession.Say("!hint " + itemName); } } } public static void TryHintHotDog() { if (WorldSettings.HotDogs == 0 || !CanHint()) { return; } int num = WorldSettings.HotDogs + WorldSettings.ExtraHotDogs; int num2 = APFoundItems.Count((long id) => id == 1004); if (num2 >= WorldSettings.HotDogs) { return; } num -= num2; num2 = APReceivedHints.Count((Hint hint) => hint.ReceivingPlayer == APSlot && hint.ItemId == 1004); if (num2 < num) { string itemName = APSession.Items.GetItemName(1004L, (string)null); if (itemName != null) { APSession.Say("!hint " + itemName); } } } public static bool HasGoaled(long lastTrackBeaten = -1L) { if (WorldSettings.GoalTracks == 0) { if (GoalTrack.HasValue) { if (lastTrackBeaten == GoalTrack.Value.ID || APSentLocations.Contains(GoalTrack.Value.ID + 1000)) { return true; } } else { ArchipelagoPlugin.Logger.LogWarning((object)"Goal tracks is 0 and no goal track is set!"); } return false; } int num = APSentLocations.Count((long id) => id > 1000); if (lastTrackBeaten != -1 && !APSentLocations.Contains(lastTrackBeaten + 1000)) { num++; } return num >= WorldSettings.GoalTracks; } public static void ConnectToAP(string host, int port, string slot, string pass) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Expected O, but got Unknown //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) ArchipelagoPlugin.Logger.LogInfo((object)$"Connecting to {host}:{port}"); ArchipelagoSession aPSession = APSession; if (aPSession != null) { aPSession.Socket.DisconnectAsync(); } APSession = null; APSlot = -1; APReceivedHints = Array.Empty(); APFoundItems.Clear(); APSentLocations.Clear(); OnWorldSettingsChanged(); try { APSession = ArchipelagoSessionFactory.CreateSession(host, port); IReceivedItemsHelper items = APSession.Items; object obj = <>c.<>9__28_0; if (obj == null) { ItemReceivedHandler val = delegate(ReceivedItemsHelper helper) { List list = new List(); while (helper.Any()) { ItemInfo val15 = helper.PeekItem(); if (val15.ItemId == 1003) { if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - LastFunFact > 1000) { LastFunFact = DateTimeOffset.Now.ToUnixTimeMilliseconds(); if (UnseenFacts.Count == 0) { UnseenFacts.AddRange(FunFacts); ListExtensions.Shuffle((IList)UnseenFacts); } APSession.Say("FUN FACT: " + UnseenFacts[0]); UnseenFacts.RemoveAt(0); } } else if (val15.ItemId != 1002) { long itemId2 = val15.ItemId; if (((ulong)(itemId2 - 1005) <= 4uL) ? true : false) { if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - ConnectTime > 10000) { long itemId3 = val15.ItemId; long num2 = itemId3; long num3 = num2 - 1005; if ((ulong)num3 <= 4uL) { switch (num3) { case 0L: APTrapController.AddTrap(APTrapController.TrapType.FlipControls); break; case 1L: APTrapController.AddTrap(APTrapController.TrapType.SilenceTrack); break; case 2L: APTrapController.AddTrap(APTrapController.TrapType.SilenceTrombone); break; case 3L: APTrapController.AddTrap(APTrapController.TrapType.HideNotes); break; case 4L: APTrapController.AddTrap(APTrapController.TrapType.NoBreath); break; } } } } else { APTrapController.TrapType trap = APTrapController.TrapType.GetTrap(val15.ItemId); if (trap != null) { if (DateTimeOffset.Now.ToUnixTimeMilliseconds() - ConnectTime > 10000) { APTrapController.AddTrap(trap); } } else { list.Add(val15.ItemId); } } } helper.DequeueItem(); } OnReceivedItems(list); }; <>c.<>9__28_0 = val; obj = (object)val; } items.ItemReceived += (ItemReceivedHandler)obj; ILocationCheckHelper locations = APSession.Locations; object obj2 = <>c.<>9__28_1; if (obj2 == null) { CheckedLocationsUpdatedHandler val2 = delegate(ReadOnlyCollection locs) { lock (APSentLocations) { foreach (long loc in locs) { if (!APSentLocations.Contains(loc)) { APSentLocations.Add(loc); Hint[] aPReceivedHints4 = APReceivedHints; foreach (Hint val14 in aPReceivedHints4) { if (val14.FindingPlayer == APSlot && val14.LocationId == loc) { APReceivedHints = APReceivedHints.Where((Hint it) => it.FindingPlayer != APSlot || it.LocationId != loc).ToArray(); break; } } } } } OnTrackAvailabilityChanged(); }; <>c.<>9__28_1 = val2; obj2 = (object)val2; } locations.CheckedLocationsUpdated += (CheckedLocationsUpdatedHandler)obj2; APSession.Hints.TrackHints((Action)delegate(Hint[] hints) { APReceivedHints = hints.Where((Hint hint) => !hint.Found).ToArray(); OnHintsChanged(); }, true, (int?)null, (int?)null); IArchipelagoSocketHelper socket = APSession.Socket; object obj3 = <>c.<>9__28_3; if (obj3 == null) { SocketClosedHandler val3 = delegate(string reason) { ArchipelagoPlugin.Logger.LogInfo((object)("Socket closed: " + reason)); APSlot = -1; APSession = null; OnWorldSettingsChanged(); }; <>c.<>9__28_3 = val3; obj3 = (object)val3; } socket.SocketClosed += (SocketClosedHandler)obj3; IMessageLogHelper messageLog = APSession.MessageLog; object obj4 = <>c.<>9__28_4; if (obj4 == null) { MessageReceivedHandler val4 = delegate(LogMessage message) { //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown HintItemSendLogMessage val9 = (HintItemSendLogMessage)(object)((message is HintItemSendLogMessage) ? message : null); if (val9 != null) { if (((ItemSendLogMessage)val9).IsRelatedToActivePlayer) { int sender2 = ((ItemSendLogMessage)val9).Sender.Slot; int receiver2 = ((ItemSendLogMessage)val9).Receiver.Slot; bool isFound = val9.IsFound; long itemId = ((ItemSendLogMessage)val9).Item.ItemId; long location2 = ((ItemSendLogMessage)val9).Item.LocationId; bool flag = false; Hint[] aPReceivedHints = APReceivedHints; foreach (Hint val10 in aPReceivedHints) { if (val10.FindingPlayer == sender2 && val10.ReceivingPlayer == receiver2 && val10.LocationId == location2) { flag = true; if (isFound) { APReceivedHints = APReceivedHints.Where((Hint it) => it.FindingPlayer != sender2 || it.ReceivingPlayer != receiver2 || it.LocationId != location2).ToArray(); } OnHintsChanged(); break; } } if (!isFound && !flag) { Hint[] aPReceivedHints2 = APReceivedHints; int num = 0; Hint[] array = (Hint[])(object)new Hint[1 + aPReceivedHints2.Length]; ReadOnlySpan val11 = default(ReadOnlySpan); val11..ctor(aPReceivedHints2); val11.CopyTo(new Span(array).Slice(num, val11.Length)); num += val11.Length; array[num] = new Hint { Entrance = "", FindingPlayer = sender2, Found = false, ItemFlags = ((ItemSendLogMessage)val9).Item.Flags, ItemId = itemId, LocationId = location2, ReceivingPlayer = receiver2, Status = (HintStatus)(((((ItemSendLogMessage)val9).Item.Flags & 4) != 0) ? 20 : (((int)((ItemSendLogMessage)val9).Item.Flags == 0) ? 10 : 30)) }; APReceivedHints = array; OnHintsChanged(); } if (ArchipelagoPlugin.SendChatToLog) { ArchipelagoPlugin.Logger.LogInfo((object)((object)message).ToString()); } } } else { ItemSendLogMessage val12 = (ItemSendLogMessage)(object)((message is ItemSendLogMessage) ? message : null); if (val12 != null) { if (val12.IsRelatedToActivePlayer) { int sender = val12.Sender.Slot; int receiver = val12.Receiver.Slot; long location = val12.Item.LocationId; Hint[] aPReceivedHints3 = APReceivedHints; foreach (Hint val13 in aPReceivedHints3) { if (val13.FindingPlayer == sender && val13.ReceivingPlayer == receiver && val13.LocationId == location) { APReceivedHints = APReceivedHints.Where((Hint it) => it.FindingPlayer != sender || it.ReceivingPlayer != receiver || it.LocationId != location).ToArray(); OnHintsChanged(); break; } } if (ArchipelagoPlugin.SendChatToLog) { ArchipelagoPlugin.Logger.LogInfo((object)((object)message).ToString()); } } } else if (ArchipelagoPlugin.SendChatToLog) { ArchipelagoPlugin.Logger.LogInfo((object)((object)message).ToString()); } } }; <>c.<>9__28_4 = val4; obj4 = (object)val4; } messageLog.OnMessageReceived += (MessageReceivedHandler)obj4; ConnectTime = DateTimeOffset.Now.ToUnixTimeMilliseconds(); LoginResult val5 = APSession.TryConnectAndLogin("Trombone Champ", slot, (ItemsHandlingFlags)7, APVersion, Array.Empty(), (string)null, pass, true); ConnectTime = (LastFunFact = DateTimeOffset.Now.ToUnixTimeMilliseconds()); if (!val5.Successful) { ArchipelagoPlugin.Logger.LogWarning((object)$"Failed to connect to {host}:{port}"); LoginFailure val6 = (LoginFailure)val5; string[] errors = val6.Errors; foreach (string text in errors) { ArchipelagoPlugin.Logger.LogWarning((object)(" " + text)); } ConnectionRefusedError[] errorCodes = val6.ErrorCodes; foreach (ConnectionRefusedError val7 in errorCodes) { ArchipelagoPlugin.Logger.LogWarning((object)$" {val7}"); } return; } LoginSuccessful val8 = (LoginSuccessful)val5; APTeam = val8.Team; APSlot = val8.Slot; ArchipelagoPlugin.Logger.LogInfo((object)$"Successfully connected to {host}:{port} - Team: {APTeam}, Slot: {APSlot}"); WorldSettings.GoalTracks = int.Parse(val8.SlotData["goal"].ToString()); WorldSettings.GoalTrack = val8.SlotData["goal_track"].ToString(); if (WorldSettings.GoalTracks == 0) { ArchipelagoPlugin.Logger.LogInfo((object)("Goal track: " + WorldSettings.GoalTrack)); } else { ArchipelagoPlugin.Logger.LogInfo((object)$"Goal track count: {WorldSettings.GoalTracks}"); } WorldSettings.GoalRating = int.Parse(val8.SlotData["rating"].ToString()); WorldSettings.InitialRating = int.Parse(val8.SlotData["rating_start"].ToString()); ArchipelagoPlugin.Logger.LogInfo((object)$"Goal rating: {WorldSettings.GoalRating} | Initial Rating: {WorldSettings.InitialRating}"); WorldSettings.EasyTrackGap = int.Parse(val8.SlotData["easy_track"].ToString()); ArchipelagoPlugin.Logger.LogInfo((object)$"Easy Track Gap: {WorldSettings.EasyTrackGap}"); WorldSettings.HotDogs = int.Parse(val8.SlotData["hot_dogs"].ToString()); WorldSettings.ExtraHotDogs = int.Parse(val8.SlotData["extra_hot_dogs"].ToString()); ArchipelagoPlugin.Logger.LogInfo((object)$"HotDogs: {WorldSettings.HotDogs} + {WorldSettings.ExtraHotDogs}"); WorldSettings.TrackGating = int.Parse(val8.SlotData["track_gating"].ToString()) > 0; ArchipelagoPlugin.Logger.LogInfo((object)$"Track gating: {WorldSettings.TrackGating}"); WorldSettings.DifficultyGating = (APSettings.DiffGateType)int.Parse(val8.SlotData["difficulty_gating"].ToString()); ArchipelagoPlugin.Logger.LogInfo((object)$"Difficulty gating: {WorldSettings.DifficultyGating}"); WorldSettings.MinDiff = int.Parse(val8.SlotData["min_diff"].ToString()); WorldSettings.MaxDiff = int.Parse(val8.SlotData["max_diff"].ToString()); ArchipelagoPlugin.Logger.LogInfo((object)$"Difficulty range: {WorldSettings.MinDiff} - {WorldSettings.MaxDiff}"); WorldSettings.Unsafe = int.Parse(val8.SlotData["unsafe"].ToString()) != 0; ArchipelagoPlugin.Logger.LogInfo((object)$"Unsafe: {WorldSettings.Unsafe}"); WorldSettings.Celeste = int.Parse(val8.SlotData["celeste"].ToString()) != 0; ArchipelagoPlugin.Logger.LogInfo((object)$"Celeste DLC: {WorldSettings.Celeste}"); WorldSettings.PizzaTower = int.Parse(val8.SlotData["pizza_tower"].ToString()) != 0; ArchipelagoPlugin.Logger.LogInfo((object)$"Pizza Tower DLC: {WorldSettings.PizzaTower}"); WorldSettings.UndertaleDeltarune = int.Parse(val8.SlotData["undertale_deltarune"].ToString()) != 0; ArchipelagoPlugin.Logger.LogInfo((object)$"Undertale/Deltarune DLC: {WorldSettings.UndertaleDeltarune}"); WorldSettings.RemovedTracks = ((JToken)(JArray)val8.SlotData["removed_tracks"]).ToObject(); ArchipelagoPlugin.Logger.LogInfo((object)("Removed tracks: " + string.Join(", ", WorldSettings.RemovedTracks))); OnWorldSettingsChanged(); APSession.Hints.GetHintsAsync((int?)null, (int?)null).ContinueWith(delegate(Task task) { if (task.IsCompletedSuccessfully) { APReceivedHints = task.Result.Where((Hint hint) => !hint.Found).ToArray(); OnHintsChanged(); } }); } catch (Exception ex) { ArchipelagoPlugin.Logger.LogError((object)("Unusual error: " + ex.Message)); ArchipelagoPlugin.Logger.LogError((object)ex.StackTrace); } } public static void OnReceivedItems(List items) { lock (ItemQueue) { ItemQueue.AddRange(items); } if (!Monitor.TryEnter(ItemQueueProcessLock, 10)) { return; } bool flag = false; bool flag2 = false; bool flag3 = false; while (true) { lock (APFoundItems) { lock (ItemQueue) { APFoundItems.AddRange(ItemQueue); ItemQueue.Clear(); } } foreach (long item in items) { bool flag4 = item > 0 && item < 1000; bool flag5 = flag4; if (!flag5) { bool flag6 = ((item == 1001 || item == 1004) ? true : false); flag5 = flag6; } if (flag5 || item > 1010) { flag = true; } if ((item == 1001 || item == 1004 || item == 1011) ? true : false) { flag3 = true; } if (item > 1011) { flag2 = true; } } if (flag3) { } lock (ItemQueue) { if (ItemQueue.Count == 0) { Monitor.Exit(ItemQueueProcessLock); break; } } } if (flag) { OnTrackAvailabilityChanged(); } else if (flag2) { OnHintsChanged(); } } public static void OnHintsChanged() { LevelSelectController val = Object.FindObjectOfType(); if (Object.op_Implicit((Object)(object)val)) { val.populateSongNames(false); } } public static void OnWorldSettingsChanged() { if (APSession == null || APSlot == -1) { WorldSettings.MinDiff = 2; WorldSettings.MaxDiff = 1; } FilteredTracks = APTracks.GetTrackList(WorldSettings).ToArray(); GoalTrack = APTracks.GetGoalTrack(WorldSettings, FilteredTracks); OnTrackAvailabilityChanged(); if (ArchipelagoPlugin.Instance.curGUI == 0 && APSlot != -1) { ArchipelagoPlugin.Instance.curGUI = 1; } if (ArchipelagoPlugin.Instance.curGUI == 1 && APSlot == -1) { ArchipelagoPlugin.Instance.curGUI = 0; } } public static void OnTrackAvailabilityChanged() { lock (TrackUpdateLock) { lock (APSentLocations) { lock (APFoundItems) { AvailableTracks = FilteredTracks.Where(IsTrackAvailable).ToArray(); if (GlobalVariables.chosen_collection_index < 0 || GlobalVariables.chosen_collection_index >= GlobalVariables.all_track_collections.Count) { return; } TrackCollection val = GlobalVariables.all_track_collections[GlobalVariables.chosen_collection_index]; if (TrackCollectionListener.COLLECTIONS.TryGetValue(val._unique_id, out var value)) { List list = value.BuildTrackList().ToList(); TrackCollection allCollection = GlobalVariables.all_track_collections.First((TrackCollection coll) => coll._unique_id == "all"); val.all_tracks = list.Select((TromboneTrack track) => allCollection.all_tracks.First((SingleTrackData data) => data.trackname_short == track.trackname_short)).ToList(); val._trackcount = list.Count; LevelSelectController val2 = Object.FindObjectOfType(); if (Object.op_Implicit((Object)(object)val2)) { string trackname_short = val2.alltrackslist[val2.songindex].trackname_short; val2.selectNewCollection(true); GlobalVariables.levelselect_index = 0; val2.sortTracks(GlobalVariables.sortmode, false); int num = -1; for (int i = 0; i < val2.alltrackslist.Count; i++) { if (val2.alltrackslist[i].trackname_short == trackname_short) { num = i; break; } } if (num != -1) { val2.songindex = num; GlobalVariables.levelselect_index = num; val2.populateSongNames(false); } else { val2.populateSongNames(true); } } } IEnumerator enumerator = TrackReloader.ReloadAll((Action)null).ForEach((Action>)delegate { }); while (enumerator.MoveNext()) { } } } } } } public struct APSettings { public enum DiffGateType { OFF, ON, PROG } public int GoalTracks; public string GoalTrack; public int GoalRating; public int InitialRating; public int EasyTrackGap; public int HotDogs; public int ExtraHotDogs; public bool TrackGating; public DiffGateType DifficultyGating; public int MinDiff; public int MaxDiff; public bool Unsafe; public bool Celeste; public bool PizzaTower; public bool UndertaleDeltarune; public string[] RemovedTracks; public APSettings() { GoalTracks = 1; GoalTrack = null; GoalRating = 3; InitialRating = 3; EasyTrackGap = 0; HotDogs = 0; ExtraHotDogs = 0; TrackGating = false; DifficultyGating = DiffGateType.OFF; MinDiff = 1; MaxDiff = 10; Unsafe = true; Celeste = true; PizzaTower = true; UndertaleDeltarune = true; RemovedTracks = Array.Empty(); } } public readonly struct Track : IEquatable { public readonly long ID; public readonly string Name; public readonly int Difficulty; public readonly bool Unsafe; public readonly string DLC; public Track(long id, string name, int difficulty, bool allowUnsafe = false, string dlc = "Base") { ID = id; Name = name; Difficulty = difficulty; Unsafe = allowUnsafe; DLC = dlc; } public bool Equals(Track other) { return ID == other.ID; } public override bool Equals(object obj) { return obj is Track other && Equals(other); } public override int GetHashCode() { return (int)ID; } } public class APTracks { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private Track <>2__current; private int <>l__initialThreadId; private APSettings settings; public APSettings <>3__settings; private Track[] <>s__1; private int <>s__2; private Track 5__3; Track IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; 5__3 = default(Track); <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_016c; } <>1__state = -1; <>s__1 = TRACKS; <>s__2 = 0; goto IL_0187; IL_016c: 5__3 = default(Track); <>s__2++; goto IL_0187; IL_0187: if (<>s__2 < <>s__1.Length) { 5__3 = <>s__1[<>s__2]; if (5__3.Difficulty >= settings.MinDiff && 5__3.Difficulty <= settings.MaxDiff && (settings.Unsafe || !5__3.Unsafe) && (5__3.DLC == "Base" || (5__3.DLC == "Celeste" && settings.Celeste) || (5__3.DLC == "Pizza Tower" && settings.PizzaTower) || (5__3.DLC == "UTDR" && settings.UndertaleDeltarune)) && !settings.RemovedTracks.Contains(5__3.Name)) { <>2__current = 5__3; <>1__state = 1; return true; } goto IL_016c; } <>s__1 = null; return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; d__ = this; } else { d__ = new d__1(0); } d__.settings = <>3__settings; return d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public static readonly Track[] TRACKS = new Track[119] { new Track(1L, "Are U Ready", 7), new Track(2L, "Arirang", 3), new Track(3L, "Auld Lang Syne", 7), new Track(4L, "Baboons!", 6), new Track(5L, "Bald Mountain", 7), new Track(6L, "Ball Game", 3), new Track(7L, "Barber of Seville", 7), new Track(8L, "Beethoven's Fifth", 7), new Track(9L, "Blue Danube", 5), new Track(10L, "Bumblebee", 9), new Track(11L, "Carol of the Bells", 7), new Track(12L, "Chop Waltz", 6), new Track(13L, "Commander Tokyo", 9), new Track(14L, "Danny Boy", 3), new Track(15L, "Danse Macabre", 8), new Track(16L, "Eine (CHAMP MIX)", 10), new Track(17L, "Eine Kleine", 5), new Track(18L, "Entertainer", 7), new Track(19L, "Four Seasons (Summer)", 9), new Track(20L, "Funiculi Funicula", 6), new Track(21L, "Gladiators", 8), new Track(22L, "God Save the King", 2), new Track(23L, "Gymnopédie", 5), new Track(24L, "Habanera", 5), new Track(25L, "Happy Birthday", 5), new Track(26L, "Hava Nagila", 5), new Track(27L, "Hello! Ma Baby", 6), new Track(28L, "Hino Do Brasil", 7), new Track(29L, "Hungarian Dance", 7, allowUnsafe: true), new Track(30L, "Hungarian Rhapsody", 9), new Track(31L, "Jarabe Tapatío", 9), new Track(32L, "Jasmine Flower", 3), new Track(33L, "Jingle Bells", 5), new Track(34L, "Korobeiniki", 7), new Track(35L, "Long-Tail Limbo", 5), new Track(36L, "Mars", 4), new Track(37L, "Marseillaise", 7), new Track(38L, "Martian Killbots", 3), new Track(39L, "Merry Gentlemen", 7), new Track(40L, "Mountain King", 8), new Track(41L, "O Canada", 3), new Track(42L, "O Christmas Tree", 4), new Track(43L, "Ode to Joy", 2), new Track(44L, "Oh Chanukah!", 8), new Track(45L, "Old Gray Mare", 5), new Track(46L, "Old MacDonald", 7), new Track(47L, "Rhapsody in Blue", 8), new Track(48L, "Rising Sun Blues", 4), new Track(49L, "Rosamunde", 6), new Track(50L, "Round the Mountain", 7), new Track(51L, "Sailor's Hornpipe", 10), new Track(52L, "Sakura", 2), new Track(53L, "Silent Night", 4), new Track(54L, "SkaBIRD", 6), new Track(55L, "Skeleton Rag", 6), new Track(56L, "Skip To My Lou", 5), new Track(57L, "St James Trombonery", 4), new Track(58L, "Stars & Stripes", 8, allowUnsafe: true), new Track(59L, "Star-Spangled", 5), new Track(60L, "Sugar Plum Fairy", 5), new Track(61L, "T. Champ Medley", 7), new Track(62L, "Taps", 3), new Track(63L, "The Can-Can", 8), new Track(64L, "The Ritz", 7), new Track(65L, "The Riverside", 5), new Track(66L, "The Saints", 5), new Track(67L, "Toccata & Fugue", 8), new Track(68L, "Trombone Fuerte", 9), new Track(69L, "Trombone Skyze", 4), new Track(70L, "Trombone Skyze (Nasty)", 8), new Track(71L, "W. Post March", 7, allowUnsafe: true), new Track(72L, "Warm-Up", 1), new Track(73L, "William Tell", 8), new Track(74L, "Zarathustra", 1), new Track(201L, "Confronting Myself", 7, allowUnsafe: true, "Celeste"), new Track(202L, "First Steps", 7, allowUnsafe: true, "Celeste"), new Track(203L, "Heart of the Mountain", 7, allowUnsafe: true, "Celeste"), new Track(204L, "Madeline and Theo", 6, allowUnsafe: true, "Celeste"), new Track(205L, "Reach for the Summit", 6, allowUnsafe: true, "Celeste"), new Track(206L, "Reflection", 6, allowUnsafe: true, "Celeste"), new Track(207L, "Resurrections", 6, allowUnsafe: true, "Celeste"), new Track(208L, "Scattered and Lost", 8, allowUnsafe: true, "Celeste"), new Track(209L, "Spirit of Hospitality", 6, allowUnsafe: true, "Celeste"), new Track(210L, "Starjump", 8, allowUnsafe: true, "Celeste"), new Track(251L, "Bye Bye There!", 7, allowUnsafe: true, "Pizza Tower"), new Track(252L, "Cold Spaghetti", 8, allowUnsafe: true, "Pizza Tower"), new Track(253L, "Death I Deservioli", 8, allowUnsafe: true, "Pizza Tower"), new Track(254L, "ET Wahwahs", 8, allowUnsafe: true, "Pizza Tower"), new Track(255L, "Funiculi Holiday", 7, allowUnsafe: true, "Pizza Tower"), new Track(256L, "Good Eatin'", 8, allowUnsafe: true, "Pizza Tower"), new Track(257L, "It's Pizza Time!", 8, allowUnsafe: true, "Pizza Tower"), new Track(258L, "Kid's Menu", 9, allowUnsafe: true, "Pizza Tower"), new Track(259L, "Oregano Mirage", 9, allowUnsafe: true, "Pizza Tower"), new Track(260L, "Pizza Deluxe", 7, allowUnsafe: true, "Pizza Tower"), new Track(261L, "Pumpin' Hot Stuff", 7, allowUnsafe: true, "Pizza Tower"), new Track(262L, "Put On A Show!", 7, allowUnsafe: true, "Pizza Tower"), new Track(263L, "Unexpectancy", 9, allowUnsafe: true, "Pizza Tower"), new Track(264L, "Yeehaw", 8, allowUnsafe: true, "Pizza Tower"), new Track(301L, "ASGORE", 8, allowUnsafe: true, "UTDR"), new Track(302L, "BIG SHOT", 7, allowUnsafe: true, "UTDR"), new Track(303L, "Black Knife", 7, allowUnsafe: true, "UTDR"), new Track(304L, "Bonetrousle", 8, allowUnsafe: true, "UTDR"), new Track(305L, "CYBER'S WORLD?", 7, allowUnsafe: true, "UTDR"), new Track(306L, "Dark Sanctuary", 7, allowUnsafe: true, "UTDR"), new Track(307L, "Dummy!", 9, allowUnsafe: true, "UTDR"), new Track(308L, "GUARDIAN", 8, allowUnsafe: true, "UTDR"), new Track(309L, "Hopes and Dreams", 8, allowUnsafe: true, "UTDR"), new Track(310L, "It's TV Time!", 8, allowUnsafe: true, "UTDR"), new Track(311L, "Killer Queen", 8, allowUnsafe: true, "UTDR"), new Track(312L, "Megalovania", 9, allowUnsafe: true, "UTDR"), new Track(313L, "Metal Crusher", 9, allowUnsafe: true, "UTDR"), new Track(314L, "Pandora Palace", 7, allowUnsafe: true, "UTDR"), new Track(315L, "Rude Buster", 9, allowUnsafe: true, "UTDR"), new Track(316L, "Scarlet Forest", 6, allowUnsafe: true, "UTDR"), new Track(317L, "SWORD", 7, allowUnsafe: true, "UTDR"), new Track(318L, "Third Sanctuary", 9, allowUnsafe: true, "UTDR"), new Track(319L, "True Hero", 8, allowUnsafe: true, "UTDR"), new Track(320L, "TV World", 7, allowUnsafe: true, "UTDR"), new Track(321L, "World Revolving", 8, allowUnsafe: true, "UTDR") }; [IteratorStateMachine(typeof(d__1))] public static IEnumerable GetTrackList(APSettings settings) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>3__settings = settings }; } public static Track? GetGoalTrack(APSettings settings, Track[] tracks) { if (settings.GoalTracks > 0) { return null; } Track value = tracks.FirstOrDefault((Track track) => track.Name == settings.GoalTrack); if (value.Name != settings.GoalTrack) { ArchipelagoPlugin.Logger.LogWarning((object)"Goal track count is 0 and goal track failed to resolve to a track!"); return null; } return value; } } public class APTrapController { public class TrapType { public class TrapFlipControls : TrapType { public TrapFlipControls() : base(1201L) { } public override void StartTrap(GameController controller) { int num = GlobalVariables.mousecontrolmode; switch (num) { case 0: num = 1; break; case 1: num = 0; break; case 2: num = 3; break; case 3: num = 2; break; } controller.gameplay_settings.mouse_controldirection = num; } public override void EndTrap(GameController controller) { controller.gameplay_settings.mouse_controldirection = GlobalVariables.mousecontrolmode; } public override float TrapDuration() { return 8f; } } public class TrapSilenceTrack : TrapType { private float OriginalVolume; public TrapSilenceTrack() : base(1202L) { } public override void StartTrap(GameController controller) { OriginalVolume = controller.musictrack.volume; } public override void ContinueTrap(GameController controller) { float num = (float)controller.musictrack.timeSamples / (float)controller.musictrack.clip.frequency; float num2 = (num - TrapStartTime) / (TrapEndTime - TrapStartTime); float num3 = num2 * 2f; if (num3 > 1f) { num3 = 2f - num3; } float volume = 0f; if (num3 < 0.25f) { volume = 1f - num3 / 0.25f; } controller.musictrack.volume = volume; } public override void EndTrap(GameController controller) { controller.musictrack.volume = OriginalVolume; } } public class TrapSilenceTrombone : TrapType { public TrapSilenceTrombone() : base(1203L) { } public override void ContinueTrap(GameController controller) { controller.currentnotesound.volume = 0f; } public override void EndTrap(GameController controller) { if (controller.noteactive) { controller.currentnotesound.volume = 1f; } } } public class TrapHideNotes : TrapType { public TrapHideNotes() : base(1204L) { } public override void ContinueTrap(GameController controller) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) controller.noteholderr.anchoredPosition3D = new Vector3(0f, 100f, 0f); } } public class TrapNoBreath : TrapType { public TrapNoBreath() : base(1205L) { } public override void StartTrap(GameController controller) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) controller.breathcounter = 1f; if (!controller.outofbreath) { controller.sfxrefs.outofbreath.Play(); controller.breathglow.anchoredPosition3D = new Vector3(-380f, 0f, 0f); controller.outofbreath = true; controller.noteplaying = false; controller.setPuppetShake(false); controller.setPuppetBreath(true); controller.stopNote(); } } public override void EndTrap(GameController controller) { controller.breathcounter = 0f; controller.outofbreath = false; controller.sfxrefs.outofbreath.Stop(); controller.setPuppetBreath(false); } public override float TrapDuration() { return 2f; } } public class TrapWarbleTrombone : TrapType { private const float NUM_CYCLES = 5f; public TrapWarbleTrombone() : base(1206L) { } public override void ContinueTrap(GameController controller) { float num = (float)controller.musictrack.timeSamples / (float)controller.musictrack.clip.frequency; float num2 = (num - TrapStartTime) / (TrapEndTime - TrapStartTime); AudioSource currentnotesound = controller.currentnotesound; currentnotesound.pitch *= Mathf.Sin(num2 * 5f * (float)Math.PI * 2f) * 0.2f + 0.9f; } } public class TrapWarpSpeed : TrapType { private static readonly AnimationCurve SpeedCurve = new AnimationCurve((Keyframe[])(object)new Keyframe[8] { new Keyframe(0f, 1f), new Keyframe(0.1f, 1f), new Keyframe(0.3f, 0.9f), new Keyframe(0.35f, 0.9f), new Keyframe(0.65f, 1.25f), new Keyframe(0.7f, 1.25f), new Keyframe(0.9f, 1f), new Keyframe(1f, 1f) }); public TrapWarpSpeed() : base(1207L) { } public override void ContinueTrap(GameController controller) { float num = (float)controller.musictrack.timeSamples / (float)controller.musictrack.clip.frequency; float num2 = (num - TrapStartTime) / (TrapEndTime - TrapStartTime); float num3 = SpeedCurve.Evaluate(num2); if (GlobalVariables.turbomode) { num3 *= 2f; } controller.musictrack.pitch = num3; controller.smooth_scrolling_move_mult = num3; } public override void EndTrap(GameController controller) { float num = ((!GlobalVariables.turbomode) ? 1 : 2); controller.musictrack.pitch = num; controller.smooth_scrolling_move_mult = num; } public override float TrapDuration() { return 10f; } } public static readonly TrapType FlipControls = new TrapFlipControls(); public static readonly TrapType SilenceTrack = new TrapSilenceTrack(); public static readonly TrapType SilenceTrombone = new TrapSilenceTrombone(); public static readonly TrapType HideNotes = new TrapHideNotes(); public static readonly TrapType NoBreath = new TrapNoBreath(); public static readonly TrapType[] Traps = new TrapType[7] { FlipControls, SilenceTrack, SilenceTrombone, HideNotes, NoBreath, new TrapWarbleTrombone(), new TrapWarpSpeed() }; public readonly long ID; public TrapType(long ID) { this.ID = ID; base..ctor(); } public virtual float TrapDuration() { return 5f; } public virtual void StartTrap(GameController controller) { } public virtual void ContinueTrap(GameController controller) { } public virtual void EndTrap(GameController controller) { } public static TrapType GetTrap(long ID) { return Traps.FirstOrDefault((TrapType trap) => trap.ID == ID); } } public static List TrapQueue = new List(); private static TrapType CurTrap; private static float TrapStartTime; private static float TrapEndTime; public static void AddTrap(TrapType t) { TrapQueue.Add(t); } public static void ResetState() { TrapEndTime = 0f; if (CurTrap != null) { ArchipelagoPlugin.Logger.LogWarning((object)"Trap controller was reset with active traps!"); TrapQueue.Insert(0, CurTrap); } CurTrap = null; } public static void ControllerUpdate(GameController controller) { if (!Object.op_Implicit((Object)(object)controller.musictrack) || !Object.op_Implicit((Object)(object)controller.musictrack.clip)) { return; } float num = (float)controller.musictrack.timeSamples / (float)controller.musictrack.clip.frequency; if (CurTrap != null && num >= TrapEndTime) { CurTrap.EndTrap(controller); CurTrap = null; return; } if (CurTrap == null) { if (TrapQueue.Count == 0) { return; } float num2 = TrapEndTime + 3f; if (num < num2) { return; } float num3 = num + TrapQueue[0].TrapDuration(); if (num3 > controller.levelendtime - 3f) { return; } CurTrap = TrapQueue[0]; CurTrap.StartTrap(controller); TrapQueue.RemoveAt(0); TrapStartTime = num; TrapEndTime = num3; } CurTrap?.ContinueTrap(controller); } } [BepInPlugin("APTromboneChampMod", "AP Trombone", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class ArchipelagoPlugin : BaseUnityPlugin { [HarmonyPatch(typeof(PointSceneController), "Awake")] private class ScoreScreenChecker { private static void Postfix() { if (APHandler.APSlot == -1) { Logger.LogInfo((object)"AP not connected, not sending."); return; } float gameplay_scoreperc = GlobalVariables.gameplay_scoreperc; int num = (int)(gameplay_scoreperc / 0.2f) - 2; if (num > 3) { num = (GlobalVariables.gameplay_perfect ? 5 : ((!((double)gameplay_scoreperc >= 1.35)) ? 3 : 4)); } bool flag = num >= APHandler.GetRequiredRating(); Track track2 = APHandler.AvailableTracks.FirstOrDefault((Track track) => track.Name == GlobalVariables.chosen_track_data.trackname_short); if (track2.Name == GlobalVariables.chosen_track_data.trackname_short) { Logger.LogInfo((object)("Track end screen: " + GlobalVariables.chosen_track_data.trackname_short)); Logger.LogInfo((object)$" Score: {gameplay_scoreperc:P2}"); Logger.LogInfo((object)("Rating: " + (new string[8] { "F", "D", "C", "B", "A", "S", "Wall (S)", "Perfect (S)" })[num + 2])); Logger.LogInfo((object)$"Beaten: {flag}"); if (!APHandler.IsTrackAvailable(track2)) { Logger.LogInfo((object)"Submission blocked, track is not available."); } else { APHandler.SendTrack(track2, flag); } } else { Logger.LogInfo((object)"Track was not in the list of AP tracks."); } } } [HarmonyPatch(typeof(LevelSelectController), "clickPlay")] private class PreventPlayingTrack { private static bool Prefix(LevelSelectController __instance) { if (APHandler.APSlot == -1) { return true; } if (APHandler.HasGoaled(-1L)) { return true; } Track? track = APHandler.FindTrack(__instance.alltrackslist[__instance.songindex].trackname_short); if (!track.HasValue) { return false; } if (!APHandler.IsTrackAvailable(track.Value)) { return false; } return true; } } [HarmonyPatch(typeof(LevelSelectController), "populateSongNames")] private class ChangeSongDescriptionAndDisablePlay { private static void Postfix(LevelSelectController __instance) { TrackCollection val = GlobalVariables.all_track_collections[GlobalVariables.chosen_collection_index]; if (APHandler.APSlot != -1 && APHandler.HasGoaled(-1L)) { __instance.songdesctext.text = "Goaled!\nMaybe play for fun?"; ((Behaviour)__instance.playbtn).enabled = true; ((Component)__instance.playbtn).gameObject.SetActive(true); return; } if (TrackCollectionListener.COLLECTIONS.TryGetValue(val._unique_id, out var value)) { APCollection aPCollection = (APCollection)value; if (aPCollection.HasNoTracks()) { __instance.songdesctext.text = ((APHandler.APSlot == -1) ? "Not connected to AP!\nPress F1 to open connection manager." : aPCollection.GetNoTrackString()); ((Behaviour)__instance.playbtn).enabled = false; ((Component)__instance.playbtn).gameObject.SetActive(false); return; } } bool flag = false; if (APHandler.APSlot == -1) { flag = true; } else { Track? track = APHandler.FindTrack(__instance.alltrackslist[__instance.songindex].trackname_short); if (track.HasValue) { TrackHints trackHints = APHandler.GetTrackHints(track.Value); bool flag2 = APHandler.APSentLocations.Contains(track.Value.ID); bool flag3 = APHandler.APSentLocations.Contains(track.Value.ID + 1000); StringBuilder stringBuilder = new StringBuilder(); if (APHandler.GoalTrack.HasValue && APHandler.GoalTrack.Value.ID == track.Value.ID) { stringBuilder.Append("This is the goal track, beat it to win!\n"); } if (APHandler.IsTrackAvailable(track.Value)) { if (flag2 && flag3) { stringBuilder.Append("Track already beaten."); } else { flag = true; stringBuilder.Append("Can play this track!"); stringBuilder.Append("\nRequired rating: " + APHandler.GetRatingString(APHandler.GetRequiredRating())); if (!flag2) { stringBuilder.Append("\nPlay reward: " + APHandler.FormatItemHint(trackHints.PlayReward)); } if (!flag3) { stringBuilder.Append("\nBeat reward: " + APHandler.FormatItemHint(trackHints.BeatReward)); } } } else { stringBuilder.Append("Track locked."); if (APHandler.GoalTrack.HasValue && APHandler.GoalTrack.Value.ID == track.Value.ID) { int hotDogs = APHandler.WorldSettings.HotDogs; if (hotDogs > 0) { int num = APHandler.APFoundItems.Count((long id) => id == 1004); if (num < hotDogs) { stringBuilder.Append($"\nHot dogs: {num}/{hotDogs}"); } } } if (APHandler.WorldSettings.TrackGating && !APHandler.APFoundItems.Contains(track.Value.ID)) { stringBuilder.Append("\nTrack unlock: " + APHandler.FormatLocationString(trackHints.TrackUnlock)); } if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.ON && !APHandler.APFoundItems.Contains((long)track.Value.Difficulty + 1010L)) { stringBuilder.Append($"\nDifficulty {track.Value.Difficulty}: {APHandler.FormatLocationString(trackHints.DifficultyUnlocks[0])}"); } if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.PROG) { int num2 = track.Value.Difficulty - APHandler.WorldSettings.MinDiff; if (num2 > 0) { int num3 = APHandler.APFoundItems.Count((long id) => id == 1011); if (num3 < num2) { stringBuilder.Append($"\nDifficulty unlocks: {num3}/{num2}"); Hint[] difficultyUnlocks = trackHints.DifficultyUnlocks; foreach (Hint hint in difficultyUnlocks) { stringBuilder.Append("\nProgressive Difficulty: " + APHandler.FormatLocationString(hint)); } } } } } __instance.songdesctext.text = stringBuilder.ToString(); } else { __instance.songdesctext.text = "Not an AP track."; } } ((Behaviour)__instance.playbtn).enabled = flag; ((Component)__instance.playbtn).gameObject.SetActive(flag); } } [HarmonyPatch(typeof(GameController), "Awake")] private class TrapReset { private static void Postfix() { APTrapController.ResetState(); } } [HarmonyPatch(typeof(GameController), "Update")] private class TrapPatch { private static void Postfix(GameController __instance) { APTrapController.ControllerUpdate(__instance); } } private static Harmony _harmony = new Harmony("archipelago"); public static ArchipelagoPlugin Instance; internal static ManualLogSource Logger; private string uri = "archipelago.gg"; private string port = "38281"; private string slotname = ""; private string password = ""; public int curGUI = -1; private Rect windowRect = new Rect(20f, 20f, 700f, 300f); private static GUIStyle textStyle = new GUIStyle { fontSize = 17 }; public static bool SendChatToLog = false; private Vector2 hintScroll1 = Vector2.zero; private Vector2 hintScroll2 = Vector2.zero; private const int hintEntryWidth = 240; private const int hintEntryInfoWidth = 70; private void Awake() { Instance = this; Logger = ((BaseUnityPlugin)this).Logger; GameInitializationEvent.Register(((BaseUnityPlugin)this).Info, (Action)TryInitialize); } private void TryInitialize() { ImageHandler.LoadTextures(); TrackCollectionRegistrationEvent.EVENT.Register((Listener)(object)new TrackCollectionListener()); _harmony.PatchAll(); } private void Update() { if (Input.GetKeyDown((KeyCode)282)) { int num = curGUI; if ((num > 1 || num == -1) ? true : false) { if (APHandler.APSlot == -1) { curGUI = 0; } else { curGUI = 1; } } else { curGUI = -1; } } if (!Input.GetKeyDown((KeyCode)283)) { return; } if (curGUI != 2) { if (APHandler.APSlot == -1) { curGUI = 0; } else { curGUI = 2; } } else { curGUI = -1; } } private void OnGUI() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Expected O, but got Unknown //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0465: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Expected O, but got Unknown //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Unknown result type (might be due to invalid IL or missing references) //IL_0492: Unknown result type (might be due to invalid IL or missing references) //IL_04a5: Unknown result type (might be due to invalid IL or missing references) //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) if (curGUI != -1) { windowRect = GUI.Window(curGUI, windowRect, new WindowFunction(WindowHandler), "Archipelago Menu"); } if (!ImageHandler.TexturesLoaded) { return; } int height = Screen.height; GUI.DrawTexture(new Rect(10f, (float)(height - 50), 40f, 40f), (Texture)(object)((APHandler.APSlot == -1) ? ImageHandler.ArchipelagoGrey : ImageHandler.Archipelago)); if (APHandler.APSlot == -1) { return; } int num = 60; if (APHandler.HasGoaled(-1L)) { return; } if (APHandler.GoalTrack.HasValue && APHandler.IsTrackAvailable(APHandler.GoalTrack.Value)) { int num2 = APHandler.APFoundItems.Count((long id) => id == 1001); int num3 = APHandler.WorldSettings.InitialRating - APHandler.WorldSettings.GoalRating; if (num2 >= num3) { return; } } if (APHandler.WorldSettings.HotDogs > 0) { bool flag = APHandler.APFoundItems.Count((long id) => id == 1004) >= APHandler.WorldSettings.HotDogs; GUI.DrawTexture(new Rect((float)num, (float)(height - 50), 40f, 40f), (Texture)(object)(flag ? ImageHandler.HotDog : ImageHandler.HotDogGrey)); num += 50; } if (APHandler.WorldSettings.InitialRating > APHandler.WorldSettings.GoalRating) { bool flag2 = APHandler.APFoundItems.Count((long id) => id == 1001) >= APHandler.WorldSettings.InitialRating - APHandler.WorldSettings.GoalRating; GUI.DrawTexture(new Rect((float)num, (float)(height - 50), 40f, 40f), (Texture)(object)(flag2 ? ImageHandler.RankIndicator : ImageHandler.RankIndicatorGrey)); string text = (new string[4] { "C", "B", "A", "S" })[APHandler.GetRequiredRating()]; GUI.color = Color.black; Vector2 val = textStyle.CalcSize(new GUIContent(text)); GUI.Label(new Rect((float)(num + 20) - val.x / 2f, (float)(height - 30) - val.y / 2f, 40f, 40f), text, textStyle); GUI.color = Color.white; num += 50; } if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.OFF) { return; } List list = new List(); List list2 = new List(); if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.PROG) { int num4 = APHandler.WorldSettings.MinDiff + APHandler.APFoundItems.Count((long id) => id == 1011); for (int i = APHandler.WorldSettings.MinDiff + 1; i <= APHandler.WorldSettings.MaxDiff; i++) { list.Add(i); if (num4 < i) { list2.Add(i); } } } if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.ON) { for (int j = APHandler.WorldSettings.MinDiff + 1; j <= APHandler.WorldSettings.MaxDiff; j++) { list.Add(j); if (!APHandler.APFoundItems.Contains((long)j + 1010L)) { list2.Add(j); } } } foreach (int item in list) { GUI.DrawTexture(new Rect((float)num, (float)(height - 50), 40f, 40f), (Texture)(object)(list2.Contains(item) ? ImageHandler.DifficultyIndicatorGrey : ImageHandler.DifficultyIndicator)); GUI.color = Color.black; string text2 = item.ToString(); Vector2 val2 = textStyle.CalcSize(new GUIContent(text2)); GUI.Label(new Rect((float)(num + 20) - val2.x / 2f, (float)(height - 28) - val2.y / 2f, 40f, 40f), item.ToString(), textStyle); GUI.color = Color.white; num += 50; } } private void WindowHandler(int ID) { switch (ID) { case 0: ShowLoginWindow(); break; case 1: ShowTrackerWindow(); break; case 2: ShowHintWindow(); break; default: Logger.LogWarning((object)$"Unknown GUI ID: {ID}"); curGUI = -1; break; } } private void ShowLoginWindow() { GUILayout.Label("Server URI: ", Array.Empty()); uri = GUILayout.TextField(uri, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); GUILayout.Label("Server Port: ", Array.Empty()); port = GUILayout.TextField(port, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); GUILayout.Label("Server Slotname: ", Array.Empty()); slotname = GUILayout.TextField(slotname, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); GUILayout.Label("Server Password (Optional): ", Array.Empty()); password = GUILayout.PasswordField(password, '*', (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(200f) }); if (GUILayout.Button("Connect Archipelago", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }) && int.TryParse(port.Trim(), out var result)) { APHandler.ConnectToAP(uri, result, slotname, password); } if (GUILayout.Button("Close", Array.Empty())) { curGUI = -1; } } private void ShowTrackerWindow() { GUILayout.Label("Connected to AP server.", Array.Empty()); SendChatToLog = GUILayout.Toggle(SendChatToLog, "Send Chat to Log", Array.Empty()); GUILayout.Space(10f); Track[] array = APTracks.GetTrackList(APHandler.WorldSettings).ToArray(); string text; if (APHandler.HasGoaled(-1L)) { text = "Goaled!"; } else if (APHandler.WorldSettings.GoalTracks == 0) { text = "Goal track: " + APHandler.WorldSettings.GoalTrack; } else { int num = array.Count((Track track) => APHandler.APSentLocations.Contains(track.ID + 1000)); text = $"Beat tracks: {num}/{APHandler.WorldSettings.GoalTrack}"; } GUILayout.Label(text, Array.Empty()); if (APHandler.WorldSettings.HotDogs > 0) { int num2 = APHandler.APFoundItems.Count((long id) => id == 1004); if (APHandler.WorldSettings.ExtraHotDogs > 0) { int num3 = APHandler.WorldSettings.HotDogs + APHandler.WorldSettings.ExtraHotDogs; GUILayout.Label($"Hot Dogs: {num2}/{APHandler.WorldSettings.HotDogs} ({num3})", Array.Empty()); } else { GUILayout.Label($"Hot Dogs: {num2}/{APHandler.WorldSettings.HotDogs}", Array.Empty()); } } string[] array2 = new string[4] { "C", "B", "A", "S" }; GUILayout.Label("Required rating: " + array2[APHandler.GetRequiredRating()], Array.Empty()); if (APHandler.WorldSettings.InitialRating != APHandler.WorldSettings.GoalRating) { int num4 = APHandler.WorldSettings.InitialRating - APHandler.WorldSettings.GoalRating; int num5 = APHandler.APFoundItems.Count((long id) => id == 1001); GUILayout.Label($"Rating Reduction items: {num5}/{num4}", Array.Empty()); } GUILayout.Space(10f); if (APHandler.WorldSettings.TrackGating || APHandler.WorldSettings.DifficultyGating != 0) { if (APHandler.WorldSettings.TrackGating) { int num6 = array.Count((Track track) => APHandler.APFoundItems.Contains(track.ID)); GUILayout.Label($"Tracks unlocked: {num6}/{array.Length}", Array.Empty()); } if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.ON) { List list = new List(1) { APHandler.WorldSettings.MinDiff }; for (int i = APHandler.WorldSettings.MinDiff + 1; i <= APHandler.WorldSettings.MaxDiff; i++) { if (APHandler.APFoundItems.Contains((long)i + 1010L)) { list.Add(i); } } GUILayout.Label("Difficulties unlocked: " + string.Join(", ", list), Array.Empty()); } if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.PROG) { int num7 = APHandler.WorldSettings.MinDiff + APHandler.APFoundItems.Count((long id) => id == 1011); GUILayout.Label($"Max difficulty: {num7}/{APHandler.WorldSettings.MaxDiff}", Array.Empty()); } GUILayout.Space(10f); } if (GUILayout.Button("Disconnect", Array.Empty())) { APHandler.APSession.Socket.DisconnectAsync(); APHandler.APSlot = -1; curGUI = 0; } if (GUILayout.Button("Close", Array.Empty())) { curGUI = -1; } } private void ShowHintWindow() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_09d6: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) //IL_09f5: Unknown result type (might be due to invalid IL or missing references) if (APHandler.APSlot == -1) { curGUI = 0; return; } bool flag = APHandler.CanHint(); GUILayout.Label($"Hint points: {APHandler.APSession.RoomState.HintPoints}/{APHandler.APSession.RoomState.HintCost}", Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.BeginVertical(Array.Empty()); hintScroll1 = GUILayout.BeginScrollView(hintScroll1, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(340f) }); bool flag2 = false; if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.ON) { List list = new List(); for (int i = APHandler.WorldSettings.MinDiff + 1; i <= APHandler.WorldSettings.MaxDiff; i++) { if (!APHandler.APFoundItems.Contains((long)i + 1010L)) { list.Add(i); } } if (list.Count > 0) { flag2 = true; GUILayout.Label($"Missing difficulties: {list.Count}", Array.Empty()); foreach (int diff in list) { GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Difficulty {diff}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) }); Hint val = ((IEnumerable)APHandler.APReceivedHints).FirstOrDefault((Func)((Hint hint) => hint.ReceivingPlayer == APHandler.APSlot && hint.ItemId == (long)diff + 1010L)); if (val != null && val.ReceivingPlayer == APHandler.APSlot && val.ItemId == (long)diff + 1010L) { GUI.enabled = false; GUILayout.Button("HINTED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } else if (flag) { if (GUILayout.Button("Hint", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { APHandler.TryHintDifficulty(diff); } } else { GUI.enabled = false; GUILayout.Button("MISSING", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } GUILayout.EndHorizontal(); } } } if (APHandler.WorldSettings.DifficultyGating == APSettings.DiffGateType.PROG) { int num = APHandler.WorldSettings.MaxDiff - APHandler.WorldSettings.MinDiff; int num2 = APHandler.APFoundItems.Count((long id) => id == 1011); if (num2 < num) { flag2 = true; Hint[] array = APHandler.APReceivedHints.Where((Hint hint) => hint.ReceivingPlayer == APHandler.APSlot && hint.ItemId == 1011).ToArray(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Progressive Difficulty ({num2}/{num})", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) }); int num3 = num - num2; if (flag) { if (GUILayout.Button($"Hint {array.Length}/{num3}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { APHandler.TryHintDifficulty(1); } } else if (array.Length != 0) { GUI.enabled = false; GUILayout.Button($"HINTED {array.Length}/{num3}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } else { GUI.enabled = false; GUILayout.Button("MISSING", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } GUILayout.EndHorizontal(); } } if (APHandler.WorldSettings.InitialRating != APHandler.WorldSettings.GoalRating) { int num4 = APHandler.WorldSettings.InitialRating - APHandler.WorldSettings.GoalRating; int num5 = APHandler.APFoundItems.Count((long id) => id == 1001); if (num5 < num4) { flag2 = true; Hint[] array2 = APHandler.APReceivedHints.Where((Hint hint) => hint.ReceivingPlayer == APHandler.APSlot && hint.ItemId == 1001).ToArray(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Rank Reduction ({num5}/{num4})", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) }); int num6 = num4 - num5; if (flag) { if (GUILayout.Button($"Hint {array2.Length}/{num6}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { APHandler.TryHintRankReduction(); } } else if (array2.Length != 0) { GUI.enabled = false; GUILayout.Button($"HINTED {array2.Length}/{num6}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } else { GUI.enabled = false; GUILayout.Button("MISSING", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } GUILayout.EndHorizontal(); } } if (APHandler.WorldSettings.HotDogs > 0) { int num7 = APHandler.WorldSettings.HotDogs + APHandler.WorldSettings.ExtraHotDogs; int num8 = APHandler.APFoundItems.Count((long id) => id == 1004); if (num8 < APHandler.WorldSettings.HotDogs) { flag2 = true; Hint[] array3 = APHandler.APReceivedHints.Where((Hint hint) => hint.ReceivingPlayer == APHandler.APSlot && hint.ItemId == 1004).ToArray(); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label($"Hot Dog ({num8}/{APHandler.WorldSettings.HotDogs} ({num7}))", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) }); int num9 = num7 - num8; if (flag) { if (GUILayout.Button($"Hint {array3.Length}/{num9}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { APHandler.TryHintHotDog(); } } else if (array3.Length != 0) { GUI.enabled = false; GUILayout.Button($"HINTED {array3.Length}/{num9}", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } else { GUI.enabled = false; GUILayout.Button("MISSING", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } GUILayout.EndHorizontal(); } } if (APHandler.WorldSettings.TrackGating) { Track[] array4 = APHandler.FilteredTracks.Where((Track track) => !APHandler.APFoundItems.Contains(track.ID)).ToArray(); if (array4.Length != 0) { flag2 = true; GUILayout.Label($"Track unlocks remaining: {array4.Length}", Array.Empty()); Track[] array5 = array4; for (int j = 0; j < array5.Length; j++) { Track track2 = array5[j]; GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(track2.Name, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) }); Hint val2 = ((IEnumerable)APHandler.APReceivedHints).FirstOrDefault((Func)((Hint hint) => hint.ReceivingPlayer == APHandler.APSlot && hint.ItemId == track2.ID)); if (val2 != null && val2.ReceivingPlayer == APHandler.APSlot && val2.ItemId == track2.ID) { GUI.enabled = false; GUILayout.Button("HINTED", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } else if (flag) { if (GUILayout.Button("Hint", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { APHandler.TryHintTrack(track2); } } else { GUI.enabled = false; GUILayout.Button("MISSING", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); GUI.enabled = true; } GUILayout.EndHorizontal(); } } } if (!flag2) { GUILayout.Label("No more items!", Array.Empty()); } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.BeginVertical(Array.Empty()); hintScroll2 = GUILayout.BeginScrollView(hintScroll2, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(340f) }); Hint[] array6 = APHandler.APReceivedHints.Where((Hint hint) => hint.ReceivingPlayer != APHandler.APSlot || (hint.ItemId != 1002 && hint.ItemId != 1003)).ToArray(); if (array6.Length == 0) { GUILayout.Label("No hints!", Array.Empty()); } else { Hint[] array7 = array6.Where((Hint hint) => hint.FindingPlayer == APHandler.APSlot && hint.ReceivingPlayer == APHandler.APSlot).ToArray(); Hint[] array8 = array6.Where((Hint hint) => hint.FindingPlayer != APHandler.APSlot && hint.ReceivingPlayer == APHandler.APSlot).ToArray(); Hint[] array9 = array6.Where((Hint hint) => hint.ReceivingPlayer != APHandler.APSlot).ToArray(); Hint[] array10 = array7; foreach (Hint hint2 in array10) { GUILayout.Label(APHandler.FormatFullHint(hint2), Array.Empty()); } Hint[] array11 = array8; foreach (Hint hint3 in array11) { GUILayout.Label(APHandler.FormatFullHint(hint3), Array.Empty()); } Hint[] array12 = array9; foreach (Hint hint4 in array12) { GUILayout.Label(APHandler.FormatFullHint(hint4), Array.Empty()); } } GUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.EndHorizontal(); if (GUILayout.Button("Disconnect", Array.Empty())) { APHandler.APSession.Socket.DisconnectAsync(); APHandler.APSlot = -1; curGUI = 0; } if (GUILayout.Button("Close", Array.Empty())) { curGUI = -1; } } } public static class ImageHandler { public static Sprite ArchipelagoCollection; public static Sprite ArchipelagoCollectionFiltered; public static Sprite ArchipelagoCollectionLocked; public static Texture2D Archipelago; public static Texture2D ArchipelagoGrey; public static Texture2D HotDog; public static Texture2D HotDogGrey; public static Texture2D RankIndicator; public static Texture2D RankIndicatorGrey; public static Texture2D DifficultyIndicator; public static Texture2D DifficultyIndicatorGrey; public static bool TexturesLoaded; public static void LoadTextures() { FromFile("ap"); FromFile("ap_grey"); FromFile("difficulty"); FromFile("difficulty_grey"); FromFile("hotdog"); FromFile("hotdog_grey"); FromFile("rank"); FromFile("rank_grey"); FromFileSprite("coll_ap"); FromFileSprite("coll_ap_filter"); FromFileSprite("coll_ap_locked"); } private static void FromFile(string name) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)ArchipelagoPlugin.Instance).Info.Location), name + ".png"); ArchipelagoPlugin.Logger.LogInfo((object)("Loading texture from " + text)); UnityWebRequest req = UnityWebRequestTexture.GetTexture(text); UnityWebRequestAsyncOperation val = req.SendWebRequest(); bool done = false; ((AsyncOperation)val).completed += delegate { done = true; SetTexture(req.downloadHandler.data, name); }; if (((AsyncOperation)val).isDone && !done) { SetTexture(req.downloadHandler.data, name); } } private static void SetTexture(byte[] data, string name) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1); ImageConversion.LoadImage(val, data); switch (name) { case "ap": Archipelago = val; break; case "ap_grey": ArchipelagoGrey = val; break; case "difficulty": DifficultyIndicator = val; break; case "difficulty_grey": DifficultyIndicatorGrey = val; break; case "hotdog": HotDog = val; break; case "hotdog_grey": HotDogGrey = val; break; case "rank": RankIndicator = val; break; case "rank_grey": RankIndicatorGrey = val; break; default: ArchipelagoPlugin.Logger.LogWarning((object)("Texture loaded but unknown name: " + name)); break; } if (Object.op_Implicit((Object)(object)Archipelago) && Object.op_Implicit((Object)(object)ArchipelagoGrey) && Object.op_Implicit((Object)(object)DifficultyIndicator) && Object.op_Implicit((Object)(object)DifficultyIndicatorGrey) && Object.op_Implicit((Object)(object)HotDog) && Object.op_Implicit((Object)(object)HotDogGrey) && Object.op_Implicit((Object)(object)RankIndicator) && Object.op_Implicit((Object)(object)RankIndicatorGrey) && Object.op_Implicit((Object)(object)ArchipelagoCollection) && Object.op_Implicit((Object)(object)ArchipelagoCollectionFiltered) && Object.op_Implicit((Object)(object)ArchipelagoCollectionLocked)) { TexturesLoaded = true; } } private static void FromFileSprite(string name) { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)ArchipelagoPlugin.Instance).Info.Location), name + ".png"); ArchipelagoPlugin.Logger.LogInfo((object)("Loading texture from " + text)); UnityWebRequest req = UnityWebRequestTexture.GetTexture(text); UnityWebRequestAsyncOperation val = req.SendWebRequest(); bool done = false; ((AsyncOperation)val).completed += delegate { done = true; SetSprite(req.downloadHandler.data, name); }; if (((AsyncOperation)val).isDone && !done) { SetSprite(req.downloadHandler.data, name); } } private static void SetSprite(byte[] data, string name) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); ImageConversion.LoadImage(val, data); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); switch (name) { case "coll_ap": ArchipelagoCollection = val2; break; case "coll_ap_filter": ArchipelagoCollectionFiltered = val2; break; case "coll_ap_locked": ArchipelagoCollectionLocked = val2; break; default: ArchipelagoPlugin.Logger.LogWarning((object)("Sprite loaded but unknown name: " + name)); break; } if (Object.op_Implicit((Object)(object)Archipelago) && Object.op_Implicit((Object)(object)ArchipelagoGrey) && Object.op_Implicit((Object)(object)DifficultyIndicator) && Object.op_Implicit((Object)(object)DifficultyIndicatorGrey) && Object.op_Implicit((Object)(object)HotDog) && Object.op_Implicit((Object)(object)HotDogGrey) && Object.op_Implicit((Object)(object)RankIndicator) && Object.op_Implicit((Object)(object)RankIndicatorGrey) && Object.op_Implicit((Object)(object)ArchipelagoCollection) && Object.op_Implicit((Object)(object)ArchipelagoCollectionFiltered) && Object.op_Implicit((Object)(object)ArchipelagoCollectionLocked)) { TexturesLoaded = true; } } } public interface APCollection { bool HasNoTracks(); string GetNoTrackString(); } public class TrackCollectionAllAP : BaseTromboneCollection, APCollection { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private TromboneTrack <>2__current; private int <>l__initialThreadId; public TrackCollectionAllAP <>4__this; private int 5__1; private ArrayList 5__2; private List 5__3; private IEnumerator <>s__4; private TromboneTrack 5__5; private Track? 5__6; private IEnumerator <>s__7; private Track 5__8; private IEnumerator <>s__9; private Track 5__10; private List.Enumerator <>s__11; private string 5__12; TromboneTrack IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; 5__3 = null; <>s__4 = null; 5__5 = null; 5__6 = null; <>s__7 = null; 5__8 = default(Track); <>s__9 = null; 5__10 = default(Track); <>s__11 = default(List.Enumerator); 5__12 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0; 5__2 = new ArrayList(APHandler.FilteredTracks); 5__3 = new List(); <>s__4 = ((IEnumerable)TrackLookup.allTracks()).GetEnumerator(); <>1__state = -3; goto IL_01c1; case 1: <>1__state = -3; goto IL_01ad; case 2: { <>1__state = -1; break; } IL_01c1: if (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; 5__6 = null; <>s__7 = 5__2.GetEnumerator(); try { while (<>s__7.MoveNext()) { 5__8 = (Track)<>s__7.Current; if (5__8.Name.ToLower() == 5__5.trackname_short.ToLower()) { 5__6 = 5__8; break; } 5__8 = default(Track); } } finally { if (<>s__7 is IDisposable disposable) { disposable.Dispose(); } } <>s__7 = null; if (5__6.HasValue) { 5__2.Remove(5__6); 5__1++; <>2__current = 5__5; <>1__state = 1; return true; } 5__3.Add(5__5.trackname_short); goto IL_01ad; } <>m__Finally1(); <>s__4 = null; if (5__2.Count > 0) { <>s__9 = 5__2.GetEnumerator(); try { while (<>s__9.MoveNext()) { 5__10 = (Track)<>s__9.Current; ArchipelagoPlugin.Logger.LogInfo((object)("Missed track: " + 5__10.Name)); 5__10 = default(Track); } } finally { if (<>s__9 is IDisposable disposable2) { disposable2.Dispose(); } } <>s__9 = null; <>s__11 = 5__3.GetEnumerator(); try { while (<>s__11.MoveNext()) { 5__12 = <>s__11.Current; ArchipelagoPlugin.Logger.LogInfo((object)("Unknown track: " + 5__12)); 5__12 = null; } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(List.Enumerator); } if (5__1 == 0) { <>2__current = ((IEnumerable)TrackLookup.allTracks()).First((TromboneTrack track) => track.trackname_short == "Warm-Up"); <>1__state = 2; return true; } break; IL_01ad: 5__6 = null; 5__5 = null; goto IL_01c1; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__4 != null) { <>s__4.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__1(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public TrackCollectionAllAP() : base("AP", "Archipelago", "All tracks required for Archipelago") { } [IteratorStateMachine(typeof(d__1))] public override IEnumerable BuildTrackList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>4__this = this }; } public override YieldTask> LoadSprite() { return Coroutines.sync>(FuncConvert.FromFunc>((Func>)(() => FSharpResult.NewOk(ImageHandler.ArchipelagoCollection)))); } public bool HasNoTracks() { foreach (TromboneTrack item in (IEnumerable)TrackLookup.allTracks()) { Track[] filteredTracks = APHandler.FilteredTracks; for (int i = 0; i < filteredTracks.Length; i++) { Track track = filteredTracks[i]; if (track.Name.ToLower() == item.trackname_short.ToLower()) { return false; } } } return true; } public string GetNoTrackString() { return "AP song list is empty!\nReport this with your config included."; } } public class TrackCollectionAvailWithChecksOnly : BaseTromboneCollection, APCollection { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private TromboneTrack <>2__current; private int <>l__initialThreadId; public TrackCollectionAvailWithChecksOnly <>4__this; private int 5__1; private ArrayList 5__2; private List 5__3; private IEnumerator <>s__4; private TromboneTrack 5__5; private Track? 5__6; private IEnumerator <>s__7; private Track 5__8; private IEnumerator <>s__9; private Track 5__10; private List.Enumerator <>s__11; private string 5__12; TromboneTrack IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; 5__3 = null; <>s__4 = null; 5__5 = null; 5__6 = null; <>s__7 = null; 5__8 = default(Track); <>s__9 = null; 5__10 = default(Track); <>s__11 = default(List.Enumerator); 5__12 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0; 5__2 = new ArrayList(APHandler.FilteredTracks); 5__3 = new List(); <>s__4 = ((IEnumerable)TrackLookup.allTracks()).GetEnumerator(); <>1__state = -3; goto IL_022f; case 1: <>1__state = -3; goto IL_021b; case 2: { <>1__state = -1; break; } IL_022f: if (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; 5__6 = null; <>s__7 = 5__2.GetEnumerator(); try { while (<>s__7.MoveNext()) { 5__8 = (Track)<>s__7.Current; if (5__8.Name.ToLower() == 5__5.trackname_short.ToLower()) { 5__6 = 5__8; break; } 5__8 = default(Track); } } finally { if (<>s__7 is IDisposable disposable) { disposable.Dispose(); } } <>s__7 = null; if (5__6.HasValue) { 5__2.Remove(5__6.Value); if (APHandler.IsTrackAvailable(5__6.Value) && (!APHandler.APSentLocations.Contains(5__6.Value.ID) || !APHandler.APSentLocations.Contains(5__6.Value.ID + 1000))) { 5__1++; <>2__current = 5__5; <>1__state = 1; return true; } } else { 5__3.Add(5__5.trackname_short); } goto IL_021b; } <>m__Finally1(); <>s__4 = null; if (5__2.Count > 0) { <>s__9 = 5__2.GetEnumerator(); try { while (<>s__9.MoveNext()) { 5__10 = (Track)<>s__9.Current; ArchipelagoPlugin.Logger.LogInfo((object)("Missed track: " + 5__10.Name)); 5__10 = default(Track); } } finally { if (<>s__9 is IDisposable disposable2) { disposable2.Dispose(); } } <>s__9 = null; <>s__11 = 5__3.GetEnumerator(); try { while (<>s__11.MoveNext()) { 5__12 = <>s__11.Current; ArchipelagoPlugin.Logger.LogInfo((object)("Unknown track: " + 5__12)); 5__12 = null; } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(List.Enumerator); } if (5__1 == 0) { <>2__current = ((IEnumerable)TrackLookup.allTracks()).First((TromboneTrack track) => track.trackname_short == "Warm-Up"); <>1__state = 2; return true; } break; IL_021b: 5__6 = null; 5__5 = null; goto IL_022f; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__4 != null) { <>s__4.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__1(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public TrackCollectionAvailWithChecksOnly() : base("AP_checks", "Archipelago Checks", "Tracks that are unlocked and have checks remaining") { } [IteratorStateMachine(typeof(d__1))] public override IEnumerable BuildTrackList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>4__this = this }; } public override YieldTask> LoadSprite() { return Coroutines.sync>(FuncConvert.FromFunc>((Func>)(() => FSharpResult.NewOk(ImageHandler.ArchipelagoCollectionFiltered)))); } public bool HasNoTracks() { foreach (TromboneTrack item in (IEnumerable)TrackLookup.allTracks()) { Track[] filteredTracks = APHandler.FilteredTracks; for (int i = 0; i < filteredTracks.Length; i++) { Track track = filteredTracks[i]; if (track.Name.ToLower() == item.trackname_short.ToLower() && APHandler.IsTrackAvailable(track) && (!APHandler.APSentLocations.Contains(track.ID) || !APHandler.APSentLocations.Contains(track.ID + 1000))) { return false; } } } return true; } public string GetNoTrackString() { return "No songs left to play.\nMaybe press F2 to hint something?"; } } public class TrackCollectionLockedOnly : BaseTromboneCollection, APCollection { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private TromboneTrack <>2__current; private int <>l__initialThreadId; public TrackCollectionLockedOnly <>4__this; private int 5__1; private ArrayList 5__2; private List 5__3; private IEnumerator <>s__4; private TromboneTrack 5__5; private Track? 5__6; private IEnumerator <>s__7; private Track 5__8; private IEnumerator <>s__9; private Track 5__10; private List.Enumerator <>s__11; private string 5__12; TromboneTrack IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } 5__2 = null; 5__3 = null; <>s__4 = null; 5__5 = null; 5__6 = null; <>s__7 = null; 5__8 = default(Track); <>s__9 = null; 5__10 = default(Track); <>s__11 = default(List.Enumerator); 5__12 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; 5__1 = 0; 5__2 = new ArrayList(APHandler.FilteredTracks); 5__3 = new List(); <>s__4 = ((IEnumerable)TrackLookup.allTracks()).GetEnumerator(); <>1__state = -3; goto IL_01e1; case 1: <>1__state = -3; goto IL_01cd; case 2: { <>1__state = -1; break; } IL_01e1: if (<>s__4.MoveNext()) { 5__5 = <>s__4.Current; 5__6 = null; <>s__7 = 5__2.GetEnumerator(); try { while (<>s__7.MoveNext()) { 5__8 = (Track)<>s__7.Current; if (5__8.Name.ToLower() == 5__5.trackname_short.ToLower()) { 5__6 = 5__8; break; } 5__8 = default(Track); } } finally { if (<>s__7 is IDisposable disposable) { disposable.Dispose(); } } <>s__7 = null; if (5__6.HasValue) { 5__2.Remove(5__6.Value); if (!APHandler.IsTrackAvailable(5__6.Value)) { 5__1++; <>2__current = 5__5; <>1__state = 1; return true; } } else { 5__3.Add(5__5.trackname_short); } goto IL_01cd; } <>m__Finally1(); <>s__4 = null; if (5__2.Count > 0) { <>s__9 = 5__2.GetEnumerator(); try { while (<>s__9.MoveNext()) { 5__10 = (Track)<>s__9.Current; ArchipelagoPlugin.Logger.LogInfo((object)("Missed track: " + 5__10.Name)); 5__10 = default(Track); } } finally { if (<>s__9 is IDisposable disposable2) { disposable2.Dispose(); } } <>s__9 = null; <>s__11 = 5__3.GetEnumerator(); try { while (<>s__11.MoveNext()) { 5__12 = <>s__11.Current; ArchipelagoPlugin.Logger.LogInfo((object)("Unknown track: " + 5__12)); 5__12 = null; } } finally { ((IDisposable)<>s__11).Dispose(); } <>s__11 = default(List.Enumerator); } if (5__1 == 0) { <>2__current = ((IEnumerable)TrackLookup.allTracks()).First((TromboneTrack track) => track.trackname_short == "Warm-Up"); <>1__state = 2; return true; } break; IL_01cd: 5__6 = null; 5__5 = null; goto IL_01e1; } return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>s__4 != null) { <>s__4.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__1(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public TrackCollectionLockedOnly() : base("AP_locked", "Archipelago Locked", "Tracks that aren't yet available") { } [IteratorStateMachine(typeof(d__1))] public override IEnumerable BuildTrackList() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>4__this = this }; } public override YieldTask> LoadSprite() { return Coroutines.sync>(FuncConvert.FromFunc>((Func>)(() => FSharpResult.NewOk(ImageHandler.ArchipelagoCollectionLocked)))); } public bool HasNoTracks() { foreach (TromboneTrack item in (IEnumerable)TrackLookup.allTracks()) { Track[] filteredTracks = APHandler.FilteredTracks; for (int i = 0; i < filteredTracks.Length; i++) { Track track = filteredTracks[i]; if (track.Name.ToLower() == item.trackname_short.ToLower() && !APHandler.IsTrackAvailable(track)) { return false; } } } return true; } public string GetNoTrackString() { return "All songs unlocked.\nGo play them!"; } } public class TrackCollectionListener : Listener { [CompilerGenerated] private sealed class d__1 : IEnumerable, IEnumerable, IEnumerator, IDisposable, IEnumerator { private int <>1__state; private TromboneCollection <>2__current; private int <>l__initialThreadId; public TrackCollectionListener <>4__this; private Dictionary.ValueCollection.Enumerator <>s__1; private BaseTromboneCollection 5__2; TromboneCollection IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>s__1 = default(Dictionary.ValueCollection.Enumerator); 5__2 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = COLLECTIONS.Values.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; 5__2 = null; break; } if (<>s__1.MoveNext()) { 5__2 = <>s__1.Current; <>2__current = (TromboneCollection)(object)5__2; <>1__state = 1; return true; } <>m__Finally1(); <>s__1 = default(Dictionary.ValueCollection.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { d__1 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new d__1(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public static readonly Dictionary COLLECTIONS = new Dictionary { { "AP", (BaseTromboneCollection)(object)new TrackCollectionAllAP() }, { "AP_checks", (BaseTromboneCollection)(object)new TrackCollectionAvailWithChecksOnly() }, { "AP_locked", (BaseTromboneCollection)(object)new TrackCollectionLockedOnly() } }; [IteratorStateMachine(typeof(d__1))] public IEnumerable OnRegisterCollections() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__1(-2) { <>4__this = this }; } } public struct TrackHints { public Hint TrackUnlock; public Hint[] DifficultyUnlocks; public Hint PlayReward; public Hint BeatReward; public TrackHints() { TrackUnlock = null; DifficultyUnlocks = Array.Empty(); PlayReward = null; BeatReward = null; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "APTromboneChampMod"; public const string PLUGIN_NAME = "AP Trombone"; public const string PLUGIN_VERSION = "0.0.1"; } }