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 Byrding v0.2.1
plugins/Byrding.dll
Decompiled 9 hours 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GBV.Shared; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [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("Guys Being Vikings")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.2.1.0")] [assembly: AssemblyInformationalVersion("0.2.1+3b9e4c96cd95e3885ec71ba43c73398cab78c9d6")] [assembly: AssemblyProduct("Byrding")] [assembly: AssemblyTitle("Byrding")] [assembly: AssemblyVersion("0.2.1.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 GBV.Shared { internal static class Theme { public static readonly Color StoneDeep = Hex("0A0B0D"); public static readonly Color Stone = Hex("14161A"); public static readonly Color StoneHi = Hex("1F2329"); public static readonly Color StoneLit = Hex("2D323A"); public static readonly Color Carve = Hex("060708"); public static readonly Color Brass = Hex("C9A45C"); public static readonly Color BrassHi = Hex("F2D9A0"); public static readonly Color BrassDim = Hex("6B5630"); public static readonly Color BrassInk = Hex("17110478"); public static readonly Color TextHi = Hex("F7F4EE"); public static readonly Color Text = Hex("D8D4CC"); public static readonly Color Muted = Hex("9FA0A2"); public static readonly Color Faint = Hex("74767A"); public static readonly Color Good = Hex("A6C978"); public static readonly Color Bad = Hex("DD6A57"); public static readonly Color Warn = Hex("E8B25C"); public const float Pad = 30f; public const float Inlay = 9f; public const float TabH = 46f; public const float RowH = 30f; public const float FooterH = 44f; public static GUIStyle Blank; public static GUIStyle Wordmark; public static GUIStyle TabOn; public static GUIStyle TabOff; public static GUIStyle Heading; public static GUIStyle Body; public static GUIStyle BodyHi; public static GUIStyle Dim; public static GUIStyle Small; public static GUIStyle SmallRight; public static GUIStyle Mono; public static GUIStyle MonoDim; public static GUIStyle MonoEcho; public static GUIStyle Search; public static GUIStyle Field; public static GUIStyle FieldText; public static GUIStyle FieldArea; public static GUIStyle Console_; public static GUIStyle Link; public static GUIStyle LinkOn; public static GUIStyle Chip; public static GUIStyle ChipOn; public static GUIStyle Row; public static GUIStyle Action; public static GUIStyle ActionKey; public static GUIStyle Danger; public static GUIStyle Btn; public static GUIStyle BtnOn; public static GUIStyle BtnPrimary; public static GUIStyle BtnDanger; public static GUIStyle BtnSmall; public static GUIStyle DropItem; public static GUIStyle TileName; public static GUIStyle TileNameHot; public static GUIStyle Glyph; public static GUIStyle ScrollbarV; public static GUIStyle ScrollbarThumb; public static GUIStyle Scroll; public static Texture2D Grain; public static Texture2D Px; private static bool _built; public static void EnsureBuilt() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0039: 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_005d: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_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_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: 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_02d9: 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_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0379: 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_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: 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_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04f4: Unknown result type (might be due to invalid IL or missing references) //IL_04fe: Expected O, but got Unknown //IL_0508: Unknown result type (might be due to invalid IL or missing references) //IL_050d: Unknown result type (might be due to invalid IL or missing references) //IL_0513: Unknown result type (might be due to invalid IL or missing references) //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_0528: Unknown result type (might be due to invalid IL or missing references) //IL_0532: 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_0547: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_057c: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_058b: Expected O, but got Unknown //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0592: Unknown result type (might be due to invalid IL or missing references) //IL_059c: Expected O, but got Unknown //IL_059c: Unknown result type (might be due to invalid IL or missing references) //IL_05a1: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Expected O, but got Unknown //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b3: Unknown result type (might be due to invalid IL or missing references) //IL_05be: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Expected O, but got Unknown //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_05dc: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_05ee: Unknown result type (might be due to invalid IL or missing references) //IL_05f3: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Expected O, but got Unknown //IL_0602: Expected O, but got Unknown //IL_0607: Unknown result type (might be due to invalid IL or missing references) //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0614: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_062b: Unknown result type (might be due to invalid IL or missing references) //IL_0635: Expected O, but got Unknown //IL_063a: Expected O, but got Unknown //IL_063f: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_064c: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065e: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_066f: Expected O, but got Unknown //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_067b: Expected O, but got Unknown //IL_0680: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_069f: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Expected O, but got Unknown //IL_06b3: Expected O, but got Unknown //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_06e5: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0751: Unknown result type (might be due to invalid IL or missing references) //IL_0784: Unknown result type (might be due to invalid IL or missing references) //IL_07bc: Unknown result type (might be due to invalid IL or missing references) //IL_07d6: Unknown result type (might be due to invalid IL or missing references) //IL_07e0: Expected O, but got Unknown //IL_07ea: Unknown result type (might be due to invalid IL or missing references) //IL_07ef: Unknown result type (might be due to invalid IL or missing references) //IL_07fa: Unknown result type (might be due to invalid IL or missing references) //IL_0809: Unknown result type (might be due to invalid IL or missing references) //IL_080e: Unknown result type (might be due to invalid IL or missing references) //IL_0818: Expected O, but got Unknown //IL_0818: Unknown result type (might be due to invalid IL or missing references) //IL_0823: Unknown result type (might be due to invalid IL or missing references) //IL_0829: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Expected O, but got Unknown //IL_0833: Unknown result type (might be due to invalid IL or missing references) //IL_0838: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Expected O, but got Unknown //IL_0847: Expected O, but got Unknown //IL_0851: Unknown result type (might be due to invalid IL or missing references) //IL_0856: Unknown result type (might be due to invalid IL or missing references) //IL_085c: Unknown result type (might be due to invalid IL or missing references) //IL_086b: Unknown result type (might be due to invalid IL or missing references) //IL_0871: Unknown result type (might be due to invalid IL or missing references) //IL_0880: Unknown result type (might be due to invalid IL or missing references) //IL_0886: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Unknown result type (might be due to invalid IL or missing references) //IL_089a: Unknown result type (might be due to invalid IL or missing references) //IL_08a4: Expected O, but got Unknown //IL_08a4: Unknown result type (might be due to invalid IL or missing references) //IL_08af: Unknown result type (might be due to invalid IL or missing references) //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08be: Expected O, but got Unknown //IL_08be: Unknown result type (might be due to invalid IL or missing references) //IL_08c3: Unknown result type (might be due to invalid IL or missing references) //IL_08cd: Expected O, but got Unknown //IL_08d2: Expected O, but got Unknown //IL_0959: Unknown result type (might be due to invalid IL or missing references) //IL_096d: Unknown result type (might be due to invalid IL or missing references) if (!_built) { _built = true; Px = Solid(Color.white); Grain = StoneGrain(128); Blank = new GUIStyle(); Wordmark = Label(26, (FontStyle)1, TextHi); Heading = Label(11, (FontStyle)1, Brass); Body = Label(13, (FontStyle)0, Text); BodyHi = Label(13, (FontStyle)1, TextHi); Dim = Label(13, (FontStyle)0, Muted); Small = Label(11, (FontStyle)0, Muted); SmallRight = Label(11, (FontStyle)0, Muted); SmallRight.alignment = (TextAnchor)5; Mono = Label(12, (FontStyle)0, TextHi); MonoDim = Label(12, (FontStyle)0, Muted); MonoEcho = Label(12, (FontStyle)1, Brass); TabOff = Ghost(46f, 13, (FontStyle)0, Muted, TextHi); TabOn = Ghost(46f, 13, (FontStyle)1, BrassHi, BrassHi); TabOff.alignment = (TextAnchor)4; TabOn.alignment = (TextAnchor)4; Link = Ghost(30f, 13, (FontStyle)0, Text, BrassHi); LinkOn = Ghost(30f, 13, (FontStyle)1, BrassHi, BrassHi); Link.alignment = (TextAnchor)4; LinkOn.alignment = (TextAnchor)4; Chip = Ghost(26f, 12, (FontStyle)0, Muted, BrassHi); ChipOn = Ghost(26f, 12, (FontStyle)1, Brass, BrassHi); Chip.alignment = (TextAnchor)4; ChipOn.alignment = (TextAnchor)4; Row = Ghost(30f, 13, (FontStyle)0, Text, BrassHi); Row.alignment = (TextAnchor)3; Row.padding = new RectOffset(12, 12, 0, 0); Action = Ghost(34f, 13, (FontStyle)1, Brass, BrassHi); Action.alignment = (TextAnchor)4; ActionKey = Ghost(34f, 13, (FontStyle)1, BrassInk, BrassInk); ActionKey.alignment = (TextAnchor)4; Danger = Ghost(34f, 13, (FontStyle)1, Bad, Hex("FF8B78")); Danger.alignment = (TextAnchor)4; Btn = Plate(34, 4, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 13); BtnOn = Plate(34, 4, Hex("312B18"), Hex("43391F"), Brass, Hex("3B3320"), Hex("4E4227"), BrassHi, Hex("2A2515"), Hex("352E1A"), BrassHi, BrassHi, 13); BtnPrimary = Plate(34, 4, Hex("A8873A"), Hex("D0A63A"), Hex("F2D9A0"), Hex("C09A38"), Hex("EBC97A"), Hex("F7E6BE"), Hex("8A6E2C"), Hex("A8873A"), Hex("F2D9A0"), Hex("151003"), 13); BtnPrimary.fontStyle = (FontStyle)1; BtnDanger = Plate(34, 4, Hex("5A2621"), Hex("7A332C"), Hex("A8453A"), Hex("7A332C"), Hex("9C4239"), Hex("DD6A57"), Hex("431B17"), Hex("5A2621"), Hex("DD6A57"), Hex("F3C8C0"), 13); BtnDanger.fontStyle = (FontStyle)1; BtnSmall = Plate(26, 3, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 12); DropItem = Ghost(28f, 13, (FontStyle)0, Text, BrassHi); DropItem.alignment = (TextAnchor)3; DropItem.padding = new RectOffset(12, 12, 0, 0); GUIStyle val = new GUIStyle(GUI.skin.textField); val.normal.background = Solid(Carve); val.normal.textColor = TextHi; val.hover.background = Solid(Carve); val.hover.textColor = TextHi; val.focused.background = Solid(Carve); val.focused.textColor = TextHi; val.border = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(10, 10, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fontSize = 15; val.fixedHeight = 34f; val.alignment = (TextAnchor)3; Search = val; Field = new GUIStyle(Search) { fontSize = 13, fixedHeight = 26f, alignment = (TextAnchor)4, padding = new RectOffset(2, 2, 0, 0) }; FieldText = new GUIStyle(Search) { fontSize = 13, fixedHeight = 26f, alignment = (TextAnchor)3, padding = new RectOffset(8, 8, 0, 0) }; FieldArea = new GUIStyle(Search) { fontSize = 13, fixedHeight = 0f, alignment = (TextAnchor)0, padding = new RectOffset(10, 10, 8, 8), wordWrap = true }; Console_ = new GUIStyle(Search) { fontSize = 13, fixedHeight = 0f, alignment = (TextAnchor)3, padding = new RectOffset(4, 4, 0, 0) }; Console_.normal.textColor = TextHi; Console_.focused.textColor = TextHi; Console_.hover.textColor = TextHi; Texture2D background = Solid(new Color(0f, 0f, 0f, 0f)); Console_.normal.background = background; Console_.focused.background = background; Console_.hover.background = background; Console_.active.background = background; TileName = Label(11, (FontStyle)0, Text); TileName.alignment = (TextAnchor)1; TileName.wordWrap = true; TileName.clipping = (TextClipping)1; TileNameHot = Label(11, (FontStyle)1, TextHi); TileNameHot.alignment = (TextAnchor)1; TileNameHot.wordWrap = true; TileNameHot.clipping = (TextClipping)1; Glyph = Label(20, (FontStyle)0, Hex("4A3F33")); Glyph.alignment = (TextAnchor)4; Scroll = new GUIStyle(); GUIStyle val2 = new GUIStyle(GUI.skin.verticalScrollbar); val2.normal.background = Solid(Hex("0A0807")); val2.border = new RectOffset(0, 0, 0, 0); val2.fixedWidth = 3f; val2.margin = new RectOffset(10, 0, 0, 0); val2.padding = new RectOffset(0, 0, 0, 0); ScrollbarV = val2; GUIStyle val3 = new GUIStyle(GUI.skin.verticalScrollbarThumb); val3.normal.background = Solid(BrassDim); val3.hover.background = Solid(Brass); val3.active.background = Solid(BrassHi); val3.border = new RectOffset(0, 0, 0, 0); val3.fixedWidth = 3f; val3.margin = new RectOffset(0, 0, 0, 0); val3.padding = new RectOffset(0, 0, 0, 0); ScrollbarThumb = val3; GUI.skin.verticalScrollbarUpButton = GUIStyle.none; GUI.skin.verticalScrollbarDownButton = GUIStyle.none; GUI.skin.horizontalScrollbarLeftButton = GUIStyle.none; GUI.skin.horizontalScrollbarRightButton = GUIStyle.none; GUI.skin.verticalScrollbar = ScrollbarV; GUI.skin.verticalScrollbarThumb = ScrollbarThumb; GUI.skin.settings.selectionColor = new Color(Brass.r, Brass.g, Brass.b, 0.3f); GUI.skin.settings.cursorColor = BrassHi; } } public static void DrawSlab(Rect r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: 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_0301: Unknown result type (might be due to invalid IL or missing references) Fill(r, Stone); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.95f); GUI.DrawTextureWithTexCoords(r, (Texture)(object)Grain, new Rect(0f, 0f, ((Rect)(ref r)).width / (float)((Texture)Grain).width, ((Rect)(ref r)).height / (float)((Texture)Grain).height)); GUI.color = color; FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: true); FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 34f, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: false); Outline(r, Hex("000000"), 1f); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width - 2f, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.9f)); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.7f)); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width - 2f, 1f), new Color(0f, 0f, 0f, 0.65f)); Fill(new Rect(((Rect)(ref r)).xMax - 2f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(0f, 0f, 0f, 0.5f)); Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x + 9f, ((Rect)(ref r)).y + 9f, ((Rect)(ref r)).width - 18f, ((Rect)(ref r)).height - 18f); Outline(r2, new Color(Brass.r, Brass.g, Brass.b, 0.75f), 1f); Outline(new Rect(((Rect)(ref r2)).x + 1f, ((Rect)(ref r2)).y + 1f, ((Rect)(ref r2)).width - 2f, ((Rect)(ref r2)).height - 2f), new Color(0f, 0f, 0f, 0.55f), 1f); Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).y); Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).y); Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).yMax); Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).yMax); } private static void Rivet(float cx, float cy) { //IL_0053: 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_0076: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) Rect r = default(Rect); ((Rect)(ref r))..ctor(cx - 3f, cy - 3f, 6f, 6f); Fill(new Rect(((Rect)(ref r)).x - 1f, ((Rect)(ref r)).y - 1f, ((Rect)(ref r)).width + 2f, ((Rect)(ref r)).height + 2f), new Color(0f, 0f, 0f, 0.6f)); Fill(r, BrassDim); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 2f), Brass); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 2f, 2f), BrassHi); } public static void Fill(Rect r, Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)Px); GUI.color = color; } private static void FillFade(Rect r, Color c, float alpha, bool topDown) { //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_0056: 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_0063: Unknown result type (might be due to invalid IL or missing references) int num = 8; for (int i = 0; i < num; i++) { float num2 = (float)i / (float)num; float num3 = alpha * (topDown ? (1f - num2) : num2); float num4 = ((Rect)(ref r)).height / (float)num; Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + num4 * (float)i, ((Rect)(ref r)).width, num4 + 1f), new Color(c.r, c.g, c.b, num3)); } } public static void Outline(Rect r, Color c, float w) { //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_0039: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: 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) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, w), c); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - w, ((Rect)(ref r)).width, w), c); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c); Fill(new Rect(((Rect)(ref r)).xMax - w, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c); } public static void Hairline(Rect r, float alpha = 0.28f) { //IL_001a: 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) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), new Color(Brass.r, Brass.g, Brass.b, alpha)); } public static void Groove(Rect r) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), Carve); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.8f)); } public static string Spaced(string s) { if (string.IsNullOrEmpty(s)) { return s; } StringBuilder stringBuilder = new StringBuilder(s.Length * 2); string text = s.ToUpperInvariant(); foreach (char value in text) { stringBuilder.Append(value).Append(' '); } return stringBuilder.ToString().TrimEnd(); } private static GUIStyle Label(int size, FontStyle style, Color colour) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) //IL_001d: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = style }; val.normal.textColor = colour; val.margin = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(0, 0, 0, 0); val.alignment = (TextAnchor)3; val.wordWrap = false; return val; } private static GUIStyle Ghost(float h, int size, FontStyle style, Color normal, Color hover) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006b: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b6: 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_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown Texture2D background = Solid(new Color(0f, 0f, 0f, 0f)); GUIStyle val = new GUIStyle(GUI.skin.button); val.normal.background = background; val.normal.textColor = normal; val.hover.background = background; val.hover.textColor = hover; val.active.background = background; val.active.textColor = hover; val.onNormal.background = background; val.onNormal.textColor = hover; val.onHover.background = background; val.onHover.textColor = hover; val.onActive.background = background; val.onActive.textColor = hover; val.border = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(8, 8, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fixedHeight = h; val.fontSize = size; val.fontStyle = style; val.alignment = (TextAnchor)3; val.wordWrap = false; val.clipping = (TextClipping)1; return val; } private static GUIStyle Plate(int h, int radius, Color nBot, Color nTop, Color nEdge, Color hBot, Color hTop, Color hEdge, Color aBot, Color aTop, Color aEdge, Color text, int fontSize) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_0018: 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) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_003e: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0061: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00a1: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00fe: 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_010f: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.button); val.normal.background = PlateTex(h, radius, nBot, nTop, nEdge); val.normal.textColor = text; val.hover.background = PlateTex(h, radius, hBot, hTop, hEdge); val.hover.textColor = text; val.active.background = PlateTex(h, radius, aBot, aTop, aEdge); val.active.textColor = text; val.onNormal.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onNormal.textColor = text; val.onHover.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onHover.textColor = text; val.onActive.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onActive.textColor = text; val.border = new RectOffset(radius + 3, radius + 3, 0, 0); val.padding = new RectOffset(10, 10, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fixedHeight = h; val.fontSize = fontSize; val.alignment = (TextAnchor)4; val.wordWrap = false; val.clipping = (TextClipping)1; return val; } private static Texture2D PlateTex(int h, int radius, Color bottom, Color top, Color edge) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0046: 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_00b5: 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_00bb: 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_00c6: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) int num = radius * 2 + 8; Texture2D val = new Texture2D(num, h, (TextureFormat)5, false); for (int i = 0; i < h; i++) { float num2 = ((h <= 1) ? 0f : ((float)i / (float)(h - 1))); Color val2 = Color.Lerp(bottom, top, num2); if (i >= h - 1) { val2 = Color.Lerp(val2, Color.white, 0.12f); } for (int j = 0; j < num; j++) { float num3 = Sdf(j, i, num, h, radius); float num4 = Mathf.Clamp01(0.5f - num3); if (num4 <= 0f) { val.SetPixel(j, i, new Color(0f, 0f, 0f, 0f)); continue; } float num5 = Mathf.Clamp01(0.5f - (num3 + 1.15f)); Color val3 = Color.Lerp(edge, val2, num5); val.SetPixel(j, i, new Color(val3.r, val3.g, val3.b, num4)); } } return Finish(val); } private static float Sdf(float x, float y, int w, int h, int radius) { float num = Mathf.Min((float)radius, (float)Mathf.Min(w, h) * 0.5f); float num2 = x + 0.5f; float num3 = y + 0.5f; float num4 = Mathf.Clamp(num2, num, (float)w - num); float num5 = Mathf.Clamp(num3, num, (float)h - num); float num6 = num2 - num4; float num7 = num3 - num5; return Mathf.Sqrt(num6 * num6 + num7 * num7) - num; } private static Color Hex(string hex) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) int num = Convert.ToInt32(hex.Substring(0, 2), 16); int num2 = Convert.ToInt32(hex.Substring(2, 2), 16); int num3 = Convert.ToInt32(hex.Substring(4, 2), 16); float num4 = ((hex.Length >= 8) ? ((float)Convert.ToInt32(hex.Substring(6, 2), 16) / 255f) : 1f); return new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, num4); } private static Texture2D Finish(Texture2D t) { ((Object)t).hideFlags = (HideFlags)61; ((Texture)t).filterMode = (FilterMode)1; ((Texture)t).wrapMode = (TextureWrapMode)0; t.Apply(); return t; } private static Texture2D Solid(Color c) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)5, false); val.SetPixel(0, 0, c); ((Texture)val).wrapMode = (TextureWrapMode)1; return Finish(val); } private static Texture2D StoneGrain(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00c4: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (0f + Tileable(j, i, size, 8f) * 0.5f + Tileable(j, i, size, 19f) * 0.32f + Tileable(j, i, size, 43f) * 0.18f - 0.5f) * 2f; float num2 = Mathf.Abs(num) * 0.55f; Color val2 = ((num >= 0f) ? new Color(StoneHi.r, StoneHi.g, StoneHi.b, num2) : new Color(Carve.r, Carve.g, Carve.b, num2 * 1.5f)); val.SetPixel(j, i, val2); } } return Finish(val); } private static float Tileable(int x, int y, int size, float freq) { float num = (float)x / (float)size; float num2 = (float)y / (float)size; float num3 = Mathf.PerlinNoise(num * freq, num2 * freq); float num4 = Mathf.PerlinNoise((num - 1f) * freq, num2 * freq); float num5 = Mathf.PerlinNoise(num * freq, (num2 - 1f) * freq); float num6 = Mathf.PerlinNoise((num - 1f) * freq, (num2 - 1f) * freq); return Mathf.Lerp(Mathf.Lerp(num3, num4, num), Mathf.Lerp(num5, num6, num), num2); } } } namespace GBV.Byrding { internal static class Access { public static FieldRef<Inventory, int> InventoryHeight; public static FieldRef<Player, bool> PlayerIsLoading; public static FieldRef<InventoryGrid, List<InventoryElement>> GridElements; public static FieldRef<InventoryGrid, Inventory> GridInventory; public static FieldRef<InventoryGrid, int> GridWidth; private static bool _bound; public static bool Ready { get; private set; } public static void Bind() { if (_bound) { return; } _bound = true; try { InventoryHeight = AccessTools.FieldRefAccess<Inventory, int>("m_height"); PlayerIsLoading = AccessTools.FieldRefAccess<Player, bool>("m_isLoading"); GridElements = AccessTools.FieldRefAccess<InventoryGrid, List<InventoryElement>>("m_elements"); GridInventory = AccessTools.FieldRefAccess<InventoryGrid, Inventory>("m_inventory"); GridWidth = AccessTools.FieldRefAccess<InventoryGrid, int>("m_width"); Ready = InventoryHeight != null && PlayerIsLoading != null && GridElements != null && GridInventory != null && GridWidth != null; } catch (Exception ex) { Ready = false; ManualLogSource log = ByrdingPlugin.Log; if (log != null) { log.LogError((object)("Byrding could not find the game fields it needs and has switched itself off. This usually means Valheim has been updated. Your gear is untouched and still in your inventory.\n" + ex)); } } if (!Ready) { ManualLogSource log2 = ByrdingPlugin.Log; if (log2 != null) { log2.LogError((object)"Byrding is standing down: one or more required game fields are missing."); } } } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class Commands { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__3_0; public static ConsoleEvent <>9__3_1; public static ConsoleEvent <>9__3_2; internal void <Register>b__3_0(ConsoleEventArgs args) { try { Player val = LocalPlayer(args.Context); if ((Object)(object)val == (Object)null) { return; } int num = Reconcile.UnpackAll(val, unequip: true); if (num < 0) { Terminal context = args.Context; if (context != null) { context.AddString("Byrding: could not unpack. Check the log."); } return; } int num2 = OccupiedSlots(val); if (num2 > 0) { Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Byrding: moved " + num + " item(s), but " + num2 + " could not fit. Free some pack slots and run it again."); } } else { Terminal context3 = args.Context; if (context3 != null) { context3.AddString("Byrding: moved " + num + " item(s) back into your pack and took them off. The gear slots are empty and it is safe to uninstall."); } } } catch (Exception ex) { Safety.Failed("byrding_unpack", ex); Terminal context4 = args.Context; if (context4 != null) { context4.AddString("Byrding: byrding_unpack failed. Check the log."); } } } internal void <Register>b__3_1(ConsoleEventArgs args) { try { Status(args.Context); } catch (Exception ex) { Safety.Failed("byrding_status", ex); Terminal context = args.Context; if (context != null) { context.AddString("Byrding: byrding_status failed. Check the log."); } } } internal void <Register>b__3_2(ConsoleEventArgs args) { try { DumpUi(args.Context); } catch (Exception ex) { Safety.Failed("byrding_dumpui", ex); Terminal context = args.Context; if (context != null) { context.AddString("Byrding: byrding_dumpui failed. Check the log."); } } } } private static bool _registered; [HarmonyPostfix] public static void Postfix() { try { if (!_registered) { _registered = true; Register(); } } catch (Exception ex) { Safety.Failed("Terminal.InitTerminal command registration", ex); } } private static Player LocalPlayer(Terminal context) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null && context != null) { context.AddString("Byrding: no local player. Load into a world first."); } return localPlayer; } private static void Register() { //IL_0033: 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_0029: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0062: Expected O, but got Unknown //IL_00a5: 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_009b: Expected O, but got Unknown object obj = <>c.<>9__3_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { try { Player val4 = LocalPlayer(args.Context); if (!((Object)(object)val4 == (Object)null)) { int num = Reconcile.UnpackAll(val4, unequip: true); if (num < 0) { Terminal context = args.Context; if (context != null) { context.AddString("Byrding: could not unpack. Check the log."); } } else { int num2 = OccupiedSlots(val4); if (num2 > 0) { Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Byrding: moved " + num + " item(s), but " + num2 + " could not fit. Free some pack slots and run it again."); } } else { Terminal context3 = args.Context; if (context3 != null) { context3.AddString("Byrding: moved " + num + " item(s) back into your pack and took them off. The gear slots are empty and it is safe to uninstall."); } } } } } catch (Exception ex) { Safety.Failed("byrding_unpack", ex); Terminal context4 = args.Context; if (context4 != null) { context4.AddString("Byrding: byrding_unpack failed. Check the log."); } } }; <>c.<>9__3_0 = val; obj = (object)val; } new ConsoleCommand("byrding_unpack", "byrding_unpack - empty every gear slot back into your pack. Run this before uninstalling Byrding: without it, the next time you log in the game shrinks your inventory and drops anything in the gear rows at your feet.", (ConsoleEvent)obj, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__3_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { try { Status(args.Context); } catch (Exception ex) { Safety.Failed("byrding_status", ex); Terminal context = args.Context; if (context != null) { context.AddString("Byrding: byrding_status failed. Check the log."); } } }; <>c.<>9__3_1 = val2; obj2 = (object)val2; } new ConsoleCommand("byrding_status", "byrding_status - what Byrding thinks your inventory looks like, what is in each slot, and which slot types this game build actually has items for.", (ConsoleEvent)obj2, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj3 = <>c.<>9__3_2; if (obj3 == null) { ConsoleEvent val3 = delegate(ConsoleEventArgs args) { try { DumpUi(args.Context); } catch (Exception ex) { Safety.Failed("byrding_dumpui", ex); Terminal context = args.Context; if (context != null) { context.AddString("Byrding: byrding_dumpui failed. Check the log."); } } }; <>c.<>9__3_2 = val3; obj3 = (object)val3; } new ConsoleCommand("byrding_dumpui", "byrding_dumpui - print the inventory window's object hierarchy to the log. Only useful for working out where the Gear button should go when another mod has rearranged the panel.", (ConsoleEvent)obj3, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static int OccupiedSlots(Player player) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = ((Humanoid)player).GetInventory(); int visibleRows = Geometry.VisibleRows(player); int width = inventory.GetWidth(); int num = 0; for (int i = 0; i < 15; i++) { Vector2i val = Geometry.SlotPos(i, visibleRows, width); if (inventory.GetItemAt(val.x, val.y) != null) { num++; } } return num; } private static void Status(Terminal context) { //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: 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_017f: 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_023b: Unknown result type (might be due to invalid IL or missing references) Player val = LocalPlayer(context); if ((Object)(object)val == (Object)null) { return; } Inventory inventory = ((Humanoid)val).GetInventory(); int num = Geometry.VisibleRows(val); int width = inventory.GetWidth(); if (context != null) { context.AddString("Byrding 0.2.1" + (Geometry.Active ? "" : " [INACTIVE]")); } if (context != null) { context.AddString(" game fields bound: " + Access.Ready); } if (context != null) { context.AddString(" inventory: " + width + " wide, " + num + " visible rows, " + inventory.GetHeight() + " actual, gear rows at " + num + "-" + (num + 2 - 1)); } if (context != null) { context.AddString(" pack: " + Geometry.PackUsed(inventory, num) + "/" + Geometry.PackCapacity(inventory, num) + " used"); } if (context != null) { context.AddString(" panel: " + (GearPanel.IsOpen ? "open" : "closed")); } for (int i = 0; i < 15; i++) { Vector2i val2 = Geometry.SlotPos(i, num, width); ItemData itemAt = inventory.GetItemAt(val2.x, val2.y); string text = ((itemAt == null) ? "-" : (Localization.instance.Localize(itemAt.m_shared.m_name) + ((itemAt.m_stack > 1) ? (" x" + itemAt.m_stack) : "") + (((Humanoid)val).IsItemEquiped(itemAt) ? " (worn)" : ""))); string text2 = ""; int quickIndex = Slots.All[i].QuickIndex; if (quickIndex >= 0 && ByrdingPlugin.WeaponHotkeys != null && quickIndex < ByrdingPlugin.WeaponHotkeys.Length && ByrdingPlugin.WeaponHotkeys[quickIndex] != null) { text2 = " [" + ((object)ByrdingPlugin.WeaponHotkeys[quickIndex].Value/*cast due to .constrained prefix*/).ToString() + "]"; } if (context != null) { context.AddString(" " + i + " " + Slots.All[i].Name.PadRight(8) + " (" + val2.x + "," + val2.y + ") " + text + text2); } } ReportItemTypes(context); } private static void ReportItemTypes(Terminal context) { //IL_00e0: 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_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null || instance.m_items == null) { if (context != null) { context.AddString(" (ObjectDB not loaded, cannot count item types)"); } return; } Dictionary<ItemType, int> dictionary = new Dictionary<ItemType, int>(); foreach (GameObject item in instance.m_items) { ItemDrop val = (((Object)(object)item != (Object)null) ? item.GetComponent<ItemDrop>() : null); if (val?.m_itemData?.m_shared != null) { ItemType itemType = val.m_itemData.m_shared.m_itemType; dictionary.TryGetValue(itemType, out var value); dictionary[itemType] = value + 1; } } StringBuilder stringBuilder = new StringBuilder(" items in ObjectDB:"); ItemType[] array = new ItemType[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); ItemType[] array2 = (ItemType[])(object)array; foreach (ItemType val2 in array2) { dictionary.TryGetValue(val2, out var value2); stringBuilder.Append(' ').Append(val2).Append('=') .Append(value2); } if (context != null) { context.AddString(stringBuilder.ToString()); } } private static void DumpUi(Terminal context) { InventoryGui instance = InventoryGui.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_player == (Object)null) { if (context != null) { context.AddString("Byrding: the inventory UI does not exist yet. Open your inventory once, then try again."); } return; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("Byrding UI dump - inventory window hierarchy"); TMP_Text armor = instance.m_armor; stringBuilder.AppendLine(" armor readout : " + Path((armor != null) ? armor.transform : null)); TMP_Text weight = instance.m_weight; stringBuilder.AppendLine(" weight readout: " + Path((weight != null) ? weight.transform : null)); stringBuilder.AppendLine(); Walk(stringBuilder, (Transform)(object)instance.m_player, 0, instance); ManualLogSource log = ByrdingPlugin.Log; if (log != null) { log.LogInfo((object)stringBuilder.ToString()); } if (context != null) { context.AddString("Byrding: hierarchy written to the log (BepInEx/LogOutput.log). It is long; the console will not hold it."); } } private static void Walk(StringBuilder sb, Transform t, int depth, InventoryGui gui) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) if (depth <= 4) { RectTransform val = (RectTransform)(object)((t is RectTransform) ? t : null); sb.Append(' ', depth * 2).Append(((Object)t).name); if ((Object)(object)val != (Object)null) { StringBuilder stringBuilder = sb.Append(" pos=").Append(val.anchoredPosition).Append(" size="); Rect rect = val.rect; stringBuilder.Append(((Rect)(ref rect)).size).Append(" anchor=").Append(val.anchorMin) .Append("..") .Append(val.anchorMax); } LayoutGroup component = ((Component)t).GetComponent<LayoutGroup>(); if ((Object)(object)component != (Object)null) { sb.Append(" [").Append(((object)component).GetType().Name).Append(']'); } if ((Object)(object)((Component)t).GetComponent<Image>() != (Object)null) { sb.Append(" [Image]"); } if ((Object)(object)gui.m_armor != (Object)null && (Object)(object)t == (Object)(object)gui.m_armor.transform) { sb.Append(" <-- ARMOR"); } if ((Object)(object)gui.m_weight != (Object)null && (Object)(object)t == (Object)(object)gui.m_weight.transform) { sb.Append(" <-- WEIGHT"); } sb.AppendLine(); for (int i = 0; i < t.childCount; i++) { Walk(sb, t.GetChild(i), depth + 1, gui); } } } private static string Path(Transform t) { if ((Object)(object)t == (Object)null) { return "(none)"; } StringBuilder stringBuilder = new StringBuilder(((Object)t).name); Transform parent = t.parent; while ((Object)(object)parent != (Object)null) { stringBuilder.Insert(0, ((Object)parent).name + "/"); parent = parent.parent; } return stringBuilder.ToString(); } } internal static class GearPanel { private sealed class Group { public string Caption; public int[] Slots; } private const string PanelName = "ByrdingGearPanel"; private const string GlyphName = "ByrdingSlotGlyph"; private static RectTransform _panel; private static Image _backdrop; private static RectTransform[] _dividers; private static TMP_Text[] _captions; private static bool _open = true; private static bool _openInitialised; private static bool _reportedBackdrop; private const int Columns = 3; private static readonly Group[] Layout = new Group[3] { new Group { Caption = "Gear", Slots = new int[6] { 0, 1, 2, 3, 4, 5 } }, new Group { Caption = "Weapons", Slots = new int[6] { 9, 10, 11, 12, 13, 14 } }, new Group { Caption = "Food", Slots = new int[3] { 6, 7, 8 } } }; public static bool IsOpen => _open; public static void Toggle() { _open = !_open; _openInitialised = true; } public static void Forget() { _panel = null; _backdrop = null; _dividers = null; _captions = null; _openInitialised = false; SlotButton.Forget(); SlotSprites.Reset(); } public static void Teardown(InventoryGrid grid) { if ((Object)(object)_panel == (Object)null) { return; } try { Transform val = (Transform)(((Object)(object)grid != (Object)null && (Object)(object)grid.m_gridRoot != (Object)null) ? ((object)grid.m_gridRoot) : ((object)((Transform)_panel).parent)); for (int num = ((Transform)_panel).childCount - 1; num >= 0; num--) { Transform child = ((Transform)_panel).GetChild(num); if (!((Object)(object)((Component)child).GetComponent<InventoryElement>() == (Object)null)) { child.SetParent(val, false); ((Component)child).gameObject.SetActive(true); } } Object.Destroy((Object)(object)((Component)_panel).gameObject); } catch (Exception ex) { Safety.Failed("GearPanel.Teardown", ex); } finally { SlotButton.Destroy(); Forget(); } } public static void Apply(InventoryGui gui, InventoryGrid grid) { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)gui == (Object)null || (Object)(object)grid == (Object)null) { return; } Player localPlayer = Player.m_localPlayer; Inventory val = ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null); if (val == null) { return; } int num = Geometry.VisibleRows(localPlayer); int width = val.GetWidth(); List<InventoryElement> list = Access.GridElements.Invoke(grid); if (list == null) { return; } int num2 = (num + 2) * width; if (list.Count < num2) { return; } if (!_openInitialised) { _open = ByrdingPlugin.OpenOnInventory == null || ByrdingPlugin.OpenOnInventory.Value; _openInitialised = true; } float num3 = grid.m_elementSpace; if (num3 <= 0f) { num3 = 70f; } EnsurePanel(gui, num3); if ((Object)(object)_panel == (Object)null) { return; } if ((Object)(object)grid.m_gridRoot != (Object)null) { grid.m_gridRoot.SetSizeWithCurrentAnchors((Axis)1, (float)num * num3); } ((Component)_panel).gameObject.SetActive(_open); if (!_open) { _panel.anchoredPosition = new Vector2(-30000f, 0f); } for (int i = 0; i < 15; i++) { Vector2i val2 = Geometry.SlotPos(i, num, width); InventoryElement val3 = list[val2.y * width + val2.x]; if (!((Object)(object)val3 == (Object)null)) { PlaceCell(val3, i, num3); UpdateGlyph(val3, Slots.All[i].Glyph, val.GetItemAt(val2.x, val2.y) == null, num3); } } HideSpares(list, num, width); } private static void HideSpares(List<InventoryElement> elements, int visible, int width) { int num = visible * width; int num2 = (visible + 2) * width; for (int i = num; i < num2 && i < elements.Count; i++) { if (i - num >= 15) { InventoryElement val = elements[i]; if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(false); } } } } private static int RowsIn(Group group) { return (group.Slots.Length + 3 - 1) / 3; } private static float PadOf(float pitch) { return pitch * 0.46f; } private static float CaptionOf(float pitch) { return pitch * 0.3f; } private static float GroupGapOf(float pitch) { return pitch * 0.26f; } private static float PanelWidth(float pitch) { return PadOf(pitch) * 2f + pitch * 3f; } private static float PanelHeight(float pitch) { float num = PadOf(pitch) * 2f; for (int i = 0; i < Layout.Length; i++) { if (i > 0) { num += GroupGapOf(pitch); } num += CaptionOf(pitch) + pitch * (float)RowsIn(Layout[i]); } return num; } private static float GroupTop(int g, float pitch) { float num = PadOf(pitch); for (int i = 0; i < g; i++) { num += CaptionOf(pitch) + pitch * (float)RowsIn(Layout[i]) + GroupGapOf(pitch); } return num; } private static bool CellCentre(int index, float pitch, out Vector2 centre) { //IL_0072: 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_0057: 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) for (int i = 0; i < Layout.Length; i++) { int num = Array.IndexOf(Layout[i].Slots, index); if (num >= 0) { int num2 = num % 3; int num3 = num / 3; float num4 = PadOf(pitch) + pitch * ((float)num2 + 0.5f); float num5 = GroupTop(i, pitch) + CaptionOf(pitch) + pitch * ((float)num3 + 0.5f); centre = new Vector2(num4, 0f - num5); return true; } } centre = Vector2.zero; return false; } private static void PlaceCell(InventoryElement element, int index, float pitch) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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_00b0: Unknown result type (might be due to invalid IL or missing references) if (!CellCentre(index, pitch, out var centre)) { return; } RectTransform val = element.GetElementRectTransform(); if ((Object)(object)val == (Object)null) { Transform transform = ((Component)element).transform; val = (RectTransform)(object)((transform is RectTransform) ? transform : null); } if (!((Object)(object)val == (Object)null)) { if (!((Component)element).gameObject.activeSelf) { ((Component)element).gameObject.SetActive(true); } if ((Object)(object)((Transform)val).parent != (Object)(object)_panel) { ((Transform)val).SetParent((Transform)(object)_panel, false); } val.anchorMin = new Vector2(0f, 1f); val.anchorMax = new Vector2(0f, 1f); val.pivot = new Vector2(0.5f, 0.5f); val.anchoredPosition = centre; ((Transform)val).localScale = Vector3.one; UpdateBinding(element, index); } } private static void UpdateBinding(InventoryElement element, int index) { try { Transform val = ((Component)element).transform.Find("binding"); if ((Object)(object)val == (Object)null) { return; } TMP_Text component = ((Component)val).GetComponent<TMP_Text>(); if ((Object)(object)component == (Object)null) { return; } int num = Slots.Get(index)?.QuickIndex ?? (-1); if (num < 0) { if (((Behaviour)component).enabled) { ((Behaviour)component).enabled = false; } return; } string text = (num + 1).ToString(); if (!((Behaviour)component).enabled) { ((Behaviour)component).enabled = true; } if (component.text != text) { component.text = text; } } catch (Exception ex) { Safety.Failed("GearPanel.UpdateBinding", ex); } } private static void EnsurePanel(InventoryGui gui, float pitch) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_panel != (Object)null) { PositionPanel(gui, pitch); return; } RectTransform player = gui.m_player; if ((Object)(object)player == (Object)null) { return; } Transform val = ((Transform)player).Find("ByrdingGearPanel"); if ((Object)(object)val != (Object)null) { _panel = (RectTransform)(object)((val is RectTransform) ? val : null); } else { _panel = new GameObject("ByrdingGearPanel", new Type[1] { typeof(RectTransform) }).GetComponent<RectTransform>(); ((Transform)_panel).SetParent((Transform)(object)player, false); } ((Transform)_panel).localScale = Vector3.one; BuildBackdrop(gui); _captions = (TMP_Text[])(object)new TMP_Text[Layout.Length]; _dividers = (RectTransform[])(object)new RectTransform[Layout.Length - 1]; for (int i = 0; i < Layout.Length; i++) { _captions[i] = BuildCaption(gui, "ByrdingCaption" + Layout[i].Caption, Layout[i].Caption); if (i > 0) { _dividers[i - 1] = BuildDivider(); } } PositionPanel(gui, pitch); } catch (Exception ex) { Safety.Failed("GearPanel.EnsurePanel", ex); _panel = null; } } private static void PositionPanel(InventoryGui gui, float pitch) { //IL_0015: 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_00d5: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0243: 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_0279: Unknown result type (might be due to invalid IL or missing references) float num = PanelWidth(pitch); float num2 = PanelHeight(pitch); _panel.sizeDelta = new Vector2(num, num2); float num3 = pitch * 0.3f; float num4 = ((ByrdingPlugin.PanelOffsetX != null) ? ByrdingPlugin.PanelOffsetX.Value : 0f); float num5 = ((ByrdingPlugin.PanelOffsetY != null) ? ByrdingPlugin.PanelOffsetY.Value : 0f); Rect rect = gui.m_player.rect; float xMax = ((Rect)(ref rect)).xMax; xMax = Mathf.Max(xMax, RightEdgeIn(gui.m_player, RowOf(gui.m_armor))); xMax = Mathf.Max(xMax, RightEdgeIn(gui.m_player, RowOf(gui.m_weight))); xMax = Mathf.Min(xMax, ((Rect)(ref rect)).xMax + pitch * 2f); _panel.anchorMin = new Vector2(0.5f, 0.5f); _panel.anchorMax = new Vector2(0.5f, 0.5f); _panel.pivot = new Vector2(0f, 1f); _panel.anchoredPosition = new Vector2(xMax + num3 + num4, ((Rect)(ref rect)).yMax + num5) - ((Rect)(ref rect)).center; float num6 = PadOf(pitch); float h = CaptionOf(pitch); if ((Object)(object)_backdrop != (Object)null) { RectTransform rectTransform = ((Graphic)_backdrop).rectTransform; rectTransform.anchorMin = Vector2.zero; rectTransform.anchorMax = Vector2.one; rectTransform.offsetMin = Vector2.zero; rectTransform.offsetMax = Vector2.zero; } for (int i = 0; i < Layout.Length; i++) { float num7 = GroupTop(i, pitch); if (_captions != null && i < _captions.Length) { PlaceCaption(_captions[i], num6, 0f - num7, num - num6 * 2f, h); } if (i > 0 && _dividers != null && i - 1 < _dividers.Length && (Object)(object)_dividers[i - 1] != (Object)null) { RectTransform obj = _dividers[i - 1]; obj.anchorMin = new Vector2(0f, 1f); obj.anchorMax = new Vector2(0f, 1f); obj.pivot = new Vector2(0f, 1f); obj.sizeDelta = new Vector2(num - num6 * 2f, 1f); obj.anchoredPosition = new Vector2(num6, 0f - (num7 - GroupGapOf(pitch) * 0.5f)); } } } private static RectTransform RowOf(TMP_Text readout) { if ((Object)(object)readout == (Object)null) { return null; } Transform parent = readout.transform.parent; return (RectTransform)(((object)((parent is RectTransform) ? parent : null)) ?? ((object)readout.rectTransform)); } private static float RightEdgeIn(RectTransform basis, RectTransform other) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)basis == (Object)null || (Object)(object)other == (Object)null) { return float.NegativeInfinity; } Vector3[] array = (Vector3[])(object)new Vector3[4]; other.GetWorldCorners(array); float num = float.NegativeInfinity; for (int i = 0; i < 4; i++) { float x = ((Transform)basis).InverseTransformPoint(array[i]).x; if (x > num) { num = x; } } return num; } private static void PlaceCaption(TMP_Text text, float x, float y, float w, float h) { //IL_0038: 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_0062: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)text == (Object)null)) { text.fontSize = Mathf.Clamp(h * 0.82f, 13f, 24f); RectTransform rectTransform = text.rectTransform; rectTransform.anchorMin = new Vector2(0f, 1f); rectTransform.anchorMax = new Vector2(0f, 1f); rectTransform.pivot = new Vector2(0f, 1f); rectTransform.sizeDelta = new Vector2(w, h); rectTransform.anchoredPosition = new Vector2(x, y); } } private static void BuildBackdrop(InventoryGui gui) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0081: 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) GameObject val = new GameObject("ByrdingBackdrop", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent((Transform)(object)_panel, false); val.transform.SetAsFirstSibling(); _backdrop = val.GetComponent<Image>(); ((Graphic)_backdrop).raycastTarget = false; Image val2 = FindWindowBackground(gui); if ((Object)(object)val2 != (Object)null) { _backdrop.sprite = val2.sprite; _backdrop.type = val2.type; ((Graphic)_backdrop).color = ((Graphic)val2).color; ((Graphic)_backdrop).material = ((Graphic)val2).material; _backdrop.pixelsPerUnitMultiplier = val2.pixelsPerUnitMultiplier; _backdrop.fillCenter = true; } else { ((Graphic)_backdrop).color = new Color(Theme.Stone.r, Theme.Stone.g, Theme.Stone.b, 0.92f); Safety.Warn("GearPanel.backdrop", "could not find the inventory window's background image, so the gear panel is using a plain one. Everything still works; it just looks less native."); } } private static Image FindWindowBackground(InventoryGui gui) { Image val = Search(gui.m_container) ?? Search(gui.m_player); if (!_reportedBackdrop) { _reportedBackdrop = true; ManualLogSource log = ByrdingPlugin.Log; if (log != null) { log.LogInfo((object)("Byrding: gear panel background = " + (((Object)(object)val != (Object)null) ? Describe(val) : "NONE FOUND, using a plain slate panel"))); } LogCandidates(gui); } return val; } private static Image Search(RectTransform root) { //IL_0086: 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_00a9: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Invalid comparison between Unknown and I4 if ((Object)(object)root == (Object)null) { return null; } Image result = null; float num = 0f; Image[] componentsInChildren = ((Component)root).GetComponentsInChildren<Image>(true); foreach (Image val in componentsInChildren) { if ((Object)(object)val == (Object)null || (Object)(object)val.sprite == (Object)null || ((Object)(object)_panel != (Object)null && ((Object)(object)((Component)val).transform == (Object)(object)_panel || ((Component)val).transform.IsChildOf((Transform)(object)_panel)))) { continue; } Rect rect = ((Graphic)val).rectTransform.rect; float num2 = ((Rect)(ref rect)).width * ((Rect)(ref rect)).height; if (!(num2 < 20000f) && !(((Graphic)val).color.a < 0.3f) && !(Saturation(((Graphic)val).color) > 0.35f)) { float num3 = num2 * (((int)val.type == 1) ? 4f : 1f); if (NameLooksLikeBackground(((Object)val).name)) { num3 *= 8f; } if (!(num3 <= num)) { num = num3; result = val; } } } return result; } private static string Describe(Image image) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) Rect rect = ((Graphic)image).rectTransform.rect; return "'" + ((Object)image).name + "' sprite='" + (((Object)(object)image.sprite != (Object)null) ? ((Object)image.sprite).name : "none") + "' type=" + ((object)image.type/*cast due to .constrained prefix*/).ToString() + " size=" + Mathf.RoundToInt(((Rect)(ref rect)).width) + "x" + Mathf.RoundToInt(((Rect)(ref rect)).height) + " colour=" + ColorUtility.ToHtmlStringRGBA(((Graphic)image).color); } private static void LogCandidates(InventoryGui gui) { //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) try { StringBuilder stringBuilder = new StringBuilder("Byrding: background candidates\n"); RectTransform[] array = (RectTransform[])(object)new RectTransform[2] { gui.m_container, gui.m_player }; foreach (RectTransform val in array) { if ((Object)(object)val == (Object)null) { continue; } stringBuilder.Append(" under ").Append(((Object)val).name).Append(":\n"); Image[] componentsInChildren = ((Component)val).GetComponentsInChildren<Image>(true); foreach (Image val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val2.sprite == (Object)null)) { Rect rect = ((Graphic)val2).rectTransform.rect; if (!(((Rect)(ref rect)).width * ((Rect)(ref rect)).height < 20000f)) { stringBuilder.Append(" ").Append(Describe(val2)).Append('\n'); } } } } ManualLogSource log = ByrdingPlugin.Log; if (log != null) { log.LogInfo((object)stringBuilder.ToString()); } } catch (Exception ex) { Safety.Failed("GearPanel.LogCandidates", ex); } } private static float Saturation(Color c) { //IL_0000: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(c.r, Mathf.Max(c.g, c.b)); float num2 = Mathf.Min(c.r, Mathf.Min(c.g, c.b)); if (!(num <= 0f)) { return (num - num2) / num; } return 0f; } private static bool NameLooksLikeBackground(string name) { if (string.IsNullOrEmpty(name)) { return false; } string text = name.ToLowerInvariant(); if (!text.Contains("bkg") && !text.Contains("background") && !text.Contains("frame") && !text.Contains("panel")) { return text.Contains("border"); } return true; } private static RectTransform BuildDivider() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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_006b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("ByrdingDivider", new Type[2] { typeof(RectTransform), typeof(Image) }); val.transform.SetParent((Transform)(object)_panel, false); Image component = val.GetComponent<Image>(); ((Graphic)component).raycastTarget = false; ((Graphic)component).color = new Color(Theme.Brass.r, Theme.Brass.g, Theme.Brass.b, 0.28f); return val.GetComponent<RectTransform>(); } private static TMP_Text BuildCaption(InventoryGui gui, string name, string label) { //IL_011f: Unknown result type (might be due to invalid IL or missing references) try { TMP_Text val = (((Object)(object)gui.m_containerName != (Object)null) ? gui.m_containerName : gui.m_playerName); if ((Object)(object)val == (Object)null) { return null; } GameObject val2 = Object.Instantiate<GameObject>(((Component)val).gameObject, (Transform)(object)_panel); ((Object)val2).name = name; val2.SetActive(true); LayoutElement[] components = val2.GetComponents<LayoutElement>(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } Transform[] componentsInChildren = val2.GetComponentsInChildren<Transform>(true); foreach (Transform val3 in componentsInChildren) { if ((Object)(object)val3 != (Object)(object)val2.transform) { Object.Destroy((Object)(object)((Component)val3).gameObject); } } TMP_Text component = val2.GetComponent<TMP_Text>(); if ((Object)(object)component == (Object)null) { return null; } component.text = label; component.alignment = (TextAlignmentOptions)513; component.enableAutoSizing = false; component.fontSize = Mathf.Max(11f, component.fontSize * 0.78f); ((Graphic)component).color = new Color(Theme.Brass.r, Theme.Brass.g, Theme.Brass.b, 0.95f); ((Graphic)component).raycastTarget = false; return component; } catch (Exception ex) { Safety.Failed("GearPanel.BuildCaption(" + label + ")", ex); return null; } } private static void UpdateGlyph(InventoryElement element, SlotGlyph glyph, bool empty, float pitch) { //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00fb: Unknown result type (might be due to invalid IL or missing references) try { bool num = empty && (ByrdingPlugin.ShowSilhouettes == null || ByrdingPlugin.ShowSilhouettes.Value); Transform val = ((Component)element).transform.Find("ByrdingSlotGlyph"); if (!num) { if ((Object)(object)val != (Object)null && ((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(false); } return; } Image component; if ((Object)(object)val == (Object)null) { GameObject val2 = new GameObject("ByrdingSlotGlyph", new Type[2] { typeof(RectTransform), typeof(Image) }); val2.transform.SetParent(((Component)element).transform, false); component = val2.GetComponent<Image>(); ((Graphic)component).raycastTarget = false; component.preserveAspect = true; RectTransform component2 = val2.GetComponent<RectTransform>(); component2.anchorMin = new Vector2(0.5f, 0.5f); component2.anchorMax = new Vector2(0.5f, 0.5f); component2.anchoredPosition = Vector2.zero; component2.sizeDelta = new Vector2(pitch * 0.58f, pitch * 0.58f); if ((Object)(object)element.m_icon != (Object)null) { ((Transform)component2).SetSiblingIndex(((Component)element.m_icon).transform.GetSiblingIndex()); } } else { component = ((Component)val).GetComponent<Image>(); if ((Object)(object)component == (Object)null) { return; } if (!((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } } Sprite val3 = SlotSprites.For(glyph); if ((Object)(object)component.sprite != (Object)(object)val3) { component.sprite = val3; } } catch (Exception ex) { Safety.Failed("GearPanel.UpdateGlyph", ex); } } } internal static class Geometry { public const int DefaultVisibleRows = 4; public const int MaxVisibleRows = 9; private static int _knownVisibleRows = -1; private static int _cachedVisibleRows = -1; private static Player _cachedFor; public static bool Installed => Access.Ready; public static bool Active { get { if (Installed && ByrdingPlugin.Enabled != null) { return ByrdingPlugin.Enabled.Value; } return false; } } public static bool IsPlayerInventory(Inventory inv) { if (inv == null) { return false; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null) { return ((Humanoid)localPlayer).GetInventory() == inv; } return false; } public static int VisibleRows(Player player) { if ((Object)(object)player == (Object)null) { return 4; } if (_cachedVisibleRows > 0 && _cachedFor == player) { return _cachedVisibleRows; } int num = 4; string s = default(string); if (player.TryGetUniqueKeyValue("invrows", ref s) && int.TryParse(s, out var result)) { num = Mathf.Clamp(result, 1, 9); } _cachedVisibleRows = num; _cachedFor = player; return num; } public static void Invalidate() { _cachedVisibleRows = -1; _cachedFor = null; } public static int VisibleRows() { return VisibleRows(Player.m_localPlayer); } public static int FullHeight(Player player) { return VisibleRows(player) + 2; } public static Vector2i SlotPos(int index, int visibleRows, int width) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) return new Vector2i(index % width, visibleRows + index / width); } public static Vector2i SlotPos(int index) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; Inventory val = ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null); int width = ((val != null) ? val.GetWidth() : 8); return SlotPos(index, VisibleRows(localPlayer), width); } public static int SlotAt(Vector2i pos, int visibleRows, int width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) if (pos.y < visibleRows) { return -1; } int num = (pos.y - visibleRows) * width + pos.x; if (num < 0 || num >= 15) { return -1; } return num; } public static int SlotAt(Vector2i pos) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; Inventory val = ((localPlayer != null) ? ((Humanoid)localPlayer).GetInventory() : null); if (val == null) { return -1; } return SlotAt(pos, VisibleRows(localPlayer), val.GetWidth()); } public static bool IsBlockedSpare(Vector2i pos, int visibleRows, int width) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (pos.y >= visibleRows) { return SlotAt(pos, visibleRows, width) < 0; } return false; } public static bool IsHidden(Vector2i pos, int visibleRows) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return pos.y >= visibleRows; } public static int PackCapacity(Inventory inv, int visibleRows) { return inv.GetWidth() * visibleRows; } public static int PackUsed(Inventory inv, int visibleRows) { int num = 0; List<ItemData> allItems = inv.GetAllItems(); for (int i = 0; i < allItems.Count; i++) { if (allItems[i].m_gridPos.y < visibleRows) { num++; } } return num; } public static int PackFree(Inventory inv, int visibleRows) { return Mathf.Max(0, PackCapacity(inv, visibleRows) - PackUsed(inv, visibleRows)); } public static Vector2i FindFreePackCell(Inventory inv, int visibleRows) { //IL_0033: 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) int width = inv.GetWidth(); for (int i = 0; i < visibleRows; i++) { for (int j = 0; j < width; j++) { if (inv.GetItemAt(j, i) == null) { return new Vector2i(j, i); } } } return new Vector2i(-1, -1); } public static void Ensure(Player player) { if (!Installed || (Object)(object)player == (Object)null) { return; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return; } int num = VisibleRows(player); if (!Active) { EnsureWhileOff(inventory, num); return; } int num2 = num + 2; if (_knownVisibleRows >= 0 && _knownVisibleRows != num) { Relocate(inventory, _knownVisibleRows, num); } _knownVisibleRows = num; if (inventory.GetHeight() != num2) { inventory.SetHeight(num2); } } private static void EnsureWhileOff(Inventory inv, int visible) { _knownVisibleRows = -1; int num = HighestOccupiedHiddenRow(inv, visible); int num2 = ((num >= 0) ? (num + 1) : visible); if (inv.GetHeight() != num2) { inv.SetHeight(num2); } } public static int HighestOccupiedHiddenRow(Inventory inv, int visible) { int num = -1; List<ItemData> allItems = inv.GetAllItems(); for (int i = 0; i < allItems.Count; i++) { int y = allItems[i].m_gridPos.y; if (y >= visible && y > num) { num = y; } } return num; } public static void Forget() { _knownVisibleRows = -1; Invalidate(); } private static void Relocate(Inventory inv, int oldVisible, int newVisible) { //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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to inva