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 Huskarl v0.1.6
plugins/Huskarl.dll
Decompiled 10 hours 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.IO; 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 UnityEngine; using UnityEngine.Rendering; [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.6.0")] [assembly: AssemblyInformationalVersion("0.1.6+71eadc83c57b0679777ea2b3c8c4b80aa1d4ff35")] [assembly: AssemblyProduct("Huskarl")] [assembly: AssemblyTitle("Huskarl")] [assembly: AssemblyVersion("0.1.6.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GBV.Shared { internal static class Theme { public static readonly Color StoneDeep = Hex("0A0B0D"); public static readonly Color Stone = Hex("14161A"); public static readonly Color StoneHi = Hex("1F2329"); public static readonly Color StoneLit = Hex("2D323A"); public static readonly Color Carve = Hex("060708"); public static readonly Color Brass = Hex("C9A45C"); public static readonly Color BrassHi = Hex("F2D9A0"); public static readonly Color BrassDim = Hex("6B5630"); public static readonly Color BrassInk = Hex("17110478"); public static readonly Color TextHi = Hex("F7F4EE"); public static readonly Color Text = Hex("D8D4CC"); public static readonly Color Muted = Hex("9FA0A2"); public static readonly Color Faint = Hex("74767A"); public static readonly Color Good = Hex("A6C978"); public static readonly Color Bad = Hex("DD6A57"); public static readonly Color Warn = Hex("E8B25C"); public const float Pad = 30f; public const float Inlay = 9f; public const float TabH = 46f; public const float RowH = 30f; public const float FooterH = 44f; public static GUIStyle Blank; public static GUIStyle Wordmark; public static GUIStyle TabOn; public static GUIStyle TabOff; public static GUIStyle Heading; public static GUIStyle Body; public static GUIStyle BodyHi; public static GUIStyle Dim; public static GUIStyle Small; public static GUIStyle SmallRight; public static GUIStyle Mono; public static GUIStyle MonoDim; public static GUIStyle MonoEcho; public static GUIStyle Search; public static GUIStyle Field; public static GUIStyle FieldText; public static GUIStyle FieldArea; public static GUIStyle Console_; public static GUIStyle Link; public static GUIStyle LinkOn; public static GUIStyle Chip; public static GUIStyle ChipOn; public static GUIStyle Row; public static GUIStyle Action; public static GUIStyle ActionKey; public static GUIStyle Danger; public static GUIStyle Btn; public static GUIStyle BtnOn; public static GUIStyle BtnPrimary; public static GUIStyle BtnDanger; public static GUIStyle BtnSmall; public static GUIStyle 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Expected O, but got Unknown //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0315: Unknown result type (might be due to invalid IL or missing references) //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Unknown result type (might be due to invalid IL or missing references) //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_038d: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0415: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_0489: Unknown result type (might be due to invalid IL or missing references) //IL_0493: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04ed: Unknown result type (might be due to invalid IL or missing references) //IL_04f2: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_0506: Unknown result type (might be due to invalid IL or missing references) //IL_050b: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0529: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Expected O, but got Unknown //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_056c: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0587: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_0597: Unknown result type (might be due to invalid IL or missing references) //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05ac: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05cb: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05db: 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_05ea: Expected O, but got Unknown //IL_05ea: Unknown result type (might be due to invalid IL or missing references) //IL_05f1: Unknown result type (might be due to invalid IL or missing references) //IL_05fb: Expected O, but got Unknown //IL_05fb: Unknown result type (might be due to invalid IL or missing references) //IL_0600: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Expected O, but got Unknown //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0612: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Expected O, but got Unknown //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0633: Unknown result type (might be due to invalid IL or missing references) //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_065c: Expected O, but got Unknown //IL_0661: Expected O, but got Unknown //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_066b: Unknown result type (might be due to invalid IL or missing references) //IL_0673: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Unknown result type (might be due to invalid IL or missing references) //IL_0685: Unknown result type (might be due to invalid IL or missing references) //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Expected O, but got Unknown //IL_0699: Expected O, but got Unknown //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06bd: Unknown result type (might be due to invalid IL or missing references) //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Expected O, but got Unknown //IL_06ce: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Expected O, but got Unknown //IL_06df: Unknown result type (might be due to invalid IL or missing references) //IL_06e4: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Unknown result type (might be due to invalid IL or missing references) //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_070d: Expected O, but got Unknown //IL_0712: Expected O, but got Unknown //IL_071c: Unknown result type (might be due to invalid IL or missing references) //IL_0730: Unknown result type (might be due to invalid IL or missing references) //IL_0744: Unknown result type (might be due to invalid IL or missing references) //IL_0762: Unknown result type (might be due to invalid IL or missing references) //IL_07b0: Unknown result type (might be due to invalid IL or missing references) //IL_07e3: Unknown result type (might be due to invalid IL or missing references) //IL_081b: Unknown result type (might be due to invalid IL or missing references) //IL_0835: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Expected O, but got Unknown //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_084e: 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_0868: Unknown result type (might be due to invalid IL or missing references) //IL_086d: Unknown result type (might be due to invalid IL or missing references) //IL_0877: Expected O, but got Unknown //IL_0877: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Unknown result type (might be due to invalid IL or missing references) //IL_0888: Unknown result type (might be due to invalid IL or missing references) //IL_0892: Expected O, but got Unknown //IL_0892: Unknown result type (might be due to invalid IL or missing references) //IL_0897: Unknown result type (might be due to invalid IL or missing references) //IL_08a1: Expected O, but got Unknown //IL_08a6: Expected O, but got Unknown //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08b5: 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_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_08d0: 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_08e5: 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_08f9: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Expected O, but got Unknown //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_090e: Unknown result type (might be due to invalid IL or missing references) //IL_0913: Unknown result type (might be due to invalid IL or missing references) //IL_091d: Expected O, but got Unknown //IL_091d: Unknown result type (might be due to invalid IL or missing references) //IL_0922: Unknown result type (might be due to invalid IL or missing references) //IL_092c: Expected O, but got Unknown //IL_0931: Expected O, but got Unknown //IL_09b8: Unknown result type (might be due to invalid IL or missing references) //IL_09cc: Unknown result type (might be due to invalid IL or missing references) if (!_built) { _built = true; Px = Solid(Color.white); Grain = StoneGrain(128); Blank = new GUIStyle(); Wordmark = Label(26, (FontStyle)1, TextHi); Heading = Label(11, (FontStyle)1, Brass); Body = Label(13, (FontStyle)0, Text); BodyHi = Label(13, (FontStyle)1, TextHi); Dim = Label(13, (FontStyle)0, Muted); Small = Label(11, (FontStyle)0, Muted); SmallRight = Label(11, (FontStyle)0, Muted); SmallRight.alignment = (TextAnchor)5; Mono = Label(12, (FontStyle)0, TextHi); MonoDim = Label(12, (FontStyle)0, Muted); MonoEcho = Label(12, (FontStyle)1, Brass); TabOff = Ghost(46f, 13, (FontStyle)0, Muted, TextHi); TabOn = Ghost(46f, 13, (FontStyle)1, BrassHi, BrassHi); TabOff.alignment = (TextAnchor)4; TabOn.alignment = (TextAnchor)4; Link = Ghost(30f, 13, (FontStyle)0, Text, BrassHi); LinkOn = Ghost(30f, 13, (FontStyle)1, BrassHi, BrassHi); Link.alignment = (TextAnchor)4; LinkOn.alignment = (TextAnchor)4; Chip = Ghost(26f, 12, (FontStyle)0, Muted, BrassHi); ChipOn = Ghost(26f, 12, (FontStyle)1, Brass, BrassHi); Chip.alignment = (TextAnchor)4; ChipOn.alignment = (TextAnchor)4; Row = Ghost(30f, 13, (FontStyle)0, Text, BrassHi); Row.alignment = (TextAnchor)3; Row.padding = new RectOffset(12, 12, 0, 0); Action = Ghost(34f, 13, (FontStyle)1, Brass, BrassHi); Action.alignment = (TextAnchor)4; ActionKey = Ghost(34f, 13, (FontStyle)1, BrassInk, BrassInk); ActionKey.alignment = (TextAnchor)4; Danger = Ghost(34f, 13, (FontStyle)1, Bad, Hex("FF8B78")); Danger.alignment = (TextAnchor)4; Btn = Plate(34, 4, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 13); BtnOn = Plate(34, 4, Hex("312B18"), Hex("43391F"), Brass, Hex("3B3320"), Hex("4E4227"), BrassHi, Hex("2A2515"), Hex("352E1A"), BrassHi, BrassHi, 13); BtnPrimary = Plate(34, 4, Hex("A8873A"), Hex("D0A63A"), Hex("F2D9A0"), Hex("C09A38"), Hex("EBC97A"), Hex("F7E6BE"), Hex("8A6E2C"), Hex("A8873A"), Hex("F2D9A0"), Hex("151003"), 13); BtnPrimary.fontStyle = (FontStyle)1; BtnDanger = Plate(34, 4, Hex("5A2621"), Hex("7A332C"), Hex("A8453A"), Hex("7A332C"), Hex("9C4239"), Hex("DD6A57"), Hex("431B17"), Hex("5A2621"), Hex("DD6A57"), Hex("F3C8C0"), 13); BtnDanger.fontStyle = (FontStyle)1; BtnSmall = Plate(26, 3, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 12); 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(Carve); val.hover.textColor = TextHi; val.focused.background = Solid(Carve); val.focused.textColor = TextHi; val.border = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(10, 10, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fontSize = 15; val.fixedHeight = 34f; val.alignment = (TextAnchor)3; Search = val; Field = new GUIStyle(Search) { fontSize = 13, fixedHeight = 26f, alignment = (TextAnchor)4, padding = new RectOffset(2, 2, 0, 0) }; FieldText = new GUIStyle(Search) { fontSize = 13, fixedHeight = 26f, alignment = (TextAnchor)3, padding = new RectOffset(8, 8, 0, 0) }; FieldArea = new GUIStyle(Search) { fontSize = 13, fixedHeight = 0f, alignment = (TextAnchor)0, padding = new RectOffset(10, 10, 8, 8), wordWrap = true }; Console_ = new GUIStyle(Search) { fontSize = 13, fixedHeight = 0f, alignment = (TextAnchor)3, padding = new RectOffset(4, 4, 0, 0) }; Console_.normal.textColor = TextHi; Console_.focused.textColor = TextHi; Console_.hover.textColor = TextHi; Texture2D background = Solid(new Color(0f, 0f, 0f, 0f)); Console_.normal.background = background; Console_.focused.background = background; Console_.hover.background = background; Console_.active.background = background; TileName = Label(11, (FontStyle)0, Text); TileName.alignment = (TextAnchor)1; TileName.wordWrap = true; TileName.clipping = (TextClipping)1; TileNameHot = Label(11, (FontStyle)1, TextHi); TileNameHot.alignment = (TextAnchor)1; TileNameHot.wordWrap = true; TileNameHot.clipping = (TextClipping)1; Glyph = Label(20, (FontStyle)0, Hex("4A3F33")); Glyph.alignment = (TextAnchor)4; Scroll = new GUIStyle(); GUIStyle val2 = new GUIStyle(GUI.skin.verticalScrollbar); val2.normal.background = Solid(Hex("0A0807")); val2.border = new RectOffset(0, 0, 0, 0); val2.fixedWidth = 3f; val2.margin = new RectOffset(10, 0, 0, 0); val2.padding = new RectOffset(0, 0, 0, 0); ScrollbarV = val2; GUIStyle val3 = new GUIStyle(GUI.skin.verticalScrollbarThumb); val3.normal.background = Solid(BrassDim); val3.hover.background = Solid(Brass); val3.active.background = Solid(BrassHi); val3.border = new RectOffset(0, 0, 0, 0); val3.fixedWidth = 3f; val3.margin = new RectOffset(0, 0, 0, 0); val3.padding = new RectOffset(0, 0, 0, 0); ScrollbarThumb = val3; GUI.skin.verticalScrollbarUpButton = GUIStyle.none; GUI.skin.verticalScrollbarDownButton = GUIStyle.none; GUI.skin.horizontalScrollbarLeftButton = GUIStyle.none; GUI.skin.horizontalScrollbarRightButton = GUIStyle.none; GUI.skin.verticalScrollbar = ScrollbarV; GUI.skin.verticalScrollbarThumb = ScrollbarThumb; GUI.skin.settings.selectionColor = new Color(Brass.r, Brass.g, Brass.b, 0.3f); GUI.skin.settings.cursorColor = BrassHi; } } public static void DrawSlab(Rect r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) Fill(r, Stone); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.95f); GUI.DrawTextureWithTexCoords(r, (Texture)(object)Grain, new Rect(0f, 0f, ((Rect)(ref r)).width / (float)((Texture)Grain).width, ((Rect)(ref r)).height / (float)((Texture)Grain).height)); GUI.color = color; FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: true); FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 34f, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: false); Outline(r, Hex("000000"), 1f); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width - 2f, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.9f)); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.7f)); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width - 2f, 1f), new Color(0f, 0f, 0f, 0.65f)); Fill(new Rect(((Rect)(ref r)).xMax - 2f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(0f, 0f, 0f, 0.5f)); Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x + 9f, ((Rect)(ref r)).y + 9f, ((Rect)(ref r)).width - 18f, ((Rect)(ref r)).height - 18f); Outline(r2, new Color(Brass.r, Brass.g, Brass.b, 0.75f), 1f); Outline(new Rect(((Rect)(ref r2)).x + 1f, ((Rect)(ref r2)).y + 1f, ((Rect)(ref r2)).width - 2f, ((Rect)(ref r2)).height - 2f), new Color(0f, 0f, 0f, 0.55f), 1f); Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).y); Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).y); Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).yMax); Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).yMax); } private static void Rivet(float cx, float cy) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) Rect r = default(Rect); ((Rect)(ref r))..ctor(cx - 3f, cy - 3f, 6f, 6f); Fill(new Rect(((Rect)(ref r)).x - 1f, ((Rect)(ref r)).y - 1f, ((Rect)(ref r)).width + 2f, ((Rect)(ref r)).height + 2f), new Color(0f, 0f, 0f, 0.6f)); Fill(r, BrassDim); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 2f), Brass); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 2f, 2f), BrassHi); } public static void Fill(Rect r, Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)Px); GUI.color = color; } private static void FillFade(Rect r, Color c, float alpha, bool topDown) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) int num = 8; for (int i = 0; i < num; i++) { float num2 = (float)i / (float)num; float num3 = alpha * (topDown ? (1f - num2) : num2); float num4 = ((Rect)(ref r)).height / (float)num; Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + num4 * (float)i, ((Rect)(ref r)).width, num4 + 1f), new Color(c.r, c.g, c.b, num3)); } } public static void Outline(Rect r, Color c, float w) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, w), c); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - w, ((Rect)(ref r)).width, w), c); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c); Fill(new Rect(((Rect)(ref r)).xMax - w, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c); } public static void Hairline(Rect r, float alpha = 0.28f) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), new Color(Brass.r, Brass.g, Brass.b, alpha)); } public static void Groove(Rect r) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), Carve); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.8f)); } public static string Spaced(string s) { if (string.IsNullOrEmpty(s)) { return s; } StringBuilder stringBuilder = new StringBuilder(s.Length * 2); string text = s.ToUpperInvariant(); foreach (char value in text) { stringBuilder.Append(value).Append(' '); } return stringBuilder.ToString().TrimEnd(); } private static GUIStyle Label(int size, FontStyle style, Color colour) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = style }; val.normal.textColor = colour; val.margin = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(0, 0, 0, 0); val.alignment = (TextAnchor)3; val.wordWrap = false; return val; } private static GUIStyle Ghost(float h, int size, FontStyle style, Color normal, Color hover) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown Texture2D background = Solid(new Color(0f, 0f, 0f, 0f)); GUIStyle val = new GUIStyle(GUI.skin.button); val.normal.background = background; val.normal.textColor = normal; val.hover.background = background; val.hover.textColor = hover; val.active.background = background; val.active.textColor = hover; val.onNormal.background = background; val.onNormal.textColor = hover; val.onHover.background = background; val.onHover.textColor = hover; val.onActive.background = background; val.onActive.textColor = hover; val.border = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(8, 8, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fixedHeight = h; val.fontSize = size; val.fontStyle = style; val.alignment = (TextAnchor)3; val.wordWrap = false; val.clipping = (TextClipping)1; return val; } private static GUIStyle Plate(int h, int radius, Color nBot, Color nTop, Color nEdge, Color hBot, Color hTop, Color hEdge, Color aBot, Color aTop, Color aEdge, Color text, int fontSize) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.button); val.normal.background = PlateTex(h, radius, nBot, nTop, nEdge); val.normal.textColor = text; val.hover.background = PlateTex(h, radius, hBot, hTop, hEdge); val.hover.textColor = text; val.active.background = PlateTex(h, radius, aBot, aTop, aEdge); val.active.textColor = text; val.onNormal.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onNormal.textColor = text; val.onHover.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onHover.textColor = text; val.onActive.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onActive.textColor = text; val.border = new RectOffset(radius + 3, radius + 3, 0, 0); val.padding = new RectOffset(10, 10, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fixedHeight = h; val.fontSize = fontSize; val.alignment = (TextAnchor)4; val.wordWrap = false; val.clipping = (TextClipping)1; return val; } private static Texture2D PlateTex(int h, int radius, Color bottom, Color top, Color edge) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) int num = radius * 2 + 8; Texture2D val = new Texture2D(num, h, (TextureFormat)5, false); for (int i = 0; i < h; i++) { float num2 = ((h <= 1) ? 0f : ((float)i / (float)(h - 1))); Color val2 = Color.Lerp(bottom, top, num2); if (i >= h - 1) { val2 = Color.Lerp(val2, Color.white, 0.12f); } for (int j = 0; j < num; j++) { float num3 = Sdf(j, i, num, h, radius); float num4 = Mathf.Clamp01(0.5f - num3); if (num4 <= 0f) { val.SetPixel(j, i, new Color(0f, 0f, 0f, 0f)); continue; } float num5 = Mathf.Clamp01(0.5f - (num3 + 1.15f)); Color val3 = Color.Lerp(edge, val2, num5); val.SetPixel(j, i, new Color(val3.r, val3.g, val3.b, num4)); } } return Finish(val); } private static float Sdf(float x, float y, int w, int h, int radius) { float num = Mathf.Min((float)radius, (float)Mathf.Min(w, h) * 0.5f); float num2 = x + 0.5f; float num3 = y + 0.5f; float num4 = Mathf.Clamp(num2, num, (float)w - num); float num5 = Mathf.Clamp(num3, num, (float)h - num); float num6 = num2 - num4; float num7 = num3 - num5; return Mathf.Sqrt(num6 * num6 + num7 * num7) - num; } private static Color Hex(string hex) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) int num = Convert.ToInt32(hex.Substring(0, 2), 16); int num2 = Convert.ToInt32(hex.Substring(2, 2), 16); int num3 = Convert.ToInt32(hex.Substring(4, 2), 16); float num4 = ((hex.Length >= 8) ? ((float)Convert.ToInt32(hex.Substring(6, 2), 16) / 255f) : 1f); return new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, num4); } private static Texture2D Finish(Texture2D t) { ((Object)t).hideFlags = (HideFlags)61; ((Texture)t).filterMode = (FilterMode)1; ((Texture)t).wrapMode = (TextureWrapMode)0; t.Apply(); return t; } private static Texture2D Solid(Color c) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)5, false); val.SetPixel(0, 0, c); ((Texture)val).wrapMode = (TextureWrapMode)1; return Finish(val); } private static Texture2D StoneGrain(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (0f + Tileable(j, i, size, 8f) * 0.5f + Tileable(j, i, size, 19f) * 0.32f + Tileable(j, i, size, 43f) * 0.18f - 0.5f) * 2f; float num2 = Mathf.Abs(num) * 0.55f; Color val2 = ((num >= 0f) ? new Color(StoneHi.r, StoneHi.g, StoneHi.b, num2) : new Color(Carve.r, Carve.g, Carve.b, num2 * 1.5f)); val.SetPixel(j, i, val2); } } return Finish(val); } private static float Tileable(int x, int y, int size, float freq) { float num = (float)x / (float)size; float num2 = (float)y / (float)size; float num3 = Mathf.PerlinNoise(num * freq, num2 * freq); float num4 = Mathf.PerlinNoise((num - 1f) * freq, num2 * freq); float num5 = Mathf.PerlinNoise(num * freq, (num2 - 1f) * freq); float num6 = Mathf.PerlinNoise((num - 1f) * freq, (num2 - 1f) * freq); return Mathf.Lerp(Mathf.Lerp(num3, num4, num), Mathf.Lerp(num5, num6, num), num2); } } } namespace GBV.Huskarl { internal struct Look { internal int Model; internal string Hair; internal string Beard; internal float SkinHue; internal float HairTone; internal float HairLevel; internal static Look Default() { return new Look { Model = 0, Hair = null, Beard = null, SkinHue = 0.5f, HairTone = 0.5f, HairLevel = 0.75f }; } } internal static class Appearance { private static List<ItemDrop> _hairs; private static List<ItemDrop> _beards; private static int _builtForDb; private static readonly Color SkinRampA = new Color(0.98f, 0.87f, 0.77f); private static readonly Color SkinRampB = new Color(0.44f, 0.3f, 0.22f); private static readonly Color HairRampA = new Color(0.95f, 0.88f, 0.7f); private static readonly Color HairRampB = new Color(0.2f, 0.13f, 0.09f); private static readonly int KeySkinHue = StringExtensionMethods.GetStableHashCode("gbv.hk.skin"); private static readonly int KeyHairTone = StringExtensionMethods.GetStableHashCode("gbv.hk.tone"); private static readonly int KeyHairLevel = StringExtensionMethods.GetStableHashCode("gbv.hk.level"); private static readonly int KeyHair = StringExtensionMethods.GetStableHashCode("gbv.hk.hair"); private static readonly int KeyBeard = StringExtensionMethods.GetStableHashCode("gbv.hk.beard"); private static readonly int KeyModel = StringExtensionMethods.GetStableHashCode("gbv.hk.model"); internal static List<ItemDrop> Hairs() { Build(); return _hairs ?? new List<ItemDrop>(); } internal static List<ItemDrop> Beards() { Build(); return _beards ?? new List<ItemDrop>(); } private static void Build() { try { ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null) { return; } int instanceID = ((Object)instance).GetInstanceID(); if (_hairs == null || _builtForDb != instanceID) { _hairs = instance.GetAllItems((ItemType)10, "Hair"); _beards = instance.GetAllItems((ItemType)10, "Beard"); _hairs.RemoveAll((ItemDrop x) => (Object)(object)x == (Object)null || ((Object)x).name.Contains("_")); _beards.RemoveAll((ItemDrop x) => (Object)(object)x == (Object)null || ((Object)x).name.Contains("_")); Sort(_hairs); Sort(_beards); _builtForDb = instanceID; } } catch (Exception ex) { Safety.Failed("Appearance.Build", ex); } } private static void Sort(List<ItemDrop> items) { items.Sort(delegate(ItemDrop a, ItemDrop b) { bool flag = IsNone(a); bool flag2 = IsNone(b); return (flag != flag2) ? ((!flag) ? 1 : (-1)) : string.Compare(DisplayName(a), DisplayName(b), StringComparison.OrdinalIgnoreCase); }); } private static bool IsNone(ItemDrop item) { if ((Object)(object)item != (Object)null) { return ((Object)item).name.IndexOf("None", StringComparison.OrdinalIgnoreCase) >= 0; } return false; } internal static string DisplayName(ItemDrop item) { if ((Object)(object)item == (Object)null) { return ""; } try { string name = item.m_itemData.m_shared.m_name; return (Localization.instance == null) ? name : Localization.instance.Localize(name); } catch { return ((Object)item).name; } } private static PlayerCustomizaton Barber() { try { if ((Object)(object)PlayerCustomizaton.m_barberInstance != (Object)null) { return PlayerCustomizaton.m_barberInstance; } PlayerCustomizaton[] array = Resources.FindObjectsOfTypeAll<PlayerCustomizaton>(); return (array != null && array.Length != 0) ? array[0] : null; } catch { return null; } } internal static Color SkinColour(float hue) { //IL_0017: 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_002d: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) PlayerCustomizaton val = Barber(); Color val2 = (((Object)(object)val != (Object)null) ? val.m_skinColor0 : SkinRampA); Color val3 = (((Object)(object)val != (Object)null) ? val.m_skinColor1 : SkinRampB); return Color.Lerp(val2, val3, Mathf.Clamp01(hue)); } internal static Color HairColour(float tone, float level) { //IL_0017: 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_002d: 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_0032: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) PlayerCustomizaton val = Barber(); Color val2 = (((Object)(object)val != (Object)null) ? val.m_hairColor0 : HairRampA); Color val3 = (((Object)(object)val != (Object)null) ? val.m_hairColor1 : HairRampB); float num = (((Object)(object)val != (Object)null) ? val.m_hairMinLevel : 0.1f); float num2 = (((Object)(object)val != (Object)null) ? val.m_hairMaxLevel : 1f); return Color.Lerp(val2, val3, Mathf.Clamp01(tone)) * Mathf.Lerp(num, num2, Mathf.Clamp01(level)); } internal static void Apply(VisEquipment vis, Look look) { //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_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) if ((Object)(object)vis == (Object)null) { return; } try { int num = ((vis.m_models != null) ? vis.m_models.Length : 0); if (num > 0) { vis.SetModel(Mathf.Clamp(look.Model, 0, num - 1)); } vis.SetHairItem(Hash(look.Hair)); vis.SetBeardItem(Hash(look.Beard)); vis.SetSkinColor(Utils.ColorToVec3(SkinColour(look.SkinHue))); vis.SetHairColor(Utils.ColorToVec3(HairColour(look.HairTone, look.HairLevel))); } catch (Exception ex) { Safety.Failed("Appearance.Apply", ex); } } private static int Hash(string prefabName) { if (!string.IsNullOrEmpty(prefabName)) { return StringExtensionMethods.GetStableHashCode(prefabName); } return 0; } internal static Look Read(ZDO zdo) { Look result = Look.Default(); if (zdo == null) { return result; } result.Model = zdo.GetInt(KeyModel, 0); result.Hair = NullIfEmpty(zdo.GetString(KeyHair, "")); result.Beard = NullIfEmpty(zdo.GetString(KeyBeard, "")); result.SkinHue = zdo.GetFloat(KeySkinHue, 0.5f); result.HairTone = zdo.GetFloat(KeyHairTone, 0.5f); result.HairLevel = zdo.GetFloat(KeyHairLevel, 0.75f); return result; } internal static void Write(ZDO zdo, Look look) { if (zdo != null) { zdo.Set(KeyModel, look.Model, false); zdo.Set(KeyHair, look.Hair ?? ""); zdo.Set(KeyBeard, look.Beard ?? ""); zdo.Set(KeySkinHue, look.SkinHue); zdo.Set(KeyHairTone, look.HairTone); zdo.Set(KeyHairLevel, look.HairLevel); } } private static string NullIfEmpty(string s) { if (!string.IsNullOrEmpty(s)) { return s; } return null; } internal static bool WasSet(ZDO zdo) { if (zdo != null) { return zdo.GetFloat(KeySkinHue, -1f) >= 0f; } return false; } } internal static class Art { private const double PanelRadius = 18.0; private const int PanelBorder = 22; private static bool _built; internal static Texture2D Glow; internal static Texture2D Ball; internal static Texture2D Panel; internal static Texture2D PanelEdge; internal static Texture2D Metal; internal static Texture2D Fade; internal static GUIStyle PanelStyle; internal static GUIStyle PanelEdgeStyle; internal static void EnsureBuilt() { //IL_00d0: 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_00e5: 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_00f8: Expected O, but got Unknown //IL_00fd: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Expected O, but got Unknown //IL_012a: Expected O, but got Unknown if (_built) { return; } _built = true; try { Glow = Finish(SlotArtwork.Glow(128), 128, 128, "HuskarlGlow"); Ball = Finish(SlotArtwork.Ball(128), 128, 128, "HuskarlBall"); Panel = Finish(SlotArtwork.Panel(64, 18.0, filled: true), 64, 64, "HuskarlPanel"); PanelEdge = Finish(SlotArtwork.Panel(64, 18.0, filled: false), 64, 64, "HuskarlPanelEdge"); Metal = Finish(SlotArtwork.Metal(64, 8), 64, 8, "HuskarlMetal"); Fade = Finish(SlotArtwork.Fade(8, 64), 8, 64, "HuskarlFade"); GUIStyle val = new GUIStyle(); val.normal.background = Panel; val.border = new RectOffset(22, 22, 22, 22); PanelStyle = val; GUIStyle val2 = new GUIStyle(); val2.normal.background = PanelEdge; val2.border = new RectOffset(22, 22, 22, 22); PanelEdgeStyle = val2; } catch (Exception ex) { Safety.Failed("Art.EnsureBuilt", ex); } } internal static void DrawPanel(Rect r, Color fill) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); if (!((Object)(object)Panel == (Object)null)) { Color color = GUI.color; GUI.color = fill; GUI.Box(r, GUIContent.none, PanelStyle); GUI.color = color; } } internal static void DrawPanelEdge(Rect r, Color edge) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); if (!((Object)(object)PanelEdge == (Object)null)) { Color color = GUI.color; GUI.color = edge; GUI.Box(r, GUIContent.none, PanelEdgeStyle); GUI.color = color; } } internal static void DrawGlow(Rect r, Color colour, float strength = 1f) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: 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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); if (!((Object)(object)Glow == (Object)null) && !(strength <= 0f)) { Color color = GUI.color; GUI.color = new Color(colour.r, colour.g, colour.b, colour.a * Mathf.Clamp01(strength)); GUI.DrawTexture(r, (Texture)(object)Glow, (ScaleMode)0, true); GUI.color = color; } } internal static void DrawBall(Rect r, Color colour) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); if (!((Object)(object)Ball == (Object)null)) { Color color = GUI.color; GUI.color = colour; GUI.DrawTexture(r, (Texture)(object)Ball, (ScaleMode)0, true); GUI.color = color; } } internal static void DrawMetal(Rect r, Color colour) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); if (!((Object)(object)Metal == (Object)null)) { Color color = GUI.color; GUI.color = colour; GUI.DrawTexture(r, (Texture)(object)Metal, (ScaleMode)0, true); GUI.color = color; } } internal static void DrawFade(Rect r, Color colour, bool fromTop) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) EnsureBuilt(); if (!((Object)(object)Fade == (Object)null)) { Color color = GUI.color; GUI.color = colour; GUI.DrawTextureWithTexCoords(r, (Texture)(object)Fade, fromTop ? new Rect(0f, 0f, 1f, 1f) : new Rect(0f, 1f, 1f, -1f), true); GUI.color = color; } } private static Texture2D Finish(float[] rgba, int width, int height, string name) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < height; i++) { int num = i * width; int num2 = (height - 1 - i) * width; for (int j = 0; j < width; j++) { int num3 = (num + j) * 4; array[num2 + j] = new Color(rgba[num3], rgba[num3 + 1], rgba[num3 + 2], rgba[num3 + 3]); } } Texture2D val = new Texture2D(width, height, (TextureFormat)4, false) { name = name, filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1, hideFlags = (HideFlags)61 }; val.SetPixels(array); val.Apply(); return val; } } internal sealed class BodyEntry { internal string Prefab; internal string Display; internal bool IsPerson; internal string Search; } internal static class Catalog { private static List<BodyEntry> _all; private static int _builtForScene; internal static List<BodyEntry> All() { try { ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null || instance.m_prefabs == null) { return _all ?? new List<BodyEntry>(); } int instanceID = ((Object)instance).GetInstanceID(); if (_all != null && _builtForScene == instanceID) { return _all; } List<BodyEntry> list = new List<BodyEntry>(256); foreach (GameObject prefab in instance.m_prefabs) { if (!((Object)(object)prefab == (Object)null)) { Character component = prefab.GetComponent<Character>(); if (!((Object)(object)component == (Object)null)) { string text = Localize(component.m_name); list.Add(new BodyEntry { Prefab = ((Object)prefab).name, Display = (string.IsNullOrEmpty(text) ? ((Object)prefab).name : text), IsPerson = CanWearAFace(prefab), Search = (((Object)prefab).name + " " + text).ToLowerInvariant() }); } } } list.Sort((BodyEntry a, BodyEntry b) => string.Compare(a.Display, b.Display, StringComparison.OrdinalIgnoreCase)); _all = list; _builtForScene = instanceID; HuskarlPlugin.Log.LogInfo((object)("Huskarl: catalogued " + list.Count + " bodies.")); return _all; } catch (Exception ex) { Safety.Failed("Catalog.All", ex); return _all ?? new List<BodyEntry>(); } } private static bool CanWearAFace(GameObject prefab) { VisEquipment component = prefab.GetComponent<VisEquipment>(); if ((Object)(object)component == (Object)null) { return false; } if (component.m_isPlayer && component.m_models != null) { return component.m_models.Length != 0; } return false; } private static string Localize(string token) { try { if (string.IsNullOrEmpty(token)) { return ""; } return (Localization.instance == null) ? token : Localization.instance.Localize(token); } catch { return token; } } internal static List<BodyEntry> Filter(string needle, bool peopleOnly) { List<BodyEntry> list = All(); if (string.IsNullOrEmpty(needle) && !peopleOnly) { return list; } string text = (string.IsNullOrEmpty(needle) ? null : needle.ToLowerInvariant()); List<BodyEntry> list2 = new List<BodyEntry>(); foreach (BodyEntry item in list) { if ((!peopleOnly || item.IsPerson) && (text == null || item.Search.IndexOf(text, StringComparison.Ordinal) >= 0)) { list2.Add(item); } } return list2; } internal static BodyEntry Find(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return null; } foreach (BodyEntry item in All()) { if (string.Equals(item.Prefab, prefabName, StringComparison.Ordinal)) { return item; } } return null; } internal static void Invalidate() { _all = null; _builtForScene = 0; } } 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 = HuskarlPlugin.Log; if (log != null) { log.LogInfo((object)"Huskarl: no graphics device, so this is a dedicated server. The panel and both role windows are disabled here; the NPC engine still runs."); } } return _hasUi; } } internal static void Tick() { if (!HasUi) { return; } try { WatchForWorldChange(); } catch (Exception ex) { Safety.Failed("Client.WatchForWorldChange", ex); } try { PlaceMode.Tick(); } catch (Exception ex2) { Safety.Failed("PlaceMode.Tick", ex2); } try { HuskarlPanel.Tick(); } catch (Exception ex3) { Safety.Failed("HuskarlPanel.Tick", ex3); } try { SlotsPanel.Tick(); } catch (Exception ex4) { Safety.Failed("SlotsPanel.Tick", ex4); } try { MarblesPanel.Tick(); } catch (Exception ex5) { Safety.Failed("MarblesPanel.Tick", ex5); } try { PlinkoPanel.Tick(); } catch (Exception ex6) { Safety.Failed("PlinkoPanel.Tick", ex6); } try { TraderRole.Tick(); } catch (Exception ex7) { Safety.Failed("TraderRole.Tick", ex7); } try { GuisePanel.Tick(); } catch (Exception ex8) { Safety.Failed("GuisePanel.Tick", ex8); } try { GuiseGlowAttacher.Tick(); } catch (Exception ex9) { Safety.Failed("GuiseGlowAttacher.Tick", ex9); } } private static void WatchForWorldChange() { bool flag = (Object)(object)ZNetScene.instance != (Object)null; if (_sceneWasLoaded && !flag) { HuskarlPanel.Close(); SlotsPanel.Close(); MarblesPanel.Close(); PlinkoPanel.Close(); GuisePanel.Close(); ItemPreview.Release(); Preview.Release(); Catalog.Invalidate(); } _sceneWasLoaded = flag; } internal static void Draw() { if (!HasUi) { return; } try { PlaceMode.DrawHud(); } catch (Exception ex) { Safety.Failed("PlaceMode.DrawHud", ex); } try { HuskarlPanel.Draw(); } catch (Exception ex2) { Safety.Failed("HuskarlPanel.Draw", ex2); } try { SlotsPanel.Draw(); } catch (Exception ex3) { Safety.Failed("SlotsPanel.Draw", ex3); } try { MarblesPanel.Draw(); } catch (Exception ex4) { Safety.Failed("MarblesPanel.Draw", ex4); } try { PlinkoPanel.Draw(); } catch (Exception ex5) { Safety.Failed("PlinkoPanel.Draw", ex5); } try { GuisePanel.Draw(); } catch (Exception ex6) { Safety.Failed("GuisePanel.Draw", ex6); } } internal static void Interact(HuskarlNpc npc) { if (!HasUi || (Object)(object)npc == (Object)null) { return; } try { switch (npc.Role) { case "trader": TraderRole.Open(npc); break; case "gambler": if (npc.Game == "marbles") { MarblesPanel.Open(npc); } else if (npc.Game == "plinko") { PlinkoPanel.Open(npc); } else { SlotsPanel.Open(npc); } break; case "guise": GuisePanel.Open(npc); break; } } catch (Exception ex) { Safety.Failed("Client.Interact", ex); } } } [HarmonyPatch(typeof(Terminal), "InitTerminal")] public static class Commands { [CompilerGenerated] private static class <>O { public static ConsoleOptionsFetcher <0>__CreatureNames; } [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; public static ConsoleOptionsFetcher <>9__2_6; public static ConsoleEvent <>9__2_7; public static ConsoleEvent <>9__2_8; public static ConsoleOptionsFetcher <>9__2_9; internal void <Register>b__2_0(ConsoleEventArgs args) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (!RequireAdmin(args.Context)) { return; } Player val = LocalPlayer(args.Context); if ((Object)(object)val == (Object)null) { return; } if (args.Length < 2) { args.Context.AddString("Usage: huskarl_spawn <prefab> [name]"); return; } string npcName = ((args.Length >= 3) ? string.Join(" ", args.Args, 2, args.Length - 2) : args[1]); Vector3 position = ((Component)val).transform.position + ((Component)val).transform.forward * 2f; Quaternion rotation = Quaternion.LookRotation(-((Component)val).transform.forward); HuskarlNpc huskarlNpc = Npc.Spawn(args[1], npcName, "none", position, rotation); if ((Object)(object)huskarlNpc == (Object)null) { args.Context.AddString("Huskarl: could not place '" + args[1] + "'. Check the prefab name."); return; } PlaceMode.Begin(huskarlNpc); args.Context.AddString("Huskarl: placed " + huskarlNpc.Describe() + ". Aim it and click to set it down, or Escape to put it back."); } internal void <Register>b__2_1(ConsoleEventArgs args) { string filter = ((args.Length > 1) ? args[1] : ""); GuiseProbe.Dump(args, filter); } internal void <Register>b__2_2(ConsoleEventArgs args) { //IL_001c: 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_008c: Unknown result type (might be due to invalid IL or missing references) Player val = LocalPlayer(args.Context); if ((Object)(object)val == (Object)null) { return; } List<HuskarlNpc> list = Npc.All(((Component)val).transform.position); if (list.Count == 0) { args.Context.AddString("Huskarl: no NPCs loaded near you."); return; } args.Context.AddString("Huskarl: " + list.Count + " NPC(s) loaded."); foreach (HuskarlNpc item in list) { float num = Vector3.Distance(((Component)val).transform.position, ((Component)item).transform.position); args.Context.AddString(" " + item.Describe() + " " + num.ToString("0") + "m"); } } internal void <Register>b__2_3(ConsoleEventArgs args) { if (RequireAdmin(args.Context)) { HuskarlNpc huskarlNpc = Target(args.Context); if (!((Object)(object)huskarlNpc == (Object)null)) { string text = huskarlNpc.Describe(); args.Context.AddString(Npc.Delete(huskarlNpc) ? ("Huskarl: removed " + text + ".") : ("Huskarl: could not remove " + text + ".")); } } } internal void <Register>b__2_4(ConsoleEventArgs args) { if (!RequireAdmin(args.Context)) { return; } if (args.Length < 2) { args.Context.AddString("Usage: huskarl_name <name>"); return; } HuskarlNpc huskarlNpc = Target(args.Context); if (!((Object)(object)huskarlNpc == (Object)null)) { string value = string.Join(" ", args.Args, 1, args.Length - 1); args.Context.AddString(huskarlNpc.Write(Keys.Name, value) ? ("Huskarl: renamed to " + huskarlNpc.Describe() + ".") : "Huskarl: could not rename that one. Try again in a moment."); } } internal void <Register>b__2_5(ConsoleEventArgs args) { if (!RequireAdmin(args.Context)) { return; } if (args.Length < 2) { args.Context.AddString("Usage: huskarl_role <" + string.Join("|", Keys.Roles) + ">"); return; } string value = args[1].ToLowerInvariant(); if (Array.IndexOf(Keys.Roles, value) < 0) { args.Context.AddString("Huskarl: '" + args[1] + "' is not a role. Try one of: " + string.Join(", ", Keys.Roles)); return; } HuskarlNpc huskarlNpc = Target(args.Context); if (!((Object)(object)huskarlNpc == (Object)null)) { args.Context.AddString(huskarlNpc.Write(Keys.Role, value) ? ("Huskarl: " + huskarlNpc.Describe() + ".") : "Huskarl: could not change that one. Try again in a moment."); } } internal List<string> <Register>b__2_6() { return new List<string>(Keys.Roles); } internal void <Register>b__2_7(ConsoleEventArgs args) { GameObject val = null; string text; if (args.Length >= 2) { val = (((Object)(object)ZNetScene.instance == (Object)null) ? null : ZNetScene.instance.GetPrefab(args[1])); text = "prefab " + args[1]; if ((Object)(object)val == (Object)null) { args.Context.AddString("Huskarl: there is no prefab called '" + args[1] + "'."); return; } } else { HuskarlNpc huskarlNpc = Target(args.Context); if ((Object)(object)huskarlNpc == (Object)null) { return; } val = ((Component)huskarlNpc).gameObject; text = huskarlNpc.Describe(); } args.Context.AddString("Huskarl: components on " + text + ":"); Component[] componentsInChildren = val.GetComponentsInChildren<Component>(true); foreach (Component val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { string text2 = (((Object)(object)val2.gameObject == (Object)(object)val) ? "" : (" (" + ((Object)val2.gameObject).name + ")")); args.Context.AddString(" " + ((object)val2).GetType().Name + text2); } } } internal void <Register>b__2_8(ConsoleEventArgs args) { if (args.Length >= 2 && string.Equals(args[1], "reload", StringComparison.OrdinalIgnoreCase)) { if (!RequireAdmin(args.Context)) { return; } if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer()) { args.Context.AddString("Huskarl: only the server can reload the paytable. Yours is whatever it sent you."); return; } ConfigSync.LoadFromDisk(); args.Context.AddString("Huskarl: paytable reloaded. It reaches each player as they connect."); } SlotPrize[] table = ConfigSync.Table; int stake = ConfigSync.Stake; args.Context.AddString("Huskarl: " + stake + " gold a pull" + (ConfigSync.FromServer ? " (the server's odds)" : " (this machine's own odds)") + ", file at " + ConfigSync.Path); SlotPrize[] array = table; for (int i = 0; i < array.Length; i++) { SlotPrize prize = array[i]; string text = ((prize.Matches == 0) ? "anything else" : (prize.Matches + " x " + Slots.Name(prize.Symbol))); string text2 = ((prize.Rate <= 0.0) ? "never" : ("1 in " + Mathf.RoundToInt((float)(1.0 / prize.Rate)))); args.Context.AddString(" " + text.PadRight(18) + Slots.Describe(prize, 1).PadRight(22) + text2); } double num = Slots.ReturnToPlayer(table, stake); double val = Slots.BreakEvenRate(table, stake); double num2 = Slots.TotalRate(table); args.Context.AddString(" pays back " + (num * 100.0).ToString("0.0") + "%, breaks even 1 pull in " + (1.0 / Math.Max(0.0001, val)).ToString("0.0")); if (Math.Abs(num2 - 1.0) > 0.005) { args.Context.AddString(" WARNING: the rates add up to " + num2.ToString("0.####") + " rather than 1, so they are not the odds written in the file."); } } internal List<string> <Register>b__2_9() { return new List<string> { "reload" }; } } private static bool _registered; [HarmonyPostfix] public static void Postfix() { if (_registered) { return; } _registered = true; try { Register(); } catch (Exception ex) { Safety.Failed("Terminal.InitTerminal command registration", ex); } } private static void Register() { //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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0086: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0127: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Expected O, but got Unknown //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Expected O, but got Unknown //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown object obj = <>c.<>9__2_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (RequireAdmin(args.Context)) { Player val13 = LocalPlayer(args.Context); if (!((Object)(object)val13 == (Object)null)) { if (args.Length < 2) { args.Context.AddString("Usage: huskarl_spawn <prefab> [name]"); } else { string npcName = ((args.Length >= 3) ? string.Join(" ", args.Args, 2, args.Length - 2) : args[1]); Vector3 position = ((Component)val13).transform.position + ((Component)val13).transform.forward * 2f; Quaternion rotation = Quaternion.LookRotation(-((Component)val13).transform.forward); HuskarlNpc huskarlNpc = Npc.Spawn(args[1], npcName, "none", position, rotation); if ((Object)(object)huskarlNpc == (Object)null) { args.Context.AddString("Huskarl: could not place '" + args[1] + "'. Check the prefab name."); } else { PlaceMode.Begin(huskarlNpc); args.Context.AddString("Huskarl: placed " + huskarlNpc.Describe() + ". Aim it and click to set it down, or Escape to put it back."); } } } } }; <>c.<>9__2_0 = val; obj = (object)val; } object obj2 = <>O.<0>__CreatureNames; if (obj2 == null) { ConsoleOptionsFetcher val2 = CreatureNames; <>O.<0>__CreatureNames = val2; obj2 = (object)val2; } new ConsoleCommand("huskarl_spawn", "huskarl_spawn <prefab> [name] - put an NPC where you are standing. The prefab is any creature, e.g. Draugr or Dverger.", (ConsoleEvent)obj, false, false, false, false, false, false, (ConsoleOptionsFetcher)obj2, false, false, false); object obj3 = <>c.<>9__2_1; if (obj3 == null) { ConsoleEvent val3 = delegate(ConsoleEventArgs args) { string filter = ((args.Length > 1) ? args[1] : ""); GuiseProbe.Dump(args, filter); }; <>c.<>9__2_1 = val3; obj3 = (object)val3; } new ConsoleCommand("huskarl_fx", "huskarl_fx [name] - dump what every borrowed Guise effect is actually made of.", (ConsoleEvent)obj3, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj4 = <>c.<>9__2_2; if (obj4 == null) { ConsoleEvent val4 = delegate(ConsoleEventArgs args) { //IL_001c: 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_008c: Unknown result type (might be due to invalid IL or missing references) Player val13 = LocalPlayer(args.Context); if (!((Object)(object)val13 == (Object)null)) { List<HuskarlNpc> list = Npc.All(((Component)val13).transform.position); if (list.Count != 0) { args.Context.AddString("Huskarl: " + list.Count + " NPC(s) loaded."); { foreach (HuskarlNpc item in list) { float num = Vector3.Distance(((Component)val13).transform.position, ((Component)item).transform.position); args.Context.AddString(" " + item.Describe() + " " + num.ToString("0") + "m"); } return; } } args.Context.AddString("Huskarl: no NPCs loaded near you."); } }; <>c.<>9__2_2 = val4; obj4 = (object)val4; } new ConsoleCommand("huskarl_list", "huskarl_list - list every NPC in the zones loaded around you, nearest first.", (ConsoleEvent)obj4, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj5 = <>c.<>9__2_3; if (obj5 == null) { ConsoleEvent val5 = delegate(ConsoleEventArgs args) { if (RequireAdmin(args.Context)) { HuskarlNpc huskarlNpc = Target(args.Context); if (!((Object)(object)huskarlNpc == (Object)null)) { string text = huskarlNpc.Describe(); args.Context.AddString(Npc.Delete(huskarlNpc) ? ("Huskarl: removed " + text + ".") : ("Huskarl: could not remove " + text + ".")); } } }; <>c.<>9__2_3 = val5; obj5 = (object)val5; } new ConsoleCommand("huskarl_delete", "huskarl_delete - remove the NPC you are looking at, or the nearest one within five metres.", (ConsoleEvent)obj5, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj6 = <>c.<>9__2_4; if (obj6 == null) { ConsoleEvent val6 = delegate(ConsoleEventArgs args) { if (RequireAdmin(args.Context)) { if (args.Length < 2) { args.Context.AddString("Usage: huskarl_name <name>"); } else { HuskarlNpc huskarlNpc = Target(args.Context); if (!((Object)(object)huskarlNpc == (Object)null)) { string value = string.Join(" ", args.Args, 1, args.Length - 1); args.Context.AddString(huskarlNpc.Write(Keys.Name, value) ? ("Huskarl: renamed to " + huskarlNpc.Describe() + ".") : "Huskarl: could not rename that one. Try again in a moment."); } } } }; <>c.<>9__2_4 = val6; obj6 = (object)val6; } new ConsoleCommand("huskarl_name", "huskarl_name <name> - rename the NPC you are looking at.", (ConsoleEvent)obj6, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj7 = <>c.<>9__2_5; if (obj7 == null) { ConsoleEvent val7 = delegate(ConsoleEventArgs args) { if (RequireAdmin(args.Context)) { if (args.Length < 2) { args.Context.AddString("Usage: huskarl_role <" + string.Join("|", Keys.Roles) + ">"); } else { string value = args[1].ToLowerInvariant(); if (Array.IndexOf(Keys.Roles, value) < 0) { args.Context.AddString("Huskarl: '" + args[1] + "' is not a role. Try one of: " + string.Join(", ", Keys.Roles)); } else { HuskarlNpc huskarlNpc = Target(args.Context); if (!((Object)(object)huskarlNpc == (Object)null)) { args.Context.AddString(huskarlNpc.Write(Keys.Role, value) ? ("Huskarl: " + huskarlNpc.Describe() + ".") : "Huskarl: could not change that one. Try again in a moment."); } } } } }; <>c.<>9__2_5 = val7; obj7 = (object)val7; } object obj8 = <>c.<>9__2_6; if (obj8 == null) { ConsoleOptionsFetcher val8 = () => new List<string>(Keys.Roles); <>c.<>9__2_6 = val8; obj8 = (object)val8; } new ConsoleCommand("huskarl_role", "huskarl_role <none|trader|gambler|guise> - set what the NPC you are looking at does.", (ConsoleEvent)obj7, false, false, false, false, false, false, (ConsoleOptionsFetcher)obj8, false, false, false); object obj9 = <>c.<>9__2_7; if (obj9 == null) { ConsoleEvent val9 = delegate(ConsoleEventArgs args) { GameObject val13 = null; string text; if (args.Length >= 2) { val13 = (((Object)(object)ZNetScene.instance == (Object)null) ? null : ZNetScene.instance.GetPrefab(args[1])); text = "prefab " + args[1]; if ((Object)(object)val13 == (Object)null) { args.Context.AddString("Huskarl: there is no prefab called '" + args[1] + "'."); return; } } else { HuskarlNpc huskarlNpc = Target(args.Context); if ((Object)(object)huskarlNpc == (Object)null) { return; } val13 = ((Component)huskarlNpc).gameObject; text = huskarlNpc.Describe(); } args.Context.AddString("Huskarl: components on " + text + ":"); Component[] componentsInChildren = val13.GetComponentsInChildren<Component>(true); foreach (Component val14 in componentsInChildren) { if (!((Object)(object)val14 == (Object)null)) { string text2 = (((Object)(object)val14.gameObject == (Object)(object)val13) ? "" : (" (" + ((Object)val14.gameObject).name + ")")); args.Context.AddString(" " + ((object)val14).GetType().Name + text2); } } }; <>c.<>9__2_7 = val9; obj9 = (object)val9; } object obj10 = <>O.<0>__CreatureNames; if (obj10 == null) { ConsoleOptionsFetcher val10 = CreatureNames; <>O.<0>__CreatureNames = val10; obj10 = (object)val10; } new ConsoleCommand("huskarl_dump", "huskarl_dump [prefab] - list the components on a prefab, or on the NPC you are looking at. Use it to find out what a body is actually made of.", (ConsoleEvent)obj9, false, false, false, false, false, false, (ConsoleOptionsFetcher)obj10, false, false, false); object obj11 = <>c.<>9__2_8; if (obj11 == null) { ConsoleEvent val11 = delegate(ConsoleEventArgs args) { if (args.Length >= 2 && string.Equals(args[1], "reload", StringComparison.OrdinalIgnoreCase)) { if (!RequireAdmin(args.Context)) { return; } if ((Object)(object)ZNet.instance == (Object)null || !ZNet.instance.IsServer()) { args.Context.AddString("Huskarl: only the server can reload the paytable. Yours is whatever it sent you."); return; } ConfigSync.LoadFromDisk(); args.Context.AddString("Huskarl: paytable reloaded. It reaches each player as they connect."); } SlotPrize[] table = ConfigSync.Table; int stake = ConfigSync.Stake; args.Context.AddString("Huskarl: " + stake + " gold a pull" + (ConfigSync.FromServer ? " (the server's odds)" : " (this machine's own odds)") + ", file at " + ConfigSync.Path); SlotPrize[] array = table; for (int i = 0; i < array.Length; i++) { SlotPrize prize = array[i]; string text = ((prize.Matches == 0) ? "anything else" : (prize.Matches + " x " + Slots.Name(prize.Symbol))); string text2 = ((prize.Rate <= 0.0) ? "never" : ("1 in " + Mathf.RoundToInt((float)(1.0 / prize.Rate)))); args.Context.AddString(" " + text.PadRight(18) + Slots.Describe(prize, 1).PadRight(22) + text2); } double num = Slots.ReturnToPlayer(table, stake); double val13 = Slots.BreakEvenRate(table, stake); double num2 = Slots.TotalRate(table); args.Context.AddString(" pays back " + (num * 100.0).ToString("0.0") + "%, breaks even 1 pull in " + (1.0 / Math.Max(0.0001, val13)).ToString("0.0")); if (Math.Abs(num2 - 1.0) > 0.005) { args.Context.AddString(" WARNING: the rates add up to " + num2.ToString("0.####") + " rather than 1, so they are not the odds written in the file."); } }; <>c.<>9__2_8 = val11; obj11 = (object)val11; } object obj12 = <>c.<>9__2_9; if (obj12 == null) { ConsoleOptionsFetcher val12 = () => new List<string> { "reload" }; <>c.<>9__2_9 = val12; obj12 = (object)val12; } new ConsoleCommand("huskarl_slots", "huskarl_slots [reload] - show the slot machine's odds, or reload them from disk and push them to every client.", (ConsoleEvent)obj11, false, false, false, false, false, false, (ConsoleOptionsFetcher)obj12, false, false, false); } private static bool RequireAdmin(Terminal context) { try { if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.LocalPlayerIsAdminOrHost()) { return true; } } catch { } if (context != null) { context.AddString("Huskarl: you need to be an admin or the host to do that."); } return false; } private static Player LocalPlayer(Terminal context) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null && context != null) { context.AddString("Huskarl: no local player. Load into a world first."); } return localPlayer; } private static HuskarlNpc Target(Terminal context) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) Player val = LocalPlayer(context); if ((Object)(object)val == (Object)null) { return null; } GameObject hoverObject = ((Humanoid)val).GetHoverObject(); HuskarlNpc huskarlNpc = (((Object)(object)hoverObject == (Object)null) ? null : hoverObject.GetComponentInParent<HuskarlNpc>()); if ((Object)(object)huskarlNpc == (Object)null) { huskarlNpc = Npc.Nearest(((Component)val).transform.position, 5f); } if ((Object)(object)huskarlNpc == (Object)null && context != null) { context.AddString("Huskarl: no NPC here. Look at one, or stand within five metres of it."); } return huskarlNpc; } private static List<string> CreatureNames() { List<string> list = new List<string>(); try { if ((Object)(object)ZNetScene.instance == (Object)null || ZNetScene.instance.m_prefabs == null) { return list; } foreach (GameObject prefab in ZNetScene.instance.m_prefabs) { if (!((Object)(object)prefab == (Object)null) && !((Object)(object)prefab.GetComponent<Character>() == (Object)null)) { list.Add(((Object)prefab).name); } } list.Sort(StringComparer.OrdinalIgnoreCase); } catch (Exception ex) { Safety.Failed("Commands.CreatureNames", ex); } return list; } } internal static class ConfigSync { private const string RpcName = "GBV_Huskarl_Slots"; internal const string FileName = "gbv.valheim.huskarl.slots.cfg"; private static bool _registered; internal static SlotPrize[] Table { get; private set; } = Slots.DefaultTable(); internal static int Stake { get; private set; } = 20; internal static string[] Prefabs { get; private set; } = Slots.DefaultPrefabs(); internal static bool FromServer { get; private set; } internal static string Path => System.IO.Path.Combine(Paths.ConfigPath, "gbv.valheim.huskarl.slots.cfg"); internal static void Register() { if (ZRoutedRpc.instance != null) { if (!_registered) { ZRoutedRpc.instance.Register<ZPackage>("GBV_Huskarl_Slots", (Action<long, ZPackage>)OnReceived); _registered = true; } if ((Object)(object)ZNet.instance != (Object)null && ZNet.instance.IsServer()) { LoadFromDisk(); ZRoutedRpc instance = ZRoutedRpc.instance; instance.m_onNewPeer = (Action<long>)Delegate.Combine(instance.m_onNewPeer, new Action<long>(OnNewPeer)); } else { FromServer = false; } } } internal static void Reset() { Table = Slots.DefaultTable(); Stake = 20; Prefabs = Slots.DefaultPrefabs(); FromServer = false; } internal static void LoadFromDisk() { try { if (!File.Exists(Path)) { File.WriteAllText(Path, Slots.ToText(Slots.DefaultTable(), 20, Currency.Sensible())); Table = Sl