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 MidgardPlus Lodge v0.2.3
plugins/MidgardPlusLodge.dll
Decompiled 13 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using Jotunn.Utils; using Microsoft.CodeAnalysis; using MidgardPlus.Api; using Splatform; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Rendering; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MidgardPlus.Lodge { public static class Budget { public const int NameLength = 24; public const int RefundCeiling = 10; public const int MasterBonus = 5; public const int CoinPerPoint = 100; public const string Off = "off"; public const string BadRank = "rank"; public const string BadSlot = "slot"; public const string OverBudget = "budget"; public const string BadShape = "shape"; public const string BadFamily = "family"; public const string BadMod = "mod"; public const string BadOath = "oath"; public const string OathClash = "oath_clash"; public const string BadTrigger = "trigger"; public const string BadElement = "element"; public const string BadName = "name"; public const string Wait = "wait"; public const string Coin = "coin"; public const string Fight = "fight"; public const string Level = "level"; public const string Trial = "trial"; public const string NeedMaster = "master"; public const string Open = "all"; private static readonly string[] Ring = new string[6] { "styrkr", "hamr", "smid", "odr", "stjorn", "skot" }; public static string FamilyOf(Affinity affinity) { return affinity switch { Affinity.Styrkr => "styrkr", Affinity.Hamr => "hamr", Affinity.Skot => "skot", Affinity.Smid => "smid", Affinity.Stjorn => "stjorn", Affinity.Odr => "odr", _ => "", }; } public static int FamilyPercent(Affinity own, string family) { if (family == "all") { if (own != Affinity.None) { return 100; } return 0; } int num = Array.IndexOf(Ring, family ?? ""); int num2 = Array.IndexOf(Ring, FamilyOf(own)); if (num < 0 || num2 < 0) { return 0; } if (own == Affinity.Odr) { if (!(family == "odr")) { return 90; } return 100; } if (family == "odr") { return 0; } int num3 = Math.Abs(num2 - num); return Math.Min(num3, Ring.Length - num3) switch { 0 => 75, 1 => 100, 2 => 125, _ => 150, }; } public static float FamilyFactor(Affinity own, string family) { return (float)FamilyPercent(own, family) / 100f; } public static int Allowed(int meginLevel) { return 10 + Math.Max(0, Math.Min(100, meginLevel)) / 5; } public static int Slots(int meginLevel) { if (meginLevel >= 70) { return 4; } if (meginLevel >= 45) { return 3; } if (meginLevel >= 20) { return 2; } return (meginLevel >= 1) ? 1 : 0; } public static int OathLimit(Affinity own) { if (own != Affinity.Odr) { return 3; } return 4; } public static int ElementCost(string element, Affinity own) { ElementInfo elementInfo = Catalog.Element(element); if (elementInfo == null) { return 0; } if (own != Affinity.Hamr) { return elementInfo.cost; } return elementInfo.hamr; } public static int ModCost(PowerDef def) { int num = 0; if (def == null || def.mods == null) { return 0; } foreach (PartRank mod in def.mods) { ModInfo modInfo = ((mod != null) ? Catalog.Mod(mod.id) : null); if (modInfo != null) { num += modInfo.cost * Math.Max(1, Math.Min(modInfo.ranks, mod.rank)); } } return num; } public static int Parts(PowerDef def, Affinity own) { if (def == null) { return 0; } ShapeInfo shapeInfo = Catalog.Shape(def.shape); TriggerInfo triggerInfo = Catalog.Trigger(def.trigger); return (shapeInfo?.cost ?? 0) + ElementCost(def.element, own) + (triggerInfo?.cost ?? 0) + ModCost(def); } public static int Gross(PowerDef def, Affinity own) { if (def == null) { return 0; } ShapeInfo shapeInfo = Catalog.Shape(def.shape); int num = ((shapeInfo != null) ? FamilyPercent(own, shapeInfo.family) : 0); if (num <= 0) { num = 100; } return (Parts(def, own) * num + 99) / 100; } public static int OathSum(PowerDef def) { int num = 0; if (def == null || def.oaths == null) { return 0; } foreach (string oath in def.oaths) { OathInfo oathInfo = Catalog.Oath(oath); if (oathInfo != null) { num += oathInfo.refund; } } return num; } public static bool FullOath(PowerDef def) { ShapeInfo shapeInfo = ((def != null) ? Catalog.Shape(def.shape) : null); if (shapeInfo != null && shapeInfo.oath > 0) { return OathSum(def) >= shapeInfo.oath; } return true; } public static float Strength(PowerDef def) { ShapeInfo shapeInfo = ((def != null) ? Catalog.Shape(def.shape) : null); if (shapeInfo == null || FullOath(def)) { return 1f; } return Math.Max(0.1f, Math.Min(1f, shapeInfo.weak)); } public static int RefundCap(PowerDef def, Affinity own) { return Math.Min(Gross(def, own) / 2, 10); } public static int Refund(PowerDef def, Affinity own) { return Math.Min(OathSum(def), RefundCap(def, own)); } public static int Cost(PowerDef def, Affinity own) { return Gross(def, own) - Refund(def, own); } public static bool Check(PowerDef def, Affinity own, int meginLevel, int slotsOpen, out string reason) { return Check(def, own, meginLevel, slotsOpen, 0, out reason); } public static bool Check(PowerDef def, Affinity own, int meginLevel, int slotsOpen, int bonus, out string reason) { reason = Problem(def, own, meginLevel, slotsOpen, bonus); return reason.Length == 0; } public static string Problem(PowerDef def, Affinity own, int meginLevel, int slotsOpen, int bonus) { if (def == null || !Catalog.Ready) { return "slot"; } if (own == Affinity.None || FamilyOf(own).Length == 0 || meginLevel < 1) { return "rank"; } if (def.slot < 0 || def.slot >= Math.Min(slotsOpen, Slots(meginLevel))) { return "slot"; } if (Catalog.Trigger(def.trigger) == null) { return "trigger"; } ShapeInfo shapeInfo = Catalog.Shape(def.shape); if (shapeInfo == null || !shapeInfo.v1) { return "shape"; } if (FamilyPercent(own, shapeInfo.family) <= 0) { return "family"; } if (shapeInfo.master && bonus <= 0) { return "master"; } if (Catalog.Element(def.element) == null) { return "element"; } if (shapeInfo.element == "none" && def.element != "megin") { return "element"; } if (shapeInfo.element == "need" && def.element == "megin") { return "element"; } string text = ModProblem(def, shapeInfo); if (text.Length > 0) { return text; } string text2 = OathProblem(def, shapeInfo, own); if (text2.Length > 0) { return text2; } if ((def.name ?? "") != Clean(def.name)) { return "name"; } if (Cost(def, own) > Allowed(meginLevel) + Math.Max(0, bonus)) { return "budget"; } return ""; } private static string ModProblem(PowerDef def, ShapeInfo shape) { if (def.mods == null) { return ""; } HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal); foreach (PartRank mod in def.mods) { ModInfo modInfo = ((mod != null) ? Catalog.Mod(mod.id) : null); if (modInfo == null || !hashSet.Add(modInfo.id) || !shape.mods.Contains(modInfo.id) || mod.rank < 1 || mod.rank > modInfo.ranks) { return "mod"; } } return ""; } private static string OathProblem(PowerDef def, ShapeInfo shape, Affinity own) { bool flag = false; HashSet<string> hashSet = new HashSet<string>(StringComparer.Ordinal); if (def.oaths != null) { if (def.oaths.Count > OathLimit(own)) { return "oath"; } foreach (string oath in def.oaths) { OathInfo oathInfo = Catalog.Oath(oath); if (oathInfo == null || !hashSet.Add(oathInfo.id) || !Binds(oathInfo, shape, def.trigger)) { return "oath"; } flag |= oathInfo.arg; } foreach (string oath2 in def.oaths) { foreach (string exclude in Catalog.Oath(oath2).excludes) { if (hashSet.Contains(exclude)) { return "oath_clash"; } } } } string text = def.arg ?? ""; if (flag ? (!Catalog.Weapon(text)) : (text.Length > 0)) { return "oath"; } return ""; } public static bool Binds(OathInfo oath, ShapeInfo shape, string trigger) { if (oath == null || shape == null) { return false; } if (oath.needs == "pvp" && !shape.pvp) { return false; } if (oath.needs == "strikes" && !shape.strikes) { return false; } return !oath.triggers.Contains(trigger ?? ""); } public static string Clean(string name) { if (string.IsNullOrEmpty(name)) { return ""; } StringBuilder stringBuilder = new StringBuilder(); bool flag = false; foreach (char c in name) { switch (c) { case '<': flag = true; continue; case '>': flag = false; continue; } if (!flag && !char.IsControl(c) && !char.IsSurrogate(c)) { stringBuilder.Append(c); } } string text = stringBuilder.ToString().Trim(); while (text.Contains(" ")) { text = text.Replace(" ", " "); } if (text.Length <= 24) { return text; } return text.Substring(0, 24).Trim(); } } public sealed class BuilderModule : ILodgeModule { public int Order => 40; public void Init(BaseUnityPlugin plugin) { if (!Catalog.Ready) { Plugin.Log.LogError((object)"The Lodge power catalog could not be read, so no power can be sworn."); } BuilderPanel.Listen(); } public void WorldStart() { } public void WorldEnd() { BuilderPanel.Close(); } } public static class BuilderPanel { private sealed class Driver : MonoBehaviour { private void Update() { Frame(); } private void OnDestroy() { Gone(((Component)this).gameObject); } } [CompilerGenerated] private static class <>O { public static Action<int, bool, string> <0>__OnVerdict; public static Action <1>__NextWeapon; public static UnityAction <2>__Swear; public static UnityAction <3>__Unswear; public static UnityAction <4>__Close; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction<string> <>9__48_0; public static UnityAction <>9__60_2; internal void <Build>b__48_0(string value) { if (_draft != null) { _draft.name = Budget.Clean(value); Paint(); } } internal void <FillOaths>b__60_2() { Pick(NextWeapon); } } private const string Title = "HEITSTRENGING"; private const float Width = 1466f; private const float Height = 808f; private const float AnswerWait = 8f; private static readonly string[] FamilyOrder = new string[7] { "styrkr", "hamr", "skot", "smid", "stjorn", "odr", "all" }; private static readonly int[] SlotLevels = new int[4] { 1, 20, 45, 70 }; private static GameObject _panel; private static RectTransform _tabs; private static RectTransform _triggers; private static RectTransform _shapes; private static RectTransform _points; private static RectTransform _mods; private static RectTransform _oaths; private static RectTransform _buttons; private static Text _head; private static Text _about; private static Text _note; private static Text _cap; private static InputField _name; private static ScrollRect _modScroll; private static ScrollRect _oathScroll; private static int _slot; private static PowerDef _draft; private static bool _waiting; private static float _waitingSince; private static string _message = ""; private static bool _messageBad; private static bool _holding; private static bool _listening; private static MethodInfo _cooldownLeft; private static MethodInfo _blocked; private static bool _casterSought; public static bool IsOpen => (Object)(object)_panel != (Object)null; public static void Open(int slot) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !Lodge.On || (Object)(object)GUIManager.CustomGUIFront == (Object)null || GUIManager.IsHeadless()) { return; } if (Lodge.RankOf(localPlayer) < Rank.Veidimadr || Lodge.AffinityOf(localPlayer) == Affinity.None || Lodge.MeginLevel(localPlayer) < 1) { ((Character)localPlayer).Message((MessageType)2, TextApi.T("lodge_build_need_megin", Array.Empty<object>()), 0, (Sprite)null, false); return; } if (!LodgeNet.Ready) { LodgeNet.SendHello(); ((Character)localPlayer).Message((MessageType)2, TextApi.T("lodge_build_not_ready", Array.Empty<object>()), 0, (Sprite)null, false); return; } Listen(); int num = OpenSlots(localPlayer); _slot = Mathf.Clamp(slot, 0, Mathf.Max(0, num - 1)); if ((Object)(object)_panel == (Object)null) { Build(); } _message = ""; _messageBad = false; _waiting = false; Load(localPlayer); Refresh(); } public static void Close() { if ((Object)(object)_panel != (Object)null) { GameObject panel = _panel; _panel = null; Object.Destroy((Object)(object)panel); } Forget(); Hold(want: false); } internal static void Listen() { if (!_listening) { _listening = true; LodgeNet.Verdict += OnVerdict; } } private static void Gone(GameObject panel) { if ((Object)(object)_panel == (Object)(object)panel || (Object)(object)_panel == (Object)null) { _panel = null; Forget(); Hold(want: false); } } private static void Forget() { PowerPreview.Close(); _tabs = null; _triggers = null; _shapes = null; _points = null; _mods = null; _oaths = null; _buttons = null; _head = null; _about = null; _note = null; _cap = null; _name = null; _modScroll = null; _oathScroll = null; _waiting = false; } private static void Hold(bool want) { if (want != _holding) { _holding = want; GUIManager.BlockInput(want); } } private static int LevelOf(Player player) { return LodgeNet.Level(player); } private static int OpenSlots(Player player) { int cap = ((LodgeSettings.PowerSlots != null) ? LodgeSettings.PowerSlots.Value : 4); return Validation.SlotsOpen(Lodge.State(player), LevelOf(player), cap); } private static int Points(Player player) { int num = LevelOf(player); return Budget.Allowed(num) + Validation.Bonus(Lodge.State(player), _slot, num); } private static PowerDef Copy(PowerDef def) { PowerDef powerDef = Wire.FromJson<PowerDef>(Wire.ToJson(def)); powerDef.mods = powerDef.mods ?? new List<PartRank>(); powerDef.oaths = powerDef.oaths ?? new List<string>(); powerDef.name = powerDef.name ?? ""; powerDef.arg = powerDef.arg ?? ""; return powerDef; } private static void Load(Player player) { PowerDef powerDef = LodgeNet.Find(Lodge.Powers(player), _slot); if (powerDef != null && Catalog.Shape(powerDef.shape) != null) { _draft = Copy(powerDef); _draft.slot = _slot; } else { _draft = Fresh(Lodge.AffinityOf(player)); } Settle(player); if ((Object)(object)_name != (Object)null) { _name.SetTextWithoutNotify(_draft.name); } } private static PowerDef Fresh(Affinity own) { PowerDef powerDef = new PowerDef { slot = _slot }; ShapeInfo shapeInfo = null; foreach (ShapeInfo shape in Catalog.Shapes) { if (shape.v1 && Budget.FamilyPercent(own, shape.family) > 0 && (shapeInfo == null || (shape.family == Budget.FamilyOf(own) && shapeInfo.family != Budget.FamilyOf(own)))) { shapeInfo = shape; } } powerDef.shape = ((shapeInfo != null) ? shapeInfo.id : ""); return powerDef; } private static void Settle(Player player) { ShapeInfo shape = Catalog.Shape(_draft.shape); if (shape == null) { return; } if (Catalog.Trigger(_draft.trigger) == null) { _draft.trigger = "key"; } if (Catalog.Element(_draft.element) == null || shape.element == "none") { _draft.element = "megin"; } if (shape.element == "need" && _draft.element == "megin") { _draft.element = "fire"; } _draft.mods.RemoveAll((PartRank part) => part == null || Catalog.Mod(part.id) == null || !shape.mods.Contains(part.id) || part.rank < 1); foreach (PartRank mod in _draft.mods) { mod.rank = Mathf.Clamp(mod.rank, 1, Catalog.Mod(mod.id).ranks); } HashSet<string> seen = new HashSet<string>(); _draft.oaths.RemoveAll((string id) => !Budget.Binds(Catalog.Oath(id), shape, _draft.trigger) || !seen.Add(id)); int num = Budget.OathLimit(Lodge.AffinityOf(player)); while (_draft.oaths.Count > num) { _draft.oaths.RemoveAt(_draft.oaths.Count - 1); } bool flag = false; foreach (string oath in _draft.oaths) { flag |= Catalog.Oath(oath).arg; } if (!flag) { _draft.arg = ""; } else if (!Catalog.Weapon(_draft.arg)) { _draft.arg = ((Catalog.Weapons.Count > 0) ? Catalog.Weapons[0] : ""); } } private static void Build() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0032: 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_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: 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_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) //IL_03d8: 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_05ba: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05e7: Unknown result type (might be due to invalid IL or missing references) //IL_060a: Unknown result type (might be due to invalid IL or missing references) //IL_0628: Expected O, but got Unknown //IL_0666: Unknown result type (might be due to invalid IL or missing references) //IL_0675: Unknown result type (might be due to invalid IL or missing references) //IL_0684: Unknown result type (might be due to invalid IL or missing references) //IL_0693: 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_06b4: Unknown result type (might be due to invalid IL or missing references) //IL_06d9: 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_06f7: Unknown result type (might be due to invalid IL or missing references) //IL_0706: Unknown result type (might be due to invalid IL or missing references) //IL_0715: Unknown result type (might be due to invalid IL or missing references) //IL_0738: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Expected O, but got Unknown //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_07be: Unknown result type (might be due to invalid IL or missing references) //IL_081c: Unknown result type (might be due to invalid IL or missing references) //IL_082b: Unknown result type (might be due to invalid IL or missing references) //IL_083a: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Unknown result type (might be due to invalid IL or missing references) //IL_0858: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) RectTransform val = (RectTransform)GUIManager.CustomGUIFront.transform; RectTransform val2 = PanelKit.NewRect("MidgardPlusLodgeBuilder", (Transform)(object)val); _panel = ((Component)val2).gameObject; PanelKit.Anchor(val2, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, new Vector2(1466f, 808f)); Rect rect = val.rect; float num = (((Rect)(ref rect)).width - 20f) / 1466f; rect = val.rect; float num2 = Mathf.Min(1f, Mathf.Min(num, (((Rect)(ref rect)).height - 20f) / 808f)); if (num2 > 0.1f && num2 < 1f) { ((Transform)val2).localScale = new Vector3(num2, num2, 1f); } PanelKit.Fill(_panel, PanelKit.Round, PanelKit.Deep); RectTransform obj = PanelKit.NewRect("Glow", (Transform)(object)val2); PanelKit.Stretch(obj, 0f, 0f, 0f, 0f); Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); obj2.sprite = PanelKit.Glow; ((Graphic)obj2).color = PanelKit.Top; ((Graphic)obj2).raycastTarget = false; RectTransform obj3 = PanelKit.NewRect("Border", (Transform)(object)val2); PanelKit.Stretch(obj3, 0f, 0f, 0f, 0f); ((Graphic)PanelKit.Fill(((Component)obj3).gameObject, PanelKit.RingSprite, PanelKit.Edge)).raycastTarget = false; _panel.AddComponent<Driver>(); Hold(want: true); Text obj4 = PanelKit.Label((Transform)(object)val2, "HEITSTRENGING", 32, PanelKit.Gold, (TextAnchor)3, heading: true); obj4.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Anchor(((Graphic)obj4).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(22f, -10f), new Vector2(270f, 40f)); Text obj5 = PanelKit.Label((Transform)(object)val2, TextApi.T("lodge_build_subtitle", Array.Empty<object>()), 14, PanelKit.Muted, (TextAnchor)3, heading: false); obj5.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Anchor(((Graphic)obj5).rectTransform, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(298f, -14f), new Vector2(200f, 36f)); _head = PanelKit.Label((Transform)(object)val2, "", 17, PanelKit.TextColor, (TextAnchor)5, heading: false); _head.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Anchor(((Graphic)_head).rectTransform, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-360f, -12f), new Vector2(230f, 36f)); _tabs = PanelKit.NewRect("Tabs", (Transform)(object)val2); PanelKit.Anchor(_tabs, new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(1f, 1f), new Vector2(-18f, -12f), new Vector2(330f, 36f)); HorizontalLayoutGroup obj6 = ((Component)_tabs).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj6).spacing = 6f; ((HorizontalOrVerticalLayoutGroup)obj6).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj6).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj6).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj6).childForceExpandHeight = true; RectTransform obj7 = PanelKit.NewRect("Hairline", (Transform)(object)val2); PanelKit.Anchor(obj7, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -58f), new Vector2(-20f, 2f)); Image obj8 = ((Component)obj7).gameObject.AddComponent<Image>(); obj8.sprite = PanelKit.Hairline; ((Graphic)obj8).raycastTarget = false; RectTransform obj9 = PanelKit.Column((Transform)(object)Card((Transform)(object)val2, 18f, 70f, 250f, 344f), 4f); PanelKit.Stretch(obj9, 10f, 8f, 10f, 8f); PanelKit.Header((Transform)(object)obj9, TextApi.T("lodge_build_name", Array.Empty<object>())); _name = PanelKit.MakeInput((Transform)(object)obj9, TextApi.T("lodge_build_name_hint", Array.Empty<object>()), "", 24); PanelKit.Sized<InputField>(_name, -1f, 32f, 1f); ((UnityEvent<string>)(object)_name.onValueChanged).AddListener((UnityAction<string>)delegate(string value) { if (_draft != null) { _draft.name = Budget.Clean(value); Paint(); } }); PanelKit.Header((Transform)(object)obj9, TextApi.T("lodge_build_trigger", Array.Empty<object>())); _triggers = PanelKit.Column((Transform)(object)obj9, 3f); _shapes = PanelKit.Column((Transform)(object)Card((Transform)(object)val2, 278f, 70f, 520f, 344f), 3f); PanelKit.Stretch(_shapes, 10f, 8f, 10f, 8f); _points = PanelKit.Column((Transform)(object)Card((Transform)(object)val2, 808f, 70f, 234f, 344f), 2f); PanelKit.Stretch(_points, 12f, 8f, 12f, 8f); RectTransform parent = Card((Transform)(object)val2, 18f, 424f, 510f, 200f); PanelKit.Anchor(((Graphic)PanelKit.Header((Transform)(object)parent, TextApi.T("lodge_build_mods", Array.Empty<object>()))).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -4f), new Vector2(-24f, 28f)); _mods = PanelKit.MakeScroll((Transform)(object)parent, out _modScroll); PanelKit.Stretch((RectTransform)((Component)_modScroll).transform, 6f, 34f, 6f, 6f); RectTransform parent2 = Card((Transform)(object)val2, 538f, 424f, 504f, 200f); PanelKit.Anchor(((Graphic)PanelKit.Header((Transform)(object)parent2, TextApi.T("lodge_build_oaths", Array.Empty<object>()))).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -4f), new Vector2(-24f, 28f)); _cap = PanelKit.Label((Transform)(object)parent2, "", 13, PanelKit.Muted, (TextAnchor)8, heading: false); PanelKit.Anchor(((Graphic)_cap).rectTransform, new Vector2(0f, 1f), new Vector2(1f, 1f), new Vector2(0.5f, 1f), new Vector2(0f, -4f), new Vector2(-28f, 26f)); _oaths = PanelKit.MakeScroll((Transform)(object)parent2, out _oathScroll); PanelKit.Stretch((RectTransform)((Component)_oathScroll).transform, 6f, 34f, 6f, 6f); RectTransform parent3 = Card((Transform)(object)val2, 18f, 634f, 1024f, 116f); _about = PanelKit.Label((Transform)(object)parent3, "", 14, PanelKit.TextColor, (TextAnchor)0, heading: false); _about.verticalOverflow = (VerticalWrapMode)0; PanelKit.Stretch(((Graphic)_about).rectTransform, 12f, 6f, 12f, 22f); _note = PanelKit.Label((Transform)(object)parent3, "", 14, PanelKit.Muted, (TextAnchor)6, heading: false); _note.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Stretch(((Graphic)_note).rectTransform, 12f, 92f, 12f, 4f); _buttons = PanelKit.NewRect("Buttons", (Transform)(object)val2); PanelKit.Anchor(_buttons, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(18f, -758f), new Vector2(1024f, 38f)); HorizontalLayoutGroup obj10 = ((Component)_buttons).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj10).spacing = 10f; ((HorizontalOrVerticalLayoutGroup)obj10).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj10).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj10).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj10).childForceExpandHeight = true; ((LayoutGroup)obj10).childAlignment = (TextAnchor)3; PowerPreview.Build(val2, 1052f, 70f); } private static RectTransform Card(Transform parent, float x, float y, float width, float height) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = PanelKit.Box(parent, x, y, width, height); PanelKit.Fill(((Component)obj).gameObject, PanelKit.Round, PanelKit.PanelColor); return obj; } private static void Refresh() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)_panel == (Object)null) && !((Object)(object)localPlayer == (Object)null) && _draft != null) { Affinity affinity = Lodge.AffinityOf(localPlayer); int meginLevel = LevelOf(localPlayer); int open = OpenSlots(localPlayer); _head.text = "Megin " + meginLevel.ToString(CultureInfo.InvariantCulture) + " " + Progression.AffinityName(affinity) + " " + TextApi.T(Tiers.Key(Tiers.Of(meginLevel)), Array.Empty<object>()); FillTabs(open); FillTriggers(); FillShapes(affinity); FillMods(); FillOaths(affinity); Paint(); } } private static void Paint() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)_panel == (Object)null) && !((Object)(object)localPlayer == (Object)null) && _draft != null) { Affinity own = Lodge.AffinityOf(localPlayer); FillPoints(localPlayer, own); FillAbout(localPlayer, own); FillButtons(localPlayer, own); PowerPreview.Show(_draft, localPlayer, own, _slot); } } private static void Pick(Action change) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !_waiting && _draft != null) { change(); Settle(localPlayer); _message = ""; _messageBad = false; Refresh(); } } private static void FillTabs(int open) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) PanelKit.Clear(_tabs); for (int i = 0; i < 4; i++) { int slot = i; Button val = PanelKit.MakeButton((Transform)(object)_tabs, TextApi.T("lodge_build_slot", new object[1] { i + 1 }), i == _slot, (UnityAction)delegate { Switch(slot); }); if (i >= open) { ((Graphic)((Component)val).GetComponent<PanelKit.Look>().Label).color = PanelKit.Muted; } } } private static void Switch(int slot) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !_waiting) { if (slot >= OpenSlots(localPlayer)) { _message = TextApi.T("lodge_build_slot_locked", new object[2] { slot + 1, SlotLevels[Mathf.Clamp(slot, 0, SlotLevels.Length - 1)] }); _messageBad = true; Paint(); } else { _slot = slot; _message = ""; _messageBad = false; Load(localPlayer); Refresh(); } } } private static void FillTriggers() { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown PanelKit.Clear(_triggers); foreach (TriggerInfo trigger in Catalog.Triggers) { string id = trigger.id; string text = TextApi.T("lodge_trigger_" + id + "_name", Array.Empty<object>()) + ((trigger.cost > 0) ? (" +" + trigger.cost.ToString(CultureInfo.InvariantCulture)) : ""); PanelKit.Sized<Button>(PanelKit.MakeButton((Transform)(object)_triggers, text, _draft.trigger == id, (UnityAction)delegate { Pick(delegate { _draft.trigger = id; }); }), -1f, 28f, 1f); } } private static void FillShapes(Affinity own) { //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031a: Expected O, but got Unknown //IL_0147: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Expected O, but got Unknown PanelKit.Clear(_shapes); PanelKit.Header((Transform)(object)_shapes, TextApi.T("lodge_build_shape", Array.Empty<object>())); string[] familyOrder = FamilyOrder; foreach (string text in familyOrder) { List<ShapeInfo> list = new List<ShapeInfo>(); foreach (ShapeInfo shape in Catalog.Shapes) { if (shape.v1 && shape.family == text) { list.Add(shape); } } if (list.Count == 0) { continue; } int num = Budget.FamilyPercent(own, text); RectTransform parent = PanelKit.Row((Transform)(object)_shapes, 30f); string text2 = ((num > 0) ? ("x" + ((float)num / 100f).ToString("0.##", CultureInfo.InvariantCulture)) : TextApi.T("lodge_build_closed", Array.Empty<object>())); string text3 = ((text == "all") ? TextApi.T("lodge_build_family_all", Array.Empty<object>()) : Progression.AffinityName(AffinityOf(text))); Text obj = PanelKit.Label((Transform)(object)parent, text3 + " " + text2, 14, (text == Budget.FamilyOf(own)) ? PanelKit.Gold : PanelKit.Muted, (TextAnchor)3, heading: false); obj.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Sized<Text>(obj, 108f, -1f, 0f); foreach (ShapeInfo item in list) { string id = item.id; Button obj2 = PanelKit.MakeButton((Transform)(object)parent, TextApi.T("lodge_shape_" + id + "_name", Array.Empty<object>()), _draft.shape == id, (UnityAction)delegate { Pick(delegate { _draft.shape = id; }); }); PanelKit.Sized<Button>(obj2, 0f, -1f, 1f); PanelKit.Usable(obj2, num > 0); } } PanelKit.Header((Transform)(object)_shapes, TextApi.T("lodge_build_element", Array.Empty<object>())); ShapeInfo shapeInfo = Catalog.Shape(_draft.shape); RectTransform parent2 = PanelKit.Row((Transform)(object)_shapes, 30f); foreach (ElementInfo element in Catalog.Elements) { string id2 = element.id; int num2 = Budget.ElementCost(id2, own); string text4 = TextApi.T("lodge_element_" + id2 + "_name", Array.Empty<object>()) + ((num2 > 0) ? (" +" + num2.ToString(CultureInfo.InvariantCulture)) : ""); Button obj3 = PanelKit.MakeButton((Transform)(object)parent2, text4, _draft.element == id2, (UnityAction)delegate { Pick(delegate { _draft.element = id2; }); }); PanelKit.Sized<Button>(obj3, 0f, -1f, 1f); bool usable = shapeInfo != null && (shapeInfo.element == "any" || (shapeInfo.element == "none" && id2 == "megin") || (shapeInfo.element == "need" && id2 != "megin")); PanelKit.Usable(obj3, usable); } } private static Affinity AffinityOf(string family) { for (int i = 1; i <= 6; i++) { if (Budget.FamilyOf((Affinity)i) == family) { return (Affinity)i; } } return Affinity.None; } private static void FillMods() { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00e7: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Expected O, but got Unknown //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) PanelKit.Clear(_mods); ShapeInfo shapeInfo = Catalog.Shape(_draft.shape); if (shapeInfo == null) { return; } foreach (string mod in shapeInfo.mods) { ModInfo modInfo = Catalog.Mod(mod); if (modInfo == null) { continue; } string id = modInfo.id; int num = PowerRules.Rank(_draft, id); RectTransform parent = PanelKit.Row((Transform)(object)_mods, 30f); Text obj = PanelKit.Label((Transform)(object)parent, TextApi.T("lodge_mod_" + id + "_name", Array.Empty<object>()), 15, (num > 0) ? PanelKit.Gold : PanelKit.TextColor, (TextAnchor)3, heading: false); obj.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Sized<Text>(obj, 104f, -1f, 0f); Button obj2 = PanelKit.MakeButton((Transform)(object)parent, "-", active: false, (UnityAction)delegate { Pick(delegate { SetRank(id, PowerRules.Rank(_draft, id) - 1); }); }); PanelKit.Sized<Button>(obj2, 28f, -1f, 0f); PanelKit.Usable(obj2, num > 0); PanelKit.Sized<Text>(PanelKit.Label((Transform)(object)parent, num.ToString(CultureInfo.InvariantCulture), 16, PanelKit.TextColor, (TextAnchor)4, heading: false), 20f, -1f, 0f); Button obj3 = PanelKit.MakeButton((Transform)(object)parent, "+", active: false, (UnityAction)delegate { Pick(delegate { SetRank(id, PowerRules.Rank(_draft, id) + 1); }); }); PanelKit.Sized<Button>(obj3, 28f, -1f, 0f); PanelKit.Usable(obj3, num < modInfo.ranks); string text = ((modInfo.ranks > 1) ? TextApi.T("lodge_build_per_rank", new object[1] { modInfo.cost }) : ("+" + modInfo.cost.ToString(CultureInfo.InvariantCulture))); Text obj4 = PanelKit.Label((Transform)(object)parent, text, 13, PanelKit.Muted, (TextAnchor)3, heading: false); obj4.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Sized<Text>(obj4, 84f, -1f, 0f); Text obj5 = PanelKit.Label((Transform)(object)parent, TextApi.T("lodge_mod_" + id + "_desc", Array.Empty<object>()), 12, PanelKit.Muted, (TextAnchor)3, heading: false); obj5.verticalOverflow = (VerticalWrapMode)0; PanelKit.Sized<Text>(obj5, 0f, -1f, 1f); } } private static void SetRank(string id, int rank) { ModInfo modInfo = Catalog.Mod(id); if (modInfo != null) { rank = Mathf.Clamp(rank, 0, modInfo.ranks); _draft.mods.RemoveAll((PartRank part) => part == null || part.id == id); if (rank > 0) { _draft.mods.Add(new PartRank { id = id, rank = rank }); } } } private static void FillOaths(Affinity own) { //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Expected O, but got Unknown PanelKit.Clear(_oaths); ShapeInfo shapeInfo = Catalog.Shape(_draft.shape); if (shapeInfo == null) { return; } int num = Budget.OathLimit(own); foreach (OathInfo oath in Catalog.Oaths) { string id = oath.id; bool flag = _draft.oaths.Contains(id); bool flag2 = Budget.Binds(oath, shapeInfo, _draft.trigger); bool flag3 = false; foreach (string exclude in oath.excludes) { flag3 |= _draft.oaths.Contains(exclude); } RectTransform parent = PanelKit.Row((Transform)(object)_oaths, 52f); Button obj = PanelKit.MakeButton((Transform)(object)parent, flag ? "x" : "", flag, (UnityAction)delegate { Pick(delegate { if (!_draft.oaths.Remove(id)) { _draft.oaths.Add(id); } }); }); PanelKit.Sized<Button>(obj, 30f, -1f, 0f); PanelKit.Usable(obj, flag || (flag2 && !flag3 && _draft.oaths.Count < num)); RectTransform obj2 = PanelKit.Column((Transform)(object)parent, 0f); PanelKit.Sized<RectTransform>(obj2, 0f, -1f, 1f); bool flag4 = flag || (flag2 && !flag3); Text obj3 = PanelKit.Label((Transform)(object)obj2, TextApi.T("lodge_oath_" + id + "_name", Array.Empty<object>()), 15, flag ? PanelKit.Gold : (flag4 ? PanelKit.TextColor : PanelKit.Muted), (TextAnchor)6, heading: false); obj3.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Sized<Text>(obj3, -1f, 20f, 1f); Text obj4 = PanelKit.Label((Transform)(object)obj2, TextApi.T("lodge_oath_" + id + "_desc", Array.Empty<object>()), 12, PanelKit.Muted, (TextAnchor)0, heading: false); obj4.verticalOverflow = (VerticalWrapMode)0; PanelKit.Sized<Text>(obj4, -1f, 30f, 1f); if (flag && oath.arg) { string text = (Catalog.Weapon(_draft.arg) ? TextApi.T("lodge_weapon_" + _draft.arg, Array.Empty<object>()) : ""); string text2 = TextApi.T("lodge_build_weapon", new object[1] { text }); object obj5 = <>c.<>9__60_2; if (obj5 == null) { UnityAction val = delegate { Pick(NextWeapon); }; <>c.<>9__60_2 = val; obj5 = (object)val; } PanelKit.Sized<Button>(PanelKit.MakeButton((Transform)(object)parent, text2, active: false, (UnityAction)obj5), 150f, -1f, 0f); } PanelKit.Sized<Text>(PanelKit.Label((Transform)(object)parent, oath.refund.ToString(CultureInfo.InvariantCulture), 16, flag ? PanelKit.Gold : PanelKit.Muted, (TextAnchor)4, heading: false), 26f, -1f, 0f); } } private static void NextWeapon() { IReadOnlyList<string> weapons = Catalog.Weapons; if (weapons.Count == 0) { return; } int num = 0; for (int i = 0; i < weapons.Count; i++) { if (weapons[i] == _draft.arg) { num = i + 1; } } _draft.arg = weapons[num % weapons.Count]; } private static void PointRow(string label, string value, Color color, int size) { //IL_0015: 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) RectTransform parent = PanelKit.Row((Transform)(object)_points, (float)size + 10f); Text obj = PanelKit.Label((Transform)(object)parent, label, size, color, (TextAnchor)3, heading: false); obj.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Sized<Text>(obj, 0f, -1f, 1f); Text obj2 = PanelKit.Label((Transform)(object)parent, value, size, color, (TextAnchor)5, heading: false); obj2.horizontalOverflow = (HorizontalWrapMode)1; PanelKit.Sized<Text>(obj2, 70f, -1f, 0f); } private static string Whole(int value) { return value.ToString(CultureInfo.InvariantCulture); } private static void FillPoints(Player player, Affinity own) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0233: 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) PanelKit.Clear(_points); PanelKit.Header((Transform)(object)_points, TextApi.T("lodge_build_points", Array.Empty<object>())); ShapeInfo shapeInfo = Catalog.Shape(_draft.shape); TriggerInfo triggerInfo = Catalog.Trigger(_draft.trigger); int num = ((shapeInfo != null) ? Budget.FamilyPercent(own, shapeInfo.family) : 100); int value = Budget.Gross(_draft, own); int num2 = Budget.Refund(_draft, own); int num3 = Budget.Cost(_draft, own); int num4 = Points(player); PointRow(TextApi.T("lodge_build_shape", Array.Empty<object>()), Whole(shapeInfo?.cost ?? 0), PanelKit.TextColor, 15); PointRow(TextApi.T("lodge_build_element", Array.Empty<object>()), Whole(Budget.ElementCost(_draft.element, own)), PanelKit.TextColor, 15); PointRow(TextApi.T("lodge_build_trigger", Array.Empty<object>()), Whole(triggerInfo?.cost ?? 0), PanelKit.TextColor, 15); PointRow(TextApi.T("lodge_build_mods", Array.Empty<object>()), Whole(Budget.ModCost(_draft)), PanelKit.TextColor, 15); PointRow(TextApi.T("lodge_build_affinity", Array.Empty<object>()) + " x" + ((float)num / 100f).ToString("0.##", CultureInfo.InvariantCulture), "= " + Whole(value), PanelKit.Muted, 15); PointRow(TextApi.T("lodge_build_oaths_short", Array.Empty<object>()), (num2 > 0) ? ("-" + Whole(num2)) : "0", PanelKit.TextColor, 15); RectTransform obj = PanelKit.NewRect("Rule", (Transform)(object)_points); Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); obj2.sprite = PanelKit.Hairline; ((Graphic)obj2).raycastTarget = false; PanelKit.Sized<RectTransform>(obj, -1f, 2f, 1f); bool flag = num3 > num4; PointRow(TextApi.T("lodge_build_cost", Array.Empty<object>()), Whole(num3) + " / " + Whole(num4), flag ? PanelKit.Warn : PanelKit.Gold, 22); if (flag) { PanelKit.Sized<Text>(PanelKit.Label((Transform)(object)_points, TextApi.T("lodge_build_over", new object[1] { num3 - num4 }), 13, PanelKit.Warn, (TextAnchor)0, heading: false), -1f, 20f, 1f); } if ((Object)(object)_cap != (Object)null) { _cap.text = TextApi.T("lodge_build_refund_cap", new object[1] { Budget.RefundCap(_draft, own) }); } } private static string Number(float value) { return value.ToString((Mathf.Abs(value - Mathf.Round(value)) < 0.05f) ? "0" : "0.#", CultureInfo.InvariantCulture); } private static void FillAbout(Player player, Affinity own) { ShapeInfo shapeInfo = Catalog.Shape(_draft.shape); if (shapeInfo == null) { _about.text = ""; return; } int num = LevelOf(player); LodgeState lodgeState = Lodge.State(player); int num2 = Validation.MasteryRank(lodgeState, _draft, num); Built built = PowerRules.Resolve(_draft, own, num, num2); List<string> list = new List<string>(); list.Add(TextApi.T("lodge_build_stats", new object[2] { Number(built.MeginCost), Number(built.Cooldown) })); List<string> list2 = list; if (built.Damage > 0f) { int num3 = built.Count * ((!built.Twin) ? 1 : 2); list2.Add((num3 > 1) ? TextApi.T("lodge_build_damage_each", new object[2] { Number(built.Damage), num3 }) : TextApi.T("lodge_build_damage", new object[1] { Number(built.Damage) })); } if (built.Range > 0f) { list2.Add(TextApi.T("lodge_build_range", new object[1] { Number(built.Range) })); } if (built.Radius > 0f) { list2.Add(TextApi.T("lodge_build_radius", new object[1] { Number(built.Radius) })); } if (built.Time > 0f) { list2.Add(TextApi.T("lodge_build_time", new object[1] { Number(built.Time) })); } string text = TextApi.T("lodge_build_unbound", Array.Empty<object>()); if (_draft.oaths.Count > 0) { List<string> list3 = new List<string>(); foreach (string oath in _draft.oaths) { string text2 = TextApi.T("lodge_oath_" + oath + "_name", Array.Empty<object>()); OathInfo oathInfo = Catalog.Oath(oath); if (oathInfo != null && oathInfo.arg && Catalog.Weapon(_draft.arg)) { text2 = text2 + " (" + TextApi.T("lodge_weapon_" + _draft.arg, Array.Empty<object>()) + ")"; } list3.Add(text2); } text = TextApi.T("lodge_build_bound", new object[1] { string.Join(", ", list3.ToArray()) }); } int familyPercent = Budget.FamilyPercent(own, shapeInfo.family); bool flag = Validation.Bonus(lodgeState, _slot, num) > 0; int num4 = Growth.MasteryCap(lodgeState.rank); int num5 = Validation.MasteryUses(lodgeState, _draft); string text3; if (num2 >= num4 || num2 >= Growth.MasterySteps.Count) { text3 = ((num2 > 0) ? TextApi.T("lodge_build_mastery_top", new object[2] { TextApi.T("lodge_mastery_rank_" + num2, Array.Empty<object>()), num2 }) : TextApi.T("lodge_build_mastery_shut", Array.Empty<object>())); } else { int num6 = MasteryRules.Need(num2 + 1, familyPercent, flag); text3 = ((num2 > 0) ? TextApi.T("lodge_build_mastery", new object[4] { TextApi.T("lodge_mastery_rank_" + num2, Array.Empty<object>()), num2, num5, num6 }) : TextApi.T("lodge_build_mastery_none", new object[2] { num5, num6 })); } if (num2 > 0) { text3 = text3 + " " + TextApi.T("lodge_build_mastery_bonus", new object[3] { Percent(1f - MasteryRules.CostFactor(num2)), Percent(1f - MasteryRules.CooldownFactor(num2)), Percent(MasteryRules.ReachFactor(num2) - 1f) }); } if (flag) { text3 = text3 + " " + TextApi.T("lodge_build_masterwork", Array.Empty<object>()); } if (shapeInfo.oath > 0) { int num7 = Budget.OathSum(_draft); text3 = text3 + " " + (Budget.FullOath(_draft) ? TextApi.T("lodge_build_oath_full", new object[2] { num7, shapeInfo.oath }) : TextApi.T("lodge_build_oath_weak", new object[3] { num7, shapeInfo.oath, Percent(shapeInfo.weak) })); } _about.text = TextApi.T("lodge_shape_" + shapeInfo.id + "_desc", Array.Empty<object>()) + " " + TextApi.T("lodge_element_" + _draft.element + "_name", Array.Empty<object>()) + ": " + TextApi.T("lodge_element_" + _draft.element + "_desc", Array.Empty<object>()) + "\n" + string.Join(". ", list2.ToArray()) + ". " + text + "\n" + text3; } private static string Percent(float share) { return Mathf.RoundToInt(share * 100f).ToString(CultureInfo.InvariantCulture); } private static string Reason(string code) { return TextApi.T("lodge_reason_" + (string.IsNullOrEmpty(code) ? "off" : code), Array.Empty<object>()); } private static int Fee(Player player, Affinity own, PowerDef held) { if ((Lodge.State(player).paidSlots & (1 << _slot)) == 0 || (held != null && LodgeNet.Approved(_slot) && Validation.Hash(held) == Validation.Hash(_draft))) { return 0; } return Budget.Cost(_draft, own) * 100; } private static void FillButtons(Player player, Affinity own) { //IL_0100: 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_010b: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03b9: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) PanelKit.Clear(_buttons); PowerDef powerDef = LodgeNet.Find(Lodge.Powers(player), _slot); int num = LevelOf(player); string text = Budget.Problem(_draft, own, num, OpenSlots(player), Validation.Bonus(Lodge.State(player), _slot, num)); int num2 = Fee(player, own, powerDef); int num3 = LodgeNet.Coins(player); bool flag = powerDef != null && LodgeNet.Approved(_slot) && Validation.Hash(powerDef) == Validation.Hash(_draft) && (powerDef.name ?? "") == (_draft.name ?? ""); if (text.Length == 0 && num3 < num2) { text = "coin"; } RectTransform buttons = _buttons; string text2 = ((num2 > 0) ? TextApi.T("lodge_build_swear_fee", new object[1] { num2 }) : TextApi.T("lodge_build_swear_free", Array.Empty<object>())); object obj = <>O.<2>__Swear; if (obj == null) { UnityAction val = Swear; <>O.<2>__Swear = val; obj = (object)val; } Button val2 = PanelKit.MakeButton((Transform)(object)buttons, text2, active: true, (UnityAction)obj); PanelKit.Sized<Button>(val2, 280f, -1f, 0f); PanelKit.Usable(val2, !_waiting && !flag && text.Length == 0); RectTransform buttons2 = _buttons; string text3 = TextApi.T("lodge_build_unswear", Array.Empty<object>()); object obj2 = <>O.<3>__Unswear; if (obj2 == null) { UnityAction val3 = Unswear; <>O.<3>__Unswear = val3; obj2 = (object)val3; } Button obj3 = PanelKit.MakeButton((Transform)(object)buttons2, text3, active: false, (UnityAction)obj2); PanelKit.Sized<Button>(obj3, 200f, -1f, 0f); PanelKit.Usable(obj3, !_waiting && powerDef != null); PanelKit.Sized<Text>(PanelKit.Label((Transform)(object)_buttons, TextApi.T("lodge_build_coins", new object[1] { num3 }), 14, PanelKit.Muted, (TextAnchor)4, heading: false), 0f, -1f, 1f); RectTransform buttons3 = _buttons; string text4 = TextApi.T("lodge_build_back", Array.Empty<object>()); object obj4 = <>O.<4>__Close; if (obj4 == null) { UnityAction val4 = Close; <>O.<4>__Close = val4; obj4 = (object)val4; } Button val5 = PanelKit.MakeButton((Transform)(object)buttons3, text4, active: false, (UnityAction)obj4); PanelKit.Sized<Button>(val5, 130f, -1f, 0f); if (ZInput.IsGamepadActive() && (Object)(object)EventSystem.current != (Object)null && (Object)(object)EventSystem.current.currentSelectedGameObject == (Object)null) { EventSystem.current.SetSelectedGameObject(((Selectable)val2).interactable ? ((Component)val2).gameObject : ((Component)val5).gameObject); } Color color = PanelKit.Muted; string text5; if (_waiting) { text5 = TextApi.T("lodge_build_waiting", Array.Empty<object>()); } else if (_message.Length > 0) { text5 = _message; color = (_messageBad ? PanelKit.Warn : PanelKit.Gold); } else if (text.Length > 0) { text5 = Reason(text); color = PanelKit.Warn; } else if (powerDef == null) { text5 = TextApi.T("lodge_build_status_empty", Array.Empty<object>()) + " " + TextApi.T("lodge_build_first_free", Array.Empty<object>()); } else if (!flag) { text5 = TextApi.T("lodge_build_status_draft", Array.Empty<object>()) + " " + TextApi.T("lodge_build_first_free", Array.Empty<object>()); if (Validation.MasteryUses(Lodge.State(player), powerDef) > 0 && Validation.Hash(powerDef) != Validation.Hash(_draft)) { text5 = text5 + " " + TextApi.T("lodge_build_mastery_lost", Array.Empty<object>()); color = PanelKit.Warn; } } else { text5 = TextApi.T("lodge_build_status_sworn", Array.Empty<object>()) + CasterNote(); color = PanelKit.Gold; } if (!_waiting && _message.Length == 0 && powerDef != null && !LodgeNet.Approved(_slot) && LodgeNet.Refusal(_slot).Length > 0) { text5 = TextApi.T("lodge_build_status_refused", new object[1] { Reason(LodgeNet.Refusal(_slot)) }); color = PanelKit.Warn; } _note.text = text5; ((Graphic)_note).color = color; } private static string CasterNote() { if (!_casterSought) { _casterSought = true; Type type = typeof(BuilderPanel).Assembly.GetType("MidgardPlus.Lodge.Caster"); if (type != null) { BindingFlags bindingAttr = BindingFlags.Static | BindingFlags.Public; _cooldownLeft = type.GetMethod("CooldownLeft", bindingAttr, null, new Type[1] { typeof(int) }, null); _blocked = type.GetMethod("Blocked", bindingAttr, null, new Type[1] { typeof(int) }, null); } } try { string text = ((_blocked != null) ? (_blocked.Invoke(null, new object[1] { _slot }) as string) : ""); if (!string.IsNullOrEmpty(text) && Catalog.Oath(text) != null) { return " " + TextApi.T("lodge_build_blocked", new object[1] { TextApi.T("lodge_oath_" + text + "_name", Array.Empty<object>()) }); } float num = ((_cooldownLeft != null) ? Convert.ToSingle(_cooldownLeft.Invoke(null, new object[1] { _slot }), CultureInfo.InvariantCulture) : 0f); if (num > 0.5f) { return " " + TextApi.T("lodge_build_cooldown", new object[1] { Mathf.CeilToInt(num) }); } } catch (Exception) { _blocked = null; _cooldownLeft = null; } return ""; } private static void Swear() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !_waiting && _draft != null) { PowerDef powerDef = Copy(_draft); powerDef.slot = _slot; powerDef.name = Budget.Clean(powerDef.name); powerDef.cost = Budget.Cost(powerDef, Lodge.AffinityOf(localPlayer)); Send(powerDef); } } private static void Unswear() { if (!((Object)(object)Player.m_localPlayer == (Object)null) && !_waiting) { Send(new PowerDef { slot = _slot, shape = "" }); } } private static void Send(PowerDef def) { _waiting = true; _waitingSince = Time.unscaledTime; _message = ""; _messageBad = false; LodgeNet.SendSubmit(def); Paint(); } private static void OnVerdict(int slot, bool ok, string reason) { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)_panel == (Object)null) && !((Object)(object)localPlayer == (Object)null) && slot == _slot) { _waiting = false; if (ok) { _message = TextApi.T((LodgeNet.Find(Lodge.Powers(localPlayer), _slot) == null) ? "lodge_build_unsworn" : "lodge_build_sworn", Array.Empty<object>()); _messageBad = false; Load(localPlayer); } else { _message = TextApi.T("lodge_build_refused", new object[1] { Reason(reason) }); _messageBad = true; } Refresh(); } } private static void Frame() { if ((Object)(object)_panel == (Object)null) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || !Lodge.On || (Object)(object)ZNet.instance == (Object)null) { Close(); return; } if (_waiting && Time.unscaledTime - _waitingSince > 8f) { _waiting = false; _message = TextApi.T("lodge_build_no_answer", Array.Empty<object>()); _messageBad = true; Paint(); } bool flag = (Object)(object)_name != (Object)null && _name.isFocused; if (Input.GetKeyDown((KeyCode)27) || (!flag && ZInput.GetButtonDown("JoyButtonB"))) { Close(); } } } [Serializable] public sealed class TriggerInfo { public string id = ""; public int cost; } [Serializable] public sealed class ElementInfo { public string id = ""; public int cost; public int hamr; public string type = "Blunt"; } [Serializable] public sealed class ShapeInfo { public string id = ""; public string family = ""; public string kind = ""; public int cost; public float megin; public float cooldown; public float coef; public int count = 1; public float spread; public float speed; public float range; public float radius; public float time; public float amount; public float tick; public float push; public string aim = "aim"; public bool v1; public bool pvp; public bool strikes; public string element = "any"; public List<string> mods = new List<string>(); public bool master; public int oath; public float weak = 1f; public float hold; public float full; public string pose = ""; public float tall; } [Serializable] public sealed class ModInfo { public string id = ""; public int cost; public int ranks = 1; public float per; public float alt; public List<string> kinds = new List<string>(); } [Serializable] public sealed class OathInfo { public string id = ""; public int refund; public List<string> excludes = new List<string>(); public string needs = ""; public List<string> triggers = new List<string>(); public bool arg; } public static class Catalog { public const string Resource = "MidgardPlusLodge.Data.catalog.json"; public const string Plain = "megin"; private static readonly object Gate = new object(); private static bool _loaded; private static int _version; private static readonly List<TriggerInfo> TriggerList = new List<TriggerInfo>(); private static readonly List<ElementInfo> ElementList = new List<ElementInfo>(); private static readonly List<ShapeInfo> ShapeList = new List<ShapeInfo>(); private static readonly List<ModInfo> ModList = new List<ModInfo>(); private static readonly List<OathInfo> OathList = new List<OathInfo>(); private static readonly List<string> WeaponList = new List<string>(); private static readonly Dictionary<string, TriggerInfo> TriggerMap = new Dictionary<string, TriggerInfo>(StringComparer.Ordinal); private static readonly Dictionary<string, ElementInfo> ElementMap = new Dictionary<string, ElementInfo>(StringComparer.Ordinal); private static readonly Dictionary<string, ShapeInfo> ShapeMap = new Dictionary<string, ShapeInfo>(StringComparer.Ordinal); private static readonly Dictionary<string, ModInfo> ModMap = new Dictionary<string, ModInfo>(StringComparer.Ordinal); private static readonly Dictionary<string, OathInfo> OathMap = new Dictionary<string, OathInfo>(StringComparer.Ordinal); public static int Version { get { Ensure(); return _version; } } public static bool Ready { get { Ensure(); return ShapeList.Count > 0; } } public static IReadOnlyList<ShapeInfo> Shapes { get { Ensure(); return ShapeList; } } public static IReadOnlyList<TriggerInfo> Triggers { get { Ensure(); return TriggerList; } } public static IReadOnlyList<ElementInfo> Elements { get { Ensure(); return ElementList; } } public static IReadOnlyList<ModInfo> Mods { get { Ensure(); return ModList; } } public static IReadOnlyList<OathInfo> Oaths { get { Ensure(); return OathList; } } public static IReadOnlyList<string> Weapons { get { Ensure(); return WeaponList; } } public static ShapeInfo Shape(string id) { Ensure(); if (id == null || !ShapeMap.TryGetValue(id, out var value)) { return null; } return value; } public static TriggerInfo Trigger(string id) { Ensure(); if (id == null || !TriggerMap.TryGetValue(id, out var value)) { return null; } return value; } public static ElementInfo Element(string id) { Ensure(); if (id == null || !ElementMap.TryGetValue(id, out var value)) { return null; } return value; } public static ModInfo Mod(string id) { Ensure(); if (id == null || !ModMap.TryGetValue(id, out var value)) { return null; } return value; } public static OathInfo Oath(string id) { Ensure(); if (id == null || !OathMap.TryGetValue(id, out var value)) { return null; } return value; } public static bool Weapon(string skill) { Ensure(); if (skill != null) { return WeaponList.Contains(skill); } return false; } public static bool Load(string json) { Dictionary<string, object> dictionary = MiniJson.Map(MiniJson.Parse(json)); if (dictionary == null) { return false; } lock (Gate) { Clear(); _version = MiniJson.Whole(dictionary, "v", 0); foreach (object item in MiniJson.Rows(dictionary, "triggers")) { Dictionary<string, object> map = MiniJson.Map(item); TriggerInfo triggerInfo = new TriggerInfo { id = MiniJson.Text(map, "id", ""), cost = MiniJson.Whole(map, "cost", 0) }; if (triggerInfo.id.Length > 0 && !TriggerMap.ContainsKey(triggerInfo.id)) { TriggerList.Add(triggerInfo); TriggerMap[triggerInfo.id] = triggerInfo; } } foreach (object item2 in MiniJson.Rows(dictionary, "elements")) { Dictionary<string, object> map2 = MiniJson.Map(item2); ElementInfo elementInfo = new ElementInfo { id = MiniJson.Text(map2, "id", ""), cost = MiniJson.Whole(map2, "cost", 0), type = MiniJson.Text(map2, "type", "Blunt") }; elementInfo.hamr = MiniJson.Whole(map2, "hamr", elementInfo.cost); if (elementInfo.id.Length > 0 && !ElementMap.ContainsKey(elementInfo.id)) { ElementList.Add(elementInfo); ElementMap[elementInfo.id] = elementInfo; } } foreach (object item3 in MiniJson.Rows(dictionary, "shapes")) { Dictionary<string, object> map3 = MiniJson.Map(item3); ShapeInfo shapeInfo = new ShapeInfo { id = MiniJson.Text(map3, "id", ""), family = MiniJson.Text(map3, "family", ""), kind = MiniJson.Text(map3, "kind", ""), cost = MiniJson.Whole(map3, "cost", 0), megin = MiniJson.Number(map3, "megin", 0f), cooldown = MiniJson.Number(map3, "cooldown", 0f), coef = MiniJson.Number(map3, "coef", 0f), count = MiniJson.Whole(map3, "count", 1), spread = MiniJson.Number(map3, "spread", 0f), speed = MiniJson.Number(map3, "speed", 0f), range = MiniJson.Number(map3, "range", 0f), radius = MiniJson.Number(map3, "radius", 0f), time = MiniJson.Number(map3, "time", 0f), amount = MiniJson.Number(map3, "amount", 0f), tick = MiniJson.Number(map3, "tick", 0f), push = MiniJson.Number(map3, "push", 0f), aim = MiniJson.Text(map3, "aim", "aim"), v1 = MiniJson.Flag(map3, "v1", fallback: false), pvp = MiniJson.Flag(map3, "pvp", fallback: false), strikes = MiniJson.Flag(map3, "strikes", fallback: false), element = MiniJson.Text(map3, "element", "any"), mods = MiniJson.Texts(map3, "mods"), master = MiniJson.Flag(map3, "master", fallback: false), oath = MiniJson.Whole(map3, "oath", 0), weak = MiniJson.Number(map3, "weak", 1f), hold = MiniJson.Number(map3, "hold", 0f), full = MiniJson.Number(map3, "full", 0f), pose = MiniJson.Text(map3, "pose", ""), tall = MiniJson.Number(map3, "tall", 0f) }; if (shapeInfo.id.Length > 0 && !ShapeMap.ContainsKey(shapeInfo.id)) { ShapeList.Add(shapeInfo); ShapeMap[shapeInfo.id] = shapeInfo; } } foreach (object item4 in MiniJson.Rows(dictionary, "mods")) { Dictionary<string, object> map4 = MiniJson.Map(item4); ModInfo modInfo = new ModInfo { id = MiniJson.Text(map4, "id", ""), cost = MiniJson.Whole(map4, "cost", 0), ranks = MiniJson.Whole(map4, "ranks", 1), per = MiniJson.Number(map4, "per", 0f), alt = MiniJson.Number(map4, "alt", 0f), kinds = MiniJson.Texts(map4, "kinds") }; if (modInfo.id.Length > 0 && !ModMap.ContainsKey(modInfo.id)) { ModList.Add(modInfo); ModMap[modInfo.id] = modInfo; } } foreach (object item5 in MiniJson.Rows(dictionary, "oaths")) { Dictionary<string, object> map5 = MiniJson.Map(item5); OathInfo oathInfo = new OathInfo { id = MiniJson.Text(map5, "id", ""), refund = MiniJson.Whole(map5, "refund", 0), excludes = MiniJson.Texts(map5, "excludes"), needs = MiniJson.Text(map5, "needs", ""), triggers = MiniJson.Texts(map5, "triggers"), arg = MiniJson.Flag(map5, "arg", fallback: false) }; if (oathInfo.id.Length > 0 && !OathMap.ContainsKey(oathInfo.id)) { OathList.Add(oathInfo); OathMap[oathInfo.id] = oathInfo; } } WeaponList.AddRange(MiniJson.Texts(dictionary, "weapons")); _loaded = true; return ShapeList.Count > 0; } } private static void Clear() { TriggerList.Clear(); ElementList.Clear(); ShapeList.Clear(); ModList.Clear(); OathList.Clear(); WeaponList.Clear(); TriggerMap.Clear(); ElementMap.Clear(); ShapeMap.Clear(); ModMap.Clear(); OathMap.Clear(); } private static void Ensure() { if (_loaded) { return; } lock (Gate) { if (_loaded) { return; } _loaded = true; string text = null; try { using Stream stream = typeof(Catalog).Assembly.GetManifestResourceStream("MidgardPlusLodge.Data.catalog.json"); if (stream != null) { using StreamReader streamReader = new StreamReader(stream, Encoding.UTF8); text = streamReader.ReadToEnd(); } } catch (IOException) { } if (text != null) { Load(text); } } } } internal static class MiniJson { private const string Digits = "+-0123456789.eE"; internal static object Parse(string text) { if (string.IsNullOrEmpty(text)) { return null; } int at = 0; try { object obj = Value(text, ref at, 0); Blank(text, ref at); return (at == text.Length) ? obj : null; } catch (FormatException) { return null; } catch (IndexOutOfRangeException) { return null; } catch (ArgumentOutOfRangeException) { return null; } catch (OverflowException) { return null; } } internal static Dictionary<string, object> Map(object value) { return value as Dictionary<string, object>; } internal static List<object> Rows(Dictionary<string, object> map, string key) { if (map != null && map.TryGetValue(key, out var value) && value is List<object> result) { return result; } return new List<object>(); } internal static string Text(Dictionary<string, object> map, string key, string fallback) { if (map != null && map.TryGetValue(key, out var value) && value is string result) { return result; } return fallback; } internal static float Number(Dictionary<string, object> map, string key, float fallback) { if (map != null && map.TryGetValue(key, out var value) && value is double num) { return (float)num; } return fallback; } internal static int Whole(Dictionary<string, object> map, string key, int fallback) { if (map != null && map.TryGetValue(key, out var value) && value is double a) { return (int)Math.Round(a); } return fallback; } internal static bool Flag(Dictionary<string, object> map, string key, bool fallback) { if (map != null && map.TryGetValue(key, out var value) && value is bool) { return (bool)value; } return fallback; } internal static List<string> Texts(Dictionary<string, object> map, string key) { List<string> list = new List<string>(); foreach (object item2 in Rows(map, key)) { if (item2 is string item) { list.Add(item); } } return list; } private static void Blank(string text, ref int at) { while (at < text.Length && char.IsWhiteSpace(text[at])) { at++; } } private static object Value(string text, ref int at, int depth) { if (depth > 32) { throw new FormatException(); } Blank(text, ref at); if (at >= text.Length) { throw new FormatException(); } switch (text[at]) { case '{': return Object(text, ref at, depth); case '[': return Array(text, ref at, depth); case '"': return String(text, ref at); default: { if (Word(text, ref at, "true")) { return true; } if (Word(text, ref at, "false")) { return false; } if (Word(text, ref at, "null")) { return null; } int num = at; while (at < text.Length && "+-0123456789.eE".IndexOf(text[at]) >= 0) { at++; } if (at == num) { throw new FormatException(); } return double.Parse(text.Substring(num, at - num), NumberStyles.Float, CultureInfo.InvariantCulture); } } } private static bool Word(string text, ref int at, string word) { if (string.CompareOrdinal(text, at, word, 0, word.Length) != 0) { return false; } at += word.Length; return true; } private static Dictionary<string, object> Object(string text, ref int at, int depth) { Dictionary<string, object> dictionary = new Dictionary<string, object>(StringComparer.Ordinal); at++; Blank(text, ref at); if (text[at] == '}') { at++; return dictionary; } while (true) { Blank(text, ref at); if (text[at] != '"') { throw new FormatException(); } string key = String(text, ref at); Blank(text, ref at); if (text[at] != ':') { throw new FormatException(); } at++; dictionary[key] = Value(text, ref at, depth + 1); Blank(text, ref at); if (text[at] != ',') { break; } at++; } if (text[at] == '}') { at++; return dictionary; } throw new FormatException(); } private static List<object> Array(string text, ref int at, int depth) { List<object> list = new List<object>(); at++; Blank(text, ref at); if (text[at] == ']') { at++; return list; } while (true) { list.Add(Value(text, ref at, depth + 1)); Blank(text, ref at); if (text[at] != ',') { break; } at++; } if (text[at] == ']') { at++; return list; } throw new FormatException(); } private static string String(string text, ref int at) { StringBuilder stringBuilder = new StringBuilder(); at++; while (true) { char c = text[at++]; switch (c) { case '"': return stringBuilder.ToString(); default: stringBuilder.Append(c); break; case '\\': { char c2 = text[at++]; switch (c2) { case 'n': stringBuilder.Append('\n'); break; case 't': stringBuilder.Append('\t'); break; case 'r': stringBuilder.Append('\r'); break; case 'b': stringBuilder.Append('\b'); break; case 'f': stringBuilder.Append('\f'); break; case 'u': stringBuilder.Append((char)int.Parse(text.Substring(at, 4), NumberStyles.HexNumber, CultureInfo.InvariantCulture)); at += 4; break; default: stringBuilder.Append(c2); break; } break; } } } } } internal static class PanelKit { internal sealed class Look : MonoBehaviour { public Text Label; public bool Active; public void Paint() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Label != (Object)null) { Button component = ((Component)this).GetComponent<Button>(); bool flag = (Object)(object)component == (Object)null || ((Selectable)component).interactable; ((Graphic)Label).color = ((!flag) ? Muted : (Active ? Dark : TextColor)); } } } [CompilerGenerated] private static class <>O { public static UnityAction <0>__Unfocus; } internal static readonly Color Deep = Color32.op_Implicit(new Color32((byte)18, (byte)10, (byte)24, byte.MaxValue)); internal static readonly Color Top = Color32.op_Implicit(new Color32((byte)29, (byte)16, (byte)36, byte.MaxValue)); internal static readonly Color PanelColor = Color32.op_Implicit(new Color32((byte)34, (byte)19, (byte)43, byte.MaxValue)); internal static readonly Color Card = Color32.op_Implicit(new Color32((byte)42, (byte)24, (byte)52, byte.MaxValue)); internal static readonly Color CardLit = Color32.op_Implicit(new Color32((byte)52, (byte)31, (byte)64, byte.MaxValue)); internal static readonly Color Gold = Color32.op_Implicit(new Color32((byte)217, (byte)164, (byte)65, byte.MaxValue)); internal static readonly Color GoldLit = Color32.op_Implicit(new Color32((byte)234, (byte)190, (byte)99, byte.MaxValue)); internal static readonly Color GoldPressed = Color32.op_Implicit(new Color32((byte)184, (byte)136, (byte)50, byte.MaxValue)); internal static readonly Color TextColor = Color32.op_Implicit(new Color32((byte)234, (byte)223, (byte)207, byte.MaxValue)); internal static readonly Color Muted = Color32.op_Implicit(new Color32((byte)169, (byte)155, (byte)176, byte.MaxValue)); internal static readonly Color Dark = Color32.op_Implicit(new Color32((byte)26, (byte)15, (byte)31, byte.MaxValue)); internal static readonly Color Edge = Color32.op_Implicit(new Color32((byte)217, (byte)164, (byte)65, (byte)90)); internal static readonly Color Red = Color32.op_Implicit(new Color32((byte)184, (byte)50, (byte)58, byte.MaxValue)); internal static readonly Color Warn = Color32.op_Implicit(new Color32((byte)232, (byte)96, (byte)96, byte.MaxValue)); internal static readonly Color Purple = Color32.op_Implicit(new Color32((byte)122, (byte)63, (byte)160, byte.MaxValue)); private static Font _bodyFont; private static Font _headFont; private static Sprite _round; private static Sprite _ring; private static Sprite _hairline; private static Sprite _glow; internal static Font BodyFont { get { if ((Object)(object)_bodyFont == (Object)null) { _bodyFont = PickFont((GUIManager.Instance != null) ? GUIManager.Instance.AveriaSerif : null, "AveriaSerifLibre-Regular", "AveriaSerifLibre-Bold", "AveriaSerif"); } return _bodyFont; } } internal static Font HeadFont { get { if ((Object)(object)_headFont == (Object)null) { _headFont = PickFont((GUIManager.Instance != null) ? GUIManager.Instance.NorseBold : null, "Norsebold", "Norse", "AveriaSerifLibre-Bold"); } return _headFont; } } internal static Sprite Round { get { if (!((Object)(object)_round != (Object)null)) { return _round = MakeRounded(32, 7f, 0f); } return _round; } } internal static Sprite RingSprite { get { if (!((Object)(object)_ring != (Object)null)) { return _ring = MakeRounded(32, 7f, 1.5f); } return _ring; } } internal static Sprite Hairline { get { if (!((Object)(object)_hairline != (Object)null)) { return _hairline = MakeHairline(); } return _hairline; } } internal static Sprite Glow { get { if (!((Object)(object)_glow != (Object)null)) { return _glow = MakeGlow(); } return _glow; } } private static Font PickFont(Font preferred, params string[] names) { if ((Object)(object)preferred != (Object)null) { return preferred; } Font[] array = Resources.FindObjectsOfTypeAll<Font>(); Font[] array2; foreach (string value in names) { array2 = array; foreach (Font val in array2) { if ((Object)(object)val != (Object)null && ((Object)val).name.IndexOf(value, StringComparison.OrdinalIgnoreCase) >= 0) { return val; } } } array2 = array; foreach (Font val2 in array2) { if ((Object)(object)val2 != (Object)null) { return val2; } } return null; } internal static RectTransform NewRect(string name, Transform parent) { //IL_0014: 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_002a: 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_0042: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent(parent, false); return (RectTransform)val.transform; } internal static void Stretch(RectTransform rect, float left, float top, float right, float bottom) { //IL_0001: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = Vector2.zero; rect.anchorMax = Vector2.one; rect.pivot = new Vector2(0.5f, 0.5f); rect.offsetMin = new Vector2(left, bottom); rect.offsetMax = new Vector2(0f - right, 0f - top); } internal static void Anchor(RectTransform rect, Vector2 min, Vector2 max, Vector2 pivot, Vector2 position, Vector2 size) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001e: Unknown result type (might be due to invalid IL or missing references) rect.anchorMin = min; rect.anchorMax = max; rect.pivot = pivot; rect.anchoredPosition = position; rect.sizeDelta = size; } internal static RectTransform Box(Transform parent, float x, float y, float width, float height) { //IL_0016: 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_0034: 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_0049: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = NewRect("Box", parent); Anchor(obj, new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(0f, 1f), new Vector2(x, 0f - y), new Vector2(width, height)); return obj; } internal static Image Fill(GameObject item, Sprite sprite, Color color) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Image obj = item.AddComponent<Image>(); obj.sprite = sprite; obj.type = (Type)1; ((Graphic)obj).color = color; return obj; } internal static Text Label(Transform parent, string text, int size, Color color, TextAnchor align, bool heading) { //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) Text obj = ((Component)NewRect("Text", parent)).gameObject.AddComponent<Text>(); obj.font = (heading ? HeadFont : BodyFont); obj.fontSize = size; ((Graphic)obj).color = color; obj.alignment = align; obj.horizontalOverflow = (HorizontalWrapMode)0; obj.verticalOverflow = (VerticalWrapMode)1; obj.supportRichText = false; ((Graphic)obj).raycastTarget = false; obj.text = text ?? ""; return obj; } internal static T Sized<T>(T component, float width, float height, float flexible) where T : Component { LayoutElement val = ((Component)component).GetComponent<LayoutElement>(); if ((Object)(object)val == (Object)null) { val = ((Component)component).gameObject.AddComponent<LayoutElement>(); } if (width >= 0f) { val.preferredWidth = width; if (flexible <= 0f) { val.minWidth = width; } } if (height >= 0f) { val.preferredHeight = height; val.minHeight = height; } val.flexibleWidth = flexible; return component; } internal static RectTransform Column(Transform parent, float spacing) { RectTransform obj = NewRect("Column", parent); VerticalLayoutGroup obj2 = ((Component)obj).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = spacing; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = false; ((LayoutGroup)obj2).childAlignment = (TextAnchor)0; return obj; } internal static RectTransform Row(Transform parent, float height) { RectTransform obj = NewRect("Row", parent); HorizontalLayoutGroup obj2 = ((Component)obj).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj2).spacing = 6f; ((HorizontalOrVerticalLayoutGroup)obj2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj2).childForceExpandHeight = true; ((LayoutGroup)obj2).childAlignment = (TextAnchor)3; PanelKit.Sized<RectTransform>(obj, -1f, height, 1f); return obj; } internal static Text Header(Transform parent, string text) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) Text obj = Label(parent, text, 20, Gold, (TextAnchor)6, heading: true); PanelKit.Sized<Text>(obj, -1f, 28f, 1f); return obj; } internal static Button MakeButton(Transform parent, string text, bool active, UnityAction action) { //IL_0017: 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_0076: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown RectTransform val = NewRect("Button", parent); Image targetGraphic = Fill(((Component)val).gameObject, Round, Color.white); RectTransform obj = NewRect("Ring", (Transform)(object)val); Stretch(obj, 0f, 0f, 0f, 0f); ((Graphic)Fill(((Component)obj).gameObject, RingSprite, Edge)).raycastTarget = false; ((Component)obj).gameObject.AddComponent<LayoutElement>().ignoreLayout = true; Text val2 = Label((Transform)(object)val, text, 15, TextColor, (TextAnchor)4, heading: false); val2.verticalOverflow = (VerticalWrapMode)0; val2.resizeTextForBestFit = true; val2.resizeTextMinSize = 10; val2.resizeTextMaxSize = 15; Stretch(((Graphic)val2).rectTransform, 8f, 0f, 8f, 0f); ((Component)val2).gameObject.AddComponent<LayoutElement>().ignoreLayout = true; Button val3 = ((Component)val).gameObject.AddComponent<Button>(); ((Selectable)val3).targetGraphic = (Graphic)(object)targetGraphic; ((Component)val).gameObject.AddComponent<Look>().Label = val2; ButtonClickedEvent onClick = val3.onClick; object obj2 = <>O.<0>__Unfocus; if (obj2 == null) { UnityAction val4 = Unfocus; <>O.<0>__Unfocus = val4; obj2 = (object)val4; } ((UnityEvent)onClick).AddListener((UnityAction)obj2); if (action != null) { ((UnityEvent)val3.onClick).AddListener(action); } SetActive(val3, active); return val3; } internal static void Usable(Button button, bool usable) { if (!((Object)(object)button == (Object)null)) { ((Selectable)button).interactable = usable; Look component = ((Component)button).GetComponent<Look>(); if ((Object)(object)component != (Object)null) { component.Paint(); } } } internal static void SetText(Button button, string text) { Look look = (((Object)(object)button != (Object)null) ? ((Component)button).GetComponent<Look>() : null); if ((Object)(object)look != (Object)null && (Object)(object)look.Label != (Object)null) { look.Label.text = text ?? ""; } } internal static void SetActive(Button button, bool active) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_004e: 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_00a7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)button == (Object)null)) { ColorBlock colors = ((Selectable)button).colors; ((ColorBlock)(ref colors)).normalColor = (active ? Gold : Card); ((ColorBlock)(ref colors)).highlightedColor = (active ? GoldLit : CardLit); ((ColorBlock)(ref colors)).pressedColor = GoldPressed; ((ColorBlock)(ref colors)).selectedColor = (active ? Gold : Card); ((ColorBlock)(ref colors)).disabledColor = new Color(Card.r, Card.g, Card.b, 0.45f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)button).colors = colors; Look component = ((Component)button).GetComponent<Look>(); if ((Object)(object)component != (Object)null) { component.Active = active; component.Paint(); } } } internal static void Unfocus() { EventSystem current = EventSystem.current; if (!((Object)(object)current == (Object)null) && !ZInput.IsGamepadActive()) { GameObject currentSelectedGameObject = current.currentSelectedGameObject; InputField val = (((Object)(object)currentSelectedGameObject != (Object)null) ? currentSelectedGameObject.GetComponent<InputField>() : null); if ((Object)(object)val == (Object)null || !val.isFocused) { current.SetSelectedGameObject((GameObject)null); } } } internal static InputField MakeInput(Transform parent, string placeholder, string value, int limit) { //IL_0017: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect("Input", parent); Image targetGraphic = Fill(((Component)val).gameObject, Round, Color.white); ((Component)val).gameObject.AddComponent<RectMask2D>(); RectTransform obj = NewRect("Ring", (Transform)(object)val); Stretch(obj, 0f, 0f, 0f, 0f); ((Graphic)Fill(((Component)obj).gameObject, RingSprite, Edge)).raycastTarget = false; Text val2 = Label((Transform)(object)val, placeholder, 15, Muted, (TextAnchor)3, heading: false); val2.fontStyle = (FontStyle)2; val2.horizontalOverflow = (HorizontalWrapMode)1; Stretch(((Graphic)val2).rectTransform, 10f, 2f, 10f, 2f); Text val3 = Label((Transform)(object)val, "", 15, TextColor, (TextAnchor)3, heading: false); val3.horizontalOverflow = (HorizontalWrapMode)1; Stretch(((Graphic)val3).rectTransform, 10f, 2f, 10f, 2f); InputField obj2 = ((Component)val).gameObject.AddComponent<InputField>(); obj2.textComponent = val3; obj2.placeholder = (Graphic)(object)val2; ((Selectable)obj2).targetGraphic = (Graphic)(object)targetGraphic; obj2.lineType = (LineType)0; obj2.contentType = (ContentType)0; obj2.characterLimit = limit; obj2.customCaretColor = true; obj2.caretColor = Gold; obj2.caretWidth = 2; obj2.selectionColor = new Color(Gold.r, Gold.g, Gold.b, 0.35f); ColorBlock colors = ((Selectable)obj2).colors; ((ColorBlock)(ref colors)).normalColor = Deep; ((ColorBlock)(ref colors)).highlightedColor = Top; ((ColorBlock)(ref colors)).pressedColor = Top; ((ColorBlock)(ref colors)).selectedColor = CardLit; ((ColorBlock)(ref colors)).disabledColor = new Color(Deep.r, Deep.g, Deep.b, 0.5f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeDuration = 0.08f; ((Selectable)obj2).colors = colors; obj2.text = value ?? ""; return obj2; } internal static RectTransform MakeScroll(Transform parent, out ScrollRect scroller) { //IL_0017: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: 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_00b8: 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_00e7: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0169: 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) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_0230: 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_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) RectTransform val = NewRect("Scroll", parent); Fill(((Component)val).gameObject, Round, PanelColor); scroller = ((Component)val).gameObject.AddComponent<ScrollRect>(); RectTransform val2 = NewRect("Viewport", (Transform)(object)val); Stretch(val2, 4f, 4f, 16f, 4f); ((Component)val2).gameObject.AddComponent<RectMask2D>(); RectTransform val3 = NewRect("Content", (Transform)(object)val2); val3.anchorMin = new Vector2(0f, 1f); val3.anchorMax = new Vector2(1f, 1f); val3.pivot = new Vector2(0.5f, 1f); val3.offsetMin = Vector2.zero; val3.offsetMax = Vector2.zero; VerticalLayoutGroup obj = ((Component)val3).gameObject.AddComponent<VerticalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 4f; ((LayoutGroup)obj).padding = new RectOffset(6, 6, 6, 6); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((Component)val3).gameObject.AddComponent<ContentSizeFitter>().verticalFit = (FitMode)2; RectTransform val4 = NewRect("Scrollbar", (Transform)(object)val); val4.anchorMin = new Vector2(1f, 0f); val4.anchorMax = new Vector2(1f, 1f); val4.pivot = new Vector2(1f, 0.5f); val4.offsetMin = new Vector2(-12f, 8f); val4.offsetMax = new Vector2(-4f, -8f); Fill(((Component)val4).gameObject, Round, Deep); RectTransform val5 = NewRect("Area", (Transform)(object)val4); Stretch(val5, 0f, 0f, 0f, 0f); RectTransform val6 = NewRect("Handle", (Transform)(object)val5); Stretch(val6, 0f, 0f, 0f, 0f); Image targetGraphic = Fill(((Component)val6).gameObject, Round, Color.white); Scrollbar val7 = ((Component)val4).gameObject.AddComponent<Scrollbar>(); val7.handleRect = val6; ((Selectable)val7).targetGraphic = (Graphic)(object)targetGraphic; val7.direction = (Direction)2; ColorBlock colors = ((Selectable)val7).colors; ((ColorBlock)(ref colors)).normalColor = new Color(Gold.r, Gold.g, Gold.b, 0.55f); ((ColorBlock)(ref colors)).highlightedColor = Gold; ((ColorBlock)(ref colors)).pressedColor = GoldLit; ((ColorBlock)(ref colors)).selectedColor = new Color(Gold.r, Gold.g, Gold.b, 0.55f); ((ColorBlock)(ref colors)).colorMultiplier = 1f; ((ColorBlock)(ref colors)).fadeD