using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.Rendering; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MechGaming")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.5.2.0")] [assembly: AssemblyInformationalVersion("1.5.2")] [assembly: AssemblyProduct("GodCommands")] [assembly: AssemblyTitle("GodCommands")] [assembly: AssemblyVersion("1.5.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MechGaming.REPO.GodCommands { internal static class HotkeyInput { private const int KeyDownMask = 32768; private const float TextInputScanInterval = 0.15f; private static readonly Dictionary PreviousStates = new Dictionary(); private static readonly Type? UnityInputFieldType = Type.GetType("UnityEngine.UI.InputField, UnityEngine.UI"); private static readonly Type? TmpInputFieldType = Type.GetType("TMPro.TMP_InputField, Unity.TextMeshPro"); private static int _currentProcessId; private static float _nextTextInputScanTime; private static bool _cachedNoTextInputActive = true; private static int CurrentProcessId { get { if (_currentProcessId == 0) { _currentProcessId = Process.GetCurrentProcess().Id; } return _currentProcessId; } } internal static bool GetKeyDown(KeyCode key) { //IL_0000: 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_0017: 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) bool flag = GetUnityKeyDown(key) || GetWindowsKey(key); bool value; bool flag2 = PreviousStates.TryGetValue(key, out value) && value; PreviousStates[key] = flag; if (flag) { return !flag2; } return false; } internal static bool GetKey(KeyCode key) { //IL_0000: 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) if (!GetUnityKey(key)) { return GetWindowsKey(key); } return true; } internal static bool GetMouseButton(int button) { if (!GetUnityMouseButton(button)) { return GetWindowsMouseButton(button); } return true; } internal static bool NoTextInputActive(Func gameCheck) { try { if (gameCheck()) { _cachedNoTextInputActive = true; return true; } } catch { } if (Time.unscaledTime < _nextTextInputScanTime) { return _cachedNoTextInputActive; } _nextTextInputScanTime = Time.unscaledTime + 0.15f; _cachedNoTextInputActive = !AnyFocusedTextInput(); return _cachedNoTextInputActive; } private static bool GetUnityKeyDown(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) try { return Input.GetKeyDown(key); } catch { return false; } } private static bool GetUnityKey(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) try { return Input.GetKey(key); } catch { return false; } } private static bool GetUnityMouseButton(int button) { try { return Input.GetMouseButton(button); } catch { return false; } } private static bool GetWindowsKey(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) int num = ToVirtualKey(key); if (num != 0 && IsForegroundProcess()) { return IsVirtualKeyDown(num); } return false; } private static bool GetWindowsMouseButton(int button) { int num = button switch { 0 => 1, 1 => 2, 2 => 4, _ => 0, }; if (num != 0 && IsForegroundProcess()) { return IsVirtualKeyDown(num); } return false; } private static bool IsVirtualKeyDown(int virtualKey) { try { return (GetAsyncKeyState(virtualKey) & 0x8000) != 0; } catch { return false; } } private static bool IsForegroundProcess() { try { IntPtr foregroundWindow = GetForegroundWindow(); if (foregroundWindow == IntPtr.Zero) { return false; } GetWindowThreadProcessId(foregroundWindow, out var processId); return processId == CurrentProcessId; } catch { return false; } } private static int ToVirtualKey(KeyCode key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_000c: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected I4, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_001e: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Invalid comparison between Unknown and I4 //IL_0036: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown //IL_0094: 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_00c4: Expected I4, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Invalid comparison between Unknown and I4 //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Invalid comparison between Unknown and I4 //IL_00c4: 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_00e8: Expected I4, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Invalid comparison between Unknown and I4 //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_00e8: 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_0100: Expected I4, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Invalid comparison between Unknown and I4 if ((int)key >= 97 && (int)key <= 122) { return 65 + (key - 97); } if ((int)key >= 48 && (int)key <= 57) { return 48 + (key - 48); } if ((int)key >= 282 && (int)key <= 678) { return 112 + (key - 282); } if ((int)key <= 32) { if ((int)key <= 9) { if ((int)key == 8) { return 8; } if ((int)key == 9) { return 9; } } else { if ((int)key == 13) { return 13; } if ((int)key == 27) { return 27; } if ((int)key == 32) { return 32; } } } else if ((int)key <= 127) { if ((int)key == 47) { return 191; } if ((int)key == 127) { return 46; } } else { switch (key - 273) { case 7: return 33; case 8: return 34; case 6: return 35; case 5: return 36; case 3: return 37; case 0: return 38; case 2: return 39; case 1: return 40; case 4: return 45; } switch (key - 303) { case 1: return 160; case 0: return 161; case 3: return 162; case 2: return 163; case 5: return 164; case 4: return 165; } switch (key - 323) { case 0: return 1; case 1: return 2; case 2: return 4; } } return 0; } private static bool AnyFocusedTextInput() { if (!TypeHasFocusedInput(UnityInputFieldType)) { return TypeHasFocusedInput(TmpInputFieldType); } return true; } private static bool TypeHasFocusedInput(Type? inputType) { if (inputType == null) { return false; } try { Object[] array = Resources.FindObjectsOfTypeAll(inputType); for (int i = 0; i < array.Length; i++) { if (IsFocusedInput(array[i])) { return true; } } } catch { return false; } return false; } private static bool IsFocusedInput(Object input) { Component val = (Component)(object)((input is Component) ? input : null); if (val == null || !val.gameObject.activeInHierarchy) { return false; } Behaviour val2 = (Behaviour)(object)((val is Behaviour) ? val : null); if (val2 != null && !val2.enabled) { return false; } PropertyInfo property = ((object)input).GetType().GetProperty("isFocused", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.PropertyType == typeof(bool)) { try { return (bool)property.GetValue(input, null); } catch { return false; } } return false; } [DllImport("user32.dll")] private static extern short GetAsyncKeyState(int virtualKey); [DllImport("user32.dll")] private static extern IntPtr GetForegroundWindow(); [DllImport("user32.dll")] private static extern uint GetWindowThreadProcessId(IntPtr windowHandle, out uint processId); } [BepInPlugin("MechGaming.REPO.GodCommands", "GodCommands", "1.5.2")] public sealed class Plugin : BaseUnityPlugin { private static class GameFields { internal static readonly FieldInfo ChatMessage = AccessTools.Field(typeof(ChatManager), "chatMessage"); internal static readonly FieldInfo AssetManagerMainCamera = AccessTools.Field(typeof(AssetManager), "mainCamera"); internal static readonly FieldInfo CosmeticPhysGrabObject = AccessTools.Field(typeof(CosmeticWorldObject), "physGrabObject"); internal static readonly FieldInfo EnemyEnemyParent = AccessTools.Field(typeof(Enemy), "EnemyParent"); internal static readonly FieldInfo EnemyHasHealth = AccessTools.Field(typeof(Enemy), "HasHealth"); internal static readonly FieldInfo EnemyHealth = AccessTools.Field(typeof(Enemy), "Health"); internal static readonly FieldInfo EnemyHealthDead = AccessTools.Field(typeof(EnemyHealth), "dead"); internal static readonly FieldInfo EnemyHealthDeadImpulse = AccessTools.Field(typeof(EnemyHealth), "deadImpulse"); internal static readonly FieldInfo EnemyParentCurrentRooms = AccessTools.Field(typeof(EnemyParent), "currentRooms"); internal static readonly FieldInfo EnemyParentDespawnedTimer = AccessTools.Field(typeof(EnemyParent), "DespawnedTimer"); internal static readonly FieldInfo EnemyParentEnemy = AccessTools.Field(typeof(EnemyParent), "Enemy"); internal static readonly FieldInfo EnemyParentSpawned = AccessTools.Field(typeof(EnemyParent), "Spawned"); internal static readonly FieldInfo EnemyPlayerDistanceClosest = AccessTools.Field(typeof(EnemyPlayerDistance), "PlayerDistanceClosest"); internal static readonly FieldInfo EnemyPlayerDistanceLocal = AccessTools.Field(typeof(EnemyPlayerDistance), "PlayerDistanceLocal"); internal static readonly FieldInfo EnemyPlayerRoomSameAny = AccessTools.Field(typeof(EnemyPlayerRoom), "SameAny"); internal static readonly FieldInfo EnemyPlayerRoomSameLocal = AccessTools.Field(typeof(EnemyPlayerRoom), "SameLocal"); internal static readonly FieldInfo EnemyTargetPlayerAvatar = AccessTools.Field(typeof(Enemy), "TargetPlayerAvatar"); internal static readonly FieldInfo EnemyTargetPlayerViewID = AccessTools.Field(typeof(Enemy), "TargetPlayerViewID"); internal static readonly FieldInfo ExtractionCurrentState = AccessTools.Field(typeof(ExtractionPoint), "currentState"); internal static readonly FieldInfo ExtractionSafetySpawn = AccessTools.Field(typeof(ExtractionPoint), "safetySpawn"); internal static readonly FieldInfo ImpactDetectorIsIndestructible = AccessTools.Field(typeof(PhysGrabObjectImpactDetector), "isIndestructible"); internal static readonly FieldInfo ItemAttributesInstanceName = AccessTools.Field(typeof(ItemAttributes), "instanceName"); internal static readonly FieldInfo ItemAttributesAssetName = AccessTools.Field(typeof(ItemAttributes), "itemAssetName"); internal static readonly FieldInfo ItemAttributesItemName = AccessTools.Field(typeof(ItemAttributes), "itemName"); internal static readonly FieldInfo ItemAttributesPromptName = AccessTools.Field(typeof(ItemAttributes), "promptName"); internal static readonly FieldInfo ItemBatteryBatteryLifeCountBars = AccessTools.Field(typeof(ItemBattery), "batteryLifeCountBars"); internal static readonly FieldInfo ItemBatteryBatteryLifeCountBarsPrev = AccessTools.Field(typeof(ItemBattery), "batteryLifeCountBarsPrev"); internal static readonly FieldInfo ItemBatteryBatteryLifeInt = AccessTools.Field(typeof(ItemBattery), "batteryLifeInt"); internal static readonly FieldInfo ItemBatteryBatteryLifePrev = AccessTools.Field(typeof(ItemBattery), "batteryLifePrev"); internal static readonly FieldInfo ItemBatteryBatteryVisualLogic = AccessTools.Field(typeof(ItemBattery), "batteryVisualLogic"); internal static readonly FieldInfo ItemBatteryBatteryColorMedium = AccessTools.Field(typeof(ItemBattery), "batteryColorMedium"); internal static readonly FieldInfo ItemBatteryCurrentBars = AccessTools.Field(typeof(ItemBattery), "currentBars"); internal static readonly FieldInfo ItemBatteryDrainRate = AccessTools.Field(typeof(ItemBattery), "drainRate"); internal static readonly FieldInfo ItemBatteryDrainTimer = AccessTools.Field(typeof(ItemBattery), "drainTimer"); internal static readonly FieldInfo ItemBatteryItemEquippable = AccessTools.Field(typeof(ItemBattery), "itemEquippable"); internal static readonly FieldInfo ItemBatteryItemAttributes = AccessTools.Field(typeof(ItemBattery), "itemAttributes"); internal static readonly FieldInfo ItemBatteryPhysGrabObject = AccessTools.Field(typeof(ItemBattery), "physGrabObject"); internal static readonly FieldInfo ItemBatteryShowBattery = AccessTools.Field(typeof(ItemBattery), "showBattery"); internal static readonly FieldInfo ItemBatteryShowTimer = AccessTools.Field(typeof(ItemBattery), "showTimer"); internal static readonly MethodInfo ItemBatteryBatteryUpdateBars = AccessTools.Method(typeof(ItemBattery), "BatteryUpdateBars", (Type[])null, (Type[])null); internal static readonly FieldInfo ItemEquippableIsEquipped = AccessTools.Field(typeof(ItemEquippable), "isEquipped"); internal static readonly FieldInfo InventorySpots = AccessTools.Field(typeof(Inventory), "inventorySpots"); internal static readonly FieldInfo InventorySpotBatteryVisualLogic = AccessTools.Field(typeof(InventorySpot), "batteryVisualLogic"); internal static readonly FieldInfo InventorySpotCurrentItem = AccessTools.Field(typeof(InventorySpot), "k__BackingField"); internal static readonly FieldInfo BatteryVisualBars = AccessTools.Field(typeof(BatteryVisualLogic), "bars"); internal static readonly FieldInfo BatteryVisualCurrentBars = AccessTools.Field(typeof(BatteryVisualLogic), "currentBars"); internal static readonly FieldInfo BatteryVisualIsCharging = AccessTools.Field(typeof(BatteryVisualLogic), "batteryIsCharging"); internal static readonly FieldInfo BatteryVisualIsDraining = AccessTools.Field(typeof(BatteryVisualLogic), "batteryIsDraining"); internal static readonly FieldInfo BatteryVisualIsOutWarning = AccessTools.Field(typeof(BatteryVisualLogic), "batteryIsOutWarning"); internal static readonly FieldInfo BatteryVisualChargeNeeded = AccessTools.Field(typeof(BatteryVisualLogic), "batteryChargeNeeded"); internal static readonly FieldInfo BatteryVisualSmallDeductionFlashing = AccessTools.Field(typeof(BatteryVisualLogic), "smallDeductionFlashing"); internal static readonly FieldInfo MapCustomEntity = AccessTools.Field(typeof(MapCustom), "mapCustomEntity"); internal static readonly FieldInfo PlayerAvatarIsLocal = AccessTools.Field(typeof(PlayerAvatar), "isLocal"); internal static readonly FieldInfo PlayerAvatarRb = AccessTools.Field(typeof(PlayerAvatar), "rb"); internal static readonly FieldInfo PlayerHealthGodMode = AccessTools.Field(typeof(PlayerHealth), "godMode"); internal static readonly FieldInfo PlayerHealthHealth = AccessTools.Field(typeof(PlayerHealth), "health"); internal static readonly FieldInfo PlayerHealthIsMenuAvatar = AccessTools.Field(typeof(PlayerHealth), "isMenuAvatar"); internal static readonly FieldInfo PlayerHealthMaxHealth = AccessTools.Field(typeof(PlayerHealth), "maxHealth"); internal static readonly FieldInfo PhysGrabEnemyRigidbody = AccessTools.Field(typeof(PhysGrabObject), "enemyRigidbody"); internal static readonly FieldInfo PhysGrabImpactDetector = AccessTools.Field(typeof(PhysGrabObject), "impactDetector"); internal static readonly FieldInfo PhysGrabIsCart = AccessTools.Field(typeof(PhysGrabObject), "isCart"); internal static readonly FieldInfo PhysGrabIsEnemy = AccessTools.Field(typeof(PhysGrabObject), "isEnemy"); internal static readonly FieldInfo PhysGrabIsPlayer = AccessTools.Field(typeof(PhysGrabObject), "isPlayer"); internal static readonly FieldInfo PhysGrabIsValuable = AccessTools.Field(typeof(PhysGrabObject), "isValuable"); internal static readonly FieldInfo PhysGrabSpawnTorque = AccessTools.Field(typeof(PhysGrabObject), "spawnTorque"); internal static readonly FieldInfo RoundExtractionPointActive = AccessTools.Field(typeof(RoundDirector), "extractionPointActive"); internal static readonly FieldInfo RoundExtractionPointCurrent = AccessTools.Field(typeof(RoundDirector), "extractionPointCurrent"); internal static readonly FieldInfo ValuableDollarValueCurrent = AccessTools.Field(typeof(ValuableObject), "dollarValueCurrent"); internal static readonly FieldInfo ValuableDollarValueOriginal = AccessTools.Field(typeof(ValuableObject), "dollarValueOriginal"); internal static readonly FieldInfo ValuableDollarValueOverride = AccessTools.Field(typeof(ValuableObject), "dollarValueOverride"); internal static readonly FieldInfo ValuableDollarValueSet = AccessTools.Field(typeof(ValuableObject), "dollarValueSet"); internal static readonly FieldInfo ValuablePhysGrabObject = AccessTools.Field(typeof(ValuableObject), "physGrabObject"); internal static T Get(FieldInfo field, object instance) { if (field == null || instance == null) { return default(T); } object value = field.GetValue(instance); if (value is T) { return (T)value; } return default(T); } internal static void Set(FieldInfo field, object instance, T value) { if (!(field == null) && instance != null) { field.SetValue(instance, value); } } internal static object? Invoke(MethodInfo method, object instance, params object[] args) { if (method == null || instance == null) { return null; } return method.Invoke(instance, args); } } [CompilerGenerated] private sealed class d__268 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private PlayerHealth <>2__current; private int <>l__initialThreadId; private PlayerHealth[] <>7__wrap1; private int <>7__wrap2; PlayerHealth IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__268(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar(); if ((Object)(object)localPlayerAvatar != (Object)null && (Object)(object)localPlayerAvatar.playerHealth != (Object)null) { <>2__current = localPlayerAvatar.playerHealth; <>1__state = 1; return true; } <>7__wrap1 = Object.FindObjectsOfType(); <>7__wrap2 = 0; goto IL_00ba; } case 1: <>1__state = -1; return false; case 2: { <>1__state = -1; goto IL_00ac; } IL_00ac: <>7__wrap2++; goto IL_00ba; IL_00ba: if (<>7__wrap2 < <>7__wrap1.Length) { PlayerHealth val = <>7__wrap1[<>7__wrap2]; if (!((Object)(object)val == (Object)null) && !GameFields.Get(GameFields.PlayerHealthIsMenuAvatar, val)) { <>2__current = val; <>1__state = 2; return true; } goto IL_00ac; } <>7__wrap1 = null; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__268(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } [CompilerGenerated] private sealed class d__158 : IEnumerable, IEnumerable, IEnumerator, IEnumerator, IDisposable { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private IEnumerator<(string Name, int Seconds)> <>7__wrap1; string IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__158(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>7__wrap1 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; List<(string, int)> list = new List<(string, int)>(); foreach (EnemyParent knownEnemy in GetKnownEnemies()) { if (!((Object)(object)knownEnemy == (Object)null) && !IsEnemySpawned(knownEnemy)) { float num = GameFields.Get(GameFields.EnemyParentDespawnedTimer, knownEnemy); if (!(num <= 0.05f)) { list.Add((DescribeEnemy(knownEnemy), Mathf.CeilToInt(num))); } } } <>7__wrap1 = list.OrderBy<(string, int), int>(((string Name, int Seconds) timer) => timer.Seconds).ThenBy<(string, int), string>(((string Name, int Seconds) timer) => timer.Name, StringComparer.OrdinalIgnoreCase).GetEnumerator(); <>1__state = -3; break; } case 1: <>1__state = -3; break; } if (<>7__wrap1.MoveNext()) { (string Name, int Seconds) current2 = <>7__wrap1.Current; string item = current2.Name; int item2 = current2.Seconds; <>2__current = $"{item} - {item2}s"; <>1__state = 1; return true; } <>m__Finally1(); <>7__wrap1 = null; return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; if (<>7__wrap1 != null) { <>7__wrap1.Dispose(); } } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new d__158(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)this).GetEnumerator(); } } public const string PluginGuid = "MechGaming.REPO.GodCommands"; public const string PluginName = "GodCommands"; public const string PluginVersion = "1.5.2"; private const float MonsterMapRefreshInterval = 0.5f; private const float LootRefreshInterval = 1f; private const float LightsRefreshInterval = 1f; private const float GearEnergyRefreshInterval = 0.25f; private const float MessageDuration = 4f; private const int MenuWidth = 1080; private const int MenuHeight = 720; private const int SummonSuggestionLimit = 8; private const int MaxSummonAmount = 50; private const int LaserSwirlSegments = 24; private const float NoclipSpeed = 9f; private const float NoclipFastSpeed = 22f; private const float LaserRange = 75f; private const float LaserDamageInterval = 0.12f; private const string SoloOnlyMessage = "GodCommands only works in SoloPlayer."; private const string CommandInputControlName = "GodCommandsCommandInput"; private Harmony? _harmony; private DebugCommandHandler? _registeredHandler; private ConfigEntry _adminMenuKey; private ConfigEntry _laserDamage; private Dictionary> _actionKeys; private readonly Dictionary _invisibilityRenderers = new Dictionary(); private readonly Dictionary _noclipColliders = new Dictionary(); private readonly Dictionary _noclipRigidbodies = new Dictionary(); private readonly Dictionary _monsterMapMarkers = new Dictionary(); private readonly List _respawnTimerHudLines = new List(); private readonly List _summonables = new List(); private bool _lootIndestructible; private bool _commandWindowOpen; private bool _commandWindowFocusRequested; private bool _adminMenuOpen; private bool _summonCatalogBuilt; private bool _lightsOriginalStored; private bool _storedCursorVisible; private bool _storedCommandCursorVisible; private bool _originalFog; private CursorLockMode _storedCursorLockMode; private CursorLockMode _storedCommandCursorLockMode; private AdminAction? _bindingAction; private Rect _adminMenuRect = new Rect(40f, 40f, 1080f, 720f); private Vector2 _adminMenuScroll; private Vector2 _commandHelpScroll; private Vector2 _summonSuggestionsScroll; private GameObject? _rightClickLaserVisual; private LineRenderer? _rightClickLaserLine; private LineRenderer? _rightClickLaserSwirlA; private LineRenderer? _rightClickLaserSwirlB; private Light? _rightClickLaserLight; private Material? _rightClickLaserMaterial; private GameObject? _lightsObject; private Light? _lightsDirectional; private Sprite? _monsterMarkerSprite; private Texture2D? _monsterMarkerTexture; private AmbientMode _originalAmbientMode; private Color _originalAmbientLight; private Color _originalFogColor; private float _originalAmbientIntensity; private float _originalFogDensity; private float _nextLootRefreshTime; private float _nextInvisibilityRefreshTime; private float _nextLightsRefreshTime; private float _nextGearEnergyRefreshTime; private float _nextLaserDamageTime; private float _nextMonsterMapRefreshTime; private float _nextRespawnHudRefreshTime; private float _statusMessageUntil; private string _statusMessage = string.Empty; private string _commandInput = "/"; private string _giveMoneyText = "1000"; private string _laserDamageText = "100"; private string _summonCatalogStatus = "Summon catalog not indexed yet."; private string _summonCatalogSceneName = string.Empty; private string _summonSearch = string.Empty; private string _summonAmountText = "1"; private int _summonCatalogKnownItemCount; private static readonly KeyCode[] BindableKeys = (from KeyCode key in Enum.GetValues(typeof(KeyCode)) where (int)key > 0 select key).ToArray(); private static readonly Color VanillaBatteryColor = new Color(1f, 0.86f, 0.06f, 1f); private static readonly Color VanillaBatteryBorderColor = new Color(1f, 0.68f, 0.04f, 1f); private static readonly string[] CommandHelpLines = new string[20] { "/kill - kill nearest monster", "/killroom - kill monsters in your room", "/killall - kill all living monsters", "/killclick - toggle click-to-kill", "/infiniteenergy - toggle infinite player energy", "/invis - toggle invisibility", "/invulnerable - toggle invulnerability", "/noclip - toggle noclip", "/showmonsters - toggle monster map dots", "/showrespawntimer - toggle monster respawn HUD", "/unlimitedenergy - toggle gear energy", "/laseronrightclick - toggle right-click laser", "/lightson - toggle bright map lighting", "/spawning - toggle monster spawning", "/indestructableloot - make loot indestructable", "/extractall - move all loot value to extractor", "/tptoextractor - teleport to extractor", "/tptotruck - teleport to truck", "/summonitem [item name] [amount] - spawn an item", "/givemoney [amount] - add money" }; internal static Plugin? Instance { get; private set; } internal static bool InfiniteEnergyEnabled { get; private set; } internal static bool InvisibilityEnabled { get; private set; } internal static bool InvulnerableEnabled { get; private set; } internal static bool KillClickEnabled { get; private set; } internal static bool LaserOnRightClickEnabled { get; private set; } internal static bool LightsOnEnabled { get; private set; } internal static bool NoclipEnabled { get; private set; } internal static bool ShowMonstersEnabled { get; private set; } internal static bool ShowRespawnTimersEnabled { get; private set; } internal static bool SpawningDisabled { get; private set; } internal static bool UnlimitedGearEnergyEnabled { get; private set; } private void Awake() { //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Expected O, but got Unknown Instance = this; _adminMenuKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "AdminMenuKey", (KeyCode)284, "Key used to open the GodCommands admin menu."); _laserDamage = ((BaseUnityPlugin)this).Config.Bind("Laser", "RightClickLaserDamage", 100, "Damage applied by each right-click laser hit tick."); _laserDamageText = Mathf.Clamp(_laserDamage.Value, 1, 999999).ToString(); _actionKeys = new Dictionary> { [AdminAction.InfiniteEnergy] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "InfiniteEnergy", (KeyCode)0, "Optional keybind for toggling infinite energy."), [AdminAction.Invisibility] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "Invisibility", (KeyCode)0, "Optional keybind for toggling invisibility."), [AdminAction.Invulnerable] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "Invulnerable", (KeyCode)0, "Optional keybind for toggling invulnerability."), [AdminAction.KillClick] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "KillClick", (KeyCode)0, "Optional keybind for toggling kill click."), [AdminAction.LaserOnRightClick] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "LaserOnRightClick", (KeyCode)0, "Optional keybind for toggling right-click laser."), [AdminAction.LightsOn] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "LightsOn", (KeyCode)0, "Optional keybind for toggling map lighting."), [AdminAction.Noclip] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "Noclip", (KeyCode)0, "Optional keybind for toggling noclip flight."), [AdminAction.ShowMonsters] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "ShowMonsters", (KeyCode)0, "Optional keybind for toggling monster map markers."), [AdminAction.ShowRespawnTimers] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "ShowRespawnTimers", (KeyCode)0, "Optional keybind for toggling monster respawn timers."), [AdminAction.DisableSpawning] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "DisableSpawning", (KeyCode)0, "Optional keybind for toggling monster spawning."), [AdminAction.IndestructibleLoot] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "IndestructibleLoot", (KeyCode)0, "Optional keybind for enabling indestructable loot."), [AdminAction.UnlimitedGearEnergy] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "UnlimitedGearEnergy", (KeyCode)0, "Optional keybind for toggling unlimited weapon and gear energy."), [AdminAction.GiveMoney] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "GiveMoney", (KeyCode)0, "Optional keybind for giving the amount entered in the admin menu."), [AdminAction.KillNearest] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "KillNearest", (KeyCode)0, "Optional keybind for killing the nearest monster."), [AdminAction.KillRoom] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "KillRoom", (KeyCode)0, "Optional keybind for killing monsters in your current room."), [AdminAction.KillAll] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "KillAll", (KeyCode)0, "Optional keybind for killing every living monster."), [AdminAction.ExtractAll] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "ExtractAll", (KeyCode)0, "Optional keybind for extracting all map loot."), [AdminAction.TeleportToExtractor] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "TeleportToExtractor", (KeyCode)0, "Optional keybind for teleporting to an extractor."), [AdminAction.TeleportToTruck] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "TeleportToTruck", (KeyCode)0, "Optional keybind for teleporting to the truck."), [AdminAction.SummonItem] = ((BaseUnityPlugin)this).Config.Bind("Keybinds", "SummonItem", (KeyCode)0, "Optional keybind for summoning the selected menu item.") }; _harmony = new Harmony("MechGaming.REPO.GodCommands"); _harmony.PatchAll(typeof(Plugin).Assembly); ((BaseUnityPlugin)this).Logger.LogInfo((object)"GodCommands 1.5.2 loaded."); } private void Update() { TryRegisterCommands(); if (!IsSoloPlayer()) { RestoreInvisibilityRenderers(); RestoreNoclipPhysics(); HideMonsterMapMarkers(); DestroyRightClickLaser(); DisableMapLights(); SetCommandWindowOpen(open: false); HandleInput(); return; } HandleInput(); ApplyInfiniteEnergy(); ApplyInvulnerability(); ApplyUnlimitedGearEnergy(); ApplyInvisibility(); ApplyNoclip(); ApplyMonsterMapMarkers(); ApplyMapLights(); UpdateRightClickLaser(); if (_lootIndestructible && Time.unscaledTime >= _nextLootRefreshTime) { ApplyIndestructibleToLoot(); _nextLootRefreshTime = Time.unscaledTime + 1f; } } private void OnDestroy() { SetAdminMenuOpen(open: false); RestoreInvisibilityRenderers(); RestoreNoclipPhysics(); HideMonsterMapMarkers(); DestroyRightClickLaser(); DisableMapLights(); SetCommandWindowOpen(open: false); Harmony? harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } Instance = null; } private void OnGUI() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018d: 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) //IL_01a2: 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_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01f3: Unknown result type (might be due to invalid IL or missing references) DrawKeyboundStatus(); DrawRespawnTimersHud(); if (_commandWindowOpen) { DrawCommandWindow(); } if (_adminMenuOpen) { ((Rect)(ref _adminMenuRect)).width = Mathf.Min(1080f, Mathf.Max(520f, (float)Screen.width - 80f)); ((Rect)(ref _adminMenuRect)).height = Mathf.Min(720f, Mathf.Max(420f, (float)Screen.height - 80f)); ((Rect)(ref _adminMenuRect)).x = Mathf.Clamp(((Rect)(ref _adminMenuRect)).x, 0f, Mathf.Max(0f, (float)Screen.width - ((Rect)(ref _adminMenuRect)).width)); ((Rect)(ref _adminMenuRect)).y = Mathf.Clamp(((Rect)(ref _adminMenuRect)).y, 0f, Mathf.Max(0f, (float)Screen.height - ((Rect)(ref _adminMenuRect)).height)); _adminMenuRect = GUI.Window(((Object)this).GetInstanceID(), _adminMenuRect, new WindowFunction(DrawAdminMenuWindow), "GodCommands Admin"); } if (!(Time.unscaledTime >= _statusMessageUntil) && !string.IsNullOrWhiteSpace(_statusMessage)) { float num = Mathf.Max(12f, ((float)Screen.width - 560f) / 2f); Rect val = new Rect(num, 42f, Mathf.Min(560f, (float)Screen.width - 24f), 46f); GUI.color = new Color(0f, 0f, 0f, 0.68f); GUI.Box(val, GUIContent.none); GUI.color = Color.white; GUIStyle val2 = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 18, fontStyle = (FontStyle)1, wordWrap = true }; val2.normal.textColor = new Color(0.82f, 1f, 0.78f, 1f); GUI.Label(val, _statusMessage, val2); } } private void DrawCommandWindow() { //IL_006d: 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_0082: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Invalid comparison between Unknown and I4 //IL_019e: 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_011a: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Invalid comparison between Unknown and I4 //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Invalid comparison between Unknown and I4 //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Invalid comparison between Unknown and I4 float num = Mathf.Min(880f, (float)Screen.width - 80f); float num2 = Mathf.Min(360f, (float)Screen.height - 120f); Rect val = default(Rect); ((Rect)(ref val))..ctor(((float)Screen.width - num) / 2f, (float)Screen.height - num2 - 46f, num, num2); GUI.color = new Color(0f, 0f, 0f, 0.84f); GUI.Box(val, GUIContent.none); GUI.color = Color.white; GUILayout.BeginArea(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 12f, ((Rect)(ref val)).width - 28f, ((Rect)(ref val)).height - 24f)); GUILayout.Label("GodCommands", Array.Empty()); GUI.SetNextControlName("GodCommandsCommandInput"); _commandInput = GUILayout.TextField(_commandInput, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(30f) }); Event current = Event.current; if ((int)current.type == 4) { KeyCode keyCode = current.keyCode; if (((int)keyCode == 13 || (int)keyCode == 271) ? true : false) { SubmitCommandWindow(); current.Use(); } else if ((int)current.keyCode == 27) { SetCommandWindowOpen(open: false); current.Use(); } } GUILayout.Space(8f); string filter = NormalizeCommandFilter(_commandInput); List list = CommandHelpLines.Where((string line) => string.IsNullOrWhiteSpace(filter) || line.Contains(filter, StringComparison.OrdinalIgnoreCase)).ToList(); _commandHelpScroll = GUILayout.BeginScrollView(_commandHelpScroll, false, true, Array.Empty()); IEnumerable enumerable; if (list.Count <= 0) { IEnumerable commandHelpLines = CommandHelpLines; enumerable = commandHelpLines; } else { IEnumerable commandHelpLines = list; enumerable = commandHelpLines; } foreach (string item in enumerable) { GUILayout.Label(item, Array.Empty()); } GUILayout.EndScrollView(); GUILayout.EndArea(); if (_commandWindowFocusRequested) { GUI.FocusControl("GodCommandsCommandInput"); _commandWindowFocusRequested = false; } } private void SubmitCommandWindow() { string commandInput = _commandInput; SetCommandWindowOpen(open: false); PublishCommandResult(ExecuteLocalCommand(commandInput)); } private void HandleInput() { //IL_00d9: 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_0042: 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_00b4: 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_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_0194: Unknown result type (might be due to invalid IL or missing references) if (_bindingAction.HasValue) { if (HotkeyInput.GetKeyDown((KeyCode)27)) { PublishStatus("keybind cancelled"); _bindingAction = null; return; } KeyCode[] bindableKeys = BindableKeys; for (int i = 0; i < bindableKeys.Length; i++) { KeyCode val = bindableKeys[i]; if (HotkeyInput.GetKeyDown(val) && !((object)(KeyCode)(ref val)).ToString().StartsWith("Mouse", StringComparison.OrdinalIgnoreCase) && !((object)(KeyCode)(ref val)).ToString().StartsWith("Joystick", StringComparison.OrdinalIgnoreCase)) { AdminAction value = _bindingAction.Value; _actionKeys[value].Value = val; _bindingAction = null; PublishStatus($"{GetActionLabel(value)} bound to [{val}]"); break; } } } else if (HotkeyInput.GetKeyDown(_adminMenuKey.Value)) { SetCommandWindowOpen(open: false); SetAdminMenuOpen(!_adminMenuOpen); } else if (_commandWindowOpen) { if (HotkeyInput.GetKeyDown((KeyCode)13) || HotkeyInput.GetKeyDown((KeyCode)271)) { SubmitCommandWindow(); } else if (HotkeyInput.GetKeyDown((KeyCode)27)) { SetCommandWindowOpen(open: false); } } else if (_adminMenuOpen) { if (HotkeyInput.GetKeyDown((KeyCode)27)) { SetAdminMenuOpen(open: false); } } else { if (!NoTextInputActive()) { return; } if (!IsSoloPlayer() || !HotkeyInput.GetKeyDown((KeyCode)47)) { foreach (KeyValuePair> actionKey in _actionKeys) { KeyCode value2 = actionKey.Value.Value; if ((int)value2 != 0 && HotkeyInput.GetKeyDown(value2)) { PublishStatus(ExecuteAction(actionKey.Key)); } } return; } SetCommandWindowOpen(open: true); } } private void HandleSoloBlockedInput() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) if (HotkeyInput.GetKeyDown(_adminMenuKey.Value)) { PublishStatus("GodCommands only works in SoloPlayer."); } } private void ApplyInfiniteEnergy() { if (InfiniteEnergyEnabled && IsSoloPlayer()) { PlayerController instance = PlayerController.instance; if (!((Object)(object)instance == (Object)null)) { instance.EnergyCurrent = Mathf.Max(instance.EnergyCurrent, instance.EnergyStart); } } } private void ApplyInvulnerability() { if (!InvulnerableEnabled || !IsSoloPlayer()) { return; } foreach (PlayerHealth localPlayerHealthObject in GetLocalPlayerHealthObjects()) { SetPlayerHealthInvulnerable(localPlayerHealthObject, invulnerable: true); } } private void ApplyUnlimitedGearEnergy() { if (UnlimitedGearEnergyEnabled && IsSoloPlayer() && !(Time.unscaledTime < _nextGearEnergyRefreshTime)) { ItemBattery[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { FillBattery(array[i]); } _nextGearEnergyRefreshTime = Time.unscaledTime + 0.25f; } } private void ApplyInvisibility() { if (!InvisibilityEnabled || !IsSoloPlayer() || Time.unscaledTime < _nextInvisibilityRefreshTime) { return; } PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar(); if ((Object)(object)localPlayerAvatar != (Object)null) { HideLocalAvatarRenderers(localPlayerAvatar); } EnemyVision[] array = Object.FindObjectsOfType(); foreach (EnemyVision val in array) { try { val.DisableVision(0.4f); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("Could not disable enemy vision: " + ex.Message)); } } EnemyPlayerDistance[] array2 = Object.FindObjectsOfType(); foreach (EnemyPlayerDistance instance in array2) { GameFields.Set(GameFields.EnemyPlayerDistanceLocal, instance, 9999f); GameFields.Set(GameFields.EnemyPlayerDistanceClosest, instance, 9999f); } EnemyPlayerRoom[] array3 = Object.FindObjectsOfType(); foreach (EnemyPlayerRoom instance2 in array3) { GameFields.Set(GameFields.EnemyPlayerRoomSameAny, instance2, value: false); GameFields.Set(GameFields.EnemyPlayerRoomSameLocal, instance2, value: false); } Enemy[] array4 = Object.FindObjectsOfType(); foreach (Enemy val2 in array4) { if (IsLocalPlayer(GameFields.Get(GameFields.EnemyTargetPlayerAvatar, val2))) { GameFields.Set(GameFields.EnemyTargetPlayerAvatar, val2, null); GameFields.Set(GameFields.EnemyTargetPlayerViewID, val2, 0); try { val2.DisableChase(0.4f); } catch (Exception ex2) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("Could not disable enemy chase: " + ex2.Message)); } } } _nextInvisibilityRefreshTime = Time.unscaledTime + 0.2f; } private void ApplyNoclip() { //IL_0069: 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_0090: 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_00ba: 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_00c8: 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_00dd: 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_00e5: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_010d: 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_011a: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0151: 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_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) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_01b2: 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_01bc: Unknown result type (might be due to invalid IL or missing references) if (!NoclipEnabled || !IsSoloPlayer()) { RestoreNoclipPhysics(); return; } PlayerController instance = PlayerController.instance; PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar(); if ((Object)(object)instance == (Object)null || (Object)(object)localPlayerAvatar == (Object)null) { return; } CacheAndDisableNoclipPhysics(instance, localPlayerAvatar); instance.InputDisable(0.1f); instance.AntiGravity(0.2f); Transform cameraTransform = GetCameraTransform(instance); if ((Object)(object)cameraTransform == (Object)null) { return; } Quaternion rotation = Quaternion.Euler(0f, cameraTransform.eulerAngles.y, 0f); ((Component)instance).transform.rotation = rotation; ((Component)localPlayerAvatar).transform.rotation = rotation; ZeroLocalPlayerVelocity(instance, localPlayerAvatar); if (!_adminMenuOpen && !_commandWindowOpen && NoTextInputActive()) { Vector3 val = Vector3.zero; if (HotkeyInput.GetKey((KeyCode)119)) { val += cameraTransform.forward; } if (HotkeyInput.GetKey((KeyCode)115)) { val -= cameraTransform.forward; } if (HotkeyInput.GetKey((KeyCode)100)) { val += cameraTransform.right; } if (HotkeyInput.GetKey((KeyCode)97)) { val -= cameraTransform.right; } if (HotkeyInput.GetKey((KeyCode)32) || HotkeyInput.GetKey((KeyCode)101)) { val += Vector3.up; } if (HotkeyInput.GetKey((KeyCode)306) || HotkeyInput.GetKey((KeyCode)113)) { val -= Vector3.up; } if (!(((Vector3)(ref val)).sqrMagnitude <= 0.0001f)) { float num = ((HotkeyInput.GetKey((KeyCode)304) || HotkeyInput.GetKey((KeyCode)303)) ? 22f : 9f); TeleportLocalPlayer(((Component)localPlayerAvatar).transform.position + ((Vector3)(ref val)).normalized * num * Time.unscaledDeltaTime, rotation); } } } private void ApplyMonsterMapMarkers() { if (!ShowMonstersEnabled || !IsSoloPlayer() || Time.unscaledTime < _nextMonsterMapRefreshTime) { return; } Map instance = Map.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.CustomObject == (Object)null || (Object)(object)instance.OverLayerParent == (Object)null) { return; } HashSet hashSet = new HashSet(); foreach (EnemyParent liveEnemy in GetLiveEnemies()) { int instanceID = ((Object)liveEnemy).GetInstanceID(); hashSet.Add(instanceID); EnsureMonsterMapMarker(instance, liveEnemy, instanceID); } foreach (int item in _monsterMapMarkers.Keys.ToList()) { if (!hashSet.Contains(item)) { RemoveMonsterMapMarker(item); } } _nextMonsterMapRefreshTime = Time.unscaledTime + 0.5f; } private void ApplyMapLights() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (LightsOnEnabled && IsSoloPlayer() && !(Time.unscaledTime < _nextLightsRefreshTime)) { StoreOriginalLighting(); RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = Color.white; RenderSettings.ambientIntensity = 2.4f; RenderSettings.fog = false; EnsureMapLightObject(); _nextLightsRefreshTime = Time.unscaledTime + 1f; } } private void UpdateRightClickLaser() { //IL_0050: 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_0060: 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_006b: 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_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_0081: 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_0084: 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_00a3: 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_00b0: Unknown result type (might be due to invalid IL or missing references) if (!LaserOnRightClickEnabled || !IsSoloPlayer() || _adminMenuOpen || _commandWindowOpen || !NoTextInputActive() || !HotkeyInput.GetMouseButton(1)) { DeactivateRightClickLaser(); return; } Transform cameraTransform = GetCameraTransform(PlayerController.instance); if ((Object)(object)cameraTransform == (Object)null) { DeactivateRightClickLaser(); return; } Vector3 val = cameraTransform.position + cameraTransform.forward * 0.35f; Vector3 end = val + cameraTransform.forward * 75f; RaycastHit hit = default(RaycastHit); bool flag = Physics.Raycast(val, cameraTransform.forward, ref hit, 75f, -5, (QueryTriggerInteraction)1); if (flag) { end = ((RaycastHit)(ref hit)).point; } if (EnsureRightClickLaserVisual()) { DrawRightClickLaser(val, end, flag, hit); } } private void SetAdminMenuOpen(bool open) { //IL_0078: 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_005a: Unknown result type (might be due to invalid IL or missing references) if (_adminMenuOpen != open) { _adminMenuOpen = open; _bindingAction = null; ((BaseUnityPlugin)this).Logger.LogInfo((object)("GodCommands admin menu " + (open ? "opened" : "closed") + ".")); if (open) { _storedCursorVisible = Cursor.visible; _storedCursorLockMode = Cursor.lockState; Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } else { Cursor.visible = _storedCursorVisible; Cursor.lockState = _storedCursorLockMode; } } } private void SetCommandWindowOpen(bool open) { //IL_0055: 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_0037: Unknown result type (might be due to invalid IL or missing references) if (_commandWindowOpen != open) { _commandWindowOpen = open; if (open) { _commandInput = "/"; _commandWindowFocusRequested = true; _storedCommandCursorVisible = Cursor.visible; _storedCommandCursorLockMode = Cursor.lockState; Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } else { Cursor.visible = _storedCommandCursorVisible; Cursor.lockState = _storedCommandCursorLockMode; } } } private void DrawAdminMenuWindow(int windowId) { //IL_0044: 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_0068: 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_025b: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(500f, ((Rect)(ref _adminMenuRect)).width - 24f); float num2 = Mathf.Max(320f, ((Rect)(ref _adminMenuRect)).height - 58f); GUILayout.Space(8f); _adminMenuScroll = GUILayout.BeginScrollView(_adminMenuScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(num), GUILayout.Height(num2) }); try { GUILayout.Label($"Menu key: {_adminMenuKey.Value}", Array.Empty()); GUILayout.Space(6f); GUILayout.Label("Toggles", Array.Empty()); DrawToggleAction(AdminAction.InfiniteEnergy, "Keep player energy full."); DrawToggleAction(AdminAction.Invisibility, "Hide from monsters and block detection."); DrawToggleAction(AdminAction.Invulnerable, "Prevent incoming player damage."); DrawToggleAction(AdminAction.KillClick, "Kill monsters when you click to grab them."); DrawToggleAction(AdminAction.LaserOnRightClick, "Hold right click to fire the wand-style laser."); DrawToggleAction(AdminAction.LightsOn, "Brighten the whole map so it is easy to see."); DrawToggleAction(AdminAction.Noclip, "Fly through walls. Movement follows your camera and keeps map facing correct."); DrawToggleAction(AdminAction.ShowMonsters, "Show living monsters on the map as red dots."); DrawToggleAction(AdminAction.ShowRespawnTimers, "Show monster respawn countdowns on the HUD."); DrawToggleAction(AdminAction.DisableSpawning, "Prevent monsters from spawning."); DrawToggleAction(AdminAction.IndestructibleLoot, "Keep loot from breaking."); DrawToggleAction(AdminAction.UnlimitedGearEnergy, "Keep weapon and gear batteries full."); DrawLaserSettings(); GUILayout.Space(10f); GUILayout.Label("Buttons", Array.Empty()); DrawButtonAction(AdminAction.KillNearest, "Kill the closest monster."); DrawButtonAction(AdminAction.KillRoom, "Kill monsters in your room."); DrawButtonAction(AdminAction.KillAll, "Kill every living monster."); DrawButtonAction(AdminAction.ExtractAll, "Condense map loot at the active extractor."); DrawButtonAction(AdminAction.TeleportToExtractor, "Teleport to the active extractor or nearest unactivated extractor."); DrawButtonAction(AdminAction.TeleportToTruck, "Teleport to the truck safety point."); DrawMoneySection(); GUILayout.Space(10f); DrawSummonSection(); GUILayout.Space(10f); if (_bindingAction.HasValue) { GUILayout.Label("Press a key for " + GetActionLabel(_bindingAction.Value) + ". Escape cancels.", Array.Empty()); } else { GUILayout.Label("Bind buttons assign optional hotkeys. Clear removes a hotkey.", Array.Empty()); } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"GodCommands admin menu draw failed: {arg}"); GUILayout.Label("GodCommands menu hit an error. Check LogOutput.log.", Array.Empty()); } finally { GUILayout.EndScrollView(); } GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _adminMenuRect)).width, 24f)); } private void DrawToggleAction(AdminAction action, string description) { bool flag = IsActionActive(action); GUILayout.BeginVertical(GUI.skin.box, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label(GetActionLabel(action) + ": " + (flag ? "true" : "false"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(430f) }); if (GUILayout.Button(flag ? "Disable" : "Enable", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(96f) })) { PublishStatus(ExecuteAction(action)); } DrawBindControls(action); GUILayout.EndHorizontal(); GUILayout.Label(description, Array.Empty()); GUILayout.EndVertical(); } private void DrawButtonAction(AdminAction action, string description) { GUILayout.BeginVertical(GUI.skin.box, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button(GetActionLabel(action), (GUILayoutOption[])(object)new GUILayoutOption[3] { GUILayout.MinWidth(430f), GUILayout.Height(28f), GUILayout.ExpandWidth(true) })) { PublishStatus(ExecuteAction(action)); } DrawBindControls(action); GUILayout.EndHorizontal(); GUILayout.Label(description, Array.Empty()); GUILayout.EndVertical(); } private void DrawMoneySection() { GUILayout.BeginVertical(GUI.skin.box, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Money Amount ($)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); _giveMoneyText = GUILayout.TextField(_giveMoneyText, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.MinWidth(180f), GUILayout.ExpandWidth(true) }); if (GUILayout.Button("Give Money", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(120f), GUILayout.Height(28f) })) { PublishStatus(GiveMoneyCommand(new string[1] { _giveMoneyText })); } DrawBindControls(AdminAction.GiveMoney); GUILayout.EndHorizontal(); GUILayout.Label("Enter normal dollars; GodCommands converts it to R.E.P.O.'s K currency units.", Array.Empty()); GUILayout.EndVertical(); } private void DrawLaserSettings() { GUILayout.BeginVertical(GUI.skin.box, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Laser Damage", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) }); _laserDamageText = GUILayout.TextField(_laserDamageText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }); if (GUILayout.Button("Apply", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(96f), GUILayout.Height(28f) })) { int laserDamageFromText = GetLaserDamageFromText(updateConfig: true); _laserDamageText = laserDamageFromText.ToString(); PublishStatus($"laser damage set to {laserDamageFromText}"); } GUILayout.EndHorizontal(); GUILayout.Label("Default is 100, matching the clown laser hit damage.", Array.Empty()); GUILayout.EndVertical(); } private int GetLaserDamageFromText(bool updateConfig) { int num = ((_laserDamage != null) ? _laserDamage.Value : 100); if (int.TryParse((_laserDamageText ?? string.Empty).Replace(",", string.Empty).Trim(), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { num = result; } num = Mathf.Clamp(num, 1, 999999); if (updateConfig && _laserDamage != null) { _laserDamage.Value = num; } return num; } private void DrawSummonSection() { //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_017a: 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) TryRefreshSummonCatalog(); GUILayout.Label("Summon Item", Array.Empty()); GUILayout.BeginVertical(GUI.skin.box, Array.Empty()); GUILayout.BeginHorizontal(Array.Empty()); GUILayout.Label("Search", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(72f) }); _summonSearch = GUILayout.TextField(_summonSearch, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.MinWidth(360f), GUILayout.ExpandWidth(true) }); GUILayout.Label("Amount", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); _summonAmountText = GUILayout.TextField(_summonAmountText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(58f) }); if (GUILayout.Button("-", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { SetSummonAmount(GetSummonAmount() - 1); } if (GUILayout.Button("+", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(30f) })) { SetSummonAmount(GetSummonAmount() + 1); } if (GUILayout.Button("Refresh", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(82f) })) { TryRefreshSummonCatalog(force: true); } GUILayout.EndHorizontal(); List list = GetSummonMatches(_summonSearch).Take(8).ToList(); _summonSuggestionsScroll = GUILayout.BeginScrollView(_summonSuggestionsScroll, false, true, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(140f) }); if (list.Count == 0) { GUILayout.Label((_summonables.Count == 0) ? "No summonable items found yet." : "No matching items.", Array.Empty()); } else { foreach (SummonableItem item in list) { if (GUILayout.Button(item.DisplayName, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(26f) })) { _summonSearch = item.DisplayName; } } } GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty()); if (GUILayout.Button("Summon Selected", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(430f), GUILayout.Height(30f) })) { PublishStatus(SummonSelectedItem()); } DrawBindControls(AdminAction.SummonItem); GUILayout.EndHorizontal(); GUILayout.Label($"{_summonables.Count} summonable items indexed. Type to filter, click a result to autofill.", Array.Empty()); GUILayout.Label(_summonCatalogStatus, Array.Empty()); GUILayout.EndVertical(); } private void DrawBindControls(AdminAction action) { //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_002f: 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) KeyCode value = _actionKeys[action].Value; if (GUILayout.Button((_bindingAction == action) ? "..." : (((int)value == 0) ? "Bind" : $"[{value}]"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(82f) })) { _bindingAction = action; PublishStatus("press a key for " + GetActionLabel(action)); } if (GUILayout.Button("Clear", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(62f) })) { _actionKeys[action].Value = (KeyCode)0; if (_bindingAction == action) { _bindingAction = null; } PublishStatus(GetActionLabel(action) + " keybind cleared"); } } private void DrawKeyboundStatus() { //IL_00c3: 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_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_00f7: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_014f: 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_0051: 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_004c: 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_0212: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_01cc: 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) if (!IsSoloPlayer()) { return; } List list = new List(); AdminAction[] array = new AdminAction[20] { AdminAction.InfiniteEnergy, AdminAction.Invisibility, AdminAction.Invulnerable, AdminAction.KillClick, AdminAction.LaserOnRightClick, AdminAction.LightsOn, AdminAction.Noclip, AdminAction.ShowMonsters, AdminAction.ShowRespawnTimers, AdminAction.DisableSpawning, AdminAction.IndestructibleLoot, AdminAction.UnlimitedGearEnergy, AdminAction.GiveMoney, AdminAction.KillNearest, AdminAction.KillRoom, AdminAction.KillAll, AdminAction.ExtractAll, AdminAction.TeleportToExtractor, AdminAction.TeleportToTruck, AdminAction.SummonItem }; foreach (AdminAction adminAction in array) { ConfigEntry value; KeyCode val = (KeyCode)((_actionKeys != null && _actionKeys.TryGetValue(adminAction, out value)) ? ((int)value.Value) : 0); if ((int)val != 0) { string arg = ((!IsToggleAction(adminAction)) ? "READY" : (IsActionActive(adminAction) ? "ENABLED" : "DISABLED")); list.Add($"{GetActionLabel(adminAction)}: {arg} [{val}]"); } } if (list.Count != 0) { GUIStyle val2 = new GUIStyle(GUI.skin.box) { alignment = (TextAnchor)4, fontSize = 16, fontStyle = (FontStyle)1, richText = true, padding = new RectOffset(12, 12, 6, 6) }; val2.normal.textColor = Color.white; float num = 300f; float num2 = 34f; float num3 = Mathf.Max(12f, (float)Screen.width - num - 16f); float num4 = Mathf.Max(12f, (float)Screen.height - num2 * (float)list.Count - 16f); Color backgroundColor = GUI.backgroundColor; for (int j = 0; j < list.Count; j++) { Rect val3 = new Rect(num3, num4 + (float)j * num2, num, 30f); GUI.backgroundColor = (list[j].Contains("ENABLED", StringComparison.Ordinal) ? new Color(0.2f, 0.7f, 0.2f, 0.85f) : (list[j].Contains("READY", StringComparison.Ordinal) ? new Color(0.2f, 0.32f, 0.7f, 0.85f) : new Color(0.7f, 0.2f, 0.2f, 0.85f))); GUI.Box(val3, list[j], val2); } GUI.backgroundColor = backgroundColor; } } private void DrawRespawnTimersHud() { //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_00c3: 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_00ed: 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_0103: 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_0112: 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_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_012b: Expected O, but got Unknown //IL_0146: 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) if (!ShowRespawnTimersEnabled || !IsSoloPlayer()) { return; } if (Time.unscaledTime >= _nextRespawnHudRefreshTime) { _respawnTimerHudLines.Clear(); _respawnTimerHudLines.AddRange(GetRespawnTimerLines().Take(10)); _nextRespawnHudRefreshTime = Time.unscaledTime + 0.25f; } if (_respawnTimerHudLines.Count != 0) { float num = 260f; float num2 = 24f; float num3 = 10f + num2 * (float)_respawnTimerHudLines.Count; float num4 = 18f; float num5 = Mathf.Clamp((float)Screen.height * 0.34f, 96f, Mathf.Max(96f, (float)Screen.height - num3 - 20f)); Rect val = new Rect(num4, num5, num, num3); Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.62f); GUI.Box(val, GUIContent.none); GUI.color = color; GUIStyle val2 = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)3, fontSize = 15, fontStyle = (FontStyle)1, padding = new RectOffset(10, 8, 0, 0) }; val2.normal.textColor = new Color(1f, 0.72f, 0.68f, 1f); for (int i = 0; i < _respawnTimerHudLines.Count; i++) { GUI.Label(new Rect(num4, num5 + 5f + num2 * (float)i, num, num2), _respawnTimerHudLines[i], val2); } } } [IteratorStateMachine(typeof(d__158))] private static IEnumerable GetRespawnTimerLines() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__158(-2); } private void TryRegisterCommands() { DebugCommandHandler instance = DebugCommandHandler.instance; if ((Object)(object)instance == (Object)null || instance == _registeredHandler) { return; } Register(instance, "kill", "Kills the nearest monster.", delegate { PublishCommandResult(RunSolo(KillNearestMonster)); }); Register(instance, "killroom", "Kills all monsters in your current room.", delegate { PublishCommandResult(RunSolo(KillMonstersInCurrentRoom)); }); Register(instance, "killall", "Kills all living monsters.", delegate { PublishCommandResult(RunSolo(KillAllMonsters)); }); Register(instance, "killclick", "Toggles click-to-kill for monsters.", delegate { PublishCommandResult(RunSolo(ToggleKillClick)); }); Register(instance, "infiniteenergy", "Toggles infinite player energy.", delegate { PublishCommandResult(RunSolo(ToggleInfiniteEnergy)); }); Register(instance, "invis", "Toggles invisibility and monster undetectability.", delegate { PublishCommandResult(RunSolo(ToggleInvisibility)); }); Register(instance, "invulnerable", "Toggles player invulnerability.", delegate { PublishCommandResult(RunSolo(ToggleInvulnerable)); }); Register(instance, "noclip", "Toggles noclip flight.", delegate { PublishCommandResult(RunSolo(ToggleNoclip)); }); Register(instance, "showmonsters", "Toggles monster map markers.", delegate { PublishCommandResult(RunSolo(ToggleShowMonsters)); }); Register(instance, "showrespawntimer", "Toggles monster respawn timers.", delegate { PublishCommandResult(RunSolo(ToggleShowRespawnTimers)); }); Register(instance, "showrespawntimers", "Alias for /showrespawntimer.", delegate { PublishCommandResult(RunSolo(ToggleShowRespawnTimers)); }); Register(instance, "unlimitedenergy", "Toggles unlimited weapon and gear energy.", delegate { PublishCommandResult(RunSolo(ToggleUnlimitedGearEnergy)); }); Register(instance, "laseronrightclick", "Toggles right-click laser.", delegate { PublishCommandResult(RunSolo(ToggleLaserOnRightClick)); }); Register(instance, "lightson", "Toggles bright map lighting.", delegate { PublishCommandResult(RunSolo(ToggleLightsOn)); }); Register(instance, "spawning", "Toggles monster spawning.", delegate { PublishCommandResult(RunSolo(ToggleSpawning)); }); Register(instance, "indestructableloot", "Makes loot indestructable.", delegate { PublishCommandResult(RunSolo(EnableIndestructibleLoot)); }); Register(instance, "indestructibleloot", "Alias for /indestructableloot.", delegate { PublishCommandResult(RunSolo(EnableIndestructibleLoot)); }); Register(instance, "extractall", "Condenses all map loot value into one moneybag at the active extractor.", delegate { PublishCommandResult(RunSolo(ExtractAllLoot)); }); Register(instance, "tptoextractor", "Teleports to the active or nearest unactivated extractor.", delegate { PublishCommandResult(RunSolo(TeleportToExtractor)); }); Register(instance, "tptotruck", "Teleports to the truck.", delegate { PublishCommandResult(RunSolo(TeleportToTruck)); }); Register(instance, "summonitem", "Summons an item by name. Usage: /summonitem [item name] [amount]", delegate(bool _, string[] args) { string[] args3 = args; PublishCommandResult(RunSolo(() => SummonItemCommand(args3))); }); Register(instance, "givemoney", "Adds money. Usage: /givemoney [dollar amount]", delegate(bool _, string[] args) { string[] args2 = args; PublishCommandResult(RunSolo(() => GiveMoneyCommand(args2))); }); _registeredHandler = instance; ((BaseUnityPlugin)this).Logger.LogInfo((object)"GodCommands chat commands registered."); } private static void Register(DebugCommandHandler handler, string name, string description, Action execute) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown handler.Register(new ChatCommand(name, description, execute, (Func>)null, (Func)(() => true), false)); } private void PublishCommandResult(string message) { PublishStatus(message); ChatManager instance = ChatManager.instance; if ((Object)(object)instance != (Object)null) { GameFields.Set(GameFields.ChatMessage, instance, message); } } internal void PublishStatus(string message) { _statusMessage = message; _statusMessageUntil = Time.unscaledTime + 4f; ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } private static string RunSolo(Func action) { if (!IsSoloPlayer()) { return "GodCommands only works in SoloPlayer."; } return action(); } private string ExecuteLocalCommand(string input) { string text = input.Trim(); if (text.StartsWith("/", StringComparison.Ordinal)) { string text2 = text; text = text2.Substring(1, text2.Length - 1).TrimStart(); } if (string.IsNullOrWhiteSpace(text)) { return "enter a command"; } string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); string text3 = array[0].ToLowerInvariant(); string[] args = array.Skip(1).ToArray(); switch (text3) { case "kill": return RunSolo(KillNearestMonster); case "killroom": return RunSolo(KillMonstersInCurrentRoom); case "killall": return RunSolo(KillAllMonsters); case "killclick": return RunSolo(ToggleKillClick); case "infiniteenergy": return RunSolo(ToggleInfiniteEnergy); case "invis": return RunSolo(ToggleInvisibility); case "invulnerable": return RunSolo(ToggleInvulnerable); case "noclip": return RunSolo(ToggleNoclip); case "showmonsters": return RunSolo(ToggleShowMonsters); case "showrespawntimers": case "showrespawntimer": return RunSolo(ToggleShowRespawnTimers); case "unlimitedenergy": return RunSolo(ToggleUnlimitedGearEnergy); case "laseronrightclick": return RunSolo(ToggleLaserOnRightClick); case "lightson": return RunSolo(ToggleLightsOn); case "spawning": return RunSolo(ToggleSpawning); case "indestructableloot": case "indestructibleloot": return RunSolo(EnableIndestructibleLoot); case "extractall": return RunSolo(ExtractAllLoot); case "tptoextractor": return RunSolo(TeleportToExtractor); case "tptotruck": return RunSolo(TeleportToTruck); case "summonitem": return RunSolo(() => SummonItemCommand(args)); case "givemoney": return RunSolo(() => GiveMoneyCommand(args)); case "help": case "commands": return "commands shown in GodCommands window"; default: return "unknown command /" + text3; } } private static string NormalizeCommandFilter(string input) { string text = input.Trim(); if (text.StartsWith("/", StringComparison.Ordinal)) { string text2 = text; text = text2.Substring(1, text2.Length - 1); } int num = text.IndexOf(' '); if (num < 0) { return text; } return text.Substring(0, num); } private string ExecuteAction(AdminAction action) { if (!IsSoloPlayer()) { return "GodCommands only works in SoloPlayer."; } return action switch { AdminAction.InfiniteEnergy => ToggleInfiniteEnergy(), AdminAction.Invisibility => ToggleInvisibility(), AdminAction.Invulnerable => ToggleInvulnerable(), AdminAction.KillClick => ToggleKillClick(), AdminAction.LaserOnRightClick => ToggleLaserOnRightClick(), AdminAction.LightsOn => ToggleLightsOn(), AdminAction.Noclip => ToggleNoclip(), AdminAction.ShowMonsters => ToggleShowMonsters(), AdminAction.ShowRespawnTimers => ToggleShowRespawnTimers(), AdminAction.DisableSpawning => ToggleSpawning(), AdminAction.IndestructibleLoot => ToggleIndestructibleLoot(), AdminAction.UnlimitedGearEnergy => ToggleUnlimitedGearEnergy(), AdminAction.GiveMoney => GiveMoneyCommand(new string[1] { _giveMoneyText }), AdminAction.KillNearest => KillNearestMonster(), AdminAction.KillRoom => KillMonstersInCurrentRoom(), AdminAction.KillAll => KillAllMonsters(), AdminAction.ExtractAll => ExtractAllLoot(), AdminAction.TeleportToExtractor => TeleportToExtractor(), AdminAction.TeleportToTruck => TeleportToTruck(), AdminAction.SummonItem => SummonSelectedItem(), _ => "unknown admin action", }; } private bool IsActionActive(AdminAction action) { return action switch { AdminAction.InfiniteEnergy => InfiniteEnergyEnabled, AdminAction.Invisibility => InvisibilityEnabled, AdminAction.Invulnerable => InvulnerableEnabled, AdminAction.KillClick => KillClickEnabled, AdminAction.LaserOnRightClick => LaserOnRightClickEnabled, AdminAction.LightsOn => LightsOnEnabled, AdminAction.Noclip => NoclipEnabled, AdminAction.ShowMonsters => ShowMonstersEnabled, AdminAction.ShowRespawnTimers => ShowRespawnTimersEnabled, AdminAction.DisableSpawning => SpawningDisabled, AdminAction.IndestructibleLoot => _lootIndestructible, AdminAction.UnlimitedGearEnergy => UnlimitedGearEnergyEnabled, _ => false, }; } private static bool IsToggleAction(AdminAction action) { if ((uint)action <= 11u) { return true; } return false; } private static string GetActionLabel(AdminAction action) { return action switch { AdminAction.InfiniteEnergy => "Infinite Energy", AdminAction.Invisibility => "Invisibility", AdminAction.Invulnerable => "Invulnerable", AdminAction.KillClick => "Kill Click", AdminAction.LaserOnRightClick => "Right-Click Laser", AdminAction.LightsOn => "Lights On", AdminAction.Noclip => "Noclip", AdminAction.ShowMonsters => "Show Monsters", AdminAction.ShowRespawnTimers => "Respawn Timers", AdminAction.DisableSpawning => "No Spawning", AdminAction.IndestructibleLoot => "Indestructable Loot", AdminAction.UnlimitedGearEnergy => "Unlimited Gear Energy", AdminAction.GiveMoney => "Give Money", AdminAction.KillNearest => "Kill Nearest", AdminAction.KillRoom => "Kill Room", AdminAction.KillAll => "Kill All", AdminAction.ExtractAll => "Extract All", AdminAction.TeleportToExtractor => "TP To Extractor", AdminAction.TeleportToTruck => "TP To Truck", AdminAction.SummonItem => "Summon Item", _ => action.ToString(), }; } private string KillNearestMonster() { //IL_005d: Unknown result type (might be due to invalid IL or missing references) Vector3? playerPosition = GetPlayerPosition(); if (!playerPosition.HasValue) { return "no local player found"; } EnemyParent val = GetLiveEnemies().OrderBy(delegate(EnemyParent enemy) { //IL_0001: 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_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 val2 = GetEnemyPosition(enemy) - playerPosition.Value; return ((Vector3)(ref val2)).sqrMagnitude; }).FirstOrDefault(); if ((Object)(object)val == (Object)null) { return "no monsters alive"; } string text = DescribeEnemy(val); if (!KillEnemy(val, playerPosition.Value)) { return "could not kill monster " + text; } return "killed monster " + text; } private string KillMonstersInCurrentRoom() { //IL_0032: 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_0037: 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) List playerRooms = GetPlayerRooms(); if (playerRooms.Count == 0) { return "no current room found"; } List list = new List(); Vector3 sourcePosition = (Vector3)(((??)GetPlayerPosition()) ?? Vector3.zero); foreach (EnemyParent liveEnemy in GetLiveEnemies()) { TryRefreshEnemyRooms(liveEnemy); if (SharesRoom(liveEnemy, playerRooms)) { string item = DescribeEnemy(liveEnemy); if (KillEnemy(liveEnemy, sourcePosition)) { list.Add(item); } } } return FormatKilledMessage(list, "no monsters in this room"); } private string KillAllMonsters() { //IL_001e: 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_0023: 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) List list = new List(); Vector3 sourcePosition = (Vector3)(((??)GetPlayerPosition()) ?? Vector3.zero); foreach (EnemyParent liveEnemy in GetLiveEnemies()) { string item = DescribeEnemy(liveEnemy); if (KillEnemy(liveEnemy, sourcePosition)) { list.Add(item); } } return FormatKilledMessage(list, "no monsters alive"); } private string ToggleKillClick() { KillClickEnabled = !KillClickEnabled; if (!KillClickEnabled) { return "killclick disabled"; } return "killclick enabled"; } private string ToggleInfiniteEnergy() { InfiniteEnergyEnabled = !InfiniteEnergyEnabled; if (InfiniteEnergyEnabled) { ApplyInfiniteEnergy(); } if (!InfiniteEnergyEnabled) { return "infinite energy disabled"; } return "infinite energy enabled"; } private string ToggleInvisibility() { InvisibilityEnabled = !InvisibilityEnabled; if (InvisibilityEnabled) { _nextInvisibilityRefreshTime = 0f; ApplyInvisibility(); } else { RestoreInvisibilityRenderers(); } if (!InvisibilityEnabled) { return "invis disabled"; } return "invis enabled"; } private string ToggleInvulnerable() { InvulnerableEnabled = !InvulnerableEnabled; if (InvulnerableEnabled) { ApplyInvulnerability(); } else { ClearInvulnerability(); } if (!InvulnerableEnabled) { return "invulnerable disabled"; } return "invulnerable enabled"; } private string ToggleUnlimitedGearEnergy() { UnlimitedGearEnergyEnabled = !UnlimitedGearEnergyEnabled; if (UnlimitedGearEnergyEnabled) { _nextGearEnergyRefreshTime = 0f; ApplyUnlimitedGearEnergy(); } else { RestoreGearBatteryVisuals(); } if (!UnlimitedGearEnergyEnabled) { return "unlimited energy disabled"; } return "unlimited energy enabled"; } private string ToggleNoclip() { NoclipEnabled = !NoclipEnabled; if (!NoclipEnabled) { RestoreNoclipPhysics(); } if (!NoclipEnabled) { return "noclip disabled"; } return "noclip enabled"; } private string ToggleShowMonsters() { ShowMonstersEnabled = !ShowMonstersEnabled; if (ShowMonstersEnabled) { _nextMonsterMapRefreshTime = 0f; ApplyMonsterMapMarkers(); } else { HideMonsterMapMarkers(); } if (!ShowMonstersEnabled) { return "show monsters disabled"; } return "show monsters enabled"; } private string ToggleShowRespawnTimers() { ShowRespawnTimersEnabled = !ShowRespawnTimersEnabled; if (!ShowRespawnTimersEnabled) { return "monster respawn timers disabled"; } return "monster respawn timers enabled"; } private string ToggleLaserOnRightClick() { LaserOnRightClickEnabled = !LaserOnRightClickEnabled; if (!LaserOnRightClickEnabled) { DestroyRightClickLaser(); } if (!LaserOnRightClickEnabled) { return "right-click laser disabled"; } return "right-click laser enabled"; } private string ToggleLightsOn() { LightsOnEnabled = !LightsOnEnabled; if (LightsOnEnabled) { _nextLightsRefreshTime = 0f; ApplyMapLights(); } else { DisableMapLights(); } if (!LightsOnEnabled) { return "lights on disabled"; } return "lights on enabled"; } private string ToggleSpawning() { SpawningDisabled = !SpawningDisabled; if (!SpawningDisabled) { return "monster spawning enabled"; } return "monster spawning disabled"; } private string EnableIndestructibleLoot() { _lootIndestructible = true; int num = ApplyIndestructibleToLoot(); _nextLootRefreshTime = Time.unscaledTime + 1f; if (num != 1) { return $"indestructable loot enabled for {num} loot items"; } return "indestructable loot enabled for 1 loot item"; } private string ToggleIndestructibleLoot() { if (_lootIndestructible) { _lootIndestructible = false; int num = ClearIndestructibleLoot(); if (num != 1) { return $"indestructable loot disabled for {num} loot items"; } return "indestructable loot disabled for 1 loot item"; } return EnableIndestructibleLoot(); } private string ExtractAllLoot() { //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_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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) ExtractionPoint activeExtractionPoint = GetActiveExtractionPoint(); if ((Object)(object)activeExtractionPoint == (Object)null) { return "activate an extractor"; } Vector3 extractionDropPosition = GetExtractionDropPosition(activeExtractionPoint); HashSet hashSet = new HashSet(); int num = 0; int num2 = 0; int num3 = 0; ValuableObject[] array = Object.FindObjectsOfType(); foreach (ValuableObject val in array) { if (IsActiveComponent((Component)(object)val)) { PhysGrabObject val2 = GameFields.Get(GameFields.ValuablePhysGrabObject, val); if ((Object)(object)val2 == (Object)null) { val2 = ((Component)val).GetComponent(); } if ((Object)(object)val2 != (Object)null) { hashSet.Add(((Object)val2).GetInstanceID()); } int valuableValue = GetValuableValue(val); if (valuableValue <= 0) { MoveToExtractor(((Component)val).transform, extractionDropPosition, num3++); continue; } num += valuableValue; DestroyLootObject(((Component)val).gameObject, val2); num2++; } } ItemValuableBox[] array2 = Object.FindObjectsOfType(); foreach (ItemValuableBox val3 in array2) { if (!IsActiveComponent((Component)(object)val3)) { continue; } PhysGrabObject component = ((Component)val3).GetComponent(); if (!((Object)(object)component != (Object)null) || hashSet.Add(((Object)component).GetInstanceID())) { int num4 = Mathf.RoundToInt(Mathf.Max(val3.ExtractionValue, val3.CurrentValue)); if (num4 > 0) { num += num4; DestroyLootObject(((Component)val3).gameObject, component); num2++; } else { MoveToExtractor(((Component)val3).transform, extractionDropPosition, num3++); } } } CosmeticWorldObject[] array3 = Object.FindObjectsOfType(); foreach (CosmeticWorldObject val4 in array3) { if (IsActiveComponent((Component)(object)val4)) { PhysGrabObject val5 = GameFields.Get(GameFields.CosmeticPhysGrabObject, val4); if ((Object)(object)val5 == (Object)null) { val5 = ((Component)val4).GetComponent(); } if (!((Object)(object)val5 != (Object)null) || hashSet.Add(((Object)val5).GetInstanceID())) { MoveToExtractor(((Component)val4).transform, extractionDropPosition, num3++); } } } bool num5 = num > 0 && SpawnMoneybag(num, activeExtractionPoint, extractionDropPosition); if (_lootIndestructible) { ApplyIndestructibleToLoot(); } string text = ((num > 0) ? ("$" + SemiFunc.DollarGetString(num)) : "$0"); if (!num5 && num > 0) { return $"could not spawn moneybag for {text}; moved {num3} special items"; } return $"extracted {num2} loot items into one {text} moneybag; moved {num3} special items"; } private string TeleportToExtractor() { //IL_0017: 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_0042: 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) Vector3? playerPosition = GetPlayerPosition(); if (!playerPosition.HasValue) { return "no local player found"; } ExtractionPoint teleportExtractor = GetTeleportExtractor(playerPosition.Value); if ((Object)(object)teleportExtractor == (Object)null) { return "no extractor found"; } TeleportLocalPlayer(GetExtractorTeleportPosition(teleportExtractor), Quaternion.Euler(0f, ((Component)teleportExtractor).transform.eulerAngles.y, 0f)); return "teleported to extractor " + DescribeObject(((Component)teleportExtractor).gameObject); } private string TeleportToTruck() { //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_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_0061: 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) Transform val = null; if ((Object)(object)TruckSafetySpawnPoint.instance != (Object)null) { val = ((Component)TruckSafetySpawnPoint.instance).transform; } else { TruckDoor val2 = Object.FindObjectOfType(); if ((Object)(object)val2 != (Object)null) { val = ((Component)val2).transform; } } if ((Object)(object)val == (Object)null) { return "truck not found"; } TeleportLocalPlayer(val.position + Vector3.up * 0.15f, Quaternion.Euler(0f, val.eulerAngles.y, 0f)); return "teleported to truck"; } private static ExtractionPoint? GetTeleportExtractor(Vector3 playerPosition) { //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_005a: Unknown result type (might be due to invalid IL or missing references) ExtractionPoint val = (from point in Object.FindObjectsOfType() where (Object)(object)point != (Object)null && (int)GameFields.Get(GameFields.ExtractionCurrentState, point) == 2 select point).OrderBy(delegate(ExtractionPoint point) { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 val4 = ((Component)point).transform.position - playerPosition; return ((Vector3)(ref val4)).sqrMagnitude; }).FirstOrDefault(); if ((Object)(object)val != (Object)null) { return val; } try { ExtractionPoint val2 = SemiFunc.ExtractionPointGetNearestNotActivated(playerPosition); if ((Object)(object)val2 != (Object)null) { return val2; } } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Could not query nearest unactivated extractor: " + ex.Message)); } } return (from point in Object.FindObjectsOfType() where (Object)(object)point != (Object)null select point).OrderBy(delegate(ExtractionPoint point) { //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Vector3 val3 = ((Component)point).transform.position - playerPosition; return ((Vector3)(ref val3)).sqrMagnitude; }).FirstOrDefault(); } private static Vector3 GetExtractorTeleportPosition(ExtractionPoint extractionPoint) { //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_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_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_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_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_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) Transform val = GameFields.Get(GameFields.ExtractionSafetySpawn, extractionPoint); if ((Object)(object)val != (Object)null) { return val.position + Vector3.up * 0.15f; } if ((Object)(object)extractionPoint.extractionArea != (Object)null) { return extractionPoint.extractionArea.transform.position + Vector3.up * 0.25f; } return ((Component)extractionPoint).transform.position + Vector3.up * 0.25f; } private string SummonItemCommand(string[] args) { if (args == null || args.Length == 0) { return "usage: /summonitem [item name] [amount]"; } int amount = 1; List list = args.Where((string arg) => !string.IsNullOrWhiteSpace(arg)).ToList(); if (list.Count > 1) { if (int.TryParse(list[list.Count - 1], out var result)) { amount = Mathf.Clamp(result, 1, 50); list.RemoveAt(list.Count - 1); } } string text = string.Join(" ", list).Trim(); if (!string.IsNullOrWhiteSpace(text)) { return SummonItem(text, amount); } return "usage: /summonitem [item name] [amount]"; } private string GiveMoneyCommand(string[] args) { if (args == null || args.Length == 0) { return "usage: /givemoney [dollar amount]"; } if (!TryParseMoneyInput(args[0].Trim(), out var currencyUnits, out var dollarAmount)) { return "usage: /givemoney [dollar amount]"; } int num = (int)Math.Min(Math.Max((long)GetRunCurrency() + (long)currencyUnits, 0L), 2147483647L); SetRunCurrency(num); _giveMoneyText = dollarAmount.ToString(CultureInfo.InvariantCulture); return "added " + FormatDollarAmount(dollarAmount) + " (" + FormatCurrencyUnits(currencyUnits) + "); money is now " + FormatCurrencyUnits(num); } private static bool TryParseMoneyInput(string input, out int currencyUnits, out long dollarAmount) { currencyUnits = 0; dollarAmount = 0L; string text = input.Replace("$", string.Empty).Replace(",", string.Empty).Trim() .ToLowerInvariant(); bool flag = text.EndsWith("k", StringComparison.Ordinal); if (flag) { string text2 = text; text = text2.Substring(0, text2.Length - 1).Trim(); } if (!decimal.TryParse(text, NumberStyles.Number, CultureInfo.InvariantCulture, out var result) || result <= 0m) { return false; } if (flag) { decimal num = Math.Ceiling(result); if (num > 2147483647m) { num = 2147483647m; } currencyUnits = Math.Max(1, (int)num); dollarAmount = Math.Min((long)currencyUnits * 1000L, long.MaxValue); return true; } decimal num2 = Math.Ceiling(result); if (num2 > 9223372036854775807m) { num2 = 9223372036854775807m; } dollarAmount = Math.Max(1L, (long)num2); currencyUnits = (int)Math.Min(Math.Max((dollarAmount + 999) / 1000, 1L), 2147483647L); return true; } private static int GetRunCurrency() { try { return SemiFunc.StatGetRunCurrency(); } catch { StatsManager instance = StatsManager.instance; int value; return ((Object)(object)instance != (Object)null && instance.runStats != null && instance.runStats.TryGetValue("currency", out value)) ? value : 0; } } private static void SetRunCurrency(int value) { bool flag = false; try { SemiFunc.StatSetRunCurrency(value); flag = true; } catch { StatsManager instance = StatsManager.instance; if ((Object)(object)instance != (Object)null && instance.runStats != null) { instance.runStats["currency"] = value; flag = true; } } if (!flag) { return; } if ((Object)(object)ShopManager.instance != (Object)null) { ShopManager.instance.totalCurrency = value; } try { SemiFunc.StatSyncAll(); } catch { } } private static string FormatMoney(int value) { try { return "$" + SemiFunc.DollarGetString(value); } catch { return $"${value:N0}"; } } private static string FormatCurrencyUnits(int units) { return $"{FormatDollarAmount((long)Math.Max(0, units) * 1000L)} ({units:N0}K)"; } private static string FormatDollarAmount(long dollars) { return $"${Math.Max(0L, dollars):N0}"; } private string SummonSelectedItem() { return SummonItem(_summonSearch, GetSummonAmount()); } private string SummonItem(string query, int amount) { //IL_00b8: 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_00bd: 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_00e3: 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_00e8: 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_0109: 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_011d: 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_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) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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_018b: 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 (string.IsNullOrWhiteSpace(query)) { return "enter an item name"; } if (!TryRefreshSummonCatalog()) { return "summon list could not be indexed"; } SummonableItem summonableItem = FindSummonable(query); if (summonableItem == null) { TryRefreshSummonCatalog(force: true); summonableItem = FindSummonable(query); } if (summonableItem == null) { return "no summonable item found for " + query; } if ((Object)(object)summonableItem.Prefab == (Object)null) { TryRefreshSummonCatalog(force: true); summonableItem = FindSummonable(query); if (summonableItem == null || (Object)(object)summonableItem.Prefab == (Object)null) { return "summonable item " + query + " is no longer available"; } } Vector3? playerPosition = GetPlayerPosition(); if (!playerPosition.HasValue) { return "no local player found"; } Transform cameraTransform = GetCameraTransform(PlayerController.instance); Vector3 val = (((Object)(object)cameraTransform != (Object)null) ? cameraTransform.forward : Vector3.forward); Quaternion val2 = (((Object)(object)cameraTransform != (Object)null) ? Quaternion.Euler(0f, cameraTransform.eulerAngles.y, 0f) : Quaternion.identity); int num = 0; int num2 = Mathf.Clamp(amount, 1, 50); for (int i = 0; i < num2; i++) { Vector3 val3 = playerPosition.Value + ((Vector3)(ref val)).normalized * 1.6f + Vector3.up * (0.5f + (float)i * 0.08f) + GetDropOffset(i); GameObject obj = Object.Instantiate(summonableItem.Prefab, val3, val2); ((Object)obj).name = summonableItem.PrefabName + " (GodCommands)"; Rigidbody component = obj.GetComponent(); if ((Object)(object)component != (Object)null && !component.isKinematic) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; } PhysGrabObject component2 = obj.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.Teleport(val3, val2); } num++; } _summonSearch = summonableItem.DisplayName; if (num != 1) { return $"summoned {num}x {summonableItem.DisplayName}"; } return "summoned item " + summonableItem.DisplayName; } internal static bool TryKillClickedEnemy(PhysGrabObject physGrabObject) { //IL_0059: 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_005e: 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 (!KillClickEnabled || !IsSoloPlayer() || (Object)(object)physGrabObject == (Object)null) { return false; } EnemyParent val = ResolveEnemyFromPhysGrabObject(physGrabObject); if ((Object)(object)val == (Object)null || !IsLiveEnemy(val)) { return false; } string text = DescribeEnemy(val); Vector3 sourcePosition = (Vector3)(((??)GetPlayerPosition()) ?? ((Component)physGrabObject).transform.position); bool flag = KillEnemy(val, sourcePosition); Instance?.PublishStatus(flag ? ("killclick killed monster " + text) : ("killclick could not kill monster " + text)); return flag; } internal static bool ShouldBlockEnemySpawn(EnemyParent? enemyParent) { if (!SpawningDisabled || !IsSoloPlayer()) { return false; } return true; } internal static bool ShouldBlockBatteryDrain(ItemBattery? battery) { if (!UnlimitedGearEnergyEnabled || !IsSoloPlayer() || (Object)(object)battery == (Object)null) { return false; } FillBattery(battery); return true; } internal static bool ShouldBlockBatterySetLife(ItemBattery? battery, ref int batteryLife) { if (!UnlimitedGearEnergyEnabled || !IsSoloPlayer() || (Object)(object)battery == (Object)null) { return false; } batteryLife = 100; FillBattery(battery); return true; } internal static bool ShouldBlockBatteryFullPercentChange(ItemBattery? battery, ref int batteryLifeInt, ref bool charge) { if (!UnlimitedGearEnergyEnabled || !IsSoloPlayer() || (Object)(object)battery == (Object)null) { return false; } batteryLifeInt = Mathf.Max(1, battery.batteryBars); charge = true; FillBattery(battery); return true; } internal static bool ShouldBlockPlayerDamage(PlayerHealth? health, ref int damage) { if (!InvulnerableEnabled || !IsSoloPlayer() || (Object)(object)health == (Object)null || damage <= 0) { return false; } SetPlayerHealthInvulnerable(health, invulnerable: true); damage = 0; return true; } internal static bool IsInvisibilityActiveFor(PlayerAvatar? player) { if (InvisibilityEnabled && IsSoloPlayer()) { return IsLocalPlayer(player); } return false; } internal static bool ShouldBlockInvestigation() { if (InvisibilityEnabled) { return IsSoloPlayer(); } return false; } private void RestoreGearBatteryVisuals() { ItemBattery[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { RestoreBatteryVisual(array[i]); } } private static void FillBattery(ItemBattery battery) { if ((Object)(object)battery == (Object)null) { return; } try { int num = Mathf.Max(1, battery.batteryBars); bool num2 = battery.batteryLife < 99.5f || GameFields.Get(GameFields.ItemBatteryBatteryLifeInt, battery) != num || GameFields.Get(GameFields.ItemBatteryCurrentBars, battery) != num; NormalizeBatteryColors(battery); battery.batteryLife = 100f; GameFields.Set(GameFields.ItemBatteryBatteryLifePrev, battery, 100f); GameFields.Set(GameFields.ItemBatteryBatteryLifeInt, battery, num); GameFields.Set(GameFields.ItemBatteryCurrentBars, battery, num); GameFields.Set(GameFields.ItemBatteryBatteryLifeCountBars, battery, num); GameFields.Set(GameFields.ItemBatteryBatteryLifeCountBarsPrev, battery, num); GameFields.Set(GameFields.ItemBatteryDrainRate, battery, 0f); GameFields.Set(GameFields.ItemBatteryDrainTimer, battery, 0f); string text = GameFields.Get(instance: GameFields.Get(GameFields.ItemBatteryItemAttributes, battery), field: GameFields.ItemAttributesInstanceName); if (num2 && !string.IsNullOrWhiteSpace(text)) { SemiFunc.StatSetBattery(text, 100); } UpdateInventoryBatteryVisual(battery, num); UpdateWorldBatteryVisual(battery, num); UpdateHeldBatteryUiVisual(battery, num); } catch (Exception ex) { Plugin? instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogDebug((object)("Could not fill battery for " + ((Object)battery).name + ": " + ex.Message)); } } } private static void RestoreBatteryVisual(ItemBattery battery) { if ((Object)(object)battery == (Object)null) { return; } try { int batteryBarCount = GetBatteryBarCount(battery); NormalizeBatteryColors(battery); GameFields.Set(GameFields.ItemBatteryBatteryLifeInt, battery, batteryBarCount); GameFields.Set(GameFields.ItemBatteryCurrentBars, battery, batteryBarCount); GameFields.Set(GameFields.ItemBatteryBatteryLifeCountBars, battery, batteryBarCount); GameFields.Set(GameFields.ItemBatteryBatteryLifeCountBarsPrev, battery, batteryBarCount); UpdateInventoryBatteryVisual(battery, batteryBarCount); UpdateWorldBatteryVisual(battery, batteryBarCount); UpdateHeldBatteryUiVisual(battery, batteryBarCount); } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Could not restore battery visual for " + ((Object)battery).name + ": " + ex.Message)); } } } private static int GetBatteryBarCount(ItemBattery battery) { int num = Mathf.Max(1, battery.batteryBars); float num2 = 100f / (float)num; return Mathf.Clamp(Mathf.RoundToInt(Mathf.Clamp(battery.batteryLife, 0f, 100f) / num2), 0, num); } private static bool ShouldShowWorldBatteryVisual(ItemBattery battery) { ItemEquippable val = GameFields.Get(GameFields.ItemBatteryItemEquippable, battery); if ((Object)(object)val != (Object)null && GameFields.Get(GameFields.ItemEquippableIsEquipped, val)) { return true; } PhysGrabObject val2 = GameFields.Get(GameFields.ItemBatteryPhysGrabObject, battery); if ((Object)(object)val2 != (Object)null) { if (!val2.grabbed) { return val2.grabbedLocal; } return true; } return false; } private static void UpdateWorldBatteryVisual(ItemBattery battery, int bars) { BatteryVisualLogic val = GameFields.Get(GameFields.ItemBatteryBatteryVisualLogic, battery); if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeInHierarchy) { QuietRefreshBatteryVisual(val, battery, bars); } } private static void HideWorldBatteryVisual(ItemBattery battery) { GameFields.Set(GameFields.ItemBatteryShowBattery, battery, value: false); GameFields.Set(GameFields.ItemBatteryShowTimer, battery, 0f); BatteryVisualLogic val = GameFields.Get(GameFields.ItemBatteryBatteryVisualLogic, battery); if (!((Object)(object)val == (Object)null)) { ResetBatteryVisualStyle(val, battery); } } private static void UpdateInventoryBatteryVisual(ItemBattery battery, int bars) { ItemEquippable val = GameFields.Get(GameFields.ItemBatteryItemEquippable, battery); Inventory instance = Inventory.instance; List list = GameFields.Get>(GameFields.InventorySpots, instance); if ((Object)(object)val == (Object)null || list == null) { return; } foreach (InventorySpot item in list) { if (!((Object)(object)item == (Object)null) && GameFields.Get(GameFields.InventorySpotCurrentItem, item) == val) { BatteryVisualLogic val2 = GameFields.Get(GameFields.InventorySpotBatteryVisualLogic, item); if (!((Object)(object)val2 == (Object)null)) { QuietRefreshBatteryVisual(val2, battery, bars); } } } } private static void UpdateHeldBatteryUiVisual(ItemBattery battery, int bars) { BatteryUI instance = BatteryUI.instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance.batteryVisualLogic == (Object)null)) { BatteryVisualLogic batteryVisualLogic = instance.batteryVisualLogic; if (batteryVisualLogic.itemBattery == battery) { QuietRefreshBatteryVisual(batteryVisualLogic, battery, bars); } } } private static void QuietRefreshBatteryVisual(BatteryVisualLogic visual, ItemBattery battery, int bars) { if (!((Object)(object)visual == (Object)null) && !((Object)(object)battery == (Object)null)) { NormalizeBatteryColors(battery); bool num = visual.itemBattery != battery; visual.itemBattery = battery; int num2 = Mathf.Max(1, visual.batteryBars); int num3 = GameFields.Get(GameFields.BatteryVisualCurrentBars, visual); List list = GameFields.Get>(GameFields.BatteryVisualBars, visual); bool num4 = num || num2 != bars || num3 != bars || list == null || list.Count != bars; ResetBatteryVisualStyle(visual, battery); if (num4) { visual.BatteryBarsSet(); } ResetBatteryVisualStyle(visual, battery); } } private static void NormalizeBatteryColors(ItemBattery battery) { //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_001b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)battery == (Object)null)) { battery.batteryColor = VanillaBatteryColor; GameFields.Set(GameFields.ItemBatteryBatteryColorMedium, battery, VanillaBatteryBorderColor); } } private static void ResetBatteryVisualStyle(BatteryVisualLogic visual, ItemBattery battery) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) NormalizeBatteryColors(battery); visual.BatteryColorMainSet(VanillaBatteryColor); GameFields.Set(GameFields.BatteryVisualIsCharging, visual, value: false); GameFields.Set(GameFields.BatteryVisualIsDraining, visual, value: false); GameFields.Set(GameFields.BatteryVisualIsOutWarning, visual, value: false); GameFields.Set(GameFields.BatteryVisualChargeNeeded, visual, value: false); GameFields.Set(GameFields.BatteryVisualSmallDeductionFlashing, visual, value: false); if ((Object)(object)visual.batteryBarCharge != (Object)null) { ((Component)visual.batteryBarCharge).gameObject.SetActive(false); } if ((Object)(object)visual.batteryBarDrain != (Object)null) { ((Component)visual.batteryBarDrain).gameObject.SetActive(false); } if ((Object)(object)visual.batteryChargeNeededVisual != (Object)null) { visual.batteryChargeNeededVisual.SetActive(false); } if ((Object)(object)visual.batteryOutVisual != (Object)null) { visual.batteryOutVisual.SetActive(false); } } private static void SetPlayerHealthInvulnerable(PlayerHealth health, bool invulnerable) { if ((Object)(object)health == (Object)null) { return; } GameFields.Set(GameFields.PlayerHealthGodMode, health, invulnerable); if (invulnerable) { int num = GameFields.Get(GameFields.PlayerHealthHealth, health); int num2 = GameFields.Get(GameFields.PlayerHealthMaxHealth, health); if (num2 > 0 && num < num2) { GameFields.Set(GameFields.PlayerHealthHealth, health, num2); } } } private void HideLocalAvatarRenderers(PlayerAvatar player) { Renderer[] componentsInChildren = ((Component)player).GetComponentsInChildren(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { int instanceID = ((Object)val).GetInstanceID(); if (!_invisibilityRenderers.ContainsKey(instanceID)) { _invisibilityRenderers[instanceID] = new RendererState(val, val.enabled); } val.enabled = false; } } } private void RestoreInvisibilityRenderers() { foreach (RendererState value in _invisibilityRenderers.Values) { if ((Object)(object)value.Renderer != (Object)null) { value.Renderer.enabled = value.WasEnabled; } } _invisibilityRenderers.Clear(); } private void ClearInvulnerability() { foreach (PlayerHealth localPlayerHealthObject in GetLocalPlayerHealthObjects()) { GameFields.Set(GameFields.PlayerHealthGodMode, localPlayerHealthObject, value: false); } } private void CacheAndDisableNoclipPhysics(PlayerController controller, PlayerAvatar avatar) { Collider[] componentsInChildren = ((Component)controller).GetComponentsInChildren(true); foreach (Collider collider in componentsInChildren) { CacheAndDisableCollider(collider); } componentsInChildren = ((Component)avatar).GetComponentsInChildren(true); foreach (Collider collider2 in componentsInChildren) { CacheAndDisableCollider(collider2); } CacheAndDisableRigidbody(controller.rb); CacheAndDisableRigidbody(GameFields.Get(GameFields.PlayerAvatarRb, avatar)); CacheAndDisableRigidbody(((Component)controller).GetComponent()); CacheAndDisableRigidbody(((Component)avatar).GetComponent()); } private void CacheAndDisableCollider(Collider collider) { if (!((Object)(object)collider == (Object)null)) { int instanceID = ((Object)collider).GetInstanceID(); if (!_noclipColliders.ContainsKey(instanceID)) { _noclipColliders[instanceID] = new ColliderState(collider, collider.enabled); } collider.enabled = false; } } private void CacheAndDisableRigidbody(Rigidbody rb) { //IL_005e: 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) if (!((Object)(object)rb == (Object)null)) { int instanceID = ((Object)rb).GetInstanceID(); if (!_noclipRigidbodies.ContainsKey(instanceID)) { _noclipRigidbodies[instanceID] = new RigidbodyState(rb, rb.useGravity, rb.isKinematic, rb.detectCollisions, rb.drag, rb.angularDrag); } rb.useGravity = false; rb.detectCollisions = false; rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; rb.drag = 0f; rb.angularDrag = 0f; } } private void RestoreNoclipPhysics() { foreach (ColliderState value in _noclipColliders.Values) { if ((Object)(object)value.Collider != (Object)null) { value.Collider.enabled = value.WasEnabled; } } foreach (RigidbodyState value2 in _noclipRigidbodies.Values) { if (!((Object)(object)value2.Rigidbody == (Object)null)) { value2.Rigidbody.useGravity = value2.UseGravity; value2.Rigidbody.isKinematic = value2.IsKinematic; value2.Rigidbody.detectCollisions = value2.DetectCollisions; value2.Rigidbody.drag = value2.Drag; value2.Rigidbody.angularDrag = value2.AngularDrag; } } _noclipColliders.Clear(); _noclipRigidbodies.Clear(); } private static void ZeroLocalPlayerVelocity(PlayerController controller, PlayerAvatar avatar) { ZeroRigidbody(controller.rb); ZeroRigidbody(GameFields.Get(GameFields.PlayerAvatarRb, avatar)); } private static void ZeroRigidbody(Rigidbody rb) { //IL_000b: 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) if (!((Object)(object)rb == (Object)null)) { rb.velocity = Vector3.zero; rb.angularVelocity = Vector3.zero; } } private static Transform? GetCameraTransform(PlayerController? controller) { if ((Object)(object)controller != (Object)null && (Object)(object)controller.cameraGameObject != (Object)null) { return controller.cameraGameObject.transform; } Camera main = Camera.main; if ((Object)(object)main != (Object)null) { return ((Component)main).transform; } Camera val = (((Object)(object)AssetManager.instance != (Object)null) ? GameFields.Get(GameFields.AssetManagerMainCamera, AssetManager.instance) : null); if (!((Object)(object)val != (Object)null)) { return null; } return ((Component)val).transform; } private static void TeleportLocalPlayer(Vector3 position, Quaternion rotation) { //IL_002e: 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_008a: 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_0049: 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_0069: 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_00a7: 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_00bd: 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) PlayerController instance = PlayerController.instance; PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar(); if ((Object)(object)instance == (Object)null && (Object)(object)localPlayerAvatar == (Object)null) { return; } if ((Object)(object)instance != (Object)null) { ((Component)instance).transform.SetPositionAndRotation(position, rotation); if ((Object)(object)instance.rb != (Object)null) { instance.rb.velocity = Vector3.zero; instance.rb.angularVelocity = Vector3.zero; instance.rb.MovePosition(position); instance.rb.MoveRotation(rotation); } } if ((Object)(object)localPlayerAvatar != (Object)null) { ((Component)localPlayerAvatar).transform.SetPositionAndRotation(position, rotation); Rigidbody val = GameFields.Get(GameFields.PlayerAvatarRb, localPlayerAvatar); if ((Object)(object)val != (Object)null) { val.velocity = Vector3.zero; val.angularVelocity = Vector3.zero; val.MovePosition(position); val.MoveRotation(rotation); } } } private void EnsureMonsterMapMarker(Map map, EnemyParent enemy, int id) { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00a0: 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_00d7: 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_0132: 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 (_monsterMapMarkers.TryGetValue(id, out MapCustom value) && (Object)(object)value != (Object)null) { MapCustomEntity mapCustomEntity = GetMapCustomEntity(value); if ((Object)(object)mapCustomEntity != (Object)null) { value.color = Color.red; if ((Object)(object)mapCustomEntity.spriteRenderer != (Object)null) { mapCustomEntity.spriteRenderer.color = Color.red; } ApplyMonsterMarkerScale(mapCustomEntity, enemy); return; } } RemoveMonsterMapMarker(id); Transform enemyMapTarget = GetEnemyMapTarget(enemy); if ((Object)(object)enemyMapTarget == (Object)null) { return; } GameObject val = new GameObject("GodCommands Monster Marker - " + DescribeEnemy(enemy)); val.transform.SetParent(enemyMapTarget, false); val.transform.localPosition = Vector3.zero; MapCustom val2 = val.AddComponent(); val2.autoAdd = false; val2.sprite = GetMonsterMarkerSprite(); val2.color = Color.red; try { map.AddCustom(val2, val2.sprite, Color.red); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogDebug((object)("Could not add monster marker: " + ex.Message)); } MapCustomEntity mapCustomEntity2 = GetMapCustomEntity(val2); if ((Object)(object)mapCustomEntity2 == (Object)null) { Object.Destroy((Object)(object)val); return; } if ((Object)(object)mapCustomEntity2.spriteRenderer != (Object)null) { mapCustomEntity2.spriteRenderer.color = Color.red; } ApplyMonsterMarkerScale(mapCustomEntity2, enemy); ((Object)((Component)mapCustomEntity2).gameObject).name = ((Object)val).name; _monsterMapMarkers[id] = val2; } private static void ApplyMonsterMarkerScale(MapCustomEntity entity, EnemyParent enemy) { //IL_0017: 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_0058: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)entity == (Object)null)) { float monsterMarkerScale = GetMonsterMarkerScale(enemy); ((Component)entity).transform.localScale = Vector3.one * monsterMarkerScale; if ((Object)(object)entity.spriteRenderer != (Object)null && (Object)(object)((Component)entity.spriteRenderer).transform != (Object)(object)((Component)entity).transform) { ((Component)entity.spriteRenderer).transform.localScale = Vector3.one; } } } private static float GetMonsterMarkerScale(EnemyParent enemy) { return Mathf.Clamp(GetEnemyVisualSize(enemy) * 0.32f, 0.78f, 1.85f); } private static float GetEnemyVisualSize(EnemyParent enemy) { //IL_0053: 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_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_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_0083: 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_00d7: 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_00e0: 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_00f8: 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) if ((Object)(object)enemy == (Object)null) { return 1f; } float num = 0f; Renderer[] componentsInChildren = ((Component)enemy).GetComponentsInChildren(true); Bounds bounds; foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null) && !(((object)val).GetType().Name == "ParticleSystemRenderer") && ((Component)val).gameObject.activeInHierarchy) { bounds = val.bounds; Vector3 size = ((Bounds)(ref bounds)).size; num = Mathf.Max(new float[4] { num, size.x, size.y, size.z }); } } if (num > 0.05f) { return num; } Collider[] componentsInChildren2 = ((Component)enemy).GetComponentsInChildren(true); foreach (Collider val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null) && ((Component)val2).gameObject.activeInHierarchy) { bounds = val2.bounds; Vector3 size2 = ((Bounds)(ref bounds)).size; num = Mathf.Max(new float[4] { num, size2.x, size2.y, size2.z }); } } if (!(num > 0.05f)) { return 1f; } return num; } private static MapCustomEntity? GetMapCustomEntity(MapCustom custom) { return GameFields.Get(GameFields.MapCustomEntity, custom); } private static Transform GetEnemyMapTarget(EnemyParent enemy) { Enemy enemy2 = GetEnemy(enemy); if (!((Object)(object)enemy2 != (Object)null)) { return ((Component)enemy).transform; } return ((Component)enemy2).transform; } private Sprite GetMonsterMarkerSprite() { //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_0031: Expected O, but got Unknown //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_00e7: 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_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_0098: 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) if ((Object)(object)_monsterMarkerSprite != (Object)null) { return _monsterMarkerSprite; } _monsterMarkerTexture = new Texture2D(12, 12, (TextureFormat)4, false) { name = "GodCommands Monster Map Dot" }; Color val = default(Color); ((Color)(ref val))..ctor(1f, 1f, 1f, 0f); Color white = Color.white; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(5.5f, 5.5f); float num = 3.6000001f; for (int i = 0; i < 12; i++) { for (int j = 0; j < 12; j++) { float num2 = Vector2.Distance(new Vector2((float)j, (float)i), val2); _monsterMarkerTexture.SetPixel(j, i, (num2 <= num) ? white : val); } } _monsterMarkerTexture.Apply(); Object.DontDestroyOnLoad((Object)(object)_monsterMarkerTexture); _monsterMarkerSprite = Sprite.Create(_monsterMarkerTexture, new Rect(0f, 0f, 12f, 12f), new Vector2(0.5f, 0.5f), 64f); ((Object)_monsterMarkerSprite).name = "GodCommands Monster Map Dot"; Object.DontDestroyOnLoad((Object)(object)_monsterMarkerSprite); return _monsterMarkerSprite; } private void RemoveMonsterMapMarker(int id) { if (!_monsterMapMarkers.TryGetValue(id, out MapCustom value)) { return; } if ((Object)(object)value != (Object)null) { MapCustomEntity mapCustomEntity = GetMapCustomEntity(value); if ((Object)(object)mapCustomEntity != (Object)null) { Object.Destroy((Object)(object)((Component)mapCustomEntity).gameObject); } Object.Destroy((Object)(object)((Component)value).gameObject); } _monsterMapMarkers.Remove(id); } private void HideMonsterMapMarkers() { foreach (int item in _monsterMapMarkers.Keys.ToList()) { RemoveMonsterMapMarker(item); } } private void StoreOriginalLighting() { //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_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_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 (!_lightsOriginalStored) { _originalAmbientMode = RenderSettings.ambientMode; _originalAmbientLight = RenderSettings.ambientLight; _originalAmbientIntensity = RenderSettings.ambientIntensity; _originalFog = RenderSettings.fog; _originalFogColor = RenderSettings.fogColor; _originalFogDensity = RenderSettings.fogDensity; _lightsOriginalStored = true; } } private void EnsureMapLightObject() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_004c: 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) if ((Object)(object)_lightsObject == (Object)null) { _lightsObject = new GameObject("GodCommands Map Lights"); Object.DontDestroyOnLoad((Object)(object)_lightsObject); _lightsDirectional = _lightsObject.AddComponent(); _lightsDirectional.type = (LightType)1; _lightsDirectional.color = Color.white; _lightsDirectional.shadows = (LightShadows)0; } _lightsObject.SetActive(true); if ((Object)(object)_lightsDirectional != (Object)null) { ((Behaviour)_lightsDirectional).enabled = true; _lightsDirectional.intensity = 1.6f; ((Component)_lightsDirectional).transform.rotation = Quaternion.Euler(50f, -35f, 0f); } } private void DisableMapLights() { //IL_0024: 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_0050: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_lightsObject != (Object)null) { _lightsObject.SetActive(false); } if (_lightsOriginalStored) { RenderSettings.ambientMode = _originalAmbientMode; RenderSettings.ambientLight = _originalAmbientLight; RenderSettings.ambientIntensity = _originalAmbientIntensity; RenderSettings.fog = _originalFog; RenderSettings.fogColor = _originalFogColor; RenderSettings.fogDensity = _originalFogDensity; _lightsOriginalStored = false; } } private bool EnsureRightClickLaserVisual() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0126: 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_017c: 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_00aa: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: 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_0252: 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) //IL_01fd: Expected O, but got Unknown if ((Object)(object)_rightClickLaserVisual != (Object)null && (Object)(object)_rightClickLaserLine != (Object)null && (Object)(object)_rightClickLaserSwirlA != (Object)null && (Object)(object)_rightClickLaserSwirlB != (Object)null) { return true; } if ((Object)(object)_rightClickLaserVisual == (Object)null) { _rightClickLaserVisual = new GameObject("GodCommands Right Click Laser"); Object.DontDestroyOnLoad((Object)(object)_rightClickLaserVisual); } if ((Object)(object)_rightClickLaserMaterial == (Object)null) { Shader val = Shader.Find("Sprites/Default") ?? Shader.Find("Hidden/Internal-Colored"); if ((Object)(object)val != (Object)null) { _rightClickLaserMaterial = new Material(val) { name = "GodCommands Right Click Laser Material" }; if (_rightClickLaserMaterial.HasProperty("_Color")) { _rightClickLaserMaterial.color = new Color(1f, 0.82f, 0.06f, 1f); } } } if (_rightClickLaserLine == null) { _rightClickLaserLine = CreateRightClickLaserLine("GodCommands Right Click Laser Core", 0.075f, 0.028f, new Color(1f, 0.95f, 0.28f, 1f), new Color(1f, 0.62f, 0.02f, 0.92f), 2); } if (_rightClickLaserSwirlA == null) { _rightClickLaserSwirlA = CreateRightClickLaserLine("GodCommands Right Click Laser Swirl A", 0.028f, 0.014f, new Color(1f, 0.88f, 0.08f, 0.95f), new Color(1f, 0.48f, 0.02f, 0.35f), 24); } if (_rightClickLaserSwirlB == null) { _rightClickLaserSwirlB = CreateRightClickLaserLine("GodCommands Right Click Laser Swirl B", 0.022f, 0.012f, new Color(1f, 0.98f, 0.32f, 0.82f), new Color(1f, 0.68f, 0.04f, 0.28f), 24); } if ((Object)(object)_rightClickLaserLight == (Object)null) { GameObject val2 = new GameObject("GodCommands Right Click Laser Light"); val2.transform.SetParent(_rightClickLaserVisual.transform, false); _rightClickLaserLight = val2.AddComponent(); _rightClickLaserLight.type = (LightType)2; _rightClickLaserLight.shadows = (LightShadows)0; } _rightClickLaserLight.color = new Color(1f, 0.82f, 0.06f, 1f); _rightClickLaserLight.range = 5f; _rightClickLaserLight.intensity = 1.4f; _rightClickLaserVisual.SetActive(false); return true; } private LineRenderer CreateRightClickLaserLine(string name, float startWidth, float endWidth, Color startColor, Color endColor, int positionCount) { //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_005d: 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) GameObject val = new GameObject(name); val.transform.SetParent(_rightClickLaserVisual.transform, false); LineRenderer val2 = val.AddComponent(); val2.positionCount = positionCount; val2.useWorldSpace = true; val2.startWidth = startWidth; val2.endWidth = endWidth; val2.numCapVertices = 8; val2.numCornerVertices = 6; val2.alignment = (LineAlignment)0; val2.textureMode = (LineTextureMode)0; val2.startColor = startColor; val2.endColor = endColor; if ((Object)(object)_rightClickLaserMaterial != (Object)null) { ((Renderer)val2).material = _rightClickLaserMaterial; } return val2; } private void DrawRightClickLaser(Vector3 start, Vector3 end, bool hitSomething, RaycastHit hit) { //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_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_003c: 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_0043: 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_0045: 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_0068: 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_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_0073: 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_007a: 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_007d: 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_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_00ac: 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_00c5: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00da: 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_015e: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0107: 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_0109: 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_0114: 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) if ((Object)(object)_rightClickLaserVisual == (Object)null || (Object)(object)_rightClickLaserLine == (Object)null) { return; } Vector3 val = end - start; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude <= 0.01f) { DeactivateRightClickLaser(); return; } Vector3 val2 = val / magnitude; Vector3 val3 = ((Mathf.Abs(Vector3.Dot(val2, Vector3.up)) > 0.95f) ? Vector3.right : Vector3.up); Vector3 val4 = Vector3.Cross(val2, val3); Vector3 normalized = ((Vector3)(ref val4)).normalized; val4 = Vector3.Cross(normalized, val2); val3 = ((Vector3)(ref val4)).normalized; float num = Time.unscaledTime * 15f; _rightClickLaserVisual.SetActive(true); _rightClickLaserLine.SetPosition(0, start); _rightClickLaserLine.SetPosition(1, end); DrawRightClickLaserSwirl(_rightClickLaserSwirlA, start, val2, normalized, val3, magnitude, num); DrawRightClickLaserSwirl(_rightClickLaserSwirlB, start, val2, normalized, val3, magnitude, num + MathF.PI); if ((Object)(object)_rightClickLaserLight != (Object)null) { ((Component)_rightClickLaserLight).transform.position = (hitSomething ? end : (start + (end - start) * 0.5f)); _rightClickLaserLight.range = (hitSomething ? 6f : 3f); _rightClickLaserLight.intensity = (hitSomething ? 4f : 2f); } if (hitSomething) { TryApplyLaserHit(hit, start); } } private static void DrawRightClickLaserSwirl(LineRenderer? line, Vector3 start, Vector3 direction, Vector3 right, Vector3 up, float distance, float phase) { //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_005f: 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_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_0073: 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) //IL_0083: 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) if (!((Object)(object)line == (Object)null)) { if (line.positionCount != 24) { line.positionCount = 24; } for (int i = 0; i < 24; i++) { float num = (float)i / 23f; float num2 = phase + num * MathF.PI * 8f; float num3 = Mathf.Lerp(0.06f, 0.035f, num); Vector3 val = (right * Mathf.Cos(num2) + up * Mathf.Sin(num2)) * num3; line.SetPosition(i, start + direction * (distance * num) + val); } } } private void TryApplyLaserHit(RaycastHit hit, Vector3 sourcePosition) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) if (!(Time.unscaledTime < _nextLaserDamageTime) && !((Object)(object)((RaycastHit)(ref hit)).collider == (Object)null)) { EnemyParent val = ((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent(); if ((Object)(object)val == (Object)null) { Enemy componentInParent = ((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent(); val = (((Object)(object)componentInParent != (Object)null) ? GetEnemyParent(componentInParent) : null); } if ((Object)(object)val == (Object)null) { PhysGrabObject componentInParent2 = ((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent(); val = (((Object)(object)componentInParent2 != (Object)null) ? ResolveEnemyFromPhysGrabObject(componentInParent2) : null); } if (!((Object)(object)val == (Object)null) && IsLiveEnemy(val)) { _nextLaserDamageTime = Time.unscaledTime + 0.12f; DamageEnemy(val, sourcePosition, GetLaserDamageFromText(updateConfig: false)); } } } private void DeactivateRightClickLaser() { if ((Object)(object)_rightClickLaserVisual != (Object)null) { _rightClickLaserVisual.SetActive(false); } } private void DestroyRightClickLaser() { if ((Object)(object)_rightClickLaserVisual != (Object)null) { Object.Destroy((Object)(object)_rightClickLaserVisual); _rightClickLaserVisual = null; _rightClickLaserLine = null; _rightClickLaserSwirlA = null; _rightClickLaserSwirlB = null; _rightClickLaserLight = null; } if ((Object)(object)_rightClickLaserMaterial != (Object)null) { Object.Destroy((Object)(object)_rightClickLaserMaterial); _rightClickLaserMaterial = null; } } private bool TryRefreshSummonCatalog(bool force = false) { try { RefreshSummonCatalog(force); return true; } catch (Exception arg) { _summonCatalogBuilt = true; _summonCatalogStatus = "Summon list could not finish indexing. Check LogOutput.log."; ((BaseUnityPlugin)this).Logger.LogWarning((object)$"GodCommands summon catalog failed: {arg}"); return false; } } private void RefreshSummonCatalog(bool force = false) { //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) Scene activeScene = SceneManager.GetActiveScene(); string name = ((Scene)(ref activeScene)).name; int num = (((Object)(object)StatsManager.instance != (Object)null && StatsManager.instance.itemDictionary != null) ? StatsManager.instance.itemDictionary.Count : 0); if (force || !_summonCatalogBuilt || num != _summonCatalogKnownItemCount || !string.Equals(name, _summonCatalogSceneName, StringComparison.Ordinal)) { Dictionary dictionary = new Dictionary(StringComparer.OrdinalIgnoreCase); CollectKnownItems(dictionary); CollectSummonablesFromObject(dictionary, ShopManager.instance); CollectSummonablesFromObject(dictionary, ItemManager.instance); CollectSummonablesFromObject(dictionary, ValuableDirector.instance); CollectSummonablesFromObject(dictionary, AssetManager.instance); CollectSceneSummonables(dictionary); _summonables.Clear(); _summonables.AddRange(dictionary.Values.OrderBy((SummonableItem item) => item.DisplayName, StringComparer.OrdinalIgnoreCase)); _summonCatalogBuilt = true; _summonCatalogSceneName = name; _summonCatalogKnownItemCount = num; _summonCatalogStatus = ((_summonables.Count == 0) ? "No summonable items are indexed yet. Load into a level, then press Refresh." : "Summon list is cached. Press Refresh after changing levels if items are missing."); } } private static void CollectKnownItems(Dictionary items) { StatsManager instance = StatsManager.instance; if ((Object)(object)instance != (Object)null && instance.itemDictionary != null) { foreach (Item value in instance.itemDictionary.Values) { AddSummonableItem(items, value); } } ShopManager instance2 = ShopManager.instance; if ((Object)(object)instance2 != (Object)null) { AddSummonableItems(items, instance2.potentialItems); AddSummonableItems(items, instance2.potentialItemConsumables); AddSummonableItems(items, instance2.potentialItemUpgrades); AddSummonableItems(items, instance2.potentialItemHealthPacks); } } private static void AddSummonableItems(Dictionary items, IEnumerable? sourceItems) { if (sourceItems == null) { return; } foreach (Item sourceItem in sourceItems) { AddSummonableItem(items, sourceItem); } } private static void CollectSummonablesFromObject(Dictionary items, object? source) { if (source == null) { return; } Object val = (Object)((source is Object) ? source : null); if (val != null && val == (Object)null) { return; } FieldInfo[] fields = source.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { object value; try { value = fieldInfo.GetValue(source); } catch { continue; } try { AddSummonableValue(items, value); } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Skipped summon catalog field " + fieldInfo.Name + ": " + ex.Message)); } } } } private static void CollectSceneSummonables(Dictionary items) { ItemAttributes[] array = Object.FindObjectsOfType(); foreach (ItemAttributes val in array) { AddSummonablePrefab(items, ((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); } ItemEquippable[] array2 = Object.FindObjectsOfType(); foreach (ItemEquippable val2 in array2) { AddSummonablePrefab(items, ((Object)(object)val2 != (Object)null) ? ((Component)val2).gameObject : null); } ItemUpgrade[] array3 = Object.FindObjectsOfType(); foreach (ItemUpgrade val3 in array3) { AddSummonablePrefab(items, ((Object)(object)val3 != (Object)null) ? ((Component)val3).gameObject : null); } ItemValuableBox[] array4 = Object.FindObjectsOfType(); foreach (ItemValuableBox val4 in array4) { AddSummonablePrefab(items, ((Object)(object)val4 != (Object)null) ? ((Component)val4).gameObject : null); } ValuableObject[] array5 = Object.FindObjectsOfType(); foreach (ValuableObject val5 in array5) { AddSummonablePrefab(items, ((Object)(object)val5 != (Object)null) ? ((Component)val5).gameObject : null); } CosmeticWorldObject[] array6 = Object.FindObjectsOfType(); foreach (CosmeticWorldObject val6 in array6) { AddSummonablePrefab(items, ((Object)(object)val6 != (Object)null) ? ((Component)val6).gameObject : null); } NotValuableObject[] array7 = Object.FindObjectsOfType(); foreach (NotValuableObject val7 in array7) { AddSummonablePrefab(items, ((Object)(object)val7 != (Object)null) ? ((Component)val7).gameObject : null); } } private static void AddSummonableValue(Dictionary items, object? value) { if (value == null || value is string) { return; } Object val = (Object)((value is Object) ? value : null); if (val != null && val == (Object)null) { return; } GameObject val2 = (GameObject)((value is GameObject) ? value : null); if (val2 != null) { AddSummonablePrefab(items, val2); return; } Component val3 = (Component)((value is Component) ? value : null); if (val3 != null) { try { AddSummonablePrefab(items, ((Object)(object)val3 != (Object)null) ? val3.gameObject : null); return; } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Skipped broken summonable component: " + ex.Message)); } return; } } Item val4 = (Item)((value is Item) ? value : null); if (val4 != null) { AddSummonableItem(items, val4); return; } if (value is IDictionary dictionary) { try { int num = 0; foreach (object value2 in dictionary.Values) { AddSummonableValue(items, value2); if (++num >= 1500) { break; } } return; } catch (Exception ex2) { Plugin? instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogDebug((object)("Skipped summonable dictionary: " + ex2.Message)); } return; } } if (!(value is IEnumerable enumerable)) { return; } try { int num2 = 0; foreach (object item in enumerable) { try { AddSummonableValue(items, item); } catch (Exception ex3) { Plugin? instance3 = Instance; if (instance3 != null) { ((BaseUnityPlugin)instance3).Logger.LogDebug((object)("Skipped summonable catalog entry: " + ex3.Message)); } } if (++num2 >= 1500) { break; } } } catch (Exception ex4) { Plugin? instance4 = Instance; if (instance4 != null) { ((BaseUnityPlugin)instance4).Logger.LogDebug((object)("Skipped summonable enumerable: " + ex4.Message)); } } } private static void AddSummonableItem(Dictionary items, Item? item) { if ((Object)(object)item == (Object)null || item.disabled || item.prefab == null || !item.prefab.IsValid()) { return; } GameObject prefab; try { prefab = item.prefab.Prefab; } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Skipped item prefab " + ((Object)item).name + ": " + ex.Message)); } return; } if (!((Object)(object)prefab == (Object)null)) { string displayNameOverride = ((!string.IsNullOrWhiteSpace(item.itemName)) ? item.itemName : ((!string.IsNullOrWhiteSpace(((Object)item).name)) ? ((Object)item).name : GetSummonableDisplayName(prefab))); AddSummonablePrefab(items, prefab, displayNameOverride); } } private static void AddSummonablePrefab(Dictionary items, GameObject? prefab, string? displayNameOverride = null) { if ((Object)(object)prefab == (Object)null) { return; } string text = "unknown item"; try { text = ((Object)prefab).name; } catch { return; } try { if (!IsSummonablePrefab(prefab)) { return; } } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Skipped invalid summonable prefab " + text + ": " + ex.Message)); } return; } string text2; try { text2 = ((!string.IsNullOrWhiteSpace(displayNameOverride)) ? displayNameOverride : GetSummonableDisplayName(prefab)); } catch (Exception ex2) { Plugin? instance2 = Instance; if (instance2 != null) { ((BaseUnityPlugin)instance2).Logger.LogDebug((object)("Used fallback name for summonable prefab " + text + ": " + ex2.Message)); } text2 = text; } string text3 = NormalizeItemName(text2); if (!string.IsNullOrWhiteSpace(text3) && !items.ContainsKey(text3)) { items[text3] = new SummonableItem(text2, prefab); } } private static bool IsSummonablePrefab(GameObject prefab) { if (!((Object)(object)prefab.GetComponentInChildren(true) != (Object)null) && !((Object)(object)prefab.GetComponentInChildren(true) != (Object)null) && !((Object)(object)prefab.GetComponentInChildren(true) != (Object)null) && !((Object)(object)prefab.GetComponentInChildren(true) != (Object)null) && !((Object)(object)prefab.GetComponentInChildren(true) != (Object)null) && !((Object)(object)prefab.GetComponentInChildren(true) != (Object)null) && !((Object)(object)prefab.GetComponentInChildren(true) != (Object)null) && !((Object)(object)prefab.GetComponentInChildren(true) != (Object)null)) { return (Object)(object)prefab.GetComponentInChildren(true) != (Object)null; } return true; } private static string GetSummonableDisplayName(GameObject prefab) { ItemAttributes componentInChildren = prefab.GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { FieldInfo[] array = new FieldInfo[3] { GameFields.ItemAttributesItemName, GameFields.ItemAttributesPromptName, GameFields.ItemAttributesAssetName }; for (int i = 0; i < array.Length; i++) { string text = GameFields.Get(array[i], componentInChildren); if (!string.IsNullOrWhiteSpace(text)) { return text; } } } ValuableObject componentInChildren2 = prefab.GetComponentInChildren(true); if ((Object)(object)componentInChildren2 != (Object)null && !string.IsNullOrWhiteSpace(((Object)componentInChildren2).name)) { return ((Object)componentInChildren2).name.Replace("(Clone)", string.Empty).Trim(); } return ((Object)prefab).name.Replace("(Clone)", string.Empty).Trim(); } private List GetSummonMatches(string query) { if (string.IsNullOrWhiteSpace(query)) { return _summonables.Take(8).ToList(); } string normalized = NormalizeItemName(query); return _summonables.Where((SummonableItem item) => NormalizeItemName(item.DisplayName).Contains(normalized, StringComparison.OrdinalIgnoreCase) || NormalizeItemName(item.PrefabName).Contains(normalized, StringComparison.OrdinalIgnoreCase)).ToList(); } private SummonableItem? FindSummonable(string query) { string normalized = NormalizeItemName(query); if (string.IsNullOrWhiteSpace(normalized)) { return null; } SummonableItem summonableItem = _summonables.FirstOrDefault((SummonableItem item) => string.Equals(NormalizeItemName(item.DisplayName), normalized, StringComparison.OrdinalIgnoreCase) || string.Equals(NormalizeItemName(item.PrefabName), normalized, StringComparison.OrdinalIgnoreCase)); if (summonableItem != null) { return summonableItem; } return _summonables.FirstOrDefault((SummonableItem item) => NormalizeItemName(item.DisplayName).Contains(normalized, StringComparison.OrdinalIgnoreCase) || NormalizeItemName(item.PrefabName).Contains(normalized, StringComparison.OrdinalIgnoreCase)); } private static string NormalizeItemName(string name) { return name.Replace("(Clone)", string.Empty).Replace("_", " ").Replace("-", " ") .Trim(); } private int GetSummonAmount() { if (!int.TryParse(_summonAmountText, out var result)) { result = 1; } return Mathf.Clamp(result, 1, 50); } private void SetSummonAmount(int amount) { _summonAmountText = Mathf.Clamp(amount, 1, 50).ToString(); } [IteratorStateMachine(typeof(d__268))] private static IEnumerable GetLocalPlayerHealthObjects() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__268(-2); } private static IEnumerable GetKnownEnemies() { Dictionary enemies = new Dictionary(); EnemyDirector instance = EnemyDirector.instance; if ((Object)(object)instance != (Object)null && instance.enemiesSpawned != null) { foreach (EnemyParent item in instance.enemiesSpawned) { AddEnemy(item); } } EnemyParent[] array = Object.FindObjectsOfType(); for (int i = 0; i < array.Length; i++) { AddEnemy(array[i]); } Enemy[] array2 = Object.FindObjectsOfType(); for (int i = 0; i < array2.Length; i++) { AddEnemy(GetEnemyParent(array2[i])); } return enemies.Values.Where((EnemyParent enemy) => (Object)(object)enemy != (Object)null); void AddEnemy(EnemyParent? enemy) { if (!((Object)(object)enemy == (Object)null)) { enemies[((Object)enemy).GetInstanceID()] = enemy; } } } private static IEnumerable GetLiveEnemies() { return GetKnownEnemies().Where(IsLiveEnemy); } private static bool IsLiveEnemy(EnemyParent enemy) { if ((Object)(object)enemy == (Object)null) { return false; } if (!IsEnemySpawned(enemy) && ((Object)(object)enemy.EnableObject == (Object)null || !enemy.EnableObject.activeInHierarchy)) { return false; } EnemyHealth enemyHealth = GetEnemyHealth(enemy); if (!((Object)(object)enemyHealth == (Object)null)) { return !IsEnemyHealthDead(enemyHealth); } return true; } private static bool KillEnemy(EnemyParent enemy, Vector3 sourcePosition) { //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_0046: 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_003d: Unknown result type (might be due to invalid IL or missing references) EnemyHealth enemyHealth = GetEnemyHealth(enemy); if ((Object)(object)enemyHealth != (Object)null && !IsEnemyHealthDead(enemyHealth)) { Vector3 val = ((Component)enemyHealth).transform.position - sourcePosition; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.up; } enemyHealth.Hurt(999999, ((Vector3)(ref val)).normalized); return true; } if (IsEnemySpawned(enemy)) { enemy.Despawn(); return true; } return false; } private static bool DamageEnemy(EnemyParent enemy, Vector3 sourcePosition, int damage) { //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_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_004a: 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) EnemyHealth enemyHealth = GetEnemyHealth(enemy); if ((Object)(object)enemyHealth == (Object)null || IsEnemyHealthDead(enemyHealth)) { return false; } Vector3 val = ((Component)enemyHealth).transform.position - sourcePosition; if (((Vector3)(ref val)).sqrMagnitude < 0.001f) { val = Vector3.up; } enemyHealth.Hurt(Mathf.Max(1, damage), ((Vector3)(ref val)).normalized); return true; } private static EnemyHealth? GetEnemyHealth(EnemyParent enemy) { Enemy enemy2 = GetEnemy(enemy); if ((Object)(object)enemy2 != (Object)null && GameFields.Get(GameFields.EnemyHasHealth, enemy2)) { EnemyHealth val = GameFields.Get(GameFields.EnemyHealth, enemy2); if ((Object)(object)val != (Object)null) { return val; } } return ((Component)enemy).GetComponentInChildren(); } private static Enemy? GetEnemy(EnemyParent enemy) { return GameFields.Get(GameFields.EnemyParentEnemy, enemy); } private static EnemyParent? GetEnemyParent(Enemy enemy) { return GameFields.Get(GameFields.EnemyEnemyParent, enemy); } private static bool IsEnemySpawned(EnemyParent enemy) { return GameFields.Get(GameFields.EnemyParentSpawned, enemy); } private static bool IsEnemyHealthDead(EnemyHealth health) { if (!GameFields.Get(GameFields.EnemyHealthDead, health)) { return GameFields.Get(GameFields.EnemyHealthDeadImpulse, health); } return true; } private static EnemyParent? ResolveEnemyFromPhysGrabObject(PhysGrabObject physGrabObject) { EnemyRigidbody val = GameFields.Get(GameFields.PhysGrabEnemyRigidbody, physGrabObject); if (!GameFields.Get(GameFields.PhysGrabIsEnemy, physGrabObject) && (Object)(object)val == (Object)null && (Object)(object)((Component)physGrabObject).GetComponentInParent() == (Object)null) { return null; } EnemyRigidbody val2 = (((Object)(object)val != (Object)null) ? val : ((Component)physGrabObject).GetComponentInParent()); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.enemy != (Object)null) { return GetEnemyParent(val2.enemy); } Enemy componentInParent = ((Component)physGrabObject).GetComponentInParent(); if (!((Object)(object)componentInParent != (Object)null)) { return ((Component)physGrabObject).GetComponentInParent(); } return GetEnemyParent(componentInParent); } private static Vector3? GetPlayerPosition() { //IL_004c: 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) PlayerController instance = PlayerController.instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.playerAvatarScript != (Object)null) { return ((Component)instance.playerAvatarScript).transform.position; } if (!((Object)(object)instance != (Object)null)) { return null; } return ((Component)instance).transform.position; } private static PlayerAvatar? GetLocalPlayerAvatar() { PlayerController instance = PlayerController.instance; if (!((Object)(object)instance != (Object)null)) { return null; } return instance.playerAvatarScript; } private static bool IsLocalPlayer(PlayerAvatar? player) { if ((Object)(object)player == (Object)null) { return false; } PlayerAvatar localPlayerAvatar = GetLocalPlayerAvatar(); if ((Object)(object)localPlayerAvatar != (Object)null && player == localPlayerAvatar) { return true; } return GameFields.Get(GameFields.PlayerAvatarIsLocal, player); } private static List GetPlayerRooms() { PlayerController instance = PlayerController.instance; PlayerAvatar val = (((Object)(object)instance != (Object)null) ? instance.playerAvatarScript : null); RoomVolumeCheck val2 = (((Object)(object)val != (Object)null) ? val.RoomVolumeCheck : null); if ((Object)(object)val2 == (Object)null || val2.CurrentRooms == null) { return new List(); } return val2.CurrentRooms.Where((RoomVolume room) => (Object)(object)room != (Object)null).ToList(); } private static void TryRefreshEnemyRooms(EnemyParent enemy) { try { enemy.GetRoomVolume(); } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Could not refresh room for " + DescribeEnemy(enemy) + ": " + ex.Message)); } } } private static bool SharesRoom(EnemyParent enemy, List playerRooms) { List enemyRooms = GetEnemyRooms(enemy); if (enemyRooms.Count == 0) { return false; } foreach (RoomVolume item in enemyRooms) { if ((Object)(object)item != (Object)null && playerRooms.Contains(item)) { return true; } } return false; } private static List GetEnemyRooms(EnemyParent enemy) { List list = GameFields.Get>(GameFields.EnemyParentCurrentRooms, enemy); if (list == null) { return new List(); } return list.Where((RoomVolume room) => (Object)(object)room != (Object)null).ToList(); } private static Vector3 GetEnemyPosition(EnemyParent enemy) { //IL_0030: 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) Enemy enemy2 = GetEnemy(enemy); if ((Object)(object)enemy2 != (Object)null && (Object)(object)enemy2.CenterTransform != (Object)null) { return enemy2.CenterTransform.position; } return ((Component)enemy).transform.position; } private static string DescribeEnemy(EnemyParent enemy) { if (!string.IsNullOrWhiteSpace(enemy.enemyName)) { return enemy.enemyName; } Enemy enemy2 = GetEnemy(enemy); if ((Object)(object)enemy2 != (Object)null) { return ((object)(EnemyType)(ref enemy2.Type)).ToString(); } if (!string.IsNullOrWhiteSpace(((Component)enemy).tag) && ((Component)enemy).tag != "Untagged") { return ((Component)enemy).tag; } return ((Object)enemy).name.Replace("(Clone)", string.Empty).Trim(); } private static string DescribeObject(GameObject gameObject) { if ((Object)(object)gameObject == (Object)null) { return "unknown"; } return ((Object)gameObject).name.Replace("(Clone)", string.Empty).Trim(); } private static string FormatKilledMessage(List killed, string emptyMessage) { if (killed.Count == 0) { return emptyMessage; } if (killed.Count == 1) { return "killed monster " + killed[0]; } string text = string.Join(", ", killed.Take(6)); if (killed.Count > 6) { text += $", and {killed.Count - 6} more"; } return "killed monsters " + text; } private int ApplyIndestructibleToLoot() { int num = 0; PhysGrabObject[] array = Object.FindObjectsOfType(); foreach (PhysGrabObject val in array) { if (IsLootPhysGrabObject(val)) { val.OverrideIndestructible(5f); PhysGrabObjectImpactDetector impactDetector = GetImpactDetector(val); if ((Object)(object)impactDetector != (Object)null) { GameFields.Set(GameFields.ImpactDetectorIsIndestructible, impactDetector, value: true); impactDetector.destroyDisable = true; } num++; } } CosmeticWorldObject[] array2 = Object.FindObjectsOfType(); foreach (CosmeticWorldObject instance in array2) { PhysGrabObject val2 = GameFields.Get(GameFields.CosmeticPhysGrabObject, instance); if (!((Object)(object)val2 == (Object)null)) { val2.OverrideIndestructible(5f); PhysGrabObjectImpactDetector impactDetector2 = GetImpactDetector(val2); if ((Object)(object)impactDetector2 != (Object)null) { GameFields.Set(GameFields.ImpactDetectorIsIndestructible, impactDetector2, value: true); impactDetector2.destroyDisable = true; } } } return num; } private int ClearIndestructibleLoot() { int num = 0; PhysGrabObject[] array = Object.FindObjectsOfType(); foreach (PhysGrabObject val in array) { if (IsLootPhysGrabObject(val)) { val.ResetIndestructible(); PhysGrabObjectImpactDetector impactDetector = GetImpactDetector(val); if ((Object)(object)impactDetector != (Object)null) { GameFields.Set(GameFields.ImpactDetectorIsIndestructible, impactDetector, value: false); impactDetector.destroyDisable = false; } num++; } } return num; } private static bool IsLootPhysGrabObject(PhysGrabObject physGrabObject) { if ((Object)(object)physGrabObject == (Object)null || GameFields.Get(GameFields.PhysGrabIsEnemy, physGrabObject) || GameFields.Get(GameFields.PhysGrabIsPlayer, physGrabObject) || GameFields.Get(GameFields.PhysGrabIsCart, physGrabObject)) { return false; } if (!GameFields.Get(GameFields.PhysGrabIsValuable, physGrabObject) && !((Object)(object)((Component)physGrabObject).GetComponent() != (Object)null) && !((Object)(object)((Component)physGrabObject).GetComponent() != (Object)null)) { return (Object)(object)((Component)physGrabObject).GetComponent() != (Object)null; } return true; } private static PhysGrabObjectImpactDetector? GetImpactDetector(PhysGrabObject physGrabObject) { PhysGrabObjectImpactDetector val = GameFields.Get(GameFields.PhysGrabImpactDetector, physGrabObject); if (!((Object)(object)val != (Object)null)) { return ((Component)physGrabObject).GetComponent(); } return val; } private static ExtractionPoint? GetActiveExtractionPoint() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Invalid comparison between Unknown and I4 RoundDirector instance = RoundDirector.instance; if ((Object)(object)instance != (Object)null && GameFields.Get(GameFields.RoundExtractionPointActive, instance)) { ExtractionPoint val = GameFields.Get(GameFields.RoundExtractionPointCurrent, instance); if ((Object)(object)val != (Object)null) { return val; } } ExtractionPoint[] array = Object.FindObjectsOfType(); foreach (ExtractionPoint val2 in array) { if ((Object)(object)val2 != (Object)null && (int)GameFields.Get(GameFields.ExtractionCurrentState, val2) == 2) { return val2; } } return null; } private static Vector3 GetExtractionDropPosition(ExtractionPoint extractionPoint) { //IL_0014: 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_0053: 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_003d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)extractionPoint.surplusSpawnTransform != (Object)null) { return extractionPoint.surplusSpawnTransform.position; } if ((Object)(object)extractionPoint.extractionArea != (Object)null) { return extractionPoint.extractionArea.transform.position + Vector3.up; } return ((Component)extractionPoint).transform.position + Vector3.up; } private static int GetValuableValue(ValuableObject valuable) { int num = GameFields.Get(GameFields.ValuableDollarValueOverride, valuable); if (num > 0) { return num; } float num2 = GameFields.Get(GameFields.ValuableDollarValueCurrent, valuable); if (num2 <= 0f) { try { valuable.DollarValueSetLogic(); num2 = GameFields.Get(GameFields.ValuableDollarValueCurrent, valuable); } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogDebug((object)("Could not refresh value for " + ((Object)valuable).name + ": " + ex.Message)); } } } float num3 = GameFields.Get(GameFields.ValuableDollarValueOriginal, valuable); return Mathf.RoundToInt(Mathf.Max(num2, num3)); } private static void DestroyLootObject(GameObject gameObject, PhysGrabObject? physGrabObject) { try { if ((Object)(object)physGrabObject != (Object)null) { physGrabObject.DestroyPhysGrabObject(); return; } } catch (Exception ex) { Plugin? instance = Instance; if (instance != null) { ((BaseUnityPlugin)instance).Logger.LogWarning((object)("Could not destroy loot through PhysGrabObject: " + ex.Message)); } } Object.Destroy((Object)(object)gameObject); } private static void MoveToExtractor(Transform transform, Vector3 dropCenter, int index) { //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_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_000e: 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_004f: 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_002b: 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_003d: Unknown result type (might be due to invalid IL or missing references) Vector3 dropOffset = GetDropOffset(index); Vector3 val = dropCenter + dropOffset; Rigidbody component = ((Component)transform).GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = Vector3.zero; component.angularVelocity = Vector3.zero; component.MovePosition(val); component.MoveRotation(Quaternion.identity); } transform.position = val; transform.rotation = Quaternion.identity; PhysGrabObject component2 = ((Component)transform).GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.OverrideIndestructible(2f); } } private static Vector3 GetDropOffset(int index) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) int num = index / 8 + 1; float num2 = (float)(index % 8) * MathF.PI * 0.25f; float num3 = (float)num * 0.28f; return new Vector3(Mathf.Cos(num2) * num3, 0.25f + 0.04f * (float)index, Mathf.Sin(num2) * num3); } private static bool SpawnMoneybag(int value, ExtractionPoint extractionPoint, Vector3 dropCenter) { //IL_0060: 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: 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_00ec: 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) AssetManager instance = AssetManager.instance; if ((Object)(object)instance == (Object)null) { return false; } GameObject val = instance.surplusValuableSmall; if (value > 10000 && (Object)(object)instance.surplusValuableBig != (Object)null) { val = instance.surplusValuableBig; } else if (value > 5000 && (Object)(object)instance.surplusValuableMedium != (Object)null) { val = instance.surplusValuableMedium; } if ((Object)(object)val == (Object)null) { return false; } GameObject obj = Object.Instantiate(val, dropCenter + Vector3.up * 0.35f, Quaternion.identity); ((Object)obj).name = $"GodCommands Moneybag ${value}"; ValuableObject component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { GameFields.Set(GameFields.ValuableDollarValueOverride, component, value); GameFields.Set(GameFields.ValuableDollarValueCurrent, (object)component, (float)value); GameFields.Set(GameFields.ValuableDollarValueOriginal, (object)component, (float)value); GameFields.Set(GameFields.ValuableDollarValueSet, component, value: true); } PhysGrabObject component2 = obj.GetComponent(); if ((Object)(object)component2 != (Object)null) { GameFields.Set(GameFields.PhysGrabSpawnTorque, component2, Random.insideUnitSphere * 0.05f); if ((Object)(object)Instance != (Object)null && Instance._lootIndestructible) { component2.OverrideIndestructible(5f); } } return true; } private static bool IsActiveComponent(Component component) { if ((Object)(object)component == (Object)null || !component.gameObject.activeInHierarchy) { return false; } Behaviour val = (Behaviour)(object)((component is Behaviour) ? component : null); if (val != null) { return val.enabled; } return true; } private static bool NoTextInputActive() { try { return HotkeyInput.NoTextInputActive((Func)SemiFunc.NoTextInputsActive); } catch { return true; } } internal static bool IsSoloPlayer() { try { if ((Object)(object)GameManager.instance != (Object)null && GameManager.Multiplayer()) { return false; } } catch { return false; } try { return !SemiFunc.IsMultiplayer(); } catch { return true; } } } internal readonly struct RendererState { internal Renderer Renderer { get; } internal bool WasEnabled { get; } internal RendererState(Renderer renderer, bool wasEnabled) { Renderer = renderer; WasEnabled = wasEnabled; } } internal readonly struct ColliderState { internal Collider Collider { get; } internal bool WasEnabled { get; } internal ColliderState(Collider collider, bool wasEnabled) { Collider = collider; WasEnabled = wasEnabled; } } internal readonly struct RigidbodyState { internal Rigidbody Rigidbody { get; } internal bool UseGravity { get; } internal bool IsKinematic { get; } internal bool DetectCollisions { get; } internal float Drag { get; } internal float AngularDrag { get; } internal RigidbodyState(Rigidbody rigidbody, bool useGravity, bool isKinematic, bool detectCollisions, float drag, float angularDrag) { Rigidbody = rigidbody; UseGravity = useGravity; IsKinematic = isKinematic; DetectCollisions = detectCollisions; Drag = drag; AngularDrag = angularDrag; } } internal sealed class SummonableItem { internal string DisplayName { get; } internal GameObject Prefab { get; } internal string PrefabName { get; } internal SummonableItem(string displayName, GameObject prefab) { DisplayName = displayName; Prefab = prefab; try { PrefabName = (((Object)(object)prefab != (Object)null) ? ((Object)prefab).name : displayName); } catch { PrefabName = displayName; } } } internal enum AdminAction { InfiniteEnergy, Invisibility, Invulnerable, KillClick, LaserOnRightClick, LightsOn, Noclip, ShowMonsters, ShowRespawnTimers, DisableSpawning, IndestructibleLoot, UnlimitedGearEnergy, GiveMoney, KillNearest, KillRoom, KillAll, ExtractAll, TeleportToExtractor, TeleportToTruck, SummonItem } [HarmonyPatch(typeof(PhysGrabber), "StartGrabbingPhysObject")] internal static class PhysGrabberStartGrabbingPhysObjectPatch { private static bool Prefix(PhysGrabObject _physGrabObject) { return !Plugin.TryKillClickedEnemy(_physGrabObject); } } [HarmonyPatch(typeof(EnemyParent), "Spawn")] internal static class EnemyParentSpawnPatch { private static bool Prefix(EnemyParent __instance) { return !Plugin.ShouldBlockEnemySpawn(__instance); } } [HarmonyPatch(typeof(EnemyVision), "VisionTrigger")] internal static class EnemyVisionVisionTriggerPatch { private static bool Prefix(PlayerAvatar player) { return !Plugin.IsInvisibilityActiveFor(player); } } [HarmonyPatch(typeof(Enemy), "SetChaseTarget")] internal static class EnemySetChaseTargetPatch { private static bool Prefix(PlayerAvatar playerAvatar) { return !Plugin.IsInvisibilityActiveFor(playerAvatar); } } [HarmonyPatch(typeof(EnemyDirector), "SetInvestigate")] internal static class EnemyDirectorSetInvestigatePatch { private static bool Prefix() { return !Plugin.ShouldBlockInvestigation(); } } [HarmonyPatch(typeof(ItemBattery), "Drain")] internal static class ItemBatteryDrainPatch { private static bool Prefix(ItemBattery __instance) { return !Plugin.ShouldBlockBatteryDrain(__instance); } } [HarmonyPatch(typeof(ItemBattery), "RemoveFullBar")] internal static class ItemBatteryRemoveFullBarPatch { private static bool Prefix(ItemBattery __instance) { return !Plugin.ShouldBlockBatteryDrain(__instance); } } [HarmonyPatch(typeof(ItemBattery), "SetBatteryLife")] internal static class ItemBatterySetBatteryLifePatch { private static bool Prefix(ItemBattery __instance, ref int _batteryLife) { return !Plugin.ShouldBlockBatterySetLife(__instance, ref _batteryLife); } } [HarmonyPatch(typeof(ItemBattery), "BatteryFullPercentChange")] internal static class ItemBatteryBatteryFullPercentChangePatch { private static bool Prefix(ItemBattery __instance, ref int _batteryLifeInt, ref bool charge) { return !Plugin.ShouldBlockBatteryFullPercentChange(__instance, ref _batteryLifeInt, ref charge); } } [HarmonyPatch(typeof(PlayerHealth), "Hurt")] internal static class PlayerHealthHurtPatch { private static bool Prefix(PlayerHealth __instance, ref int damage) { return !Plugin.ShouldBlockPlayerDamage(__instance, ref damage); } } [HarmonyPatch(typeof(PlayerHealth), "HurtOther")] internal static class PlayerHealthHurtOtherPatch { private static bool Prefix(PlayerHealth __instance, ref int damage) { return !Plugin.ShouldBlockPlayerDamage(__instance, ref damage); } } }