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 Viking Wall Street v1.3.3
VikingWallStreet.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; 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 UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("VikingWallStreet")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.3.3.0")] [assembly: AssemblyInformationalVersion("1.3.3+80d5f6ebff10d90b1056216999443b02ea4be10a")] [assembly: AssemblyProduct("VikingWallStreet")] [assembly: AssemblyTitle("VikingWallStreet")] [assembly: AssemblyVersion("1.3.3.0")] namespace YggdrasilExchange; [Serializable] internal class PendingOrder { public long id; public string sym; public int dir; public long margin; public long fee; public int lev; public double sl; public double tp; public long placedTick; } [Serializable] internal class Position { public long id; public string sym; public int dir; public long margin; public int lev; public double entry; public long openTick; public double sl; public double tp; public double divOwed; public double divGot; } [Serializable] internal class PriceAlert { public long id; public string sym; public int dir; public double price; } [Serializable] internal class TradeRecord { public string sym; public int dir; public int lev; public long margin; public long pnl; public long tick; public string reason; } [Serializable] internal class LoanData { public bool active; public long principal; public long owed; public long takenTick; public long dueTick; public long lastPenaltyDay; public long lastSeizeDay = -1L; public long lastCollectorDay = -1L; public bool warned; } [Serializable] internal class KV { public string k; public string v; } [Serializable] internal class PawnItem { public long id; public string prefab; public string displayName; public int stack; public int quality; public int variant; public float durability; public long crafterId; public string crafterName; public int worldLevel; public List<KV> custom = new List<KV>(); public long loan; public long buyback; public long dueTick; } [Serializable] internal class Notice { public long tick; public string text; } [Serializable] internal class AccountData { public double dust; public int version = 2; public bool used; public int seed; public long balance; public long lastTick = -1L; public long nextId = 1L; public List<Position> positions = new List<Position>(); public List<PendingOrder> orders = new List<PendingOrder>(); public List<TradeRecord> history = new List<TradeRecord>(); public LoanData loan = new LoanData(); public List<PawnItem> pawns = new List<PawnItem>(); public List<Notice> notices = new List<Notice>(); public int loansRepaid; public int loansDefaulted; public long totalPnl; public int trades; public int wins; public long feesPaid; public long bestTrade; public long worstTrade; public long divTotal; public List<PriceAlert> alerts = new List<PriceAlert>(); public bool nHours = true; public bool nMinute = true; public bool nDiv = true; public bool nTrades = true; public bool nWhales = true; public bool nAlerts = true; public bool nWorld = true; public bool nShare = true; public List<FeedFill> fills = new List<FeedFill>(); public List<FeedFill> feed = new List<FeedFill>(); public long insiderTax; } internal static class AccountStore { private static AccountData _cached; private static long _cachedPlayer; private static int _cachedSeed; private static string Key(int seed) { return "YggX.Account." + seed; } internal static AccountData Get() { Player localPlayer = Player.m_localPlayer; Market market = Market.Get(); if ((Object)(object)localPlayer == (Object)null || market == null) { return null; } long playerID = localPlayer.GetPlayerID(); if (playerID == 0L) { return null; } if (_cached != null && _cachedPlayer == playerID && _cachedSeed == market.Seed) { return _cached; } AccountData accountData = null; if (localPlayer.m_customData.TryGetValue(Key(market.Seed), out var value) && !string.IsNullOrEmpty(value)) { try { AccountData accountData2 = new AccountData(); JsonUtility.FromJsonOverwrite(value, (object)accountData2); accountData = accountData2; } catch (Exception ex) { string text = Key(market.Seed) + ".corrupt." + DateTime.UtcNow.ToString("yyyyMMddHHmmss"); localPlayer.m_customData[text] = value; Plugin.Log.LogError((object)("Corrupted bank account data, starting fresh. The old data is kept in the character under '" + text + "': " + ex.Message)); } } if (accountData == null) { accountData = new AccountData { seed = market.Seed, lastTick = market.NowTick }; } if (accountData.positions == null) { accountData.positions = new List<Position>(); } if (accountData.history == null) { accountData.history = new List<TradeRecord>(); } if (accountData.loan == null) { accountData.loan = new LoanData(); } if (accountData.pawns == null) { accountData.pawns = new List<PawnItem>(); } if (accountData.notices == null) { accountData.notices = new List<Notice>(); } if (accountData.alerts == null) { accountData.alerts = new List<PriceAlert>(); } if (accountData.orders == null) { accountData.orders = new List<PendingOrder>(); } if (accountData.fills == null) { accountData.fills = new List<FeedFill>(); } if (accountData.feed == null) { accountData.feed = new List<FeedFill>(); } if (accountData.version < 2) { Migrate(accountData); } _cached = accountData; _cachedPlayer = playerID; _cachedSeed = market.Seed; return accountData; } private static void Migrate(AccountData acc) { if (acc.lastTick > 0) { acc.lastTick *= 4L; } foreach (Position position in acc.positions) { position.openTick *= 4L; } foreach (TradeRecord item in acc.history) { item.tick *= 4L; } foreach (Notice notice in acc.notices) { notice.tick *= 4L; } foreach (PawnItem pawn in acc.pawns) { pawn.dueTick *= 4L; } if (acc.loan.active) { acc.loan.takenTick *= 4L; acc.loan.dueTick *= 4L; } acc.version = 2; acc.used = true; } internal static void Save() { Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && _cached != null && localPlayer.GetPlayerID() == _cachedPlayer) { if (_cached.history.Count > 60) { _cached.history.RemoveRange(0, _cached.history.Count - 60); } if (_cached.notices.Count > 40) { _cached.notices.RemoveRange(0, _cached.notices.Count - 40); } localPlayer.m_customData[Key(_cachedSeed)] = JsonUtility.ToJson((object)_cached); } } internal static void Reset() { _cached = null; _cachedPlayer = 0L; } } internal static class Appraiser { private static readonly Dictionary<string, double> Base = new Dictionary<string, double>(StringComparer.OrdinalIgnoreCase) { { "Wood", 1.0 }, { "FineWood", 2.0 }, { "RoundLog", 2.0 }, { "ElderBark", 4.0 }, { "YggdrasilWood", 6.0 }, { "Blackwood", 8.0 }, { "Stone", 1.0 }, { "Flint", 1.0 }, { "Resin", 1.0 }, { "Coal", 1.0 }, { "GreydwarfEye", 1.0 }, { "BoneFragments", 1.0 }, { "LeatherScraps", 1.0 }, { "DeerHide", 2.0 }, { "Feathers", 1.0 }, { "TrollHide", 8.0 }, { "WolfPelt", 8.0 }, { "WolfFang", 4.0 }, { "LoxPelt", 15.0 }, { "ScaleHide", 12.0 }, { "AskHide", 14.0 }, { "Carapace", 12.0 }, { "Chitin", 3.0 }, { "CopperOre", 3.0 }, { "Copper", 6.0 }, { "TinOre", 3.0 }, { "Tin", 6.0 }, { "Bronze", 15.0 }, { "BronzeNails", 1.0 }, { "IronScrap", 7.0 }, { "Iron", 15.0 }, { "IronNails", 1.0 }, { "SilverOre", 9.0 }, { "Silver", 22.0 }, { "BlackMetalScrap", 12.0 }, { "BlackMetal", 28.0 }, { "FlametalOre", 20.0 }, { "Flametal", 45.0 }, { "FlametalOreNew", 20.0 }, { "FlametalNew", 45.0 }, { "Obsidian", 5.0 }, { "Crystal", 6.0 }, { "Ooze", 3.0 }, { "Guck", 3.0 }, { "Entrails", 1.0 }, { "Bloodbag", 3.0 }, { "SurtlingCore", 10.0 }, { "Thistle", 2.0 }, { "Dandelion", 1.0 }, { "Mushroom", 1.0 }, { "Raspberry", 1.0 }, { "Blueberries", 1.0 }, { "Barley", 2.0 }, { "BarleyFlour", 3.0 }, { "Flax", 2.0 }, { "LinenThread", 6.0 }, { "Tar", 4.0 }, { "Needle", 3.0 }, { "Eitr", 15.0 }, { "Sap", 6.0 }, { "Softtissue", 6.0 }, { "BlackMarble", 4.0 }, { "BlackCore", 25.0 }, { "RoyalJelly", 6.0 }, { "Ectoplasm", 6.0 }, { "FreezeGland", 6.0 }, { "Honey", 4.0 }, { "QueenBee", 20.0 }, { "Carrot", 2.0 }, { "Turnip", 2.0 }, { "Onion", 3.0 }, { "DragonTear", 60.0 }, { "Wishbone", 120.0 }, { "CryptKey", 40.0 }, { "HardAntler", 40.0 }, { "TrophyEikthyr", 40.0 }, { "Thunderstone", 50.0 }, { "MechanicalSpring", 25.0 }, { "Iolite", 25.0 }, { "Bilebag", 8.0 }, { "GemstoneRed", 60.0 }, { "GemstoneGreen", 60.0 }, { "GemstoneBlue", 60.0 }, { "CelestialFeather", 30.0 }, { "CharredBone", 4.0 }, { "SulfurStone", 5.0 }, { "MoltenCore", 30.0 }, { "ProustitePowder", 10.0 }, { "Grausten", 2.0 }, { "Ashwood", 3.0 } }; private static readonly Dictionary<string, double> Cache = new Dictionary<string, double>(); internal static void ClearCache() { Cache.Clear(); } internal static double UnitValue(ItemData item) { if (item?.m_shared == null) { return 0.0; } double num = PrefabValue(((Object)(object)item.m_dropPrefab != (Object)null) ? ((Object)item.m_dropPrefab).name : item.m_shared.m_name, 0); if (item.m_quality > 1) { num *= 1.0 + 0.6 * (double)(item.m_quality - 1); } if (item.m_shared.m_maxDurability > 0f && item.m_shared.m_useDurability) { float maxDurability = item.GetMaxDurability(); if (maxDurability > 0f) { num *= 0.4 + 0.6 * (double)Mathf.Clamp01(item.m_durability / maxDurability); } } return Math.Max(0.5, num); } private static double PrefabValue(string prefab, int depth) { if (string.IsNullOrEmpty(prefab)) { return 1.0; } if (Cache.TryGetValue(prefab, out var value)) { return value; } double num = Compute(prefab, depth); Cache[prefab] = num; return num; } private static double Compute(string prefab, int depth) { //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Invalid comparison between Unknown and I4 //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Invalid comparison between Unknown and I4 //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Invalid comparison between Unknown and I4 if (Base.TryGetValue(prefab, out var value)) { return value; } ObjectDB instance = ObjectDB.instance; GameObject val = (((Object)(object)instance != (Object)null) ? instance.GetItemPrefab(prefab) : null); ItemDrop val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<ItemDrop>() : null); if ((Object)(object)val2 == (Object)null) { return 1.0; } SharedData shared = val2.m_itemData.m_shared; if (shared.m_value > 0) { return shared.m_value; } if (prefab.StartsWith("Trophy", StringComparison.OrdinalIgnoreCase)) { return 6.0; } if (depth < 4 && (Object)(object)instance != (Object)null) { Recipe val3 = null; foreach (Recipe recipe in instance.m_recipes) { if ((Object)(object)recipe != (Object)null && (Object)(object)recipe.m_item != (Object)null && ((Object)((Component)recipe.m_item).gameObject).name == prefab && recipe.m_enabled) { val3 = recipe; break; } } if ((Object)(object)val3 != (Object)null && val3.m_resources != null && val3.m_resources.Length != 0) { double num = 0.0; Requirement[] resources = val3.m_resources; foreach (Requirement val4 in resources) { if (!((Object)(object)val4?.m_resItem == (Object)null) && val4.m_amount > 0) { num += (double)val4.m_amount * PrefabValue(((Object)((Component)val4.m_resItem).gameObject).name, depth + 1); } } int num2 = Math.Max(1, val3.m_amount); return Math.Max(1.0, num * 1.15 / (double)num2); } } ItemType itemType = shared.m_itemType; if ((int)itemType != 1) { if ((int)itemType != 2) { if ((int)itemType == 13) { return 6.0; } return 4.0; } return 3.0; } return 2.0; } internal static double SellRate(float skill) { return 0.35 + 0.25 * (double)Mathf.Clamp01(skill / 100f); } internal static double PawnRate(float skill) { return 0.3 + 0.2 * (double)Mathf.Clamp01(skill / 100f); } } internal static class BankBuilding { internal enum Align { Bottom, Top, Center } internal const string PrefabName = "piece_yggx_desk"; private static float _lastHeight; private static readonly string[] BaseCandidates = new string[2] { "piece_cartographytable", "piece_maptable" }; internal static void Register() { if (!TryRegisterFromCartographyTable()) { Plugin.Log.LogWarning((object)"Exchange desk: the cartography table prefab was not found, using the fallback built from blocks."); RegisterFallback(); } } private static bool TryRegisterFromCartographyTable() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //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_0165: Unknown result type (might be due to invalid IL or missing references) string text = null; string[] baseCandidates = BaseCandidates; foreach (string text2 in baseCandidates) { if ((Object)(object)Cache.GetPrefab<GameObject>(text2) != (Object)null) { text = text2; break; } } if (text == null) { return false; } try { PieceConfig val = DeskConfig(); CustomPiece val2 = new CustomPiece("piece_yggx_desk", text, val); GameObject piecePrefab = val2.PiecePrefab; if ((Object)(object)piecePrefab == (Object)null) { return false; } Switch[] componentsInChildren = piecePrefab.GetComponentsInChildren<Switch>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren[i]); } MapTable[] componentsInChildren2 = piecePrefab.GetComponentsInChildren<MapTable>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren2[i]); } Fireplace[] componentsInChildren3 = piecePrefab.GetComponentsInChildren<Fireplace>(true); for (int i = 0; i < componentsInChildren3.Length; i++) { Object.DestroyImmediate((Object)(object)componentsInChildren3[i]); } Piece component = piecePrefab.GetComponent<Piece>(); if ((Object)(object)component != (Object)null) { component.m_name = "$piece_yggx_desk"; component.m_description = "$piece_yggx_desk_desc"; component.m_icon = Plugin.PieceIcon; } GameObject val3 = new GameObject("yggx_light") { layer = piecePrefab.layer }; val3.transform.SetParent(piecePrefab.transform, false); val3.transform.localPosition = new Vector3(0f, 1.7f, 0f); Light obj = val3.AddComponent<Light>(); obj.type = (LightType)2; obj.color = new Color(1f, 0.75f, 0.45f); obj.range = 4f; obj.intensity = 0.6f; obj.shadows = (LightShadows)0; piecePrefab.AddComponent<BankCounter>(); PieceManager.Instance.AddPiece(val2); Plugin.Log.LogInfo((object)("Exchange desk registered from " + text + ".")); return true; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Exchange desk from the cartography table failed: " + ex.Message)); return false; } } private static PieceConfig DeskConfig() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Expected O, but got Unknown //IL_0070: Expected O, but got Unknown PieceConfig val = new PieceConfig { Name = "$piece_yggx_desk", Description = "$piece_yggx_desk_desc", PieceTable = "Hammer", Category = PieceCategories.Misc, CraftingStation = "piece_workbench", Icon = Plugin.PieceIcon }; val.AddRequirement(new RequirementConfig("FineWood", 10, 0, true)); val.AddRequirement(new RequirementConfig("Coins", 100, 0, true)); return val; } private static void RegisterFallback() { //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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_024e: 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_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0355: Unknown result type (might be due to invalid IL or missing references) //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_03f5: Unknown result type (might be due to invalid IL or missing references) //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Expected O, but got Unknown //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Expected O, but got Unknown //IL_0435: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Expected O, but got Unknown //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0451: Expected O, but got Unknown GameObject val = PrefabManager.Instance.CreateEmptyPrefab("piece_yggx_desk", true); if ((Object)(object)val == (Object)null) { return; } Object.DestroyImmediate((Object)(object)val.GetComponent<MeshRenderer>()); Object.DestroyImmediate((Object)(object)val.GetComponent<MeshFilter>()); Object.DestroyImmediate((Object)(object)val.GetComponent<Collider>()); val.layer = LayerMask.NameToLayer("piece"); Piece obj = val.AddComponent<Piece>(); obj.m_name = "$piece_yggx_desk"; obj.m_description = "$piece_yggx_desk_desc"; obj.m_icon = Plugin.PieceIcon; obj.m_canBeRemoved = true; obj.m_allowedInDungeons = false; obj.m_clipGround = true; obj.m_noInWater = true; int ok = 0; int missing = 0; Material val2 = null; string[] array = new string[4] { "piece_chair02", "piece_chair", "piece_table_oak", "piece_table" }; for (int i = 0; i < array.Length; i++) { GameObject prefab = Cache.GetPrefab<GameObject>(array[i]); MeshRenderer val3 = (((Object)(object)prefab == (Object)null) ? null : prefab.GetComponentInChildren<MeshRenderer>(true)); if ((Object)(object)val3 != (Object)null && (Object)(object)((Renderer)val3).sharedMaterial != (Object)null) { val2 = ((Renderer)val3).sharedMaterial; break; } } if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"Exchange desk: no wood material found, the desk will look plain."); } Block(val, val2, new Vector3(0f, 0.84999996f, 0f), new Vector3(1.6f, 0.1f, 0.8f), solid: true); Block(val, val2, new Vector3(0f, 0.25f, 0.02f), new Vector3(1.4f, 0.06f, 0.7f), solid: true); Block(val, val2, new Vector3(0f, 0.5f, 0.36f), new Vector3(1.5f, 0.9f, 0.06f), solid: false); Block(val, val2, new Vector3(-0.72f, 0.45f, 0f), new Vector3(0.06f, 0.8f, 0.72f), solid: false); Block(val, val2, new Vector3(0.72f, 0.45f, 0f), new Vector3(0.06f, 0.8f, 0.72f), solid: false); Block(val, val2, new Vector3(0f, 1.02f, 0.33f), new Vector3(1.5f, 0.24f, 0.06f), solid: false); ok += 6; Count(AddPart(val.transform, new string[2] { "piece_chair02", "piece_chair" }, new Vector3(0f, 0f, -1f), 0f, 0f, Align.Bottom)); Count(AddPart(val.transform, new string[1] { "Coins" }, new Vector3(-0.4f, 0.9f, 0f), 0f, 0f, Align.Bottom, colliders: false)); Count(AddPart(val.transform, new string[1] { "Coins" }, new Vector3(0.45f, 0.9f, -0.15f), 40f, 0f, Align.Bottom, colliders: false, 0.7f)); GameObject val4 = new GameObject("yggx_light") { layer = val.layer }; val4.transform.SetParent(val.transform, false); val4.transform.localPosition = new Vector3(0f, 1.7f, 0f); Light obj2 = val4.AddComponent<Light>(); obj2.type = (LightType)2; obj2.color = new Color(1f, 0.75f, 0.45f); obj2.range = 5f; obj2.intensity = 0.9f; obj2.shadows = (LightShadows)0; val.AddComponent<BankCounter>(); PieceConfig val5 = new PieceConfig { Name = "$piece_yggx_desk", Description = "$piece_yggx_desk_desc", PieceTable = "Hammer", Category = PieceCategories.Misc, CraftingStation = "piece_workbench", Icon = Plugin.PieceIcon }; val5.AddRequirement(new RequirementConfig("FineWood", 10, 0, true)); val5.AddRequirement(new RequirementConfig("Coins", 100, 0, true)); PieceManager.Instance.AddPiece(new CustomPiece(val, false, val5)); Plugin.Log.LogInfo((object)$"Exchange desk registered: {ok} parts, {missing} missing vanilla prefabs."); void Count(GameObject g) { if ((Object)(object)g != (Object)null) { ok++; } else { missing++; } } } private static void Block(GameObject root, Material mat, Vector3 center, Vector3 size, bool solid) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)val).name = "desk_block"; val.layer = root.layer; val.transform.SetParent(root.transform, false); val.transform.localPosition = center; val.transform.localScale = size; if ((Object)(object)mat != (Object)null) { ((Renderer)val.GetComponent<MeshRenderer>()).sharedMaterial = mat; } if ((Object)(object)val.GetComponent<Collider>() == (Object)null) { val.AddComponent<BoxCollider>(); } } private static GameObject AddPart(Transform root, string[] candidates, Vector3 target, float yRot, float fitWidth, Align align, bool colliders = true, float scale = 1f) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: 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_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_024e: 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_01b5: 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_0263: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: 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_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) GameObject val = null; for (int i = 0; i < candidates.Length; i++) { val = Cache.GetPrefab<GameObject>(candidates[i]); if ((Object)(object)val != (Object)null) { break; } } if ((Object)(object)val == (Object)null) { Plugin.Verbose("Bank: no prefab among " + string.Join(", ", candidates)); return null; } GameObject val2 = new GameObject("part_" + ((Object)val).name); val2.layer = ((Component)root).gameObject.layer; val2.transform.SetParent(root, false); GameObject val3 = new GameObject("visual"); val3.layer = ((Component)root).gameObject.layer; val3.transform.SetParent(val2.transform, false); HashSet<Renderer> hashSet = new HashSet<Renderer>(); LODGroup[] componentsInChildren = val.GetComponentsInChildren<LODGroup>(true); for (int i = 0; i < componentsInChildren.Length; i++) { LOD[] lODs = componentsInChildren[i].GetLODs(); for (int j = 1; j < lODs.Length; j++) { Renderer[] renderers = lODs[j].renderers; foreach (Renderer val4 in renderers) { if ((Object)(object)val4 != (Object)null) { hashSet.Add(val4); } } } } CopyRecursive(val.transform, val3.transform, hashSet, colliders, isRoot: true); Bounds val5 = default(Bounds); bool flag = false; MeshFilter[] componentsInChildren2 = val3.GetComponentsInChildren<MeshFilter>(true); foreach (MeshFilter val6 in componentsInChildren2) { if ((Object)(object)val6.sharedMesh == (Object)null) { continue; } Matrix4x4 val7 = val2.transform.worldToLocalMatrix * ((Component)val6).transform.localToWorldMatrix; Bounds bounds = val6.sharedMesh.bounds; for (int l = 0; l < 8; l++) { Vector3 val8 = ((Bounds)(ref bounds)).center + Vector3.Scale(((Bounds)(ref bounds)).extents, new Vector3((float)(((l & 1) != 0) ? 1 : (-1)), (float)(((l & 2) != 0) ? 1 : (-1)), (float)(((l & 4) != 0) ? 1 : (-1)))); Vector3 val9 = ((Matrix4x4)(ref val7)).MultiplyPoint3x4(val8); if (!flag) { ((Bounds)(ref val5))..ctor(val9, Vector3.zero); flag = true; } else { ((Bounds)(ref val5)).Encapsulate(val9); } } } if (!flag) { Object.DestroyImmediate((Object)(object)val2); return null; } float num = scale; if (fitWidth > 0f && ((Bounds)(ref val5)).size.x > 0.01f) { num = fitWidth / ((Bounds)(ref val5)).size.x; } val3.transform.localScale = Vector3.one * num; Vector3 val10 = ((Bounds)(ref val5)).center * num; float num2 = align switch { Align.Top => ((Bounds)(ref val5)).max.y * num, Align.Bottom => ((Bounds)(ref val5)).min.y * num, _ => ((Bounds)(ref val5)).center.y * num, }; val3.transform.localPosition = new Vector3(0f - val10.x, 0f - num2, 0f - val10.z); _lastHeight = target.y + (((Bounds)(ref val5)).max.y - ((Bounds)(ref val5)).min.y) * num; val2.transform.localPosition = target; val2.transform.localRotation = Quaternion.Euler(0f, yRot, 0f); return val2; } private static void CopyRecursive(Transform src, Transform dst, HashSet<Renderer> skip, bool colliders, bool isRoot) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_02e9: Expected O, but got Unknown //IL_02fe: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Expected O, but got Unknown //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) if (!isRoot && !((Component)src).gameObject.activeSelf) { return; } GameObject gameObject = ((Component)dst).gameObject; if (!isRoot) { gameObject.transform.localPosition = src.localPosition; gameObject.transform.localRotation = src.localRotation; gameObject.transform.localScale = src.localScale; } gameObject.layer = ((Component)src).gameObject.layer; MeshRenderer component = ((Component)src).GetComponent<MeshRenderer>(); MeshFilter component2 = ((Component)src).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component2 != (Object)null && (Object)(object)component2.sharedMesh != (Object)null && !skip.Contains((Renderer)(object)component) && ((Renderer)component).enabled) { gameObject.AddComponent<MeshFilter>().sharedMesh = component2.sharedMesh; MeshRenderer obj = gameObject.AddComponent<MeshRenderer>(); ((Renderer)obj).sharedMaterials = ((Renderer)component).sharedMaterials; ((Renderer)obj).shadowCastingMode = ((Renderer)component).shadowCastingMode; ((Renderer)obj).receiveShadows = ((Renderer)component).receiveShadows; } SkinnedMeshRenderer component3 = ((Component)src).GetComponent<SkinnedMeshRenderer>(); if ((Object)(object)component3 != (Object)null && (Object)(object)component3.sharedMesh != (Object)null && !skip.Contains((Renderer)(object)component3) && ((Renderer)component3).enabled) { gameObject.AddComponent<MeshFilter>().sharedMesh = component3.sharedMesh; ((Renderer)gameObject.AddComponent<MeshRenderer>()).sharedMaterials = ((Renderer)component3).sharedMaterials; } Light component4 = ((Component)src).GetComponent<Light>(); if ((Object)(object)component4 != (Object)null && ((Behaviour)component4).enabled) { Light obj2 = gameObject.AddComponent<Light>(); obj2.type = component4.type; obj2.color = component4.color; obj2.range = component4.range; obj2.intensity = component4.intensity; obj2.spotAngle = component4.spotAngle; obj2.shadows = (LightShadows)0; } if (colliders) { Collider[] components = ((Component)src).GetComponents<Collider>(); foreach (Collider val in components) { if ((Object)(object)val == (Object)null || val.isTrigger || !val.enabled) { continue; } Collider val2 = val; BoxCollider val3 = (BoxCollider)(object)((val2 is BoxCollider) ? val2 : null); if (val3 == null) { MeshCollider val4 = (MeshCollider)(object)((val2 is MeshCollider) ? val2 : null); if (val4 == null) { SphereCollider val5 = (SphereCollider)(object)((val2 is SphereCollider) ? val2 : null); if (val5 == null) { CapsuleCollider val6 = (CapsuleCollider)(object)((val2 is CapsuleCollider) ? val2 : null); if (val6 != null) { CapsuleCollider obj3 = gameObject.AddComponent<CapsuleCollider>(); obj3.center = val6.center; obj3.radius = val6.radius; obj3.height = val6.height; obj3.direction = val6.direction; } } else { SphereCollider obj4 = gameObject.AddComponent<SphereCollider>(); obj4.center = val5.center; obj4.radius = val5.radius; } } else if ((Object)(object)val4.sharedMesh != (Object)null) { MeshCollider obj5 = gameObject.AddComponent<MeshCollider>(); obj5.sharedMesh = val4.sharedMesh; obj5.convex = val4.convex; } } else { BoxCollider obj6 = gameObject.AddComponent<BoxCollider>(); obj6.center = val3.center; obj6.size = val3.size; } } } foreach (Transform item in src) { Transform val7 = item; if (((Component)val7).gameObject.activeSelf) { GameObject val8 = new GameObject(((Object)val7).name); val8.transform.SetParent(dst, false); CopyRecursive(val7, val8.transform, skip, colliders, isRoot: false); } } } } internal class BankCounter : MonoBehaviour, Hoverable, Interactable { public string GetHoverName() { return Localization.instance.Localize("$piece_yggx_desk"); } public string GetHoverText() { string text = "$piece_yggx_desk\n[<color=yellow><b>$KEY_Use</b></color>] $yggx_open"; AccountData accountData = AccountStore.Get(); Market market = Market.Get(); if (accountData != null && market != null) { text = text + "\n" + Texts.T("Счёт: ", "Balance: ") + Texts.Coins(accountData.balance); if (accountData.loan.active) { bool flag = Engine.IsOverdue(accountData, market.NowTick); text = text + "\n<color=" + (flag ? "red" : "orange") + ">" + Texts.T("Долг: ", "Debt: ") + Texts.Coins(accountData.loan.owed) + "</color>"; } } return Localization.instance.Localize(text); } public float GetHoverOffset() { return 0.5f; } public bool Interact(Humanoid user, bool hold, bool alt) { if (hold) { return false; } if ((Object)(object)user != (Object)(object)Player.m_localPlayer) { return false; } BankUI.Open(((Component)this).transform); return true; } public bool UseItem(Humanoid user, ItemData item) { return false; } } internal static class BankUI { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__105_0; public static UnityAction <>9__105_1; public static UnityAction <>9__107_0; public static UnityAction <>9__107_1; public static UnityAction <>9__107_2; public static UnityAction <>9__107_3; public static UnityAction<string> <>9__107_4; public static UnityAction <>9__107_6; public static UnityAction <>9__111_0; public static UnityAction <>9__111_1; public static Func<Campaign, bool> <>9__116_3; public static Func<Campaign, string> <>9__116_4; public static Func<Market.Rumour, bool> <>9__116_5; public static Func<MarketEvent, bool> <>9__116_6; public static UnityAction<string> <>9__119_0; public static UnityAction<string> <>9__119_1; public static UnityAction <>9__119_2; public static Func<Position, bool> <>9__131_0; public static Func<Position, string> <>9__131_1; public static Func<InputField, bool> <>9__133_0; public static Func<ItemData, bool> <>9__134_0; public static Func<ItemData, int> <>9__134_4; public static Func<IGrouping<string, ItemData>, <>f__AnonymousType0<string, ItemData, int>> <>9__134_1; public static Func<<>f__AnonymousType0<string, ItemData, int>, string> <>9__134_2; public static Func<<>f__AnonymousType0<string, ItemData, int>, int> <>9__134_3; public static Func<Market.Rumour, bool> <>9__136_0; public static Comparison<KeyValuePair<long, int>> <>9__136_1; public static Func<MarketEvent, bool> <>9__136_2; public static Func<char, bool> <>9__145_0; public static Func<Campaign, string> <>9__147_2; public static Comparison<KeyValuePair<string, double>> <>9__147_0; public static UnityAction <>9__181_0; public static UnityAction <>9__181_1; public static Action<List<WorldRecord>> <>9__228_0; public static UnityAction <>9__229_0; public static UnityAction <>9__229_1; public static Func<ChainProgress, int> <>9__231_4; public static Func<(int i, double p), bool> <>9__231_1; public static Func<(int i, double p), double> <>9__231_2; internal void <BuildMarketTab>b__105_0() { OpenOrder(1); } internal void <BuildMarketTab>b__105_1() { OpenOrder(-1); } internal void <BuildBankTab>b__107_0() { Engine.Deposit(ParseLong(_bankAmount.text)); } internal void <BuildBankTab>b__107_1() { Engine.Deposit(Engine.InventoryCoins()); } internal void <BuildBankTab>b__107_2() { Engine.Withdraw(ParseLong(_bankAmount.text)); } internal void <BuildBankTab>b__107_3() { AccountData accountData = AccountStore.Get(); if (accountData != null) { Engine.Withdraw(accountData.balance); } } internal void <BuildBankTab>b__107_4(string _) { RefreshBank(); } internal void <BuildBankTab>b__107_6() { Msg(_bankMsg, Engine.Repay(0L)); } internal void <BuildSettingsTab>b__111_0() { Msg(_alertMsg, Engine.AddAlert(_sel, 1, ParseDouble(_alertPrice.text))); } internal void <BuildSettingsTab>b__111_1() { Msg(_alertMsg, Engine.AddAlert(_sel, -1, ParseDouble(_alertPrice.text))); } internal bool <RefreshMarket>b__116_3(Campaign c) { return c.Stock == _sel; } internal string <RefreshMarket>b__116_4(Campaign c) { return Funds.All[c.Fund].Name + ((c.Dir > 0) ? Texts.T(" скупает", " is buying") : Texts.T(" продаёт", " is selling")); } internal bool <RefreshMarket>b__116_5(Market.Rumour r) { return r.Event.Stock == _sel; } internal bool <RefreshMarket>b__116_6(MarketEvent e) { if (e.Stock != _sel) { return e.Stock < 0; } return true; } internal void <BuildOrderDialog>b__119_0(string _) { if (!_syncing) { OrderFromQty(); } } internal void <BuildOrderDialog>b__119_1(string _) { if (!_syncing) { OrderFromAmount(); } } internal void <BuildOrderDialog>b__119_2() { _order.SetActive(false); } internal bool <RefreshPortfolio>b__131_0(Position p) { return Stocks.IndexOf(p.sym) >= 0; } internal string <RefreshPortfolio>b__131_1(Position p) { return p.sym + "|" + p.dir + "|" + p.lev; } internal bool <RefreshPawn>b__133_0(InputField f) { return f.isFocused; } internal bool <RefreshInventoryRows>b__134_0(ItemData it) { if (it != null && !it.m_equipped && it.m_shared != null) { return it.m_shared.m_name != "$item_coins"; } return false; } internal <>f__AnonymousType0<string, ItemData, int> <RefreshInventoryRows>b__134_1(IGrouping<string, ItemData> g) { return new { Key = g.Key, Proto = g.First(), Count = g.Sum((ItemData x) => x.m_stack) }; } internal int <RefreshInventoryRows>b__134_4(ItemData x) { return x.m_stack; } internal string <RefreshInventoryRows>b__134_2(<>f__AnonymousType0<string, ItemData, int> g) { return Localization.instance.Localize(g.Proto.m_shared.m_name); } internal int <RefreshInventoryRows>b__134_3(<>f__AnonymousType0<string, ItemData, int> g) { return g.Proto.m_quality; } internal bool <RefreshNews>b__136_0(Market.Rumour r) { if (r.Event.Stock >= 0) { return Stocks.IsListed(Stocks.All[r.Event.Stock]); } return true; } internal int <RefreshNews>b__136_1(KeyValuePair<long, int> a, KeyValuePair<long, int> b) { return a.Key.CompareTo(b.Key); } internal bool <RefreshNews>b__136_2(MarketEvent e) { if (e.Stock >= 0) { return Stocks.IsListed(Stocks.All[e.Stock]); } return true; } internal bool <UpdateHover>b__145_0(char c) { return c == '\n'; } internal string <RefreshFunds>b__147_2(Campaign c) { return ((c.Dir > 0) ? ("<color=#73e06b>" + Texts.T("лонг ", "long ")) : ("<color=#ff6050>" + Texts.T("шорт ", "short "))) + Stocks.All[c.Stock].Sym + "</color>"; } internal int <RefreshFunds>b__147_0(KeyValuePair<string, double> a, KeyValuePair<string, double> b) { return b.Value.CompareTo(a.Value); } internal void <BuildGuideTab>b__181_0() { OpenChapter(_guideCh - 1); } internal void <BuildGuideTab>b__181_1() { OpenChapter(_guideCh + 1); } internal void <InitPulse>b__228_0(List<WorldRecord> recs) { //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Color val = default(Color); foreach (WorldRecord rec in recs) { _arrived[rec.Id] = Time.realtimeSinceStartup; ColorUtility.TryParseHtmlString(WorldText.Color(rec), ref val); float item = Mathf.Clamp01((float)(WorldText.MaxImpact(rec) / 0.08)) * 0.7f + 0.3f; if (_spikes.Count < 8) { _spikes.Add((Color32.op_Implicit(val), item)); } } if (_arrived.Count > 400) { _arrived.Clear(); } _dirty = true; } internal void <BuildPulseTab>b__229_0() { if ((Object)(object)_help != (Object)null) { _help.SetActive(!_help.activeSelf); } } internal void <BuildPulseTab>b__229_1() { _help.SetActive(false); } internal int <RefreshPulse>b__231_4(ChainProgress c) { return c.Deadline; } internal bool <RefreshPulse>b__231_1((int i, double p) v) { return Math.Abs(v.p) >= 0.0005; } internal double <RefreshPulse>b__231_2((int i, double p) v) { return Math.Abs(v.p); } } private const float W = 1200f; private const float H = 780f; private const float BodyY = 108f; private static readonly Color Gold = new Color(1f, 0.78f, 0.32f); private static readonly Color Beige = new Color(0.94f, 0.89f, 0.77f); private static readonly Color Grey = new Color(0.72f, 0.69f, 0.62f); private static readonly Color Green = new Color(0.45f, 0.88f, 0.42f); private static readonly Color Red = new Color(1f, 0.38f, 0.32f); private static readonly Color RowA = new Color(0f, 0f, 0f, 0.28f); private static readonly Color RowB = new Color(0f, 0f, 0f, 0.14f); private static readonly Color RowSel = new Color(1f, 0.75f, 0.3f, 0.22f); private static GameObject _panel; private static Transform _anchor; private static bool _open; private static bool _dirty; private static bool _unblockNext; private static bool _inputBlocked; private static bool _loading; private static Text _loadingLabel; private static float _timer; private static long _lastTick = -1L; private static int _tab; private static int _sel = 2; private static int _range = 288; private static int _lev = 1; private static Text _title; private static Text _headerInfo; private static readonly GameObject[] _tabRoots = (GameObject[])(object)new GameObject[10]; private static readonly Text[] _tabLabels = (Text[])(object)new Text[10]; private static readonly Text[] _toggleLabels = (Text[])(object)new Text[8]; private static Text _alertFor; private static Text _alertMsg; private static Text _titleInfo; private static InputField _alertPrice; private static RectTransform _alertList; private static RectTransform _hoverLine; private static RectTransform _hoverDot; private static RectTransform _hoverBox; private static Text _hoverText; private static Text _mood; private static double[] _chartVals; private static long _chartFrom; private static double _chartMinV; private static double _chartMaxV; private const int VolH = 44; private static RectTransform _fundList; private static RectTransform _rankList; private static RectTransform _fundHist; private static RectTransform _stockList; private static Text _dName; private static Text _dSector; private static Text _dSlogan; private static Text _dPrice; private static Text _dChange; private static Text _dExtra; private static Text _dNews; private static Text _chartMin; private static Text _chartMax; private static Text _chartNote; private static RawImage _chart; private static Texture2D _chartTex; private static readonly Text[] _rangeLabels = (Text[])(object)new Text[7]; private static InputField _amount; private static InputField _qty; private static InputField _sl; private static InputField _tp; private static GameObject _order; private static int _orderDir = 1; private static bool _syncing; private static Text _ordTitle; private static Text _ordPrice; private static readonly int[] Levs = new int[5] { 1, 2, 3, 5, 10 }; private const int MonthTicks = 2880; private static readonly int[] Ranges = new int[7] { 96, 288, 672, 2880, 8640, 17280, 34560 }; private static readonly Text[] _levLabels = (Text[])(object)new Text[5]; private static Text _preview; private static Text _tradeMsg; private static Text _skillLine; private static RectTransform _posList; private static Text _portSummary; private static Text _bankInfo; private static Text _loanInfo; private static Text _bankMsg; private static Text _contract; private static InputField _bankAmount; private static InputField _loanAmount; private static readonly Text[] _termLabels = (Text[])(object)new Text[3]; private static GameObject _takeGroup; private static GameObject _repayGroup; private static RectTransform _noticeList; private static RectTransform _invList; private static RectTransform _pawnList; private static readonly Dictionary<string, int> _pawnQty = new Dictionary<string, int>(); private static Text _pawnMsg; private static RectTransform _newsList; private static Text _stats; private static RectTransform _histList; private static Text _ordMsg; private static Text _ordOk; private static readonly HashSet<string> _expanded = new HashSet<string>(); internal const int GuideTab = 8; private static List<GuideChapter> _guide; private static int _guideCh; private static int _guideBuilt = -1; private static readonly List<(Image bg, Text label)> _tocButtons = new List<(Image, Text)>(); private static RectTransform _guidePage; private static ScrollRect _guideScroll; private static CanvasGroup _guideFade; private static RectTransform _guideFadeRt; private static Text _guideTitle; private static Text _guideCounter; private static float _guideAnim = 1f; private static readonly HashSet<int> _guideRead = new HashSet<int>(); private const float PageW = 860f; private static readonly Color Parchment = new Color(0.16f, 0.12f, 0.08f, 0.92f); private static readonly Color Ink = new Color(0.95f, 0.9f, 0.8f); internal const int PulseTab = 7; internal const int SettingsTab = 9; private const int EcgW = 300; private const int EcgH = 56; private static Texture2D _ecgTex; private static readonly float[] _ecgY = new float[300]; private static readonly Color32[] _ecgCol = (Color32[])(object)new Color32[300]; private static readonly Color32[] _ecgPx = (Color32[])(object)new Color32[16800]; private static float _ecgShift; private static float _ecgPhase; private static readonly List<float> _beatTimes = new List<float>(); private static readonly List<(Color32 col, float amp)> _spikes = new List<(Color32, float)>(); private static float _spikeLeft; private static Color32 _spikeCol; private static float _spikeAmp; private static Text _ecgLabel; private static readonly Image[] _gFill = (Image[])(object)new Image[4]; private static readonly Text[] _gValue = (Text[])(object)new Text[4]; private static readonly Text[] _gHint = (Text[])(object)new Text[4]; private static readonly float[] _gShown = new float[4]; private static readonly float[] _gTarget = new float[4]; private const float GaugeW = 300f; private static RectTransform _chronicle; private static RectTransform _chainList; private static RectTransform _influence; private static readonly List<(Image bar, float target, bool neg)> _infBars = new List<(Image, float, bool)>(); private static GameObject _help; private static Text _pulseSummary; private static RectTransform _tickerText; private static Text _tickerLabel; private static float _tickerX; private static readonly List<(Image img, float age, float life, float a0)> _flashes = new List<(Image, float, float, float)>(); private static readonly Dictionary<int, double> _lastPx = new Dictionary<int, double>(); private static long _lastPxTick = -1L; private static readonly Dictionary<int, float> _arrived = new Dictionary<int, float>(); private static double _pxFrom; private static double _pxTo; private static float _pxT = 1f; private static int _pxSel = -1; private static Color _pxFlash = Color.clear; internal static bool IsOpen => _open; internal static void MarkDirty() { _dirty = true; } internal static void Open(Transform anchor) { if ((Object)(object)GUIManager.CustomGUIFront == (Object)null) { return; } if ((Object)(object)_panel == (Object)null) { _inputBlocked = false; Build(); } if (!((Object)(object)_panel == (Object)null)) { _anchor = anchor; AccountData accountData = AccountStore.Get(); if (accountData != null && !accountData.used) { accountData.used = true; AccountStore.Save(); _tab = 8; _guideCh = 0; ShowTab(); } _panel.SetActive(true); if (!_inputBlocked) { GUIManager.BlockInput(true); _inputBlocked = true; } _open = true; _unblockNext = false; _dirty = true; _lastTick = -1L; Engine.Pulse(); Refresh(full: true); } } internal static void Close() { if (_open) { _open = false; if ((Object)(object)_order != (Object)null) { _order.SetActive(false); } if ((Object)(object)_panel != (Object)null) { _panel.SetActive(false); } _unblockNext = true; } } internal static void UpdateStatic() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) if (_unblockNext) { _unblockNext = false; if (_inputBlocked) { _inputBlocked = false; GUIManager.BlockInput(false); } } else { if (!_open) { return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)_panel == (Object)null || (Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead() || (Object)(object)_anchor == (Object)null || Vector3.Distance(((Component)localPlayer).transform.position, _anchor.position) > 8f || ZInput.GetKeyDown(Plugin.CloseKey.Value, false)) { Close(); return; } UpdateHover(); Animate(Time.unscaledDeltaTime); _timer += Time.unscaledDeltaTime; long num = Market.Get()?.NowTick ?? (-1); if (_dirty || num != _lastTick) { _lastTick = num; _dirty = false; _timer = 0f; Refresh(full: true); } else if (_timer > 1f) { _timer = 0f; Refresh(full: false); } } } private static void Build() { //IL_001b: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Expected O, but got Unknown //IL_037b: Unknown result type (might be due to invalid IL or missing references) GUIManager instance = GUIManager.Instance; _panel = instance.CreateWoodpanel(GUIManager.CustomGUIFront.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, 1200f, 780f, true); ((Object)_panel).name = "YggdrasilExchangePanel"; _title = Label(_panel.transform, Texts.T("БИРЖА ХАЛЬДОРА", "HALDOR'S EXCHANGE"), 28f, 14f, 620f, 44f, Texts.IsRu ? 30 : 34, Gold, (TextAnchor)3, Texts.IsRu ? instance.AveriaSerifBold : instance.NorseBold); _headerInfo = Label(_panel.transform, "", 560f, 6f, 560f, 58f, 15, Beige, (TextAnchor)5); Btn(_panel.transform, "X", 1134f, 18f, 40f, 40f, new UnityAction(Close)); string[] array = new string[10] { Texts.T("Биржа", "Exchange"), Texts.T("Портфель", "Portfolio"), Texts.T("Банк", "Bank"), Texts.T("Ломбард", "Pawnshop"), Texts.T("Новости", "News"), Texts.T("История", "History"), Texts.T("Фонды", "Funds"), Texts.T("Пульс мира", "World Pulse"), Texts.T("Руководство", "Guide"), Texts.T("Настройки", "Settings") }; float[] array2 = new float[10] { 96f, 112f, 92f, 104f, 104f, 100f, 86f, 128f, 136f, 116f }; float num = 28f; for (int i = 0; i < array.Length; i++) { int idx = i; float num2 = array2[i]; GameObject val = Btn(_panel.transform, array[i], num, 62f, num2, 36f, (UnityAction)delegate { _tab = idx; _dirty = true; ShowTab(); }); _tabLabels[i] = val.GetComponentInChildren<Text>(); num += num2 + 6f; _tabRoots[i] = Container(_panel.transform, "tab" + i); } BuildMarketTab(_tabRoots[0].transform); BuildPortfolioTab(_tabRoots[1].transform); BuildBankTab(_tabRoots[2].transform); BuildPawnTab(_tabRoots[3].transform); BuildNewsTab(_tabRoots[4].transform); BuildHistoryTab(_tabRoots[5].transform); BuildFundsTab(_tabRoots[6].transform); BuildPulseTab(_tabRoots[7].transform); BuildGuideTab(_tabRoots[8].transform); BuildSettingsTab(_tabRoots[9].transform); BuildTicker(); BuildOrderDialog(_panel.transform); _loadingLabel = Label(_panel.transform, "", 60f, 328f, 1080f, 120f, 20, Gold, (TextAnchor)4); ((Component)_loadingLabel).gameObject.SetActive(false); ShowTab(); _panel.SetActive(false); } private static void ShowTab() { //IL_004e: 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) for (int i = 0; i < _tabRoots.Length; i++) { _tabRoots[i].SetActive(i == _tab && (!_loading || i == 8)); if ((Object)(object)_tabLabels[i] != (Object)null) { ((Graphic)_tabLabels[i]).color = ((i == _tab) ? Gold : Beige); } } if ((Object)(object)_loadingLabel != (Object)null) { ((Component)_loadingLabel).gameObject.SetActive(_loading && _tab != 8); } } private static void BuildMarketTab(Transform t) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Expected O, but got Unknown //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Expected O, but got Unknown //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_0424: Unknown result type (might be due to invalid IL or missing references) //IL_0458: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_04b0: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_053d: Unknown result type (might be due to invalid IL or missing references) //IL_0543: Expected O, but got Unknown //IL_059d: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) //IL_05e2: Unknown result type (might be due to invalid IL or missing references) //IL_0588: Unknown result type (might be due to invalid IL or missing references) //IL_058d: Unknown result type (might be due to invalid IL or missing references) //IL_0593: Expected O, but got Unknown Label(t, Texts.T("Котировки", "Quotes"), 28f, 108f, 360f, 26f, 18, Gold, (TextAnchor)3); _mood = Label(t, "", 130f, 108f, 268f, 26f, 13, Beige, (TextAnchor)5); _stockList = Scroll(t, 28f, 138f, 370f, 612f); float num = 418f; _dName = Label(t, "", num, 108f, 470f, 34f, 26, Gold, (TextAnchor)3); _dSector = Label(t, "", num, 142f, 470f, 22f, 15, Grey, (TextAnchor)3); _dSlogan = Label(t, "", num, 164f, 470f, 22f, 15, Beige, (TextAnchor)3); _dSlogan.fontStyle = (FontStyle)2; _dPrice = Label(t, "", num, 188f, 240f, 40f, 32, Beige, (TextAnchor)3); _dChange = Label(t, "", num + 240f, 188f, 230f, 40f, 17, Beige, (TextAnchor)3); string[] array = new string[7] { Texts.T("1 д", "1d"), Texts.T("3 д", "3d"), Texts.T("7 д", "7d"), Texts.T("30 д", "30d"), Texts.T("3 мес", "3M"), Texts.T("6 мес", "6M"), Texts.T("1 год", "1Y") }; int[] ranges = Ranges; for (int i = 0; i < ranges.Length; i++) { int r = ranges[i]; GameObject val = Btn(t, array[i], num + (float)(i * 50), 234f, 47f, 28f, (UnityAction)delegate { _range = r; _dirty = true; }); _rangeLabels[i] = val.GetComponentInChildren<Text>(); } _chartNote = Label(t, "", num + 352f, 232f, 128f, 32f, 11, Grey, (TextAnchor)5); Box(t, num, 268f, 480f, 240f, new Color(0f, 0f, 0f, 0.35f)); GameObject val2 = new GameObject("chart", new Type[2] { typeof(RectTransform), typeof(RawImage) }); Place(val2, t, num, 268f, 480f, 240f); _chart = val2.GetComponent<RawImage>(); _chartTex = new Texture2D(480, 240, (TextureFormat)4, false) { filterMode = (FilterMode)1, wrapMode = (TextureWrapMode)1 }; _chart.texture = (Texture)(object)_chartTex; _chartMax = Label(t, "", num + 6f, 270f, 160f, 18f, 13, Grey, (TextAnchor)0); _chartMin = Label(t, "", num + 6f, 442f, 160f, 18f, 13, Grey, (TextAnchor)6); _hoverLine = ((Graphic)Box(t, num, 268f, 1f, 240f, new Color(1f, 0.85f, 0.45f, 0.55f))).rectTransform; _hoverDot = ((Graphic)Box(t, num, 268f, 9f, 9f, new Color(1f, 0.85f, 0.45f, 1f))).rectTransform; _hoverBox = ((Graphic)Box(t, num, 268f, 190f, 62f, new Color(0.08f, 0.06f, 0.04f, 0.92f))).rectTransform; _hoverText = Label((Transform)(object)_hoverBox, "", 8f, 4f, 176f, 56f, 13, Beige, (TextAnchor)0); SetHover(on: false); _dExtra = Label(t, "", num, 514f, 480f, 62f, 14, Beige, (TextAnchor)0); _dNews = Label(t, "", num, 578f, 480f, 176f, 14, Beige, (TextAnchor)0); float num2 = 918f; float num3 = 258f; Box(t, num2 - 8f, 104f, num3 + 16f, 646f, new Color(0f, 0f, 0f, 0.25f)); string text = Texts.T("КУПИТЬ", "BUY"); object obj = <>c.<>9__105_0; if (obj == null) { UnityAction val3 = delegate { OpenOrder(1); }; <>c.<>9__105_0 = val3; obj = (object)val3; } ((Graphic)Btn(t, text, num2, 108f, num3, 60f, (UnityAction)obj).GetComponentInChildren<Text>()).color = Green; string text2 = Texts.T("ШОРТ (ставка на падение)", "SHORT (bet on a fall)"); object obj2 = <>c.<>9__105_1; if (obj2 == null) { UnityAction val4 = delegate { OpenOrder(-1); }; <>c.<>9__105_1 = val4; obj2 = (object)val4; } ((Graphic)Btn(t, text2, num2, 178f, num3, 44f, (UnityAction)obj2).GetComponentInChildren<Text>()).color = Red; _tradeMsg = Label(t, "", num2, 234f, num3, 110f, 14, Gold, (TextAnchor)0); _skillLine = Label(t, "", num2, 358f, num3, 140f, 13, Grey, (TextAnchor)0); } private static void BuildPortfolioTab(Transform t) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) _portSummary = Label(t, "", 28f, 108f, 1144f, 52f, 16, Beige, (TextAnchor)0); Header(t, 28f, 164f, new(string, float)[6] { (Texts.T("Акция", "Stock"), 130f), (Texts.T("Тип", "Side"), 100f), (Texts.T("Кол-во", "Qty"), 100f), (Texts.T("Ставка / объём", "Stake / size"), 150f), (Texts.T("Ср. вход » сейчас", "Avg entry » now"), 210f), (Texts.T("Выручка сейчас / прибыль", "Payout now / P/L"), 220f) }); _posList = Scroll(t, 28f, 192f, 1144f, 562f); } private static void BuildBankTab(Transform t) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Expected O, but got Unknown //IL_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Expected O, but got Unknown //IL_0404: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Expected O, but got Unknown //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_051f: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Expected O, but got Unknown float num = 28f; float num2 = 540f; Box(t, num - 8f, 104f, num2 + 16f, 300f, new Color(0f, 0f, 0f, 0.22f)); Label(t, Texts.T("Счёт", "Account"), num, 108f, num2, 28f, 22, Gold, (TextAnchor)3); _bankInfo = Label(t, "", num, 140f, num2, 90f, 16, Beige, (TextAnchor)0); _bankAmount = Field(t, num, 236f, 200f, 36f, Texts.T("сумма", "amount"), (ContentType)2); string text = Texts.T("Внести", "Deposit"); float x = num + 210f; object obj = <>c.<>9__107_0; if (obj == null) { UnityAction val = delegate { Engine.Deposit(ParseLong(_bankAmount.text)); }; <>c.<>9__107_0 = val; obj = (object)val; } Btn(t, text, x, 236f, 160f, 36f, (UnityAction)obj); string text2 = Texts.T("Внести всё", "Deposit all"); float x2 = num + 380f; object obj2 = <>c.<>9__107_1; if (obj2 == null) { UnityAction val2 = delegate { Engine.Deposit(Engine.InventoryCoins()); }; <>c.<>9__107_1 = val2; obj2 = (object)val2; } Btn(t, text2, x2, 236f, 160f, 36f, (UnityAction)obj2); string text3 = Texts.T("Снять", "Withdraw"); float x3 = num + 210f; object obj3 = <>c.<>9__107_2; if (obj3 == null) { UnityAction val3 = delegate { Engine.Withdraw(ParseLong(_bankAmount.text)); }; <>c.<>9__107_2 = val3; obj3 = (object)val3; } Btn(t, text3, x3, 280f, 160f, 36f, (UnityAction)obj3); string text4 = Texts.T("Снять всё", "Withdraw all"); float x4 = num + 380f; object obj4 = <>c.<>9__107_3; if (obj4 == null) { UnityAction val4 = delegate { AccountData accountData = AccountStore.Get(); if (accountData != null) { Engine.Withdraw(accountData.balance); } }; <>c.<>9__107_3 = val4; obj4 = (object)val4; } Btn(t, text4, x4, 280f, 160f, 36f, (UnityAction)obj4); _bankMsg = Label(t, "", num, 324f, num2, 70f, 14, Gold, (TextAnchor)0); float num3 = 600f; float num4 = 572f; Box(t, num3 - 8f, 104f, num4 + 16f, 430f, new Color(0f, 0f, 0f, 0.22f)); Label(t, Texts.T("Кредит у Хальдора", "Haldor's loans"), num3, 108f, num4, 28f, 22, Gold, (TextAnchor)3); _loanInfo = Label(t, "", num3, 140f, num4, 120f, 16, Beige, (TextAnchor)0); _takeGroup = Container(t, "take"); Label(_takeGroup.transform, Texts.T("Сумма кредита", "Loan amount"), num3, 266f, 200f, 22f, 14, Grey, (TextAnchor)3); _loanAmount = Field(_takeGroup.transform, num3, 290f, 200f, 36f, "500", (ContentType)2); _loanAmount.text = "500"; ((UnityEvent<string>)(object)_loanAmount.onValueChanged).AddListener((UnityAction<string>)delegate { RefreshBank(); }); for (int num5 = 0; num5 < Engine.Terms.Length; num5++) { int idx = num5; GameObject val5 = Btn(_takeGroup.transform, "", num3, 334f + (float)(num5 * 44), num4, 40f, (UnityAction)delegate { Msg(_bankMsg, Engine.TakeLoan(ParseLong(_loanAmount.text), idx)); }); _termLabels[num5] = val5.GetComponentInChildren<Text>(); } _repayGroup = Container(t, "repay"); Label(_repayGroup.transform, Texts.T("Погасить из счёта", "Repay from account"), num3, 266f, 300f, 22f, 14, Grey, (TextAnchor)3); InputField repayField = Field(_repayGroup.transform, num3, 290f, 200f, 36f, Texts.T("сумма", "amount"), (ContentType)2); Btn(_repayGroup.transform, Texts.T("Погасить", "Repay"), num3 + 210f, 290f, 170f, 36f, (UnityAction)delegate { long num6 = ParseLong(repayField.text); Msg(_bankMsg, (num6 > 0) ? Engine.Repay(num6) : Texts.T("Введи сумму или нажми «Погасить всё».", "Enter an amount or press 'Repay all'.")); }); Transform transform = _repayGroup.transform; string text5 = Texts.T("Погасить всё", "Repay all"); float x5 = num3 + 390f; object obj5 = <>c.<>9__107_6; if (obj5 == null) { UnityAction val6 = delegate { Msg(_bankMsg, Engine.Repay(0L)); }; <>c.<>9__107_6 = val6; obj5 = (object)val6; } Btn(transform, text5, x5, 290f, 182f, 36f, (UnityAction)obj5); _contract = Label(t, "", num3, 470f, num4, 66f, 13, Grey, (TextAnchor)0); Label(t, Texts.T("Письма от Хальдора", "Letters from Haldor"), num, 416f, num2, 26f, 18, Gold, (TextAnchor)3); _noticeList = Scroll(t, num, 446f, num2, 308f); } private static void BuildPawnTab(Transform t) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) Label(t, Texts.T("Твой инвентарь — Хальдор купит или даст под залог", "Your inventory: Haldor buys or lends against it"), 28f, 108f, 700f, 26f, 17, Gold, (TextAnchor)3); _invList = Scroll(t, 28f, 138f, 700f, 562f); _pawnMsg = Label(t, "", 28f, 708f, 700f, 44f, 14, Gold, (TextAnchor)0); Label(t, Texts.T("В залоге (выкуп 5 дней, +25%)", "Pawned (redeem within 5 days, +25%)"), 750f, 108f, 420f, 26f, 17, Gold, (TextAnchor)3); _pawnList = Scroll(t, 750f, 138f, 422f, 612f); } private static void BuildNewsTab(Transform t) { _newsList = Scroll(t, 28f, 108f, 1144f, 646f); } private static void BuildFundsTab(Transform t) { //IL_0026: 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_00ca: Unknown result type (might be due to invalid IL or missing references) Label(t, Texts.T("Крупные игроки Мидгарда", "Midgard's big players"), 28f, 108f, 700f, 26f, 18, Gold, (TextAnchor)3); _fundList = Scroll(t, 28f, 138f, 720f, 330f); Label(t, Texts.T("Рейтинг капиталов", "Capital ranking"), 770f, 108f, 400f, 26f, 18, Gold, (TextAnchor)3); _rankList = Scroll(t, 770f, 138f, 402f, 330f); Label(t, Texts.T("Чем закончились их сделки", "How their deals ended"), 28f, 478f, 900f, 26f, 18, Gold, (TextAnchor)3); _fundHist = Scroll(t, 28f, 508f, 1144f, 246f); } private static void BuildSettingsTab(Transform t) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown Label(t, Texts.T("Уведомления на экране", "On-screen notifications"), 28f, 108f, 540f, 26f, 18, Gold, (TextAnchor)3); Label(t, Texts.T("Письма в банке приходят всегда, здесь — только всплывающие сообщения.", "Letters in the bank always arrive; this only controls pop-ups."), 28f, 134f, 540f, 22f, 13, Grey, (TextAnchor)3); for (int i = 0; i < _toggleLabels.Length; i++) { int k = i; Text componentInChildren = Btn(t, "", 28f, 164f + (float)(i * 46), 540f, 40f, (UnityAction)delegate { ToggleSetting(k); }).GetComponentInChildren<Text>(); componentInChildren.alignment = (TextAnchor)3; componentInChildren.resizeTextForBestFit = false; componentInChildren.fontSize = 15; _toggleLabels[i] = componentInChildren; } _titleInfo = Label(t, "", 28f, 538f, 540f, 222f, 14, Beige, (TextAnchor)0); float num = 600f; float w = 572f; Label(t, Texts.T("Ценовые оповещения", "Price alerts"), num, 108f, w, 26f, 18, Gold, (TextAnchor)3); _alertFor = Label(t, "", num, 136f, w, 44f, 14, Beige, (TextAnchor)0); _alertPrice = Field(t, num, 184f, 180f, 36f, Texts.T("цена", "price"), (ContentType)3); string text = Texts.T("Если выше", "If above"); float x = num + 190f; object obj = <>c.<>9__111_0; if (obj == null) { UnityAction val = delegate { Msg(_alertMsg, Engine.AddAlert(_sel, 1, ParseDouble(_alertPrice.text))); }; <>c.<>9__111_0 = val; obj = (object)val; } Btn(t, text, x, 184f, 180f, 36f, (UnityAction)obj); string text2 = Texts.T("Если ниже", "If below"); float x2 = num + 380f; object obj2 = <>c.<>9__111_1; if (obj2 == null) { UnityAction val2 = delegate { Msg(_alertMsg, Engine.AddAlert(_sel, -1, ParseDouble(_alertPrice.text))); }; <>c.<>9__111_1 = val2; obj2 = (object)val2; } Btn(t, text2, x2, 184f, 192f, 36f, (UnityAction)obj2); _alertMsg = Label(t, "", num, 224f, w, 26f, 14, Gold, (TextAnchor)3); _alertList = Scroll(t, num, 254f, w, 500f); } private static void ToggleSetting(int k) { AccountData accountData = AccountStore.Get(); if (accountData != null) { switch (k) { case 0: accountData.nHours = !accountData.nHours; break; case 1: accountData.nMinute = !accountData.nMinute; break; case 2: accountData.nDiv = !accountData.nDiv; break; case 3: accountData.nTrades = !accountData.nTrades; break; case 4: accountData.nWhales = !accountData.nWhales; break; case 5: accountData.nAlerts = !accountData.nAlerts; break; case 6: accountData.nWorld = !accountData.nWorld; break; case 7: accountData.nShare = !accountData.nShare; break; } AccountStore.Save(); _dirty = true; } } private static void RefreshSettings(AccountData acc, Market m, long now) { //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_03eb: Unknown result type (might be due to invalid IL or missing references) //IL_0401: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Expected O, but got Unknown bool[] array = new bool[8] { acc.nHours, acc.nMinute, acc.nDiv, acc.nTrades, acc.nWhales, acc.nAlerts, acc.nWorld, acc.nShare }; string[] array2 = new string[8] { "Открытие и закрытие биржи", "«Торги откроются через минуту»", "Дивиденды (выплаты и отсечки)", "Сделки: стоп-лосс, тейк-профит, ликвидация", "Фонды давят на твои бумаги", "Сработавшие ценовые оповещения", "Пульс мира: новости из мира на экране", "Показывать мои сделки друзьям на графике" }; string[] array3 = new string[8] { "Exchange opening and closing", "'Trading opens in one minute'", "Dividends (payments and ex-dates)", "Trades: stop-loss, take-profit, liquidation", "Funds pushing your stocks", "Triggered price alerts", "World Pulse: world news cards on screen", "Show my trades to friends on the chart" }; for (int i = 0; i < _toggleLabels.Length; i++) { _toggleLabels[i].text = " " + (Texts.IsRu ? On(array[i]) : OnEn(array[i])) + (Texts.IsRu ? array2[i] : array3[i]); } _titleInfo.text = "<color=#ffc850><size=17>" + Texts.T("Твоё звание: ", "Your title: ") + Engine.Title(acc) + "</size></color>\n" + Texts.T("Юнга рынка » Подмастерье менялы (10) » Торговый викинг (25) » Волк Хальдорова ряда (45) » Ярл биржи (70) » Ярл Иггдрасиля (90 и +50 000 прибыли)", "Cabin boy » Apprentice (10) » Trading Viking (25) » Wolf of Haldor Street (45) » Jarl of the Exchange (70) » Jarl of Yggdrasil (90 and +50,000 profit)") + "\n\n" + Texts.T("Дивиденды получено за всё время: ", "Dividends received all-time: ") + Texts.Coins(acc.divTotal); StockDef stockDef = Stocks.All[_sel]; _alertFor.text = Texts.T("Бумага: ", "Stock: ") + "<color=#ffc850>" + stockDef.Sym + "</color> " + stockDef.Name + Texts.T(" · сейчас ", " · now ") + Texts.Price(m.Price(_sel, now)) + "\n<color=#bdb39d>" + Texts.T("Другую бумагу выбери на вкладке «Биржа».", "Pick another stock on the Exchange tab.") + "</color>"; Clear(_alertList); float num = 0f; int num2 = 0; foreach (PriceAlert item in acc.alerts.ToList()) { PriceAlert al = item; Transform parent = Row(_alertList, num, 40f, (num2++ % 2 == 0) ? RowA : RowB, null); Label(parent, "<color=#ffc850>" + item.sym + "</color> " + ((item.dir > 0) ? Texts.T("выше ", "above ") : Texts.T("ниже ", "below ")) + Texts.Price(item.price), 10f, 0f, 380f, 40f, 15, Beige, (TextAnchor)3); Btn(parent, Texts.T("Удалить", "Delete"), 440f, 5f, 110f, 30f, (UnityAction)delegate { Engine.RemoveAlert(al); }); num += 42f; } if (num2 == 0) { Label((Transform)(object)_alertList, Texts.T("Оповещений нет.", "No alerts."), 10f, 6f, 400f, 26f, 14, Grey, (TextAnchor)3); } _alertList.sizeDelta = new Vector2(_alertList.sizeDelta.x, Math.Max(40f, num)); static string On(bool v) { if (!v) { return "<color=#ff6050>[ВЫКЛ]</color> "; } return "<color=#73e06b>[ВКЛ]</color> "; } static string OnEn(bool v) { if (!v) { return "<color=#ff6050>[OFF]</color> "; } return "<color=#73e06b>[ON]</color> "; } } private static void BuildHistoryTab(Transform t) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) _stats = Label(t, "", 28f, 108f, 420f, 642f, 15, Beige, (TextAnchor)0); Label(t, Texts.T("Последние сделки", "Recent trades"), 470f, 108f, 600f, 26f, 18, Gold, (TextAnchor)3); _histList = Scroll(t, 470f, 138f, 702f, 616f); } private static void Refresh(bool full) { AccountData accountData = AccountStore.Get(); Market market = Market.Get(); if (accountData == null || market == null) { return; } long nowTick = market.NowTick; bool flag = !market.IsWarm; if (flag != _loading) { _loading = flag; if ((Object)(object)_order != (Object)null && flag) { _order.SetActive(false); } ShowTab(); full = true; } if (flag) { string text = ((!WorldData.Synced) ? Texts.T("Ждём летопись мира от хоста...", "Waiting for the world chronicle from the host...") : (Texts.T("Хальдор сверяет книги: история рынка ", "Haldor is checking the books: market history ") + Texts.Num(market.WarmProgress * 100.0, "0") + "%")); _headerInfo.text = Texts.Clock(nowTick) + "\n" + text; if ((Object)(object)_loadingLabel != (Object)null) { _loadingLabel.text = text + "\n<size=14><color=#bdb39d>" + Texts.T("Это бывает один раз после входа в старый мир. Руководство уже можно читать.", "This happens once after entering an old world. The guide is already available.") + "</color></size>"; } if (_tab == 8) { RefreshGuide(); } return; } market.EnsureTo(nowTick); string text2 = (market.IsOpenNow ? ("<color=#73e06b>" + Texts.T("Биржа открыта", "Exchange open") + "</color> " + Texts.T("до 18:00 (", "until 18:00 (") + Texts.Mmss(market.SecondsUntilTick(Market.NextCloseTick(nowTick))) + ")") : ("<color=#ff9a50>" + Texts.T("Биржа закрыта", "Exchange closed") + "</color> " + Texts.T("откроется через ", "opens in ") + Texts.Mmss(market.SecondsUntilTick(Market.NextOpenTick(nowTick))))); string text3 = (accountData.loan.active ? (" · <color=" + (Engine.IsOverdue(accountData, nowTick) ? "#ff6050" : "#ffb040") + ">" + Texts.T("Долг: ", "Debt: ") + Texts.Coins(accountData.loan.owed) + "</color>") : ""); _headerInfo.text = Texts.Clock(nowTick) + " · " + text2 + "\n" + Texts.T("Счёт: ", "Balance: ") + "<color=#ffc850>" + Texts.Coins(accountData.balance) + "</color> · " + Texts.T("в кармане: ", "pocket: ") + Texts.Coins(Engine.InventoryCoins()) + "\n" + Texts.T("Торговля ", "Trading ") + Mathf.FloorToInt(Engine.Skill) + " · <color=#ffc850>" + Engine.Title(accountData) + "</color>" + text3; switch (_tab) { case 0: if (full) { RefreshMarket(accountData, market, nowTick); } else { UpdatePreview(); } break; case 1: if (full) { RefreshPortfolio(accountData, market, nowTick); } break; case 2: if (full) { RefreshBank(); } break; case 3: if (full) { RefreshPawn(accountData, nowTick); } break; case 4: if (full) { RefreshNews(market, nowTick); } break; case 5: if (full) { RefreshHistory(accountData); } break; case 6: if (full) { RefreshFunds(accountData, market, nowTick); } break; case 7: if (full) { RefreshPulse(market, nowTick); } break; case 8: RefreshGuide(); break; case 9: if (full) { RefreshSettings(accountData, market, nowTick); } break; } if (full) { RefreshTicker(market, nowTick); } } private static void RefreshMarket(AccountData acc, Market m, long now) { //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_0430: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) Clear(_stockList); float num = 0f; for (int i = 0; i < Stocks.All.Count; i++) { StockDef stockDef = Stocks.All[i]; int idx = i; bool flag = Stocks.IsListed(stockDef); Transform val = Row(_stockList, num, 48f, (i == _sel) ? RowSel : ((i % 2 == 0) ? RowA : RowB), delegate { _sel = idx; _dirty = true; }); double num2 = m.Price(i, now); double num3 = m.Change(i, now, 96L); Label(val, stockDef.Sym, 8f, 3f, 80f, 22f, 17, flag ? Gold : Grey, (TextAnchor)3); Label(val, stockDef.Name + ((stockDef.DivEvery > 0) ? (" <color=#ffc850>" + Texts.T("див.", "div") + "</color>") : ""), 8f, 24f, 230f, 20f, 13, flag ? Beige : Grey, (TextAnchor)3); if (flag) { FlashRow(val, i, num2, now); Label(val, Texts.Price(num2), 200f, 3f, 150f, 22f, 17, Beige, (TextAnchor)5); Label(val, Texts.Pct(num3), 200f, 24f, 150f, 20f, 14, (num3 >= 0.0) ? Green : Red, (TextAnchor)5); } else { Label(val, Texts.T("IPO после", "IPO after"), 200f, 3f, 150f, 22f, 13, Grey, (TextAnchor)5); Label(val, Texts.IsRu ? stockDef.UnlockRu : stockDef.UnlockEn, 140f, 24f, 210f, 20f, 12, Grey, (TextAnchor)5); } num += 50f; } _stockList.sizeDelta = new Vector2(_stockList.sizeDelta.x, num); _lastPxTick = now; StockDef def = Stocks.All[_sel]; bool flag2 = Stocks.IsListed(def); double p = m.Price(_sel, now); _dName.text = def.Name + " <size=18><color=#bdb39d>" + def.Sym + "</color></size>"; _dSector.text = def.Sector + " · " + Texts.T("риск: ", "risk: ") + def.RiskLabel; _dSlogan.text = "«" + def.Slogan + "»"; SetPrice(p, flag2); double change = m.Change(_sel, now, 96L); double change2 = m.Change(_sel, now, 672L); _dChange.text = (flag2 ? (Texts.T("сутки ", "24h ") + Colored(change) + "\n" + Texts.T("неделя ", "7d ") + Colored(change2)) : (Texts.T("Выйдет на биржу после ", "Lists after ") + (Texts.IsRu ? def.UnlockRu : def.UnlockEn))); for (int num4 = 0; num4 < _rangeLabels.Length; num4++) { int[] ranges = Ranges; ((Graphic)_rangeLabels[num4]).color = ((ranges[num4] == _range) ? Gold : Beige); } DrawChart(m, acc, now); int mood = m.Mood(now); _mood.text = Texts.T("Настроение: ", "Mood: ") + MoodText(mood) + " (" + mood + ")"; List<Bankruptcy> list = m.Bankruptcies.Where((Bankruptcy b) => b.Stock == _sel && b.Tick <= now).ToList(); List<string> list2 = new List<string>(); list2.Add(Texts.T("Твоих позиций: ", "Your positions: ") + acc.positions.Count((Position x) => x.sym == def.Sym) + ((list.Count > 0) ? (" <color=#ff6050>" + Texts.T("Банкротств: ", "Bankruptcies: ") + list.Count + "</color>") : "") + ((def.Links != null && def.Links.Count > 0) ? (" " + Texts.T("Связана с: ", "Linked to: ") + string.Join(", ", def.Links.Keys)) : "")); if (def.DivEvery > 0) { list2.Add("<color=#ffc850>" + Texts.T("Дивиденд ", "Dividend ") + Texts.Pct(def.DivYield, sign: false) + Texts.T(" раз в ", " every ") + def.DivEvery + Texts.T(" дн. · отсечка ", " d · ex-date ") + Texts.Clock(m.NextExTick(_sel, now)) + "</color>"); } if (!m.IsOpenNow && flag2 && !def.IsIndex) { double num5 = m.PerceivedNightFlow(_sel, now, Engine.Skill); string text = ((num5 > 0.005) ? Texts.T("покупатели перевешивают", "buyers dominate") : ((num5 < -0.005) ? Texts.T("продавцы перевешивают", "sellers dominate") : Texts.T("равновесие", "balanced"))); list2.Add("<color=#c8a0ff>" + Texts.T("Ночные заявки: ", "Overnight orders: ") + text + " (" + Texts.Pct(num5) + ")</color>"); } else { List<Campaign> list3 = (from c in m.ActiveCampaigns(now) where c.Stock == _sel select c).ToList(); if (list3.Count > 0) { list2.Add("<color=#ffb040>" + string.Join("; ", list3.Select((Campaign c) => Funds.All[c.Fund].Name + ((c.Dir > 0) ? Texts.T(" скупает", " is buying") : Texts.T(" продаёт", " is selling")))) + "</color>"); } } _dExtra.text = string.Join("\n", list2); List<string> list4 = new List<string>(); float skill = Engine.Skill; foreach (Market.Rumour item in (from r in m.Rumours(now, skill) where r.Event.Stock == _sel select r).Take(2)) { list4.Add("<color=#c8a0ff>" + Texts.T("Слух: ", "Rumour: ") + RumourText(item) + "</color>"); } foreach (MarketEvent item2 in (from e in m.RecentNews(now, 672L) where e.Stock == _sel || e.Stock < 0 select e).Take(5)) { list4.Add("<color=#bdb39d>" + Texts.Clock(item2.Tick) + "</color> " + (item2.Positive ? "<color=#73e06b>[+]</color> " : "<color=#ff6050>[-]</color> ") + item2.Headline); } _dNews.text = ((list4.Count > 0) ? string.Join("\n", list4) : Texts.T("Тишина. Никто ничего не слышал.", "Silence. Nobody heard a thing.")); UpdatePreview(); } private static void BuildOrderDialog(Transform parent) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Expected O, but got Unknown //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0320: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Expected O, but got Unknown //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Expected O, but got Unknown //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Expected O, but got Unknown GUIManager instance = GUIManager.Instance; _order = Container(parent, "orderDialog"); ((Graphic)Box(_order.transform, 0f, 0f, 1200f, 780f, new Color(0f, 0f, 0f, 0.62f))).raycastTarget = true; float num = 560f; float num2 = 590f; Transform transform = instance.CreateWoodpanel(_order.transform, new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), Vector2.zero, num, num2, false).transform; _ordTitle = Label(transform, "", 30f, 16f, 500f, 36f, 26, Gold, (TextAnchor)3); _ordPrice = Label(transform, "", 30f, 56f, 500f, 40f, 14, Beige, (TextAnchor)0); Label(transform, Texts.T("Количество, шт.", "Quantity, shares"), 30f, 100f, 240f, 20f, 14, Grey, (TextAnchor)3); Label(transform, Texts.T("Всего потратить, монет", "Total to spend, coins"), 290f, 100f, 240f, 20f, 14, Grey, (TextAnchor)3); _qty = Field(transform, 30f, 122f, 240f, 36f, "0", (ContentType)3); _amount = Field(transform, 290f, 122f, 240f, 36f, "0", (ContentType)2); ((UnityEvent<string>)(object)_qty.onValueChanged).AddListener((UnityAction<string>)delegate { if (!_syncing) { OrderFromQty(); } }); ((UnityEvent<string>)(object)_amount.onValueChanged).AddListener((UnityAction<string>)delegate { if (!_syncing) { OrderFromAmount(); } }); double[] array = new double[4] { 0.1, 0.25, 0.5, 1.0 }; string[] array2 = new string[4] { "10%", "25%", "50%", Texts.T("Максимум", "Max") }; for (int num3 = 0; num3 < 4; num3++) { double k = array[num3]; Btn(transform, array2[num3], 30 + num3 * 127, 166f, 117f, 30f, (UnityAction)delegate { OrderFraction(k); }); } Label(transform, Texts.T("Плечо (1x = обычная покупка акций)", "Leverage (1x = plain share purchase)"), 30f, 208f, 500f, 20f, 14, Grey, (TextAnchor)3); for (int num4 = 0; num4 < Levs.Length; num4++) { int lv = Levs[num4]; GameObject val = Btn(transform, lv + "x", 30 + num4 * 78, 230f, 70f, 32f, (UnityAction)delegate { _lev = lv; OrderFromAmount(); }); _levLabels[num4] = val.GetComponentInChildren<Text>(); } Label(transform, Texts.T("Стоп-лосс %", "Stop-loss %"), 30f, 274f, 240f, 20f, 13, Grey, (TextAnchor)3); Label(transform, Texts.T("Тейк-профит %", "Take-profit %"), 290f, 274f, 240f, 20f, 13, Grey, (TextAnchor)3); _sl = Field(transform, 30f, 296f, 240f, 32f, Texts.T("нет", "off"), (ContentType)2); _tp = Field(transform, 290f, 296f, 240f, 32f, Texts.T("нет", "off"), (ContentType)2); _preview = Label(transform, "", 30f, 340f, 500f, 150f, 14, Beige, (TextAnchor)0); _ordMsg = Label(transform, "", 30f, 492f, 500f, 34f, 14, Red, (TextAnchor)0); _ordOk = Btn(transform, "", 30f, 532f, 240f, 46f, new UnityAction(DoOrder)).GetComponentInChildren<Text>(); string text = Texts.T("Отмена", "Cancel"); object obj = <>c.<>9__119_2; if (obj == null) { UnityAction val2 = delegate { _order.SetActive(false); }; <>c.<>9__119_2 = val2; obj = (object)val2; } Btn(transform, text, 290f, 532f, 240f, 46f, (UnityAction)obj); _order.SetActive(false); } private static void OpenOrder(int dir) { //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_order == (Object)null) && !_loading) { _orderDir = dir; StockDef stockDef = Stocks.All[_sel]; _ordTitle.text = ((dir > 0) ? Texts.T("Покупка ", "Buy ") : Texts.T("Шорт ", "Short ")) + stockDef.Sym; bool flag = Market.Get() != null && !Market.Get().IsOpenNow; _ordOk.text = (flag ? Texts.T("ПОДАТЬ ЗАЯВКУ", "PLACE ORDER") : ((dir > 0) ? Texts.T("КУПИТЬ", "BUY") : Texts.T("ОТКРЫТЬ ШОРТ", "OPEN SHORT"))); ((Graphic)_ordOk).color = ((dir > 0) ? Green : Red); _syncing = true; _qty.text = ""; _amount.text = ""; _syncing = false; _ordMsg.text = ""; _order.SetActive(true); _order.transform.SetAsLastSibling(); UpdateOrder(); } } private static double OrderPrice() { if (Market.Get() != null) { return Market.Get().Price(_sel, Market.Get().NowTick); } return 0.0; } private static double FillPrice(double notional) { return OrderPrice() * (1.0 + (double)_orderDir * Engine.Slippage(Stocks.All[_sel], notional)); } private static long Available(AccountData acc) { return acc.balance + Engine.InventoryCoins(); } private static void OrderFromAmount() { long num = Engine.MaxStake(ParseLong(_amount.text), _lev, Engine.Skill); double num2 = (double)num * (double)_lev; _syncing = true; _qty.text = ((num > 0) ? Texts.Num(num2 / Math.Max(1E-09, FillPrice(num2)), "0.##") : ""); _syncing = false; UpdateOrder(); } private static void OrderFromQty() { double num = ParseDouble(_qty.text); double notional = num * OrderPrice(); long num2 = ((num > 0.0) ? ((long)Math.Ceiling(num * FillPrice(notional) / (double)_lev)) : 0); long num3 = ((num2 > 0) ? (num2 + Engine.FeeFor(num2, _lev, Engine.Skill)) : 0); _syncing = true; _amount.text = ((num3 > 0) ? num3.ToString() : ""); _syncing = false; UpdateOrder(); } private static void OrderFraction(double k) { AccountData accountData = AccountStore.Get(); if (accountData != null) { _amount.text = ((long)Math.Floor((double)Available(accountData) * k)).ToString(); OrderFromAmount(); } } private static void UpdatePreview() { if (AccountStore.Get() != null && !((Object)(object)_skillLine == (Object)null)) { float skill = Engine.Skill; _skillLine.text = Texts.T("Торговля ", "Trading ") + Mathf.FloorToInt(skill) + "\n" + ((skill < 5f) ? Texts.T($"- Шорт с ур. {5}\n", $"- Shorts at level {5}\n") : "") + ((skill < 15f) ? Texts.T($"- Стопы с ур. {15}\n", $"- Stops at level {15}\n") : "") + Texts.T("- Слухи за ", "- Rumours ") + Market.RumourLead(skill) + Texts.T(" ч до события", " h before events") + "\n" + Texts.T("- Прибыльные сделки учат быстрее", "- Profitable trades teach faster"); UpdateOrder(); } } private static void UpdateOrder() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) AccountData accountData = AccountStore.Get(); Market market = Market.Get(); if (accountData != null && market != null && !((Object)(object)_order == (Object)null) && _order.activeSelf && !((Object)(object)_preview == (Object)null) && market.IsWarm) { float skill = Engine.Skill; int num = Engine.MaxLeverage(skill); if (_lev > num) { _lev = num; } for (int i = 0; i < Levs.Length; i++) { bool flag = Levs[i] <= num; _levLabels[i].text = Levs[i] + "x"; ((Graphic)_levLabels[i]).color = ((!flag) ? Grey : ((Levs[i] == _lev) ? Gold : Beige)); } double num2 = market.Price(_sel, market.NowTick); StockDef def = Stocks.All[_sel]; long num3 = Engine.MaxStake(ParseLong(_amount.text), _lev, skill); long num4 = Engine.FeeFor(num3, _lev, skill); double num5 = (double)num3 * (double)_lev; double num6 = Engine.Slippage(def, num5); double num7 = num2 * (1.0 + (double)_orderDir * num6); _ordPrice.text = Texts.T("Рыночная заявка. Цена сейчас: ", "Market order. Price now: ") + "<color=#ffc850>" + Texts.Price(num2) + "</color>" + Texts.T(" · на счёте ", " · account ") + Texts.Coins(accountData.balance) + Texts.T(", в кармане ", ", pocket ") + Texts.Coins(Engine.InventoryCoins()); string text = (market.IsOpenNow ? "" : ("<color=#ff9a50>" + Texts.T("Ночь: биржа закрыта. Заявка исполнится в 06:00 по цене открытия, монеты резервируются сразу. Цифры ниже ориентировочные.\n", "Night: the exchange is closed. The order fills at 06:00 at the opening price