using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using HarmonyLib;
using RapidGUI;
using SharpConfig;
using UnityEngine;
using ValheimTooler.Configuration;
using ValheimTooler.Core;
using ValheimTooler.Core.Extensions;
using ValheimTooler.Models;
using ValheimTooler.Models.Mono;
using ValheimTooler.UI;
using ValheimTooler.Utils;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ValheimTooler")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Astropilot")]
[assembly: AssemblyProduct("ValheimTooler")]
[assembly: AssemblyCopyright("Copyright © Astropilot 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("66a8de82-ae2d-4a68-bc1b-84452afe01bd")]
[assembly: AssemblyFileVersion("1.11.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.11.0.0")]
namespace RapidGUI
{
public interface IDoGUI
{
void DoGUI();
}
public interface IDoGUIWindow
{
void DoGUIWindow();
void CloseWindow();
}
public class RapidGUIBehaviour : MonoBehaviour
{
private static RapidGUIBehaviour s_instance;
public KeyCode closeFocusedWindowKey = (KeyCode)113;
public int prefixLabelSlideButton = 1;
public Action onGUI;
public static RapidGUIBehaviour Instance
{
get
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)s_instance == (Object)null)
{
s_instance = Object.FindObjectOfType<RapidGUIBehaviour>();
if ((Object)(object)s_instance == (Object)null)
{
s_instance = new GameObject("RapidGUI").AddComponent<RapidGUIBehaviour>();
}
if (Application.isPlaying)
{
Object.DontDestroyOnLoad((Object)(object)s_instance);
}
}
return s_instance;
}
}
public void OnGUI()
{
onGUI?.Invoke();
}
}
public static class RGUIUtility
{
private static readonly GUIContent s_tempContent = new GUIContent();
public static GUIContent TempContent(string text)
{
s_tempContent.text = text;
s_tempContent.tooltip = null;
s_tempContent.image = null;
return s_tempContent;
}
public static Vector2 GetMouseScreenPos(Vector2? screenInsideOffset = 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_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: 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)
Vector3 mousePosition = Input.mousePosition;
Vector2 val = default(Vector2);
((Vector2)(ref val))..ctor(mousePosition.x, (float)Screen.height - mousePosition.y);
if (screenInsideOffset.HasValue)
{
Vector2 val2 = new Vector2((float)Screen.width, (float)Screen.height) - screenInsideOffset.Value;
val = Vector2.Min(val, val2);
return val;
}
return val;
}
}
public static class WindowInvoker
{
private static readonly HashSet<IDoGUIWindow> s_windows;
private static IDoGUIWindow s_focusedWindow;
static WindowInvoker()
{
s_windows = new HashSet<IDoGUIWindow>();
RapidGUIBehaviour instance = RapidGUIBehaviour.Instance;
instance.onGUI = (Action)Delegate.Combine(instance.onGUI, new Action(DoGUI));
}
public static void Add(IDoGUIWindow window)
{
s_windows.Add(window);
}
public static void Remove(IDoGUIWindow window)
{
s_windows.Remove(window);
}
public static void SetFocusedWindow(IDoGUIWindow window)
{
s_focusedWindow = window;
}
private static void DoGUI()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Invalid comparison between Unknown and I4
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
foreach (IDoGUIWindow s_window in s_windows)
{
s_window?.DoGUIWindow();
}
Event current = Event.current;
if ((int)current.type == 5 && current.keyCode == RapidGUIBehaviour.Instance.closeFocusedWindowKey && GUIUtility.keyboardControl == 0 && s_windows.Contains(s_focusedWindow))
{
s_focusedWindow.CloseWindow();
s_focusedWindow = null;
}
if ((int)Event.current.type == 7)
{
s_windows.Clear();
}
}
}
public static class RGUI
{
private class PopupWindow : IDoGUIWindow
{
public string label;
public Vector2 pos;
public Vector2 size;
public int? result;
public string[] displayOptions;
public Vector2 scrollPosition;
protected static readonly int s_popupWindowId = "Popup".GetHashCode();
public Rect GetWindowRect()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
return new Rect(pos, size);
}
public virtual void DoGUIWindow()
{
//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_003b: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
GUI.skin = InterfaceMaker.CustomSkin;
GUI.ModalWindow(s_popupWindowId, GetWindowRect(), (WindowFunction)delegate
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
ScrollViewScope val = new ScrollViewScope(scrollPosition, Array.Empty<GUILayoutOption>());
try
{
scrollPosition = val.scrollPosition;
for (int i = 0; i < displayOptions.Length; i++)
{
if (GUILayout.Button(displayOptions[i], InterfaceMaker.CustomSkin.button, Array.Empty<GUILayoutOption>()))
{
result = i;
}
}
}
finally
{
((IDisposable)val)?.Dispose();
}
Event current = Event.current;
if ((int)current.rawType == 0)
{
Rect val2 = new Rect(Vector2.zero, size);
if (!((Rect)(ref val2)).Contains(current.mousePosition))
{
result = -1;
}
}
}, label, InterfaceMaker.CustomSkin.GetStyle("popup"));
}
public void CloseWindow()
{
result = -1;
}
}
private class SearchablePopupWindow : PopupWindow
{
public string _searchTerms;
public string[] _displayOptionsCopy;
public void SetSearchTerms(string searchTerms)
{
_searchTerms = searchTerms;
}
public override void DoGUIWindow()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Invalid comparison between Unknown and I4
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Expected O, but got Unknown
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
GUI.skin = InterfaceMaker.CustomSkin;
if ((int)Event.current.type == 8)
{
_displayOptionsCopy = (string[])displayOptions.Clone();
}
GUI.ModalWindow(PopupWindow.s_popupWindowId, GetWindowRect(), (WindowFunction)delegate
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
_searchTerms = GUILayout.TextField(_searchTerms, Array.Empty<GUILayoutOption>());
if (_displayOptionsCopy.Length == 0)
{
GUILayout.Label("No results has been found!", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) });
}
else
{
scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
for (int i = 0; i < _displayOptionsCopy.Length; i++)
{
if (GUILayout.Button(_displayOptionsCopy[i], InterfaceMaker.CustomSkin.button, Array.Empty<GUILayoutOption>()))
{
result = i;
}
}
GUILayout.EndScrollView();
}
Event current = Event.current;
if ((int)current.rawType == 0)
{
Rect val = new Rect(Vector2.zero, size);
if (!((Rect)(ref val)).Contains(current.mousePosition))
{
result = -1;
}
}
}, label, InterfaceMaker.CustomSkin.GetStyle("popup"));
}
}
private static int s_popupControlId;
private static readonly PopupWindow s_popupWindow = new PopupWindow();
private static readonly SearchablePopupWindow s_searchablePopupWindow = new SearchablePopupWindow();
public static string SelectionPopup(string current, string[] displayOptions)
{
int num = Array.IndexOf(displayOptions, current);
GUILayout.Box(current, InterfaceMaker.CustomSkin.textField, Array.Empty<GUILayoutOption>());
int num2 = PopupOnLastRect(num, displayOptions);
if (num2 != num)
{
current = displayOptions[num2];
}
return current;
}
public static int SelectionPopup(int selectionIndex, string[] displayOptions)
{
GUILayout.Box((selectionIndex < 0 || displayOptions.Length <= selectionIndex) ? "" : displayOptions[selectionIndex], InterfaceMaker.CustomSkin.textField, Array.Empty<GUILayoutOption>());
return PopupOnLastRect(selectionIndex, displayOptions);
}
public static string SearchableSelectionPopup(string current, string[] displayOptions, ref string searchTerms)
{
int num = Array.IndexOf(displayOptions, current);
GUILayout.Box(current, InterfaceMaker.CustomSkin.textField, Array.Empty<GUILayoutOption>());
int num2 = SearchablePopupOnLastRect(num, displayOptions, ref searchTerms);
if (num2 != num)
{
current = displayOptions[num2];
}
return current;
}
public static int SearchableSelectionPopup(int selectionIndex, string[] displayOptions, ref string searchTerms)
{
GUILayout.Box((selectionIndex < 0 || displayOptions.Length <= selectionIndex) ? "" : displayOptions[selectionIndex], InterfaceMaker.CustomSkin.textField, Array.Empty<GUILayoutOption>());
return SearchablePopupOnLastRect(selectionIndex, displayOptions, ref searchTerms);
}
public static int PopupOnLastRect(string[] displayOptions, string label = "")
{
return PopupOnLastRect(-1, displayOptions, -1, label);
}
public static int PopupOnLastRect(string[] displayOptions, int button, string label = "")
{
return PopupOnLastRect(-1, displayOptions, button, label);
}
public static int PopupOnLastRect(int selectionIndex, string[] displayOptions, int mouseButton = -1, string label = "")
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return Popup(GUILayoutUtility.GetLastRect(), mouseButton, selectionIndex, displayOptions, label);
}
public static int SearchablePopupOnLastRect(string[] displayOptions, ref string searchTerms, string label = "")
{
return SearchablePopupOnLastRect(-1, displayOptions, ref searchTerms, -1, label);
}
public static int SearchablePopupOnLastRect(string[] displayOptions, int button, ref string searchTerms, string label = "")
{
return SearchablePopupOnLastRect(-1, displayOptions, ref searchTerms, button, label);
}
public static int SearchablePopupOnLastRect(int selectionIndex, string[] displayOptions, ref string searchTerms, int mouseButton = -1, string label = "")
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return SearchablePopup(GUILayoutUtility.GetLastRect(), mouseButton, selectionIndex, displayOptions, ref searchTerms, label);
}
public static int Popup(Rect launchRect, int mouseButton, int selectionIndex, string[] displayOptions, string label = "")
{
//IL_008d: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Invalid comparison between Unknown and I4
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Invalid comparison between Unknown and I4
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Expected O, but got Unknown
//IL_010a: Expected O, but got Unknown
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Invalid comparison between Unknown and I4
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_020c: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0224: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
int result = selectionIndex;
int controlID = GUIUtility.GetControlID((FocusType)2);
if (s_popupControlId != controlID)
{
Event current = Event.current;
Vector2 mousePosition = current.mousePosition;
if ((int)current.type == 1 && (mouseButton < 0 || current.button == mouseButton) && ((Rect)(ref launchRect)).Contains(mousePosition) && displayOptions != null && displayOptions.Length != 0)
{
s_popupWindow.pos = RGUIUtility.GetMouseScreenPos(Vector2.one * 150f);
s_popupControlId = controlID;
current.Use();
}
}
else
{
EventType type = Event.current.type;
int? result2 = s_popupWindow.result;
if (result2.HasValue && (int)type == 8)
{
if (result2.Value >= 0)
{
result = result2.Value;
}
s_popupWindow.result = null;
s_popupControlId = 0;
}
else
{
if ((int)type == 8 || (int)type == 7)
{
GUIStyle val = new GUIStyle(InterfaceMaker.CustomSkin.button)
{
padding = new RectOffset(24, 48, 2, 2)
};
Vector2 zero = Vector2.zero;
for (int i = 0; i < displayOptions.Length; i++)
{
Vector2 val2 = val.CalcSize(RGUIUtility.TempContent(displayOptions[i]));
zero.x = Mathf.Max(zero.x, val2.x);
zero.y += val2.y;
}
RectOffset margin = val.margin;
zero.y += Mathf.Max(0, displayOptions.Length - 1) * Mathf.Max(margin.top, margin.bottom);
GUIStyle verticalScrollbar = InterfaceMaker.OldSkin.verticalScrollbar;
Vector2 val3 = verticalScrollbar.CalcScreenSize(Vector2.zero);
RectOffset margin2 = verticalScrollbar.margin;
GUIStyle horizontalScrollbar = InterfaceMaker.OldSkin.horizontalScrollbar;
Vector2 val4 = horizontalScrollbar.CalcScreenSize(Vector2.zero);
RectOffset margin3 = horizontalScrollbar.margin;
zero += new Vector2(val3.x + (float)margin2.horizontal, val4.y + (float)margin3.vertical) + Vector2.one * 5f;
Vector2 val5 = InterfaceMaker.CustomSkin.GetStyle("popup").CalcScreenSize(zero);
Vector2 val6 = new Vector2((float)Screen.width, (float)Screen.height) - s_popupWindow.pos;
s_popupWindow.size = Vector2.Min(val5, val6);
}
s_popupWindow.label = label;
s_popupWindow.displayOptions = displayOptions;
WindowInvoker.Add(s_popupWindow);
}
}
return result;
}
public static int SearchablePopup(Rect launchRect, int mouseButton, int selectionIndex, string[] displayOptions, ref string searchTerms, string label = "")
{
//IL_008d: 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_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Invalid comparison between Unknown and I4
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Invalid comparison between Unknown and I4
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Invalid comparison between Unknown and I4
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0137: Expected O, but got Unknown
//IL_0139: Expected O, but got Unknown
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Invalid comparison between Unknown and I4
//IL_015c: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0222: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Unknown result type (might be due to invalid IL or missing references)
//IL_0296: Unknown result type (might be due to invalid IL or missing references)
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
int result = selectionIndex;
int controlID = GUIUtility.GetControlID((FocusType)2);
if (s_popupControlId != controlID)
{
Event current = Event.current;
Vector2 mousePosition = current.mousePosition;
if ((int)current.type == 1 && (mouseButton < 0 || current.button == mouseButton) && ((Rect)(ref launchRect)).Contains(mousePosition) && displayOptions != null && displayOptions.Length != 0)
{
s_searchablePopupWindow.pos = RGUIUtility.GetMouseScreenPos(Vector2.one * 150f);
s_popupControlId = controlID;
current.Use();
}
}
else
{
EventType type = Event.current.type;
int? result2 = s_searchablePopupWindow.result;
if (s_searchablePopupWindow._searchTerms != null)
{
if (!searchTerms.Equals(s_searchablePopupWindow._searchTerms))
{
result = -1;
}
searchTerms = s_searchablePopupWindow._searchTerms;
}
if (result2.HasValue && (int)type == 8)
{
if (result2.Value >= 0)
{
result = result2.Value;
}
s_searchablePopupWindow.result = null;
s_popupControlId = 0;
}
else
{
if ((int)type == 8 || (int)type == 7)
{
GUIStyle val = new GUIStyle(InterfaceMaker.CustomSkin.button)
{
padding = new RectOffset(24, 48, 2, 2)
};
GUIStyle textField = InterfaceMaker.CustomSkin.textField;
Vector2 zero = Vector2.zero;
for (int i = 0; i < displayOptions.Length; i++)
{
Vector2 val2 = val.CalcSize(RGUIUtility.TempContent(displayOptions[i]));
zero.x = Mathf.Max(zero.x, val2.x);
zero.y += val2.y;
}
if (displayOptions.Length == 0)
{
zero.x += 150f;
}
RectOffset margin = val.margin;
zero.y += Mathf.Max(0, displayOptions.Length - 1) * Mathf.Max(margin.top, margin.bottom);
GUIStyle verticalScrollbar = InterfaceMaker.CustomSkin.verticalScrollbar;
Vector2 val3 = verticalScrollbar.CalcScreenSize(Vector2.zero);
RectOffset margin2 = verticalScrollbar.margin;
GUIStyle horizontalScrollbar = InterfaceMaker.CustomSkin.horizontalScrollbar;
Vector2 val4 = horizontalScrollbar.CalcScreenSize(Vector2.zero);
RectOffset margin3 = horizontalScrollbar.margin;
zero += new Vector2(val3.x + (float)margin2.horizontal, val4.y + (float)margin3.vertical) + Vector2.one * 5f;
zero.y += textField.CalcHeight(RGUIUtility.TempContent("t"), zero.x);
Vector2 val5 = InterfaceMaker.CustomSkin.GetStyle("popup").CalcScreenSize(zero);
Vector2 val6 = new Vector2((float)Screen.width, (float)Screen.height) - s_searchablePopupWindow.pos;
s_searchablePopupWindow.size = Vector2.Min(val5, val6);
}
s_searchablePopupWindow.SetSearchTerms(searchTerms);
s_searchablePopupWindow.label = label;
s_searchablePopupWindow.displayOptions = displayOptions;
WindowInvoker.Add(s_searchablePopupWindow);
}
}
return result;
}
}
}
namespace ValheimTooler
{
public class EntryPoint : MonoBehaviour
{
public static readonly int s_boxSpacing = 30;
private Rect _valheimToolerRect;
public static bool s_showMainWindow = true;
private bool _wasMainWindowShowed;
public static bool s_showItemGiver = false;
private WindowToolbar _windowToolbar;
private readonly string[] _toolbarChoices = new string[4] { "$vt_toolbar_player", "$vt_toolbar_entities", "$vt_toolbar_terrain_shaper", "$vt_toolbar_misc" };
private string _version;
public void Start()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
_valheimToolerRect = new Rect(ConfigManager.s_mainWindowPosition.Value.x, ConfigManager.s_mainWindowPosition.Value.y, 800f, 300f);
s_showMainWindow = ConfigManager.s_showAtStartup.Value;
PlayerHacks.Start();
EntitiesItemsHacks.Start();
ItemGiver.Start();
MiscHacks.Start();
ESP.Start();
TerrainShaper.Start();
_version = Assembly.GetExecutingAssembly().GetName().Version.ToString();
}
public void Update()
{
if (ConfigManager.s_toggleInterfaceKey.Value.IsDown())
{
s_showMainWindow = !s_showMainWindow;
if (s_showMainWindow && (Object)(object)GameCamera.instance != (Object)null)
{
GameCamera.instance.SetFieldValue("m_mouseCapture", value: false);
GameCamera.instance.CallMethod("UpdateMouseCapture");
}
}
PlayerHacks.Update();
EntitiesItemsHacks.Update();
ItemGiver.Update();
MiscHacks.Update();
ESP.Update();
TerrainShaper.Update();
}
public void OnGUI()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
GUI.skin = InterfaceMaker.CustomSkin;
if (s_showMainWindow)
{
_valheimToolerRect = GUILayout.Window(1001, _valheimToolerRect, new WindowFunction(ValheimToolerWindow), VTLocalization.instance.Localize("$vt_main_title (v" + _version + ")"), (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Height(10f),
GUILayout.Width(10f)
});
if (s_showItemGiver)
{
ItemGiver.DisplayGUI();
}
_wasMainWindowShowed = true;
ConfigManager.s_mainWindowPosition.Value = ((Rect)(ref _valheimToolerRect)).position;
}
else if (_wasMainWindowShowed)
{
if ((Object)(object)GameCamera.instance != (Object)null)
{
GameCamera.instance.SetFieldValue("m_mouseCapture", value: true);
GameCamera.instance.CallMethod("UpdateMouseCapture");
}
_wasMainWindowShowed = false;
}
ESP.DisplayGUI();
}
private void ValheimToolerWindow(int windowID)
{
GUILayout.Space(10f);
_windowToolbar = (WindowToolbar)GUILayout.Toolbar((int)_windowToolbar, _toolbarChoices.Select((string choice) => VTLocalization.instance.Localize(choice)).ToArray(), Array.Empty<GUILayoutOption>());
switch (_windowToolbar)
{
case WindowToolbar.PLAYER:
PlayerHacks.DisplayGUI();
break;
case WindowToolbar.ENTITIES_ITEMS:
EntitiesItemsHacks.DisplayGUI();
break;
case WindowToolbar.TERRAIN_SHAPER:
TerrainShaper.DisplayGUI();
break;
case WindowToolbar.MISC:
MiscHacks.DisplayGUI();
break;
}
GUI.DragWindow();
}
}
internal class Loader
{
private static GameObject s_entryPoint = null;
private static readonly Harmony s_harmony = new Harmony("ValheimTooler");
public static void Init()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if ((Object)(object)s_entryPoint == (Object)null)
{
RunPatches();
s_entryPoint = new GameObject();
s_entryPoint.AddComponent<EntryPoint>();
s_entryPoint.AddComponent<RapidGUIBehaviour>();
Object.DontDestroyOnLoad((Object)(object)s_entryPoint);
}
}
private static void RunPatches()
{
s_harmony.PatchAll();
}
public static void Unload()
{
_Unload();
}
private static void _Unload()
{
Object.Destroy((Object)(object)s_entryPoint);
s_harmony.UnpatchSelf();
}
}
}
namespace ValheimTooler.Utils
{
public static class ConfigManager
{
private static readonly ConfigFile s_settingsFile;
private static readonly ConfigFile s_internalFile;
private static readonly string s_configurationPath;
private const string SettingsFileName = "valheimtooler_settings.cfg";
private const string InternalFileName = "valheimtooler_internal.cfg";
public static ConfigEntry<KeyboardShortcut> s_toggleInterfaceKey;
public static ConfigEntry<bool> s_showAtStartup;
public static ConfigEntry<string> s_language;
public static ConfigEntry<KeyboardShortcut> s_godModeShortCut;
public static ConfigEntry<KeyboardShortcut> s_unlimitedStaminaShortcut;
public static ConfigEntry<KeyboardShortcut> s_flyModeShortcut;
public static ConfigEntry<KeyboardShortcut> s_ghostModeShortcut;
public static ConfigEntry<KeyboardShortcut> s_noPlacementCostShortcut;
public static ConfigEntry<KeyboardShortcut> s_inventoryInfiniteWeightShortcut;
public static ConfigEntry<KeyboardShortcut> s_instantCraftShortcut;
public static ConfigEntry<KeyboardShortcut> s_guardianPowerAllShortcut;
public static ConfigEntry<KeyboardShortcut> s_healAllShortcut;
public static ConfigEntry<KeyboardShortcut> s_removeAllDropShortcut;
public static ConfigEntry<KeyboardShortcut> s_terrainShapeShortcut;
public static ConfigEntry<KeyboardShortcut> s_terrainLevelShortcut;
public static ConfigEntry<KeyboardShortcut> s_terrainLowerShortcut;
public static ConfigEntry<KeyboardShortcut> s_terrainRaiseShortcut;
public static ConfigEntry<KeyboardShortcut> s_terrainResetShortcut;
public static ConfigEntry<KeyboardShortcut> s_terrainSmoothShortcut;
public static ConfigEntry<KeyboardShortcut> s_terrainPaintShortcut;
public static ConfigEntry<KeyboardShortcut> s_espPlayersShortcut;
public static ConfigEntry<KeyboardShortcut> s_espMonstersShortcut;
public static ConfigEntry<KeyboardShortcut> s_espDroppedItemsShortcut;
public static ConfigEntry<KeyboardShortcut> s_espDepositsShortcut;
public static ConfigEntry<KeyboardShortcut> s_espPickablesShortcut;
public static ConfigEntry<Vector2> s_mainWindowPosition;
public static ConfigEntry<Vector2> s_itemGiverWindowPosition;
public static ConfigEntry<bool> s_permanentPins;
public static ConfigEntry<bool> s_espRadiusEnabled;
public static ConfigEntry<float> s_espRadius;
static ConfigManager()
{
//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
//IL_04d5: Unknown result type (might be due to invalid IL or missing references)
string path = Path.Combine(Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName), "config_vt.path");
string path2 = "";
if (File.Exists(path))
{
path2 = Path.GetFullPath(File.ReadAllText(path));
if (!Directory.Exists(path2))
{
ZLog.Log((object)"[ValheimTooler - ConfigManager] Path given in config_vt.path file is incorrect.");
path2 = "";
}
}
else
{
ZLog.Log((object)"[ValheimTooler - ConfigManager] Failed to find config_vt.path file.");
}
s_configurationPath = path2;
string configPath = Path.Combine(s_configurationPath, "valheimtooler_settings.cfg");
string configPath2 = Path.Combine(s_configurationPath, "valheimtooler_internal.cfg");
s_settingsFile = new ConfigFile(configPath, saveOnInit: true);
s_internalFile = new ConfigFile(configPath2, saveOnInit: true);
s_toggleInterfaceKey = s_settingsFile.Bind("General", "ToggleInterfaceKey", new KeyboardShortcut((KeyCode)127), "Which key will show/hide the tool.");
s_showAtStartup = s_settingsFile.Bind("General", "ShowAtStartup", defaultValue: true, "Choose whether or not to display the tool at startup.");
s_language = s_settingsFile.Bind("General", "Language", "Auto", new ConfigDescription("Tool language, in auto the language is chosen according to the game language.", new AcceptableValueList<string>("Auto", "French", "English")));
s_godModeShortCut = s_settingsFile.Bind("Shortcuts", "GodMode", default(KeyboardShortcut), "The shortcut to use the god mode feature");
s_unlimitedStaminaShortcut = s_settingsFile.Bind("Shortcuts", "UnlimitedStamina", default(KeyboardShortcut), "The shortcut to use the unlimited stamina feature");
s_flyModeShortcut = s_settingsFile.Bind("Shortcuts", "FlyMode", default(KeyboardShortcut), "The shortcut to use the fly mode feature");
s_ghostModeShortcut = s_settingsFile.Bind("Shortcuts", "GhostMode", default(KeyboardShortcut), "The shortcut to use the ghost mode feature");
s_noPlacementCostShortcut = s_settingsFile.Bind("Shortcuts", "NoPlacementCost", default(KeyboardShortcut), "The shortcut to use the no placement cost feature");
s_inventoryInfiniteWeightShortcut = s_settingsFile.Bind("Shortcuts", "InventoryInfiniteWeight", default(KeyboardShortcut), "The shortcut to use the inventory with infinite weight feature");
s_instantCraftShortcut = s_settingsFile.Bind("Shortcuts", "InstantCraft", default(KeyboardShortcut), "The shortcut to use the instant craft feature");
s_guardianPowerAllShortcut = s_settingsFile.Bind("Shortcuts", "GuardianPowerAllPlayers", default(KeyboardShortcut), "The shortcut to give all players the selected guardian power");
s_healAllShortcut = s_settingsFile.Bind("Shortcuts", "HealAllPlayers", default(KeyboardShortcut), "Shortcut to heal all the players");
s_removeAllDropShortcut = s_settingsFile.Bind("Shortcuts", "RemoveAllDrops", default(KeyboardShortcut), "The shortcut to use the remove all drops feature");
s_terrainShapeShortcut = s_settingsFile.Bind("Shortcuts", "TerrainChangeShape", default(KeyboardShortcut), "");
s_terrainLevelShortcut = s_settingsFile.Bind("Shortcuts", "TerrainLevel", default(KeyboardShortcut), "");
s_terrainLowerShortcut = s_settingsFile.Bind("Shortcuts", "TerrainLower", default(KeyboardShortcut), "");
s_terrainRaiseShortcut = s_settingsFile.Bind("Shortcuts", "TerrainRaise", default(KeyboardShortcut), "");
s_terrainResetShortcut = s_settingsFile.Bind("Shortcuts", "TerrainReset", default(KeyboardShortcut), "");
s_terrainSmoothShortcut = s_settingsFile.Bind("Shortcuts", "TerrainSmooth", default(KeyboardShortcut), "");
s_terrainPaintShortcut = s_settingsFile.Bind("Shortcuts", "TerrainPaint", default(KeyboardShortcut), "");
s_espPlayersShortcut = s_settingsFile.Bind("Shortcuts", "ESPPlayers", default(KeyboardShortcut), "The shortcut to show/hide the ESP for players");
s_espMonstersShortcut = s_settingsFile.Bind("Shortcuts", "ESPMonsters", default(KeyboardShortcut), "The shortcut to show/hide the ESP for monsters");
s_espDroppedItemsShortcut = s_settingsFile.Bind("Shortcuts", "ESPDroppedItems", default(KeyboardShortcut), "The shortcut to show/hide the ESP for dropped items");
s_espDepositsShortcut = s_settingsFile.Bind("Shortcuts", "ESPDeposits", default(KeyboardShortcut), "The shortcut to show/hide the ESP for deposits");
s_espPickablesShortcut = s_settingsFile.Bind("Shortcuts", "ESPPickables", default(KeyboardShortcut), "The shortcut to show/hide the ESP for pickables");
s_mainWindowPosition = s_internalFile.Bind<Vector2>("Internal", "MainWindowPosition", new Vector2(5f, 5f));
s_itemGiverWindowPosition = s_internalFile.Bind<Vector2>("Internal", "ItemGiverPosition", new Vector2((float)(Screen.width - 400), 5f));
s_permanentPins = s_internalFile.Bind("Internal", "PermanentPins", defaultValue: false);
s_espRadiusEnabled = s_internalFile.Bind("Internal", "RadiusEnabled", defaultValue: false);
s_espRadius = s_internalFile.Bind("Internal", "RadiusValue", 5f);
s_settingsFile.OrphanedEntries.Clear();
s_internalFile.OrphanedEntries.Clear();
s_settingsFile.Save();
s_internalFile.Save();
}
}
public class VTLocalization
{
public static readonly string s_cheatOn = "$vt_cheat_on";
public static readonly string s_cheatOff = "$vt_cheat_off";
private static VTLocalization s_instance;
private static readonly char[] s_endChars = " (){}[]+-!?/\\\\&%,.:-=<>\n".ToCharArray();
private Dictionary<string, string> m_translations = new Dictionary<string, string>();
public static VTLocalization instance
{
get
{
if (s_instance == null)
{
Initialize();
}
return s_instance;
}
}
private static void Initialize()
{
if (s_instance == null)
{
s_instance = new VTLocalization();
}
}
private VTLocalization()
{
SetupLanguage("English");
string value = ConfigManager.s_language.Value;
if (value == "Auto")
{
string @string = PlayerPrefs.GetString("language", "");
if (@string.Length > 0)
{
SetupLanguage(@string);
}
}
else if (value != "English")
{
SetupLanguage(value);
}
}
public string Localize(string text)
{
StringBuilder stringBuilder = new StringBuilder();
int num = 0;
string word;
int wordStart;
int wordEnd;
while (FindNextWord(text, num, out word, out wordStart, out wordEnd))
{
stringBuilder.Append(text.Substring(num, wordStart - num));
stringBuilder.Append(Translate(word));
num = wordEnd;
}
stringBuilder.Append(text.Substring(num));
return stringBuilder.ToString();
}
private bool FindNextWord(string text, int startIndex, out string word, out int wordStart, out int wordEnd)
{
if (startIndex >= text.Length - 1)
{
word = null;
wordStart = -1;
wordEnd = -1;
return false;
}
wordStart = text.IndexOf('$', startIndex);
if (wordStart != -1)
{
int num = text.IndexOfAny(s_endChars, wordStart);
if (num != -1)
{
word = text.Substring(wordStart + 1, num - wordStart - 1);
wordEnd = num;
}
else
{
word = text.Substring(wordStart + 1);
wordEnd = text.Length;
}
return true;
}
word = null;
wordEnd = -1;
return false;
}
private string Translate(string word)
{
if (word.StartsWith("KEY_"))
{
string bindingName = word.Substring(4);
return GetBoundKeyString(bindingName);
}
if (m_translations.TryGetValue(word, out var value))
{
return value;
}
return "[" + word + "]";
}
public string GetBoundKeyString(string bindingName)
{
string boundKeyString = ZInput.instance.GetBoundKeyString(bindingName, false);
if (boundKeyString.Length > 0 && boundKeyString[0] == '$' && m_translations.TryGetValue(boundKeyString.Substring(1), out var value))
{
return value;
}
return boundKeyString;
}
private void AddWord(string key, string text)
{
m_translations.Remove(key);
m_translations.Add(key, text);
}
private void Clear()
{
m_translations.Clear();
}
public bool SetupLanguage(string language)
{
if (!LoadCFG(language))
{
return false;
}
return true;
}
public bool LoadCFG(string language)
{
byte[] embeddedResource = ResourceUtils.GetEmbeddedResource("Resources.Localization.translations.cfg");
if (embeddedResource == null)
{
ZLog.Log((object)"Failed to load the translation file!");
return false;
}
Configuration val = Configuration.LoadFromString(Encoding.UTF8.GetString(embeddedResource, 0, embeddedResource.Length));
if (!val.Contains(language))
{
ZLog.Log((object)("Failed to find language: " + language));
return false;
}
foreach (Setting item in val[language])
{
AddWord(((ConfigurationElement)item).Name, item.StringValue);
}
return true;
}
}
public static class ReflectionExtensions
{
public static T GetFieldValue<T>(this object obj, string name)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
return (T)(obj.GetType().GetField(name, bindingAttr)?.GetValue(obj));
}
public static void SetFieldValue<T>(this object obj, string name, T value)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
obj.GetType().GetField(name, bindingAttr)?.SetValue(obj, value);
}
public static object CallMethod(this object obj, string methodName, params object[] args)
{
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
MethodInfo method = obj.GetType().GetMethod(methodName, bindingAttr);
if (method != null)
{
return method.Invoke(obj, args);
}
return null;
}
public static object CallStaticMethod<T>(string methodName, params object[] args) where T : new()
{
BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy;
MethodInfo method = typeof(T).GetMethod(methodName, bindingAttr);
if (method != null)
{
return method.Invoke(null, args);
}
return null;
}
}
public static class ResourceUtils
{
private static Dictionary<string, GameObject> s_cachedPrefabs = new Dictionary<string, GameObject>();
public static byte[] ReadAllBytes(this Stream input)
{
byte[] array = new byte[16384];
using MemoryStream memoryStream = new MemoryStream();
int count;
while ((count = input.Read(array, 0, array.Length)) > 0)
{
memoryStream.Write(array, 0, count);
}
return memoryStream.ToArray();
}
public static byte[] GetEmbeddedResource(string resourceFileName, Assembly containingAssembly = null)
{
if (containingAssembly == null)
{
containingAssembly = Assembly.GetCallingAssembly();
}
string name = containingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(resourceFileName));
using Stream input = containingAssembly.GetManifestResourceStream(name);
byte[] array = input.ReadAllBytes();
if (array.Length == 0)
{
Debug.LogWarning((object)string.Format("The resource %1 was not found", resourceFileName));
}
return array;
}
public static Texture2D LoadTexture(byte[] texData)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Expected O, but got Unknown
Texture2D val = new Texture2D(1, 1, (TextureFormat)5, false);
MethodInfo method = typeof(Texture2D).GetMethod("LoadImage", new Type[1] { typeof(byte[]) });
if (method != null)
{
method.Invoke(val, new object[1] { texData });
}
else
{
Type? type = Type.GetType("UnityEngine.ImageConversion, UnityEngine.ImageConversionModule");
if (type == null)
{
throw new ArgumentNullException("converter");
}
MethodInfo? method2 = type.GetMethod("LoadImage", new Type[2]
{
typeof(Texture2D),
typeof(byte[])
});
if (method2 == null)
{
throw new ArgumentNullException("converterMethod");
}
method2.Invoke(null, new object[2] { val, texData });
}
return val;
}
public static GameObject GetHiddenPrefab(string name)
{
if (s_cachedPrefabs.TryGetValue(name.ToLower(), out var value) && (Object)(object)value != (Object)null)
{
return value;
}
foreach (GameObject item in from t in Resources.FindObjectsOfTypeAll<Transform>()
where (Object)(object)t.parent == (Object)null
select t into x
select ((Component)x).gameObject)
{
if (((Object)item).name.Equals(name, StringComparison.OrdinalIgnoreCase))
{
if (s_cachedPrefabs.ContainsKey(name.ToLower()))
{
s_cachedPrefabs.Remove(name.ToLower());
}
s_cachedPrefabs.Add(name.ToLower(), item);
return item;
}
}
return null;
}
}
}
namespace ValheimTooler.UI
{
internal class InterfaceMaker
{
private static GUISkin s_customSkin;
private static Texture2D s_winBackground;
private static Texture2D s_winTitleBackground;
private static Texture2D s_boxBackground;
private static Texture2D s_toggleOffBackground;
private static Texture2D s_toggleOnBackground;
private static Texture2D s_buttonNormalBackground;
private static Texture2D s_buttonHoverBackground;
private static Texture2D s_buttonActiveBackground;
private static Texture2D s_buttonActiveNormalBackground;
private static Texture2D s_buttonActiveHoverBackground;
private static Texture2D s_buttonActiveActiveBackground;
private static Texture2D s_fieldBackground;
private static Texture2D s_scrollBackground;
private static Texture2D s_scrollThumbBackground;
private static Texture2D s_flatButtonNormalBackground;
private static Texture2D s_flatButtonHoverBackground;
private static Texture2D s_flatButtonActiveBackground;
private static Font s_font;
private static GUISkin s_oldSkin;
public static GUISkin CustomSkin
{
get
{
if ((Object)(object)s_customSkin == (Object)null)
{
try
{
s_customSkin = CreateSkin();
}
catch (Exception ex)
{
ZLog.Log((object)("Could not load custom GUISkin - " + ex.Message));
s_customSkin = GUI.skin;
}
}
return s_customSkin;
}
}
public static GUISkin OldSkin => s_oldSkin;
private static GUISkin CreateSkin()
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Expected O, but got Unknown
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: 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_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0350: Unknown result type (might be due to invalid IL or missing references)
//IL_037a: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
//IL_03f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0401: Expected O, but got Unknown
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Expected O, but got Unknown
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Expected O, but got Unknown
//IL_0506: Unknown result type (might be due to invalid IL or missing references)
//IL_0530: Unknown result type (might be due to invalid IL or missing references)
//IL_055a: Unknown result type (might be due to invalid IL or missing references)
//IL_0584: Unknown result type (might be due to invalid IL or missing references)
//IL_05ae: Unknown result type (might be due to invalid IL or missing references)
//IL_05d8: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_062c: Unknown result type (might be due to invalid IL or missing references)
//IL_0640: Unknown result type (might be due to invalid IL or missing references)
//IL_064a: Expected O, but got Unknown
//IL_0650: Unknown result type (might be due to invalid IL or missing references)
//IL_068a: Unknown result type (might be due to invalid IL or missing references)
//IL_068f: Unknown result type (might be due to invalid IL or missing references)
//IL_0690: Unknown result type (might be due to invalid IL or missing references)
//IL_069a: Expected O, but got Unknown
//IL_069a: Unknown result type (might be due to invalid IL or missing references)
//IL_06a6: Expected O, but got Unknown
//IL_06cf: Unknown result type (might be due to invalid IL or missing references)
//IL_06d9: Expected O, but got Unknown
//IL_06e3: Unknown result type (might be due to invalid IL or missing references)
//IL_06e8: Unknown result type (might be due to invalid IL or missing references)
//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
//IL_06f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0702: Expected O, but got Unknown
s_oldSkin = GUI.skin;
GUISkin val = Object.Instantiate<GUISkin>(GUI.skin);
Object.DontDestroyOnLoad((Object)(object)val);
LoadTextures();
val.font = s_font;
val.label.normal.textColor = Color.gray;
val.box.onNormal.background = null;
val.box.normal.background = s_boxBackground;
val.box.normal.textColor = Color.gray;
RectOffset padding = val.box.padding;
padding.top += 7;
RectOffset padding2 = val.box.padding;
padding2.bottom += 7;
RectOffset padding3 = val.box.padding;
padding3.left += 7;
RectOffset padding4 = val.box.padding;
padding4.right += 7;
val.window.border = new RectOffset(80, 80, 80, 20);
RectOffset padding5 = val.window.padding;
padding5.top += 5;
val.window.onNormal.background = null;
val.window.normal.background = s_winTitleBackground;
val.window.normal.textColor = Color.white;
val.button.normal.textColor = Color.white;
val.button.normal.background = s_buttonNormalBackground;
val.button.hover.textColor = Color.white;
val.button.hover.background = s_buttonHoverBackground;
val.button.active.textColor = Color.white;
val.button.active.background = s_buttonActiveBackground;
val.button.onNormal.textColor = Color.white;
val.button.onNormal.background = s_buttonActiveNormalBackground;
val.button.onHover.textColor = Color.white;
val.button.onHover.background = s_buttonActiveHoverBackground;
val.button.onActive.textColor = Color.white;
val.button.onActive.background = s_buttonActiveActiveBackground;
val.button.font = s_font;
val.button.wordWrap = false;
val.horizontalSliderThumb.normal.background = s_buttonNormalBackground;
val.horizontalSliderThumb.hover.background = s_buttonHoverBackground;
val.horizontalSliderThumb.active.background = s_buttonActiveBackground;
val.horizontalSliderThumb.onNormal.background = s_buttonActiveNormalBackground;
val.horizontalSliderThumb.onHover.background = s_buttonActiveHoverBackground;
val.horizontalSliderThumb.onActive.background = s_buttonActiveActiveBackground;
val.horizontalSlider.normal.background = s_scrollBackground;
val.toggle.normal.textColor = Color.gray;
val.toggle.normal.background = s_toggleOffBackground;
val.toggle.onNormal.textColor = Color.gray;
val.toggle.onNormal.background = s_toggleOnBackground;
val.toggle.hover.textColor = Color.gray;
val.toggle.hover.background = s_toggleOffBackground;
val.toggle.onHover.textColor = Color.gray;
val.toggle.onHover.background = s_toggleOnBackground;
val.toggle.active.textColor = Color.gray;
val.toggle.active.background = s_toggleOnBackground;
val.toggle.onActive.textColor = Color.gray;
val.toggle.onActive.background = s_toggleOffBackground;
val.toggle.border = new RectOffset(0, 0, 0, 0);
val.toggle.overflow = new RectOffset(0, 0, 0, 0);
val.toggle.imagePosition = (ImagePosition)2;
val.toggle.padding = new RectOffset(0, 0, 0, 0);
val.toggle.fixedWidth = 30f;
val.toggle.fixedHeight = 30f;
RectOffset padding6 = val.button.padding;
int top = (val.button.padding.bottom = 6);
padding6.top = top;
RectOffset padding7 = val.button.padding;
top = (val.button.padding.left = 5);
padding7.left = top;
RectOffset border = val.button.border;
top = (val.button.border.top = 0);
border.bottom = top;
RectOffset border2 = val.button.border;
top = (val.button.border.right = 10);
border2.left = top;
val.textField.normal.background = s_fieldBackground;
val.textField.normal.textColor = Color.white;
val.textField.onNormal.background = s_fieldBackground;
val.textField.onNormal.textColor = Color.white;
val.textField.hover.background = s_fieldBackground;
val.textField.hover.textColor = Color.white;
val.textField.onHover.background = s_fieldBackground;
val.textField.onHover.textColor = Color.white;
val.textField.active.background = s_fieldBackground;
val.textField.active.textColor = Color.white;
val.textField.onActive.background = s_fieldBackground;
val.textField.onActive.textColor = Color.white;
val.textField.focused.background = s_fieldBackground;
val.textField.focused.textColor = Color.white;
val.textField.onFocused.background = s_fieldBackground;
val.textField.onFocused.textColor = Color.white;
val.textField.padding = new RectOffset(8, 8, 5, 5);
val.settings.cursorColor = Color.white;
val.verticalScrollbar.normal.background = s_scrollBackground;
val.verticalScrollbarThumb.normal.background = s_scrollThumbBackground;
GUIStyle val2 = new GUIStyle(val.box)
{
border = new RectOffset(),
name = "popup"
};
GUIStyleState normal = val2.normal;
Texture2D background = (val2.hover.background = s_winBackground);
normal.background = background;
val2.border = new RectOffset(30, 30, 30, 30);
GUIStyle val4 = new GUIStyle(OldSkin.label)
{
wordWrap = false,
alignment = (TextAnchor)4,
name = "flatButton"
};
val4.normal.background = s_flatButtonNormalBackground;
val4.hover.background = s_flatButtonHoverBackground;
val4.onNormal.background = s_flatButtonActiveBackground;
val.customStyles = (GUIStyle[])(object)new GUIStyle[2] { val2, val4 };
return val;
}
private static void LoadTextures()
{
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Expected O, but got Unknown
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_020e: Expected O, but got Unknown
//IL_022f: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: Unknown result type (might be due to invalid IL or missing references)
//IL_0254: Unknown result type (might be due to invalid IL or missing references)
//IL_025e: Expected O, but got Unknown
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
s_winBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.window.png"));
Object.DontDestroyOnLoad((Object)(object)s_winBackground);
s_winTitleBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.window_title.png"));
Object.DontDestroyOnLoad((Object)(object)s_winTitleBackground);
s_boxBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.box.png"));
Object.DontDestroyOnLoad((Object)(object)s_boxBackground);
s_toggleOffBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.toggle_off.png"));
Object.DontDestroyOnLoad((Object)(object)s_toggleOffBackground);
s_toggleOnBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.toggle_on.png"));
Object.DontDestroyOnLoad((Object)(object)s_toggleOnBackground);
s_buttonNormalBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_normal.png"));
Object.DontDestroyOnLoad((Object)(object)s_buttonNormalBackground);
s_buttonHoverBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_hover.png"));
Object.DontDestroyOnLoad((Object)(object)s_buttonHoverBackground);
s_buttonActiveBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active.png"));
Object.DontDestroyOnLoad((Object)(object)s_buttonActiveBackground);
s_buttonActiveNormalBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active_normal.png"));
Object.DontDestroyOnLoad((Object)(object)s_buttonActiveNormalBackground);
s_buttonActiveHoverBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active_hover.png"));
Object.DontDestroyOnLoad((Object)(object)s_buttonActiveHoverBackground);
s_buttonActiveActiveBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.button_active_active.png"));
Object.DontDestroyOnLoad((Object)(object)s_buttonActiveActiveBackground);
s_fieldBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.field.png"));
Object.DontDestroyOnLoad((Object)(object)s_fieldBackground);
s_scrollBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.scroll_background.png"));
Object.DontDestroyOnLoad((Object)(object)s_scrollBackground);
s_scrollThumbBackground = ResourceUtils.LoadTexture(ResourceUtils.GetEmbeddedResource("Resources.scroll_thumb.png"));
Object.DontDestroyOnLoad((Object)(object)s_scrollThumbBackground);
s_flatButtonNormalBackground = new Texture2D(1, 1);
s_flatButtonNormalBackground.SetPixels((Color[])(object)new Color[1]
{
new Color(0.5f, 0.5f, 0.5f, 0.5f)
});
s_flatButtonNormalBackground.Apply();
Object.DontDestroyOnLoad((Object)(object)s_flatButtonNormalBackground);
s_flatButtonHoverBackground = new Texture2D(1, 1);
s_flatButtonHoverBackground.SetPixels((Color[])(object)new Color[1]
{
new Color(0.5f, 0.5f, 0.5f, 0.2f)
});
s_flatButtonHoverBackground.Apply();
Object.DontDestroyOnLoad((Object)(object)s_flatButtonHoverBackground);
s_flatButtonActiveBackground = new Texture2D(1, 1);
s_flatButtonActiveBackground.SetPixels((Color[])(object)new Color[1]
{
new Color(0.9f, 0.5f, 0.1f, 0.5f)
});
s_flatButtonActiveBackground.Apply();
Object.DontDestroyOnLoad((Object)(object)s_flatButtonActiveBackground);
s_font = ((IEnumerable<Font>)(Resources.FindObjectsOfTypeAll(typeof(Font)) as Font[])).FirstOrDefault((Func<Font, bool>)((Font f) => ((Object)f).name.Equals("AveriaSerifLibre-Bold")));
if ((Object)(object)s_font == (Object)null)
{
ZLog.Log((object)"Error while loading font!");
}
}
}
public static class Utils
{
public static string ToggleButtonLabel(string labelCode, bool condition, KeyboardShortcut? shortcut)
{
return ToggleButtonLabelCustom(labelCode, condition, VTLocalization.s_cheatOn, VTLocalization.s_cheatOff, shortcut);
}
public static string ToggleButtonLabel(string labelCode, bool condition)
{
return ToggleButtonLabel(labelCode, condition, null);
}
public static string ToggleButtonLabelCustom(string labelCode, bool condition, string activeLabelCode, string normalLabelCode)
{
return ToggleButtonLabelCustom(labelCode, condition, activeLabelCode, normalLabelCode, null);
}
public static string ToggleButtonLabelCustom(string labelCode, bool condition, string activeLabelCode, string normalLabelCode, KeyboardShortcut? shortcut)
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
string text = VTLocalization.instance.Localize(labelCode + " : " + (condition ? activeLabelCode : normalLabelCode));
if (shortcut.HasValue && (int)shortcut.Value.MainKey != 0)
{
text = text + " [" + shortcut.Value.ToString() + "]";
}
return text;
}
public static string LabelWithShortcut(string labelCode, KeyboardShortcut? shortcut)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
string text = VTLocalization.instance.Localize(labelCode);
if (shortcut.HasValue && (int)shortcut.Value.MainKey != 0)
{
text = text + " [" + shortcut.Value.ToString() + "]";
}
return text;
}
}
public static class SpriteManager
{
private static readonly Dictionary<string, Texture2D> s_atlasCache;
static SpriteManager()
{
s_atlasCache = new Dictionary<string, Texture2D>();
}
public static Texture2D TextureFromSprite(Sprite sprite, bool resize = true)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
Rect val = sprite.rect;
if (((Rect)(ref val)).width == (float)((Texture)sprite.texture).width)
{
return sprite.texture;
}
Texture2D val2;
if (s_atlasCache.ContainsKey(((Object)sprite.texture).name))
{
val2 = s_atlasCache[((Object)sprite.texture).name];
}
else
{
val2 = DuplicateTexture(sprite.texture);
s_atlasCache.Add(((Object)sprite.texture).name, val2);
}
val = sprite.rect;
int num = (int)((Rect)(ref val)).width;
val = sprite.rect;
Texture2D val3 = new Texture2D(num, (int)((Rect)(ref val)).height);
Texture2D obj = val2;
val = sprite.textureRect;
int num2 = Mathf.CeilToInt(((Rect)(ref val)).x);
val = sprite.textureRect;
int num3 = Mathf.CeilToInt(((Rect)(ref val)).y);
val = sprite.textureRect;
int num4 = Mathf.CeilToInt(((Rect)(ref val)).width);
val = sprite.textureRect;
Color[] pixels = obj.GetPixels(num2, num3, num4, Mathf.CeilToInt(((Rect)(ref val)).height));
val3.SetPixels(pixels);
val3.Apply();
if (resize && (((Texture)val3).width > 200 || ((Texture)val3).height > 200))
{
val3.Reinitialize(60, 60);
}
return val3;
}
public static Texture2D DuplicateTexture(Texture2D source)
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Expected O, but got Unknown
RenderTexture temporary = RenderTexture.GetTemporary(((Texture)source).width, ((Texture)source).height, 0, (RenderTextureFormat)7, (RenderTextureReadWrite)1);
Graphics.Blit((Texture)(object)source, temporary);
RenderTexture active = RenderTexture.active;
RenderTexture.active = temporary;
Texture2D val = new Texture2D(((Texture)source).width, ((Texture)source).height);
val.ReadPixels(new Rect(0f, 0f, (float)((Texture)temporary).width, (float)((Texture)temporary).height), 0, 0);
val.Apply();
RenderTexture.active = active;
RenderTexture.ReleaseTemporary(temporary);
return val;
}
}
}
namespace ValheimTooler.Properties
{
[GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[DebuggerNonUserCode]
[CompilerGenerated]
public class Resources
{
private static ResourceManager resourceMan;
private static CultureInfo resourceCulture;
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static ResourceManager ResourceManager
{
get
{
if (resourceMan == null)
{
resourceMan = new ResourceManager("ValheimTooler.Properties.Resources", typeof(Resources).Assembly);
}
return resourceMan;
}
}
[EditorBrowsable(EditorBrowsableState.Advanced)]
public static CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
internal Resources()
{
}
}
}
namespace ValheimTooler.Patches
{
[HarmonyPatch(typeof(Inventory), "IsTeleportable")]
internal class AlwaysTeleportAllow
{
private static bool Prefix(ref bool __result)
{
if (PlayerHacks.s_bypassRestrictedTeleportable)
{
__result = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Destructible), "Start")]
internal class AutoPinResources
{
private static Random s_random = new Random();
private const string Chars = "0123456789";
private static void Postfix(ref Destructible __instance)
{
if (!MiscHacks.s_enableAutopinMap)
{
return;
}
HoverText component = ((Component)__instance).GetComponent<HoverText>();
if (Object.op_Implicit((Object)(object)component) && !((Object)(object)((Component)__instance).gameObject.GetComponent<PinnedObject>() != (Object)null) && component.m_text.ToLower().Contains("deposit"))
{
string text = new string((from s in Enumerable.Repeat("0123456789", 5)
select s[s_random.Next(s.Length)]).ToArray());
string text2 = component.GetHoverName() + " [VT" + text + "]";
((Component)__instance).gameObject.AddComponent<PinnedObject>().Init(text2);
ZLog.Log((object)("Pin candidate: " + text2));
}
}
}
[HarmonyPatch(typeof(Player), "EdgeOfWorldKill", new Type[] { typeof(float) })]
internal class EdgeMapKill
{
private static bool Prefix()
{
if ((Object)(object)Player.m_localPlayer != (Object)null && Player.m_localPlayer.VTInGodMode())
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Player), "UseStamina", new Type[] { typeof(float) })]
internal class InfiniteStamina
{
private static void Prefix(ref Player __instance, ref float v)
{
if (PlayerHacks.s_isInfiniteStaminaMe && (Object)(object)Player.m_localPlayer != (Object)null && __instance.GetPlayerID() == Player.m_localPlayer.GetPlayerID())
{
v = 0f;
}
}
}
[HarmonyPatch(typeof(InventoryGui), "UpdateRecipe", new Type[]
{
typeof(Player),
typeof(float)
})]
internal class InstantCraft
{
private static void Prefix(ref Player player, ref float dt)
{
if (PlayerHacks.s_instantCraft)
{
dt = 2f;
}
}
}
[HarmonyPatch(typeof(Inventory), "GetTotalWeight")]
internal class InventoryNoWeightLimit
{
private static bool Prefix(ref float __result)
{
if (PlayerHacks.s_inventoryNoWeightLimit)
{
__result = 0f;
return false;
}
return true;
}
}
internal class NoPlacementCostRepair
{
[HarmonyPatch(typeof(InventoryGui), "CanRepair", new Type[] { typeof(ItemData) })]
public class CanRepairPatch
{
private static bool Prefix(ref InventoryGui __instance, ref bool __result, ItemData item)
{
if ((Object)(object)Player.m_localPlayer == (Object)null)
{
return true;
}
bool fieldValue = Player.m_localPlayer.GetFieldValue<bool>("m_noPlacementCost");
if (fieldValue)
{
__result = fieldValue;
return false;
}
return true;
}
}
}
internal class DisableInputWhenInterfaceIsShowed
{
[HarmonyPatch(typeof(Player), "TakeInput")]
private class PlayerTakeInput
{
private static bool Prefix(ref bool __result)
{
if (EntryPoint.s_showMainWindow)
{
__result = false;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(PlayerController), "InInventoryEtc")]
private class PlayerControllerInInventoryEtc
{
private static bool Prefix(ref bool __result)
{
if (EntryPoint.s_showMainWindow)
{
__result = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(InventoryGrid), "OnLeftClick", new Type[] { typeof(UIInputHandler) })]
private class InventoryGridOnLeftClick
{
private static bool Prefix()
{
if (EntryPoint.s_showMainWindow)
{
return false;
}
return true;
}
}
[HarmonyPatch(typeof(InventoryGrid), "OnRightClick", new Type[] { typeof(UIInputHandler) })]
private class InventoryGridOnRightClick
{
private static bool Prefix()
{
if (EntryPoint.s_showMainWindow)
{
return false;
}
return true;
}
}
}
}
namespace ValheimTooler.Models
{
public class TPTarget
{
public enum TargetType
{
PlayerNet,
Player,
Peer,
MapPin
}
public readonly TargetType targetType;
public readonly PlayerInfo playerNet;
public readonly Player player;
public readonly ZNetPeer peer;
public readonly PinData minimapPin;
public string Name => targetType switch
{
TargetType.PlayerNet => playerNet.m_name,
TargetType.Player => player.GetPlayerName(),
TargetType.Peer => peer.m_playerName,
TargetType.MapPin => $"{minimapPin.m_name} ({minimapPin.m_type})",
_ => "",
};
public Vector3? Position
{
get
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
switch (targetType)
{
case TargetType.PlayerNet:
if (playerNet.m_publicPosition)
{
return playerNet.m_position;
}
return null;
case TargetType.Player:
return ((Component)player).transform.position;
case TargetType.Peer:
return null;
case TargetType.MapPin:
{
Vector3 pos = minimapPin.m_pos;
pos.y = Mathf.Clamp(pos.y, ZoneSystem.instance.m_waterLevel, ZoneSystem.instance.m_waterLevel);
return pos;
}
default:
return null;
}
}
}
public TPTarget(TargetType targetType, object target)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
this.targetType = targetType;
switch (targetType)
{
case TargetType.PlayerNet:
playerNet = (PlayerInfo)target;
break;
case TargetType.Player:
player = (Player)target;
break;
case TargetType.Peer:
peer = (ZNetPeer)target;
break;
case TargetType.MapPin:
minimapPin = (PinData)target;
break;
}
}
public override string ToString()
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
return targetType switch
{
TargetType.PlayerNet => "Player " + playerNet.m_name,
TargetType.Player => "Player " + player.GetPlayerName(),
TargetType.Peer => "Player " + peer.m_playerName,
TargetType.MapPin => $"Map pin: {minimapPin.m_name} ({minimapPin.m_type})",
_ => "Unknow",
};
}
}
}
namespace ValheimTooler.Models.Mono
{
internal class PinnedObject : MonoBehaviour
{
public PinData pin;
public void Init(string aName)
{
//IL_000c: 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_005e: 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)
pin = Minimap.instance.AddPin(((Component)this).transform.position, (PinType)3, aName, ConfigManager.s_permanentPins.Value, false, 0L, "");
ZLog.Log((object)$"Tracking: {aName} at {((Component)this).transform.position.x} {((Component)this).transform.position.y} {((Component)this).transform.position.z}");
}
private void OnDestroy()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (pin != null && (Object)(object)Minimap.instance != (Object)null && !ConfigManager.s_permanentPins.Value)
{
Minimap.instance.RemovePin(pin);
ZLog.Log((object)$"Removing: {pin.m_name} at {((Component)this).transform.position.x} {((Component)this).transform.position.y} {((Component)this).transform.position.z}");
}
}
}
}
namespace ValheimTooler.Core
{
public static class EntitiesItemsHacks
{
private static string s_entityQuantityText = "1";
private static int s_entityLevelIdx = 0;
private static int s_entityPrefabIdx = 0;
private static string s_entitySearchTerms = "";
private static string s_previousSearchTerms = "";
private static float s_updateTimer = 0f;
private static readonly float s_updateTimerInterval = 1.5f;
private static readonly List<string> s_entityLevels = new List<string>();
private static readonly List<string> s_entityPrefabs = new List<string>();
private static List<string> s_entityPrefabsFiltered = new List<string>();
private static int NameComparator(string a, string b)
{
return string.Compare(a, b, StringComparison.InvariantCultureIgnoreCase);
}
public static void Start()
{
for (int i = 1; i <= 5; i++)
{
s_entityLevels.Add(i.ToString());
}
}
public static void Update()
{
if (Time.time >= s_updateTimer && s_entityPrefabs.Count == 0)
{
if (Object.op_Implicit((Object)(object)ZNetScene.instance))
{
foreach (GameObject prefab in ZNetScene.instance.m_prefabs)
{
if (!((Object)prefab).name.Contains("_"))
{
s_entityPrefabs.Add(((Object)prefab).name);
}
}
s_entityPrefabs.Sort(NameComparator);
s_entityPrefabsFiltered = s_entityPrefabs;
}
s_updateTimer = Time.time + s_updateTimerInterval;
}
if (ConfigManager.s_removeAllDropShortcut.Value.IsDown())
{
RemoveAllDrops();
}
}
public static void DisplayGUI()
{
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_entities_spawn_title"), GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
GUILayout.Space((float)EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_entities_spawn_entity_name :"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_entityPrefabIdx = RGUI.SearchableSelectionPopup(s_entityPrefabIdx, s_entityPrefabsFiltered.ToArray(), ref s_entitySearchTerms);
SearchItem(s_entitySearchTerms);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_entities_spawn_quantity :"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_entityQuantityText = GUILayout.TextField(s_entityQuantityText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_entities_spawn_level :"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_entityLevelIdx = RGUI.SelectionPopup(s_entityLevelIdx, s_entityLevels.ToArray());
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_entities_spawn_button"), Array.Empty<GUILayoutOption>()) && int.TryParse(s_entityQuantityText, out var result) && int.TryParse(s_entityLevels[s_entityLevelIdx], out var result2) && result <= 100 && s_entityPrefabIdx < s_entityPrefabsFiltered.Count && s_entityPrefabIdx >= 0)
{
SpawnEntities(s_entityPrefabsFiltered[s_entityPrefabIdx], result2, result);
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_entities_drops_title"), GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
GUILayout.Space((float)EntryPoint.s_boxSpacing);
if (GUILayout.Button(ValheimTooler.UI.Utils.LabelWithShortcut("$vt_entities_drops_button", ConfigManager.s_removeAllDropShortcut.Value), Array.Empty<GUILayoutOption>()))
{
RemoveAllDrops();
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_entities_item_giver_title"), GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
GUILayout.Space((float)EntryPoint.s_boxSpacing);
if (GUILayout.Button(EntryPoint.s_showItemGiver ? VTLocalization.instance.Localize("$vt_entities_item_giver_button_hide") : VTLocalization.instance.Localize("$vt_entities_item_giver_button_show"), Array.Empty<GUILayoutOption>()))
{
EntryPoint.s_showItemGiver = !EntryPoint.s_showItemGiver;
}
GUILayout.EndVertical();
}
private static void SearchItem(string search)
{
if (s_previousSearchTerms.Equals(search))
{
return;
}
if (search.Length == 0)
{
s_entityPrefabsFiltered = s_entityPrefabs;
}
else
{
string searchLower = search.ToLower();
s_entityPrefabsFiltered = s_entityPrefabs.Where((string i) => i.ToLower().Contains(searchLower)).ToList();
}
s_previousSearchTerms = search;
}
private static void SpawnEntity(GameObject entityPrefab, int level)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)entityPrefab != (Object)null && (Object)(object)Player.m_localPlayer != (Object)null)
{
Vector3 val = Random.insideUnitSphere * 0.5f;
Character component = Object.Instantiate<GameObject>(entityPrefab, ((Component)Player.m_localPlayer).transform.position + ((Component)Player.m_localPlayer).transform.forward * 2f + Vector3.up + val, Quaternion.identity).GetComponent<Character>();
if ((Object)(object)component != (Object)null)
{
component.SetLevel(level);
}
}
}
private static void SpawnEntities(string entityPrefab, int level, int quantity)
{
if ((Object)(object)ZNetScene.instance == (Object)null)
{
return;
}
GameObject prefab = ZNetScene.instance.GetPrefab(entityPrefab);
if (!((Object)(object)prefab == (Object)null))
{
for (int i = 0; i < quantity; i++)
{
SpawnEntity(prefab, level);
}
}
}
private static void RemoveAllDrops()
{
ItemDrop[] array = Object.FindObjectsOfType<ItemDrop>();
foreach (ItemDrop val in array)
{
Fish component = ((Component)val).gameObject.GetComponent<Fish>();
if (!Object.op_Implicit((Object)(object)component) || component.IsOutOfWater())
{
ZNetView component2 = ((Component)val).GetComponent<ZNetView>();
if (Object.op_Implicit((Object)(object)component2) && component2.IsValid())
{
component2.Destroy();
}
}
}
}
}
public static class ItemGiver
{
private class InventoryItem
{
public GameObject itemPrefab;
public ItemDrop itemDrop;
public GUIContent guiContent;
public int variant;
public InventoryItem(GameObject itemPrefab, ItemDrop itemDrop, GUIContent guiContent, int variant)
{
this.itemPrefab = itemPrefab;
this.itemDrop = itemDrop;
this.guiContent = guiContent;
this.variant = variant;
}
}
private static Rect s_itemGiverRect;
private static Vector2 s_itemGiverScrollPosition;
private static readonly List<InventoryItem> s_items = new List<InventoryItem>();
private static List<InventoryItem> s_itemsFiltered = new List<InventoryItem>();
private static List<GUIContent> s_itemsGUIFiltered = new List<GUIContent>();
private static int s_selectedItem = 0;
private static string s_quantityItem = "1";
private static string s_qualityItem = "1";
private static string s_searchTerms = "";
private static string s_previousSearchTerms = "";
public static void Start()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Expected O, but got Unknown
s_itemGiverRect = new Rect(ConfigManager.s_itemGiverWindowPosition.Value.x, ConfigManager.s_itemGiverWindowPosition.Value.y, 400f, 400f);
if ((Object)(object)ObjectDB.instance == (Object)null)
{
return;
}
foreach (GameObject item2 in ObjectDB.instance.m_items)
{
ItemDrop component = item2.GetComponent<ItemDrop>();
ItemData itemData = component.m_itemData;
if (itemData != null && itemData.m_shared?.m_icons?.Length <= 0)
{
continue;
}
for (int i = 0; i < component.m_itemData.m_shared.m_icons.Length; i++)
{
try
{
GUIContent val = new GUIContent((Texture)(object)SpriteManager.TextureFromSprite(component.m_itemData.m_shared.m_icons[i]), Localization.instance.Localize(component.m_itemData.m_shared.m_name + ((i > 0) ? (" Variant " + i) : "")));
InventoryItem item = new InventoryItem(item2, component, val, i);
s_itemsGUIFiltered.Add(val);
s_items.Add(item);
s_itemsFiltered.Add(item);
}
catch
{
ZLog.Log((object)$"[ValheimTooler - ItemGiver] Failed to load item {component.m_itemData.m_shared.m_name} with variant {i}. This item will be ignored.");
}
}
}
}
public static void Update()
{
}
public static void DisplayGUI()
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
s_itemGiverRect = GUILayout.Window(1002, s_itemGiverRect, new WindowFunction(ItemGiverWindow), VTLocalization.instance.Localize("$vt_item_giver_title"), Array.Empty<GUILayoutOption>());
ConfigManager.s_itemGiverWindowPosition.Value = ((Rect)(ref s_itemGiverRect)).position;
}
public static void ItemGiverWindow(int windowID)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Expected O, but got Unknown
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_01f2: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Expected O, but got Unknown
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0211: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
//IL_02e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Unknown result type (might be due to invalid IL or missing references)
//IL_031e: Unknown result type (might be due to invalid IL or missing references)
//IL_0325: Unknown result type (might be due to invalid IL or missing references)
//IL_032c: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)ObjectDB.instance == (Object)null || ObjectDB.instance.m_items.Count == 0)
{
return;
}
GUIStyle val = new GUIStyle(GUI.skin.label);
val.normal.textColor = Color.white;
GUILayout.Space((float)EntryPoint.s_boxSpacing);
s_searchTerms = GUILayout.TextField(s_searchTerms, Array.Empty<GUILayoutOption>());
SearchItem(s_searchTerms);
s_itemGiverScrollPosition = GUILayout.BeginScrollView(s_itemGiverScrollPosition, GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(350f) });
s_selectedItem = GUILayout.SelectionGrid(s_selectedItem, s_itemsGUIFiltered.ToArray(), 4, InterfaceMaker.CustomSkin.GetStyle("flatButton"), Array.Empty<GUILayoutOption>());
GUILayout.EndScrollView();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_item_giver_quantity :"), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_quantityItem = GUILayout.TextField(s_quantityItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_item_giver_quality :"), val, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_qualityItem = GUILayout.TextField(s_qualityItem, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_item_giver_button"), Array.Empty<GUILayoutOption>()) && int.TryParse(s_quantityItem, out var result) && int.TryParse(s_qualityItem, out var result2))
{
Player.m_localPlayer.VTAddItemToInventory(((Object)s_itemsFiltered[s_selectedItem].itemPrefab).name, result, result2, s_itemsFiltered[s_selectedItem].variant);
}
if (GUI.tooltip != "")
{
GUIContent val2 = new GUIContent(GUI.tooltip);
Vector2 val3 = new GUIStyle(GUI.skin.textField).CalcSize(val2);
Vector2 val4 = default(Vector2);
if (Event.current.mousePosition.x + val3.x > ((Rect)(ref s_itemGiverRect)).width)
{
val4.x = Event.current.mousePosition.x - (Event.current.mousePosition.x + val3.x - ((Rect)(ref s_itemGiverRect)).width);
}
else
{
val4.x = Event.current.mousePosition.x;
}
if (Event.current.mousePosition.y + 30f + val3.y > ((Rect)(ref s_itemGiverRect)).height)
{
val4.y = Event.current.mousePosition.y + 30f - (Event.current.mousePosition.y + 30f + val3.y - ((Rect)(ref s_itemGiverRect)).height);
}
else
{
val4.y = Event.current.mousePosition.y + 30f;
}
GUI.Box(new Rect(val4.x, val4.y, val3.x, val3.y), val2, GUI.skin.textField);
}
GUI.DragWindow();
}
private static void SearchItem(string search)
{
search = search.ToLower();
if (s_previousSearchTerms.Equals(search))
{
return;
}
if (search.Length == 0)
{
s_itemsFiltered = s_items;
s_itemsGUIFiltered = s_itemsFiltered.Select((InventoryItem i) => i.guiContent).ToList();
}
else
{
s_itemsFiltered = s_items.Where((InventoryItem i) => Localization.instance.Localize(i.itemDrop.m_itemData.m_shared.m_name + ((i.variant > 0) ? (" Variant " + i.variant) : "")).ToLower().Contains(search)).ToList();
s_itemsGUIFiltered = s_itemsFiltered.Select((InventoryItem i) => i.guiContent).ToList();
}
s_previousSearchTerms = search;
}
}
public static class MiscHacks
{
public static bool s_enableAutopinMap = false;
private static int s_playerDamageIdx = 0;
private static string s_damageToDeal = "1";
private static string s_worldMessageText = "";
private static string s_chatUsernameText = "";
private static string s_chatMessageText = "";
private static bool s_isShoutMessage = false;
private static List<Player> s_players = null;
private static float s_updateTimer = 0f;
private static readonly float s_updateTimerInterval = 1.5f;
public static void Start()
{
}
public static void Update()
{
if (Time.time >= s_updateTimer)
{
s_players = Player.GetAllPlayers();
s_updateTimer = Time.time + s_updateTimerInterval;
}
if (ConfigManager.s_espPlayersShortcut.Value.IsDown())
{
ActionToggleESPPlayers(sendNotification: true);
}
if (ConfigManager.s_espMonstersShortcut.Value.IsDown())
{
ActionToggleESPMonsters(sendNotification: true);
}
if (ConfigManager.s_espDroppedItemsShortcut.Value.IsDown())
{
ActionToggleESPDroppedItems(sendNotification: true);
}
if (ConfigManager.s_espDepositsShortcut.Value.IsDown())
{
ActionToggleESPDeposits(sendNotification: true);
}
if (ConfigManager.s_espPickablesShortcut.Value.IsDown())
{
ActionToggleESPPickables(sendNotification: true);
}
}
public static void DisplayGUI()
{
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_damage_title"), GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
GUILayout.Space((float)EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_damage_player :"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_playerDamageIdx = RGUI.SelectionPopup(s_playerDamageIdx, s_players?.Select((Player p) => p.GetPlayerName()).ToArray());
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_damage_value :"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_damageToDeal = GUILayout.TextField(s_damageToDeal, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_player"), Array.Empty<GUILayoutOption>()) && int.TryParse(s_damageToDeal, out var result))
{
((Character)(object)s_players[s_playerDamageIdx]).VTDamage(result);
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_entities"), Array.Empty<GUILayoutOption>()))
{
DamageAllCharacters();
}
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_damage_button_players"), Array.Empty<GUILayoutOption>()))
{
DamageAllOtherPlayers();
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_map_title"), GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
GUILayout.Space((float)EntryPoint.s_boxSpacing);
if (GUILayout.Button(ValheimTooler.UI.Utils.ToggleButtonLabel("$vt_misc_autopin", s_enableAutopinMap), Array.Empty<GUILayoutOption>()))
{
s_enableAutopinMap = !s_enableAutopinMap;
}
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
ConfigManager.s_permanentPins.Value = GUILayout.Toggle(ConfigManager.s_permanentPins.Value, "", Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_autopin_permanent"), Array.Empty<GUILayoutOption>());
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_autopin_clear"), Array.Empty<GUILayoutOption>()) && (Object)(object)Minimap.instance != (Object)null)
{
foreach (PinData item in new List<PinData>(Minimap.instance.GetFieldValue<List<PinData>>("m_pins")))
{
if (Regex.IsMatch(item.m_name, "^.+\\[VT[0-9]{5}]$"))
{
Minimap.instance.RemovePin(item);
}
}
}
GUILayout.EndVertical();
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_event_title"), GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
GUILayout.Space((float)EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_event_message :"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_worldMessageText = GUILayout.TextField(s_worldMessageText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
GUILayout.EndHorizontal();
if (GUILayout.Button(VTLocalization.instance.Localize("$vt_misc_event_button"), Array.Empty<GUILayoutOption>()))
{
MessageAllInRange((MessageType)2, s_worldMessageText);
}
GUILayout.EndVertical();
GUILayout.EndVertical();
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
GUILayout.BeginVertical(VTLocalization.instance.Localize("$vt_misc_chat_title"), GUI.skin.box, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
GUILayout.Space((float)EntryPoint.s_boxSpacing);
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label(VTLocalization.instance.Localize("$vt_misc_chat_username :"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(false) });
s_chatUsernameText = GUILayout.TextField(s_chatUsernameText, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandWidth(true) });
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());