using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using Mirror; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GearDebug")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Debug panel for equipping Big Walk props and recolouring your character in a solo game")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1")] [assembly: AssemblyProduct("GearDebug")] [assembly: AssemblyTitle("GearDebug")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [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 GearDebug { internal static class CharacterColour { public static Color Custom = new Color(1f, 0.35f, 0.1f); public static bool PaintHead = true; public static bool PaintTorso = true; public static bool PaintLegs = true; public static bool Keep; public static string RepaintError; private static float _nextRepaint; private static IntPtr _paletteFrom; private static Color[] _swatches = Array.Empty(); private static bool[] _locked = Array.Empty(); private static IntPtr _rememberedFor; private static int _headWas; private static int _torsoWas; private static int _legsWas; public static int PaletteCount => _swatches.Length; public static bool Remembered => _rememberedFor != IntPtr.Zero; public static Color Swatch(int id) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (id < 0 || id >= _swatches.Length) { return Color.grey; } return _swatches[id]; } public static bool Locked(int id) { if (id >= 0 && id < _locked.Length) { return _locked[id]; } return false; } public static void ReadPalette(PlayerCharacter pc) { //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown object obj; if (pc == null) { obj = null; } else { PlayerLooks looks = pc.looks; obj = ((looks != null) ? looks.lookSet : null); } PlayerLookSet val = (PlayerLookSet)obj; if ((Object)(object)val == (Object)null || ((Il2CppObjectBase)val).Pointer == _paletteFrom) { return; } bool flag = default(bool); try { Il2CppStructArray colors = val.colors; int num = ((Il2CppArrayBase)(object)colors)?.Length ?? 0; Color[] array = (Color[])(object)new Color[num]; bool[] array2 = new bool[num]; for (int i = 0; i < num; i++) { LookColor val2 = ((Il2CppArrayBase)(object)colors)[i]; array[i] = val2.color; array2[i] = val2.rewardOnly; } _swatches = array; _locked = array2; _paletteFrom = ((Il2CppObjectBase)val).Pointer; ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("palette: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" colours, "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(Count(array2)); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" of them reward-only"); } log.LogInfo(val3); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(35, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("could not read the colour palette: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex.Message); } log2.LogWarning(val4); } } private static int Count(bool[] flags) { int num = 0; for (int i = 0; i < flags.Length; i++) { if (flags[i]) { num++; } } return num; } public static int Current(PlayerCharacter pc, LookPart part) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) try { return (((pc != null) ? pc.looks : null) == null) ? (-1) : pc.looks.GetLookId(part); } catch (Exception) { return -1; } } public static string SetFromPalette(PlayerCharacter pc, LookPart part, int id) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) PlayerLooks val = ((pc != null) ? pc.looks : null); if (val == null) { return "no player to recolour"; } if (id < 0 || id >= _swatches.Length) { return $"there is no colour {id} in the palette"; } Remember(pc, val); string arg; try { val.ServerSaveLook(part, id); arg = "saved"; } catch (Exception ex) { arg = "local only"; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(55, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("ServerSaveLook was refused ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("), painting locally instead"); } log.LogInfo(val2); } string text = Paint(val, part, Colour(val, id)); if (text != null) { return text; } string text2 = $"{Name(part)} is now colour {id} ({arg})"; Plugin.Log.LogInfo((object)text2); return null; } public static string SetWholeBody(PlayerCharacter pc, int id) { return SetFromPalette(pc, (LookPart)0, id) ?? SetFromPalette(pc, (LookPart)1, id) ?? SetFromPalette(pc, (LookPart)2, id); } public static int CurrentWholeBody(PlayerCharacter pc) { int num = Current(pc, (LookPart)0); int num2 = Current(pc, (LookPart)1); int num3 = Current(pc, (LookPart)2); if (num < 0 || num != num2 || num != num3) { return -1; } return num; } private static LookColor Colour(PlayerLooks looks, int id) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) try { return looks.GetColor(id); } catch (Exception) { return new LookColor { color = Swatch(id) }; } } public static string PaintCustom(PlayerCharacter pc) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) PlayerLooks val = ((pc != null) ? pc.looks : null); if (val == null) { return "no player to recolour"; } if (!PaintHead && !PaintTorso && !PaintLegs) { return "tick a part to paint first"; } Remember(pc, val); LookColor colour = new LookColor { color = Custom }; string text = Apply(val, colour); if (text != null) { return text; } RepaintError = null; Keep = true; _nextRepaint = Time.unscaledTime + Mathf.Max(0f, Plugin.RepaintInterval.Value); return null; } public static void Repaint(PlayerCharacter pc) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown if (!Keep || RepaintError != null) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < _nextRepaint) { return; } _nextRepaint = unscaledTime + Mathf.Max(0f, Plugin.RepaintInterval.Value); PlayerLooks val = (((Object)(object)pc == (Object)null) ? null : pc.looks); if (val == null) { return; } string text = Apply(val, new LookColor { color = Custom }); if (text != null) { RepaintError = text; Keep = false; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("stopped repainting: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(text); } log.LogWarning(val2); } } private static string Apply(PlayerLooks looks, LookColor colour) { //IL_0009: 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_0033: Unknown result type (might be due to invalid IL or missing references) if (PaintHead) { string text = Paint(looks, (LookPart)0, colour); if (text != null) { return text; } } if (PaintTorso) { string text2 = Paint(looks, (LookPart)1, colour); if (text2 != null) { return text2; } } if (PaintLegs) { string text3 = Paint(looks, (LookPart)2, colour); if (text3 != null) { return text3; } } return null; } private static string Paint(PlayerLooks looks, LookPart part, LookColor colour) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) try { Il2CppReferenceArray val = Renderers(looks, part); if (val == null) { return "the game lists no " + Name(part) + " renderers"; } looks.SetColor(val, colour); return null; } catch (Exception ex) { return "could not colour the " + Name(part) + ": " + ex.Message; } } private static Il2CppReferenceArray Renderers(PlayerLooks looks, LookPart part) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)part != 1) { if ((int)part == 2) { return looks.legsRenderers; } return looks.headRenderers; } return looks.torsoRenderers; } public static string PutThemBack(PlayerCharacter pc) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown if ((Object)(object)pc == (Object)null) { return "no player to recolour"; } if (((Il2CppObjectBase)pc).Pointer != _rememberedFor) { return "nothing to put back"; } Keep = false; string text = SetFromPalette(pc, (LookPart)0, _headWas) ?? SetFromPalette(pc, (LookPart)1, _torsoWas) ?? SetFromPalette(pc, (LookPart)2, _legsWas); if (text != null) { return text; } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(26, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("put the colours back to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_headWas); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_torsoWas); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_legsWas); } log.LogInfo(val); return null; } public static int Random(PlayerCharacter pc) { try { PlayerLooks val = ((pc != null) ? pc.looks : null); if (val != null) { return val.GetRandomLookId(); } } catch (Exception) { } if (_swatches.Length == 0) { return -1; } for (int i = 0; i < 20; i++) { int num = Random.Range(0, _swatches.Length); if (!Locked(num)) { return num; } } return 0; } private static void Remember(PlayerCharacter pc, PlayerLooks looks) { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown if (((Il2CppObjectBase)pc).Pointer == _rememberedFor) { return; } bool flag = default(bool); try { _headWas = looks.GetLookId((LookPart)0); _torsoWas = looks.GetLookId((LookPart)1); _legsWas = looks.GetLookId((LookPart)2); _rememberedFor = ((Il2CppObjectBase)pc).Pointer; ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(57, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("colours before anything was changed: head "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_headWas); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("torso "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_torsoWas); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", legs "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(_legsWas); } log.LogInfo(val); } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(70, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("could not read the current look ids, so there is nothing to "); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("put back: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ex.Message); } log2.LogWarning(val2); } } public static string Name(LookPart part) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 if ((int)part != 1) { if ((int)part == 2) { return "legs"; } return "head"; } return "torso"; } public static void Report(PlayerCharacter pc) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown PlayerLooks val = ((pc != null) ? pc.looks : null); if (val == null) { Plugin.Log.LogInfo((object)"colours: no PlayerLooks on this character"); return; } ReadPalette(pc); LookPart[] array = (LookPart[])(object)new LookPart[3] { default(LookPart), (LookPart)1, (LookPart)2 }; foreach (LookPart part in array) { int num = Current(pc, part); Color val2 = Swatch(num); Plugin.Log.LogInfo((object)($"colour {Name(part)}: look id {num} " + $"rgb({val2.r:0.##}, {val2.g:0.##}, {val2.b:0.##})" + (Locked(num) ? " reward-only" : ""))); } if (Keep) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(53, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("free colour is being repainted every frame: "); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("rgb("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(Custom.r, "0.##"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(Custom.g, "0.##"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(Custom.b, "0.##"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")"); } log.LogInfo(val3); } Parts(val); } private static void Parts(PlayerLooks looks) { Part(looks, (LookPart)0, looks.headRenderers); Part(looks, (LookPart)1, looks.torsoRenderers); Part(looks, (LookPart)2, looks.legsRenderers); } private static void Part(PlayerLooks looks, LookPart part, Il2CppReferenceArray list) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val; if (list == null) { ManualLogSource log = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name(part)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": no renderer list"); } log.LogInfo(val); return; } ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("--- "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name(part)); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Il2CppArrayBase)(object)list).Length); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" renderers the colour is written to ---"); } log2.LogInfo(val); for (int i = 0; i < ((Il2CppArrayBase)(object)list).Length; i++) { LooksRenderer val2 = ((Il2CppArrayBase)(object)list)[i]; if (val2 == null) { continue; } Renderer renderer = val2.renderer; if ((Object)(object)renderer == (Object)null) { ManualLogSource log3 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(33, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(i); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] (no renderer) local="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(val2.local); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" remote="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(val2.remote); } log3.LogInfo(val); continue; } string text = "?"; try { Material sharedMaterial = renderer.sharedMaterial; text = (((Object)(object)sharedMaterial == (Object)null) ? "(none)" : ((Object)sharedMaterial).name); } catch (Exception) { } string text2 = ""; try { Component componentInParent = ((Component)renderer).GetComponentInParent(Il2CppType.Of(), true); if ((Object)(object)componentInParent != (Object)null) { LODGroup val3 = ((Il2CppObjectBase)componentInParent).TryCast(); text2 = " LODGROUP('" + ((Object)componentInParent.gameObject).name + "'" + (((Object)(object)val3 != (Object)null) ? $", {val3.lodCount} levels, enabled={val3.enabled}" : "") + ")"; } } catch (Exception) { text2 = " LODGROUP(?)"; } ManualLogSource log4 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(58, 10, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(i); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)((Component)renderer).gameObject).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' local="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(val2.local); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" remote="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(val2.remote); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" mat:"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" enabled="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(renderer.enabled); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" forceOff="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(renderer.forceRenderingOff); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" active="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Component)renderer).gameObject.activeInHierarchy); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" at "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Path(((Component)renderer).transform)); } log4.LogInfo(val); } } private static string Path(Transform t) { string text = ((Object)t).name; Transform parent = t.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } } internal enum GearTab { Gear, Colour } internal static class GearPanel { private struct Entry { public Prop Prop; public string Name; public string Search; public float Distance; } private struct PropRow { public Prop Prop; public string Text; } private struct SlotRow { public PropHome Home; public string Text; } private static readonly List Props = new List(); private static readonly List Homes = new List(); private static PlayerCharacter _player; private static Prop _picked; private static string _filter = ""; private static string _status = ""; private static GearTab _tab = GearTab.Gear; private static LookPart _part = (LookPart)0; private static bool _whole; private static Vector2 _homeScroll; private static Vector2 _propScroll; private static bool _rowsDirty = true; private static float _nextRebuild; private static string _rowFilter; private const float RebuildInterval = 0.5f; private static bool _ready; private static float _scale = 1.6f; private static float _height = 600f; private static GearTab _drawTab; private static bool _havePlayer; private static SlotRow[] _slotRows = Array.Empty(); private static PropRow[] _propRows = Array.Empty(); private static int _matched; private static bool _crowded; private static int _palette; private static bool _repaintFailed; private static int _curHead = -1; private static int _curTorso = -1; private static int _curLegs = -1; private const float Width = 560f; private const int PerRow = 8; private const float SwatchWidth = 58f; private const float SwatchHeight = 34f; private static GUILayoutOption[] _swatchSize; private static GUILayoutOption[] _slotsHigh; private static GUILayoutOption[] _propsHigh; private static GUILayoutOption[] _filterWide; private static GUILayoutOption[] _paintLabel; private static GUILayoutOption[] _channelLabel; private static Texture2D _white; public static PlayerCharacter Player => _player; private static void Sizes() { if (_swatchSize == null) { _swatchSize = (GUILayoutOption[])(object)new GUILayoutOption[2] { GUILayout.Width(58f), GUILayout.Height(34f) }; _slotsHigh = (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(180f) }; _propsHigh = (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(320f) }; _filterWide = (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(160f) }; _paintLabel = (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(60f) }; _channelLabel = (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(100f) }; } } public static void Refresh() { _player = FindPlayer(); if ((Object)(object)_player == (Object)null) { _status = "no local player yet — load into a game first"; _rowsDirty = true; Homes.Clear(); Props.Clear(); } else { FindHomes(_player); FindProps(_player); CharacterColour.ReadPalette(_player); _status = $"{Homes.Count} slots on you, {Props.Count} props in the world"; } } private static void Snapshot() { _ready = true; float num = Mathf.Max(0.5f, Plugin.Scale.Value); float num2 = Mathf.Max(0.5f, (float)Screen.width / 600f); _scale = Mathf.Min(num, num2); _height = (float)Screen.height / _scale - 20f; _drawTab = _tab; _repaintFailed = CharacterColour.RepaintError != null; _palette = CharacterColour.PaletteCount; bool flag = (Object)(object)_player != (Object)null; if (flag != _havePlayer) { _havePlayer = flag; _rowsDirty = true; } if (_drawTab == GearTab.Colour && _havePlayer) { _curHead = CharacterColour.Current(_player, (LookPart)0); _curTorso = CharacterColour.Current(_player, (LookPart)1); _curLegs = CharacterColour.Current(_player, (LookPart)2); } float unscaledTime = Time.unscaledTime; if (_rowsDirty || !string.Equals(_filter, _rowFilter, StringComparison.Ordinal) || unscaledTime >= _nextRebuild) { _rowsDirty = false; _rowFilter = _filter; _nextRebuild = unscaledTime + 0.5f; BuildSlotRows(); BuildPropRows(); } } private static void BuildSlotRows() { if (!_havePlayer) { _slotRows = Array.Empty(); return; } List list = new List(Homes.Count); foreach (PropHome home in Homes) { if (!((Object)(object)home == (Object)null)) { Prop pinnedProp = home.pinnedProp; list.Add(new SlotRow { Home = home, Text = Label(home) + " — " + (((Object)(object)pinnedProp == (Object)null) ? "empty" : ("'" + Name(pinnedProp) + "'")) }); } } _slotRows = list.ToArray(); } private static void BuildPropRows() { _matched = 0; _crowded = false; if (!_havePlayer) { _propRows = Array.Empty(); return; } string text = (_filter ?? "").Trim().ToLowerInvariant(); int num = Mathf.Max(1, Plugin.ListLimit.Value); List list = new List(Mathf.Min(num, Props.Count)); foreach (Entry prop in Props) { if (!((Object)(object)prop.Prop == (Object)null) && (text.Length <= 0 || prop.Search.IndexOf(text, StringComparison.Ordinal) >= 0)) { _matched++; if (list.Count < num) { list.Add(new PropRow { Prop = prop.Prop, Text = $"{prop.Name} {prop.Distance:0}m" }); } } } _propRows = list.ToArray(); _crowded = _matched > list.Count; } public static void Closed() { _ready = false; } public static void Draw() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) Sizes(); if ((int)Event.current.type == 8) { Snapshot(); } else if (!_ready) { return; } Matrix4x4 matrix = GUI.matrix; GUI.matrix = Matrix4x4.Scale(new Vector3(_scale, _scale, 1f)); GUILayout.BeginArea(new Rect(10f, 10f, 560f, _height), GUI.skin.box); try { Body(); } finally { GUI.enabled = true; GUILayout.EndArea(); GUI.matrix = matrix; } } private static void Body() { GUILayout.Label("GEAR DEBUG", (Il2CppReferenceArray)null); TabBar(); if (!_havePlayer) { GUILayout.Label((_status.Length > 0) ? _status : "not looked yet", (Il2CppReferenceArray)null); if (GUILayout.Button("Look for the player", (Il2CppReferenceArray)null)) { Refresh(); } return; } if (_drawTab == GearTab.Colour) { ColourBody(); } else { GearBody(); } GUILayout.Space(6f); GUILayout.Label(_status, (Il2CppReferenceArray)null); GUILayout.BeginHorizontal((Il2CppReferenceArray)null); if (GUILayout.Button("Refresh", (Il2CppReferenceArray)null)) { Refresh(); } if (GUILayout.Button("Log a report", (Il2CppReferenceArray)null)) { Report(); } GUILayout.EndHorizontal(); } private static void TabBar() { GUILayout.BeginHorizontal((Il2CppReferenceArray)null); Pick(GearTab.Gear, "Gear"); Pick(GearTab.Colour, "Colour"); GUILayout.EndHorizontal(); } private static void Pick(GearTab tab, string label) { bool flag = _tab == tab; if (!(!GUILayout.Button(flag ? ("[" + label + "]") : label, (Il2CppReferenceArray)null) || flag)) { _tab = tab; _status = ""; } } private static void GearBody() { DrawSlots(); DrawProps(); } private static void DrawSlots() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(6f); GUILayout.Label($"Slots on your character ({_slotRows.Length})", (Il2CppReferenceArray)null); _homeScroll = GUILayout.BeginScrollView(_homeScroll, _slotsHigh); SlotRow[] slotRows = _slotRows; for (int i = 0; i < slotRows.Length; i++) { SlotRow slotRow = slotRows[i]; GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label(slotRow.Text, (Il2CppReferenceArray)null); GUILayout.FlexibleSpace(); if (GUILayout.Button("Fill", (Il2CppReferenceArray)null)) { Pin(slotRow.Home); } if (GUILayout.Button("Clear", (Il2CppReferenceArray)null)) { Unpin(slotRow.Home); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); } private static void DrawProps() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(6f); GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label("Props in the world filter:", (Il2CppReferenceArray)null); _filter = GUILayout.TextField(_filter ?? "", _filterWide); if (GUILayout.Button("x", (Il2CppReferenceArray)null)) { _filter = ""; } GUILayout.EndHorizontal(); GUILayout.Label(((Object)(object)_picked == (Object)null) ? "nothing picked yet" : ("picked: '" + Name(_picked) + "'"), (Il2CppReferenceArray)null); _propScroll = GUILayout.BeginScrollView(_propScroll, _propsHigh); PropRow[] propRows = _propRows; for (int i = 0; i < propRows.Length; i++) { PropRow propRow = propRows[i]; GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label(propRow.Text, (Il2CppReferenceArray)null); GUILayout.FlexibleSpace(); if (GUILayout.Button("Pick", (Il2CppReferenceArray)null)) { Pick(propRow.Prop); } if (GUILayout.Button("Hold", (Il2CppReferenceArray)null)) { Hold(propRow.Prop); } GUILayout.EndHorizontal(); } GUILayout.EndScrollView(); if (_crowded) { GUILayout.Label($"showing {_propRows.Length} of {_matched} matches — " + "narrow the filter to see the rest", (Il2CppReferenceArray)null); } } private static void ColourBody() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Invalid comparison between Unknown and I4 //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0236: 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_0272: Unknown result type (might be due to invalid IL or missing references) GUILayout.Space(6f); GUILayout.Label("— The game's palette —", (Il2CppReferenceArray)null); PartBar(); int current = ((!_whole) ? (((int)_part == 1) ? _curTorso : (((int)_part == 2) ? _curLegs : _curHead)) : ((_curHead >= 0 && _curHead == _curTorso && _curHead == _curLegs) ? _curHead : (-1))); GUILayout.Label(Wearing(current), (Il2CppReferenceArray)null); Swatches(current); GUILayout.BeginHorizontal((Il2CppReferenceArray)null); if (GUILayout.Button(_whole ? "Random" : ("Random " + CharacterColour.Name(_part)), (Il2CppReferenceArray)null)) { Set(CharacterColour.Random(_player)); } if (GUILayout.Button("Random each part", (Il2CppReferenceArray)null)) { RandomAll(); } GUI.enabled = CharacterColour.Remembered; if (GUILayout.Button("Put them back", (Il2CppReferenceArray)null)) { Say(CharacterColour.PutThemBack(_player), "colours put back"); } GUI.enabled = true; GUILayout.EndHorizontal(); GUILayout.Space(10f); GUILayout.Label("— Any colour at all —", (Il2CppReferenceArray)null); GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label("Paint:", _paintLabel); CharacterColour.PaintHead = GUILayout.Toggle(CharacterColour.PaintHead, " head ", Array.Empty()); CharacterColour.PaintTorso = GUILayout.Toggle(CharacterColour.PaintTorso, " torso ", Array.Empty()); CharacterColour.PaintLegs = GUILayout.Toggle(CharacterColour.PaintLegs, " legs ", Array.Empty()); GUILayout.EndHorizontal(); Color custom = CharacterColour.Custom; custom.r = Channel("Red", custom.r); custom.g = Channel("Green", custom.g); custom.b = Channel("Blue", custom.b); CharacterColour.Custom = custom; GUILayout.BeginHorizontal((Il2CppReferenceArray)null); Preset("White", Color.white); Preset("Black", new Color(0.05f, 0.05f, 0.05f)); Preset("Red", new Color(0.9f, 0.1f, 0.1f)); Preset("Green", new Color(0.15f, 0.8f, 0.2f)); Preset("Blue", new Color(0.15f, 0.35f, 0.95f)); Preset("Pink", new Color(1f, 0.4f, 0.75f)); GUILayout.EndHorizontal(); GUILayout.BeginHorizontal((Il2CppReferenceArray)null); if (GUILayout.Button("Paint it", (Il2CppReferenceArray)null)) { Say(CharacterColour.PaintCustom(_player), "painted, and keeping it"); } bool flag = GUILayout.Toggle(CharacterColour.Keep, " Keep it painted", Array.Empty()); if (flag != CharacterColour.Keep) { CharacterColour.Keep = flag; CharacterColour.RepaintError = null; if (flag) { Say(CharacterColour.PaintCustom(_player), "keeping it painted"); } else { _status = "stopped repainting"; } } GUILayout.EndHorizontal(); GUILayout.Label("A free colour is yours alone and is not saved. Changing view repaints", (Il2CppReferenceArray)null); GUILayout.Label("you from the palette, so painting one turns Keep it painted on for you.", (Il2CppReferenceArray)null); if (_repaintFailed) { GUILayout.Label("repainting stopped: " + CharacterColour.RepaintError, (Il2CppReferenceArray)null); } } private static string Wearing(int current) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (!_whole) { if (current >= 0) { return $"{CharacterColour.Name(_part)}: colour #{current} of {_palette}" + (CharacterColour.Locked(current) ? " (reward-only)" : ""); } return CharacterColour.Name(_part) + ": the game will not say which colour it is wearing"; } if (current >= 0) { return $"whole body: colour #{current} of {_palette}"; } return $"whole body: mixed — head #{_curHead}, torso #{_curTorso}, legs #{_curLegs}"; } private static void PartBar() { GUILayout.BeginHorizontal((Il2CppReferenceArray)null); PartPick((LookPart)0, "Head"); PartPick((LookPart)1, "Torso"); PartPick((LookPart)2, "Legs"); bool whole = _whole; if (GUILayout.Button(whole ? "[Whole body]" : "Whole body", (Il2CppReferenceArray)null) && !whole) { _whole = true; _status = ""; } GUILayout.EndHorizontal(); } private static void PartPick(LookPart part, string label) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) bool flag = !_whole && _part == part; if (!(!GUILayout.Button(flag ? ("[" + label + "]") : label, (Il2CppReferenceArray)null) || flag)) { _part = part; _whole = false; _status = ""; } } private static void Swatches(int current) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (_palette == 0) { GUILayout.Label("no palette yet — press Refresh once you are in a game", (Il2CppReferenceArray)null); return; } for (int i = 0; i < _palette; i += 8) { GUILayout.BeginHorizontal((Il2CppReferenceArray)null); for (int j = i; j < i + 8 && j < _palette; j++) { bool num = GUILayout.Button("", _swatchSize); Fill(GUILayoutUtility.GetLastRect(), j, j == current); if (num) { Set(j); } } GUILayout.EndHorizontal(); } } private static void Fill(Rect cell, int id, bool current) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00a4: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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) if ((int)Event.current.type == 7) { Color val = CharacterColour.Swatch(id); val.a = 1f; Color color = GUI.color; if (_white == null) { _white = Texture2D.whiteTexture; } if (current) { GUI.color = Color.white; GUI.DrawTexture(Inset(cell, 2f), (Texture)(object)_white); } GUI.color = val; GUI.DrawTexture(Inset(cell, current ? 5f : 3f), (Texture)(object)_white); if (CharacterColour.Locked(id)) { GUI.color = ((0.299f * val.r + 0.587f * val.g + 0.114f * val.b > 0.55f) ? Color.black : Color.white); GUI.Label(Inset(cell, 5f), "*"); } GUI.color = color; } } private static Rect Inset(Rect r, float by) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) return new Rect(((Rect)(ref r)).x + by, ((Rect)(ref r)).y + by, Mathf.Max(0f, ((Rect)(ref r)).width - 2f * by), Mathf.Max(0f, ((Rect)(ref r)).height - 2f * by)); } private static float Channel(string label, float value) { GUILayout.BeginHorizontal((Il2CppReferenceArray)null); GUILayout.Label($"{label}: {value:0.##}", _channelLabel); float result = GUILayout.HorizontalSlider(value, 0f, 1f, Array.Empty()); GUILayout.EndHorizontal(); return result; } private static void Preset(string label, Color colour) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = colour; bool num = GUILayout.Button(label, (Il2CppReferenceArray)null); GUI.backgroundColor = backgroundColor; if (num) { CharacterColour.Custom = colour; Say(CharacterColour.PaintCustom(_player), "painted " + label.ToLowerInvariant() + ", and keeping it"); } } private static void Set(int id) { //IL_003c: 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) if (id < 0) { _status = "the game has no colour to give"; } else if (_whole) { Say(CharacterColour.SetWholeBody(_player, id), $"all of you is colour #{id}"); } else { Say(CharacterColour.SetFromPalette(_player, _part, id), $"{CharacterColour.Name(_part)} set to colour #{id}"); } } private static void RandomAll() { Say(CharacterColour.SetFromPalette(_player, (LookPart)0, CharacterColour.Random(_player)) ?? CharacterColour.SetFromPalette(_player, (LookPart)1, CharacterColour.Random(_player)) ?? CharacterColour.SetFromPalette(_player, (LookPart)2, CharacterColour.Random(_player)), "randomised"); } private static void Say(string failed, string good) { _status = failed ?? good; } private static void Pick(Prop prop) { _picked = prop; _status = "picked '" + Name(prop) + "'"; } private static void Pin(PropHome home) { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown if ((Object)(object)_picked == (Object)null) { _status = "pick a prop from the list below first"; return; } try { _picked.ServerSetPinned(home); _status = "pinned '" + Name(_picked) + "' into " + Label(home); Plugin.Log.LogInfo((object)_status); FindHomes(_player); } catch (Exception ex) { try { _picked.PredictivelyPlaceInHome(home); _status = "placed '" + Name(_picked) + "' into " + Label(home) + " as a client"; Plugin.Log.LogInfo((object)_status); FindHomes(_player); } catch (Exception ex2) { _status = "could not pin: " + ex2.Message; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(16, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("pinning failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogWarning(val); } } } private static void Unpin(PropHome home) { Prop pinnedProp = home.pinnedProp; if ((Object)(object)pinnedProp == (Object)null) { _status = Label(home) + " is already empty"; return; } try { pinnedProp.ServerSetUnpinned(); _status = "took '" + Name(pinnedProp) + "' out of " + Label(home); Plugin.Log.LogInfo((object)_status); FindHomes(_player); } catch (Exception ex) { _status = "could not clear " + Label(home) + ": " + ex.Message; } } private static void Hold(Prop prop) { try { prop.SetHeld(_player); _status = "holding '" + Name(prop) + "'"; Plugin.Log.LogInfo((object)_status); } catch (Exception ex) { _status = "could not hold '" + Name(prop) + "': " + ex.Message; } } private static string Label(PropHome home) { PlayerCharacter player = _player; PlayerRegistry val = ((player != null) ? player.registry : null); if (val != null) { if ((Object)(object)home == (Object)(object)val.backpackPocket) { return "BACKPACK"; } if ((Object)(object)home == (Object)(object)val.holsterPocket) { return "BELT (holster)"; } if ((Object)(object)home == (Object)(object)val.blindfoldPocket) { return "BLINDFOLD"; } } return ((Object)home).name + (home.isInventory ? " (inventory)" : ""); } private unsafe static string Name(Prop prop) { //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_0017: Unknown result type (might be due to invalid IL or missing references) string text = ((Object)prop).name ?? "?"; SaveablePropName saveablePropName = prop.saveablePropName; if ((int)saveablePropName == 0) { return text; } string text2 = ((object)(*(SaveablePropName*)(&saveablePropName))/*cast due to .constrained prefix*/).ToString(); if (text.IndexOf(text2, StringComparison.OrdinalIgnoreCase) >= 0) { return text; } return text + " [" + text2 + "]"; } private static PlayerCharacter FindPlayer() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown try { Il2CppReferenceArray val = Object.FindObjectsOfType(Il2CppType.Of()); if (val == null) { return null; } PlayerCharacter result = null; for (int i = 0; i < ((Il2CppArrayBase)(object)val).Length; i++) { Object obj = ((Il2CppArrayBase)(object)val)[i]; PlayerCharacter val2 = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null); if ((Object)(object)val2 == (Object)null) { continue; } try { if (((NetworkBehaviour)val2).isLocalPlayer) { return val2; } } catch (Exception) { } PlayerCameraMinder cameraMinder = val2.cameraMinder; PlayerCameraReferences val3 = ((cameraMinder != null) ? cameraMinder.playerCameraReferences : null); if ((Object)(object)val3 != (Object)null && (Object)(object)val3.playerCamera != (Object)null) { result = val2; } } return result; } catch (Exception ex2) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("could not find the player: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted(ex2.Message); } log.LogWarning(val4); return null; } } private static void FindHomes(PlayerCharacter pc) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown _rowsDirty = true; Homes.Clear(); if ((Object)(object)pc == (Object)null) { return; } PlayerRegistry registry = pc.registry; if (registry != null) { Add(registry.backpackPocket); Add(registry.holsterPocket); Add(registry.blindfoldPocket); } try { Il2CppReferenceArray componentsInChildren = ((Component)pc).GetComponentsInChildren(Il2CppType.Of(), true); if (componentsInChildren != null) { for (int i = 0; i < ((Il2CppArrayBase)(object)componentsInChildren).Length; i++) { Component obj = ((Il2CppArrayBase)(object)componentsInChildren)[i]; Add((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("could not list your slots: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); } log.LogWarning(val); } } private static void Add(PropHome home) { if ((Object)(object)home == (Object)null) { return; } foreach (PropHome home2 in Homes) { if ((Object)(object)home2 == (Object)(object)home) { return; } } Homes.Add(home); } private static void FindProps(PlayerCharacter pc) { //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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0030: 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) _rowsDirty = true; Props.Clear(); Vector3 position = ((Component)pc).transform.position; bool flag = default(bool); try { List allProps = Prop.allProps; if (allProps != null) { for (int i = 0; i < allProps.Count; i++) { Record(allProps[i], position); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(57, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Prop.allProps did not work ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), sweeping the scene instead"); } log.LogInfo(val); } if (Props.Count == 0) { try { Il2CppReferenceArray val2 = Object.FindObjectsOfType(Il2CppType.Of()); if (val2 != null) { for (int j = 0; j < ((Il2CppArrayBase)(object)val2).Length; j++) { Object obj = ((Il2CppArrayBase)(object)val2)[j]; Record((obj != null) ? ((Il2CppObjectBase)obj).TryCast() : null, position); } } } catch (Exception ex2) { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("could not list the world's props: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(ex2.Message); } log2.LogWarning(val3); } } Props.Sort((Entry a, Entry b) => a.Distance.CompareTo(b.Distance)); } private static void Record(Prop prop, Vector3 here) { //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) if (!((Object)(object)prop == (Object)null)) { string text = Name(prop); Props.Add(new Entry { Prop = prop, Name = text, Search = text.ToLowerInvariant(), Distance = Vector3.Distance(((Component)prop).transform.position, here) }); } } private static void Report() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if ((Object)(object)_player == (Object)null) { Plugin.Log.LogInfo((object)"no player to report on"); return; } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("--- gear on '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(((Object)_player).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' ---"); } log.LogInfo(val); PlayerRegistry registry = _player.registry; if (registry != null) { MeshRenderer fakeHolster = registry.fakeHolster; Plugin.Log.LogInfo((object)(((Object)(object)fakeHolster == (Object)null) ? "fakeHolster: none" : ("fakeHolster: '" + ((Object)((Component)fakeHolster).gameObject).name + "' under " + Path(((Component)fakeHolster).transform) + ", " + $"enabled {((Renderer)fakeHolster).enabled}, active {((Component)fakeHolster).gameObject.activeInHierarchy}"))); } foreach (PropHome home in Homes) { if ((Object)(object)home == (Object)null) { continue; } Prop pinnedProp = home.pinnedProp; StringBuilder stringBuilder = new StringBuilder(Label(home)).Append(" at ").Append(Path(((Component)home).transform)).Append(((Object)(object)home.hideForLocalPlayer != (Object)null) ? " HIDDEN-FOR-LOCAL" : ""); if ((Object)(object)pinnedProp == (Object)null) { stringBuilder.Append(" — empty"); } else { stringBuilder.Append(" — holding '" + Name(pinnedProp) + "'"); if ((Object)(object)pinnedProp.locallyHiddenForPlayer != (Object)null) { stringBuilder.Append(" LOCALLY-HIDDEN"); } } Plugin.Log.LogInfo((object)stringBuilder.ToString()); } CharacterColour.Report(_player); _status = "written to BepInEx/LogOutput.log"; } private static string Path(Transform t) { string text = ((Object)t).name; Transform parent = t.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } } [BepInPlugin("deck.bigwalk.geardebug", "Gear Debug", "1.1.1")] public class Plugin : BasePlugin { public const string Guid = "deck.bigwalk.geardebug"; public static ManualLogSource Log; public static ConfigEntry ToggleKeys; public static ConfigEntry FreeCursor; public static ConfigEntry ListLimit; public static ConfigEntry Scale; public static ConfigEntry RepaintInterval; public static ConfigEntry LogKeys; public override void Load() { //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown Log = ((BasePlugin)this).Log; ToggleKeys = ((BasePlugin)this).Config.Bind("Input", "ToggleKeys", "Quote,F9", "Comma-separated keys that open and close the panel. Several are listed because Steam swallows the function keys before the game sees them on some setups — whichever one arrives wins. Any KeyCode name works, including JoystickButton0..19 for a pad."); FreeCursor = ((BasePlugin)this).Config.Bind("Input", "FreeCursor", true, "Release the mouse cursor while the panel is open, so the buttons can be clicked. The game still reads the mouse for looking around, so expect the camera to turn while you aim at a button."); ListLimit = ((BasePlugin)this).Config.Bind("General", "ListLimit", 60, "How many props to show at once. Big Walk's world holds thousands, so type in the filter box to narrow it down rather than raising this."); Scale = ((BasePlugin)this).Config.Bind("General", "Scale", 1.6f, "How much to magnify the panel. Unity's built-in debug UI draws at a fixed pixel size, which is unreadable on a handheld screen."); RepaintInterval = ((BasePlugin)this).Config.Bind("General", "RepaintInterval", 0.25f, "Seconds between re-applying a free colour while 'Keep it painted' is on. Each pass pushes a colour through every renderer on your body, so doing it every frame costs real frame time for no benefit — nothing repaints you that often. Lower it if a colour visibly flickers back after a body swap; 0 means every frame."); LogKeys = ((BasePlugin)this).Config.Bind("Debug", "LogKeys", false, "Log every key and pad button press, to find one this machine actually delivers."); ClassInjector.RegisterTypeInIl2Cpp(); GameObject val = new GameObject("GearDebugRuntime") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); val.AddComponent(); ((BasePlugin)this).Config.Save(); ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Gear Debug loaded. Any of ["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(ToggleKeys.Value); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("] opens the panel."); } log.LogInfo(val2); } } public class GearDebugRuntime : MonoBehaviour { private static KeyCode[] _allKeys; private bool _open; private bool _inputDead; private CursorLockMode _lockWas; private bool _cursorWas; public GearDebugRuntime(IntPtr ptr) : base(ptr) { } private void Update() { //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown if (_inputDead) { return; } try { if (Plugin.LogKeys.Value) { ReportKeys(); } if (KeyList.AnyDown(Plugin.ToggleKeys.Value)) { _open = !_open; if (_open) { GearPanel.Refresh(); } else { GearPanel.Closed(); } Cursor(_open); Plugin.Log.LogInfo((object)(_open ? "panel open" : "panel closed")); } } catch (Exception ex) { _inputDead = true; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(62, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("keyboard input is unavailable, so the panel cannot be opened: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } private void LateUpdate() { if (CharacterColour.Keep) { CharacterColour.Repaint(GearPanel.Player); } } private unsafe static void ReportKeys() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_004b: 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_0049: Invalid comparison between Unknown and I4 if (!Input.anyKeyDown) { return; } if (_allKeys == null) { _allKeys = (KeyCode[])Enum.GetValues(typeof(KeyCode)); } string text = null; KeyCode[] allKeys = _allKeys; for (int i = 0; i < allKeys.Length; i++) { KeyCode val = allKeys[i]; if ((int)val != 0 && ((int)val < 323 || (int)val > 329) && Input.GetKeyDown(val)) { text = ((text == null) ? ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString() : (text + ", " + ((object)(*(KeyCode*)(&val))/*cast due to .constrained prefix*/).ToString())); } } if (text != null) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("key down: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(text); } log.LogInfo(val2); } } private void Cursor(bool free) { //IL_0028: 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) if (Plugin.FreeCursor.Value) { if (free) { _lockWas = Cursor.lockState; _cursorWas = Cursor.visible; } else { Cursor.lockState = _lockWas; Cursor.visible = _cursorWas; } } } private void OnGUI() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if (!_open) { return; } if (Plugin.FreeCursor.Value) { Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; } try { GearPanel.Draw(); } catch (Exception ex) { _open = false; Cursor(free: false); GearPanel.Closed(); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("the panel threw, closing it: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(ex); } log.LogError(val); } } } internal static class KeyList { private static readonly Dictionary Parsed = new Dictionary(); public static bool AnyDown(string spec) { KeyCode[] array = Parse(spec); for (int i = 0; i < array.Length; i++) { if (Input.GetKeyDown(array[i])) { return true; } } return false; } private static KeyCode[] Parse(string spec) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (spec == null) { spec = string.Empty; } if (Parsed.TryGetValue(spec, out var value)) { return value; } List list = new List(); string[] array = spec.Split(','); bool flag = default(bool); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); if (text.Length == 0) { continue; } if (Enum.TryParse(text, ignoreCase: true, out KeyCode result) && (int)result != 0) { list.Add(result); continue; } ManualLogSource log = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(33, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' is not a key name, ignoring it"); } log.LogWarning(val); } KeyCode[] array2 = list.ToArray(); Parsed[spec] = array2; return array2; } } }