Please disclose if your mod was created primarily using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Gungnir v1.7.6
Gungnir.dll
Decompiled 5 months 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.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using Gungnir.Patch; using HarmonyLib; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Gungnir")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Gungnir")] [assembly: AssemblyCopyright("Copyright © zamboni 2022")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d85db6e6-c4ed-4d3d-9590-0a40b8ce5774")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace Gungnir { internal class CustomConsole : MonoBehaviour { private const BindingFlags s_bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private const string s_argPattern = "((?:<[^>]+>)|(?:\\[[^\\]]+\\]))"; private const int s_maxHistory = 1000; private const int s_fontSize = 16; private const int s_historyEntryMargin = 10; private static Color s_backgroundColor = Color32.op_Implicit(new Color32((byte)42, (byte)47, (byte)58, (byte)165)); private GUIStyle m_consoleStyle = new GUIStyle(); private Font m_font = Font.CreateDynamicFontFromOSFont("Consolas", 16); private List<string> m_history = new List<string>(); private Vector2 m_scrollPosition = new Vector2(0f, 2.1474836E+09f); private string m_currentText = string.Empty; private int m_caretPos; private float m_hintAlpha; private float m_hintAlphaVel; private Rect m_windowRect; private Image m_background; private CommandMeta m_currentCommand; private string m_currentHint = string.Empty; private bool m_foundConsoleInstance; private bool m_foundChatInstance; private CommandHandler m_handler; public CommandHandler Handler { get { return m_handler; } set { m_handler = value; } } public int MaxHistory => 1000; public float Height => ((Rect)(ref m_windowRect)).height; public float LineHeight => m_consoleStyle.CalcHeight(GUIContent.none, ((Rect)(ref m_windowRect)).width); public int VisibleLines => (int)((((Rect)(ref m_windowRect)).height - LineHeight) / (LineHeight + 10f)); public void ClearScreen() { m_history.Clear(); ((TMP_Text)((Terminal)Console.instance).m_output).text = string.Empty; ((MonoBehaviour)this).StartCoroutine(clear()); IEnumerator clear() { yield return null; m_history.Clear(); ((TMP_Text)((Terminal)Console.instance).m_output).text = string.Empty; } } private List<string> GetConsoleBuffer() { return typeof(Console).GetField("m_chatBuffer", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(Console.instance) as List<string>; } private void SetConsoleBuffer(List<string> buffer) { typeof(Console).GetField("m_chatBuffer", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).SetValue(Console.instance, buffer); } public void Print(string text) { ((MonoBehaviour)this).StartCoroutine(print(text)); IEnumerator print(string value) { yield return null; m_history.Add(value); } } private void Start() { Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject); CreateStyle(); } private void CreateStyle() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) string[] pathsToOSFonts = Font.GetPathsToOSFonts(); string text = "Consolas"; string[] array = pathsToOSFonts; foreach (string text2 in array) { if (text2.IndexOf("consola.ttf", StringComparison.OrdinalIgnoreCase) != -1) { text = text2; break; } } m_consoleStyle.wordWrap = true; m_consoleStyle.fontSize = 16; m_consoleStyle.font = m_font; m_consoleStyle.normal.textColor = Color.white; m_consoleStyle.richText = true; m_consoleStyle.alignment = (TextAnchor)0; if (Object.op_Implicit((Object)(object)Console.instance)) { Canvas component = ((Component)Console.instance).gameObject.GetComponent<Canvas>(); if (Object.op_Implicit((Object)(object)component)) { component.pixelPerfect = true; component.planeDistance = 0f; component.renderMode = (RenderMode)0; } Image componentInChildren = ((Component)Console.instance).gameObject.GetComponentInChildren<Image>(true); if (Object.op_Implicit((Object)(object)componentInChildren)) { m_background = componentInChildren; ((Graphic)componentInChildren).color = s_backgroundColor; } TMP_FontAsset font = TMP_FontAsset.CreateFontAsset(new Font(text)); ((TMP_Text)((Terminal)Console.instance).m_output).font = font; ((TMP_InputField)((Terminal)Console.instance).m_input).textComponent.font = font; ((TMP_Text)((Terminal)Console.instance).m_output).fontSize = m_font.fontSize; ((Graphic)((Terminal)Console.instance).m_output).color = Color.white; ((TMP_InputField)((Terminal)Console.instance).m_input).textComponent.fontSize = m_font.fontSize; ((TMP_InputField)((Terminal)Console.instance).m_input).caretColor = Color.white; ((TMP_InputField)((Terminal)Console.instance).m_input).customCaretColor = true; ((Component)((Terminal)Console.instance).m_output).gameObject.SetActive(false); ((TMP_Text)((Terminal)Console.instance).m_output).text = string.Empty; } m_history.Clear(); } private void SetInputText(string text) { m_currentText = text; if (Object.op_Implicit((Object)(object)Console.instance)) { ((TMP_InputField)((Terminal)Console.instance).m_input).text = text; ((TMP_InputField)((Terminal)Console.instance).m_input).caretPosition = m_currentText.Length; } } private void OnConsoleDetected() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) Rect rect = ((TMP_Text)((Terminal)Console.instance).m_output).rectTransform.rect; float num = ((Rect)(ref rect)).width - 10f; rect = ((TMP_Text)((Terminal)Console.instance).m_output).rectTransform.rect; m_windowRect = new Rect(10f, 1f, num, ((Rect)(ref rect)).height); CreateStyle(); ((UnityEvent<string>)(object)((TMP_InputField)((Terminal)Console.instance).m_input).onValueChanged).RemoveListener((UnityAction<string>)OnInputChanged); ((UnityEvent<string>)(object)((TMP_InputField)((Terminal)Console.instance).m_input).onValueChanged).AddListener((UnityAction<string>)OnInputChanged); } private void OnInputChanged(string text) { m_currentText = text; string[] array = text.Split(); if (array.Length != 0) { string text2 = array[0]; if (text2.StartsWith("/")) { m_currentCommand = Handler.GetCommand(text2); } } } private void UpdateCommandHint() { //IL_0043: 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_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) if (m_currentCommand == null || string.IsNullOrEmpty(m_currentText)) { return; } if (string.IsNullOrEmpty(m_currentCommand.hint)) { m_currentHint = ("/" + m_currentCommand.data.keyword).WithColor(Logger.WarningColor) + "\n" + m_currentCommand.data.description; return; } List<string> list = Util.SplitByPattern(m_currentCommand.hint, "((?:<[^>]+>)|(?:\\[[^\\]]+\\]))"); Match[] array = Regex.Matches(m_currentText, Util.CommandPattern).OfType<Match>().Skip(1) .ToArray(); int num = 0; string text = ""; for (int i = 0; i < array.Length; i++) { Group group = array[i].Groups[0]; int num2 = group.Index + group.Length; if (m_caretPos <= num2 && i < list.Count) { num = i; break; } if (m_caretPos > num2 && i + 1 < list.Count) { num = i + 1; } else if (i >= list.Count) { num = list.Count - 1; break; } } for (int j = 0; j < list.Count; j++) { string text2 = list[j]; text = ((j != num) ? (text + text2.WithColor(new Color(0.8f, 0.8f, 0.8f)) + " ") : (text + "<b>" + text2.WithColor(Logger.GoodColor) + "</b> ")); } m_currentHint = ("/" + m_currentCommand.data.keyword).WithColor(Logger.WarningColor) + " " + text.Trim() + "\n" + m_currentCommand.data.description; } private void Update() { //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) if (!m_foundConsoleInstance && Object.op_Implicit((Object)(object)Console.instance)) { m_foundConsoleInstance = true; OnConsoleDetected(); } else if (!Object.op_Implicit((Object)(object)Console.instance)) { m_foundConsoleInstance = false; return; } if (!m_foundChatInstance && Object.op_Implicit((Object)(object)Chat.instance)) { m_foundChatInstance = true; OnConsoleDetected(); } else if (!Object.op_Implicit((Object)(object)Chat.instance)) { m_foundChatInstance = false; } if (m_caretPos != ((TMP_InputField)((Terminal)Console.instance).m_input).caretPosition) { m_caretPos = ((TMP_InputField)((Terminal)Console.instance).m_input).caretPosition; UpdateCommandHint(); } List<string> consoleBuffer = GetConsoleBuffer(); if (consoleBuffer.Count > 0) { m_history.AddRange(consoleBuffer); consoleBuffer.Clear(); if (m_history.Count > 1000) { m_history.RemoveRange(0, Math.Abs(1000 - m_history.Count)); } ((TMP_Text)((Terminal)Console.instance).m_output).text = string.Empty; m_scrollPosition = new Vector2(0f, 2.1474836E+09f); } } private void OnGUI() { //IL_0010: 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_0036: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00d8: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: 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) if (Console.IsVisible()) { GUILayout.Window(5001, m_windowRect, new WindowFunction(DrawConsole), "Gungnir 1.7.5", m_consoleStyle, Array.Empty<GUILayoutOption>()); float hintAlpha = m_hintAlpha; if (m_currentCommand == null || string.IsNullOrEmpty(m_currentText)) { m_hintAlpha = Mathf.SmoothDamp(m_hintAlpha, 0f, ref m_hintAlphaVel, 0.2f); } else { m_hintAlpha = Mathf.SmoothDamp(m_hintAlpha, 1f, ref m_hintAlphaVel, 0.2f); } if (!Mathf.Approximately(m_hintAlpha, 0f)) { GUIContent val = ((m_hintAlpha == hintAlpha) ? new GUIContent(m_currentHint) : new GUIContent(Util.MultiplyColorTagAlpha(m_currentHint, m_hintAlpha))); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, m_hintAlpha); Vector2 val2 = m_consoleStyle.CalcSize(val); float num = m_consoleStyle.CalcHeight(val, val2.x); Vector3[] array = (Vector3[])(object)new Vector3[4]; ((Graphic)m_background).rectTransform.GetWorldCorners(array); Rect val3 = default(Rect); ((Rect)(ref val3))..ctor(array[1].x, (float)Screen.height - array[1].y, array[2].x - array[1].x, array[1].y - array[0].y); float num2 = ((Rect)(ref val3)).yMax + 30f; GUITools.DrawRect(new Rect(((Rect)(ref m_windowRect)).x - 10f, num2, val2.x + 20f, num + 20f), s_backgroundColor); GUI.Label(new Rect(((Rect)(ref m_windowRect)).x, num2 + 10f, ((Rect)(ref m_windowRect)).width, LineHeight * 2f), val, m_consoleStyle); GUI.color = color; } } else { m_hintAlpha = 0f; } } private void DrawConsole(int windowID) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (!Cursor.visible) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; } GUILayout.Space(16f); GUILayout.FlexibleSpace(); GUILayout.BeginVertical(Array.Empty<GUILayoutOption>()); m_scrollPosition = GUILayout.BeginScrollView(m_scrollPosition, Array.Empty<GUILayoutOption>()); foreach (string item in m_history) { GUILayout.Label(item, m_consoleStyle, Array.Empty<GUILayoutOption>()); GUILayout.Space(10f); } GUILayout.EndScrollView(); GUILayout.EndVertical(); } } public static class GUITools { private static readonly Texture2D backgroundTexture = Texture2D.whiteTexture; private static readonly GUIStyle textureStyle = new GUIStyle { normal = new GUIStyleState { background = backgroundTexture } }; public static void DrawRect(Rect position, Color color, GUIContent content = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = color; GUI.Box(position, content ?? GUIContent.none, textureStyle); GUI.backgroundColor = backgroundColor; } public static void DrawCorners(Rect rect, float size, Color color, GUIContent content = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = color; GUI.Box(new Rect(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin, size, size), content ?? GUIContent.none, textureStyle); GUI.Box(new Rect(((Rect)(ref rect)).xMax - size, ((Rect)(ref rect)).yMin, size, size), content ?? GUIContent.none, textureStyle); GUI.Box(new Rect(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMax - size, size, size), content ?? GUIContent.none, textureStyle); GUI.Box(new Rect(((Rect)(ref rect)).xMax - size, ((Rect)(ref rect)).yMax - size, size, size), content ?? GUIContent.none, textureStyle); GUI.backgroundColor = backgroundColor; } public static void DrawCornersID(Rect rect, float size, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = color; GUI.Box(new Rect(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMin, size, size), "1", textureStyle); GUI.Box(new Rect(((Rect)(ref rect)).xMax - size, ((Rect)(ref rect)).yMin, size, size), "2", textureStyle); GUI.Box(new Rect(((Rect)(ref rect)).xMin, ((Rect)(ref rect)).yMax - size, size, size), "3", textureStyle); GUI.Box(new Rect(((Rect)(ref rect)).xMax - size, ((Rect)(ref rect)).yMax - size, size, size), "4", textureStyle); GUI.backgroundColor = backgroundColor; } public static void LayoutBox(Color color, GUIContent content = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = color; GUILayout.Box(content ?? GUIContent.none, textureStyle, Array.Empty<GUILayoutOption>()); GUI.backgroundColor = backgroundColor; } } internal static class Logger { internal class LogStream { private StringBuilder builder = new StringBuilder(); private readonly int lineNumber; private readonly string filePath = ""; private readonly string methodName = ""; private readonly LogType type = (LogType)3; private bool m_space = true; private bool m_quote; [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream space() { m_space = true; builder.Append(' '); return this; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream maybeSpace() { if (m_space) { builder.Append(' '); } return this; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream noSpace() { m_space = false; return this; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream quote() { m_quote = true; builder.Append('"'); return this; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream maybeQuote(char c = '"') { if (m_quote) { builder.Append(c); } return this; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream noQuote() { m_quote = false; return this; } public bool autoInsertSpaces() { return m_space; } public void setAutoInsertSpaces(bool enabled) { m_space = enabled; } public LogStream(LogType type, int lineNumber, string filePath, string methodName) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) this.type = type; this.lineNumber = lineNumber; this.filePath = filePath; this.methodName = methodName; } [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream write(object input, Color? color = null) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) builder.Append(color.HasValue ? input.ToString().WithColor(color.Value) : input); return maybeSpace(); } [MethodImpl(MethodImplOptions.AggressiveInlining)] public LogStream param(object input) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) builder.Append(input.ToString().WithColor(GetLogSubColor(type))); return maybeSpace(); } public void commit() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (builder.Length > 0) { Print(builder.ToString().TrimEnd(Array.Empty<char>()), type, logToConsole: true, lineNumber, filePath, methodName); } } } public static Color ErrorColor = new Color(0.96862745f, 42f / 85f, 0.5372549f); public static Color WarningColor = new Color(0.922f, 0.796f, 0.545f); public static Color GoodColor = new Color(35f / 51f, 0.8f, 0.5882353f); private static Color GetLogColor(LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((int)type != 0) { if ((int)type == 2) { return WarningColor; } return Color.white; } return ErrorColor; } private static Color GetLogSubColor(LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((int)type != 0) { if ((int)type == 2) { return Color.white; } return GoodColor; } return Color.white; } private static void Print(string message, LogType type = 3, bool logToConsole = false, int lineNumber = 0, string filePath = "", string methodName = "") { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (logToConsole && (Object)(object)Console.instance != (Object)null) { string text = "87E3FF"; string text2 = ColorUtility.ToHtmlStringRGBA(GetLogColor(type)); Console.instance.Print("<color=#" + text + ">[Gungnir]</color> <color=#" + text2 + ">" + message + "</color>"); } message = Util.StripTags(message); Debug.unityLogger.Log(type, (object)$"[Gungnir:{Path.GetFileName(filePath)}:{lineNumber}] {message}"); } public static LogStream Log(string message = "", bool logToConsole = true, [CallerLineNumber] int lineNumber = 0, [CallerFilePath] string filePath = "", [CallerMemberName] string methodName = "") { if (!string.IsNullOrEmpty(message)) { Print(message, (LogType)3, logToConsole, lineNumber, filePath, methodName); } return new LogStream((LogType)3, lineNumber, filePath, methodName); } public static LogStream Error(string message = "", bool logToConsole = true, [CallerLineNumber] int lineNumber = 0, [CallerFilePath] string filePath = "", [CallerMemberName] string methodName = "") { if (!string.IsNullOrEmpty(message)) { Print(message, (LogType)0, logToConsole, lineNumber, filePath, methodName); } return new LogStream((LogType)0, lineNumber, filePath, methodName); } public static LogStream Warning(string message = "", bool logToConsole = true, [CallerLineNumber] int lineNumber = 0, [CallerFilePath] string filePath = "", [CallerMemberName] string methodName = "") { if (!string.IsNullOrEmpty(message)) { Print(message, (LogType)2, logToConsole, lineNumber, filePath, methodName); } return new LogStream((LogType)2, lineNumber, filePath, methodName); } } [AttributeUsage(AttributeTargets.Method)] internal class Command : Attribute { public readonly string keyword; public readonly string description; public readonly string autoCompleteTarget; public Command(string keyword, string description, string autoComplete = null) { this.keyword = keyword; this.description = description; autoCompleteTarget = autoComplete; } } internal class CommandMeta { public delegate List<string> AutoCompleteDelegate(); public readonly Command data; public readonly MethodBase method; public readonly List<ParameterInfo> arguments; public readonly string hint; public readonly int requiredArguments; public readonly AutoCompleteDelegate AutoComplete; public CommandMeta(Command data, MethodBase method, List<ParameterInfo> arguments, AutoCompleteDelegate autoCompleteDelegate = null) { this.data = data; this.method = method; this.arguments = arguments; AutoComplete = autoCompleteDelegate; if (arguments.Count > 0) { StringBuilder stringBuilder = new StringBuilder(); foreach (ParameterInfo argument in arguments) { bool hasDefaultValue = argument.HasDefaultValue; requiredArguments += ((!hasDefaultValue) ? 1 : 0); if (!hasDefaultValue) { stringBuilder.Append("<" + Util.GetSimpleTypeName(argument.ParameterType) + " " + argument.Name + "> "); } else { string text = ((argument.DefaultValue == null) ? "none" : argument.DefaultValue.ToString()); stringBuilder.Append("[" + Util.GetSimpleTypeName(argument.ParameterType) + " " + argument.Name + "=" + text + "] "); } } stringBuilder.Remove(stringBuilder.Length - 1, 1); hint = stringBuilder.ToString(); } else { requiredArguments = 0; } } } internal class CommandHandler { private Dictionary<string, CommandMeta> m_actions = new Dictionary<string, CommandMeta>(); private Dictionary<string, string> m_aliases = new Dictionary<string, string>(); private CustomConsole m_console; private Gungnir m_plugin; private const BindingFlags s_bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; internal CustomConsole Console { get { return m_console; } set { m_console = value; } } internal Gungnir Plugin { get { return m_plugin; } set { m_plugin = value; } } public Dictionary<string, string> Aliases { get { return m_aliases; } set { m_aliases = value; } } private static List<string> GetPrefabNames() { ZNetScene instance = ZNetScene.instance; if (instance == null) { return null; } return instance.GetPrefabNames(); } [Command("alias", "Create a shortcut or alternate name for a command, or sequence of commands.", null)] public void Alias(string name, params string[] commandText) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) if (name.Contains(" ")) { Logger.Error("An alias cannot contain spaces.", logToConsole: true, 135, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Alias"); return; } if (m_actions.ContainsKey(name)) { Logger.Error(name.WithColor(Color.white) + " is a Gungnir command and cannot be overwritten.", logToConsole: true, 141, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Alias"); return; } if (Util.GetPrivateStaticField<Dictionary<string, ConsoleCommand>>(typeof(Terminal), "commands").ContainsKey(name)) { Logger.Error(name.WithColor(Color.white) + " is a built-in Valheim command and cannot be overwritten.", logToConsole: true, 146, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Alias"); return; } if (m_aliases.ContainsKey(name)) { m_aliases.Remove(name); } string text = string.Join(" ", commandText); m_aliases.Add(name, text); Plugin.SaveAliases(); Logger.Log("Alias " + name.WithColor(Logger.WarningColor) + " created for " + text.WithColor(Logger.WarningColor), logToConsole: true, 157, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Alias"); } [Command("bind", "Bind a console command to a key. See the Unity documentation for KeyCode names.", null)] public void Bind(string keyCode, params string[] commandText) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!Enum.TryParse<KeyCode>(keyCode, ignoreCase: true, out KeyCode result)) { Logger.Error("Couldn't find a key code named " + keyCode.WithColor(Color.white) + ".", logToConsole: true, 165, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Bind"); return; } if (Plugin.Binds.ContainsKey(result)) { Plugin.Binds.Remove(result); } string text = string.Join(" ", commandText); Plugin.Binds.Add(result, text); Plugin.SaveBinds(); Logger.Log("Bound " + ((object)(KeyCode)(ref result)).ToString().WithColor(Logger.GoodColor) + " to " + text.WithColor(Logger.WarningColor) + ".", logToConsole: true, 177, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Bind"); } [Command("butcher", "Kills all living creatures within a radius (meters), excluding players.", null)] public void KillAll(float radius = 50f, bool killTamed = false) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 185, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "KillAll"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 191, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "KillAll"); return; } List<Character> list = new List<Character>(); Character.GetCharactersInRange(((Component)Player.m_localPlayer).transform.position, radius, list); int num = 0; foreach (Character item in list) { if (!item.IsPlayer() && (!item.IsTamed() || killTamed)) { HitData val = new HitData(); val.m_damage.m_damage = float.PositiveInfinity; item.Damage(val); num++; } } Logger.Log("Murdered " + num.ToString().WithColor(Logger.GoodColor) + " creature(s) within " + radius.ToString().WithColor(Logger.GoodColor) + " meters.", logToConsole: true, 210, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "KillAll"); } [Command("clear", "Clears the console's output.", null)] public void ClearConsole() { Console?.ClearScreen(); } [Command("creative", "Toggles creative mode, which removes the need for resources.", null)] public void ToggleNoCost(bool? enabled = null) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) enabled = enabled ?? (!Player.m_localPlayer.GetPrivateField<bool>("m_noPlacementCost")); Player.m_localPlayer.SetPrivateField("m_noPlacementCost", enabled); if (!enabled.Value && !((Character)Player.m_localPlayer).IsDebugFlying()) { Player.m_debugMode = false; } else { Player.m_debugMode = true; } Player.m_localPlayer.InvokePrivate<object>("UpdateAvailablePiecesList", Array.Empty<object>()); Logger.Log("Creative mode: " + (enabled.Value ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 233, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleNoCost"); } [Command("echo", "Shout into the void.", null)] public void Echo(params string[] values) { Console.instance.Print(string.Join(" ", values)); } [Command("explore", "Reveals the map around you within a certain radius.", null)] public void Explore(float radius = 200f) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 247, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Explore"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 253, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Explore"); return; } Minimap.instance.InvokePrivate<object>("Explore", new object[2] { ((Component)Player.m_localPlayer).transform.position, radius }); Logger.Log("", logToConsole: true, 259, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Explore").write("Revealed the map within").param(radius) .write("meter(s).") .commit(); } [Command("fly", "Toggles the ability to fly. Can also disable collisions with the second argument.", null)] public void ToggleFly(bool noCollision = false) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 271, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleFly"); return; } bool flag = Player.m_localPlayer.ToggleDebugFly(); if (flag) { ((Component)Player.m_localPlayer).GetComponent<Collider>().enabled = !noCollision; } else { ((Component)Player.m_localPlayer).GetComponent<Collider>().enabled = true; } if (!flag && !Player.m_localPlayer.NoCostCheat()) { Player.m_debugMode = false; } else { Player.m_debugMode = true; } Logger.Log("Flight: " + (flag ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)) + " | No collision: " + ((noCollision && flag) ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 287, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleFly"); } [Command("give", "Give an item to yourself or another player.", "GetPrefabNames")] public void Give(string itemName, int amount = 1, Player player = null, int level = 1) { //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { Logger.Error("No world loaded.", logToConsole: true, 296, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } if (string.IsNullOrEmpty(itemName)) { Logger.Error("You must specify a name.", logToConsole: true, 302, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } if (amount <= 0) { Logger.Error("Amount must be greater than 0.", logToConsole: true, 308, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } if (level <= 0) { Logger.Error("Level must be greater than 0.", logToConsole: true, 314, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } if ((Object)(object)player == (Object)null) { player = Player.m_localPlayer; } GameObject prefabByName; try { prefabByName = Util.GetPrefabByName(itemName); } catch (TooManyValuesException) { Logger.Error("Found more than one item containing the text <color=white>" + itemName + "</color>, please be more specific.", logToConsole: true, 329, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } catch (NoMatchFoundException) { Logger.Error("Couldn't find any items named <color=white>" + itemName + "</color>.", logToConsole: true, 334, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } if ((Object)(object)prefabByName.GetComponent<ItemDrop>() == (Object)null) { Logger.Error("Found a prefab named <color=white>" + itemName + "</color>, but that isn't an item.", logToConsole: true, 340, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } Vector3 val = Random.insideUnitSphere * 0.5f; ((Character)Player.m_localPlayer).Message((MessageType)1, "Spawning object " + ((Object)prefabByName).name, 0, (Sprite)null); GameObject val2 = Object.Instantiate<GameObject>(prefabByName, ((Component)player).transform.position + ((Component)player).transform.forward * 2f + Vector3.up + val, Quaternion.identity); if (!Object.op_Implicit((Object)(object)val2)) { Logger.Error("Something went wrong!", logToConsole: true, 351, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); return; } ItemDrop component = val2.GetComponent<ItemDrop>(); component.m_itemData.m_quality = level; component.m_itemData.m_stack = amount; component.m_itemData.m_durability = component.m_itemData.GetMaxDurability(); Logger.Log("Gave " + amount.ToString().WithColor(Logger.GoodColor) + " of " + ((Object)prefabByName).name.WithColor(Logger.GoodColor) + " to " + player.GetPlayerName().WithColor(Logger.GoodColor) + ".", logToConsole: true, 361, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Give"); if ((Object)(object)player == (Object)(object)Player.m_localPlayer) { ((Humanoid)player).Pickup(val2, false, false); } } [Command("goto", "Teleport yourself to another player.", null)] public void Goto(Player player) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 376, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Goto"); return; } ((Component)Player.m_localPlayer).transform.position = ((Component)player).transform.position - ((Component)player).transform.forward * 1.5f + Vector3.up * 2f; Logger.Log("Teleporting to " + player.GetPlayerName().WithColor(Logger.GoodColor) + "...", logToConsole: true, 382, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Goto"); } [Command("ghost", "Toggles ghost mode. Prevents hostile creatures from detecting you.", null)] public void ToggleGhostMode(bool? enabled = null) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 390, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleGhostMode"); return; } enabled = enabled ?? (!((Character)Player.m_localPlayer).InGhostMode()); Player.m_localPlayer.SetGhostMode(enabled.Value); Logger.Log("Ghost mode: " + (((Character)Player.m_localPlayer).InGhostMode() ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 397, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleGhostMode"); } [Command("god", "Toggles invincibility.", null)] public void ToggleGodmode(bool? enabled = null) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 405, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleGodmode"); return; } enabled = enabled ?? (!((Character)Player.m_localPlayer).InGodMode()); Player.m_localPlayer.SetGodMode(enabled.Value); Logger.Log("God mode: " + (((Character)Player.m_localPlayer).InGodMode() ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 412, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleGodmode"); } [Command("heal", "Heal all of your wounds.", null)] public void Heal() { if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 420, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Heal"); return; } ((Character)Player.m_localPlayer).Heal(((Character)Player.m_localPlayer).GetMaxHealth(), true); Logger.Log("All wounds cured.", logToConsole: true, 425, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Heal"); } [Command("help", "Prints the command list, or looks up the syntax of a specific command. Also accepts a page number, in case of many commands.", null)] public void Help(string commandOrPageNum = null) { //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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_0185: Unknown result type (might be due to invalid IL or missing references) int result = 1; bool flag = int.TryParse(commandOrPageNum, out result); result = Math.Max(result, 1); if (commandOrPageNum == null || flag) { int num = Console.VisibleLines - 2; int num2 = Math.Max((int)Math.Ceiling((float)m_actions.Count * 3f / (float)num), 1); int num3 = (int)Math.Ceiling((float)num / 3f); if (result > num2) { Logger.Error($"Max number of help pages is {num2}.", logToConsole: true, 443, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Help"); return; } if (!flag || result == 1) { Console.instance.Print("\n[Gungnir] Version 1.7.5 by zamboni\n"); } if (flag) { Console.instance.Print($"Page ({result}/{num2})\n"); } int count = (result - 1) * num3; { foreach (CommandMeta item in from m in m_actions.Values.ToList().Skip(count).Take(flag ? num3 : m_actions.Count) orderby m.data.keyword select m) { string text = "/" + item.data.keyword; if (item.arguments.Count > 0) { Console.instance.Print(text.WithColor(Logger.WarningColor) + " " + item.hint.WithColor(Logger.GoodColor) + "\n" + item.data.description); } else { Console.instance.Print(text.WithColor(Logger.WarningColor) + "\n" + item.data.description); } Console.instance.Print(""); } return; } } if (!commandOrPageNum.StartsWith("/")) { commandOrPageNum = "/" + commandOrPageNum; } if (!m_actions.TryGetValue(commandOrPageNum, out var value)) { Logger.Error("Sorry, couldn't find a command named " + commandOrPageNum.WithColor(Color.white) + ".", logToConsole: true, 481, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Help"); return; } Console.instance.Print(""); if (value.arguments.Count > 0) { Console.instance.Print(commandOrPageNum.WithColor(Logger.WarningColor) + " " + value.hint.WithColor(Logger.GoodColor) + "\n" + value.data.description); } else { Console.instance.Print(commandOrPageNum.WithColor(Logger.WarningColor) + "\n" + value.data.description); } } [Command("listaliases", "List all of your custom aliases, or check what a specific alias does.", null)] public void ListAliases(string alias = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) if (m_aliases.Count == 0) { Logger.Error("You have no aliases currently set. Use " + "/alias".WithColor(Color.white) + " to add some.", logToConsole: true, 501, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListAliases"); return; } if (string.IsNullOrEmpty(alias)) { foreach (KeyValuePair<string, string> alias2 in m_aliases) { Console.instance.Print(alias2.Key + " = " + alias2.Value.WithColor(Logger.WarningColor)); } return; } if (!m_aliases.TryGetValue(alias, out var value)) { Logger.Error("The alias " + alias.WithColor(Color.white) + " does not exist.", logToConsole: true, 515, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListAliases"); } else { Console.instance.Print(alias + " = " + value.WithColor(Logger.WarningColor)); } } [Command("listbinds", "List all of your custom keybinds, or check what an individual keycode is bound to.", null)] public void ListBinds(string keyCode = null) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (Plugin.Binds.Count == 0) { Logger.Error("You have no keybinds currently set. Use " + "/bind".WithColor(Color.white) + " to add some.", logToConsole: true, 527, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListBinds"); return; } if (string.IsNullOrEmpty(keyCode)) { foreach (KeyValuePair<KeyCode, string> bind in Plugin.Binds) { Console.instance.Print($"{bind.Key} = {bind.Value.WithColor(Logger.WarningColor)}"); } return; } string value; if (!Enum.TryParse<KeyCode>(keyCode, ignoreCase: true, out KeyCode result)) { Logger.Error("Couldn't find a key code named " + keyCode.WithColor(Color.white) + ".", logToConsole: true, 541, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListBinds"); } else if (!Plugin.Binds.TryGetValue(result, out value)) { Logger.Error(keyCode.ToString().WithColor(Color.white) + " is not bound to anything.", logToConsole: true, 547, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListBinds"); } else { Console.instance.Print($"{result} = {value.WithColor(Logger.WarningColor)}"); } } [Command("listweather", "Get a list of all available weather types.", null)] public void ListWeather() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)EnvMan.instance)) { Logger.Error("No world loaded.", logToConsole: true, 559, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListWeather"); return; } IEnumerable<string> enumerable = EnvMan.instance.m_environments.Select((EnvSetup env) => env.m_name); Logger.Log("Found " + enumerable.Count().ToString().WithColor(Logger.GoodColor) + " available weather types...", logToConsole: true, 567, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListWeather"); foreach (string item in enumerable) { Console.instance.Print(item); } } [Command("listitems", "List every item in the game, or search for one that contains your text.", null)] public void ListItems(string itemName = null) { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { Logger.Error("No world loaded.", logToConsole: true, 578, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListItems"); return; } List<string> list = new List<string>(); foreach (string prefabName in ZNetScene.instance.GetPrefabNames()) { if (!Object.op_Implicit((Object)(object)ZNetScene.instance.GetPrefab(prefabName).GetComponent<ItemDrop>())) { continue; } if (itemName == null) { list.Add(prefabName); continue; } int num = prefabName.IndexOf(itemName, StringComparison.OrdinalIgnoreCase); if (num != -1) { string text = prefabName.Substring(num, itemName.Length); string item = prefabName.Replace(text, text.WithColor(Logger.GoodColor)); list.Add(item); } } if (list.Count == 0) { Logger.Error("Couldn't find any items containing the text " + itemName.WithColor(Color.white) + ".", logToConsole: true, 609, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListItems"); return; } Logger.Log("Found " + list.Count.ToString().WithColor(Logger.GoodColor) + " items...", logToConsole: true, 612, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListItems"); foreach (string item2 in list) { Console.instance.Print(item2); } } [Command("listportals", "List every portal tag.", null)] public void ListPortals() { //IL_0131: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 624, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListPortals"); return; } HashSet<string> hashSet = new HashSet<string>(); foreach (int portalHash in Game.instance.PortalPrefabHash) { foreach (ZDO item in from <>h__TransparentIdentifier0 in ZDOMan.instance.GetPrivateField<Dictionary<ZDOID, ZDO>>("m_objectsByID").Select(delegate(KeyValuePair<ZDOID, ZDO> pair) { KeyValuePair<ZDOID, ZDO> keyValuePair = pair; return new { pair = pair, tag = keyValuePair.Value.GetString("tag", (string)null) }; }) where <>h__TransparentIdentifier0.pair.Value.GetPrefab() == portalHash && !string.IsNullOrEmpty(<>h__TransparentIdentifier0.tag) && <>h__TransparentIdentifier0.tag != " " select <>h__TransparentIdentifier0.pair.Value) { string @string = item.GetString("tag", (string)null); if (!hashSet.Contains(@string)) { hashSet.Add(@string); } } } Logger.Log("Found " + hashSet.Count.ToString().WithColor(Logger.GoodColor) + " tag(s)...", logToConsole: true, 647, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListPortals"); foreach (string item2 in hashSet.OrderBy((string tag) => tag)) { Console.instance.Print(item2); } } [Command("listprefabs", "List every prefab in the game, or search for one that contains your text.", null)] public void ListPrefabs(string prefabName = null) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { Logger.Error("No world loaded.", logToConsole: true, 658, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListPrefabs"); return; } List<string> list = new List<string>(); foreach (string prefabName2 in ZNetScene.instance.GetPrefabNames()) { ZNetScene.instance.GetPrefab(prefabName2); if (prefabName == null) { list.Add(prefabName2); continue; } int num = prefabName2.IndexOf(prefabName, StringComparison.OrdinalIgnoreCase); if (num != -1) { string text = prefabName2.Substring(num, prefabName.Length); string item = prefabName2.Replace(text, text.WithColor(Logger.GoodColor)); list.Add(item); } } if (list.Count == 0) { Logger.Error("Couldn't find any items containing the text " + prefabName.WithColor(Color.white) + ".", logToConsole: true, 685, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListPrefabs"); return; } Logger.Log("Found " + list.Count.ToString().WithColor(Logger.GoodColor) + " prefabs...", logToConsole: true, 688, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListPrefabs"); foreach (string item2 in list) { Console.instance.Print(item2); } } [Command("listskills", "List every available skill in the game.", null)] public void ListSkills() { //IL_0022: 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) Array values = Enum.GetValues(typeof(SkillType)); Logger.Log("Found " + values.Length.ToString().WithColor(Logger.GoodColor) + " available skills...", logToConsole: true, 701, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ListSkills"); foreach (SkillType item in values) { SkillType val = item; Console.instance.Print(((object)(SkillType)(ref val)).ToString()); } } [Command("nomana", "Toggles infinite eitr (mana).", null)] public void ToggleMana(bool? enabled = null) { //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 712, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleMana"); return; } enabled = enabled ?? (!Plugin.NoMana); if (enabled.Value) { Player.m_localPlayer.m_eitrRegenDelay = 0f; Player.m_localPlayer.m_eiterRegen = 1000f; Player.m_localPlayer.InvokePrivate<object>("SetMaxEitr", new object[2] { 1000f, true }); Plugin.NoMana = true; } else { Player.m_localPlayer.m_eitrRegenDelay = 1f; Player.m_localPlayer.m_eiterRegen = 5f; Player.m_localPlayer.InvokePrivate<object>("SetMaxEitr", new object[2] { 100f, true }); Plugin.NoMana = false; } Logger.Log("Infinite mana: " + (Plugin.NoMana ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 733, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleMana"); } [Command("nostam", "Toggles infinite stamina.", null)] public void ToggleStamina(bool? enabled = null) { //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 744, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleStamina"); return; } enabled = enabled ?? (!Plugin.NoStamina); if (enabled.Value) { Player.m_localPlayer.m_staminaRegenDelay = 0.05f; Player.m_localPlayer.m_staminaRegen = 999f; Player.m_localPlayer.m_runStaminaDrain = 0f; Player.m_localPlayer.SetMaxStamina(9999f, true); Plugin.NoStamina = true; } else { Player.m_localPlayer.m_staminaRegenDelay = 1f; Player.m_localPlayer.m_staminaRegen = 5f; Player.m_localPlayer.m_runStaminaDrain = 10f; Player.m_localPlayer.SetMaxStamina(100f, true); Plugin.NoStamina = false; } Logger.Log("Infinite stamina: " + (Plugin.NoStamina ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 767, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleStamina"); } [Command("nores", "Toggle building restrictions. Allows you to place objects even when the preview is red.", null)] public void ToggleBuildAnywhere(bool? enabled = null) { //IL_008c: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 778, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleBuildAnywhere"); return; } enabled = enabled ?? (!Plugin.BuildAnywhere); Plugin.BuildAnywhere = enabled.Value; Logger.Log("No build restrictions: " + (Plugin.BuildAnywhere ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 785, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleBuildAnywhere"); } [Command("noslide", "Toggle the ability to walk up steep angles without sliding.", null)] public void ToggleNoSlide(bool? enabled = null) { //IL_008c: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 793, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleNoSlide"); return; } enabled = enabled ?? (!Plugin.NoSlide); Plugin.NoSlide = enabled.Value; Logger.Log("No slide: " + (Plugin.NoSlide ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 800, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleNoSlide"); } [Command("nosup", "Toggle the need for structural support.", null)] public void ToggleNoSupport(bool? enabled = null) { //IL_008c: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 808, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleNoSupport"); return; } enabled = enabled ?? (!Plugin.NoSlide); Plugin.NoStructuralSupport = enabled.Value; Logger.Log("No structural support: " + (Plugin.NoStructuralSupport ? "ON".WithColor(Logger.GoodColor) : "OFF".WithColor(Logger.ErrorColor)), logToConsole: true, 815, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "ToggleNoSupport"); } [Command("pos", "Print your current position as XZY coordinates. (XZY is used for tp command.)", null)] public void Pos() { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 823, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Pos"); return; } Vector3 position = ((Component)Player.m_localPlayer).transform.position; string text = $"{Math.Round(position.x, 3)} {Math.Round(position.z, 3)} {Math.Round(position.y, 3)}".WithColor(Logger.GoodColor); Logger.Log("Your current position is " + text, logToConsole: true, 829, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Pos"); } [Command("puke", "Clears all food buffs and makes room for you to eat something else.", null)] public void Puke() { if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 837, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Puke"); return; } Player.m_localPlayer.ClearFood(); Logger.Log("Food buffs cleared.", logToConsole: true, 842, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Puke"); } [Command("refreshability", "Refreshes the cooldown on your special ability.", null)] public void RefreshAbility() { if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 850, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RefreshAbility"); return; } Player.m_localPlayer.m_guardianPowerCooldown = 0f; Logger.Log("Guardian power cooldown refreshed.", logToConsole: true, 855, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RefreshAbility"); } [Command("removedrops", "Clears all item drops in a radius (meters).", null)] public void RemoveDrops(float radius = 50f) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 863, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RemoveDrops"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 869, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RemoveDrops"); return; } ItemDrop[] array = Object.FindObjectsOfType<ItemDrop>(); int num = 0; ItemDrop[] array2 = array; foreach (ItemDrop val in array2) { ZNetView component = ((Component)val).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component) && Vector3.Distance(((Component)val).gameObject.transform.position, ((Component)Player.m_localPlayer).gameObject.transform.position) <= radius) { component.ClaimOwnership(); component.Destroy(); num++; } } Logger.Log("Removed " + num.ToString().WithColor(Logger.GoodColor) + " item(s) within " + radius.ToString().WithColor(Logger.GoodColor) + " meters.", logToConsole: true, 888, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RemoveDrops"); } [Command("repair", "Repairs every item in your inventory.", null)] public void Repair() { if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 896, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Repair"); return; } List<ItemData> list = new List<ItemData>(); ((Humanoid)Player.m_localPlayer).GetInventory().GetWornItems(list); foreach (ItemData item in list) { item.m_durability = item.GetMaxDurability(); } Logger.Log("All your items have been repaired.", logToConsole: true, 908, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Repair"); } [Command("repairbuilds", "Repairs all nearby structures within a radius. Optionally, you can specify a health value to \"overheal\".", null)] public void RepairBuildings(float radius = 50f, float health = 0f) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 916, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RepairBuildings"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 922, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RepairBuildings"); return; } if (health < 0f) { Logger.Error("Health cannot be negative.", logToConsole: true, 928, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RepairBuildings"); return; } int num = 0; foreach (WearNTear allInstance in WearNTear.GetAllInstances()) { if (Vector3.Distance(((Component)allInstance).gameObject.transform.position, ((Component)Player.m_localPlayer).transform.position) <= radius) { ZDO zDO = ((Component)allInstance).gameObject.GetComponent<ZNetView>().GetZDO(); float @float = zDO.GetFloat("health", 0f); if (health == 0f && allInstance.Repair()) { num++; } else if (health != 0f && @float != health) { zDO.Set("health", health); ZDOMan.instance.ForceSendZDO(zDO.m_uid); num++; } } } if (health == 0f) { Logger.Log("", logToConsole: true, 958, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RepairBuildings").write("Repaired").param(num) .write("structure(s) within") .param(radius) .write("meter(s).") .commit(); } else { Logger.Log("", logToConsole: true, 966, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "RepairBuildings").write("Set the health of").param(num) .write("structure(s) within") .param(radius) .write("meter(s) to") .noSpace() .param(health) .write(".") .commit(); } } [Command("setmaxweight", "Set your maximum carry weight.", null)] public void SetCarryWeight(float maxWeight = 300f) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 983, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetCarryWeight"); return; } if (maxWeight <= 0f) { Logger.Error("Max weight must be greater than 0.", logToConsole: true, 989, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetCarryWeight"); return; } Player.m_localPlayer.m_maxCarryWeight = maxWeight; Logger.Log("Set maximum carry weight to " + maxWeight.ToString().WithColor(Logger.GoodColor) + ".", logToConsole: true, 995, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetCarryWeight"); } [Command("setskill", "Set the level of one of your skills.", null)] public void SetSkill(string skillName, int level) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1003, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetSkill"); return; } string partialMatch; try { partialMatch = Util.GetPartialMatch(((IEnumerable<SkillType>)Enum.GetValues(typeof(SkillType))).Select((SkillType skill) => ((object)(SkillType)(ref skill)).ToString()), skillName); } catch (TooManyValuesException) { Logger.Error("Found more than one skill containing the text " + skillName.WithColor(Color.white) + ", please be more specific.", logToConsole: true, 1018, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetSkill"); return; } catch (NoMatchFoundException) { Logger.Error("Couldn't find a skill named " + skillName.WithColor(Color.white) + ".", logToConsole: true, 1023, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetSkill"); return; } level = Mathf.Clamp(level, 0, 100); ((Character)Player.m_localPlayer).GetSkills().CheatResetSkill(partialMatch); ((Character)Player.m_localPlayer).GetSkills().CheatRaiseSkill(partialMatch, (float)level, false); Logger.Log("Set " + partialMatch.WithColor(Logger.GoodColor) + " to level " + level.ToString().WithColor(Logger.GoodColor) + ".", logToConsole: true, 1032, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetSkill"); } [Command("seed", "Print the seed used by this world.", null)] public void Seed() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ZNetScene.instance == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1040, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Seed"); } else { Logger.Log(WorldGenerator.instance.GetPrivateField<World>("m_world").m_seedName.WithColor(Logger.GoodColor), logToConsole: true, 1044, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Seed"); } } [Command("spawn", "Spawn a prefab/creature/item. If it's a creature, levelOrQuantity will set the level, or if it's an item, set the stack size.", "GetPrefabNames")] public void SpawnPrefab(string prefab, int levelOrQuantity = 1) { //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { Logger.Error("No world loaded.", logToConsole: true, 1052, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); return; } ZNetView[] array = Object.FindObjectsOfType<ZNetView>(); if (array.Length == 0) { Logger.Error("Can't locate a base ZDO to use for network reference.", logToConsole: true, 1060, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); return; } ZDO zDO = array[0].GetZDO(); if (string.IsNullOrEmpty(prefab)) { Logger.Error("You must specify a name.", logToConsole: true, 1068, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); return; } if (levelOrQuantity <= 0) { Logger.Error("Level/quantity to spawn must be greater than 0.", logToConsole: true, 1074, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); return; } GameObject prefabByName; try { prefabByName = Util.GetPrefabByName(prefab); } catch (TooManyValuesException) { Logger.Error("Found more than one prefab containing the text <color=white>" + prefab + "</color>, please be more specific.", logToConsole: true, 1086, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); return; } catch (NoMatchFoundException) { Logger.Error("Couldn't find any prefabs named <color=white>" + prefab + "</color>.", logToConsole: true, 1091, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); return; } GameObject val = Object.Instantiate<GameObject>(prefabByName, ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward * 1.5f, Quaternion.identity); if (!Object.op_Implicit((Object)(object)val)) { Logger.Error("Something went wrong!", logToConsole: true, 1103, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); return; } ZNetView component = val.GetComponent<ZNetView>(); Character component2 = val.GetComponent<Character>(); ItemDrop component3 = val.GetComponent<ItemDrop>(); if (Object.op_Implicit((Object)(object)component2)) { component2.SetLevel(Math.Min(levelOrQuantity, 10)); } else if (Object.op_Implicit((Object)(object)component3) && component3.m_itemData != null) { component3.m_itemData.m_quality = 1; component3.m_itemData.m_durability = component3.m_itemData.GetMaxDurability(); component3.m_itemData.m_stack = levelOrQuantity; } zDO.Set("spawn_id", component.GetZDO().m_uid); zDO.Set("alive_time", ZNet.instance.GetTime().Ticks); Logger.Log("Spawned " + ((Object)prefabByName).name.WithColor(Logger.GoodColor) + ".", logToConsole: true, 1129, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnPrefab"); } [Command("spawntamed", "Spawn a tamed version of a creature.", null)] public void SpawnTamed(string creature, int level = 1) { //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)ZNetScene.instance)) { Logger.Error("No world loaded.", logToConsole: true, 1137, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); return; } if (string.IsNullOrEmpty(creature)) { Logger.Error("You must specify a name.", logToConsole: true, 1143, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); return; } if (level <= 0) { Logger.Error("Level must be greater than 0.", logToConsole: true, 1149, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); return; } GameObject prefabByName; try { prefabByName = Util.GetPrefabByName(creature); } catch (TooManyValuesException) { Logger.Error("Found more than one creature containing the text <color=white>" + creature + "</color>, please be more specific.", logToConsole: true, 1161, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); return; } catch (NoMatchFoundException) { Logger.Error("Couldn't find any creatures named <color=white>" + creature + "</color>.", logToConsole: true, 1166, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); return; } if ((Object)(object)prefabByName.GetComponent<Character>() == (Object)null) { Logger.Error(((Object)prefabByName).name.WithColor(Color.white) + " is not a valid creature.", logToConsole: true, 1174, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); return; } GameObject val = Object.Instantiate<GameObject>(prefabByName, ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward * 1.5f, Quaternion.identity); if (!Object.op_Implicit((Object)(object)val)) { Logger.Error("Something went wrong!", logToConsole: true, 1186, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); return; } Character component = val.GetComponent<Character>(); ((Component)component).gameObject.GetComponent<MonsterAI>().MakeTame(); component.SetLevel(Math.Min(level, 10)); Logger.Log("Spawned a tame level " + level.ToString().WithColor(Logger.WarningColor) + " " + ((Object)prefabByName).name.WithColor(Logger.GoodColor) + ".", logToConsole: true, 1194, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SpawnTamed"); } [Command("tame", "Pacify all tameable creatures in a radius.", null)] public void Tame(float radius = 10f) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1202, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Tame"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 1208, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Tame"); return; } List<Character> list = new List<Character>(); Character.GetCharactersInRange(((Component)Player.m_localPlayer).transform.position, radius, list); int num = 0; foreach (Character item in list) { if ((Object)(object)((Component)item).gameObject.GetComponent<Tameable>() != (Object)null) { ((Component)item).gameObject.GetComponent<MonsterAI>().MakeTame(); num++; } } Logger.Log("Tamed " + num.ToString().WithColor(Logger.GoodColor) + " creatures within " + radius.ToString().WithColor(Logger.GoodColor) + " meters.", logToConsole: true, 1226, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Tame"); } [Command("time", "Overrides the time of day for you only (0 to 1 where 0.5 is noon). Set to a negative number to disable.", null)] public void SetTime(float time) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)EnvMan.instance)) { Logger.Error("No world loaded.", logToConsole: true, 1234, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetTime"); } else if (time >= 0f) { time = Mathf.Clamp01(time); EnvMan.instance.m_debugTimeOfDay = true; EnvMan.instance.m_debugTime = time; float num = time * 24f; string text = (((int)num).ToString().PadLeft(2, '0') + ":" + ((int)((num - (float)(int)num) * 60f)).ToString().PadLeft(2, '0')).WithColor(Logger.GoodColor); Logger.Log("Time set to " + text + ".", logToConsole: true, 1248, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetTime"); } else { EnvMan.instance.m_debugTimeOfDay = false; Logger.Log("Time re-synchronized with the game.", logToConsole: true, 1253, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "SetTime"); } } [Command("tlevel", "Level the terrain in a radius.", null)] public void TerrainLevel(float radius = 10f) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1265, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLevel"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 1271, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLevel"); return; } if (radius > 50f) { Logger.Error("To avoid crashing your or another player's game, your radius will be clamped to 50.", logToConsole: true, 1276, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLevel"); radius = 50f; } Ground.Level(((Component)Player.m_localPlayer).transform.position, radius); Logger.Log("Terrain within " + radius.ToString().WithColor(Logger.GoodColor) + " meter(s) leveled.", logToConsole: true, 1281, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLevel"); } [Command("tlower", "Lower the terrain in a radius by some amount. Strength values closer to 0 make the terrain edges steep, while values further from 0 make them smoother.", null)] public void TerrainLower(float radius = 10f, float depth = 1f, float strength = 0.01f) { //IL_00c9: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1289, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLower"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 1295, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLower"); return; } if (radius > 50f) { Logger.Error("To avoid crashing your or another player's game, your radius will be clamped to 50.", logToConsole: true, 1300, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLower"); radius = 50f; } if (depth <= 0f) { Logger.Error("Depth must be greater than 0.", logToConsole: true, 1306, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLower"); return; } if (strength <= 0f) { Logger.Error("Strength must be greater than 0.", logToConsole: true, 1312, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLower"); return; } Ground.Lower(((Component)Player.m_localPlayer).transform.position, radius, depth, strength); Logger.Log("Terrain within " + radius.ToString().WithColor(Logger.GoodColor) + " meter(s) lowered.", logToConsole: true, 1317, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainLower"); } [Command("tpaint", "Paint terrain in a radius. Available paint types are: dirt, paved, cultivate, and reset.", null)] public void TerrainPaint(float radius = 5f, string paintType = "reset") { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1325, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainPaint"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 1331, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainPaint"); return; } if (radius > 50f) { Logger.Error("To avoid crashing your or another player's game, your radius will be clamped to 50.", logToConsole: true, 1336, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainPaint"); radius = 50f; } if (!Enum.TryParse<PaintType>(paintType, ignoreCase: true, out PaintType result)) { Logger.Error("No paint type named " + paintType.WithColor(Color.white), logToConsole: true, 1342, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainPaint"); return; } Ground.Paint(((Component)Player.m_localPlayer).transform.position, radius, result); Logger.Log("Terrain within " + radius.ToString().WithColor(Logger.GoodColor) + " meter(s) painted.", logToConsole: true, 1347, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainPaint"); } [Command("traise", "Raise the terrain in a radius by some amount. Strength values closer to 0 make the terrain edges steep, while values further from 0 make them smoother.", null)] public void TerrainRaise(float radius = 10f, float height = 1f, float strength = 0.01f) { //IL_00c9: 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) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1355, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainRaise"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 1361, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainRaise"); return; } if (radius > 50f) { Logger.Error("To avoid crashing your or another player's game, your radius will be clamped to 50.", logToConsole: true, 1366, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainRaise"); radius = 50f; } if (height <= 0f) { Logger.Error("Height must be greater than 0.", logToConsole: true, 1372, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainRaise"); return; } if (strength <= 0f) { Logger.Error("Strength must be greater than 0.", logToConsole: true, 1378, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainRaise"); return; } Ground.Raise(((Component)Player.m_localPlayer).transform.position, radius, height, strength); Logger.Log("Terrain within " + radius.ToString().WithColor(Logger.GoodColor) + " meter(s) raised.", logToConsole: true, 1383, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainRaise"); } [Command("treset", "Reset all terrain modifications in a radius.", null)] public void TerrainReset(float radius = 10f) { //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1391, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainReset"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 1397, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainReset"); return; } if (radius > 50f) { Logger.Error("To avoid crashing your or another player's game, your radius will be clamped to 50.", logToConsole: true, 1402, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainReset"); radius = 50f; } Ground.Reset(((Component)Player.m_localPlayer).transform.position, radius); Logger.Log("Terrain within " + radius.ToString().WithColor(Logger.GoodColor) + " meter(s) reset.", logToConsole: true, 1407, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainReset"); } [Command("tshape", "Choose the shape of terrain modifications with 'circle' or 'square'.", null)] public void TerrainShape(string shape) { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (shape.Equals("square", StringComparison.OrdinalIgnoreCase) || shape.Equals("box", StringComparison.OrdinalIgnoreCase) || shape.Equals("cube", StringComparison.OrdinalIgnoreCase)) { Ground.square = true; } else { if (!shape.Equals("circle", StringComparison.OrdinalIgnoreCase) && !shape.Equals("sphere", StringComparison.OrdinalIgnoreCase) && !shape.Equals("round", StringComparison.OrdinalIgnoreCase)) { Logger.Error("Only " + "square".WithColor(Color.white) + " and " + "circle".WithColor(Color.white) + " are acceptable values.", logToConsole: true, 1423, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainShape"); return; } Ground.square = false; } Logger.Log("Terrain modification shape: " + (Ground.square ? "square".WithColor(Logger.GoodColor) : "circle".WithColor(Logger.GoodColor)), logToConsole: true, 1427, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainShape"); } [Command("tsmooth", "Smooth terrain in a radius with some strength. Higher strengths mean more aggressive smoothing.", null)] public void TerrainSmooth(float radius = 10f, float strength = 0.5f) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { Logger.Error("No world loaded.", logToConsole: true, 1435, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainSmooth"); return; } if (radius <= 0f) { Logger.Error("Radius must be greater than 0.", logToConsole: true, 1441, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainSmooth"); return; } if (radius > 50f) { Logger.Error("To avoid crashing your or another player's game, your radius will be clamped to 50.", logToConsole: true, 1446, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainSmooth"); radius = 50f; } if (strength <= 0f) { Logger.Error("Strength must be greater than 0.", logToConsole: true, 1452, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainSmooth"); return; } Ground.Smooth(((Component)Player.m_localPlayer).transform.position, radius, strength); Logger.Log("Terrain within " + radius.ToString().WithColor(Logger.GoodColor) + " meter(s) smoothed.", logToConsole: true, 1457, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "TerrainSmooth"); } [Command("tp", "Teleport to specific coordinates. The Y value is optional. If omitted, will attempt to find the best height to put you at automagically.", null)] public void Teleport(float x, float z, float? y = null) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { Logger.Error("No world loaded.", logToConsole: true, 1467, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Teleport"); return; } if (!y.HasValue) { RaycastHit val = default(RaycastHit); Physics.Raycast(new Vector3(x, 5000f, z), Vector3.down, ref val, 10000f); y = ((RaycastHit)(ref val)).point.y; } ((Component)Player.m_localPlayer).transform.position = new Vector3(x, y.Value, z); Logger.Log("Woosh!", logToConsole: true, 1478, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Teleport"); } [Command("unalias", "Remove an alias you've created.", null)] public void Unalias(string alias) { //IL_0052: 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) if (m_aliases.ContainsKey(alias)) { m_aliases.Remove(alias); Logger.Log("Alias " + alias.WithColor(Logger.GoodColor) + " deleted.", logToConsole: true, 1487, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Unalias"); } else { Logger.Error("No alias named " + alias.WithColor(Color.white) + " exists.", logToConsole: true, 1492, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Unalias"); } } [Command("unaliasall", "Removes all of your custom command aliases. Requires a true/1/yes as parameter to confirm you mean it.", null)] public void UnaliasAll(bool confirm) { if (!confirm) { Logger.Error("Your aliases are safe.", logToConsole: true, 1500, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "UnaliasAll"); return; } m_aliases.Clear(); Plugin.SaveAliases(); Logger.Log("All of your aliases have been cleared.", logToConsole: true, 1507, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "UnaliasAll"); } [Command("unbind", "Removes a custom keybind.", null)] public void Unbind(string keyCode) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!Enum.TryParse<KeyCode>(keyCode, ignoreCase: true, out KeyCode result)) { Logger.Error("Couldn't find a key code named " + keyCode.WithColor(Color.white) + ".", logToConsole: true, 1515, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Unbind"); return; } if (!Plugin.Binds.ContainsKey(result)) { Logger.Error(((object)(KeyCode)(ref result)).ToString().WithColor(Color.white) + " is not bound to anything.", logToConsole: true, 1521, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\CommandHandler.cs", "Unbind"); return; } Plugin.Binds.Remove(result); Plugin.SaveBinds(); Logger.Log("Unbound " + ((object)(KeyCode)(ref result)).ToString().WithColor(Logger.GoodColor) + ".", logToConsole: true, 1528, "C:\\Users\\dylan\\Documents\\Valheim Custom Mods\\Gungnir\\Gungnir\\src\\Co