Decompiled source of Valheim Admin Tool v0.1.0
ValheimAdminTool.dll
Decompiled 6 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using ValheimAdminTool; using ValheimAdminTool.Controls; using ValheimAdminTool.Menus; using ValheimAdminTool.UI; using ValheimAdminTool.Utils; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ValheimAdminTool")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("ValheimAdminTool")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7533fcaa-3250-4f45-8108-6cc00c17797a")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] internal static class ModDropdown { internal static Dropdown CreateDropdown(Transform parentTransform, string name, Vector2 position, Vector2 size, List<string> options, UnityAction<int> onValueChanged) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0043: 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_0054: 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_006b: 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_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_01bb: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Expected O, but got Unknown //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Expected O, but got Unknown //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_043a: Unknown result type (might be due to invalid IL or missing references) //IL_045d: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_048c: Unknown result type (might be due to invalid IL or missing references) //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_0559: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Expected O, but got Unknown GameObject val = new GameObject(name); val.transform.SetParent(parentTransform, false); Dropdown val2 = val.AddComponent<Dropdown>(); Image obj = val.AddComponent<Image>(); obj.sprite = ModMenu.sprites["dropdownBackground"]; obj.type = (Type)1; RectTransform component = val.GetComponent<RectTransform>(); component.anchoredPosition = position; component.sizeDelta = size; GameObject val3 = new GameObject("Label"); val3.transform.SetParent(val.transform, false); Text val4 = val3.AddComponent<Text>(); val4.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val4.alignment = (TextAnchor)3; ((Graphic)val4).color = Color.black; RectTransform component2 = val3.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0f, 0f); component2.anchorMax = new Vector2(1f, 1f); component2.offsetMin = new Vector2(10f, 0f); component2.offsetMax = new Vector2(-25f, 0f); GameObject val5 = new GameObject("Arrow"); val5.transform.SetParent(val.transform, false); Image val6 = val5.AddComponent<Image>(); val6.sprite = ModMenu.sprites["dropdownArrow"]; ((Graphic)val6).color = Color.white; RectTransform component3 = val5.GetComponent<RectTransform>(); component3.anchorMin = new Vector2(1f, 0.5f); component3.anchorMax = new Vector2(1f, 0.5f); component3.sizeDelta = new Vector2(20f, 20f); component3.anchoredPosition = new Vector2(-15f, 0f); GameObject val7 = new GameObject("Template"); val7.transform.SetParent(val.transform, false); RectTransform val8 = val7.AddComponent<RectTransform>(); val8.anchorMin = new Vector2(0f, 1f); val8.anchorMax = new Vector2(1f, 1f); val8.pivot = new Vector2(0.5f, 1f); val8.sizeDelta = new Vector2(0f, (float)((options.Count > 6) ? 140 : (options.Count * 20 + 10))); ((Graphic)val7.AddComponent<Image>()).color = new Color(1f, 1f, 1f, 0.9f); ScrollRect obj2 = val7.AddComponent<ScrollRect>(); obj2.horizontal = false; obj2.vertical = true; GameObject val9 = new GameObject("Viewport"); val9.transform.SetParent(val7.transform, false); RectTransform val10 = val9.AddComponent<RectTransform>(); val10.anchorMin = new Vector2(0f, 0f); val10.anchorMax = new Vector2(1f, 1f); val10.sizeDelta = new Vector2(0f, 0f); val9.AddComponent<Mask>().showMaskGraphic = false; ((Graphic)val9.AddComponent<Image>()).color = Color.clear; obj2.viewport = val10; GameObject val11 = new GameObject("Content"); val11.transform.SetParent(val9.transform, false); RectTransform val12 = val11.AddComponent<RectTransform>(); val12.anchorMin = new Vector2(0f, 1f); val12.anchorMax = new Vector2(1f, 1f); val12.pivot = new Vector2(0.5f, 1f); val12.sizeDelta = new Vector2(0f, (float)(options.Count * 20)); obj2.content = val12; GameObject val13 = new GameObject("Item"); val13.transform.SetParent(val11.transform, false); RectTransform obj3 = val13.AddComponent<RectTransform>(); obj3.anchorMin = new Vector2(0f, 1f); obj3.anchorMax = new Vector2(1f, 1f); obj3.pivot = new Vector2(0.5f, 1f); obj3.sizeDelta = new Vector2(0f, 20f); Image val14 = val13.AddComponent<Image>(); ((Graphic)val14).color = new Color(1f, 1f, 1f, 0.9f); GameObject val15 = new GameObject("Item Label"); val15.transform.SetParent(val13.transform, false); Text val16 = val15.AddComponent<Text>(); val16.font = Resources.GetBuiltinResource<Font>("Arial.ttf"); val16.alignment = (TextAnchor)3; ((Graphic)val16).color = Color.black; RectTransform component4 = val15.GetComponent<RectTransform>(); component4.anchorMin = new Vector2(0f, 0f); component4.anchorMax = new Vector2(1f, 1f); component4.offsetMin = new Vector2(10f, 0f); component4.offsetMax = new Vector2(-10f, 0f); Toggle obj4 = val13.AddComponent<Toggle>(); ((Selectable)obj4).targetGraphic = (Graphic)(object)val14; obj4.graphic = (Graphic)(object)val14; obj4.isOn = false; val9.AddComponent<RectTransform>(); ((HorizontalOrVerticalLayoutGroup)val11.AddComponent<VerticalLayoutGroup>()).childForceExpandHeight = false; val7.AddComponent<CanvasGroup>().alpha = 0f; val7.SetActive(false); val13.AddComponent<LayoutElement>().preferredHeight = 20f; val2.template = val8; val2.captionText = val4; val2.itemText = val16; val2.options.Clear(); foreach (string option in options) { val2.options.Add(new OptionData(option)); } if (onValueChanged != null) { ((UnityEvent<int>)(object)val2.onValueChanged).AddListener(onValueChanged); } val2.value = 0; val2.RefreshShownValue(); Debug.Log((object)("Dropdown created: " + name)); Debug.Log((object)("Options count: " + options.Count)); Debug.Log((object)("Arrow Image: " + (((Object)(object)val6.sprite != (Object)null) ? "Loaded" : "Not Loaded"))); Debug.Log((object)("Template Active: " + val7.activeSelf)); return val2; } } namespace ValheimAdminTool { public class DragHandler : MonoBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IEndDragHandler { private Vector2 pointerOffset; private RectTransform canvasRectTransform; private RectTransform panelRectTransform; private bool clampedToLeft; private bool clampedToRight; private bool clampedToTop; private bool clampedToBottom; public void Start() { Canvas componentInParent = ((Component)this).GetComponentInParent<Canvas>(); if ((Object)(object)componentInParent != (Object)null) { ref RectTransform reference = ref canvasRectTransform; Transform transform = ((Component)componentInParent).transform; reference = (RectTransform)(object)((transform is RectTransform) ? transform : null); ref RectTransform reference2 = ref panelRectTransform; Transform transform2 = ((Component)this).transform; reference2 = (RectTransform)(object)((transform2 is RectTransform) ? transform2 : null); } clampedToLeft = false; clampedToRight = false; clampedToTop = false; clampedToBottom = false; } public void OnBeginDrag(PointerEventData eventData) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) ((Transform)panelRectTransform).SetAsLastSibling(); RectTransformUtility.ScreenPointToLocalPointInRectangle(panelRectTransform, eventData.position, eventData.pressEventCamera, ref pointerOffset); } public void OnDrag(PointerEventData eventData) { //IL_0016: 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_0035: 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) //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) //IL_005f: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); if (!((Object)(object)panelRectTransform == (Object)null) && RectTransformUtility.ScreenPointToLocalPointInRectangle(canvasRectTransform, eventData.position, eventData.pressEventCamera, ref val)) { ((Transform)panelRectTransform).localPosition = Vector2.op_Implicit(val - pointerOffset); ClampToWindow(); Vector2 val2 = Vector2.op_Implicit(((Transform)panelRectTransform).localPosition); Rect rect; if (clampedToRight) { rect = canvasRectTransform.rect; float num = ((Rect)(ref rect)).width * 0.5f; rect = panelRectTransform.rect; val2.x = num - ((Rect)(ref rect)).width * (1f - panelRectTransform.pivot.x); } else if (clampedToLeft) { rect = canvasRectTransform.rect; float num2 = (0f - ((Rect)(ref rect)).width) * 0.5f; rect = panelRectTransform.rect; val2.x = num2 + ((Rect)(ref rect)).width * panelRectTransform.pivot.x; } if (clampedToTop) { rect = canvasRectTransform.rect; float num3 = ((Rect)(ref rect)).height * 0.5f; rect = panelRectTransform.rect; val2.y = num3 - ((Rect)(ref rect)).height * (1f - panelRectTransform.pivot.y); } else if (clampedToBottom) { rect = canvasRectTransform.rect; float num4 = (0f - ((Rect)(ref rect)).height) * 0.5f; rect = panelRectTransform.rect; val2.y = num4 + ((Rect)(ref rect)).height * panelRectTransform.pivot.y; } ((Transform)panelRectTransform).localPosition = Vector2.op_Implicit(val2); } } public void OnEndDrag(PointerEventData eventData) { } private void ClampToWindow() { Vector3[] array = (Vector3[])(object)new Vector3[4]; Vector3[] array2 = (Vector3[])(object)new Vector3[4]; canvasRectTransform.GetWorldCorners(array); panelRectTransform.GetWorldCorners(array2); if (array2[2].x > array[2].x) { if (!clampedToRight) { clampedToRight = true; } } else if (clampedToRight) { clampedToRight = false; } else if (array2[0].x < array[0].x) { if (!clampedToLeft) { clampedToLeft = true; } } else if (clampedToLeft) { clampedToLeft = false; } if (array2[2].y > array[2].y) { if (!clampedToTop) { clampedToTop = true; } } else if (clampedToTop) { clampedToTop = false; } else if (array2[0].y < array[0].y) { if (!clampedToBottom) { clampedToBottom = true; } } else if (clampedToBottom) { clampedToBottom = false; } } } internal class ModConfig { internal static ConfigEntry<bool> _isModEnabled; internal static ConfigEntry<KeyboardShortcut> showMenuHotkey; internal static ConfigEntry<KeyboardShortcut> quickHealKey; internal static ConfigEntry<KeyboardShortcut> godModeHotkey; internal static ConfigEntry<KeyboardShortcut> debugModeKey; internal static ConfigEntry<KeyboardShortcut> staminaModeKey; internal static ConfigEntry<KeyboardShortcut> noClip; internal static ConfigEntry<KeyboardShortcut> flyMode; internal static void CreateConfig(ConfigFile config) { //IL_0030: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) _isModEnabled = config.Bind<bool>("_Global", "isModEnabled", true, "Globally enable or disable this mod."); showMenuHotkey = config.Bind<KeyboardShortcut>("Hotkeys", "Show Menu", new KeyboardShortcut((KeyCode)284, Array.Empty<KeyCode>()), (ConfigDescription)null); quickHealKey = config.Bind<KeyboardShortcut>("Hotkeys", "Quick Heal", new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()), (ConfigDescription)null); godModeHotkey = config.Bind<KeyboardShortcut>("Hotkeys", "God Mode", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), (ConfigDescription)null); debugModeKey = config.Bind<KeyboardShortcut>("Hotkeys", "Debug Mode", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), (ConfigDescription)null); staminaModeKey = config.Bind<KeyboardShortcut>("Hotkeys", "Stamina Mode", new KeyboardShortcut((KeyCode)289, Array.Empty<KeyCode>()), (ConfigDescription)null); noClip = config.Bind<KeyboardShortcut>("Hotkeys", "No Clip", new KeyboardShortcut((KeyCode)292, Array.Empty<KeyCode>()), (ConfigDescription)null); flyMode = config.Bind<KeyboardShortcut>("Hotkeys", "Fly Mode", new KeyboardShortcut((KeyCode)293, Array.Empty<KeyCode>()), (ConfigDescription)null); } } public class ModMenu : MonoBehaviour { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__20_0; public static UnityAction <>9__20_1; public static UnityAction <>9__20_2; public static UnityAction <>9__20_3; public static UnityAction <>9__20_4; public static UnityAction <>9__20_5; internal void <SetupMainMenu>b__20_0() { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer01"]).gameObject.SetActive(true); ((Component)containerTransforms["CheatsContainer"]).gameObject.SetActive(true); } internal void <SetupMainMenu>b__20_1() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer02"]).gameObject.SetActive(true); ((Component)containerTransforms["SkillsContainer"]).gameObject.SetActive(true); if ((Object)(object)SkillsMenu.swordsSlider != (Object)null && (Object)(object)SkillsMenu.swordsSlider.handleRect != (Object)null) { SkillsMenu.swordsSlider.handleRect.sizeDelta = new Vector2(20f, 20f); float num = (SkillsMenu.swordsSlider.value - SkillsMenu.swordsSlider.minValue) / (SkillsMenu.swordsSlider.maxValue - SkillsMenu.swordsSlider.minValue) * (((Component)SkillsMenu.swordsSlider).GetComponent<RectTransform>().sizeDelta.x - SkillsMenu.swordsSlider.handleRect.sizeDelta.x); SkillsMenu.swordsSlider.handleRect.anchoredPosition = new Vector2(num, 0f); } } internal void <SetupMainMenu>b__20_2() { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer03"]).gameObject.SetActive(true); ((Component)containerTransforms["ToolsContainer"]).gameObject.SetActive(true); } internal void <SetupMainMenu>b__20_3() { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer04"]).gameObject.SetActive(true); ((Component)containerTransforms["ESPContainer"]).gameObject.SetActive(true); } internal void <SetupMainMenu>b__20_4() { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer05"]).gameObject.SetActive(true); ((Component)containerTransforms["ItemsContainer"]).gameObject.SetActive(true); } internal void <SetupMainMenu>b__20_5() { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer06"]).gameObject.SetActive(true); ((Component)containerTransforms["EntitiesContainer"]).gameObject.SetActive(true); } } public static bool displayMainMenu = false; public static bool manualCursorEnabled = false; public static bool isInitialized = false; public static GameObject canvasObject; public static Canvas mainCanvas; public static GameObject backgroundImageObject; public static RectTransform backgroundImageTransform; public static IDictionary<string, GameObject> containerObjects = new Dictionary<string, GameObject>(); public static IDictionary<string, RectTransform> containerTransforms = new Dictionary<string, RectTransform>(); public static IDictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>(); public static IDictionary<string, Sprite> sprites = new Dictionary<string, Sprite>(); private void Start() { } private void LateUpdate() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) KeyboardShortcut value = ModConfig.showMenuHotkey.Value; if (((KeyboardShortcut)(ref value)).IsDown() && (Object)(object)ZNet.instance != (Object)null) { ValheimAdminTool.playerIsLocalOrAdmin = ZNet.instance.LocalPlayerIsAdminOrHost(); if (ValheimAdminTool.playerIsLocalOrAdmin || ValheimAdminTool.overrideAdminCheck) { displayMainMenu = !displayMainMenu; } } if (ValheimAdminTool.playerIsLocalOrAdmin || ValheimAdminTool.overrideAdminCheck) { HotkeyHandler(); } if (isInitialized) { SkillsMenu.UpdateSkills(); ESPMenu.Update(); ItemsMenu.Update(); } } private void OnGUI() { if ((Object)(object)Player.m_localPlayer == (Object)null || (!ValheimAdminTool.playerIsLocalOrAdmin && !ValheimAdminTool.overrideAdminCheck)) { return; } if (displayMainMenu) { if ((Object)(object)mainCanvas == (Object)null && !isInitialized) { SetupSprites(); SetupCanvas(); SetupMainBackgroundImage(); SetupMainMenu(); } ((Behaviour)mainCanvas).enabled = true; ShowCursor(flag: true); } else { if ((Object)(object)mainCanvas != (Object)null) { ((Behaviour)mainCanvas).enabled = false; } ShowCursor(flag: false); } ESPMenu.DrawESP(); } private static void HotkeyHandler() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0138: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) if ((!ValheimAdminTool.playerIsLocalOrAdmin && !ValheimAdminTool.overrideAdminCheck) || (Object.op_Implicit((Object)(object)Chat.instance) && Chat.instance.HasFocus()) || Console.IsVisible() || TextInput.IsVisible() || StoreGui.IsVisible() || InventoryGui.IsVisible() || Minimap.IsOpen()) { return; } KeyboardShortcut value = ModConfig.quickHealKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { ((Character)Player.m_localPlayer).SetHealth(((Character)Player.m_localPlayer).GetMaxHealth()); ((Character)Player.m_localPlayer).Message((MessageType)1, "<color=\"blue\">Healing Player</color>", 0, (Sprite)null); } value = ModConfig.godModeHotkey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CheatsMenu.sGodMode = !CheatsMenu.sGodMode; Player.m_localPlayer.SetGodMode(CheatsMenu.sGodMode); ((Character)Player.m_localPlayer).Message((MessageType)1, CheatsMenu.sGodMode ? "<color=\"green\">Enabled God Mode</color>" : "<color=\"red\">Disabled God Mode</color>", 0, (Sprite)null); } value = ModConfig.debugModeKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CheatsMenu.sDebugMode = !CheatsMenu.sDebugMode; if (CheatsMenu.sDebugMode) { Player.m_debugMode = true; } else { Player.m_debugMode = false; } ((Character)Player.m_localPlayer).Message((MessageType)1, CheatsMenu.sDebugMode ? "<color=\"green\">Enabled Debug Mode</color>" : "<color=\"red\">Disabled Debug Mode</color>", 0, (Sprite)null); } value = ModConfig.staminaModeKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CheatsMenu.sUnlimitedStamina = !CheatsMenu.sUnlimitedStamina; ((Character)Player.m_localPlayer).Message((MessageType)1, CheatsMenu.sUnlimitedStamina ? "<color=\"green\">Enabled Unlimited Stamina</color>" : "<color=\"red\">Disabled Unlimited Stamina</color>", 0, (Sprite)null); } value = ModConfig.noClip.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CheatsMenu.sNoClip = !CheatsMenu.sNoClip; Player.m_localPlayer.m_debugFly = CheatsMenu.sNoClip; Collider[] componentsInChildren = ((Component)Player.m_localPlayer).GetComponentsInChildren<Collider>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = !CheatsMenu.sNoClip; } ((Character)Player.m_localPlayer).Message((MessageType)1, CheatsMenu.sNoClip ? "<color=\"green\">Enabled No Clip</color>" : "<color=\"red\">Disabled No Clip</color>", 0, (Sprite)null); } value = ModConfig.flyMode.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { CheatsMenu.sFlyMode = !CheatsMenu.sFlyMode; Player.m_localPlayer.m_debugFly = CheatsMenu.sFlyMode; ((Character)Player.m_localPlayer).Message((MessageType)1, CheatsMenu.sFlyMode ? "<color=\"green\">Enabled Fly Mode</color>" : "<color=\"red\">Disabled Fly Mode</color>", 0, (Sprite)null); } } private static void SetupSprites() { SetupSprite("backgroundImage", "background.png"); SetupSprite("buttonNormal", "button_normal.png"); SetupSprite("buttonHover", "button_highlighted.png"); SetupSprite("buttonPressed", "button_pressed.png"); SetupSprite("scrollForeground", "scroll_thumb.png"); SetupSprite("switchOn", "switch_on.png"); SetupSprite("switchOff", "switch_off.png"); SetupSprite("switchBackground", "switch_background.png"); SetupSprite("switchCircle", "switch_circle.png"); SetupSprite("dropdownArrow", "DropdownArrow.png"); SetupSprite("dropdownBackground", "DropdownBackground.png"); } private static void SetupCanvas() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) canvasObject = new GameObject(); ((Object)canvasObject).name = "MainCanvas"; canvasObject.AddComponent<Canvas>(); CanvasScaler obj = canvasObject.AddComponent<CanvasScaler>(); canvasObject.AddComponent<GraphicRaycaster>(); mainCanvas = canvasObject.GetComponent<Canvas>(); mainCanvas.renderMode = (RenderMode)0; obj.referencePixelsPerUnit = 100f; obj.referenceResolution = new Vector2(1920f, 1080f); RectTransform component = canvasObject.GetComponent<RectTransform>(); component.anchorMin = new Vector2(0.5f, 0.5f); component.anchorMax = new Vector2(0.5f, 0.5f); component.pivot = new Vector2(0.5f, 0.5f); component.anchoredPosition = Vector2.zero; } private static void SetupMainBackgroundImage() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0052: 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_0093: Unknown result type (might be due to invalid IL or missing references) backgroundImageObject = new GameObject(); backgroundImageObject.transform.parent = canvasObject.transform; ((Object)backgroundImageObject).name = "backgroundImage"; Image obj = backgroundImageObject.AddComponent<Image>(); obj.sprite = sprites["backgroundImage"]; ((Graphic)obj).color = Color.white; backgroundImageTransform = ((Component)obj).GetComponent<RectTransform>(); ((Transform)backgroundImageTransform).localPosition = new Vector3(0f, 0f, 0f); backgroundImageTransform.sizeDelta = new Vector2(1100f, 600f); } private static void SetupSprite(string name, string texture) { //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) if (!textures.ContainsKey(name)) { Texture2D val = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources." + texture)); Sprite value = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), Vector2.zero); textures.Add(name, val); sprites.Add(name, value); } } private static void DeactivateAllTransforms() { ((Component)containerTransforms["CheatsContainer"]).gameObject.SetActive(false); ((Component)containerTransforms["SkillsContainer"]).gameObject.SetActive(false); ((Component)containerTransforms["ToolsContainer"]).gameObject.SetActive(false); ((Component)containerTransforms["ESPContainer"]).gameObject.SetActive(false); ((Component)containerTransforms["ItemsContainer"]).gameObject.SetActive(false); ((Component)containerTransforms["EntitiesContainer"]).gameObject.SetActive(false); ((Component)containerTransforms["AdminContainer"]).gameObject.SetActive(false); ((Component)containerTransforms["ScrollContainer01"]).gameObject.SetActive(false); ((Component)containerTransforms["ScrollContainer02"]).gameObject.SetActive(false); ((Component)containerTransforms["ScrollContainer03"]).gameObject.SetActive(false); ((Component)containerTransforms["ScrollContainer04"]).gameObject.SetActive(false); ((Component)containerTransforms["ScrollContainer05"]).gameObject.SetActive(false); ((Component)containerTransforms["ScrollContainer06"]).gameObject.SetActive(false); ((Component)containerTransforms["ScrollContainer07"]).gameObject.SetActive(false); } private static void SetupMainMenu() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_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_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Expected O, but got Unknown //IL_0122: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_01a1: Expected O, but got Unknown //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown //IL_023e: 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_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Expected O, but got Unknown //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02a8: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_034a: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0442: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_0619: Unknown result type (might be due to invalid IL or missing references) //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0627: Unknown result type (might be due to invalid IL or missing references) //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_066d: Unknown result type (might be due to invalid IL or missing references) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_0678: Expected O, but got Unknown //IL_0735: Unknown result type (might be due to invalid IL or missing references) //IL_073a: Unknown result type (might be due to invalid IL or missing references) //IL_0743: Unknown result type (might be due to invalid IL or missing references) //IL_06fa: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Expected O, but got Unknown //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_07c9: Unknown result type (might be due to invalid IL or missing references) //IL_07d2: Unknown result type (might be due to invalid IL or missing references) //IL_0789: Unknown result type (might be due to invalid IL or missing references) //IL_078e: Unknown result type (might be due to invalid IL or missing references) //IL_0794: Expected O, but got Unknown //IL_0853: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_0861: Unknown result type (might be due to invalid IL or missing references) //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_081d: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Expected O, but got Unknown //IL_08e2: Unknown result type (might be due to invalid IL or missing references) //IL_08e7: Unknown result type (might be due to invalid IL or missing references) //IL_08f0: Unknown result type (might be due to invalid IL or missing references) //IL_08a7: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_08b2: Expected O, but got Unknown //IL_095f: Unknown result type (might be due to invalid IL or missing references) //IL_096e: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_09a0: Unknown result type (might be due to invalid IL or missing references) //IL_09a5: Unknown result type (might be due to invalid IL or missing references) //IL_09c9: Unknown result type (might be due to invalid IL or missing references) //IL_09d8: Unknown result type (might be due to invalid IL or missing references) //IL_09f6: Unknown result type (might be due to invalid IL or missing references) //IL_0a0a: Unknown result type (might be due to invalid IL or missing references) //IL_0a0f: Unknown result type (might be due to invalid IL or missing references) //IL_0a33: Unknown result type (might be due to invalid IL or missing references) //IL_0a42: Unknown result type (might be due to invalid IL or missing references) //IL_0a60: Unknown result type (might be due to invalid IL or missing references) //IL_0a74: Unknown result type (might be due to invalid IL or missing references) //IL_0a79: Unknown result type (might be due to invalid IL or missing references) //IL_0a9d: Unknown result type (might be due to invalid IL or missing references) //IL_0aac: Unknown result type (might be due to invalid IL or missing references) //IL_0aca: Unknown result type (might be due to invalid IL or missing references) //IL_0ade: Unknown result type (might be due to invalid IL or missing references) //IL_0ae3: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_0b16: Unknown result type (might be due to invalid IL or missing references) //IL_0b34: Unknown result type (might be due to invalid IL or missing references) //IL_0b48: Unknown result type (might be due to invalid IL or missing references) //IL_0b4d: Unknown result type (might be due to invalid IL or missing references) //IL_0b71: Unknown result type (might be due to invalid IL or missing references) //IL_0b80: Unknown result type (might be due to invalid IL or missing references) //IL_0b9e: Unknown result type (might be due to invalid IL or missing references) //IL_0bb2: Unknown result type (might be due to invalid IL or missing references) //IL_0bb7: Unknown result type (might be due to invalid IL or missing references) //IL_0bdb: Unknown result type (might be due to invalid IL or missing references) //IL_0bea: Unknown result type (might be due to invalid IL or missing references) //IL_0c08: Unknown result type (might be due to invalid IL or missing references) //IL_0c1c: Unknown result type (might be due to invalid IL or missing references) //IL_0c21: Unknown result type (might be due to invalid IL or missing references) //IL_0936: Unknown result type (might be due to invalid IL or missing references) //IL_093b: Unknown result type (might be due to invalid IL or missing references) //IL_0941: Expected O, but got Unknown int num = 303; int num2 = 47; int num3 = 10; int num4 = 0; int num5 = 211; int fontSize = 18; new Color(1f, 0.5686f, 0.0039f, 1f); backgroundImageObject.AddComponent<DragHandler>(); ModContainer.SetupContainer(backgroundImageObject.transform, "MenuContainer", Color.clear, new Vector3(-550f, -300f, 0f), Vector2.op_Implicit(new Vector2(342f, 506f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "CheatsContainer", Color.clear, new Vector3(-150f, -750f, 0f), Vector2.op_Implicit(new Vector2(550f, 750f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "SkillsContainer", Color.clear, new Vector3(-150f, -750f, 0f), Vector2.op_Implicit(new Vector2(550f, 750f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "ToolsContainer", Color.clear, new Vector3(-150f, -750f, 0f), Vector2.op_Implicit(new Vector2(550f, 750f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "ESPContainer", Color.clear, new Vector3(-150f, -750f, 0f), Vector2.op_Implicit(new Vector2(550f, 750f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "ItemsContainer", Color.clear, new Vector3(-150f, -750f, 0f), Vector2.op_Implicit(new Vector2(550f, 750f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "EntitiesContainer", Color.clear, new Vector3(-150f, -750f, 0f), Vector2.op_Implicit(new Vector2(550f, 750f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "AdminContainer", Color.clear, new Vector3(-150f, -750f, 0f), Vector2.op_Implicit(new Vector2(550f, 750f)), scroll: false, new RectTransform()); ModContainer.SetupContainer(backgroundImageObject.transform, "ScrollContainer01", Color.white, new Vector3(-207f, -300f, 0f), Vector2.op_Implicit(new Vector2(752f, 506f)), scroll: true, containerTransforms["CheatsContainer"]); ModContainer.SetupContainer(backgroundImageObject.transform, "ScrollContainer02", Color.white, new Vector3(-207f, -300f, 0f), Vector2.op_Implicit(new Vector2(752f, 506f)), scroll: true, containerTransforms["SkillsContainer"]); ModContainer.SetupContainer(backgroundImageObject.transform, "ScrollContainer03", Color.white, new Vector3(-207f, -300f, 0f), Vector2.op_Implicit(new Vector2(752f, 506f)), scroll: true, containerTransforms["ToolsContainer"]); ModContainer.SetupContainer(backgroundImageObject.transform, "ScrollContainer04", Color.white, new Vector3(-207f, -300f, 0f), Vector2.op_Implicit(new Vector2(752f, 506f)), scroll: true, containerTransforms["ESPContainer"]); ModContainer.SetupContainer(backgroundImageObject.transform, "ScrollContainer05", Color.white, new Vector3(-207f, -300f, 0f), Vector2.op_Implicit(new Vector2(752f, 506f)), scroll: true, containerTransforms["ItemsContainer"]); ModContainer.SetupContainer(backgroundImageObject.transform, "ScrollContainer06", Color.white, new Vector3(-207f, -300f, 0f), Vector2.op_Implicit(new Vector2(752f, 506f)), scroll: true, containerTransforms["EntitiesContainer"]); ModContainer.SetupContainer(backgroundImageObject.transform, "ScrollContainer07", Color.white, new Vector3(-207f, -300f, 0f), Vector2.op_Implicit(new Vector2(752f, 506f)), scroll: true, containerTransforms["AdminContainer"]); ((Component)containerTransforms["CheatsContainer"]).transform.SetParent(containerObjects["ScrollContainer01"].transform); ((Component)containerTransforms["SkillsContainer"]).transform.SetParent(containerObjects["ScrollContainer02"].transform); ((Component)containerTransforms["ToolsContainer"]).transform.SetParent(containerObjects["ScrollContainer03"].transform); ((Component)containerTransforms["ESPContainer"]).transform.SetParent(containerObjects["ScrollContainer04"].transform); ((Component)containerTransforms["ItemsContainer"]).transform.SetParent(containerObjects["ScrollContainer05"].transform); ((Component)containerTransforms["EntitiesContainer"]).transform.SetParent(containerObjects["ScrollContainer06"].transform); DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer01"]).gameObject.SetActive(true); ((Component)containerTransforms["CheatsContainer"]).gameObject.SetActive(true); RectTransform transform = containerTransforms["MenuContainer"]; Vector2 position = Vector2.op_Implicit(new Vector3((float)num4, (float)num5, 0f)); Vector2 size = new Vector2((float)num, (float)num2); Sprite normalSprite = sprites["buttonNormal"]; Sprite hoverSprite = sprites["buttonHover"]; Sprite activeSprite = sprites["buttonPressed"]; object obj = <>c.<>9__20_0; if (obj == null) { UnityAction val = delegate { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer01"]).gameObject.SetActive(true); ((Component)containerTransforms["CheatsContainer"]).gameObject.SetActive(true); }; <>c.<>9__20_0 = val; obj = (object)val; } ModButton.CreateButton((Transform)(object)transform, "CheatsMenu", "Cheats", fontSize, position, size, normalSprite, hoverSprite, activeSprite, (UnityAction)obj); RectTransform transform2 = containerTransforms["MenuContainer"]; Vector2 position2 = Vector2.op_Implicit(new Vector3((float)num4, (float)(num5 - (num2 + num3)), 0f)); Vector2 size2 = new Vector2((float)num, (float)num2); Sprite normalSprite2 = sprites["buttonNormal"]; Sprite hoverSprite2 = sprites["buttonHover"]; Sprite activeSprite2 = sprites["buttonPressed"]; object obj2 = <>c.<>9__20_1; if (obj2 == null) { UnityAction val2 = delegate { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer02"]).gameObject.SetActive(true); ((Component)containerTransforms["SkillsContainer"]).gameObject.SetActive(true); if ((Object)(object)SkillsMenu.swordsSlider != (Object)null && (Object)(object)SkillsMenu.swordsSlider.handleRect != (Object)null) { SkillsMenu.swordsSlider.handleRect.sizeDelta = new Vector2(20f, 20f); float num6 = (SkillsMenu.swordsSlider.value - SkillsMenu.swordsSlider.minValue) / (SkillsMenu.swordsSlider.maxValue - SkillsMenu.swordsSlider.minValue) * (((Component)SkillsMenu.swordsSlider).GetComponent<RectTransform>().sizeDelta.x - SkillsMenu.swordsSlider.handleRect.sizeDelta.x); SkillsMenu.swordsSlider.handleRect.anchoredPosition = new Vector2(num6, 0f); } }; <>c.<>9__20_1 = val2; obj2 = (object)val2; } ModButton.CreateButton((Transform)(object)transform2, "SkillsMenu", "Skills", fontSize, position2, size2, normalSprite2, hoverSprite2, activeSprite2, (UnityAction)obj2); RectTransform transform3 = containerTransforms["MenuContainer"]; Vector2 position3 = Vector2.op_Implicit(new Vector3((float)num4, (float)(num5 - 2 * (num2 + num3)), 0f)); Vector2 size3 = new Vector2((float)num, (float)num2); Sprite normalSprite3 = sprites["buttonNormal"]; Sprite hoverSprite3 = sprites["buttonHover"]; Sprite activeSprite3 = sprites["buttonPressed"]; object obj3 = <>c.<>9__20_2; if (obj3 == null) { UnityAction val3 = delegate { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer03"]).gameObject.SetActive(true); ((Component)containerTransforms["ToolsContainer"]).gameObject.SetActive(true); }; <>c.<>9__20_2 = val3; obj3 = (object)val3; } ModButton.CreateButton((Transform)(object)transform3, "ToolsMenu", "Tools", fontSize, position3, size3, normalSprite3, hoverSprite3, activeSprite3, (UnityAction)obj3); RectTransform transform4 = containerTransforms["MenuContainer"]; Vector2 position4 = Vector2.op_Implicit(new Vector3((float)num4, (float)(num5 - 3 * (num2 + num3)), 0f)); Vector2 size4 = new Vector2((float)num, (float)num2); Sprite normalSprite4 = sprites["buttonNormal"]; Sprite hoverSprite4 = sprites["buttonHover"]; Sprite activeSprite4 = sprites["buttonPressed"]; object obj4 = <>c.<>9__20_3; if (obj4 == null) { UnityAction val4 = delegate { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer04"]).gameObject.SetActive(true); ((Component)containerTransforms["ESPContainer"]).gameObject.SetActive(true); }; <>c.<>9__20_3 = val4; obj4 = (object)val4; } ModButton.CreateButton((Transform)(object)transform4, "ESPMenu", "ESP", fontSize, position4, size4, normalSprite4, hoverSprite4, activeSprite4, (UnityAction)obj4); RectTransform transform5 = containerTransforms["MenuContainer"]; Vector2 position5 = Vector2.op_Implicit(new Vector3((float)num4, (float)(num5 - 4 * (num2 + num3)), 0f)); Vector2 size5 = new Vector2((float)num, (float)num2); Sprite normalSprite5 = sprites["buttonNormal"]; Sprite hoverSprite5 = sprites["buttonHover"]; Sprite activeSprite5 = sprites["buttonPressed"]; object obj5 = <>c.<>9__20_4; if (obj5 == null) { UnityAction val5 = delegate { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer05"]).gameObject.SetActive(true); ((Component)containerTransforms["ItemsContainer"]).gameObject.SetActive(true); }; <>c.<>9__20_4 = val5; obj5 = (object)val5; } ModButton.CreateButton((Transform)(object)transform5, "ItemsMenu", "Items", fontSize, position5, size5, normalSprite5, hoverSprite5, activeSprite5, (UnityAction)obj5); RectTransform transform6 = containerTransforms["MenuContainer"]; Vector2 position6 = Vector2.op_Implicit(new Vector3((float)num4, (float)(num5 - 5 * (num2 + num3)), 0f)); Vector2 size6 = new Vector2((float)num, (float)num2); Sprite normalSprite6 = sprites["buttonNormal"]; Sprite hoverSprite6 = sprites["buttonHover"]; Sprite activeSprite6 = sprites["buttonPressed"]; object obj6 = <>c.<>9__20_5; if (obj6 == null) { UnityAction val6 = delegate { DeactivateAllTransforms(); ((Component)containerTransforms["ScrollContainer06"]).gameObject.SetActive(true); ((Component)containerTransforms["EntitiesContainer"]).gameObject.SetActive(true); }; <>c.<>9__20_5 = val6; obj6 = (object)val6; } ModButton.CreateButton((Transform)(object)transform6, "EntitiesMenu", "Entities", fontSize, position6, size6, normalSprite6, hoverSprite6, activeSprite6, (UnityAction)obj6); ModGroupBox.CreateGroupBox((Transform)(object)containerTransforms["CheatsContainer"], new Vector2(-34f, -10f), new Vector2(260f, 329f), 2f, new Color(1f, 0.6f, 0.003921569f, 1f), "Cheats", new Vector2(50f, 2f), Color.black); ModGroupBox.CreateGroupBox((Transform)(object)containerTransforms["CheatsContainer"], new Vector2(246f, -10f), new Vector2(160f, 161f), 2f, new Color(1f, 0.6f, 0.003921569f, 1f), "Other", new Vector2(50f, 2f), Color.black); ModGroupBox.CreateGroupBox((Transform)(object)containerTransforms["ToolsContainer"], new Vector2(-34f, -10f), new Vector2(282f, 138f), 2f, new Color(1f, 0.6f, 0.003921569f, 1f), "Death Menu", new Vector2(50f, 2f), Color.black); ModGroupBox.CreateGroupBox((Transform)(object)containerTransforms["ToolsContainer"], new Vector2(-34f, -160f), new Vector2(282f, 86f), 2f, new Color(1f, 0.6f, 0.003921569f, 1f), "Ship Hacks", new Vector2(50f, 2f), Color.black); ModGroupBox.CreateGroupBox((Transform)(object)containerTransforms["ToolsContainer"], new Vector2(-34f, -258f), new Vector2(282f, 86f), 2f, new Color(1f, 0.6f, 0.003921569f, 1f), "Food Hacks", new Vector2(50f, 2f), Color.black); ModGroupBox.CreateGroupBox((Transform)(object)containerTransforms["ToolsContainer"], new Vector2(-34f, -356f), new Vector2(282f, 63f), 2f, new Color(1f, 0.6f, 0.003921569f, 1f), "Experimental", new Vector2(50f, 2f), Color.black); ModGroupBox.CreateGroupBox((Transform)(object)containerTransforms["ToolsContainer"], new Vector2(268f, -10f), new Vector2(160f, 241f), 2f, new Color(1f, 0.6f, 0.003921569f, 1f), "Boss Powers", new Vector2(50f, 2f), Color.black); CheatsMenu.CreateUI(); SkillsMenu.CreateUI(); ToolsMenu.CreateUI(); ESPMenu.CreateUI(); ItemsMenu.CreateUI(); EntitiesMenu.CreateUI(); isInitialized = true; } public void ShowCursor(bool flag) { if (flag) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; ((Behaviour)GameCamera.instance).enabled = false; ((Behaviour)((Component)Player.m_localPlayer).GetComponent<PlayerController>()).enabled = false; manualCursorEnabled = true; } else if (manualCursorEnabled) { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; ((Behaviour)GameCamera.instance).enabled = true; ((Behaviour)((Component)Player.m_localPlayer).GetComponent<PlayerController>()).enabled = true; manualCursorEnabled = false; } } } public class Switch : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { private Image background; private Image circle; private bool isOn; public Sprite onBackgroundSprite; public Sprite offBackgroundSprite; public Sprite circleSprite; public UnityEvent OnSwitchOn = new UnityEvent(); public UnityEvent OnSwitchOff = new UnityEvent(); private void Start() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) background = ((Component)this).GetComponent<Image>(); if ((Object)(object)background != (Object)null) { background.sprite = offBackgroundSprite; } isOn = false; GameObject val = new GameObject("Circle"); val.transform.SetParent(((Component)this).transform, false); circle = val.AddComponent<Image>(); circle.sprite = circleSprite; ((Graphic)circle).rectTransform.anchoredPosition = new Vector2(-13f, 0f); ((Graphic)circle).rectTransform.sizeDelta = new Vector2(15.28f, 15.28f); } public void OnPointerClick(PointerEventData eventData) { isOn = !isOn; if ((Object)(object)background != (Object)null) { background.sprite = (isOn ? onBackgroundSprite : offBackgroundSprite); } ((MonoBehaviour)this).StartCoroutine(AnimateSwitch(isOn)); } private IEnumerator AnimateSwitch(bool isOn) { float duration = 0.2f; float start = (isOn ? (-13f) : 13f); float end = (isOn ? 13f : (-13f)); float timeElapsed = 0f; while (timeElapsed < duration) { float num = Mathf.Lerp(start, end, timeElapsed / duration); ((Graphic)circle).rectTransform.anchoredPosition = new Vector2(num, 0f); timeElapsed += Time.deltaTime; yield return null; } ((Graphic)circle).rectTransform.anchoredPosition = new Vector2(end, 0f); if (isOn) { UnityEvent onSwitchOn = OnSwitchOn; if (onSwitchOn != null) { onSwitchOn.Invoke(); } } else { UnityEvent onSwitchOff = OnSwitchOff; if (onSwitchOff != null) { onSwitchOff.Invoke(); } } } } [BepInPlugin("icecub.ValheimAdminTool", "ValheimAdminTool", "0.1.0")] public class ValheimAdminTool : BaseUnityPlugin { public const string PluginGUID = "icecub.ValheimAdminTool"; public const string PluginName = "ValheimAdminTool"; public const string PluginVersion = "0.1.0"; public static bool playerIsLocalOrAdmin = false; public static bool overrideAdminCheck = true; private static ModMenu modInstance; public static Harmony harmony; private void Awake() { //IL_000b: 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_0033: Expected O, but got Unknown ModConfig.CreateConfig(((BaseUnityPlugin)this).Config); modInstance = new GameObject().AddComponent<ModMenu>(); Object.DontDestroyOnLoad((Object)(object)modInstance); harmony = new Harmony("icecub.ValheimAdminTool"); harmony.PatchAll(Assembly.GetExecutingAssembly()); } public static void ResetMod() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Expected O, but got Unknown //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Expected O, but got Unknown //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Expected O, but got Unknown //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Expected O, but got Unknown //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Expected O, but got Unknown //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0468: Expected O, but got Unknown //IL_046d: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Expected O, but got Unknown //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Expected O, but got Unknown //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Expected O, but got Unknown //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Expected O, but got Unknown //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_04b3: Expected O, but got Unknown //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c2: Expected O, but got Unknown CheatsMenu.sGodMode = false; CheatsMenu.sDebugMode = false; CheatsMenu.sUnlimitedStamina = false; CheatsMenu.sUnlimitedEitr = false; CheatsMenu.sFlyMode = false; CheatsMenu.sNoClip = false; CheatsMenu.sFreeCam = false; CheatsMenu.sGhostMode = false; CheatsMenu.sNoCarryLimit = false; CheatsMenu.sNoBuildCost = false; CheatsMenu.sBuildEverywhere = false; CheatsMenu.sNoStructureDmg = false; ModMenu.displayMainMenu = false; ModMenu.manualCursorEnabled = false; ModMenu.isInitialized = false; ModMenu.canvasObject = null; ModMenu.mainCanvas = null; ModMenu.backgroundImageObject = null; ModMenu.backgroundImageTransform = null; ModMenu.containerObjects.Clear(); ModMenu.containerTransforms.Clear(); ModMenu.textures.Clear(); ModMenu.sprites.Clear(); ToolsMenu.noFoodDegrade = false; ToolsMenu.noFoodTimeout = false; ToolsMenu.enableWindInBack = false; ToolsMenu.enableShipSpeedHack = false; ToolsMenu.disableItemLoss = false; ToolsMenu.disableFoodLoss = false; ToolsMenu.disableStatusLoss = false; ToolsMenu.disableSkillLoss = false; ToolsMenu.disableDurabilityLoss = false; ItemsMenu.armorTabPageObject = new GameObject("Armor"); ItemsMenu.toolsTabPageObject = new GameObject("Tools"); ItemsMenu.weaponsTabPageObject = new GameObject("Weapons"); ItemsMenu.ammoTabPageObject = new GameObject("Ammo"); ItemsMenu.resourcesTabPageObject = new GameObject("Resources"); ItemsMenu.foodTabPageObject = new GameObject("Food"); ItemsMenu.potionsTabPageObject = new GameObject("Potions"); ItemsMenu.miscellaneousTabPageObject = new GameObject("Miscellaneous"); ItemsMenu.s_updateTimer = 0f; ItemsMenu.s_updateTimerInterval = 1.5f; ItemsMenu.itemNames.Clear(); ItemsMenu.tabButtons = null; ItemsMenu.customInputField = null; ESPMenu.s_playersColor = Color.magenta; ESPMenu.s_monstersAndOthersColor = Color.red; ESPMenu.s_tamedMonstersColor = new Color(1f, 0.3f, 0f, 1f); ESPMenu.s_pickablesColor = new Color(0.13f, 0.58f, 0.89f, 1f); ESPMenu.s_dropsColor = new Color(0.13f, 0.72f, 0.11f, 1f); ESPMenu.s_depositsColor = Color.yellow; ESPMenu.s_cavesColor = Color.cyan; ESPMenu.s_trollsColor = Color.cyan; ESPMenu.s_mountainCaveColor = Color.cyan; ESPMenu.s_sunkenCryptColor = Color.cyan; ESPMenu.meadowsTabPageObject = new GameObject("Meadows"); ESPMenu.blackForestTabPageObject = new GameObject("Black Forest"); ESPMenu.oceanTabPageObject = new GameObject("Ocean"); ESPMenu.swampTabPageObject = new GameObject("Swamp"); ESPMenu.mountainTabPageObject = new GameObject("Mountain"); ESPMenu.plainsTabPageObject = new GameObject("Plains"); ESPMenu.mistlandsTabPageObject = new GameObject("Mistlands"); ESPMenu.ashlandsTabPageObject = new GameObject("Ashlands"); ESPMenu.deepNorthTabPageObject = new GameObject("Deep North"); ESPMenu.s_characters.Clear(); ESPMenu.s_pickables.Clear(); ESPMenu.s_pickableItems.Clear(); ESPMenu.s_drops.Clear(); ESPMenu.s_depositsDestructible.Clear(); ESPMenu.s_mineRock5s.Clear(); ESPMenu.s_caves.Clear(); ESPMenu.s_trolls.Clear(); ESPMenu.s_mountainCaves.Clear(); ESPMenu.s_sunkenCrypts.Clear(); ESPMenu.tabButtons = null; ESPMenu.s_showESP = false; ESPMenu.s_showPlayerESP = false; ESPMenu.s_showMonsterESP = false; ESPMenu.s_showDroppedESP = false; ESPMenu.s_showDepositESP = false; ESPMenu.s_showPickableESP = false; ESPMenu.s_showCaves = false; ESPMenu.s_showTrolls = false; ESPMenu.s_showMountains = false; ESPMenu.s_showSunken = false; ESPMenu.s_showBoar = false; ESPMenu.s_showNeck = false; ESPMenu.s_showGreyling = false; ESPMenu.s_showGreydwarf = false; ESPMenu.s_showGreydwarfBrute = false; ESPMenu.s_showGreydwarfShaman = false; ESPMenu.s_showTroll = false; ESPMenu.s_showSkeleton = false; ESPMenu.s_showRancidRemains = false; ESPMenu.s_showGhost = false; ESPMenu.s_showRoot = false; ESPMenu.s_showSerpent = false; ESPMenu.s_showAbomination = false; ESPMenu.s_showBlob = false; ESPMenu.s_showOozer = false; ESPMenu.s_showDraugr = false; ESPMenu.s_showDraugrElite = false; ESPMenu.s_showLeech = false; ESPMenu.s_showSurtling = false; ESPMenu.s_showWraith = false; ESPMenu.s_showWolf = false; ESPMenu.s_showDrake = false; ESPMenu.s_showFenring = false; ESPMenu.s_showStoneGolem = false; ESPMenu.s_showBat = false; ESPMenu.s_showUlv = false; ESPMenu.s_showCultist = false; ESPMenu.s_showDeathsquito = false; ESPMenu.s_showLox = false; ESPMenu.s_showFuling = false; ESPMenu.s_showFulingBerserker = false; ESPMenu.s_showFulingShaman = false; ESPMenu.s_showGrowth = false; ESPMenu.s_showSeeker = false; ESPMenu.s_showSeekerSoldier = false; ESPMenu.s_showSeekerBrood = false; ESPMenu.s_showGjall = false; ESPMenu.s_showTick = false; ESPMenu.s_showDvergrRogue = false; ESPMenu.s_showDvergrMage = false; ESPMenu.s_showDeer = false; ESPMenu.s_showFish = false; ESPMenu.s_showGull = false; ESPMenu.s_showLeviathan = false; ESPMenu.s_showHare = false; ESPMenu.s_showChicken = false; ESPMenu.s_showHen = false; EntitiesMenu.meadowsEntitiesObj = new GameObject("MeadowsEntities"); EntitiesMenu.blackForestEntitiesObj = new GameObject("BlackForestEntities"); EntitiesMenu.swampEntitiesObj = new GameObject("SwampEntities"); EntitiesMenu.mountainEntitiesObj = new GameObject("MountainEntities"); EntitiesMenu.plainsEntitiesObj = new GameObject("PlainsEntities"); EntitiesMenu.mistLandsEntitiesObj = new GameObject("MistLandsEntities"); EntitiesMenu.ashlandsEntitiesObj = new GameObject("AshlandsEntities"); EntitiesMenu.tabButtons = null; EntitiesMenu.customInputField = null; } public void OnDestroy() { ResetMod(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } } } } namespace ValheimAdminTool.Utils { public static class ResourceUtils { public static byte[] ReadAllBytes(this Stream input) { byte[] array = new byte[16384]; using MemoryStream memoryStream = new MemoryStream(); int count; while ((count = input.Read(array, 0, array.Length)) > 0) { memoryStream.Write(array, 0, count); } return memoryStream.ToArray(); } public static byte[] GetEmbeddedResource(string resourceFileName, Assembly containingAssembly = null) { if (containingAssembly == null) { containingAssembly = Assembly.GetCallingAssembly(); } string name = containingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(resourceFileName)); using Stream input = containingAssembly.GetManifestResourceStream(name); byte[] array = input.ReadAllBytes(); if (array.Length == 0) { Debug.LogWarning((object)string.Format("The resource %1 was not found", resourceFileName)); } return array; } public static Texture2D LoadTexture(byte[] texData) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); MethodInfo method = typeof(Texture2D).GetMethod("LoadImage", new Type[1] { typeof(byte[]) }); if (method != null) { method.Invoke(val, new object[1] { texData }); } else { Type? type = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule"); if (type == null) { throw new ArgumentNullException("converter"); } MethodInfo? method2 = type.GetMethod("LoadImage", new Type[2] { typeof(Texture2D), typeof(byte[]) }); if (method2 == null) { throw new ArgumentNullException("converterMethod"); } method2.Invoke(null, new object[2] { val, texData }); } return val; } } public static class Utilities { public static BindingFlags BindFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; public static T GetPrivateField<T>(this object obj, string fieldName) { return (T)obj.GetType().GetField(fieldName, BindFlags).GetValue(obj); } public static void SetPrivateField(this object obj, string fieldName, object value) { obj.GetType().GetField(fieldName, BindFlags).SetValue(obj, value); } public static void SetPrivateProperty(this object obj, string propertyName, object value) { obj.GetType().GetProperty(propertyName, BindFlags).SetValue(obj, value, null); } public static T GetPrivateProperty<T>(this object obj, string propertyName) { return (T)obj.GetType().GetProperty(propertyName, BindFlags).GetValue(obj); } public static void InvokePrivateMethod(this object obj, string methodName, object[] methodParams) { obj.GetType().GetMethod(methodName, BindFlags).Invoke(obj, methodParams); } } } namespace ValheimAdminTool.UI { public class InputManager : MonoBehaviour { private InputField activeInputField; private void Update() { if ((Object)(object)activeInputField != (Object)null) { if (Input.GetKeyDown((KeyCode)9)) { HandleTabKey(activeInputField, activeInputField.text); } else if (Input.GetKeyDown((KeyCode)8)) { HandleBackspaceKey(activeInputField, activeInputField.text); } } } public void SetActiveInputField(InputField inputField) { activeInputField = inputField; } private void HandleTabKey(InputField inputField, string value) { int num = value.IndexOf(' '); if (num != -1) { inputField.caretPosition = num; inputField.selectionAnchorPosition = num; inputField.selectionFocusPosition = num; } else { inputField.caretPosition = value.Length; inputField.selectionAnchorPosition = value.Length; inputField.selectionFocusPosition = value.Length; } } private void HandleBackspaceKey(InputField inputField, string value) { if (inputField.selectionAnchorPosition < inputField.selectionFocusPosition) { inputField.text = value.Substring(0, inputField.selectionAnchorPosition); inputField.caretPosition = inputField.selectionAnchorPosition; inputField.selectionFocusPosition = inputField.selectionAnchorPosition; } } } internal class InterfaceMaker { private static GUISkin s_customSkin; private static Texture2D s_winBackground; private static Texture2D s_winTitleBackground; private static Texture2D s_boxBackground; private static Texture2D s_toggleOffBackground; private static Texture2D s_toggleOnBackground; private static Texture2D s_buttonNormalBackground; private static Texture2D s_buttonHoverBackground; private static Texture2D s_buttonActiveBackground; private static Texture2D s_buttonActiveNormalBackground; private static Texture2D s_buttonActiveHoverBackground; private static Texture2D s_buttonActiveActiveBackground; private static Texture2D s_fieldBackground; private static Texture2D s_scrollBackground; private static Texture2D s_scrollThumbBackground; private static Texture2D s_flatButtonNormalBackground; private static Texture2D s_flatButtonHoverBackground; private static Texture2D s_flatButtonActiveBackground; private static Font s_font; private static GUISkin s_oldSkin; public static GUISkin CustomSkin { get { if ((Object)(object)s_customSkin == (Object)null) { try { s_customSkin = CreateSkin(); } catch (Exception ex) { ZLog.Log((object)("Could not load custom GUISkin - " + ex.Message)); s_customSkin = GUI.skin; } } return s_customSkin; } } public static GUISkin OldSkin => s_oldSkin; private static GUISkin CreateSkin() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Expected O, but got Unknown //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Expected O, but got Unknown //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d5: Expected O, but got Unknown //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Unknown result type (might be due to invalid IL or missing references) //IL_0500: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) //IL_057e: Unknown result type (might be due to invalid IL or missing references) //IL_05a8: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05c6: Expected O, but got Unknown //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_060b: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Expected O, but got Unknown //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Expected O, but got Unknown //IL_064b: Unknown result type (might be due to invalid IL or missing references) //IL_0655: Expected O, but got Unknown //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0664: 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) //IL_0672: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Expected O, but got Unknown s_oldSkin = GUI.skin; GUISkin val = Object.Instantiate<GUISkin>(GUI.skin); Object.DontDestroyOnLoad((Object)(object)val); LoadTextures(); val.font = s_font; val.label.normal.textColor = Color.gray; val.box.onNormal.background = null; val.box.normal.background = s_boxBackground; val.box.normal.textColor = Color.gray; val.window.border = new RectOffset(80, 80, 80, 20); RectOffset padding = val.window.padding; padding.top += 5; val.window.onNormal.background = null; val.window.normal.background = s_winTitleBackground; val.window.normal.textColor = Color.white; val.button.normal.textColor = Color.gray; val.button.normal.background = s_buttonNormalBackground; val.button.hover.textColor = Color.gray; val.button.hover.background = s_buttonHoverBackground; val.button.active.textColor = Color.gray; val.button.active.background = s_buttonActiveBackground; val.button.onNormal.textColor = Color.white; val.button.onNormal.background = s_buttonActiveNormalBackground; val.button.onHover.textColor = Color.white; val.button.onHover.background = s_buttonActiveHoverBackground; val.button.onActive.textColor = Color.white; val.button.onActive.background = s_buttonActiveActiveBackground; val.button.font = s_font; val.button.wordWrap = false; val.horizontalSliderThumb.normal.background = s_buttonNormalBackground; val.horizontalSliderThumb.hover.background = s_buttonHoverBackground; val.horizontalSliderThumb.active.background = s_buttonActiveBackground; val.horizontalSliderThumb.onNormal.background = s_buttonActiveNormalBackground; val.horizontalSliderThumb.onHover.background = s_buttonActiveHoverBackground; val.horizontalSliderThumb.onActive.background = s_buttonActiveActiveBackground; val.horizontalSlider.normal.background = s_scrollBackground; val.toggle.normal.textColor = Color.gray; val.toggle.normal.background = s_toggleOffBackground; val.toggle.onNormal.textColor = Color.gray; val.toggle.onNormal.background = s_toggleOnBackground; val.toggle.hover.textColor = Color.gray; val.toggle.hover.background = s_toggleOffBackground; val.toggle.onHover.textColor = Color.gray; val.toggle.onHover.background = s_toggleOnBackground; val.toggle.active.textColor = Color.gray; val.toggle.active.background = s_toggleOnBackground; val.toggle.onActive.textColor = Color.gray; val.toggle.onActive.background = s_toggleOffBackground; val.toggle.border = new RectOffset(0, 0, 0, 0); val.toggle.overflow = new RectOffset(0, 0, 0, 0); val.toggle.imagePosition = (ImagePosition)2; val.toggle.padding = new RectOffset(0, 0, 0, 0); val.toggle.fixedWidth = 30f; val.toggle.fixedHeight = 30f; RectOffset padding2 = val.button.padding; int top = (val.button.padding.bottom = 6); padding2.top = top; RectOffset border = val.button.border; top = (val.button.border.top = 0); border.bottom = top; RectOffset border2 = val.button.border; top = (val.button.border.right = 10); border2.left = top; val.textField.normal.background = s_fieldBackground; val.textField.normal.textColor = Color.gray; val.textField.onNormal.background = s_fieldBackground; val.textField.onNormal.textColor = Color.gray; val.textField.hover.background = s_fieldBackground; val.textField.hover.textColor = Color.gray; val.textField.onHover.background = s_fieldBackground; val.textField.onHover.textColor = Color.gray; val.textField.active.background = s_fieldBackground; val.textField.active.textColor = Color.gray; val.textField.onActive.background = s_fieldBackground; val.textField.onActive.textColor = Color.gray; val.textField.focused.background = s_fieldBackground; val.textField.focused.textColor = Color.gray; val.textField.onFocused.background = s_fieldBackground; val.textField.onFocused.textColor = Color.gray; val.textField.padding = new RectOffset(8, 8, 5, 5); val.settings.cursorColor = Color.gray; val.verticalScrollbar.normal.background = s_scrollBackground; val.verticalScrollbarThumb.normal.background = s_scrollThumbBackground; GUIStyle val2 = new GUIStyle(val.box) { border = new RectOffset(), name = "popup" }; GUIStyleState normal = val2.normal; Texture2D background = (val2.hover.background = s_winBackground); normal.background = background; val2.border = new RectOffset(30, 30, 30, 30); GUIStyle val4 = new GUIStyle(OldSkin.label) { wordWrap = false, alignment = (TextAnchor)4, name = "flatButton" }; val4.normal.background = s_flatButtonNormalBackground; val4.hover.background = s_flatButtonHoverBackground; val4.onNormal.background = s_flatButtonActiveBackground; val.customStyles = (GUIStyle[])(object)new GUIStyle[2] { val2, val4 }; return val; } private static void LoadTextures() { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Expected O, but got Unknown //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) s_winBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.window.png")); Object.DontDestroyOnLoad((Object)(object)s_winBackground); s_winTitleBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.window_title.png")); Object.DontDestroyOnLoad((Object)(object)s_winTitleBackground); s_boxBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.box.png")); Object.DontDestroyOnLoad((Object)(object)s_boxBackground); s_toggleOffBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.toggle_off.png")); Object.DontDestroyOnLoad((Object)(object)s_toggleOffBackground); s_toggleOnBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.toggle_on.png")); Object.DontDestroyOnLoad((Object)(object)s_toggleOnBackground); s_buttonNormalBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_normal.png")); Object.DontDestroyOnLoad((Object)(object)s_buttonNormalBackground); s_buttonHoverBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_hover.png")); Object.DontDestroyOnLoad((Object)(object)s_buttonHoverBackground); s_buttonActiveBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active.png")); Object.DontDestroyOnLoad((Object)(object)s_buttonActiveBackground); s_buttonActiveNormalBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active_normal.png")); Object.DontDestroyOnLoad((Object)(object)s_buttonActiveNormalBackground); s_buttonActiveHoverBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active_hover.png")); Object.DontDestroyOnLoad((Object)(object)s_buttonActiveHoverBackground); s_buttonActiveActiveBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active_active.png")); Object.DontDestroyOnLoad((Object)(object)s_buttonActiveActiveBackground); s_fieldBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.field.png")); Object.DontDestroyOnLoad((Object)(object)s_fieldBackground); s_scrollBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.scroll_background.png")); Object.DontDestroyOnLoad((Object)(object)s_scrollBackground); s_scrollThumbBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.scroll_thumb.png")); Object.DontDestroyOnLoad((Object)(object)s_scrollThumbBackground); s_flatButtonNormalBackground = new Texture2D(1, 1); s_flatButtonNormalBackground.SetPixels((Color[])(object)new Color[1] { new Color(0.5f, 0.5f, 0.5f, 0.5f) }); s_flatButtonNormalBackground.Apply(); Object.DontDestroyOnLoad((Object)(object)s_flatButtonNormalBackground); s_flatButtonHoverBackground = new Texture2D(1, 1); s_flatButtonHoverBackground.SetPixels((Color[])(object)new Color[1] { new Color(0.5f, 0.5f, 0.5f, 0.2f) }); s_flatButtonHoverBackground.Apply(); Object.DontDestroyOnLoad((Object)(object)s_flatButtonHoverBackground); s_flatButtonActiveBackground = new Texture2D(1, 1); s_flatButtonActiveBackground.SetPixels((Color[])(object)new Color[1] { new Color(0.9f, 0.5f, 0.1f, 0.5f) }); s_flatButtonActiveBackground.Apply(); Object.DontDestroyOnLoad((Object)(object)s_flatButtonActiveBackground); s_font = (Resources.FindObjectsOfTypeAll(typeof(Font)) as Font[]).ToList().First((Font f) => ((Object)f).name.Equals("Norsebold")); if ((Object)(object)s_font != (Object)null) { Object.DontDestroyOnLoad((Object)(object)s_font); } else { ZLog.Log((object)"Error while loading font!"); } } } } namespace ValheimAdminTool.Patches { [HarmonyPatch(typeof(Character), "ApplyDamage")] internal class ApplyCharacterDamage_Patch { private static void Prefix(Character __instance, ref HitData hit, ref bool showDamageText, bool triggerEffects, DamageModifier mod) { if (CheatsMenu.sGodMode && __instance.IsPlayer()) { hit.m_damage.m_damage = 0f; showDamageText = false; } } } [HarmonyPatch(typeof(EnvMan), "SetTargetWind")] internal class PatchTargetWind { private static void Prefix(ref Vector3 dir, ref float intensity) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //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_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Invalid comparison between Unknown and I4 if (ToolsMenu.enableWindInBack) { Ship localShip = Ship.GetLocalShip(); if (!Object.op_Implicit((Object)(object)localShip)) { return; } Speed speedSetting = localShip.GetSpeedSetting(); if ((int)speedSetting == 3 || (int)speedSetting == 4) { Vector3 forward = ((Component)localShip).transform.forward; dir.x = forward.x; dir.z = forward.z; } } if (!ToolsMenu.enableShipSpeedHack) { return; } Ship localShip2 = Ship.GetLocalShip(); if (Object.op_Implicit((Object)(object)localShip2)) { Speed speedSetting2 = localShip2.GetSpeedSetting(); if ((int)speedSetting2 == 2) { localShip2.m_sailForceFactor = 0.05f; } else if ((int)speedSetting2 == 3) { localShip2.m_sailForceFactor = 0.125f; } else if ((int)speedSetting2 == 4) { localShip2.m_sailForceFactor = 0.25f; } } } } [HarmonyPatch(typeof(Humanoid), "UpdateEquipment")] internal class DrainEquipedItemDurability_Patch { private static bool Prefix(float dt) { if (ToolsMenu.disableDurabilityLoss) { if (((Character)Player.m_localPlayer).IsSwimming() && !((Character)Player.m_localPlayer).IsOnGround()) { ((Humanoid)Player.m_localPlayer).HideHandItems(false, true); } return false; } return true; } } [HarmonyPatch(typeof(Humanoid), "BlockAttack")] internal class BlockAttack_Patch { private static void Prefix(Humanoid __instance, ref float __state, ItemData ___m_leftItem) { if (ToolsMenu.disableDurabilityLoss && ((Character)__instance).IsPlayer() && ___m_leftItem != null) { __state = ___m_leftItem.m_durability; } } private static void Postfix(Humanoid __instance, float __state, ref ItemData ___m_leftItem) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 if (ToolsMenu.disableDurabilityLoss && ((Character)__instance).IsPlayer() && __state > 0f && ___m_leftItem != null && __state > ___m_leftItem.m_durability && (int)___m_leftItem.m_shared.m_itemType == 5) { ___m_leftItem.m_durability = Mathf.Max(0f, __state - (__state - ___m_leftItem.m_durability) * 0f); } } } [HarmonyPatch(typeof(InventoryGui), "Show")] internal class Update_Patch { private static bool Prefix(InventoryGui __instance) { if (ModMenu.displayMainMenu && ModMenu.isInitialized) { InputField customInputField = ItemsMenu.customInputField; if ((Object)(object)EventSystem.current.currentSelectedGameObject == (Object)(object)((Component)customInputField).gameObject) { int num = customInputField.text.IndexOf(' '); if (num != -1) { customInputField.caretPosition = num; customInputField.selectionAnchorPosition = num; customInputField.selectionFocusPosition = customInputField.text.Length; } else { customInputField.caretPosition = customInputField.text.Length; customInputField.selectionAnchorPosition = customInputField.text.Length; customInputField.selectionFocusPosition = customInputField.text.Length; } } return false; } return true; } } [HarmonyPatch(typeof(ItemDrop), "Awake")] internal class ItemDrop_Patch { private static void Postfix(ItemDrop __instance) { //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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Invalid comparison between Unknown and I4 //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Invalid comparison between Unknown and I4 //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Invalid comparison between Unknown and I4 if (!ToolsMenu.disableDurabilityLoss) { return; } if (((Object)__instance).name.StartsWith("Pickaxe")) { __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; return; } if (((Object)__instance).name.StartsWith("Axe")) { __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; return; } ItemType itemType = __instance.m_itemData.m_shared.m_itemType; if ((int)itemType <= 4) { if ((int)itemType != 3) { if ((int)itemType == 4) { __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; } return; } } else if ((int)itemType != 14) { if ((int)itemType != 15) { if ((int)itemType == 19) { if (((Object)__instance).name.StartsWith("Hammer")) { __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; } else if (((Object)__instance).name.StartsWith("Hoe")) { __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; } else { __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; } } } else { __instance.m_itemData.m_shared.m_durabilityDrain = 0f; __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; } return; } __instance.m_itemData.m_shared.m_useDurabilityDrain = 0f; } } [HarmonyPatch(typeof(Location), "IsInsideNoBuildLocation")] internal class PatchIsInsideNoBuildLocation { private static void Postfix(ref bool __result) { if (CheatsMenu.sBuildEverywhere) { __result = false; } } } internal class MapPatches { [HarmonyPatch(typeof(Minimap), "Update")] private class Minimap_Update_Patch { private static bool Prefix(ref Minimap __instance) { if (ZInputPatches.IsInputFieldFocused()) { return false; } return true; } } [HarmonyPatch(typeof(Minimap), "SetMapMode")] private class Minimap_SetMapMode_Patch { private static bool Prefix(ref Minimap __instance, ref MapMode mode) { if (ZInputPatches.IsInputFieldFocused()) { return false; } return true; } } } [HarmonyPatch(typeof(Player), "UpdateFood")] internal class FoodDegrade_Patch { private static bool Prefix(ref Player __instance, float dt, bool forceUpdate) { Player localPlayer = Player.m_localPlayer; localPlayer.m_foodUpdateTimer += dt; if (Player.m_localPlayer.m_foodUpdateTimer >= 1f || forceUpdate) { Player localPlayer2 = Player.m_localPlayer; localPlayer2.m_foodUpdateTimer -= 1f; foreach (Food food in Player.m_localPlayer.GetFoods()) { if (!ToolsMenu.noFoodTimeout) { food.m_time -= 0.5f; } float num = Mathf.Clamp01(food.m_time / food.m_item.m_shared.m_foodBurnTime); num = Mathf.Pow(num, 0.3f); if (ToolsMenu.noFoodDegrade) { food.m_health = food.m_item.m_shared.m_food; food.m_stamina = food.m_item.m_shared.m_foodStamina; food.m_eitr = food.m_item.m_shared.m_foodEitr; } else { food.m_health = food.m_item.m_shared.m_food * num; food.m_stamina = food.m_item.m_shared.m_foodStamina * num; food.m_eitr = food.m_item.m_shared.m_foodEitr * num; } if (food.m_time <= 0f) { ((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_food_done", 0, (Sprite)null); Player.m_localPlayer.m_foods.Remove(food); break; } } float num2 = default(float); float num3 = default(float); float num4 = default(float); Player.m_localPlayer.GetTotalFoodValue(ref num2, ref num3, ref num4); Player.m_localPlayer.SetMaxHealth(num2, true); Player.m_localPlayer.SetMaxStamina(num3, true); if (num4 > 0f) { __instance.ShowTutorial("eitr", false); } } if (forceUpdate) { return true; } Player localPlayer3 = Player.m_localPlayer; localPlayer3.m_foodRegenTimer += dt; if (!(Player.m_localPlayer.m_foo