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.2.0
plugins/Huskarl.dll
Decompiled 2 months 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.2.0.0")] [assembly: AssemblyInformationalVersion("0.2.0+d41778de5e018764102615405b4022657af7f7a5")] [assembly: AssemblyProduct("Huskarl")] [assembly: AssemblyTitle("Huskarl")] [assembly: AssemblyVersion("0.2.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GBV.Shared { internal static class Theme { public static readonly Color StoneDeep = Hex("0A0B0D"); public static readonly Color Stone = Hex("14161A"); public static readonly Color StoneHi = Hex("1F2329"); public static readonly Color StoneLit = Hex("2D323A"); public static readonly Color Carve = Hex("060708"); public static readonly Color Brass = Hex("C9A45C"); public static readonly Color BrassHi = Hex("F2D9A0"); public static readonly Color BrassDim = Hex("6B5630"); public static readonly Color BrassInk = Hex("17110478"); public static readonly Color TextHi = Hex("F7F4EE"); public static readonly Color Text = Hex("D8D4CC"); public static readonly Color Muted = Hex("9FA0A2"); public static readonly Color Faint = Hex("74767A"); public static readonly Color Good = Hex("A6C978"); public static readonly Color Bad = Hex("DD6A57"); public static readonly Color Warn = Hex("E8B25C"); public const float Pad = 30f; public const float Inlay = 9f; public const float TabH = 46f; public const float RowH = 30f; public const float FooterH = 44f; public static GUIStyle Blank; public static GUIStyle Wordmark; public static GUIStyle Title; public static GUIStyle Lead; public static GUIStyle TabOn; public static GUIStyle TabOff; public static GUIStyle Heading; public static GUIStyle Body; public static GUIStyle BodyHi; public static GUIStyle Dim; public static GUIStyle Small; public static GUIStyle SmallRight; public static GUIStyle Mono; public static GUIStyle MonoDim; public static GUIStyle MonoEcho; public static GUIStyle Search; public static GUIStyle Field; public static GUIStyle FieldText; public static GUIStyle FieldArea; public static GUIStyle Console_; public static GUIStyle Link; public static GUIStyle LinkOn; public static GUIStyle Chip; public static GUIStyle ChipOn; public static GUIStyle Row; public static GUIStyle Action; public static GUIStyle ActionKey; public static GUIStyle Danger; public static GUIStyle Btn; public static GUIStyle BtnOn; public static GUIStyle BtnPrimary; public static GUIStyle BtnDanger; public static GUIStyle BtnSmall; public static GUIStyle BtnSmallOn; public static GUIStyle DropItem; public static GUIStyle TileName; public static GUIStyle TileNameHot; public static GUIStyle Glyph; public static GUIStyle ScrollbarV; public static GUIStyle ScrollbarThumb; public static GUIStyle Scroll; public static Texture2D Grain; public static Texture2D Px; private static bool _built; public static void EnsureBuilt() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Expected O, but got Unknown //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02f3: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0334: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0370: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_0407: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_042f: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_044d: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Unknown result type (might be due to invalid IL or missing references) //IL_0499: Unknown result type (might be due to invalid IL or missing references) //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b7: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Unknown result type (might be due to invalid IL or missing references) //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_052a: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0534: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0552: Unknown result type (might be due to invalid IL or missing references) //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Expected O, but got Unknown //IL_058b: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Unknown result type (might be due to invalid IL or missing references) //IL_05a5: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b5: Unknown result type (might be due to invalid IL or missing references) //IL_05bb: Unknown result type (might be due to invalid IL or missing references) //IL_05ca: Unknown result type (might be due to invalid IL or missing references) //IL_05d0: Unknown result type (might be due to invalid IL or missing references) //IL_05da: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05ef: Unknown result type (might be due to invalid IL or missing references) //IL_05f5: Unknown result type (might be due to invalid IL or missing references) //IL_05ff: Unknown result type (might be due to invalid IL or missing references) //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Expected O, but got Unknown //IL_060e: Unknown result type (might be due to invalid IL or missing references) //IL_0615: Unknown result type (might be due to invalid IL or missing references) //IL_061f: Expected O, but got Unknown //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_062e: Expected O, but got Unknown //IL_062e: Unknown result type (might be due to invalid IL or missing references) //IL_0636: Unknown result type (might be due to invalid IL or missing references) //IL_0641: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Expected O, but got Unknown //IL_0652: Unknown result type (might be due to invalid IL or missing references) //IL_0657: Unknown result type (might be due to invalid IL or missing references) //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_066a: Unknown result type (might be due to invalid IL or missing references) //IL_0671: Unknown result type (might be due to invalid IL or missing references) //IL_0676: Unknown result type (might be due to invalid IL or missing references) //IL_0680: Expected O, but got Unknown //IL_0685: Expected O, but got Unknown //IL_068a: Unknown result type (might be due to invalid IL or missing references) //IL_068f: Unknown result type (might be due to invalid IL or missing references) //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Unknown result type (might be due to invalid IL or missing references) //IL_06a9: Unknown result type (might be due to invalid IL or missing references) //IL_06ae: Unknown result type (might be due to invalid IL or missing references) //IL_06b8: Expected O, but got Unknown //IL_06bd: Expected O, but got Unknown //IL_06c2: Unknown result type (might be due to invalid IL or missing references) //IL_06c7: Unknown result type (might be due to invalid IL or missing references) //IL_06cf: Unknown result type (might be due to invalid IL or missing references) //IL_06da: Unknown result type (might be due to invalid IL or missing references) //IL_06e1: Unknown result type (might be due to invalid IL or missing references) //IL_06e8: Unknown result type (might be due to invalid IL or missing references) //IL_06f2: Expected O, but got Unknown //IL_06f2: Unknown result type (might be due to invalid IL or missing references) //IL_06fe: Expected O, but got Unknown //IL_0703: Unknown result type (might be due to invalid IL or missing references) //IL_0708: Unknown result type (might be due to invalid IL or missing references) //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0722: Unknown result type (might be due to invalid IL or missing references) //IL_0727: Unknown result type (might be due to invalid IL or missing references) //IL_0731: Expected O, but got Unknown //IL_0736: Expected O, but got Unknown //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_07d4: Unknown result type (might be due to invalid IL or missing references) //IL_0807: Unknown result type (might be due to invalid IL or missing references) //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0859: Unknown result type (might be due to invalid IL or missing references) //IL_0863: Expected O, but got Unknown //IL_086d: Unknown result type (might be due to invalid IL or missing references) //IL_0872: Unknown result type (might be due to invalid IL or missing references) //IL_087d: Unknown result type (might be due to invalid IL or missing references) //IL_088c: Unknown result type (might be due to invalid IL or missing references) //IL_0891: Unknown result type (might be due to invalid IL or missing references) //IL_089b: Expected O, but got Unknown //IL_089b: Unknown result type (might be due to invalid IL or missing references) //IL_08a6: Unknown result type (might be due to invalid IL or missing references) //IL_08ac: Unknown result type (might be due to invalid IL or missing references) //IL_08b6: Expected O, but got Unknown //IL_08b6: Unknown result type (might be due to invalid IL or missing references) //IL_08bb: Unknown result type (might be due to invalid IL or missing references) //IL_08c5: Expected O, but got Unknown //IL_08ca: Expected O, but got Unknown //IL_08d4: Unknown result type (might be due to invalid IL or missing references) //IL_08d9: Unknown result type (might be due to invalid IL or missing references) //IL_08df: Unknown result type (might be due to invalid IL or missing references) //IL_08ee: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Unknown result type (might be due to invalid IL or missing references) //IL_0903: Unknown result type (might be due to invalid IL or missing references) //IL_0909: Unknown result type (might be due to invalid IL or missing references) //IL_0918: Unknown result type (might be due to invalid IL or missing references) //IL_091d: Unknown result type (might be due to invalid IL or missing references) //IL_0927: Expected O, but got Unknown //IL_0927: Unknown result type (might be due to invalid IL or missing references) //IL_0932: Unknown result type (might be due to invalid IL or missing references) //IL_0937: Unknown result type (might be due to invalid IL or missing references) //IL_0941: Expected O, but got Unknown //IL_0941: Unknown result type (might be due to invalid IL or missing references) //IL_0946: Unknown result type (might be due to invalid IL or missing references) //IL_0950: Expected O, but got Unknown //IL_0955: Expected O, but got Unknown //IL_09dc: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Unknown result type (might be due to invalid IL or missing references) if (!_built) { _built = true; Px = Solid(Color.white); Grain = StoneGrain(128); Blank = new GUIStyle(); Wordmark = Label(28, (FontStyle)1, TextHi); Title = Label(22, (FontStyle)1, TextHi); Lead = Label(17, (FontStyle)0, Text); Heading = Label(11, (FontStyle)1, Brass); Body = Label(13, (FontStyle)0, Text); BodyHi = Label(13, (FontStyle)1, TextHi); Dim = Label(13, (FontStyle)0, Muted); Small = Label(11, (FontStyle)0, Muted); SmallRight = Label(11, (FontStyle)0, Muted); SmallRight.alignment = (TextAnchor)5; Mono = Label(12, (FontStyle)0, TextHi); MonoDim = Label(12, (FontStyle)0, Muted); MonoEcho = Label(12, (FontStyle)1, Brass); TabOff = Ghost(46f, 13, (FontStyle)0, Muted, TextHi); TabOn = Ghost(46f, 13, (FontStyle)1, BrassHi, BrassHi); TabOff.alignment = (TextAnchor)4; TabOn.alignment = (TextAnchor)4; Link = Ghost(30f, 13, (FontStyle)0, Text, BrassHi); LinkOn = Ghost(30f, 13, (FontStyle)1, BrassHi, BrassHi); Link.alignment = (TextAnchor)4; LinkOn.alignment = (TextAnchor)4; Chip = Ghost(26f, 12, (FontStyle)0, Muted, BrassHi); ChipOn = Ghost(26f, 12, (FontStyle)1, Brass, BrassHi); Chip.alignment = (TextAnchor)4; ChipOn.alignment = (TextAnchor)4; Row = Ghost(30f, 13, (FontStyle)0, Text, BrassHi); Row.alignment = (TextAnchor)3; Row.padding = new RectOffset(12, 12, 0, 0); Action = Ghost(34f, 13, (FontStyle)1, Brass, BrassHi); Action.alignment = (TextAnchor)4; ActionKey = Ghost(34f, 13, (FontStyle)1, BrassInk, BrassInk); ActionKey.alignment = (TextAnchor)4; Danger = Ghost(34f, 13, (FontStyle)1, Bad, Hex("FF8B78")); Danger.alignment = (TextAnchor)4; Btn = Plate(34, 4, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 13); BtnOn = Plate(34, 4, Hex("312B18"), Hex("43391F"), Brass, Hex("3B3320"), Hex("4E4227"), BrassHi, Hex("2A2515"), Hex("352E1A"), BrassHi, BrassHi, 13); BtnPrimary = Plate(34, 4, Hex("A8873A"), Hex("D0A63A"), Hex("F2D9A0"), Hex("C09A38"), Hex("EBC97A"), Hex("F7E6BE"), Hex("8A6E2C"), Hex("A8873A"), Hex("F2D9A0"), Hex("151003"), 13); BtnPrimary.fontStyle = (FontStyle)1; BtnDanger = Plate(34, 4, Hex("5A2621"), Hex("7A332C"), Hex("A8453A"), Hex("7A332C"), Hex("9C4239"), Hex("DD6A57"), Hex("431B17"), Hex("5A2621"), Hex("DD6A57"), Hex("F3C8C0"), 13); BtnDanger.fontStyle = (FontStyle)1; BtnSmall = Plate(26, 3, Hex("1B1F25"), Hex("272D35"), Hex("3B434E"), Hex("262D36"), Hex("39424E"), Hex("6E5F3A"), Hex("14171C"), Hex("1B2027"), Brass, Text, 12); BtnSmallOn = Plate(26, 3, Hex("312B18"), Hex("43391F"), Brass, Hex("3B3320"), Hex("4E4227"), BrassHi, Hex("2A2515"), Hex("352E1A"), BrassHi, TextHi, 12); DropItem = Ghost(28f, 13, (FontStyle)0, Text, BrassHi); DropItem.alignment = (TextAnchor)3; DropItem.padding = new RectOffset(12, 12, 0, 0); GUIStyle val = new GUIStyle(GUI.skin.textField); val.normal.background = Solid(Carve); val.normal.textColor = TextHi; val.hover.background = Solid(StoneHi); val.hover.textColor = TextHi; val.focused.background = Solid(StoneLit); val.focused.textColor = TextHi; val.border = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(10, 10, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fontSize = 15; val.fixedHeight = 34f; val.alignment = (TextAnchor)3; Search = val; Field = new GUIStyle(Search) { fontSize = 13, fixedHeight = 26f, alignment = (TextAnchor)4, padding = new RectOffset(2, 2, 0, 0) }; FieldText = new GUIStyle(Search) { fontSize = 13, fixedHeight = 26f, alignment = (TextAnchor)3, padding = new RectOffset(8, 8, 0, 0) }; FieldArea = new GUIStyle(Search) { fontSize = 13, fixedHeight = 0f, alignment = (TextAnchor)0, padding = new RectOffset(10, 10, 8, 8), wordWrap = true }; Console_ = new GUIStyle(Search) { fontSize = 13, fixedHeight = 0f, alignment = (TextAnchor)3, padding = new RectOffset(4, 4, 0, 0) }; Console_.normal.textColor = TextHi; Console_.focused.textColor = TextHi; Console_.hover.textColor = TextHi; Texture2D background = Solid(new Color(0f, 0f, 0f, 0f)); Console_.normal.background = background; Console_.focused.background = background; Console_.hover.background = background; Console_.active.background = background; TileName = Label(11, (FontStyle)0, Text); TileName.alignment = (TextAnchor)1; TileName.wordWrap = true; TileName.clipping = (TextClipping)1; TileNameHot = Label(11, (FontStyle)1, TextHi); TileNameHot.alignment = (TextAnchor)1; TileNameHot.wordWrap = true; TileNameHot.clipping = (TextClipping)1; Glyph = Label(20, (FontStyle)0, Hex("4A3F33")); Glyph.alignment = (TextAnchor)4; Scroll = new GUIStyle(); GUIStyle val2 = new GUIStyle(GUI.skin.verticalScrollbar); val2.normal.background = Solid(Hex("0A0807")); val2.border = new RectOffset(0, 0, 0, 0); val2.fixedWidth = 3f; val2.margin = new RectOffset(10, 0, 0, 0); val2.padding = new RectOffset(0, 0, 0, 0); ScrollbarV = val2; GUIStyle val3 = new GUIStyle(GUI.skin.verticalScrollbarThumb); val3.normal.background = Solid(BrassDim); val3.hover.background = Solid(Brass); val3.active.background = Solid(BrassHi); val3.border = new RectOffset(0, 0, 0, 0); val3.fixedWidth = 3f; val3.margin = new RectOffset(0, 0, 0, 0); val3.padding = new RectOffset(0, 0, 0, 0); ScrollbarThumb = val3; GUI.skin.verticalScrollbarUpButton = GUIStyle.none; GUI.skin.verticalScrollbarDownButton = GUIStyle.none; GUI.skin.horizontalScrollbarLeftButton = GUIStyle.none; GUI.skin.horizontalScrollbarRightButton = GUIStyle.none; GUI.skin.verticalScrollbar = ScrollbarV; GUI.skin.verticalScrollbarThumb = ScrollbarThumb; GUI.skin.settings.selectionColor = new Color(Brass.r, Brass.g, Brass.b, 0.3f); GUI.skin.settings.cursorColor = BrassHi; } } public static void DrawSlab(Rect r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Unknown result type (might be due to invalid IL or missing references) Fill(r, Stone); Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.95f); GUI.DrawTextureWithTexCoords(r, (Texture)(object)Grain, new Rect(0f, 0f, ((Rect)(ref r)).width / (float)((Texture)Grain).width, ((Rect)(ref r)).height / (float)((Texture)Grain).height)); GUI.color = color; FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: true); FillFade(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 34f, ((Rect)(ref r)).width, 34f), Carve, 0.6f, topDown: false); Outline(r, Hex("000000"), 1f); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width - 2f, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.9f)); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.7f)); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width - 2f, 1f), new Color(0f, 0f, 0f, 0.65f)); Fill(new Rect(((Rect)(ref r)).xMax - 2f, ((Rect)(ref r)).y + 1f, 1f, ((Rect)(ref r)).height - 2f), new Color(0f, 0f, 0f, 0.5f)); Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x + 9f, ((Rect)(ref r)).y + 9f, ((Rect)(ref r)).width - 18f, ((Rect)(ref r)).height - 18f); Outline(r2, new Color(Brass.r, Brass.g, Brass.b, 0.75f), 1f); Outline(new Rect(((Rect)(ref r2)).x + 1f, ((Rect)(ref r2)).y + 1f, ((Rect)(ref r2)).width - 2f, ((Rect)(ref r2)).height - 2f), new Color(0f, 0f, 0f, 0.55f), 1f); Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).y); Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).y); Rivet(((Rect)(ref r2)).x, ((Rect)(ref r2)).yMax); Rivet(((Rect)(ref r2)).xMax, ((Rect)(ref r2)).yMax); } private static void Rivet(float cx, float cy) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) Rect r = default(Rect); ((Rect)(ref r))..ctor(cx - 3f, cy - 3f, 6f, 6f); Fill(new Rect(((Rect)(ref r)).x - 1f, ((Rect)(ref r)).y - 1f, ((Rect)(ref r)).width + 2f, ((Rect)(ref r)).height + 2f), new Color(0f, 0f, 0f, 0.6f)); Fill(r, BrassDim); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 2f), Brass); Fill(new Rect(((Rect)(ref r)).x + 1f, ((Rect)(ref r)).y + 1f, 2f, 2f), BrassHi); } public static void Fill(Rect r, Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; GUI.color = c; GUI.DrawTexture(r, (Texture)(object)Px); GUI.color = color; } private static void FillFade(Rect r, Color c, float alpha, bool topDown) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) int num = 8; for (int i = 0; i < num; i++) { float num2 = (float)i / (float)num; float num3 = alpha * (topDown ? (1f - num2) : num2); float num4 = ((Rect)(ref r)).height / (float)num; Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + num4 * (float)i, ((Rect)(ref r)).width, num4 + 1f), new Color(c.r, c.g, c.b, num3)); } } public static void Outline(Rect r, Color c, float w) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, w), c); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - w, ((Rect)(ref r)).width, w), c); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c); Fill(new Rect(((Rect)(ref r)).xMax - w, ((Rect)(ref r)).y, w, ((Rect)(ref r)).height), c); } public static void Hairline(Rect r, float alpha = 0.28f) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), new Color(Brass.r, Brass.g, Brass.b, alpha)); } public static void Groove(Rect r) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 1f), Carve); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width, 1f), new Color(StoneLit.r, StoneLit.g, StoneLit.b, 0.8f)); } public static string Spaced(string s) { if (string.IsNullOrEmpty(s)) { return s; } StringBuilder stringBuilder = new StringBuilder(s.Length * 2); string text = s.ToUpperInvariant(); foreach (char value in text) { stringBuilder.Append(value).Append(' '); } return stringBuilder.ToString().TrimEnd(); } private static GUIStyle Label(int size, FontStyle style, Color colour) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.label) { fontSize = size, fontStyle = style }; val.normal.textColor = colour; val.margin = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(0, 0, 0, 0); val.alignment = (TextAnchor)3; val.wordWrap = false; return val; } private static GUIStyle Ghost(float h, int size, FontStyle style, Color normal, Color hover) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown Texture2D background = Solid(new Color(0f, 0f, 0f, 0f)); GUIStyle val = new GUIStyle(GUI.skin.button); val.normal.background = background; val.normal.textColor = normal; val.hover.background = background; val.hover.textColor = hover; val.active.background = background; val.active.textColor = hover; val.onNormal.background = background; val.onNormal.textColor = hover; val.onHover.background = background; val.onHover.textColor = hover; val.onActive.background = background; val.onActive.textColor = hover; val.border = new RectOffset(0, 0, 0, 0); val.padding = new RectOffset(8, 8, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fixedHeight = h; val.fontSize = size; val.fontStyle = style; val.alignment = (TextAnchor)3; val.wordWrap = false; val.clipping = (TextClipping)1; return val; } private static GUIStyle Plate(int h, int radius, Color nBot, Color nTop, Color nEdge, Color hBot, Color hTop, Color hEdge, Color aBot, Color aTop, Color aEdge, Color text, int fontSize) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Expected O, but got Unknown GUIStyle val = new GUIStyle(GUI.skin.button); val.normal.background = PlateTex(h, radius, nBot, nTop, nEdge); val.normal.textColor = text; val.hover.background = PlateTex(h, radius, hBot, hTop, hEdge); val.hover.textColor = text; val.active.background = PlateTex(h, radius, aBot, aTop, aEdge); val.active.textColor = text; val.onNormal.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onNormal.textColor = text; val.onHover.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onHover.textColor = text; val.onActive.background = PlateTex(h, radius, aBot, aTop, aEdge); val.onActive.textColor = text; val.border = new RectOffset(radius + 3, radius + 3, 0, 0); val.padding = new RectOffset(10, 10, 0, 0); val.margin = new RectOffset(0, 0, 0, 0); val.fixedHeight = h; val.fontSize = fontSize; val.alignment = (TextAnchor)4; val.wordWrap = false; val.clipping = (TextClipping)1; return val; } private static Texture2D PlateTex(int h, int radius, Color bottom, Color top, Color edge) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) int num = radius * 2 + 8; Texture2D val = new Texture2D(num, h, (TextureFormat)5, false); for (int i = 0; i < h; i++) { float num2 = ((h <= 1) ? 0f : ((float)i / (float)(h - 1))); Color val2 = Color.Lerp(bottom, top, num2); if (i >= h - 1) { val2 = Color.Lerp(val2, Color.white, 0.12f); } for (int j = 0; j < num; j++) { float num3 = Sdf(j, i, num, h, radius); float num4 = Mathf.Clamp01(0.5f - num3); if (num4 <= 0f) { val.SetPixel(j, i, new Color(0f, 0f, 0f, 0f)); continue; } float num5 = Mathf.Clamp01(0.5f - (num3 + 1.15f)); Color val3 = Color.Lerp(edge, val2, num5); val.SetPixel(j, i, new Color(val3.r, val3.g, val3.b, num4)); } } return Finish(val); } private static float Sdf(float x, float y, int w, int h, int radius) { float num = Mathf.Min((float)radius, (float)Mathf.Min(w, h) * 0.5f); float num2 = x + 0.5f; float num3 = y + 0.5f; float num4 = Mathf.Clamp(num2, num, (float)w - num); float num5 = Mathf.Clamp(num3, num, (float)h - num); float num6 = num2 - num4; float num7 = num3 - num5; return Mathf.Sqrt(num6 * num6 + num7 * num7) - num; } private static Color Hex(string hex) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) int num = Convert.ToInt32(hex.Substring(0, 2), 16); int num2 = Convert.ToInt32(hex.Substring(2, 2), 16); int num3 = Convert.ToInt32(hex.Substring(4, 2), 16); float num4 = ((hex.Length >= 8) ? ((float)Convert.ToInt32(hex.Substring(6, 2), 16) / 255f) : 1f); return new Color((float)num / 255f, (float)num2 / 255f, (float)num3 / 255f, num4); } private static Texture2D Finish(Texture2D t) { ((Object)t).hideFlags = (HideFlags)61; ((Texture)t).filterMode = (FilterMode)1; ((Texture)t).wrapMode = (TextureWrapMode)0; t.Apply(); return t; } private static Texture2D Solid(Color c) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown Texture2D val = new Texture2D(1, 1, (TextureFormat)5, false); val.SetPixel(0, 0, c); ((Texture)val).wrapMode = (TextureWrapMode)1; return Finish(val); } private static Texture2D StoneGrain(int size) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)5, false); for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = (0f + Tileable(j, i, size, 8f) * 0.5f + Tileable(j, i, size, 19f) * 0.32f + Tileable(j, i, size, 43f) * 0.18f - 0.5f) * 2f; float num2 = Mathf.Abs(num) * 0.55f; Color val2 = ((num >= 0f) ? new Color(StoneHi.r, StoneHi.g, StoneHi.b, num2) : new Color(Carve.r, Carve.g, Carve.b, num2 * 1.5f)); val.SetPixel(j, i, val2); } } return Finish(val); } private static float Tileable(int x, int y, int size, float freq) { float num = (float)x / (float)size; float num2 = (float)y / (float)size; float num3 = Mathf.PerlinNoise(num * freq, num2 * freq); float num4 = Mathf.PerlinNoise((num - 1f) * freq, num2 * freq); float num5 = Mathf.PerlinNoise(num * freq, (num2 - 1f) * freq); float num6 = Mathf.PerlinNoise((num - 1f) * freq, (num2 - 1f) * freq); return Mathf.Lerp(Mathf.Lerp(num3, num4, num), Mathf.Lerp(num5, num6, num), num2); } } internal static class BankLedger { internal const string Prefix = "gbv.hk.bank."; internal const long Ceiling = 1000000000000L; internal static string KeyFor(long worldUid, string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return null; } return "gbv.hk.bank." + worldUid.ToString(CultureInfo.InvariantCulture) + "." + prefabName; } internal static long Parse(string stored) { if (string.IsNullOrEmpty(stored)) { return 0L; } if (!long.TryParse(stored, NumberStyles.Integer, CultureInfo.InvariantCulture, out var result)) { return 0L; } if (result <= 0) { return 0L; } if (result <= 1000000000000L) { return result; } return 1000000000000L; } internal static string Format(long balance) { if (balance <= 0) { return null; } return ((balance > 1000000000000L) ? 1000000000000L : balance).ToString(CultureInfo.InvariantCulture); } internal static long Room(long balance) { long num = ((balance < 0) ? 0 : balance); if (num < 1000000000000L) { return 1000000000000L - num; } return 0L; } internal static int Accepts(long balance, int wanted) { if (wanted <= 0) { return 0; } long num = Room(balance); if (num <= 0) { return 0; } if (num >= wanted) { return wanted; } return (int)num; } internal static long Credit(long balance, int amount) { long num = ((balance < 0) ? 0 : balance); if (amount <= 0) { return num; } long num2 = num + amount; if (num2 <= 1000000000000L) { return num2; } return 1000000000000L; } internal static int Grants(long balance, int wanted) { if (wanted <= 0) { return 0; } long num = ((balance < 0) ? 0 : balance); if (num <= 0) { return 0; } if (num >= wanted) { return wanted; } return (int)num; } internal static long Debit(long balance, int amount) { long num = ((balance < 0) ? 0 : balance); if (amount <= 0) { return num; } long num2 = num - amount; if (num2 > 0) { return num2; } return 0L; } internal static string Pretty(long balance) { if (balance <= 0) { return "0"; } string text = balance.ToString(CultureInfo.InvariantCulture); if (text.Length <= 4) { return text; } StringBuilder stringBuilder = new StringBuilder(text.Length + text.Length / 3); int num = text.Length % 3; if (num == 0) { num = 3; } stringBuilder.Append(text, 0, num); for (int i = num; i < text.Length; i += 3) { stringBuilder.Append(' ').Append(text, i, 3); } return stringBuilder.ToString(); } internal static bool IsBankKey(string key) { if (!string.IsNullOrEmpty(key)) { return key.StartsWith("gbv.hk.bank.", StringComparison.Ordinal); } return false; } internal static string PrefabIn(string key) { if (!IsBankKey(key)) { return null; } int num = key.IndexOf('.', "gbv.hk.bank.".Length); if (num < 0 || num + 1 >= key.Length) { return null; } return key.Substring(num + 1); } } } 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 string Chest; internal string Legs; internal string Helmet; internal string Cape; internal static Look Default() { return new Look { Model = 0, Hair = null, Beard = null, SkinHue = 0.5f, HairTone = 0.5f, HairLevel = 0.75f, Chest = "ArmorRagsChest", Legs = "ArmorRagsLegs", Helmet = "", Cape = "" }; } } 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 Dictionary<ItemType, List<ItemDrop>> _worn = new Dictionary<ItemType, List<ItemDrop>>(); private static int _wornForDb; 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"); private static readonly int KeyChest = StringExtensionMethods.GetStableHashCode("gbv.hk.chest"); private static readonly int KeyLegs = StringExtensionMethods.GetStableHashCode("gbv.hk.legs"); private static readonly int KeyHelmet = StringExtensionMethods.GetStableHashCode("gbv.hk.helm"); private static readonly int KeyCape = StringExtensionMethods.GetStableHashCode("gbv.hk.cape"); internal static List<ItemDrop> Hairs() { Build(); return _hairs ?? new List<ItemDrop>(); } internal static List<ItemDrop> Beards() { Build(); return _beards ?? new List<ItemDrop>(); } internal static List<ItemDrop> Chests() { return Wearable((ItemType)7); } internal static List<ItemDrop> Legs() { return Wearable((ItemType)11); } internal static List<ItemDrop> Helmets() { return Wearable((ItemType)6); } internal static List<ItemDrop> Capes() { return Wearable((ItemType)17); } private static List<ItemDrop> Wearable(ItemType type) { //IL_003b: 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_0064: Unknown result type (might be due to invalid IL or missing references) try { ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null) { return new List<ItemDrop>(); } int instanceID = ((Object)instance).GetInstanceID(); if (_wornForDb != instanceID) { _worn.Clear(); _wornForDb = instanceID; } if (_worn.TryGetValue(type, out var value)) { return value; } value = instance.GetAllItems(type, "") ?? new List<ItemDrop>(); _worn[type] = value; return value; } catch (Exception ex) { Safety.Failed("Appearance.Wearable", ex); return 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))); vis.SetChestItem(Hash(look.Chest)); vis.SetLegItem(Hash(look.Legs)); vis.SetHelmetItem(Hash(look.Helmet)); vis.SetShoulderItem(Hash(look.Cape), 0, 1); } 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); result.Chest = zdo.GetString(KeyChest, result.Chest ?? ""); result.Legs = zdo.GetString(KeyLegs, result.Legs ?? ""); result.Helmet = zdo.GetString(KeyHelmet, ""); result.Cape = zdo.GetString(KeyCape, ""); 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); zdo.Set(KeyChest, look.Chest ?? ""); zdo.Set(KeyLegs, look.Legs ?? ""); zdo.Set(KeyHelmet, look.Helmet ?? ""); zdo.Set(KeyCape, look.Cape ?? ""); } } 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 { internal enum Elevation { Sunken, Flat, Raised, Floating } internal static class Ease { internal static float OutQuad(float t) { t = Mathf.Clamp01(t); return 1f - (1f - t) * (1f - t); } internal static float OutBack(float t) { t = Mathf.Clamp01(t) - 1f; return 1f + t * t * (2.70158f * t + 1.70158f); } internal static float Pulse(float speed) { return 0.5f + 0.5f * Mathf.Sin(Time.realtimeSinceStartup * speed * MathF.PI * 2f); } } 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 Texture2D Rays; internal static Texture2D Vignette; internal static Texture2D Shadow; internal static Texture2D BevelUp; internal static Texture2D BevelDown; internal static Texture2D Sheen; private static GUIStyle ShadowStyle; private static GUIStyle BevelUpStyle; private static GUIStyle BevelDownStyle; internal static GUIStyle PanelStyle; internal static GUIStyle PanelEdgeStyle; internal static void EnsureBuilt() { //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Expected O, but got Unknown //IL_0218: Expected O, but got Unknown //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Expected O, but got Unknown //IL_0245: Expected O, but got Unknown if (_built) { return; } _built = true; try { Rays = Finish(SlotArtwork.Rays(256, 12), 256, 256, "HuskarlRays"); Vignette = Finish(SlotArtwork.Vignette(128, 18.0, 0.55), 128, 128, "HuskarlVignette"); Shadow = Finish(SlotArtwork.Shadow(128, 18.0, 14.0), 128, 128, "HuskarlShadow"); BevelUp = Finish(SlotArtwork.Bevel(128, 18.0, 7.0, raised: true), 128, 128, "HuskarlBevelUp"); BevelDown = Finish(SlotArtwork.Bevel(128, 18.0, 7.0, raised: false), 128, 128, "HuskarlBevelDown"); Sheen = Finish(SlotArtwork.Sheen(8, 128), 8, 128, "HuskarlSheen"); 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; ShadowStyle = Slice(Shadow, 34); BevelUpStyle = Slice(BevelUp, 22); BevelDownStyle = Slice(BevelDown, 22); } catch (Exception ex) { Safety.Failed("Art.EnsureBuilt", ex); } } internal static void DrawSurface(Rect r, Elevation elevation, Color fill, Color edge) { //IL_00c2: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); float num = elevation switch { Elevation.Raised => 0.6f, Elevation.Floating => 1f, _ => 0f, }; if (num > 0f && (Object)(object)Shadow != (Object)null) { float num2 = 14f * num; Rect val = new Rect(((Rect)(ref r)).x - num2, ((Rect)(ref r)).y - num2 * 0.35f + num2 * 0.5f, ((Rect)(ref r)).width + num2 * 2f, ((Rect)(ref r)).height + num2 * 2f); Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.55f * num); GUI.Box(val, GUIContent.none, ShadowStyle); GUI.color = color; } DrawPanelFlat(r, fill); if (elevation != Elevation.Sunken && (Object)(object)Sheen != (Object)null) { Color color2 = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.05f + 0.05f * num); GUI.DrawTexture(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, ((Rect)(ref r)).height * 0.34f), (Texture)(object)Sheen); GUI.color = color2; } if (elevation != Elevation.Flat) { GUIStyle val2 = ((elevation == Elevation.Sunken) ? BevelDownStyle : BevelUpStyle); if (val2 != null) { Color color3 = GUI.color; GUI.color = new Color(1f, 1f, 1f, (elevation == Elevation.Sunken) ? 0.85f : 0.7f); GUI.Box(r, GUIContent.none, val2); GUI.color = color3; } } if (edge.a > 0f) { DrawPanelEdge(r, edge); } } internal static void DrawCard(Rect r, Elevation elevation) { //IL_0032: 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_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) Color fill = ((elevation == Elevation.Sunken) ? new Color(0.035f, 0.04f, 0.048f, 0.96f) : new Color(0.1f, 0.11f, 0.125f, 0.96f)); DrawSurface(r, elevation, fill, Theme.BrassDim); } internal static void DrawBar(Rect r, float fill01, Color colour) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0095: 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_00aa: 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_00ef: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); Theme.Fill(r, new Color(0.02f, 0.025f, 0.03f, 0.95f)); Theme.Outline(r, new Color(0f, 0f, 0f, 0.55f), 1f); float num = Mathf.Clamp01(fill01); if (!(num <= 0f)) { Rect r2 = default(Rect); ((Rect)(ref r2))..ctor(((Rect)(ref r)).x + 2f, ((Rect)(ref r)).y + 2f, (((Rect)(ref r)).width - 4f) * num, ((Rect)(ref r)).height - 4f); Theme.Fill(r2, colour); if (!((Object)(object)Sheen == (Object)null)) { Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, 0.22f); GUI.DrawTexture(new Rect(((Rect)(ref r2)).x, ((Rect)(ref r2)).y, ((Rect)(ref r2)).width, ((Rect)(ref r2)).height * 0.5f), (Texture)(object)Sheen); GUI.color = color; } } } internal static void DrawPanelFlat(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 DrawPanel(Rect r, Color fill) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) DrawSurface(r, Elevation.Raised, fill, new Color(0f, 0f, 0f, 0f)); } internal static void DrawSunken(Rect r, Color fill) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: 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) DrawSurface(r, Elevation.Sunken, fill, new Color(0f, 0f, 0f, 0f)); } 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 DrawRays(Rect r, Color colour, float turns, float strength = 1f) { //IL_001b: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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) EnsureBuilt(); if (!((Object)(object)Rays == (Object)null) && !(strength <= 0f)) { Matrix4x4 matrix = GUI.matrix; GUIUtility.RotateAroundPivot(turns * 360f, ((Rect)(ref r)).center); Color color = GUI.color; GUI.color = new Color(colour.r, colour.g, colour.b, colour.a * strength); GUI.DrawTexture(r, (Texture)(object)Rays); GUI.color = color; GUI.matrix = matrix; } } internal static void DrawVignette(Rect r, float strength = 1f) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) EnsureBuilt(); if (!((Object)(object)Vignette == (Object)null) && !(strength <= 0f)) { Color color = GUI.color; GUI.color = new Color(1f, 1f, 1f, strength); GUI.DrawTexture(r, (Texture)(object)Vignette); 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 GUIStyle Slice(Texture2D texture, int border) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0021: Expected O, but got Unknown GUIStyle val = new GUIStyle(); val.normal.background = texture; val.border = new RectOffset(border, border, border, border); return val; } 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 static class Bank { internal struct Currency { internal string Prefab; internal string Display; internal string Label; internal Sprite Icon; internal bool IsGold; } internal const string CoinPrefab = "Coins"; private const string RunemarkPrefix = "RM_"; private const string OchrePrefab = "RM_Ochre"; private const string RunemarkLockKey = "gbv.rm.lock"; private static List<Currency> _currencies; private static int _resolvedFor = -1; internal static List<Currency> Currencies() { ObjectDB instance = ObjectDB.instance; if ((Object)(object)instance == (Object)null) { return _currencies ?? new List<Currency>(); } int instanceID = ((Object)instance).GetInstanceID(); if (_currencies != null && instanceID == _resolvedFor) { return _currencies; } List<Currency> list = new List<Currency>(); try { Add(list, instance, "Coins", gold: true); Add(list, instance, "RM_Ochre", gold: false); if (instance.m_items != null) { foreach (GameObject item in instance.m_items) { if (!((Object)(object)item == (Object)null) && ((Object)item).name.StartsWith("RM_", StringComparison.Ordinal)) { Add(list, instance, ((Object)item).name, gold: false); } } } } catch (Exception ex) { Safety.Failed("Bank.Currencies", ex); } _resolvedFor = instanceID; _currencies = list; return _currencies; } private static void Add(List<Currency> into, ObjectDB db, string prefabName, bool gold) { if (string.IsNullOrEmpty(prefabName)) { return; } foreach (Currency item in into) { if (string.Equals(item.Prefab, prefabName, StringComparison.Ordinal)) { return; } } GameObject itemPrefab = db.GetItemPrefab(prefabName); ItemDrop val = (((Object)(object)itemPrefab == (Object)null) ? null : itemPrefab.GetComponent<ItemDrop>()); if (!((Object)(object)val == (Object)null) && val.m_itemData != null && val.m_itemData.m_shared != null) { string name = val.m_itemData.m_shared.m_name; if (!string.IsNullOrEmpty(name)) { Sprite[] icons = val.m_itemData.m_shared.m_icons; into.Add(new Currency { Prefab = prefabName, Display = name, Label = Localise(name), Icon = ((icons != null && icons.Length != 0) ? icons[0] : null), IsGold = gold }); } } } private static string Localise(string name) { try { if (Localization.instance == null) { return name; } string text = Localization.instance.Localize(name); return string.IsNullOrEmpty(text) ? name : text; } catch (Exception ex) { Safety.Failed("Bank.Localise", ex); return name; } } internal static void Forget() { _currencies = null; _resolvedFor = -1; } internal static long WorldUid() { try { return ((Object)(object)ZNet.instance == (Object)null) ? 0 : ZNet.instance.GetWorldUID(); } catch (Exception ex) { Safety.Failed("Bank.WorldUid", ex); return 0L; } } internal static long Balance(Player player, string prefabName) { try { if ((Object)(object)player == (Object)null || player.m_customData == null) { return 0L; } string text = BankLedger.KeyFor(WorldUid(), prefabName); if (text == null) { return 0L; } string value; return player.m_customData.TryGetValue(text, out value) ? BankLedger.Parse(value) : 0; } catch (Exception ex) { Safety.Failed("Bank.Balance", ex); return 0L; } } private static void Store(Player player, string prefabName, long balance) { if ((Object)(object)player == (Object)null || player.m_customData == null) { return; } string text = BankLedger.KeyFor(WorldUid(), prefabName); if (text != null) { string text2 = BankLedger.Format(balance); if (text2 == null) { player.m_customData.Remove(text); } else { player.m_customData[text] = text2; } } } internal static int InPack(Player player, Currency currency) { try { if ((Object)(object)player == (Object)null || string.IsNullOrEmpty(currency.Display)) { return 0; } Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return 0; } int num = 0; foreach (ItemData allItem in inventory.GetAllItems()) { if (Spendable(allItem, currency.Display)) { num += allItem.m_stack; } } return num; } catch (Exception ex) { Safety.Failed("Bank.InPack", ex); return 0; } } private static bool Spendable(ItemData item, string display) { if (item == null || item.m_shared == null) { return false; } if (!string.Equals(item.m_shared.m_name, display, StringComparison.Ordinal)) { return false; } return !IsLocked(item); } private static bool IsLocked(ItemData item) { if (item.m_customData == null) { return false; } if (item.m_customData.TryGetValue("gbv.rm.lock", out var value)) { return value == "1"; } return false; } internal static int Deposit(Player player, Currency currency, int wanted) { try { if ((Object)(object)player == (Object)null || wanted <= 0) { return 0; } long balance = Balance(player, currency.Prefab); int num = BankLedger.Accepts(balance, wanted); if (num <= 0) { return 0; } int num2 = InPack(player, currency); int num3 = Mathf.Min(num, num2); if (num3 <= 0) { return 0; } int num4 = Take(player, currency, num3); if (num4 <= 0) { return 0; } Store(player, currency.Prefab, BankLedger.Credit(balance, num4)); return num4; } catch (Exception ex) { Safety.Failed("Bank.Deposit", ex); return 0; } } internal static int Withdraw(Player player, Currency currency, int wanted) { try { if ((Object)(object)player == (Object)null || wanted <= 0) { return 0; } long balance = Balance(player, currency.Prefab); int num = BankLedger.Grants(balance, wanted); if (num <= 0) { return 0; } GameObject val = Prefab(currency.Prefab); if ((Object)(object)val == (Object)null) { HuskarlPlugin.Log.LogWarning((object)("Huskarl: " + currency.Prefab + " is banked but no longer exists in this world, so it cannot be withdrawn. The balance is untouched.")); return 0; } Store(player, currency.Prefab, BankLedger.Debit(balance, num)); Payout.Give(player, val, num); return num; } catch (Exception ex) { Safety.Failed("Bank.Withdraw", ex); return 0; } } private static int Take(Player player, Currency currency, int count) { Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null) { return 0; } List<ItemData> list = new List<ItemData>(inventory.GetAllItems()); int num = count; foreach (ItemData item in list) { if (num <= 0) { break; } if (Spendable(item, currency.Display)) { int num2 = Mathf.Min(item.m_stack, num); inventory.RemoveItem(item, num2); num -= num2; } } return count - num; } private static GameObject Prefab(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return null; } ObjectDB instance = ObjectDB.instance; if (!((Object)(object)instance == (Object)null)) { return instance.GetItemPrefab(prefabName); } return null; } internal static List<KeyValuePair<Currency, long>> Holdings(Player player) { List<KeyValuePair<Currency, long>> list = new List<KeyValuePair<Currency, long>>(); foreach (Currency item in Currencies()) { long num = Balance(player, item.Prefab); if (num > 0) { list.Add(new KeyValuePair<Currency, long>(item, num)); } } return list; } internal static void Set(Player player, Currency currency, long balance) { Store(player, currency.Prefab, (balance < 0) ? 0 : balance); } internal static bool Find(string token, out Currency currency) { currency = default(Currency); if (string.IsNullOrEmpty(token)) { return false; } foreach (Currency item in Currencies()) { if (string.Equals(item.Prefab, token, StringComparison.OrdinalIgnoreCase) || string.Equals(item.Display, token, StringComparison.OrdinalIgnoreCase) || string.Equals(item.Label, token, StringComparison.OrdinalIgnoreCase)) { currency = item; return true; } } return false; } } internal static class BankPanel { private struct Row { internal Bank.Currency Currency; internal int Pack; internal long Banked; } private enum Move { None, Deposit, Withdraw, DepositEverything, WithdrawEverything } private struct Columns { internal Rect Icon; internal Rect Name; internal Rect Pack; internal Rect Banked; internal Rect Deposit; internal Rect Withdraw; internal static Columns For(Rect r) { //IL_0088: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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_00f8: 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_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) float num = ((Rect)(ref r)).xMax - 10f - 116f; float num2 = num - 8f - 116f; float num3 = num2 - 16f - 118f; float num4 = num3 - 12f - 118f; float num5 = ((Rect)(ref r)).x + 12f; float num6 = num5 + 36f; return new Columns { Icon = new Rect(num5, ((Rect)(ref r)).y + (((Rect)(ref r)).height - 28f) * 0.5f, 28f, 28f), Name = new Rect(num6, ((Rect)(ref r)).y, Mathf.Max(40f, num4 - num6 - 10f), ((Rect)(ref r)).height), Pack = new Rect(num4, ((Rect)(ref r)).y, 118f, ((Rect)(ref r)).height), Banked = new Rect(num3, ((Rect)(ref r)).y, 118f, ((Rect)(ref r)).height), Deposit = new Rect(num2, ((Rect)(ref r)).y + 6f, 116f, Mathf.Max(10f, ((Rect)(ref r)).height - 12f)), Withdraw = new Rect(num, ((Rect)(ref r)).y + 6f, 116f, Mathf.Max(10f, ((Rect)(ref r)).height - 12f)) }; } } [CompilerGenerated] private static class <>O { public static WindowFunction <0>__DrawWindow; } private const int WindowId = 1212891713; private static HuskarlNpc _npc; private static Rect _window; private static readonly List<Row> _rows = new List<Row>(); private static Vector2 _scroll; private static string _status = ""; private static float _refreshed; private const int All = -1; private static readonly int[] Amounts = new int[5] { 1, 10, 100, 1000, -1 }; private static int _amount = 100; private static Move _pending; private static string _pendingPrefab; private const float PlateH = 26f; internal static bool IsOpen { get; private set; } internal static float CloseDistance => 6f; internal static void Open(HuskarlNpc npc) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)npc == (Object)null) && !((Object)(object)Player.m_localPlayer == (Object)null)) { _npc = npc; IsOpen = true; _status = ""; _refreshed = 0f; _scroll = Vector2.zero; ClearPending(); Art.EnsureBuilt(); float num = Mathf.Min(980f, (float)Screen.width - 80f); float num2 = Mathf.Min(760f, (float)Screen.height - 60f); _window = new Rect(((float)Screen.width - num) * 0.5f, ((float)Screen.height - num2) * 0.5f, num, num2); } } internal static void Close() { IsOpen = false; _npc = null; _rows.Clear(); ClearPending(); PanelInput.ReturnCursorToGame(); } private static void ClearPending() { _pending = Move.None; _pendingPrefab = null; } internal static void Tick() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) if (!IsOpen) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)_npc == (Object)null || (Object)(object)((Component)_npc).gameObject == (Object)null || (Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead()) { Close(); return; } if (Vector3.Distance(((Component)localPlayer).transform.position, ((Component)_npc).transform.position) > CloseDistance) { Close(); return; } if (Input.GetKeyDown((KeyCode)27)) { Close(); return; } Cursor.lockState = (CursorLockMode)0; Cursor.visible = true; if (Apply(localPlayer) || Time.realtimeSinceStartup - _refreshed > 0.25f) { _refreshed = Time.realtimeSinceStartup; Refresh(localPlayer); } } private static bool Apply(Player player) { Move pending = _pending; string pendingPrefab = _pendingPrefab; ClearPending(); if (pending == Move.None) { return false; } try { switch (pending) { case Move.Deposit: case Move.Withdraw: return One(player, pending, pendingPrefab); case Move.DepositEverything: return Everything(player, deposit: true); case Move.WithdrawEverything: return Everything(player, deposit: false); } } catch (Exception ex) { Safety.Failed("BankPanel.Apply", ex); _status = "Something went wrong. Nothing was moved."; } return false; } private static bool One(Player player, Move move, string prefab) { if (!Bank.Find(prefab, out var currency)) { return false; } bool flag = move == Move.Deposit; int num = _amount; if (num == -1) { num = (flag ? Bank.InPack(player, currency) : Clamp(Bank.Balance(player, currency.Prefab))); } if (num <= 0) { _status = (flag ? ("You have no " + currency.Label + " to bank.") : ("There is no " + currency.Label + " in your vault.")); return false; } int num2 = (flag ? Bank.Deposit(player, currency, num) : Bank.Withdraw(player, currency, num)); if (num2 <= 0) { _status = (flag ? ("You have no " + currency.Label + " to bank.") : ("There is no " + currency.Label + " in your vault.")); return false; } _status = (flag ? ("Banked " + BankLedger.Pretty(num2) + " " + currency.Label + ".") : ("Withdrew " + BankLedger.Pretty(num2) + " " + currency.Label + ".")); return true; } private static bool Everything(Player player, bool deposit) { int num = 0; long num2 = 0L; foreach (Bank.Currency item in Bank.Currencies()) { int num3 = (deposit ? Bank.InPack(player, item) : Clamp(Bank.Balance(player, item.Prefab))); if (num3 > 0) { int num4 = (deposit ? Bank.Deposit(player, item, num3) : Bank.Withdraw(player, item, num3)); if (num4 > 0) { num++; num2 += num4; } } } if (num == 0) { _status = (deposit ? "There was nothing to bank." : "Your vault is empty."); return false; } _status = (deposit ? "Banked " : "Withdrew ") + BankLedger.Pretty(num2) + " across " + num + ((num == 1) ? " kind." : " kinds."); return true; } private static int Clamp(long balance) { if (balance <= 0) { return 0; } if (balance <= int.MaxValue) { return (int)balance; } return int.MaxValue; } private static void Refresh(Player player) { _rows.Clear(); foreach (Bank.Currency item in Bank.Currencies()) { _rows.Add(new Row { Currency = item, Pack = Bank.InPack(player, item), Banked = Bank.Balance(player, item.Prefab) }); } } internal static void Draw() { //IL_0013: 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_002c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown if (!IsOpen) { return; } try { Theme.EnsureBuilt(); Art.EnsureBuilt(); GUI.color = Color.white; GUI.backgroundColor = Color.white; Rect window = _window; object obj = <>O.<0>__DrawWindow; if (obj == null) { WindowFunction val = DrawWindow; <>O.<0>__DrawWindow = val; obj = (object)val; } _window = GUI.Window(1212891713, window, (WindowFunction)obj, GUIContent.none, Theme.Blank); } catch (Exception ex) { Safety.Failed("BankPanel.Draw", ex); Close(); } } private static void DrawWindow(int id) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) Rect r = default(Rect); ((Rect)(ref r))..ctor(0f, 0f, ((Rect)(ref _window)).width, ((Rect)(ref _window)).height); Theme.DrawSlab(r); float num = 30f; Rect inner = default(Rect); ((Rect)(ref inner))..ctor(num, num * 0.5f, ((Rect)(ref r)).width - num * 2f, ((Rect)(ref r)).height - num * 1.1f); float num2 = DrawMasthead(inner); num2 = DrawAmounts(new Rect(((Rect)(ref inner)).x, num2, ((Rect)(ref inner)).width, 34f)); float num3 = ((Rect)(ref inner)).yMax - 44f; DrawRows(new Rect(((Rect)(ref inner)).x, num2, ((Rect)(ref inner)).width, num3 - num2 - 12f)); DrawFooter(new Rect(((Rect)(ref inner)).x, num3, ((Rect)(ref inner)).width, 44f)); GUI.Drag