using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using HarmonyLib; using Peak; using Peak.Network; using Photon.Pun; using Photon.Realtime; using Steamworks; using UnityEngine; using UnityEngine.Networking; using UnityEngine.SceneManagement; using Zorro.Core.Serizalization; [assembly: ComVisible(false)] [assembly: Guid("8e2c4942-7667-4f44-a4d8-88d4502a3db9")] [assembly: AssemblyFileVersion("0.5.0.0")] [assembly: AssemblyProduct("PEAK Troll Mod")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = "")] [assembly: AssemblyTitle("PEAK Troll Mod")] [assembly: AssemblyDescription("An all-in-one BepInEx 5 mod for PEAK")] [assembly: AssemblyCompany("PEAK Troll Mod Contributors")] [assembly: AssemblyVersion("0.5.0.0")] namespace PeakTrollMod; [BepInPlugin("com.dougl.peaktrollmod", "PEAK Troll Mod", "0.5.0")] [BepInProcess("PEAK.exe")] public sealed class TrollModPlugin : BaseUnityPlugin { public const string Guid = "com.dougl.peaktrollmod"; public const string Name = "PEAK Troll Mod"; public const string Version = "0.5.0"; internal static TrollModPlugin Instance; internal ModConfig Settings; internal CapabilityRegistry Capabilities; internal PlayerManager Players; internal TrollNetworkManager Network; internal PlayerActions Actions; internal NoWaitManager NoWait; internal RecoveryManager Recovery; internal QuickReconnectManager QuickReconnect; internal ModConfigBrowser ModBrowser; internal TeamStatusManager TeamStatus; internal QuickBackpackManager QuickBackpack; internal BetterSpectatingManager BetterSpectating; internal PlayerPreferencesManager PlayerPreferences; internal LobbyReadinessManager LobbyReadiness; internal ActionShortcutManager Shortcuts; internal UnlimitedLobbyManager UnlimitedLobby; internal StaminaEffectPreviewManager StaminaEffectPreview; internal SurvivalAssistManager SurvivalAssist; internal LuggageNavigationManager LuggageNavigation; internal ClimbForecastManager ClimbForecast; internal PartySupplyAdvisorManager PartySupplyAdvisor; internal HotkeyConflictDoctor HotkeyDoctor; internal InfiniteRescueClawManager InfiniteRescueClaw; internal HungerAmplifierManager HungerAmplifier; internal InfiniteJetpackFuelManager InfiniteJetpackFuel; internal BiggerBackpackManager BiggerBackpack; internal BackpackProtectionManager BackpackProtection; internal StartAsSkeletonManager StartAsSkeleton; internal ScoutEspManager ScoutEsp; internal ProfileManager Profiles; internal LobbyProfileSyncManager LobbyProfileSync; internal AntiSoftlockManager AntiSoftlock; internal MindControlManager MindControl; internal SpawnManager Spawns; internal MirageManager Mirages; internal PingPlacementManager PingPlacement; internal PhantomPingManager PhantomPings; internal AudioManager Audio; internal AppearanceManager Appearance; internal ProgressionManager Progression; internal CampfireTrollManager CampfireTroll; internal HelicopterTrollManager HelicopterTroll; internal ChaosManager Chaos; internal ExpeditionDirectorManager Director; internal SummitSaboteurManager SummitSaboteur; internal ResetManager Reset; internal TrollUIManager Ui; internal UiFontManager UiFonts; private Harmony _harmony; private float _nextDynamicRefresh; private float _nextMenuToggle; private float _nextMenuInputWarning; private bool _menuKeyWasPressed; private bool _wasInRoom; private bool _shutdown; private void Awake() { //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Expected O, but got Unknown Instance = this; Settings = new ModConfig(((BaseUnityPlugin)this).Config); UiFonts = new UiFontManager(((BaseUnityPlugin)this).Logger); UiFonts.Load(); ModBrowser = new ModConfigBrowser(); ModBrowser.Refresh(); Capabilities = new CapabilityRegistry(((BaseUnityPlugin)this).Logger); Capabilities.Discover(); Players = new PlayerManager(((BaseUnityPlugin)this).Logger); Audio = new AudioManager(((BaseUnityPlugin)this).Logger, (BaseUnityPlugin)(object)this); PlayerPreferences = new PlayerPreferencesManager(((BaseUnityPlugin)this).Logger, Players, Audio, Settings); LobbyReadiness = new LobbyReadinessManager(Players); Mirages = new MirageManager(((BaseUnityPlugin)this).Logger); Actions = new PlayerActions(((BaseUnityPlugin)this).Logger, Players, Capabilities, Audio); NoWait = new NoWaitManager(((BaseUnityPlugin)this).Logger, Players, Actions, Capabilities, Settings); Recovery = new RecoveryManager(((BaseUnityPlugin)this).Logger, Players, Actions); Profiles = new ProfileManager(Settings); LobbyProfileSync = new LobbyProfileSyncManager(Profiles, Players); AntiSoftlock = new AntiSoftlockManager(Players, Recovery, Settings, ((BaseUnityPlugin)this).Logger); QuickReconnect = new QuickReconnectManager(((BaseUnityPlugin)this).Logger, Settings, Capabilities); TeamStatus = new TeamStatusManager(Players, Settings, ModBrowser, PlayerPreferences); QuickBackpack = new QuickBackpackManager(((BaseUnityPlugin)this).Logger, Settings, ModBrowser); BetterSpectating = new BetterSpectatingManager(((BaseUnityPlugin)this).Logger, Players, Actions, Settings); Spawns = new SpawnManager(((BaseUnityPlugin)this).Logger, Players, Capabilities); Shortcuts = new ActionShortcutManager(Settings); UnlimitedLobby = new UnlimitedLobbyManager(((BaseUnityPlugin)this).Logger, Settings, Actions, Spawns); StaminaEffectPreview = new StaminaEffectPreviewManager(Settings, ((BaseUnityPlugin)this).Logger); SurvivalAssist = new SurvivalAssistManager(Settings, ((BaseUnityPlugin)this).Logger); LuggageNavigation = new LuggageNavigationManager(Settings, ((BaseUnityPlugin)this).Logger); ClimbForecast = new ClimbForecastManager(Settings, ((BaseUnityPlugin)this).Logger); PartySupplyAdvisor = new PartySupplyAdvisorManager(Players, Settings, ((BaseUnityPlugin)this).Logger); HotkeyDoctor = new HotkeyConflictDoctor(ModBrowser, Settings, ((BaseUnityPlugin)this).Logger); InfiniteRescueClaw = new InfiniteRescueClawManager(Settings, ((BaseUnityPlugin)this).Logger); HungerAmplifier = new HungerAmplifierManager(((BaseUnityPlugin)this).Logger, Players, Actions); InfiniteJetpackFuel = new InfiniteJetpackFuelManager(Settings, ((BaseUnityPlugin)this).Logger); BiggerBackpack = new BiggerBackpackManager(Settings, ((BaseUnityPlugin)this).Logger); BackpackProtection = new BackpackProtectionManager(Settings, ((BaseUnityPlugin)this).Logger); StartAsSkeleton = new StartAsSkeletonManager(Settings, ((BaseUnityPlugin)this).Logger); ScoutEsp = new ScoutEspManager(Players, Settings, ((BaseUnityPlugin)this).Logger); Network = new TrollNetworkManager(((BaseUnityPlugin)this).Logger, Players, Actions, Mirages, Audio, HungerAmplifier); LobbyProfileSync.AttachNetwork(Network); MindControl = new MindControlManager(((BaseUnityPlugin)this).Logger, Players, Network, Settings, Capabilities); PingPlacement = new PingPlacementManager(((BaseUnityPlugin)this).Logger, Mirages, Players, Network); PhantomPings = new PhantomPingManager(((BaseUnityPlugin)this).Logger, Players); Appearance = new AppearanceManager(((BaseUnityPlugin)this).Logger); Progression = new ProgressionManager(((BaseUnityPlugin)this).Logger, Players, Settings); CampfireTroll = new CampfireTrollManager(((BaseUnityPlugin)this).Logger, Players, Actions, Settings); HelicopterTroll = new HelicopterTrollManager(((BaseUnityPlugin)this).Logger, Settings); Chaos = new ChaosManager(((BaseUnityPlugin)this).Logger, Players, Network, Actions, Mirages, Audio, Spawns); Director = new ExpeditionDirectorManager(((BaseUnityPlugin)this).Logger, Players, Actions, Spawns, Chaos, Network, Settings); Reset = new ResetManager(((BaseUnityPlugin)this).Logger, Actions, Mirages, Spawns, Audio, Appearance); SummitSaboteur = new SummitSaboteurManager(((BaseUnityPlugin)this).Logger, Players, Actions, Network, Spawns, Capabilities); Ui = new TrollUIManager(this); _harmony = new Harmony("com.dougl.peaktrollmod"); _harmony.PatchAll(typeof(TrollModPlugin).Assembly); SceneManager.sceneLoaded += OnSceneLoaded; Players.Refresh(); _wasInRoom = PhotonNetwork.InRoom; ((BaseUnityPlugin)this).Logger.LogInfo((object)("PEAK Troll Mod 0.5.0 loaded for PEAK " + Application.version + ".")); } private void Update() { if (Ui.IsOpen && Input.GetKeyDown((KeyCode)27)) { Ui.ForceClose(); } HandleMenuInput(); Players.Tick(); PlayerPreferences.Tick(); LobbyReadiness.Tick(); QuickReconnect.Tick(); Network.Tick(); LobbyProfileSync.Tick(); MindControl.Tick(); Actions.Tick(); Recovery.Tick(); AntiSoftlock.Tick(); NoWait.Tick(); QuickBackpack.Tick(Ui.IsOpen); BetterSpectating.Tick(Ui.IsOpen); StaminaEffectPreview.Tick(); SurvivalAssist.Tick(); InfiniteJetpackFuel.Tick(); BiggerBackpack.Tick(); StartAsSkeleton.Tick(); HungerAmplifier.Tick(); LuggageNavigation.Tick(); ScoutEsp.Tick(); ClimbForecast.Tick(); PartySupplyAdvisor.Tick(); HotkeyDoctor.Tick(); InfiniteRescueClaw.Tick(); Audio.Tick(); Mirages.Tick(); PhantomPings.Tick(); Spawns.Tick(); UnlimitedLobby.Tick(); Progression.Tick(); HelicopterTroll.Tick(); Chaos.Tick(); Director.Tick(); SummitSaboteur.Tick(); Ui.Tick(); bool inRoom = PhotonNetwork.InRoom; if (_wasInRoom && !inRoom) { Reset.ResetAll(); } _wasInRoom = inRoom; if (Time.unscaledTime >= _nextDynamicRefresh) { _nextDynamicRefresh = Time.unscaledTime + 10f; Capabilities.RefreshDynamic(); Actions.RefreshItemCatalog(); } } private void HandleMenuInput() { //IL_000b: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = Settings.MenuKey.Value; bool flag = false; bool flag2 = false; try { flag = ((KeyboardShortcut)(ref value)).IsDown(); flag2 = ((KeyboardShortcut)(ref value)).IsPressed(); } catch (Exception ex) { if (Time.unscaledTime >= _nextMenuInputWarning) { _nextMenuInputWarning = Time.unscaledTime + 2f; Warn("Configured menu shortcut could not be read: " + ex.Message); } } bool flag3 = false; try { if ((int)((KeyboardShortcut)(ref value)).MainKey != 0) { flag3 = Input.GetKey(((KeyboardShortcut)(ref value)).MainKey); } } catch { } bool flag4 = flag3 && !_menuKeyWasPressed; _menuKeyWasPressed = flag3; if (Settings.MenuActivation.Value == MenuActivationMode.Toggle) { if ((flag || flag4) && Time.unscaledTime >= _nextMenuToggle) { _nextMenuToggle = Time.unscaledTime + 0.15f; Ui.Toggle(); } } else { Ui.SetOpen(flag2 || flag3); } } private void OnGUI() { bool menuOpen = Ui != null && Ui.IsOpen; if (TeamStatus != null) { TeamStatus.Draw(menuOpen); } if (BetterSpectating != null) { BetterSpectating.Draw(menuOpen); } if (StaminaEffectPreview != null) { StaminaEffectPreview.Draw(menuOpen); } if (LuggageNavigation != null) { LuggageNavigation.Draw(menuOpen); } if (ScoutEsp != null) { ScoutEsp.Draw(menuOpen); } if (ClimbForecast != null) { ClimbForecast.Draw(menuOpen); } if (MindControl != null) { MindControl.Draw(menuOpen); } if (Ui != null) { Ui.Draw(); } } private void FixedUpdate() { if (Actions != null) { Actions.FixedTick(); } if (InfiniteRescueClaw != null) { InfiniteRescueClaw.FixedTick(); } } private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { if (Reset != null) { Reset.ResetAll(); } if (Players != null) { Players.Refresh(); } if (Capabilities != null) { Capabilities.RefreshDynamic(); } if (Actions != null) { Actions.RefreshItemCatalog(); } if (NoWait != null) { NoWait.OnSceneLoaded(); } if (Recovery != null) { Recovery.OnSceneLoaded(); } if (BetterSpectating != null) { BetterSpectating.OnSceneLoaded(); } if (UnlimitedLobby != null) { UnlimitedLobby.ResetScene(); } if (StaminaEffectPreview != null) { StaminaEffectPreview.ResetScene(); } if (SurvivalAssist != null) { SurvivalAssist.ResetScene(); } if (InfiniteJetpackFuel != null) { InfiniteJetpackFuel.ResetScene(); } if (BiggerBackpack != null) { BiggerBackpack.ResetScene(); } if (StartAsSkeleton != null) { StartAsSkeleton.OnSceneLoaded(); } if (LuggageNavigation != null) { LuggageNavigation.ResetScene(); } if (ScoutEsp != null) { ScoutEsp.ResetScene(); } if (AntiSoftlock != null) { AntiSoftlock.ResetScene(); } if (LobbyProfileSync != null) { LobbyProfileSync.Reset(); } if (ClimbForecast != null) { ClimbForecast.ResetScene(); } if (PartySupplyAdvisor != null) { PartySupplyAdvisor.ResetScene(); } if (InfiniteRescueClaw != null) { InfiniteRescueClaw.ResetScene(); } if (HungerAmplifier != null) { HungerAmplifier.Reset(); } if (MindControl != null) { MindControl.Reset(); } if (Ui != null) { Ui.ResetVisualAssets(); } if (CampfireTroll != null) { CampfireTroll.ResetScene(); } if (SummitSaboteur != null) { SummitSaboteur.Reset(); } if (Director != null) { Director.OnSceneLoaded(); } if (HelicopterTroll != null) { HelicopterTroll.ResetScene(); } DebugLog("Scene loaded: " + ((Scene)(ref scene)).name); } private void OnDisable() { if (!_shutdown) { if (Ui != null) { Ui.ForceClose(); } if (Reset != null) { Reset.ResetAll(); } } } private void OnEnable() { if (!_shutdown && Ui != null) { Ui.RecoverClosedState(); } } private void OnDestroy() { Shutdown(); } private void OnApplicationQuit() { Shutdown(); } private void Shutdown() { if (!_shutdown) { _shutdown = true; SceneManager.sceneLoaded -= OnSceneLoaded; if (Ui != null) { Ui.ForceClose(); } if (LuggageNavigation != null) { LuggageNavigation.ResetScene(); } if (ScoutEsp != null) { ScoutEsp.ResetScene(); } if (AntiSoftlock != null) { AntiSoftlock.ResetScene(); } if (LobbyProfileSync != null) { LobbyProfileSync.Reset(); } if (ClimbForecast != null) { ClimbForecast.ResetScene(); } if (PartySupplyAdvisor != null) { PartySupplyAdvisor.ResetScene(); } if (InfiniteRescueClaw != null) { InfiniteRescueClaw.RestoreAll(); } if (InfiniteJetpackFuel != null) { InfiniteJetpackFuel.ResetScene(); } if (BiggerBackpack != null) { BiggerBackpack.ResetScene(); } if (StartAsSkeleton != null) { StartAsSkeleton.RestoreOwnedSkeleton(); } if (HungerAmplifier != null) { HungerAmplifier.Reset(); } if (MindControl != null) { MindControl.Reset(); } if (SummitSaboteur != null) { SummitSaboteur.Reset(); } if (Director != null) { Director.Stop(cleanup: true); } if (Reset != null) { Reset.ResetAll(); } if (Audio != null) { Audio.Dispose(); } if (Network != null) { Network.Dispose(); } if (_harmony != null) { _harmony.UnpatchSelf(); } if (UiFonts != null) { UiFonts.Dispose(); } Instance = null; } } internal void DebugLog(string message) { if (Settings != null && Settings.DebugLogging.Value) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("[PTM] " + message)); } } internal void Warn(string message) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("[PTM] " + message)); } } [HarmonyPatch] internal static class ImmortalityPatch { private static IEnumerable TargetMethods() { string[] names = new string[8] { "Die", "DieInstantly", "DieInstantlyLocal", "RPCA_SetDead", "RPCA_Die", "PassOut", "RPCA_PassOut", "PassOutInstantly" }; for (int i = 0; i < names.Length; i++) { MethodInfo method = AccessTools.Method(typeof(Character), names[i], new Type[0], (Type[])null); if (method != null) { yield return method; } } } private static bool Prefix(Character __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if (!((Object)(object)instance == (Object)null) && instance.SurvivalAssist != null && instance.SurvivalAssist.Immortality && !((Object)(object)__instance == (Object)null)) { return !__instance.IsLocal; } return true; } } [HarmonyPatch(typeof(GamefeelHandler), "GetRotation")] internal static class AccessibleCameraShakePatch { private static void Postfix(ref Vector3 __result) { //IL_001a: 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_0039: Unknown result type (might be due to invalid IL or missing references) TrollModPlugin instance = TrollModPlugin.Instance; if (!((Object)(object)instance == (Object)null) && instance.Settings != null) { __result *= Mathf.Clamp01(instance.Settings.CameraShakeScale.Value); } } } [HarmonyPatch(typeof(PointPinger), "get_canPing")] internal static class SpectatorGhostPingPatch { private static readonly FieldInfo LastPinged = AccessTools.Field(typeof(PointPinger), "_timeLastPinged"); private static readonly FieldInfo Cooldown = AccessTools.Field(typeof(PointPinger), "coolDown"); private static void Postfix(PointPinger __instance, ref bool __result) { TrollModPlugin instance = TrollModPlugin.Instance; Character localCharacter = Character.localCharacter; if (!__result && !((Object)(object)instance == (Object)null) && instance.Settings != null && instance.Settings.BetterSpectatingEnabled.Value && instance.Settings.SpectateGhostPings.Value && !((Object)(object)localCharacter == (Object)null) && !((Object)(object)localCharacter.data == (Object)null) && localCharacter.data.fullyPassedOut && !((Object)(object)__instance == (Object)null)) { float num = ((LastPinged == null) ? 0f : ((float)LastPinged.GetValue(__instance))); float num2 = ((Cooldown == null) ? 0.5f : ((float)Cooldown.GetValue(__instance))); if (Time.time - num >= num2) { __result = true; } } } } [HarmonyPatch(typeof(CharacterItems), "DropAllItems")] internal static class NoWaitInventoryPreservationPatch { private static bool Prefix(CharacterItems __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if (!((Object)(object)instance == (Object)null) && instance.NoWait != null) { return !instance.NoWait.ShouldSuppressDrop(__instance); } return true; } } [HarmonyPatch(typeof(Character), "CanDoInput")] internal static class GameplayInputPatch { private static void Postfix(Character __instance, ref bool __result) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.Ui != null && instance.Ui.IsTyping && (Object)(object)__instance != (Object)null && __instance.IsLocal) { __result = false; } } } [HarmonyPatch(typeof(PointPinger), "DoPing")] internal static class PingPlacementPatch { private static bool Prefix(PointPinger __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance == (Object)null || instance.PingPlacement == null || !instance.PingPlacement.Active) { return true; } return !instance.PingPlacement.TryCapture(__instance); } } [HarmonyPatch(typeof(CursorHandler), "Update")] internal static class CursorHandlerPatch { private static bool Prefix() { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance == (Object)null || instance.Ui == null || !instance.Ui.IsOpen) { return true; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; return false; } } [HarmonyPatch(typeof(GUIManager), "UpdateWindowStatus")] internal static class WindowStatusPatch { private static readonly FieldInfo ShowingCursor = AccessTools.Field(typeof(GUIManager), "k__BackingField"); private static readonly FieldInfo BlockingInput = AccessTools.Field(typeof(GUIManager), "k__BackingField"); private static readonly FieldInfo LastBlockedInput = AccessTools.Field(typeof(GUIManager), "lastBlockedInput"); private static void Postfix(GUIManager __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if (!((Object)(object)instance == (Object)null) && instance.Ui != null && instance.Ui.IsOpen && !((Object)(object)__instance == (Object)null)) { if (ShowingCursor != null) { ShowingCursor.SetValue(__instance, true); } if (BlockingInput != null) { BlockingInput.SetValue(__instance, instance.Ui.IsTyping); } if (LastBlockedInput != null && instance.Ui.IsTyping) { LastBlockedInput.SetValue(__instance, Time.frameCount); } } } } [HarmonyPatch(typeof(CharacterInput), "Sample")] internal static class MindControlInputPatch { private static void Postfix(CharacterInput __instance, bool __0) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.MindControl != null) { instance.MindControl.OnInputSampled(__instance, __0); } } } [HarmonyPatch(typeof(MainCameraMovement), "LateUpdate")] internal static class MindControlCameraPatch { private static void Postfix(MainCameraMovement __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.MindControl != null) { instance.MindControl.OverrideCamera(__instance); } } } [HarmonyPatch(typeof(MirageLuggage), "Update")] internal static class MesaMirageLuggagePatch { private static void Postfix(MirageLuggage __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.LuggageNavigation != null) { instance.LuggageNavigation.SuppressNativeMirage((Component)(object)__instance); } } } [HarmonyPatch(typeof(Mirage), "Update")] internal static class MesaMiragePatch { private static void Postfix(Mirage __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.LuggageNavigation != null) { instance.LuggageNavigation.SuppressNativeMirage((Component)(object)__instance); } } } internal enum FeatureCapability { PlayerDiscovery, Ragdoll, Launch, Speed, Flight, Visibility, Teleport, StartEndTeleport, Resurrect, QuickReconnect, EmergencyRecovery, Knockout, Eliminate, StatusEffects, HungerAmplifier, DropHeldItem, GiveItem, ScoutmasterSpawn, MushroomZombieSpawn, LookerSpawn, Mandrake, PingPlacement, MirageLuggage, MirageStatue, MirageCapybara, MirageScout, FakeEnemyScoutmaster, FakeEnemyZombie, FakeEnemyLooker, FakeAudio, AppearanceSwap, VoiceSwap, IncomingVoiceMute, TalkWhileKnockedOut, PoisonCloud, SporeCloud, ZombieTargeting, DynamiteShower, ItemStorm, SkyLaunch, HorizonLaunch, WrongMountain, CosmeticUnlocks, BadgeUnlocks, PositionRoulette, OneLiveOne, ComboBuilder, SummitSaboteur, MindControl, InfiniteJetpackFuel, BiggerBackpack, BackpackProtection, StartAsSkeleton, CampfireReset, CampfireDeathTrap, HelicopterSuppression, PhantomPings } internal enum PermissionKind { Anyone, EveryoneNeedsMod, HostOnly, Unsupported } internal enum NetCommand : byte { Hello = 1, Ragdoll, Launch, Speed, Visibility, Teleport, Knockout, Eliminate, Status, ClearStatuses, GiveItem, Reset, FakeAudio, MirageScout, FakeEnemy, ClearMirages, HostSpawnScoutmaster, HostSpawnZombie, HostClearRequestedSpawns, MirageProp, SetHelicopterSuppression, PhantomPings, CancelPhantomPings, Flight, SetHungerAmplifier, SummitSabotageVictim, MindControlStart, MindControlAck, MindControlInput, MindControlStop, ProfileOffer, ProfileResponse, DirectorScenarioOffer, DirectorScenarioResponse } internal enum MirageKind { Luggage, AmuletStatue, CapybaraPool, Scout, FakeEnemy } internal enum FakeEnemyKind { Scoutmaster, MushroomZombie, Looker } internal enum MirageBehavior { StandStill, StandAndStare, FollowAtDistance, ApproachSlowly, ChargeTarget, WalkAcross, RunAway, VanishWhenClose } internal enum PhantomPingPattern { BreadcrumbTrail, Circle, BehindYou } internal enum NoWaitDestination { NearestLiving, LowestLiving, Checkpoint } internal enum MenuActivationMode { Toggle, Hold } internal enum ExpeditionMode { ZombieOutbreak, Survival, RescueRush, Hardcore, ChaosClimb, Custom } internal enum DirectorRoundState { Stopped, Running, Paused, Completed, Failed } internal sealed class ActionResult { public readonly bool Success; public readonly string Message; private ActionResult(bool success, string message) { Success = success; Message = message; } public static ActionResult Ok(string message) { return new ActionResult(success: true, message); } public static ActionResult Fail(string message) { return new ActionResult(success: false, message); } } internal sealed class PlayerEntry { public int ActorNumber; public string Name; public ulong SteamUserId; public Character Character; public bool IsLocal; public override string ToString() { return Name + (IsLocal ? " (You)" : ""); } } internal sealed class MirageRecord { public Guid Id; public MirageKind Kind; public int CreatorActor; public DateTime CreatedUtc; public Vector3 Position; public Quaternion Rotation; public int TargetActor; public GameObject Object; } internal sealed class ModConfig { public readonly ConfigEntry MenuKey; public readonly ConfigEntry UiScale; public readonly ConfigEntry Transparency; public readonly ConfigEntry ConfirmDestructive; public readonly ConfigEntry ExcludeSelf; public readonly ConfigEntry DebugLogging; public readonly ConfigEntry NetworkDiagnostics; public readonly ConfigEntry MirageDebug; public readonly ConfigEntry FakeEnemyDebug; public readonly ConfigEntry MaxSpawnedObjects; public readonly ConfigEntry MaxDynamiteObjects; public readonly ConfigEntry MaxItemStormObjects; public readonly ConfigEntry ChaosMinDelay; public readonly ConfigEntry ChaosMaxDelay; public readonly ConfigEntry UnlockAllCosmetics; public readonly ConfigEntry UnlockAllBadges; public readonly ConfigEntry CampfireResetEnabled; public readonly ConfigEntry CampfireDeathTrapEnabled; public readonly ConfigEntry CampfireDeathRadius; public readonly ConfigEntry HelicopterSuppressionEnabled; public readonly ConfigEntry NoWaitEnabled; public readonly ConfigEntry NoWaitDestinationMode; public readonly ConfigEntry NoWaitPreserveReconnectState; public readonly ConfigEntry LastLobbyId; public readonly ConfigEntry TeamStatusEnabled; public readonly ConfigEntry TeamStatusDistance; public readonly ConfigEntry TeamStatusScale; public readonly ConfigEntry TeamStatusShowSelf; public readonly ConfigEntry QuickBackpackEnabled; public readonly ConfigEntry QuickBackpackKey; public readonly ConfigEntry BetterSpectatingEnabled; public readonly ConfigEntry SpectatePreviousKey; public readonly ConfigEntry SpectateNextKey; public readonly ConfigEntry SpectateFreeCameraKey; public readonly ConfigEntry SpectateGhostPings; public readonly ConfigEntry SpectateOverlay; public readonly ConfigEntry PreferExternalQualityOfLifeMods; public readonly ConfigEntry PlayerPreferencesData; public readonly ConfigEntry TextScale; public readonly ConfigEntry HighContrast; public readonly ConfigEntry CameraShakeScale; public readonly ConfigEntry ReduceFlashingEffects; public readonly ConfigEntry MenuActivation; public readonly ConfigEntry ItemSpawnerEnabled; public readonly ConfigEntry EffectPreviewEnabled; public readonly ConfigEntry StaminaEffectPreviewEnabled; public readonly ConfigEntry StaminaEffectPreviewDetails; public readonly ConfigEntry ImmortalityEnabled; public readonly ConfigEntry InfiniteStaminaEnabled; public readonly ConfigEntry RealLuggageDirectionsEnabled; public readonly ConfigEntry RealLuggageMaximumDistance; public readonly ConfigEntry MesaAntiMiragesEnabled; public readonly ConfigEntry FavoritesAndRecentsEnabled; public readonly ConfigEntry FavoriteItemsData; public readonly ConfigEntry RecentItemsData; public readonly ConfigEntry FavoriteEffectsData; public readonly ConfigEntry RecentEffectsData; public readonly ConfigEntry UnlimitedLobbyEnabled; public readonly ConfigEntry UnlimitedLobbyMaxPlayers; public readonly ConfigEntry UnlimitedLobbyScaleSupplies; public readonly ConfigEntry UnlimitedLobbyExtraFood; public readonly ConfigEntry UnlimitedLobbyExtraBackpacks; public readonly ConfigEntry ClimbForecastEnabled; public readonly ConfigEntry ClimbForecastMaximumHeight; public readonly ConfigEntry ClimbForecastSafetyReserve; public readonly ConfigEntry PartySupplyAdvisorEnabled; public readonly ConfigEntry PartySupplyIncludeBackpacks; public readonly ConfigEntry HotkeyConflictDoctorEnabled; public readonly ConfigEntry InfiniteRescueClawReachEnabled; public readonly ConfigEntry MindControlDuration; public readonly ConfigEntry MindControlCameraDistance; public readonly ConfigEntry MindControlHostPuppetForce; public readonly ConfigEntry MindControlEscapeKey; public readonly ConfigEntry InfiniteJetpackFuelEnabled; public readonly ConfigEntry BiggerBackpackEnabled; public readonly ConfigEntry BackpackProtectionEnabled; public readonly ConfigEntry StartAsSkeletonEnabled; public readonly ConfigEntry ScoutCompassEnabled; public readonly ConfigEntry ScoutEspEnabled; public readonly ConfigEntry LuggageEspEnabled; public readonly ConfigEntry ZombieEspEnabled; public readonly ConfigEntry ScoutmasterEspEnabled; public readonly ConfigEntry EspLabelsEnabled; public readonly ConfigEntry EspTracersEnabled; public readonly ConfigEntry EspMaximumDistance; public readonly ConfigEntry EspOutlineWidth; public readonly ConfigEntry ScoutEspColor; public readonly ConfigEntry LuggageEspColor; public readonly ConfigEntry ZombieEspColor; public readonly ConfigEntry ScoutmasterEspColor; public readonly ConfigEntry ActiveProfileName; public readonly ConfigEntry SavedProfileCode; public readonly ConfigEntry AntiSoftlockDoctorEnabled; public readonly ConfigEntry AntiSoftlockDetectionDelay; public readonly ConfigEntry DirectorScenarioCode; public ModConfig(ConfigFile config) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Unknown result type (might be due to invalid IL or missing references) MenuKey = config.Bind("UI", "MenuKey", new KeyboardShortcut((KeyCode)288, (KeyCode[])(object)new KeyCode[0]), "Open or close the PEAK Troll Mod menu."); UiScale = config.Bind("UI", "Scale", 1f, "UI scale (0.75-1.5)."); Transparency = config.Bind("UI", "Transparency", 0.96f, "Window opacity (0.55-1.0)."); ConfirmDestructive = config.Bind("Safety", "ConfirmDestructiveActions", true, "Require a second click for elimination and bulk reset."); ExcludeSelf = config.Bind("Targeting", "ExcludeSelf", true, "Exclude the local player from random targets."); DebugLogging = config.Bind("Diagnostics", "DebugLogging", false, "Enable detailed diagnostics."); NetworkDiagnostics = config.Bind("Diagnostics", "NetworkDiagnostics", false, "Log validated mod messages."); MirageDebug = config.Bind("Diagnostics", "MirageDebugInfo", false, "Log mirage lifecycle."); FakeEnemyDebug = config.Bind("Diagnostics", "FakeEnemyDebugInfo", false, "Log fake-enemy lifecycle."); MaxSpawnedObjects = config.Bind("Safety", "MaximumModSpawnedObjects", 24, "Hard cap for tracked spawns and mirages."); MaxDynamiteObjects = config.Bind("Safety", "MaximumDynamiteObjects", 64, "Separate hard cap for caller-owned Dynamite Shower items (1-128)."); MaxItemStormObjects = config.Bind("Safety", "MaximumItemStormObjects", 64, "Separate hard cap for caller-owned Item Storm objects (1-128)."); ChaosMinDelay = config.Bind("Chaos", "MinimumDelay", 8f, "Minimum chaos event delay."); ChaosMaxDelay = config.Bind("Chaos", "MaximumDelay", 18f, "Maximum chaos event delay."); UnlockAllCosmetics = config.Bind("Progression", "UnlockAllCosmetics", false, "Expose all PEAK cosmetics while the mod is enabled without granting platform achievements."); UnlockAllBadges = config.Bind("Progression", "UnlockAllBadges", false, "Expose all PEAK badges and sync the local sash while enabled without granting platform achievements."); CampfireResetEnabled = config.Bind("World", "CampfireTeleportsEveryoneToStart", false, "When this client observes a campfire ignition, teleport all scouts back to the first segment start."); CampfireDeathTrapEnabled = config.Bind("World", "CampfireDeathTrap", false, "When this client observes a campfire ignition, eliminate every living scout within the configured radius. Takes precedence over the reset trap."); CampfireDeathRadius = config.Bind("World", "CampfireDeathRadius", 12f, "Radius in metres around an ignited campfire affected by the death trap (3-50)."); HelicopterSuppressionEnabled = config.Bind("World", "SuppressSummitHelicopter", false, "Suppress the summit rescue sequence locally and advertise suppression to compatible clients."); NoWaitEnabled = config.Bind("Player", "NoWait", true, "When joining an expedition already in progress, automatically revive the local scout beside the nearest living player."); NoWaitDestinationMode = config.Bind("Player", "NoWaitDestination", NoWaitDestination.NearestLiving, "Where No Wait places a late joiner: nearest living scout, lowest living scout, or the active checkpoint."); NoWaitPreserveReconnectState = config.Bind("Player", "NoWaitPreserveReconnectState", true, "When reconnecting, preserve the local scout's restored inventory, statuses, thorns, extra stamina, and petrification state."); LastLobbyId = config.Bind("Reconnect", "LastLobbyId", string.Empty, "Last valid Steam lobby ID observed by Quick Reconnect."); TeamStatusEnabled = config.Bind("Quality of Life", "TeamStatusPanel", true, "Show a compact teammate stamina and condition panel."); TeamStatusDistance = config.Bind("Quality of Life", "TeamStatusDistance", 45f, "Maximum world distance for the team panel (10-200 metres)."); TeamStatusScale = config.Bind("Quality of Life", "TeamStatusScale", 1f, "Team panel scale (0.7-1.4)."); TeamStatusShowSelf = config.Bind("Quality of Life", "TeamStatusShowSelf", false, "Include the local scout in the team panel."); QuickBackpackEnabled = config.Bind("Quality of Life", "QuickBackpack", true, "Open the equipped backpack wheel with a hotkey."); QuickBackpackKey = config.Bind("Quality of Life", "QuickBackpackKey", new KeyboardShortcut((KeyCode)98, (KeyCode[])(object)new KeyCode[0]), "Hold to open the equipped backpack wheel."); BetterSpectatingEnabled = config.Bind("Quality of Life", "BetterSpectating", true, "Add spectator shortcuts, overlay, free camera, ghost pings, and revive-near-target."); SpectatePreviousKey = config.Bind("Quality of Life", "SpectatePreviousKey", new KeyboardShortcut((KeyCode)113, (KeyCode[])(object)new KeyCode[0]), "Cycle to the previous living scout while spectating."); SpectateNextKey = config.Bind("Quality of Life", "SpectateNextKey", new KeyboardShortcut((KeyCode)101, (KeyCode[])(object)new KeyCode[0]), "Cycle to the next living scout while spectating."); SpectateFreeCameraKey = config.Bind("Quality of Life", "SpectateFreeCameraKey", new KeyboardShortcut((KeyCode)289, (KeyCode[])(object)new KeyCode[0]), "Toggle PEAK's free camera while spectating."); SpectateGhostPings = config.Bind("Quality of Life", "SpectateGhostPings", true, "Allow normal point pings while fully passed out."); SpectateOverlay = config.Bind("Quality of Life", "SpectateOverlay", true, "Show the current spectator target, altitude, status, and shortcuts."); PreferExternalQualityOfLifeMods = config.Bind("Compatibility", "PreferExternalQualityOfLifeMods", true, "Yield duplicate built-in features to enabled PeakStatsEx and EasyBackpack components."); PlayerPreferencesData = config.Bind("Player Preferences", "SavedPlayers", string.Empty, "Serialized per-Steam-player aliases, colors, voice settings, and random-target exclusions."); TextScale = config.Bind("Accessibility", "TextScale", 1f, "Menu text scale (0.85-1.30)."); HighContrast = config.Bind("Accessibility", "HighContrastColors", false, "Use brighter text and stronger status contrast."); CameraShakeScale = config.Bind("Accessibility", "CameraShakeScale", 1f, "Scale PEAK camera shake from 0 (off) to 1 (normal)."); ReduceFlashingEffects = config.Bind("Accessibility", "ReduceFlashingTrollEffects", false, "Slow and cap repeated visual troll effects such as Phantom Pings."); MenuActivation = config.Bind("Accessibility", "MenuActivation", MenuActivationMode.Toggle, "Open F7 as a toggle or only while the shortcut is held."); ItemSpawnerEnabled = config.Bind("Quality of Life", "ItemSpawner", true, "Show the searchable item spawner page in the F7 menu."); EffectPreviewEnabled = config.Bind("Quality of Life", "EffectPreview", true, "Show safe, non-executing effect previews before use."); StaminaEffectPreviewEnabled = config.Bind("Quality of Life", "StaminaEffectPreview", true, "Preview a held consumable's stamina and condition-bar changes before using it. Automatically yields to the standalone Effect Preview mod."); StaminaEffectPreviewDetails = config.Bind("Quality of Life", "StaminaEffectPreviewDetails", true, "Show individual condition changes beneath the held-item stamina forecast."); ImmortalityEnabled = config.Bind("Player", "Immortality", false, "Prevent local death and full pass-out and continuously clear every negative stamina-bar condition, including carried-weight encumbrance, while enabled."); InfiniteStaminaEnabled = config.Bind("Player", "InfiniteStamina", false, "Continuously refill the local scout's available stamina while enabled."); RealLuggageDirectionsEnabled = config.Bind("Quality of Life", "RealLuggageDirections", false, "Show direction and distance to the nearest unopened genuine luggage while ignoring native and mod-created mirages."); RealLuggageMaximumDistance = config.Bind("Quality of Life", "RealLuggageMaximumDistance", 750f, "Maximum real-luggage search distance in metres (25-2000)."); MesaAntiMiragesEnabled = config.Bind("Quality of Life", "MesaAntiMirages", false, "Locally hide native and PEAK Troll Mod-created mirage visuals wherever they appear. The legacy setting name is retained so existing configs keep working."); FavoritesAndRecentsEnabled = config.Bind("Quality of Life", "FavoritesAndRecentActions", true, "Remember favorite and recently used items/effect previews."); FavoriteItemsData = config.Bind("Quick Access", "FavoriteItems", string.Empty, "Newline-separated favorite runtime item names."); RecentItemsData = config.Bind("Quick Access", "RecentItems", string.Empty, "Newline-separated recently used runtime item names."); FavoriteEffectsData = config.Bind("Quick Access", "FavoriteEffects", string.Empty, "Newline-separated favorite effect preview names."); RecentEffectsData = config.Bind("Quick Access", "RecentEffects", string.Empty, "Newline-separated recently previewed effects."); UnlimitedLobbyEnabled = config.Bind("Unlimited Lobby", "Enabled", false, "Raise the next hosted lobby's player cap. Automatically yields to the standalone PEAK Unlimited mod."); UnlimitedLobbyMaxPlayers = config.Bind("Unlimited Lobby", "MaxPlayers", 12, "Maximum players for newly hosted rooms (4-30). Change before creating the lobby."); UnlimitedLobbyScaleSupplies = config.Bind("Unlimited Lobby", "ScaleCampfireSupplies", true, "Scale campfire food and backpack spawns for players above the vanilla four-player count."); UnlimitedLobbyExtraFood = config.Bind("Unlimited Lobby", "ExtraCampfireFood", true, "Spawn one additional marshmallow per player above four, including late joiners."); UnlimitedLobbyExtraBackpacks = config.Bind("Unlimited Lobby", "ExtraBackpacks", true, "Spawn roughly one additional backpack per four players above the vanilla cap."); ClimbForecastEnabled = config.Bind("Smart Quality of Life", "ClimbForecast", true, "While reaching toward a steep surface, estimate the climb time, stamina cost, and safety reserve to its next standable ledge."); ClimbForecastMaximumHeight = config.Bind("Smart Quality of Life", "ClimbForecastMaximumHeight", 12f, "Maximum vertical height scanned for a standable ledge (3-20 metres)."); ClimbForecastSafetyReserve = config.Bind("Smart Quality of Life", "ClimbForecastSafetyReserve", 0.2f, "Stamina reserve required for a climb to be rated safe (0-50 percent)."); PartySupplyAdvisorEnabled = config.Bind("Smart Quality of Life", "PartySupplyAdvisor", true, "Summarize synchronized party supplies and highlight practical loadout gaps without moving items."); PartySupplyIncludeBackpacks = config.Bind("Smart Quality of Life", "PartySupplyIncludeBackpacks", true, "Include already-synchronized equipped-backpack contents in party supply analysis."); HotkeyConflictDoctorEnabled = config.Bind("Smart Quality of Life", "HotkeyConflictDoctor", true, "Detect exact duplicate BepInEx KeyboardShortcut and KeyCode bindings across enabled plugins."); InfiniteRescueClawReachEnabled = config.Bind("Quality of Life", "InfiniteRescueClawReach", false, "Give the locally held Rescue Claw map-wide targeting and zip the local scout toward distant wall anchors. Yields to a standalone infinite-range rescue-hook mod."); MindControlDuration = config.Bind("Mind Control", "MaximumDuration", 60f, "Maximum in-game Mind Control session duration in seconds (10-180)."); MindControlCameraDistance = config.Bind("Mind Control", "ThirdPersonCameraDistance", 5.5f, "Controller's third-person follow-camera distance in metres (3-10)."); MindControlHostPuppetForce = config.Bind("Mind Control", "HostPuppetForce", 2.5f, "Bounded native movement force for host-only control of unmodded scouts (1-8)."); MindControlEscapeKey = config.Bind("Mind Control", "ReleaseKey", new KeyboardShortcut((KeyCode)287, (KeyCode[])(object)new KeyCode[0]), "Immediately release or break free from an active Mind Control session."); InfiniteJetpackFuelEnabled = config.Bind("Player", "InfiniteJetpackFuel", false, "Keep the locally equipped Jetpack at its native maximum fuel and restore its original fuel when disabled."); BiggerBackpackEnabled = config.Bind("Quality of Life", "BiggerBackpack", false, "Expand the local Backpack to eight slots and Fanny Pack to four slots. Extra slots require this mod to display on other clients."); BackpackProtectionEnabled = config.Bind("Quality of Life", "BackpackProtection", false, "Prevent other scouts from withdrawing items from your equipped backpack when you or the current host runs a compatible protocol."); StartAsSkeletonEnabled = config.Bind("Player", "StartAsSkeleton", false, "Start each island expedition with PEAK's native Book of Bones skeleton state."); ScoutCompassEnabled = config.Bind("ESP", "ScoutCompass", false, "Show the direction and distance to the nearest other living scout."); ScoutEspEnabled = config.Bind("ESP", "Scouts", false, "Draw local through-wall outlines around other scouts."); LuggageEspEnabled = config.Bind("ESP", "Luggage", false, "Draw local through-wall outlines around unopened genuine luggage."); ZombieEspEnabled = config.Bind("ESP", "Zombies", false, "Draw local through-wall outlines around loaded Mushroom Zombies."); ScoutmasterEspEnabled = config.Bind("ESP", "Scoutmaster", false, "Draw local through-wall outlines around loaded Scoutmasters."); EspLabelsEnabled = config.Bind("ESP", "Labels", true, "Show category/name and distance labels above ESP outlines."); EspTracersEnabled = config.Bind("ESP", "Tracers", false, "Draw colored lines from the bottom-center of the screen to highlighted ESP targets."); EspMaximumDistance = config.Bind("ESP", "MaximumDistance", 600f, "Maximum ESP rendering distance in metres (25-2000)."); EspOutlineWidth = config.Bind("ESP", "OutlineWidth", 2f, "ESP outline and tracer thickness (1-8 pixels)."); ScoutEspColor = config.Bind("ESP Colors", "Scout", "#40FFC7", "Scout ESP outline color as #RRGGBB."); LuggageEspColor = config.Bind("ESP Colors", "Luggage", "#FFC233", "Luggage ESP outline color as #RRGGBB."); ZombieEspColor = config.Bind("ESP Colors", "Zombie", "#FF4040", "Zombie ESP outline color as #RRGGBB."); ScoutmasterEspColor = config.Bind("ESP Colors", "Scoutmaster", "#B861FF", "Scoutmaster ESP outline color as #RRGGBB."); ActiveProfileName = config.Bind("Profiles", "ActiveProfileName", "Custom", "Display name of the last applied or saved PEAK Troll Mod profile."); SavedProfileCode = config.Bind("Profiles", "SavedProfileCode", string.Empty, "Portable code for the last saved PEAK Troll Mod profile."); AntiSoftlockDoctorEnabled = config.Bind("Anti-Softlock", "Enabled", true, "Detect likely local softlocks and offer explicit safe recovery actions."); AntiSoftlockDetectionDelay = config.Bind("Anti-Softlock", "DetectionDelay", 10f, "Seconds a suspicious state must persist before the doctor recommends a repair (6-30)."); DirectorScenarioCode = config.Bind("Expedition Director", "LastScenarioCode", string.Empty, "Last validated PTMD1 scenario code exported or imported through Expedition Director."); } } internal static class ReflectionHelpers { private static readonly Dictionary Methods = new Dictionary(); private static readonly Dictionary Fields = new Dictionary(); public static MethodInfo Method(Type type, string name, Type[] args) { string key = type.FullName + "::" + name + "/" + args.Length; if (!Methods.TryGetValue(key, out var value)) { value = AccessTools.Method(type, name, args, (Type[])null); Methods[key] = value; } return value; } public static FieldInfo Field(Type type, string name) { string key = type.FullName + "::" + name; if (!Fields.TryGetValue(key, out var value)) { value = AccessTools.Field(type, name); Fields[key] = value; } return value; } public static object Invoke(object target, MethodInfo method, params object[] args) { if (target == null || method == null) { return null; } return method.Invoke(target, args); } public static bool HasMethod(Type type, string name, params Type[] args) { return Method(type, name, args) != null; } public static bool HasField(Type type, string name) { return Field(type, name) != null; } } internal sealed class CapabilityRegistry { private readonly Dictionary _unavailable = new Dictionary(); private readonly ManualLogSource _log; private bool _discovered; public CapabilityRegistry(ManualLogSource log) { _log = log; } public void Discover() { Dictionary dictionary = new Dictionary(_unavailable); _unavailable.Clear(); Need(FeatureCapability.PlayerDiscovery, typeof(PlayerHandler).GetMethod("GetAllPlayerCharacters") != null, "PlayerHandler.GetAllPlayerCharacters missing"); Need(FeatureCapability.Ragdoll, ReflectionHelpers.HasMethod(typeof(Character), "AddForceAtPosition", typeof(Vector3), typeof(Vector3), typeof(float)) && ReflectionHelpers.HasMethod(typeof(Character), "Fall", typeof(float), typeof(float)), "native Character.AddForceAtPosition/Fall RPC paths missing"); Need(FeatureCapability.Launch, ReflectionHelpers.HasMethod(typeof(Character), "AddForceAtPosition", typeof(Vector3), typeof(Vector3), typeof(float)), "native Character.AddForceAtPosition RPC path missing"); Need(FeatureCapability.Speed, ReflectionHelpers.HasField(typeof(CharacterMovement), "movementModifier"), "CharacterMovement.movementModifier missing"); Need(FeatureCapability.Flight, ReflectionHelpers.HasField(typeof(CharacterRagdoll), "rigidbodies") && typeof(Rigidbody).GetProperty("linearVelocity") != null && typeof(Rigidbody).GetProperty("useGravity") != null, "character rigidbodies or flight physics properties missing"); Need(FeatureCapability.Visibility, typeof(Renderer) != null, "Unity Renderer unavailable"); Need(FeatureCapability.Teleport, typeof(Character).GetMethod("WarpPlayerRPC") != null, "Character.WarpPlayerRPC missing"); Need(FeatureCapability.StartEndTeleport, typeof(MapHandler).GetField("segments") != null, "MapHandler segment references missing"); Need(FeatureCapability.Resurrect, ReflectionHelpers.HasMethod(typeof(Character), "RPCA_ReviveAtPosition", typeof(Vector3), typeof(bool), typeof(int)), "Character.RPCA_ReviveAtPosition missing"); Need(FeatureCapability.QuickReconnect, ReflectionHelpers.HasMethod(typeof(SteamLobbyHandler), "TryJoinLobby", typeof(CSteamID)), "Steam lobby join path missing"); Need(FeatureCapability.EmergencyRecovery, Available(FeatureCapability.Teleport) && ReflectionHelpers.HasMethod(typeof(CharacterRagdoll), "HaltBodyVelocity", typeof(bool)), "safe warp or rigidbody halt path missing"); Need(FeatureCapability.Knockout, typeof(Character).GetMethod("PassOutInstantly") != null, "Character.PassOutInstantly missing"); Need(FeatureCapability.Eliminate, typeof(Character).GetMethod("RPCA_Die") != null, "Character.RPCA_Die missing"); Need(FeatureCapability.StatusEffects, typeof(CharacterAfflictions).GetMethod("AddStatus") != null, "CharacterAfflictions.AddStatus missing"); Need(FeatureCapability.HungerAmplifier, ReflectionHelpers.Method(typeof(CharacterAfflictions), "UpdateNormalStatuses", Type.EmptyTypes) != null && ReflectionHelpers.HasField(typeof(CharacterAfflictions), "hungerPerSecond"), "native hunger update or hungerPerSecond field missing"); Need(FeatureCapability.DropHeldItem, ReflectionHelpers.Method(typeof(CharacterItems), "DropItemFromSlotRPC", new Type[2] { typeof(byte), typeof(Vector3) }) != null, "native held-slot drop RPC missing"); Need(FeatureCapability.GiveItem, ReflectionHelpers.HasMethod(typeof(CharacterItems), "SpawnItemInHand", typeof(string)), "CharacterItems.SpawnItemInHand missing"); Need(FeatureCapability.SkyLaunch, typeof(Character).GetMethod("WarpPlayerRPC") != null && Available(FeatureCapability.Ragdoll), "native warp/ragdoll RPC paths missing"); Need(FeatureCapability.HorizonLaunch, typeof(Character).GetMethod("WarpPlayerRPC") != null && Available(FeatureCapability.Ragdoll), "native warp/ragdoll RPC paths missing"); Need(FeatureCapability.DynamiteShower, HasLoaded(typeof(Dynamite)) && typeof(Dynamite).GetMethod("LightFlare") != null, "no loaded Dynamite item prefab or fuse API"); Need(FeatureCapability.ItemStorm, HasLoaded(typeof(Item)) && typeof(Item).GetMethod("SetKinematicNetworked") != null, "no loaded network item prefab or physics API"); Need(FeatureCapability.WrongMountain, Available(FeatureCapability.Teleport) && Available(FeatureCapability.Ragdoll) && Available(FeatureCapability.GiveItem), "native warp, ragdoll, or item RPC path missing"); Need(FeatureCapability.CosmeticUnlocks, typeof(CustomizationOption).GetProperty("IsLocked") != null, "CustomizationOption.IsLocked missing"); Need(FeatureCapability.BadgeUnlocks, typeof(BadgeData).GetProperty("IsLocked") != null && typeof(CharacterData).GetMethod("SetBadgeStatus", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic) != null, "badge lock or sash synchronization API missing"); Need(FeatureCapability.PositionRoulette, Available(FeatureCapability.Teleport), "native warp RPC path missing"); Need(FeatureCapability.OneLiveOne, Available(FeatureCapability.DynamiteShower), "networked Dynamite spawning or fuse API missing"); Need(FeatureCapability.ComboBuilder, Available(FeatureCapability.Ragdoll) && Available(FeatureCapability.Knockout) && Available(FeatureCapability.SkyLaunch), "one or more native combo action paths are missing"); Need(FeatureCapability.SummitSaboteur, Available(FeatureCapability.StartEndTeleport) && Available(FeatureCapability.HorizonLaunch) && Available(FeatureCapability.DropHeldItem) && Available(FeatureCapability.MushroomZombieSpawn) && ReflectionHelpers.Method(typeof(CharacterAfflictions), "RPC_ApplyStatusesFromFloatArray", new Type[2] { typeof(float[]), typeof(PhotonMessageInfo) }) != null && typeof(UI_Notifications).GetMethod("AddNotification") != null, "summit reference, native drop/Hunger/launch path, loaded zombie prefab, or notification path missing"); Need(FeatureCapability.MindControl, ReflectionHelpers.Method(typeof(CharacterInput), "Sample", new Type[1] { typeof(bool) }) != null && ReflectionHelpers.Method(typeof(MainCameraMovement), "LateUpdate", Type.EmptyTypes) != null && ReflectionHelpers.HasField(typeof(CharacterInput), "movementInput") && ReflectionHelpers.HasField(typeof(CharacterInput), "lookInput"), "owned CharacterInput sampling or third-person camera update path missing"); Need(FeatureCapability.InfiniteJetpackFuel, ReflectionHelpers.HasField(typeof(JetpackItem), "startingFuel") && typeof(ItemSlot).GetProperty("data") != null && ReflectionHelpers.HasField(typeof(FloatItemData), "Value"), "Jetpack starting fuel or backpack instance-data path missing"); Need(FeatureCapability.BiggerBackpack, ReflectionHelpers.HasField(typeof(BackpackData), "itemSlots") && ReflectionHelpers.Method(typeof(BackpackData), "DeserializeValue", new Type[1] { typeof(BinaryDeserializer) }) != null && ReflectionHelpers.Method(typeof(BackpackWheel), "InitWheel", new Type[3] { typeof(BackpackReference), typeof(int), typeof(BackpackType) }) != null, "variable backpack data or radial-wheel initialization path missing"); Need(FeatureCapability.BackpackProtection, ReflectionHelpers.Method(typeof(Item), "RequestPickup", new Type[1] { typeof(PhotonView) }) != null && ReflectionHelpers.HasField(typeof(Item), "backpackReference") && ReflectionHelpers.HasField(typeof(BackpackReference), "view"), "master pickup or equipped-backpack reference path missing"); Need(FeatureCapability.StartAsSkeleton, ReflectionHelpers.Method(typeof(CharacterData), "SetSkeleton", new Type[1] { typeof(bool) }) != null && typeof(CharacterData).GetProperty("isSkeleton") != null, "native Book of Bones skeleton state path missing"); Need(FeatureCapability.CampfireReset, ReflectionHelpers.Method(typeof(Campfire), "Light_Rpc", new Type[2] { typeof(bool), typeof(float) }) != null && Available(FeatureCapability.StartEndTeleport) && Available(FeatureCapability.Teleport), "campfire ignition or native start-warp path missing"); Need(FeatureCapability.CampfireDeathTrap, ReflectionHelpers.Method(typeof(Campfire), "Light_Rpc", new Type[2] { typeof(bool), typeof(float) }) != null && Available(FeatureCapability.Eliminate), "campfire ignition or native death RPC path missing"); Need(FeatureCapability.HelicopterSuppression, ReflectionHelpers.Method(typeof(PeakHandler), "SummonHelicopter", Type.EmptyTypes) != null && ReflectionHelpers.HasField(typeof(PeakHandler), "summonedHelicopter"), "summit helicopter summon path missing"); Need(FeatureCapability.Mandrake, Available(FeatureCapability.ItemStorm) && HasLoadedItem("Mandrake"), "no loaded network Mandrake item prefab"); Need(FeatureCapability.ScoutmasterSpawn, ReflectionHelpers.HasMethod(typeof(Scoutmaster), "SetCurrentTarget", typeof(Character), typeof(float)), "Scoutmaster.SetCurrentTarget missing"); Need(FeatureCapability.MushroomZombieSpawn, SpawnManager.TryResolveZombiePrefabName(out var _), "verified Mushroom Zombie resource unavailable"); Need(FeatureCapability.LookerSpawn, condition: false, "no verified network prefab path in PEAK 2.4.b"); Need(FeatureCapability.PingPlacement, ReflectionHelpers.HasMethod(typeof(PointPinger), "TryGetPingHit", typeof(RaycastHit).MakeByRefType(), typeof(Vector3)), "PointPinger.TryGetPingHit missing"); Need(FeatureCapability.PhantomPings, ReflectionHelpers.HasMethod(typeof(PointPinger), "ReceivePoint_Rpc", typeof(Vector3), typeof(Vector3)) && ReflectionHelpers.HasField(typeof(PointPinger), "character"), "PointPinger.ReceivePoint_Rpc or character reference missing"); Need(FeatureCapability.MirageScout, condition: true, ""); Need(FeatureCapability.MirageLuggage, HasLoaded(typeof(Luggage)), "no loaded Luggage visual source"); Need(FeatureCapability.MirageStatue, HasLoaded(typeof(ScoutStatue)), "no loaded ScoutStatue visual source"); Need(FeatureCapability.MirageCapybara, HasLoaded(typeof(Capybara)), "no loaded Capybara visual source"); Need(FeatureCapability.FakeEnemyScoutmaster, HasLoaded(typeof(Scoutmaster)), "no loaded Scoutmaster visual source"); Need(FeatureCapability.FakeEnemyZombie, HasLoaded(typeof(MushroomZombie)), "no loaded MushroomZombie visual source"); Need(FeatureCapability.FakeEnemyLooker, HasLoaded(typeof(Looker)), "no loaded Looker visual source"); Need(FeatureCapability.FakeAudio, condition: true, ""); Need(FeatureCapability.ZombieTargeting, ReflectionHelpers.HasMethod(typeof(MushroomZombie), "SetCurrentTarget", typeof(Character), typeof(float)), "MushroomZombie.SetCurrentTarget missing"); Need(FeatureCapability.AppearanceSwap, ReflectionHelpers.HasMethod(typeof(CharacterCustomization), "OnPlayerDataChange", typeof(PersistentPlayerData)), "CharacterCustomization.OnPlayerDataChange missing"); Need(FeatureCapability.VoiceSwap, condition: false, "voice routing ownership and group mutation are not safely exposed"); Need(FeatureCapability.IncomingVoiceMute, ReflectionHelpers.HasField(typeof(CharacterVoiceHandler), "k__BackingField") || ReflectionHelpers.HasField(typeof(CharacterVoiceHandler), "m_source"), "Character voice AudioSource missing"); Need(FeatureCapability.TalkWhileKnockedOut, condition: false, "no supported voice privilege hook verified"); Need(FeatureCapability.PoisonCloud, condition: false, "no verified network hazard prefab path"); Need(FeatureCapability.SporeCloud, condition: false, "no verified network hazard prefab path"); if (!_discovered || dictionary.Count != _unavailable.Count) { _log.LogInfo((object)("Capability discovery complete: " + (Enum.GetValues(typeof(FeatureCapability)).Length - _unavailable.Count) + " available, " + _unavailable.Count + " unavailable.")); } if (!_discovered) { foreach (KeyValuePair item in _unavailable) { _log.LogWarning((object)string.Concat("Capability ", item.Key, " disabled: ", item.Value)); } } _discovered = true; } private void Need(FeatureCapability feature, bool condition, string reason) { if (!condition) { _unavailable[feature] = reason; } } private static bool HasLoaded(Type type) { return Resources.FindObjectsOfTypeAll(type).Length > 0; } private static bool HasLoadedItem(string token) { Item[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && (Object)(object)((Component)array[i]).gameObject != (Object)null && ((Object)((Component)array[i]).gameObject).name.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } return false; } public bool Available(FeatureCapability feature) { return !_unavailable.ContainsKey(feature); } public string Reason(FeatureCapability feature) { if (!_unavailable.TryGetValue(feature, out var value)) { return string.Empty; } return value; } public void RefreshDynamic() { Discover(); } } internal sealed class PlayerManager { private readonly ManualLogSource _log; private readonly List _entries = new List(); private float _nextRefresh; public Func ExcludeFromRandom; public IList Entries => _entries.AsReadOnly(); public PlayerEntry Local { get; private set; } public bool IsHost { get { if (PhotonNetwork.InRoom) { return PhotonNetwork.IsMasterClient; } return false; } } public PlayerManager(ManualLogSource log) { _log = log; } public void Tick() { if (!(Time.unscaledTime < _nextRefresh)) { _nextRefresh = Time.unscaledTime + 1f; Refresh(); } } public void Refresh() { _entries.Clear(); Local = null; try { if (!PlayerHandler.Exists) { return; } List allPlayerCharacters = PlayerHandler.GetAllPlayerCharacters(); for (int i = 0; i < allPlayerCharacters.Count; i++) { Character val = allPlayerCharacters[i]; if (!((Object)(object)val == (Object)null) && val.refs != null && !((Object)(object)val.refs.view == (Object)null)) { PlayerEntry playerEntry = new PlayerEntry(); playerEntry.Character = val; playerEntry.ActorNumber = val.refs.view.OwnerActorNr; playerEntry.Name = (string.IsNullOrEmpty(val.characterName) ? ("Player " + playerEntry.ActorNumber) : val.characterName); playerEntry.SteamUserId = (((Object)(object)val.data == (Object)null) ? 0 : val.data.userID); playerEntry.IsLocal = val.IsLocal; _entries.Add(playerEntry); if (playerEntry.IsLocal) { Local = playerEntry; } } } } catch (Exception ex) { _log.LogWarning((object)("Player resolution failed: " + ex.Message)); } } public PlayerEntry Find(int actor) { for (int i = 0; i < _entries.Count; i++) { if (_entries[i].ActorNumber == actor) { return _entries[i]; } } return null; } public PlayerEntry Random(bool excludeSelf) { List list = new List(); for (int i = 0; i < _entries.Count; i++) { if ((!excludeSelf || !_entries[i].IsLocal) && (ExcludeFromRandom == null || !ExcludeFromRandom(_entries[i]))) { list.Add(_entries[i]); } } if (list.Count != 0) { return list[Random.Range(0, list.Count)]; } return null; } } internal sealed class PlayerActions { private sealed class WrongMountainJob { public int FirstActor; public int SecondActor; public Vector3 Direction; public float Strength; public float ExecuteAt; } private sealed class CachedState { public bool HasSpeed; public float Speed; public bool FlightActive; public float FlightSpeed; public readonly Dictionary FlightBodies = new Dictionary(); public readonly Dictionary Renderers = new Dictionary(); public readonly HashSet Statuses = new HashSet(); public readonly Dictionary HostStatusDeltas = new Dictionary(); public bool SkeletonApplied; public float SkeletonApplyGraceUntil; } private sealed class FlightBodyState { public bool UseGravity; public float MaxLinearVelocity; } private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly CapabilityRegistry _capabilities; private readonly AudioManager _audio; private readonly Dictionary _states = new Dictionary(); private readonly List _items = new List(); private readonly List _wrongMountainJobs = new List(); private readonly MethodInfo _addForceAtPosition; private readonly MethodInfo _fall; private readonly MethodInfo _die; private readonly MethodInfo _spawnItem; private readonly MethodInfo _hostApplyStatuses; private readonly MethodInfo _dropItemFromSlot; private readonly FieldInfo _ragdollRigidbodies; public IList Items => _items.AsReadOnly(); public PlayerActions(ManualLogSource log, PlayerManager players, CapabilityRegistry capabilities, AudioManager audio) { _log = log; _players = players; _capabilities = capabilities; _audio = audio; _addForceAtPosition = ReflectionHelpers.Method(typeof(Character), "AddForceAtPosition", new Type[3] { typeof(Vector3), typeof(Vector3), typeof(float) }); _fall = ReflectionHelpers.Method(typeof(Character), "Fall", new Type[2] { typeof(float), typeof(float) }); _die = ReflectionHelpers.Method(typeof(Character), "DieInstantly", Type.EmptyTypes); _spawnItem = ReflectionHelpers.Method(typeof(CharacterItems), "SpawnItemInHand", new Type[1] { typeof(string) }); _hostApplyStatuses = ReflectionHelpers.Method(typeof(CharacterAfflictions), "RPC_ApplyStatusesFromFloatArray", new Type[2] { typeof(float[]), typeof(PhotonMessageInfo) }); _dropItemFromSlot = ReflectionHelpers.Method(typeof(CharacterItems), "DropItemFromSlotRPC", new Type[2] { typeof(byte), typeof(Vector3) }); _ragdollRigidbodies = ReflectionHelpers.Field(typeof(CharacterRagdoll), "rigidbodies"); RefreshItemCatalog(); } private CachedState State(PlayerEntry entry) { if (!_states.TryGetValue(entry.ActorNumber, out var value)) { value = new CachedState(); _states.Add(entry.ActorNumber, value); } return value; } public void RefreshItemCatalog() { Item[] array = Resources.FindObjectsOfTypeAll(); _items.Clear(); HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); foreach (Item val in array) { if (!((Object)(object)val == (Object)null) && !string.IsNullOrEmpty(((Object)val).name) && hashSet.Add(((Object)val).name)) { _items.Add(val); } } _items.Sort((Item a, Item b) => string.Compare(((Object)a).name, ((Object)b).name, StringComparison.OrdinalIgnoreCase)); } public ActionResult RagdollLocal(PlayerEntry target, Vector3 direction, float strength, float seconds) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.Ragdoll)) { return Missing(FeatureCapability.Ragdoll); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } strength = Mathf.Clamp(strength, 1f, 75f); seconds = Mathf.Clamp(seconds, 0.25f, 5f); direction = ((((Vector3)(ref direction)).sqrMagnitude < 0.01f) ? Vector3.up : ((Vector3)(ref direction)).normalized); try { ReflectionHelpers.Invoke(target.Character, _fall, seconds, 0f); ReflectionHelpers.Invoke(target.Character, _addForceAtPosition, direction * strength, target.Character.Center, 4f); return ActionResult.Ok("Ragdolled " + target.Name + " through PEAK's native RPCs; their mod is not required."); } catch (Exception ex) { return Error("Ragdoll", ex); } } public ActionResult RagdollOffMountainLocal(PlayerEntry target, float strength) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.Ragdoll)) { return Missing(FeatureCapability.Ragdoll); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } strength = Mathf.Clamp(strength, 1f, 75f); bool foundDrop; Vector3 val = FindDropDirection(target.Character.Center, out foundDrop); try { ReflectionHelpers.Invoke(target.Character, _fall, 2.5f, 0f); ReflectionHelpers.Invoke(target.Character, _addForceAtPosition, val * strength, target.Character.Center, 4f); return ActionResult.Ok("Ragdolled " + target.Name + (foundDrop ? " toward the steepest nearby drop." : " away from the climb route (no nearby drop was detected).")); } catch (Exception ex) { return Error("Ragdoll off mountain", ex); } } public ActionResult HorizontalRagdollLocal(PlayerEntry target, float strength) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.Ragdoll)) { return Missing(FeatureCapability.Ragdoll); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } strength = Mathf.Clamp(strength, 25f, 150f); Vector3 val = Vector3.zero; if (_players.Local != null && (Object)(object)_players.Local.Character != (Object)null) { val = target.Character.Center - _players.Local.Character.Center; } val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; ((Vector3)(ref val))..ctor(normalized.x, 0f, normalized.y); } Vector3 val2 = ((Vector3)(ref val)).normalized + Vector3.up * 0.06f; val = ((Vector3)(ref val2)).normalized; try { ReflectionHelpers.Invoke(target.Character, _fall, 5f, 0f); ReflectionHelpers.Invoke(target.Character, _addForceAtPosition, val * strength, target.Character.Center, 4f); return ActionResult.Ok("Ragdolled " + target.Name + " horizontally at bounded strength " + strength.ToString("0") + "."); } catch (Exception ex) { return Error("Horizontal ragdoll", ex); } } public ActionResult WrongMountainLocal(PlayerEntry first, PlayerEntry second, float strength) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.WrongMountain)) { return Missing(FeatureCapability.WrongMountain); } if (first == null || second == null || (Object)(object)first.Character == (Object)null || (Object)(object)second.Character == (Object)null) { return ActionResult.Fail("Two available players are required."); } if (first.ActorNumber == second.ActorNumber) { return ActionResult.Fail("Wrong Mountain needs two different players."); } if (first.Character.refs == null || second.Character.refs == null || (Object)(object)first.Character.refs.view == (Object)null || (Object)(object)second.Character.refs.view == (Object)null) { return ActionResult.Fail("A target Photon view is unavailable."); } Vector3 center = first.Character.Center; Vector3 center2 = second.Character.Center; Vector3 direction = center2 - center; direction.y = 0f; if (((Vector3)(ref direction)).sqrMagnitude < 0.01f) { Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 normalized = ((Vector2)(ref insideUnitCircle)).normalized; ((Vector3)(ref direction))..ctor(normalized.x, 0f, normalized.y); } Vector3 val = ((Vector3)(ref direction)).normalized + Vector3.up * 0.08f; direction = ((Vector3)(ref val)).normalized; strength = Mathf.Clamp(strength, 25f, 150f); try { first.Character.refs.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { center2, true }); second.Character.refs.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { center, true }); GiveRandomItem(first); GiveRandomItem(second); _wrongMountainJobs.Add(new WrongMountainJob { FirstActor = first.ActorNumber, SecondActor = second.ActorNumber, Direction = direction, Strength = strength, ExecuteAt = Time.unscaledTime + 0.35f }); return ActionResult.Ok("Swapped " + first.Name + " with " + second.Name + "; opposite ragdoll throws and random hand items are queued."); } catch (Exception ex) { return Error("Wrong Mountain", ex); } } public ActionResult PositionRouletteLocal(IList entries) { //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.PositionRoulette)) { return Missing(FeatureCapability.PositionRoulette); } List list = new List(); Dictionary dictionary = new Dictionary(); if (entries != null) { for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; if (playerEntry != null && !((Object)(object)playerEntry.Character == (Object)null) && playerEntry.Character.refs != null && !((Object)(object)playerEntry.Character.refs.view == (Object)null) && !dictionary.ContainsKey(playerEntry.ActorNumber)) { list.Add(playerEntry); dictionary.Add(playerEntry.ActorNumber, playerEntry.Character.Center); } } } if (list.Count < 2) { return ActionResult.Fail("Position Roulette needs at least two available scouts."); } for (int num = list.Count - 1; num > 0; num--) { int index = Random.Range(0, num + 1); PlayerEntry value = list[num]; list[num] = list[index]; list[index] = value; } try { for (int j = 0; j < list.Count; j++) { PlayerEntry playerEntry2 = list[(j + 1) % list.Count]; list[j].Character.refs.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { dictionary[playerEntry2.ActorNumber], true }); } return ActionResult.Ok("Rotated " + list.Count + " scouts through a randomized no-fixed-point position roulette."); } catch (Exception ex) { return Error("Position Roulette", ex); } } private void GiveRandomItem(PlayerEntry target) { if (_items.Count != 0 && target != null && !((Object)(object)target.Character == (Object)null) && target.Character.refs != null && !((Object)(object)target.Character.refs.items == (Object)null)) { Item val = _items[Random.Range(0, _items.Count)]; if ((Object)(object)val != (Object)null && !string.IsNullOrEmpty(((Object)val).name)) { ReflectionHelpers.Invoke(target.Character.refs.items, _spawnItem, ((Object)val).name); } } } public void Tick() { //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair state in _states) { CachedState value = state.Value; if (value.SkeletonApplied && !(Time.unscaledTime < value.SkeletonApplyGraceUntil)) { PlayerEntry playerEntry = _players.Find(state.Key); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null || (Object)(object)playerEntry.Character.data == (Object)null || !playerEntry.Character.data.isSkeleton) { value.SkeletonApplied = false; } } } for (int num = _wrongMountainJobs.Count - 1; num >= 0; num--) { WrongMountainJob wrongMountainJob = _wrongMountainJobs[num]; if (!(Time.unscaledTime < wrongMountainJob.ExecuteAt)) { _wrongMountainJobs.RemoveAt(num); PlayerEntry playerEntry2 = _players.Find(wrongMountainJob.FirstActor); PlayerEntry playerEntry3 = _players.Find(wrongMountainJob.SecondActor); if (playerEntry2 != null && playerEntry3 != null && !((Object)(object)playerEntry2.Character == (Object)null) && !((Object)(object)playerEntry3.Character == (Object)null)) { try { ReflectionHelpers.Invoke(playerEntry2.Character, _fall, 5f, 0f); ReflectionHelpers.Invoke(playerEntry3.Character, _fall, 5f, 0f); ReflectionHelpers.Invoke(playerEntry2.Character, _addForceAtPosition, wrongMountainJob.Direction * wrongMountainJob.Strength, playerEntry2.Character.Center, 4f); ReflectionHelpers.Invoke(playerEntry3.Character, _addForceAtPosition, -wrongMountainJob.Direction * wrongMountainJob.Strength, playerEntry3.Character.Center, 4f); } catch (Exception ex) { _log.LogWarning((object)("Delayed Wrong Mountain throw failed safely: " + ex.Message)); } } } } } public void FixedTick() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair state in _states) { CachedState value = state.Value; if (!value.FlightActive) { continue; } PlayerEntry playerEntry = _players.Find(state.Key); if (playerEntry == null || !playerEntry.IsLocal || (Object)(object)playerEntry.Character == (Object)null || (Object)(object)playerEntry.Character.data == (Object)null || playerEntry.Character.data.dead) { RestoreFlight(value); continue; } Vector3 val = Vector3.zero; TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance == (Object)null || instance.Ui == null || !instance.Ui.IsTyping) { Vector3 lookDirection_Flat = playerEntry.Character.data.lookDirection_Flat; lookDirection_Flat.y = 0f; Vector3 lookDirection_Right = playerEntry.Character.data.lookDirection_Right; lookDirection_Right.y = 0f; if (((Vector3)(ref lookDirection_Flat)).sqrMagnitude > 0.01f) { ((Vector3)(ref lookDirection_Flat)).Normalize(); } if (((Vector3)(ref lookDirection_Right)).sqrMagnitude > 0.01f) { ((Vector3)(ref lookDirection_Right)).Normalize(); } float num = ((Input.GetKey((KeyCode)119) || Input.GetKey((KeyCode)273)) ? 1f : 0f) - ((Input.GetKey((KeyCode)115) || Input.GetKey((KeyCode)274)) ? 1f : 0f); float num2 = ((Input.GetKey((KeyCode)100) || Input.GetKey((KeyCode)275)) ? 1f : 0f) - ((Input.GetKey((KeyCode)97) || Input.GetKey((KeyCode)276)) ? 1f : 0f); float num3 = (Input.GetKey((KeyCode)32) ? 1f : 0f) - ((Input.GetKey((KeyCode)306) || Input.GetKey((KeyCode)305)) ? 1f : 0f); val = lookDirection_Flat * num + lookDirection_Right * num2 + Vector3.up * num3; if (((Vector3)(ref val)).sqrMagnitude > 1f) { ((Vector3)(ref val)).Normalize(); } } float num4 = ((Input.GetKey((KeyCode)304) || Input.GetKey((KeyCode)303)) ? 1.75f : 1f); Vector3 linearVelocity = val * value.FlightSpeed * num4; foreach (KeyValuePair flightBody in value.FlightBodies) { if (!((Object)(object)flightBody.Key == (Object)null)) { flightBody.Key.useGravity = false; flightBody.Key.maxLinearVelocity = Mathf.Max(flightBody.Key.maxLinearVelocity, value.FlightSpeed * 2f); flightBody.Key.linearVelocity = linearVelocity; } } } } private Vector3 FindDropDirection(Vector3 origin, out bool foundDrop) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) TryGroundHeight(origin, 14f, out var height); float num = float.MinValue; Vector3 val = Vector3.zero; Vector3 val2 = default(Vector3); for (int i = 0; i < 24; i++) { float num2 = (float)i * (float)Math.PI * 2f / 24f; ((Vector3)(ref val2))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); float num3 = 0f; bool flag = false; for (int j = 1; j <= 4; j++) { float num4 = (float)j * 3f; if (!TryGroundHeight(origin + val2 * num4, 28f, out var height2)) { num3 += 80f + (float)(5 - j) * 12f; flag = true; break; } float num5 = height - height2; num3 = ((!(num5 > 0f)) ? (num3 + num5 * 0.5f) : (num3 + num5 * (6f - (float)j))); } if (flag) { num3 += 20f; } if (num3 > num) { num = num3; val = val2; } } foundDrop = num >= 18f && ((Vector3)(ref val)).sqrMagnitude > 0.01f; if (!foundDrop) { val = DirectionAwayFromRoute(origin); } Vector3 val3 = ((Vector3)(ref val)).normalized + Vector3.up * 0.22f; return ((Vector3)(ref val3)).normalized; } private static bool TryGroundHeight(Vector3 position, float depth, out float height) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 4f, Vector3.down, ref val, depth, -5, (QueryTriggerInteraction)1)) { height = ((RaycastHit)(ref val)).point.y; return true; } height = position.y - depth; return false; } private Vector3 DirectionAwayFromRoute(Vector3 origin) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; int num = 0; MapHandler val2 = Object.FindFirstObjectByType(); if ((Object)(object)val2 != (Object)null && val2.segments != null) { for (int i = 0; i < val2.segments.Length; i++) { MapSegment val3 = val2.segments[i]; if (val3 != null && !((Object)(object)val3.reconnectSpawnPos == (Object)null)) { val += val3.reconnectSpawnPos.position; num++; } } } val = ((num > 0) ? (val / (float)num) : ((_players.Local == null || !((Object)(object)_players.Local.Character != (Object)null)) ? (origin - Vector3.forward) : _players.Local.Character.Center)); Vector3 val4 = origin - val; val4.y = 0f; if (!(((Vector3)(ref val4)).sqrMagnitude > 0.01f)) { return Vector3.forward; } return ((Vector3)(ref val4)).normalized; } public ActionResult LaunchLocal(PlayerEntry target, Vector3 direction, float strength, bool ragdoll) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00c4: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.Launch)) { return Missing(FeatureCapability.Launch); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } strength = Mathf.Clamp(strength, 5f, 120f); direction = ((((Vector3)(ref direction)).sqrMagnitude < 0.01f) ? Vector3.up : ((Vector3)(ref direction)).normalized); try { if (ragdoll) { ReflectionHelpers.Invoke(target.Character, _fall, 1.5f, 0f); } ReflectionHelpers.Invoke(target.Character, _addForceAtPosition, direction * strength, target.Character.Center, 4f); return ActionResult.Ok("Launched " + target.Name + " through PEAK's native force RPC; no host or target mod required."); } catch (Exception ex) { return Error("Launch", ex); } } public ActionResult SkyLaunchLocal(PlayerEntry target, float height) { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.SkyLaunch)) { return Missing(FeatureCapability.SkyLaunch); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.view == (Object)null) { return ActionResult.Fail("Target view unavailable."); } height = Mathf.Clamp(height, 25f, 300f); Vector3 val = target.Character.Center + Vector3.up * height; try { ReflectionHelpers.Invoke(target.Character, _fall, 5f, 0f); ReflectionHelpers.Invoke(target.Character, _addForceAtPosition, Vector3.up * 18f, target.Character.Center, 4f); target.Character.refs.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); return ActionResult.Ok("Sent " + target.Name + " " + height.ToString("0") + "m into the sky through PEAK's native RPCs."); } catch (Exception ex) { return Error("Sky launch", ex); } } public ActionResult HorizonLaunchLocal(PlayerEntry target, float distance) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.HorizonLaunch)) { return Missing(FeatureCapability.HorizonLaunch); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.view == (Object)null) { return ActionResult.Fail("Target view unavailable."); } distance = Mathf.Clamp(distance, 25f, 300f); Vector3 val = DirectionAwayFromRoute(target.Character.Center); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.forward; } ((Vector3)(ref val)).Normalize(); if (!TryClearHorizonDestination(target.Character.Center + val * distance, out var destination)) { return ActionResult.Fail("No clear endpoint was found in the outward direction."); } try { ReflectionHelpers.Invoke(target.Character, _fall, 6f, 0f); Character character = target.Character; MethodInfo addForceAtPosition = _addForceAtPosition; object[] array = new object[3]; Vector3 val2 = val + Vector3.up * 0.08f; array[0] = ((Vector3)(ref val2)).normalized * 24f; array[1] = target.Character.Center; array[2] = 4f; ReflectionHelpers.Invoke(character, addForceAtPosition, array); target.Character.refs.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { destination, true }); return ActionResult.Ok("Sent " + target.Name + " " + distance.ToString("0") + "m toward the far horizon through PEAK's native RPCs."); } catch (Exception ex) { return Error("Far Horizon", ex); } } private static bool TryClearHorizonDestination(Vector3 desired, out Vector3 destination) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0035: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 9; i++) { Vector3 val = desired + Vector3.up * (8f + (float)i * 5f); if (!Physics.CheckSphere(val, 0.8f, -5, (QueryTriggerInteraction)1)) { destination = val; return true; } } destination = Vector3.zero; return false; } public ActionResult SetSpeedLocal(PlayerEntry target, float multiplier) { if (!_capabilities.Available(FeatureCapability.Speed)) { return Missing(FeatureCapability.Speed); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.movement == (Object)null) { return ActionResult.Fail("Movement component unavailable."); } CachedState cachedState = State(target); if (!cachedState.HasSpeed) { cachedState.Speed = target.Character.refs.movement.movementModifier; cachedState.HasSpeed = true; } target.Character.refs.movement.movementModifier = Mathf.Clamp(multiplier, 0.25f, 3f); return ActionResult.Ok("Speed set to " + multiplier.ToString("0.00") + "x."); } public ActionResult SetFlightLocal(PlayerEntry target, bool enabled, float speed) { if (!_capabilities.Available(FeatureCapability.Flight)) { return Missing(FeatureCapability.Flight); } if (target == null || !target.IsLocal || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.ragdoll == (Object)null || _ragdollRigidbodies == null) { return ActionResult.Fail("Flight requires the selected player's compatible owner client."); } CachedState cachedState = State(target); if (!enabled) { RestoreFlight(cachedState); return ActionResult.Ok("Flight disabled for " + target.Name + "."); } speed = Mathf.Clamp(speed, 4f, 20f); if (!(_ragdollRigidbodies.GetValue(target.Character.refs.ragdoll) is IList list)) { return ActionResult.Fail("No character rigidbody registry was available for flight."); } for (int i = 0; i < list.Count; i++) { Rigidbody val = list[i]; if (!((Object)(object)val == (Object)null)) { if (!cachedState.FlightBodies.ContainsKey(val)) { cachedState.FlightBodies.Add(val, new FlightBodyState { UseGravity = val.useGravity, MaxLinearVelocity = val.maxLinearVelocity }); } val.useGravity = false; val.maxLinearVelocity = Mathf.Max(val.maxLinearVelocity, speed * 2f); } } if (cachedState.FlightBodies.Count == 0) { return ActionResult.Fail("No character rigidbodies were available for flight."); } cachedState.FlightSpeed = speed; cachedState.FlightActive = true; return ActionResult.Ok("Flight enabled for " + target.Name + " at " + speed.ToString("0") + " m/s. Close F7, then use WASD, Space/Ctrl, and Shift."); } public ActionResult StopFlightLocal(PlayerEntry target) { if (target == null) { return ActionResult.Fail("Local player unavailable."); } if (!_states.TryGetValue(target.ActorNumber, out var value) || !value.FlightActive) { return ActionResult.Ok("Flight was already disabled."); } RestoreFlight(value); return ActionResult.Ok("Flight disabled and its cached physics restored."); } private static void RestoreFlight(CachedState state) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (state == null) { return; } foreach (KeyValuePair flightBody in state.FlightBodies) { if (!((Object)(object)flightBody.Key == (Object)null)) { flightBody.Key.linearVelocity = Vector3.zero; flightBody.Key.useGravity = flightBody.Value.UseGravity; flightBody.Key.maxLinearVelocity = flightBody.Value.MaxLinearVelocity; } } state.FlightBodies.Clear(); state.FlightActive = false; } public ActionResult SetVisibilityLocal(PlayerEntry target, bool visible) { if (!_capabilities.Available(FeatureCapability.Visibility)) { return Missing(FeatureCapability.Visibility); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } CachedState cachedState = State(target); Renderer[] componentsInChildren = ((Component)target.Character).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!cachedState.Renderers.ContainsKey(val)) { cachedState.Renderers.Add(val, val.enabled); } val.enabled = visible; } return ActionResult.Ok(visible ? "Visibility restored." : "Target hidden on compatible clients."); } public ActionResult TeleportLocal(PlayerEntry target, Vector3 position) { //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.Teleport)) { return Missing(FeatureCapability.Teleport); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.view == (Object)null) { return ActionResult.Fail("Target view unavailable."); } if (!TrySafePosition(position, out var safe)) { return ActionResult.Fail("No safe ground near destination."); } try { target.Character.refs.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { safe, true }); return ActionResult.Ok("Teleported " + target.Name + "."); } catch (Exception ex) { return Error("Teleport", ex); } } public bool TryGetStartEnd(bool end, out Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0067: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; MapHandler val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null || val.segments == null || val.segments.Length == 0) { return false; } int num = (end ? (val.segments.Length - 1) : 0); MapSegment val2 = val.segments[num]; if (val2 == null || (Object)(object)val2.reconnectSpawnPos == (Object)null) { return false; } position = val2.reconnectSpawnPos.position; return true; } public bool TryGetCheckpointPosition(out Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) position = Vector3.zero; MapHandler val = Object.FindFirstObjectByType(); if ((Object)(object)val == (Object)null || (Object)(object)MapHandler.CurrentBaseCampSpawnPoint == (Object)null) { return false; } return TrySafePosition(MapHandler.CurrentBaseCampSpawnPoint.position, out position); } public ActionResult KnockoutLocal(PlayerEntry target) { if (!_capabilities.Available(FeatureCapability.Knockout)) { return Missing(FeatureCapability.Knockout); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } try { target.Character.PassOutInstantly(); return ActionResult.Ok("Knocked out " + target.Name + " through PEAK's native RPC; no host or target mod required."); } catch (Exception ex) { return Error("Knockout", ex); } } public ActionResult EliminateLocal(PlayerEntry target) { if (!_capabilities.Available(FeatureCapability.Eliminate)) { return Missing(FeatureCapability.Eliminate); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.view == (Object)null) { return ActionResult.Fail("Target view unavailable."); } try { target.Character.refs.view.RPC("RPCA_Die", (RpcTarget)0, new object[0]); return ActionResult.Ok("Eliminated " + target.Name + " through PEAK's native death RPC; no host or target mod required."); } catch (Exception ex) { return Error("Eliminate", ex); } } public ActionResult SetSkeletonState(PlayerEntry target, bool skeleton) { if (!_capabilities.Available(FeatureCapability.StartAsSkeleton)) { return Missing(FeatureCapability.StartAsSkeleton); } if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.data == (Object)null) { return ActionResult.Fail("Target skeleton state is unavailable."); } if (skeleton && (target.Character.data.dead || target.Character.data.fullyPassedOut)) { return ActionResult.Fail(target.Name + " must be alive before becoming a skeleton."); } if (!skeleton) { if (!_states.TryGetValue(target.ActorNumber, out var value) || !value.SkeletonApplied) { return ActionResult.Fail("No menu-applied skeleton transformation is tracked for " + target.Name + "."); } try { target.Character.data.SetSkeleton(false); value.SkeletonApplied = false; return ActionResult.Ok("Restored " + target.Name + " through PEAK's native skeleton RPC."); } catch (Exception ex) { return Error("Restore skeleton", ex); } } if (target.Character.data.isSkeleton) { return ActionResult.Ok(target.Name + " is already a skeleton; their existing state was left unchanged."); } try { target.Character.data.SetSkeleton(true); CachedState value = State(target); value.SkeletonApplied = true; value.SkeletonApplyGraceUntil = Time.unscaledTime + 2f; return ActionResult.Ok("Made " + target.Name + " a skeleton through PEAK's native Book of Bones state; no host or target mod required."); } catch (Exception ex2) { return Error("Make skeleton", ex2); } } public ActionResult ApplyStatusLocal(PlayerEntry target, int statusIndex, float amount) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.StatusEffects)) { return Missing(FeatureCapability.StatusEffects); } if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.refs.afflictions == (Object)null) { return ActionResult.Fail("Affliction component unavailable."); } STATUSTYPE val = (STATUSTYPE)Mathf.Clamp(statusIndex, 0, 14); amount = Mathf.Clamp(amount, 0f, 2f); try { bool flag = target.Character.refs.afflictions.AddStatus(val, amount, false, true, true, false); if (flag) { State(target).Statuses.Add(val); } return flag ? ActionResult.Ok(string.Concat("Applied ", val, ".")) : ActionResult.Fail("The game rejected that status."); } catch (Exception ex) { return Error("Status", ex); } } public ActionResult ApplyStatusAsHost(PlayerEntry target, int statusIndex, float amount) { //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) if (!_players.IsHost) { return ActionResult.Fail("PEAK accepts this native status RPC only from the host."); } if (_hostApplyStatuses == null) { return ActionResult.Fail("PEAK's host status RPC is unavailable in this game build."); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.afflictions == (Object)null || (Object)(object)target.Character.refs.view == (Object)null || target.Character.refs.view.Owner == null) { return ActionResult.Fail("Target afflictions/view unavailable."); } statusIndex = Mathf.Clamp(statusIndex, 0, 14); if (statusIndex == 7 || statusIndex == 9 || statusIndex == 12) { return ActionResult.Fail("PEAK's host status RPC excludes this status; a compatible target client is required."); } STATUSTYPE val = (STATUSTYPE)statusIndex; amount = Mathf.Clamp(amount, 0.01f, 2f); try { CharacterAfflictions afflictions = target.Character.refs.afflictions; float num = Mathf.Max(0f, afflictions.GetStatusCap(val) - afflictions.GetCurrentStatus(val) - afflictions.GetIncrementalStatus(val)); float num2 = Mathf.Min(new float[3] { amount, num, Mathf.Max(0f, 2f - afflictions.statusSum) }); if (num2 <= 0f) { return ActionResult.Fail("That status is already at PEAK's applicable cap."); } float[] array = new float[15]; array[statusIndex] = num2; target.Character.refs.view.RPC("RPC_ApplyStatusesFromFloatArray", target.Character.refs.view.Owner, new object[1] { array }); CachedState cachedState = State(target); cachedState.HostStatusDeltas.TryGetValue(val, out var value); cachedState.HostStatusDeltas[val] = value + num2; return ActionResult.Ok(string.Concat("Host applied ", val, " through PEAK's native validated status RPC; target mod not required.")); } catch (Exception ex) { return Error("Host status", ex); } } public ActionResult ClearHostStatuses(PlayerEntry target) { //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (!_players.IsHost) { return ActionResult.Fail("Only the host can clear host-applied native statuses."); } if (_hostApplyStatuses == null) { return ActionResult.Fail("PEAK's host status RPC is unavailable in this game build."); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.view == (Object)null || target.Character.refs.view.Owner == null) { return ActionResult.Fail("Target view unavailable."); } CachedState cachedState = State(target); if (cachedState.HostStatusDeltas.Count == 0) { return ActionResult.Ok("No host-applied troll statuses were tracked for " + target.Name + "."); } try { float[] array = new float[15]; foreach (KeyValuePair hostStatusDelta in cachedState.HostStatusDeltas) { array[hostStatusDelta.Key] = 0f - Mathf.Max(0f, hostStatusDelta.Value); } target.Character.refs.view.RPC("RPC_ApplyStatusesFromFloatArray", target.Character.refs.view.Owner, new object[1] { array }); cachedState.HostStatusDeltas.Clear(); return ActionResult.Ok("Cleared tracked host-applied statuses through PEAK's native RPC."); } catch (Exception ex) { return Error("Host status cleanup", ex); } } public ActionResult ClearModStatusesLocal(PlayerEntry target) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.refs.afflictions == (Object)null) { return ActionResult.Fail("Affliction component unavailable."); } CachedState cachedState = State(target); foreach (STATUSTYPE status in cachedState.Statuses) { target.Character.refs.afflictions.SetStatus(status, 0f, true); } cachedState.Statuses.Clear(); return ActionResult.Ok("Cleared mod-applied statuses."); } public ActionResult GiveItemLocal(PlayerEntry target, string itemName) { if (!_capabilities.Available(FeatureCapability.GiveItem)) { return Missing(FeatureCapability.GiveItem); } if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.refs.items == (Object)null || string.IsNullOrEmpty(itemName)) { return ActionResult.Fail("Item or target unavailable."); } Item val = null; for (int i = 0; i < _items.Count; i++) { if (string.Equals(((Object)_items[i]).name, itemName, StringComparison.OrdinalIgnoreCase)) { val = _items[i]; break; } } if ((Object)(object)val == (Object)null) { return ActionResult.Fail("Item is not in the runtime catalog."); } try { ReflectionHelpers.Invoke(target.Character.refs.items, _spawnItem, ((Object)val).name); return ActionResult.Ok("Requested " + ((Object)val).name + " in " + target.Name + "'s hands."); } catch (Exception ex) { return Error("Give item", ex); } } public ActionResult DropHeldItemLocal(PlayerEntry target) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.DropHeldItem)) { return Missing(FeatureCapability.DropHeldItem); } if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.data == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.items == (Object)null || (Object)(object)((MonoBehaviourPun)target.Character.refs.items).photonView == (Object)null) { return ActionResult.Fail("Target item state is unavailable."); } if ((Object)(object)target.Character.data.currentItem == (Object)null || !target.Character.refs.items.currentSelectedSlot.IsSome) { return ActionResult.Fail(target.Name + " is not holding a droppable slot item."); } try { byte value = target.Character.refs.items.currentSelectedSlot.Value; Vector3 value2 = target.Character.data.lookDirection_Flat; if (!Finite(value2) || ((Vector3)(ref value2)).sqrMagnitude < 0.01f) { value2 = Vector3.forward; } Vector3 val = target.Character.Center + ((Vector3)(ref value2)).normalized * 1.2f + Vector3.up * 0.3f; ((MonoBehaviourPun)target.Character.refs.items).photonView.RPC(_dropItemFromSlot.Name, (RpcTarget)0, new object[2] { value, val }); return ActionResult.Ok("Dropped " + target.Name + "'s held slot item through PEAK's native RPC."); } catch (Exception ex) { return Error("Drop held item", ex); } } public ActionResult ResurrectAtLastLivingPosition(PlayerEntry target) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } Vector3 val = target.Character.LastLivingPosition; if (!Finite(val) || ((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = target.Character.Center; } return ResurrectLocal(target, val, applyPostReviveStatus: false); } public ActionResult ResurrectNearPlayer(PlayerEntry target, PlayerEntry anchor) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) if (anchor == null || (Object)(object)anchor.Character == (Object)null) { return ActionResult.Fail("No living player is available to join."); } Vector3 value = (((Object)(object)anchor.Character.data == (Object)null) ? Vector3.right : anchor.Character.data.lookDirection_Right); value.y = 0f; if (!Finite(value) || ((Vector3)(ref value)).sqrMagnitude < 0.01f) { value = Vector3.right; } return ResurrectLocal(target, anchor.Character.Center + ((Vector3)(ref value)).normalized * 1.5f, applyPostReviveStatus: false); } public ActionResult ResurrectLocal(PlayerEntry target, Vector3 desiredPosition, bool applyPostReviveStatus) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.Resurrect)) { return Missing(FeatureCapability.Resurrect); } if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.data == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.view == (Object)null) { return ActionResult.Fail("Target revive view unavailable."); } if (!target.Character.data.dead && !target.Character.data.fullyPassedOut) { return ActionResult.Fail(target.Name + " is already alive."); } if (!Finite(desiredPosition)) { return ActionResult.Fail("Revive destination is invalid."); } if (!TrySafePosition(desiredPosition, out var safe)) { return ActionResult.Fail("No safe ground was found near the revive destination."); } try { target.Character.refs.view.RPC("RPCA_ReviveAtPosition", (RpcTarget)0, new object[3] { safe, applyPostReviveStatus, -1 }); return ActionResult.Ok("Resurrected " + target.Name + " through PEAK's native synchronized revive; host and target mod are not required."); } catch (Exception ex) { return Error("Resurrect", ex); } } public ActionResult HaltVelocityLocal(PlayerEntry target) { if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.ragdoll == (Object)null) { return ActionResult.Fail("Local ragdoll unavailable."); } try { target.Character.refs.ragdoll.HaltBodyVelocity(true); target.Character.data.fallSeconds = 0f; return ActionResult.Ok("Stopped local character velocity and reset fall damage buildup."); } catch (Exception ex) { return Error("Stabilize player", ex); } } public ActionResult ResetLocal(PlayerEntry target) { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Target unavailable."); } if (!_states.TryGetValue(target.ActorNumber, out var value)) { return ActionResult.Ok("No reversible troll state was cached."); } RestoreFlight(value); if (value.HasSpeed && target.Character.refs != null && (Object)(object)target.Character.refs.movement != (Object)null) { target.Character.refs.movement.movementModifier = value.Speed; } foreach (KeyValuePair renderer in value.Renderers) { if ((Object)(object)renderer.Key != (Object)null) { renderer.Key.enabled = renderer.Value; } } if (target.Character.refs != null && (Object)(object)target.Character.refs.afflictions != (Object)null) { foreach (STATUSTYPE status in value.Statuses) { target.Character.refs.afflictions.SetStatus(status, 0f, true); } } if (_players.IsHost && value.HostStatusDeltas.Count > 0) { ClearHostStatuses(target); } if (value.SkeletonApplied && (Object)(object)target.Character.data != (Object)null) { try { target.Character.data.SetSkeleton(false); } catch (Exception ex) { _log.LogWarning((object)("Tracked skeleton cleanup failed safely: " + ex.Message)); } } value.SkeletonApplied = false; _states.Remove(target.ActorNumber); return ActionResult.Ok("Restored reversible changes for " + target.Name + "."); } public void ResetKnownPlayers() { _wrongMountainJobs.Clear(); List list = new List(_players.Entries); for (int i = 0; i < list.Count; i++) { ResetLocal(list[i]); } _states.Clear(); } internal static bool TrySafePosition(Vector3 desired, out Vector3 safe) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) safe = desired; Vector3 val = desired + Vector3.up * 2f; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(val, Vector3.down, ref val2, 8f, -5, (QueryTriggerInteraction)1)) { safe = ((RaycastHit)(ref val2)).point + Vector3.up * 1.1f; if (Physics.CheckSphere(safe, 0.35f, -5, (QueryTriggerInteraction)1)) { safe += Vector3.up * 1.25f; } return !Physics.CheckSphere(safe, 0.35f, -5, (QueryTriggerInteraction)1); } return false; } internal static bool Finite(Vector3 value) { if (!float.IsNaN(value.x) && !float.IsInfinity(value.x) && !float.IsNaN(value.y) && !float.IsInfinity(value.y) && !float.IsNaN(value.z)) { return !float.IsInfinity(value.z); } return false; } private ActionResult Missing(FeatureCapability capability) { return ActionResult.Fail(string.Concat(capability, " unsupported: ", _capabilities.Reason(capability))); } private ActionResult Error(string action, Exception ex) { _log.LogWarning((object)(action + " failed: " + ex)); return ActionResult.Fail(action + " failed safely: " + ex.Message); } } internal sealed class NoWaitManager { private const float JoinWindowSeconds = 90f; private const float ReviveQueueInterval = 1.5f; private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private readonly CapabilityRegistry _capabilities; private readonly ModConfig _settings; private readonly List _reviveQueue = new List(); private bool _wasInRoom; private bool _recentRoomJoin; private float _roomJoinedAt; private float _nextAttempt; private float _nextQueuedRevive; private Character _trackedLocalCharacter; private CharacterItems _suppressedDropItems; private float _suppressDropUntil; private bool _restorePending; private ReconnectData _restoreData; private Character _restoreCharacter; private Character _settleCharacter; private float _restoreAt; private float _settleUntil; public bool Enabled { get { return _settings.NoWaitEnabled.Value; } set { _settings.NoWaitEnabled.Value = value; } } public NoWaitDestination Destination { get { return _settings.NoWaitDestinationMode.Value; } set { _settings.NoWaitDestinationMode.Value = value; } } public bool PreserveReconnectState { get { return _settings.NoWaitPreserveReconnectState.Value; } set { _settings.NoWaitPreserveReconnectState.Value = value; } } public NoWaitManager(ManualLogSource log, PlayerManager players, PlayerActions actions, CapabilityRegistry capabilities, ModConfig settings) { _log = log; _players = players; _actions = actions; _capabilities = capabilities; _settings = settings; _wasInRoom = PhotonNetwork.InRoom; _recentRoomJoin = _wasInRoom; _roomJoinedAt = Time.unscaledTime; } public void Tick() { //IL_01d1: Unknown result type (might be due to invalid IL or missing references) TickPostRevive(); TickReviveQueue(); bool inRoom = PhotonNetwork.InRoom; if (!_wasInRoom && inRoom) { _recentRoomJoin = true; _roomJoinedAt = Time.unscaledTime; _trackedLocalCharacter = null; } else if (_wasInRoom && !inRoom) { ResetRoomState(); } _wasInRoom = inRoom; if (!inRoom || !Enabled || !_recentRoomJoin || !_capabilities.Available(FeatureCapability.Resurrect)) { return; } if (Time.unscaledTime - _roomJoinedAt > 90f) { _recentRoomJoin = false; return; } PlayerEntry local = _players.Local; if (local == null || (Object)(object)local.Character == (Object)null || (Object)(object)local.Character.data == (Object)null || !local.Character.IsInitialized) { return; } if ((Object)(object)_trackedLocalCharacter != (Object)(object)local.Character) { _trackedLocalCharacter = local.Character; _nextAttempt = 0f; } if (local.Character.inAirport || !GameHandler.IsOnIsland) { if (local.Character.inAirport) { _recentRoomJoin = false; } } else if (!local.Character.data.dead && !local.Character.data.fullyPassedOut) { if (Time.unscaledTime - _roomJoinedAt > 15f) { _recentRoomJoin = false; } } else { if (Time.unscaledTime < _nextAttempt) { return; } _nextAttempt = Time.unscaledTime + 1f; if (TryResolveDestination(local, out var destination, out var name)) { if (PreserveReconnectState && local.Character.refs != null && (Object)(object)local.Character.refs.items != (Object)null) { BeginReconnectPreservation(local.Character); } ActionResult actionResult = _actions.ResurrectLocal(local, destination, applyPostReviveStatus: false); if (!actionResult.Success) { CancelReconnectPreservation(); _log.LogWarning((object)("No Wait revive attempt failed: " + actionResult.Message)); return; } _actions.HaltVelocityLocal(local); _settleCharacter = local.Character; _settleUntil = Time.unscaledTime + 1f; _recentRoomJoin = false; _log.LogInfo((object)("No Wait joined " + local.Name + " at " + name + ".")); } } } public ActionResult QueueResurrectAll() { _reviveQueue.Clear(); for (int i = 0; i < _players.Entries.Count; i++) { PlayerEntry playerEntry = _players.Entries[i]; if (playerEntry != null && (Object)(object)playerEntry.Character != (Object)null && (Object)(object)playerEntry.Character.data != (Object)null && (playerEntry.Character.data.dead || playerEntry.Character.data.fullyPassedOut)) { _reviveQueue.Add(playerEntry.ActorNumber); } } if (_reviveQueue.Count == 0) { return ActionResult.Fail("No dead or fully passed-out players are available."); } _nextQueuedRevive = 0f; return ActionResult.Ok("Queued " + _reviveQueue.Count + " resurrection" + ((_reviveQueue.Count == 1) ? "." : "s at safe intervals.")); } public bool ShouldSuppressDrop(CharacterItems items) { if ((Object)(object)items != (Object)null && (Object)(object)items == (Object)(object)_suppressedDropItems) { return Time.unscaledTime <= _suppressDropUntil; } return false; } public void OnSceneLoaded() { _trackedLocalCharacter = null; _nextAttempt = 0f; _reviveQueue.Clear(); } private bool TryResolveDestination(PlayerEntry local, out Vector3 destination, out string name) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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) destination = Vector3.zero; name = string.Empty; if (Destination == NoWaitDestination.Checkpoint) { if (!_actions.TryGetCheckpointPosition(out destination)) { return false; } name = "the active checkpoint"; return true; } PlayerEntry playerEntry = null; float num = float.MaxValue; for (int i = 0; i < _players.Entries.Count; i++) { PlayerEntry playerEntry2 = _players.Entries[i]; if (RecoveryManager.TrySafeScout(playerEntry2, local, out var safe)) { float num2; if (Destination != NoWaitDestination.LowestLiving && PlayerActions.Finite(local.Character.Center)) { Vector3 val = playerEntry2.Character.Center - local.Character.Center; num2 = ((Vector3)(ref val)).sqrMagnitude; } else { num2 = playerEntry2.Character.Center.y; } float num3 = num2; if (num3 < num) { num = num3; playerEntry = playerEntry2; destination = safe; } } } if (playerEntry == null) { return false; } name = ((Destination == NoWaitDestination.LowestLiving) ? "the lowest living scout, " : "the nearest living scout, ") + playerEntry.Name; return true; } private void BeginReconnectPreservation(Character character) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) try { _restoreData = ReconnectData.CreateFromCharacter(character); _restoreCharacter = character; _suppressedDropItems = character.refs.items; _suppressDropUntil = Time.unscaledTime + 1.5f; _restoreAt = Time.unscaledTime + 0.2f; _restorePending = true; } catch (Exception ex) { CancelReconnectPreservation(); _log.LogWarning((object)("No Wait could not snapshot reconnect state: " + ex.Message)); } } private void TickPostRevive() { //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (_restorePending && Time.unscaledTime >= _restoreAt) { try { if ((Object)(object)_restoreCharacter != (Object)null && _restoreCharacter.refs != null && (Object)(object)_restoreCharacter.refs.afflictions != (Object)null) { _restoreCharacter.refs.afflictions.ApplyReconnectData(_restoreData); _restoreCharacter.data.extraStamina = _restoreData.extraStamina; _restoreCharacter.data.SetPetrify(_restoreData.petrify); _log.LogInfo((object)"No Wait restored reconnect statuses and retained inventory."); } } catch (Exception ex) { _log.LogWarning((object)("No Wait reconnect-state restore failed safely: " + ex.Message)); } _restorePending = false; } if ((Object)(object)_settleCharacter != (Object)null && Time.unscaledTime <= _settleUntil) { PlayerEntry local = _players.Local; if (local != null && (Object)(object)local.Character == (Object)(object)_settleCharacter) { _actions.HaltVelocityLocal(local); } } if ((Object)(object)_restoreCharacter != (Object)null && Time.unscaledTime > _suppressDropUntil) { _restoreCharacter = null; _suppressedDropItems = null; } if ((Object)(object)_settleCharacter != (Object)null && Time.unscaledTime > _settleUntil) { _settleCharacter = null; } } private void TickReviveQueue() { if (_reviveQueue.Count == 0 || Time.unscaledTime < _nextQueuedRevive) { return; } if (!PhotonNetwork.InRoom) { _reviveQueue.Clear(); return; } int actor = _reviveQueue[0]; _reviveQueue.RemoveAt(0); _nextQueuedRevive = Time.unscaledTime + 1.5f; PlayerEntry playerEntry = _players.Find(actor); if (playerEntry != null && !((Object)(object)playerEntry.Character == (Object)null) && !((Object)(object)playerEntry.Character.data == (Object)null) && (playerEntry.Character.data.dead || playerEntry.Character.data.fullyPassedOut)) { ActionResult actionResult = _actions.ResurrectAtLastLivingPosition(playerEntry); if (!actionResult.Success) { _log.LogWarning((object)("Queued resurrection failed safely: " + actionResult.Message)); } } } private void CancelReconnectPreservation() { _restorePending = false; _restoreCharacter = null; _suppressedDropItems = null; _suppressDropUntil = 0f; } private void ResetRoomState() { _recentRoomJoin = false; _trackedLocalCharacter = null; _reviveQueue.Clear(); _settleCharacter = null; CancelReconnectPreservation(); } } internal sealed class RecoveryManager { private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private Vector3 _lastSafePosition; private bool _hasLastSafePosition; private Character _trackedCharacter; private Character _settleCharacter; private float _settleUntil; public bool HasLastSafePosition => _hasLastSafePosition; public RecoveryManager(ManualLogSource log, PlayerManager players, PlayerActions actions) { _log = log; _players = players; _actions = actions; } public void Tick() { //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) PlayerEntry local = _players.Local; if (local == null || (Object)(object)local.Character == (Object)null || (Object)(object)local.Character.data == (Object)null || !local.Character.IsInitialized) { return; } if ((Object)(object)_settleCharacter != (Object)null) { if (Time.unscaledTime <= _settleUntil && (Object)(object)local.Character == (Object)(object)_settleCharacter) { _actions.HaltVelocityLocal(local); } else { _settleCharacter = null; } } if ((Object)(object)_trackedCharacter != (Object)(object)local.Character) { _trackedCharacter = local.Character; _hasLastSafePosition = false; } CharacterData data = local.Character.data; if (!data.dead && !data.fullyPassedOut && data.isGrounded && !(data.groundedFor < 0.75f) && !data.isInWater && !data.isClimbingAnything && PlayerActions.TrySafePosition(local.Character.Center, out var safe)) { _lastSafePosition = safe; _hasLastSafePosition = true; } } public void OnSceneLoaded() { _trackedCharacter = null; _settleCharacter = null; _hasLastSafePosition = false; } public ActionResult RecoverLastSafeGround() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (!_hasLastSafePosition) { return ActionResult.Fail("No safe grounded position has been recorded in this scene yet."); } return MoveLocalTo(_lastSafePosition, "last safe ground"); } public ActionResult RecoverNearestScout() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) PlayerEntry local = _players.Local; if (local == null || (Object)(object)local.Character == (Object)null) { return ActionResult.Fail("Local player unavailable."); } PlayerEntry playerEntry = null; Vector3 destination = Vector3.zero; float num = float.MaxValue; bool flag = PlayerActions.Finite(local.Character.Center); for (int i = 0; i < _players.Entries.Count; i++) { PlayerEntry playerEntry2 = _players.Entries[i]; if (TrySafeScout(playerEntry2, local, out var safe)) { float num2; if (!flag) { num2 = playerEntry2.Character.Center.y; } else { Vector3 val = playerEntry2.Character.Center - local.Character.Center; num2 = ((Vector3)(ref val)).sqrMagnitude; } float num3 = num2; if (num3 < num) { num = num3; playerEntry = playerEntry2; destination = safe; } } } if (playerEntry == null) { return ActionResult.Fail("No living scout is standing on safe ground."); } return MoveLocalTo(destination, "safe ground beside " + playerEntry.Name); } public ActionResult RecoverCheckpoint() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (!_actions.TryGetCheckpointPosition(out var position)) { return ActionResult.Fail("The active checkpoint spawn is unavailable or unsafe."); } return MoveLocalTo(position, "the active checkpoint"); } public ActionResult RecoverStart() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!_actions.TryGetStartEnd(end: false, out var position)) { return ActionResult.Fail("The expedition start reference is unavailable."); } return MoveLocalTo(position, "the expedition start"); } public ActionResult StabilizeSelf() { PlayerEntry local = _players.Local; if (local == null) { return ActionResult.Fail("Local player unavailable."); } _actions.StopFlightLocal(local); return _actions.HaltVelocityLocal(local); } public ActionResult RestoreSelf() { PlayerEntry local = _players.Local; if (local == null) { return ActionResult.Fail("Local player unavailable."); } ActionResult actionResult = _actions.ResetLocal(local); _actions.HaltVelocityLocal(local); if (!actionResult.Success) { return actionResult; } return ActionResult.Ok("Restored local flight, speed, visibility, statuses, and movement state."); } private ActionResult MoveLocalTo(Vector3 destination, string label) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) PlayerEntry local = _players.Local; if (local == null || (Object)(object)local.Character == (Object)null || (Object)(object)local.Character.data == (Object)null) { return ActionResult.Fail("Local player unavailable."); } _actions.StopFlightLocal(local); _actions.HaltVelocityLocal(local); ActionResult actionResult = ((local.Character.data.dead || local.Character.data.fullyPassedOut) ? _actions.ResurrectLocal(local, destination, applyPostReviveStatus: false) : _actions.TeleportLocal(local, destination)); if (!actionResult.Success) { return actionResult; } _actions.HaltVelocityLocal(local); _settleCharacter = local.Character; _settleUntil = Time.unscaledTime + 1f; _log.LogInfo((object)("Emergency Recovery moved the local scout to " + label + ".")); return ActionResult.Ok("Recovered to " + label + "."); } internal static bool TrySafeScout(PlayerEntry candidate, PlayerEntry excluded, out Vector3 safe) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) safe = Vector3.zero; if (candidate == null || candidate == excluded || (Object)(object)candidate.Character == (Object)null || (Object)(object)candidate.Character.data == (Object)null || !candidate.Character.IsInitialized) { return false; } CharacterData data = candidate.Character.data; if (data.dead || data.fullyPassedOut || !data.isGrounded || data.groundedFor < 0.75f || data.isInWater || data.isClimbingAnything) { return false; } Vector3 value = data.lookDirection_Right; value.y = 0f; if (!PlayerActions.Finite(value) || ((Vector3)(ref value)).sqrMagnitude < 0.01f) { value = Vector3.right; } return PlayerActions.TrySafePosition(candidate.Character.Center + ((Vector3)(ref value)).normalized * 1.5f, out safe); } } internal sealed class MindControlManager { private const int JumpPressed = 1; private const int JumpHeld = 2; private const int SprintPressed = 4; private const int SprintHeld = 8; private const int SprintTogglePressed = 16; private const int SprintToggleHeld = 32; private const int CrouchPressed = 64; private const int CrouchHeld = 128; private const int CrouchTogglePressed = 256; private const int InteractPressed = 512; private const int InteractHeld = 1024; private const int InteractReleased = 2048; private const int DropPressed = 4096; private const int DropHeld = 8192; private const int DropReleased = 16384; private const int PrimaryPressed = 32768; private const int PrimaryHeld = 65536; private const int PrimaryReleased = 131072; private const int SecondaryPressed = 262144; private const int SecondaryHeld = 524288; private const int SecondaryReleased = 1048576; private const int PingPressed = 2097152; private const int SelectForwardPressed = 4194304; private const int SelectBackwardPressed = 8388608; private const int UnselectPressed = 16777216; private const int BackpackPressed = 33554432; private const int ScrollForwardPressed = 67108864; private const int ScrollForwardHeld = 134217728; private const int ScrollBackwardPressed = 268435456; private const int ScrollBackwardHeld = 536870912; private const int EmoteHeld = 1073741824; private const int AllowedMask = int.MaxValue; private const int HeldMask = 1745429674; private const int PulseMask = 402053973; private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly TrollNetworkManager _network; private readonly ModConfig _settings; private readonly CapabilityRegistry _capabilities; private readonly MethodInfo _addForceAtPosition; private int _controlledActor; private int _controllerActor; private int _session; private int _sequence; private int _lastVictimSequence = -1; private bool _pending; private bool _hostPuppetMode; private bool _puppetCrouched; private float _pendingUntil; private float _sessionUntil; private float _lastPacketAt; private float _nextSend; private Vector2 _controllerMovement; private Vector2 _controllerLook; private float _controllerScroll; private int _controllerHeld; private int _controllerPulses; private Vector2 _victimMovement; private Vector2 _victimLook; private float _victimScroll; private int _victimHeld; private int _victimPulses; private Vector3 _cameraPosition; private bool _cameraInitialized; private Vector3 _puppetForward; private GUIStyle _overlayTitle; private GUIStyle _overlayText; private string _status = "Inactive"; public bool IsControlling { get { if (_controlledActor > 0) { return !_pending; } return false; } } public bool IsPending { get { if (_controlledActor > 0) { return _pending; } return false; } } public bool IsControlled => _controllerActor > 0; public bool Active { get { if (!IsControlling && !IsPending) { return IsControlled; } return true; } } public string Status => _status; public MindControlManager(ManualLogSource log, PlayerManager players, TrollNetworkManager network, ModConfig settings, CapabilityRegistry capabilities) { _log = log; _players = players; _network = network; _settings = settings; _capabilities = capabilities; _addForceAtPosition = ReflectionHelpers.Method(typeof(Character), "AddForceAtPosition", new Type[3] { typeof(Vector3), typeof(Vector3), typeof(float) }); } public ActionResult Start(PlayerEntry target) { //IL_0185: 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) if (!_capabilities.Available(FeatureCapability.MindControl)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.MindControl)); } if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.data == (Object)null) { return ActionResult.Fail("Select one available scout."); } if (target.IsLocal) { return ActionResult.Fail("Mind Control requires a different scout."); } if (target.Character.data.dead || target.Character.data.fullyPassedOut) { return ActionResult.Fail("The selected scout must be conscious."); } if (Active) { Stop(); } int num = Random.Range(1, int.MaxValue); float num2 = Mathf.Clamp(_settings.MindControlDuration.Value, 10f, 180f); if (!_network.IsCompatible(target.ActorNumber)) { if (!_players.IsHost) { return ActionResult.Fail(target.Name + " is unmodded. Only the host can use limited puppet control on unmodded scouts."); } if (_addForceAtPosition == null || target.Character.refs == null || (Object)(object)target.Character.refs.view == (Object)null) { return ActionResult.Fail("PEAK's native puppet-control path is unavailable in this game build."); } _controlledActor = target.ActorNumber; _session = num; _hostPuppetMode = true; _sessionUntil = Time.unscaledTime + num2; _nextSend = 0f; _cameraInitialized = false; _puppetForward = FlatForward(target.Character); _status = "Host puppet control: " + target.Name + ". Their own controls remain active; F6 releases."; return ActionResult.Ok("Host puppet control started for " + target.Name + ". Movement, sprint, jump, and crouch use PEAK's native RPCs; their own controls cannot be suppressed without the mod."); } ActionResult actionResult = _network.SendMindControlCommand(NetCommand.MindControlStart, target.ActorNumber, new object[2] { num, num2 }, reliable: true); if (!actionResult.Success) { return actionResult; } _controlledActor = target.ActorNumber; _session = num; _pending = true; _pendingUntil = Time.unscaledTime + 4f; _sessionUntil = Time.unscaledTime + num2; _status = "Waiting for " + target.Name + " to accept the control session."; return ActionResult.Ok("Mind Control requested for " + target.Name + ". It will use game inputs only; F6 releases either side."); } public ActionResult Stop() { if (!Active) { return ActionResult.Ok("Mind Control is already inactive."); } if (_hostPuppetMode && _puppetCrouched) { PlayerEntry playerEntry = _players.Find(_controlledActor); try { if (playerEntry != null && (Object)(object)playerEntry.Character != (Object)null && playerEntry.Character.refs != null && (Object)(object)playerEntry.Character.refs.view != (Object)null) { playerEntry.Character.refs.view.RPC("RPCA_SetCrouch", (RpcTarget)0, new object[1] { false }); } } catch (Exception ex) { _log.LogWarning((object)("Host puppet crouch cleanup failed safely: " + ex.Message)); } } if (_controlledActor > 0 && !_hostPuppetMode) { _network.SendMindControlCommand(NetCommand.MindControlStop, _controlledActor, new object[1] { _session }, reliable: true); } if (_controllerActor > 0) { _network.SendMindControlCommand(NetCommand.MindControlStop, _controllerActor, new object[1] { _session }, reliable: true); } string text = (IsControlled ? "Mind Control broken locally." : "Mind Control released."); Clear(); _status = text; return ActionResult.Ok(text); } public ActionResult ReceiveStart(int senderActor, int session, float duration) { PlayerEntry local = _players.Local; PlayerEntry playerEntry = _players.Find(senderActor); bool flag = local != null && local.IsLocal && playerEntry != null && !playerEntry.IsLocal && session > 0 && !IsControlled && !IsControlling && !IsPending && (Object)(object)local.Character != (Object)null && (Object)(object)local.Character.data != (Object)null && !local.Character.data.dead && !local.Character.data.fullyPassedOut; _network.SendMindControlCommand(NetCommand.MindControlAck, senderActor, new object[2] { session, flag }, reliable: true); if (!flag) { return ActionResult.Fail("Mind Control request rejected because this client is unavailable or already in a session."); } _controllerActor = senderActor; _session = session; _sessionUntil = Time.unscaledTime + Mathf.Clamp(duration, 10f, 180f); _lastPacketAt = Time.unscaledTime; _lastVictimSequence = -1; _status = "Controlled by " + playerEntry.Name + ". Press F6 to break free."; return ActionResult.Ok(_status); } public ActionResult ReceiveAck(int senderActor, int session, bool accepted) { if (!IsPending || senderActor != _controlledActor || session != _session) { return ActionResult.Fail("Ignored an unrelated Mind Control acknowledgement."); } PlayerEntry playerEntry = _players.Find(senderActor); if (!accepted) { string text = ((playerEntry == null) ? "The target" : playerEntry.Name); Clear(); _status = text + " could not enter Mind Control."; return ActionResult.Fail(_status); } _pending = false; _nextSend = 0f; _sequence = 0; _cameraInitialized = false; _status = "Controlling " + ((playerEntry == null) ? "selected scout" : playerEntry.Name) + ". Press F6 to release."; return ActionResult.Ok(_status); } public ActionResult ReceiveInput(int senderActor, int session, int sequence, float moveX, float moveY, float lookX, float lookY, float scroll, int mask) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) if (!IsControlled || senderActor != _controllerActor || session != _session) { return ActionResult.Fail("Ignored input outside the active Mind Control session."); } if (sequence <= _lastVictimSequence) { return ActionResult.Fail("Ignored stale Mind Control input."); } _lastVictimSequence = sequence; _lastPacketAt = Time.unscaledTime; _victimMovement = Vector2.ClampMagnitude(new Vector2(Clean(moveX, -1f, 1f), Clean(moveY, -1f, 1f)), 1f); _victimLook += new Vector2(Clean(lookX, -50f, 50f), Clean(lookY, -50f, 50f)); _victimLook = new Vector2(Mathf.Clamp(_victimLook.x, -100f, 100f), Mathf.Clamp(_victimLook.y, -100f, 100f)); _victimScroll = Mathf.Clamp(_victimScroll + Clean(scroll, -10f, 10f), -20f, 20f); mask &= 0x7FFFFFFF; _victimHeld = mask & 0x680924AA; _victimPulses |= mask & 0x17F6DB55; return ActionResult.Ok("Mind Control input accepted."); } public ActionResult ReceiveStop(int senderActor, int session) { if (session != _session) { return ActionResult.Fail("Ignored a stale Mind Control stop."); } if (IsControlled && senderActor == _controllerActor) { Clear(); _status = "Mind Control released by the controller."; return ActionResult.Ok(_status); } if ((IsControlling || IsPending) && senderActor == _controlledActor) { Clear(); _status = "The selected scout broke free from Mind Control."; return ActionResult.Ok(_status); } return ActionResult.Fail("Ignored a Mind Control stop from an unrelated player."); } public void Tick() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return; } KeyboardShortcut value = _settings.MindControlEscapeKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { Stop(); } else if (!PhotonNetwork.InRoom) { Clear(); _status = "Mind Control ended because the lobby closed."; } else if (IsPending && Time.unscaledTime >= _pendingUntil) { Clear(); _status = "Mind Control request timed out."; } else if (Time.unscaledTime >= _sessionUntil) { Stop(); _status = "Mind Control duration ended."; } else if (IsControlling) { PlayerEntry playerEntry = _players.Find(_controlledActor); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null || (Object)(object)playerEntry.Character.data == (Object)null || playerEntry.Character.data.dead || playerEntry.Character.data.fullyPassedOut) { Stop(); _status = "Mind Control ended because the target became unavailable."; } else if (_hostPuppetMode) { if (!_players.IsHost) { Stop(); _status = "Host puppet control ended because host authority was lost."; } else if (Time.unscaledTime >= _nextSend) { ApplyHostPuppetInput(playerEntry); } } else if (Time.unscaledTime >= _nextSend) { SendControllerInput(); } } else if (IsControlled && (Time.unscaledTime - _lastPacketAt > 2f || _players.Find(_controllerActor) == null)) { int controllerActor = _controllerActor; int session = _session; Clear(); if (controllerActor > 0) { _network.SendMindControlCommand(NetCommand.MindControlStop, controllerActor, new object[1] { session }, reliable: true); } _status = "Mind Control ended because its input stream stopped."; } } public void OnInputSampled(CharacterInput input, bool canDoInput) { Character localCharacter = Character.localCharacter; if ((Object)(object)input == (Object)null || (Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.input != (Object)(object)input) { return; } if (IsControlling) { Capture(input); ClearGameplayInput(input); } else if (IsControlled) { if (canDoInput) { Apply(input); } else { ClearGameplayInput(input); } } } public void OverrideCamera(MainCameraMovement camera) { //IL_005f: 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) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) if (!IsControlling || (Object)(object)camera == (Object)null) { return; } PlayerEntry playerEntry = _players.Find(_controlledActor); if (playerEntry != null && !((Object)(object)playerEntry.Character == (Object)null) && !((Object)(object)playerEntry.Character.data == (Object)null)) { Vector3 val = (_hostPuppetMode ? _puppetForward : FlatForward(playerEntry.Character)); Vector3 val2 = playerEntry.Character.Center + Vector3.up * 1.1f; float num = Mathf.Clamp(_settings.MindControlCameraDistance.Value, 3f, 10f); Vector3 val3 = val2 - val * num + Vector3.up * 1.4f; Vector3 val4 = val3 - val2; RaycastHit val5 = default(RaycastHit); if (((Vector3)(ref val4)).sqrMagnitude > 0.01f && Physics.Raycast(val2 + Vector3.up * 0.35f, ((Vector3)(ref val4)).normalized, ref val5, ((Vector3)(ref val4)).magnitude, -5, (QueryTriggerInteraction)1)) { val3 = ((RaycastHit)(ref val5)).point + ((RaycastHit)(ref val5)).normal * 0.2f; } if (!_cameraInitialized) { _cameraPosition = val3; _cameraInitialized = true; } else { _cameraPosition = Vector3.Lerp(_cameraPosition, val3, 1f - Mathf.Exp(-12f * Time.unscaledDeltaTime)); } ((Component)camera).transform.position = _cameraPosition; Vector3 val6 = val2 - _cameraPosition; if (((Vector3)(ref val6)).sqrMagnitude > 0.01f) { ((Component)camera).transform.rotation = Quaternion.LookRotation(((Vector3)(ref val6)).normalized, Vector3.up); } } } public void Draw(bool menuOpen) { //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Invalid comparison between Unknown and I4 //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) if (menuOpen || (!IsControlling && !IsControlled) || Event.current == null || (int)Event.current.type != 7) { return; } EnsureStyles(); PlayerEntry playerEntry = _players.Find(IsControlled ? _controllerActor : _controlledActor); string text = ((playerEntry == null) ? "Unknown scout" : playerEntry.Name); string text2 = (IsControlled ? ("MIND CONTROLLED BY " + text.ToUpperInvariant()) : ((_hostPuppetMode ? "HOST PUPPET — " : "MIND CONTROL — ") + text.ToUpperInvariant())); string text3 = (IsControlled ? "F6 break free • Pause and voice remain yours" : (_hostPuppetMode ? "WASD push • Shift sprint • Space jump • C crouch • F6 release" : "WASD move • Mouse look • normal action keys • F6 release")); Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - 560f) * 0.5f, 28f, 560f, 62f); Color color = GUI.color; int depth = GUI.depth; try { GUI.depth = -9500; GUI.color = new Color(0.025f, 0.035f, 0.04f, 0.94f); GUI.Box(val, GUIContent.none); GUI.color = Color.white; GUI.Label(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 5f, ((Rect)(ref val)).width - 24f, 25f), text2, _overlayTitle); GUI.Label(new Rect(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 31f, ((Rect)(ref val)).width - 24f, 22f), text3, _overlayText); } finally { GUI.color = color; GUI.depth = depth; } } private void Capture(CharacterInput input) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0067: Unknown result type (might be due to invalid IL or missing references) _controllerMovement = Vector2.ClampMagnitude(input.movementInput, 1f); _controllerLook += input.lookInput; _controllerLook = new Vector2(Mathf.Clamp(_controllerLook.x, -100f, 100f), Mathf.Clamp(_controllerLook.y, -100f, 100f)); _controllerScroll = Mathf.Clamp(_controllerScroll + input.scrollInput, -20f, 20f); int num = ReadMask(input); _controllerHeld = num & 0x680924AA; _controllerPulses |= num & 0x17F6DB55; } private void SendControllerInput() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) _nextSend = Time.unscaledTime + 0.05f; int num = _controllerHeld | _controllerPulses; object[] args = new object[8] { _session, ++_sequence, _controllerMovement.x, _controllerMovement.y, _controllerLook.x, _controllerLook.y, _controllerScroll, num }; ActionResult actionResult = _network.SendMindControlCommand(NetCommand.MindControlInput, _controlledActor, args, reliable: false); if (actionResult.Success) { _controllerPulses = 0; _controllerLook = Vector2.zero; _controllerScroll = 0f; } } private void ApplyHostPuppetInput(PlayerEntry target) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) _nextSend = Time.unscaledTime + 0.1f; try { float num = Mathf.Clamp(_controllerLook.x, -50f, 50f) * 0.16f; if (Mathf.Abs(num) > 0.001f) { _puppetForward = Quaternion.AngleAxis(num, Vector3.up) * _puppetForward; } _puppetForward.y = 0f; if (!Finite(_puppetForward) || ((Vector3)(ref _puppetForward)).sqrMagnitude < 0.01f) { _puppetForward = FlatForward(target.Character); } ((Vector3)(ref _puppetForward)).Normalize(); Vector3 val = Vector3.Cross(Vector3.up, _puppetForward); Vector3 normalized = ((Vector3)(ref val)).normalized; Vector3 val2 = _puppetForward * _controllerMovement.y + normalized * _controllerMovement.x; float num2 = Mathf.Clamp01(((Vector3)(ref val2)).magnitude); if (num2 > 0.02f) { ((Vector3)(ref val2)).Normalize(); int mask = _controllerHeld | _controllerPulses; bool flag = Has(mask, 8) || Has(mask, 32); float num3 = Mathf.Clamp(_settings.MindControlHostPuppetForce.Value, 1f, 8f) * (flag ? 1.65f : 1f) * num2; ReflectionHelpers.Invoke(target.Character, _addForceAtPosition, val2 * num3, target.Character.Center, 3f); } int mask2 = _controllerHeld | _controllerPulses; if (Has(mask2, 1)) { target.Character.refs.view.RPC("JumpRpc", (RpcTarget)0, new object[1] { false }); } if (Has(mask2, 64) || Has(mask2, 256)) { _puppetCrouched = !_puppetCrouched; target.Character.refs.view.RPC("RPCA_SetCrouch", (RpcTarget)0, new object[1] { _puppetCrouched }); } _controllerPulses = 0; _controllerLook = Vector2.zero; _controllerScroll = 0f; } catch (Exception ex) { _log.LogWarning((object)("Host puppet input failed safely: " + ex.Message)); Stop(); _status = "Host puppet control stopped because PEAK rejected a native action."; } } private void Apply(CharacterInput input) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) int mask = _victimHeld | _victimPulses; input.movementInput = _victimMovement; input.lookInput = _victimLook; input.scrollInput = _victimScroll; input.jumpWasPressed = Has(mask, 1); input.jumpIsPressed = Has(mask, 2); input.sprintWasPressed = Has(mask, 4); input.sprintIsPressed = Has(mask, 8); input.sprintToggleWasPressed = Has(mask, 16); input.sprintToggleIsPressed = Has(mask, 32); input.crouchWasPressed = Has(mask, 64); input.crouchIsPressed = Has(mask, 128); input.crouchToggleWasPressed = Has(mask, 256); input.interactWasPressed = Has(mask, 512); input.interactIsPressed = Has(mask, 1024); input.interactWasReleased = Has(mask, 2048); input.dropWasPressed = Has(mask, 4096); input.dropIsPressed = Has(mask, 8192); input.dropWasReleased = Has(mask, 16384); input.usePrimaryWasPressed = Has(mask, 32768); input.usePrimaryIsPressed = Has(mask, 65536); input.usePrimaryWasReleased = Has(mask, 131072); input.useSecondaryWasPressed = Has(mask, 262144); input.useSecondaryIsPressed = Has(mask, 524288); input.useSecondaryWasReleased = Has(mask, 1048576); input.pingWasPressed = Has(mask, 2097152); if (!input.itemSwitchBlocked) { input.selectSlotForwardWasPressed = Has(mask, 4194304); input.selectSlotBackwardWasPressed = Has(mask, 8388608); input.unselectSlotWasPressed = Has(mask, 16777216); input.selectBackpackWasPressed = Has(mask, 33554432); } else { input.selectSlotForwardWasPressed = false; input.selectSlotBackwardWasPressed = false; input.unselectSlotWasPressed = false; input.selectBackpackWasPressed = false; } input.scrollForwardWasPressed = Has(mask, 67108864); input.scrollForwardIsPressed = Has(mask, 134217728); input.scrollBackwardWasPressed = Has(mask, 268435456); input.scrollBackwardIsPressed = Has(mask, 536870912); input.emoteIsPressed = Has(mask, 1073741824); _victimPulses = 0; _victimLook = Vector2.zero; _victimScroll = 0f; } private static int ReadMask(CharacterInput input) { int mask = 0; Add(ref mask, input.jumpWasPressed, 1); Add(ref mask, input.jumpIsPressed, 2); Add(ref mask, input.sprintWasPressed, 4); Add(ref mask, input.sprintIsPressed, 8); Add(ref mask, input.sprintToggleWasPressed, 16); Add(ref mask, input.sprintToggleIsPressed, 32); Add(ref mask, input.crouchWasPressed, 64); Add(ref mask, input.crouchIsPressed, 128); Add(ref mask, input.crouchToggleWasPressed, 256); Add(ref mask, input.interactWasPressed, 512); Add(ref mask, input.interactIsPressed, 1024); Add(ref mask, input.interactWasReleased, 2048); Add(ref mask, input.dropWasPressed, 4096); Add(ref mask, input.dropIsPressed, 8192); Add(ref mask, input.dropWasReleased, 16384); Add(ref mask, input.usePrimaryWasPressed, 32768); Add(ref mask, input.usePrimaryIsPressed, 65536); Add(ref mask, input.usePrimaryWasReleased, 131072); Add(ref mask, input.useSecondaryWasPressed, 262144); Add(ref mask, input.useSecondaryIsPressed, 524288); Add(ref mask, input.useSecondaryWasReleased, 1048576); Add(ref mask, input.pingWasPressed, 2097152); Add(ref mask, input.selectSlotForwardWasPressed, 4194304); Add(ref mask, input.selectSlotBackwardWasPressed, 8388608); Add(ref mask, input.unselectSlotWasPressed, 16777216); Add(ref mask, input.selectBackpackWasPressed, 33554432); Add(ref mask, input.scrollForwardWasPressed, 67108864); Add(ref mask, input.scrollForwardIsPressed, 134217728); Add(ref mask, input.scrollBackwardWasPressed, 268435456); Add(ref mask, input.scrollBackwardIsPressed, 536870912); Add(ref mask, input.emoteIsPressed, 1073741824); return mask; } private static void ClearGameplayInput(CharacterInput input) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) input.movementInput = Vector2.zero; input.lookInput = Vector2.zero; input.scrollInput = 0f; input.jumpWasPressed = false; input.jumpIsPressed = false; input.sprintWasPressed = false; input.sprintIsPressed = false; input.sprintToggleWasPressed = false; input.sprintToggleIsPressed = false; input.crouchWasPressed = false; input.crouchIsPressed = false; input.crouchToggleWasPressed = false; input.interactWasPressed = false; input.interactIsPressed = false; input.interactWasReleased = false; input.dropWasPressed = false; input.dropIsPressed = false; input.dropWasReleased = false; input.usePrimaryWasPressed = false; input.usePrimaryIsPressed = false; input.usePrimaryWasReleased = false; input.useSecondaryWasPressed = false; input.useSecondaryIsPressed = false; input.useSecondaryWasReleased = false; input.pingWasPressed = false; input.selectSlotForwardWasPressed = false; input.selectSlotBackwardWasPressed = false; input.unselectSlotWasPressed = false; input.selectBackpackWasPressed = false; input.scrollForwardWasPressed = false; input.scrollForwardIsPressed = false; input.scrollBackwardWasPressed = false; input.scrollBackwardIsPressed = false; input.emoteIsPressed = false; } private void Clear() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) _controlledActor = 0; _controllerActor = 0; _session = 0; _sequence = 0; _lastVictimSequence = -1; _pending = false; _hostPuppetMode = false; _puppetCrouched = false; _pendingUntil = 0f; _sessionUntil = 0f; _lastPacketAt = 0f; _nextSend = 0f; _controllerMovement = Vector2.zero; _controllerLook = Vector2.zero; _controllerScroll = 0f; _controllerHeld = 0; _controllerPulses = 0; _victimMovement = Vector2.zero; _victimLook = Vector2.zero; _victimScroll = 0f; _victimHeld = 0; _victimPulses = 0; _cameraInitialized = false; _puppetForward = Vector3.forward; } public void ResetTarget(int actor) { if (_controlledActor == actor || _controllerActor == actor || (_players.Local != null && _players.Local.ActorNumber == actor && Active)) { Clear(); _status = "Mind Control cleared by player reset."; } } public void Reset() { Clear(); _status = "Inactive"; } private void EnsureStyles() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (_overlayTitle == null) { _overlayTitle = new GUIStyle(GUI.skin.label); _overlayTitle.font = UiFontManager.DisplayFont; _overlayTitle.fontSize = 15; _overlayTitle.fontStyle = (FontStyle)1; _overlayTitle.alignment = (TextAnchor)4; _overlayTitle.normal.textColor = new Color(0.4f, 1f, 0.9f); _overlayText = new GUIStyle(GUI.skin.label); _overlayText.font = UiFontManager.BodyFont; _overlayText.fontSize = 12; _overlayText.alignment = (TextAnchor)4; _overlayText.normal.textColor = new Color(0.82f, 0.88f, 0.87f); } } private static bool Has(int mask, int flag) { return (mask & flag) != 0; } private static void Add(ref int mask, bool value, int flag) { if (value) { mask |= flag; } } private static Vector3 FlatForward(Character character) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) Vector3 value = (((Object)(object)character != (Object)null && (Object)(object)character.data != (Object)null) ? character.data.lookDirection_Flat : Vector3.forward); value.y = 0f; if (!Finite(value) || ((Vector3)(ref value)).sqrMagnitude < 0.01f) { value = (((Object)(object)character == (Object)null) ? Vector3.forward : ((Component)character).transform.forward); } value.y = 0f; if (!(((Vector3)(ref value)).sqrMagnitude < 0.01f)) { return ((Vector3)(ref value)).normalized; } return Vector3.forward; } private static bool Finite(Vector3 value) { if (!float.IsNaN(value.x) && !float.IsNaN(value.y) && !float.IsNaN(value.z) && !float.IsInfinity(value.x) && !float.IsInfinity(value.y)) { return !float.IsInfinity(value.z); } return false; } private static float Clean(float value, float min, float max) { if (!float.IsNaN(value) && !float.IsInfinity(value)) { return Mathf.Clamp(value, min, max); } return 0f; } } internal sealed class QuickReconnectManager { private readonly ManualLogSource _log; private readonly ModConfig _settings; private readonly CapabilityRegistry _capabilities; private float _nextCapture; public bool HasLastLobby { get { if (ulong.TryParse(_settings.LastLobbyId.Value, out var result)) { return result != 0; } return false; } } public string LastLobbyDisplay { get { if (!HasLastLobby) { return "Not saved"; } return _settings.LastLobbyId.Value; } } public QuickReconnectManager(ManualLogSource log, ModConfig settings, CapabilityRegistry capabilities) { _log = log; _settings = settings; _capabilities = capabilities; } public void Tick() { if (Time.unscaledTime < _nextCapture) { return; } _nextCapture = Time.unscaledTime + 1f; try { IMatchmakingAPI matchmaking = NetCode.Matchmaking; if (matchmaking != null && matchmaking.InLobby) { string lobbyId = matchmaking.LobbyId; if (ulong.TryParse(lobbyId, out var result) && result != 0 && !string.Equals(lobbyId, _settings.LastLobbyId.Value, StringComparison.Ordinal)) { _settings.LastLobbyId.Value = lobbyId; _log.LogInfo((object)("Quick Reconnect saved Steam lobby " + lobbyId + ".")); } } } catch (Exception ex) { _log.LogWarning((object)("Quick Reconnect could not capture the current lobby: " + ex.Message)); } } public ActionResult Reconnect() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.QuickReconnect)) { return ActionResult.Fail("Quick Reconnect unsupported: " + _capabilities.Reason(FeatureCapability.QuickReconnect)); } if (PhotonNetwork.InRoom) { return ActionResult.Fail("Leave the current Photon room before reconnecting."); } if (!ulong.TryParse(_settings.LastLobbyId.Value, out var result) || result == 0) { return ActionResult.Fail("No previous Steam lobby has been saved yet."); } try { SteamLobbyHandler service = GameHandler.GetService(); if (service == null) { return ActionResult.Fail("PEAK's Steam lobby service is not initialized yet."); } service.TryJoinLobby(new CSteamID(result)); return ActionResult.Ok("Reconnecting to the last Steam lobby…"); } catch (Exception ex) { _log.LogWarning((object)("Quick Reconnect failed safely: " + ex)); return ActionResult.Fail("Quick Reconnect failed safely: " + ex.Message); } } } internal sealed class TrollNetworkManager : IOnEventCallback { private const byte EventCode = 197; private const int ProtocolVersion = 12; private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private readonly MirageManager _mirages; private readonly AudioManager _audio; private readonly HungerAmplifierManager _hungerAmplifier; private readonly HashSet _compatible = new HashSet(); private readonly Dictionary _advertisedProtocols = new Dictionary(); private readonly Dictionary _advertisedVersions = new Dictionary(); private readonly Dictionary _advertisedReady = new Dictionary(); private readonly Dictionary _advertisedBackpackProtection = new Dictionary(); private bool _localReady; private float _nextHello; private bool _registered; public int CompatibleCount => _compatible.Count; public bool HostSupportsRequests { get { if (!_players.IsHost) { if (PhotonNetwork.InRoom && PhotonNetwork.MasterClient != null) { return IsCompatible(PhotonNetwork.MasterClient.ActorNumber); } return false; } return true; } } public bool LocalReady => _localReady; public TrollNetworkManager(ManualLogSource log, PlayerManager players, PlayerActions actions, MirageManager mirages, AudioManager audio, HungerAmplifierManager hungerAmplifier) { _log = log; _players = players; _actions = actions; _mirages = mirages; _audio = audio; _hungerAmplifier = hungerAmplifier; PhotonNetwork.AddCallbackTarget((object)this); _registered = true; } public void Tick() { if (!PhotonNetwork.InRoom) { _compatible.Clear(); _advertisedProtocols.Clear(); _advertisedVersions.Clear(); _advertisedReady.Clear(); _advertisedBackpackProtection.Clear(); _localReady = false; return; } bool flag = (Object)(object)TrollModPlugin.Instance != (Object)null && TrollModPlugin.Instance.BackpackProtection != null && TrollModPlugin.Instance.BackpackProtection.Enabled; if (PhotonNetwork.LocalPlayer != null) { int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; _compatible.Add(actorNumber); _advertisedProtocols[actorNumber] = 12; _advertisedVersions[actorNumber] = "0.5.0"; _advertisedReady[actorNumber] = _localReady; _advertisedBackpackProtection[actorNumber] = flag; } if (Time.unscaledTime >= _nextHello) { _nextHello = Time.unscaledTime + 5f; Broadcast(NetCommand.Hello, Pack(NetCommand.Hello, PhotonNetwork.LocalPlayer.ActorNumber, new object[4] { 12, "0.5.0", _localReady, flag }), reliable: true); } } public bool IsCompatible(int actor) { return _compatible.Contains(actor); } public bool HasAdvertisement(int actor) { return _advertisedProtocols.ContainsKey(actor); } public bool IsReady(int actor) { if (_advertisedReady.TryGetValue(actor, out var value)) { return value; } return false; } public bool IsBackpackProtected(int actor) { if (_compatible.Contains(actor) && _advertisedBackpackProtection.TryGetValue(actor, out var value)) { return value; } return false; } public void SetLocalReady(bool ready) { _localReady = ready; _nextHello = 0f; } public void RefreshLocalAdvertisement() { _nextHello = 0f; if (PhotonNetwork.LocalPlayer != null) { _advertisedBackpackProtection[PhotonNetwork.LocalPlayer.ActorNumber] = (Object)(object)TrollModPlugin.Instance != (Object)null && TrollModPlugin.Instance.BackpackProtection != null && TrollModPlugin.Instance.BackpackProtection.Enabled; } } public string CompatibilityStatus(int actor) { if (!_advertisedProtocols.TryGetValue(actor, out var value)) { return "No mod detected"; } _advertisedVersions.TryGetValue(actor, out var value2); if (value != 12) { return "Protocol v" + value + " — needs v" + 12; } if (!string.IsNullOrEmpty(value2) && value2 != "0.5.0") { return "v" + value2 + " — version differs"; } return "Compatible v" + (string.IsNullOrEmpty(value2) ? "0.5.0" : value2); } public ActionResult SendToOwner(NetCommand command, PlayerEntry target, object[] args) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (target == null) { return ActionResult.Fail("No target selected."); } switch (command) { case NetCommand.Ragdoll: return _actions.RagdollLocal(target, V3(args, 0), Float(args, 3, 20f), Float(args, 4, 1.5f)); case NetCommand.Launch: return _actions.LaunchLocal(target, V3(args, 0), Float(args, 3, 35f), Bool(args, 4, d: true)); case NetCommand.Teleport: return _actions.TeleportLocal(target, V3(args, 0)); case NetCommand.Knockout: return _actions.KnockoutLocal(target); case NetCommand.Eliminate: return _actions.EliminateLocal(target); case NetCommand.GiveItem: return _actions.GiveItemLocal(target, String(args, 0, string.Empty, 128)); case NetCommand.Status: if (_players.IsHost && Int(args, 0, 0) != 7 && Int(args, 0, 0) != 9 && Int(args, 0, 0) != 12) { return _actions.ApplyStatusAsHost(target, Int(args, 0, 0), Float(args, 1, 0.1f)); } break; } if (command == NetCommand.SetHungerAmplifier && !target.IsLocal) { bool flag = Bool(args, 0, d: false); float num = Mathf.Clamp(Float(args, 1, 5f), 2f, 20f); if (!IsCompatible(target.ActorNumber)) { return _hungerAmplifier.SetHostFallback(target, flag, num); } _hungerAmplifier.ResetTarget(target.ActorNumber); return Send(command, target.ActorNumber, new object[2] { flag, num }, new int[1] { target.ActorNumber }); } if (target.IsLocal) { return Execute(command, target.ActorNumber, args, target.ActorNumber); } if (!IsCompatible(target.ActorNumber)) { return ActionResult.Fail(target.Name + " does not advertise PEAK Troll Mod; this action has no safe vanilla fallback."); } return Send(command, target.ActorNumber, args, new int[1] { target.ActorNumber }); } public ActionResult SendMindControlCommand(NetCommand command, int recipientActor, object[] args, bool reliable) { if (command != NetCommand.MindControlStart && command != NetCommand.MindControlAck && command != NetCommand.MindControlInput && command != NetCommand.MindControlStop) { return ActionResult.Fail("Invalid Mind Control command."); } if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Mind Control requires a Photon room."); } PlayerEntry playerEntry = _players.Find(recipientActor); if (playerEntry == null || playerEntry.IsLocal) { return ActionResult.Fail("Mind Control recipient is unavailable."); } if (!IsCompatible(recipientActor)) { return ActionResult.Fail(playerEntry.Name + " needs the same Mind Control protocol."); } return Send(command, recipientActor, args, new int[1] { recipientActor }, reliable); } public ActionResult RagdollOffMountain(PlayerEntry target, float strength) { return _actions.RagdollOffMountainLocal(target, Mathf.Clamp(strength, 1f, 75f)); } public ActionResult HorizontalRagdoll(PlayerEntry target, float strength) { return _actions.HorizontalRagdollLocal(target, Mathf.Clamp(strength, 25f, 150f)); } public ActionResult WrongMountain(PlayerEntry first, PlayerEntry second, float strength) { return _actions.WrongMountainLocal(first, second, Mathf.Clamp(strength, 25f, 150f)); } public ActionResult PositionRoulette(IList players) { return _actions.PositionRouletteLocal(players); } public ActionResult SkyLaunch(PlayerEntry target, float height) { return _actions.SkyLaunchLocal(target, Mathf.Clamp(height, 25f, 300f)); } public ActionResult HorizonLaunch(PlayerEntry target, float distance) { return _actions.HorizonLaunchLocal(target, Mathf.Clamp(distance, 25f, 300f)); } public ActionResult Resurrect(PlayerEntry target) { return _actions.ResurrectAtLastLivingPosition(target); } public ActionResult ClearStatuses(PlayerEntry target) { if (target == null) { return ActionResult.Fail("No target selected."); } ActionResult actionResult = (_players.IsHost ? _actions.ClearHostStatuses(target) : null); ActionResult actionResult2 = null; if (target.IsLocal) { actionResult2 = _actions.ClearModStatusesLocal(target); } else if (IsCompatible(target.ActorNumber)) { actionResult2 = Send(NetCommand.ClearStatuses, target.ActorNumber, new object[0], new int[1] { target.ActorNumber }); } if (actionResult2 != null && actionResult2.Success) { return actionResult2; } return actionResult ?? actionResult2 ?? ActionResult.Fail(target.Name + " needs PEAK Troll Mod for non-host status cleanup."); } public ActionResult RequestHostSpawn(NetCommand command, PlayerEntry target, float distance) { if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select an individual target."); } if (command != NetCommand.HostSpawnScoutmaster && command != NetCommand.HostSpawnZombie) { return ActionResult.Fail("Invalid host request."); } distance = Mathf.Clamp(distance, 4f, 25f); if (_players.IsHost) { if (command != NetCommand.HostSpawnScoutmaster) { return TrollModPlugin.Instance.Spawns.SpawnZombie(target, distance); } return TrollModPlugin.Instance.Spawns.SpawnScoutmaster(target, distance); } if (!PhotonNetwork.InRoom || PhotonNetwork.MasterClient == null) { return ActionResult.Fail("No Photon host is available."); } int actorNumber = PhotonNetwork.MasterClient.ActorNumber; if (!IsCompatible(actorNumber)) { return ActionResult.Fail("The host needs PEAK Troll Mod for this request."); } return Send(command, target.ActorNumber, new object[1] { distance }, new int[1] { actorNumber }); } public ActionResult RequestClearMySpawns() { if (_players.Local == null) { return ActionResult.Fail("Local player unavailable."); } if (_players.IsHost) { int num = TrollModPlugin.Instance.Spawns.ClearForCreator(_players.Local.ActorNumber); return ActionResult.Ok("Cleared " + num + " requested spawns."); } if (!PhotonNetwork.InRoom || PhotonNetwork.MasterClient == null || !IsCompatible(PhotonNetwork.MasterClient.ActorNumber)) { return ActionResult.Fail("A compatible host is required for tracked cleanup."); } return Send(NetCommand.HostClearRequestedSpawns, _players.Local.ActorNumber, new object[0], new int[1] { PhotonNetwork.MasterClient.ActorNumber }); } public ActionResult SendToAll(NetCommand command, int targetActor, object[] args) { if (!PhotonNetwork.InRoom) { return Execute(command, targetActor, args, targetActor); } return Broadcast(command, Pack(command, targetActor, args), reliable: true); } public ActionResult BroadcastHelicopterSuppression(bool enabled) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom) { return ActionResult.Fail("Not in a Photon room."); } RaiseEventOptions val = new RaiseEventOptions(); val.Receivers = (ReceiverGroup)0; int targetActor = ((PhotonNetwork.LocalPlayer != null) ? PhotonNetwork.LocalPlayer.ActorNumber : 0); if (!PhotonNetwork.RaiseEvent((byte)197, (object)Pack(NetCommand.SetHelicopterSuppression, targetActor, new object[1] { enabled }), val, SendOptions.SendReliable)) { return ActionResult.Fail("Photon rejected helicopter suppression advertisement."); } return ActionResult.Ok("Advertised helicopter suppression."); } private ActionResult Send(NetCommand command, int targetActor, object[] args, int[] actors) { return Send(command, targetActor, args, actors, reliable: true); } public ActionResult OfferLobbyProfile(string name, string code) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!_players.IsHost || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Only the current host can offer a lobby profile."); } if (string.IsNullOrEmpty(code) || code.Length > 4096) { return ActionResult.Fail("The profile code is empty or too large."); } RaiseEventOptions val = new RaiseEventOptions(); val.Receivers = (ReceiverGroup)0; int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; if (!PhotonNetwork.RaiseEvent((byte)197, (object)Pack(NetCommand.ProfileOffer, actorNumber, new object[2] { SafeString(name, 32), code }), val, SendOptions.SendReliable)) { return ActionResult.Fail("Photon rejected the profile offer."); } return ActionResult.Ok("Offered profile " + SafeString(name, 32) + " to compatible lobby members."); } public ActionResult RespondLobbyProfile(int hostActor, bool accepted, string name) { if (!PhotonNetwork.InRoom || PhotonNetwork.MasterClient == null || PhotonNetwork.MasterClient.ActorNumber != hostActor) { return ActionResult.Fail("The offering host is no longer available."); } return Send(NetCommand.ProfileResponse, hostActor, new object[2] { accepted, SafeString(name, 32) }, new int[1] { hostActor }); } public ActionResult OfferDirectorScenario(string name, string code) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if (!_players.IsHost || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Only the current host can offer a Director scenario."); } if (string.IsNullOrEmpty(code) || code.Length > 512) { return ActionResult.Fail("The Director scenario code is empty or too large."); } RaiseEventOptions val = new RaiseEventOptions(); val.Receivers = (ReceiverGroup)0; int actorNumber = PhotonNetwork.LocalPlayer.ActorNumber; if (!PhotonNetwork.RaiseEvent((byte)197, (object)Pack(NetCommand.DirectorScenarioOffer, actorNumber, new object[2] { SafeString(name, 32), code }), val, SendOptions.SendReliable)) { return ActionResult.Fail("Photon rejected the Director scenario offer."); } return ActionResult.Ok("Offered " + SafeString(name, 32) + " rules to compatible lobby members."); } public ActionResult RespondDirectorScenario(int hostActor, bool accepted, string name) { if (!PhotonNetwork.InRoom || PhotonNetwork.MasterClient == null || PhotonNetwork.MasterClient.ActorNumber != hostActor) { return ActionResult.Fail("The offering host is no longer available."); } return Send(NetCommand.DirectorScenarioResponse, hostActor, new object[2] { accepted, SafeString(name, 32) }, new int[1] { hostActor }); } private ActionResult Send(NetCommand command, int targetActor, object[] args, int[] actors, bool reliable) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom) { return ActionResult.Fail("Not in a Photon room."); } RaiseEventOptions val = new RaiseEventOptions(); val.TargetActors = actors; if (!PhotonNetwork.RaiseEvent((byte)197, (object)Pack(command, targetActor, args), val, reliable ? SendOptions.SendReliable : SendOptions.SendUnreliable)) { return ActionResult.Fail(string.Concat("Photon rejected ", command, ".")); } return ActionResult.Ok(string.Concat("Sent ", command, ".")); } private ActionResult Broadcast(NetCommand command, object[] packed, bool reliable) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom) { return ActionResult.Fail("Not in a Photon room."); } RaiseEventOptions val = new RaiseEventOptions(); val.Receivers = (ReceiverGroup)1; if (!PhotonNetwork.RaiseEvent((byte)197, (object)packed, val, reliable ? SendOptions.SendReliable : SendOptions.SendUnreliable)) { return ActionResult.Fail("Photon rejected broadcast."); } return ActionResult.Ok(string.Concat("Broadcast ", command, ".")); } private static object[] Pack(NetCommand command, int targetActor, object[] args) { return new object[4] { 12, (byte)command, targetActor, (args == null) ? new object[0] : args }; } public void OnEvent(EventData photonEvent) { if (photonEvent == null || photonEvent.Code != 197 || !PhotonNetwork.InRoom) { return; } Player val = ((PhotonNetwork.CurrentRoom == null) ? null : PhotonNetwork.CurrentRoom.GetPlayer(photonEvent.Sender, false)); if (val == null) { _log.LogWarning((object)"Rejected troll packet from unknown actor."); return; } if (!(photonEvent.CustomData is object[] array) || array.Length != 4 || !(array[0] is int) || !(array[1] is byte) || !(array[2] is int) || !(array[3] is object[])) { _log.LogWarning((object)("Rejected malformed troll packet from " + photonEvent.Sender)); return; } int num = (int)array[0]; NetCommand netCommand = (NetCommand)(byte)array[1]; if (!Enum.IsDefined(typeof(NetCommand), netCommand)) { _log.LogWarning((object)"Rejected unknown troll command."); return; } int targetActor = (int)array[2]; object[] array2 = (object[])array[3]; if (netCommand == NetCommand.Hello) { _advertisedProtocols[photonEvent.Sender] = num; string text = ((array2.Length > 1 && array2[1] is string) ? ((string)array2[1]) : string.Empty); _advertisedVersions[photonEvent.Sender] = ((text.Length > 32) ? text.Substring(0, 32) : text); _advertisedReady[photonEvent.Sender] = array2.Length > 2 && array2[2] is bool && (bool)array2[2]; _advertisedBackpackProtection[photonEvent.Sender] = num == 12 && array2.Length > 3 && array2[3] is bool && (bool)array2[3]; if (num == 12) { _compatible.Add(photonEvent.Sender); } else { _compatible.Remove(photonEvent.Sender); } } else if (num == 12) { _compatible.Add(photonEvent.Sender); try { Execute(netCommand, targetActor, array2, photonEvent.Sender); } catch (Exception ex) { _log.LogWarning((object)("Troll packet failed safely: " + ex.Message)); } } } private ActionResult Execute(NetCommand command, int targetActor, object[] args, int senderActor) { //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Unknown result type (might be due to invalid IL or missing references) //IL_055f: Unknown result type (might be due to invalid IL or missing references) //IL_0569: Unknown result type (might be due to invalid IL or missing references) //IL_085a: Unknown result type (might be due to invalid IL or missing references) //IL_0864: Unknown result type (might be due to invalid IL or missing references) //IL_08a2: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_0901: Unknown result type (might be due to invalid IL or missing references) //IL_090b: Unknown result type (might be due to invalid IL or missing references) //IL_09d0: Unknown result type (might be due to invalid IL or missing references) //IL_09d5: Unknown result type (might be due to invalid IL or missing references) //IL_09fc: Unknown result type (might be due to invalid IL or missing references) //IL_0a06: Unknown result type (might be due to invalid IL or missing references) //IL_0a0b: Unknown result type (might be due to invalid IL or missing references) //IL_0a12: Unknown result type (might be due to invalid IL or missing references) //IL_0a17: Unknown result type (might be due to invalid IL or missing references) //IL_09e5: Unknown result type (might be due to invalid IL or missing references) //IL_09ea: Unknown result type (might be due to invalid IL or missing references) switch (command) { case NetCommand.ProfileOffer: if (PhotonNetwork.MasterClient == null || senderActor != PhotonNetwork.MasterClient.ActorNumber || targetActor != senderActor) { return ActionResult.Fail("Rejected invalid profile offer authority."); } if (args == null || args.Length != 2 || !(args[0] is string) || !(args[1] is string) || ((string)args[1]).Length > 4096) { return ActionResult.Fail("Rejected malformed profile offer."); } if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.LobbyProfileSync != null) { return TrollModPlugin.Instance.LobbyProfileSync.ReceiveOffer(senderActor, SafeString((string)args[0], 32), (string)args[1]); } return ActionResult.Fail("Lobby profile sync is unavailable."); case NetCommand.ProfileResponse: if (!_players.IsHost || PhotonNetwork.LocalPlayer == null || targetActor != PhotonNetwork.LocalPlayer.ActorNumber) { return ActionResult.Fail("Rejected profile response on a non-host target."); } if (args == null || args.Length != 2 || !(args[0] is bool) || !(args[1] is string)) { return ActionResult.Fail("Rejected malformed profile response."); } if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.LobbyProfileSync != null) { return TrollModPlugin.Instance.LobbyProfileSync.ReceiveResponse(senderActor, (bool)args[0], SafeString((string)args[1], 32)); } return ActionResult.Fail("Lobby profile sync is unavailable."); case NetCommand.DirectorScenarioOffer: if (PhotonNetwork.MasterClient == null || senderActor != PhotonNetwork.MasterClient.ActorNumber || targetActor != senderActor) { return ActionResult.Fail("Rejected invalid Director scenario authority."); } if (args == null || args.Length != 2 || !(args[0] is string) || !(args[1] is string) || ((string)args[1]).Length > 512) { return ActionResult.Fail("Rejected malformed Director scenario offer."); } if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.Director != null) { return TrollModPlugin.Instance.Director.ReceiveOffer(senderActor, SafeString((string)args[0], 32), (string)args[1]); } return ActionResult.Fail("Expedition Director is unavailable."); case NetCommand.DirectorScenarioResponse: if (!_players.IsHost || PhotonNetwork.LocalPlayer == null || targetActor != PhotonNetwork.LocalPlayer.ActorNumber) { return ActionResult.Fail("Rejected Director response on a non-host target."); } if (args == null || args.Length != 2 || !(args[0] is bool) || !(args[1] is string)) { return ActionResult.Fail("Rejected malformed Director response."); } if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.Director != null) { return TrollModPlugin.Instance.Director.ReceiveResponse(senderActor, (bool)args[0], SafeString((string)args[1], 32)); } return ActionResult.Fail("Expedition Director is unavailable."); case NetCommand.SetHelicopterSuppression: if ((Object)(object)TrollModPlugin.Instance != (Object)null && TrollModPlugin.Instance.HelicopterTroll != null) { TrollModPlugin.Instance.HelicopterTroll.SetRemote(senderActor, Bool(args, 0, d: false)); } return ActionResult.Ok("Updated compatible-client helicopter suppression."); default: { PlayerEntry playerEntry = _players.Find(targetActor); if (playerEntry == null) { return ActionResult.Fail("Target left the lobby."); } switch (command) { case NetCommand.HostSpawnScoutmaster: case NetCommand.HostSpawnZombie: { if (!_players.IsHost) { return ActionResult.Fail("Ignored host request on a non-host client."); } float distance = Mathf.Clamp(Float(args, 0, 10f), 4f, 25f); if (command != NetCommand.HostSpawnScoutmaster) { return TrollModPlugin.Instance.Spawns.SpawnZombie(playerEntry, distance, senderActor); } return TrollModPlugin.Instance.Spawns.SpawnScoutmaster(playerEntry, distance, senderActor); } case NetCommand.HostClearRequestedSpawns: { if (!_players.IsHost || targetActor != senderActor) { return ActionResult.Fail("Rejected invalid cleanup request."); } int num = TrollModPlugin.Instance.Spawns.ClearForCreator(senderActor); return ActionResult.Ok("Cleared " + num + " requested spawns."); } default: if (command != NetCommand.ClearMirages && !playerEntry.IsLocal) { return ActionResult.Fail("Ignored on non-owner client."); } break; case NetCommand.Visibility: case NetCommand.Reset: case NetCommand.MirageScout: case NetCommand.FakeEnemy: break; } switch (command) { case NetCommand.Ragdoll: return _actions.RagdollLocal(playerEntry, V3(args, 0), Float(args, 3, 30f), Float(args, 4, 1.5f)); case NetCommand.Launch: return _actions.LaunchLocal(playerEntry, V3(args, 0), Float(args, 3, 35f), Bool(args, 4, d: true)); case NetCommand.Speed: return _actions.SetSpeedLocal(playerEntry, Mathf.Clamp(Float(args, 0, 1f), 0.25f, 3f)); case NetCommand.Flight: return _actions.SetFlightLocal(playerEntry, Bool(args, 0, d: false), Mathf.Clamp(Float(args, 1, 10f), 4f, 20f)); case NetCommand.Visibility: return _actions.SetVisibilityLocal(playerEntry, Bool(args, 0, d: true)); case NetCommand.Teleport: return _actions.TeleportLocal(playerEntry, Position(args, 0, playerEntry.Character.Center, 5000f)); case NetCommand.Knockout: return _actions.KnockoutLocal(playerEntry); case NetCommand.Eliminate: return _actions.EliminateLocal(playerEntry); case NetCommand.Status: return _actions.ApplyStatusLocal(playerEntry, Mathf.Clamp(Int(args, 0, 0), 0, 14), Mathf.Clamp(Float(args, 1, 0.1f), 0f, 2f)); case NetCommand.SetHungerAmplifier: return _hungerAmplifier.Set(Bool(args, 0, d: false), Mathf.Clamp(Float(args, 1, 5f), 2f, 20f)); case NetCommand.SummitSabotageVictim: if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.SummitSaboteur != null) { return TrollModPlugin.Instance.SummitSaboteur.ActivateVictim(Mathf.Clamp(Float(args, 0, 6f), 0f, 10f)); } return ActionResult.Fail("Summit Saboteur is unavailable."); case NetCommand.MindControlStart: if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.MindControl != null) { return TrollModPlugin.Instance.MindControl.ReceiveStart(senderActor, Int(args, 0, 0), Mathf.Clamp(Float(args, 1, 60f), 10f, 180f)); } return ActionResult.Fail("Mind Control is unavailable."); case NetCommand.MindControlAck: if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.MindControl != null) { return TrollModPlugin.Instance.MindControl.ReceiveAck(senderActor, Int(args, 0, 0), Bool(args, 1, d: false)); } return ActionResult.Fail("Mind Control is unavailable."); case NetCommand.MindControlInput: if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.MindControl != null) { return TrollModPlugin.Instance.MindControl.ReceiveInput(senderActor, Int(args, 0, 0), Mathf.Max(0, Int(args, 1, 0)), Mathf.Clamp(Float(args, 2, 0f), -1f, 1f), Mathf.Clamp(Float(args, 3, 0f), -1f, 1f), Mathf.Clamp(Float(args, 4, 0f), -50f, 50f), Mathf.Clamp(Float(args, 5, 0f), -50f, 50f), Mathf.Clamp(Float(args, 6, 0f), -10f, 10f), Int(args, 7, 0) & 0x7FFFFFFF); } return ActionResult.Fail("Mind Control is unavailable."); case NetCommand.MindControlStop: if (!((Object)(object)TrollModPlugin.Instance == (Object)null) && TrollModPlugin.Instance.MindControl != null) { return TrollModPlugin.Instance.MindControl.ReceiveStop(senderActor, Int(args, 0, 0)); } return ActionResult.Fail("Mind Control is unavailable."); case NetCommand.ClearStatuses: return _actions.ClearModStatusesLocal(playerEntry); case NetCommand.GiveItem: return _actions.GiveItemLocal(playerEntry, String(args, 0, string.Empty, 128)); case NetCommand.Reset: return ResetTarget(playerEntry); case NetCommand.FakeAudio: return _audio.PlayDiscovered(String(args, 0, string.Empty, 128), Position(args, 1, playerEntry.Character.Center, 50f), Mathf.Clamp(Float(args, 4, 0.8f), 0f, 1f), targetActor); case NetCommand.MirageScout: return _mirages.CreateScout(playerEntry, Int(args, 0, targetActor), Position(args, 1, playerEntry.Character.Center, 50f), (MirageBehavior)Mathf.Clamp(Int(args, 4, 0), 0, 7), Mathf.Clamp(Float(args, 5, 12f), 1f, 120f), senderActor); case NetCommand.FakeEnemy: return _mirages.CreateFakeEnemy(playerEntry, (FakeEnemyKind)Mathf.Clamp(Int(args, 0, 0), 0, 2), Position(args, 1, playerEntry.Character.Center, 50f), (MirageBehavior)Mathf.Clamp(Int(args, 4, 0), 0, 7), Mathf.Clamp(Float(args, 5, 12f), 1f, 120f), senderActor); case NetCommand.ClearMirages: _mirages.ClearAll(); return ActionResult.Ok("Mirages cleared."); case NetCommand.PhantomPings: return TrollModPlugin.Instance.PhantomPings.Start(playerEntry, (PhantomPingPattern)Mathf.Clamp(Int(args, 0, 0), 0, 2), Mathf.Clamp(Int(args, 1, 6), 3, 12), Mathf.Clamp(Float(args, 2, 1f), 0.35f, 3f)); case NetCommand.CancelPhantomPings: TrollModPlugin.Instance.PhantomPings.Cancel(); return ActionResult.Ok("Phantom Pings cancelled."); case NetCommand.MirageProp: { int kind = Mathf.Clamp(Int(args, 0, 0), 0, 2); Vector3 val = V3(args, 4); if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = Vector3.up; } return _mirages.CreateStatic((MirageKind)kind, Position(args, 1, playerEntry.Character.Center, 50f), Quaternion.FromToRotation(Vector3.up, ((Vector3)(ref val)).normalized), senderActor, targetActor); } default: return ActionResult.Fail("Unsupported command."); } } } } private static float Float(object[] a, int i, float d) { if (a == null || i >= a.Length || !(a[i] is float)) { return d; } return (float)a[i]; } private static int Int(object[] a, int i, int d) { if (a == null || i >= a.Length || !(a[i] is int)) { return d; } return (int)a[i]; } private static bool Bool(object[] a, int i, bool d) { if (a == null || i >= a.Length || !(a[i] is bool)) { return d; } return (bool)a[i]; } private static string String(object[] a, int i, string d, int max) { string text = ((a != null && i < a.Length && a[i] is string) ? ((string)a[i]) : d); if (text.Length > max) { return text.Substring(0, max); } return text; } private static string SafeString(string value, int max) { if (string.IsNullOrEmpty(value)) { return string.Empty; } value = value.Replace("\r", " ").Replace("\n", " "); if (value.Length > max) { return value.Substring(0, max); } return value; } private static Vector3 V3(object[] a, int i) { //IL_002f: 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_0037: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Float(a, i, 0f), Float(a, i + 1, 0f), Float(a, i + 2, 0f)); if (!Finite(val)) { return Vector3.zero; } return val; } private static Vector3 Position(object[] a, int i, Vector3 origin, float maxDistance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: 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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = V3(a, i); Vector3 val2 = val - origin; if (((Vector3)(ref val2)).magnitude > maxDistance) { val = origin + ((Vector3)(ref val2)).normalized * maxDistance; } return val; } private static bool Finite(Vector3 value) { if (!float.IsNaN(value.x) && !float.IsNaN(value.y) && !float.IsNaN(value.z) && !float.IsInfinity(value.x) && !float.IsInfinity(value.y)) { return !float.IsInfinity(value.z); } return false; } private ActionResult ResetTarget(PlayerEntry target) { _audio.StopForTarget(target.ActorNumber); _audio.RestoreVoice(target.ActorNumber); _mirages.ClearTarget(target.ActorNumber); if (_hungerAmplifier != null) { _hungerAmplifier.ResetTarget(target.ActorNumber); } if (TrollModPlugin.Instance.SummitSaboteur != null) { TrollModPlugin.Instance.SummitSaboteur.ResetTarget(target.ActorNumber); } if (TrollModPlugin.Instance.MindControl != null) { TrollModPlugin.Instance.MindControl.ResetTarget(target.ActorNumber); } if (target.IsLocal && TrollModPlugin.Instance.PhantomPings != null) { TrollModPlugin.Instance.PhantomPings.Cancel(); } if (target.IsLocal && _hungerAmplifier != null) { _hungerAmplifier.Set(enabled: false, 2f); } if (target.IsLocal && TrollModPlugin.Instance.SummitSaboteur != null) { TrollModPlugin.Instance.SummitSaboteur.ActivateVictim(0f); } if (TrollModPlugin.Instance.Appearance != null) { TrollModPlugin.Instance.Appearance.Restore(target); } return _actions.ResetLocal(target); } public void Dispose() { if (_registered) { PhotonNetwork.RemoveCallbackTarget((object)this); _registered = false; } } } internal sealed class ModConfigBrowser { private readonly List _plugins = new List(); public IList Plugins => _plugins.AsReadOnly(); public void Refresh() { _plugins.Clear(); foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { if (pluginInfo.Value != null && pluginInfo.Value.Metadata != null && (Object)(object)pluginInfo.Value.Instance != (Object)null) { _plugins.Add(pluginInfo.Value); } } _plugins.Sort((PluginInfo a, PluginInfo b) => string.Compare(a.Metadata.Name, b.Metadata.Name, StringComparison.OrdinalIgnoreCase)); } public bool IsEnabled(string guid) { if (Chainloader.PluginInfos.TryGetValue(guid, out var value) && value != null && (Object)(object)value.Instance != (Object)null) { return ((Behaviour)value.Instance).enabled; } return false; } public bool HasEnabledBool(string guid, string key) { if (!Chainloader.PluginInfos.TryGetValue(guid, out var value) || value == null || (Object)(object)value.Instance == (Object)null || !((Behaviour)value.Instance).enabled) { return false; } ConfigEntryBase[] configEntries = value.Instance.Config.GetConfigEntries(); for (int i = 0; i < configEntries.Length; i++) { if (configEntries[i].Definition.Key == key && configEntries[i].SettingType == typeof(bool)) { return (bool)configEntries[i].BoxedValue; } } return false; } public ActionResult SetComponentEnabled(PluginInfo info, bool enabled) { if (info == null || (Object)(object)info.Instance == (Object)null) { return ActionResult.Fail("Plugin component unavailable."); } if (info.Metadata.GUID == "com.dougl.peaktrollmod") { return ActionResult.Fail("PEAK Troll Mod cannot disable its own menu. Toggle its modules instead."); } ((Behaviour)info.Instance).enabled = enabled; return ActionResult.Ok(info.Metadata.Name + (enabled ? " component enabled for this session." : " component disabled for this session; Harmony patches may remain until restart.")); } public ActionResult SetValue(ConfigEntryBase entry, string serialized) { if (entry == null) { return ActionResult.Fail("Config setting unavailable."); } try { entry.SetSerializedValue(serialized); entry.ConfigFile.Save(); return ActionResult.Ok(entry.Definition.Section + " / " + entry.Definition.Key + " saved. Some mods require a restart to apply it."); } catch (Exception ex) { return ActionResult.Fail("Value rejected: " + ex.Message); } } public ActionResult ResetValue(ConfigEntryBase entry) { if (entry == null) { return ActionResult.Fail("Config setting unavailable."); } try { entry.BoxedValue = entry.DefaultValue; entry.ConfigFile.Save(); return ActionResult.Ok(entry.Definition.Key + " reset to its default value."); } catch (Exception ex) { return ActionResult.Fail("Reset failed: " + ex.Message); } } } internal sealed class TeamStatusManager { private readonly PlayerManager _players; private readonly ModConfig _settings; private readonly ModConfigBrowser _mods; private readonly PlayerPreferencesManager _preferences; private GUIStyle _name; private GUIStyle _detail; private Texture2D _pixel; public bool SuppressedByExternal { get { if (_settings.PreferExternalQualityOfLifeMods.Value) { return _mods.HasEnabledBool("com.github.LengSword.PeakStatsEx", "DisplayTeammateStaminaBars"); } return false; } } public TeamStatusManager(PlayerManager players, ModConfig settings, ModConfigBrowser mods, PlayerPreferencesManager preferences) { _players = players; _settings = settings; _mods = mods; _preferences = preferences; } public void Draw(bool menuOpen) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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_016e: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) if (menuOpen || !_settings.TeamStatusEnabled.Value || SuppressedByExternal || !GameHandler.IsOnIsland || _players.Local == null || (Object)(object)_players.Local.Character == (Object)null) { return; } EnsureStyles(); float num = Mathf.Clamp(_settings.TeamStatusScale.Value, 0.7f, 1.4f); Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUI.matrix = Matrix4x4.TRS(new Vector3((float)Screen.width - 330f * num - 18f, 18f, 0f), Quaternion.identity, new Vector3(num, num, 1f)); float num2 = 0f; int num3 = 0; float num4 = Mathf.Clamp(_settings.TeamStatusDistance.Value, 10f, 200f); IList entries = _players.Entries; for (int i = 0; i < entries.Count; i++) { if (num3 >= 6) { break; } PlayerEntry playerEntry = entries[i]; Character val = playerEntry?.Character; if (!((Object)(object)val == (Object)null) && !((Object)(object)val.data == (Object)null) && val.refs != null && (_settings.TeamStatusShowSelf.Value || !playerEntry.IsLocal)) { float num5 = Vector3.Distance(_players.Local.Character.Center, val.Center); if (playerEntry.IsLocal || !(num5 > num4)) { DrawCard(new Rect(0f, num2, 330f, 58f), playerEntry, num5); num2 += 64f; num3++; } } } GUI.matrix = matrix; GUI.color = color; } private void DrawCard(Rect rect, PlayerEntry entry, float distance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) Character character = entry.Character; CharacterData data = character.data; DrawRect(rect, new Color(0.025f, 0.04f, 0.043f, 0.88f)); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 4f, ((Rect)(ref rect)).height), StateColor(data)); string text = (data.dead ? "DEAD" : (data.fullyPassedOut ? "DOWN" : (data.zombified ? "ZOMBIE" : "ACTIVE"))); GUIStyle val = new GUIStyle(_name); val.normal.textColor = (_settings.HighContrast.Value ? Color.white : _preferences.DisplayColor(entry)); GUI.Label(new Rect(12f, ((Rect)(ref rect)).y + 6f, 205f, 22f), _preferences.DisplayName(entry), val); GUI.Label(new Rect(218f, ((Rect)(ref rect)).y + 7f, 100f, 20f), text + " " + distance.ToString("0") + "m", _detail); float num = Mathf.Clamp01(data.TotalStamina); DrawRect(new Rect(12f, ((Rect)(ref rect)).y + 33f, 132f, 8f), new Color(0.12f, 0.16f, 0.16f, 1f)); DrawRect(new Rect(12f, ((Rect)(ref rect)).y + 33f, 132f * num, 8f), new Color(0.26f, 0.82f, 0.7f, 1f)); GUI.Label(new Rect(151f, ((Rect)(ref rect)).y + 26f, 168f, 24f), "STA " + Mathf.RoundToInt(num * 100f) + "% " + Conditions(character), _detail); } private string Conditions(Character c) { if (c.refs == null || (Object)(object)c.refs.afflictions == (Object)null) { return ""; } string text = ""; int num = 0; STATUSTYPE[] array = (STATUSTYPE[])(object)new STATUSTYPE[8] { default(STATUSTYPE), (STATUSTYPE)1, (STATUSTYPE)2, (STATUSTYPE)3, (STATUSTYPE)5, (STATUSTYPE)8, (STATUSTYPE)10, (STATUSTYPE)13 }; for (int i = 0; i < array.Length; i++) { if (num >= 2) { break; } if (c.refs.afflictions.GetCurrentStatus(array[i]) >= 0.08f) { if (num > 0) { text += ", "; } text += ((object)array[i]).ToString(); num++; } } if (text.Length != 0) { return text; } return "OK"; } private Color StateColor(CharacterData data) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) bool value = _settings.HighContrast.Value; if (!data.dead) { if (!data.fullyPassedOut) { if (!data.zombified) { return new Color(0.1f, value ? 1f : 0.75f, value ? 0.9f : 0.7f, 1f); } return new Color(value ? 0.65f : 0.5f, 1f, 0.15f, 1f); } return new Color(1f, value ? 0.75f : 0.55f, 0.08f, 1f); } return new Color(value ? 1f : 0.8f, 0.12f, 0.12f, 1f); } private void EnsureStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_pixel != (Object)null)) { _pixel = new Texture2D(1, 1); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _name = new GUIStyle(GUI.skin.label); _name.font = UiFontManager.DisplayFont; _name.fontSize = 14; _name.fontStyle = (FontStyle)1; _name.normal.textColor = Color.white; _detail = new GUIStyle(GUI.skin.label); _detail.font = UiFontManager.BodyFont; _detail.fontSize = 11; _detail.alignment = (TextAnchor)5; _detail.normal.textColor = new Color(0.72f, 0.8f, 0.79f); } } private void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } } internal sealed class QuickBackpackManager { private readonly ManualLogSource _log; private readonly ModConfig _settings; private readonly ModConfigBrowser _mods; public bool SuppressedByExternal { get { if (_settings.PreferExternalQualityOfLifeMods.Value) { return _mods.IsEnabled("nickklmao.easybackpack"); } return false; } } public QuickBackpackManager(ManualLogSource log, ModConfig settings, ModConfigBrowser mods) { _log = log; _settings = settings; _mods = mods; } public void Tick(bool menuOpen) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (menuOpen || !_settings.QuickBackpackEnabled.Value || SuppressedByExternal) { return; } KeyboardShortcut value = _settings.QuickBackpackKey.Value; if (!((KeyboardShortcut)(ref value)).IsDown()) { return; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || (Object)(object)localCharacter.player == (Object)null || localCharacter.data.dead || localCharacter.data.fullyPassedOut || localCharacter.data.passedOut || localCharacter.data.usingWheel) { return; } try { BackpackSlot backpackSlot = localCharacter.player.backpackSlot; if (backpackSlot != null && !((ItemSlot)backpackSlot).IsEmpty() && !((Object)(object)GUIManager.instance == (Object)null)) { int num = 4; if (localCharacter.refs != null && (Object)(object)localCharacter.refs.backpackHandler != (Object)null && (Object)(object)localCharacter.refs.backpackHandler.activeBackpackVisuals != (Object)null) { num = localCharacter.refs.backpackHandler.activeBackpackVisuals.slotCount; } GUIManager.instance.OpenBackpackWheel(BackpackReference.GetFromEquippedBackpack(localCharacter), num, backpackSlot.backpackType); } } catch (Exception ex) { _log.LogWarning((object)("Quick Backpack failed safely: " + ex.Message)); } } } internal sealed class BetterSpectatingManager { private static readonly FieldInfo GodCamField = AccessTools.Field(typeof(MainCameraMovement), "isGodCam"); private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private readonly ModConfig _settings; private MainCameraMovement _camera; private float _nextFind; private GUIStyle _title; private GUIStyle _text; private Texture2D _pixel; public bool IsEligible { get { Character localCharacter = Character.localCharacter; if (_settings.BetterSpectatingEnabled.Value && (Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null) { return localCharacter.data.fullyPassedOut; } return false; } } public bool IsSpectating { get { if (IsEligible && (Object)(object)Camera != (Object)null) { return MainCameraMovement.IsSpectating; } return false; } } public Character SpectatedCharacter { get { if (!((Object)(object)Camera == (Object)null)) { return MainCameraMovement.specCharacter; } return null; } } public bool FreeCamera { get { if ((Object)(object)Camera != (Object)null && GodCamField != null) { return (bool)GodCamField.GetValue(Camera); } return false; } } private MainCameraMovement Camera { get { if ((Object)(object)_camera == (Object)null && Time.unscaledTime >= _nextFind) { _nextFind = Time.unscaledTime + 2f; _camera = Object.FindObjectOfType(); } return _camera; } } public BetterSpectatingManager(ManualLogSource log, PlayerManager players, PlayerActions actions, ModConfig settings) { _log = log; _players = players; _actions = actions; _settings = settings; } public void Tick(bool menuOpen) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) MainCameraMovement camera = Camera; if (!IsEligible) { if ((Object)(object)camera != (Object)null && FreeCamera) { SetFreeCamera(enabled: false); } } else { if (menuOpen || (Object)(object)camera == (Object)null) { return; } try { KeyboardShortcut value = _settings.SpectatePreviousKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { camera.SwapSpecPlayerLeft(); } KeyboardShortcut value2 = _settings.SpectateNextKey.Value; if (((KeyboardShortcut)(ref value2)).IsDown()) { camera.SwapSpecPlayerRight(); } KeyboardShortcut value3 = _settings.SpectateFreeCameraKey.Value; if (((KeyboardShortcut)(ref value3)).IsDown()) { SetFreeCamera(!FreeCamera); } } catch (Exception ex) { _log.LogWarning((object)("Better Spectating input failed safely: " + ex.Message)); } } } public ActionResult SetFreeCamera(bool enabled) { if (!IsEligible || (Object)(object)Camera == (Object)null || GodCamField == null) { return ActionResult.Fail("Free camera is available only while fully passed out."); } try { GodCamField.SetValue(Camera, enabled); return ActionResult.Ok(enabled ? "Spectator free camera enabled." : "Returned to the spectated scout."); } catch (Exception ex) { return ActionResult.Fail("Free camera unavailable: " + ex.Message); } } public ActionResult ReviveBesideSpectated() { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) PlayerEntry local = _players.Local; Character spectatedCharacter = SpectatedCharacter; if (local == null || (Object)(object)local.Character == (Object)null || (Object)(object)spectatedCharacter == (Object)null || (Object)(object)spectatedCharacter.data == (Object)null || (Object)(object)spectatedCharacter == (Object)(object)local.Character) { return ActionResult.Fail("No other spectated scout is available."); } Vector3 value = spectatedCharacter.data.lookDirection_Right; value.y = 0f; if (!PlayerActions.Finite(value) || ((Vector3)(ref value)).sqrMagnitude < 0.01f) { value = Vector3.right; } if (!PlayerActions.TrySafePosition(spectatedCharacter.Center + ((Vector3)(ref value)).normalized * 1.5f, out var safe)) { return ActionResult.Fail("No safe ground was found beside the spectated scout."); } SetFreeCamera(enabled: false); ActionResult actionResult = _actions.ResurrectLocal(local, safe, applyPostReviveStatus: false); if (actionResult.Success) { _actions.HaltVelocityLocal(local); } if (!actionResult.Success) { return actionResult; } return ActionResult.Ok("Revived beside " + spectatedCharacter.characterName + "."); } public void OnSceneLoaded() { _camera = null; _nextFind = 0f; } public void Draw(bool menuOpen) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: 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_0210: Unknown result type (might be due to invalid IL or missing references) if (!menuOpen && _settings.SpectateOverlay.Value && IsSpectating && !FreeCamera) { Character spectatedCharacter = SpectatedCharacter; if (!((Object)(object)spectatedCharacter == (Object)null) && !((Object)(object)spectatedCharacter.data == (Object)null)) { EnsureStyles(); Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - 520f) * 0.5f, (float)Screen.height - 112f, 520f, 86f); Color color = GUI.color; GUI.color = new Color(0.025f, 0.04f, 0.043f, 0.9f); GUI.DrawTexture(val, (Texture)(object)_pixel); GUI.color = color; string text = (string.IsNullOrEmpty(spectatedCharacter.characterName) ? "Scout" : spectatedCharacter.characterName); string text2 = (spectatedCharacter.data.dead ? "Dead" : (spectatedCharacter.data.zombified ? "Zombie" : (spectatedCharacter.data.fullyPassedOut ? "Passed out" : "Alive"))); GUI.Label(new Rect(((Rect)(ref val)).x + 16f, ((Rect)(ref val)).y + 8f, 488f, 26f), "SPECTATING " + text, _title); Rect val2 = new Rect(((Rect)(ref val)).x + 16f, ((Rect)(ref val)).y + 35f, 488f, 42f); object[] array = new object[11] { "Altitude ", null, null, null, null, null, null, null, null, null, null }; float y = spectatedCharacter.Center.y; array[1] = y.ToString("0"); array[2] = "m • "; array[3] = text2; array[4] = "\n"; array[5] = _settings.SpectatePreviousKey.Value; array[6] = "/"; array[7] = _settings.SpectateNextKey.Value; array[8] = " cycle • "; array[9] = _settings.SpectateFreeCameraKey.Value; array[10] = " free cam • F7 revive controls"; GUI.Label(val2, string.Concat(array), _text); } } } private void EnsureStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0091: 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_00b0: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_pixel != (Object)null)) { _pixel = new Texture2D(1, 1); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _title = new GUIStyle(GUI.skin.label); _title.font = UiFontManager.DisplayFont; _title.fontSize = 15; _title.fontStyle = (FontStyle)1; _title.normal.textColor = new Color(0.4f, 0.95f, 0.86f); _text = new GUIStyle(GUI.skin.label); _text.font = UiFontManager.BodyFont; _text.fontSize = 12; _text.normal.textColor = new Color(0.82f, 0.88f, 0.87f); } } } internal sealed class PlayerPreference { public ulong SteamId; public string Alias = string.Empty; public float VoiceVolume = 1f; public bool Muted; public bool ExcludeFromRandom; public Color Color = new Color(0.35f, 0.85f, 0.78f, 1f); public PlayerPreference Clone() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) PlayerPreference playerPreference = new PlayerPreference(); playerPreference.SteamId = SteamId; playerPreference.Alias = Alias; playerPreference.VoiceVolume = VoiceVolume; playerPreference.Muted = Muted; playerPreference.ExcludeFromRandom = ExcludeFromRandom; playerPreference.Color = Color; return playerPreference; } } internal sealed class PlayerPreferencesManager { private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly AudioManager _audio; private readonly ModConfig _settings; private readonly Dictionary _saved = new Dictionary(); private float _nextApply; public PlayerPreferencesManager(ManualLogSource log, PlayerManager players, AudioManager audio, ModConfig settings) { _log = log; _players = players; _audio = audio; _settings = settings; Load(); _players.ExcludeFromRandom = IsExcluded; } public PlayerPreference Get(PlayerEntry entry) { if (entry != null && entry.SteamUserId != 0 && _saved.TryGetValue(entry.SteamUserId, out var value)) { return value.Clone(); } PlayerPreference playerPreference = new PlayerPreference(); playerPreference.SteamId = entry?.SteamUserId ?? 0; return playerPreference; } public string DisplayName(PlayerEntry entry) { if (entry == null || entry.SteamUserId == 0 || !_saved.TryGetValue(entry.SteamUserId, out var value) || string.IsNullOrEmpty(value.Alias)) { if (entry != null) { return entry.Name; } return "Unknown"; } return value.Alias; } public Color DisplayColor(PlayerEntry entry) { //IL_0036: 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) if (entry == null || entry.SteamUserId == 0 || !_saved.TryGetValue(entry.SteamUserId, out var value)) { return new Color(0.35f, 0.85f, 0.78f, 1f); } return value.Color; } public bool IsExcluded(PlayerEntry entry) { if (entry != null && entry.SteamUserId != 0 && _saved.TryGetValue(entry.SteamUserId, out var value)) { return value.ExcludeFromRandom; } return false; } public ActionResult Save(PlayerEntry entry, PlayerPreference value) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) if (entry == null || entry.SteamUserId == 0) { return ActionResult.Fail("This player's Steam identity is not available yet."); } value.SteamId = entry.SteamUserId; value.VoiceVolume = Mathf.Clamp01(value.VoiceVolume); value.Alias = (value.Alias ?? string.Empty).Trim(); if (value.Alias.Length > 24) { value.Alias = value.Alias.Substring(0, 24); } value.Color = new Color(Mathf.Clamp01(value.Color.r), Mathf.Clamp01(value.Color.g), Mathf.Clamp01(value.Color.b), 1f); _saved[value.SteamId] = value.Clone(); Persist(); Apply(entry, value); return ActionResult.Ok("Saved local preferences for " + entry.Name + "."); } public ActionResult Reset(PlayerEntry entry) { if (entry == null || entry.SteamUserId == 0) { return ActionResult.Fail("This player's Steam identity is not available yet."); } _saved.Remove(entry.SteamUserId); Persist(); _audio.RestoreVoice(entry.ActorNumber); return ActionResult.Ok("Removed saved preferences for " + entry.Name + "."); } public void Tick() { if (Time.unscaledTime < _nextApply) { return; } _nextApply = Time.unscaledTime + 2f; for (int i = 0; i < _players.Entries.Count; i++) { PlayerEntry playerEntry = _players.Entries[i]; if (playerEntry != null && playerEntry.SteamUserId != 0 && _saved.TryGetValue(playerEntry.SteamUserId, out var value)) { Apply(playerEntry, value); } } } private void Apply(PlayerEntry entry, PlayerPreference value) { if (!entry.IsLocal) { _audio.SetIncomingVoicePreference(entry, value.VoiceVolume, value.Muted); } } private void Persist() { List list = new List(); foreach (KeyValuePair item in _saved) { PlayerPreference value = item.Value; string text = Convert.ToBase64String(Encoding.UTF8.GetBytes(value.Alias ?? string.Empty)); list.Add(item.Key + "," + value.VoiceVolume.ToString("0.###", CultureInfo.InvariantCulture) + "," + (value.Muted ? "1" : "0") + "," + (value.ExcludeFromRandom ? "1" : "0") + "," + value.Color.r.ToString("0.###", CultureInfo.InvariantCulture) + "," + value.Color.g.ToString("0.###", CultureInfo.InvariantCulture) + "," + value.Color.b.ToString("0.###", CultureInfo.InvariantCulture) + "," + text); } _settings.PlayerPreferencesData.Value = string.Join(";", list.ToArray()); } private void Load() { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) try { string[] array = (_settings.PlayerPreferencesData.Value ?? string.Empty).Split(new char[1] { ';' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string[] array2 = array[i].Split(new char[1] { ',' }); if (array2.Length == 8 && ulong.TryParse(array2[0], out var result) && float.TryParse(array2[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array2[4], NumberStyles.Float, CultureInfo.InvariantCulture, out var result3) && float.TryParse(array2[5], NumberStyles.Float, CultureInfo.InvariantCulture, out var result4) && float.TryParse(array2[6], NumberStyles.Float, CultureInfo.InvariantCulture, out var result5)) { _saved[result] = new PlayerPreference { SteamId = result, VoiceVolume = Mathf.Clamp01(result2), Muted = (array2[2] == "1"), ExcludeFromRandom = (array2[3] == "1"), Color = new Color(Mathf.Clamp01(result3), Mathf.Clamp01(result4), Mathf.Clamp01(result5), 1f), Alias = Encoding.UTF8.GetString(Convert.FromBase64String(array2[7])) }; } } } catch (Exception ex) { _saved.Clear(); _log.LogWarning((object)("Player preferences could not be loaded: " + ex.Message)); } } } internal sealed class LobbyReadinessManager { private readonly PlayerManager _players; private int _hostActor; private int _hostChanges; public string HostName { get { PlayerEntry playerEntry = _players.Find(_hostActor); if (playerEntry != null) { return playerEntry.Name; } if (PhotonNetwork.MasterClient != null) { return PhotonNetwork.MasterClient.NickName; } return "Unavailable"; } } public string HostMigration { get { if (_hostChanges != 0) { return "Changed " + _hostChanges + ((_hostChanges == 1) ? " time" : " times"); } return "Stable"; } } public string LobbyCode { get { try { IMatchmakingAPI matchmaking = NetCode.Matchmaking; return (matchmaking == null || !matchmaking.InLobby) ? string.Empty : matchmaking.LobbyId; } catch { return string.Empty; } } } public LobbyReadinessManager(PlayerManager players) { _players = players; } public void Tick() { if (!PhotonNetwork.InRoom) { _hostActor = 0; _hostChanges = 0; return; } int num = ((PhotonNetwork.MasterClient != null) ? PhotonNetwork.MasterClient.ActorNumber : 0); if (_hostActor != 0 && num != 0 && num != _hostActor) { _hostChanges++; } _hostActor = num; } public string Readiness(PlayerEntry entry) { if (entry == null || (Object)(object)entry.Character == (Object)null) { return "NOT LOADED"; } if (!entry.Character.IsInitialized) { return "LOADING"; } return "LOADED"; } } internal sealed class ActionShortcutManager { private const int RecentLimit = 8; private readonly ConfigEntry _favoriteItems; private readonly ConfigEntry _recentItems; private readonly ConfigEntry _favoriteEffects; private readonly ConfigEntry _recentEffects; public IList FavoriteItems => Parse(_favoriteItems.Value); public IList RecentItems => Parse(_recentItems.Value); public IList FavoriteEffects => Parse(_favoriteEffects.Value); public IList RecentEffects => Parse(_recentEffects.Value); public ActionShortcutManager(ModConfig settings) { _favoriteItems = settings.FavoriteItemsData; _recentItems = settings.RecentItemsData; _favoriteEffects = settings.FavoriteEffectsData; _recentEffects = settings.RecentEffectsData; } public bool IsFavoriteItem(string name) { return Contains(Parse(_favoriteItems.Value), name); } public bool IsFavoriteEffect(string name) { return Contains(Parse(_favoriteEffects.Value), name); } public bool ToggleFavoriteItem(string name) { return Toggle(_favoriteItems, name); } public bool ToggleFavoriteEffect(string name) { return Toggle(_favoriteEffects, name); } public void RecordItem(string name) { Record(_recentItems, name); } public void RecordEffect(string name) { Record(_recentEffects, name); } private static bool Toggle(ConfigEntry entry, string value) { List list = Parse(entry.Value); int num = Find(list, value); if (num >= 0) { list.RemoveAt(num); entry.Value = Join(list); return false; } if (!string.IsNullOrEmpty(value)) { list.Add(value.Trim()); } entry.Value = Join(list); return true; } private static void Record(ConfigEntry entry, string value) { if (!string.IsNullOrEmpty(value)) { List list = Parse(entry.Value); int num = Find(list, value); if (num >= 0) { list.RemoveAt(num); } list.Insert(0, value.Trim()); while (list.Count > 8) { list.RemoveAt(list.Count - 1); } entry.Value = Join(list); } } private static bool Contains(List values, string value) { return Find(values, value) >= 0; } private static int Find(List values, string value) { for (int i = 0; i < values.Count; i++) { if (string.Equals(values[i], value, StringComparison.OrdinalIgnoreCase)) { return i; } } return -1; } private static List Parse(string value) { List list = new List(); if (string.IsNullOrEmpty(value)) { return list; } string[] array = value.Split(new char[1] { '\n' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (!string.IsNullOrEmpty(text) && !Contains(list, text)) { list.Add(text); } } return list; } private static string Join(List values) { return string.Join("\n", values.ToArray()); } } internal sealed class ProfileManager { private const string Prefix = "PTM1."; private readonly ModConfig _settings; public string ActiveName { get { if (!string.IsNullOrEmpty(_settings.ActiveProfileName.Value)) { return _settings.ActiveProfileName.Value; } return "Custom"; } } public string SavedCode => _settings.SavedProfileCode.Value ?? string.Empty; public ProfileManager(ModConfig settings) { _settings = settings; } public ActionResult ApplyPreset(string name) { if (name != "Vanilla+" && name != "Accessibility" && name != "Large Lobby" && name != "Practice") { return ActionResult.Fail("Unknown profile preset."); } ApplySafeBaseline(); switch (name) { case "Vanilla+": _settings.ScoutCompassEnabled.Value = true; break; case "Accessibility": _settings.ScoutCompassEnabled.Value = true; _settings.HighContrast.Value = true; _settings.TextScale.Value = 1.15f; _settings.CameraShakeScale.Value = 0f; _settings.ReduceFlashingEffects.Value = true; _settings.TeamStatusDistance.Value = 90f; break; case "Large Lobby": _settings.ScoutCompassEnabled.Value = true; _settings.TeamStatusDistance.Value = 120f; _settings.UnlimitedLobbyEnabled.Value = true; _settings.UnlimitedLobbyMaxPlayers.Value = 12; _settings.UnlimitedLobbyScaleSupplies.Value = true; _settings.UnlimitedLobbyExtraFood.Value = true; _settings.UnlimitedLobbyExtraBackpacks.Value = true; break; case "Practice": _settings.ScoutCompassEnabled.Value = true; _settings.RealLuggageDirectionsEnabled.Value = true; _settings.LuggageEspEnabled.Value = true; _settings.ImmortalityEnabled.Value = true; _settings.InfiniteStaminaEnabled.Value = true; _settings.InfiniteJetpackFuelEnabled.Value = true; _settings.InfiniteRescueClawReachEnabled.Value = true; break; } _settings.ActiveProfileName.Value = name; _settings.SavedProfileCode.Value = Encode(name); return ActionResult.Ok(name + " profile applied."); } public ActionResult SaveCurrent(string name) { name = CleanName(name); _settings.ActiveProfileName.Value = name; _settings.SavedProfileCode.Value = Encode(name); return ActionResult.Ok("Saved current settings as " + name + "."); } public ActionResult ImportAndApply(string code) { if (!TryDecode(code, out var name, out var payload)) { return ActionResult.Fail("That profile code is invalid or from an unsupported format."); } try { string[] array = payload.Split(new char[1] { ';' }); for (int i = 0; i < array.Length; i++) { int num = array[i].IndexOf('='); if (num > 0) { ApplyValue(array[i].Substring(0, num), array[i].Substring(num + 1)); } } _settings.ActiveProfileName.Value = name; _settings.SavedProfileCode.Value = code.Trim(); return ActionResult.Ok("Applied profile " + name + "."); } catch { return ActionResult.Fail("The profile was valid but contained an unsupported setting value."); } } public bool ValidateCode(string code, out string name) { string payload; return TryDecode(code, out name, out payload); } private void ApplySafeBaseline() { _settings.NoWaitEnabled.Value = true; _settings.TeamStatusEnabled.Value = true; _settings.QuickBackpackEnabled.Value = true; _settings.BetterSpectatingEnabled.Value = true; _settings.StaminaEffectPreviewEnabled.Value = true; _settings.ClimbForecastEnabled.Value = true; _settings.PartySupplyAdvisorEnabled.Value = true; _settings.HotkeyConflictDoctorEnabled.Value = true; _settings.HighContrast.Value = false; _settings.TextScale.Value = 1f; _settings.CameraShakeScale.Value = 1f; _settings.ReduceFlashingEffects.Value = false; _settings.TeamStatusDistance.Value = 45f; _settings.ScoutCompassEnabled.Value = false; _settings.ScoutEspEnabled.Value = false; _settings.LuggageEspEnabled.Value = false; _settings.ZombieEspEnabled.Value = false; _settings.ScoutmasterEspEnabled.Value = false; _settings.EspLabelsEnabled.Value = true; _settings.EspTracersEnabled.Value = false; _settings.RealLuggageDirectionsEnabled.Value = false; _settings.ImmortalityEnabled.Value = false; _settings.InfiniteStaminaEnabled.Value = false; _settings.InfiniteJetpackFuelEnabled.Value = false; _settings.InfiniteRescueClawReachEnabled.Value = false; _settings.UnlimitedLobbyEnabled.Value = false; } private string Encode(string name) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("name=").Append(Uri.EscapeDataString(CleanName(name))); Add(stringBuilder, "nw", _settings.NoWaitEnabled.Value); Add(stringBuilder, "ts", _settings.TeamStatusEnabled.Value); Add(stringBuilder, "td", _settings.TeamStatusDistance.Value); Add(stringBuilder, "qb", _settings.QuickBackpackEnabled.Value); Add(stringBuilder, "bs", _settings.BetterSpectatingEnabled.Value); Add(stringBuilder, "ep", _settings.StaminaEffectPreviewEnabled.Value); Add(stringBuilder, "cf", _settings.ClimbForecastEnabled.Value); Add(stringBuilder, "ps", _settings.PartySupplyAdvisorEnabled.Value); Add(stringBuilder, "hk", _settings.HotkeyConflictDoctorEnabled.Value); Add(stringBuilder, "hc", _settings.HighContrast.Value); Add(stringBuilder, "tx", _settings.TextScale.Value); Add(stringBuilder, "cs", _settings.CameraShakeScale.Value); Add(stringBuilder, "rf", _settings.ReduceFlashingEffects.Value); Add(stringBuilder, "sc", _settings.ScoutCompassEnabled.Value); Add(stringBuilder, "se", _settings.ScoutEspEnabled.Value); Add(stringBuilder, "le", _settings.LuggageEspEnabled.Value); Add(stringBuilder, "ze", _settings.ZombieEspEnabled.Value); Add(stringBuilder, "me", _settings.ScoutmasterEspEnabled.Value); Add(stringBuilder, "el", _settings.EspLabelsEnabled.Value); Add(stringBuilder, "et", _settings.EspTracersEnabled.Value); Add(stringBuilder, "ed", _settings.EspMaximumDistance.Value); Add(stringBuilder, "ew", _settings.EspOutlineWidth.Value); Add(stringBuilder, "rd", _settings.RealLuggageDirectionsEnabled.Value); Add(stringBuilder, "im", _settings.ImmortalityEnabled.Value); Add(stringBuilder, "is", _settings.InfiniteStaminaEnabled.Value); Add(stringBuilder, "jf", _settings.InfiniteJetpackFuelEnabled.Value); Add(stringBuilder, "rc", _settings.InfiniteRescueClawReachEnabled.Value); Add(stringBuilder, "ul", _settings.UnlimitedLobbyEnabled.Value); Add(stringBuilder, "um", _settings.UnlimitedLobbyMaxPlayers.Value); Add(stringBuilder, "us", _settings.UnlimitedLobbyScaleSupplies.Value); Add(stringBuilder, "uf", _settings.UnlimitedLobbyExtraFood.Value); Add(stringBuilder, "ub", _settings.UnlimitedLobbyExtraBackpacks.Value); return "PTM1." + Convert.ToBase64String(Encoding.UTF8.GetBytes(stringBuilder.ToString())); } private static void Add(StringBuilder b, string key, bool value) { b.Append(';').Append(key).Append('=') .Append(value ? '1' : '0'); } private static void Add(StringBuilder b, string key, int value) { b.Append(';').Append(key).Append('=') .Append(value.ToString(CultureInfo.InvariantCulture)); } private static void Add(StringBuilder b, string key, float value) { b.Append(';').Append(key).Append('=') .Append(value.ToString("0.###", CultureInfo.InvariantCulture)); } private bool TryDecode(string code, out string name, out string payload) { name = string.Empty; payload = string.Empty; if (string.IsNullOrEmpty(code)) { return false; } code = code.Trim(); if (code.Length > 4096 || !code.StartsWith("PTM1.", StringComparison.Ordinal)) { return false; } try { byte[] bytes = Convert.FromBase64String(code.Substring("PTM1.".Length)); payload = Encoding.UTF8.GetString(bytes); if (payload.Length > 3000 || !payload.StartsWith("name=", StringComparison.Ordinal)) { return false; } int num = payload.IndexOf(';'); string stringToUnescape = ((num < 0) ? payload.Substring(5) : payload.Substring(5, num - 5)); name = CleanName(Uri.UnescapeDataString(stringToUnescape)); return !string.IsNullOrEmpty(name); } catch { return false; } } private void ApplyValue(string key, string value) { bool value2 = value == "1"; float.TryParse(value, NumberStyles.Float, CultureInfo.InvariantCulture, out var result); int.TryParse(value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result2); switch (key) { case "nw": _settings.NoWaitEnabled.Value = value2; break; case "ts": _settings.TeamStatusEnabled.Value = value2; break; case "td": _settings.TeamStatusDistance.Value = Mathf.Clamp(result, 10f, 200f); break; case "qb": _settings.QuickBackpackEnabled.Value = value2; break; case "bs": _settings.BetterSpectatingEnabled.Value = value2; break; case "ep": _settings.StaminaEffectPreviewEnabled.Value = value2; break; case "cf": _settings.ClimbForecastEnabled.Value = value2; break; case "ps": _settings.PartySupplyAdvisorEnabled.Value = value2; break; case "hk": _settings.HotkeyConflictDoctorEnabled.Value = value2; break; case "hc": _settings.HighContrast.Value = value2; break; case "tx": _settings.TextScale.Value = Mathf.Clamp(result, 0.85f, 1.3f); break; case "cs": _settings.CameraShakeScale.Value = Mathf.Clamp01(result); break; case "rf": _settings.ReduceFlashingEffects.Value = value2; break; case "sc": _settings.ScoutCompassEnabled.Value = value2; break; case "se": _settings.ScoutEspEnabled.Value = value2; break; case "le": _settings.LuggageEspEnabled.Value = value2; break; case "ze": _settings.ZombieEspEnabled.Value = value2; break; case "me": _settings.ScoutmasterEspEnabled.Value = value2; break; case "el": _settings.EspLabelsEnabled.Value = value2; break; case "et": _settings.EspTracersEnabled.Value = value2; break; case "ed": _settings.EspMaximumDistance.Value = Mathf.Clamp(result, 25f, 2000f); break; case "ew": _settings.EspOutlineWidth.Value = Mathf.Clamp(result, 1f, 8f); break; case "rd": _settings.RealLuggageDirectionsEnabled.Value = value2; break; case "im": _settings.ImmortalityEnabled.Value = value2; break; case "is": _settings.InfiniteStaminaEnabled.Value = value2; break; case "jf": _settings.InfiniteJetpackFuelEnabled.Value = value2; break; case "rc": _settings.InfiniteRescueClawReachEnabled.Value = value2; break; case "ul": _settings.UnlimitedLobbyEnabled.Value = value2; break; case "um": _settings.UnlimitedLobbyMaxPlayers.Value = Mathf.Clamp(result2, 4, 30); break; case "us": _settings.UnlimitedLobbyScaleSupplies.Value = value2; break; case "uf": _settings.UnlimitedLobbyExtraFood.Value = value2; break; case "ub": _settings.UnlimitedLobbyExtraBackpacks.Value = value2; break; } } private static string CleanName(string value) { if (string.IsNullOrEmpty(value)) { return "Custom"; } value = value.Trim(); if (value.Length > 32) { value = value.Substring(0, 32); } return value.Replace("\r", " ").Replace("\n", " "); } } internal sealed class LobbyProfileSyncManager { private readonly ProfileManager _profiles; private readonly PlayerManager _players; private TrollNetworkManager _network; private readonly Dictionary _responses = new Dictionary(); private string _pendingName = string.Empty; private string _pendingCode = string.Empty; private int _pendingHost; public bool HasPendingOffer => !string.IsNullOrEmpty(_pendingCode); public string PendingName => _pendingName; public string Status { get { if (!HasPendingOffer) { if (!_players.IsHost) { return "No pending host profile offer"; } return ResponseSummary(); } return "Host offered profile: " + _pendingName; } } public LobbyProfileSyncManager(ProfileManager profiles, PlayerManager players) { _profiles = profiles; _players = players; } public void AttachNetwork(TrollNetworkManager network) { _network = network; } public ActionResult Offer(string name) { if (!_players.IsHost) { return ActionResult.Fail("Only the current host can offer a lobby profile."); } ActionResult actionResult = _profiles.SaveCurrent(name); if (!actionResult.Success) { return actionResult; } _responses.Clear(); return _network.OfferLobbyProfile(_profiles.ActiveName, _profiles.SavedCode); } public ActionResult ReceiveOffer(int senderActor, string name, string code) { if (!PhotonNetwork.InRoom || PhotonNetwork.MasterClient == null || senderActor != PhotonNetwork.MasterClient.ActorNumber) { return ActionResult.Fail("Rejected profile offer from a non-host sender."); } if (!_profiles.ValidateCode(code, out var name2)) { return ActionResult.Fail("Rejected invalid lobby profile code."); } _pendingHost = senderActor; _pendingName = name2; _pendingCode = code; return ActionResult.Ok("Lobby host offered profile " + name2 + ". Review it on Profiles."); } public ActionResult Accept() { if (!HasPendingOffer) { return ActionResult.Fail("No host profile offer is pending."); } string pendingName = _pendingName; ActionResult actionResult = _profiles.ImportAndApply(_pendingCode); if (actionResult.Success && _network != null) { _network.RespondLobbyProfile(_pendingHost, accepted: true, pendingName); } ClearPending(); return actionResult; } public ActionResult Decline() { if (!HasPendingOffer) { return ActionResult.Fail("No host profile offer is pending."); } string pendingName = _pendingName; if (_network != null) { _network.RespondLobbyProfile(_pendingHost, accepted: false, pendingName); } ClearPending(); return ActionResult.Ok("Declined profile " + pendingName + "."); } public ActionResult ReceiveResponse(int senderActor, bool accepted, string name) { if (!_players.IsHost) { return ActionResult.Fail("Ignored profile response on a non-host client."); } PlayerEntry playerEntry = _players.Find(senderActor); if (playerEntry == null) { return ActionResult.Fail("Profile respondent left the lobby."); } _responses[senderActor] = (accepted ? "Accepted " : "Declined ") + name; return ActionResult.Ok(playerEntry.Name + " " + (accepted ? "accepted." : "declined.")); } public void Tick() { if (!PhotonNetwork.InRoom) { Reset(); } else if (HasPendingOffer && (PhotonNetwork.MasterClient == null || PhotonNetwork.MasterClient.ActorNumber != _pendingHost)) { ClearPending(); } } public void Reset() { ClearPending(); _responses.Clear(); } private void ClearPending() { _pendingHost = 0; _pendingName = string.Empty; _pendingCode = string.Empty; } private string ResponseSummary() { int num = 0; int num2 = 0; foreach (KeyValuePair response in _responses) { if (response.Value.StartsWith("Accepted", StringComparison.Ordinal)) { num++; } else { num2++; } } if (_responses.Count != 0) { return num + " accepted • " + num2 + " declined"; } return "No responses to the latest offer"; } } internal enum SoftlockRepair { None, LastSafe, SafeScout, Checkpoint, Start, Stabilize, Restore } internal sealed class SoftlockIssue { public string Title; public string Detail; public string RepairLabel; public SoftlockRepair Repair; } internal sealed class AntiSoftlockManager { private readonly PlayerManager _players; private readonly RecoveryManager _recovery; private readonly ModConfig _settings; private readonly ManualLogSource _log; private readonly List _issues = new List(); private Character _tracked; private Vector3 _samplePosition; private float _lastMovementTime; private float _nextScan; private float _uninitializedSince; private float _incapacitatedSince; private bool _wasIncapacitated; public bool Enabled { get { return _settings.AntiSoftlockDoctorEnabled.Value; } set { _settings.AntiSoftlockDoctorEnabled.Value = value; if (!value) { _issues.Clear(); } } } public float DetectionDelay { get { return Mathf.Clamp(_settings.AntiSoftlockDetectionDelay.Value, 6f, 30f); } set { _settings.AntiSoftlockDetectionDelay.Value = Mathf.Clamp(value, 6f, 30f); } } public IList Issues => _issues.AsReadOnly(); public string Status { get { if (Enabled) { if (_issues.Count != 0) { return _issues.Count + " recovery recommendation" + ((_issues.Count == 1) ? "" : "s"); } return "No likely softlock detected"; } return "Diagnostics disabled"; } } public AntiSoftlockManager(PlayerManager players, RecoveryManager recovery, ModConfig settings, ManualLogSource log) { _players = players; _recovery = recovery; _settings = settings; _log = log; } public void Tick() { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) if (!Enabled || Time.unscaledTime < _nextScan) { return; } _nextScan = Time.unscaledTime + 0.5f; _issues.Clear(); PlayerEntry local = _players.Local; if (local == null || (Object)(object)local.Character == (Object)null) { Add("Scout not loaded", "The local scout object is unavailable. Wait for loading to finish; if it persists, reconnect.", "NO AUTOMATIC FIX", SoftlockRepair.None); return; } Character character = local.Character; if ((Object)(object)_tracked != (Object)(object)character) { _tracked = character; _samplePosition = character.Center; _lastMovementTime = Time.unscaledTime; _uninitializedSince = Time.unscaledTime; } if (!character.IsInitialized) { if (Time.unscaledTime - _uninitializedSince > DetectionDelay) { Add("Initialization stalled", "The local scout has not initialized within the expected window. Reconnecting is safer than mutating a partially loaded character.", "RECONNECT REQUIRED", SoftlockRepair.None); } return; } if (!PlayerActions.Finite(character.Center)) { Add("Invalid position", "The local scout position contains invalid coordinates.", "RECOVER TO CHECKPOINT", SoftlockRepair.Checkpoint); return; } CharacterData data = character.data; if ((Object)(object)data == (Object)null) { return; } if (data.dead || data.fullyPassedOut) { if (!_wasIncapacitated) { _incapacitatedSince = Time.unscaledTime; } _wasIncapacitated = true; if (Time.unscaledTime - _incapacitatedSince > DetectionDelay) { Add("Unable to rejoin play", "Your scout has remained dead or fully passed out. Recovery can revive you at a safe teammate or checkpoint.", "REVIVE NEAR TEAM", SoftlockRepair.SafeScout); } return; } _wasIncapacitated = false; if (data.isGrounded || data.isClimbingAnything || data.isInWater) { _samplePosition = character.Center; _lastMovementTime = Time.unscaledTime; return; } Vector3 val = character.Center - _samplePosition; if (((Vector3)(ref val)).sqrMagnitude > 0.16f) { _samplePosition = character.Center; _lastMovementTime = Time.unscaledTime; } if (Time.unscaledTime - _lastMovementTime > DetectionDelay) { Add("Motionless off ground", "Your scout has barely moved while neither grounded, climbing, nor swimming.", _recovery.HasLastSafePosition ? "LAST SAFE GROUND" : "NEAREST SAFE SCOUT", _recovery.HasLastSafePosition ? SoftlockRepair.LastSafe : SoftlockRepair.SafeScout); } } public ActionResult Repair(int index) { if (index < 0 || index >= _issues.Count) { return ActionResult.Fail("That diagnostic is no longer active."); } ActionResult actionResult; switch (_issues[index].Repair) { case SoftlockRepair.None: return ActionResult.Fail("This state needs a reconnect rather than an automatic mutation."); case SoftlockRepair.LastSafe: actionResult = _recovery.RecoverLastSafeGround(); break; case SoftlockRepair.SafeScout: actionResult = _recovery.RecoverNearestScout(); if (!actionResult.Success) { actionResult = _recovery.RecoverCheckpoint(); } if (!actionResult.Success) { actionResult = _recovery.RecoverStart(); } break; case SoftlockRepair.Checkpoint: actionResult = _recovery.RecoverCheckpoint(); if (!actionResult.Success) { actionResult = _recovery.RecoverStart(); } break; case SoftlockRepair.Start: actionResult = _recovery.RecoverStart(); break; case SoftlockRepair.Stabilize: actionResult = _recovery.StabilizeSelf(); break; default: actionResult = _recovery.RestoreSelf(); break; } if (actionResult.Success) { _lastMovementTime = Time.unscaledTime; _issues.Clear(); _log.LogInfo((object)"Anti-Softlock Doctor applied an explicitly confirmed repair."); } return actionResult; } public void ResetScene() { _issues.Clear(); _tracked = null; _lastMovementTime = Time.unscaledTime; _uninitializedSince = Time.unscaledTime; _incapacitatedSince = 0f; _wasIncapacitated = false; } private void Add(string title, string detail, string label, SoftlockRepair repair) { _issues.Add(new SoftlockIssue { Title = title, Detail = detail, RepairLabel = label, Repair = repair }); } } internal sealed class UnlimitedLobbyManager { private sealed class ProvisionState { public int Food; public int Backpacks; } private readonly ManualLogSource _log; private readonly ModConfig _settings; private readonly PlayerActions _actions; private readonly SpawnManager _spawns; private readonly Dictionary _provisions = new Dictionary(); private float _nextScan; internal static UnlimitedLobbyManager Current; public bool StandaloneDetected { get { foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { PluginInfo value = pluginInfo.Value; if (value != null && value.Metadata != null && !(value.Metadata.GUID == "com.dougl.peaktrollmod")) { string text = (value.Metadata.GUID + " " + value.Metadata.Name + " " + (((Object)(object)value.Instance == (Object)null) ? string.Empty : ((object)value.Instance).GetType().Assembly.GetName().Name)).Replace(" ", string.Empty); if (text.IndexOf("PEAKUnlimited", StringComparison.OrdinalIgnoreCase) >= 0) { return true; } } } return false; } } public bool Active { get { if (_settings.UnlimitedLobbyEnabled.Value) { return !StandaloneDetected; } return false; } } public int MaxPlayers => Mathf.Clamp(_settings.UnlimitedLobbyMaxPlayers.Value, 4, 30); public string Status { get { if (!StandaloneDetected) { if (!Active) { return "Off"; } return "Enabled for the next hosted lobby"; } return "Yielding to standalone PEAK Unlimited"; } } public UnlimitedLobbyManager(ManualLogSource log, ModConfig settings, PlayerActions actions, SpawnManager spawns) { _log = log; _settings = settings; _actions = actions; _spawns = spawns; Current = this; } public void Tick() { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) if (!Active || !_settings.UnlimitedLobbyScaleSupplies.Value || !PhotonNetwork.InRoom || !PhotonNetwork.IsMasterClient || PhotonNetwork.CurrentRoom == null || Time.unscaledTime < _nextScan) { return; } _nextScan = Time.unscaledTime + 2f; int num = Mathf.Max(0, PhotonNetwork.CurrentRoom.PlayerCount - 4); Campfire[] array = Resources.FindObjectsOfTypeAll(); foreach (Campfire val in array) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { continue; } Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid() && ((Behaviour)val).isActiveAndEnabled && (string.IsNullOrEmpty(val.nameOverride) || val.nameOverride.IndexOf("PORTABLE", StringComparison.OrdinalIgnoreCase) < 0)) { int instanceID = ((Object)val).GetInstanceID(); if (!_provisions.TryGetValue(instanceID, out var value)) { value = new ProvisionState(); _provisions[instanceID] = value; } if (_settings.UnlimitedLobbyExtraFood.Value) { SpawnMissing(val, FindItem("Marshmallow"), num, ref value.Food, 2.7f); } int desired = (_settings.UnlimitedLobbyExtraBackpacks.Value ? Mathf.CeilToInt((float)num / 4f) : 0); SpawnMissing(val, FindItem("Backpack"), desired, ref value.Backpacks, 3.6f); } } } private void SpawnMissing(Campfire campfire, string itemName, int desired, ref int spawned, float radius) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) if (desired <= spawned || string.IsNullOrEmpty(itemName)) { return; } int num = desired - spawned; for (int i = 0; i < num; i++) { float num2 = (float)(spawned + i) * 137.5f * ((float)Math.PI / 180f); Vector3 position = ((Component)campfire).transform.position + new Vector3(Mathf.Cos(num2) * radius, 1.1f, Mathf.Sin(num2) * radius); ActionResult actionResult = _spawns.SpawnWorldItem(itemName, position); if (!actionResult.Success) { _log.LogWarning((object)("Unlimited lobby provision spawn stopped: " + actionResult.Message)); break; } spawned++; } } private string FindItem(string token) { for (int i = 0; i < _actions.Items.Count; i++) { Item val = _actions.Items[i]; if ((Object)(object)val != (Object)null && ((Object)val).name.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) { return ((Object)val).name; } } return string.Empty; } public void ResetScene() { _provisions.Clear(); _nextScan = 0f; } } [HarmonyPatch] internal static class UnlimitedMaxPlayersPatch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("Peak.Network.NetworkingUtilities"); if (!(type == null)) { return AccessTools.PropertyGetter(type, "MAX_PLAYERS"); } return null; } private static bool Prefix(ref int __result) { UnlimitedLobbyManager current = UnlimitedLobbyManager.Current; if (current == null || !current.Active) { return true; } __result = current.MaxPlayers; return false; } } [HarmonyPatch] internal static class UnlimitedHostRoomOptionsPatch { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("Peak.Network.NetworkingUtilities"); if (!(type == null)) { return AccessTools.Method(type, "HostRoomOptions", new Type[0], (Type[])null); } return null; } private static bool Prefix(ref RoomOptions __result) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown UnlimitedLobbyManager current = UnlimitedLobbyManager.Current; if (current == null || !current.Active) { return true; } RoomOptions val = new RoomOptions(); val.IsVisible = false; val.MaxPlayers = (byte)current.MaxPlayers; val.PublishUserId = true; __result = val; return false; } } internal sealed class StaminaEffectPreviewManager { private sealed class StatusChange { public STATUSTYPE Type; public float Requested; public float Actual; } private readonly ModConfig _settings; private readonly ManualLogSource _log; private readonly List _changes = new List(); private Item _item; private float _currentMaximum; private float _projectedMaximum; private float _extraStamina; private bool _infiniteStamina; private bool _wouldPassOut; private float _healingPool; private bool _standaloneDetected; private float _nextStandaloneCheck; private float _nextErrorLog; private Texture2D _pixel; private GUIStyle _title; private GUIStyle _small; public bool StandaloneDetected { get { RefreshStandaloneDetection(); return _standaloneDetected; } } public string Status { get { if (!StandaloneDetected) { if (!_settings.StaminaEffectPreviewEnabled.Value) { return "Off"; } return "Held-item stamina forecast enabled"; } return "Yielding to standalone Effect Preview"; } } public StaminaEffectPreviewManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { _item = null; _changes.Clear(); _extraStamina = 0f; _infiniteStamina = false; _wouldPassOut = false; _healingPool = 0f; if (!_settings.StaminaEffectPreviewEnabled.Value || StandaloneDetected) { return; } try { UpdatePreview(); } catch (Exception ex) { _item = null; _changes.Clear(); if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Stamina preview skipped an unsupported item: " + ex.Message)); } } } private void UpdatePreview() { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.refs == null || (Object)(object)localCharacter.refs.afflictions == (Object)null || localCharacter.data.fullyPassedOut) { return; } Item currentItem = localCharacter.data.currentItem; if ((Object)(object)currentItem == (Object)null || currentItem.consuming) { return; } Dictionary dictionary = new Dictionary(); ItemAction[] componentsInChildren = ((Component)currentItem).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ReadAction(componentsInChildren[i], dictionary, localCharacter.refs.afflictions); } if (dictionary.Count == 0 && Mathf.Abs(_extraStamina) < 0.001f && !_infiniteStamina && _healingPool <= 0.001f) { return; } CharacterAfflictions afflictions = localCharacter.refs.afflictions; float num = Mathf.Max(0f, afflictions.statusSum); float num2 = 0f; foreach (KeyValuePair item in dictionary) { float num3 = Mathf.Max(0f, afflictions.GetCurrentStatus(item.Key)); float num4 = Mathf.Max(num3, afflictions.GetStatusCap(item.Key)); float num5 = Mathf.Clamp(num3 + item.Value, 0f, num4); float num6 = num5 - num3; if (!(Mathf.Abs(num6) < 0.001f)) { _changes.Add(new StatusChange { Type = item.Key, Requested = item.Value, Actual = num6 }); num2 += num6; } } float num7 = Mathf.Min(Mathf.Max(0f, num + num2), _healingPool); num2 -= num7; _currentMaximum = Mathf.Clamp01(localCharacter.GetMaxStamina()); _projectedMaximum = Mathf.Clamp01(_currentMaximum - num2); _wouldPassOut = num + num2 >= 0.99f; _item = currentItem; } public void Draw(bool menuOpen) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0097: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) if (!menuOpen && !((Object)(object)_item == (Object)null) && Event.current != null && (int)Event.current.type == 7) { EnsureAssets(); float num = Mathf.Clamp((float)Screen.width / 1920f, 0.75f, 1.25f); float num2 = 390f * num; float num3 = (_settings.StaminaEffectPreviewDetails.Value ? 86f : 58f) * num; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(((float)Screen.width - num2) * 0.5f, (float)Screen.height - 190f * num, num2, num3); DrawRect(rect, new Color(0.025f, 0.035f, 0.04f, 0.9f)); DrawOutline(rect, _wouldPassOut ? new Color(1f, 0.28f, 0.22f, 0.95f) : new Color(0.25f, 0.78f, 0.72f, 0.9f)); GUI.Label(new Rect(((Rect)(ref rect)).x + 10f * num, ((Rect)(ref rect)).y + 6f * num, ((Rect)(ref rect)).width - 20f * num, 20f * num), CleanName(((Object)_item).name) + " • STAMINA PREVIEW", _title); Rect rect2 = default(Rect); ((Rect)(ref rect2))..ctor(((Rect)(ref rect)).x + 10f * num, ((Rect)(ref rect)).y + 31f * num, ((Rect)(ref rect)).width - 20f * num, 12f * num); DrawRect(rect2, new Color(0.08f, 0.1f, 0.11f, 1f)); float num4 = Mathf.Min(_currentMaximum, _projectedMaximum); DrawRect(new Rect(((Rect)(ref rect2)).x, ((Rect)(ref rect2)).y, ((Rect)(ref rect2)).width * num4, ((Rect)(ref rect2)).height), new Color(0.3f, 0.78f, 0.72f, 1f)); if (_projectedMaximum > _currentMaximum) { DrawRect(new Rect(((Rect)(ref rect2)).x + ((Rect)(ref rect2)).width * _currentMaximum, ((Rect)(ref rect2)).y, ((Rect)(ref rect2)).width * (_projectedMaximum - _currentMaximum), ((Rect)(ref rect2)).height), new Color(0.35f, 1f, 0.55f, 0.95f)); } else if (_projectedMaximum < _currentMaximum) { DrawRect(new Rect(((Rect)(ref rect2)).x + ((Rect)(ref rect2)).width * _projectedMaximum, ((Rect)(ref rect2)).y, ((Rect)(ref rect2)).width * (_currentMaximum - _projectedMaximum), ((Rect)(ref rect2)).height), new Color(1f, 0.42f, 0.22f, 0.95f)); } DrawOutline(rect2, new Color(0.75f, 0.86f, 0.84f, 0.75f)); string text = Mathf.RoundToInt(_currentMaximum * 100f) + "% → " + Mathf.RoundToInt(_projectedMaximum * 100f) + "%"; if (Mathf.Abs(_extraStamina) >= 0.001f) { text = text + " Extra stamina " + SignedPercent(_extraStamina); } if (_infiniteStamina) { text += " ∞ stamina"; } if (_wouldPassOut) { text += " WARNING: would pass out"; } GUI.Label(new Rect(((Rect)(ref rect)).x + 10f * num, ((Rect)(ref rect)).y + 45f * num, ((Rect)(ref rect)).width - 20f * num, 18f * num), text, _small); if (_settings.StaminaEffectPreviewDetails.Value) { GUI.Label(new Rect(((Rect)(ref rect)).x + 10f * num, ((Rect)(ref rect)).y + 64f * num, ((Rect)(ref rect)).width - 20f * num, 18f * num), DetailText(), _small); } } } public void ResetScene() { _item = null; _changes.Clear(); if ((Object)(object)_pixel != (Object)null) { Object.Destroy((Object)(object)_pixel); } _pixel = null; _title = null; _small = null; } private void ReadAction(ItemAction action, Dictionary requested, CharacterAfflictions current) { //IL_008e: 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) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)action == (Object)null) { return; } Type type = ((object)action).GetType(); switch (type.Name) { case "Action_ModifyStatus": { object obj = Read(type, action, "statusType"); if (obj is STATUSTYPE && TryFloat(Read(type, action, "changeAmount"), out var result9)) { Add(requested, (STATUSTYPE)obj, result9); } break; } case "Action_RestoreHunger": { if (TryFloat(Read(type, action, "restorationAmount"), out var result)) { Add(requested, ParseStatus("Hunger"), 0f - Mathf.Abs(result)); } break; } case "Action_InflictPoison": { if (TryFloat(Read(type, action, "inflictionTime"), out var result4) && TryFloat(Read(type, action, "poisonPerSecond"), out var result5)) { Add(requested, ParseStatus("Poison"), Mathf.Abs(result4 * result5)); } break; } case "Action_GiveExtraStamina": { if (TryFloat(Read(type, action, "amount"), out var result8)) { _extraStamina += result8; } break; } case "Action_ApplyInfiniteStamina": { _infiniteStamina = true; if (TryFloat(Read(type, action, "drowsyAmount"), out var result7)) { Add(requested, ParseStatus("Drowsy"), result7); } break; } case "Action_SuperJumpAmulet": { if (TryFloat(Read(type, action, "petrifyPerUse"), out var result6)) { Add(requested, ParseStatus("Petrify"), result6); } break; } case "Action_MoraleBoost": { if (TryFloat(Read(type, action, "baselineStaminaBoost"), out var result2)) { _extraStamina += result2; } if (TryFloat(Read(type, action, "staminaBoostPerAdditionalScout"), out var result3)) { _extraStamina += (float)Mathf.Max(0, (PhotonNetwork.CurrentRoom != null) ? (PhotonNetwork.CurrentRoom.PlayerCount - 1) : 0) * result3; } break; } case "Action_ApplyAffliction": case "Action_ApplyMassAffliction": ReadAffliction(Read(type, action, "affliction"), requested, current); if (!(Read(type, action, "extraAfflictions") is Array array)) { break; } { foreach (object item in array) { ReadAffliction(item, requested, current); } break; } } } private void ReadAffliction(object affliction, Dictionary requested, CharacterAfflictions current) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) if (affliction == null) { return; } Type type = affliction.GetType(); if (type.Name == "Affliction_AdjustStatus") { object obj = Read(type, affliction, "statusType"); if (obj is STATUSTYPE && TryFloat(Read(type, affliction, "statusAmount"), out var result)) { Add(requested, (STATUSTYPE)obj, result); } return; } if (type.Name == "Affliction_AddBonusStamina") { if (TryFloat(Read(type, affliction, "staminaAmount"), out var result2)) { _extraStamina += result2; } return; } if (type.Name == "Affliction_ClearAllStatus") { bool flag = Read(type, affliction, "includePetrify") is bool && (bool)Read(type, affliction, "includePetrify"); { foreach (object value in Enum.GetValues(typeof(STATUSTYPE))) { STATUSTYPE val = (STATUSTYPE)value; if (flag || !(((object)val).ToString() == "Petrify")) { Add(requested, val, 0f - current.GetCurrentStatus(val)); } } return; } } if (type.Name == "Affliction_HealAll" && TryFloat(Read(type, affliction, "maxHealing"), out var result3)) { _healingPool += Mathf.Abs(result3); } } private static object Read(Type type, object instance, string name) { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(instance); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (!(property == null)) { return property.GetValue(instance, null); } return null; } private static bool TryFloat(object value, out float result) { try { result = ((value == null) ? 0f : Convert.ToSingle(value)); return value != null; } catch { result = 0f; return false; } } private static STATUSTYPE ParseStatus(string name) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return (STATUSTYPE)Enum.Parse(typeof(STATUSTYPE), name, ignoreCase: true); } private static void Add(Dictionary values, STATUSTYPE type, float amount) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) values.TryGetValue(type, out var value); values[type] = value + amount; } private string DetailText() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) string text = string.Empty; for (int i = 0; i < _changes.Count; i++) { if (text.Length > 0) { text += " • "; } object obj = text; text = string.Concat(obj, _changes[i].Type, " ", SignedPercent(_changes[i].Actual)); } if (text.Length == 0) { text = (_infiniteStamina ? "Temporary unlimited stamina" : "No condition-bar change"); } if (_healingPool > 0.001f) { object obj2 = text; text = string.Concat(obj2, (text.Length == 0) ? string.Empty : " • ", "All-condition healing up to ", Mathf.RoundToInt(_healingPool * 100f), "%"); } return text; } private static string SignedPercent(float value) { return ((value >= 0f) ? "+" : "−") + Mathf.RoundToInt(Mathf.Abs(value) * 100f) + "%"; } private static string CleanName(string value) { if (!string.IsNullOrEmpty(value)) { return value.Replace("(Clone)", string.Empty).Trim(); } return "Held item"; } private void RefreshStandaloneDetection() { if (Time.unscaledTime < _nextStandaloneCheck) { return; } _nextStandaloneCheck = Time.unscaledTime + 5f; _standaloneDetected = false; foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { PluginInfo value = pluginInfo.Value; if (value != null && !((Object)(object)value.Instance == (Object)null) && ((Behaviour)value.Instance).enabled && !(pluginInfo.Key == "com.dougl.peaktrollmod")) { string text = Normalize(pluginInfo.Key + " " + ((value.Metadata == null) ? string.Empty : value.Metadata.Name)); if (text.Contains("effectpreview")) { _standaloneDetected = true; break; } } } } private static string Normalize(string value) { char[] array = new char[value.Length]; int length = 0; for (int i = 0; i < value.Length; i++) { if (char.IsLetterOrDigit(value[i])) { array[length++] = char.ToLowerInvariant(value[i]); } } return new string(array, 0, length); } private void EnsureAssets() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_pixel == (Object)null) { _pixel = new Texture2D(1, 1); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); } if (_title == null) { _title = new GUIStyle(GUI.skin.label); _title.font = UiFontManager.DisplayFont; _title.fontSize = 12; _title.fontStyle = (FontStyle)1; _title.normal.textColor = new Color(0.82f, 1f, 0.96f); } if (_small == null) { _small = new GUIStyle(GUI.skin.label); _small.font = UiFontManager.BodyFont; _small.fontSize = 11; _small.normal.textColor = (_wouldPassOut ? new Color(1f, 0.58f, 0.5f) : new Color(0.8f, 0.88f, 0.87f)); } } private void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } private void DrawOutline(Rect rect, Color color) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 1f), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 1f, ((Rect)(ref rect)).width, 1f), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), color); DrawRect(new Rect(((Rect)(ref rect)).xMax - 1f, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), color); } } internal sealed class SurvivalAssistManager { private readonly ModConfig _settings; private readonly ManualLogSource _log; private float _nextErrorLog; private float _nextCleanse; public bool Immortality { get { return _settings.ImmortalityEnabled.Value; } set { _settings.ImmortalityEnabled.Value = value; } } public bool InfiniteStamina { get { return _settings.InfiniteStaminaEnabled.Value; } set { _settings.InfiniteStaminaEnabled.Value = value; } } public SurvivalAssistManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { if (!Immortality && !InfiniteStamina) { return; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.refs == null || (Object)(object)localCharacter.refs.afflictions == (Object)null || localCharacter.data.dead) { return; } try { if (Immortality && Time.unscaledTime >= _nextCleanse) { _nextCleanse = Time.unscaledTime + 0.1f; ClearNegativeStatuses(localCharacter.refs.afflictions); } if (InfiniteStamina && !localCharacter.data.fullyPassedOut) { Character.GainFullStamina(); } } catch (Exception ex) { if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Survival assistance skipped an update: " + ex.Message)); } } } private static void ClearNegativeStatuses(CharacterAfflictions afflictions) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_0054: Unknown result type (might be due to invalid IL or missing references) bool flag = false; if (afflictions.physicalThorns != null && afflictions.physicalThorns.Count > 0) { afflictions.RemoveAllThorns(); flag = true; } foreach (object value in Enum.GetValues(typeof(STATUSTYPE))) { STATUSTYPE val = (STATUSTYPE)value; if (!(afflictions.GetCurrentStatus(val) <= 0f) || !(afflictions.GetIncrementalStatus(val) <= 0f)) { afflictions.SetStatus(val, 0f, false); flag = true; } } if (flag) { afflictions.PushStatuses((Player)null); } } public void ResetScene() { } } internal sealed class LuggageNavigationManager { private static readonly FieldInfo MirageLuggageRenderers = AccessTools.Field(typeof(MirageLuggage), "renderers"); private static readonly FieldInfo MirageParticleRenderer = AccessTools.Field(typeof(Mirage), "psr"); private readonly ModConfig _settings; private readonly ManualLogSource _log; private readonly Dictionary _suppressedRenderers = new Dictionary(); private Luggage _nearest; private float _distance; private float _nextLuggageScan; private float _nextMirageScan; private float _nextErrorLog; private bool _wasSuppressing; private Texture2D _pixel; private GUIStyle _title; private GUIStyle _detail; public bool DirectionsEnabled { get { return _settings.RealLuggageDirectionsEnabled.Value; } set { _settings.RealLuggageDirectionsEnabled.Value = value; } } public bool AntiMiragesEnabled { get { return _settings.MesaAntiMiragesEnabled.Value; } set { _settings.MesaAntiMiragesEnabled.Value = value; if (value) { _nextMirageScan = 0f; } else if (_wasSuppressing || _suppressedRenderers.Count > 0) { RestoreMirages(); _wasSuppressing = false; } } } public int HiddenRendererCount => _suppressedRenderers.Count; public string LuggageStatus { get { if (!((Object)(object)_nearest == (Object)null)) { return Mathf.RoundToInt(_distance) + " m to nearest real luggage"; } return "No unopened real luggage detected"; } } public string MirageStatus { get { if (AntiMiragesEnabled) { return "Hiding " + HiddenRendererCount + " native and mod mirage renderer(s)"; } return "Off"; } } public LuggageNavigationManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { try { if (DirectionsEnabled && Time.unscaledTime >= _nextLuggageScan) { _nextLuggageScan = Time.unscaledTime + 0.35f; RefreshNearestLuggage(); } if (!DirectionsEnabled) { _nearest = null; } if (AntiMiragesEnabled) { if (!_wasSuppressing) { _nextMirageScan = 0f; } _wasSuppressing = true; if (Time.unscaledTime >= _nextMirageScan) { _nextMirageScan = Time.unscaledTime + 0.75f; FindAndSuppressMirages(); } } else if (_wasSuppressing || _suppressedRenderers.Count > 0) { RestoreMirages(); _wasSuppressing = false; } } catch (Exception ex) { if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Luggage navigation skipped a frame safely: " + ex.Message)); } } } public void Draw(bool menuOpen) { //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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_01c7: Unknown result type (might be due to invalid IL or missing references) if (menuOpen || !DirectionsEnabled || Event.current == null || (int)Event.current.type != 7) { return; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead || localCharacter.data.fullyPassedOut) { return; } EnsureStyles(); string text = (((Object)(object)_nearest == (Object)null) ? "REAL LUGGAGE —" : ("REAL LUGGAGE " + DirectionGlyph(localCharacter))); string text2 = (((Object)(object)_nearest == (Object)null) ? "No unopened genuine luggage detected" : (Mathf.RoundToInt(_distance) + " m • native and mod mirages ignored")); float num = 330f; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(((float)Screen.width - num) * 0.5f, 34f, num, 52f); Color color = GUI.color; int depth = GUI.depth; try { GUI.depth = -9000; DrawRect(rect, new Color(0.025f, 0.04f, 0.043f, 0.9f)); DrawOutline(rect, ((Object)(object)_nearest == (Object)null) ? new Color(0.45f, 0.52f, 0.52f, 0.85f) : new Color(0.25f, 0.85f, 0.74f, 0.95f)); GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 4f, ((Rect)(ref rect)).width - 20f, 23f), text, _title); GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 27f, ((Rect)(ref rect)).width - 20f, 18f), text2, _detail); } finally { GUI.color = color; GUI.depth = depth; } } public void SuppressNativeMirage(Component component) { if ((Object)(object)component == (Object)null || !AntiMiragesEnabled) { return; } try { MirageLuggage val = (MirageLuggage)(object)((component is MirageLuggage) ? component : null); if ((Object)(object)val != (Object)null) { Renderer[] renderers = ((MirageLuggageRenderers == null) ? null : (MirageLuggageRenderers.GetValue(val) as Renderer[])); Suppress(renderers); Suppress(((Component)val).GetComponentsInChildren(true)); return; } Mirage val2 = (Mirage)(object)((component is Mirage) ? component : null); if ((Object)(object)val2 == (Object)null) { return; } Suppress(((Component)val2).GetComponentsInChildren(true)); Renderer renderer = (Renderer)((MirageParticleRenderer == null) ? null : /*isinst with value type is only supported in some contexts*/); Suppress(renderer); if (val2.objectsToHide == null) { return; } for (int i = 0; i < val2.objectsToHide.Length; i++) { if ((Object)(object)val2.objectsToHide[i] != (Object)null) { Suppress(val2.objectsToHide[i].GetComponentsInChildren(true)); } } } catch (Exception ex) { if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Mesa mirage suppression skipped an unsupported object: " + ex.Message)); } } } public void SuppressModMirage(GameObject visual) { if (!((Object)(object)visual == (Object)null) && AntiMiragesEnabled) { Suppress(visual.GetComponentsInChildren(true)); } } public void ResetScene() { RestoreMirages(); _nearest = null; _distance = 0f; _nextLuggageScan = 0f; _nextMirageScan = 0f; _wasSuppressing = false; if ((Object)(object)_pixel != (Object)null) { Object.Destroy((Object)(object)_pixel); } _pixel = null; _title = null; _detail = null; } private void RefreshNearestLuggage() { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) _nearest = null; _distance = 0f; Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || Luggage.ALL_LUGGAGE == null) { return; } float num = Mathf.Clamp(_settings.RealLuggageMaximumDistance.Value, 25f, 2000f); float num2 = num * num; for (int i = 0; i < Luggage.ALL_LUGGAGE.Count; i++) { Luggage val = Luggage.ALL_LUGGAGE[i]; if (IsRealUnopenedLuggage(val)) { Vector3 val2 = ((Component)val).transform.position - localCharacter.Center; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (!(sqrMagnitude >= num2)) { num2 = sqrMagnitude; _nearest = val; } } } if ((Object)(object)_nearest != (Object)null) { _distance = Mathf.Sqrt(num2); } } private static bool IsRealUnopenedLuggage(Luggage luggage) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)luggage == (Object)null) && !luggage.IsOpen) { Scene scene = ((Component)luggage).gameObject.scene; if (((Scene)(ref scene)).IsValid() && ((Component)luggage).gameObject.activeInHierarchy) { if ((Object)(object)((Component)luggage).GetComponentInParent() != (Object)null || (Object)(object)((Component)luggage).GetComponentInChildren(true) != (Object)null) { return false; } if ((Object)(object)((Component)luggage).GetComponentInParent() != (Object)null || (Object)(object)((Component)luggage).GetComponentInChildren(true) != (Object)null) { return false; } return !((Object)((Component)luggage).gameObject).name.StartsWith("PTM_Mirage_", StringComparison.Ordinal); } } return false; } private void FindAndSuppressMirages() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0062: Unknown result type (might be due to invalid IL or missing references) MirageLuggage[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null) { Scene scene = ((Component)array[i]).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { SuppressNativeMirage((Component)(object)array[i]); } } } Mirage[] array2 = Resources.FindObjectsOfTypeAll(); for (int j = 0; j < array2.Length; j++) { if ((Object)(object)array2[j] != (Object)null) { Scene scene2 = ((Component)array2[j]).gameObject.scene; if (((Scene)(ref scene2)).IsValid()) { SuppressNativeMirage((Component)(object)array2[j]); } } } TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.Mirages != null) { instance.Mirages.SuppressTrackedVisuals(Suppress); } RemoveDestroyedRendererKeys(); } private void Suppress(Renderer renderer) { if (!((Object)(object)renderer == (Object)null)) { if (!_suppressedRenderers.ContainsKey(renderer)) { _suppressedRenderers.Add(renderer, renderer.enabled); } renderer.enabled = false; } } private void Suppress(Renderer[] renderers) { if (renderers != null) { for (int i = 0; i < renderers.Length; i++) { Suppress(renderers[i]); } } } private void RestoreMirages() { foreach (KeyValuePair suppressedRenderer in _suppressedRenderers) { if ((Object)(object)suppressedRenderer.Key != (Object)null) { suppressedRenderer.Key.enabled = suppressedRenderer.Value; } } _suppressedRenderers.Clear(); } private void RemoveDestroyedRendererKeys() { List list = null; foreach (KeyValuePair suppressedRenderer in _suppressedRenderers) { if ((Object)(object)suppressedRenderer.Key == (Object)null) { if (list == null) { list = new List(); } list.Add(suppressedRenderer.Key); } } if (list != null) { for (int i = 0; i < list.Count; i++) { _suppressedRenderers.Remove(list[i]); } } } private string DirectionGlyph(Character local) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_nearest == (Object)null) { return "—"; } Vector3 lookDirection_Flat = local.data.lookDirection_Flat; lookDirection_Flat.y = 0f; Vector3 val = ((Component)_nearest).transform.position - local.Center; val.y = 0f; if (((Vector3)(ref lookDirection_Flat)).sqrMagnitude < 0.001f || ((Vector3)(ref val)).sqrMagnitude < 0.001f) { return "↑"; } float num = Vector3.SignedAngle(((Vector3)(ref lookDirection_Flat)).normalized, ((Vector3)(ref val)).normalized, Vector3.up); if (num >= -22.5f && num < 22.5f) { return "↑"; } if (num >= 22.5f && num < 67.5f) { return "↗"; } if (num >= 67.5f && num < 112.5f) { return "→"; } if (num >= 112.5f && num < 157.5f) { return "↘"; } if (num >= 157.5f || num < -157.5f) { return "↓"; } if (num >= -157.5f && num < -112.5f) { return "↙"; } if (num >= -112.5f && num < -67.5f) { return "←"; } return "↖"; } private void EnsureStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: 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) //IL_006b: Expected O, but got Unknown //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_011c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_pixel != (Object)null)) { _pixel = new Texture2D(1, 1); ((Object)_pixel).name = "PTM_LUGGAGE_NAV_PIXEL"; ((Object)_pixel).hideFlags = (HideFlags)61; _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _title = new GUIStyle(GUI.skin.label); _title.font = UiFontManager.DisplayFont; _title.fontSize = 14; _title.fontStyle = (FontStyle)1; _title.alignment = (TextAnchor)4; _title.normal.textColor = new Color(0.45f, 1f, 0.88f); _detail = new GUIStyle(GUI.skin.label); _detail.font = UiFontManager.BodyFont; _detail.fontSize = 11; _detail.alignment = (TextAnchor)4; _detail.normal.textColor = new Color(0.76f, 0.84f, 0.83f); } } private void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } private void DrawOutline(Rect rect, Color color) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 1f), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 1f, ((Rect)(ref rect)).width, 1f), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), color); DrawRect(new Rect(((Rect)(ref rect)).xMax - 1f, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), color); } } internal enum EspCategory { Scout, Luggage, Zombie, Scoutmaster } internal sealed class ScoutEspManager { private sealed class EspTarget { public Component Component; public Renderer[] Renderers; public EspCategory Category; public string Label; } private readonly PlayerManager _players; private readonly ModConfig _settings; private readonly ManualLogSource _log; private readonly List _targets = new List(); private float _nextScan; private float _nextErrorLog; private PlayerEntry _nearestScout; private float _nearestScoutDistance; private Texture2D _pixel; private GUIStyle _labelStyle; private GUIStyle _compassTitle; private GUIStyle _compassDetail; public bool CompassEnabled { get { return _settings.ScoutCompassEnabled.Value; } set { _settings.ScoutCompassEnabled.Value = value; } } public bool ScoutsEnabled { get { return _settings.ScoutEspEnabled.Value; } set { _settings.ScoutEspEnabled.Value = value; Invalidate(); } } public bool LuggageEnabled { get { return _settings.LuggageEspEnabled.Value; } set { _settings.LuggageEspEnabled.Value = value; Invalidate(); } } public bool ZombiesEnabled { get { return _settings.ZombieEspEnabled.Value; } set { _settings.ZombieEspEnabled.Value = value; Invalidate(); } } public bool ScoutmastersEnabled { get { return _settings.ScoutmasterEspEnabled.Value; } set { _settings.ScoutmasterEspEnabled.Value = value; Invalidate(); } } public bool LabelsEnabled { get { return _settings.EspLabelsEnabled.Value; } set { _settings.EspLabelsEnabled.Value = value; } } public bool TracersEnabled { get { return _settings.EspTracersEnabled.Value; } set { _settings.EspTracersEnabled.Value = value; } } public float MaximumDistance { get { return Mathf.Clamp(_settings.EspMaximumDistance.Value, 25f, 2000f); } set { _settings.EspMaximumDistance.Value = Mathf.Clamp(value, 25f, 2000f); } } public float OutlineWidth { get { return Mathf.Clamp(_settings.EspOutlineWidth.Value, 1f, 8f); } set { _settings.EspOutlineWidth.Value = Mathf.Clamp(value, 1f, 8f); } } public int TargetCount => _targets.Count; public string CompassStatus { get { if (_nearestScout != null) { return Mathf.RoundToInt(_nearestScoutDistance) + " m to " + _nearestScout.Name; } return "No other living scout detected"; } } public ScoutEspManager(PlayerManager players, ModConfig settings, ManualLogSource log) { _players = players; _settings = settings; _log = log; } public Color GetColor(EspCategory category) { //IL_006f: 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_0062: Unknown result type (might be due to invalid IL or missing references) Color result = default(Color); if (!ColorUtility.TryParseHtmlString(category switch { EspCategory.Zombie => _settings.ZombieEspColor.Value, EspCategory.Luggage => _settings.LuggageEspColor.Value, EspCategory.Scout => _settings.ScoutEspColor.Value, _ => _settings.ScoutmasterEspColor.Value, }, ref result)) { result = DefaultColor(category); } result.a = 0.96f; return result; } public void SetColor(EspCategory category, Color color) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) string text = "#" + ColorUtility.ToHtmlStringRGB(new Color(Mathf.Clamp01(color.r), Mathf.Clamp01(color.g), Mathf.Clamp01(color.b), 1f)); switch (category) { case EspCategory.Scout: if (_settings.ScoutEspColor.Value != text) { _settings.ScoutEspColor.Value = text; } break; case EspCategory.Luggage: if (_settings.LuggageEspColor.Value != text) { _settings.LuggageEspColor.Value = text; } break; case EspCategory.Zombie: if (_settings.ZombieEspColor.Value != text) { _settings.ZombieEspColor.Value = text; } break; default: if (_settings.ScoutmasterEspColor.Value != text) { _settings.ScoutmasterEspColor.Value = text; } break; } } public int Count(EspCategory category) { int num = 0; for (int i = 0; i < _targets.Count; i++) { if (_targets[i].Category == category && (Object)(object)_targets[i].Component != (Object)null) { num++; } } return num; } public void Tick() { try { RefreshNearestScout(); if (!AnyEspEnabled()) { _targets.Clear(); } else if (Time.unscaledTime >= _nextScan) { _nextScan = Time.unscaledTime + 0.75f; ScanTargets(); } } catch (Exception ex) { if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Scout/ESP scan skipped safely: " + ex.Message)); } } } public void Draw(bool menuOpen) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 if (menuOpen || Event.current == null || (int)Event.current.type != 7) { return; } Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && !((Object)(object)localCharacter.data == (Object)null) && !localCharacter.data.dead) { EnsureStyles(); if (AnyEspEnabled()) { DrawTargets(localCharacter); } if (CompassEnabled) { DrawCompass(localCharacter); } } } public void ResetScene() { _targets.Clear(); _nearestScout = null; _nearestScoutDistance = 0f; _nextScan = 0f; if ((Object)(object)_pixel != (Object)null) { Object.Destroy((Object)(object)_pixel); } _pixel = null; _labelStyle = null; _compassTitle = null; _compassDetail = null; } private void Invalidate() { _nextScan = 0f; } private bool AnyEspEnabled() { if (!ScoutsEnabled && !LuggageEnabled && !ZombiesEnabled) { return ScoutmastersEnabled; } return true; } private void RefreshNearestScout() { //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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) _nearestScout = null; _nearestScoutDistance = 0f; if (!CompassEnabled || _players == null || _players.Local == null || (Object)(object)_players.Local.Character == (Object)null) { return; } Vector3 center = _players.Local.Character.Center; float num = float.MaxValue; IList entries = _players.Entries; for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; if (playerEntry != null && !playerEntry.IsLocal && !((Object)(object)playerEntry.Character == (Object)null) && !((Object)(object)playerEntry.Character.data == (Object)null) && !playerEntry.Character.data.dead) { Vector3 val = playerEntry.Character.Center - center; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (!(sqrMagnitude >= num)) { num = sqrMagnitude; _nearestScout = playerEntry; } } } if (_nearestScout != null) { _nearestScoutDistance = Mathf.Sqrt(num); } } private void ScanTargets() { _targets.Clear(); if (ScoutsEnabled) { IList entries = _players.Entries; for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; if (playerEntry != null && !playerEntry.IsLocal && !((Object)(object)playerEntry.Character == (Object)null) && IsSceneObject((Component)(object)playerEntry.Character)) { AddTarget((Component)(object)playerEntry.Character, EspCategory.Scout, string.IsNullOrEmpty(playerEntry.Name) ? "SCOUT" : playerEntry.Name); } } } if (LuggageEnabled && Luggage.ALL_LUGGAGE != null) { for (int j = 0; j < Luggage.ALL_LUGGAGE.Count; j++) { Luggage val = Luggage.ALL_LUGGAGE[j]; if (IsRealLuggage(val)) { AddTarget((Component)(object)val, EspCategory.Luggage, "LUGGAGE"); } } } if (ZombiesEnabled) { MushroomZombie[] array = Resources.FindObjectsOfTypeAll(); for (int k = 0; k < array.Length; k++) { if (IsSceneObject((Component)(object)array[k])) { AddTarget((Component)(object)array[k], EspCategory.Zombie, "ZOMBIE"); } } } if (!ScoutmastersEnabled) { return; } Scoutmaster[] array2 = Resources.FindObjectsOfTypeAll(); for (int l = 0; l < array2.Length; l++) { if (IsSceneObject((Component)(object)array2[l])) { AddTarget((Component)(object)array2[l], EspCategory.Scoutmaster, "SCOUTMASTER"); } } } private void AddTarget(Component component, EspCategory category, string label) { Renderer[] componentsInChildren = component.GetComponentsInChildren(false); if (componentsInChildren == null || componentsInChildren.Length == 0) { return; } List list = new List(); for (int i = 0; i < componentsInChildren.Length; i++) { if (componentsInChildren[i] is MeshRenderer || componentsInChildren[i] is SkinnedMeshRenderer) { list.Add(componentsInChildren[i]); } } if (list.Count != 0) { _targets.Add(new EspTarget { Component = component, Renderers = list.ToArray(), Category = category, Label = label }); } } private void DrawTargets(Character local) { //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: 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_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Expected O, but got Unknown //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } float num = MaximumDistance * MaximumDistance; Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; int depth = GUI.depth; try { GUI.depth = -8800; for (int i = 0; i < _targets.Count; i++) { EspTarget espTarget = _targets[i]; if ((Object)(object)espTarget.Component == (Object)null || !espTarget.Component.gameObject.activeInHierarchy || !TryGetBounds(espTarget.Renderers, out var bounds)) { continue; } Vector3 val = ((Bounds)(ref bounds)).center - local.Center; if (((Vector3)(ref val)).sqrMagnitude > num) { continue; } Vector3[] array = BoundsCorners(bounds); Vector2[] array2 = (Vector2[])(object)new Vector2[8]; bool flag = false; for (int j = 0; j < array.Length; j++) { Vector3 val2 = main.WorldToScreenPoint(array[j]); if (val2.z <= 0.05f) { flag = true; break; } ref Vector2 reference = ref array2[j]; reference = new Vector2(val2.x, (float)Screen.height - val2.y); } if (!flag) { Color color2 = GetColor(espTarget.Category); DrawBounds(array2, color2, OutlineWidth); if (TracersEnabled) { Vector3 val3 = main.WorldToScreenPoint(new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).min.y, ((Bounds)(ref bounds)).center.z)); DrawLine(new Vector2((float)Screen.width * 0.5f, (float)Screen.height - 3f), new Vector2(val3.x, (float)Screen.height - val3.y), color2, OutlineWidth); } if (LabelsEnabled) { Vector3 val4 = main.WorldToScreenPoint(new Vector3(((Bounds)(ref bounds)).center.x, ((Bounds)(ref bounds)).max.y, ((Bounds)(ref bounds)).center.z)); string text = espTarget.Label + " " + Mathf.RoundToInt(Vector3.Distance(local.Center, ((Bounds)(ref bounds)).center)) + "m"; GUIStyle val5 = new GUIStyle(_labelStyle); val5.normal.textColor = color2; GUI.Label(new Rect(val4.x - 100f, (float)Screen.height - val4.y - 25f, 200f, 22f), text, val5); } } } } finally { GUI.matrix = matrix; GUI.color = color; GUI.depth = depth; } } private void DrawCompass(Character local) { //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) string text = ((_nearestScout == null) ? "SCOUT COMPASS —" : ("SCOUT COMPASS " + DirectionGlyph(local, _nearestScout.Character.Center))); string text2 = ((_nearestScout == null) ? "No other living scout detected" : (Mathf.RoundToInt(_nearestScoutDistance) + " m • " + _nearestScout.Name)); float num = 310f; Rect rect = default(Rect); ((Rect)(ref rect))..ctor(((float)Screen.width - num) * 0.5f, 92f, num, 50f); Color color = GUI.color; int depth = GUI.depth; try { GUI.depth = -8900; DrawRect(rect, new Color(0.025f, 0.04f, 0.043f, 0.9f)); DrawOutline(rect, (Color)((_nearestScout == null) ? new Color(0.45f, 0.52f, 0.52f, 0.85f) : GetColor(EspCategory.Scout)), 1f); GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 3f, ((Rect)(ref rect)).width - 20f, 23f), text, _compassTitle); GUI.Label(new Rect(((Rect)(ref rect)).x + 10f, ((Rect)(ref rect)).y + 26f, ((Rect)(ref rect)).width - 20f, 18f), text2, _compassDetail); } finally { GUI.color = color; GUI.depth = depth; } } private static bool TryGetBounds(Renderer[] renderers, out Bounds bounds) { //IL_0001: 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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) bounds = default(Bounds); bool flag = false; if (renderers == null) { return false; } foreach (Renderer val in renderers) { if (!((Object)(object)val == (Object)null) && val.enabled && ((Component)val).gameObject.activeInHierarchy) { if (!flag) { bounds = val.bounds; flag = true; } else { ((Bounds)(ref bounds)).Encapsulate(val.bounds); } } } if (flag) { Vector3 size = ((Bounds)(ref bounds)).size; return ((Vector3)(ref size)).sqrMagnitude > 0.0001f; } return false; } private static Vector3[] BoundsCorners(Bounds b) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) Vector3 min = ((Bounds)(ref b)).min; Vector3 max = ((Bounds)(ref b)).max; return (Vector3[])(object)new Vector3[8] { new Vector3(min.x, min.y, min.z), new Vector3(max.x, min.y, min.z), new Vector3(max.x, max.y, min.z), new Vector3(min.x, max.y, min.z), new Vector3(min.x, min.y, max.z), new Vector3(max.x, min.y, max.z), new Vector3(max.x, max.y, max.z), new Vector3(min.x, max.y, max.z) }; } private void DrawBounds(Vector2[] p, Color color, float width) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) int[,] array = new int[12, 2] { { 0, 1 }, { 1, 2 }, { 2, 3 }, { 3, 0 }, { 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 }, { 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 } }; for (int i = 0; i < 12; i++) { DrawLine(p[array[i, 0]], p[array[i, 1]], color, width); } } private void DrawLine(Vector2 a, Vector2 b, Color color, float width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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) Vector2 val = b - a; float magnitude = ((Vector2)(ref val)).magnitude; if (!(magnitude < 0.5f)) { Matrix4x4 matrix = GUI.matrix; GUIUtility.RotateAroundPivot(Mathf.Atan2(val.y, val.x) * 57.29578f, a); DrawRect(new Rect(a.x, a.y - width * 0.5f, magnitude, width), color); GUI.matrix = matrix; } } private static bool IsSceneObject(Component component) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)component != (Object)null) { Scene scene = component.gameObject.scene; if (((Scene)(ref scene)).IsValid()) { return component.gameObject.activeInHierarchy; } } return false; } private static bool IsRealLuggage(Luggage luggage) { if (!IsSceneObject((Component)(object)luggage) || luggage.IsOpen) { return false; } if ((Object)(object)((Component)luggage).GetComponentInParent() != (Object)null || (Object)(object)((Component)luggage).GetComponentInChildren(true) != (Object)null) { return false; } if ((Object)(object)((Component)luggage).GetComponentInParent() != (Object)null || (Object)(object)((Component)luggage).GetComponentInChildren(true) != (Object)null) { return false; } return !((Object)((Component)luggage).gameObject).name.StartsWith("PTM_Mirage_", StringComparison.Ordinal); } private static string DirectionGlyph(Character local, Vector3 destination) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) Vector3 lookDirection_Flat = local.data.lookDirection_Flat; lookDirection_Flat.y = 0f; Vector3 val = destination - local.Center; val.y = 0f; if (((Vector3)(ref lookDirection_Flat)).sqrMagnitude < 0.001f || ((Vector3)(ref val)).sqrMagnitude < 0.001f) { return "↑"; } float num = Vector3.SignedAngle(((Vector3)(ref lookDirection_Flat)).normalized, ((Vector3)(ref val)).normalized, Vector3.up); if (num >= -22.5f && num < 22.5f) { return "↑"; } if (num >= 22.5f && num < 67.5f) { return "↗"; } if (num >= 67.5f && num < 112.5f) { return "→"; } if (num >= 112.5f && num < 157.5f) { return "↘"; } if (num >= 157.5f || num < -157.5f) { return "↓"; } if (num >= -157.5f && num < -112.5f) { return "↙"; } if (num >= -112.5f && num < -67.5f) { return "←"; } return "↖"; } private static Color DefaultColor(EspCategory category) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) return (Color)(category switch { EspCategory.Scout => new Color(0.25f, 1f, 0.78f), EspCategory.Luggage => new Color(1f, 0.76f, 0.2f), EspCategory.Zombie => new Color(1f, 0.25f, 0.25f), _ => new Color(0.72f, 0.38f, 1f), }); } private void EnsureStyles() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0041: 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) //IL_006b: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_pixel != (Object)null)) { _pixel = new Texture2D(1, 1); ((Object)_pixel).name = "PTM_ESP_PIXEL"; ((Object)_pixel).hideFlags = (HideFlags)61; _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _labelStyle = new GUIStyle(GUI.skin.label); _labelStyle.font = UiFontManager.DisplayFont; _labelStyle.fontSize = 12; _labelStyle.fontStyle = (FontStyle)1; _labelStyle.alignment = (TextAnchor)4; _compassTitle = new GUIStyle(_labelStyle); _compassTitle.fontSize = 14; _compassDetail = new GUIStyle(GUI.skin.label); _compassDetail.font = UiFontManager.BodyFont; _compassDetail.fontSize = 11; _compassDetail.alignment = (TextAnchor)4; _compassDetail.normal.textColor = new Color(0.76f, 0.84f, 0.83f); } } private void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } private void DrawOutline(Rect rect, Color color, float width) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, width), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - width, ((Rect)(ref rect)).width, width), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, width, ((Rect)(ref rect)).height), color); DrawRect(new Rect(((Rect)(ref rect)).xMax - width, ((Rect)(ref rect)).y, width, ((Rect)(ref rect)).height), color); } } internal sealed class ClimbForecastManager { private readonly ModConfig _settings; private readonly ManualLogSource _log; private float _nextScan; private float _nextErrorLog; private bool _visible; private float _height; private float _seconds; private float _cost; private float _remaining; private string _rating = "NO TARGET"; private string _detail = string.Empty; private Texture2D _pixel; private GUIStyle _title; private GUIStyle _text; public bool Enabled { get { return _settings.ClimbForecastEnabled.Value; } set { _settings.ClimbForecastEnabled.Value = value; } } public float MaximumHeight { get { return Mathf.Clamp(_settings.ClimbForecastMaximumHeight.Value, 3f, 20f); } set { _settings.ClimbForecastMaximumHeight.Value = Mathf.Clamp(value, 3f, 20f); } } public float SafetyReserve { get { return Mathf.Clamp(_settings.ClimbForecastSafetyReserve.Value, 0f, 0.5f); } set { _settings.ClimbForecastSafetyReserve.Value = Mathf.Clamp(value, 0f, 0.5f); } } public string Status { get { if (Enabled) { if (!_visible) { return "Reach toward a wall to scan its next ledge"; } return _rating + " — " + _detail; } return "Off"; } } public ClimbForecastManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { if (Time.unscaledTime < _nextScan) { return; } _nextScan = Time.unscaledTime + 0.12f; _visible = false; if (!Enabled || !GameHandler.IsOnIsland) { return; } try { Scan(); } catch (Exception ex) { if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Climb forecast skipped a scan: " + ex.Message)); } } } private void Scan() { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0396: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.refs == null || (Object)(object)localCharacter.refs.climbing == (Object)null || localCharacter.data.dead || localCharacter.data.fullyPassedOut || (!localCharacter.data.isReaching && !localCharacter.data.isClimbing)) { return; } Vector3 lookDirection = localCharacter.data.lookDirection; RaycastHit val = default(RaycastHit); if (((Vector3)(ref lookDirection)).sqrMagnitude < 0.1f || !Physics.Raycast(localCharacter.Head, ((Vector3)(ref lookDirection)).normalized, ref val, 8f, -5, (QueryTriggerInteraction)1) || (Object)(object)((RaycastHit)(ref val)).collider == (Object)null || (Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent() != (Object)null || (Object)(object)((Component)((RaycastHit)(ref val)).collider).GetComponentInParent() != (Object)null) { return; } float num = Vector3.Angle(Vector3.up, ((RaycastHit)(ref val)).normal); if (num < 48f) { return; } Vector3 normal = ((RaycastHit)(ref val)).normal; Vector3 normalized = ((Vector3)(ref normal)).normalized; float num2 = FindWallEdge(((RaycastHit)(ref val)).point, normalized, ((RaycastHit)(ref val)).collider); if (num2 < 0f) { SetUnavailable("NO LEDGE", "No edge found within " + MaximumHeight.ToString("0") + "m"); return; } Vector3 val2 = ((RaycastHit)(ref val)).point + Vector3.up * (num2 + 1.4f) - normalized * 0.55f; RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val2, Vector3.down, ref val3, 2.6f, -5, (QueryTriggerInteraction)1) || Vector3.Dot(((RaycastHit)(ref val3)).normal, Vector3.up) < 0.58f) { SetUnavailable("NO FOOTING", "Edge found, but no standable top was detected"); return; } _height = ((RaycastHit)(ref val3)).point.y - localCharacter.Center.y; if (_height <= 0.25f) { return; } bool flag = !Physics.CheckSphere(((RaycastHit)(ref val3)).point + Vector3.up * 0.85f, 0.32f, -5, (QueryTriggerInteraction)1); CharacterClimbing climbing = localCharacter.refs.climbing; ClimbModifierSurface componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && componentInParent.onlySlideDown) { SetUnavailable("NO CLIMB", "This surface only permits downward sliding"); return; } float num3 = Mathf.Max(0.05f, localCharacter.data.staminaMod); float num4 = (((Object)(object)componentInParent == (Object)null) ? 1f : Mathf.Max(0.05f, componentInParent.speedMultiplier)); float num5 = (((Object)(object)componentInParent == (Object)null) ? 1f : Mathf.Max(0f, componentInParent.staminaUsageMultiplier)); float num6 = Mathf.Max(0.05f, climbing.climbSpeed * climbing.climbSpeedMod * num3 * num4); _seconds = Mathf.Clamp(_height / num6, 0f, 120f); float num7 = ((localCharacter.data.staticClimbCost || ((Object)(object)componentInParent != (Object)null && componentInParent.staticClimbCost)) ? 1f : Mathf.Lerp(0.2f, 1f, Mathf.InverseLerp(40f, 60f, num))); float num8 = Mathf.Max(0f, climbing.maxStaminaUsage * num7 * num3 * num5 * Ascents.climbStaminaMultiplier); float num9 = ((!localCharacter.data.isClimbing && localCharacter.data.hasClimbedSinceGrounded) ? Mathf.Min(0.3f, Vector3.Distance(localCharacter.Center, ((RaycastHit)(ref val)).point) * 0.15f) : 0f); _cost = Mathf.Clamp(_seconds * num8 + num9, 0f, 5f); if (localCharacter.infiniteStam || _settings.InfiniteStaminaEnabled.Value) { _cost = 0f; } float num10 = Mathf.Max(0f, localCharacter.GetTotalStamina()); _remaining = num10 - _cost; float num11 = Mathf.Max(0f, localCharacter.GetMaxStamina()) * SafetyReserve; if (!flag) { _rating = "BLOCKED"; } else if (_remaining < 0f) { _rating = "NOT ENOUGH"; } else if (_remaining < num11) { _rating = "TIGHT"; } else { _rating = "SAFE"; } _detail = _height.ToString("0.0") + "m • " + _seconds.ToString("0.0") + "s • cost " + Mathf.RoundToInt(_cost * 100f) + "% • left " + Mathf.RoundToInt(Mathf.Max(0f, _remaining) * 100f) + "%"; _visible = true; } private float FindWallEdge(Vector3 point, Vector3 normal, Collider original) { //IL_000f: 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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) float maximumHeight = MaximumHeight; RaycastHit val2 = default(RaycastHit); for (float num = 0.25f; num <= maximumHeight; num += 0.25f) { Vector3 val = point + Vector3.up * num + normal * 0.4f; if (!Physics.Raycast(val, -normal, ref val2, 1f, -5, (QueryTriggerInteraction)1) || (Object)(object)((RaycastHit)(ref val2)).collider == (Object)null || ((Object)(object)((RaycastHit)(ref val2)).collider != (Object)(object)original && Vector3.Angle(((RaycastHit)(ref val2)).normal, normal) > 30f)) { return num; } } return -1f; } private void SetUnavailable(string rating, string detail) { _rating = rating; _detail = detail; _height = (_seconds = (_cost = (_remaining = 0f))); _visible = true; } public void Draw(bool menuOpen) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: 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) if (!menuOpen && _visible && Event.current != null && (int)Event.current.type == 7) { EnsureAssets(); float num = Mathf.Clamp((float)Screen.width / 1920f, 0.75f, 1.25f); Rect rect = default(Rect); ((Rect)(ref rect))..ctor(((float)Screen.width - 460f * num) * 0.5f, (float)Screen.height - 272f * num, 460f * num, 58f * num); Color val = ((_rating == "SAFE") ? new Color(0.25f, 0.9f, 0.7f) : ((_rating == "TIGHT") ? new Color(1f, 0.7f, 0.2f) : new Color(1f, 0.34f, 0.25f))); DrawRect(rect, new Color(0.025f, 0.035f, 0.04f, 0.92f)); DrawOutline(rect, val); _title.normal.textColor = val; GUI.Label(new Rect(((Rect)(ref rect)).x + 10f * num, ((Rect)(ref rect)).y + 5f * num, ((Rect)(ref rect)).width - 20f * num, 21f * num), "CLIMB FORECAST • " + _rating, _title); GUI.Label(new Rect(((Rect)(ref rect)).x + 10f * num, ((Rect)(ref rect)).y + 30f * num, ((Rect)(ref rect)).width - 20f * num, 20f * num), _detail, _text); } } public void ResetScene() { _visible = false; if ((Object)(object)_pixel != (Object)null) { Object.Destroy((Object)(object)_pixel); } _pixel = null; _title = null; _text = null; } private void EnsureAssets() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_pixel != (Object)null)) { _pixel = new Texture2D(1, 1); _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _title = new GUIStyle(GUI.skin.label); _title.font = UiFontManager.DisplayFont; _title.fontSize = 12; _title.fontStyle = (FontStyle)1; _text = new GUIStyle(GUI.skin.label); _text.font = UiFontManager.BodyFont; _text.fontSize = 11; _text.normal.textColor = new Color(0.84f, 0.9f, 0.89f); } } private void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } private void DrawOutline(Rect rect, Color color) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, ((Rect)(ref rect)).width, 1f), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).yMax - 1f, ((Rect)(ref rect)).width, 1f), color); DrawRect(new Rect(((Rect)(ref rect)).x, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), color); DrawRect(new Rect(((Rect)(ref rect)).xMax - 1f, ((Rect)(ref rect)).y, 1f, ((Rect)(ref rect)).height), color); } } [Flags] internal enum SupplyKind { None = 0, Food = 1, Medical = 2, Climbing = 4, Mobility = 8, Antidote = 0x10 } internal sealed class PartySupplyPlayerSummary { public string Name; public int PocketItems; public int BackpackItems; public int Food; public int Medical; public int Climbing; public int Mobility; public int Antidotes; public int TotalItems => PocketItems + BackpackItems; } internal sealed class PartySupplyAdvisorManager { private readonly PlayerManager _players; private readonly ModConfig _settings; private readonly ManualLogSource _log; private readonly List _summaries = new List(); private readonly List _recommendations = new List(); private readonly Dictionary _classification = new Dictionary(StringComparer.OrdinalIgnoreCase); private float _nextRefresh; private float _nextErrorLog; private string _error = string.Empty; public bool Enabled { get { return _settings.PartySupplyAdvisorEnabled.Value; } set { _settings.PartySupplyAdvisorEnabled.Value = value; } } public bool IncludeBackpacks { get { return _settings.PartySupplyIncludeBackpacks.Value; } set { _settings.PartySupplyIncludeBackpacks.Value = value; } } public IList Players => _summaries.AsReadOnly(); public IList Recommendations => _recommendations.AsReadOnly(); public string Status { get { if (Enabled) { if (string.IsNullOrEmpty(_error)) { if (_summaries.Count != 0) { return _summaries.Count + " scout loadout(s), " + _recommendations.Count + " recommendation(s)"; } return "Waiting for synchronized party inventories"; } return _error; } return "Off"; } } public PartySupplyAdvisorManager(PlayerManager players, ModConfig settings, ManualLogSource log) { _players = players; _settings = settings; _log = log; } public void Tick() { if (!(Time.unscaledTime < _nextRefresh)) { _nextRefresh = Time.unscaledTime + 1.5f; Refresh(); } } public void Refresh() { try { RefreshCore(); _error = string.Empty; } catch (Exception ex) { _summaries.Clear(); _recommendations.Clear(); _error = "Supply analysis unavailable for current synchronized data"; if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Party Supply Advisor skipped a refresh: " + ex.Message)); } } } private void RefreshCore() { _summaries.Clear(); _recommendations.Clear(); if (!Enabled || !GameHandler.IsOnIsland) { return; } int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = int.MaxValue; int num9 = -1; PartySupplyPlayerSummary partySupplyPlayerSummary = null; PartySupplyPlayerSummary partySupplyPlayerSummary2 = null; PartySupplyPlayerSummary partySupplyPlayerSummary3 = null; int num10 = 0; IList entries = _players.Entries; for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; Character val = playerEntry?.Character; if ((Object)(object)val == (Object)null || (Object)(object)val.data == (Object)null || val.data.dead || (Object)(object)val.player == (Object)null) { continue; } PartySupplyPlayerSummary partySupplyPlayerSummary4 = new PartySupplyPlayerSummary(); partySupplyPlayerSummary4.Name = playerEntry.Name; PartySupplyPlayerSummary partySupplyPlayerSummary5 = partySupplyPlayerSummary4; Player player = val.player; ItemSlot[] itemSlots = player.itemSlots; if (itemSlots != null) { for (int j = 0; j < itemSlots.Length; j++) { Collect(itemSlots[j], partySupplyPlayerSummary5, backpack: false); } } if (IncludeBackpacks) { CollectBackpack(player.backpackSlot, partySupplyPlayerSummary5); } _summaries.Add(partySupplyPlayerSummary5); num += partySupplyPlayerSummary5.Food; num2 += partySupplyPlayerSummary5.Medical; num3 += partySupplyPlayerSummary5.Climbing; num4 += partySupplyPlayerSummary5.Mobility; num5 += partySupplyPlayerSummary5.Antidotes; if (partySupplyPlayerSummary5.Climbing > 0) { num10++; partySupplyPlayerSummary3 = partySupplyPlayerSummary5; } if (partySupplyPlayerSummary5.TotalItems < num8) { num8 = partySupplyPlayerSummary5.TotalItems; partySupplyPlayerSummary = partySupplyPlayerSummary5; } if (partySupplyPlayerSummary5.TotalItems > num9) { num9 = partySupplyPlayerSummary5.TotalItems; partySupplyPlayerSummary2 = partySupplyPlayerSummary5; } if (val.refs != null && (Object)(object)val.refs.afflictions != (Object)null) { if (val.refs.afflictions.GetCurrentStatus((STATUSTYPE)0) >= 0.2f) { num6++; } if (val.refs.afflictions.GetCurrentStatus((STATUSTYPE)3) >= 0.08f) { num7++; } } } if (_summaries.Count != 0) { if (num3 == 0) { _recommendations.Add("No rope, chain, piton, spike, or climbing cannon detected."); } if (num2 == 0) { _recommendations.Add((num6 > 0) ? (num6 + " injured scout(s), but no recovery item was detected.") : "No medical or recovery item was detected."); } else if (num6 > num2) { _recommendations.Add(num6 + " injured scouts share only " + num2 + " detected recovery item(s)."); } if (num7 > 0 && num5 == 0) { _recommendations.Add(num7 + " poisoned scout(s), but no antidote was detected."); } if (num == 0) { _recommendations.Add("No packaged food, berries, mushrooms, or hunger-restoring item detected."); } if (_summaries.Count > 1 && partySupplyPlayerSummary2 != null && partySupplyPlayerSummary != null && num9 - num8 >= 3) { _recommendations.Add("Redistribute supplies: " + partySupplyPlayerSummary2.Name + " carries " + num9 + ", while " + partySupplyPlayerSummary.Name + " carries " + num8 + "."); } if (_summaries.Count > 2 && num3 > 1 && num10 == 1 && partySupplyPlayerSummary3 != null) { _recommendations.Add("All climbing support is concentrated on " + partySupplyPlayerSummary3.Name + "."); } if (num4 == 0 && _recommendations.Count < 4) { _recommendations.Add("No emergency mobility item such as a balloon or parachute was detected."); } if (_recommendations.Count == 0) { _recommendations.Add("Party coverage looks balanced from synchronized item data."); } } } private void CollectBackpack(BackpackSlot backpackSlot, PartySupplyPlayerSummary summary) { BackpackData val = default(BackpackData); if (backpackSlot != null && ((ItemSlot)backpackSlot).data != null && ((ItemSlot)backpackSlot).data.TryGetDataEntry((DataEntryKey)7, ref val) && val != null && val.itemSlots != null) { for (int i = 0; i < val.itemSlots.Length; i++) { Collect(val.itemSlots[i], summary, backpack: true); } } } private void Collect(ItemSlot slot, PartySupplyPlayerSummary summary, bool backpack) { if (slot != null && !((Object)(object)slot.prefab == (Object)null)) { if (backpack) { summary.BackpackItems++; } else { summary.PocketItems++; } SupplyKind supplyKind = Classify(slot.prefab); if ((supplyKind & SupplyKind.Food) != SupplyKind.None) { summary.Food++; } if ((supplyKind & SupplyKind.Medical) != SupplyKind.None) { summary.Medical++; } if ((supplyKind & SupplyKind.Climbing) != SupplyKind.None) { summary.Climbing++; } if ((supplyKind & SupplyKind.Mobility) != SupplyKind.None) { summary.Mobility++; } if ((supplyKind & SupplyKind.Antidote) != SupplyKind.None) { summary.Antidotes++; } } } private SupplyKind Classify(Item item) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) string text = ((item.UIData == null || string.IsNullOrEmpty(item.UIData.itemName)) ? ((Object)item).name : item.UIData.itemName).ToLowerInvariant(); string key = item.itemID + "|" + text; if (_classification.TryGetValue(key, out var value)) { return value; } SupplyKind supplyKind = SupplyKind.None; if ((item.itemTags & 0xE) != 0 || Contains(text, "food", "berry", "mushroom", "ration", "marshmallow", "coconut", "banana")) { supplyKind |= SupplyKind.Food; } if (Contains(text, "bandage", "medkit", "medical", "first aid", "remedy", "cure", "antidote", "panacea")) { supplyKind |= SupplyKind.Medical; } if (Contains(text, "antidote")) { supplyKind |= SupplyKind.Medical | SupplyKind.Antidote; } if (Contains(text, "rope", "chain", "piton", "climbing spike", "rescue claw", "rescue hook")) { supplyKind |= SupplyKind.Climbing; } if (Contains(text, "balloon", "parachute", "cannon", "magic bean", "teleporter")) { supplyKind |= SupplyKind.Mobility; } ItemAction[] componentsInChildren = ((Component)item).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { string text2 = (((Object)(object)componentsInChildren[i] == (Object)null) ? string.Empty : ((object)componentsInChildren[i]).GetType().Name.ToLowerInvariant()); if (text2.Contains("heal")) { supplyKind |= SupplyKind.Medical; } if (text2.Contains("restorehunger")) { supplyKind |= SupplyKind.Food; } } _classification[key] = supplyKind; return supplyKind; } private static bool Contains(string value, params string[] tokens) { for (int i = 0; i < tokens.Length; i++) { if (value.Contains(tokens[i])) { return true; } } return false; } public void ResetScene() { _summaries.Clear(); _recommendations.Clear(); _classification.Clear(); _error = string.Empty; _nextRefresh = 0f; } } internal sealed class HotkeyBindingRecord { public PluginInfo Plugin; public ConfigEntryBase Entry; public KeyCode MainKey; public KeyCode[] Modifiers; public string Shortcut; public string Label => Plugin.Metadata.Name + " • " + Entry.Definition.Key; } internal sealed class HotkeyConflictRecord { public string Shortcut; public readonly List Bindings = new List(); public HotkeyBindingRecord SuggestedTarget; public KeyCode SuggestedKey; public string SuggestedShortcut; } internal sealed class HotkeyConflictDoctor { private static readonly KeyCode[] CandidateKeys = (KeyCode[])(object)new KeyCode[14] { (KeyCode)287, (KeyCode)290, (KeyCode)291, (KeyCode)292, (KeyCode)293, (KeyCode)278, (KeyCode)279, (KeyCode)277, (KeyCode)127, (KeyCode)280, (KeyCode)281, (KeyCode)257, (KeyCode)258, (KeyCode)259 }; private readonly ModConfigBrowser _browser; private readonly ModConfig _settings; private readonly ManualLogSource _log; private readonly List _conflicts = new List(); private readonly HashSet _used = new HashSet(StringComparer.Ordinal); private float _nextRefresh; private float _nextErrorLog; private string _error = string.Empty; public bool Enabled { get { return _settings.HotkeyConflictDoctorEnabled.Value; } set { _settings.HotkeyConflictDoctorEnabled.Value = value; if (!value) { _conflicts.Clear(); } } } public IList Conflicts => _conflicts.AsReadOnly(); public string Status { get { if (Enabled) { if (string.IsNullOrEmpty(_error)) { if (_conflicts.Count != 0) { return _conflicts.Count + " exact shortcut conflict(s) found"; } return "No exact enabled-plugin shortcut conflicts found"; } return _error; } return "Off"; } } public HotkeyConflictDoctor(ModConfigBrowser browser, ModConfig settings, ManualLogSource log) { _browser = browser; _settings = settings; _log = log; } public void Tick() { if (Enabled && !(Time.unscaledTime < _nextRefresh)) { _nextRefresh = Time.unscaledTime + 5f; Refresh(); } } public void Refresh() { try { RefreshCore(); _error = string.Empty; } catch (Exception ex) { _conflicts.Clear(); _error = "Shortcut scan unavailable for one or more loaded configs"; if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Hotkey Conflict Doctor skipped a scan: " + ex.Message)); } } } private void RefreshCore() { //IL_01a9: 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_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) _conflicts.Clear(); _used.Clear(); if (!Enabled) { return; } Dictionary> dictionary = new Dictionary>(StringComparer.Ordinal); IList plugins = _browser.Plugins; for (int i = 0; i < plugins.Count; i++) { PluginInfo val = plugins[i]; if (val == null || (Object)(object)val.Instance == (Object)null || !((Behaviour)val.Instance).enabled) { continue; } ICollection values = ((IDictionary)val.Instance.Config).Values; foreach (ConfigEntryBase item in values) { if (TryRead(val, item, out var binding) && (int)binding.MainKey != 0) { string text = Canonical(binding.MainKey, binding.Modifiers); _used.Add(text); if (!dictionary.TryGetValue(text, out var value)) { value = (dictionary[text] = new List()); } value.Add(binding); } } } foreach (KeyValuePair> item2 in dictionary) { if (item2.Value.Count >= 2) { HotkeyConflictRecord hotkeyConflictRecord = new HotkeyConflictRecord(); hotkeyConflictRecord.Shortcut = item2.Value[0].Shortcut; HotkeyConflictRecord hotkeyConflictRecord2 = hotkeyConflictRecord; hotkeyConflictRecord2.Bindings.AddRange(item2.Value); hotkeyConflictRecord2.SuggestedTarget = ChooseTarget(item2.Value); hotkeyConflictRecord2.SuggestedKey = FindSuggestion((KeyCode[])((hotkeyConflictRecord2.SuggestedTarget == null) ? ((Array)new KeyCode[0]) : ((Array)hotkeyConflictRecord2.SuggestedTarget.Modifiers))); hotkeyConflictRecord2.SuggestedShortcut = FormatShortcut(hotkeyConflictRecord2.SuggestedKey, (KeyCode[])((hotkeyConflictRecord2.SuggestedTarget == null) ? ((Array)new KeyCode[0]) : ((Array)hotkeyConflictRecord2.SuggestedTarget.Modifiers))); _conflicts.Add(hotkeyConflictRecord2); } } _conflicts.Sort((HotkeyConflictRecord a, HotkeyConflictRecord b) => string.Compare(a.Shortcut, b.Shortcut, StringComparison.OrdinalIgnoreCase)); } public ActionResult ApplySuggestion(HotkeyConflictRecord conflict) { //IL_000c: 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_0053: 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) if (conflict == null || conflict.SuggestedTarget == null || (int)conflict.SuggestedKey == 0) { return ActionResult.Fail("No safe unused suggestion is available."); } try { HotkeyBindingRecord suggestedTarget = conflict.SuggestedTarget; if (suggestedTarget.Entry.SettingType == typeof(KeyboardShortcut)) { suggestedTarget.Entry.BoxedValue = (object)new KeyboardShortcut(conflict.SuggestedKey, suggestedTarget.Modifiers); } else { if (!(suggestedTarget.Entry.SettingType == typeof(KeyCode))) { return ActionResult.Fail("The selected binding type is no longer supported."); } suggestedTarget.Entry.BoxedValue = conflict.SuggestedKey; } suggestedTarget.Entry.ConfigFile.Save(); string message = suggestedTarget.Label + " reassigned to " + conflict.SuggestedShortcut + ". Some mods require restart."; Refresh(); return ActionResult.Ok(message); } catch (Exception ex) { return ActionResult.Fail("Shortcut update failed: " + ex.Message); } } private unsafe static bool TryRead(PluginInfo plugin, ConfigEntryBase entry, out HotkeyBindingRecord binding) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) binding = null; if (entry == null) { return false; } if (entry.SettingType == typeof(KeyboardShortcut)) { KeyboardShortcut val = (KeyboardShortcut)entry.BoxedValue; List list = new List(((KeyboardShortcut)(ref val)).Modifiers); binding = new HotkeyBindingRecord { Plugin = plugin, Entry = entry, MainKey = ((KeyboardShortcut)(ref val)).MainKey, Modifiers = list.ToArray(), Shortcut = ((object)(*(KeyboardShortcut*)(&val))/*cast due to .constrained prefix*/).ToString() }; return true; } if (entry.SettingType == typeof(KeyCode)) { KeyCode val2 = (KeyCode)entry.BoxedValue; binding = new HotkeyBindingRecord { Plugin = plugin, Entry = entry, MainKey = val2, Modifiers = (KeyCode[])(object)new KeyCode[0], Shortcut = ((object)val2).ToString() }; return true; } return false; } private static HotkeyBindingRecord ChooseTarget(List bindings) { for (int num = bindings.Count - 1; num >= 0; num--) { if (bindings[num].Plugin.Metadata.GUID != "com.dougl.peaktrollmod") { return bindings[num]; } } return bindings[bindings.Count - 1]; } private KeyCode FindSuggestion(KeyCode[] modifiers) { for (int i = 0; i < CandidateKeys.Length; i++) { if (!_used.Contains(Canonical(CandidateKeys[i], modifiers))) { return CandidateKeys[i]; } } return (KeyCode)0; } private static string Canonical(KeyCode main, KeyCode[] modifiers) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected I4, but got Unknown int[] array = new int[(modifiers != null) ? modifiers.Length : 0]; for (int i = 0; i < array.Length; i++) { array[i] = (int)modifiers[i]; } Array.Sort(array); string text = ((int)main).ToString(); for (int j = 0; j < array.Length; j++) { text = text + "+" + array[j]; } return text; } private static string FormatShortcut(KeyCode main, KeyCode[] modifiers) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if ((int)main == 0) { return "unavailable"; } string text = string.Empty; if (modifiers != null) { for (int i = 0; i < modifiers.Length; i++) { text = string.Concat(text, modifiers[i], " + "); } } return text + main; } } internal sealed class InfiniteRescueClawManager { private sealed class BodyState { public bool UseGravity; public float MaxLinearVelocity; } private sealed class HookState { public float Range; public float RangeDownward; public float MaxWallHookTime; public bool Zipping; public float ZipDeadline; public Character Character; public readonly Dictionary Bodies = new Dictionary(); } private const float EffectiveInfiniteRange = 5000f; private const float ZipSpeed = 45f; private const float ZipVelocityLimit = 90f; private const float ExtendedWallHookTime = 120f; private static readonly FieldInfo IsPullingField = ReflectionHelpers.Field(typeof(RescueHook), "isPulling"); private static readonly FieldInfo HitNothingField = ReflectionHelpers.Field(typeof(RescueHook), "hitNothing"); private static readonly FieldInfo TargetPlayerField = ReflectionHelpers.Field(typeof(RescueHook), "targetPlayer"); private static readonly FieldInfo TargetRigField = ReflectionHelpers.Field(typeof(RescueHook), "targetRig"); private static readonly FieldInfo TargetPositionField = ReflectionHelpers.Field(typeof(RescueHook), "targetPos"); private static readonly FieldInfo RagdollRigidbodiesField = ReflectionHelpers.Field(typeof(CharacterRagdoll), "rigidbodies"); private readonly ModConfig _settings; private readonly ManualLogSource _log; private readonly Dictionary _states = new Dictionary(); private bool _standaloneDetected; private float _nextStandaloneCheck; private float _nextErrorLog; public bool Enabled { get { return _settings.InfiniteRescueClawReachEnabled.Value; } set { _settings.InfiniteRescueClawReachEnabled.Value = value; if (!value) { RestoreAll(); } } } public bool StandaloneDetected { get { RefreshStandaloneDetection(); return _standaloneDetected; } } public string Status { get { if (!StandaloneDetected) { if (!Enabled) { return "Off"; } return "Map-wide wall grapple and distant-anchor zip enabled"; } return "Yielding to standalone Rescue Hook Infinite Range"; } } public InfiniteRescueClawManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { RefreshStandaloneDetection(); if (!Enabled || _standaloneDetected) { RestoreAll(); return; } try { Character localCharacter = Character.localCharacter; Item val = (((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null) ? null : localCharacter.data.currentItem); RestoreNoLongerHeld(val); if (!((Object)(object)val == (Object)null)) { RescueHook[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { ApplyRange(componentsInChildren[i]); } } } catch (Exception ex) { FailSafe("range update", ex); } } public void FixedTick() { if (!Enabled || _standaloneDetected) { return; } try { Character localCharacter = Character.localCharacter; Item val = (((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null) ? null : localCharacter.data.currentItem); if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead || localCharacter.data.fullyPassedOut || (Object)(object)val == (Object)null) { StopAllZips(releaseHook: true); return; } RescueHook[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { UpdateZip(componentsInChildren[i], localCharacter); } } catch (Exception ex) { FailSafe("grapple zip", ex); } } private void ApplyRange(RescueHook hook) { if (!((Object)(object)hook == (Object)null)) { if (!_states.TryGetValue(hook, out var value)) { HookState hookState = new HookState(); hookState.Range = hook.range; hookState.RangeDownward = hook.rangeDownward; hookState.MaxWallHookTime = hook.maxWallHookTime; value = hookState; _states.Add(hook, value); } hook.range = 5000f; hook.rangeDownward = 5000f; } } private void UpdateZip(RescueHook hook, Character character) { //IL_006a: 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_006f: 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_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0156: 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_0160: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hook == (Object)null || !_states.TryGetValue(hook, out var value)) { return; } bool flag = ReadBool(IsPullingField, hook); bool flag2 = ReadBool(HitNothingField, hook); Character val = ReadObject(TargetPlayerField, hook); Rigidbody val2 = ReadObject(TargetRigField, hook); Vector3 val3 = (Vector3)((TargetPositionField == null) ? Vector3.zero : ((Vector3)TargetPositionField.GetValue(hook))); bool flag3 = flag && !flag2 && (Object)(object)val == (Object)null && (Object)(object)val2 == (Object)null && PlayerActions.Finite(val3); float num = (flag3 ? Vector3.Distance(character.Center, val3) : 0f); float num2 = ((val3.y < character.Center.y) ? value.RangeDownward : value.Range); if (!value.Zipping) { if (!flag3 || num <= Mathf.Max(5f, num2 + 1f)) { return; } StartZip(hook, value, character, num); } if (!flag3 || (Object)(object)value.Character != (Object)(object)character || Time.unscaledTime >= value.ZipDeadline) { StopZip(hook, value, releaseHook: true); return; } float num3 = Mathf.Max(2f, hook.stopPullDistance); if (num <= num3 + 0.35f) { StopZip(hook, value, releaseHook: true); return; } Vector3 val4 = val3 - character.Center; Vector3 normalized = ((Vector3)(ref val4)).normalized; float num4 = Mathf.Min(45f, Mathf.Max(8f, (num - num3) * 4f)); Vector3 linearVelocity = normalized * num4; foreach (KeyValuePair body in value.Bodies) { Rigidbody key = body.Key; if (!((Object)(object)key == (Object)null)) { key.useGravity = false; key.maxLinearVelocity = Mathf.Max(body.Value.MaxLinearVelocity, 90f); key.linearVelocity = linearVelocity; } } character.data.sinceGrounded = 0f; } private void StartZip(RescueHook hook, HookState state, Character character, float distance) { if (character.refs == null || (Object)(object)character.refs.ragdoll == (Object)null || RagdollRigidbodiesField == null || !(RagdollRigidbodiesField.GetValue(character.refs.ragdoll) is List list)) { return; } state.Bodies.Clear(); for (int i = 0; i < list.Count; i++) { Rigidbody val = list[i]; if ((Object)(object)val != (Object)null && !state.Bodies.ContainsKey(val)) { state.Bodies.Add(val, new BodyState { UseGravity = val.useGravity, MaxLinearVelocity = val.maxLinearVelocity }); } } if (state.Bodies.Count != 0) { state.Character = character; state.ZipDeadline = Time.unscaledTime + Mathf.Clamp(distance / 45f + 2f, 3f, 120f); state.Zipping = true; hook.maxWallHookTime = 120f; } } private void StopZip(RescueHook hook, HookState state, bool releaseHook) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!state.Zipping) { return; } foreach (KeyValuePair body in state.Bodies) { Rigidbody key = body.Key; if (!((Object)(object)key == (Object)null)) { key.useGravity = body.Value.UseGravity; key.maxLinearVelocity = body.Value.MaxLinearVelocity; key.linearVelocity = Vector3.ClampMagnitude(key.linearVelocity, 8f); } } state.Bodies.Clear(); state.Character = null; state.Zipping = false; state.ZipDeadline = 0f; if ((Object)(object)hook != (Object)null) { hook.maxWallHookTime = state.MaxWallHookTime; if (releaseHook && (Object)(object)((MonoBehaviourPun)hook).photonView != (Object)null && ((MonoBehaviourPun)hook).photonView.IsMine) { ((MonoBehaviourPun)hook).photonView.RPC("RPCA_LetGo", (RpcTarget)0, Array.Empty()); } } } private void StopAllZips(bool releaseHook) { foreach (KeyValuePair state in _states) { if (state.Value.Zipping) { StopZip(state.Key, state.Value, releaseHook); } } } private void RestoreNoLongerHeld(Item held) { List list = new List(); foreach (KeyValuePair state in _states) { RescueHook key = state.Key; if ((Object)(object)key == (Object)null) { RestoreBodies(state.Value); list.Add(key); } else if ((Object)(object)held == (Object)null || (Object)(object)((Component)key).GetComponentInParent() != (Object)(object)held) { StopZip(key, state.Value, releaseHook: true); RestoreHook(key, state.Value); list.Add(key); } } for (int i = 0; i < list.Count; i++) { _states.Remove(list[i]); } } public void RestoreAll() { foreach (KeyValuePair state in _states) { if ((Object)(object)state.Key != (Object)null) { StopZip(state.Key, state.Value, releaseHook: true); RestoreHook(state.Key, state.Value); } else { RestoreBodies(state.Value); } } _states.Clear(); } private static void RestoreHook(RescueHook hook, HookState state) { hook.range = state.Range; hook.rangeDownward = state.RangeDownward; hook.maxWallHookTime = state.MaxWallHookTime; } private static void RestoreBodies(HookState state) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) foreach (KeyValuePair body in state.Bodies) { if ((Object)(object)body.Key != (Object)null) { body.Key.useGravity = body.Value.UseGravity; body.Key.maxLinearVelocity = body.Value.MaxLinearVelocity; body.Key.linearVelocity = Vector3.ClampMagnitude(body.Key.linearVelocity, 8f); } } state.Bodies.Clear(); state.Character = null; state.Zipping = false; state.ZipDeadline = 0f; } public void ResetScene() { RestoreAll(); } private void FailSafe(string operation, Exception ex) { RestoreAll(); if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Infinite Rescue Claw restored defaults after a " + operation + " error: " + ex.Message)); } } private static bool ReadBool(FieldInfo field, RescueHook hook) { if (field != null) { return (bool)field.GetValue(hook); } return false; } private static T ReadObject(FieldInfo field, RescueHook hook) where T : class { if (!(field == null)) { return field.GetValue(hook) as T; } return null; } private void RefreshStandaloneDetection() { if (Time.unscaledTime < _nextStandaloneCheck) { return; } _nextStandaloneCheck = Time.unscaledTime + 5f; _standaloneDetected = false; foreach (KeyValuePair pluginInfo in Chainloader.PluginInfos) { PluginInfo value = pluginInfo.Value; if (value != null && !((Object)(object)value.Instance == (Object)null) && ((Behaviour)value.Instance).enabled && !(pluginInfo.Key == "com.dougl.peaktrollmod")) { string text = Normalize(pluginInfo.Key + " " + ((value.Metadata == null) ? string.Empty : value.Metadata.Name)); if (text.Contains("rescuehookinfiniterange") || text.Contains("infiniterescueclaw") || text.Contains("infiniterescuehook")) { _standaloneDetected = true; break; } } } } private static string Normalize(string value) { char[] array = new char[value.Length]; int length = 0; for (int i = 0; i < value.Length; i++) { if (char.IsLetterOrDigit(value[i])) { array[length++] = char.ToLowerInvariant(value[i]); } } return new string(array, 0, length); } } internal struct HungerRateState { public bool Applied; public float Original; } internal sealed class HungerAmplifierManager { private sealed class HostJob { public float Multiplier; public float Pending; } private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private readonly Dictionary _hostJobs = new Dictionary(); private bool _enabled; private float _multiplier = 5f; public HungerAmplifierManager(ManualLogSource log, PlayerManager players, PlayerActions actions) { _log = log; _players = players; _actions = actions; } public ActionResult Set(bool enabled, float multiplier) { _multiplier = Mathf.Clamp(multiplier, 2f, 20f); _enabled = enabled; _log.LogInfo((object)("Hunger rate amplifier " + (enabled ? ("set to " + _multiplier.ToString("0.0") + "x.") : "disabled."))); return ActionResult.Ok(enabled ? ("Natural hunger rate amplified to " + _multiplier.ToString("0.0") + "x.") : "Natural hunger rate restored."); } public ActionResult SetHostFallback(PlayerEntry target, bool enabled, float multiplier) { if (!_players.IsHost) { return ActionResult.Fail("An unmodded target requires the current Photon host to amplify hunger."); } if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.afflictions == (Object)null) { return ActionResult.Fail("Target hunger state is unavailable."); } if (!enabled) { _hostJobs.Remove(target.ActorNumber); return ActionResult.Ok("Stopped host-native hunger amplification for " + target.Name + "."); } if (!_hostJobs.TryGetValue(target.ActorNumber, out var value)) { value = new HostJob(); _hostJobs[target.ActorNumber] = value; } value.Multiplier = Mathf.Clamp(multiplier, 2f, 20f); value.Pending = 0f; return ActionResult.Ok("Host-native hunger amplification set to " + value.Multiplier.ToString("0.0") + "x for " + target.Name + "; target mod not required."); } public void Tick() { if (_hostJobs.Count == 0) { return; } if (!PhotonNetwork.InRoom || !_players.IsHost) { _hostJobs.Clear(); return; } float num = Mathf.Clamp(Time.deltaTime, 0f, 0.25f); if (num <= 0f) { return; } List list = new List(_hostJobs.Keys); for (int i = 0; i < list.Count; i++) { int num2 = list[i]; if (!_hostJobs.TryGetValue(num2, out var value)) { continue; } PlayerEntry playerEntry = _players.Find(num2); if (playerEntry == null) { _hostJobs.Remove(num2); } else { if ((Object)(object)playerEntry.Character == (Object)null || (Object)(object)playerEntry.Character.data == (Object)null || playerEntry.Character.data.dead || playerEntry.Character.refs == null || (Object)(object)playerEntry.Character.refs.afflictions == (Object)null) { continue; } float hungerPerSecond = playerEntry.Character.refs.afflictions.hungerPerSecond; if (float.IsNaN(hungerPerSecond) || float.IsInfinity(hungerPerSecond) || hungerPerSecond <= 0f) { continue; } value.Pending = Mathf.Min(0.25f, value.Pending + hungerPerSecond * (Mathf.Clamp(value.Multiplier, 2f, 20f) - 1f) * num); if (!(value.Pending < 0.01f)) { float num3 = Mathf.Min(value.Pending, 0.05f); ActionResult actionResult = _actions.ApplyStatusAsHost(playerEntry, 1, num3); if (actionResult.Success) { value.Pending = Mathf.Max(0f, value.Pending - num3); } else { value.Pending = 0f; } } } } } public HungerRateState Begin(CharacterAfflictions afflictions) { HungerRateState result = default(HungerRateState); if (!_enabled || (Object)(object)afflictions == (Object)null || (Object)(object)afflictions.character == (Object)null || !afflictions.character.IsLocal) { return result; } float hungerPerSecond = afflictions.hungerPerSecond; if (float.IsNaN(hungerPerSecond) || float.IsInfinity(hungerPerSecond) || hungerPerSecond <= 0f) { return result; } result.Applied = true; result.Original = hungerPerSecond; afflictions.hungerPerSecond = hungerPerSecond * Mathf.Clamp(_multiplier, 2f, 20f); return result; } public void Restore(CharacterAfflictions afflictions, HungerRateState state) { if (state.Applied && (Object)(object)afflictions != (Object)null) { afflictions.hungerPerSecond = state.Original; } } public void Reset() { _enabled = false; _multiplier = 5f; _hostJobs.Clear(); } public void ResetTarget(int actor) { _hostJobs.Remove(actor); } } [HarmonyPatch(typeof(CharacterAfflictions), "UpdateNormalStatuses")] internal static class HungerRatePatch { private static void Prefix(CharacterAfflictions __instance, ref HungerRateState __state) { TrollModPlugin instance = TrollModPlugin.Instance; __state = (((Object)(object)instance == (Object)null || instance.HungerAmplifier == null) ? default(HungerRateState) : instance.HungerAmplifier.Begin(__instance)); } private static Exception Finalizer(CharacterAfflictions __instance, HungerRateState __state, Exception __exception) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.HungerAmplifier != null) { instance.HungerAmplifier.Restore(__instance, __state); } return __exception; } } internal sealed class InfiniteJetpackFuelManager { private readonly ModConfig _settings; private readonly ManualLogSource _log; private ItemInstanceData _cachedData; private FloatItemData _cachedFuel; private FloatItemData _cachedPercentage; private float _originalFuel; private float _originalPercentage; private bool _hadPercentage; private float _nextErrorLog; private string _status = "Off"; public bool Enabled { get { return _settings.InfiniteJetpackFuelEnabled.Value; } set { if (!value) { Restore(); } _settings.InfiniteJetpackFuelEnabled.Value = value; _status = (value ? "Equip a Jetpack to keep its fuel full." : "Off"); } } public string Status => _status; public InfiniteJetpackFuelManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Invalid comparison between Unknown and I4 if (!Enabled) { if (_cachedData != null) { Restore(); } return; } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.player == (Object)null || (Object)(object)localCharacter.data == (Object)null || localCharacter.data.dead) { Restore(); _status = "Waiting for the local scout."; return; } BackpackSlot backpackSlot = localCharacter.player.backpackSlot; if (backpackSlot == null || (int)backpackSlot.backpackType != 3 || ((ItemSlot)backpackSlot).data == null || (Object)(object)((ItemSlot)backpackSlot).prefab == (Object)null) { Restore(); _status = "Equip a Jetpack to keep its fuel full."; return; } try { JetpackItem component = ((Component)((ItemSlot)backpackSlot).prefab).GetComponent(); FloatItemData val = default(FloatItemData); if ((Object)(object)component == (Object)null || !((ItemSlot)backpackSlot).data.TryGetDataEntry((DataEntryKey)10, ref val) || val == null) { Restore(); _status = "This equipped backpack does not expose PEAK's jetpack fuel data."; return; } if (!object.ReferenceEquals(_cachedData, ((ItemSlot)backpackSlot).data)) { Restore(); Cache(((ItemSlot)backpackSlot).data, val); } float num = component.startingFuel; if (float.IsNaN(num) || float.IsInfinity(num) || num <= 0f) { num = Mathf.Max(1f, _originalFuel); } _cachedFuel.Value = num; if (_cachedPercentage != null) { _cachedPercentage.Value = 1f; } _status = "Active — local Jetpack fuel is held at " + num.ToString("0.#") + "."; } catch (Exception ex) { Restore(); _status = "Jetpack fuel update skipped safely."; if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Infinite Jetpack Fuel skipped an update: " + ex.Message)); } } } private void Cache(ItemInstanceData data, FloatItemData fuel) { _cachedData = data; _cachedFuel = fuel; _originalFuel = fuel.Value; _cachedPercentage = null; _hadPercentage = data.TryGetDataEntry((DataEntryKey)11, ref _cachedPercentage) && _cachedPercentage != null; _originalPercentage = (_hadPercentage ? _cachedPercentage.Value : 0f); } public void Restore() { try { if (_cachedFuel != null) { _cachedFuel.Value = _originalFuel; } if (_hadPercentage && _cachedPercentage != null) { _cachedPercentage.Value = _originalPercentage; } } catch (Exception ex) { if (Time.unscaledTime >= _nextErrorLog) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Infinite Jetpack Fuel cleanup failed safely: " + ex.Message)); } } _cachedData = null; _cachedFuel = null; _cachedPercentage = null; _originalFuel = 0f; _originalPercentage = 0f; _hadPercentage = false; } public void ResetScene() { Restore(); _status = (Enabled ? "Waiting for the local scout." : "Off"); } } internal sealed class BiggerBackpackManager { internal const int BackpackSlots = 8; internal const int FannyPackSlots = 4; private const int NativeBackpackSlots = 4; private const int NativeFannyPackSlots = 2; private readonly ModConfig _settings; private readonly ManualLogSource _log; private static readonly FieldInfo WheelSlicesField = AccessTools.Field(typeof(BackpackWheel), "slices"); private float _nextErrorLog; private string _status = "Off"; public bool Enabled { get { return _settings.BiggerBackpackEnabled.Value; } set { _settings.BiggerBackpackEnabled.Value = value; _status = (value ? "Active — Backpack 8 slots, Fanny Pack 4 slots." : "Off — occupied extra slots remain accessible until emptied."); if (!value) { TryRestoreLocalCapacity(); } } } public string Status => _status; public BiggerBackpackManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && !((Object)(object)localCharacter.player == (Object)null)) { PrepareEquipped(localCharacter.player.backpackSlot); } } internal void PrepareEquipped(BackpackSlot slot) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) BackpackData val = default(BackpackData); if (slot == null || ((ItemSlot)slot).data == null || !((ItemSlot)slot).data.TryGetDataEntry((DataEntryKey)7, ref val) || val == null) { return; } int num = ExpandedCapacity(slot.backpackType); int num2 = NativeCapacity(slot.backpackType); if (num > 0) { if (Enabled) { EnsureCapacity(val, num); _status = "Active — " + DisplayName(slot.backpackType) + " has " + num + " slots."; } else if (RestoreNativeCapacity(val, slot.backpackType)) { _status = "Off"; } else { _status = "Off — empty slots " + num2 + "–" + (val.itemSlots.Length - 1) + " before capacity can return to normal."; } } } internal void PrepareBackpackItem(Backpack backpack) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!Enabled || (Object)(object)backpack == (Object)null) { return; } int num = ExpandedCapacity(backpack.backpackType); if (num <= 0) { return; } try { BackpackData data = ((Item)backpack).GetData((DataEntryKey)7); EnsureCapacity(data, num); } catch (Exception ex) { LogFailure("backpack item capacity", ex); } } internal bool PrepareWheel(BackpackReference reference, ref int requestedSlots, BackpackType type, BackpackWheel wheel) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) int num = ExpandedCapacity(type); if (num <= 0) { return true; } try { BackpackData data = ((BackpackReference)(ref reference)).GetData(); if (data == null) { return true; } Array array = (((Object)(object)wheel == (Object)null || WheelSlicesField == null) ? null : (WheelSlicesField.GetValue(wheel) as Array)); int num2 = ((array != null) ? Math.Max(0, array.Length - 1) : 0); if (Enabled) { if (num2 < num) { _status = "Bigger Backpack disabled for this UI: PEAK exposed only " + num2 + " radial slots."; CloseUnsafeWheel(wheel); return false; } EnsureCapacity(data, num); requestedSlots = num; return true; } NativeCapacity(type); if (!RestoreNativeCapacity(data, type)) { if (num2 < data.itemSlots.Length) { _status = "Empty the occupied extra slots before opening this pack with PEAK's current wheel."; CloseUnsafeWheel(wheel); return false; } requestedSlots = data.itemSlots.Length; } return true; } catch (Exception ex) { LogFailure("backpack wheel capacity", ex); CloseUnsafeWheel(wheel); return false; } } private static void CloseUnsafeWheel(BackpackWheel wheel) { if ((Object)(object)wheel != (Object)null) { ((Component)wheel).gameObject.SetActive(false); } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null) { localCharacter.data.usingBackpackWheel = false; } } public void ResetScene() { TryRestoreLocalCapacity(); _status = (Enabled ? "Waiting for an equipped Backpack or Fanny Pack." : "Off"); } private void TryRestoreLocalCapacity() { Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && !((Object)(object)localCharacter.player == (Object)null)) { PrepareEquipped(localCharacter.player.backpackSlot); } } internal static void PrepareIncoming(BackpackData data, ref InventorySyncData incoming) { if (data != null && incoming.slots != null) { int num = Math.Min(8, incoming.slots.Length); if (num > 4) { EnsureCapacity(data, num); } } } internal static void EnsureCapacity(BackpackData data, int capacity) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown if (data == null) { return; } capacity = Math.Max(0, Math.Min(8, capacity)); ItemSlot[] itemSlots = data.itemSlots; if (itemSlots != null && itemSlots.Length >= capacity) { return; } ItemSlot[] array = (ItemSlot[])(object)new ItemSlot[capacity]; int num = ((itemSlots != null) ? Math.Min(itemSlots.Length, array.Length) : 0); for (int i = 0; i < num; i++) { array[i] = itemSlots[i]; } for (int j = 0; j < array.Length; j++) { if (array[j] == null) { array[j] = new ItemSlot((byte)j); } } data.itemSlots = array; } private static bool TryShrink(BackpackData data, int capacity) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown if (data == null || data.itemSlots == null || data.itemSlots.Length <= capacity) { return true; } for (int i = capacity; i < data.itemSlots.Length; i++) { if (data.itemSlots[i] != null && !data.itemSlots[i].IsEmpty()) { return false; } } ItemSlot[] array = (ItemSlot[])(object)new ItemSlot[capacity]; Array.Copy(data.itemSlots, array, capacity); for (int j = 0; j < array.Length; j++) { if (array[j] == null) { array[j] = new ItemSlot((byte)j); } } data.itemSlots = array; return true; } private static bool RestoreNativeCapacity(BackpackData data, BackpackType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Invalid comparison between Unknown and I4 int num = NativeCapacity(type); if (data == null || data.itemSlots == null) { return true; } for (int i = num; i < data.itemSlots.Length; i++) { if (data.itemSlots[i] != null && !data.itemSlots[i].IsEmpty()) { return false; } } if ((int)type != 2) { return TryShrink(data, 4); } return true; } private static int ExpandedCapacity(BackpackType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)type == 1) { return 8; } if ((int)type == 2) { return 4; } return 0; } private static int NativeCapacity(BackpackType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)type != 2) { return 4; } return 2; } private static string DisplayName(BackpackType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)type != 2) { return "Backpack"; } return "Fanny Pack"; } private void LogFailure(string operation, Exception ex) { _status = "Bigger Backpack skipped an incompatible PEAK path safely."; if (!(Time.unscaledTime < _nextErrorLog)) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Bigger Backpack " + operation + " failed safely: " + ex.Message)); } } } [HarmonyPatch(typeof(BackpackWheel), "InitWheel")] internal static class BiggerBackpackWheelPatch { private static bool Prefix(BackpackWheel __instance, BackpackReference __0, ref int __1, BackpackType __2) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) TrollModPlugin instance = TrollModPlugin.Instance; if (!((Object)(object)instance == (Object)null) && instance.BiggerBackpack != null) { return instance.BiggerBackpack.PrepareWheel(__0, ref __1, __2, __instance); } return true; } } [HarmonyPatch(typeof(Backpack), "HasSpace")] internal static class BiggerBackpackItemCapacityPatch { private static void Prefix(Backpack __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.BiggerBackpack != null) { instance.BiggerBackpack.PrepareBackpackItem(__instance); } } } [HarmonyPatch(typeof(CharacterBackpackHandler), "StashInBackpack")] internal static class BiggerEquippedBackpackCapacityPatch { private static void Prefix(CharacterBackpackHandler __instance) { TrollModPlugin instance = TrollModPlugin.Instance; Character localCharacter = Character.localCharacter; if ((Object)(object)instance != (Object)null && instance.BiggerBackpack != null && (Object)(object)localCharacter != (Object)null && localCharacter.refs != null && (Object)(object)localCharacter.refs.backpackHandler == (Object)(object)__instance && (Object)(object)localCharacter.player != (Object)null) { instance.BiggerBackpack.PrepareEquipped(localCharacter.player.backpackSlot); } } } [HarmonyPatch(typeof(BackpackData), "DeserializeValue")] internal static class BiggerBackpackDeserializePatch { private static readonly MethodInfo DeserializeMethod = AccessTools.Method(typeof(InventorySyncData), "Deserialize", (Type[])null, (Type[])null); private static readonly MethodInfo PrepareMethod = AccessTools.Method(typeof(BiggerBackpackManager), "PrepareIncoming", (Type[])null, (Type[])null); private static readonly FieldInfo ItemSlotsField = AccessTools.Field(typeof(BackpackData), "itemSlots"); private static IEnumerable Transpiler(IEnumerable instructions) { List source = new List(instructions); bool inserted = false; bool replacedLimit = false; for (int i = 0; i < source.Count; i++) { CodeInstruction instruction = source[i]; if (inserted && !replacedLimit && instruction.opcode == OpCodes.Ldc_I4_4) { CodeInstruction loadThis = new CodeInstruction(OpCodes.Ldarg_0, (object)null); loadThis.labels.AddRange(instruction.labels); loadThis.blocks.AddRange(instruction.blocks); yield return loadThis; yield return new CodeInstruction(OpCodes.Ldfld, (object)ItemSlotsField); yield return new CodeInstruction(OpCodes.Ldlen, (object)null); yield return new CodeInstruction(OpCodes.Conv_I4, (object)null); replacedLimit = true; } else { yield return instruction; if (!inserted && CodeInstructionExtensions.Calls(instruction, DeserializeMethod)) { object local = ((i >= 2) ? source[i - 2].operand : null); yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null); yield return new CodeInstruction(OpCodes.Ldloca_S, local); yield return new CodeInstruction(OpCodes.Call, (object)PrepareMethod); inserted = true; } } } if (!inserted || !replacedLimit) { throw new InvalidOperationException("BackpackData.DeserializeValue no longer matches the verified PEAK slot loop."); } } } internal sealed class BackpackProtectionManager { private readonly ModConfig _settings; private readonly ManualLogSource _log; private string _status = "Off"; private float _nextDenialLog; public bool Enabled { get { return _settings.BackpackProtectionEnabled.Value; } set { _settings.BackpackProtectionEnabled.Value = value; TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.Network != null) { instance.Network.RefreshLocalAdvertisement(); } _status = (value ? EnforcementStatus() : "Off"); } } public string Status { get { if (!Enabled) { return "Off"; } _status = EnforcementStatus(); return _status; } } public BackpackProtectionManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } internal bool AllowPickup(Item item, PhotonView requesterView) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 if (!PhotonNetwork.IsMasterClient || (Object)(object)item == (Object)null || item.backpackReference.IsNone) { return true; } try { BackpackReference item2 = item.backpackReference.Value.Item2; if ((int)item2.type != 1 || (Object)(object)item2.view == (Object)null || item2.view.Owner == null) { return true; } int actorNumber = item2.view.Owner.ActorNumber; if (!TrollModPlugin.Instance.Network.IsBackpackProtected(actorNumber)) { return true; } Player val = (((Object)(object)requesterView == (Object)null) ? null : requesterView.Owner); if (val != null && val.ActorNumber == actorNumber) { return true; } if (val != null && (Object)(object)((MonoBehaviourPun)item).photonView != (Object)null) { ((MonoBehaviourPun)item).photonView.RPC("DenyPickupRPC", val, Array.Empty()); } if (Time.unscaledTime >= _nextDenialLog) { _nextDenialLog = Time.unscaledTime + 2f; _log.LogInfo((object)("[PTM] Backpack Protection denied a withdrawal from actor " + actorNumber + " by actor " + ((val != null) ? val.ActorNumber : 0) + ".")); } return false; } catch (Exception ex) { _log.LogWarning((object)("[PTM] Backpack Protection inspection failed safely: " + ex.Message)); return true; } } private static string EnforcementStatus() { if (!PhotonNetwork.InRoom) { return "Active — will advertise when you join a lobby."; } TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance == (Object)null || instance.Network == null) { return "Active — networking is still initializing."; } if (PhotonNetwork.IsMasterClient) { return "Active — this host blocks other scouts from withdrawing your items."; } if (instance.Network.HostSupportsRequests) { return "Active — the compatible host enforces your lock, including against unmodded scouts."; } return "Active locally, but the current host needs the same protocol to enforce it."; } } [HarmonyPatch(typeof(Item), "RequestPickup")] internal static class BackpackProtectionPickupPatch { private static bool Prefix(Item __instance, PhotonView __0) { TrollModPlugin instance = TrollModPlugin.Instance; if (!((Object)(object)instance == (Object)null) && instance.BackpackProtection != null) { return instance.BackpackProtection.AllowPickup(__instance, __0); } return true; } } internal sealed class StartAsSkeletonManager { private readonly ModConfig _settings; private readonly ManualLogSource _log; private Character _completedCharacter; private Character _ownedCharacter; private string _status = "Off"; private float _nextErrorLog; public bool Enabled { get { return _settings.StartAsSkeletonEnabled.Value; } set { if (_settings.StartAsSkeletonEnabled.Value != value) { _settings.StartAsSkeletonEnabled.Value = value; if (value) { _completedCharacter = null; _status = "Waiting for a living scout on an island."; } else { RestoreOwnedSkeleton(); _status = "Off"; } } } } public string Status => _status; public StartAsSkeletonManager(ModConfig settings, ManualLogSource log) { _settings = settings; _log = log; } public void Tick() { Character localCharacter = Character.localCharacter; if ((Object)(object)_ownedCharacter != (Object)null) { if ((Object)(object)_ownedCharacter != (Object)(object)localCharacter || (Object)(object)_ownedCharacter.data == (Object)null) { _ownedCharacter = null; } else if (!_ownedCharacter.data.isSkeleton) { _ownedCharacter = null; _status = "Book of Bones changed your state; the start trigger will not repeat this expedition."; } } if (!Enabled) { return; } if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null || !localCharacter.IsInitialized || localCharacter.inAirport || !GameHandler.IsOnIsland) { _status = "Waiting for a living scout on an island."; return; } if (localCharacter.data.dead || localCharacter.data.fullyPassedOut) { _status = "Waiting until your scout is alive."; return; } if ((Object)(object)_completedCharacter == (Object)(object)localCharacter) { if (!localCharacter.data.isSkeleton) { _status = "Start trigger completed for this expedition."; } return; } _completedCharacter = localCharacter; if (localCharacter.data.isSkeleton) { _status = "Already a skeleton — existing state left unchanged."; return; } try { localCharacter.data.SetSkeleton(true); _ownedCharacter = localCharacter; _status = "Active — started this expedition as a skeleton."; _log.LogInfo((object)"[PTM] Applied the native Book of Bones skeleton state to the local scout."); } catch (Exception ex) { _completedCharacter = null; _status = "Skeleton start failed safely; see the BepInEx log."; LogFailure("apply", ex); } } public void OnSceneLoaded() { _completedCharacter = null; _status = (Enabled ? "Waiting for a living scout on an island." : "Off"); } public void ResetCurrentExpedition() { Character localCharacter = Character.localCharacter; RestoreOwnedSkeleton(); _completedCharacter = localCharacter; _status = (Enabled ? "Reset for this expedition; applies again on the next island." : "Off"); } public void RestoreOwnedSkeleton() { Character ownedCharacter = _ownedCharacter; _ownedCharacter = null; if ((Object)(object)ownedCharacter == (Object)null || (Object)(object)ownedCharacter.data == (Object)null || !ownedCharacter.data.isSkeleton) { return; } try { ownedCharacter.data.SetSkeleton(false); _log.LogInfo((object)"[PTM] Restored the local scout from the mod-owned skeleton state."); } catch (Exception ex) { LogFailure("restore", ex); } } private void LogFailure(string operation, Exception ex) { if (!(Time.unscaledTime < _nextErrorLog)) { _nextErrorLog = Time.unscaledTime + 10f; _log.LogWarning((object)("[PTM] Start As Skeleton " + operation + " failed safely: " + ex.Message)); } } } internal sealed class SpawnManager { private sealed class TrackedSpawn { public GameObject Object; public int CreatorActor; public int TargetActor; public bool IsDynamite; public bool IsItemStorm; public bool IsDirector; } private sealed class DynamiteShowerJob { public int TargetActor; public int CreatorActor; public int Remaining; public float Height; public float Spread; public float Interval; public float NextSpawn; public bool LightFuses; public bool OneLiveOne; public int LitOrdinal; public int Spawned; public string PrefabName; } private sealed class ItemStormJob { public int TargetActor; public int CreatorActor; public int Remaining; public float Height; public float Spread; public float Interval; public float NextSpawn; public bool RandomItems; public string FixedPrefabName; public List PrefabNames; } private const string ZombieResourcePath = "mushroomzombie"; private static string _verifiedZombiePrefabName; private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly CapabilityRegistry _capabilities; private readonly List _tracked = new List(); private readonly List _showers = new List(); private readonly List _itemStorms = new List(); private float _nextOrphanCheck; private float _nextTargetRefresh; public int Count { get { Prune(); return _tracked.Count; } } public int DirectorEnemyCount { get { Prune(); int num = 0; for (int i = 0; i < _tracked.Count; i++) { if (_tracked[i].IsDirector && !_tracked[i].IsItemStorm && !_tracked[i].IsDynamite) { num++; } } return num; } } public int DynamiteCount { get { Prune(); int num = 0; for (int i = 0; i < _tracked.Count; i++) { if (_tracked[i].IsDynamite) { num++; } } return num; } } public int ItemStormCount { get { Prune(); int num = 0; for (int i = 0; i < _tracked.Count; i++) { if (_tracked[i].IsItemStorm) { num++; } } return num; } } public SpawnManager(ManualLogSource log, PlayerManager players, CapabilityRegistry capabilities) { _log = log; _players = players; _capabilities = capabilities; } public ActionResult SpawnScoutmaster(PlayerEntry target, float distance) { return SpawnScoutmaster(target, distance, (_players.Local != null) ? _players.Local.ActorNumber : 0); } public ActionResult SpawnScoutmaster(PlayerEntry target, float distance, int creatorActor) { return SpawnScoutmaster(target, distance, creatorActor, director: false); } public ActionResult SpawnDirectorScoutmaster(PlayerEntry target, float distance) { return SpawnScoutmaster(target, distance, (_players.Local != null) ? _players.Local.ActorNumber : 0, director: true); } private ActionResult SpawnScoutmaster(PlayerEntry target, float distance, int creatorActor, bool director) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select an individual target."); } if (!_players.IsHost) { return ActionResult.Fail("Host authority is required."); } if (!_capabilities.Available(FeatureCapability.ScoutmasterSpawn)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.ScoutmasterSpawn)); } if (!CanSpawn()) { return ActionResult.Fail("Maximum mod-spawned object count reached."); } try { Vector3 val = Nearby(target, distance); GameObject val2 = PhotonNetwork.InstantiateRoomObject("Character_Scoutmaster", val, Quaternion.identity, (byte)0, (object[])null); ForceTarget(val2, target, 300f); Track(val2, creatorActor, target.ActorNumber, isDynamite: false, isItemStorm: false, director); return ActionResult.Ok("Spawned tracked Scoutmaster targeting " + target.Name + "."); } catch (Exception ex) { _log.LogWarning((object)("Scoutmaster spawn failed: " + ex)); return ActionResult.Fail(ex.Message); } } public ActionResult SpawnZombie(PlayerEntry target, float distance) { return SpawnZombie(target, distance, (_players.Local != null) ? _players.Local.ActorNumber : 0); } public ActionResult SpawnZombieBehind(PlayerEntry target, float distance) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //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_0096: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.data == (Object)null) { return ActionResult.Fail("Select one available target."); } if (!_players.IsHost) { return ActionResult.Fail("Host authority is required."); } if (!CanSpawn()) { return ActionResult.Fail("Maximum mod-spawned object count reached."); } if (!TryResolveZombiePrefabName(out var prefabName)) { return ActionResult.Fail("The verified Mushroom Zombie resource could not be loaded."); } try { distance = Mathf.Clamp(distance, 4f, 12f); Vector3 value = -target.Character.data.lookDirection_Flat; if (!PlayerActions.Finite(value) || ((Vector3)(ref value)).sqrMagnitude < 0.01f) { value = Vector3.back; } Vector3 val = target.Character.Center + ((Vector3)(ref value)).normalized * distance + Vector3.up * 3f; RaycastHit val3 = default(RaycastHit); Vector3 val2 = (Physics.Raycast(val, Vector3.down, ref val3, 12f, -5, (QueryTriggerInteraction)1) ? (((RaycastHit)(ref val3)).point + Vector3.up * 0.2f) : val); GameObject val4 = PhotonNetwork.Instantiate(prefabName, val2, Quaternion.identity, (byte)0, (object[])null); ForceTarget(val4, target, 300f); int creatorActor = ((_players.Local != null) ? _players.Local.ActorNumber : 0); Track(val4, creatorActor, target.ActorNumber); return ActionResult.Ok("Spawned a tracked Mushroom Zombie behind " + target.Name + "."); } catch (Exception ex) { _log.LogWarning((object)("Behind-target zombie spawn failed: " + ex)); return ActionResult.Fail(ex.Message); } } public ActionResult SpawnZombie(PlayerEntry target, float distance, int creatorActor) { return SpawnZombie(target, distance, creatorActor, director: false); } public ActionResult SpawnDirectorZombie(PlayerEntry target, float distance) { return SpawnZombie(target, distance, (_players.Local != null) ? _players.Local.ActorNumber : 0, director: true); } private ActionResult SpawnZombie(PlayerEntry target, float distance, int creatorActor, bool director) { //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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select an individual target."); } if (!_players.IsHost) { return ActionResult.Fail("Host authority is required."); } if (!CanSpawn()) { return ActionResult.Fail("Maximum mod-spawned object count reached."); } if (!TryResolveZombiePrefabName(out var prefabName)) { return ActionResult.Fail("The verified Mushroom Zombie resource could not be loaded."); } try { Vector3 val = Nearby(target, distance); GameObject val2 = PhotonNetwork.Instantiate(prefabName, val, Quaternion.identity, (byte)0, (object[])null); ForceTarget(val2, target, 300f); Track(val2, creatorActor, target.ActorNumber, isDynamite: false, isItemStorm: false, director); return ActionResult.Ok("Spawned tracked Mushroom Zombie targeting " + target.Name + "."); } catch (Exception ex) { _log.LogWarning((object)("Zombie spawn failed: " + ex)); return ActionResult.Fail(ex.Message); } } internal static bool TryResolveZombiePrefabName(out string prefabName) { if (!string.IsNullOrEmpty(_verifiedZombiePrefabName)) { prefabName = _verifiedZombiePrefabName; return true; } MushroomZombieSpawner[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null) && !((Object)(object)array[i].mushroomZombiePrefab == (Object)null) && !((Object)(object)((Component)array[i].mushroomZombiePrefab).gameObject == (Object)null)) { _verifiedZombiePrefabName = ((Object)((Component)array[i].mushroomZombiePrefab).gameObject).name; prefabName = _verifiedZombiePrefabName; return !string.IsNullOrEmpty(prefabName); } } GameObject val = Resources.Load("mushroomzombie"); if ((Object)(object)val != (Object)null) { MushroomZombie val2 = val.GetComponent(); if ((Object)(object)val2 == (Object)null) { val2 = val.GetComponentInChildren(true); } if ((Object)(object)val2 != (Object)null) { _verifiedZombiePrefabName = "mushroomzombie"; prefabName = _verifiedZombiePrefabName; return true; } } prefabName = null; return false; } public ActionResult StartDynamiteShower(PlayerEntry target, int count, float height, float spread, float interval, bool lightFuses) { if (!_capabilities.Available(FeatureCapability.DynamiteShower)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.DynamiteShower)); } if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Join a Photon room before spawning networked dynamite."); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select an individual target."); } string text = FindDynamitePrefabName(); if (string.IsNullOrEmpty(text)) { return ActionResult.Fail("No loaded Dynamite item prefab was found."); } count = Mathf.Clamp(count, 1, 64); height = Mathf.Clamp(height, 6f, 40f); spread = Mathf.Clamp(spread, 1f, 12f); interval = Mathf.Clamp(interval, 0.12f, 1.5f); Prune(); int num = Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxDynamiteObjects.Value, 1, 128); int num2 = 0; for (int i = 0; i < _showers.Count; i++) { num2 += _showers[i].Remaining; } count = Mathf.Min(count, num - DynamiteCount - num2); if (count <= 0) { return ActionResult.Fail("Maximum mod-spawned object count would be exceeded."); } _showers.Add(new DynamiteShowerJob { TargetActor = target.ActorNumber, CreatorActor = PhotonNetwork.LocalPlayer.ActorNumber, Remaining = count, Height = height, Spread = spread, Interval = interval, NextSpawn = Time.unscaledTime, LightFuses = lightFuses, PrefabName = text }); return ActionResult.Ok("Queued " + count + (lightFuses ? " lit" : " unlit") + " dynamite above " + target.Name + "."); } public ActionResult StartOneLiveOne(PlayerEntry target, int count, float height, float spread, float interval) { if (!_capabilities.Available(FeatureCapability.OneLiveOne)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.OneLiveOne)); } if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Join a Photon room before spawning networked dynamite."); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select an individual target."); } string text = FindDynamitePrefabName(); if (string.IsNullOrEmpty(text)) { return ActionResult.Fail("No loaded Dynamite item prefab was found."); } count = Mathf.Clamp(count, 2, 64); height = Mathf.Clamp(height, 6f, 40f); spread = Mathf.Clamp(spread, 1f, 12f); interval = Mathf.Clamp(interval, 0.12f, 1.5f); Prune(); int num = Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxDynamiteObjects.Value, 1, 128); int num2 = 0; for (int i = 0; i < _showers.Count; i++) { num2 += _showers[i].Remaining; } count = Mathf.Min(count, num - DynamiteCount - num2); if (count < 2) { return ActionResult.Fail("One Live One needs room for at least two tracked dynamites."); } _showers.Add(new DynamiteShowerJob { TargetActor = target.ActorNumber, CreatorActor = PhotonNetwork.LocalPlayer.ActorNumber, Remaining = count, Height = height, Spread = spread, Interval = interval, NextSpawn = Time.unscaledTime, LightFuses = false, OneLiveOne = true, LitOrdinal = Random.Range(0, count), Spawned = 0, PrefabName = text }); return ActionResult.Ok("Queued " + count + " dynamites above " + target.Name + " with exactly one hidden live fuse."); } public ActionResult StartItemStorm(PlayerEntry target, int count, float height, float spread, float interval, bool randomItems, string selectedItemName) { if (!_capabilities.Available(FeatureCapability.ItemStorm)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.ItemStorm)); } if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Join a Photon room before spawning networked items."); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select an individual target."); } List list = FindItemPrefabNames(); if (list.Count == 0) { return ActionResult.Fail("No loaded network item prefabs were found."); } string fixedName = NormalizePrefabName(selectedItemName); if (!randomItems) { int num = list.FindIndex((string value) => string.Equals(value, fixedName, StringComparison.OrdinalIgnoreCase)); if (num < 0) { return ActionResult.Fail("The selected item is not a loaded network prefab."); } fixedName = list[num]; } count = Mathf.Clamp(count, 1, 64); height = Mathf.Clamp(height, 6f, 40f); spread = Mathf.Clamp(spread, 1f, 14f); interval = Mathf.Clamp(interval, 0.12f, 1.5f); Prune(); int num2 = Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxItemStormObjects.Value, 1, 128); int num3 = 0; for (int num4 = 0; num4 < _itemStorms.Count; num4++) { num3 += _itemStorms[num4].Remaining; } count = Mathf.Min(count, num2 - ItemStormCount - num3); if (count <= 0) { return ActionResult.Fail("The configured Item Storm cap has been reached."); } _itemStorms.Add(new ItemStormJob { TargetActor = target.ActorNumber, CreatorActor = PhotonNetwork.LocalPlayer.ActorNumber, Remaining = count, Height = height, Spread = spread, Interval = interval, NextSpawn = Time.unscaledTime, RandomItems = randomItems, FixedPrefabName = fixedName, PrefabNames = list }); return ActionResult.Ok("Queued " + count + (randomItems ? " random items" : (" copies of " + fixedName)) + " above " + target.Name + "."); } public ActionResult StartMandrakeRain(PlayerEntry target, int count, float height, float spread, float interval) { if (!_capabilities.Available(FeatureCapability.Mandrake)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.Mandrake)); } List list = FindItemPrefabNames(); string text = list.Find((string value) => value.IndexOf("Mandrake", StringComparison.OrdinalIgnoreCase) >= 0); if (string.IsNullOrEmpty(text)) { return ActionResult.Fail("No loaded Mandrake network prefab was found."); } return StartItemStorm(target, count, height, spread, interval, randomItems: false, text); } public ActionResult SpawnItemNear(PlayerEntry target, string itemName, int count) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (!_capabilities.Available(FeatureCapability.ItemStorm)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.ItemStorm)); } if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select an individual target."); } count = Mathf.Clamp(count, 1, 12); int num = 0; for (int i = 0; i < count; i++) { Vector2 val = Random.insideUnitCircle * 1.5f; Vector3 position = target.Character.Center + new Vector3(val.x, 1.2f + (float)i * 0.12f, val.y); ActionResult actionResult = SpawnWorldItem(itemName, position); if (!actionResult.Success) { if (num != 0) { return ActionResult.Ok("Spawned " + num + " item(s); stopped because " + actionResult.Message); } return actionResult; } num++; } return ActionResult.Ok("Spawned " + num + " " + itemName + " near " + target.Name + "."); } public ActionResult SpawnWorldItem(string itemName, Vector3 position) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_00b3: Unknown result type (might be due to invalid IL or missing references) if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Join a Photon room before spawning a world item."); } if (!CanSpawnItemStorm()) { return ActionResult.Fail("The configured network-item cap has been reached."); } List list = FindItemPrefabNames(); string normalized = NormalizePrefabName(itemName); string text = list.Find((string value) => string.Equals(value, normalized, StringComparison.OrdinalIgnoreCase)); if (string.IsNullOrEmpty(text)) { return ActionResult.Fail("The selected item is not a loaded network prefab."); } try { GameObject val = PhotonNetwork.Instantiate("0_Items/" + text, position, Random.rotation, (byte)0, (object[])null); if ((Object)(object)val == (Object)null) { throw new InvalidOperationException("Photon returned no item object."); } Item component = val.GetComponent(); if ((Object)(object)component != (Object)null) { component.SetKinematicNetworked(false, position, val.transform.rotation); } Track(val, PhotonNetwork.LocalPlayer.ActorNumber, (Object)(object)val.GetComponent() != (Object)null, isItemStorm: true); return ActionResult.Ok("Spawned " + text + "."); } catch (Exception ex) { _log.LogWarning((object)("World item spawn failed safely: " + ex.Message)); return ActionResult.Fail(ex.Message); } } public ActionResult SpawnDirectorSupply(PlayerEntry target) { //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("No living scout is available for a supply drop."); } if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null) { return ActionResult.Fail("Join a Photon room before spawning supplies."); } if (!CanSpawnItemStorm()) { return ActionResult.Fail("The configured network-item cap has been reached."); } List list = FindItemPrefabNames(); string[] array = new string[6] { "Marshmallow", "First Aid", "Bandage", "Energy", "Cure", "Antidote" }; List list2 = new List(); for (int i = 0; i < list.Count; i++) { for (int j = 0; j < array.Length; j++) { if (list[i].IndexOf(array[j], StringComparison.OrdinalIgnoreCase) >= 0) { list2.Add(list[i]); break; } } } if (list2.Count == 0) { return ActionResult.Fail("No supported supply item is loaded in this biome."); } string text = list2[Random.Range(0, list2.Count)]; Vector2 val = Random.insideUnitCircle * 2f; Vector3 val2 = target.Character.Center + new Vector3(val.x, 1.5f, val.y); try { GameObject val3 = PhotonNetwork.Instantiate("0_Items/" + text, val2, Random.rotation, (byte)0, (object[])null); if ((Object)(object)val3 == (Object)null) { throw new InvalidOperationException("Photon returned no supply object."); } Item component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.SetKinematicNetworked(false, val2, val3.transform.rotation); } Track(val3, PhotonNetwork.LocalPlayer.ActorNumber, 0, (Object)(object)val3.GetComponent() != (Object)null, isItemStorm: true, isDirector: true); return ActionResult.Ok("Dropped " + text + " near " + target.Name + "."); } catch (Exception ex) { _log.LogWarning((object)("Director supply drop failed safely: " + ex.Message)); return ActionResult.Fail(ex.Message); } } private static List FindItemPrefabNames() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) Item[] array = Resources.FindObjectsOfTypeAll(); List list = new List(); HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < 2; i++) { foreach (Item val in array) { if ((Object)(object)val == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { continue; } Scene scene = ((Component)val).gameObject.scene; bool flag = ((Scene)(ref scene)).IsValid(); if ((i != 0 || !flag) && (i != 1 || flag)) { string text = NormalizePrefabName(((Object)((Component)val).gameObject).name); if (!string.IsNullOrEmpty(text) && hashSet.Add(text)) { list.Add(text); } } } if (list.Count > 0) { break; } } list.Sort(StringComparer.OrdinalIgnoreCase); return list; } private static string NormalizePrefabName(string name) { if (string.IsNullOrEmpty(name)) { return string.Empty; } if (name.StartsWith("PTM_TRACKED_", StringComparison.Ordinal)) { name = name.Substring("PTM_TRACKED_".Length); } if (name.EndsWith("(Clone)", StringComparison.Ordinal)) { name = name.Substring(0, name.Length - 7).TrimEnd(new char[0]); } return name.Trim(); } private static string FindDynamitePrefabName() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) Dynamite[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < 2; i++) { for (int j = 0; j < array.Length; j++) { if ((Object)(object)array[j] == (Object)null || (Object)(object)((Component)array[j]).gameObject == (Object)null) { continue; } Scene scene = ((Component)array[j]).gameObject.scene; bool flag = ((Scene)(ref scene)).IsValid(); if ((i == 0 && flag) || (i == 1 && !flag)) { continue; } Item val = (((Object)(object)((ItemComponent)array[j]).item != (Object)null) ? ((ItemComponent)array[j]).item : ((Component)array[j]).GetComponent()); if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null)) { string text = ((Object)((Component)val).gameObject).name; if (text.StartsWith("PTM_TRACKED_", StringComparison.Ordinal)) { text = text.Substring("PTM_TRACKED_".Length); } if (text.EndsWith("(Clone)", StringComparison.Ordinal)) { text = text.Substring(0, text.Length - 7).TrimEnd(new char[0]); } if (!string.IsNullOrEmpty(text)) { return text; } } } } return null; } private static Vector3 Nearby(PlayerEntry target, float distance) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) distance = Mathf.Clamp(distance, 4f, 25f); Vector2 insideUnitCircle = Random.insideUnitCircle; Vector2 val = ((Vector2)(ref insideUnitCircle)).normalized * distance; Vector3 val2 = target.Character.Center + new Vector3(val.x, 2f, val.y); RaycastHit val3 = default(RaycastHit); if (!Physics.Raycast(val2, Vector3.down, ref val3, 12f, -5, (QueryTriggerInteraction)1)) { return val2; } return ((RaycastHit)(ref val3)).point + Vector3.up * 0.2f; } private bool CanSpawn() { Prune(); int num = 0; for (int i = 0; i < _tracked.Count; i++) { if (!_tracked[i].IsDynamite && !_tracked[i].IsItemStorm) { num++; } } return num < Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxSpawnedObjects.Value, 1, 64); } private bool CanSpawnDynamite() { return DynamiteCount < Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxDynamiteObjects.Value, 1, 128); } private bool CanSpawnItemStorm() { return ItemStormCount < Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxItemStormObjects.Value, 1, 128); } private void Track(GameObject go, int creatorActor) { Track(go, creatorActor, 0, isDynamite: false, isItemStorm: false); } private void Track(GameObject go, int creatorActor, int targetActor) { Track(go, creatorActor, targetActor, isDynamite: false, isItemStorm: false); } private void Track(GameObject go, int creatorActor, bool isDynamite) { Track(go, creatorActor, 0, isDynamite, isItemStorm: false); } private void Track(GameObject go, int creatorActor, bool isDynamite, bool isItemStorm) { Track(go, creatorActor, 0, isDynamite, isItemStorm); } private void Track(GameObject go, int creatorActor, int targetActor, bool isDynamite, bool isItemStorm) { Track(go, creatorActor, targetActor, isDynamite, isItemStorm, isDirector: false); } private void Track(GameObject go, int creatorActor, int targetActor, bool isDynamite, bool isItemStorm, bool isDirector) { if ((Object)(object)go != (Object)null) { ((Object)go).name = "PTM_TRACKED_" + ((Object)go).name; _tracked.Add(new TrackedSpawn { Object = go, CreatorActor = creatorActor, TargetActor = targetActor, IsDynamite = isDynamite, IsItemStorm = isItemStorm, IsDirector = isDirector }); _log.LogInfo((object)("Tracking troll spawn view " + ((!((Object)(object)go.GetComponent() == (Object)null)) ? go.GetComponent().ViewID : 0) + " requested by actor " + creatorActor + ((targetActor > 0) ? (" targeting actor " + targetActor) : string.Empty) + (isDirector ? " for Expedition Director" : string.Empty))); } } private void Prune() { for (int num = _tracked.Count - 1; num >= 0; num--) { if ((Object)(object)_tracked[num].Object == (Object)null) { _tracked.RemoveAt(num); } } } public void Tick() { Prune(); TickDynamiteShowers(); TickItemStorms(); if (!_players.IsHost || !PhotonNetwork.InRoom || PhotonNetwork.CurrentRoom == null) { return; } if (Time.unscaledTime >= _nextTargetRefresh) { _nextTargetRefresh = Time.unscaledTime + 10f; RefreshTrackedTargets(); } if (Time.unscaledTime < _nextOrphanCheck) { return; } _nextOrphanCheck = Time.unscaledTime + 5f; List list = new List(); for (int i = 0; i < _tracked.Count; i++) { int creatorActor = _tracked[i].CreatorActor; if (creatorActor > 0 && PhotonNetwork.CurrentRoom.GetPlayer(creatorActor, false) == null && !list.Contains(creatorActor)) { list.Add(creatorActor); } } for (int j = 0; j < list.Count; j++) { ClearForCreator(list[j]); } } private void RefreshTrackedTargets() { for (int i = 0; i < _tracked.Count; i++) { TrackedSpawn trackedSpawn = _tracked[i]; if (!trackedSpawn.IsDynamite && !((Object)(object)trackedSpawn.Object == (Object)null) && trackedSpawn.TargetActor > 0) { PlayerEntry playerEntry = _players.Find(trackedSpawn.TargetActor); if (playerEntry != null && !((Object)(object)playerEntry.Character == (Object)null) && ((Object)(object)trackedSpawn.Object.GetComponent() != (Object)null || (Object)(object)trackedSpawn.Object.GetComponent() != (Object)null)) { ForceTarget(trackedSpawn.Object, playerEntry, 300f); } } } } private void ForceTarget(GameObject enemy, PlayerEntry target, float duration) { if (_players.IsHost && !((Object)(object)enemy == (Object)null) && target != null && !((Object)(object)target.Character == (Object)null) && target.Character.refs != null && !((Object)(object)target.Character.refs.view == (Object)null)) { PhotonView component = enemy.GetComponent(); if (!((Object)(object)component == (Object)null) && component.ViewID != 0) { component.RPC("RPCA_SetCurrentTarget", (RpcTarget)0, new object[2] { target.Character.refs.view.ViewID, Mathf.Clamp(duration, 10f, 600f) }); } } } private void TickDynamiteShowers() { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Unknown result type (might be due to invalid IL or missing references) for (int num = _showers.Count - 1; num >= 0; num--) { DynamiteShowerJob dynamiteShowerJob = _showers[num]; if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null || PhotonNetwork.LocalPlayer.ActorNumber != dynamiteShowerJob.CreatorActor) { _showers.RemoveAt(num); } else { if (Time.unscaledTime < dynamiteShowerJob.NextSpawn) { continue; } PlayerEntry playerEntry = _players.Find(dynamiteShowerJob.TargetActor); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null) { _log.LogWarning((object)"Cancelled dynamite shower because its target left."); _showers.RemoveAt(num); continue; } if (!CanSpawnDynamite()) { _log.LogWarning((object)"Stopped dynamite shower at the configured dynamite cap."); _showers.RemoveAt(num); continue; } Vector2 val = Random.insideUnitCircle * dynamiteShowerJob.Spread; Vector3 val2 = playerEntry.Character.Center + new Vector3(val.x, dynamiteShowerJob.Height + Random.Range(-1.5f, 1.5f), val.y); try { GameObject val3 = PhotonNetwork.Instantiate("0_Items/" + dynamiteShowerJob.PrefabName, val2, Random.rotation, (byte)0, (object[])null); if ((Object)(object)val3 == (Object)null) { throw new InvalidOperationException("Photon returned no Dynamite object."); } Item component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.SetKinematicNetworked(false, val2, val3.transform.rotation); } Dynamite component2 = val3.GetComponent(); if ((dynamiteShowerJob.LightFuses || (dynamiteShowerJob.OneLiveOne && dynamiteShowerJob.Spawned == dynamiteShowerJob.LitOrdinal)) && (Object)(object)component2 != (Object)null) { component2.LightFlare(); } Track(val3, dynamiteShowerJob.CreatorActor, isDynamite: true); } catch (Exception ex) { _log.LogWarning((object)("Dynamite shower spawn failed safely: " + ex.Message)); _showers.RemoveAt(num); continue; } dynamiteShowerJob.Spawned++; dynamiteShowerJob.Remaining--; dynamiteShowerJob.NextSpawn = Time.unscaledTime + dynamiteShowerJob.Interval; if (dynamiteShowerJob.Remaining <= 0) { _showers.RemoveAt(num); } } } } private void TickItemStorms() { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) for (int num = _itemStorms.Count - 1; num >= 0; num--) { ItemStormJob itemStormJob = _itemStorms[num]; if (!PhotonNetwork.InRoom || PhotonNetwork.LocalPlayer == null || PhotonNetwork.LocalPlayer.ActorNumber != itemStormJob.CreatorActor) { _itemStorms.RemoveAt(num); } else { if (Time.unscaledTime < itemStormJob.NextSpawn) { continue; } PlayerEntry playerEntry = _players.Find(itemStormJob.TargetActor); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null) { _log.LogWarning((object)"Cancelled Item Storm because its target left."); _itemStorms.RemoveAt(num); continue; } if (!CanSpawnItemStorm()) { _log.LogWarning((object)"Stopped Item Storm at its configured cap."); _itemStorms.RemoveAt(num); continue; } if (itemStormJob.PrefabNames == null || itemStormJob.PrefabNames.Count == 0) { _itemStorms.RemoveAt(num); continue; } string prefabName = (itemStormJob.RandomItems ? itemStormJob.PrefabNames[Random.Range(0, itemStormJob.PrefabNames.Count)] : itemStormJob.FixedPrefabName); Vector2 val = Random.insideUnitCircle * itemStormJob.Spread; Vector3 val2 = playerEntry.Character.Center + new Vector3(val.x, itemStormJob.Height + Random.Range(-1.5f, 1.5f), val.y); try { GameObject val3 = PhotonNetwork.Instantiate("0_Items/" + prefabName, val2, Random.rotation, (byte)0, (object[])null); if ((Object)(object)val3 == (Object)null) { throw new InvalidOperationException("Photon returned no item object."); } Item component = val3.GetComponent(); if ((Object)(object)component != (Object)null) { component.SetKinematicNetworked(false, val2, val3.transform.rotation); } Track(val3, itemStormJob.CreatorActor, (Object)(object)val3.GetComponent() != (Object)null, isItemStorm: true); } catch (Exception ex) { _log.LogWarning((object)("Item Storm could not spawn " + prefabName + ": " + ex.Message)); itemStormJob.PrefabNames.RemoveAll((string value) => string.Equals(value, prefabName, StringComparison.OrdinalIgnoreCase)); if (!itemStormJob.RandomItems || itemStormJob.PrefabNames.Count == 0) { _itemStorms.RemoveAt(num); continue; } } itemStormJob.Remaining--; itemStormJob.NextSpawn = Time.unscaledTime + itemStormJob.Interval; if (itemStormJob.Remaining <= 0) { _itemStorms.RemoveAt(num); } } } } public void ClearAll() { _showers.Clear(); _itemStorms.Clear(); Prune(); for (int num = _tracked.Count - 1; num >= 0; num--) { GameObject val = _tracked[num].Object; if (!((Object)(object)val == (Object)null)) { try { PhotonView component = val.GetComponent(); if (_players.IsHost || !((Object)(object)component != (Object)null) || component.IsMine) { if ((Object)(object)component != (Object)null && component.ViewID != 0) { PhotonNetwork.Destroy(val); } else { Object.Destroy((Object)(object)val); } _tracked.RemoveAt(num); } } catch (Exception ex) { _log.LogWarning((object)("Tracked spawn cleanup failed: " + ex.Message)); } } } } public int ClearDirectorSpawns() { Prune(); int num = 0; for (int num2 = _tracked.Count - 1; num2 >= 0; num2--) { if (_tracked[num2].IsDirector) { GameObject val = _tracked[num2].Object; try { if ((Object)(object)val != (Object)null) { PhotonView component = val.GetComponent(); if ((Object)(object)component != (Object)null && component.ViewID != 0) { PhotonNetwork.Destroy(val); } else { Object.Destroy((Object)(object)val); } } _tracked.RemoveAt(num2); num++; } catch (Exception ex) { _log.LogWarning((object)("Director spawn cleanup failed: " + ex.Message)); } } } return num; } public int ClearLocalDynamite() { _showers.Clear(); Prune(); int num = 0; for (int num2 = _tracked.Count - 1; num2 >= 0; num2--) { if (_tracked[num2].IsDynamite) { GameObject val = _tracked[num2].Object; try { if (!((Object)(object)val != (Object)null)) { goto IL_0090; } PhotonView component = val.GetComponent(); if (!((Object)(object)component != (Object)null) || component.IsMine) { if ((Object)(object)component != (Object)null && component.ViewID != 0) { PhotonNetwork.Destroy(val); } else { Object.Destroy((Object)(object)val); } goto IL_0090; } goto end_IL_004e; IL_0090: num++; _tracked.RemoveAt(num2); end_IL_004e:; } catch (Exception ex) { _log.LogWarning((object)("Dynamite cleanup failed: " + ex.Message)); } } } return num; } public int ClearLocalItemStorm() { _itemStorms.Clear(); Prune(); int num = 0; for (int num2 = _tracked.Count - 1; num2 >= 0; num2--) { if (_tracked[num2].IsItemStorm) { GameObject val = _tracked[num2].Object; try { if (!((Object)(object)val != (Object)null)) { goto IL_0090; } PhotonView component = val.GetComponent(); if (!((Object)(object)component != (Object)null) || component.IsMine) { if ((Object)(object)component != (Object)null && component.ViewID != 0) { PhotonNetwork.Destroy(val); } else { Object.Destroy((Object)(object)val); } goto IL_0090; } goto end_IL_004e; IL_0090: num++; _tracked.RemoveAt(num2); end_IL_004e:; } catch (Exception ex) { _log.LogWarning((object)("Item Storm cleanup failed: " + ex.Message)); } } } return num; } public int ClearForCreator(int creatorActor) { if (!_players.IsHost) { return 0; } int num = 0; for (int num2 = _tracked.Count - 1; num2 >= 0; num2--) { if (_tracked[num2].CreatorActor == creatorActor) { GameObject val = _tracked[num2].Object; try { if ((Object)(object)val != (Object)null) { PhotonView component = val.GetComponent(); if ((Object)(object)component != (Object)null && component.ViewID != 0) { PhotonNetwork.Destroy(val); } else { Object.Destroy((Object)(object)val); } } num++; _tracked.RemoveAt(num2); } catch (Exception ex) { _log.LogWarning((object)("Requested spawn cleanup failed: " + ex.Message)); } } } return num; } } internal static class VisualCloneFactory { public static GameObject CloneVisuals(GameObject source, string name, Vector3 position, Quaternion rotation) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null) { return null; } Dictionary dictionary = new Dictionary(); GameObject val = new GameObject(name); val.transform.position = position; val.transform.rotation = rotation; val.transform.localScale = source.transform.lossyScale; dictionary[source.transform] = val.transform; CopyTransforms(source.transform, val.transform, dictionary); CopyRenderers(source, val, dictionary); CopyAnimator(source, val, dictionary); return val; } private static void CopyTransforms(Transform source, Transform target, Dictionary map) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < source.childCount; i++) { Transform child = source.GetChild(i); GameObject val = new GameObject(((Object)child).name); val.transform.SetParent(target, false); val.transform.localPosition = child.localPosition; val.transform.localRotation = child.localRotation; val.transform.localScale = child.localScale; val.SetActive(((Component)child).gameObject.activeSelf); map[child] = val.transform; CopyTransforms(child, val.transform, map); } } private static void CopyRenderers(GameObject source, GameObject target, Dictionary map) { //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) MeshFilter[] componentsInChildren = source.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { if (map.TryGetValue(((Component)componentsInChildren[i]).transform, out var value)) { MeshFilter val = ((Component)value).gameObject.AddComponent(); val.sharedMesh = componentsInChildren[i].sharedMesh; MeshRenderer component = ((Component)componentsInChildren[i]).GetComponent(); if ((Object)(object)component != (Object)null) { MeshRenderer val2 = ((Component)value).gameObject.AddComponent(); ((Renderer)val2).sharedMaterials = ((Renderer)component).sharedMaterials; ((Renderer)val2).enabled = ((Renderer)component).enabled; ((Renderer)val2).shadowCastingMode = ((Renderer)component).shadowCastingMode; ((Renderer)val2).receiveShadows = ((Renderer)component).receiveShadows; } } } SkinnedMeshRenderer[] componentsInChildren2 = source.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren2.Length; j++) { if (!map.TryGetValue(((Component)componentsInChildren2[j]).transform, out var value2)) { continue; } SkinnedMeshRenderer val3 = ((Component)value2).gameObject.AddComponent(); val3.sharedMesh = componentsInChildren2[j].sharedMesh; ((Renderer)val3).sharedMaterials = ((Renderer)componentsInChildren2[j]).sharedMaterials; ((Renderer)val3).enabled = ((Renderer)componentsInChildren2[j]).enabled; ((Renderer)val3).localBounds = ((Renderer)componentsInChildren2[j]).localBounds; val3.updateWhenOffscreen = true; if ((Object)(object)componentsInChildren2[j].rootBone != (Object)null && map.TryGetValue(componentsInChildren2[j].rootBone, out var value3)) { val3.rootBone = value3; } Transform[] array = (Transform[])(object)new Transform[componentsInChildren2[j].bones.Length]; for (int k = 0; k < array.Length; k++) { if ((Object)(object)componentsInChildren2[j].bones[k] != (Object)null && map.TryGetValue(componentsInChildren2[j].bones[k], out var value4)) { array[k] = value4; } } val3.bones = array; } } private static void CopyAnimator(GameObject source, GameObject target, Dictionary map) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) Animator componentInChildren = source.GetComponentInChildren(true); if (!((Object)(object)componentInChildren == (Object)null) && map.TryGetValue(((Component)componentInChildren).transform, out var value)) { Animator val = ((Component)value).gameObject.AddComponent(); val.runtimeAnimatorController = componentInChildren.runtimeAnimatorController; val.avatar = componentInChildren.avatar; val.applyRootMotion = false; val.updateMode = componentInChildren.updateMode; val.cullingMode = (AnimatorCullingMode)0; } } } internal sealed class MiragePuppetController : MonoBehaviour { private Character _target; private MirageBehavior _behavior; private float _speed; private float _followDistance; private float _vanishDistance; private float _destroyAt; private Vector3 _walkDirection; public void Initialize(Character target, MirageBehavior behavior, float lifetime, float speed, float followDistance, float vanishDistance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) _target = target; _behavior = behavior; _speed = Mathf.Clamp(speed, 0.2f, 8f); _followDistance = Mathf.Clamp(followDistance, 2f, 15f); _vanishDistance = Mathf.Clamp(vanishDistance, 1f, 10f); _destroyAt = Time.time + Mathf.Clamp(lifetime, 1f, 120f); _walkDirection = ((Component)this).transform.right; } private void Update() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0153: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) if (Time.time >= _destroyAt) { Object.Destroy((Object)(object)((Component)this).gameObject); } else if (!((Object)(object)_target == (Object)null)) { Vector3 center = _target.Center; Vector3 val = center - ((Component)this).transform.position; val.y = 0f; float magnitude = ((Vector3)(ref val)).magnitude; if (((Vector3)(ref val)).sqrMagnitude > 0.01f && (_behavior == MirageBehavior.StandAndStare || _behavior == MirageBehavior.FollowAtDistance || _behavior == MirageBehavior.ApproachSlowly || _behavior == MirageBehavior.ChargeTarget || _behavior == MirageBehavior.VanishWhenClose)) { ((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up), Time.deltaTime * 4f); } if (_behavior == MirageBehavior.FollowAtDistance && magnitude > _followDistance) { Move(((Vector3)(ref val)).normalized, _speed); } else if (_behavior == MirageBehavior.ApproachSlowly && magnitude > 1.5f) { Move(((Vector3)(ref val)).normalized, _speed * 0.45f); } else if (_behavior == MirageBehavior.ChargeTarget && magnitude > 1f) { Move(((Vector3)(ref val)).normalized, _speed * 1.7f); } else if (_behavior == MirageBehavior.WalkAcross) { Move(_walkDirection, _speed); } else if (_behavior == MirageBehavior.RunAway && magnitude < _followDistance * 2f) { Move(-((Vector3)(ref val)).normalized, _speed * 1.5f); } else if (_behavior == MirageBehavior.VanishWhenClose && magnitude <= _vanishDistance) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } private void Move(Vector3 direction, float speed) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Transform transform = ((Component)this).transform; transform.position += direction * speed * Time.deltaTime; } } internal sealed class MirageManager { private readonly ManualLogSource _log; private readonly List _records = new List(); public int Count => _records.Count; public int FakeEnemyCount { get { int num = 0; for (int i = 0; i < _records.Count; i++) { if (_records[i].Kind == MirageKind.FakeEnemy) { num++; } } return num; } } public MirageManager(ManualLogSource log) { _log = log; } public void Tick() { for (int num = _records.Count - 1; num >= 0; num--) { if ((Object)(object)_records[num].Object == (Object)null) { _records.RemoveAt(num); } } } public ActionResult CreateStatic(MirageKind kind, Vector3 position, Quaternion rotation, int creator, int targetActor = 0) { //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) if (!CanCreate()) { return ActionResult.Fail("Maximum mod-spawned object count reached."); } Type type = kind switch { MirageKind.CapybaraPool => typeof(Capybara), MirageKind.AmuletStatue => typeof(ScoutStatue), MirageKind.Luggage => typeof(Luggage), _ => null, }; if (type == null) { return ActionResult.Fail("Unsupported static mirage type."); } Object[] array = Resources.FindObjectsOfTypeAll(type); GameObject val = null; foreach (Object obj in array) { Component val2 = (Component)(object)((obj is Component) ? obj : null); if ((Object)(object)val2 != (Object)null) { Scene scene = val2.gameObject.scene; if (((Scene)(ref scene)).IsValid()) { val = val2.gameObject; break; } } } if ((Object)(object)val == (Object)null && array.Length > 0) { Object obj2 = array[0]; Component val3 = (Component)(object)((obj2 is Component) ? obj2 : null); if ((Object)(object)val3 != (Object)null) { val = val3.gameObject; } } if ((Object)(object)val == (Object)null) { return ActionResult.Fail(string.Concat("No loaded visual source for ", kind, ".")); } GameObject val4 = VisualCloneFactory.CloneVisuals(val, "PTM_Mirage_" + kind, position, rotation); if ((Object)(object)val4 == (Object)null) { return ActionResult.Fail("Visual extraction failed."); } Register(kind, val4, targetActor, creator); return ActionResult.Ok(string.Concat("Created ", kind, " mirage.")); } public ActionResult CreateScout(PlayerEntry victim, int appearanceActor, Vector3 position, MirageBehavior behavior, float lifetime, int creator) { //IL_0050: 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) //IL_005c: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!CanCreate()) { return ActionResult.Fail("Maximum mod-spawned object count reached."); } PlayerEntry playerEntry = TrollModPlugin.Instance.Players.Find(appearanceActor); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null) { return ActionResult.Fail("Appearance source left the lobby."); } GameObject gameObject = ((Component)playerEntry.Character).gameObject; Vector3 val = victim.Character.Center - position; GameObject val2 = VisualCloneFactory.CloneVisuals(gameObject, "PTM_MirageScout", position, Quaternion.LookRotation(((Vector3)(ref val)).normalized, Vector3.up)); if ((Object)(object)val2 == (Object)null) { return ActionResult.Fail("Scout visual extraction failed."); } val2.AddComponent().Initialize(victim.Character, behavior, lifetime, 2.2f, 5f, 2f); Register(MirageKind.Scout, val2, victim.ActorNumber, creator); return ActionResult.Ok("Created Mirage Scout for " + victim.Name + "."); } public ActionResult CreateFakeEnemy(PlayerEntry victim, FakeEnemyKind enemy, Vector3 position, MirageBehavior behavior, float lifetime, int creator) { //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) if (!CanCreate()) { return ActionResult.Fail("Maximum mod-spawned object count reached."); } Object[] array = Resources.FindObjectsOfTypeAll(enemy switch { FakeEnemyKind.MushroomZombie => typeof(MushroomZombie), FakeEnemyKind.Scoutmaster => typeof(Scoutmaster), _ => typeof(Looker), }); GameObject val = null; foreach (Object obj in array) { Component val2 = (Component)(object)((obj is Component) ? obj : null); if ((Object)(object)val2 != (Object)null) { val = val2.gameObject; if (val.activeInHierarchy) { break; } } } if ((Object)(object)val == (Object)null) { return ActionResult.Fail(string.Concat("No loaded safe visual source for ", enemy, ".")); } Vector3 val3 = victim.Character.Center - position; val3.y = 0f; GameObject val4 = VisualCloneFactory.CloneVisuals(val, "PTM_FakeEnemy_" + enemy, position, (((Vector3)(ref val3)).sqrMagnitude > 0.01f) ? Quaternion.LookRotation(((Vector3)(ref val3)).normalized, Vector3.up) : Quaternion.identity); if ((Object)(object)val4 == (Object)null) { return ActionResult.Fail("Enemy visual extraction failed."); } val4.AddComponent().Initialize(victim.Character, behavior, lifetime, 2.5f, 6f, 2.5f); Register(MirageKind.FakeEnemy, val4, victim.ActorNumber, creator); return ActionResult.Ok(string.Concat("Created harmless fake ", enemy, ".")); } private void Register(MirageKind kind, GameObject go, int target, int creator) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) MirageRecord mirageRecord = new MirageRecord(); mirageRecord.Id = Guid.NewGuid(); mirageRecord.Kind = kind; mirageRecord.CreatorActor = creator; mirageRecord.CreatedUtc = DateTime.UtcNow; mirageRecord.Position = go.transform.position; mirageRecord.Rotation = go.transform.rotation; mirageRecord.TargetActor = target; mirageRecord.Object = go; _records.Add(mirageRecord); TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.LuggageNavigation != null) { instance.LuggageNavigation.SuppressModMirage(go); } if (TrollModPlugin.Instance.Settings.MirageDebug.Value) { _log.LogInfo((object)string.Concat("Mirage ", mirageRecord.Id, " created: ", kind)); } } private bool CanCreate() { Tick(); return _records.Count < Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxSpawnedObjects.Value, 1, 64); } public void SuppressTrackedVisuals(Action suppress) { if (suppress == null) { return; } for (int i = 0; i < _records.Count; i++) { GameObject val = _records[i].Object; if (!((Object)(object)val == (Object)null)) { Renderer[] componentsInChildren = val.GetComponentsInChildren(true); for (int j = 0; j < componentsInChildren.Length; j++) { suppress(componentsInChildren[j]); } } } } public void UndoLast() { if (_records.Count != 0) { MirageRecord mirageRecord = _records[_records.Count - 1]; if ((Object)(object)mirageRecord.Object != (Object)null) { Object.Destroy((Object)(object)mirageRecord.Object); } _records.RemoveAt(_records.Count - 1); } } public void ClearType(MirageKind kind) { for (int num = _records.Count - 1; num >= 0; num--) { if (_records[num].Kind == kind) { if ((Object)(object)_records[num].Object != (Object)null) { Object.Destroy((Object)(object)_records[num].Object); } _records.RemoveAt(num); } } } public void ClearTarget(int actor) { for (int num = _records.Count - 1; num >= 0; num--) { if (_records[num].TargetActor == actor) { if ((Object)(object)_records[num].Object != (Object)null) { Object.Destroy((Object)(object)_records[num].Object); } _records.RemoveAt(num); } } } public void ClearAll() { for (int i = 0; i < _records.Count; i++) { if ((Object)(object)_records[i].Object != (Object)null) { Object.Destroy((Object)(object)_records[i].Object); } } _records.Clear(); } } internal sealed class PingPlacementManager { private readonly ManualLogSource _log; private readonly MirageManager _mirages; private readonly PlayerManager _players; private readonly TrollNetworkManager _network; private readonly MethodInfo _tryHit; private readonly FieldInfo _character; private int _targetActor; public bool Active { get; private set; } public bool MultiPlace { get; set; } public MirageKind Kind { get; private set; } public PingPlacementManager(ManualLogSource log, MirageManager mirages, PlayerManager players, TrollNetworkManager network) { _log = log; _mirages = mirages; _players = players; _network = network; _tryHit = ReflectionHelpers.Method(typeof(PointPinger), "TryGetPingHit", new Type[2] { typeof(RaycastHit).MakeByRefType(), typeof(Vector3) }); _character = ReflectionHelpers.Field(typeof(PointPinger), "character"); } public void Begin(MirageKind kind, bool multi, int targetActor) { Kind = kind; MultiPlace = multi; _targetActor = targetActor; Active = true; } public void Cancel() { Active = false; } public bool TryCapture(PointPinger pinger) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) if (!Active || (Object)(object)pinger == (Object)null || _tryHit == null) { return false; } Character val = (Character)((_character == null) ? null : /*isinst with value type is only supported in some contexts*/); if ((Object)(object)val != (Object)null && !val.IsLocal) { return false; } try { object[] array = new object[2] { (object)default(RaycastHit), Input.mousePosition }; if (!(bool)_tryHit.Invoke(pinger, array)) { return false; } RaycastHit raycast = (RaycastHit)array[0]; int creator = ((_players.Local != null) ? _players.Local.ActorNumber : 0); ActionResult actionResult = ((_targetActor < 0) ? PlaceForEveryone(raycast, creator) : PlaceForTarget(_players.Find(_targetActor), raycast, creator)); _log.LogInfo((object)string.Concat("Ping placement ", Kind, ": ", actionResult.Message)); if (!MultiPlace) { Active = false; } return actionResult.Success; } catch (Exception ex) { _log.LogWarning((object)("Ping interception failed safely: " + ex.Message)); return false; } } private ActionResult PlaceForEveryone(RaycastHit raycast, int creator) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) int num = 0; IList entries = _players.Entries; for (int i = 0; i < entries.Count; i++) { ActionResult actionResult = PlaceForTarget(entries[i], raycast, creator); if (actionResult.Success) { num++; } } if (num <= 0) { return ActionResult.Fail("No compatible viewers were available for this mirage."); } return ActionResult.Ok(string.Concat("Placed ", Kind, " for ", num, " compatible viewer(s).")); } private ActionResult PlaceForTarget(PlayerEntry target, RaycastHit raycast, int creator) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (target == null) { return ActionResult.Fail("Selected target left the lobby."); } Quaternion rotation = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref raycast)).normal); if (target.IsLocal) { return _mirages.CreateStatic(Kind, ((RaycastHit)(ref raycast)).point, rotation, creator, target.ActorNumber); } return _network.SendToOwner(NetCommand.MirageProp, target, new object[7] { (int)Kind, ((RaycastHit)(ref raycast)).point.x, ((RaycastHit)(ref raycast)).point.y, ((RaycastHit)(ref raycast)).point.z, ((RaycastHit)(ref raycast)).normal.x, ((RaycastHit)(ref raycast)).normal.y, ((RaycastHit)(ref raycast)).normal.z }); } } internal sealed class PhantomPingManager { private const int MaximumPings = 12; private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly MethodInfo _receivePoint; private readonly FieldInfo _character; private int _targetActor; private int _remaining; private int _total; private float _interval; private float _nextPing; private PhantomPingPattern _pattern; public bool Active => _remaining > 0; public PhantomPingManager(ManualLogSource log, PlayerManager players) { _log = log; _players = players; _receivePoint = ReflectionHelpers.Method(typeof(PointPinger), "ReceivePoint_Rpc", new Type[2] { typeof(Vector3), typeof(Vector3) }); _character = ReflectionHelpers.Field(typeof(PointPinger), "character"); } public ActionResult Start(PlayerEntry target, PhantomPingPattern pattern, int count, float interval) { if (target == null || (Object)(object)target.Character == (Object)null || !target.IsLocal) { return ActionResult.Fail("Phantom Pings must run on the target owner's client."); } if (_receivePoint == null || _character == null) { return ActionResult.Fail("The verified point-ping display API is unavailable."); } _targetActor = target.ActorNumber; _pattern = (PhantomPingPattern)Mathf.Clamp((int)pattern, 0, 2); _total = Mathf.Clamp(count, 3, 12); if ((Object)(object)TrollModPlugin.Instance != (Object)null && TrollModPlugin.Instance.Settings.ReduceFlashingEffects.Value) { _total = Mathf.Min(_total, 6); } _remaining = _total; _interval = Mathf.Clamp(interval, 0.35f, 3f); if ((Object)(object)TrollModPlugin.Instance != (Object)null && TrollModPlugin.Instance.Settings.ReduceFlashingEffects.Value) { _interval = Mathf.Max(_interval, 1f); } _nextPing = Time.unscaledTime; return ActionResult.Ok(string.Concat("Started ", _pattern, " with ", _total, " bounded phantom pings.")); } public void Tick() { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) if (!Active || Time.unscaledTime < _nextPing) { return; } PlayerEntry playerEntry = _players.Find(_targetActor); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null || !playerEntry.IsLocal) { Cancel(); return; } PointPinger val = FindPinger(playerEntry.Character); if ((Object)(object)val == (Object)null) { _log.LogWarning((object)"Phantom Pings stopped: target PointPinger was unavailable."); Cancel(); return; } int index = _total - _remaining; Vector3 val2 = PositionFor(playerEntry.Character, index); Vector3 val3 = Vector3.up; RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(val2 + Vector3.up * 12f, Vector3.down, ref val4, 30f)) { val2 = ((RaycastHit)(ref val4)).point; val3 = ((RaycastHit)(ref val4)).normal; } try { _receivePoint.Invoke(val, new object[2] { val2, val3 }); } catch (Exception ex) { _log.LogWarning((object)("Phantom ping display failed safely: " + ex.Message)); Cancel(); return; } _remaining--; _nextPing = Time.unscaledTime + _interval; } private Vector3 PositionFor(Character target, int index) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target.data.lookDirection_Flat; val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { val = ((Component)target).transform.forward; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; if (_pattern == PhantomPingPattern.BreadcrumbTrail) { return target.Center + val * (4f + (float)index * 2f); } if (_pattern == PhantomPingPattern.Circle) { float num = (float)Math.PI * 2f * (float)index / (float)Mathf.Max(3, _total); return target.Center + val * (Mathf.Cos(num) * 6f) + normalized * (Mathf.Sin(num) * 6f); } float num2 = ((index % 2 == 0) ? 1f : (-1f)); return target.Center - val * (3f + (float)index * 0.4f) + normalized * num2 * 1.5f; } private PointPinger FindPinger(Character character) { PointPinger[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && (Object)/*isinst with value type is only supported in some contexts*/ == (Object)(object)character) { return array[i]; } } return null; } public void Cancel() { _remaining = 0; } } internal sealed class AudioManager { private sealed class Playing { public GameObject Object; public float DestroyAt; public int TargetActor; } private sealed class VoiceState { public AudioSource Source; public float Volume; } private readonly ManualLogSource _log; private readonly List _clips = new List(); private readonly List _playing = new List(); private readonly Dictionary _voiceStates = new Dictionary(); private readonly FieldInfo _voiceAudioSource = ReflectionHelpers.Field(typeof(CharacterVoiceHandler), "k__BackingField"); private readonly FieldInfo _voiceSourceFallback = ReflectionHelpers.Field(typeof(CharacterVoiceHandler), "m_source"); private AudioClip _menuClickClip; private AudioSource _menuClickSource; private float _nextRefresh; public IList Clips => _clips.AsReadOnly(); public AudioManager(ManualLogSource log, BaseUnityPlugin host) { _log = log; Refresh(); ((MonoBehaviour)host).StartCoroutine(LoadMenuClick()); } private IEnumerator LoadMenuClick() { string path = Path.Combine(Path.GetDirectoryName(typeof(TrollModPlugin).Assembly.Location), "Audio", "menu-click.mp3"); if (!File.Exists(path)) { _log.LogWarning((object)("Menu click sound was not found at " + path)); yield break; } string url = new Uri(path).AbsoluteUri; UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(url, (AudioType)13); yield return request.SendWebRequest(); if ((int)request.result != 1) { _log.LogWarning((object)("Menu click sound could not be loaded: " + request.error)); request.Dispose(); yield break; } _menuClickClip = DownloadHandlerAudioClip.GetContent(request); request.Dispose(); if ((Object)(object)_menuClickClip == (Object)null) { _log.LogWarning((object)"Menu click sound decoded to an empty clip."); yield break; } ((Object)_menuClickClip).name = "PTM_MenuClick"; GameObject go = new GameObject("PTM_MenuClickAudio"); Object.DontDestroyOnLoad((Object)(object)go); _menuClickSource = go.AddComponent(); _menuClickSource.playOnAwake = false; _menuClickSource.spatialBlend = 0f; _menuClickSource.ignoreListenerPause = true; } public void PlayMenuClick() { if ((Object)(object)_menuClickSource != (Object)null && (Object)(object)_menuClickClip != (Object)null) { _menuClickSource.PlayOneShot(_menuClickClip, 0.65f); } } public void Tick() { if (Time.unscaledTime >= _nextRefresh) { _nextRefresh = Time.unscaledTime + 30f; Refresh(); } for (int num = _playing.Count - 1; num >= 0; num--) { if ((Object)(object)_playing[num].Object == (Object)null || Time.unscaledTime >= _playing[num].DestroyAt) { if ((Object)(object)_playing[num].Object != (Object)null) { Object.Destroy((Object)(object)_playing[num].Object); } _playing.RemoveAt(num); } } } private void Refresh() { AudioClip[] array = Resources.FindObjectsOfTypeAll(); _clips.Clear(); HashSet hashSet = new HashSet(StringComparer.OrdinalIgnoreCase); for (int i = 0; i < array.Length; i++) { if ((Object)(object)array[i] != (Object)null && !string.IsNullOrEmpty(((Object)array[i]).name) && hashSet.Add(((Object)array[i]).name)) { _clips.Add(array[i]); } } _clips.Sort((AudioClip a, AudioClip b) => string.Compare(((Object)a).name, ((Object)b).name, StringComparison.OrdinalIgnoreCase)); } public ActionResult PlayDiscovered(string clipName, Vector3 position, float volume, int targetActor) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) AudioClip val = null; for (int i = 0; i < _clips.Count; i++) { if (string.Equals(((Object)_clips[i]).name, clipName, StringComparison.OrdinalIgnoreCase)) { val = _clips[i]; break; } } if ((Object)(object)val == (Object)null) { return ActionResult.Fail("Audio clip is not loaded in the current scene."); } int num = Mathf.Clamp(TrollModPlugin.Instance.Settings.MaxSpawnedObjects.Value, 1, 64); if (_playing.Count >= num) { if ((Object)(object)_playing[0].Object != (Object)null) { Object.Destroy((Object)(object)_playing[0].Object); } _playing.RemoveAt(0); } GameObject val2 = new GameObject("PTM_FakeAudio_" + ((Object)val).name); val2.transform.position = position; AudioSource val3 = val2.AddComponent(); val3.clip = val; val3.volume = Mathf.Clamp01(volume); val3.spatialBlend = 1f; val3.rolloffMode = (AudioRolloffMode)1; val3.maxDistance = 35f; val3.Play(); _playing.Add(new Playing { Object = val2, DestroyAt = Time.unscaledTime + Mathf.Max(1f, val.length + 0.25f), TargetActor = targetActor }); return ActionResult.Ok("Played " + ((Object)val).name + "."); } public AudioClip FindAssociated(string token) { for (int i = 0; i < _clips.Count; i++) { if (((Object)_clips[i]).name.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) { return _clips[i]; } } return null; } public void StopAll() { for (int i = 0; i < _playing.Count; i++) { if ((Object)(object)_playing[i].Object != (Object)null) { Object.Destroy((Object)(object)_playing[i].Object); } } _playing.Clear(); } public void StopForTarget(int actor) { for (int num = _playing.Count - 1; num >= 0; num--) { if (_playing[num].TargetActor == actor) { if ((Object)(object)_playing[num].Object != (Object)null) { Object.Destroy((Object)(object)_playing[num].Object); } _playing.RemoveAt(num); } } } public ActionResult SetIncomingVoiceMuted(PlayerEntry target, bool muted) { if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.voice == (Object)null) { return ActionResult.Fail("Voice source is not ready."); } AudioSource voiceSource = GetVoiceSource(target.Character.refs.voice); if ((Object)(object)voiceSource == (Object)null) { return ActionResult.Fail("Incoming Photon Voice source is not ready."); } VoiceState value; if (muted) { if (!_voiceStates.TryGetValue(target.ActorNumber, out value)) { value = new VoiceState(); value.Source = voiceSource; value.Volume = voiceSource.volume; _voiceStates.Add(target.ActorNumber, value); } voiceSource.volume = 0f; return ActionResult.Ok("Muted " + target.Name + " on this client. Their mod is not required."); } if (_voiceStates.TryGetValue(target.ActorNumber, out value)) { if ((Object)(object)value.Source != (Object)null) { value.Source.volume = value.Volume; } _voiceStates.Remove(target.ActorNumber); } return ActionResult.Ok("Restored incoming voice for " + target.Name + "."); } public ActionResult SetIncomingVoicePreference(PlayerEntry target, float volume, bool muted) { if (target == null || (Object)(object)target.Character == (Object)null || target.Character.refs == null || (Object)(object)target.Character.refs.voice == (Object)null) { return ActionResult.Fail("Voice source is not ready."); } AudioSource voiceSource = GetVoiceSource(target.Character.refs.voice); if ((Object)(object)voiceSource == (Object)null) { return ActionResult.Fail("Incoming Photon Voice source is not ready."); } if (!_voiceStates.TryGetValue(target.ActorNumber, out var value) || (Object)(object)value.Source != (Object)(object)voiceSource) { value = new VoiceState(); value.Source = voiceSource; value.Volume = voiceSource.volume; _voiceStates[target.ActorNumber] = value; } voiceSource.volume = (muted ? 0f : Mathf.Clamp01(volume)); return ActionResult.Ok("Applied saved voice preference for " + target.Name + "."); } public void RestoreVoice(int actor) { if (_voiceStates.TryGetValue(actor, out var value)) { if ((Object)(object)value.Source != (Object)null) { value.Source.volume = value.Volume; } _voiceStates.Remove(actor); } } public void RestoreAllVoice() { foreach (KeyValuePair voiceState in _voiceStates) { if ((Object)(object)voiceState.Value.Source != (Object)null) { voiceState.Value.Source.volume = voiceState.Value.Volume; } } _voiceStates.Clear(); } public void Dispose() { if ((Object)(object)_menuClickSource != (Object)null) { Object.Destroy((Object)(object)((Component)_menuClickSource).gameObject); } if ((Object)(object)_menuClickClip != (Object)null) { Object.Destroy((Object)(object)_menuClickClip); } _menuClickSource = null; _menuClickClip = null; } private AudioSource GetVoiceSource(CharacterVoiceHandler voice) { AudioSource val = (AudioSource)((_voiceAudioSource == null) ? null : /*isinst with value type is only supported in some contexts*/); if (!((Object)(object)val != (Object)null)) { if (!(_voiceSourceFallback == null)) { object? value = _voiceSourceFallback.GetValue(voice); return (AudioSource)((value is AudioSource) ? value : null); } return null; } return val; } } internal sealed class AppearanceManager { private readonly ManualLogSource _log; private readonly MethodInfo _applyData; private readonly HashSet _modified = new HashSet(); public AppearanceManager(ManualLogSource log) { _log = log; _applyData = ReflectionHelpers.Method(typeof(CharacterCustomization), "OnPlayerDataChange", new Type[1] { typeof(PersistentPlayerData) }); } public ActionResult SwapLocal(PlayerEntry first, PlayerEntry second, bool clothesOnly, bool colorOnly) { if (first == null || second == null || (Object)(object)first.Character == (Object)null || (Object)(object)second.Character == (Object)null || first.ActorNumber == second.ActorNumber) { return ActionResult.Fail("Select two different players."); } try { PersistentPlayerDataService service = GameHandler.GetService(); PersistentPlayerData playerData = service.GetPlayerData(first.ActorNumber); PersistentPlayerData playerData2 = service.GetPlayerData(second.ActorNumber); if (playerData == null || playerData2 == null) { return ActionResult.Fail("Player customization data is not ready."); } Apply(first, Compose(playerData, playerData2, clothesOnly, colorOnly)); Apply(second, Compose(playerData2, playerData, clothesOnly, colorOnly)); _modified.Add(first.ActorNumber); _modified.Add(second.ActorNumber); return ActionResult.Ok("Swapped appearances locally. Unmodded players are supported."); } catch (Exception ex) { _log.LogWarning((object)("Local appearance swap failed: " + ex)); return ActionResult.Fail("Appearance data is not ready: " + ex.Message); } } public ActionResult ShuffleLocal(IList players, bool clothesOnly, bool colorOnly) { if (players == null || players.Count < 2) { return ActionResult.Fail("At least two players are required."); } try { PersistentPlayerDataService service = GameHandler.GetService(); List list = new List(); for (int i = 0; i < players.Count; i++) { list.Add(service.GetPlayerData(players[i].ActorNumber)); } for (int j = 0; j < players.Count; j++) { int index = (j + 1) % players.Count; if (list[j] != null && list[index] != null) { Apply(players[j], Compose(list[j], list[index], clothesOnly, colorOnly)); _modified.Add(players[j].ActorNumber); } } return ActionResult.Ok("Shuffled lobby appearances on this client."); } catch (Exception ex) { _log.LogWarning((object)("Local appearance shuffle failed: " + ex)); return ActionResult.Fail(ex.Message); } } public ActionResult Restore(PlayerEntry player) { if (player == null || (Object)(object)player.Character == (Object)null) { return ActionResult.Fail("Player unavailable."); } try { PersistentPlayerDataService service = GameHandler.GetService(); PersistentPlayerData playerData = service.GetPlayerData(player.ActorNumber); if (playerData == null) { return ActionResult.Fail("Player customization data is not ready."); } Apply(player, playerData); _modified.Remove(player.ActorNumber); return ActionResult.Ok("Restored " + player.Name + "'s actual appearance locally."); } catch (Exception ex) { return ActionResult.Fail(ex.Message); } } public void RestoreAll(IList players) { if (players == null) { return; } for (int i = 0; i < players.Count; i++) { if (_modified.Contains(players[i].ActorNumber)) { Restore(players[i]); } } _modified.Clear(); } private void Apply(PlayerEntry player, PersistentPlayerData data) { if (player.Character.refs == null || (Object)(object)player.Character.refs.customization == (Object)null || _applyData == null) { throw new InvalidOperationException("Character customization apply API unavailable."); } ReflectionHelpers.Invoke(player.Character.refs.customization, _applyData, data); } private static PersistentPlayerData Compose(PersistentPlayerData target, PersistentPlayerData source, bool clothesOnly, bool colorOnly) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected O, but got Unknown //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown CharacterCustomizationData customizationData = target.customizationData; CharacterCustomizationData customizationData2 = source.customizationData; CharacterCustomizationData val = new CharacterCustomizationData(); val.currentSkin = ((colorOnly || (!clothesOnly && !colorOnly)) ? customizationData2.currentSkin : customizationData.currentSkin); val.currentEyes = ((!clothesOnly && !colorOnly) ? customizationData2.currentEyes : customizationData.currentEyes); val.currentMouth = ((!clothesOnly && !colorOnly) ? customizationData2.currentMouth : customizationData.currentMouth); val.currentOutfit = (colorOnly ? customizationData.currentOutfit : customizationData2.currentOutfit); val.currentHat = (colorOnly ? customizationData.currentHat : customizationData2.currentHat); val.currentAccessory = (colorOnly ? customizationData.currentAccessory : customizationData2.currentAccessory); val.currentSash = (colorOnly ? customizationData.currentSash : customizationData2.currentSash); val.currentMedal = (colorOnly ? customizationData.currentMedal : customizationData2.currentMedal); PersistentPlayerData val2 = new PersistentPlayerData(); val2.customizationData = val; return val2; } } internal sealed class ProgressionManager { private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly ModConfig _settings; private readonly MethodInfo _setBadgeStatus; private CharacterData _lastBadgeData; private float _nextRefresh; public bool CosmeticsEnabled => _settings.UnlockAllCosmetics.Value; public bool BadgesEnabled => _settings.UnlockAllBadges.Value; public ProgressionManager(ManualLogSource log, PlayerManager players, ModConfig settings) { _log = log; _players = players; _settings = settings; _setBadgeStatus = AccessTools.Method(typeof(CharacterData), "SetBadgeStatus", (Type[])null, (Type[])null); } public ActionResult SetCosmetics(bool enabled) { _settings.UnlockAllCosmetics.Value = enabled; return ActionResult.Ok(enabled ? "All PEAK cosmetics are available while the mod is enabled. Reopen the passport if it is already open." : "Cosmetics now use your real earned unlock state."); } public ActionResult SetBadges(bool enabled) { _settings.UnlockAllBadges.Value = enabled; _lastBadgeData = null; RefreshBadges(force: true); return ActionResult.Ok(enabled ? "All PEAK badges are enabled and the local sash was refreshed; platform achievements were not granted." : "Badges and the local sash were restored to the real earned state."); } public void Tick() { if (_settings.UnlockAllBadges.Value && !(Time.unscaledTime < _nextRefresh)) { _nextRefresh = Time.unscaledTime + 3f; RefreshBadges(force: false); } } private void RefreshBadges(bool force) { PlayerEntry local = _players.Local; CharacterData val = ((local == null || (Object)(object)local.Character == (Object)null) ? null : local.Character.data); if ((Object)(object)val == (Object)null || _setBadgeStatus == null) { return; } bool flag = force || (Object)(object)val != (Object)(object)_lastBadgeData || val.badgeStatus == null || val.badgeStatus.Length == 0; if (!flag && _settings.UnlockAllBadges.Value) { for (int i = 0; i < val.badgeStatus.Length; i++) { if (!val.badgeStatus[i]) { flag = true; break; } } } if (!flag) { return; } try { _setBadgeStatus.Invoke(val, null); _lastBadgeData = val; } catch (Exception ex) { _log.LogWarning((object)("Badge refresh failed safely: " + ex.Message)); } } } [HarmonyPatch(typeof(CustomizationOption), "get_IsLocked")] internal static class AllCosmeticsUnlockPatch { private static bool Prefix(ref bool __result) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance == (Object)null || instance.Settings == null || !instance.Settings.UnlockAllCosmetics.Value) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(BadgeData), "get_IsLocked")] internal static class AllBadgesUnlockPatch { private static bool Prefix(ref bool __result) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance == (Object)null || instance.Settings == null || !instance.Settings.UnlockAllBadges.Value) { return true; } __result = false; return false; } } internal sealed class ChaosManager { private sealed class ComboJob { public int TargetActor; public List Steps; public int Index; public float NextStep; } private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly TrollNetworkManager _network; private readonly PlayerActions _actions; private readonly MirageManager _mirages; private readonly AudioManager _audio; private readonly SpawnManager _spawns; private ComboJob _combo; private float _next; public float MinimumDelay = 8f; public float MaximumDelay = 18f; public bool ExcludeSelf = true; public bool ComboMandrakeRain = true; public bool ComboKnockout = true; public bool ComboSkyHigh = true; public bool ComboHorizontalYeet = true; public bool ComboOneLiveOne; public float ComboStepDelay = 2f; public bool Active { get; private set; } public bool ComboRunning => _combo != null; public string ComboStatus { get { if (_combo != null) { return "Step " + (_combo.Index + 1) + " / " + _combo.Steps.Count; } return "Stopped"; } } public ChaosManager(ManualLogSource log, PlayerManager players, TrollNetworkManager network, PlayerActions actions, MirageManager mirages, AudioManager audio, SpawnManager spawns) { _log = log; _players = players; _network = network; _actions = actions; _mirages = mirages; _audio = audio; _spawns = spawns; } public void Start() { MinimumDelay = Mathf.Clamp(MinimumDelay, 3f, 60f); MaximumDelay = Mathf.Clamp(MaximumDelay, MinimumDelay, 120f); Active = true; Schedule(); } public void Stop() { Active = false; } public void StopCombo() { _combo = null; } public ActionResult StartCombo(PlayerEntry target) { if (target == null || (Object)(object)target.Character == (Object)null) { return ActionResult.Fail("Select one available scout for the combo."); } List list = new List(); if (ComboMandrakeRain) { list.Add(0); } if (ComboKnockout) { list.Add(1); } if (ComboSkyHigh) { list.Add(2); } if (ComboHorizontalYeet) { list.Add(3); } if (ComboOneLiveOne) { list.Add(4); } if (list.Count == 0) { return ActionResult.Fail("Enable at least one combo step."); } ComboStepDelay = Mathf.Clamp(ComboStepDelay, 0.5f, 10f); _combo = new ComboJob { TargetActor = target.ActorNumber, Steps = list, Index = 0, NextStep = Time.unscaledTime }; return ActionResult.Ok("Started a reusable " + list.Count + "-step combo on " + target.Name + "."); } private void Schedule() { _next = Time.unscaledTime + Random.Range(MinimumDelay, MaximumDelay); } public void Tick() { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) TickCombo(); if (!Active || Time.unscaledTime < _next) { return; } Schedule(); PlayerEntry playerEntry = _players.Random(ExcludeSelf); if (playerEntry == null) { return; } if (!playerEntry.IsLocal && !_network.IsCompatible(playerEntry.ActorNumber)) { if (_network.HostSupportsRequests) { ActionResult actionResult = _network.RequestHostSpawn((Random.value < 0.5f) ? NetCommand.HostSpawnScoutmaster : NetCommand.HostSpawnZombie, playerEntry, Random.Range(7f, 14f)); _log.LogInfo((object)("Chaos used an unmodded-safe host spawn for " + playerEntry.Name + ": " + actionResult.Message)); } return; } int num = Random.Range(0, 7); Vector3 val = new Vector3(Random.Range(-0.4f, 0.4f), 1f, Random.Range(-0.4f, 0.4f)); Vector3 normalized = ((Vector3)(ref val)).normalized; ActionResult actionResult2; switch (num) { case 0: actionResult2 = _network.SendToOwner(NetCommand.Ragdoll, playerEntry, new object[5] { normalized.x, normalized.y, normalized.z, Random.Range(15f, 55f), 1.5f }); break; case 1: actionResult2 = _network.SendToOwner(NetCommand.Launch, playerEntry, new object[5] { normalized.x, Mathf.Abs(normalized.y), normalized.z, Random.Range(20f, 50f), true }); break; case 2: actionResult2 = _network.SendToOwner(NetCommand.Speed, playerEntry, new object[1] { Random.Range(0.35f, 2.8f) }); break; case 3: actionResult2 = _network.SendToOwner(NetCommand.Knockout, playerEntry, new object[0]); break; case 4: actionResult2 = _network.SendToOwner(NetCommand.Status, playerEntry, new object[2] { Random.Range(0, 11), Random.Range(0.05f, 0.25f) }); break; default: { Vector3 val2 = playerEntry.Character.Center - playerEntry.Character.data.lookDirection_Flat * Random.Range(7f, 12f); NetCommand netCommand = ((num == 5) ? NetCommand.MirageScout : NetCommand.FakeEnemy); object[] args = ((netCommand == NetCommand.MirageScout) ? new object[6] { playerEntry.ActorNumber, val2.x, val2.y, val2.z, 1, 10f } : new object[6] { Random.Range(0, 3), val2.x, val2.y, val2.z, 7, 12f }); actionResult2 = _network.SendToOwner(netCommand, playerEntry, args); break; } } _log.LogInfo((object)("Chaos event " + num + " -> " + playerEntry.Name + ": " + actionResult2.Message)); } private void TickCombo() { if (_combo == null || Time.unscaledTime < _combo.NextStep) { return; } PlayerEntry playerEntry = _players.Find(_combo.TargetActor); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null) { _log.LogWarning((object)"Combo cancelled because its target left."); _combo = null; return; } int num = _combo.Steps[_combo.Index]; ActionResult actionResult = num switch { 0 => _spawns.StartMandrakeRain(playerEntry, 10, 15f, 5f, 0.18f), 1 => _network.SendToOwner(NetCommand.Knockout, playerEntry, new object[0]), 2 => _network.SkyLaunch(playerEntry, 120f), 3 => _network.HorizontalRagdoll(playerEntry, 90f), _ => _spawns.StartOneLiveOne(playerEntry, 12, 16f, 6f, 0.22f), }; _log.LogInfo((object)("Combo step " + num + " -> " + playerEntry.Name + ": " + actionResult.Message)); _combo.Index++; if (_combo.Index >= _combo.Steps.Count) { _combo = null; } else { _combo.NextStep = Time.unscaledTime + Mathf.Clamp(ComboStepDelay, 0.5f, 10f); } } } internal sealed class SummitSaboteurManager { private sealed class SabotageJob { public int TargetActor; public Vector3 Summit; public float TriggerDistance; public float StaminaLockSeconds; public float LaunchDistance; public bool Triggered; public int Stage; public float NextStage; } private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private readonly TrollNetworkManager _network; private readonly SpawnManager _spawns; private readonly CapabilityRegistry _capabilities; private SabotageJob _job; private float _nextCheck; private float _victimUntil; private bool _victimCached; private float _victimStamina; private float _victimExtraStamina; private string _status = "Not armed"; public bool Armed => _job != null; public string Status => _status; public SummitSaboteurManager(ManualLogSource log, PlayerManager players, PlayerActions actions, TrollNetworkManager network, SpawnManager spawns, CapabilityRegistry capabilities) { _log = log; _players = players; _actions = actions; _network = network; _spawns = spawns; _capabilities = capabilities; } public ActionResult Arm(PlayerEntry target, float triggerDistance, float staminaLockSeconds, float launchDistance) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) if (!_players.IsHost) { return ActionResult.Fail("Summit Saboteur requires host authority for the zombie and max-Hunger steps."); } if (!_capabilities.Available(FeatureCapability.SummitSaboteur)) { return ActionResult.Fail(_capabilities.Reason(FeatureCapability.SummitSaboteur)); } if (target == null || (Object)(object)target.Character == (Object)null || (Object)(object)target.Character.data == (Object)null) { return ActionResult.Fail("Select one available scout."); } if (!_actions.TryGetStartEnd(end: true, out var position) || !PlayerActions.Finite(position)) { return ActionResult.Fail("The final summit reference is not loaded yet."); } _job = new SabotageJob { TargetActor = target.ActorNumber, Summit = position, TriggerDistance = Mathf.Clamp(triggerDistance, 8f, 35f), StaminaLockSeconds = Mathf.Clamp(staminaLockSeconds, 2f, 10f), LaunchDistance = Mathf.Clamp(launchDistance, 50f, 300f) }; _nextCheck = 0f; _status = "Armed for " + target.Name + ". Waiting for summit approach."; return ActionResult.Ok(_status); } public ActionResult Cancel() { if (_job == null) { return ActionResult.Ok("Summit Saboteur is not armed."); } PlayerEntry playerEntry = _players.Find(_job.TargetActor); if (_job.Triggered && playerEntry != null && (playerEntry.IsLocal || _network.IsCompatible(playerEntry.ActorNumber))) { _network.SendToOwner(NetCommand.SummitSabotageVictim, playerEntry, new object[1] { 0f }); } _job = null; _status = "Cancelled"; return ActionResult.Ok("Summit Saboteur cancelled."); } public void Tick() { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) TickVictim(); if (_job == null) { return; } if (!PhotonNetwork.InRoom || !_players.IsHost) { _job = null; _status = "Cancelled because host authority was lost."; return; } PlayerEntry playerEntry = _players.Find(_job.TargetActor); if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null || (Object)(object)playerEntry.Character.data == (Object)null) { _job = null; _status = "Cancelled because the target left."; } else if (!_job.Triggered) { if (Time.unscaledTime < _nextCheck) { return; } _nextCheck = Time.unscaledTime + 0.2f; if (playerEntry.Character.data.dead) { _status = "Armed, but the target is currently dead."; return; } float num = Vector3.Distance(playerEntry.Character.Center, _job.Summit); _status = "Armed for " + playerEntry.Name + " — " + num.ToString("0") + " m from trigger."; if (num <= _job.TriggerDistance) { Trigger(playerEntry); } } else if (!(Time.unscaledTime < _job.NextStage)) { if (_job.Stage == 1) { LogStep("zombie", _spawns.SpawnZombieBehind(playerEntry, 6f)); _job.Stage = 2; _job.NextStage = Time.unscaledTime + 0.75f; } else { LogStep("horizontal launch", _network.HorizonLaunch(playerEntry, _job.LaunchDistance)); _status = "Triggered on " + playerEntry.Name + "."; _job = null; } } } private void Trigger(PlayerEntry target) { _job.Triggered = true; _job.Stage = 1; _job.NextStage = Time.unscaledTime + 0.75f; _status = "Triggered — sabotage sequence running."; LogStep("held-item drop", _actions.DropHeldItemLocal(target)); LogStep("max Hunger", _actions.ApplyStatusAsHost(target, 1, 2f)); if (target.IsLocal || _network.IsCompatible(target.ActorNumber)) { LogStep("stamina lock", _network.SendToOwner(NetCommand.SummitSabotageVictim, target, new object[1] { _job.StaminaLockSeconds })); } else { _log.LogInfo((object)("Summit Saboteur skipped the stamina lock and fake notice because " + target.Name + " is unmodded.")); } } private void LogStep(string step, ActionResult result) { _log.LogInfo((object)("Summit Saboteur " + step + ": " + result.Message)); } public ActionResult ActivateVictim(float seconds) { seconds = Mathf.Clamp(seconds, 0f, 10f); if (seconds <= 0f) { RestoreVictim(); return ActionResult.Ok("Summit Saboteur stamina lock cleared."); } Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter == (Object)null || (Object)(object)localCharacter.data == (Object)null) { return ActionResult.Fail("Local character stamina is unavailable."); } if (!_victimCached) { _victimStamina = localCharacter.data.currentStamina; _victimExtraStamina = localCharacter.data.extraStamina; _victimCached = true; } _victimUntil = Mathf.Max(_victimUntil, Time.unscaledTime + seconds); ShowRecoveryNotice(); return ActionResult.Ok("Summit Saboteur victim effect started for " + seconds.ToString("0.0") + " seconds."); } private void TickVictim() { if (!_victimCached) { return; } if (Time.unscaledTime >= _victimUntil) { RestoreVictim(); return; } Character localCharacter = Character.localCharacter; if (!((Object)(object)localCharacter == (Object)null) && !((Object)(object)localCharacter.data == (Object)null) && !localCharacter.data.dead) { localCharacter.data.currentStamina = 0f; localCharacter.data.extraStamina = 0f; localCharacter.data.staminaDelta = 0f; localCharacter.data.sinceUseStamina = 0f; } } private static void ShowRecoveryNotice() { UI_Notifications[] array = Resources.FindObjectsOfTypeAll(); foreach (UI_Notifications val in array) { if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { val.AddNotification("Connection recovered"); break; } } } private void RestoreVictim() { if (_victimCached) { Character localCharacter = Character.localCharacter; if ((Object)(object)localCharacter != (Object)null && (Object)(object)localCharacter.data != (Object)null && !localCharacter.data.dead) { if (!float.IsNaN(_victimStamina) && !float.IsInfinity(_victimStamina)) { localCharacter.data.currentStamina = _victimStamina; } if (!float.IsNaN(_victimExtraStamina) && !float.IsInfinity(_victimExtraStamina)) { localCharacter.data.extraStamina = _victimExtraStamina; } } } _victimCached = false; _victimUntil = 0f; } public void ResetTarget(int actor) { if (_job != null && _job.TargetActor == actor) { _job = null; _status = "Cancelled by player reset."; } } public void Reset() { _job = null; _status = "Not armed"; RestoreVictim(); } } internal sealed class CampfireTrollManager { private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private readonly ModConfig _settings; private readonly HashSet _triggered = new HashSet(); public bool Enabled { get { return _settings.CampfireResetEnabled.Value; } set { _settings.CampfireResetEnabled.Value = value; if (value) { _settings.CampfireDeathTrapEnabled.Value = false; } } } public bool DeathTrapEnabled { get { return _settings.CampfireDeathTrapEnabled.Value; } set { _settings.CampfireDeathTrapEnabled.Value = value; if (value) { _settings.CampfireResetEnabled.Value = false; } } } public float DeathRadius { get { return Mathf.Clamp(_settings.CampfireDeathRadius.Value, 3f, 50f); } set { _settings.CampfireDeathRadius.Value = Mathf.Clamp(value, 3f, 50f); } } public CampfireTrollManager(ManualLogSource log, PlayerManager players, PlayerActions actions, ModConfig settings) { _log = log; _players = players; _actions = actions; _settings = settings; } public void ResetScene() { _triggered.Clear(); } public void OnCampfireLit(Campfire campfire) { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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) if ((Object)(object)campfire == (Object)null || (!Enabled && !DeathTrapEnabled) || !_triggered.Add(((Object)campfire).GetInstanceID())) { return; } if (DeathTrapEnabled) { EliminateNearby(campfire); return; } if (!_actions.TryGetStartEnd(end: false, out var position)) { _log.LogWarning((object)"Campfire reset could not resolve the first segment start."); return; } IList entries = _players.Entries; int num = 0; float num2 = ((entries.Count <= 1) ? 0f : Mathf.Min(2.5f, 0.55f * (float)entries.Count)); for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; if (playerEntry != null && !((Object)(object)playerEntry.Character == (Object)null) && playerEntry.Character.refs != null && !((Object)(object)playerEntry.Character.refs.view == (Object)null)) { float num3 = ((entries.Count <= 1) ? 0f : ((float)i * (float)Math.PI * 2f / (float)entries.Count)); Vector3 val = position + new Vector3(Mathf.Cos(num3) * num2, 0f, Mathf.Sin(num3) * num2); try { playerEntry.Character.refs.view.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { val, true }); num++; } catch (Exception ex) { _log.LogWarning((object)("Campfire reset warp failed for " + playerEntry.Name + ": " + ex.Message)); } } } _log.LogInfo((object)("Campfire troll returned " + num + " scouts to the start.")); } private void EliminateNearby(Campfire campfire) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)campfire).transform.position; if (!PlayerActions.Finite(position)) { _log.LogWarning((object)"Campfire death trap received an invalid campfire position."); return; } float deathRadius = DeathRadius; float num = deathRadius * deathRadius; IList entries = _players.Entries; int num2 = 0; for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; if (playerEntry == null || (Object)(object)playerEntry.Character == (Object)null || (Object)(object)playerEntry.Character.data == (Object)null || playerEntry.Character.data.dead) { continue; } Vector3 center = playerEntry.Character.Center; if (!PlayerActions.Finite(center)) { continue; } Vector3 val = center - position; if (!(((Vector3)(ref val)).sqrMagnitude > num)) { ActionResult actionResult = _actions.EliminateLocal(playerEntry); if (actionResult.Success) { num2++; } else { _log.LogWarning((object)("Campfire death trap could not eliminate " + playerEntry.Name + ": " + actionResult.Message)); } } } _log.LogInfo((object)("Campfire death trap eliminated " + num2 + " scouts within " + deathRadius.ToString("0.#") + " m.")); } } [HarmonyPatch(typeof(Campfire), "Light_Rpc")] internal static class CampfireLightPatch { private static void Postfix(Campfire __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.CampfireTroll != null) { instance.CampfireTroll.OnCampfireLit(__instance); } } } internal sealed class HelicopterTrollManager { private readonly ManualLogSource _log; private readonly ModConfig _settings; private readonly HashSet _remoteSuppressors = new HashSet(); private readonly FieldInfo _summonedField; private PeakHandler _suppressedHandler; private float _nextAdvertise; public bool LocalEnabled => _settings.HelicopterSuppressionEnabled.Value; public bool Active { get { if (!LocalEnabled) { return _remoteSuppressors.Count > 0; } return true; } } public HelicopterTrollManager(ManualLogSource log, ModConfig settings) { _log = log; _settings = settings; _summonedField = AccessTools.Field(typeof(PeakHandler), "summonedHelicopter"); } public ActionResult SetLocalEnabled(bool enabled) { _settings.HelicopterSuppressionEnabled.Value = enabled; if ((Object)(object)TrollModPlugin.Instance != (Object)null && TrollModPlugin.Instance.Network != null) { TrollModPlugin.Instance.Network.BroadcastHelicopterSuppression(enabled); } if (!Active) { RestoreSuppressedFlag(); } return ActionResult.Ok(enabled ? "Summit helicopter suppression enabled and advertised to compatible clients." : "Local helicopter suppression disabled; compatible clients were notified."); } public void SetRemote(int actor, bool enabled) { if (enabled) { _remoteSuppressors.Add(actor); } else { _remoteSuppressors.Remove(actor); } if (!Active) { RestoreSuppressedFlag(); } } public void Tick() { if (PhotonNetwork.InRoom && PhotonNetwork.CurrentRoom != null) { List list = new List(); foreach (int remoteSuppressor in _remoteSuppressors) { if (PhotonNetwork.CurrentRoom.GetPlayer(remoteSuppressor, false) == null) { list.Add(remoteSuppressor); } } for (int i = 0; i < list.Count; i++) { _remoteSuppressors.Remove(list[i]); } if (LocalEnabled && Time.unscaledTime >= _nextAdvertise) { _nextAdvertise = Time.unscaledTime + 5f; if ((Object)(object)TrollModPlugin.Instance != (Object)null && TrollModPlugin.Instance.Network != null) { TrollModPlugin.Instance.Network.BroadcastHelicopterSuppression(enabled: true); } } } else { _remoteSuppressors.Clear(); } if (!Active) { RestoreSuppressedFlag(); } } public void ResetScene() { _remoteSuppressors.Clear(); _suppressedHandler = null; _nextAdvertise = 0f; } public bool TrySuppress(PeakHandler handler) { if (!Active || (Object)(object)handler == (Object)null || _summonedField == null) { return false; } _summonedField.SetValue(handler, true); _suppressedHandler = handler; _log.LogInfo((object)"Suppressed the local summit helicopter sequence."); return true; } private void RestoreSuppressedFlag() { if (!((Object)(object)_suppressedHandler == (Object)null) && !(_summonedField == null)) { _summonedField.SetValue(_suppressedHandler, false); _suppressedHandler = null; } } } [HarmonyPatch(typeof(PeakHandler), "SummonHelicopter")] internal static class SummitHelicopterPatch { private static bool Prefix(PeakHandler __instance) { TrollModPlugin instance = TrollModPlugin.Instance; if (!((Object)(object)instance == (Object)null) && instance.HelicopterTroll != null) { return !instance.HelicopterTroll.TrySuppress(__instance); } return true; } } internal sealed class ExpeditionDirectorManager { private const string CodePrefix = "PTMD1."; private readonly ManualLogSource _log; private readonly PlayerManager _players; private readonly PlayerActions _actions; private readonly SpawnManager _spawns; private readonly ChaosManager _chaos; private readonly TrollNetworkManager _network; private readonly ModConfig _settings; private readonly Dictionary _lastDead = new Dictionary(); private readonly Dictionary _offerResponses = new Dictionary(); private float _runStarted; private float _elapsedBeforeRun; private float _nextEvent; private float _startedAt; private float _rosterGraceUntil; private int _events; private int _rescues; private int _deaths; private string _lastEvent = "No director event has run yet."; private string _pendingOfferName = string.Empty; private string _pendingOfferCode = string.Empty; private int _pendingOfferHost; public ExpeditionMode Mode; public float DurationSeconds = 600f; public float EventInterval = 25f; public int MaximumEnemies = 10; public int StartingDifficulty = 2; public bool AdaptiveDifficulty = true; public bool ZombieWaves = true; public bool ScoutmasterEvents; public bool SupplyDrops = true; public bool AutoRevive; public bool ChaosEvents; public DirectorRoundState State { get; private set; } public int AliveCount { get; private set; } public int DeadCount { get; private set; } public int EventsTriggered => _events; public int Rescues => _rescues; public int Deaths => _deaths; public string LastEvent => _lastEvent; public bool Active { get { if (State != DirectorRoundState.Running) { return State == DirectorRoundState.Paused; } return true; } } public bool IsPaused => State == DirectorRoundState.Paused; public float Elapsed => _elapsedBeforeRun + ((State == DirectorRoundState.Running) ? Mathf.Max(0f, Time.unscaledTime - _runStarted) : 0f); public float Remaining => Mathf.Max(0f, DurationSeconds - Elapsed); public float NextEventSeconds { get { if (State != DirectorRoundState.Running) { return 0f; } return Mathf.Max(0f, _nextEvent - Time.unscaledTime); } } public int Difficulty { get { int num = ((AdaptiveDifficulty && DurationSeconds > 0f) ? Mathf.FloorToInt(Elapsed / DurationSeconds * 5f) : 0); return Mathf.Clamp(StartingDifficulty + num, 1, 10); } } public int Score => Mathf.Max(0, Mathf.RoundToInt(Elapsed) + _events * 20 + _rescues * 100 - _deaths * 25); public string ModeName => NameFor(Mode); public bool HasPendingOffer => !string.IsNullOrEmpty(_pendingOfferCode); public string PendingOfferName => _pendingOfferName; public string OfferResponseSummary { get { int num = 0; foreach (KeyValuePair offerResponse in _offerResponses) { if (offerResponse.Value) { num++; } } if (_offerResponses.Count != 0) { return num + " accepted • " + (_offerResponses.Count - num) + " declined"; } return "No responses to the latest scenario offer"; } } public string Status => string.Concat(State, " • ", ModeName, " • difficulty ", Difficulty); public string Objective { get { if (Mode == ExpeditionMode.RescueRush) { return "Revive fallen scouts and keep the whole party moving."; } if (Mode == ExpeditionMode.Hardcore) { return "Reach the summit with no automatic rescues or supply drops."; } if (Mode == ExpeditionMode.ChaosClimb) { return "Keep climbing while the director changes the pressure."; } if (Mode == ExpeditionMode.Survival) { return "Keep at least one scout alive until the timer expires."; } if (Mode == ExpeditionMode.Custom) { return "Complete your custom scenario rules before time expires."; } return "Survive escalating zombie waves until the timer expires."; } } public ExpeditionDirectorManager(ManualLogSource log, PlayerManager players, PlayerActions actions, SpawnManager spawns, ChaosManager chaos, TrollNetworkManager network, ModConfig settings) { _log = log; _players = players; _actions = actions; _spawns = spawns; _chaos = chaos; _network = network; _settings = settings; State = DirectorRoundState.Stopped; ApplyPreset(ExpeditionMode.ZombieOutbreak); if (!string.IsNullOrEmpty(settings.DirectorScenarioCode.Value)) { ImportCode(settings.DirectorScenarioCode.Value); } } public ActionResult ApplyPreset(ExpeditionMode mode) { if (Active) { return ActionResult.Fail("Stop the current round before changing its scenario."); } Mode = mode; switch (mode) { case ExpeditionMode.ZombieOutbreak: DurationSeconds = 600f; EventInterval = 24f; MaximumEnemies = 12; StartingDifficulty = 2; AdaptiveDifficulty = true; ZombieWaves = true; ScoutmasterEvents = false; SupplyDrops = true; AutoRevive = false; ChaosEvents = false; break; case ExpeditionMode.Survival: DurationSeconds = 480f; EventInterval = 30f; MaximumEnemies = 8; StartingDifficulty = 2; AdaptiveDifficulty = true; ZombieWaves = true; ScoutmasterEvents = true; SupplyDrops = true; AutoRevive = true; ChaosEvents = false; break; case ExpeditionMode.RescueRush: DurationSeconds = 420f; EventInterval = 36f; MaximumEnemies = 6; StartingDifficulty = 2; AdaptiveDifficulty = true; ZombieWaves = true; ScoutmasterEvents = false; SupplyDrops = true; AutoRevive = false; ChaosEvents = false; break; case ExpeditionMode.Hardcore: DurationSeconds = 900f; EventInterval = 18f; MaximumEnemies = 16; StartingDifficulty = 4; AdaptiveDifficulty = true; ZombieWaves = true; ScoutmasterEvents = true; SupplyDrops = false; AutoRevive = false; ChaosEvents = false; break; case ExpeditionMode.ChaosClimb: DurationSeconds = 600f; EventInterval = 20f; MaximumEnemies = 10; StartingDifficulty = 3; AdaptiveDifficulty = true; ZombieWaves = true; ScoutmasterEvents = true; SupplyDrops = true; AutoRevive = false; ChaosEvents = true; break; } ClampRules(); return ActionResult.Ok("Loaded the " + ModeName + " scenario preset."); } public ActionResult Start() { if (!PhotonNetwork.InRoom) { return ActionResult.Fail("Join a Photon room before starting a director round."); } if (!_players.IsHost) { return ActionResult.Fail("Only the current Photon host can start Expedition Director."); } if (Active) { return ActionResult.Fail("A director round is already active."); } ClampRules(); UpdateRoster(); if (AliveCount == 0) { return ActionResult.Fail("At least one living scout is required to start."); } _spawns.ClearDirectorSpawns(); _chaos.StopCombo(); _lastDead.Clear(); _events = 0; _rescues = 0; _deaths = 0; _elapsedBeforeRun = 0f; _runStarted = Time.unscaledTime; _startedAt = Time.unscaledTime; _rosterGraceUntil = Time.unscaledTime + 12f; _nextEvent = Time.unscaledTime + Mathf.Min(8f, EventInterval); _lastEvent = "Round initialized; first event is scheduled."; State = DirectorRoundState.Running; CaptureRoster(); return ActionResult.Ok("Started " + ModeName + ". " + Objective); } public ActionResult TogglePause() { if (!_players.IsHost) { return ActionResult.Fail("Only the host can pause Expedition Director."); } if (State == DirectorRoundState.Running) { _elapsedBeforeRun += Mathf.Max(0f, Time.unscaledTime - _runStarted); State = DirectorRoundState.Paused; return ActionResult.Ok("Expedition Director paused."); } if (State == DirectorRoundState.Paused) { State = DirectorRoundState.Running; _runStarted = Time.unscaledTime; _nextEvent = Time.unscaledTime + Mathf.Min(5f, EventInterval); return ActionResult.Ok("Expedition Director resumed."); } return ActionResult.Fail("No active round can be paused."); } public ActionResult Stop(bool cleanup) { bool flag = Active || State == DirectorRoundState.Completed || State == DirectorRoundState.Failed; if (State == DirectorRoundState.Running) { _elapsedBeforeRun += Mathf.Max(0f, Time.unscaledTime - _runStarted); } State = DirectorRoundState.Stopped; _chaos.StopCombo(); int num = (cleanup ? _spawns.ClearDirectorSpawns() : 0); if (!flag) { return ActionResult.Ok("Expedition Director is already stopped."); } return ActionResult.Ok("Stopped Expedition Director" + (cleanup ? (" and removed " + num + " director-owned spawn(s).") : ".")); } public void Tick() { if (!PhotonNetwork.InRoom) { ClearPendingOffer(); } else if (HasPendingOffer && (PhotonNetwork.MasterClient == null || PhotonNetwork.MasterClient.ActorNumber != _pendingOfferHost)) { ClearPendingOffer(); } if (!Active) { UpdateRoster(); return; } if (!PhotonNetwork.InRoom || !_players.IsHost) { Stop(cleanup: true); _lastEvent = "Round stopped because host authority was lost."; return; } UpdateRoster(); if (!RosterReady()) { return; } TrackRosterTransitions(); if (State == DirectorRoundState.Running) { if (AliveCount == 0 && Time.unscaledTime > _rosterGraceUntil && Time.unscaledTime - _startedAt > 10f) { Finish(success: false, "Every scout is down."); } else if (Elapsed >= DurationSeconds) { Finish(AliveCount > 0, "The scenario timer was completed."); } else if (Time.unscaledTime >= _nextEvent) { RunEvent(); _nextEvent = Time.unscaledTime + Mathf.Clamp(EventInterval - (float)(Difficulty - 1) * 0.7f, 5f, 120f); } } } public void OnSceneLoaded() { if (State == DirectorRoundState.Running) { _nextEvent = Time.unscaledTime + Mathf.Min(8f, EventInterval); } _rosterGraceUntil = Time.unscaledTime + 12f; _lastDead.Clear(); CaptureRoster(); } private void RunEvent() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) List list = LivingPlayers(); if (list.Count == 0) { return; } PlayerEntry playerEntry = list[Random.Range(0, list.Count)]; _events++; if (AutoRevive && DeadCount > 0) { PlayerEntry playerEntry2 = FirstDead(); if (playerEntry2 != null) { ActionResult actionResult = _actions.ResurrectNearPlayer(playerEntry2, playerEntry); _lastEvent = "Auto-rescue: " + actionResult.Message; return; } } if (SupplyDrops && _events % 3 == 0) { ActionResult actionResult2 = _spawns.SpawnDirectorSupply(playerEntry); if (actionResult2.Success) { _lastEvent = "Supply event: " + actionResult2.Message; return; } } if (ChaosEvents && _events % 2 == 0) { Vector3 val = new Vector3(Random.Range(-0.45f, 0.45f), 0.65f, Random.Range(-0.45f, 0.45f)); Vector3 normalized = ((Vector3)(ref val)).normalized; ActionResult actionResult3 = _actions.RagdollLocal(playerEntry, normalized, Mathf.Clamp(10f + (float)Difficulty * 3f, 10f, 45f), 1.2f); _lastEvent = "Chaos pulse: " + actionResult3.Message; return; } if (!ZombieWaves && !ScoutmasterEvents) { _lastEvent = "Rule pulse " + _events + " completed with enemy spawning disabled."; return; } int num = Mathf.Max(0, MaximumEnemies - _spawns.DirectorEnemyCount); int num2 = Mathf.Min(num, 1 + Difficulty / 3); if (num2 <= 0) { _lastEvent = "Enemy cap reached; the director held this wave."; return; } int num3 = 0; string text = ""; for (int i = 0; i < num2; i++) { ActionResult actionResult4 = ((ScoutmasterEvents && (!ZombieWaves || (Difficulty >= 5 && (_events + i) % 4 == 0))) ? _spawns.SpawnDirectorScoutmaster(playerEntry, Random.Range(8f, 15f)) : _spawns.SpawnDirectorZombie(playerEntry, Random.Range(7f, 14f))); text = actionResult4.Message; if (actionResult4.Success) { num3++; } } _lastEvent = ((num3 > 0) ? ("Wave " + _events + ": spawned " + num3 + " threat(s) near " + playerEntry.Name + ".") : ("Wave held: " + text)); _log.LogInfo((object)("Expedition Director event: " + _lastEvent)); } private void Finish(bool success, string reason) { if (State == DirectorRoundState.Running) { _elapsedBeforeRun += Mathf.Max(0f, Time.unscaledTime - _runStarted); } State = (success ? DirectorRoundState.Completed : DirectorRoundState.Failed); _lastEvent = reason + " Final score: " + Score + "."; _chaos.StopCombo(); _spawns.ClearDirectorSpawns(); } public string ExportCode() { ClampRules(); string s = (int)Mode + "|" + Mathf.RoundToInt(DurationSeconds) + "|" + Mathf.RoundToInt(EventInterval) + "|" + MaximumEnemies + "|" + StartingDifficulty + "|" + B(AdaptiveDifficulty) + "|" + B(ZombieWaves) + "|" + B(ScoutmasterEvents) + "|" + B(SupplyDrops) + "|" + B(AutoRevive) + "|" + B(ChaosEvents); string text = "PTMD1." + Convert.ToBase64String(Encoding.UTF8.GetBytes(s)); _settings.DirectorScenarioCode.Value = text; return text; } public ActionResult OfferScenario() { if (!_players.IsHost) { return ActionResult.Fail("Only the current host can offer scenario rules."); } _offerResponses.Clear(); string code = ExportCode(); return _network.OfferDirectorScenario(ModeName, code); } public ActionResult ReceiveOffer(int senderActor, string name, string code) { if (!PhotonNetwork.InRoom || PhotonNetwork.MasterClient == null || senderActor != PhotonNetwork.MasterClient.ActorNumber) { return ActionResult.Fail("Rejected Director offer from a non-host sender."); } if (!ValidateCode(code, out var modeName)) { return ActionResult.Fail("Rejected invalid Director scenario code."); } _pendingOfferHost = senderActor; _pendingOfferName = (string.IsNullOrEmpty(name) ? modeName : name); _pendingOfferCode = code; return ActionResult.Ok("Host offered " + _pendingOfferName + " rules. Review them on Expedition Director."); } public ActionResult AcceptOffer() { if (!HasPendingOffer) { return ActionResult.Fail("No Director scenario offer is pending."); } string pendingOfferName = _pendingOfferName; ActionResult actionResult = ImportCode(_pendingOfferCode); if (actionResult.Success) { _network.RespondDirectorScenario(_pendingOfferHost, accepted: true, pendingOfferName); } ClearPendingOffer(); return actionResult; } public ActionResult DeclineOffer() { if (!HasPendingOffer) { return ActionResult.Fail("No Director scenario offer is pending."); } string pendingOfferName = _pendingOfferName; _network.RespondDirectorScenario(_pendingOfferHost, accepted: false, pendingOfferName); ClearPendingOffer(); return ActionResult.Ok("Declined " + pendingOfferName + " rules."); } public ActionResult ReceiveResponse(int senderActor, bool accepted, string name) { if (!_players.IsHost) { return ActionResult.Fail("Ignored Director response on a non-host client."); } PlayerEntry playerEntry = _players.Find(senderActor); if (playerEntry == null) { return ActionResult.Fail("Director respondent left the lobby."); } _offerResponses[senderActor] = accepted; return ActionResult.Ok(playerEntry.Name + (accepted ? " accepted " : " declined ") + name + "."); } public bool ValidateCode(string code, out string modeName) { modeName = string.Empty; if (string.IsNullOrEmpty(code) || code.Length > 512 || !code.StartsWith("PTMD1.", StringComparison.Ordinal)) { return false; } try { string[] array = Encoding.UTF8.GetString(Convert.FromBase64String(code.Substring("PTMD1.".Length))).Split(new char[1] { '|' }); if (array.Length != 11) { return false; } if (!int.TryParse(array[0], out var result) || result < 0 || result > 5 || !int.TryParse(array[1], out var result2) || result2 < 60 || result2 > 3600 || !int.TryParse(array[2], out var result3) || result3 < 5 || result3 > 120 || !int.TryParse(array[3], out var result4) || result4 < 1 || result4 > 24 || !int.TryParse(array[4], out var result5) || result5 < 1 || result5 > 10) { return false; } for (int i = 5; i < 11; i++) { if (!PB(array[i], out var _)) { return false; } } modeName = NameFor((ExpeditionMode)result); return true; } catch { return false; } } public ActionResult ImportCode(string code) { if (Active) { return ActionResult.Fail("Stop the current round before importing a scenario."); } if (string.IsNullOrEmpty(code) || code.Length > 512 || !code.StartsWith("PTMD1.", StringComparison.Ordinal)) { return ActionResult.Fail("Scenario code must be a bounded PTMD1 code."); } try { string text = Encoding.UTF8.GetString(Convert.FromBase64String(code.Substring("PTMD1.".Length))); string[] array = text.Split(new char[1] { '|' }); if (array.Length != 11) { return ActionResult.Fail("Scenario code has the wrong field count."); } if (!int.TryParse(array[0], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) || result < 0 || result > 5) { return ActionResult.Fail("Scenario mode is invalid."); } if (!int.TryParse(array[1], out var result2) || !int.TryParse(array[2], out var result3) || !int.TryParse(array[3], out var result4) || !int.TryParse(array[4], out var result5)) { return ActionResult.Fail("Scenario numeric fields are invalid."); } if (!PB(array[5], out var result6) || !PB(array[6], out var result7) || !PB(array[7], out var result8) || !PB(array[8], out var result9) || !PB(array[9], out var result10) || !PB(array[10], out var result11)) { return ActionResult.Fail("Scenario flags are invalid."); } Mode = (ExpeditionMode)result; DurationSeconds = result2; EventInterval = result3; MaximumEnemies = result4; StartingDifficulty = result5; AdaptiveDifficulty = result6; ZombieWaves = result7; ScoutmasterEvents = result8; SupplyDrops = result9; AutoRevive = result10; ChaosEvents = result11; ClampRules(); _settings.DirectorScenarioCode.Value = ExportCode(); return ActionResult.Ok("Imported validated " + ModeName + " scenario rules."); } catch (Exception ex) { return ActionResult.Fail("Scenario code could not be decoded: " + ex.Message); } } private void ClampRules() { DurationSeconds = Mathf.Clamp(DurationSeconds, 60f, 3600f); EventInterval = Mathf.Clamp(EventInterval, 5f, 120f); MaximumEnemies = Mathf.Clamp(MaximumEnemies, 1, 24); StartingDifficulty = Mathf.Clamp(StartingDifficulty, 1, 10); if (!ZombieWaves && !ScoutmasterEvents && !SupplyDrops && !AutoRevive && !ChaosEvents) { ZombieWaves = true; } } private void ClearPendingOffer() { _pendingOfferHost = 0; _pendingOfferName = string.Empty; _pendingOfferCode = string.Empty; } private static int B(bool value) { if (!value) { return 0; } return 1; } private static bool PB(string value, out bool result) { if (value == "1") { result = true; return true; } if (value == "0") { result = false; return true; } result = false; return false; } private static string NameFor(ExpeditionMode mode) { return mode switch { ExpeditionMode.ZombieOutbreak => "Zombie Outbreak", ExpeditionMode.RescueRush => "Rescue Rush", ExpeditionMode.ChaosClimb => "Chaos Climb", _ => mode.ToString(), }; } private List LivingPlayers() { List list = new List(); for (int i = 0; i < _players.Entries.Count; i++) { PlayerEntry playerEntry = _players.Entries[i]; if (playerEntry != null && (Object)(object)playerEntry.Character != (Object)null && (Object)(object)playerEntry.Character.data != (Object)null && !playerEntry.Character.data.dead && !playerEntry.Character.data.fullyPassedOut) { list.Add(playerEntry); } } return list; } private PlayerEntry FirstDead() { for (int i = 0; i < _players.Entries.Count; i++) { PlayerEntry playerEntry = _players.Entries[i]; if (IsDead(playerEntry)) { return playerEntry; } } return null; } private static bool IsDead(PlayerEntry p) { if (p != null && !((Object)(object)p.Character == (Object)null) && !((Object)(object)p.Character.data == (Object)null) && !p.Character.data.dead) { return p.Character.data.fullyPassedOut; } return true; } private bool RosterReady() { if (_players.Entries.Count == 0) { return false; } for (int i = 0; i < _players.Entries.Count; i++) { if (_players.Entries[i] == null || (Object)(object)_players.Entries[i].Character == (Object)null || (Object)(object)_players.Entries[i].Character.data == (Object)null) { return false; } } return true; } private void UpdateRoster() { AliveCount = 0; DeadCount = 0; for (int i = 0; i < _players.Entries.Count; i++) { if (IsDead(_players.Entries[i])) { DeadCount++; } else { AliveCount++; } } } private void CaptureRoster() { for (int i = 0; i < _players.Entries.Count; i++) { _lastDead[_players.Entries[i].ActorNumber] = IsDead(_players.Entries[i]); } } private void TrackRosterTransitions() { for (int i = 0; i < _players.Entries.Count; i++) { PlayerEntry playerEntry = _players.Entries[i]; bool flag = IsDead(playerEntry); if (_lastDead.TryGetValue(playerEntry.ActorNumber, out var value)) { if (!value && flag) { _deaths++; } else if (value && !flag) { _rescues++; } } _lastDead[playerEntry.ActorNumber] = flag; } } } internal sealed class ResetManager { private readonly ManualLogSource _log; private readonly PlayerActions _actions; private readonly MirageManager _mirages; private readonly SpawnManager _spawns; private readonly AudioManager _audio; private readonly AppearanceManager _appearance; public ResetManager(ManualLogSource log, PlayerActions actions, MirageManager mirages, SpawnManager spawns, AudioManager audio, AppearanceManager appearance) { _log = log; _actions = actions; _mirages = mirages; _spawns = spawns; _audio = audio; _appearance = appearance; } public void ResetAll() { TrollModPlugin instance = TrollModPlugin.Instance; if ((Object)(object)instance != (Object)null && instance.Chaos != null) { instance.Chaos.Stop(); instance.Chaos.StopCombo(); } if ((Object)(object)instance != (Object)null && instance.SummitSaboteur != null) { instance.SummitSaboteur.Reset(); } if ((Object)(object)instance != (Object)null && instance.MindControl != null) { instance.MindControl.Reset(); } if ((Object)(object)instance != (Object)null && instance.PhantomPings != null) { instance.PhantomPings.Cancel(); } if ((Object)(object)instance != (Object)null && instance.InfiniteRescueClaw != null) { instance.InfiniteRescueClaw.RestoreAll(); } if ((Object)(object)instance != (Object)null && instance.InfiniteJetpackFuel != null) { instance.InfiniteJetpackFuel.ResetScene(); } if ((Object)(object)instance != (Object)null && instance.BiggerBackpack != null) { instance.BiggerBackpack.ResetScene(); } if ((Object)(object)instance != (Object)null && instance.StartAsSkeleton != null) { instance.StartAsSkeleton.ResetCurrentExpedition(); } if ((Object)(object)instance != (Object)null && instance.HungerAmplifier != null) { instance.HungerAmplifier.Reset(); } if ((Object)(object)instance != (Object)null && instance.ScoutEsp != null) { instance.ScoutEsp.ResetScene(); } if ((Object)(object)instance != (Object)null && instance.ClimbForecast != null) { instance.ClimbForecast.ResetScene(); } if ((Object)(object)instance != (Object)null && instance.PartySupplyAdvisor != null) { instance.PartySupplyAdvisor.ResetScene(); } if ((Object)(object)instance != (Object)null && instance.Players != null) { _appearance.RestoreAll(instance.Players.Entries); } _actions.ResetKnownPlayers(); _mirages.ClearAll(); _spawns.ClearAll(); _audio.StopAll(); _audio.RestoreAllVoice(); _log.LogInfo((object)"All reversible troll state cleaned up."); } } internal sealed class UiFontManager { private readonly ManualLogSource _log; private int _revision; public static Font DisplayFont => null; public static Font BodyFont => null; public int Revision => _revision; public UiFontManager(ManualLogSource log) { _log = log; } public void Load() { _revision++; _log.LogInfo((object)"Using Unity's native IMGUI font for reliable menu text rendering."); } public void PrepareForRendering() { } public void Dispose() { } } internal sealed class TrollUIManager { private const float DesignWidth = 1280f; private const float DesignHeight = 850f; private readonly TrollModPlugin _plugin; private readonly string[] _tabs = new string[16] { "⌂ Home", "♟ Player", "▣ Spawning", "✦ Mirage", "♪ Audio", "● Appearance", "◆ Profiles", "▲ World", "◈ Chaos", "★ Director", "◎ Lobby", "⚙ Settings", "◇ Smart QoL", "☷ Mod Config", "▦ Items", "⌖ ESP" }; private readonly string[] _tabNames = new string[16] { "Home", "Player", "Spawning", "Mirage", "Audio", "Appearance", "Profiles", "World", "Chaos Mode", "Expedition Director", "Lobby Readiness", "Settings", "Smart Quality of Life", "Mod Config", "Item Spawner", "ESP" }; private readonly string[] _previewEffects = new string[7] { "Launch", "Ragdoll", "Flight", "Status Effect", "Phantom Pings", "Fake Enemy", "Item Storm" }; private int _tab; private int _targetIndex; private int _statusIndex = 3; private int _itemIndex; private int _soundIndex; private int _enemyIndex; private bool _targetAll; private string _itemSearch = string.Empty; private int _itemQuantity = 1; private int _effectPreviewIndex; private float _effectPreviewUntil; private float _ragdollStrength = 30f; private float _horizontalRagdollStrength = 90f; private float _launchStrength = 35f; private float _speed = 1f; private float _flightSpeed = 10f; private float _statusAmount = 0.15f; private float _hungerMultiplier = 5f; private float _spawnDistance = 10f; private float _lifetime = 12f; private float _volume = 0.8f; private float _skyHeight = 150f; private float _horizonDistance = 200f; private float _summitTriggerDistance = 18f; private float _summitStaminaLock = 6f; private float _summitLaunchDistance = 200f; private int _dynamiteCount = 6; private float _dynamiteHeight = 18f; private float _dynamiteSpread = 5f; private float _dynamiteInterval = 0.3f; private bool _lightDynamite = true; private int _itemStormCount = 20; private float _itemStormHeight = 18f; private float _itemStormSpread = 7f; private float _itemStormInterval = 0.2f; private bool _itemStormRandom = true; private bool _randomLaunch; private bool _ragdollLaunch = true; private bool _multiPlace; private int _phantomPingPattern; private int _phantomPingCount = 6; private float _phantomPingInterval = 1f; private bool _clothesOnly; private bool _colorOnly; private bool _confirmEliminate; private int _modIndex; private int _configIndex; private string _configEdit = string.Empty; private string _configEditKey = string.Empty; private ulong _preferenceSteamId; private string _preferenceAlias = string.Empty; private float _preferenceVolume = 1f; private bool _preferenceMuted; private bool _preferenceExcluded; private Color _preferenceColor = new Color(0.35f, 0.85f, 0.78f, 1f); private string _message = "PEAK Troll Mod ready. QoL, accessibility, multiplayer tools, practice, and optional chaos."; private float _messageUntil; private CursorLockMode _oldLock; private bool _oldCursor; private GUIStyle _title; private GUIStyle _logo; private GUIStyle _subtitle; private GUIStyle _nav; private GUIStyle _navSelected; private GUIStyle _label; private GUIStyle _small; private GUIStyle _button; private GUIStyle _danger; private GUIStyle _success; private GUIStyle _disabled; private GUIStyle _cardTitle; private GUIStyle _badge; private Texture2D _pixel; private readonly List _styleTextures = new List(); private float _styledTextScale; private bool _styledHighContrast; private int _styledFontRevision = -1; private float _nextDrawErrorLog; private readonly Dictionary _cardScroll = new Dictionary(); private readonly Dictionary _buttonHover = new Dictionary(); private readonly Dictionary _buttonPulseUntil = new Dictionary(); private int _textFieldIndex; private bool _textFieldClicked; private bool _isTyping; private bool _clearTextFocus; private int _openedFrame = -1; private int _lastSuccessfulDrawFrame = -1; private string _profileName = "My Group"; private string _profileCode = string.Empty; private string _directorCode = string.Empty; public bool IsOpen { get; private set; } public bool IsTyping { get { if (IsOpen) { return _isTyping; } return false; } } public TrollUIManager(TrollModPlugin plugin) { //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) _plugin = plugin; } public void Toggle() { if (IsOpen && NeedsRenderRecovery()) { RecoverOpen(); } else if (IsOpen) { ForceClose(); } else { Open(); } } public void SetOpen(bool open) { if (open && !IsOpen) { Open(); } else if (!open && IsOpen) { ForceClose(); } } private void Open() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) _oldLock = Cursor.lockState; _oldCursor = Cursor.visible; IsOpen = true; _openedFrame = Time.frameCount; _lastSuccessfulDrawFrame = -1; _isTyping = false; _clearTextFocus = true; ResetVisualAssets(); Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } public void ForceClose() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (IsOpen) { IsOpen = false; _isTyping = false; _clearTextFocus = true; Cursor.lockState = _oldLock; Cursor.visible = _oldCursor; _confirmEliminate = false; } } public void RecoverClosedState() { IsOpen = false; _isTyping = false; _clearTextFocus = true; _openedFrame = -1; _lastSuccessfulDrawFrame = -1; ResetVisualAssets(); } public void Tick() { if (IsOpen) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; if (_isTyping && (Input.GetKeyDown((KeyCode)13) || Input.GetKeyDown((KeyCode)271))) { _clearTextFocus = true; _isTyping = false; } } } private bool NeedsRenderRecovery() { if (Time.frameCount > _openedFrame + 8) { if (_lastSuccessfulDrawFrame >= _openedFrame) { return Time.frameCount - _lastSuccessfulDrawFrame > 45; } return true; } return false; } private void RecoverOpen() { ResetVisualAssets(); _openedFrame = Time.frameCount; _lastSuccessfulDrawFrame = -1; _isTyping = false; _clearTextFocus = true; Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; _message = "Menu renderer recovered without restarting PEAK."; _messageUntil = Time.unscaledTime + 6f; } public void ResetVisualAssets() { if ((Object)(object)_pixel != (Object)null) { Object.Destroy((Object)(object)_pixel); } _pixel = null; for (int i = 0; i < _styleTextures.Count; i++) { if ((Object)(object)_styleTextures[i] != (Object)null) { Object.Destroy((Object)(object)_styleTextures[i]); } } _styleTextures.Clear(); _title = null; _logo = null; _subtitle = null; _nav = null; _navSelected = null; _label = null; _small = null; _button = null; _danger = null; _success = null; _disabled = null; _cardTitle = null; _badge = null; _buttonHover.Clear(); _buttonPulseUntil.Clear(); } public void Draw() { //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0283: 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_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: 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) if (!IsOpen) { return; } Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; Color contentColor = GUI.contentColor; Color backgroundColor = GUI.backgroundColor; bool enabled = GUI.enabled; int depth = GUI.depth; try { _textFieldIndex = 0; _textFieldClicked = false; GUI.enabled = true; GUI.color = Color.white; GUI.contentColor = Color.white; GUI.backgroundColor = Color.white; GUI.depth = -10000; if (_clearTextFocus) { GUI.FocusControl((string)null); _clearTextFocus = false; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; _plugin.UiFonts.PrepareForRendering(); EnsureStyles(); float num = Mathf.Min((float)Screen.width / 1280f, (float)Screen.height / 850f) * Mathf.Clamp(_plugin.Settings.UiScale.Value, 0.75f, 1.5f); float num2 = ((float)Screen.width - 1280f * num) * 0.5f; float num3 = ((float)Screen.height - 850f * num) * 0.5f; DrawRect(new Rect(0f, 0f, (float)Screen.width, (float)Screen.height), new Color(0.01f, 0.016f, 0.018f, 0.76f)); GUI.matrix = Matrix4x4.TRS(new Vector3(num2, num3, 0f), Quaternion.identity, new Vector3(num, num, 1f)); DrawPanel(new Rect(10f, 10f, 1260f, 830f), new Color(0.035f, 0.047f, 0.05f, Mathf.Clamp(_plugin.Settings.Transparency.Value, 0.55f, 1f)), new Color(0.25f, 0.34f, 0.35f, 1f), 2f); DrawHeader(); DrawSidebar(); DrawContent(); DrawStatusBar(); UpdateTextFocus(); _lastSuccessfulDrawFrame = Time.frameCount; } catch (Exception ex) { _isTyping = false; ResetVisualAssets(); _message = "Menu visuals were reloaded after a UI asset error."; _messageUntil = Time.unscaledTime + 8f; if (Time.unscaledTime >= _nextDrawErrorLog) { _nextDrawErrorLog = Time.unscaledTime + 5f; _plugin.Warn("Menu draw recovered from: " + ex); } } finally { GUI.matrix = matrix; GUI.color = color; GUI.contentColor = contentColor; GUI.backgroundColor = backgroundColor; GUI.enabled = enabled; GUI.depth = depth; } } private void DrawHeader() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(_logo); val.normal.textColor = new Color(0.28f, 0.78f, 0.75f); GUI.Label(new Rect(42f, 24f, 150f, 32f), "PEAK", val); GUIStyle val2 = new GUIStyle(_logo); val2.fontSize = 21; GUI.Label(new Rect(42f, 50f, 150f, 54f), "TROLL\nMOD", val2); GUI.Label(new Rect(238f, 29f, 520f, 44f), HeadingForTab(), _title); GUI.Label(new Rect(240f, 74f, 570f, 24f), SubtitleForTab(), _subtitle); if (_tab != 0 && ((_tab < 9 && _tab != 6) || _tab == 14)) { GUI.Label(new Rect(826f, 41f, 72f, 30f), "Target", _label); if (AnimatedButton(new Rect(895f, 32f, 235f, 44f), CurrentTargetName() + " ▾", _button)) { CycleTarget(); } if (AnimatedButton(new Rect(1138f, 32f, 42f, 44f), "R", _button)) { SelectRandomTarget(); } if (AnimatedButton(new Rect(1186f, 32f, 48f, 44f), "ALL", _button)) { _targetAll = true; } if (AnimatedButton(new Rect(1238f, 32f, 24f, 44f), "×", _button)) { ForceClose(); } } else if (AnimatedButton(new Rect(1182f, 32f, 52f, 44f), "F7", _button)) { ForceClose(); } Line(new Rect(210f, 116f, 1040f, 1f), new Color(0.2f, 0.31f, 0.32f, 0.85f)); } private void DrawSidebar() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) DrawPanel(new Rect(18f, 120f, 192f, 690f), new Color(0.025f, 0.035f, 0.038f, 0.96f), new Color(0.13f, 0.2f, 0.21f, 1f), 1f); for (int i = 0; i < _tabs.Length; i++) { if (AnimatedButton(new Rect(24f, (float)(128 + i * 38), 180f, 34f), _tabs[i], (i == _tab) ? _navSelected : _nav)) { _tab = i; } } GUI.Label(new Rect(35f, 752f, 165f, 24f), "Version 0.5.0", _small); } private void DrawContent() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) Rect area = default(Rect); ((Rect)(ref area))..ctor(220f, 128f, 1030f, 622f); if (_tab == 0) { DrawHome(area); } else if (_tab == 1) { DrawPlayer(area); } else if (_tab == 2) { DrawSpawning(area); } else if (_tab == 3) { DrawMirage(area); } else if (_tab == 4) { DrawAudio(area); } else if (_tab == 5) { DrawAppearance(area); } else if (_tab == 6) { DrawEnemies(area); } else if (_tab == 7) { DrawWorld(area); } else if (_tab == 8) { DrawChaos(area); } else if (_tab == 9) { DrawDirector(area); } else if (_tab == 10) { DrawLobby(area); } else if (_tab == 11) { DrawSettings(area); } else if (_tab == 12) { DrawSmartQualityOfLife(area); } else if (_tab == 13) { DrawModConfig(area); } else if (_tab == 14) { DrawItems(area); } else { DrawEsp(area); } } private void DrawEsp(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 142f, 480f, 205f), "⌖ Scout Compass", new Color(0.25f, 0.9f, 0.72f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Points toward the nearest other living scout using the synchronized lobby roster.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(_plugin.ScoutEsp.CompassEnabled ? "SCOUT COMPASS: ON" : "SCOUT COMPASS: OFF", _plugin.ScoutEsp.CompassEnabled ? _success : _button, GUILayout.Height(40f))) { _plugin.ScoutEsp.CompassEnabled = !_plugin.ScoutEsp.CompassEnabled; Say("Scout Compass " + (_plugin.ScoutEsp.CompassEnabled ? "enabled." : "disabled.")); } GUILayout.Label(_plugin.ScoutEsp.CompassStatus, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(735f, 142f, 493f, 205f), "◎ ESP Visibility", new Color(0.4f, 0.68f, 1f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Local-only 3D outlines remain visible through terrain and walls.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); EspToggle("SCOUTS", EspCategory.Scout); EspToggle("LUGGAGE", EspCategory.Luggage); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); EspToggle("ZOMBIES", EspCategory.Zombie); EspToggle("SCOUTMASTER", EspCategory.Scoutmaster); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(_plugin.ScoutEsp.LabelsEnabled ? "LABELS: ON" : "LABELS: OFF", _plugin.ScoutEsp.LabelsEnabled ? _success : _button, GUILayout.Height(30f))) { _plugin.ScoutEsp.LabelsEnabled = !_plugin.ScoutEsp.LabelsEnabled; } if (AnimatedButton(_plugin.ScoutEsp.TracersEnabled ? "TRACERS: ON" : "TRACERS: OFF", _plugin.ScoutEsp.TracersEnabled ? _success : _button, GUILayout.Height(30f))) { _plugin.ScoutEsp.TracersEnabled = !_plugin.ScoutEsp.TracersEnabled; } GUILayout.EndHorizontal(); }); Card(new Rect(238f, 365f, 990f, 355f), "◈ ESP Outline Customization", new Color(0.72f, 0.42f, 1f), delegate { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); EspColorEditor("SCOUT", EspCategory.Scout); EspColorEditor("LUGGAGE", EspCategory.Luggage); EspColorEditor("ZOMBIE", EspCategory.Zombie); EspColorEditor("SCOUTMASTER", EspCategory.Scoutmaster); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.Label("Outline / tracer width " + _plugin.ScoutEsp.OutlineWidth.ToString("0.0") + " px", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.ScoutEsp.OutlineWidth = GUILayout.HorizontalSlider(_plugin.ScoutEsp.OutlineWidth, 1f, 8f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Maximum distance " + Mathf.RoundToInt(_plugin.ScoutEsp.MaximumDistance) + " m", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.ScoutEsp.MaximumDistance = GUILayout.HorizontalSlider(_plugin.ScoutEsp.MaximumDistance, 25f, 2000f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_plugin.ScoutEsp.TargetCount + " highlighted target(s) currently tracked. ESP and its tracers are visual only and automatically hide while this menu is open.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private void DrawSmartQualityOfLife(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 142f, 480f, 250f), "△ Smart Climb Forecast", new Color(0.25f, 0.78f, 0.72f), delegate { _plugin.ClimbForecast.Enabled = GUILayout.Toggle(_plugin.ClimbForecast.Enabled, "Enable climb feasibility overlay", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_plugin.ClimbForecast.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Scan height " + _plugin.ClimbForecast.MaximumHeight.ToString("0") + "m", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.ClimbForecast.MaximumHeight = GUILayout.HorizontalSlider(_plugin.ClimbForecast.MaximumHeight, 3f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Safe reserve " + Mathf.RoundToInt(_plugin.ClimbForecast.SafetyReserve * 100f) + "%", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.ClimbForecast.SafetyReserve = GUILayout.HorizontalSlider(_plugin.ClimbForecast.SafetyReserve, 0f, 0.5f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Hold reach toward a steep surface. The estimate uses PEAK's live climb speed, stamina, surface angle/modifiers, and ascent multiplier.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(735f, 142f, 493f, 250f), "↗ Infinite Rescue Claw Reach", new Color(0.62f, 0.42f, 1f), delegate { bool enabled = !_plugin.InfiniteRescueClaw.StandaloneDetected; GUI.enabled = enabled; _plugin.InfiniteRescueClaw.Enabled = GUILayout.Toggle(_plugin.InfiniteRescueClaw.Enabled, "Effectively unlimited local claw reach", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = true; GUILayout.Label(_plugin.InfiniteRescueClaw.Status, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); GUILayout.Label("Applies only while you hold a Rescue Claw. Distant wall hits zip your scout toward the anchor at a capped 45 m/s and stop near the surface instead of timing out mid-rope.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Friend/item rescues, empty shots, uses, and other players' claws are unchanged. Physics and timeout values restore on arrival, drop, disable, or scene exit.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(238f, 406f, 480f, 316f), "▣ Party Supply Advisor", new Color(0.35f, 0.65f, 1f), delegate { _plugin.PartySupplyAdvisor.Enabled = GUILayout.Toggle(_plugin.PartySupplyAdvisor.Enabled, "Analyze synchronized party supplies", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.PartySupplyAdvisor.IncludeBackpacks = GUILayout.Toggle(_plugin.PartySupplyAdvisor.IncludeBackpacks, "Include equipped backpacks", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_plugin.PartySupplyAdvisor.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("REFRESH", _button, GUILayout.Width(82f), GUILayout.Height(26f))) { _plugin.PartySupplyAdvisor.Refresh(); } GUILayout.EndHorizontal(); IList players = _plugin.PartySupplyAdvisor.Players; for (int i = 0; i < players.Count; i++) { PartySupplyPlayerSummary partySupplyPlayerSummary = players[i]; GUILayout.Label(partySupplyPlayerSummary.Name + " • " + partySupplyPlayerSummary.TotalItems + " items | food " + partySupplyPlayerSummary.Food + " med " + partySupplyPlayerSummary.Medical + " climb " + partySupplyPlayerSummary.Climbing + " mobility " + partySupplyPlayerSummary.Mobility, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.Space(6f); IList recommendations = _plugin.PartySupplyAdvisor.Recommendations; for (int j = 0; j < recommendations.Count; j++) { GUILayout.Label("• " + recommendations[j], _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } }); Card(new Rect(735f, 406f, 493f, 316f), "⌨ Hotkey Conflict Doctor", new Color(0.86f, 0.62f, 0.25f), delegate { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) _plugin.HotkeyDoctor.Enabled = GUILayout.Toggle(_plugin.HotkeyDoctor.Enabled, "Scan enabled BepInEx plugins", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_plugin.HotkeyDoctor.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("SCAN", _button, GUILayout.Width(70f), GUILayout.Height(26f))) { _plugin.HotkeyDoctor.Refresh(); } GUILayout.EndHorizontal(); IList conflicts = _plugin.HotkeyDoctor.Conflicts; for (int i = 0; i < conflicts.Count; i++) { HotkeyConflictRecord hotkeyConflictRecord = conflicts[i]; GUILayout.Label(hotkeyConflictRecord.Shortcut + " • " + ConflictLabels(hotkeyConflictRecord), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (hotkeyConflictRecord.SuggestedTarget != null && (int)hotkeyConflictRecord.SuggestedKey != 0 && AnimatedButton("REASSIGN " + hotkeyConflictRecord.SuggestedTarget.Label + " → " + hotkeyConflictRecord.SuggestedShortcut, _button, GUILayout.Height(28f))) { Say(_plugin.HotkeyDoctor.ApplySuggestion(hotkeyConflictRecord)); } } GUILayout.Label("Only exact KeyboardShortcut/KeyCode duplicates are reported. Reassignment happens only when you click and is saved through the owning mod's config.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private static string ConflictLabels(HotkeyConflictRecord conflict) { string text = string.Empty; for (int i = 0; i < conflict.Bindings.Count; i++) { if (i > 0) { text += " ↔ "; } text += conflict.Bindings[i].Label; } return text; } private void DrawItems(Rect area) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (!_plugin.Settings.ItemSpawnerEnabled.Value) { UnsupportedPage("ITEM SPAWNER DISABLED", "Enable Item Spawner under Mod Config → Built-in Quality of Life."); return; } Card(new Rect(238f, 142f, 990f, 78f), "▦ Runtime Item Search", new Color(0.28f, 0.78f, 0.75f), delegate { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Search", _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); _itemSearch = TextField(_itemSearch, _button, GUILayout.Height(30f)); if (AnimatedButton("CLEAR", _button, GUILayout.Width(72f), GUILayout.Height(30f))) { _itemSearch = string.Empty; _itemIndex = 0; } if (AnimatedButton("REFRESH", _button, GUILayout.Width(88f), GUILayout.Height(30f))) { _plugin.Actions.RefreshItemCatalog(); _itemIndex = 0; Say("Runtime item catalog refreshed."); } GUILayout.EndHorizontal(); }); Card(new Rect(238f, 234f, 430f, 486f), "☷ Item Catalog", new Color(0.35f, 0.65f, 1f), delegate { List list = FilteredItems(); GUILayout.Label(list.Count + " matching item(s)", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (_plugin.Settings.FavoritesAndRecentsEnabled.Value) { DrawItemShortcuts("★ Favorites", _plugin.Shortcuts.FavoriteItems); DrawItemShortcuts("↻ Recent", _plugin.Shortcuts.RecentItems); GUILayout.Space(6f); } for (int i = 0; i < list.Count; i++) { string text = (((Object)(object)list[i] == (Object)null) ? string.Empty : ((Object)list[i]).name); if (!string.IsNullOrEmpty(text) && AnimatedButton(((i == _itemIndex) ? "● " : "○ ") + text, (i == _itemIndex) ? _navSelected : _button, GUILayout.Height(29f))) { _itemIndex = i; } } }); Card(new Rect(684f, 234f, 544f, 238f), "◆ Selected Item", new Color(0.86f, 0.62f, 0.25f), delegate { string text = CurrentItemName(); bool flag = FilteredItems().Count > 0; GUILayout.Label(text, _cardTitle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Discovered from PEAK's currently loaded runtime item catalog. Nothing is bundled or guessed.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Quantity " + _itemQuantity, _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(105f) }); _itemQuantity = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_itemQuantity, 1f, 12f, (GUILayoutOption[])(object)new GUILayoutOption[0])); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = flag; if (CapabilityButton("GIVE TO TARGET", FeatureCapability.GiveItem, _success, 34f)) { GiveSelectedItem(self: false); } if (CapabilityButton("GIVE TO ME", FeatureCapability.GiveItem, _button, 34f)) { GiveSelectedItem(self: true); } GUI.enabled = true; GUILayout.EndHorizontal(); GUI.enabled = flag && !_targetAll; if (CapabilityButton("SPAWN ON GROUND NEAR TARGET", FeatureCapability.ItemStorm, _button, 34f)) { SpawnSelectedItem(); } GUI.enabled = true; if (_plugin.Settings.FavoritesAndRecentsEnabled.Value && AnimatedButton(_plugin.Shortcuts.IsFavoriteItem(text) ? "★ REMOVE FAVORITE" : "☆ ADD FAVORITE", _button, GUILayout.Height(30f))) { Say((_plugin.Shortcuts.ToggleFavoriteItem(text) ? "Favorited " : "Removed favorite ") + text + "."); } }); Card(new Rect(684f, 488f, 544f, 232f), "✦ Safe Effect Preview", new Color(0.63f, 0.42f, 1f), delegate { if (!_plugin.Settings.EffectPreviewEnabled.Value) { GUILayout.Label("Effect Preview is disabled in Mod Config.", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { string text = _previewEffects[_effectPreviewIndex]; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("‹", _button, GUILayout.Width(40f), GUILayout.Height(30f))) { _effectPreviewIndex = (_effectPreviewIndex + _previewEffects.Length - 1) % _previewEffects.Length; } GUILayout.Label(text, _cardTitle, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("›", _button, GUILayout.Width(40f), GUILayout.Height(30f))) { _effectPreviewIndex = (_effectPreviewIndex + 1) % _previewEffects.Length; } GUILayout.EndHorizontal(); GUILayout.Label(EffectPreviewText(text), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Target: " + CurrentTargetName() + " • Preview never executes or networks the effect.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (Time.unscaledTime < _effectPreviewUntil) { GUILayout.Label("PREVIEW " + PreviewGlyph(text) + " " + EffectPreviewValues(text), _success, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("PREVIEW SAFELY", _success, GUILayout.Height(32f))) { PreviewEffect(text); } if (AnimatedButton(_plugin.Shortcuts.IsFavoriteEffect(text) ? "★" : "☆", _button, GUILayout.Width(48f), GUILayout.Height(32f))) { Say((_plugin.Shortcuts.ToggleFavoriteEffect(text) ? "Favorited " : "Removed favorite ") + text + "."); } if (AnimatedButton("OPEN CONTROLS", _button, GUILayout.Height(32f))) { OpenEffectControls(text); } GUILayout.EndHorizontal(); if (_plugin.Settings.FavoritesAndRecentsEnabled.Value) { GUILayout.Label("★ Favorites", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); DrawEffectShortcuts(_plugin.Shortcuts.FavoriteEffects); GUILayout.Label("↻ Recent", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); DrawEffectShortcuts(_plugin.Shortcuts.RecentEffects); } } }); } private void DrawHome(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 218f, 310f, 202f), "◆ Session", new Color(0.25f, 0.6f, 1f), delegate { GUILayout.Label("PEAK version: " + Application.version, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Host: " + (_plugin.Players.IsHost ? "Yes" : "No"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Local: " + ((_plugin.Players.Local == null) ? "Not resolved" : _plugin.Players.Local.Name), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Lobby players: " + _plugin.Players.Entries.Count, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Compatible clients: " + _plugin.Network.CompatibleCount, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Last Steam lobby: " + _plugin.QuickReconnect.LastLobbyDisplay, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(558f, 218f, 310f, 202f), "✦ Mod Status", new Color(0.62f, 0.42f, 1f), delegate { GUILayout.Label("Profile: " + _plugin.Profiles.ActiveName, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Director: " + _plugin.Director.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Softlock Doctor: " + _plugin.AntiSoftlock.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("ESP targets: " + _plugin.ScoutEsp.TargetCount, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Optional chaos: " + (_plugin.Chaos.Active ? "ACTIVE" : "Stopped"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Networking: " + (PhotonNetwork.InRoom ? "Connected" : "Offline"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(878f, 218f, 350f, 202f), "! Authority & Safety", new Color(1f, 0.68f, 0.22f), delegate { GUILayout.Label("\ud83d\udfe2 Local / harmless visual", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("\ud83d\udfe1 Target needs this mod", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("\ud83d\udd12 Photon host authority", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("⚠ Disabled when unresolved", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(238f, 438f, 990f, 300f), "↻ Reconnect & Emergency Recovery", new Color(0.25f, 1f, 0.5f), delegate { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("RECONNECT LAST LOBBY", FeatureCapability.QuickReconnect, _success, 40f)) { ReconnectLastLobby(); } if (CapabilityButton("LAST SAFE GROUND", FeatureCapability.EmergencyRecovery, _button, 40f)) { Say(_plugin.Recovery.RecoverLastSafeGround()); } if (CapabilityButton("NEAREST SAFE SCOUT", FeatureCapability.EmergencyRecovery, _button, 40f)) { Say(_plugin.Recovery.RecoverNearestScout()); } if (CapabilityButton("ACTIVE CHECKPOINT", FeatureCapability.EmergencyRecovery, _button, 40f)) { Say(_plugin.Recovery.RecoverCheckpoint()); } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("STOP FLIGHT + VELOCITY", FeatureCapability.EmergencyRecovery, _button, 38f)) { Say(_plugin.Recovery.StabilizeSelf()); } if (CapabilityButton("RESTORE SELF", FeatureCapability.EmergencyRecovery, _button, 38f)) { Say(_plugin.Recovery.RestoreSelf()); } GUILayout.EndHorizontal(); GUILayout.Space(12f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("STOP CHAOS", _danger, GUILayout.Height(42f))) { _plugin.Chaos.Stop(); _plugin.Chaos.StopCombo(); Say("Chaos and combo runner stopped."); } if (AnimatedButton("CLEAR MIRAGES", _button, GUILayout.Height(42f))) { _plugin.Mirages.ClearAll(); Say("All local mirages cleared."); } if (AnimatedButton("CLEAR TROLL SPAWNS", _button, GUILayout.Height(42f))) { ClearTrollSpawns(); } GUILayout.EndHorizontal(); GUILayout.Space(8f); if (AnimatedButton("RESET ALL TROLL EFFECTS", _danger, GUILayout.Height(42f))) { EmergencyReset(); } GUILayout.Label("Recovery uses recorded safe ground and native PEAK warps. Cleanup only touches state and objects tracked by this mod.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private void DrawPlayer(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 144f, 480f, 364f), "↗ Movement", new Color(0.28f, 0.78f, 0.75f), delegate { //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_052d: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0713: Unknown result type (might be due to invalid IL or missing references) //IL_0718: Unknown result type (might be due to invalid IL or missing references) //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Unknown result type (might be due to invalid IL or missing references) Badge(PermissionKind.EveryoneNeedsMod); GUILayout.Label("Flight", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("ON", FeatureCapability.Flight, _success, 38f)) { Owner(NetCommand.Flight, new object[2] { true, _flightSpeed }); } if (CapabilityButton("OFF", FeatureCapability.Flight, _button, 38f)) { Owner(NetCommand.Flight, new object[2] { false, _flightSpeed }); } GUILayout.EndHorizontal(); GUILayout.Label("Flight speed " + _flightSpeed.ToString("0") + " m/s", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _flightSpeed = GUILayout.HorizontalSlider(_flightSpeed, 4f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("[W] [A] [S] [D] move [SPACE] up [CTRL] down [SHIFT] boost", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); Badge(PermissionKind.HostOnly); GUILayout.Label("Mind Control", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Full control with PEAK Troll Mod; hosts get movement, jump, and crouch puppet control for unmodded scouts. Their own input stays active.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Duration " + Mathf.Clamp(_plugin.Settings.MindControlDuration.Value, 10f, 180f).ToString("0") + " s", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.MindControlDuration.Value = GUILayout.HorizontalSlider(_plugin.Settings.MindControlDuration.Value, 10f, 180f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Camera distance " + Mathf.Clamp(_plugin.Settings.MindControlCameraDistance.Value, 3f, 10f).ToString("0.0") + " m", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.MindControlCameraDistance.Value = GUILayout.HorizontalSlider(_plugin.Settings.MindControlCameraDistance.Value, 3f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Host puppet force " + Mathf.Clamp(_plugin.Settings.MindControlHostPuppetForce.Value, 1f, 8f).ToString("0.0"), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.MindControlHostPuppetForce.Value = GUILayout.HorizontalSlider(_plugin.Settings.MindControlHostPuppetForce.Value, 1f, 8f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = !_targetAll; if (CapabilityButton(_plugin.MindControl.Active ? "STOP MIND CONTROL" : "CONTROL SELECTED SCOUT", FeatureCapability.MindControl, _plugin.MindControl.Active ? _danger : _success, 38f)) { ActionResult actionResult = (_plugin.MindControl.Active ? _plugin.MindControl.Stop() : _plugin.MindControl.Start(Target())); Say(actionResult); if (actionResult.Success && _plugin.MindControl.Active) { ForceClose(); } } GUI.enabled = true; GUILayout.Label(string.Concat(_plugin.MindControl.Status, " • ", _plugin.Settings.MindControlEscapeKey.Value, " releases either side."), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); Badge(PermissionKind.Anyone); GUILayout.Label("Launch strength " + _launchStrength.ToString("0"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _launchStrength = GUILayout.HorizontalSlider(_launchStrength, 5f, 120f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); _randomLaunch = GUILayout.Toggle(_randomLaunch, "Random direction", (GUILayoutOption[])(object)new GUILayoutOption[0]); _ragdollLaunch = GUILayout.Toggle(_ragdollLaunch, "Ragdoll", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("LAUNCH", FeatureCapability.Launch, _button, 34f)) { Vector3 val; if (!_randomLaunch) { val = Vector3.up; } else { Vector3 val2 = new Vector3(Random.Range(-0.5f, 0.5f), 1f, Random.Range(-0.5f, 0.5f)); val = ((Vector3)(ref val2)).normalized; } Vector3 val3 = val; Owner(NetCommand.Launch, new object[5] { val3.x, val3.y, val3.z, _launchStrength, _ragdollLaunch }); } if (CapabilityButton("SKY HIGH", FeatureCapability.SkyLaunch, _danger, 34f)) { SkyLaunch(); } if (CapabilityButton("FAR HORIZON", FeatureCapability.HorizonLaunch, _danger, 34f)) { HorizonLaunch(); } GUILayout.EndHorizontal(); GUILayout.Label("Sky height " + _skyHeight.ToString("0") + "m", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _skyHeight = GUILayout.HorizontalSlider(_skyHeight, 25f, 300f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Far Horizon distance " + _horizonDistance.ToString("0") + "m", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _horizonDistance = GUILayout.HorizontalSlider(_horizonDistance, 25f, 300f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Ragdoll strength " + _ragdollStrength.ToString("0"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _ragdollStrength = GUILayout.HorizontalSlider(_ragdollStrength, 1f, 75f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("RAGDOLL", FeatureCapability.Ragdoll, _button, 30f)) { Vector3 val4 = new Vector3(Random.Range(-0.5f, 0.5f), 0.5f, Random.Range(-0.5f, 0.5f)); Vector3 normalized = ((Vector3)(ref val4)).normalized; Owner(NetCommand.Ragdoll, new object[5] { normalized.x, normalized.y, normalized.z, _ragdollStrength, 1.5f }); } if (CapabilityButton("OFF MOUNTAIN", FeatureCapability.Ragdoll, _danger, 30f)) { RagdollOffMountain(); } GUILayout.EndHorizontal(); GUILayout.Label("Horizontal Yeet strength " + _horizontalRagdollStrength.ToString("0"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _horizontalRagdollStrength = GUILayout.HorizontalSlider(_horizontalRagdollStrength, 25f, 150f, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("HORIZONTAL YEET", FeatureCapability.Ragdoll, _danger, 32f)) { HorizontalRagdoll(); } }); Card(new Rect(730f, 144f, 498f, 364f), "♥ Health & Status", new Color(0.83f, 0.48f, 0.38f), delegate { Badge(PermissionKind.Anyone); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(_plugin.SurvivalAssist.Immortality ? "IMMORTALITY: ON" : "IMMORTALITY: OFF", _plugin.SurvivalAssist.Immortality ? _success : _button, GUILayout.Height(34f))) { _plugin.SurvivalAssist.Immortality = !_plugin.SurvivalAssist.Immortality; Say("Immortality " + (_plugin.SurvivalAssist.Immortality ? "enabled." : "disabled.")); } if (AnimatedButton(_plugin.SurvivalAssist.InfiniteStamina ? "INFINITE STAMINA: ON" : "INFINITE STAMINA: OFF", _plugin.SurvivalAssist.InfiniteStamina ? _success : _button, GUILayout.Height(34f))) { _plugin.SurvivalAssist.InfiniteStamina = !_plugin.SurvivalAssist.InfiniteStamina; Say("Infinite Stamina " + (_plugin.SurvivalAssist.InfiniteStamina ? "enabled." : "disabled.")); } GUILayout.EndHorizontal(); GUILayout.Label("Immortality blocks death/pass-out and clears every negative stamina-bar condition, including carried weight. Infinite Stamina refills usable stamina. Both are self-only.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton(_plugin.InfiniteJetpackFuel.Enabled ? "INFINITE JETPACK FUEL: ON" : "INFINITE JETPACK FUEL: OFF", FeatureCapability.InfiniteJetpackFuel, _plugin.InfiniteJetpackFuel.Enabled ? _success : _button, 34f)) { _plugin.InfiniteJetpackFuel.Enabled = !_plugin.InfiniteJetpackFuel.Enabled; Say("Infinite Jetpack Fuel " + (_plugin.InfiniteJetpackFuel.Enabled ? "enabled." : "disabled and original fuel restored.")); } GUILayout.Label(_plugin.InfiniteJetpackFuel.Status + " Self-only; equip a Jetpack backpack.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton(_plugin.StartAsSkeleton.Enabled ? "START AS SKELETON: ON" : "START AS SKELETON: OFF", FeatureCapability.StartAsSkeleton, _plugin.StartAsSkeleton.Enabled ? _success : _button, 34f)) { _plugin.StartAsSkeleton.Enabled = !_plugin.StartAsSkeleton.Enabled; Say(_plugin.StartAsSkeleton.Status); } GUILayout.Label(_plugin.StartAsSkeleton.Status + " Uses PEAK's native Book of Bones state.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = !_targetAll; if (CapabilityButton("MAKE SELECTED SKELETON", FeatureCapability.StartAsSkeleton, _danger, 34f)) { Say(_plugin.Actions.SetSkeletonState(Target(), skeleton: true)); } if (CapabilityButton("RESTORE HUMAN", FeatureCapability.StartAsSkeleton, _button, 34f)) { Say(_plugin.Actions.SetSkeletonState(Target(), skeleton: false)); } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton(_plugin.NoWait.Enabled ? "NO WAIT: ON" : "NO WAIT: OFF", FeatureCapability.Resurrect, _plugin.NoWait.Enabled ? _success : _button, 38f)) { _plugin.NoWait.Enabled = !_plugin.NoWait.Enabled; Say("No Wait " + (_plugin.NoWait.Enabled ? "enabled." : "disabled.")); } if (CapabilityButton("RESURRECT SELF", FeatureCapability.Resurrect, _success, 38f)) { ResurrectSelf(); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("DESTINATION: " + NoWaitDestinationName(), FeatureCapability.Resurrect, _button, 34f)) { CycleNoWaitDestination(); } if (CapabilityButton(_plugin.NoWait.PreserveReconnectState ? "KEEP RECONNECT GEAR: ON" : "KEEP RECONNECT GEAR: OFF", FeatureCapability.Resurrect, _plugin.NoWait.PreserveReconnectState ? _success : _button, 34f)) { _plugin.NoWait.PreserveReconnectState = !_plugin.NoWait.PreserveReconnectState; Say("Reconnect state preservation " + (_plugin.NoWait.PreserveReconnectState ? "enabled." : "disabled.")); } GUILayout.EndHorizontal(); if (CapabilityButton(_targetAll ? "RESURRECT EVERYONE" : "RESURRECT SELECTED", FeatureCapability.Resurrect, _success, 36f)) { ResurrectSelected(); } GUILayout.Space(12f); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("KNOCK OUT", FeatureCapability.Knockout, _button, 38f)) { Owner(NetCommand.Knockout, new object[0]); } if (CapabilityButton(_confirmEliminate ? "CONFIRM ELIMINATE" : "ELIMINATE", FeatureCapability.Eliminate, _danger, 38f)) { if (!_plugin.Settings.ConfirmDestructive.Value || _confirmEliminate) { Owner(NetCommand.Eliminate, new object[0]); _confirmEliminate = false; } else { _confirmEliminate = true; Say("Click Eliminate again to confirm."); } } GUILayout.EndHorizontal(); GUILayout.Space(12f); GUILayout.Label("Status effect", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(((object)(STATUSTYPE)_statusIndex).ToString() + " ▾", _button, GUILayout.Width(280f), GUILayout.Height(36f))) { _statusIndex = (_statusIndex + 1) % 15; } if (CapabilityButton("APPLY", FeatureCapability.StatusEffects, _success, 36f)) { Owner(NetCommand.Status, new object[2] { _statusIndex, _statusAmount }); } GUILayout.EndHorizontal(); GUILayout.Label("Intensity " + _statusAmount.ToString("0.00"), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _statusAmount = GUILayout.HorizontalSlider(_statusAmount, 0.01f, 0.5f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label((_plugin.Players.IsHost && _statusIndex != 7 && _statusIndex != 9 && _statusIndex != 12) ? "Host-native status; target mod not required." : "Status requires the selected target's mod.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("CLEAR MOD STATUSES", _button, GUILayout.Height(34f))) { ClearStatuses(); } GUILayout.Space(12f); Badge(PermissionKind.EveryoneNeedsMod); if (_plugin.Players.IsHost) { Badge(PermissionKind.HostOnly); } GUILayout.Label("Amplify Hunger Rates", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Natural hunger speed " + _hungerMultiplier.ToString("0.0") + "x", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _hungerMultiplier = GUILayout.HorizontalSlider(_hungerMultiplier, 2f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("AMPLIFY SELECTED", FeatureCapability.HungerAmplifier, _danger, 34f)) { Owner(NetCommand.SetHungerAmplifier, new object[2] { true, _hungerMultiplier }); } if (CapabilityButton("NORMAL RATE", FeatureCapability.HungerAmplifier, _button, 34f)) { Owner(NetCommand.SetHungerAmplifier, new object[2] { false, 2f }); } GUILayout.EndHorizontal(); GUILayout.Label("Exact multiplier for compatible owners. The host can use bounded native Hunger pulses on unmodded targets.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(238f, 522f, 310f, 168f), "⌖ Teleport", new Color(0.43f, 0.66f, 0.64f), delegate { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) Badge(PermissionKind.Anyone); if (CapabilityButton("MYSELF TO TARGET", FeatureCapability.Teleport, _success, 30f)) { TeleportSelfToTarget(); } if (AnimatedButton("TARGET TO ME", _button, GUILayout.Height(30f)) && _plugin.Players.Local != null) { Teleport(_plugin.Players.Local.Character.Center); } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("TO START", _button)) { if (_plugin.Actions.TryGetStartEnd(end: false, out var position)) { Teleport(position); } else { Say("Start reference unavailable."); } } if (AnimatedButton("TO END", _button)) { if (_plugin.Actions.TryGetStartEnd(end: true, out var position2)) { Teleport(position2); } else { Say("End reference unavailable."); } } GUILayout.EndHorizontal(); if (AnimatedButton("RANDOM NEAR PLAYER", _button)) { PlayerEntry playerEntry = _plugin.Players.Random(excludeSelf: true); if (playerEntry != null) { Teleport(playerEntry.Character.Center + Random.insideUnitSphere * 3f); } } }); Card(new Rect(560f, 522f, 330f, 168f), "◉ Visibility & Speed", new Color(0.28f, 0.78f, 0.75f), delegate { Badge(PermissionKind.EveryoneNeedsMod); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("HIDE", FeatureCapability.Visibility, _button, 30f)) { Broadcast(NetCommand.Visibility, new object[1] { false }); } if (CapabilityButton("SHOW", FeatureCapability.Visibility, _button, 30f)) { Broadcast(NetCommand.Visibility, new object[1] { true }); } GUILayout.EndHorizontal(); GUILayout.Label("Movement speed " + _speed.ToString("0.00") + "x", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _speed = GUILayout.HorizontalSlider(_speed, 0.25f, 3f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("APPLY", FeatureCapability.Speed, _success, 30f)) { Owner(NetCommand.Speed, new object[1] { _speed }); } if (AnimatedButton("RESET 1.0x", _button, GUILayout.Height(30f))) { Owner(NetCommand.Speed, new object[1] { 1f }); } GUILayout.EndHorizontal(); }); Card(new Rect(902f, 522f, 326f, 168f), "▣ Inventory & Reset", new Color(0.86f, 0.62f, 0.25f), delegate { Badge(PermissionKind.Anyone); if (CapabilityButton(_plugin.BiggerBackpack.Enabled ? "BIGGER BACKPACK: ON" : "BIGGER BACKPACK: OFF", FeatureCapability.BiggerBackpack, _plugin.BiggerBackpack.Enabled ? _success : _button, 30f)) { _plugin.BiggerBackpack.Enabled = !_plugin.BiggerBackpack.Enabled; Say(_plugin.BiggerBackpack.Status); } if (CapabilityButton(_plugin.BackpackProtection.Enabled ? "BACKPACK PROTECTION: ON" : "BACKPACK PROTECTION: OFF", FeatureCapability.BackpackProtection, _plugin.BackpackProtection.Enabled ? _success : _button, 30f)) { _plugin.BackpackProtection.Enabled = !_plugin.BackpackProtection.Enabled; Say(_plugin.BackpackProtection.Status); } string text = CurrentItemName(); if (AnimatedButton(text + " ▾", _button, GUILayout.Height(30f))) { CycleItem(); } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("GIVE ITEM", FeatureCapability.GiveItem, _button, 32f)) { Owner(NetCommand.GiveItem, new object[1] { text }); } if (AnimatedButton("RESET PLAYER", _danger, GUILayout.Height(32f))) { Broadcast(NetCommand.Reset, new object[0]); } GUILayout.EndHorizontal(); }); } private void DrawSpawning(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 220f, 315f, 270f), "☠ Scoutmaster Ambush", new Color(1f, 0.3f, 0.35f), delegate { Badge((!_plugin.Players.IsHost) ? PermissionKind.EveryoneNeedsMod : PermissionKind.HostOnly); Distance(); GUI.enabled = _plugin.Network.HostSupportsRequests; if (AnimatedButton("REQUEST SCOUTMASTER", _button, GUILayout.Height(42f))) { Say(_plugin.Network.RequestHostSpawn(NetCommand.HostSpawnScoutmaster, Target(), _spawnDistance)); } GUI.enabled = true; GUILayout.Label(_plugin.Players.IsHost ? "Executed with local host authority." : "A compatible host executes the verified room spawn.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(565f, 220f, 315f, 270f), "♟ Mushroom Zombie", new Color(0.45f, 0.8f, 0.35f), delegate { Badge((!_plugin.Players.IsHost) ? PermissionKind.EveryoneNeedsMod : PermissionKind.HostOnly); Distance(); GUI.enabled = _plugin.Network.HostSupportsRequests; if (AnimatedButton("REQUEST ZOMBIE", _button, GUILayout.Height(42f))) { Say(_plugin.Network.RequestHostSpawn(NetCommand.HostSpawnZombie, Target(), _spawnDistance)); } GUI.enabled = true; GUILayout.Label("A compatible host loads PEAK's verified zombie resource, so this works outside the Roots.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(892f, 220f, 336f, 270f), "◉ The Looker", new Color(0.63f, 0.42f, 1f), delegate { Badge(PermissionKind.Unsupported); Unsupported("GENUINE LOOKER SPAWN", _plugin.Capabilities.Reason(FeatureCapability.LookerSpawn)); GUILayout.Label("A harmless fake Looker becomes available when a visual source is loaded.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(238f, 506f, 990f, 154f), "↻ Tracked Cleanup", new Color(0.3f, 1f, 0.55f), delegate { GUILayout.Label("Active mod-spawned enemies: " + _plugin.Spawns.Count, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = _plugin.Network.HostSupportsRequests; if (AnimatedButton("CLEAR MY REQUESTED SPAWNS", _button, GUILayout.Height(44f))) { Say(_plugin.Network.RequestClearMySpawns()); } GUI.enabled = true; GUI.enabled = _plugin.Players.IsHost; if (AnimatedButton("HOST: CLEAR ALL", _danger, GUILayout.Height(44f))) { _plugin.Spawns.ClearAll(); Say("Cleared only objects in the mod tracking registry."); } GUI.enabled = true; GUILayout.EndHorizontal(); }); } private void DrawMirage(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 218f, 315f, 265f), "✦ Ping Placement", new Color(0.35f, 0.65f, 1f), delegate { Badge(PermissionKind.EveryoneNeedsMod); GUILayout.Label("Placed for the selected viewer or every compatible viewer.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Type: " + _plugin.PingPlacement.Kind, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("Luggage", FeatureCapability.MirageLuggage, _button, 30f)) { BeginPing(MirageKind.Luggage); } if (CapabilityButton("Statue", FeatureCapability.MirageStatue, _button, 30f)) { BeginPing(MirageKind.AmuletStatue); } if (CapabilityButton("Capybara", FeatureCapability.MirageCapybara, _button, 30f)) { BeginPing(MirageKind.CapybaraPool); } GUILayout.EndHorizontal(); _multiPlace = GUILayout.Toggle(_multiPlace, "Multi-place", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("CANCEL PLACEMENT", _danger)) { _plugin.PingPlacement.Cancel(); } GUILayout.Label(_plugin.PingPlacement.Active ? "Aim and use the normal ping input." : "Placement inactive.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(565f, 218f, 315f, 265f), "♟ Mirage Scout", new Color(0.63f, 0.42f, 1f), delegate { Badge(PermissionKind.EveryoneNeedsMod); GUILayout.Label("Copies renderers, meshes, materials and animator only.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); Lifetime(); if (AnimatedButton("STAND & STARE BEHIND", _button, GUILayout.Height(38f))) { CreateScout(MirageBehavior.StandAndStare); } if (AnimatedButton("FOLLOW AT DISTANCE", _button, GUILayout.Height(38f))) { CreateScout(MirageBehavior.FollowAtDistance); } if (AnimatedButton("RUN AWAY", _button, GUILayout.Height(38f))) { CreateScout(MirageBehavior.RunAway); } }); Card(new Rect(892f, 218f, 336f, 265f), "☠ Fake Enemy", new Color(1f, 0.35f, 0.42f), delegate { Badge(PermissionKind.EveryoneNeedsMod); if (AnimatedButton(((FakeEnemyKind)_enemyIndex).ToString() + " ▾", _button)) { _enemyIndex = (_enemyIndex + 1) % 3; } Lifetime(); FeatureCapability capability = ((_enemyIndex == 0) ? FeatureCapability.FakeEnemyScoutmaster : ((_enemyIndex == 1) ? FeatureCapability.FakeEnemyZombie : FeatureCapability.FakeEnemyLooker)); if (CapabilityButton("SOMETHING'S THERE", capability, _button, 38f)) { CreateFake(MirageBehavior.StandAndStare); } if (CapabilityButton("IT'S FOLLOWING YOU", capability, _button, 38f)) { CreateFake(MirageBehavior.FollowAtDistance); } if (CapabilityButton("VANISH WHEN CLOSE", capability, _button, 38f)) { CreateFake(MirageBehavior.VanishWhenClose); } }); Card(new Rect(238f, 500f, 480f, 190f), "⌖ Phantom Pings", new Color(0.35f, 0.65f, 1f), delegate { Badge(PermissionKind.EveryoneNeedsMod); GUILayout.Label("Target-only decoy pings; one bounded sequence per viewer.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(((PhantomPingPattern)_phantomPingPattern).ToString() + " ▾", _button, GUILayout.Height(30f))) { _phantomPingPattern = (_phantomPingPattern + 1) % 3; } GUILayout.Label("Count " + _phantomPingCount, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _phantomPingCount = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_phantomPingCount, 3f, 12f, (GUILayoutOption[])(object)new GUILayoutOption[0])); GUILayout.Label("Interval " + _phantomPingInterval.ToString("0.00") + "s", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _phantomPingInterval = GUILayout.HorizontalSlider(_phantomPingInterval, 0.35f, 3f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("START", FeatureCapability.PhantomPings, _button, 34f)) { Owner(NetCommand.PhantomPings, new object[3] { _phantomPingPattern, _phantomPingCount, _phantomPingInterval }); } if (AnimatedButton("CANCEL", _danger, GUILayout.Height(34f))) { Owner(NetCommand.CancelPhantomPings, new object[0]); } GUILayout.EndHorizontal(); }); Card(new Rect(735f, 500f, 493f, 190f), "↶ Mirage Registry", new Color(0.3f, 1f, 0.55f), delegate { GUILayout.Label("Active: " + _plugin.Mirages.Count + " Fake enemies: " + _plugin.Mirages.FakeEnemyCount, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("UNDO LAST LOCAL", _button, GUILayout.Height(34f))) { _plugin.Mirages.UndoLast(); } if (AnimatedButton("CLEAR FAKE ENEMIES LOCAL", _button, GUILayout.Height(34f))) { _plugin.Mirages.ClearType(MirageKind.FakeEnemy); } if (AnimatedButton("CLEAR FOR AUDIENCE", _danger, GUILayout.Height(34f))) { ClearMirageAudience(); } }); } private void DrawAudio(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 220f, 480f, 310f), "♪ Fake Sound Cue", new Color(0.35f, 0.65f, 1f), delegate { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) Badge(PermissionKind.EveryoneNeedsMod); GUILayout.Label("Runtime clip: " + CurrentSoundName(), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("NEXT DISCOVERED CLIP", _button)) { CycleSound(); } GUILayout.Label("Volume " + _volume.ToString("0.00"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _volume = GUILayout.HorizontalSlider(_volume, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Position is behind the selected player.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("PLAY 3D SOUND", _button, GUILayout.Height(44f))) { PlayerEntry playerEntry = Target(); if (playerEntry != null) { Vector3 val = playerEntry.Character.Center - playerEntry.Character.data.lookDirection_Flat * 3f; Owner(NetCommand.FakeAudio, new object[5] { CurrentSoundName(), val.x, val.y, val.z, _volume }); } } if (AnimatedButton("PLAY LOCALLY NEAR TARGET", _success, GUILayout.Height(36f))) { PlayerEntry playerEntry2 = Target(); if (playerEntry2 != null) { Vector3 position = playerEntry2.Character.Center - playerEntry2.Character.data.lookDirection_Flat * 3f; Say(_plugin.Audio.PlayDiscovered(CurrentSoundName(), position, _volume, playerEntry2.ActorNumber)); } } GUILayout.Label("Clips are referenced from PEAK at runtime and are never redistributed.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(735f, 220f, 493f, 310f), "♬ Voice", new Color(0.63f, 0.42f, 1f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Local incoming voice control works on unmodded players.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("MUTE SELECTED INCOMING VOICE", FeatureCapability.IncomingVoiceMute, _button, 38f)) { MuteTargets(muted: true); } if (CapabilityButton("RESTORE SELECTED VOICE", FeatureCapability.IncomingVoiceMute, _success, 38f)) { MuteTargets(muted: false); } Unsupported("VOICE SWAP / TALK WHILE KO'D", "Safe remote Photon Voice rerouting is not exposed."); }); Card(new Rect(238f, 548f, 990f, 110f), "i Runtime Discovery", new Color(0.3f, 1f, 0.55f), delegate { GUILayout.Label(_plugin.Audio.Clips.Count + " AudioClip assets currently discovered. Enemy cues are available only when their vanilla clips are loaded.", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private void DrawAppearance(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 220f, 480f, 330f), "● Local Appearance Swap", new Color(0.63f, 0.42f, 1f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Observer-local: selected players do not need the mod.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _clothesOnly = GUILayout.Toggle(_clothesOnly, "Clothes only", (GUILayoutOption[])(object)new GUILayoutOption[0]); _colorOnly = GUILayout.Toggle(_colorOnly, "Color only", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("SWAP WITH RANDOM PLAYER", FeatureCapability.AppearanceSwap, _button, 42f)) { PlayerEntry first = Target(); PlayerEntry second = PickPartner(first); Say(_plugin.Appearance.SwapLocal(first, second, _clothesOnly, _colorOnly)); } if (CapabilityButton("SHUFFLE EVERYONE LOCALLY", FeatureCapability.AppearanceSwap, _button, 42f)) { Say(_plugin.Appearance.ShuffleLocal(_plugin.Players.Entries, _clothesOnly, _colorOnly)); } if (AnimatedButton("RESTORE SELECTED", _success, GUILayout.Height(38f))) { RestoreAppearances(); } }); Card(new Rect(735f, 220f, 493f, 330f), "i What Other Players See", new Color(0.35f, 0.65f, 1f), delegate { GUILayout.Label("This mode changes only your rendered view of scouts. It never changes Steam, Photon, username, account identity, or the other player's saved cosmetics.", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); GUILayout.Label("To confuse another participant, that observer still needs PEAK Troll Mod so their own client can render the swap.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(238f, 565f, 990f, 125f), "★ Local Collection Unlocks", new Color(0.3f, 1f, 0.55f), delegate { Badge(PermissionKind.Anyone); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton(_plugin.Progression.CosmeticsEnabled ? "ALL COSMETICS: ENABLED" : "ENABLE ALL COSMETICS", FeatureCapability.CosmeticUnlocks, _plugin.Progression.CosmeticsEnabled ? _success : _button, 38f)) { Say(_plugin.Progression.SetCosmetics(!_plugin.Progression.CosmeticsEnabled)); } if (CapabilityButton(_plugin.Progression.BadgesEnabled ? "ALL BADGES: ENABLED" : "ENABLE ALL BADGES", FeatureCapability.BadgeUnlocks, _plugin.Progression.BadgesEnabled ? _success : _button, 38f)) { Say(_plugin.Progression.SetBadges(!_plugin.Progression.BadgesEnabled)); } GUILayout.EndHorizontal(); GUILayout.Label("Persistent mod toggles only. They do not grant Steam/platform achievements; disable either toggle to restore the real earned state.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private void DrawEnemies(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 142f, 480f, 255f), "◆ One-Click Profiles", new Color(0.34f, 0.85f, 0.72f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Active: " + _plugin.Profiles.ActiveName, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Presets change only explicit PEAK Troll Mod settings and never touch another mod's configuration.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("VANILLA+", _button, GUILayout.Height(40f))) { ApplyPreset("Vanilla+"); } if (AnimatedButton("ACCESSIBILITY", _button, GUILayout.Height(40f))) { ApplyPreset("Accessibility"); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("LARGE LOBBY", _button, GUILayout.Height(40f))) { ApplyPreset("Large Lobby"); } if (AnimatedButton("PRACTICE", _button, GUILayout.Height(40f))) { ApplyPreset("Practice"); } GUILayout.EndHorizontal(); GUILayout.Label("Practice enables survival/navigation assists. Large Lobby affects the next room hosted and still yields to standalone PEAK Unlimited.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(735f, 142f, 493f, 255f), "▣ Save & Share", new Color(0.42f, 0.68f, 1f), delegate { GUILayout.Label("Profile name", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _profileName = TextField(_profileName, _button, GUILayout.Height(28f)); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("SAVE CURRENT", _success, GUILayout.Height(34f))) { Say(_plugin.Profiles.SaveCurrent(_profileName)); _profileCode = _plugin.Profiles.SavedCode; } if (AnimatedButton("COPY CODE", _button, GUILayout.Height(34f))) { if (string.IsNullOrEmpty(_plugin.Profiles.SavedCode)) { _plugin.Profiles.SaveCurrent(_profileName); } GUIUtility.systemCopyBuffer = _plugin.Profiles.SavedCode; _profileCode = _plugin.Profiles.SavedCode; Say("Profile code copied."); } GUILayout.EndHorizontal(); GUILayout.Label("Import code", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _profileCode = TextField(_profileCode, _button, GUILayout.Height(28f)); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("PASTE", _button, GUILayout.Height(32f))) { _profileCode = GUIUtility.systemCopyBuffer ?? string.Empty; Say("Pasted profile code for review."); } if (AnimatedButton("APPLY CODE", _success, GUILayout.Height(32f))) { Say(_plugin.Profiles.ImportAndApply(_profileCode)); } GUILayout.EndHorizontal(); GUILayout.Label("Codes include a bounded allowlist of PEAK Troll Mod QoL, accessibility, ESP, practice, and lobby settings.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(238f, 415f, 480f, 305f), "◎ Lobby Profile Sync", new Color(0.72f, 0.45f, 1f), delegate { Badge(PermissionKind.EveryoneNeedsMod); GUILayout.Label("The host can offer its current profile. Every recipient must explicitly accept before settings change.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_plugin.LobbyProfileSync.Status, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (_plugin.Players.IsHost) { GUI.enabled = PhotonNetwork.InRoom; if (AnimatedButton("OFFER CURRENT PROFILE", _success, GUILayout.Height(42f))) { Say(_plugin.LobbyProfileSync.Offer(_profileName)); } GUI.enabled = true; GUILayout.Label("Compatible recipients: " + Mathf.Max(0, _plugin.Network.CompatibleCount - 1), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else if (_plugin.LobbyProfileSync.HasPendingOffer) { GUILayout.Label("Review the profile name above. Accept applies only the documented PEAK Troll Mod setting allowlist.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("ACCEPT", _success, GUILayout.Height(42f))) { Say(_plugin.LobbyProfileSync.Accept()); } if (AnimatedButton("DECLINE", _danger, GUILayout.Height(42f))) { Say(_plugin.LobbyProfileSync.Decline()); } GUILayout.EndHorizontal(); } else { GUILayout.Label("When a compatible host sends an offer, Accept and Decline controls appear here.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } }); Card(new Rect(735f, 415f, 493f, 305f), "✚ Anti-Softlock Doctor", new Color(1f, 0.62f, 0.24f), delegate { if (AnimatedButton(_plugin.AntiSoftlock.Enabled ? "DOCTOR: MONITORING" : "DOCTOR: OFF", _plugin.AntiSoftlock.Enabled ? _success : _button, GUILayout.Height(34f))) { _plugin.AntiSoftlock.Enabled = !_plugin.AntiSoftlock.Enabled; } GUILayout.Label(_plugin.AntiSoftlock.Status, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Detection delay " + _plugin.AntiSoftlock.DetectionDelay.ToString("0") + " s", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.AntiSoftlock.DetectionDelay = GUILayout.HorizontalSlider(_plugin.AntiSoftlock.DetectionDelay, 6f, 30f, (GUILayoutOption[])(object)new GUILayoutOption[0]); IList issues = _plugin.AntiSoftlock.Issues; if (issues.Count == 0) { GUILayout.Label("Monitors invalid position, stalled initialization, prolonged incapacitation, and motionless off-ground states. Repairs always require confirmation.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } for (int i = 0; i < issues.Count && i < 2; i++) { GUILayout.Label(issues[i].Title, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(issues[i].Detail, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = issues[i].Repair != SoftlockRepair.None; if (AnimatedButton(issues[i].RepairLabel, _danger, GUILayout.Height(34f))) { Say(_plugin.AntiSoftlock.Repair(i)); } GUI.enabled = true; } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("STABILIZE", _button, GUILayout.Height(32f))) { Say(_plugin.Recovery.StabilizeSelf()); } if (AnimatedButton("RESTORE MOD STATE", _button, GUILayout.Height(32f))) { Say(_plugin.Recovery.RestoreSelf()); } GUILayout.EndHorizontal(); }); } private void DrawWorld(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 150f, 480f, 360f), "✹ Dynamite Shower", new Color(1f, 0.42f, 0.2f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Real networked PEAK dynamite; target needs no mod.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Count " + _dynamiteCount, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _dynamiteCount = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_dynamiteCount, 1f, 64f, (GUILayoutOption[])(object)new GUILayoutOption[0])); GUILayout.Label("Height " + _dynamiteHeight.ToString("0") + "m", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _dynamiteHeight = GUILayout.HorizontalSlider(_dynamiteHeight, 6f, 40f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Spread " + _dynamiteSpread.ToString("0") + "m", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _dynamiteSpread = GUILayout.HorizontalSlider(_dynamiteSpread, 1f, 12f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Interval " + _dynamiteInterval.ToString("0.00") + "s", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _dynamiteInterval = GUILayout.HorizontalSlider(_dynamiteInterval, 0.12f, 1.5f, (GUILayoutOption[])(object)new GUILayoutOption[0]); _lightDynamite = GUILayout.Toggle(_lightDynamite, "Light fuses before dropping", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("START DYNAMITE SHOWER", FeatureCapability.DynamiteShower, _danger, 42f)) { StartDynamiteShower(); } if (AnimatedButton("CANCEL + CLEAR MY DYNAMITE", _button, GUILayout.Height(34f))) { Say("Removed " + _plugin.Spawns.ClearLocalDynamite() + " tracked dynamite."); } GUILayout.Label("Active tracked dynamite: " + _plugin.Spawns.DynamiteCount, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(735f, 150f, 493f, 360f), "☂ Item Storm", new Color(0.35f, 0.68f, 1f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Real networked PEAK items; target needs no mod.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _itemStormRandom = GUILayout.Toggle(_itemStormRandom, "Random item from the loaded catalog", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (!_itemStormRandom) { GUILayout.Label("Selected: " + CurrentItemName(), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("CYCLE SELECTED ITEM", _button, GUILayout.Height(30f))) { CycleItem(); } } GUILayout.Label("Count " + _itemStormCount, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _itemStormCount = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_itemStormCount, 1f, 64f, (GUILayoutOption[])(object)new GUILayoutOption[0])); GUILayout.Label("Height " + _itemStormHeight.ToString("0") + "m", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _itemStormHeight = GUILayout.HorizontalSlider(_itemStormHeight, 6f, 40f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Spread " + _itemStormSpread.ToString("0") + "m", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _itemStormSpread = GUILayout.HorizontalSlider(_itemStormSpread, 1f, 14f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Interval " + _itemStormInterval.ToString("0.00") + "s", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _itemStormInterval = GUILayout.HorizontalSlider(_itemStormInterval, 0.12f, 1.5f, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("START ITEM STORM", FeatureCapability.ItemStorm, _danger, 42f)) { StartItemStorm(); } if (CapabilityButton("MANDRAKE RAIN", FeatureCapability.Mandrake, _danger, 42f)) { StartMandrakeRain(); } if (AnimatedButton("CANCEL + CLEAR MY ITEMS", _button, GUILayout.Height(34f))) { Say("Removed " + _plugin.Spawns.ClearLocalItemStorm() + " tracked storm items."); } GUILayout.Label("Active tracked storm items: " + _plugin.Spawns.ItemStormCount, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Poison/Spore clouds remain unsupported; use direct statuses on Player.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(238f, 525f, 480f, 210f), "⌖ Navigation & Campfire", new Color(0.3f, 1f, 0.55f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Nearest unopened genuine luggage; native and mod mirages are ignored.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(_plugin.LuggageNavigation.DirectionsEnabled ? "REAL LUGGAGE DIRECTIONS: ON" : "REAL LUGGAGE DIRECTIONS: OFF", _plugin.LuggageNavigation.DirectionsEnabled ? _success : _button, GUILayout.Height(34f))) { _plugin.LuggageNavigation.DirectionsEnabled = !_plugin.LuggageNavigation.DirectionsEnabled; Say("Real luggage directions " + (_plugin.LuggageNavigation.DirectionsEnabled ? "enabled." : "disabled.")); } GUILayout.Label(_plugin.LuggageNavigation.LuggageStatus, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Search range " + Mathf.RoundToInt(_plugin.Settings.RealLuggageMaximumDistance.Value) + " m", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.RealLuggageMaximumDistance.Value = GUILayout.HorizontalSlider(_plugin.Settings.RealLuggageMaximumDistance.Value, 25f, 2000f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); Badge(PermissionKind.Anyone); GUILayout.Label("Choose one trap for the next campfire ignition.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton(_plugin.CampfireTroll.Enabled ? "RESET TRAP: ENABLED" : "ENABLE CAMPFIRE RESET TRAP", FeatureCapability.CampfireReset, _plugin.CampfireTroll.Enabled ? _success : _danger, 34f)) { _plugin.CampfireTroll.Enabled = !_plugin.CampfireTroll.Enabled; Say("Campfire reset trap " + (_plugin.CampfireTroll.Enabled ? "enabled." : "disabled.")); } if (CapabilityButton(_plugin.CampfireTroll.DeathTrapEnabled ? "DEATH TRAP: ENABLED" : "ENABLE CAMPFIRE DEATH TRAP", FeatureCapability.CampfireDeathTrap, _plugin.CampfireTroll.DeathTrapEnabled ? _success : _danger, 34f)) { _plugin.CampfireTroll.DeathTrapEnabled = !_plugin.CampfireTroll.DeathTrapEnabled; Say("Campfire death trap " + (_plugin.CampfireTroll.DeathTrapEnabled ? "enabled." : "disabled.")); } GUILayout.Label("Death radius " + _plugin.CampfireTroll.DeathRadius.ToString("0") + " m", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.CampfireTroll.DeathRadius = GUILayout.HorizontalSlider(_plugin.CampfireTroll.DeathRadius, 3f, 50f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("The igniter is affected when inside the radius. Local Immortality still blocks your own death.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(735f, 525f, 493f, 210f), "◉ Mirage Clarity & Rescue", new Color(1f, 0.65f, 0.22f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Locally hides every detected native and mod-created mirage visual.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(_plugin.LuggageNavigation.AntiMiragesEnabled ? "ANTI-MIRAGES: ON" : "ANTI-MIRAGES: OFF", _plugin.LuggageNavigation.AntiMiragesEnabled ? _success : _button, GUILayout.Height(34f))) { _plugin.LuggageNavigation.AntiMiragesEnabled = !_plugin.LuggageNavigation.AntiMiragesEnabled; Say("Anti-Mirages " + (_plugin.LuggageNavigation.AntiMiragesEnabled ? "enabled." : "disabled.")); } GUILayout.Label(_plugin.LuggageNavigation.MirageStatus, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); Badge(PermissionKind.EveryoneNeedsMod); GUILayout.Label("Suppresses the summit rescue on compatible clients; the host must be compatible to stop completion.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton(_plugin.HelicopterTroll.LocalEnabled ? "SUPPRESSION ENABLED" : "SUPPRESS SUMMIT HELICOPTER", FeatureCapability.HelicopterSuppression, _plugin.HelicopterTroll.LocalEnabled ? _success : _danger, 34f)) { Say(_plugin.HelicopterTroll.SetLocalEnabled(!_plugin.HelicopterTroll.LocalEnabled)); } }); } private void DrawChaos(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 220f, 315f, 480f), "◈ Chaos Controller", new Color(0.63f, 0.42f, 1f), delegate { GUILayout.Label(_plugin.Chaos.Active ? "CHAOS IS ACTIVE" : "Chaos is stopped", _plugin.Chaos.Active ? _success : _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Minimum delay " + _plugin.Chaos.MinimumDelay.ToString("0") + "s", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.MinimumDelay = GUILayout.HorizontalSlider(_plugin.Chaos.MinimumDelay, 3f, 60f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Maximum delay " + _plugin.Chaos.MaximumDelay.ToString("0") + "s", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.MaximumDelay = GUILayout.HorizontalSlider(_plugin.Chaos.MaximumDelay, 3f, 120f, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.ExcludeSelf = GUILayout.Toggle(_plugin.Chaos.ExcludeSelf, "Exclude self", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("START", _success, GUILayout.Height(46f))) { _plugin.Chaos.Start(); Say("Chaos started."); } if (AnimatedButton("STOP", _danger, GUILayout.Height(46f))) { _plugin.Chaos.Stop(); Say("Chaos stopped."); } GUILayout.EndHorizontal(); GUILayout.Space(10f); Badge(PermissionKind.Anyone); GUILayout.Label("Wrong Mountain swaps the selected scout with a random different scout, gives both random items, then throws them in opposite directions.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("WRONG MOUNTAIN", FeatureCapability.WrongMountain, _danger, 42f)) { WrongMountain(); } }); Card(new Rect(565f, 220f, 330f, 480f), "⏱ Chaos Combo Builder", new Color(0.35f, 0.68f, 1f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Reusable fixed-order sequence for the selected scout:", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.ComboMandrakeRain = GUILayout.Toggle(_plugin.Chaos.ComboMandrakeRain, "1. Mandrake Rain", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.ComboKnockout = GUILayout.Toggle(_plugin.Chaos.ComboKnockout, "2. Instant Knockout", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.ComboSkyHigh = GUILayout.Toggle(_plugin.Chaos.ComboSkyHigh, "3. Sky High", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.ComboHorizontalYeet = GUILayout.Toggle(_plugin.Chaos.ComboHorizontalYeet, "4. Horizontal Yeet", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.ComboOneLiveOne = GUILayout.Toggle(_plugin.Chaos.ComboOneLiveOne, "5. One Live One", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Delay " + _plugin.Chaos.ComboStepDelay.ToString("0.0") + "s", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Chaos.ComboStepDelay = GUILayout.HorizontalSlider(_plugin.Chaos.ComboStepDelay, 0.5f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Runner: " + _plugin.Chaos.ComboStatus, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = !_targetAll; if (CapabilityButton("RUN SAVED COMBO", FeatureCapability.ComboBuilder, _danger, 42f)) { Say(_plugin.Chaos.StartCombo(Target())); } GUI.enabled = true; if (AnimatedButton("CANCEL COMBO", _button, GUILayout.Height(34f))) { _plugin.Chaos.StopCombo(); Say("Combo cancelled."); } if (_targetAll) { GUILayout.Label("Choose one scout; combo sequences do not use ALL.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } }); Card(new Rect(907f, 220f, 321f, 480f), "☠ Presets & Sabotage", new Color(1f, 0.42f, 0.2f), delegate { Badge(PermissionKind.Anyone); GUILayout.Label("Position Roulette moves every scout to another scout's former position. Nobody stays put.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (CapabilityButton("POSITION ROULETTE", FeatureCapability.PositionRoulette, _danger, 44f)) { Say(_plugin.Network.PositionRoulette(_plugin.Players.Entries)); } GUILayout.Space(16f); GUILayout.Label("One Live One drops many convincing duds with exactly one live fuse at a randomized point in the shower.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Count " + _dynamiteCount, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _dynamiteCount = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_dynamiteCount, 2f, 64f, (GUILayoutOption[])(object)new GUILayoutOption[0])); if (CapabilityButton("ONE LIVE ONE", FeatureCapability.OneLiveOne, _danger, 44f)) { StartOneLiveOne(); } if (AnimatedButton("CANCEL + CLEAR DYNAMITE", _button, GUILayout.Height(34f))) { Say("Removed " + _plugin.Spawns.ClearLocalDynamite() + " tracked dynamite."); } GUILayout.Space(18f); Badge(PermissionKind.HostOnly); GUILayout.Label("Summit Saboteur", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Secretly waits for the selected scout to approach the final summit, then drops their held item, maxes Hunger, locks stamina, spawns a zombie behind them, and launches them toward the horizon.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Trigger distance " + _summitTriggerDistance.ToString("0") + " m", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _summitTriggerDistance = GUILayout.HorizontalSlider(_summitTriggerDistance, 8f, 35f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Stamina lock " + _summitStaminaLock.ToString("0.0") + " s", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _summitStaminaLock = GUILayout.HorizontalSlider(_summitStaminaLock, 2f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Launch distance " + _summitLaunchDistance.ToString("0") + " m", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _summitLaunchDistance = GUILayout.HorizontalSlider(_summitLaunchDistance, 50f, 300f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = !_targetAll && _plugin.Players.IsHost; if (CapabilityButton(_plugin.SummitSaboteur.Armed ? "RE-ARM FOR SELECTED" : "ARM SUMMIT SABOTEUR", FeatureCapability.SummitSaboteur, _danger, 42f)) { Say(_plugin.SummitSaboteur.Arm(Target(), _summitTriggerDistance, _summitStaminaLock, _summitLaunchDistance)); } GUI.enabled = true; if (AnimatedButton("CANCEL SUMMIT SABOTEUR", _button, GUILayout.Height(34f))) { Say(_plugin.SummitSaboteur.Cancel()); } GUILayout.Label(_plugin.SummitSaboteur.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (_targetAll) { GUILayout.Label("Choose one scout; Summit Saboteur does not use ALL.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } }); } private void DrawDirector(Rect area) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) ExpeditionDirectorManager director = _plugin.Director; Card(new Rect(238f, 142f, 320f, 245f), "★ Scenario", new Color(0.3f, 0.9f, 0.7f), delegate { Badge(PermissionKind.HostOnly); GUILayout.Label(director.ModeName, _cardTitle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(director.Objective, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = !director.Active; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("‹", _button, GUILayout.Width(48f), GUILayout.Height(34f))) { int mode = (int)(director.Mode + 5) % 6; Say(director.ApplyPreset((ExpeditionMode)mode)); } if (AnimatedButton("NEXT PRESET", _button, GUILayout.Height(34f))) { int mode2 = (int)(director.Mode + 1) % 6; Say(director.ApplyPreset((ExpeditionMode)mode2)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("ZOMBIE", _danger, GUILayout.Height(31f))) { Say(director.ApplyPreset(ExpeditionMode.ZombieOutbreak)); } if (AnimatedButton("SURVIVAL", _button, GUILayout.Height(31f))) { Say(director.ApplyPreset(ExpeditionMode.Survival)); } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("RESCUE", _success, GUILayout.Height(31f))) { Say(director.ApplyPreset(ExpeditionMode.RescueRush)); } if (AnimatedButton("HARDCORE", _danger, GUILayout.Height(31f))) { Say(director.ApplyPreset(ExpeditionMode.Hardcore)); } if (AnimatedButton("CHAOS", _button, GUILayout.Height(31f))) { Say(director.ApplyPreset(ExpeditionMode.ChaosClimb)); } GUILayout.EndHorizontal(); GUI.enabled = true; }); Card(new Rect(574f, 142f, 654f, 245f), "⚙ Scenario Rules", new Color(0.38f, 0.68f, 1f), delegate { GUI.enabled = !director.Active; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); GUILayout.Label("Duration " + FormatDirectorTime(director.DurationSeconds), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); director.DurationSeconds = GUILayout.HorizontalSlider(director.DurationSeconds, 60f, 3600f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Event interval " + director.EventInterval.ToString("0") + "s", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); director.EventInterval = GUILayout.HorizontalSlider(director.EventInterval, 5f, 120f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Enemy cap " + director.MaximumEnemies, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); director.MaximumEnemies = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)director.MaximumEnemies, 1f, 24f, (GUILayoutOption[])(object)new GUILayoutOption[0])); GUILayout.EndVertical(); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); GUILayout.Label("Starting difficulty " + director.StartingDifficulty, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); director.StartingDifficulty = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)director.StartingDifficulty, 1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[0])); director.AdaptiveDifficulty = GUILayout.Toggle(director.AdaptiveDifficulty, "Adaptive difficulty", (GUILayoutOption[])(object)new GUILayoutOption[0]); director.ZombieWaves = GUILayout.Toggle(director.ZombieWaves, "Mushroom Zombie waves", (GUILayoutOption[])(object)new GUILayoutOption[0]); director.ScoutmasterEvents = GUILayout.Toggle(director.ScoutmasterEvents, "Scoutmaster events", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); director.SupplyDrops = GUILayout.Toggle(director.SupplyDrops, "Supply drops", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); director.AutoRevive = GUILayout.Toggle(director.AutoRevive, "Automatic rescue", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); director.ChaosEvents = GUILayout.Toggle(director.ChaosEvents, "Chaos pulses", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(180f) }); GUILayout.EndHorizontal(); GUI.enabled = true; }); Card(new Rect(238f, 403f, 420f, 319f), "▶ Round Control & Sharing", new Color(1f, 0.63f, 0.2f), delegate { GUILayout.Label(director.Status, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Objective: " + director.Objective, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Time " + FormatDirectorTime(director.Elapsed) + " / " + FormatDirectorTime(director.DurationSeconds) + " • Next event " + director.NextEventSeconds.ToString("0") + "s", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = _plugin.Players.IsHost; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("START ROUND", _success, GUILayout.Height(38f))) { Say(director.Start()); } if (AnimatedButton(director.IsPaused ? "RESUME" : "PAUSE", _button, GUILayout.Height(38f))) { Say(director.TogglePause()); } if (AnimatedButton("STOP + CLEAN", _danger, GUILayout.Height(38f))) { Say(director.Stop(cleanup: true)); } GUILayout.EndHorizontal(); GUI.enabled = true; GUILayout.Label("Shareable scenario code", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _directorCode = TextField(_directorCode, _button, GUILayout.Height(31f)); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("EXPORT", _button, GUILayout.Height(31f))) { _directorCode = director.ExportCode(); Say("Exported a validated PTMD1 scenario code."); } if (AnimatedButton("COPY", _button, GUILayout.Height(31f))) { if (string.IsNullOrEmpty(_directorCode)) { _directorCode = director.ExportCode(); } GUIUtility.systemCopyBuffer = _directorCode; Say("Scenario code copied."); } if (AnimatedButton("PASTE", _button, GUILayout.Height(31f))) { _directorCode = GUIUtility.systemCopyBuffer ?? string.Empty; Say("Pasted scenario code for review."); } if (AnimatedButton("IMPORT", _success, GUILayout.Height(31f))) { Say(director.ImportCode(_directorCode)); } GUILayout.EndHorizontal(); GUI.enabled = _plugin.Players.IsHost; if (AnimatedButton("OFFER RULES TO COMPATIBLE LOBBY", _success, GUILayout.Height(32f))) { Say(director.OfferScenario()); } GUI.enabled = true; if (director.HasPendingOffer) { GUILayout.Label("Host offer: " + director.PendingOfferName, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("ACCEPT RULES", _success, GUILayout.Height(31f))) { Say(director.AcceptOffer()); } if (AnimatedButton("DECLINE", _danger, GUILayout.Height(31f))) { Say(director.DeclineOffer()); } GUILayout.EndHorizontal(); } else if (_plugin.Players.IsHost) { GUILayout.Label(director.OfferResponseSummary, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } GUILayout.Label("Codes contain only bounded Director rules; they cannot edit other mods or execute arbitrary actions.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); Card(new Rect(674f, 403f, 554f, 319f), "☷ Live Host Dashboard", new Color(0.68f, 0.48f, 1f), delegate { //IL_024c: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("Alive " + director.AliveCount + " • Down " + director.DeadCount + " • Director threats " + _plugin.Spawns.DirectorEnemyCount + " • Score " + director.Score, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Events " + director.EventsTriggered + " • Rescues " + director.Rescues + " • Deaths " + director.Deaths + " • Difficulty " + director.Difficulty, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Latest: " + director.LastEvent, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); IList entries = _plugin.Players.Entries; if (entries.Count == 0) { GUILayout.Label("No synchronized scouts are available.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; string text = ((playerEntry == null || (Object)(object)playerEntry.Character == (Object)null || (Object)(object)playerEntry.Character.data == (Object)null) ? "UNAVAILABLE" : (playerEntry.Character.data.dead ? "DEAD" : (playerEntry.Character.data.fullyPassedOut ? "DOWN" : (playerEntry.Character.data.zombified ? "ZOMBIE" : "ALIVE")))); float num = ((playerEntry == null || (Object)(object)playerEntry.Character == (Object)null) ? 0f : playerEntry.Character.Center.y); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label((playerEntry == null) ? "Unknown" : _plugin.PlayerPreferences.DisplayName(playerEntry), _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) }); GUILayout.Label(text, _small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); GUILayout.Label("Altitude " + num.ToString("0") + "m", _small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(115f) }); GUILayout.Label((playerEntry != null && _plugin.Network.IsCompatible(playerEntry.ActorNumber)) ? "v12" : "vanilla/other", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); } }); } private void DrawLobby(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 142f, 326f, 202f), "◎ Lobby Readiness", new Color(0.3f, 0.7f, 1f), delegate { string lobbyCode = _plugin.LobbyReadiness.LobbyCode; GUILayout.Label("Host: " + _plugin.LobbyReadiness.HostName, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Host migration: " + _plugin.LobbyReadiness.HostMigration, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Loaded players: " + _plugin.Players.Entries.Count, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Compatible clients: " + _plugin.Network.CompatibleCount, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(_plugin.Network.LocalReady ? "READY — CLICK TO UNREADY" : "MARK MYSELF READY", _plugin.Network.LocalReady ? _success : _button, GUILayout.Height(31f))) { _plugin.Network.SetLocalReady(!_plugin.Network.LocalReady); Say(_plugin.Network.LocalReady ? "Marked ready for compatible clients." : "Marked not ready."); } GUILayout.Label("Lobby code: " + (string.IsNullOrEmpty(lobbyCode) ? "Unavailable" : lobbyCode), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = !string.IsNullOrEmpty(lobbyCode); if (AnimatedButton("COPY LOBBY CODE", _button, GUILayout.Height(31f))) { GUIUtility.systemCopyBuffer = lobbyCode; Say("Lobby code copied to the clipboard."); } GUI.enabled = true; }); Card(new Rect(580f, 142f, 648f, 202f), "♟ Player Readiness & Versions", new Color(0.4f, 0.85f, 0.65f), delegate { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) IList entries = _plugin.Players.Entries; if (entries.Count == 0) { GUILayout.Label("No lobby players resolved.", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { for (int i = 0; i < entries.Count; i++) { PlayerEntry playerEntry = entries[i]; GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUIStyle val = new GUIStyle(_label); val.normal.textColor = (_plugin.Settings.HighContrast.Value ? Color.white : _plugin.PlayerPreferences.DisplayColor(playerEntry)); GUILayout.Label(_plugin.PlayerPreferences.DisplayName(playerEntry) + (playerEntry.IsLocal ? " (You)" : ""), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(190f) }); string text = ((!_plugin.Network.HasAdvertisement(playerEntry.ActorNumber)) ? _plugin.LobbyReadiness.Readiness(playerEntry) : (_plugin.Network.IsReady(playerEntry.ActorNumber) ? "READY" : "NOT READY")); GUILayout.Label(text, _small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) }); GUILayout.Label(_plugin.Network.CompatibilityStatus(playerEntry.ActorNumber), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("EDIT", _button, GUILayout.Width(54f), GUILayout.Height(25f))) { _targetAll = false; _targetIndex = i; LoadPreferenceEditor(playerEntry); } GUILayout.EndHorizontal(); } } }); Card(new Rect(238f, 360f, 480f, 360f), "♥ Persistent Player Preferences", new Color(0.72f, 0.48f, 1f), delegate { PlayerEntry playerEntry = Target(); if (playerEntry == null) { GUILayout.Label("Select a player from the roster.", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { EnsurePreferenceEditor(playerEntry); GUILayout.Label("Editing: " + playerEntry.Name, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Saved locally by Steam ID; aliases and colors appear only in this mod.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Preferred display name", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _preferenceAlias = TextField(_preferenceAlias, _button, GUILayout.Height(30f)); GUILayout.Label("Voice volume " + Mathf.RoundToInt(_preferenceVolume * 100f) + "%", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _preferenceVolume = GUILayout.HorizontalSlider(_preferenceVolume, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); _preferenceMuted = GUILayout.Toggle(_preferenceMuted, "Always mute locally", (GUILayoutOption[])(object)new GUILayoutOption[0]); _preferenceExcluded = GUILayout.Toggle(_preferenceExcluded, "Exclude from random troll targeting", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("UI name color", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Red", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _preferenceColor.r = GUILayout.HorizontalSlider(_preferenceColor.r, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Green", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _preferenceColor.g = GUILayout.HorizontalSlider(_preferenceColor.g, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Blue", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _preferenceColor.b = GUILayout.HorizontalSlider(_preferenceColor.b, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("SAVE PREFERENCE", _success, GUILayout.Height(34f))) { Say(SavePreference(playerEntry)); } if (AnimatedButton("RESET", _button, GUILayout.Height(34f))) { Say(_plugin.PlayerPreferences.Reset(playerEntry)); LoadPreferenceEditor(playerEntry); } GUILayout.EndHorizontal(); } }); Card(new Rect(735f, 360f, 493f, 360f), "⚕ Emergency Recovery", new Color(1f, 0.58f, 0.25f), delegate { GUILayout.Label("Local, safe-ground recovery. No host permission or target mod is needed.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); if (AnimatedButton("UNSTUCK — LAST SAFE GROUND", _success, GUILayout.Height(38f))) { Say(_plugin.Recovery.RecoverLastSafeGround()); } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("NEAREST SAFE SCOUT", _button, GUILayout.Height(36f))) { Say(_plugin.Recovery.RecoverNearestScout()); } if (AnimatedButton("ACTIVE CHECKPOINT", _button, GUILayout.Height(36f))) { Say(_plugin.Recovery.RecoverCheckpoint()); } GUILayout.EndHorizontal(); if (AnimatedButton("RETURN TO EXPEDITION START", _button, GUILayout.Height(36f))) { Say(_plugin.Recovery.RecoverStart()); } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("STOP FLIGHT + VELOCITY", _button, GUILayout.Height(36f))) { Say(_plugin.Recovery.StabilizeSelf()); } if (AnimatedButton("RESTORE SELF", _button, GUILayout.Height(36f))) { Say(_plugin.Recovery.RestoreSelf()); } GUILayout.EndHorizontal(); if (AnimatedButton("CLEAR LOCAL MOD EFFECTS", _danger, GUILayout.Height(38f))) { _plugin.Reset.ResetAll(); Say("Cleared locally tracked troll effects and restored reversible state."); } GUILayout.Label("Recovery can revive you when required and clears residual rigidbody velocity after moving.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private void DrawSettings(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 178f, 480f, 500f), "⚙ Interface, Accessibility & Safety", new Color(0.35f, 0.65f, 1f), delegate { //IL_0015: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label("Menu key: " + _plugin.Settings.MenuKey.Value, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("UI scale " + _plugin.Settings.UiScale.Value.ToString("0.00"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.UiScale.Value = GUILayout.HorizontalSlider(_plugin.Settings.UiScale.Value, 0.75f, 1.5f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Transparency " + _plugin.Settings.Transparency.Value.ToString("0.00"), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.Transparency.Value = GUILayout.HorizontalSlider(_plugin.Settings.Transparency.Value, 0.55f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Text size " + _plugin.Settings.TextScale.Value.ToString("0.00") + "x", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("CYCLE", _button, GUILayout.Width(90f), GUILayout.Height(28f))) { CycleTextScale(); } GUILayout.EndHorizontal(); _plugin.Settings.HighContrast.Value = GUILayout.Toggle(_plugin.Settings.HighContrast.Value, "High-contrast status colors", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Camera shake " + Mathf.RoundToInt(_plugin.Settings.CameraShakeScale.Value * 100f) + "%", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.CameraShakeScale.Value = GUILayout.HorizontalSlider(_plugin.Settings.CameraShakeScale.Value, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.ReduceFlashingEffects.Value = GUILayout.Toggle(_plugin.Settings.ReduceFlashingEffects.Value, "Reduce repeated/flashing troll effects", (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("MENU INPUT: " + _plugin.Settings.MenuActivation.Value.ToString().ToUpperInvariant(), _button, GUILayout.Height(30f))) { _plugin.Settings.MenuActivation.Value = ((_plugin.Settings.MenuActivation.Value == MenuActivationMode.Toggle) ? MenuActivationMode.Hold : MenuActivationMode.Toggle); } GUILayout.Label("All menu, backpack, and spectator shortcuts can be changed on Mod Config.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); _plugin.Settings.ConfirmDestructive.Value = GUILayout.Toggle(_plugin.Settings.ConfirmDestructive.Value, "Confirm destructive actions", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.ExcludeSelf.Value = GUILayout.Toggle(_plugin.Settings.ExcludeSelf.Value, "Exclude self from random targets", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Maximum tracked objects " + _plugin.Settings.MaxSpawnedObjects.Value, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.MaxSpawnedObjects.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_plugin.Settings.MaxSpawnedObjects.Value, 4f, 64f, (GUILayoutOption[])(object)new GUILayoutOption[0])); GUILayout.Label("Maximum dynamite objects " + _plugin.Settings.MaxDynamiteObjects.Value, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.MaxDynamiteObjects.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_plugin.Settings.MaxDynamiteObjects.Value, 8f, 128f, (GUILayoutOption[])(object)new GUILayoutOption[0])); GUILayout.Label("Maximum Item Storm objects " + _plugin.Settings.MaxItemStormObjects.Value, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.MaxItemStormObjects.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_plugin.Settings.MaxItemStormObjects.Value, 8f, 128f, (GUILayoutOption[])(object)new GUILayoutOption[0])); }); Card(new Rect(735f, 178f, 493f, 500f), "⌁ Diagnostics", new Color(0.63f, 0.42f, 1f), delegate { _plugin.Settings.DebugLogging.Value = GUILayout.Toggle(_plugin.Settings.DebugLogging.Value, "Debug logging", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.NetworkDiagnostics.Value = GUILayout.Toggle(_plugin.Settings.NetworkDiagnostics.Value, "Network diagnostics", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.MirageDebug.Value = GUILayout.Toggle(_plugin.Settings.MirageDebug.Value, "Mirage debug info", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.FakeEnemyDebug.Value = GUILayout.Toggle(_plugin.Settings.FakeEnemyDebug.Value, "Fake Enemy debug info", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(12f); if (AnimatedButton("REFRESH CAPABILITIES", _button, GUILayout.Height(40f))) { _plugin.Capabilities.RefreshDynamic(); _plugin.Actions.RefreshItemCatalog(); _plugin.ModBrowser.Refresh(); Say("Runtime capabilities refreshed."); } GUILayout.Label("Camera shake scaling is applied at PEAK's final gamefeel rotation output, so it also covers native events.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Reduced flashing currently caps and slows repeated Phantom Pings and removes menu press pulses; it does not alter unrelated game cinematics.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("SpongePEAKLib: not used; Photon RaiseEvent provides the required validated mod channel.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private void DrawModConfig(Rect area) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) Card(new Rect(238f, 142f, 990f, 178f), "◆ Built-in Quality of Life", new Color(0.25f, 0.75f, 0.7f), delegate { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); _plugin.Settings.TeamStatusEnabled.Value = GUILayout.Toggle(_plugin.Settings.TeamStatusEnabled.Value, "Team Status Panel", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_plugin.TeamStatus.SuppressedByExternal ? "Yielding to PeakStatsEx" : "Nearby stamina + conditions", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); _plugin.Settings.QuickBackpackEnabled.Value = GUILayout.Toggle(_plugin.Settings.QuickBackpackEnabled.Value, string.Concat("Quick Backpack [", _plugin.Settings.QuickBackpackKey.Value, "]"), (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(_plugin.QuickBackpack.SuppressedByExternal ? "Yielding to EasyBackpack" : "Opens the equipped pack wheel", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); _plugin.Settings.BetterSpectatingEnabled.Value = GUILayout.Toggle(_plugin.Settings.BetterSpectatingEnabled.Value, "Better Spectating", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.SpectateGhostPings.Value = GUILayout.Toggle(_plugin.Settings.SpectateGhostPings.Value, "Ghost pings", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); _plugin.Settings.ItemSpawnerEnabled.Value = GUILayout.Toggle(_plugin.Settings.ItemSpawnerEnabled.Value, "Item Spawner", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.Settings.EffectPreviewEnabled.Value = GUILayout.Toggle(_plugin.Settings.EffectPreviewEnabled.Value, "Safe Troll Effect Cards", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); _plugin.Settings.FavoritesAndRecentsEnabled.Value = GUILayout.Toggle(_plugin.Settings.FavoritesAndRecentsEnabled.Value, "Favorites & Recents", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Persistent local quick access", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); GUI.enabled = !PhotonNetwork.InRoom && !_plugin.UnlimitedLobby.StandaloneDetected; _plugin.Settings.UnlimitedLobbyEnabled.Value = GUILayout.Toggle(_plugin.Settings.UnlimitedLobbyEnabled.Value, "Unlimited Lobby", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = true; GUILayout.Label(_plugin.UnlimitedLobby.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); GUI.enabled = !_plugin.StaminaEffectPreview.StandaloneDetected; _plugin.Settings.StaminaEffectPreviewEnabled.Value = GUILayout.Toggle(_plugin.Settings.StaminaEffectPreviewEnabled.Value, "Held-item Stamina Preview", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = true; GUILayout.Label(_plugin.StaminaEffectPreview.Status, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); GUI.enabled = _plugin.Settings.StaminaEffectPreviewEnabled.Value && !_plugin.StaminaEffectPreview.StandaloneDetected; _plugin.Settings.StaminaEffectPreviewDetails.Value = GUILayout.Toggle(_plugin.Settings.StaminaEffectPreviewDetails.Value, "Detailed condition changes", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = true; GUILayout.Label("Shows the result before consumption", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(300f) }); _plugin.LuggageNavigation.DirectionsEnabled = GUILayout.Toggle(_plugin.LuggageNavigation.DirectionsEnabled, "Real Luggage Directions", (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.LuggageNavigation.AntiMiragesEnabled = GUILayout.Toggle(_plugin.LuggageNavigation.AntiMiragesEnabled, "Anti-Mirages", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndVertical(); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUI.enabled = !PhotonNetwork.InRoom && !_plugin.UnlimitedLobby.StandaloneDetected; GUILayout.Label("Unlimited lobby cap " + _plugin.UnlimitedLobby.MaxPlayers, _small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(155f) }); _plugin.Settings.UnlimitedLobbyMaxPlayers.Value = Mathf.RoundToInt(GUILayout.HorizontalSlider((float)_plugin.Settings.UnlimitedLobbyMaxPlayers.Value, 4f, 30f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(220f) })); GUI.enabled = true; _plugin.Settings.UnlimitedLobbyScaleSupplies.Value = GUILayout.Toggle(_plugin.Settings.UnlimitedLobbyScaleSupplies.Value, "Scale food + backpacks", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.EndHorizontal(); _plugin.Settings.PreferExternalQualityOfLifeMods.Value = GUILayout.Toggle(_plugin.Settings.PreferExternalQualityOfLifeMods.Value, "Prefer enabled external QoL mods when features overlap", (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton(_plugin.BetterSpectating.FreeCamera ? "RETURN TO SCOUT" : "SPECTATOR FREE CAM", _button, GUILayout.Height(30f))) { Say(_plugin.BetterSpectating.SetFreeCamera(!_plugin.BetterSpectating.FreeCamera)); } if (AnimatedButton("REVIVE BESIDE SPECTATED", _success, GUILayout.Height(30f))) { Say(_plugin.BetterSpectating.ReviveBesideSpectated()); } GUILayout.EndHorizontal(); }); Card(new Rect(238f, 334f, 320f, 388f), "☷ Loaded Mods", new Color(0.45f, 0.65f, 1f), delegate { if (AnimatedButton("REFRESH LOADED MODS", _button, GUILayout.Height(30f))) { _plugin.ModBrowser.Refresh(); _modIndex = 0; _configIndex = 0; _configEditKey = string.Empty; Say("Loaded mod list refreshed."); } IList plugins = _plugin.ModBrowser.Plugins; for (int i = 0; i < plugins.Count; i++) { PluginInfo val = plugins[i]; string text = (((Behaviour)val.Instance).enabled ? "● " : "○ "); if (AnimatedButton(text + val.Metadata.Name + ((i == _modIndex) ? " ›" : ""), (i == _modIndex) ? _navSelected : _button, GUILayout.Height(29f))) { _modIndex = i; _configIndex = 0; _configEditKey = string.Empty; } } }); Card(new Rect(574f, 334f, 654f, 388f), "⚙ Selected Mod & Settings", new Color(0.68f, 0.46f, 1f), delegate { PluginInfo val = SelectedPlugin(); if (val == null) { GUILayout.Label("No loaded plugin selected.", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { GUILayout.Label(val.Metadata.Name + " v" + val.Metadata.Version, _cardTitle, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label(val.Metadata.GUID, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); bool flag = val.Metadata.GUID == "com.dougl.peaktrollmod"; GUI.enabled = !flag; if (AnimatedButton(((Behaviour)val.Instance).enabled ? "DISABLE COMPONENT THIS SESSION" : "ENABLE COMPONENT THIS SESSION", ((Behaviour)val.Instance).enabled ? _danger : _success, GUILayout.Height(34f))) { Say(_plugin.ModBrowser.SetComponentEnabled(val, !((Behaviour)val.Instance).enabled)); } GUI.enabled = true; GUILayout.Label(flag ? "Use the module toggles above for this mod." : "Component switches are session-only. Harmony patches may remain until restart.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(8f); ConfigEntryBase[] configEntries = val.Instance.Config.GetConfigEntries(); if (configEntries.Length == 0) { GUILayout.Label("This plugin exposes no BepInEx settings.", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); } else { if (_configIndex >= configEntries.Length) { _configIndex = 0; } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("‹", _button, GUILayout.Width(42f), GUILayout.Height(30f))) { _configIndex = (_configIndex + configEntries.Length - 1) % configEntries.Length; _configEditKey = string.Empty; } GUILayout.Label(_configIndex + 1 + " / " + configEntries.Length, _label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) }); if (AnimatedButton("NEXT SETTING ›", _button, GUILayout.Height(30f))) { _configIndex = (_configIndex + 1) % configEntries.Length; _configEditKey = string.Empty; } GUILayout.EndHorizontal(); ConfigEntryBase val2 = configEntries[_configIndex]; string text = val.Metadata.GUID + "|" + val2.Definition.Section + "|" + val2.Definition.Key; if (_configEditKey != text) { _configEditKey = text; _configEdit = val2.GetSerializedValue(); } GUILayout.Label(val2.Definition.Section + " / " + val2.Definition.Key, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (!string.IsNullOrEmpty(val2.Description.Description)) { GUILayout.Label(val2.Description.Description, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } if (val2.SettingType == typeof(bool)) { bool flag2 = (bool)val2.BoxedValue; if (AnimatedButton(flag2 ? "ON — CLICK TO TURN OFF" : "OFF — CLICK TO TURN ON", flag2 ? _success : _button, GUILayout.Height(34f))) { Say(_plugin.ModBrowser.SetValue(val2, (!flag2).ToString())); _configEdit = val2.GetSerializedValue(); } } else { GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); _configEdit = TextField(_configEdit, _button, GUILayout.Height(32f)); if (AnimatedButton("APPLY", _success, GUILayout.Width(80f), GUILayout.Height(32f))) { Say(_plugin.ModBrowser.SetValue(val2, _configEdit)); _configEdit = val2.GetSerializedValue(); } GUILayout.EndHorizontal(); } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Current: " + val2.GetSerializedValue(), _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); if (AnimatedButton("RESET DEFAULT", _button, GUILayout.Width(125f), GUILayout.Height(27f))) { Say(_plugin.ModBrowser.ResetValue(val2)); _configEdit = val2.GetSerializedValue(); } GUILayout.EndHorizontal(); GUILayout.Label("Changes are saved to the owning mod's config. Live application depends on that mod; restart PEAK when in doubt.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } } }); } private PluginInfo SelectedPlugin() { IList plugins = _plugin.ModBrowser.Plugins; if (plugins.Count == 0) { return null; } if (_modIndex >= plugins.Count) { _modIndex = 0; } return plugins[_modIndex]; } private void DrawItemShortcuts(string title, IList values) { if (values == null || values.Count == 0) { return; } GUILayout.Label(title, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); int num = Mathf.Min(values.Count, 4); for (int i = 0; i < num; i++) { if (AnimatedButton(values[i], _button, GUILayout.Height(26f))) { SelectItemNamed(values[i]); } } } private void DrawEffectShortcuts(IList values) { if (values == null || values.Count == 0) { return; } GUILayout.BeginHorizontal((GUILayoutOption[])(object)new GUILayoutOption[0]); int num = Mathf.Min(values.Count, 3); for (int i = 0; i < num; i++) { if (AnimatedButton("★ " + values[i], _button, GUILayout.Height(25f))) { SelectEffect(values[i]); } } GUILayout.EndHorizontal(); } private void GiveSelectedItem(bool self) { string text = CurrentItemName(); PlayerEntry playerEntry = (self ? _plugin.Players.Local : Target()); if (self && playerEntry == null) { Say("Local player unavailable."); return; } if (!self && !_targetAll && playerEntry == null) { Say("Select a target first."); return; } if (!self && _targetAll && _plugin.Players.Entries.Count == 0) { Say("No lobby players are available."); return; } ActionResult actionResult = null; for (int i = 0; i < _itemQuantity; i++) { if (self) { actionResult = _plugin.Network.SendToOwner(NetCommand.GiveItem, playerEntry, new object[1] { text }); } else { Owner(NetCommand.GiveItem, new object[1] { text }); actionResult = ActionResult.Ok("Requested " + _itemQuantity + " item(s)."); } } _plugin.Shortcuts.RecordItem(text); _plugin.Shortcuts.RecordEffect("Give Item"); if (actionResult == null) { Say("No target available."); } else { Say(actionResult); } } private void SpawnSelectedItem() { PlayerEntry playerEntry = Target(); string text = CurrentItemName(); if (playerEntry == null) { Say("Select one target first."); return; } ActionResult actionResult = _plugin.Spawns.SpawnItemNear(playerEntry, text, _itemQuantity); if (actionResult.Success) { _plugin.Shortcuts.RecordItem(text); _plugin.Shortcuts.RecordEffect("Spawn Item"); } Say(actionResult); } private void SelectItemNamed(string name) { _itemSearch = string.Empty; IList items = _plugin.Actions.Items; for (int i = 0; i < items.Count; i++) { if ((Object)(object)items[i] != (Object)null && string.Equals(((Object)items[i]).name, name, StringComparison.OrdinalIgnoreCase)) { _itemIndex = i; Say("Selected " + ((Object)items[i]).name + "."); return; } } Say(name + " is not currently loaded."); } private void PreviewEffect(string effect) { _effectPreviewUntil = Time.unscaledTime + 4f; if (_plugin.Settings.FavoritesAndRecentsEnabled.Value) { _plugin.Shortcuts.RecordEffect(effect); } Say("Safe preview started for " + effect + "; no gameplay action was sent."); } private void SelectEffect(string effect) { if (effect == "Give Item" || effect == "Spawn Item") { _tab = 13; Say("Opened Item Spawner for " + effect + "."); return; } for (int i = 0; i < _previewEffects.Length; i++) { if (string.Equals(_previewEffects[i], effect, StringComparison.OrdinalIgnoreCase)) { _effectPreviewIndex = i; PreviewEffect(effect); break; } } } private string EffectPreviewText(string effect) { return effect switch { "Launch" => "Shows the configured direction, force, and ragdoll handoff before a launch.", "Ragdoll" => "Shows force and recovery behavior before the native synchronized fall is requested.", "Flight" => "Shows flight speed, boost behavior, recipient requirements, and cleanup behavior.", "Status Effect" => "Shows the selected condition and bounded amount without changing scout afflictions.", "Phantom Pings" => "Shows pattern, ping count, interval, audience, and cancellation behavior.", "Fake Enemy" => "Shows the selected harmless visual decoy behavior and lifetime.", _ => "Shows Item Storm quantity, height, spread, interval, and item selection mode.", }; } private string EffectPreviewValues(string effect) { return effect switch { "Launch" => _launchStrength.ToString("0") + " force ↑", "Ragdoll" => _ragdollStrength.ToString("0") + " force ↗", "Flight" => _flightSpeed.ToString("0") + " m/s ⇧", "Status Effect" => string.Concat((object)(STATUSTYPE)_statusIndex, " ", _statusAmount.ToString("0.00")), "Phantom Pings" => string.Concat((PhantomPingPattern)_phantomPingPattern, " ×", _phantomPingCount, " ", _phantomPingInterval.ToString("0.00"), "s"), "Fake Enemy" => string.Concat((FakeEnemyKind)_enemyIndex, " ", _lifetime.ToString("0"), "s"), _ => _itemStormCount + " items " + _itemStormHeight.ToString("0") + "m high", }; } private string PreviewGlyph(string effect) { int num = Mathf.FloorToInt(Time.unscaledTime * 5f) % 4; string text = new string('·', num + 1); switch (effect) { case "Launch": case "Flight": return "SCOUT ↑" + text; case "Ragdoll": return "SCOUT ↗" + text; case "Phantom Pings": return "• • •" + text; case "Item Storm": return "▣ ↓ ▣" + text; default: return "◇" + text; } } private void OpenEffectControls(string effect) { switch (effect) { case "Phantom Pings": case "Fake Enemy": _tab = 3; break; case "Item Storm": _tab = 7; break; default: _tab = 1; break; } } private void UnsupportedPage(string title, string reason) { //IL_0029: 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) Card(new Rect(238f, 230f, 990f, 300f), "⚠ " + title, new Color(1f, 0.65f, 0.22f), delegate { Badge(PermissionKind.Unsupported); GUILayout.Space(12f); GUILayout.Label(reason, _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Space(18f); GUILayout.Label("This page remains visible so capability loss after a PEAK update is explicit rather than silently unsafe.", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); }); } private void DrawStatusBar() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) DrawPanel(new Rect(228f, 762f, 1012f, 48f), new Color(0.045f, 0.065f, 0.067f, 0.98f), new Color(0.18f, 0.28f, 0.28f, 1f), 1f); GUIStyle val = new GUIStyle(_small); val.alignment = (TextAnchor)3; val.normal.textColor = ((Time.unscaledTime < _messageUntil) ? new Color(0.48f, 0.9f, 0.78f) : new Color(0.58f, 0.67f, 0.66f)); GUI.Label(new Rect(248f, 770f, 950f, 32f), _message, val); } private void Card(Rect rect, string title, Color accent, Action draw) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) DrawPanel(rect, new Color(0.055f, 0.072f, 0.074f, 0.98f), new Color(accent.r * 0.55f, accent.g * 0.55f, accent.b * 0.55f, 1f), 1f); GUIStyle val = new GUIStyle(_cardTitle); val.normal.textColor = accent; GUI.Label(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 10f, ((Rect)(ref rect)).width - 28f, 30f), title, val); GUILayout.BeginArea(new Rect(((Rect)(ref rect)).x + 14f, ((Rect)(ref rect)).y + 46f, ((Rect)(ref rect)).width - 28f, ((Rect)(ref rect)).height - 56f)); if (!_cardScroll.TryGetValue(title, out var value)) { value = Vector2.zero; } value = GUILayout.BeginScrollView(value, false, false, (GUILayoutOption[])(object)new GUILayoutOption[0]); draw(); GUILayout.EndScrollView(); _cardScroll[title] = value; GUILayout.EndArea(); } private void Badge(PermissionKind permission) { GUILayout.Label(permission switch { PermissionKind.HostOnly => "\ud83d\udd12 Host Only", PermissionKind.EveryoneNeedsMod => "\ud83d\udfe1 Everyone Needs Mod", PermissionKind.Anyone => "\ud83d\udfe2 Anyone", _ => "⚠ Unsupported", }, _badge, (GUILayoutOption[])(object)new GUILayoutOption[0]); } private bool CapabilityButton(string text, FeatureCapability capability, GUIStyle style, float height) { bool enabled = GUI.enabled; GUI.enabled = enabled && _plugin.Capabilities.Available(capability); bool result = AnimatedButton(text, style, GUILayout.Height(height)); GUI.enabled = enabled; return result; } private void Unsupported(string name, string reason) { GUI.enabled = false; AnimatedButton(name, _disabled, GUILayout.Height(32f)); GUI.enabled = true; GUILayout.Label("⚠ " + reason, _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); } private void Distance() { GUILayout.Label("Spawn distance " + _spawnDistance.ToString("0") + "m", _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); _spawnDistance = GUILayout.HorizontalSlider(_spawnDistance, 4f, 25f, (GUILayoutOption[])(object)new GUILayoutOption[0]); } private void Lifetime() { GUILayout.Label("Despawn " + _lifetime.ToString("0") + "s", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); _lifetime = GUILayout.HorizontalSlider(_lifetime, 3f, 60f, (GUILayoutOption[])(object)new GUILayoutOption[0]); } private void BeginPing(MirageKind kind) { PlayerEntry playerEntry = Target(); if (!_targetAll && playerEntry == null) { Say("Select a target first."); return; } _plugin.PingPlacement.Begin(kind, _multiPlace, _targetAll ? (-1) : playerEntry.ActorNumber); Say("Ping placement armed for " + (_targetAll ? "every compatible viewer" : playerEntry.Name) + ". Close F7, aim, and ping."); ForceClose(); } private void RagdollOffMountain() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Network.RagdollOffMountain(entries[i], _ragdollStrength); } Say((actionResult == null) ? "No targets available." : ("Ragdolled lobby players toward nearby drops. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.RagdollOffMountain(playerEntry, _ragdollStrength)); } } } private void HorizontalRagdoll() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Network.HorizontalRagdoll(entries[i], _horizontalRagdollStrength); } Say((actionResult == null) ? "No targets available." : ("Applied horizontal yeet to lobby players. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.HorizontalRagdoll(playerEntry, _horizontalRagdollStrength)); } } } private void SkyLaunch() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Network.SkyLaunch(entries[i], _skyHeight); } Say((actionResult == null) ? "No targets available." : ("Sent lobby players sky high. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.SkyLaunch(playerEntry, _skyHeight)); } } } private void HorizonLaunch() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Network.HorizonLaunch(entries[i], _horizonDistance); } Say((actionResult == null) ? "No targets available." : ("Sent lobby players toward the far horizon. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.HorizonLaunch(playerEntry, _horizonDistance)); } } } private void ClearStatuses() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Network.ClearStatuses(entries[i]); } Say((actionResult == null) ? "No targets available." : ("Cleared tracked statuses for eligible players. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.ClearStatuses(playerEntry)); } } } private void ResurrectSelected() { if (_targetAll) { Say(_plugin.NoWait.QueueResurrectAll()); return; } PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.Resurrect(playerEntry)); } } private void ResurrectSelf() { PlayerEntry local = _plugin.Players.Local; if (local == null) { Say("Local player unavailable."); } else { Say(_plugin.Network.Resurrect(local)); } } private void ReconnectLastLobby() { ActionResult actionResult = _plugin.QuickReconnect.Reconnect(); Say(actionResult); if (actionResult.Success) { ForceClose(); } } private string NoWaitDestinationName() { if (_plugin.NoWait.Destination != NoWaitDestination.NearestLiving) { if (_plugin.NoWait.Destination != NoWaitDestination.LowestLiving) { return "CHECKPOINT"; } return "LOWEST"; } return "NEAREST"; } private void CycleNoWaitDestination() { _plugin.NoWait.Destination = (NoWaitDestination)((int)(_plugin.NoWait.Destination + 1) % 3); Say("No Wait destination set to " + NoWaitDestinationName().ToLowerInvariant() + "."); } private void StartDynamiteShower() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Spawns.StartDynamiteShower(entries[i], _dynamiteCount, _dynamiteHeight, _dynamiteSpread, _dynamiteInterval, _lightDynamite); } Say((actionResult == null) ? "No targets available." : ("Queued showers for eligible lobby players. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Spawns.StartDynamiteShower(playerEntry, _dynamiteCount, _dynamiteHeight, _dynamiteSpread, _dynamiteInterval, _lightDynamite)); } } } private void StartOneLiveOne() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Spawns.StartOneLiveOne(entries[i], _dynamiteCount, _dynamiteHeight, _dynamiteSpread, _dynamiteInterval); } Say((actionResult == null) ? "No targets available." : ("Queued One Live One for eligible lobby players. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Spawns.StartOneLiveOne(playerEntry, _dynamiteCount, _dynamiteHeight, _dynamiteSpread, _dynamiteInterval)); } } } private void StartItemStorm() { string selectedItemName = CurrentItemName(); if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Spawns.StartItemStorm(entries[i], _itemStormCount, _itemStormHeight, _itemStormSpread, _itemStormInterval, _itemStormRandom, selectedItemName); } Say((actionResult == null) ? "No targets available." : ("Queued Item Storms for eligible lobby players. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Spawns.StartItemStorm(playerEntry, _itemStormCount, _itemStormHeight, _itemStormSpread, _itemStormInterval, _itemStormRandom, selectedItemName)); } } } private void StartMandrakeRain() { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Spawns.StartMandrakeRain(entries[i], _itemStormCount, _itemStormHeight, _itemStormSpread, _itemStormInterval); } Say((actionResult == null) ? "No targets available." : ("Queued Mandrake Rain for eligible lobby players. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Spawns.StartMandrakeRain(playerEntry, _itemStormCount, _itemStormHeight, _itemStormSpread, _itemStormInterval)); } } } private void WrongMountain() { if (_targetAll) { Say("Wrong Mountain needs one selected scout so it can choose a different partner."); return; } PlayerEntry playerEntry = Target(); PlayerEntry playerEntry2 = PickRandomPartner(playerEntry); if (playerEntry == null || playerEntry2 == null) { Say("Wrong Mountain needs at least two available scouts."); } else { Say(_plugin.Network.WrongMountain(playerEntry, playerEntry2, _horizontalRagdollStrength)); } } private void ClearMirageAudience() { if (_targetAll) { IList entries = _plugin.Players.Entries; for (int i = 0; i < entries.Count; i++) { _plugin.Network.SendToOwner(NetCommand.ClearMirages, entries[i], new object[0]); } Say("Cleared mirages for all compatible viewers."); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.SendToOwner(NetCommand.ClearMirages, playerEntry, new object[0])); } } } private void CreateScout(MirageBehavior behavior) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) PlayerEntry playerEntry = Target(); if (playerEntry != null) { Vector3 val = playerEntry.Character.Center - playerEntry.Character.data.lookDirection_Flat * 8f; Owner(NetCommand.MirageScout, new object[6] { playerEntry.ActorNumber, val.x, val.y, val.z, (int)behavior, _lifetime }); } } private void CreateFake(MirageBehavior behavior) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) PlayerEntry playerEntry = Target(); if (playerEntry != null) { Vector3 val = playerEntry.Character.Center - playerEntry.Character.data.lookDirection_Flat * 8f; Owner(NetCommand.FakeEnemy, new object[6] { _enemyIndex, val.x, val.y, val.z, (int)behavior, _lifetime }); } } private void Teleport(Vector3 p) { Owner(NetCommand.Teleport, new object[3] { p.x, p.y, p.z }); } private void TeleportSelfToTarget() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) PlayerEntry playerEntry = Target(); PlayerEntry local = _plugin.Players.Local; if (playerEntry == null || local == null) { Say("Player unavailable."); return; } Vector3 center = playerEntry.Character.Center; Say(_plugin.Network.SendToOwner(NetCommand.Teleport, local, new object[3] { center.x, center.y, center.z })); } private void MuteTargets(bool muted) { if (_targetAll) { IList entries = _plugin.Players.Entries; for (int i = 0; i < entries.Count; i++) { _plugin.Audio.SetIncomingVoiceMuted(entries[i], muted); } Say(muted ? "Muted all available incoming voices locally." : "Restored all available incoming voices."); } else { Say(_plugin.Audio.SetIncomingVoiceMuted(Target(), muted)); } } private void RestoreAppearances() { if (_targetAll) { _plugin.Appearance.RestoreAll(_plugin.Players.Entries); Say("Restored all actual appearances locally."); } else { Say(_plugin.Appearance.Restore(Target())); } } private void ClearTrollSpawns() { if (_plugin.Players.IsHost) { _plugin.Spawns.ClearAll(); Say("All tracked troll spawns cleared."); } else { Say(_plugin.Network.RequestClearMySpawns()); } } private void Owner(NetCommand command, object[] args) { if (_targetAll) { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { Say("No targets available."); return; } ActionResult actionResult = null; for (int i = 0; i < entries.Count; i++) { actionResult = _plugin.Network.SendToOwner(command, entries[i], args); } Say((actionResult == null) ? "No targets available." : ("Applied to eligible lobby players. Last result: " + actionResult.Message)); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.SendToOwner(command, playerEntry, args)); } } } private void Broadcast(NetCommand command, object[] args) { if (_targetAll) { IList entries = _plugin.Players.Entries; for (int i = 0; i < entries.Count; i++) { _plugin.Network.SendToAll(command, entries[i].ActorNumber, args); } Say("Broadcast for all lobby players."); } else { PlayerEntry playerEntry = Target(); if (playerEntry == null) { Say("No target available."); } else { Say(_plugin.Network.SendToAll(command, playerEntry.ActorNumber, args)); } } } private PlayerEntry Target() { IList entries = _plugin.Players.Entries; if (entries.Count == 0) { return null; } if (_targetIndex >= entries.Count) { _targetIndex = 0; } return entries[_targetIndex]; } private string CurrentTargetName() { if (_targetAll) { return "Everyone"; } PlayerEntry playerEntry = Target(); if (playerEntry != null) { return _plugin.PlayerPreferences.DisplayName(playerEntry) + (playerEntry.IsLocal ? " (You)" : ""); } return "No players"; } private void CycleTarget() { _targetAll = false; if (_plugin.Players.Entries.Count > 0) { _targetIndex = (_targetIndex + 1) % _plugin.Players.Entries.Count; } } private void SelectRandomTarget() { PlayerEntry playerEntry = _plugin.Players.Random(_plugin.Settings.ExcludeSelf.Value); if (playerEntry == null) { return; } _targetAll = false; for (int i = 0; i < _plugin.Players.Entries.Count; i++) { if (_plugin.Players.Entries[i].ActorNumber == playerEntry.ActorNumber) { _targetIndex = i; break; } } } private PlayerEntry PickPartner(PlayerEntry first) { IList entries = _plugin.Players.Entries; if (entries.Count < 2) { return null; } for (int i = 1; i <= entries.Count; i++) { PlayerEntry playerEntry = entries[(_targetIndex + i) % entries.Count]; if (first == null || playerEntry.ActorNumber != first.ActorNumber) { return playerEntry; } } return null; } private PlayerEntry PickRandomPartner(PlayerEntry first) { IList entries = _plugin.Players.Entries; if (first == null || entries.Count < 2) { return null; } List list = new List(); for (int i = 0; i < entries.Count; i++) { if (entries[i] != null && (Object)(object)entries[i].Character != (Object)null && entries[i].ActorNumber != first.ActorNumber) { list.Add(entries[i]); } } if (list.Count != 0) { return list[Random.Range(0, list.Count)]; } return null; } private List FilteredItems() { List list = new List(); IList items = _plugin.Actions.Items; for (int i = 0; i < items.Count; i++) { if (string.IsNullOrEmpty(_itemSearch) || ((Object)items[i]).name.IndexOf(_itemSearch, StringComparison.OrdinalIgnoreCase) >= 0) { list.Add(items[i]); } } return list; } private string CurrentItemName() { List list = FilteredItems(); if (list.Count == 0) { return "No matching runtime items"; } if (_itemIndex >= list.Count) { _itemIndex = 0; } return ((Object)list[_itemIndex]).name; } private void CycleItem() { List list = FilteredItems(); if (list.Count > 0) { _itemIndex = (_itemIndex + 1) % list.Count; } } private void SelectItemContaining(string token) { IList items = _plugin.Actions.Items; for (int i = 0; i < items.Count; i++) { if (((Object)items[i]).name.IndexOf(token, StringComparison.OrdinalIgnoreCase) >= 0) { _itemIndex = i; Say("Selected " + ((Object)items[i]).name + "."); return; } } Say(token + " is not loaded in the runtime item catalog."); } private string CurrentSoundName() { IList clips = _plugin.Audio.Clips; if (clips.Count == 0) { return "No runtime clips"; } if (_soundIndex >= clips.Count) { _soundIndex = 0; } return ((Object)clips[_soundIndex]).name; } private void CycleSound() { if (_plugin.Audio.Clips.Count > 0) { _soundIndex = (_soundIndex + 1) % _plugin.Audio.Clips.Count; } } private void Say(ActionResult result) { Say(result.Message); } private void Say(string text) { _message = text; _messageUntil = Time.unscaledTime + 6f; } private string SubtitleForTab() { string[] array = new string[16] { "Session overview, capabilities, and emergency cleanup.", "Target, manipulate, and mess with players in your lobby.", "Host-authorized genuine enemy ambushes with strict tracking.", "Harmless visual decoys, fake enemies, and ping placement.", "Runtime-discovered 3D sound cues and voice capability status.", "Cosmetic confusion without identity impersonation.", "One-click presets, consent-based lobby sync, and safe recovery diagnostics.", "Environmental hazards separated from direct statuses.", "Bounded randomized events with compatible-client validation.", "Build, run, score, and share complete custom expedition scenarios.", "Readiness, compatibility, persistent friend preferences, and recovery.", "Interface, accessibility, safety limits, and diagnostics.", "Predict climbs, audit party supplies, and diagnose conflicting shortcuts.", "Toggle built-ins and safely edit loaded BepInEx mod settings.", "Search, preview, favorite, give, or place runtime-discovered PEAK items.", "Scout navigation plus customizable through-wall outlines, labels, and tracers." }; return array[_tab]; } private string HeadingForTab() { if (_tab != 1) { return _tabNames[_tab].ToUpperInvariant(); } return "PLAYER CONTROLS"; } private string FormatDirectorTime(float seconds) { seconds = Mathf.Max(0f, seconds); return Mathf.FloorToInt(seconds / 60f).ToString("00") + ":" + Mathf.FloorToInt(seconds % 60f).ToString("00"); } private void EmergencyReset() { for (int i = 0; i < _plugin.Players.Entries.Count; i++) { _plugin.Network.SendToAll(NetCommand.Reset, _plugin.Players.Entries[i].ActorNumber, new object[0]); } if (_plugin.Players.Local != null) { _plugin.Network.SendToAll(NetCommand.ClearMirages, _plugin.Players.Local.ActorNumber, new object[0]); } if (_plugin.Director != null) { _plugin.Director.Stop(cleanup: true); } _plugin.Reset.ResetAll(); Say("Cleanup and restoration completed on compatible clients."); } private void EnsurePreferenceEditor(PlayerEntry entry) { if (entry != null && _preferenceSteamId != entry.SteamUserId) { LoadPreferenceEditor(entry); } } private void LoadPreferenceEditor(PlayerEntry entry) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) PlayerPreference playerPreference = _plugin.PlayerPreferences.Get(entry); _preferenceSteamId = playerPreference.SteamId; _preferenceAlias = playerPreference.Alias; _preferenceVolume = playerPreference.VoiceVolume; _preferenceMuted = playerPreference.Muted; _preferenceExcluded = playerPreference.ExcludeFromRandom; _preferenceColor = playerPreference.Color; } private ActionResult SavePreference(PlayerEntry entry) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) PlayerPreference playerPreference = new PlayerPreference(); playerPreference.SteamId = entry.SteamUserId; playerPreference.Alias = _preferenceAlias; playerPreference.VoiceVolume = _preferenceVolume; playerPreference.Muted = _preferenceMuted; playerPreference.ExcludeFromRandom = _preferenceExcluded; playerPreference.Color = _preferenceColor; PlayerPreference value = playerPreference; ActionResult actionResult = _plugin.PlayerPreferences.Save(entry, value); if (actionResult.Success) { LoadPreferenceEditor(entry); } return actionResult; } private void CycleTextScale() { float value = _plugin.Settings.TextScale.Value; _plugin.Settings.TextScale.Value = ((value < 0.9f) ? 1f : ((value < 1.05f) ? 1.15f : ((value < 1.2f) ? 1.3f : 0.85f))); } private void ApplyPreset(string name) { Say(_plugin.Profiles.ApplyPreset(name)); _profileName = name; _profileCode = _plugin.Profiles.SavedCode; } private void EspToggle(string label, EspCategory category) { bool flag = category switch { EspCategory.Zombie => _plugin.ScoutEsp.ZombiesEnabled, EspCategory.Luggage => _plugin.ScoutEsp.LuggageEnabled, EspCategory.Scout => _plugin.ScoutEsp.ScoutsEnabled, _ => _plugin.ScoutEsp.ScoutmastersEnabled, }; if (AnimatedButton(label + ": " + (flag ? "ON" : "OFF"), flag ? _success : _button, GUILayout.Height(30f))) { flag = !flag; switch (category) { case EspCategory.Scout: _plugin.ScoutEsp.ScoutsEnabled = flag; break; case EspCategory.Luggage: _plugin.ScoutEsp.LuggageEnabled = flag; break; case EspCategory.Zombie: _plugin.ScoutEsp.ZombiesEnabled = flag; break; default: _plugin.ScoutEsp.ScoutmastersEnabled = flag; break; } Say(label + " ESP " + (flag ? "enabled." : "disabled.")); } } private void EspColorEditor(string label, EspCategory category) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(226f) }); Color color = _plugin.ScoutEsp.GetColor(category); GUILayout.Label(label + " #" + ColorUtility.ToHtmlStringRGB(color), _label, (GUILayoutOption[])(object)new GUILayoutOption[0]); Rect rect = GUILayoutUtility.GetRect(210f, 12f); DrawPanel(rect, color, new Color(1f, 1f, 1f, 0.55f), 1f); GUILayout.Label("Red", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); color.r = GUILayout.HorizontalSlider(color.r, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Green", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); color.g = GUILayout.HorizontalSlider(color.g, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); GUILayout.Label("Blue", _small, (GUILayoutOption[])(object)new GUILayoutOption[0]); color.b = GUILayout.HorizontalSlider(color.b, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[0]); _plugin.ScoutEsp.SetColor(category, color); GUILayout.EndVertical(); } private string TextField(string value, GUIStyle style, params GUILayoutOption[] options) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) Rect rect = GUILayoutUtility.GetRect(new GUIContent(value ?? string.Empty), style, options); string nextControlName = "PTM.Text." + _textFieldIndex++; GUI.SetNextControlName(nextControlName); string result = GUI.TextField(rect, value ?? string.Empty, style); if ((int)Event.current.type == 0 && ((Rect)(ref rect)).Contains(Event.current.mousePosition)) { _textFieldClicked = true; } return result; } private void UpdateTextFocus() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type == 0 && !_textFieldClicked) { GUI.FocusControl((string)null); } string nameOfFocusedControl = GUI.GetNameOfFocusedControl(); _isTyping = !string.IsNullOrEmpty(nameOfFocusedControl) && nameOfFocusedControl.StartsWith("PTM.Text.", StringComparison.Ordinal); } private void EnsureStyles() { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0143: 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) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0271: 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_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Expected O, but got Unknown //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp(_plugin.Settings.TextScale.Value, 0.85f, 1.3f); bool value = _plugin.Settings.HighContrast.Value; int revision = _plugin.UiFonts.Revision; if (!((Object)(object)_pixel != (Object)null) || _title == null || _nav == null || _button == null || _danger == null || _success == null || !(Mathf.Abs(num - _styledTextScale) < 0.001f) || value != _styledHighContrast || revision != _styledFontRevision) { ResetVisualAssets(); _pixel = new Texture2D(1, 1); ((Object)_pixel).name = "PTM_UI_PIXEL"; ((Object)_pixel).hideFlags = (HideFlags)61; _pixel.SetPixel(0, 0, Color.white); _pixel.Apply(); _styledTextScale = num; _styledHighContrast = value; _styledFontRevision = revision; Color color = (value ? new Color(0.86f, 0.91f, 0.9f) : new Color(0.58f, 0.67f, 0.67f)); Color val = (Color)(value ? Color.white : new Color(0.9f, 0.94f, 0.93f)); _logo = Style(Scaled(25), (FontStyle)1, Color.white, (TextAnchor)3, UiFontManager.DisplayFont); _title = Style(Scaled(31), (FontStyle)1, Color.white, (TextAnchor)3, UiFontManager.DisplayFont); _subtitle = Style(Scaled(13), (FontStyle)0, color, (TextAnchor)3, UiFontManager.BodyFont); _label = Style(Scaled(14), (FontStyle)0, val, (TextAnchor)3, UiFontManager.DisplayFont); _small = Style(Scaled(12), (FontStyle)0, color, (TextAnchor)3, UiFontManager.BodyFont); _cardTitle = Style(Scaled(18), (FontStyle)1, Color.white, (TextAnchor)3, UiFontManager.DisplayFont); _badge = Style(Scaled(11), (FontStyle)1, (Color)(value ? Color.white : new Color(0.72f, 0.78f, 0.76f)), (TextAnchor)3, UiFontManager.BodyFont); _nav = ButtonStyle(Scaled(15), (Color)(value ? Color.white : new Color(0.65f, 0.72f, 0.71f)), new Color(0.025f, 0.035f, 0.038f, 1f)); _nav.alignment = (TextAnchor)3; _nav.padding = new RectOffset(18, 8, 0, 0); _navSelected = ButtonStyle(Scaled(15), Color.white, new Color(0.08f, 0.28f, 0.28f, 0.98f)); _navSelected.alignment = (TextAnchor)3; _navSelected.padding = new RectOffset(18, 8, 0, 0); _button = ButtonStyle(Scaled(13), val, new Color(0.105f, 0.135f, 0.14f, 1f)); _danger = ButtonStyle(Scaled(13), Color.white, new Color(value ? 0.72f : 0.55f, 0.16f, 0.12f, 1f)); _success = ButtonStyle(Scaled(13), Color.white, new Color(0.08f, value ? 0.55f : 0.38f, 0.34f, 1f)); _disabled = ButtonStyle(Scaled(13), new Color(0.4f, 0.46f, 0.45f), new Color(0.065f, 0.08f, 0.082f, 1f)); } } private int Scaled(int value) { return Mathf.RoundToInt((float)value * Mathf.Clamp(_plugin.Settings.TextScale.Value, 0.85f, 1.3f)); } private GUIStyle Style(int size, FontStyle font, Color color, TextAnchor align, Font typeface) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) GUIStyle val = new GUIStyle(GUI.skin.label); val.font = typeface; val.fontSize = size; val.fontStyle = font; val.normal.textColor = color; val.alignment = align; val.wordWrap = true; return val; } private GUIStyle ButtonStyle(int size, Color textColor, Color bg) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.button); val.font = UiFontManager.DisplayFont; val.fontSize = size; val.fontStyle = (FontStyle)1; val.normal.textColor = textColor; val.hover.textColor = Color.white; val.active.textColor = Color.white; val.normal.background = Tint(bg); val.hover.background = Tint(new Color(Mathf.Min(1f, bg.r + 0.09f), Mathf.Min(1f, bg.g + 0.16f), Mathf.Min(1f, bg.b + 0.15f), bg.a)); val.active.background = Tint(new Color(Mathf.Min(1f, bg.r + 0.16f), Mathf.Min(1f, bg.g + 0.22f), Mathf.Min(1f, bg.b + 0.2f), bg.a)); val.padding = new RectOffset(10, 10, 6, 6); return val; } private bool AnimatedButton(string text, GUIStyle style, params GUILayoutOption[] options) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //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_000f: Unknown result type (might be due to invalid IL or missing references) Rect rect = GUILayoutUtility.GetRect(new GUIContent(text), style, options); return AnimatedButton(rect, text, style); } private bool AnimatedButton(Rect rect, string text, GUIStyle style) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0220: 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_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) string key = _tab + "|" + text + "|" + Mathf.RoundToInt(((Rect)(ref rect)).x) + "|" + Mathf.RoundToInt(((Rect)(ref rect)).y); _buttonHover.TryGetValue(key, out var value); bool flag = ((Rect)(ref rect)).Contains(Event.current.mousePosition) && GUI.enabled; value = Mathf.MoveTowards(value, flag ? 1f : 0f, Time.unscaledDeltaTime * 9f); _buttonHover[key] = value; _buttonPulseUntil.TryGetValue(key, out var value2); float num = (_plugin.Settings.ReduceFlashingEffects.Value ? 0f : ((value2 > Time.unscaledTime) ? Mathf.Clamp01((value2 - Time.unscaledTime) / 0.16f) : 0f)); float num2 = Mathf.Max(value, num); if (num2 > 0.01f) { float num3 = 1f + num2 * 3f; DrawPanel(new Rect(((Rect)(ref rect)).x - num3, ((Rect)(ref rect)).y - num3, ((Rect)(ref rect)).width + num3 * 2f, ((Rect)(ref rect)).height + num3 * 2f), new Color(0.12f, 0.48f, 0.45f, 0.1f * num2), new Color(0.31f, 0.92f, 0.85f, 0.75f * num2), 1f); } Color val = ((!GUI.enabled) ? new Color(0.18f, 0.22f, 0.22f, 0.9f) : ((style == _danger) ? new Color(0.72f, 0.28f, 0.22f, 0.95f) : ((style == _success || style == _navSelected) ? new Color(0.25f, 0.72f, 0.67f, 0.95f) : new Color(0.25f, 0.36f, 0.37f, 0.95f)))); if (flag) { val = Color.Lerp(val, new Color(0.42f, 1f, 0.91f, 1f), 0.72f); } Outline(rect, val, 1f); Rect val2 = rect; if (num > 0f) { float num4 = Mathf.Sin((1f - num) * (float)Math.PI) * 1.5f; ((Rect)(ref val2))..ctor(((Rect)(ref rect)).x + num4, ((Rect)(ref rect)).y + num4, ((Rect)(ref rect)).width - num4 * 2f, ((Rect)(ref rect)).height - num4 * 2f); } bool flag2 = GUI.Button(val2, text, style); if (flag2) { _buttonPulseUntil[key] = Time.unscaledTime + 0.16f; GUI.FocusControl((string)null); _isTyping = false; if (_plugin.Audio != null) { _plugin.Audio.PlayMenuClick(); } } return flag2; } private Texture2D Tint(Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_001e: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(1, 1); ((Object)val).name = "PTM_UI_STYLE"; ((Object)val).hideFlags = (HideFlags)61; val.SetPixel(0, 0, color); val.Apply(); _styleTextures.Add(val); return val; } private void DrawPanel(Rect rect, Color fill, Color border, float width) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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_0042: Unknown result type (might be due to invalid IL or missing references) DrawRect(rect, border); DrawRect(new Rect(((Rect)(ref rect)).x + width, ((Rect)(ref rect)).y + width, ((Rect)(ref rect)).width - width * 2f, ((Rect)(ref rect)).height - width * 2f), fill); } private void Line(Rect rect, Color color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) DrawRect(rect, color); } private void Outline(Rect rect, Color color, float width) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) DrawRect(new Rect(((Rect)(ref rect)).x - width, ((Rect)(ref rect)).y - width, ((Rect)(ref rect)).width + width * 2f, width), color); DrawRect(new Rect(((Rect)(ref rect)).x - width, ((Rect)(ref rect)).y + ((Rect)(ref rect)).height, ((Rect)(ref rect)).width + width * 2f, width), color); DrawRect(new Rect(((Rect)(ref rect)).x - width, ((Rect)(ref rect)).y, width, ((Rect)(ref rect)).height), color); DrawRect(new Rect(((Rect)(ref rect)).x + ((Rect)(ref rect)).width, ((Rect)(ref rect)).y, width, ((Rect)(ref rect)).height), color); } private void DrawRect(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)_pixel); GUI.color = color2; } }