The BepInEx console will not appear when launching like it does for other games on Thunderstore. This is normal (and helps prevent crashes during startup). You can turn it back on in your BepInEx.cfg file.
Decompiled source of PEAK Unlimited v2.7.1
PEAKUnlimited.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using UnityEngine; using UnityEngine.UI; using Zorro.Core; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PEAKUnlimited")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("0.1.0.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: AssemblyProduct("PEAKUnlimited")] [assembly: AssemblyTitle("PEAKUnlimited")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.1.0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace PEAKUnlimited { [BepInPlugin("PEAKUnlimited", "PEAKUnlimited", "0.1.0")] public class Plugin : BaseUnityPlugin { public class AwakePatch { [HarmonyPatch(typeof(Campfire), "Awake")] [HarmonyPostfix] private static void Postfix(Campfire __instance) { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsMasterClient) { return; } if (((Object)((Component)((Component)__instance).gameObject.transform.parent).gameObject).name.ToLower().Contains("wings")) { Logger.LogInfo((object)"Skipping plane campfire..."); return; } campfireList.Add(__instance); Logger.LogInfo((object)"Marshmellowifying campfire...!"); int number = _numberOfPlayers - vanillaMaxPlayers; if (_cheatExtraMarshmallows != 0) { Logger.LogInfo((object)"Adding cheatmellows!"); number = _cheatExtraMarshmallows - vanillaMaxPlayers; if (_numberOfPlayers < vanillaMaxPlayers) { number = _cheatExtraMarshmallows - _numberOfPlayers; } } Logger.LogInfo((object)"Start of campfire patch!"); if (PhotonNetwork.IsMasterClient && (_numberOfPlayers > vanillaMaxPlayers || _cheatExtraMarshmallows != 0)) { Logger.LogInfo((object)("More than 4 players, preparing to marshmallowify! Number: " + _numberOfPlayers)); Vector3 position = ((Component)__instance).gameObject.transform.position; Logger.LogInfo((object)("Spawning " + number + " marshmallows!")); marshmallows.Add(__instance, spawnMarshmallows(number, position, __instance.advanceToSegment)); Logger.LogInfo((object)"End of campfire patch!"); } else { Logger.LogInfo((object)"Not enough players for campfire patch or not host!"); } isAfterAwake = true; } } public class OnPlayerEnteredRoomPatch { [HarmonyPatch(typeof(PlayerConnectionLog), "OnPlayerEnteredRoom")] [HarmonyPostfix] private static void Postfix(PlayerConnectionLog __instance) { //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) _numberOfPlayers++; Logger.LogInfo((object)("Someone has joined the room! Number: " + _numberOfPlayers + "/" + NetworkConnector.MAX_PLAYERS)); if (!_configLateMarshmallows.Value || !isAfterAwake || !PhotonNetwork.IsMasterClient || _numberOfPlayers <= vanillaMaxPlayers || _cheatExtraMarshmallows != 0) { return; } foreach (Campfire campfire in campfireList) { Vector3 position = ((Component)campfire).gameObject.transform.position; Logger.LogInfo((object)"Spawning a marshmallow!"); marshmallows[campfire].Add(spawnMarshmallows(1, position, campfire.advanceToSegment)[0]); } } } public class OnPlayerLeftRoomPatch { [HarmonyPatch(typeof(PlayerConnectionLog), "OnPlayerLeftRoom")] [HarmonyPostfix] private static void Postfix(PlayerConnectionLog __instance) { _numberOfPlayers--; if (_numberOfPlayers < 0) { _numberOfPlayers = 0; } Logger.LogInfo((object)("Someone has left the room! Number: " + _numberOfPlayers + "/" + NetworkConnector.MAX_PLAYERS)); if (!_configLateMarshmallows.Value || !isAfterAwake || !PhotonNetwork.IsMasterClient || _numberOfPlayers < vanillaMaxPlayers || _cheatExtraMarshmallows != 0) { return; } Logger.LogInfo((object)"Removing a marshmallow!"); foreach (Campfire campfire in campfireList) { Logger.LogInfo((object)("Removing a marshmallow! " + marshmallows[campfire].Count)); Logger.LogInfo((object)("Removing a marshmallow! " + ((Object)marshmallows[campfire][0].gameObject).name)); Object.Destroy((Object)(object)marshmallows[campfire][0]); marshmallows[campfire].RemoveAt(0); Logger.LogInfo((object)("Removing a marshmallow! " + marshmallows[campfire].Count)); Logger.LogInfo((object)("Removing a marshmallow! " + ((Object)marshmallows[campfire][0].gameObject).name)); } } } public class WaitingForPlayersUIPatch { [HarmonyPatch(typeof(WaitingForPlayersUI), "Update")] [HarmonyPrefix] private static void Prefix(WaitingForPlayersUI __instance) { if (__instance.scoutImages.Length >= Character.AllCharacters.Count) { return; } Image[] array = (Image[])(object)new Image[Character.AllCharacters.Count]; Image val = __instance.scoutImages[0]; for (int i = 0; i < Character.AllCharacters.Count; i++) { if (i < vanillaMaxPlayers) { array[i] = __instance.scoutImages[i]; } else { array[i] = Object.Instantiate<Image>(val, ((Component)val).transform.parent); } } __instance.scoutImages = array; } } public class EndScreenNextPatch { [HarmonyPatch(typeof(EndScreen), "Next")] [HarmonyPostfix] private static void PostFix() { if (PhotonNetwork.IsMasterClient) { Singleton<PeakHandler>.Instance.EndScreenComplete(); } } } public class EndScreenStartPatch { [HarmonyPatch(typeof(EndScreen), "Start")] [HarmonyPrefix] private static void Prefix(EndScreen __instance) { if (Character.AllCharacters.Count <= vanillaMaxPlayers) { return; } EndScreenScoutWindow[] array = (EndScreenScoutWindow[])(object)new EndScreenScoutWindow[Character.AllCharacters.Count]; Image[] array2 = (Image[])(object)new Image[Character.AllCharacters.Count]; Image[] array3 = (Image[])(object)new Image[Character.AllCharacters.Count]; Image[] array4 = (Image[])(object)new Image[Character.AllCharacters.Count]; Transform[] array5 = (Transform[])(object)new Transform[Character.AllCharacters.Count]; for (int i = 0; i < Character.AllCharacters.Count; i++) { if (i >= __instance.scouts.Length) { if ((Object)(object)__instance.scoutWindows[0] == (Object)null) { array[i] = null; } else { array[i] = Object.Instantiate<EndScreenScoutWindow>(__instance.scoutWindows[0], ((Component)__instance.scoutWindows[0]).transform.parent); } if ((Object)(object)__instance.scouts[0] == (Object)null) { array2[i] = null; } else { array2[i] = Object.Instantiate<Image>(__instance.scouts[0], ((Component)__instance.scouts[0]).transform.parent); } if ((Object)(object)__instance.scoutsAtPeak[0] == (Object)null) { array3[i] = null; } else { array3[i] = Object.Instantiate<Image>(__instance.scoutsAtPeak[0], ((Component)__instance.scoutsAtPeak[0]).transform.parent); } if ((Object)(object)__instance.oldPip[0] == (Object)null) { array4[i] = null; } else { array4[i] = Object.Instantiate<Image>(__instance.oldPip[0], ((Component)__instance.oldPip[0]).transform.parent); } if ((Object)(object)__instance.scoutLines[0] == (Object)null) { array5[i] = null; } else { array5[i] = Object.Instantiate<Transform>(__instance.scoutLines[0], ((Component)__instance.scoutLines[0]).transform.parent); } } else { array[i] = __instance.scoutWindows[i]; array2[i] = __instance.scouts[i]; array3[i] = __instance.scoutsAtPeak[i]; array4[i] = __instance.oldPip[i]; array5[i] = __instance.scoutLines[i]; } } __instance.scoutWindows = array; __instance.scouts = array2; __instance.scoutsAtPeak = array3; __instance.oldPip = array4; __instance.scoutLines = array5; } } public class EndSequenceRoutinePatch { [HarmonyPatch(typeof(EndScreen), "EndSequenceRoutine")] [HarmonyPostfix] private static void Postfix(EndScreen __instance) { for (int i = 4; i < Character.AllCharacters.Count; i++) { Logger.LogInfo((object)"Deactivating an end screen"); Object.Destroy((Object)(object)((Component)__instance.scoutWindows[i]).gameObject); Logger.LogInfo((object)"Deleted an end screen"); } } } internal static ManualLogSource Logger; private static int _newMaxPlayers; private static int _cheatExtraMarshmallows; private static bool _extraMarshmallows; private static ConfigEntry<int> _configMaxPlayers; private static ConfigEntry<int> _configCheatExtraMarshmallows; private static ConfigEntry<bool> _configExtraMarshmallows; private static ConfigEntry<bool> _configLateMarshmallows; private static int _numberOfPlayers = 1; private readonly Harmony _harmony = new Harmony("PEAKUnlimited"); private static List<Campfire> campfireList = new List<Campfire>(); private static bool isAfterAwake = false; private static int vanillaMaxPlayers = 4; private static Dictionary<Campfire, List<GameObject>> marshmallows = new Dictionary<Campfire, List<GameObject>>(); public const string Id = "PEAKUnlimited"; public static string Name => "PEAKUnlimited"; public static string Version => "0.1.0"; private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Logger.LogInfo((object)"Plugin PEAKUnlimited is loaded!"); _configMaxPlayers = ((BaseUnityPlugin)this).Config.Bind<int>("General", "MaxPlayers", 20, "The maximum number of players you want to be able to join your lobby (Including yourself). Warning: untested, higher numbers may be unstable! Range: 1-20"); _newMaxPlayers = _configMaxPlayers.Value; _configExtraMarshmallows = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ExtraMarshmallows", true, "Controls whether additional marshmallows are spawned for the extra players"); _extraMarshmallows = _configExtraMarshmallows.Value; _configLateMarshmallows = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "LateJoinMarshmallows", false, "Controls whether additional marshmallows are spawned for players who join late (mid run), and removed for those who leave early (Experimental + Untested)"); _configCheatExtraMarshmallows = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Cheat Marshmallows", 0, "(Cheat, disabled by default) This will set the desired amount of marshmallows to the campfires as a cheat, requires ExtraMarshmallows to be enabled."); _cheatExtraMarshmallows = _configCheatExtraMarshmallows.Value; if (_newMaxPlayers == 0) { _newMaxPlayers = 1; } else if (_newMaxPlayers > 30) { _newMaxPlayers = 30; } NetworkConnector.MAX_PLAYERS = _newMaxPlayers; Logger.LogInfo((object)("Plugin PEAKUnlimited set the Max Players to " + NetworkConnector.MAX_PLAYERS + "!")); Logger.LogInfo((object)"Plugin PEAKUnlimited is patching!"); if (_extraMarshmallows) { Logger.LogInfo((object)"Plugin PEAKUnlimited extra marshmallows are enabled!"); _harmony.PatchAll(typeof(AwakePatch)); Logger.LogInfo((object)"Plugin PEAKUnlimited late marshmallows are enabled!"); Logger.LogInfo((object)"Plugin PEAKUnlimited left patch enabled!"); _harmony.PatchAll(typeof(OnPlayerLeftRoomPatch)); Logger.LogInfo((object)"Plugin PEAKUnlimited joined patch enabled!"); _harmony.PatchAll(typeof(OnPlayerEnteredRoomPatch)); } Logger.LogInfo((object)"Plugin PEAKUnlimited patching end screen!"); _harmony.PatchAll(typeof(EndSequenceRoutinePatch)); _harmony.PatchAll(typeof(WaitingForPlayersUIPatch)); _harmony.PatchAll(typeof(EndScreenStartPatch)); _harmony.PatchAll(typeof(EndScreenNextPatch)); Logger.LogInfo((object)"Plugin PEAKUnlimited has patched!"); } private static List<Vector3> GetEvenlySpacedPointsAroundCampfire(int numPoints, float innerRadius, float outerRadius, Vector3 campfirePosition, Segment advanceToSegment) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = new List<Vector3>(); for (int i = 0; i < numPoints; i++) { float num = outerRadius; if (i % 2 == 0) { num = innerRadius; } float num2 = (float)i * MathF.PI * 2f / (float)numPoints; float num3 = num * Mathf.Cos(num2); float num4 = num * Mathf.Sin(num2); if ((int)advanceToSegment == 3) { list.Add(new Vector3(num3, -0.5f, num4) + campfirePosition); } else if ((int)advanceToSegment == 4) { list.Add(new Vector3(num3, -1f, num4) + campfirePosition); } else { list.Add(SetToGround(new Vector3(num3, 0f, num4) + campfirePosition)); } } return list; } private static List<GameObject> spawnMarshmallows(int number, Vector3 campfirePosition, Segment advanceToSegment) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) List<GameObject> list = new List<GameObject>(); Item val = SingletonAsset<ItemDatabase>.Instance.itemLookup[46]; Logger.LogInfo((object)("Plugin PeakUnlimited " + val.GetName())); val.GetName(); foreach (Vector3 item in GetEvenlySpacedPointsAroundCampfire(number, 2.5f, 3f, campfirePosition, advanceToSegment)) { list.Add(((Component)Add(val, item)).gameObject); } Logger.LogInfo((object)("Plugin PeakUnlimited added with position: " + val.GetName())); return list; } private static Vector3 SetToGround(Vector3 vector) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) return HelperFunctions.GetGroundPos(vector, (LayerType)4, 0f); } private static Item Add(Item item, Vector3 position) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.IsConnected) { return null; } Logger.LogInfo((object)$"Spawn item: {item} at {position}"); return PhotonNetwork.Instantiate("0_Items/" + ((Object)item).name, position, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f), (byte)0, (object[])null).GetComponent<Item>(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }