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 Hird v0.1.5
plugins/Hird.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; 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; [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.1.5.0")] [assembly: AssemblyInformationalVersion("0.1.5+619684227f7eace38df11f1134459e5ed52fb632")] [assembly: AssemblyProduct("Hird")] [assembly: AssemblyTitle("Hird")] [assembly: AssemblyVersion("0.1.5.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 Title; public static GUIStyle Lead; 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 BtnSmallOn; 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_00b7: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: 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_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0457: 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_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0534: 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_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Expected O, but got Unknown //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Expected O, but got Unknown //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Expected O, but got Unknown //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Expected O, but got Unknown //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Expected O, but got Unknown //IL_0652: 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_065f: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Expected O, but got Unknown //IL_0685: Expected O, but got Unknown //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Expected O, but got Unknown //IL_06bd: Expected O, but got Unknown //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Expected O, but got Unknown //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Expected O, but got Unknown //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0708: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Expected O, but got Unknown //IL_0736: Expected O, but got Unknown //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0863: Expected O, but got Unknown //IL_086d: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Expected O, but got Unknown //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08a6: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_08b6: Expected O, but got Unknown //IL_08b6: Unknown result type (might be due to invalid IL or missing references) //IL_08bb: Unknown result type (might be due to invalid IL or missing references) //IL_08c5: Expected O, but got Unknown //IL_08ca: Expected O, but got Unknown //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_08df: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_0909: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_091d: Unknown result type (might be due to invalid IL or missing references) //IL_0927: Expected O, but got Unknown //IL_0927: Unknown result type (might be due to invalid IL or missing references) //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Unknown result type (might be due to invalid IL or missing references) //IL_0941: Expected O, but got Unknown //IL_0941: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Expected O, but got Unknown //IL_0955: Expected O, but got Unknown //IL_09dc: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: 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(28, (FontStyle)1, TextHi); Title = Label(22, (FontStyle)1, TextHi); Lead = Label(17, (FontStyle)0, Text); 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); BtnSmallOn = Plate(26, 3, Hex("312B18"), Hex("43391F"), Brass, Hex("3B3320"), Hex("4E4227"), BrassHi, Hex("2A2515"), Hex("352E1A"), BrassHi, TextHi, 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(StoneHi); val.hover.textColor = TextHi; val.focused.background = Solid(StoneLit); 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.Hird { internal sealed class Member { internal long Id; internal string Name; internal int WarbandLevel; } internal sealed class Band { internal long Id; internal long LeaderId; internal readonly List<Member> Members = new List<Member>(); internal bool IsLeader(long id) { return LeaderId == id; } internal Member Find(long id) { for (int i = 0; i < Members.Count; i++) { if (Members[i].Id == id) { return Members[i]; } } return null; } internal bool Contains(long id) { return Find(id) != null; } internal bool Remove(long id) { for (int i = 0; i < Members.Count; i++) { if (Members[i].Id == id) { Members.RemoveAt(i); return true; } } return false; } internal Member Heir() { for (int i = 0; i < Members.Count; i++) { if (Members[i].Id != LeaderId) { return Members[i]; } } return null; } } internal static class Names { internal const int MaxLength = 32; internal static string Clean(string raw) { if (string.IsNullOrEmpty(raw)) { return "(unnamed)"; } StringBuilder stringBuilder = new StringBuilder(raw.Length); bool flag = true; for (int i = 0; i < raw.Length; i++) { if (stringBuilder.Length >= 32) { break; } char c = raw[i]; if (c == '<' || c == '>' || c == '$') { continue; } if (c == '\n' || c == '\r' || c == '\t' || c < ' ' || c == ' ') { if (!flag) { stringBuilder.Append(' '); flag = true; } } else { stringBuilder.Append(c); flag = false; } } while (stringBuilder.Length > 0 && stringBuilder[stringBuilder.Length - 1] == ' ') { stringBuilder.Length--; } if (stringBuilder.Length != 0) { return stringBuilder.ToString(); } return "(unnamed)"; } } internal static class BandHud { private sealed class Row { internal long Id; internal GameObject Go; internal RectTransform Rt; internal CanvasGroup Group; internal GuiBar Fast; internal GuiBar Slow; internal TMP_Text Name; internal float Shown; internal string WroteName; internal float WroteAlpha = -1f; internal float WroteBar = -1f; internal RectTransform NameRt; internal RectTransform HealthRt; } private const float MinRowHeight = 18f; private static readonly Vector2 OffScreen = new Vector2(-30000f, 0f); private static GameObject _root; private static RectTransform _rootRt; private static readonly List<Row> Rows = new List<Row>(); private static readonly List<long> Built = new List<long>(); private static float _rowHeight = -1f; private static bool _warnedNoPrefab; private static float _appliedRowGap = float.NaN; private static float _appliedNameGap = float.NaN; private static readonly Vector3[] Corners = (Vector3[])(object)new Vector3[4]; internal static int RowCount => Rows.Count; internal static bool RootAlive => (Object)(object)_root != (Object)null; internal static Transform Root { get { if (!((Object)(object)_root != (Object)null)) { return null; } return _root.transform; } } internal static void Teardown() { try { for (int i = 0; i < Rows.Count; i++) { if ((Object)(object)Rows[i].Go != (Object)null) { Object.Destroy((Object)(object)Rows[i].Go); } } Rows.Clear(); Built.Clear(); if ((Object)(object)_root != (Object)null) { Object.Destroy((Object)(object)_root); } _root = null; _rootRt = null; _rowHeight = -1f; } catch (Exception ex) { Safety.Failed("BandHud.Teardown", ex); } } private static bool InWorld() { if ((Object)(object)Player.m_localPlayer != (Object)null && (Object)(object)ZNetScene.instance != (Object)null && (Object)(object)Game.instance != (Object)null) { return (Object)(object)Hud.instance != (Object)null; } return false; } internal static void Tick() { if (!HirdPlugin.Enabled.Value || !InWorld()) { Teardown(); } else if (!BandView.Showing || Hud.IsUserHidden()) { Hide(); } else { if (!EnsureRoot()) { return; } List<Member> list = BandView.Rows(); if (HirdPlugin.HudShowSelf.Value) { Member member = BandView.Self(); if (member != null) { list.Insert(0, member); } } if (list.Count == 0) { Hide(); return; } if (!SameAsBuilt(list)) { Rebuild(list); } ApplySpacing(force: false); Place(); Paint(list); if (!_root.activeSelf) { _root.SetActive(true); } } } private static void Hide() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_root == (Object)null) && _root.activeSelf) { _root.SetActive(false); if ((Object)(object)_rootRt != (Object)null) { _rootRt.anchoredPosition = OffScreen; } } } private static bool EnsureRoot() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Expected O, but got Unknown //IL_00a3: 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_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_00fd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null && (Object)(object)_rootRt != (Object)null) { return true; } Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_rootObject == (Object)null) { return false; } Transform transform = instance.m_rootObject.transform; RectTransform val = (RectTransform)(object)((transform is RectTransform) ? transform : null); if ((Object)(object)val == (Object)null) { return false; } _root = new GameObject("HirdWarband", new Type[1] { typeof(RectTransform) }); _rootRt = _root.GetComponent<RectTransform>(); ((Transform)_rootRt).SetParent((Transform)(object)val, false); _rootRt.anchorMin = new Vector2(0f, 1f); _rootRt.anchorMax = new Vector2(0f, 1f); _rootRt.pivot = new Vector2(0f, 1f); _rootRt.sizeDelta = new Vector2(240f, 10f); _rootRt.anchoredPosition = OffScreen; return true; } private static bool SameAsBuilt(List<Member> members) { if (Built.Count != members.Count) { return false; } for (int i = 0; i < members.Count; i++) { if (Built[i] != members[i].Id) { return false; } } return true; } private static void Rebuild(List<Member> members) { for (int i = 0; i < Rows.Count; i++) { if ((Object)(object)Rows[i].Go != (Object)null) { Object.Destroy((Object)(object)Rows[i].Go); } } Rows.Clear(); Built.Clear(); GameObject val = PlayerNameplate(); if ((Object)(object)val == (Object)null) { return; } for (int j = 0; j < members.Count; j++) { Row row = Make(val, members[j]); if (row != null) { Rows.Add(row); Built.Add(members[j].Id); } } ApplySpacing(force: true); } private static GameObject PlayerNameplate() { EnemyHud instance = EnemyHud.instance; GameObject obj = (((Object)(object)instance != (Object)null) ? instance.m_baseHudPlayer : null); if ((Object)(object)obj == (Object)null && !_warnedNoPrefab) { _warnedNoPrefab = true; ManualLogSource log = HirdPlugin.Log; if (log == null) { return obj; } log.LogWarning((object)"Hird: EnemyHud has no player nameplate prefab, so the warband HUD cannot draw. The panel and experience sharing still work."); } return obj; } private static Row Make(GameObject prefab, Member member) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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_00b7: 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) try { GameObject val = Object.Instantiate<GameObject>(prefab, (Transform)(object)_rootRt); ((Object)val).name = "HirdRow"; val.SetActive(true); Transform transform = val.transform; RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null); if ((Object)(object)val2 == (Object)null) { Object.Destroy((Object)(object)val); return null; } Rect rect = val2.rect; float num = Mathf.Max(200f, ((Rect)(ref rect)).width); rect = val2.rect; float num2 = Mathf.Max(18f, ((Rect)(ref rect)).height); val2.anchorMin = new Vector2(0f, 1f); val2.anchorMax = new Vector2(0f, 1f); val2.pivot = new Vector2(0f, 1f); val2.sizeDelta = new Vector2(num, num2); ((Transform)val2).localScale = Vector3.one; Row row = new Row { Id = member.Id, Go = val, Rt = val2, Group = val.AddComponent<CanvasGroup>() }; Transform val3 = val.transform.Find("Health/health_fast_friendly") ?? val.transform.Find("Health/health_fast"); row.Fast = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponent<GuiBar>() : null); if ((Object)(object)val3 != (Object)null) { ((Component)val3).gameObject.SetActive(true); } Transform val4 = val.transform.Find("Health/health_fast"); if ((Object)(object)val4 != (Object)null && (Object)(object)row.Fast != (Object)null && (Object)(object)((Component)val4).gameObject != (Object)(object)((Component)row.Fast).gameObject) { ((Component)val4).gameObject.SetActive(false); } Transform val5 = val.transform.Find("Health/health_slow"); row.Slow = (((Object)(object)val5 != (Object)null) ? ((Component)val5).GetComponent<GuiBar>() : null); Transform val6 = val.transform.Find("Name"); row.Name = (((Object)(object)val6 != (Object)null) ? ((Component)val6).GetComponent<TMP_Text>() : null); Strip(val, "level_2"); Strip(val, "level_3"); Strip(val, "Alerted"); Strip(val, "Aware"); Transform obj = val.transform.Find("Name"); RectTransform val7 = (RectTransform)(object)((obj is RectTransform) ? obj : null); Transform obj2 = val.transform.Find("Health"); RectTransform val8 = (RectTransform)(object)((obj2 is RectTransform) ? obj2 : null); LeftAlign(val7); LeftAlign(val8); if ((Object)(object)row.Name != (Object)null) { row.Name.alignment = (TextAlignmentOptions)4097; } row.NameRt = val7; row.HealthRt = val8; row.Shown = 1f; return row; } catch (Exception ex) { Safety.Failed("BandHud.Make", ex); return null; } } private static void Strip(GameObject go, string child) { Transform val = go.transform.Find(child); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } private static float Tighten(Row row, float wanted) { //IL_0090: 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_00ad: 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_00e1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)row?.Rt == (Object)null || (Object)(object)row.NameRt == (Object)null || (Object)(object)row.HealthRt == (Object)null) { return 18f; } try { if (!VExtent(row.NameRt, row.Rt, out var top, out var bottom)) { return 18f; } if (!VExtent(row.HealthRt, row.Rt, out var top2, out var bottom2)) { return 18f; } float num = bottom - top2 - wanted; row.HealthRt.anchoredPosition = new Vector2(row.HealthRt.anchoredPosition.x, row.HealthRt.anchoredPosition.y + num); float num2 = Mathf.Max(18f, top - (bottom2 + num)); row.Rt.sizeDelta = new Vector2(row.Rt.sizeDelta.x, num2); return num2; } catch (Exception ex) { Safety.Failed("BandHud.Tighten", ex); return 18f; } } private static void ApplySpacing(bool force) { float value = HirdPlugin.HudRowGap.Value; float value2 = HirdPlugin.HudNameGap.Value; if (!force && Mathf.Approximately(value, _appliedRowGap) && Mathf.Approximately(value2, _appliedNameGap)) { return; } _appliedRowGap = value; _appliedNameGap = value2; float num = 18f; for (int i = 0; i < Rows.Count; i++) { float num2 = Tighten(Rows[i], value2); if (i == 0) { num = num2; } } _rowHeight = num + value; Layout(); if (HirdPlugin.VerboseLog.Value) { ManualLogSource log = HirdPlugin.Log; if (log != null) { log.LogInfo((object)("Hird: row is " + num.ToString("0.#") + " tall with a name gap of " + value2.ToString("0.#") + ", spaced " + _rowHeight.ToString("0.#") + " apart (row gap " + value.ToString("0.#") + ").")); } } } private static bool VExtent(RectTransform of, RectTransform space, out float top, out float bottom) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_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) top = 0f; bottom = 0f; try { of.GetWorldCorners(Corners); top = ((Transform)space).InverseTransformPoint(Corners[1]).y; bottom = ((Transform)space).InverseTransformPoint(Corners[0]).y; return true; } catch (Exception ex) { Safety.Failed("BandHud.VExtent", ex); return false; } } private static void LeftAlign(RectTransform rt) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_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_0057: 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_006e: 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_0089: 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) if ((Object)(object)rt == (Object)null) { return; } try { Rect rect = rt.rect; float width = ((Rect)(ref rect)).width; rt.anchorMin = new Vector2(0f, rt.anchorMin.y); rt.anchorMax = new Vector2(0f, rt.anchorMax.y); rt.pivot = new Vector2(0f, rt.pivot.y); rt.sizeDelta = new Vector2(width, rt.sizeDelta.y); rt.anchoredPosition = new Vector2(0f, rt.anchoredPosition.y); } catch (Exception ex) { Safety.Failed("BandHud.LeftAlign", ex); } } private static void Layout() { //IL_0042: 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_0095: Unknown result type (might be due to invalid IL or missing references) float num = ((_rowHeight > 0f) ? _rowHeight : (18f + HirdPlugin.HudRowGap.Value)); for (int i = 0; i < Rows.Count; i++) { Rows[i].Rt.anchoredPosition = new Vector2(0f, (float)(-i) * num); } if ((Object)(object)_rootRt != (Object)null) { _rootRt.sizeDelta = new Vector2(_rootRt.sizeDelta.x, Mathf.Max(10f, (float)Rows.Count * num)); } } private static void Place() { //IL_002d: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_rootRt == (Object)null)) { Transform parent = ((Transform)_rootRt).parent; RectTransform val = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (!((Object)(object)val == (Object)null)) { ((Transform)_rootRt).localScale = Vector3.one * Mathf.Clamp(HirdPlugin.HudScale.Value, 0.5f, 2f); RectTransform rootRt = _rootRt; float num = 8f + HirdPlugin.HudOffsetX.Value; Rect rect = val.rect; rootRt.anchoredPosition = new Vector2(num, (0f - ((Rect)(ref rect)).height) * 0.16f + HirdPlugin.HudOffsetY.Value); } } } private static void Paint(List<Member> members) { float num = Mathf.Max(5f, HirdPlugin.ShareRange.Value); for (int i = 0; i < Rows.Count && i < members.Count; i++) { Row row = Rows[i]; Member member = members[i]; Vitals.Snap snap = BandView.SnapOf(member.Id); bool flag = BandView.IsSelf(member.Id); float num3; bool flag2; bool flag3; float num4; if (flag) { Player localPlayer = Player.m_localPlayer; float num2 = (((Object)(object)localPlayer != (Object)null) ? ((Character)localPlayer).GetMaxHealth() : 0f); num3 = (((Object)(object)localPlayer != (Object)null && num2 > 0f) ? Mathf.Clamp01(((Character)localPlayer).GetHealth() / num2) : 0f); flag2 = (Object)(object)localPlayer != (Object)null; flag3 = (Object)(object)localPlayer != (Object)null && ((Character)localPlayer).IsDead(); num4 = 0f; } else { flag2 = snap != null && !snap.Stale && snap.MaxHealth > 0f; num3 = (flag2 ? snap.Fraction : 0f); flag3 = snap?.Dead ?? false; num4 = snap?.Distance ?? (-1f); } if (flag3) { num3 = 0f; } row.Shown = Mathf.MoveTowards(row.Shown, num3, Mathf.Max(0.35f, Mathf.Abs(num3 - row.Shown) * 6f) * Time.deltaTime); if (Mathf.Abs(row.Shown - row.WroteBar) > 0.002f) { row.WroteBar = row.Shown; if ((Object)(object)row.Fast != (Object)null) { row.Fast.SetValue(row.Shown); } if ((Object)(object)row.Slow != (Object)null) { row.Slow.SetValue(row.Shown); } } if ((Object)(object)row.Name != (Object)null) { string text = Label(member, flag2, flag3, num4, flag); if (!string.Equals(text, row.WroteName, StringComparison.Ordinal)) { row.WroteName = text; row.Name.text = text; } } if ((Object)(object)row.Group != (Object)null) { bool flag4 = flag || (snap != null && snap.InRange) || (BandView.Pretending && num4 >= 0f && num4 <= num); float num5 = ((!flag2) ? 0.35f : (flag4 ? 1f : 0.62f)); if (!Mathf.Approximately(num5, row.WroteAlpha)) { row.WroteAlpha = num5; row.Group.alpha = num5; } } } } private static string Label(Member member, bool known, bool dead, float distance, bool self) { string text = member.Name ?? ""; if (dead) { return "<color=#FFFFFF80><s>" + text + "</s></color>"; } if (!known) { return "<color=#FFFFFF80>" + text + " ?</color>"; } if (!self && HirdPlugin.HudShowDistance.Value && distance >= 0f) { return text + " <color=#FFFFFF99>" + Mathf.RoundToInt(distance) + "m</color>"; } return text; } } internal static class Client { private static bool _checked; private static bool _hasUi; private static bool _sceneWasLoaded; internal static bool HasUi { get { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (_checked) { return _hasUi; } _checked = true; try { _hasUi = (int)SystemInfo.graphicsDeviceType != 4; } catch (Exception ex) { _hasUi = false; Safety.Failed("Client.HasUi", ex); } if (!_hasUi) { ManualLogSource log = HirdPlugin.Log; if (log != null) { log.LogInfo((object)"Hird: no graphics device, so this is a dedicated server. The panel and the warband HUD are disabled here; the roster still runs."); } } return _hasUi; } } internal static void Tick() { if (!HasUi) { return; } try { WatchForWorldChange(); } catch (Exception ex) { Safety.Failed("Client.WatchForWorldChange", ex); } try { Roster.Tick(); } catch (Exception ex2) { Safety.Failed("Roster.Tick", ex2); } try { Vitals.Tick(); } catch (Exception ex3) { Safety.Failed("Vitals.Tick", ex3); } try { Sharing.Tick(); } catch (Exception ex4) { Safety.Failed("Sharing.Tick", ex4); } try { Fake.Tick(); } catch (Exception ex5) { Safety.Failed("Fake.Tick", ex5); } try { BandHud.Tick(); } catch (Exception ex6) { Safety.Failed("BandHud.Tick", ex6); } try { HirdPanel.Tick(); } catch (Exception ex7) { Safety.Failed("HirdPanel.Tick", ex7); } } private static void WatchForWorldChange() { bool flag = (Object)(object)ZNetScene.instance != (Object)null; if (_sceneWasLoaded && !flag) { HirdPanel.Close(); BandHud.Teardown(); Roster.Clear(); Vitals.Clear(); Sharing.Clear(); } _sceneWasLoaded = flag; } internal static void Draw() { if (!HasUi) { return; } try { HirdPanel.Draw(); } catch (Exception ex) { Safety.Failed("HirdPanel.Draw", ex); } } } [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__2_0; public static ConsoleEvent <>9__2_1; public static ConsoleEvent <>9__2_2; public static ConsoleEvent <>9__2_3; public static ConsoleEvent <>9__2_4; public static ConsoleEvent <>9__2_5; internal void <Register>b__2_0(ConsoleEventArgs args) { try { Terminal context = args.Context; if (context != null) { context.AddString(Report()); } } catch (Exception ex) { Safety.Failed("hird", ex); } } internal void <Register>b__2_1(ConsoleEventArgs args) { try { if (args.Length < 2) { Terminal context = args.Context; if (context != null) { context.AddString("Hird: hird_invite [name]"); } return; } StringBuilder stringBuilder = new StringBuilder(); for (int i = 1; i < args.Length; i++) { if (stringBuilder.Length > 0) { stringBuilder.Append(' '); } stringBuilder.Append(args[i]); } Roster.Invite(stringBuilder.ToString()); Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Hird: asked " + Names.Clean(stringBuilder.ToString()) + "."); } } catch (Exception ex) { Safety.Failed("hird_invite", ex); } } internal void <Register>b__2_2(ConsoleEventArgs args) { try { Roster.Leave(); Terminal context = args.Context; if (context != null) { context.AddString("Hird: leaving the warband."); } } catch (Exception ex) { Safety.Failed("hird_leave", ex); } } internal void <Register>b__2_3(ConsoleEventArgs args) { try { if (args.Length < 2) { Terminal context = args.Context; if (context != null) { context.AddString("Hird: fake members are currently " + HirdPlugin.FakeMembers.Value + ". Use hird_fake [0-15]."); } return; } if (!int.TryParse(args[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Hird: hird_fake [0-15]"); } return; } HirdPlugin.FakeMembers.Value = Mathf.Clamp(result, 0, 15); Terminal context3 = args.Context; if (context3 != null) { context3.AddString((HirdPlugin.FakeMembers.Value == 0) ? "Hird: test warband off." : ("Hird: test warband of " + HirdPlugin.FakeMembers.Value + ".")); } } catch (Exception ex) { Safety.Failed("hird_fake", ex); } } internal void <Register>b__2_4(ConsoleEventArgs args) { try { string text = Nameplates(); Terminal context = args.Context; if (context != null) { context.AddString(text); } ManualLogSource log = HirdPlugin.Log; if (log != null) { log.LogWarning((object)text); } } catch (Exception ex) { Safety.Failed("hird_nameplate", ex); } } internal void <Register>b__2_5(ConsoleEventArgs args) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) try { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { Terminal context = args.Context; if (context != null) { context.AddString("Hird: load into a world first."); } return; } if (args.Length < 2 || !int.TryParse(args[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Hird: hird_warband [0-100]"); } return; } result = Mathf.Clamp(result, 0, 100); Skills skills = ((Character)localPlayer).GetSkills(); WarbandSkill.Register(skills); skills.ResetSkill(WarbandSkill.Skill); WarbandSkill.Register(skills); skills.RaiseSkill(WarbandSkill.Skill, 0f); Skill val = null; foreach (Skill skill in skills.GetSkillList()) { if (skill?.m_info != null && skill.m_info.m_skill == WarbandSkill.Skill) { val = skill; break; } } if (val == null) { Terminal context3 = args.Context; if (context3 != null) { context3.AddString("Hird: could not find the Warband skill to set it."); } return; } val.m_level = result; val.m_accumulator = 0f; Terminal context4 = args.Context; if (context4 != null) { context4.AddString("Hird: Warband set to " + result + ". You now take " + Mathf.RoundToInt(WarbandSkill.ReceiveFactor * 100f) + "% of each nearby member's experience and still keep " + Mathf.RoundToInt(WarbandSkill.KeepFactor * 100f) + "% of your own. Log out and back in to check it sticks."); } } catch (Exception ex) { Safety.Failed("hird_warband", ex); } } } private static bool _registered; private static readonly string[] Expected = new string[2] { "Health", "Name" }; [HarmonyPostfix] public static void Postfix() { try { if (!_registered) { _registered = true; Register(); } } catch (Exception ex) { Safety.Failed("Terminal.InitTerminal command registration", ex); } } 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 //IL_00de: 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) //IL_00d4: Expected O, but got Unknown //IL_0117: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Expected O, but got Unknown object obj = <>c.<>9__2_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { try { Terminal context = args.Context; if (context != null) { context.AddString(Report()); } } catch (Exception ex) { Safety.Failed("hird", ex); } }; <>c.<>9__2_0 = val; obj = (object)val; } new ConsoleCommand("hird", "hird - show your warband, who is in it, and what your experience is being shared at.", (ConsoleEvent)obj, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__2_1; if (obj2 == null) { ConsoleEvent val2 = delegate(ConsoleEventArgs args) { try { if (args.Length < 2) { Terminal context = args.Context; if (context != null) { context.AddString("Hird: hird_invite [name]"); } } else { StringBuilder stringBuilder = new StringBuilder(); for (int i = 1; i < args.Length; i++) { if (stringBuilder.Length > 0) { stringBuilder.Append(' '); } stringBuilder.Append(args[i]); } Roster.Invite(stringBuilder.ToString()); Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Hird: asked " + Names.Clean(stringBuilder.ToString()) + "."); } } } catch (Exception ex) { Safety.Failed("hird_invite", ex); } }; <>c.<>9__2_1 = val2; obj2 = (object)val2; } new ConsoleCommand("hird_invite", "hird_invite [name] - ask somebody to join your warband. Makes one if you are not already in it.", (ConsoleEvent)obj2, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj3 = <>c.<>9__2_2; if (obj3 == null) { ConsoleEvent val3 = delegate(ConsoleEventArgs args) { try { Roster.Leave(); Terminal context = args.Context; if (context != null) { context.AddString("Hird: leaving the warband."); } } catch (Exception ex) { Safety.Failed("hird_leave", ex); } }; <>c.<>9__2_2 = val3; obj3 = (object)val3; } new ConsoleCommand("hird_leave", "hird_leave - leave your warband. If you lead it, the lead passes to somebody else rather than the band ending.", (ConsoleEvent)obj3, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj4 = <>c.<>9__2_3; if (obj4 == null) { ConsoleEvent val4 = delegate(ConsoleEventArgs args) { try { int result; if (args.Length < 2) { Terminal context = args.Context; if (context != null) { context.AddString("Hird: fake members are currently " + HirdPlugin.FakeMembers.Value + ". Use hird_fake [0-15]."); } } else if (!int.TryParse(args[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out result)) { Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Hird: hird_fake [0-15]"); } } else { HirdPlugin.FakeMembers.Value = Mathf.Clamp(result, 0, 15); Terminal context3 = args.Context; if (context3 != null) { context3.AddString((HirdPlugin.FakeMembers.Value == 0) ? "Hird: test warband off." : ("Hird: test warband of " + HirdPlugin.FakeMembers.Value + ".")); } } } catch (Exception ex) { Safety.Failed("hird_fake", ex); } }; <>c.<>9__2_3 = val4; obj4 = (object)val4; } new ConsoleCommand("hird_fake", "hird_fake [0-15] - fill the warband HUD with invented members so the layout can be worked on alone. Nothing is sent to the server and no real warband is touched. The panel's masthead says so while it is on.", (ConsoleEvent)obj4, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj5 = <>c.<>9__2_4; if (obj5 == null) { ConsoleEvent val5 = delegate(ConsoleEventArgs args) { try { string text = Nameplates(); Terminal context = args.Context; if (context != null) { context.AddString(text); } ManualLogSource log = HirdPlugin.Log; if (log != null) { log.LogWarning((object)text); } } catch (Exception ex) { Safety.Failed("hird_nameplate", ex); } }; <>c.<>9__2_4 = val5; obj5 = (object)val5; } new ConsoleCommand("hird_nameplate", "hird_nameplate - DIAGNOSTIC. Report the state of the game's player nameplate template and of EnemyHud's live huds. Run this when names over players' heads go wrong, on the machine where it actually happens.", (ConsoleEvent)obj5, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj6 = <>c.<>9__2_5; if (obj6 == null) { ConsoleEvent val6 = delegate(ConsoleEventArgs args) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) try { Player localPlayer = Player.m_localPlayer; int result; if ((Object)(object)localPlayer == (Object)null) { Terminal context = args.Context; if (context != null) { context.AddString("Hird: load into a world first."); } } else if (args.Length < 2 || !int.TryParse(args[1], NumberStyles.Integer, CultureInfo.InvariantCulture, out result)) { Terminal context2 = args.Context; if (context2 != null) { context2.AddString("Hird: hird_warband [0-100]"); } } else { result = Mathf.Clamp(result, 0, 100); Skills skills = ((Character)localPlayer).GetSkills(); WarbandSkill.Register(skills); skills.ResetSkill(WarbandSkill.Skill); WarbandSkill.Register(skills); skills.RaiseSkill(WarbandSkill.Skill, 0f); Skill val7 = null; foreach (Skill skill in skills.GetSkillList()) { if (skill?.m_info != null && skill.m_info.m_skill == WarbandSkill.Skill) { val7 = skill; break; } } if (val7 == null) { Terminal context3 = args.Context; if (context3 != null) { context3.AddString("Hird: could not find the Warband skill to set it."); } } else { val7.m_level = result; val7.m_accumulator = 0f; Terminal context4 = args.Context; if (context4 != null) { context4.AddString("Hird: Warband set to " + result + ". You now take " + Mathf.RoundToInt(WarbandSkill.ReceiveFactor * 100f) + "% of each nearby member's experience and still keep " + Mathf.RoundToInt(WarbandSkill.KeepFactor * 100f) + "% of your own. Log out and back in to check it sticks."); } } } } catch (Exception ex) { Safety.Failed("hird_warband", ex); } }; <>c.<>9__2_5 = val6; obj6 = (object)val6; } new ConsoleCommand("hird_warband", "hird_warband [0-100] - DEBUG. Set your own Warband skill, to check what the share rate looks like at a level and that it survives a logout. This is a cheat and it is not hidden behind anything; a server that minds should turn Hird's console commands off by not installing it.", (ConsoleEvent)obj6, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static string Nameplates() { StringBuilder stringBuilder = new StringBuilder(); EnemyHud instance = EnemyHud.instance; if ((Object)(object)instance == (Object)null) { return "Hird: EnemyHud.instance is null. Load into a world first."; } GameObject baseHudPlayer = instance.m_baseHudPlayer; bool flag = baseHudPlayer == null; bool flag2 = (Object)(object)baseHudPlayer == (Object)null; stringBuilder.Append("Hird nameplate report"); stringBuilder.Append("\n m_baseHudPlayer: "); if (flag) { stringBuilder.Append("the FIELD IS NULL - something cleared the reference."); } else if (flag2) { stringBuilder.Append("DESTROYED - the object is gone but the field still points at it."); } else { stringBuilder.Append("alive, active=").Append(baseHudPlayer.activeSelf).Append(", children=") .Append(baseHudPlayer.transform.childCount); } if (!flag && !flag2) { StringBuilder stringBuilder2 = new StringBuilder(); string[] expected = Expected; foreach (string text in expected) { if ((Object)(object)baseHudPlayer.transform.Find(text) == (Object)null) { if (stringBuilder2.Length > 0) { stringBuilder2.Append(", "); } stringBuilder2.Append(text); } } stringBuilder.Append("\n template children: "); stringBuilder.Append((stringBuilder2.Length == 0) ? "all present, the template is intact" : ("MISSING " + stringBuilder2)); } try { if (!(AccessTools.Field(typeof(EnemyHud), "m_huds")?.GetValue(instance) is IDictionary dictionary)) { stringBuilder.Append("\n EnemyHud huds: could not read m_huds."); } else { int num = 0; foreach (object key in dictionary.Keys) { if ((Object)((key is Character) ? key : null) == (Object)null) { num++; } } stringBuilder.Append("\n EnemyHud huds: ").Append(dictionary.Count).Append((num > 0) ? (", " + num + " ORPHANED") : ", none orphaned"); } } catch (Exception ex) { stringBuilder.Append("\n EnemyHud huds: ").Append(ex.Message); } if (!flag && !flag2) { stringBuilder.Append("\n template anchors: ").Append(Anchors(baseHudPlayer.transform)); stringBuilder.Append("\n Name: ").Append(Anchors(baseHudPlayer.transform.Find("Name"))); stringBuilder.Append("\n Health: ").Append(Anchors(baseHudPlayer.transform.Find("Health"))); } stringBuilder.Append("\n EnemyHud.m_hudRoot: ").Append(((Object)(object)instance.m_hudRoot != (Object)null) ? Path(instance.m_hudRoot.transform) : "null"); Hud instance2 = Hud.instance; stringBuilder.Append("\n Hud.m_rootObject: ").Append(((Object)(object)instance2 != (Object)null && (Object)(object)instance2.m_rootObject != (Object)null) ? Path(instance2.m_rootObject.transform) : "null"); Transform root = BandHud.Root; stringBuilder.Append("\n Hird root: ").Append(((Object)(object)root != (Object)null) ? Path(root) : "none"); if ((Object)(object)root != (Object)null && (Object)(object)instance.m_hudRoot != (Object)null) { bool flag3 = root.IsChildOf(instance.m_hudRoot.transform); stringBuilder.Append("\n Hird root under EnemyHud's canvas: ").Append(flag3 ? "YES - THIS IS A BUG, teardown would take EnemyHud's plates" : "no"); } try { List<Character> allCharacters = Character.GetAllCharacters(); int num2 = 0; if (allCharacters != null) { for (int j = 0; j < allCharacters.Count; j++) { if ((Object)(object)allCharacters[j] == (Object)null) { num2++; } } stringBuilder.Append("\n Character list: ").Append(allCharacters.Count).Append(" entries"); stringBuilder.Append((num2 > 0) ? (", " + num2 + " DESTROYED - THIS IS THE NAMEPLATE BUG. Something threw inside Character.OnDestroy before it could remove itself. Only a game restart clears it.") : ", none destroyed"); } } catch (Exception ex2) { stringBuilder.Append("\n Character list: ").Append(ex2.Message); } stringBuilder.Append("\n Hird rows: ").Append(BandHud.RowCount).Append(BandHud.RootAlive ? ", root alive" : ", no root"); stringBuilder.Append("\n\nTemplate centred (0.5,0.5) + children present + root not under ").Append("EnemyHud = Hird is not the cause."); return stringBuilder.ToString(); } private static string Anchors(Transform t) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_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_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) RectTransform val = (RectTransform)(object)((t is RectTransform) ? t : null); if ((Object)(object)val == (Object)null) { if (!((Object)(object)t == (Object)null)) { return "not a RectTransform"; } return "missing"; } string[] obj = new string[8] { "min", null, null, null, null, null, null, null }; Vector2 val2 = val.anchorMin; obj[1] = ((Vector2)(ref val2)).ToString("0.##"); obj[2] = " max"; val2 = val.anchorMax; obj[3] = ((Vector2)(ref val2)).ToString("0.##"); obj[4] = " pivot"; val2 = val.pivot; obj[5] = ((Vector2)(ref val2)).ToString("0.##"); obj[6] = " size"; val2 = val.sizeDelta; obj[7] = ((Vector2)(ref val2)).ToString("0"); return string.Concat(obj); } private static string Path(Transform t) { 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(); } private static string Report() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("Hird ").Append("0.1.5").Append(". "); if (!HirdPlugin.Enabled.Value) { stringBuilder.Append("Switched off in the settings."); return stringBuilder.ToString(); } stringBuilder.Append("Warband skill ").Append(WarbandSkill.Level).Append(". Near a member you keep ") .Append(Mathf.RoundToInt(WarbandSkill.KeepFactor * 100f)) .Append("% of your own and take ") .Append(Mathf.RoundToInt(WarbandSkill.ReceiveFactor * 100f)) .Append("% of each of theirs."); if (Net.IsServer) { stringBuilder.Append(" This instance is the server, holding ").Append(Server.BandCount).Append(" warband(s)."); } if (!Roster.InBand) { stringBuilder.Append(" You are not in a warband."); return stringBuilder.ToString(); } stringBuilder.Append(" You are in a warband of ").Append(Roster.Members.Count).Append(Roster.IsLeader ? ", and you lead it." : "."); stringBuilder.Append(" ").Append(Vitals.NearbyCount).Append(" within sharing range."); foreach (Member member in Roster.Members) { Vitals.Snap snap = Vitals.Of(member.Id); stringBuilder.Append("\n ").Append(member.Name); if (member.Id == Roster.LeaderId) { stringBuilder.Append(" (leader)"); } if (member.Id == Roster.MyId) { stringBuilder.Append(" (you)"); } if (snap == null) { stringBuilder.Append(" - no vitals yet"); } else if (snap.Stale) { stringBuilder.Append(" - no signal"); } else { stringBuilder.Append(" - ").Append(Mathf.RoundToInt(snap.Fraction * 100f)).Append("% hp, ") .Append(Mathf.RoundToInt(snap.Distance)) .Append("m") .Append(snap.InRange ? ", sharing" : ", too far to share"); } } return stringBuilder.ToString(); } } internal static class Fake { private sealed class Puppet { internal Member Who; internal Vitals.Snap Snap; internal float Phase; internal float NextHit; } private static readonly string[] Pool = new string[15] { "Bjorn", "Sigrun Ravenswyrd", "Ulf", "Astrid", "Halvar the Unreasonably Long Named", "Gudrun", "Toke", "Ylva", "Ragnvald", "Hilde", "Sten", "Frida", "Arnbjorn", "Solveig", "Kettil" }; private static readonly List<Puppet> Puppets = new List<Puppet>(); private static int _built = -1; internal const long SelfId = -999L; private static readonly Member SelfRow = new Member { Id = -999L }; internal static bool Active { get { if (Client.HasUi) { return Count > 0; } return false; } } internal static int Count => Mathf.Clamp(HirdPlugin.FakeMembers.Value, 0, Pool.Length); internal static long LeaderId { get { if (Puppets.Count <= 0) { return 0L; } return Puppets[0].Who.Id; } } internal static void Tick() { int num = (Active ? Count : 0); if (num != _built) { Build(num); } if (num != 0) { Animate(); } } private static void Build(int count) { Puppets.Clear(); _built = count; for (int i = 0; i < count; i++) { Puppets.Add(new Puppet { Who = new Member { Id = -1000L - (long)i, Name = Pool[i], WarbandLevel = i * 13 % 101 }, Snap = new Vitals.Snap { MaxHealth = 100f + (float)i * 15f, Health = 100f + (float)i * 15f, WarbandLevel = i * 13 % 101 }, Phase = (float)i * 0.9f, NextHit = Time.time + 2f + (float)i }); } } private static void Animate() { for (int i = 0; i < Puppets.Count; i++) { Puppet puppet = Puppets[i]; bool num = i == 2 && Puppets.Count > 3; bool flag = i == 4 && Puppets.Count > 5 && Time.time % 30f > 20f; if (num) { puppet.Snap.Health = 0f; puppet.Snap.Dead = true; } else { float num2 = 0.82f + 0.12f * Mathf.Sin(Time.time * 0.7f + puppet.Phase); if (Time.time >= puppet.NextHit) { puppet.NextHit = Time.time + Random.Range(3f, 9f); puppet.Snap.Health = Mathf.Max(puppet.Snap.MaxHealth * 0.12f, puppet.Snap.Health - puppet.Snap.MaxHealth * Random.Range(0.15f, 0.45f)); } else { float num3 = puppet.Snap.MaxHealth * num2; puppet.Snap.Health = Mathf.MoveTowards(puppet.Snap.Health, num3, puppet.Snap.MaxHealth * 0.12f * Time.deltaTime); } puppet.Snap.Dead = false; } puppet.Snap.Distance = 8f + (float)i * 17f; puppet.Snap.InRange = puppet.Snap.Distance <= Mathf.Max(5f, HirdPlugin.ShareRange.Value); if (!flag) { puppet.Snap.At = Time.time; } } } internal static List<Member> Members() { List<Member> list = new List<Member>(Puppets.Count); for (int i = 0; i < Puppets.Count; i++) { list.Add(Puppets[i].Who); } return list; } internal static Vitals.Snap SnapOf(long id) { for (int i = 0; i < Puppets.Count; i++) { if (Puppets[i].Who.Id == id) { return Puppets[i].Snap; } } return null; } internal static Member Self() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null) { return null; } SelfRow.Name = Names.Clean(localPlayer.GetPlayerName()); SelfRow.WarbandLevel = WarbandSkill.Level; return SelfRow; } } internal static class BandView { internal static bool Pretending => Fake.Active; internal static bool Showing { get { if (!Pretending) { return Roster.InBand; } return true; } } internal static long SelfId { get { if (!Pretending) { return Roster.MyId; } return -999L; } } internal static bool CanManage { get { if (!Pretending) { return Roster.IsLeader; } return false; } } internal static List<Member> Rows() { if (!Pretending) { return Roster.Oth