Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ContainerCustomizer v1.0.2
BepInEx/plugins/ContainerCustomizer/ContainerCustomizer.dll
Decompiled 2 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("ContainerCustomizer")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("ContainerCustomizer")] [assembly: AssemblyTitle("ContainerCustomizer")] [assembly: AssemblyVersion("1.0.2.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ContainerCustomizer { [HarmonyPatch] internal static class CameraScrollInputPatch { private static IEnumerable<MethodBase> TargetMethods() { MethodInfo[] methods = typeof(GameCamera).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.Name == "UpdateCamera" && methodInfo.GetMethodBody() != null) { yield return methodInfo; } } Type type = AccessTools.TypeByName("FirstPersonMode.Util.Functions"); if (type == null) { yield break; } int targets = 0; methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo2 in methods) { if ((methodInfo2.Name == "HandleNotFirstPersonMode" || methodInfo2.Name == "HandleScrollOutDetection") && methodInfo2.GetMethodBody() != null) { targets++; yield return methodInfo2; } } if (targets < 2) { Plugin.Warn("FirstPersonMode camera input methods changed; menu wheel compatibility needs verification."); } } private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, MethodBase __originalMethod) { MethodInfo axis = typeof(Input).GetMethod("GetAxis", new Type[1] { typeof(string) }); MethodInfo raw = typeof(Input).GetMethod("GetAxisRaw", new Type[1] { typeof(string) }); BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.NonPublic; MethodInfo filteredAxis = typeof(CameraScrollInputPatch).GetMethod("ReadAxis", bindingAttr); MethodInfo filteredRaw = typeof(CameraScrollInputPatch).GetMethod("ReadAxisRaw", bindingAttr); int replacements = 0; foreach (CodeInstruction instruction in instructions) { if (instruction.opcode == OpCodes.Call && instruction.operand is MethodInfo methodInfo) { if (methodInfo == axis) { instruction.operand = filteredAxis; replacements++; } else if (methodInfo == raw) { instruction.operand = filteredRaw; replacements++; } } yield return instruction; } if (replacements > 0) { Plugin.LogInfo("Menu wheel guard: " + __originalMethod.DeclaringType.FullName + "." + __originalMethod.Name + " (" + replacements + " direct input reads)."); } else if (__originalMethod.DeclaringType != typeof(GameCamera)) { Plugin.Warn("No direct camera input reads found in " + __originalMethod.Name + "; FirstPersonMode menu compatibility needs verification."); } } private static bool BlockAxis(string axisName) { if (axisName == "Mouse ScrollWheel" && (Object)(object)Controller.Active != (Object)null) { return Controller.Active.IsWindowOpen; } return false; } private static float ReadAxis(string axisName) { if (!BlockAxis(axisName)) { return Input.GetAxis(axisName); } return 0f; } private static float ReadAxisRaw(string axisName) { if (!BlockAxis(axisName)) { return Input.GetAxisRaw(axisName); } return 0f; } } internal sealed class ChestEndLabel : MonoBehaviour { private TextMesh _text; private MeshRenderer _renderer; private Transform _icon; private Color _color; private float _width; private float _height; private const float IconSize = 0.11f; private const float Gap = 0.025f; internal void Initialize(TextMesh text, Transform icon, float width, float height, float iconSurfaceOffset) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) _text = text; _icon = icon; _width = width; _height = height; if ((Object)(object)_icon != (Object)null) { Transform icon2 = _icon; icon2.localPosition += Vector3.forward * iconSurfaceOffset; } if ((Object)(object)text == (Object)null) { ((Behaviour)this).enabled = false; return; } _renderer = ((Component)text).GetComponent<MeshRenderer>(); _color = text.color; Color color = _color; color.a = 0f; text.color = color; if ((Object)(object)_icon != (Object)null) { ((Component)_icon).gameObject.SetActive(false); } } private void LateUpdate() { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_0176: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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) if ((Object)(object)_text == (Object)null) { ((Behaviour)this).enabled = false; return; } if (string.IsNullOrWhiteSpace(_text.text)) { if ((Object)(object)_icon != (Object)null) { ((Component)_icon).gameObject.SetActive(true); } ((Behaviour)this).enabled = false; return; } Bounds localBounds = ((Renderer)_renderer).localBounds; if (!(((Bounds)(ref localBounds)).size.x <= 0f) && !(((Bounds)(ref localBounds)).size.y <= 0f)) { float num = (((Object)(object)_icon != (Object)null) ? (_height - 0.27f) : _height); float num2 = Mathf.Min(1f, Mathf.Min(_width / ((Bounds)(ref localBounds)).size.x, Mathf.Max(0.02f, num) / ((Bounds)(ref localBounds)).size.y)); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(num2, num2, 1f); ((Component)_text).transform.localScale = val; ((Component)_text).transform.localPosition = new Vector3(0f, 0f, 0.005f) - ((Component)_text).transform.localRotation * Vector3.Scale(((Bounds)(ref localBounds)).center, val); _text.color = _color; if ((Object)(object)_icon != (Object)null) { _icon.localPosition = new Vector3(0f, 0f - (((Bounds)(ref localBounds)).size.y * num2 * 0.5f + 0.025f + 0.055f), _icon.localPosition.z); ((Component)_icon).gameObject.SetActive(true); } ((Behaviour)this).enabled = false; } } } internal sealed class CurvedLabel : MonoBehaviour { private TextMesh[] _text; private MeshRenderer[] _renderers; private Bounds[] _bounds; private Color[] _colors; private float[] _angles; private Transform _icon; private Renderer _iconRenderer; private Camera _camera; private bool _ready; private float _span; private int _measurementAttempts; private float _fontScale = 1f; private float _radius = 0.452f; internal bool FollowsView { get { if (_ready) { return _span <= (float)Math.PI * 9f / 10f; } return true; } } internal void Initialize(TextMesh[] text, Transform icon, float fontScale, bool hasBackground) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_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_00bf: Unknown result type (might be due to invalid IL or missing references) _fontScale = fontScale; _radius = (hasBackground ? 0.467f : 0.452f); _text = text; _icon = icon; _iconRenderer = (((Object)(object)icon != (Object)null) ? ((Component)icon).GetComponent<Renderer>() : null); _renderers = (MeshRenderer[])(object)new MeshRenderer[text.Length]; _bounds = (Bounds[])(object)new Bounds[text.Length]; _colors = (Color[])(object)new Color[text.Length]; _angles = new float[text.Length]; for (int i = 0; i < text.Length; i++) { _renderers[i] = ((Component)text[i]).GetComponent<MeshRenderer>(); _colors[i] = text[i].color; Color color = _colors[i]; color.a = 0f; text[i].color = color; } if ((Object)(object)_iconRenderer != (Object)null) { _iconRenderer.enabled = false; } } internal void SetCamera(Camera camera) { _camera = camera; } private void LateUpdate() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) if (_text != null && (_ready || TryArrange()) && !((Object)(object)_camera == (Object)null)) { Vector3 val = default(Vector3); for (int i = 0; i < _renderers.Length; i++) { ((Vector3)(ref val))..ctor(Mathf.Sin(_angles[i]), 0f, Mathf.Cos(_angles[i])); Vector3 val2 = ((Component)this).transform.TransformPoint(val * _radius); ((Renderer)_renderers[i]).enabled = ((Bounds)(ref _bounds[i])).size.x > 0f && Vector3.Dot(((Component)this).transform.TransformDirection(val), ((Component)_camera).transform.position - val2) > 0f; } if ((Object)(object)_iconRenderer != (Object)null) { _iconRenderer.enabled = Vector3.Dot(((Component)this).transform.forward, ((Component)_camera).transform.position - ((Component)this).transform.TransformPoint(Vector3.forward * 0.484f)) > 0f; } } } private bool TryArrange() { //IL_0043: 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_004c: 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_00b0: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: 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_0249: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) _measurementAttempts++; float num = float.PositiveInfinity; float num2 = float.NegativeInfinity; for (int i = 0; i < _text.Length; i++) { if (string.IsNullOrWhiteSpace(_text[i].text)) { continue; } Bounds localBounds = ((Renderer)_renderers[i]).localBounds; if (((Bounds)(ref localBounds)).size.x <= 0f || ((Bounds)(ref localBounds)).size.y <= 0f) { if (_measurementAttempts >= 3 && _text[i].text != "?") { _text[i].text = "?"; } return false; } _bounds[i] = localBounds; num = Mathf.Min(num, ((Bounds)(ref localBounds)).min.y); num2 = Mathf.Max(num2, ((Bounds)(ref localBounds)).max.y); } float num3 = (float.IsInfinity(num) ? 0f : (num2 - num)); float num4 = ((num3 > 0f) ? ((num + num2) * 0.5f) : 0f); float[] array = new float[_text.Length]; for (int j = 0; j < array.Length; j++) { array[j] = (string.IsNullOrWhiteSpace(_text[j].text) ? LabelGeometry.WordSpace(num3, _fontScale) : ((Bounds)(ref _bounds[j])).size.x); } LabelGeometry.ArrangeArc(array, _radius, LabelGeometry.TrackingGap(num3, _fontScale), out var horizontalScale, out _span, _angles); LabelGeometry.Stack(num3, (Object)(object)_icon != (Object)null, out var textCenter, out var iconCenter); Vector3 val2 = default(Vector3); for (int k = 0; k < _text.Length; k++) { float num5 = _angles[k]; Quaternion val = Quaternion.Euler(0f, num5 * 57.29578f + 180f, 0f); ((Vector3)(ref val2))..ctor(Mathf.Sin(num5) * _radius, textCenter, Mathf.Cos(num5) * _radius); Transform transform = ((Component)_text[k]).transform; _text[k].color = _colors[k]; transform.localScale = new Vector3(horizontalScale, 1f, 1f); transform.localRotation = val; transform.localPosition = val2 - val * new Vector3(((Bounds)(ref _bounds[k])).center.x * horizontalScale, num4, 0f); } if ((Object)(object)_icon != (Object)null) { _icon.localPosition = new Vector3(0f, iconCenter - 0.54f, 0f); } _ready = true; return true; } } internal static class GameLocalization { private const BindingFlags AnyStatic = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private const BindingFlags AnyMethod = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private static Type _type; private static Type ResolveType() { if (_type != null) { return _type; } Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); for (int i = 0; i < assemblies.Length; i++) { Type type = assemblies[i].GetType("Localization", throwOnError: false); if (!(type == null)) { _type = type; break; } } return _type; } private static object Instance(Type type) { FieldInfo field = type.GetField("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(null); } PropertyInfo property = type.GetProperty("instance", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (!(property != null)) { return null; } return property.GetValue(null, null); } internal static bool IsFrench() { try { Type type = ResolveType(); if (type == null) { return false; } MethodInfo method = type.GetMethod("GetSelectedLanguage", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, Type.EmptyTypes, null); object obj = ((method != null) ? method.Invoke(method.IsStatic ? null : Instance(type), null) : null); if (obj == null) { FieldInfo field = type.GetField("m_language", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { obj = field.GetValue(Instance(type)); } } string text = ((obj != null) ? obj.ToString() : ""); return text.StartsWith("French", StringComparison.OrdinalIgnoreCase) || text.StartsWith("fr", StringComparison.OrdinalIgnoreCase); } catch { return false; } } internal static string Localize(string key) { if (string.IsNullOrEmpty(key)) { return ""; } try { Type type = ResolveType(); if (type == null) { return key; } MethodInfo method = type.GetMethod("Localize", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(string) }, null); if (method == null) { return key; } return (method.Invoke(method.IsStatic ? null : Instance(type), new object[1] { key }) as string) ?? key; } catch { return key; } } } internal static class IconAtlas { internal static readonly string[] Pictograms = new string[16] { "◆", "✦", "✚", "⬟", "☼", "☾", "⚒", "⚔", "⚓", "♜", "❖", "✿", "♠", "♣", "♦", "♥" }; internal static readonly string[] Emoji = new string[53] { "\ud83e\udeb5", "\ud83e\udea8", "⚒\ufe0f", "\ud83d\udde1\ufe0f", "\ud83c\udff9", "\ud83d\udee1\ufe0f", "\ud83c\udf56", "\ud83d\udc1f", "\ud83c\udf6f", "\ud83c\udf3e", "\ud83d\udc8e", "\ud83e\ude99", "\ud83d\udd25", "\ud83e\uddea", "\ud83e\uddf5", "\ud83d\udce6", "\ud83c\udf32", "\ud83c\udf43", "\ud83c\udf31", "\ud83e\uded0", "\ud83c\udf44", "\ud83e\udd55", "\ud83c\udf30", "\ud83e\udd58", "\ud83c\udf5e", "\ud83c\udf7a", "\ud83e\uddb4", "\ud83e\udeb6", "\ud83d\udc17", "\ud83d\udc3a", "\ud83d\udc1d", "\ud83e\udd5a", "\ud83e\uddf6", "\ud83e\uddf1", "\ud83e\ude91", "⛵", "\ud83d\udddd\ufe0f", "\ud83c\udfc6", "\ud83d\udcb0", "\ud83d\udc51", "✨", "\ud83d\udd2e", "❄\ufe0f", "\ud83d\udca7", "\ud83c\udf3f", "\ud83e\udded", "\ud83d\udd28", "⛏\ufe0f", "\ud83d\udd29", "\ud83d\udc3e", "\ud83d\udc79", "⚙\ufe0f", "\ud83c\udf86" }; internal static readonly string[] EmojiGroups = new string[53] { "materials", "materials", "craft", "equipment", "equipment", "equipment", "food", "food", "food", "nature", "materials", "materials", "craft", "food", "craft", "craft", "materials", "nature", "nature", "nature", "nature", "nature", "food", "food", "food", "food", "materials", "materials", "materials", "materials", "creatures", "food", "materials", "materials", "craft", "equipment", "craft", "creatures", "materials", "creatures", "mystic", "mystic", "mystic", "nature", "nature", "equipment", "equipment", "materials", "materials", "materials", "creatures", "craft", "craft" }; internal static readonly string[] EmojiTypes = new string[53] { "wood_resource", "stone", "components", "weapons", "ammo", "armor", "rawfood", "fishing", "rawfood", "seeds", "precious", "metal", "misc", "potions", "components", "misc", "wood_resource", "plants", "seeds", "plants", "plants", "seeds", "rawfood", "meals", "meals", "potions", "bones", "bones", "hides", "hides", "monster", "rawfood", "hides", "stone", "misc", "utility", "quest", "trophies", "precious", "trophies", "magic", "magic", "magic", "plants", "plants", "utility", "tools", "ore", "metal", "hides", "monster", "components", "misc" }; internal static readonly string[] EmojiNamesFr = new string[53] { "Bois", "Pierre", "Forge", "Épées", "Arcs", "Boucliers", "Viande", "Poissons", "Miel", "Céréales", "Gemmes", "Pièces", "Feu et charbon", "Potions", "Fil", "Stockage", "Arbres", "Feuilles", "Graines", "Baies", "Champignons", "Légumes", "Noix", "Repas", "Pain", "Hydromel", "Os", "Plumes", "Sangliers", "Loups", "Insectes", "Œufs", "Laine", "Matériaux de construction", "Mobilier", "Bateaux", "Clés", "Trophées", "Trésors", "Boss", "Magie", "Cristaux", "Givre", "Eau", "Plantes", "Exploration", "Outils", "Minerais", "Métaux", "Peaux et cuir", "Butin de monstres", "Composants", "Divers" }; internal static readonly string[] EmojiNamesEn = new string[53] { "Wood", "Stone", "Forge", "Swords", "Bows", "Shields", "Meat", "Fish", "Honey", "Grain", "Gems", "Coins", "Fire and coal", "Potions", "Thread", "Storage", "Trees", "Leaves", "Seeds", "Berries", "Mushrooms", "Vegetables", "Nuts", "Meals", "Bread", "Mead", "Bones", "Feathers", "Boars", "Wolves", "Insects", "Eggs", "Wool", "Building materials", "Furniture", "Boats", "Keys", "Trophies", "Treasure", "Bosses", "Magic", "Crystals", "Frost", "Water", "Plants", "Exploration", "Tools", "Ore", "Metals", "Hides and leather", "Monster loot", "Components", "Miscellaneous" }; private const int CellSize = 128; private const int Columns = 8; private static readonly int RowsPerMode = (Emoji.Length + 8 - 1) / 8; private static Texture2D _atlas; private static readonly Dictionary<int, Texture2D> Icons = new Dictionary<int, Texture2D>(); private static bool _failed; internal static Texture2D Get(string icon, IconMode mode) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown int num = Array.IndexOf((mode == IconMode.Pictogram) ? Pictograms : Emoji, icon); if (num < 0 || !EnsureLoaded()) { return null; } int num2 = mode switch { IconMode.EmojiOriginal => 1, IconMode.Pictogram => 0, _ => 2, }; int key = num2 * Emoji.Length + num; if (Icons.TryGetValue(key, out var value) && (Object)(object)value != (Object)null) { return value; } value = new Texture2D(128, 128, (TextureFormat)4, false); ((Object)value).name = "ContainerCustomizer_Icon_" + key; ((Object)value).hideFlags = (HideFlags)61; ((Texture)value).filterMode = (FilterMode)1; int num3 = num % 8 * 128; int num4 = (3 * RowsPerMode - 1 - num2 * RowsPerMode - num / 8) * 128; value.SetPixels(_atlas.GetPixels(num3, num4, 128, 128)); value.Apply(false, false); Icons[key] = value; return value; } private static bool EnsureLoaded() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown if ((Object)(object)_atlas != (Object)null) { return true; } if (_failed) { return false; } try { using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("ContainerCustomizer.icons.rgba")) { if (stream == null) { throw new FileNotFoundException("Embedded icons.rgba was not found"); } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); byte[] array = memoryStream.ToArray(); if (array.Length != 3072 * RowsPerMode * 128 * 4) { throw new InvalidDataException("Embedded icon atlas has an invalid size"); } _atlas = new Texture2D(1024, 3 * RowsPerMode * 128, (TextureFormat)4, false); ((Object)_atlas).hideFlags = (HideFlags)61; _atlas.LoadRawTextureData(array); _atlas.Apply(false, false); } ((Object)_atlas).name = "ContainerCustomizer_Atlas"; ((Texture)_atlas).filterMode = (FilterMode)1; return true; } catch (Exception ex) { _failed = true; if ((Object)(object)_atlas != (Object)null) { Object.Destroy((Object)(object)_atlas); } _atlas = null; Plugin.Warn("Icon atlas unavailable: " + ex); return false; } } internal static void Dispose() { foreach (Texture2D value in Icons.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } Icons.Clear(); if ((Object)(object)_atlas != (Object)null) { Object.Destroy((Object)(object)_atlas); } _atlas = null; _failed = false; } } internal static class LabelGeometry { internal static float TrackingGap(float textHeight, float fontScale) { float num = Math.Max(0f, Math.Min(1f, (fontScale - 0.5f) / 2.5f)); return Math.Max(0.004f, textHeight * (0.075f - 0.05f * num)); } internal static float WordSpace(float textHeight, float fontScale) { float num = Math.Max(0f, Math.Min(1f, (fontScale - 0.5f) / 2.5f)); return Math.Max(0.012f, textHeight * (0.32f - 0.1f * num)); } internal static void ArrangeArc(float[] widths, float radius, float gap, out float horizontalScale, out float span, float[] angles) { float num = gap * (float)Math.Max(0, widths.Length - 1); float[] array = widths; foreach (float num2 in array) { num += num2; } float num3 = (float)(Math.PI * 2.0 * (double)radius) - 0.16f; horizontalScale = Math.Min(1f, num3 / Math.Max(0.001f, num)); float num4 = gap * horizontalScale / radius; span = num4 * (float)Math.Max(0, widths.Length - 1); array = widths; foreach (float num5 in array) { span += 2f * (float)Math.Atan(num5 * horizontalScale / (2f * radius)); } float num6 = span * 0.5f; for (int j = 0; j < widths.Length; j++) { float num7 = (float)Math.Atan(widths[j] * horizontalScale / (2f * radius)); angles[j] = num6 - num7; num6 -= num7 * 2f + num4; } } internal static void Stack(float textHeight, bool hasIcon, out float textCenter, out float iconCenter) { if (textHeight <= 0f) { textCenter = (iconCenter = 0.56f); return; } float num = Math.Max(0.035f, textHeight * 0.12f); float num2 = textHeight + (hasIcon ? (num + 0.19f) : 0f); float num3 = Math.Min(0.56f, 0.84f - num2 * 0.5f); textCenter = num3 - (hasIcon ? ((num + 0.19f) * 0.5f) : 0f); iconCenter = textCenter + textHeight * 0.5f + num + 0.095f; } } [HarmonyPatch] internal static class MenuMouseWheelPatch { private static IEnumerable<MethodBase> TargetMethods() { Type type = AccessTools.TypeByName("ZInput"); bool found = false; if (type != null) { MethodInfo[] methods = type.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != "GetMouseScrollWheel") && !(methodInfo.ReturnType != typeof(float))) { found = true; yield return methodInfo; } } } if (!found) { Plugin.Warn("Mouse wheel input method unavailable; menu camera zoom suppression could not be installed."); } } [HarmonyPostfix] [HarmonyPriority(0)] private static void Postfix(ref float __result) { if ((Object)(object)Controller.Active != (Object)null && Controller.Active.IsWindowOpen) { __result = 0f; } } } internal static class Strings { private static readonly Dictionary<string, string[]> Values = new Dictionary<string, string[]> { { "edit", new string[2] { "Personnaliser", "Customize" } }, { "search", new string[2] { "Rechercher les conteneurs", "Search containers" } }, { "name", new string[2] { "Nom", "Name" } }, { "face", new string[2] { "Faces", "Faces" } }, { "lid", new string[2] { "Dessus", "Top" } }, { "wood", new string[2] { "Teinte du bois", "Wood tint" } }, { "text", new string[2] { "Couleur du texte", "Text color" } }, { "text_size", new string[2] { "Taille du texte", "Text size" } }, { "display", new string[2] { "Affichage", "Display" } }, { "label_distance", new string[2] { "Distance des noms", "Label distance" } }, { "colors", new string[2] { "Couleurs", "Colors" } }, { "preset", new string[2] { "Préréglages", "Presets" } }, { "rgb", new string[2] { "Réglage R V B", "RGB sliders" } }, { "color_target", new string[2] { "Élément à colorer", "Color target" } }, { "red", new string[2] { "Rouge", "Red" } }, { "orange", new string[2] { "Orange", "Orange" } }, { "yellow", new string[2] { "Jaune", "Yellow" } }, { "green", new string[2] { "Vert", "Green" } }, { "cyan", new string[2] { "Turquoise", "Cyan" } }, { "blue", new string[2] { "Bleu", "Blue" } }, { "purple", new string[2] { "Violet", "Purple" } }, { "pink", new string[2] { "Rose", "Pink" } }, { "brown", new string[2] { "Brun", "Brown" } }, { "gold", new string[2] { "Or", "Gold" } }, { "icon_color", new string[2] { "Couleur de l’icône", "Icon color" } }, { "choose_tint", new string[2] { "Autres couleurs et RVB…", "More colors and RGB…" } }, { "background", new string[2] { "Fond", "Background" } }, { "transparent", new string[2] { "Transparent", "Transparent" } }, { "white", new string[2] { "Blanc", "White" } }, { "black", new string[2] { "Noir", "Black" } }, { "pictograms", new string[2] { "Pictogrammes", "Pictograms" } }, { "emoji", new string[2] { "Emojis", "Emoji" } }, { "original", new string[2] { "Couleurs originales", "Original colors" } }, { "mono", new string[2] { "Monochrome", "Monochrome" } }, { "favorite", new string[2] { "Favoris uniquement", "Favorites only" } }, { "save", new string[2] { "Enregistrer", "Save" } }, { "close", new string[2] { "Fermer", "Close" } }, { "clear_icon", new string[2] { "Retirer l’icône", "Remove icon" } }, { "saved", new string[2] { "Style enregistré", "Style saved" } }, { "save_failed", new string[2] { "Enregistrement impossible", "Could not save" } }, { "no_permission", new string[2] { "Tu ne peux pas modifier ce conteneur", "You cannot edit this container" } }, { "no_target", new string[2] { "Aucun coffre ou tonneau ciblé", "No chest or barrel targeted" } }, { "nearby", new string[2] { "Conteneurs trouvés", "Matching containers" } }, { "owner", new string[2] { "Propriétaire", "Owner" } }, { "empty", new string[2] { "Aucun résultat dans le rayon", "No matches in range" } }, { "query", new string[2] { "Objet stocké à trouver", "Stored item to find" } }, { "select_item", new string[2] { "Choisir un objet stocké", "Choose a stored item" } }, { "radius", new string[2] { "Rayon", "Radius" } }, { "preview", new string[2] { "Aperçu", "Preview" } }, { "copy", new string[2] { "Copier le style", "Copy style" } }, { "paste", new string[2] { "Coller le style", "Paste style" } }, { "copy_done", new string[2] { "Style copié (session en cours)", "Style copied (current session)" } }, { "explore", new string[2] { "Explorer avec les résultats affichés", "Explore with results visible" } }, { "return_search", new string[2] { "Alt + F : modifier la recherche", "Alt + F: edit search" } }, { "occluded_markers", new string[2] { "Repérer les conteneurs à travers les murs", "Locate containers through walls" } }, { "all", new string[2] { "Tous", "All" } }, { "materials", new string[2] { "Matériaux", "Materials" } }, { "nature", new string[2] { "Nature", "Nature" } }, { "craft", new string[2] { "Artisanat", "Crafting" } }, { "equipment", new string[2] { "Équipement", "Equipment" } }, { "food", new string[2] { "Nourriture", "Food" } }, { "creatures", new string[2] { "Faune", "Creatures" } }, { "mystic", new string[2] { "Mystique", "Mystic" } }, { "wood_resource", new string[2] { "Bois", "Wood" } }, { "stone", new string[2] { "Pierre", "Stone" } }, { "ore", new string[2] { "Minerais", "Ore" } }, { "metal", new string[2] { "Métaux", "Metals" } }, { "hides", new string[2] { "Peaux et cuir", "Hides and leather" } }, { "bones", new string[2] { "Os et plumes", "Bones and feathers" } }, { "monster", new string[2] { "Butin de monstres", "Monster loot" } }, { "plants", new string[2] { "Plantes", "Plants" } }, { "seeds", new string[2] { "Graines", "Seeds" } }, { "rawfood", new string[2] { "Aliments crus", "Raw food" } }, { "meals", new string[2] { "Plats", "Meals" } }, { "potions", new string[2] { "Hydromels et potions", "Mead and potions" } }, { "fishing", new string[2] { "Pêche", "Fishing" } }, { "weapons", new string[2] { "Armes", "Weapons" } }, { "ammo", new string[2] { "Munitions", "Ammunition" } }, { "armor", new string[2] { "Armures", "Armor" } }, { "tools", new string[2] { "Outils", "Tools" } }, { "magic", new string[2] { "Magie et Eitr", "Magic and Eitr" } }, { "precious", new string[2] { "Gemmes", "Gems" } }, { "trophies", new string[2] { "Trophées", "Trophies" } }, { "utility", new string[2] { "Accessoires", "Accessories" } }, { "quest", new string[2] { "Quêtes", "Quests" } }, { "components", new string[2] { "Composants", "Components" } }, { "misc", new string[2] { "Divers", "Miscellaneous" } } }; internal static bool French => GameLocalization.IsFrench(); internal static string Get(string key) { if (!Values.TryGetValue(key, out var value)) { return key; } return value[(!French) ? 1u : 0u]; } } internal static class Panels { private static Style _clipboard; private static readonly string[] PaletteNames = new string[12] { "white", "black", "red", "orange", "yellow", "green", "cyan", "blue", "purple", "pink", "brown", "gold" }; private static readonly Color32[] Palette = (Color32[])(object)new Color32[12] { new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue), new Color32((byte)35, (byte)31, (byte)29, byte.MaxValue), new Color32((byte)210, (byte)64, (byte)49, byte.MaxValue), new Color32((byte)227, (byte)130, (byte)53, byte.MaxValue), new Color32((byte)245, (byte)216, (byte)97, byte.MaxValue), new Color32((byte)92, (byte)173, (byte)89, byte.MaxValue), new Color32((byte)73, (byte)191, (byte)190, byte.MaxValue), new Color32((byte)76, (byte)127, (byte)210, byte.MaxValue), new Color32((byte)142, (byte)96, (byte)188, byte.MaxValue), new Color32((byte)226, (byte)139, (byte)166, byte.MaxValue), new Color32((byte)126, (byte)84, (byte)52, byte.MaxValue), new Color32((byte)227, (byte)183, (byte)88, byte.MaxValue) }; internal static void Draw(Controller controller) { //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03ce: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Expected O, but got Unknown //IL_03f7: Expected O, but got Unknown //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Expected O, but got Unknown //IL_0409: Unknown result type (might be due to invalid IL or missing references) //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Expected O, but got Unknown //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: 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_0380: Invalid comparison between Unknown and I4 //IL_0328: Unknown result type (might be due to invalid IL or missing references) using (new VikingSkin.DrawingScope(GUI.skin)) { if (controller.SearchOpen) { DrawOccludedMatches(controller); } if (controller.Editing != null && controller.Draft != null) { float num = Mathf.Min(660f, (float)Screen.width - 32f); float num2 = Mathf.Min(580f, (float)Screen.height - 56f); Rect editorRect = default(Rect); ((Rect)(ref editorRect))..ctor(((float)Screen.width - num) / 2f, ((float)Screen.height - num2) / 2f, num, num2); if (((Rect)(ref controller.EditorRect)).width <= 0f) { controller.EditorRect = editorRect; } controller.EditorRect = KeepOnScreen(controller.EditorRect, num, num2); controller.EditorRect = GUI.Window(833010, controller.EditorRect, (WindowFunction)delegate { DrawEditor(controller); }, ""); } else if (controller.SearchOpen && controller.SearchNavigating) { float height = Mathf.Min(195f, (float)Screen.height - 32f); float width = Mathf.Min(370f, (float)Screen.width - 32f); GUI.Box(KeepOnScreen(controller.SearchRect, width, height), Strings.Get("search") + "\n" + Strings.Get("query") + ": " + controller.Query + "\n" + Strings.Get("nearby") + ": " + controller.Results.Count() + "\n" + string.Join("\n", from h in controller.Results.Take(4) select controller.MatchName(h.Container) + " (" + Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)h.Container).transform.position).ToString("0") + " m)") + "\n" + Strings.Get("return_search")); } else if (controller.SearchOpen) { float num3 = Mathf.Min(460f, (float)Screen.width - 32f); float num4 = Mathf.Min(420f, (float)Screen.height - 56f); if (((Rect)(ref controller.SearchRect)).width <= 0f) { controller.SearchRect = new Rect((float)Screen.width * Mathf.Clamp01(Plugin.SearchWindowX.Value), (float)Screen.height * Mathf.Clamp01(Plugin.SearchWindowY.Value), num3, num4); } controller.SearchRect = KeepOnScreen(controller.SearchRect, num3, num4); if ((int)Event.current.type == 0 && !((Rect)(ref controller.SearchRect)).Contains(Event.current.mousePosition)) { controller.BeginSearchNavigation(); return; } controller.SearchRect = GUI.Window(833011, controller.SearchRect, (WindowFunction)delegate { DrawSearch(controller); }, ""); if ((int)Event.current.type == 1) { controller.SaveSearchPosition(); } } else if (!string.IsNullOrEmpty(controller.Status) && Time.unscaledTime < controller.StatusUntil) { GUIStyle val = new GUIStyle(GUI.skin.box) { fontSize = 17, wordWrap = false, alignment = (TextAnchor)4, padding = new RectOffset(13, 13, 7, 7) }; Vector2 val2 = val.CalcSize(new GUIContent(controller.Status)); float num5 = Mathf.Min((float)Screen.width - 24f, Mathf.Max(165f, val2.x + 10f)); float num6 = Mathf.Max(38f, val2.y + 8f); GUI.Box(new Rect(((float)Screen.width - num5) * 0.5f, (float)Screen.height - 110f, num5, num6), controller.Status, val); } } } private static void DrawOccludedMatches(Controller controller) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: 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_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.ShowOccludedMarkers.Value || (int)Event.current.type != 7) { return; } Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Texture2D val = IconAtlas.Get("✨", IconMode.EmojiOriginal); if ((Object)(object)val == (Object)null) { return; } RaycastHit val4 = default(RaycastHit); foreach (ContainerHandle item in controller.Results.Take(32)) { if ((Object)(object)item.Piece == (Object)null) { continue; } Vector3 val2 = ((Component)item.Piece).transform.TransformPoint(new Vector3(0f, 0.48f, 0f)); Vector3 val3 = val2 - ((Component)main).transform.position; float magnitude = ((Vector3)(ref val3)).magnitude; if (!(magnitude < 0.1f) && Physics.Raycast(((Component)main).transform.position, val3 / magnitude, ref val4, magnitude - 0.05f, -5, (QueryTriggerInteraction)1) && !((RaycastHit)(ref val4)).transform.IsChildOf(((Component)item.Piece).transform)) { Vector3 val5 = main.WorldToScreenPoint(val2); if (!(val5.z <= 0f) && !(val5.x < 10f) && !(val5.x > (float)Screen.width - 10f) && !(val5.y < 10f) && !(val5.y > (float)Screen.height - 10f)) { GUI.DrawTexture(new Rect(val5.x - 12f, (float)Screen.height - val5.y - 12f, 24f, 24f), (Texture)(object)val, (ScaleMode)2, true); } } } } private static Rect KeepOnScreen(Rect rect, float width, float height) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) ((Rect)(ref rect)).width = width; ((Rect)(ref rect)).height = height; ((Rect)(ref rect)).x = Mathf.Clamp(((Rect)(ref rect)).x, 8f, Mathf.Max(8f, (float)Screen.width - width - 8f)); ((Rect)(ref rect)).y = Mathf.Clamp(((Rect)(ref rect)).y, 8f, Mathf.Max(8f, (float)Screen.height - height - 8f)); return rect; } private static void DrawEditor(Controller c) { //IL_00ed: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: 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_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) Style draft = c.Draft; GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(Strings.Get("edit") + " · " + GameLocalization.Localize(c.Editing.Piece.m_name), Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button("X " + Strings.Get("close"), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(26f) })) { GUILayout.EndHorizontal(); c.Close(); return; } GUILayout.EndHorizontal(); string text = c.Editing.Zdo.GetString("sac_owner_name", ""); if (!string.IsNullOrEmpty(text)) { GUILayout.Label(Strings.Get("owner") + " : " + text, Array.Empty<GUILayoutOption>()); } GUILayout.Space(8f); c.EditorScroll = GUILayout.BeginScrollView(c.EditorScroll, Array.Empty<GUILayoutOption>()); GUILayout.Label(Strings.Get("edit"), Array.Empty<GUILayoutOption>()); GUILayout.Label(Strings.Get("name") + " (64)", Array.Empty<GUILayoutOption>()); string text2 = GUILayout.TextField(draft.Name, 64, Array.Empty<GUILayoutOption>()); draft.Name = ((text2.Length > 64) ? text2.Substring(0, 64) : text2); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); draft.Faces = GUILayout.Toggle(draft.Faces, Strings.Get("face"), Array.Empty<GUILayoutOption>()); draft.Lid = GUILayout.Toggle(draft.Lid, Strings.Get("lid"), Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Toggle(c.EditorSection == 0, Strings.Get("colors"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.EditorSection = 0; } if (GUILayout.Toggle(c.EditorSection == 1, Strings.Get("emoji"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.EditorSection = 1; } if (GUILayout.Toggle(c.EditorSection == 2, Strings.Get("display"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.EditorSection = 2; } GUILayout.EndHorizontal(); if (c.EditorSection == 0) { DrawColors(c, draft); } else if (c.EditorSection == 1) { DrawEmojis(c, draft); } else { DrawDisplay(draft); } GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); Texture2D val = IconAtlas.Get(draft.Icon, draft.IconMode); if ((Object)(object)val != (Object)null) { Rect rect = GUILayoutUtility.GetRect(42f, 42f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(42f) }); Color color = GUI.color; if (draft.IconMode != IconMode.EmojiOriginal) { GUI.color = Color32.op_Implicit(draft.IconColor); } GUI.DrawTexture(rect, (Texture)(object)val, (ScaleMode)2, true); GUI.color = color; } GUILayout.Label(Strings.Get("preview") + ": " + draft.Name, Array.Empty<GUILayoutOption>()); GUILayout.EndHorizontal(); GUILayout.EndScrollView(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(Strings.Get("copy"), Array.Empty<GUILayoutOption>())) { _clipboard = draft.Clone(); c.ShowStatus(Strings.Get("copy_done")); } GUI.enabled = _clipboard != null; if (GUILayout.Button(Strings.Get("paste"), Array.Empty<GUILayoutOption>())) { c.Draft = _clipboard.Clone(); } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Button(Strings.Get("save"), Array.Empty<GUILayoutOption>())) { bool flag = c.Editing.Save(c.Draft); c.ShowStatus(Strings.Get(flag ? "saved" : "save_failed")); if (flag) { c.Close(); } } GUILayout.EndHorizontal(); GUI.DragWindow(new Rect(0f, 0f, 10000f, 23f)); } private static void DrawDisplay(Style style) { GUILayout.Space(12f); GUILayout.Label(Strings.Get("text_size") + " : " + Mathf.RoundToInt(style.TextScale * 100f) + " %", Array.Empty<GUILayoutOption>()); style.TextScale = Mathf.Round(GUILayout.HorizontalSlider(style.TextScale, 0.5f, 3f, Array.Empty<GUILayoutOption>()) * 20f) / 20f; GUILayout.Space(14f); GUILayout.Label(Strings.Get("label_distance") + " : " + Mathf.RoundToInt(Plugin.LabelDistance.Value) + " m", Array.Empty<GUILayoutOption>()); float num = Mathf.Round(GUILayout.HorizontalSlider(Plugin.LabelDistance.Value, 1f, 15f, Array.Empty<GUILayoutOption>())); if (Mathf.Abs(num - Plugin.LabelDistance.Value) >= 0.5f) { Plugin.LabelDistance.Value = num; } } private static void DrawColors(Controller c, Style style) { //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Expected O, but got Unknown //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0393: 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_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03a3: 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_02b9: 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_0327: 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) GUILayout.Space(10f); GUILayout.Label(Strings.Get("background"), Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); foreach (BackgroundMode value in Enum.GetValues(typeof(BackgroundMode))) { if (GUILayout.Toggle(style.Background == value, Strings.Get(value switch { BackgroundMode.White => "white", BackgroundMode.Transparent => "transparent", _ => "black", }), GUI.skin.button, Array.Empty<GUILayoutOption>())) { style.Background = value; } } GUILayout.EndHorizontal(); if (style.IconMode == IconMode.EmojiOriginal && c.ColorTarget == 2) { c.ColorTarget = 0; } GUILayout.Space(10f); GUILayout.Label(Strings.Get("color_target"), Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Toggle(c.ColorTarget == 0, Strings.Get("wood"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.ColorTarget = 0; } if (GUILayout.Toggle(c.ColorTarget == 1, Strings.Get("text"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.ColorTarget = 1; } if (style.IconMode != IconMode.EmojiOriginal && GUILayout.Toggle(c.ColorTarget == 2, Strings.Get("icon_color"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.ColorTarget = 2; } GUILayout.EndHorizontal(); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Toggle(c.ColorEditMode == 0, Strings.Get("preset"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.ColorEditMode = 0; } if (GUILayout.Toggle(c.ColorEditMode == 1, Strings.Get("rgb"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.ColorEditMode = 1; } GUILayout.EndHorizontal(); Color32 val = ((c.ColorTarget == 0) ? style.Wood : ((c.ColorTarget == 1) ? style.Text : style.IconColor)); if (c.ColorEditMode == 0) { for (int i = 0; i < Palette.Length; i++) { if (i % 4 == 0) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); } GUIStyle val2 = new GUIStyle(GUI.skin.button) { fixedHeight = 42f }; Color color = GUI.color; GUI.color = Color32.op_Implicit(Palette[i]); bool num = GUILayout.Button((val.r == Palette[i].r && val.g == Palette[i].g && val.b == Palette[i].b) ? ("✓ " + Strings.Get(PaletteNames[i])) : Strings.Get(PaletteNames[i]), val2, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.MinWidth(110f) }); GUI.color = color; if (num) { val = Palette[i]; } if (i % 4 == 3) { GUILayout.EndHorizontal(); } } } else { val = ColorPicker((c.ColorTarget == 0) ? Strings.Get("wood") : ((c.ColorTarget == 1) ? Strings.Get("text") : Strings.Get("icon_color")), val); } if (c.ColorTarget == 0) { style.Wood = val; } else if (c.ColorTarget == 1) { style.Text = val; } else { style.IconColor = val; } } private static void DrawEmojis(Controller c, Style style) { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Expected O, but got Unknown //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03fa: Unknown result type (might be due to invalid IL or missing references) //IL_0404: Expected O, but got Unknown //IL_0533: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_0554: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(10f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); if (GUILayout.Toggle(style.IconMode == IconMode.EmojiOriginal, Strings.Get("original"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { style.IconMode = IconMode.EmojiOriginal; } if (GUILayout.Toggle(style.IconMode == IconMode.EmojiMonochrome, Strings.Get("mono"), GUI.skin.button, Array.Empty<GUILayoutOption>())) { style.IconMode = IconMode.EmojiMonochrome; } GUILayout.EndHorizontal(); if (style.IconMode == IconMode.EmojiMonochrome) { GUILayout.Label(Strings.Get("icon_color") + " : " + $"#{style.IconColor.r:X2}{style.IconColor.g:X2}{style.IconColor.b:X2}", Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); int[] array = new int[5] { 2, 5, 7, 11, 0 }; foreach (int num in array) { if (GUILayout.Button(Strings.Get(PaletteNames[num]), Array.Empty<GUILayoutOption>())) { style.IconColor = Palette[num]; } } if (GUILayout.Button(Strings.Get("choose_tint"), Array.Empty<GUILayoutOption>())) { c.ColorTarget = 2; c.EditorSection = 0; } GUILayout.EndHorizontal(); } string[] array2 = new string[8] { "all", "materials", "nature", "craft", "equipment", "food", "creatures", "mystic" }; for (int j = 0; j < array2.Length; j++) { if (j % 4 == 0) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); } string text = array2[j]; if (GUILayout.Toggle(c.EmojiGroup == text, Strings.Get(text), GUI.skin.button, Array.Empty<GUILayoutOption>()) && c.EmojiGroup != text) { c.EmojiGroup = text; c.EmojiType = "all"; } if (j % 4 == 3) { GUILayout.EndHorizontal(); } } if (c.EmojiGroup != "all") { List<string> list = IconAtlas.EmojiTypes.Where((string type, int index) => IconAtlas.EmojiGroups[index] == c.EmojiGroup).Distinct().ToList(); list.Insert(0, "all"); for (int num2 = 0; num2 < list.Count; num2++) { if (num2 % 4 == 0) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); } string text2 = list[num2]; if (GUILayout.Toggle(c.EmojiType == text2, Strings.Get(text2), GUI.skin.button, Array.Empty<GUILayoutOption>())) { c.EmojiType = text2; } if (num2 % 4 == 3 || num2 == list.Count - 1) { GUILayout.EndHorizontal(); } } } c.ShowFavorites = GUILayout.Toggle(c.ShowFavorites, Strings.Get("favorite"), Array.Empty<GUILayoutOption>()); string[] emoji = IconAtlas.Emoji; HashSet<string> hashSet = new HashSet<string>((Plugin.Favorites.Value ?? "").Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)); int num3 = Mathf.Clamp(Mathf.FloorToInt((((Rect)(ref c.EditorRect)).width - 54f) / 96f), 1, 6); GUIStyle val = new GUIStyle(GUI.skin.button) { fixedWidth = 0f, fixedHeight = 0f }; GUIStyle val2 = new GUIStyle(GUI.skin.label) { wordWrap = true, alignment = (TextAnchor)4, fontSize = 13 }; int num4 = 0; for (int num5 = 0; num5 < emoji.Length; num5++) { string text3 = emoji[num5]; if ((c.EmojiGroup != "all" && IconAtlas.EmojiGroups[num5] != c.EmojiGroup) || (c.EmojiType != "all" && IconAtlas.EmojiTypes[num5] != c.EmojiType) || (c.ShowFavorites && !hashSet.Contains(text3))) { continue; } if (num4++ % num3 == 0) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); } GUILayout.BeginVertical((GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(84f) }); IconMode iconMode = ((style.IconMode != IconMode.EmojiMonochrome) ? IconMode.EmojiOriginal : IconMode.EmojiMonochrome); Texture2D val3 = IconAtlas.Get(text3, iconMode); if (GUILayout.Button((style.Icon == text3) ? "✓" : "", val, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(84f), GUILayout.Height(56f) })) { style.Icon = text3; style.IconMode = iconMode; } Rect lastRect = GUILayoutUtility.GetLastRect(); if ((Object)(object)val3 != (Object)null) { Color color = GUI.color; if (iconMode != IconMode.EmojiOriginal) { GUI.color = Color32.op_Implicit(style.IconColor); } GUI.DrawTexture(new Rect(((Rect)(ref lastRect)).x + (((Rect)(ref lastRect)).width - 46f) * 0.5f, ((Rect)(ref lastRect)).y + (((Rect)(ref lastRect)).height - 46f) * 0.5f, 46f, 46f), (Texture)(object)val3, (ScaleMode)2, true); GUI.color = color; } else { GUILayout.Label(text3, Array.Empty<GUILayoutOption>()); } GUILayout.Label(Strings.French ? IconAtlas.EmojiNamesFr[num5] : IconAtlas.EmojiNamesEn[num5], val2, (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(84f), GUILayout.Height(36f) }); if (GUILayout.Button(hashSet.Contains(text3) ? "★" : "☆", (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(84f), GUILayout.Height(24f) })) { if (!hashSet.Add(text3)) { hashSet.Remove(text3); } Plugin.Favorites.Value = string.Join(",", hashSet.ToArray()); } GUILayout.EndVertical(); if (num4 % num3 == 0) { GUILayout.EndHorizontal(); } } if (num4 % num3 != 0) { GUILayout.EndHorizontal(); } if (GUILayout.Button(Strings.Get("clear_icon"), Array.Empty<GUILayoutOption>())) { style.Icon = ""; } } private static Color32 ColorPicker(string label, Color32 color) { //IL_0006: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) GUILayout.Label(label + $" #{color.r:X2}{color.g:X2}{color.b:X2}", Array.Empty<GUILayoutOption>()); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label("R", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }); color.r = (byte)Mathf.RoundToInt(GUILayout.HorizontalSlider((float)(int)color.r, 0f, 255f, Array.Empty<GUILayoutOption>())); GUILayout.Label("G", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }); color.g = (byte)Mathf.RoundToInt(GUILayout.HorizontalSlider((float)(int)color.g, 0f, 255f, Array.Empty<GUILayoutOption>())); GUILayout.Label("B", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(20f) }); color.b = (byte)Mathf.RoundToInt(GUILayout.HorizontalSlider((float)(int)color.b, 0f, 255f, Array.Empty<GUILayoutOption>())); GUILayout.EndHorizontal(); return color; } private static void DrawSearch(Controller c) { //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(8f); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(Strings.Get("search"), Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); if (GUILayout.Button("X " + Strings.Get("close"), (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(110f), GUILayout.Height(26f) })) { GUILayout.EndHorizontal(); c.Close(); return; } GUILayout.EndHorizontal(); GUILayout.Space(8f); GUILayout.Label(Strings.Get("query"), Array.Empty<GUILayoutOption>()); string text = GUILayout.TextField(c.Query, 64, Array.Empty<GUILayoutOption>()); if (text != c.Query) { c.Query = text; c.RefreshMatches(); } Plugin.ShowOccludedMarkers.Value = GUILayout.Toggle(Plugin.ShowOccludedMarkers.Value, Strings.Get("occluded_markers"), Array.Empty<GUILayoutOption>()); c.ShowItemPicker = GUILayout.Toggle(c.ShowItemPicker, Strings.Get("select_item"), Array.Empty<GUILayoutOption>()); if (c.ShowItemPicker) { c.ItemScroll = GUILayout.BeginScrollView(c.ItemScroll, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(140f) }); foreach (string item in c.ItemNames.Where((string i) => string.IsNullOrEmpty(c.Query) || i.IndexOf(c.Query, StringComparison.OrdinalIgnoreCase) >= 0).Take(40)) { if (GUILayout.Button(item, Array.Empty<GUILayoutOption>())) { c.Query = item; c.ShowItemPicker = false; c.RefreshMatches(); } } GUILayout.EndScrollView(); } GUILayout.Label(Strings.Get("radius") + ": " + Plugin.SearchRadius.Value.ToString("0") + " m", Array.Empty<GUILayoutOption>()); Plugin.SearchRadius.Value = GUILayout.HorizontalSlider(Plugin.SearchRadius.Value, 5f, 50f, Array.Empty<GUILayoutOption>()); List<ContainerHandle> list = c.Results.ToList(); GUILayout.Label(Strings.Get("nearby") + ": " + list.Count, Array.Empty<GUILayoutOption>()); c.SearchScroll = GUILayout.BeginScrollView(c.SearchScroll, Array.Empty<GUILayoutOption>()); foreach (ContainerHandle item2 in list) { float num = Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)item2.Container).transform.position); GUILayout.BeginHorizontal(GUI.skin.box, Array.Empty<GUILayoutOption>()); string text2 = GameLocalization.Localize(item2.Piece.m_name); GUILayout.Label(c.MatchName(item2.Container) + " — " + text2 + " (" + num.ToString("0") + " m)", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) }); GUILayout.EndHorizontal(); } if (list.Count == 0) { GUILayout.Label(Strings.Get("empty"), Array.Empty<GUILayoutOption>()); } GUILayout.EndScrollView(); if (GUILayout.Button(Strings.Get("explore"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(32f) })) { c.BeginSearchNavigation(); } GUI.DragWindow(new Rect(0f, 0f, 10000f, 23f)); } } [BepInPlugin("zephyrfit.containercustomizer", "Container Customizer", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string Guid = "zephyrfit.containercustomizer"; public const string Name = "Container Customizer"; public const string Version = "1.0.2"; internal static Plugin Instance; internal static ConfigEntry<KeyboardShortcut> EditorKey; internal static ConfigEntry<KeyboardShortcut> SearchKey; internal static ConfigEntry<float> SearchRadius; internal static ConfigEntry<bool> ShowOccludedMarkers; internal static ConfigEntry<float> SearchWindowX; internal static ConfigEntry<float> SearchWindowY; internal static ConfigEntry<string> Favorites; internal static ConfigEntry<bool> EnableWoodTint; internal static ConfigEntry<float> LabelDistance; private Harmony _harmony; private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown Instance = this; EditorKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "Editor", new KeyboardShortcut((KeyCode)108, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Open the editor for the chest or barrel you are looking at. Avoids SimpleAccessControl's Shift+E."); SearchKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Controls", "Search", new KeyboardShortcut((KeyCode)102, (KeyCode[])(object)new KeyCode[1] { (KeyCode)308 }), "Search nearby chests and barrels."); SearchRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Search", "RadiusMetres", 50f, new ConfigDescription("Search radius in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 50f), Array.Empty<object>())); ShowOccludedMarkers = ((BaseUnityPlugin)this).Config.Bind<bool>("Search", "ShowOccludedMarkers", true, "Show gold star markers for matching chests and barrels hidden behind obstacles. Local preference."); SearchWindowX = ((BaseUnityPlugin)this).Config.Bind<float>("Search", "WindowX", 0.08f, "Horizontal search window position as a fraction of screen width (0 to 1)."); SearchWindowY = ((BaseUnityPlugin)this).Config.Bind<float>("Search", "WindowY", 0.2f, "Vertical search window position as a fraction of screen height (0 to 1)."); Favorites = ((BaseUnityPlugin)this).Config.Bind<string>("Icons", "Favorites", "", "Comma-separated favorite pictogram identifiers. Local preference."); EnableWoodTint = ((BaseUnityPlugin)this).Config.Bind<bool>("Appearance", "TintWood", true, "Tint the original wood texture using per-renderer material properties; no shared material is modified."); LabelDistance = ((BaseUnityPlugin)this).Config.Bind<float>("Appearance", "LabelDistanceMetres", 5f, new ConfigDescription("Maximum distance from your character to world labels and emoji, in metres.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 15f), Array.Empty<object>())); if (!Application.isBatchMode) { _harmony = new Harmony("zephyrfit.containercustomizer"); _harmony.PatchAll(typeof(Plugin).Assembly); ((Component)this).gameObject.AddComponent<Controller>(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Container Customizer 1.0.2 loaded" + (Application.isBatchMode ? " (dedicated server: no UI)" : ""))); } private void OnDestroy() { if (_harmony != null) { _harmony.UnpatchSelf(); } VikingSkin.Dispose(); IconAtlas.Dispose(); if ((Object)(object)Instance == (Object)(object)this) { Instance = null; } } internal static void Warn(string message) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)message); } } internal static void LogInfo(string message) { if ((Object)(object)Instance != (Object)null) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)message); } } } internal sealed class ContainerHandle { internal Container Container; internal Piece Piece; internal ZNetView View; internal ZDO Zdo; internal bool Barrel; internal static bool TryGet(Container container, out ContainerHandle result) { result = null; if ((Object)(object)container == (Object)null) { return false; } Piece componentInParent = ((Component)container).GetComponentInParent<Piece>(); if ((Object)(object)componentInParent == (Object)null) { return false; } string text = (((Object)((Component)componentInParent).gameObject).name + " " + ((Object)((Component)container).gameObject).name).ToLowerInvariant(); bool barrel = text.Contains("barrel") || text.Contains("cask") || text.Contains("keg") || text.Contains("tonneau"); ZNetView val = ((Component)componentInParent).GetComponent<ZNetView>() ?? ((Component)componentInParent).GetComponentInParent<ZNetView>(); if ((Object)(object)val == (Object)null || !val.IsValid()) { return false; } ZDO zDO = val.GetZDO(); if (zDO == null) { return false; } result = new ContainerHandle { Container = container, Piece = componentInParent, View = val, Zdo = zDO, Barrel = barrel }; return true; } internal Style Read() { if (!StyleCodec.TryDecode(Zdo.GetString("zephyrfit_cc_style_v1", ""), out var style)) { return new Style(); } return style; } internal bool CanEdit() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return false; } long playerID = localPlayer.GetPlayerID(); if (playerID == 0L) { return false; } long num = Zdo.GetLong("sac_owner", 0L); long num2 = ((num != 0L) ? num : Piece.GetCreator()); if (num2 == playerID) { return true; } return num2 == 0; } internal bool Save(Style style) { if (!CanEdit() || (Object)(object)View == (Object)null || !View.IsValid()) { return false; } try { if (!View.IsOwner()) { View.ClaimOwnership(); } if (!View.IsOwner()) { return false; } Zdo.Set("zephyrfit_cc_style_v1", StyleCodec.Encode(style)); return true; } catch (Exception ex) { Plugin.Warn("Style save failed: " + ex); return false; } } } internal sealed class Controller : MonoBehaviour { internal static Controller Active; private static readonly HashSet<Container> Registered = new HashSet<Container>(); private static Container _lastHovered; private static float _lastHoverTime; private readonly Dictionary<Vector2Int, List<ContainerHandle>> _cells = new Dictionary<Vector2Int, List<ContainerHandle>>(); private readonly Dictionary<Container, List<string>> _searchItems = new Dictionary<Container, List<string>>(); private readonly Dictionary<Container, string> _matchNames = new Dictionary<Container, string>(); private readonly SortedSet<string> _itemNames = new SortedSet<string>(StringComparer.OrdinalIgnoreCase); private readonly List<ContainerHandle> _nearby = new List<ContainerHandle>(); private readonly Dictionary<Container, Visual> _visuals = new Dictionary<Container, Visual>(); private readonly HashSet<Container> _matches = new HashSet<Container>(); private float _nextRefresh; internal ContainerHandle Editing; internal Style Draft; internal bool SearchOpen; internal bool SearchNavigating; internal string Query = ""; internal string Status = ""; internal float StatusUntil; internal Rect EditorRect; internal Rect SearchRect; internal Vector2 SearchScroll; internal Vector2 EditorScroll; internal int IconTab; internal int EditorSection; internal int ColorTarget; internal int ColorEditMode; internal string EmojiGroup = "all"; internal string EmojiType = "all"; internal bool ShowFavorites; internal bool ShowItemPicker; internal Vector2 ItemScroll; private CursorLockMode _previousCursorLock; private bool _previousCursorVisible; private bool _uiOwnsCursor; internal IEnumerable<string> ItemNames => _itemNames; internal bool IsWindowOpen { get { if (Editing == null) { if (SearchOpen) { return !SearchNavigating; } return false; } return true; } } internal IEnumerable<ContainerHandle> Results => from h in _nearby where _matches.Contains(h.Container) orderby Vector3.Distance(((Component)Player.m_localPlayer).transform.position, ((Component)h.Container).transform.position) select h; internal void ShowStatus(string message) { Status = message; StatusUntil = Time.unscaledTime + 5f; } private void Awake() { Active = this; Container[] array = Object.FindObjectsOfType<Container>(); foreach (Container item in array) { Registered.Add(item); } } internal static void Register(Container container) { if ((Object)(object)container != (Object)null) { Registered.Add(container); } } internal static void Unregister(Container container) { if ((Object)(object)container != (Object)null) { Registered.Remove(container); } } internal static void RecordHover(Container container) { _lastHovered = container; _lastHoverTime = Time.unscaledTime; } private void OnDestroy() { Close(); foreach (Visual value in _visuals.Values) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)value); } } _visuals.Clear(); Registered.Clear(); _lastHovered = null; Active = null; } private void Update() { //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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Player.m_localPlayer == (Object)null) { if (Editing != null || SearchOpen) { Close(); } return; } if (Time.time >= _nextRefresh) { _nextRefresh = Time.time + 1.5f; Refresh(); } KeyboardShortcut value; if (Input.GetKeyDown((KeyCode)27) && (Editing != null || SearchOpen)) { Close(); } else if (SearchOpen) { value = Plugin.SearchKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { if (SearchNavigating) { SearchNavigating = false; OpenCursor(); } else { Close(); } } } else { if (Editing != null || ChatHasFocus()) { return; } value = Plugin.EditorKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { if (LookAtContainer(out var handle)) { if (handle.CanEdit()) { OpenCursor(); Editing = handle; Draft = handle.Read(); IconTab = 1; Status = ""; } else { ShowStatus(Strings.Get("no_permission")); } } else { ShowStatus(Strings.Get("no_target")); } } else { value = Plugin.SearchKey.Value; if (((KeyboardShortcut)(ref value)).IsDown()) { OpenCursor(); SearchOpen = true; RefreshMatches(); } } } } private bool ChatHasFocus() { return GUIUtility.keyboardControl != 0; } private bool LookAtContainer(out ContainerHandle handle) { //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) handle = null; if ((Object)(object)_lastHovered != (Object)null && Time.unscaledTime - _lastHoverTime < 0.5f) { if (ContainerHandle.TryGet(_lastHovered, out handle)) { return true; } Plugin.Warn("Editor could not resolve hovered container '" + ((Object)((Component)_lastHovered).gameObject).name + "': Piece=" + ((Object)(object)((Component)_lastHovered).GetComponentInParent<Piece>() != (Object)null) + ", ZNetView=" + ((Object)(object)((Component)_lastHovered).GetComponentInParent<ZNetView>() != (Object)null)); } if ((Object)(object)GameCamera.instance == (Object)null) { return false; } RaycastHit[] array = Physics.RaycastAll(((Component)GameCamera.instance).transform.position, ((Component)GameCamera.instance).transform.forward, 5f, -5); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int num = 0; num < array2.Length; num++) { RaycastHit val = array2[num]; if (!((Object)(object)((RaycastHit)(ref val)).collider == (Object)null)) { Container val2 = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Container>(); Piece componentInParent = ((Component)((RaycastHit)(ref val)).collider).GetComponentInParent<Piece>(); if ((Object)(object)val2 == (Object)null && (Object)(object)componentInParent != (Object)null) { val2 = ((Component)componentInParent).GetComponentInChildren<Container>(); } if (ContainerHandle.TryGet(val2, out handle)) { return true; } if (!((Object)(object)componentInParent != (Object)null) || ((Object)((Component)componentInParent).gameObject).name.IndexOf("sign", StringComparison.OrdinalIgnoreCase) < 0) { return false; } } } return false; } private void OpenCursor() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (!_uiOwnsCursor) { _previousCursorLock = Cursor.lockState; _previousCursorVisible = Cursor.visible; _uiOwnsCursor = true; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } internal void BeginSearchNavigation() { if (SearchOpen) { SaveSearchPosition(); SearchNavigating = true; GUIUtility.keyboardControl = 0; RestoreCursor(); } } internal void SaveSearchPosition() { if (!(((Rect)(ref SearchRect)).width <= 0f) && Screen.width > 0 && Screen.height > 0) { float num = Mathf.Clamp01(((Rect)(ref SearchRect)).x / (float)Screen.width); float num2 = Mathf.Clamp01(((Rect)(ref SearchRect)).y / (float)Screen.height); if (Mathf.Abs(Plugin.SearchWindowX.Value - num) > 0.001f) { Plugin.SearchWindowX.Value = num; } if (Mathf.Abs(Plugin.SearchWindowY.Value - num2) > 0.001f) { Plugin.SearchWindowY.Value = num2; } } } private void RestoreCursor() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) if (_uiOwnsCursor) { Cursor.lockState = _previousCursorLock; Cursor.visible = _previousCursorVisible; _uiOwnsCursor = false; } } internal void Close() { if (SearchOpen) { SaveSearchPosition(); } Editing = null; Draft = null; SearchOpen = false; SearchNavigating = false; _matches.Clear(); foreach (Visual value in _visuals.Values) { if ((Object)(object)value != (Object)null) { value.SetHighlight(enabled: false); } } GUIUtility.keyboardControl = 0; RestoreCursor(); } private void Refresh() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return; } Vector3 position = ((Component)localPlayer).transform.position; float num = Mathf.Clamp(Plugin.SearchRadius.Value, 5f, 50f); _nearby.Clear(); _cells.Clear(); _searchItems.Clear(); _itemNames.Clear(); Registered.RemoveWhere((Container c) => (Object)(object)c == (Object)null); foreach (Container item in Registered) { if (ContainerHandle.TryGet(item, out var result)) { Vector2Int key = Cell(((Component)item).transform.position); if (!_cells.TryGetValue(key, out var value)) { value = (_cells[key] = new List<ContainerHandle>()); } value.Add(result); } } Vector2Int val = Cell(position); int num2 = Mathf.CeilToInt(num / 10f) + 1; for (int num3 = ((Vector2Int)(ref val)).x - num2; num3 <= ((Vector2Int)(ref val)).x + num2; num3++) { for (int num4 = ((Vector2Int)(ref val)).y - num2; num4 <= ((Vector2Int)(ref val)).y + num2; num4++) { if (!_cells.TryGetValue(new Vector2Int(num3, num4), out var value2)) { continue; } foreach (ContainerHandle item2 in value2) { Vector3 val2 = ((Component)item2.Container).transform.position - position; if (!(((Vector3)(ref val2)).sqrMagnitude > num * num)) { _nearby.Add(item2); } } } } if (_nearby.Count > 256) { _nearby.Sort(delegate(ContainerHandle a, ContainerHandle b) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: 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_0037: 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) Vector3 val3 = ((Component)a.Container).transform.position - position; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; val3 = ((Component)b.Container).transform.position - position; return sqrMagnitude.CompareTo(((Vector3)(ref val3)).sqrMagnitude); }); _nearby.RemoveRange(256, _nearby.Count - 256); } foreach (ContainerHandle item3 in _nearby) { Container container = item3.Container; Index(item3); if (!_visuals.TryGetValue(container, out var value3) || (Object)(object)value3 == (Object)null) { value3 = ((Component)container).gameObject.AddComponent<Visual>(); _visuals[container] = value3; } value3.Render(item3); } foreach (Container old in _visuals.Keys.ToList()) { if ((Object)(object)old == (Object)null || !_nearby.Any((ContainerHandle h) => (Object)(object)h.Container == (Object)(object)old)) { if ((Object)(object)_visuals[old] != (Object)null) { Object.Destroy((Object)(object)_visuals[old]); } _visuals.Remove(old); _matches.Remove(old); } } if (SearchOpen) { RefreshMatches(); } } private void Index(ContainerHandle handle) { List<string> list = new List<string>(); try { Inventory inventory = handle.Container.GetInventory(); if (inventory != null) { foreach (ItemData allItem in inventory.GetAllItems()) { if (allItem != null && allItem.m_shared != null) { string name = allItem.m_shared.m_name; string text = GameLocalization.Localize(name); if (string.IsNullOrEmpty(text)) { text = name; } list.Add(text); if (_itemNames.Count < 512) { _itemNames.Add(text); } } } } } catch (Exception ex) { Plugin.Warn("Inventory indexing failed: " + ex.Message); } _searchItems[handle.Container] = list; } private static Vector2Int Cell(Vector3 position) { //IL_0000: 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_0022: Unknown result type (might be due to invalid IL or missing references) return new Vector2Int(Mathf.FloorToInt(position.x / 10f), Mathf.FloorToInt(position.z / 10f)); } internal void RefreshMatches() { _matches.Clear(); _matchNames.Clear(); if (SearchOpen && !string.IsNullOrWhiteSpace(Query)) { string[] words = Query.Trim().Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); foreach (ContainerHandle item in _nearby) { if (!_searchItems.TryGetValue(item.Container, out var value)) { continue; } string text = value.FirstOrDefault((string item) => words.All((string w) => item.IndexOf(w, StringComparison.OrdinalIgnoreCase) >= 0)); if (text != null) { _matches.Add(item.Container); _matchNames[item.Container] = text; } } } foreach (KeyValuePair<Container, Visual> visual in _visuals) { if ((Object)(object)visual.Value != (Object)null) { visual.Value.SetHighlight(_matches.Contains(visual.Key)); } } } internal string MatchName(Container container) { if (!_matchNames.TryGetValue(container, out var value)) { return ""; } return value; } private void OnGUI() { if (!((Object)(object)Player.m_localPlayer == (Object)null)) { Panels.Draw(this); } } } [HarmonyPatch(typeof(Container), "Awake")] internal static class ContainerAwakePatch { private static void Postfix(Container __instance) { Controller.Register(__instance); } } [HarmonyPatch(typeof(Container), "GetHoverText")] internal static class ContainerHoverPatch { private static void Postfix(Container __instance, ref string __result) { Controller.RecordHover(__instance); if (ContainerHandle.TryGet(__instance, out var result)) { Style style = result.Read(); if (!string.IsNullOrEmpty(style.Name)) { __result = __result + "\n" + style.Name; } if (result.CanEdit()) { __result = __result + "\n[Left Alt + L] " + Strings.Get("edit"); } } } } [HarmonyPatch(typeof(Player), "TakeInput")] internal static class PlayerTakeInputPatch { private static void Postfix(Player __instance, ref bool __result) { if ((Object)(object)Controller.Active != (Object)null && Controller.Active.IsWindowOpen && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { __result = false; } } } [HarmonyPatch(typeof(PlayerController), "TakeInput", new Type[] { typeof(bool) })] internal static class PlayerControllerTakeInputPatch { private static void Postfix(ref bool __result) { if ((Object)(object)Controller.Active != (Object)null && Controller.Active.IsWindowOpen) { __result = false; } } } [HarmonyPatch(typeof(GameCamera), "UpdateMouseCapture")] internal static class CameraMouseCapturePatch { private static bool Prefix() { if ((Object)(object)Controller.Active == (Object)null || !Controller.Active.IsWindowOpen) { return true; } Cursor.visible = true; Cursor.lockState = (CursorLockMode)0; return false; } } internal enum BackgroundMode : byte { Transparent, White, Black } internal enum IconMode : byte { Pictogram, EmojiOriginal, EmojiMonochrome } internal sealed class Style { internal string Name = ""; internal string Icon = ""; internal IconMode IconMode; internal BackgroundMode Background; internal Color32 Wood = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); internal Color32 Text = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); internal Color32 IconColor = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); internal float TextScale = 1f; internal bool Faces = true; internal bool Lid = true; internal bool IsEmpty { get { if (Name.Length == 0 && Icon.Length == 0 && Background == BackgroundMode.Transparent && Wood.r == byte.MaxValue && Wood.g == byte.MaxValue) { return Wood.b == byte.MaxValue; } return false; } } internal Style Clone() { return (Style)MemberwiseClone(); } } internal static class StyleCodec { internal const string ZdoKey = "zephyrfit_cc_style_v1"; private const byte Version = 3; internal const int MaxName = 64; internal const int MaxIcon = 12; internal static string Encode(Style style) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) using MemoryStream memoryStream = new MemoryStream(); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream, Encoding.UTF8); int num = Mathf.Clamp(Mathf.RoundToInt(style.TextScale * 100f), 50, 300); byte b = (byte)((num <= 160) ? 2 : 3); binaryWriter.Write(b); binaryWriter.Write(Trim(style.Name, 64)); binaryWriter.Write(Trim(style.Icon, 12)); binaryWriter.Write((byte)style.IconMode); binaryWriter.Write((byte)style.Background); WriteColor(binaryWriter, style.Wood); WriteColor(binaryWriter, style.Text); WriteColor(binaryWriter, style.IconColor); binaryWriter.Write(style.Faces); binaryWriter.Write(style.Lid); if (b == 2) { binaryWriter.Write((byte)num); } else { binaryWriter.Write((ushort)num); } return Convert.ToBase64String(memoryStream.ToArray()); } internal static bool TryDecode(string value, out Style style) { //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) style = null; if (string.IsNullOrEmpty(value) || value.Length > 1024) { return false; } try { byte[] array = Convert.FromBase64String(value); if (array.Length > 768) { return false; } using MemoryStream memoryStream = new MemoryStream(array); using BinaryReader binaryReader = new BinaryReader(memoryStream, Encoding.UTF8); byte b = binaryReader.ReadByte(); if (b < 1 || b > 3) { return false; } Style style2 = new Style { Name = binaryReader.ReadString(), Icon = binaryReader.ReadString() }; if (style2.Name.Length > 64 || style2.Icon.Length > 12) { return false; } style2.IconMode = (IconMode)binaryReader.ReadByte(); style2.Background = (BackgroundMode)binaryReader.ReadByte(); if ((int)style2.IconMode > 2 || (int)style2.Background > 2) { return false; } style2.Wood = ReadColor(binaryReader); style2.Text = ReadColor(binaryReader); style2.IconColor = ReadColor(binaryReader); style2.Faces = binaryReader.ReadBoolean(); style2.Lid = binaryReader.ReadBoolean(); if (b >= 2) { int num = ((b >= 3) ? binaryReader.ReadUInt16() : binaryReader.ReadByte()); if (num < 50 || num > ((b >= 3) ? 300 : 160)) { return false; } style2.TextScale = (float)num / 100f; } if (memoryStream.Position != memoryStream.Length) { return false; } style = style2; return true; } catch (Exception) { return false; } } private static string Trim(string text, int max) { text = (text ?? "").Replace("<", "").Replace(">", ""); if (text.Length <= max) { return text; } return text.Substring(0, max); } private static void WriteColor(BinaryWriter writer, Color32 color) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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) writer.Write(color.r); writer.Write(color.g); writer.Write(color.b); writer.Write(color.a); } private static Color32 ReadColor(BinaryReader reader) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) return new Color32(reader.ReadByte(), reader.ReadByte(), reader.ReadByte(), reader.ReadByte()); } } internal static class VikingSkin { internal struct DrawingScope : IDisposable { private readonly GUISkin _previousSkin; private readonly Color _previousColor; private readonly Color _previousBackground; private readonly Color _previousContent; internal DrawingScope(GUISkin original) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //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_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missi