// Consolidated decompiled source — Azumatt-AdminMenu v2.0.1 // Generated by Hexium's decompiled-source browser. Best-effort concatenation of every type in this // version's manifest — decompiler output isn't guaranteed to compile as-is. using System; using System.Runtime.CompilerServices; using Microsoft.CodeAnalysis; using AdminMenu; using AdminMenu.Util; using TMPro; using UnityEngine; using UnityEngine.UI; using UnityEngine.EventSystems; using HarmonyLib; using System.IO; using System.Linq; using System.Reflection; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using System.Collections.Generic; using System.Globalization; using Enviro; using Fusion; using System.Text.RegularExpressions; using Cysharp.Threading.Tasks; using UnityEngine.Localization; // ---- AdminMenu.dll :: Microsoft.CodeAnalysis.EmbeddedAttribute ---- namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } // ---- AdminMenu.dll :: System.Runtime.CompilerServices.NullableAttribute ---- 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; } } } // ---- AdminMenu.dll :: System.Runtime.CompilerServices.NullableContextAttribute ---- namespace System.Runtime.CompilerServices { [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; } } } // ---- AdminMenu.dll :: SpawnerPlaceholder ---- public class SpawnerPlaceholder : MonoBehaviour { public static SpawnerPlaceholder Instance; public ExtButton Btn; public RawImage Icon; public Image Bkg; public HorizontalLayoutGroup AdditionalInfoHlg; public Text DisplayName; public Text InternalName; public Text Cost; public Text Damage; public Text Armor; public Text Level; [Header("Spawner View Right")] public GameObject SpawnerViewRight; public TMP_InputField Search; public TMP_InputField Amount; public Text AmountText; public Text ShowFavoritesText; public Text ShowFavoritesDescription; public Toggle ShowFavorites; public Text PutInInventoryText; public Text PutInInventoryDescription; public Toggle PutInInventory; public void Awake() { Instance = this; ShowFavorites.onValueChanged.AddListener(ShowFavoritesChanged); PutInInventory.onValueChanged.AddListener(PutInInventoryChanged); Btn.OnRightClick += RightClickItem; } public void Update() { PutInInventory.isOn = true; } public void SpawnItem() { AdminMenuPlugin.AdminMenuLogger.LogInfo("SpawnItem: " + DisplayName.text); if (PutInInventory == null || !PutInInventory.isOn) { return; } if ((Object)(object)RM.code == null || RM.code.allItems == null) { AdminMenuPlugin.AdminMenuLogger.LogError("RM or its properties are null!"); return; } int num = 1; if (Amount != null && int.TryParse(Amount.text, out var result)) { num = result; } foreach (Transform item in RM.code.allItems.items) { if (!(item != null) || !item.TryGetComponent(out var component) || !(component.DisplayName == Cost.text)) { continue; } if ((Object)(object)Global.code.Player.playerStorage != null) { for (int i = 0; i < num; i++) { if (!Global.code.Player.playerStorage.TryAddItem(Utility.Instantiate(component), true, true)) { Global.code.Player.quickSlotStorage.TryAddItem(Utility.Instantiate(component), true, true); } } break; } AdminMenuPlugin.AdminMenuLogger.LogError("playerStorage is null!"); } } public void RightClickItem() { if (string.IsNullOrWhiteSpace(Cost.text)) { return; } foreach (Transform item in RM.code.allItems.items) { if (item != null && item.TryGetComponent(out var component) && (bool)(Object)(object)component && !(component.DisplayName != Cost.text)) { try { Utilities.CustomUseItem(component); break; } catch { AdminMenuPlugin.AdminMenuLogger.LogInfo("Failed to use item: " + Cost.text); break; } } } } public void ShowFavoritesChanged(bool value) { ShowFavorites.isOn = value; ShowFavoritesDescription.text = (value ? "Active" : "InActive"); ShowFavoritesDescription.color = (value ? AdminUI.GreenTextColor : AdminUI.RedTextColor); } public void PutInInventoryChanged(bool value) { PutInInventory.isOn = value; PutInInventoryDescription.text = (value ? "Active" : "InActive"); PutInInventoryDescription.color = (value ? AdminUI.GreenTextColor : AdminUI.RedTextColor); } } // ---- AdminMenu.dll :: ExtButton ---- [RequireComponent(typeof(Button))] public class ExtButton : Button { public delegate void RightClickAction(); public event RightClickAction OnRightClick; public override void OnPointerClick(PointerEventData eventData) { if (eventData.button == PointerEventData.InputButton.Right) { this.OnRightClick?.Invoke(); } else { base.OnPointerClick(eventData); } } } // ---- AdminMenu.dll :: AdminMenu.GlobalCSPatch ---- namespace AdminMenu { [HarmonyPatch(typeof(Global), "Update")] internal static class GlobalCSPatch { private static void Postfix(Global __instance) { if (UIGameMenuAwakePatch.Admin && (bool)(Object)(object)Utilities.GInst) { if (AdminMenuPlugin.OpenuiHotkey.Value.IsDown()) { AdminMenuPlugin.AdminUI.SetActive(!AdminMenuPlugin.AdminUI.activeSelf); Utilities.TurnOnUI(); } if (Checks.AdminPanelActive() && !__instance.DialogueManager.IsInDialogue) { Utilities.TurnOnUI(); Cursor.visible = true; Cursor.SetCursor(RM.code.cursorNormal, Vector2.zero, CursorMode.Auto); Cursor.lockState = CursorLockMode.None; } Checks.CheckPlayer(); Checks.CheckWeapon(); if ((Object)(object)Utilities.FpspInst != null && AdminUI.noClip && Input.anyKey) { Transform transform = ((Component)(object)Utilities.FpspInst).transform; Transform transform2 = Utilities.CamInst.transform; float num = Utilities.GetKey(KeyCode.W) - Utilities.GetKey(KeyCode.S); float num2 = Utilities.GetKey(KeyCode.D) - Utilities.GetKey(KeyCode.A); transform.position += (transform.up * (Utilities.GetKey(KeyCode.Space) - Utilities.GetKey(KeyCode.LeftControl)) + transform2.forward * num + transform2.right * num2).normalized * (float)(10.0 + 15.0 * (double)Utilities.GetKey(KeyCode.LeftShift)) * Time.deltaTime; } } } } } // ---- AdminMenu.dll :: AdminMenu.UIGameMenuAwakePatch ---- namespace AdminMenu { [HarmonyPatch(typeof(UICombat), "Start")] internal static class UIGameMenuAwakePatch { public static bool Admin = true; private static void Postfix(UICombat __instance) { if (Mainframe.code.Networking.IsHostAndInGameSession || Mainframe.code.NetworkGameManager.ServerAdministration.IsServerAdmin) { AdminMenuPlugin.AdminMenuLogger.LogDebug("Setting Admin to true"); Admin = true; if (!(AdminMenuPlugin.AdminUI != null)) { if (AdminMenuPlugin.AdminUITemp == null) { AdminMenuPlugin.AdminMenuLogger.LogInfo("AdminUITemp is null, loading assets"); AdminMenuPlugin.LoadAssets(); } Transform transform = Utilities.FindChild(AdminMenuPlugin.AdminUITemp.transform, "AllowPlayers"); if (transform != null) { transform.gameObject.SetActive(value: false); } AdminMenuPlugin.AdminUI = Object.Instantiate(AdminMenuPlugin.AdminUITemp, ((Component)(object)Utilities.GInst.uiCombat).transform, worldPositionStays: false); AdminMenuPlugin.AdminUI.SetActive(value: false); } } else { if (Admin) { AdminMenuPlugin.AdminMenuLogger.LogDebug("Setting Admin to false"); } Admin = false; } } } } // ---- AdminMenu.dll :: AdminMenu.GlobalHandleKeysPatch ---- namespace AdminMenu { [HarmonyPatch(typeof(Global), "HandleKeys")] internal static class GlobalHandleKeysPatch { private static bool Prefix(Global __instance) { if (__instance.Player.IsBusy || __instance.player.IsDead || !GlobalDataHelper.IsGlobalDataValid) { return true; } if (!Checks.AdminPanelActive() || __instance.DialogueManager.IsInDialogue) { return true; } if (InputManager.Instance.EscapePressed) { __instance.ButtonEscape(); } return false; } } } // ---- AdminMenu.dll :: AdminMenu.PlayerCharacterUpdateKeysPatch ---- namespace AdminMenu { [HarmonyPatch(typeof(PlayerCharacter), "UpdateKeys")] internal static class PlayerCharacterUpdateKeysPatch { private static bool Prefix(PlayerCharacter __instance) { if (!Checks.AdminPanelActive()) { return true; } return false; } } } // ---- AdminMenu.dll :: AdminMenu.PlayerAddHealthPatch ---- namespace AdminMenu { [HarmonyPatch(typeof(PlayerCharacter), "AddHealth")] internal static class PlayerAddHealthPatch { private static bool Prefix(PlayerCharacter __instance, float point, int HitPart, Vector3 damageSource, bool canBleed, bool showBiteFx, bool IsMeleeWeapon) { if (point < 0f && HitPart != 3) { return !AdminUI.unlimitedHealth; } return true; } } } // ---- AdminMenu.dll :: AdminMenu.CraftableIsAbleToCraftPatch ---- namespace AdminMenu { [HarmonyPatch(typeof(Craftable), "IsAbleToCraft", new Type[] { typeof(Craftable) })] internal static class CraftableIsAbleToCraftPatch { private static void Postfix(Craftable __instance, ref bool __result) { if (Utilities.GInst.FreeBuild) { __result = true; } } } } // ---- AdminMenu.dll :: AdminMenu.CraftableIsAbleToCraftRequirementsPatch ---- namespace AdminMenu { [HarmonyPatch(typeof(Craftable), "IsAbleToCraft", new Type[] { typeof(CraftingItemRequirement[]) })] internal static class CraftableIsAbleToCraftRequirementsPatch { private static void Postfix(Craftable __instance, ref bool __result) { if (Utilities.GInst.FreeBuild) { __result = true; } } } } // ---- AdminMenu.dll :: AdminMenu.PlayerCharacterConsumeItemPatch ---- namespace AdminMenu { [HarmonyPatch(typeof(PlayerCharacter), "ConsumeItem")] internal static class PlayerCharacterConsumeItemPatch { private static void Postfix(PlayerCharacter __instance, ref bool __result) { if (Utilities.GInst.FreeBuild) { __result = true; } } } } // ---- AdminMenu.dll :: AdminMenu.AdminMenuPlugin ---- namespace AdminMenu { [BepInPlugin("Azumatt.AdminMenu", "AdminMenu", "2.0.1")] public class AdminMenuPlugin : BaseUnityPlugin { public enum Toggle { On = 1, Off = 0 } internal const string ModName = "AdminMenu"; internal const string ModVersion = "2.0.1"; internal const string Author = "Azumatt"; private const string ModGUID = "Azumatt.AdminMenu"; private static string ConfigFileName = "Azumatt.AdminMenu.cfg"; private static string ConfigFileFullPath; private readonly Harmony _harmony = new Harmony("Azumatt.AdminMenu"); public static readonly ManualLogSource AdminMenuLogger; public static AssetBundle? AssetBundle; public static GameObject AdminUITemp; public static GameObject AdminUI; public static ConfigEntry OpenuiHotkey; public static ConfigEntry RemoveDropsHotkey; public static ConfigEntry RemoveDropsRadius; public static ConfigEntry HideEmptyChests; public static ConfigEntry HideBrokenScavengeables; public static ConfigEntry HideCollectibles; public void Awake() { OpenuiHotkey = base.Config.Bind("1 - General", "OpenUIHotkey", new KeyboardShortcut(KeyCode.F3), "The hotkey to open the admin UI"); HideEmptyChests = base.Config.Bind("1 - General", "Hide Empty Chests", Toggle.On, "Hide chests that have no items in them"); HideBrokenScavengeables = base.Config.Bind("1 - General", "Hide Broken Scavengeables", Toggle.On, "Hide scavengeables that have nothing left to give."); HideCollectibles = base.Config.Bind("1 - General", "Hide Collectibles", Toggle.On, "Hide collectibles that have nothing left to give."); Assembly executingAssembly = Assembly.GetExecutingAssembly(); _harmony.PatchAll(executingAssembly); LoadAssets(); SetupWatcher(); } private void OnDestroy() { base.Config.Save(); } private void SetupWatcher() { FileSystemWatcher fileSystemWatcher = new FileSystemWatcher(Paths.ConfigPath, ConfigFileName); fileSystemWatcher.Changed += ReadConfigValues; fileSystemWatcher.Created += ReadConfigValues; fileSystemWatcher.Renamed += ReadConfigValues; fileSystemWatcher.IncludeSubdirectories = true; fileSystemWatcher.SynchronizingObject = ThreadingHelper.SynchronizingObject; fileSystemWatcher.EnableRaisingEvents = true; } private void ReadConfigValues(object sender, FileSystemEventArgs e) { if (!File.Exists(ConfigFileFullPath)) { return; } try { AdminMenuLogger.LogDebug("ReadConfigValues called"); base.Config.Reload(); } catch { AdminMenuLogger.LogError("There was an issue loading your " + ConfigFileName); AdminMenuLogger.LogError("Please check your config entries for spelling and format!"); } } private void OnGUI() { if (!UIGameMenuAwakePatch.Admin) { return; } if (OpenuiHotkey.Value.IsDown()) { AdminUI.SetActive(!AdminUI.activeSelf); Utilities.TurnOnUI(); } if (Checks.AdminPanelActive() && Input.GetKeyDown(KeyCode.Escape)) { AdminUI.SetActive(value: false); } if ((bool)(Object)(object)Utilities.GInst) { if (Checks.AdminPanelActive() && !Utilities.GInst.dialogueManager.IsInDialogue) { Utilities.TurnOnUI(); } Checks.CheckESP(); } } internal static AssetBundle GetAssetBundleFromResources(string filename) { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string text = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(filename)); using Stream stream = executingAssembly.GetManifestResourceStream(text); return UnityEngine.AssetBundle.LoadFromStream(stream); } public static void LoadAssets() { AssetBundle = GetAssetBundleFromResources("sunkenadminui"); AdminUITemp = AssetBundle.LoadAsset("AdminUI"); Object.DontDestroyOnLoad(AdminUITemp); AssetBundle.Unload(unloadAllLoadedObjects: false); } static AdminMenuPlugin() { string configPath = Paths.ConfigPath; char directorySeparatorChar = Path.DirectorySeparatorChar; ConfigFileFullPath = configPath + directorySeparatorChar + ConfigFileName; AdminMenuLogger = BepInEx.Logging.Logger.CreateLogSource("AdminMenu"); AdminUITemp = null; AdminUI = null; OpenuiHotkey = null; RemoveDropsHotkey = null; RemoveDropsRadius = null; HideEmptyChests = null; HideBrokenScavengeables = null; HideCollectibles = null; } } } // ---- AdminMenu.dll :: AdminMenu.AdminUI ---- namespace AdminMenu { public class AdminUI : MonoBehaviour { public static AdminUI Instance; public RectTransform Canvas; public GameObject AdminMenu; public ScrollRect ScrollViewLeft; public RectTransform LeftButtonList; public RectTransform LeftSpawnerList; public RectTransform DefaultRightView; public RectTransform SpawnerView; public Transform spawnerPlaceholder; public SpawnerPlaceholder spawnerPlaceholderComp; public static Color GreenTextColor; public List buttons = new List(); public const string Act = "Active"; public const string Inact = "InActive"; public static bool allowPlayers; public static bool unlimitedHealth; public static bool unlimitedStamina; public static bool unlimitedEnergy; public static bool unlimitedAir; public static bool unlimitedAmmo; public static bool noHunger; public static bool noThirst; public static bool playerESP; public static bool enemyESP; public static bool fishESP; public static bool birdESP; public static bool lootESP; public static bool weaponNoRecoil; public static bool weaponNoSpread; public new static bool transform; public static bool noClip; public static float timeOfDay; public static bool instantKill; [Header("Main Buttons")] public Button playerCheats; public Button visualCheats; public Button weaponCheats; public Button miscCheats; public Button spawnerCheats; [Header("Left - Buttons")] public Button UnlimitedHealth; public Button UnlimitedStamina; public Button UnlimitedEnergy; public Button UnlimitedOxygen; public Button UnlimitedAmmo; public Button FreeBuild; public Button FreeResearch; public Button NoHunger; public Button NoThirst; public Button PlayerESP; public Button EnemyESP; public Button FishESP; public Button BirdESP; public Button LootESP; public Button WeaponNoRecoil; public Button WeaponNoSpread; public Button Transform; public Button NoClip; public Slider TimeOfDay; [Header("Right - Buttons")] public Button AllowPlayers; public Button InstantKill; public Button SavePlayer; public Button LoadPlayer; public Button SaveWorld; public Button LoadWorld; public Button TriggerAutoSave; public Button LoadAutoSave; public TMP_InputField Search; public TMP_InputField Amount; [Header("Button Descriptions")] public Text unlimitedHealthDescription; public Text unlimitedStaminaDescription; public Text unlimitedEnergyDescription; public Text unlimitedOxygenDescription; public Text unlimitedAmmoDescription; public Text freeBuildDescription; public Text freeResearchDescription; public Text noHungerDescription; public Text noThirstDescription; public Text playerEspDescription; public Text enemyEspDescription; public Text fishEspDescription; public Text birdEspDescription; public Text lootEspDescription; public Text weaponNoRecoilDescription; public Text weaponNoSpreadDescription; public Text transformDescription; public Text noClipDescription; public Text instantKillDescription; public Text allowPlayersDescription; public static Color RedTextColor { get; private set; } public void Awake() { GreenTextColor = (ColorUtility.TryParseHtmlString("#25C835", out var color) ? color : Color.green); RedTextColor = unlimitedHealthDescription.color; CreateEventListeners(); PopulateList(RM.code.allItems.items); } public void CreateEventListeners() { UnlimitedHealth.onClick.AddListener(UnlimitedHealth_OnClick); UnlimitedStamina.onClick.AddListener(UnlimitedStamina_OnClick); UnlimitedEnergy.onClick.AddListener(UnlimitedEnergy_OnClick); UnlimitedOxygen.onClick.AddListener(UnlimitedOxygen_OnClick); UnlimitedAmmo.onClick.AddListener(UnlimitedAmmo_OnClick); FreeBuild.onClick.AddListener(FreeBuild_OnClick); FreeResearch.onClick.AddListener(FreeResearch_OnClick); NoHunger.onClick.AddListener(NoHunger_OnClick); NoThirst.onClick.AddListener(NoThirst_OnClick); PlayerESP.onClick.AddListener(PlayerESP_OnClick); EnemyESP.onClick.AddListener(EnemyESP_OnClick); FishESP.onClick.AddListener(FishESP_OnClick); BirdESP.onClick.AddListener(BirdESP_OnClick); LootESP.onClick.AddListener(LootESP_OnClick); WeaponNoRecoil.onClick.AddListener(WeaponNoRecoil_OnClick); WeaponNoSpread.onClick.AddListener(WeaponNoSpread_OnClick); Transform.onClick.AddListener(Transform_OnClick); NoClip.onClick.AddListener(NoClip_OnClick); TimeOfDay.onValueChanged.AddListener(TimeOfDay_OnValueChanged); AllowPlayers.onClick.AddListener(AllowPlayers_OnClick); InstantKill.onClick.AddListener(InstantKill_OnClick); SavePlayer.onClick.AddListener(SavePlayer_OnClick); LoadPlayer.onClick.AddListener(LoadPlayer_OnClick); SaveWorld.onClick.AddListener(SaveWorld_OnClick); LoadWorld.onClick.AddListener(LoadWorld_OnClick); TriggerAutoSave.onClick.AddListener(TriggerAutoSave_OnClick); LoadAutoSave.onClick.AddListener(LoadAutoSave_OnClick); playerCheats.onClick.AddListener(delegate { ToggleSubButtons(playerCheats); }); visualCheats.onClick.AddListener(delegate { ToggleSubButtons(visualCheats); }); weaponCheats.onClick.AddListener(delegate { ToggleSubButtons(weaponCheats); }); miscCheats.onClick.AddListener(delegate { ToggleSubButtons(miscCheats); }); spawnerCheats.onClick.AddListener(ToggleSpawnerList); } public void ToggleSubButtons(Button buttonClicked) { if (!LeftButtonList.gameObject.activeSelf) { LeftButtonList.gameObject.SetActive(value: true); if (LeftSpawnerList.gameObject.activeSelf) { LeftSpawnerList.gameObject.SetActive(value: false); } if (SpawnerView.gameObject.activeSelf) { SpawnerView.gameObject.SetActive(value: false); } if (!DefaultRightView.gameObject.activeSelf) { DefaultRightView.gameObject.SetActive(value: true); } ScrollViewLeft.content = LeftButtonList; } string value = DetermineButtonCategory(buttonClicked); foreach (GameObject button in buttons) { button.SetActive(button.name.Contains(value)); } } public void ToggleSpawnerList() { if (!LeftSpawnerList.gameObject.activeSelf) { LeftSpawnerList.gameObject.SetActive(value: true); if (LeftButtonList.gameObject.activeSelf) { LeftButtonList.gameObject.SetActive(value: false); } ScrollViewLeft.content = LeftSpawnerList; } if (!SpawnerView.gameObject.activeSelf) { SpawnerView.gameObject.SetActive(value: true); if (DefaultRightView.gameObject.activeSelf) { DefaultRightView.gameObject.SetActive(value: false); } } } private string DetermineButtonCategory(Button button) { string[] array = new string[4] { "Player", "Visual", "Weapon", "Misc" }; foreach (string text in array) { if (button.name.Contains(text)) { return text; } } return string.Empty; } public void PopulateList(List items) { foreach (Transform item in items) { if (!item) { continue; } Item component = item.GetComponent(); if (!(component == (Item)null)) { Transform obj = Object.Instantiate(spawnerPlaceholder, LeftSpawnerList, worldPositionStays: true); obj.gameObject.SetActive(value: true); obj.localScale = Vector3.one; SpawnerPlaceholder component2 = obj.GetComponent(); if ((bool)component.icon) { component2.Icon.texture = component.icon; } component2.DisplayName.text = $"{component.DisplayName} ({component.ItemID})"; component2.InternalName.text = component.GetDisplayDescription(); component2.Cost.text = component.DisplayName; if ((bool)(Object)(object)((Component)(object)component).GetComponent()) { component2.Armor.text = ((Component)(object)component).GetComponent().armor.ToString(); } if ((bool)(Object)(object)((Component)(object)component).GetComponent()) { component2.Damage.text = ((Component)(object)component).GetComponent().damage.ToString(CultureInfo.InvariantCulture); } } } } public void FilterItems(string searchTerm) { foreach (Transform item in LeftSpawnerList.transform) { if (item == null || item == spawnerPlaceholder) { continue; } SpawnerPlaceholder component = item.GetComponent(); if (!(component == null)) { if (string.IsNullOrWhiteSpace(searchTerm) || component.DisplayName.text.ToLower().Contains(searchTerm.ToLower())) { item.gameObject.SetActive(value: true); } else { item.gameObject.SetActive(value: false); } } } } public void SearchChanged(string str) { FilterItems(str); AdminMenuPlugin.AdminMenuLogger.LogInfo("SearchChanged: " + str); } public void AmountSearchChanged(string str) { AdminMenuPlugin.AdminMenuLogger.LogInfo("AmountSearchChanged: " + str); } public void UnlimitedHealth_OnClick() { unlimitedHealth = !unlimitedHealth; unlimitedHealthDescription.color = (unlimitedHealth ? GreenTextColor : RedTextColor); unlimitedHealthDescription.text = (unlimitedHealth ? "Active" : "InActive"); } public void UnlimitedStamina_OnClick() { unlimitedStamina = !unlimitedStamina; unlimitedStaminaDescription.color = (unlimitedStamina ? GreenTextColor : RedTextColor); unlimitedStaminaDescription.text = (unlimitedStamina ? "Active" : "InActive"); } public void UnlimitedEnergy_OnClick() { unlimitedEnergy = !unlimitedEnergy; unlimitedEnergyDescription.color = (unlimitedEnergy ? GreenTextColor : RedTextColor); unlimitedEnergyDescription.text = (unlimitedEnergy ? "Active" : "InActive"); } public void UnlimitedOxygen_OnClick() { unlimitedAir = !unlimitedAir; unlimitedOxygenDescription.color = (unlimitedAir ? GreenTextColor : RedTextColor); unlimitedOxygenDescription.text = (unlimitedAir ? "Active" : "InActive"); } public void UnlimitedAmmo_OnClick() { unlimitedAmmo = !unlimitedAmmo; unlimitedAmmoDescription.color = (unlimitedAmmo ? GreenTextColor : RedTextColor); unlimitedAmmoDescription.text = (unlimitedAmmo ? "Active" : "InActive"); } public void FreeBuild_OnClick() { Utilities.GInst.FreeBuild = !Utilities.GInst.FreeBuild; freeBuildDescription.color = (Utilities.GInst.FreeBuild ? GreenTextColor : RedTextColor); freeBuildDescription.text = (Utilities.GInst.FreeBuild ? "Active" : "InActive"); } public void FreeResearch_OnClick() { Utilities.GInst.UnLockAllResearch = !Utilities.GInst.UnLockAllResearch; freeResearchDescription.color = (Utilities.GInst.UnLockAllResearch ? GreenTextColor : RedTextColor); freeResearchDescription.text = (Utilities.GInst.UnLockAllResearch ? "Active" : "InActive"); } public void NoHunger_OnClick() { noHunger = !noHunger; noHungerDescription.color = (noHunger ? GreenTextColor : RedTextColor); noHungerDescription.text = (noHunger ? "Active" : "InActive"); } public void NoThirst_OnClick() { noThirst = !noThirst; noThirstDescription.color = (noThirst ? GreenTextColor : RedTextColor); noThirstDescription.text = (noThirst ? "Active" : "InActive"); } public void PlayerESP_OnClick() { playerESP = !playerESP; playerEspDescription.color = (playerESP ? GreenTextColor : RedTextColor); playerEspDescription.text = (playerESP ? "Active" : "InActive"); } public void EnemyESP_OnClick() { enemyESP = !enemyESP; enemyEspDescription.color = (enemyESP ? GreenTextColor : RedTextColor); enemyEspDescription.text = (enemyESP ? "Active" : "InActive"); } public void FishESP_OnClick() { fishESP = !fishESP; fishEspDescription.color = (fishESP ? GreenTextColor : RedTextColor); fishEspDescription.text = (fishESP ? "Active" : "InActive"); } public void BirdESP_OnClick() { birdESP = !birdESP; birdEspDescription.color = (birdESP ? GreenTextColor : RedTextColor); birdEspDescription.text = (birdESP ? "Active" : "InActive"); } public void LootESP_OnClick() { lootESP = !lootESP; lootEspDescription.color = (lootESP ? GreenTextColor : RedTextColor); lootEspDescription.text = (lootESP ? "Active" : "InActive"); } public void WeaponNoRecoil_OnClick() { weaponNoRecoil = !weaponNoRecoil; weaponNoRecoilDescription.color = (weaponNoRecoil ? GreenTextColor : RedTextColor); weaponNoRecoilDescription.text = (weaponNoRecoil ? "Active" : "InActive"); } public void WeaponNoSpread_OnClick() { weaponNoSpread = !weaponNoSpread; weaponNoSpreadDescription.color = (weaponNoSpread ? GreenTextColor : RedTextColor); weaponNoSpreadDescription.text = (weaponNoSpread ? "Active" : "InActive"); } public void Transform_OnClick() { transform = !transform; transformDescription.color = (transform ? GreenTextColor : RedTextColor); transformDescription.text = (transform ? "Active" : "InActive"); } public void NoClip_OnClick() { noClip = !noClip; noClipDescription.color = (noClip ? GreenTextColor : RedTextColor); noClipDescription.text = (noClip ? "Active" : "InActive"); } public void TimeOfDay_OnValueChanged(float value) { ((EnviroManagerBase)EnviroManager.instance).Time.SetTimeOfDay(value); } public void AllowPlayers_OnClick() { allowPlayers = !allowPlayers; allowPlayersDescription.color = (allowPlayers ? GreenTextColor : RedTextColor); allowPlayersDescription.text = (allowPlayers ? "Allowing player entry" : "Denying player entry"); } public void InstantKill_OnClick() { if (!((Object)(object)Utilities.GInst.Player.weaponInHand == null)) { Utilities.GInst.Player.weaponInHand.damage = 1000000f; instantKill = !instantKill; instantKillDescription.color = (instantKill ? GreenTextColor : RedTextColor); instantKillDescription.text = (instantKill ? "Active" : "InActive"); } } public void SavePlayer_OnClick() { Utilities.GInst.uiCombat.AddHint("SavePlayer", Color.red, -99f, (AudioClip)null); Mainframe.code.SaveManager.SavePlayer(false); } public void LoadPlayer_OnClick() { Utilities.GInst.uiCombat.AddHint("LoadPlayer", Color.red, -99f, (AudioClip)null); Mainframe.code.saveManager.LoadLocalPlayer(false); } public void SaveWorld_OnClick() { Utilities.GInst.uiCombat.AddHint("SaveWorld", Color.red, -99f, (AudioClip)null); Mainframe.code.SaveManager.SaveWorld(); } public void LoadWorld_OnClick() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) Utilities.GInst.uiCombat.AddHint("Load World", Color.red, -99f, (AudioClip)null); Mainframe.code.SaveManager.LoadWorldAsync(false); } public void TriggerAutoSave_OnClick() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) Utilities.GInst.uiCombat.AddHint("Autosaving", Color.red, -99f, (AudioClip)null); Mainframe.code.SaveManager.SaveGameAsync(true); } public void LoadAutoSave_OnClick() { Utilities.GInst.uiCombat.AddHint("Loading Autosave", Color.red, -99f, (AudioClip)null); Mainframe.code.SaveManager.LoadGame(true); } public static bool ShouldEsp() { if (!enemyESP && !playerESP && !fishESP && !birdESP) { return lootESP; } return true; } } } // ---- AdminMenu.dll :: AdminMenu.Util.Checks ---- namespace AdminMenu.Util { public class Checks { public static bool AdminPanelActive() { if (AdminMenuPlugin.AdminUI != null) { return AdminMenuPlugin.AdminUI.activeSelf; } return false; } public static void CheckPlayer() { if (Utilities.GInst.player.IsDead) { return; } if (AdminUI.unlimitedHealth) { Utilities.GInst.player.Health = Utilities.GInst.player.playerDefaultStatus.maxHealth; Utilities.GInst.player.TargetHealth = Utilities.GInst.player.playerDefaultStatus.maxHealth; Utilities.GInst.player.BodyTemperature = Utilities.GInst.player.playerDefaultStatus.maxBodyTemperature; if (!((double)Utilities.GInst.player.Bleeding <= 0.0)) { Utilities.GInst.player.Bleeding = 0f; } } else { Global.code.Player.Health = Utilities.GInst.player.playerDefaultStatus.health; Global.code.Player.MaxHealth = Utilities.GInst.player.playerDefaultStatus.maxHealth; } if (AdminUI.unlimitedAir) { Utilities.GInst.player.Air = Utilities.GInst.player.playerDefaultStatus.MaxAir; } if (AdminUI.unlimitedEnergy) { Utilities.GInst.player._energy = Utilities.GInst.player.playerDefaultStatus.MaxEnergy; } if (AdminUI.unlimitedStamina) { Utilities.GInst.player._stamina = Utilities.GInst.player.playerDefaultStatus.MaxEnergy; } if (AdminUI.noHunger) { Utilities.GInst.player._hunger = Utilities.GInst.player.playerDefaultStatus.MaxHunger; } if (AdminUI.noThirst) { Utilities.GInst.player._thirst = Utilities.GInst.player.playerDefaultStatus.MaxThirst; } if (AdminUI.transform && Input.GetKeyDown(KeyCode.LeftControl)) { ((Component)(object)Utilities.GInst.player).transform.position += 0.25f * Utilities.GInst.player._mainCamera.transform.forward; AdminMenuPlugin.AdminMenuLogger.LogInfo("Teleported player forward, current position: " + ((Component)(object)Utilities.GInst.player).transform.position.ToString()); } } public static void CheckWeapon() { if (!((UnityEngine.Object)(object)Utilities.GInst.player.weaponInHand == null)) { if (AdminUI.unlimitedAmmo) { PlayerWeapons.code.CurrentWeaponBehaviorComponent.bulletsLeft = PlayerWeapons.code.CurrentWeaponBehaviorComponent.bulletsPerClip; } if (AdminUI.weaponNoRecoil) { Utilities.GInst.player.weaponInHand.recoil = 0f; Utilities.GInst.player.weaponInHand.horizontalKick = 0f; Utilities.GInst.player.weaponInHand.verticalKick = 0f; Utilities.GInst.player.weaponInHand.viewClimbSide = 0f; Utilities.GInst.player.weaponInHand.viewClimbUp = 0f; } if (AdminUI.weaponNoSpread) { Utilities.GInst.player.weaponInHand.spread = 0f; } } } public static void CheckESP() { if (Event.current.type == EventType.Repaint && AdminUI.ShouldEsp()) { if (AdminUI.enemyESP) { DisplayInfoForEntities((IEnumerable)Utilities.WsInst.AllCharactersList, (Action)ProcessCharacter); } if (AdminUI.playerESP) { DisplayInfoForEntities(Utilities.WsInst.allPlayerDummies.items, ProcessCharacterPlayer); } if (AdminUI.fishESP) { DisplayInfoForEntities(Utilities.WsInst.fishes.items, ProcessFish); } if (AdminUI.birdESP) { DisplayInfoForEntities(Utilities.WsInst.birds.items, ProcessBird); } if (AdminUI.lootESP) { DisplayInfoForEntities(Utilities.WsInst.worldScavengables, ProcessWorldScavengable); DisplayInfoForEntities(Utilities.WsInst.worldCollectableContinuingInteractions, ProcessWorldCollectableContinuingInteraction); DisplayInfoForEntities(Utilities.WsInst.worldChests, ProcessWorldChest); } } } private static void DisplayInfoForEntities(IEnumerable entities, Action processEntity) { foreach (T entity in entities) { if ((bool)(entity as UnityEngine.Object)) { processEntity(entity); } } } private static void ProcessCharacter(UnityEngine.Object obj) { if (obj == null) { return; } Character val = (Character)(object)((obj is Character) ? obj : null); if ((UnityEngine.Object)(object)val == null || Utilities.CamInst == null || (UnityEngine.Object)(object)Utilities.PCInst == null) { return; } Vector3 position = ((Component)(object)val).transform.position; Vector3 position2 = Utilities.CamInst.WorldToScreenPoint(position); Vector3 position3 = val.eye.transform.position; Vector3 vector = Utilities.CamInst.WorldToScreenPoint(position3); Vector3 vector2 = Utilities.CamInst.WorldToScreenPoint(((Component)(object)val).transform.position); float num = Vector3.Distance(((Component)(object)Utilities.PCInst).transform.position, position); float health = val.health; string pText = ((object)val.weapon).ToString(); float num2 = Mathf.Abs(vector.y - vector2.y); bool flag = !Utilities.IsEnemyVisible(Utilities.CamInst.transform.position, position3); if (!Utilities.IsOnScreen(position2) || !((double)num < 250.0)) { return; } if (flag) { if ((double)num < 150.0) { Utilities.CornerBox(new Vector2(vector.x, (float)((double)Screen.height - (double)vector.y - 20.0)), num2 / 2f, num2 + 20f, 2f, Color.red, outline: true); } Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.NameReplacer(((UnityEngine.Object)(object)val).name), Color.red, center: true, 12, FontStyle.Normal); Utilities.DrawString(new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 12.0)), Utilities.WeaponReplacer(pText), Color.HSVToRGB(0.1055556f, 0.29f, 1f), center: true, 12, FontStyle.Normal); Vector2 pos = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 24.0)); string text = Mathf.Round(health) + " HP"; Color white = Color.white; Utilities.DrawString(pos, text, white, center: true, 12, FontStyle.Normal); Vector2 pos2 = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 36.0)); string text2 = Mathf.Round(num) + "m"; Color yellow = Color.yellow; Utilities.DrawString(pos2, text2, yellow, center: true, 12, FontStyle.Normal); } else if (!flag) { if ((double)num < 150.0) { Utilities.CornerBox(new Vector2(vector.x, (float)((double)Screen.height - (double)vector.y - 20.0)), num2 / 2f, num2 + 20f, 2f, Color.HSVToRGB(0.1083333f, 1f, 1f), outline: true); } Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.NameReplacer(((UnityEngine.Object)(object)val).name), Color.HSVToRGB(0.1083333f, 1f, 1f), center: true, 12, FontStyle.Normal); Utilities.DrawString(new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 12.0)), Utilities.WeaponReplacer(pText), Color.HSVToRGB(0.1055556f, 0.29f, 1f), center: true, 12, FontStyle.Normal); Vector2 pos3 = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 24.0)); string text3 = Mathf.Round(health) + " HP"; Color white2 = Color.white; Utilities.DrawString(pos3, text3, white2, center: true, 12, FontStyle.Normal); Vector2 pos4 = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 36.0)); string text4 = Mathf.Round(num) + "m"; Color yellow2 = Color.yellow; Utilities.DrawString(pos4, text4, yellow2, center: true, 12, FontStyle.Normal); } } private static void ProcessCharacterPlayer(UnityEngine.Object obj) { Transform transform = obj as Transform; if (transform == null || Utilities.CamInst == null || (UnityEngine.Object)(object)Utilities.PCInst == null) { return; } PlayerDummy component = transform.GetComponent(); if (!((UnityEngine.Object)(object)component != null) || !(UnityEngine.Object)(object)((SimulationBehaviour)component).Object || !((SimulationBehaviour)component).Object.IsValid || !(component.CharacterGuid != Utilities.GInst.Player.playerDummy.CharacterGuid)) { return; } Vector3 position = transform.transform.position; Vector3 position2 = Utilities.CamInst.WorldToScreenPoint(position); Vector3 position3 = component.eye.transform.position; Vector3 vector = Utilities.CamInst.WorldToScreenPoint(position3); Vector3 vector2 = Utilities.CamInst.WorldToScreenPoint(((Component)(object)component).transform.position); float num = Vector3.Distance(((Component)(object)Utilities.PCInst).transform.position, position); float num2 = Mathf.Abs(vector.y - vector2.y); bool flag = !Utilities.IsEnemyVisible(Utilities.CamInst.transform.position, position3); if (!Utilities.IsOnScreen(position2) || !((double)num < 250.0)) { return; } if (flag) { if ((double)num < 150.0) { Utilities.CornerBox(new Vector2(vector.x, (float)((double)Screen.height - (double)vector.y - 20.0)), num2 / 2f, num2 + 20f, 2f, Color.green, outline: true); } Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.NameReplacer(component.CharacterName), Color.green, center: true, 12, FontStyle.Normal); new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 24.0)); _ = Color.white; Vector2 pos = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 36.0)); string text = Mathf.Round(num) + "m"; Color yellow = Color.yellow; Utilities.DrawString(pos, text, yellow, center: true, 12, FontStyle.Normal); } else if (!flag) { if ((double)num < 150.0) { Utilities.CornerBox(new Vector2(vector.x, (float)((double)Screen.height - (double)vector.y - 20.0)), num2 / 2f, num2 + 20f, 2f, Color.HSVToRGB(0.1083333f, 1f, 1f), outline: true); } Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.NameReplacer(component.CharacterName), Color.HSVToRGB(0.1083333f, 1f, 1f), center: true, 12, FontStyle.Normal); new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 24.0)); _ = Color.white; Vector2 pos2 = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 36.0)); string text2 = Mathf.Round(num) + "m"; Color yellow2 = Color.yellow; Utilities.DrawString(pos2, text2, yellow2, center: true, 12, FontStyle.Normal); } } private static void ProcessFish(UnityEngine.Object obj) { Transform transform = obj as Transform; if (transform == null || Utilities.CamInst == null || (UnityEngine.Object)(object)Utilities.PCInst == null) { return; } FishAI component = transform.GetComponent(); if ((UnityEngine.Object)(object)component != null) { Vector3 position = transform.transform.position; Vector3 position2 = Utilities.CamInst.WorldToScreenPoint(position); float num = Vector3.Distance(((Component)(object)Utilities.PCInst).transform.position, position); float health = component.Health; if (Utilities.IsOnScreen(position2) && (double)num < 100.0) { Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.NameReplacer(transform.name), Color.HSVToRGB(0.5f, 1f, 1f), center: true, 12, FontStyle.Normal); Vector2 pos = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 12.0)); string text = Mathf.Round(health) + " HP"; Color white = Color.white; Utilities.DrawString(pos, text, white, center: true, 12, FontStyle.Normal); Vector2 pos2 = new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 24.0)); string text2 = Mathf.Round(num) + "m"; Color yellow = Color.yellow; Utilities.DrawString(pos2, text2, yellow, center: true, 12, FontStyle.Normal); } } } private static void ProcessBird(UnityEngine.Object obj) { Transform transform = obj as Transform; if (transform == null || Utilities.CamInst == null || (UnityEngine.Object)(object)Utilities.PCInst == null) { return; } Bird component = transform.GetComponent(); if ((UnityEngine.Object)(object)component != null) { Vector3 position = Utilities.CamInst.WorldToScreenPoint(transform.transform.position); float num = Vector3.Distance(((Component)(object)Utilities.PCInst).transform.position, transform.transform.position); float health = component.health; if (Utilities.IsOnScreen(position) && (double)num < 100.0) { Utilities.DrawString(new Vector2(position.x, (float)Screen.height - position.y), Utilities.NameReplacer(transform.name), Color.HSVToRGB(7f / 90f, 0.275f, 1f), center: true, 12, FontStyle.Normal); Vector2 pos = new Vector2(position.x, (float)((double)Screen.height - (double)position.y + 12.0)); string text = Mathf.Round(health) + " HP"; Color white = Color.white; Utilities.DrawString(pos, text, white, center: true, 12, FontStyle.Normal); Vector2 pos2 = new Vector2(position.x, (float)((double)Screen.height - (double)position.y + 24.0)); string text2 = Mathf.Round(num) + "m"; Color yellow = Color.yellow; Utilities.DrawString(pos2, text2, yellow, center: true, 12, FontStyle.Normal); } } } private static void ProcessWorldScavengable(Scavengeable scavengable) { if ((AdminMenuPlugin.HideBrokenScavengeables.Value != AdminMenuPlugin.Toggle.On || scavengable.ChopAmount > 0) && !(Utilities.CamInst == null) && !((UnityEngine.Object)(object)Utilities.PCInst == null)) { Vector3 position = ((Component)(object)scavengable).transform.position; Vector3 position2 = Utilities.CamInst.WorldToScreenPoint(position); float num = Vector3.Distance(((Component)(object)Utilities.PCInst).transform.position, position); if (Utilities.IsOnScreen(position2) && (double)num < 100.0) { Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.LootReplacer(((UnityEngine.Object)(object)scavengable).name[0].ToString().ToUpper()) + Utilities.LootReplacer(((UnityEngine.Object)(object)scavengable).name).Substring(1), Color.HSVToRGB(0.1055556f, 0.29f, 1f), center: true, 12, FontStyle.Normal); Utilities.DrawString(new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 12.0)), Mathf.Round(num) + "m", Color.yellow, center: true, 12, FontStyle.Normal); } } } private static void ProcessWorldChest(Chest chest) { if ((AdminMenuPlugin.HideEmptyChests.Value != AdminMenuPlugin.Toggle.On || !chest._storage.IsEmpty()) && !(Utilities.CamInst == null) && !((UnityEngine.Object)(object)Utilities.PCInst == null)) { Vector3 position = ((Component)(object)chest).transform.position; Vector3 position2 = Utilities.CamInst.WorldToScreenPoint(position); float num = Vector3.Distance(((Component)(object)Utilities.PCInst).transform.position, position); if (Utilities.IsOnScreen(position2) && (double)num < 100.0) { Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.LootReplacer(((UnityEngine.Object)(object)chest).name[0].ToString().ToUpper()) + Utilities.LootReplacer(((UnityEngine.Object)(object)chest).name).Substring(1), Color.HSVToRGB(0.05277778f, 0.719f, 0.627f), center: true, 12, FontStyle.Normal); Utilities.DrawString(new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 12.0)), Mathf.Round(num) + "m", Color.yellow, center: true, 12, FontStyle.Normal); } } } private static void ProcessWorldCollectableContinuingInteraction(CollectableContinuingInteraction interaction) { if ((AdminMenuPlugin.HideCollectibles.Value != AdminMenuPlugin.Toggle.On || ((Component)(object)interaction).gameObject.activeSelf) && !(Utilities.CamInst == null) && !((UnityEngine.Object)(object)Utilities.PCInst == null)) { Vector3 position = ((Component)(object)interaction).transform.position; Vector3 position2 = Utilities.CamInst.WorldToScreenPoint(position); float num = Vector3.Distance(((Component)(object)Utilities.PCInst).transform.position, position); if (Utilities.IsOnScreen(position2) && (double)num < 100.0) { Utilities.DrawString(new Vector2(position2.x, (float)Screen.height - position2.y), Utilities.LootReplacer(((UnityEngine.Object)(object)interaction).name), Color.HSVToRGB(0.1666667f, 0.102f, 0.961f), center: true, 12, FontStyle.Normal); Utilities.DrawString(new Vector2(position2.x, (float)((double)Screen.height - (double)position2.y + 12.0)), Mathf.Round(num) + "m", Color.yellow, center: true, 12, FontStyle.Normal); } } } } } // ---- AdminMenu.dll :: AdminMenu.Util.Utilities ---- namespace AdminMenu.Util { public static class Utilities { public enum IterativeSearchType { DepthFirst, BreadthFirst } private class RingArray { public Vector2[] Positions { get; private set; } public RingArray(int numSegments) { Positions = new Vector2[numSegments]; float num = 360f / (float)numSegments; for (int i = 0; i < numSegments; i++) { float f = MathF.PI / 180f * num * (float)i; Positions[i] = new Vector2(Mathf.Sin(f), Mathf.Cos(f)); } } } private static Dictionary ringDict = new Dictionary(); private static GUIStyle __style = new GUIStyle(); private static GUIStyle __outlineStyle = new GUIStyle(); private static Texture2D drawingTex; private static Color lastTexColour; public static Camera CamInst => GInst.player.MainCamera; public static PlayerCharacter PCInst => GInst.player; public static Storage StorInst => GInst.player.playerStorage; public static WeaponBehavior WbInst => PlayerWeapons.code.CurrentWeaponBehaviorComponent; public static Global GInst => Global.code; public static WorldScene WsInst => WorldScene.code; public static FPSPlayer FpspInst => FPSPlayer.code; public static RM RmInst => RM.code; public static GUIStyle StringStyle { get; set; } = new GUIStyle(GUI.skin.label); public static Color Color { get { return GUI.color; } set { GUI.color = value; } } public static void TurnOnUI() { GInst.OnGUI = true; } public static void RemoveDrops() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) DiscardedItem[] array = UnityEngine.Object.FindObjectsOfType(); foreach (DiscardedItem val in array) { if (!(Vector3.Distance(((Component)(object)val).transform.position, ((Component)(object)PCInst).transform.position) <= AdminMenuPlugin.RemoveDropsRadius.Value)) { continue; } if (((SimulationBehaviour)val).Runner.IsServer || (((SimulationBehaviour)val).Object.HasStateAuthority && ((SimulationBehaviour)val).Object.HasInputAuthority) || ((SimulationBehaviour)val).Runner.IsHostPlayer(Global.code.Player.playerDummy.PlayerRef)) { ((SimulationBehaviour)val).Runner.Despawn(((SimulationBehaviour)val).Object, false); continue; } try { ((SimulationBehaviour)val).Runner.Despawn(((SimulationBehaviour)val).Object, false); } catch { } } } public static bool IsOnScreen(Vector3 position) { if ((double)position.y > 0.00999999977648258 && (double)position.y < (double)Screen.height - 5.0) { return (double)position.z > 0.00999999977648258; } return false; } public static void DrawLine(Vector2 from, Vector2 to, float thickness, Color color) { Color = color; DrawLine(from, to, thickness); } public static void DrawLine(Vector2 from, Vector2 to, float thickness) { Vector2 normalized = (to - from).normalized; double num = (double)Mathf.Atan2(normalized.y, normalized.x) * 57.2957801818848; GUIUtility.RotateAroundPivot((float)num, from); DrawBox(from, Vector2.right * (from - to).magnitude, thickness, centered: false); GUIUtility.RotateAroundPivot((float)(0.0 - num), from); } public static void CornerBox(Vector2 Head, float Width, float Height, float thickness, Color color, bool outline) { int num = (int)((double)Width / 4.0); int num2 = num; if (outline) { RectFilled((float)((double)Head.x - (double)Width / 2.0 - 1.0), Head.y - 1f, num + 2, 3f, Color.black); RectFilled((float)((double)Head.x - (double)Width / 2.0 - 1.0), Head.y - 1f, 3f, num2 + 2, Color.black); RectFilled((float)((double)Head.x + (double)Width / 2.0 - (double)num - 1.0), Head.y - 1f, num + 2, 3f, Color.black); RectFilled((float)((double)Head.x + (double)Width / 2.0 - 1.0), Head.y - 1f, 3f, num2 + 2, Color.black); RectFilled((float)((double)Head.x - (double)Width / 2.0 - 1.0), (float)((double)Head.y + (double)Height - 4.0), num + 2, 3f, Color.black); RectFilled((float)((double)Head.x - (double)Width / 2.0 - 1.0), (float)((double)Head.y + (double)Height - (double)num2 - 4.0), 3f, num2 + 2, Color.black); RectFilled((float)((double)Head.x + (double)Width / 2.0 - (double)num - 1.0), (float)((double)Head.y + (double)Height - 4.0), num + 2, 3f, Color.black); RectFilled((float)((double)Head.x + (double)Width / 2.0 - 1.0), (float)((double)Head.y + (double)Height - (double)num2 - 4.0), 3f, num2 + 3, Color.black); } RectFilled(Head.x - Width / 2f, Head.y, num, 1f, color); RectFilled(Head.x - Width / 2f, Head.y, 1f, num2, color); RectFilled(Head.x + Width / 2f - (float)num, Head.y, num, 1f, color); RectFilled(Head.x + Width / 2f, Head.y, 1f, num2, color); RectFilled(Head.x - Width / 2f, (float)((double)Head.y + (double)Height - 3.0), num, 1f, color); RectFilled(Head.x - Width / 2f, (float)((double)Head.y + (double)Height - (double)num2 - 3.0), 1f, num2, color); RectFilled(Head.x + Width / 2f - (float)num, (float)((double)Head.y + (double)Height - 3.0), num, 1f, color); RectFilled(Head.x + Width / 2f, (float)((double)Head.y + (double)Height - (double)num2 - 3.0), 1f, num2 + 1, color); } internal static void RectFilled(float x, float y, float width, float height, Color color) { if (!drawingTex) { drawingTex = new Texture2D(1, 1); } if (color != lastTexColour) { drawingTex.SetPixel(0, 0, color); drawingTex.Apply(); lastTexColour = color; } GUI.DrawTexture(new Rect(x, y, width, height), drawingTex); } public static void DrawBox(Vector2 position, Vector2 size, float thickness, Color color, bool centered = true) { Color = color; DrawBox(position, size, thickness, centered); } public static void DrawBox(Vector2 position, Vector2 size, float thickness, bool centered = true) { if (centered) { _ = position - size / 2f; } GUI.DrawTexture(new Rect(position.x, position.y, size.x, thickness), Texture2D.whiteTexture); GUI.DrawTexture(new Rect(position.x, position.y, thickness, size.y), Texture2D.whiteTexture); GUI.DrawTexture(new Rect(position.x + size.x, position.y, thickness, size.y), Texture2D.whiteTexture); GUI.DrawTexture(new Rect(position.x, position.y + size.y, size.x + thickness, thickness), Texture2D.whiteTexture); } public static void DrawCross(Vector2 position, Vector2 size, float thickness, Color color) { Color = color; DrawCross(position, size, thickness); } public static void DrawCross(Vector2 position, Vector2 size, float thickness) { GUI.DrawTexture(new Rect(position.x - size.x / 2f, position.y, size.x, thickness), Texture2D.whiteTexture); GUI.DrawTexture(new Rect(position.x, position.y - size.y / 2f, thickness, size.y), Texture2D.whiteTexture); } public static void DrawDot(Vector2 position, Color color) { Color = color; DrawDot(position); } public static void DrawDot(Vector2 position) { DrawBox(position - Vector2.one, Vector2.one * 2f, 1f); } public static void DrawString(Vector2 pos, string text, Color color, bool center = true, int size = 12, FontStyle fontStyle = FontStyle.Bold, int depth = 1) { __style.fontSize = size; __style.richText = true; __style.normal.textColor = color; __style.fontStyle = fontStyle; __outlineStyle.fontSize = size; __outlineStyle.richText = true; __outlineStyle.normal.textColor = new Color(0f, 0f, 0f, 1f); __outlineStyle.fontStyle = fontStyle; GUIContent content = new GUIContent(text); GUIContent content2 = new GUIContent(text); if (center) { pos.x -= __style.CalcSize(content).x / 2f; } switch (depth) { case 0: GUI.Label(new Rect(pos.x, pos.y, 300f, 25f), content, __style); break; case 1: GUI.Label(new Rect(pos.x + 1f, pos.y + 1f, 300f, 25f), content2, __outlineStyle); GUI.Label(new Rect(pos.x, pos.y, 300f, 25f), content, __style); break; case 2: GUI.Label(new Rect(pos.x + 1f, pos.y + 1f, 300f, 25f), content2, __outlineStyle); GUI.Label(new Rect(pos.x - 1f, pos.y - 1f, 300f, 25f), content2, __outlineStyle); GUI.Label(new Rect(pos.x, pos.y, 300f, 25f), content, __style); break; case 3: GUI.Label(new Rect(pos.x + 1f, pos.y + 1f, 300f, 25f), content2, __outlineStyle); GUI.Label(new Rect(pos.x - 1f, pos.y - 1f, 300f, 25f), content2, __outlineStyle); GUI.Label(new Rect(pos.x, pos.y - 1f, 300f, 25f), content2, __outlineStyle); GUI.Label(new Rect(pos.x, pos.y + 1f, 300f, 25f), content2, __outlineStyle); GUI.Label(new Rect(pos.x, pos.y, 300f, 25f), content, __style); break; } } public static void DrawCircle(Vector2 position, float radius, int numSides, bool centered = true, float thickness = 1f) { DrawCircle(position, radius, numSides, Color.white, centered, thickness); } public static void DrawCircle(Vector2 position, float radius, int numSides, Color color, bool centered = true, float thickness = 1f) { RingArray ringArray; if (ringDict.ContainsKey(numSides)) { ringArray = ringDict[numSides]; } else { RingArray ringArray2 = (ringDict[numSides] = new RingArray(numSides)); ringArray = ringArray2; } RingArray ringArray4 = ringArray; Vector2 vector = (centered ? position : (position + Vector2.one * radius)); for (int i = 0; i < numSides - 1; i++) { DrawLine(vector + ringArray4.Positions[i] * radius, vector + ringArray4.Positions[i + 1] * radius, thickness, color); } DrawLine(vector + ringArray4.Positions[0] * radius, vector + ringArray4.Positions[ringArray4.Positions.Length - 1] * radius, thickness, color); } public static bool IsEnemyVisible(Vector3 position, Vector3 target) { Vector3 direction = target - position; float num = direction.magnitude * 0.9f; Ray ray = new Ray(position, direction); double num2 = num; return Physics.Raycast(ray, (float)num2, -9636629, QueryTriggerInteraction.UseGlobal); } public static string NameReplacer(string pText) { pText = pText.Replace("(Clone)", ""); return new Regex("", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant).Replace(pText, string.Empty); } public static string WeaponReplacer(string pText) { pText = pText.Replace("(WeaponRaycast)", "").Replace("A1_", "").Replace("A2_", "") .Replace("A3_", "") .Replace("A4_", "") .Replace("A5_", "") .Replace("B2_", "") .Replace("C1_", "") .Replace("C2_", "") .Replace("G1_", ""); return new Regex("", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant).Replace(pText, string.Empty); } public static string LootReplacer(string pText) { pText = pText.Replace("0", "").Replace("1", "").Replace("2", "") .Replace("3", "") .Replace("4", "") .Replace("5", "") .Replace("6", "") .Replace("7", "") .Replace("8", "") .Replace("9", "") .Replace("(", "") .Replace(")", "") .Replace("_", ""); return new Regex("", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.CultureInvariant).Replace(pText, string.Empty); } internal static float GetKey(KeyCode key) { if (Input.GetKey(key)) { return 1f; } return 0f; } public static void CustomUseItem(Item item, bool isQuickSlot = false) { //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) if (GInst.player.IsBusy) { return; } FPSPlayer.code.SwimmerMove = false; PlayerWeapons.code.StartWithQuickSlot = false; Global.code.uiCombat.HideHint(); if (!(UnityEngine.Object)(object)item) { if ((bool)(UnityEngine.Object)(object)GInst.player.weaponInHand && isQuickSlot) { PlayerWeapons.code.HolsterCurrentWeapon(); } } else { if (!(item != (Item)null)) { return; } BuildingPiece component2; BuildingContainer component3; Blueprint component4; if (((Component)(object)item).TryGetComponent(out Food component)) { if ((double)component.bleedAmount > 0.0 && (double)GInst.player.Bleeding <= 0.0) { return; } PlayerCharacter player = GInst.player; player.Hunger += (float)component.foodAmount; PlayerCharacter player2 = GInst.player; player2.Thirst += component.waterAmount; PlayerCharacter player3 = GInst.player; player3.Energy += (float)component.foodAmount * 0.2f; PlayerCharacter player4 = GInst.player; player4.Energy += component.waterAmount * 0.2f; PlayerCharacter player5 = GInst.player; player5.Stamina += (float)component.energyAmount; PlayerCharacter player6 = GInst.player; player6.Stamina += (float)component.staminaAmount; PlayerCharacter player7 = GInst.player; player7.Energy += (float)component.energyAmount; PlayerCharacter player8 = GInst.player; player8.Bleeding -= component.bleedAmount; if (!((LocalizedReference)component.Buff.localizedItemName).IsEmpty) { ((Component)(object)Utility.Instantiate(RM.code.BuffPrefab)).GetComponent().InitBuff(component); } GInst.player.AddHealth((float)component.healthAmount, 3, Vector3.zero, false, false, false, false, false); if (component.poisonAmount > 0) { GInst.player.AddHealth((float)(-component.poisonAmount), 2, Vector3.zero, false, false, false, false, false); RM.code.PlayOneShot(GInst.player.sndFoodPoisoning, 1f); } GInst.player.UpdateBuffHint(); int amount = item.Amount - 1; item.Amount = amount; if ((bool)component.itemReceivedAfterEat && UnityEngine.Random.Range(0, 100) < component.itemReceiveChance) { GInst.player.playerStorage.TryAddItem(Utility.Instantiate(component.itemReceivedAfterEat, (Transform)null), true); } if ((bool)item.sndUse) { RM.code.PlayOneShot(item.sndUse, UnityEngine.Random.Range(0.9f, 1.1f)); } else if (component.foodAmount > 0) { RM.code.PlayOneShot(GInst.player.sndEat, UnityEngine.Random.Range(0.9f, 1.1f)); } else if ((double)component.waterAmount > 0.0) { RM.code.PlayOneShot(GInst.player.sndDrink, UnityEngine.Random.Range(0.9f, 1.1f)); } else if (component.healthAmount > 0) { RM.code.PlayOneShot(GInst.player.sndUseBandage, UnityEngine.Random.Range(0.9f, 1.1f)); } } else if ((bool)(UnityEngine.Object)(object)((Component)(object)item).GetComponent()) { GInst.player.QuitConnectWire(); if ((bool)GInst.player.MyBuildController.m_BuildingHelpers.m_CurrentPreview) { GInst.player.MyBuildController.SetSelectedPiece((BuildingPiece)null, false); } if (!FPSRigidBodyWalker.code.isUnderWater || item.ItemID != RM.code.Torch.ItemID) { if ((bool)(UnityEngine.Object)(object)GInst.player.weaponInHand && GInst.player.weaponInHand._item == item && (bool)(UnityEngine.Object)(object)PlayerWeapons.code.CurrentWeaponBehaviorComponent && PlayerWeapons.code.CurrentWeaponBehaviorComponent.WeaponItem.ItemID == item.ItemID && PlayerWeapons.code.CurrentWeaponBehaviorComponent.InitDone) { PlayerWeapons.code.HolsterCurrentWeapon(); } else { PlayerWeapons.code.StartWithQuickSlot = isQuickSlot; PlayerWeapons.code.SelectWeaponByPrefab(((Component)(object)item).transform); } Global.code.uiCombat.HideFishPenal(); } GInst.player.CS(); } else if (((Component)(object)item).TryGetComponent(out component2)) { if (RM.code.ItemDictionary.TryGetValue(item.ItemID, out var value)) { GInst.player.CanSnap = false; GInst.player.MyBuildController.SetSelectedPiece(((Component)(object)value).GetComponent(), false); if (((Component)(object)Global.code.uiInventory).gameObject.activeSelf) { Global.code.uiInventory.Close(true, true); } GInst.player.DecorationPieceID = item.ItemID; if (!isQuickSlot) { ((MonoBehaviour)(object)GInst.player).Invoke("ChangeInventoryState", 0.01f); } } } else if (((Component)(object)item).TryGetComponent(out component3)) { BuildingPiece buildPiece = component3.GetBuildPiece(); if ((bool)(UnityEngine.Object)(object)buildPiece) { GInst.player.CanSnap = false; GInst.player.MyBuildController.SetSelectedPiece(buildPiece, false); if (((Component)(object)Global.code.uiInventory).gameObject.activeSelf) { Global.code.uiInventory.Close(true, true); } GInst.player.curBuildingContainer = component3; if (!isQuickSlot) { ((MonoBehaviour)(object)GInst.player).Invoke("ChangeInventoryState", 0.01f); } } } else if (((Component)(object)item).TryGetComponent(out component4) && GlobalDataHelper.IsGlobalDataValid && Mainframe.code.GlobalData.AddLearnedBlueprint(item.ItemID)) { if ((bool)(UnityEngine.Object)(object)Global.code) { Global.code.uiCombat.OpenBlueprintPenal(component4, ((Component)(object)Global.code.uiInventory).gameObject.activeSelf); } UniTaskVoid val = GInst.player.RefreshInventoryUI(); ((UniTaskVoid)(ref val)).Forget(); } if (!(UnityEngine.Object)(object)GInst.player.weaponInHand) { Global.code.uiCombat.tmpAmmo.text = "∞"; } } } public static Transform? FindChild(Transform aParent, string aName, IterativeSearchType searchType = IterativeSearchType.DepthFirst) { switch (searchType) { case IterativeSearchType.DepthFirst: { Stack stack = new Stack(); Transform transform2 = aParent; while (true) { for (int num = transform2.childCount - 1; num >= 0; num--) { stack.Push(transform2.GetChild(num)); } if (stack.Count <= 0) { break; } transform2 = stack.Pop(); if (!(transform2.name != aName)) { return transform2; } } return null; } case IterativeSearchType.BreadthFirst: { Queue queue = new Queue(); Transform transform = aParent; while (true) { int childCount = transform.childCount; for (int i = 0; i < childCount; i++) { queue.Enqueue(transform.GetChild(i)); } if (queue.Count <= 0) { break; } transform = queue.Dequeue(); if (!(transform.name != aName)) { return transform; } } return null; } default: AdminMenuPlugin.AdminMenuLogger.LogError("Search type not implemented!"); return null; } } } } // ---- AdminMenu.dll :: AdminMenu.Util.Variables ---- namespace AdminMenu.Util { public class Variables { public const float FEnemies = 250f; public const float FFishes = 100f; public const float FBirds = 100f; public const float FLoot = 100f; } }