Decompiled source of Ledger v1.0.0
Ledger.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Ledger.Cruncher; using Ledger.Desk; using Ledger.Model; using Microsoft.CodeAnalysis; using SOD.Common; using SOD.Common.Helpers; using SOD.Common.Helpers.DialogObjects; using TMPro; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Ledger")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Ledger")] [assembly: AssemblyTitle("Ledger")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Ledger { public static class Bank { private sealed class Pop : IDisposable { private bool _done; public void Dispose() { if (!_done) { _done = true; if (Contexts.Count > 0) { Contexts.Pop(); } } } } public const string Main = "main"; private static readonly Stack<(string Category, string Memo)> Contexts = new Stack<(string, string)>(); private static (string Reason, string Category, string Memo, int Frame)? _next; private static readonly Dictionary<string, IBill> BillsById = new Dictionary<string, IBill>(); public static int Balance => Journal.MainBalance; public static IReadOnlyList<Entry> Statement => Journal.Entries; internal static (string Category, string Memo)? CurrentContext { get { if (Contexts.Count <= 0) { return null; } return Contexts.Peek(); } } public static IEnumerable<Account> Accounts => Journal.Accounts.Values; public static IEnumerable<IBill> Bills => BillsById.Values.OrderBy((IBill b) => b.DueAt); internal static IEnumerable<IBill> AllBills => from b in BillsById.Values.Concat(LoanBills.Current()) orderby b.DueAt select b; public static event Action<Entry>? Posted; internal static void RaisePosted(Entry entry) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown try { Bank.Posted?.Invoke(entry); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ledger] a Posted handler failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } internal static void LabelNext(string reason, string category, string memo) { _next = (reason, category, memo, Time.frameCount); } internal static (string Category, string Memo)? TakeLabel(string? reason) { (string, string, string, int)? next = _next; if (next.HasValue) { (string, string, string, int) valueOrDefault = next.GetValueOrDefault(); if (Time.frameCount - valueOrDefault.Item4 > 1) { _next = null; return null; } if (reason != valueOrDefault.Item1) { return null; } _next = null; return (valueOrDefault.Item2, valueOrDefault.Item3); } return null; } public static void Post(int amount, string category, string memo) { if (amount == 0 || (Object)(object)GameplayController.Instance == (Object)null) { return; } using (Context(category, memo)) { GameplayController.Instance.AddMoney(amount, true, "ledger:" + category + "|" + memo); } } public static IDisposable Context(string category, string memo) { Contexts.Push((category, memo)); return new Pop(); } public static Account OpenAccount(string id, string title, AccountKind kind) { if (Journal.Accounts.TryGetValue(id, out Account value)) { value.Title = title; return value; } Account obj = new Account { Id = id, Title = title, Kind = kind }; SessionData instance = SessionData.Instance; obj.OpenedAt = ((instance != null) ? instance.gameTime : 0f); Account account = obj; Journal.Accounts[id] = account; Plugin.Debug($"[ledger] opened account {id} ({kind}) '{title}'"); return account; } public static Account? GetAccount(string id) { if (!Journal.Accounts.TryGetValue(id, out Account value)) { return null; } return value; } public static bool Deposit(string id, int amount) { Account account = GetAccount(id); if (account == null || amount <= 0 || Balance < amount) { return false; } Post(-amount, "Transfers", "To " + account.Title); account.Balance += amount; Journal.Add(id, amount, account.Balance, "Transfers", "From main account", ""); return true; } public static bool Withdraw(string id, int amount) { Account account = GetAccount(id); if (account == null || account.Kind != AccountKind.Withdrawable || amount <= 0 || account.Balance < amount) { return false; } account.Balance -= amount; Journal.Add(id, -amount, account.Balance, "Transfers", "To main account", ""); Post(amount, "Transfers", "From " + account.Title); return true; } public static bool Draw(string id, int amount, string memo) { Account account = GetAccount(id); if (account == null || amount <= 0 || account.Balance < amount) { return false; } account.Balance -= amount; Journal.Add(id, -amount, account.Balance, account.Title, memo, ""); return true; } public static bool Credit(string id, int amount, string memo) { Account account = GetAccount(id); if (account == null || amount <= 0) { return false; } account.Balance += amount; Journal.Add(id, amount, account.Balance, account.Title, memo, ""); return true; } public static void CloseAccount(string id, bool refund, string memo) { Account account = GetAccount(id); if (account == null) { return; } int balance = account.Balance; if (balance > 0) { account.Balance = 0; Journal.Add(id, -balance, 0, account.Title, memo, ""); if (refund) { Post(balance, "Transfers", "Refund from " + account.Title); } } Journal.Accounts.Remove(id); Plugin.Debug($"[ledger] closed account {id}, {(refund ? "refunded" : "kept")} {balance}"); } public static void RegisterBill(IBill bill) { BillsById[bill.Id] = bill; } public static void UnregisterBill(string id) { BillsById.Remove(id); } internal static void ClearBills() { BillsById.Clear(); } } public enum BillStatus { Upcoming, Due, Overdue, Paid } public interface IBill { string Id { get; } string Payee { get; } string Title { get; } int AmountDue { get; } float DueAt { get; } BillStatus Status { get; } string? AccountId { get; } bool Pay(); } [BepInPlugin("ekem.ledger", "Ledger", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { public static ManualLogSource Log { get; private set; } public static Settings Cfg { get; private set; } public override void Load() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown Log = ((BasePlugin)this).Log; Cfg = new Settings(((BasePlugin)this).Config); ClassInjector.RegisterTypeInIl2Cpp<BankApp>(); Store.Hook(); StatementDesk.Install(); new Harmony("ekem.ledger").PatchAll(); ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(9, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Ledger"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" loaded."); } log.LogInfo(val); } internal static void Debug(string message) { if (Cfg.DebugLogging.Value) { Log.LogInfo((object)message); } } } public class Settings { public readonly ConfigEntry<int> StatementFee; public readonly ConfigEntry<int> KeepDays; public readonly ConfigEntry<int> TransferStep; public readonly ConfigEntry<Look> Look; public readonly ConfigEntry<bool> DebugLogging; public Settings(ConfigFile config) { StatementFee = config.Bind<int>("Bank", "StatementFee", 5, "What a City Hall clerk charges for a printed statement. The fee shows up on that same statement."); KeepDays = config.Bind<int>("Bank", "KeepDays", 14, "For how many in-game days the statement keeps every transaction. Older ones are folded into one line per day and category."); TransferStep = config.Bind<int>("Bank", "TransferStep", 50, "How much one press of Deposit or Withdraw moves between your account and a bill account."); Look = config.Bind<Look>("Display", "Look", Ledger.Cruncher.Look.Retro, "How the Ledger app looks. System: inside the game's own window, like Vacuum Mail. Retro: the same layout in its own green window. Modern: a big banking screen with a side menu and cards. Takes effect the next time you open the app."); DebugLogging = config.Bind<bool>("Debug", "DebugLogging", false, "Log every recorded transaction."); } } public static class PluginInfo { public const string Guid = "ekem.ledger"; public const string Name = "Ledger"; public const string Version = "1.0.0"; } } namespace Ledger.Model { public enum AccountKind { Prepaid, Withdrawable } public class Account { public string Id { get; set; } = ""; public string Title { get; set; } = ""; public AccountKind Kind { get; set; } public int Balance { get; set; } public float OpenedAt { get; set; } } public static class Categories { private record Rule(string Category, string Memo, bool Merge = false); public const string Shopping = "Shopping"; public const string Services = "Services"; public const string Property = "Property"; public const string Furniture = "Furniture"; public const string CaseWork = "Case Work"; public const string Information = "Information Bonuses"; public const string SyncDisks = "Sync Disks"; public const string Loans = "Loans"; public const string Fines = "Fines"; public const string Theft = "Theft"; public const string Wages = "Wages"; public const string Transfers = "Transfers"; public const string Bank = "Bank"; public const string Other = "Other"; private static readonly Dictionary<string, Rule> Rules = new Dictionary<string, Rule>(StringComparer.OrdinalIgnoreCase) { ["purchase"] = new Rule("Shopping", "Purchase"), ["sell"] = new Rule("Shopping", "Sale"), ["Action cost"] = new Rule("Services", "Machine or service"), ["dialog_cost"] = new Rule("Services", "Paid service"), ["payphone"] = new Rule("Services", "Payphone"), ["Property purchase"] = new Rule("Property", "Property purchase"), ["furniture purchase"] = new Rule("Furniture", "Furniture"), ["decor purchase"] = new Rule("Furniture", "Decor"), ["Sell furniture"] = new Rule("Furniture", "Furniture sold"), ["case reward"] = new Rule("Case Work", "Case reward"), ["case penalty"] = new Rule("Case Work", "Case penalty"), ["Complete lost and found"] = new Rule("Case Work", "Lost and found reward"), ["Cover up complete"] = new Rule("Case Work", "Cover-up payment"), ["corpsabotage"] = new Rule("Case Work", "Corporate sabotage"), ["Acquire name"] = new Rule("Case Work", "Name lookup"), ["moneyforaddresses"] = new Rule("Information Bonuses", "New addresses", Merge: true), ["moneyforpasscodes"] = new Rule("Information Bonuses", "Passcodes found", Merge: true), ["moneyforblueprints"] = new Rule("Information Bonuses", "Blueprints explored", Merge: true), ["moneyforducts"] = new Rule("Information Bonuses", "Air ducts found", Merge: true), ["readingformoney"] = new Rule("Information Bonuses", "Reading", Merge: true), ["readingforstreetcleaning"] = new Rule("Information Bonuses", "Street cleaning", Merge: true), ["Hygeine photo"] = new Rule("Information Bonuses", "Hygiene photos", Merge: true), ["sync disk"] = new Rule("Sync Disks", "Sync disk"), ["Uninstall sync disk"] = new Rule("Sync Disks", "Sync disk removal"), ["Loan"] = new Rule("Loans", "Loan received"), ["Debt payoff"] = new Rule("Loans", "Loan repayment"), ["fines"] = new Rule("Fines", "Fines paid"), ["Mugged"] = new Rule("Theft", "Mugged"), ["stolen from wallet"] = new Rule("Theft", "Taken from a wallet"), ["Stolen from briefcase"] = new Rule("Theft", "Taken from a briefcase"), ["Put in briefcase"] = new Rule("Theft", "Left in a briefcase"), ["Thrown coin"] = new Rule("Other", "Coin thrown"), ["Beg"] = new Rule("Other", "Begging"), ["Starch pitch"] = new Rule("Other", "Starch pitch"), ["Starch give"] = new Rule("Other", "Starch"), ["salary"] = new Rule("Wages", "Pay") }; public const string ReasonPrefix = "ledger:"; public static (string Category, string Memo, bool Merge) Of(string? reason) { if (reason == null) { reason = ""; } if (reason.StartsWith("ledger:", StringComparison.Ordinal)) { string text = reason.Substring("ledger:".Length); int num = text.IndexOf('|'); if (num >= 0) { return (Category: text.Substring(0, num), Memo: text.Substring(num + 1), Merge: false); } return (Category: text, Memo: "", Merge: false); } if (Rules.TryGetValue(reason, out Rule value)) { return (Category: value.Category, Memo: value.Memo, Merge: value.Merge); } return (Category: "Other", Memo: (reason.Length == 0) ? "Unlabelled" : reason, Merge: false); } } public class Entry { public float T { get; set; } public int Amount { get; set; } public int Balance { get; set; } public string Account { get; set; } = "main"; public string Category { get; set; } = "Other"; public string Memo { get; set; } = ""; public string Reason { get; set; } = ""; public int Count { get; set; } = 1; } internal static class Journal { internal static List<Entry> Entries { get; private set; } = new List<Entry>(); internal static Dictionary<string, Account> Accounts { get; private set; } = new Dictionary<string, Account>(); internal static float OpenedAt { get; set; } = -1f; private static float Now { get { if (!((Object)(object)SessionData.Instance != (Object)null)) { return 0f; } return SessionData.Instance.gameTime; } } internal static int MainBalance { get { if (!((Object)(object)GameplayController.Instance != (Object)null)) { return 0; } return GameplayController.Instance.money; } } internal static void Reset() { Entries = new List<Entry>(); Accounts = new Dictionary<string, Account>(); OpenedAt = -1f; } internal static void Load(List<Entry>? entries, List<Account>? accounts, float openedAt) { Entries = entries ?? new List<Entry>(); Accounts = (accounts ?? new List<Account>()).ToDictionary((Account a) => a.Id); OpenedAt = openedAt; } internal static Entry Add(string account, int amount, int balance, string category, string memo, string reason, bool merge = false) { float now = Now; if (merge && Entries.Count > 0) { Entry entry = Entries[Entries.Count - 1]; if (entry.Account == account && entry.Category == category && entry.Memo == memo && Math.Sign(entry.Amount) == Math.Sign(amount) && now - entry.T < 1f) { entry.Amount += amount; entry.Balance = balance; entry.Count++; Bank.RaisePosted(entry); return entry; } } Entry entry2 = new Entry { T = now, Amount = amount, Balance = balance, Account = account, Category = category, Memo = memo, Reason = reason }; Entries.Add(entry2); if (OpenedAt < 0f) { OpenedAt = now; } Plugin.Debug($"[ledger] {account} {amount:+#;-#;0} → {balance} | {category} | {memo} | reason '{reason}'"); Bank.RaisePosted(entry2); return entry2; } internal static void Fold() { float cutoff = Now - (float)Plugin.Cfg.KeepDays.Value * 24f; List<Entry> list = Entries.Where((Entry e) => e.T < cutoff).ToList(); if (list.Count == 0) { return; } Entries = (from e in (from e in list group e by ((int)Math.Floor(e.T / 24f), Account: e.Account, Category: e.Category)).Select(delegate(IGrouping<(int, string Account, string Category), Entry> g) { List<Entry> list2 = g.OrderBy((Entry e) => e.T).ToList(); if (list2.Count != 1) { int num = list2.Sum((Entry e) => e.Count); Entry entry = new Entry(); entry.T = list2[list2.Count - 1].T; entry.Amount = list2.Sum((Entry e) => e.Amount); entry.Balance = list2[list2.Count - 1].Balance; entry.Account = g.Key.Account; entry.Category = g.Key.Category; entry.Memo = $"{num} transactions"; entry.Reason = ""; entry.Count = num; return entry; } return list2[0]; }).Concat(Entries.Where((Entry e) => e.T >= cutoff)) orderby e.T select e).ToList(); } } internal static class LoanBills { private sealed class Bill : IBill { private readonly int _company; public string Id => "vanilla.loan." + _company; public string Payee { get { Company? obj = CompanyOf(_company); return ((obj != null) ? obj.name : null) ?? "Loan shark"; } } public string Title => "Loan repayment"; public string? AccountId => null; public int AmountDue { get { LoanDebt val = DebtOf(_company); if (val != null) { return Math.Min((val.payments > 0) ? val.payments : val.debt, val.debt); } return 0; } } public float DueAt { get { LoanDebt? obj = DebtOf(_company); if (obj == null) { return 0f; } return obj.nextPaymentDueBy; } } public BillStatus Status { get { LoanDebt val = DebtOf(_company); if (val == null || val.debt <= 0) { return BillStatus.Paid; } float gameTime = SessionData.Instance.gameTime; if (gameTime > val.nextPaymentDueBy) { return BillStatus.Overdue; } if (!(val.nextPaymentDueBy - gameTime < 24f)) { return BillStatus.Upcoming; } return BillStatus.Due; } } public Bill(int company) { _company = company; } public bool Pay() { LoanDebt val = DebtOf(_company); Company val2 = CompanyOf(_company); if (val == null || val2 == null || Bank.Balance < AmountDue) { return false; } float nextPaymentDueBy = val.nextPaymentDueBy; GameplayController.Instance.DebtPayment(val2); DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(37, 3); defaultInterpolatedStringHandler.AppendLiteral("[ledger] paid loan to "); defaultInterpolatedStringHandler.AppendFormatted(val2.name); defaultInterpolatedStringHandler.AppendLiteral(" early: due "); defaultInterpolatedStringHandler.AppendFormatted(nextPaymentDueBy, "F2"); defaultInterpolatedStringHandler.AppendLiteral(" → "); LoanDebt? obj = DebtOf(_company); defaultInterpolatedStringHandler.AppendFormatted((obj != null) ? obj.nextPaymentDueBy : (-1f), "F2"); Plugin.Debug(defaultInterpolatedStringHandler.ToStringAndClear()); return true; } } internal static IEnumerable<IBill> Current() { GameplayController instance = GameplayController.Instance; List<LoanDebt> val = ((instance != null) ? instance.debt : null); if (val == null) { yield break; } Enumerator<LoanDebt> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { LoanDebt current = enumerator.Current; if (current != null && current.debt > 0) { yield return new Bill(current.companyID); } } } private static Company? CompanyOf(int id) { CityData instance = CityData.Instance; List<Company> val = ((instance != null) ? instance.companyDirectory : null); if (val == null) { return null; } Enumerator<Company> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Company current = enumerator.Current; if (current != null && current.companyID == id) { return current; } } return null; } private static LoanDebt? DebtOf(int companyId) { GameplayController instance = GameplayController.Instance; List<LoanDebt> val = ((instance != null) ? instance.debt : null); if (val == null) { return null; } Enumerator<LoanDebt> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { LoanDebt current = enumerator.Current; if (current != null && current.companyID == companyId) { return current; } } return null; } } internal static class Store { private class Saved { public List<Entry>? Entries { get; set; } public List<Account>? Accounts { get; set; } public float OpenedAt { get; set; } = -1f; } private const string FileName = "ledger.json"; internal static bool Loading { get; private set; } internal static void Hook() { Lib.SaveGame.OnBeforeNewGame += delegate { Journal.Reset(); Bank.ClearBills(); }; Lib.SaveGame.OnBeforeLoad += delegate { Loading = true; Bank.ClearBills(); }; Lib.SaveGame.OnAfterLoad += OnAfterLoad; Lib.SaveGame.OnBeforeSave += OnBeforeSave; Lib.SaveGame.OnBeforeDelete += OnBeforeDelete; } private static string PathFor(SaveGameArgs args) { return Lib.SaveGame.GetSaveGameDataPath(args, "ledger.json"); } private static void OnBeforeSave(object? sender, SaveGameArgs e) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown try { Journal.Fold(); File.WriteAllText(PathFor(e), JsonSerializer.Serialize(new Saved { Entries = Journal.Entries, Accounts = Journal.Accounts.Values.ToList(), OpenedAt = Journal.OpenedAt })); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ledger] failed to save: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogError(val); } } private static void OnAfterLoad(object? sender, SaveGameArgs e) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown Loading = false; Journal.Reset(); string path = PathFor(e); if (File.Exists(path)) { try { Saved saved = JsonSerializer.Deserialize<Saved>(File.ReadAllText(path)); Journal.Load(saved?.Entries, saved?.Accounts, saved?.OpenedAt ?? (-1f)); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[ledger] unreadable save data, starting clean: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogError(val); } } Reconcile(); } internal static void Reconcile() { int mainBalance = Journal.MainBalance; Entry entry = Journal.Entries.LastOrDefault((Entry x) => x.Account == "main"); if (entry == null) { Journal.Add("main", mainBalance, mainBalance, "Bank", "Opening balance", ""); } else if (entry.Balance != mainBalance) { Journal.Add("main", mainBalance - entry.Balance, mainBalance, "Bank", "Adjustment", ""); } } private static void OnBeforeDelete(object? sender, SaveGameArgs e) { string path = PathFor(e); if (File.Exists(path)) { File.Delete(path); } } } } namespace Ledger.Desk { public class StatementDesk : IDialogLogic { private const string DeskPreset = "CityHallLobby"; internal const string Name = "ledger_desk_statement"; private static int Fee => Math.Max(0, Plugin.Cfg.StatementFee.Value); internal static void Install() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) DialogObject val = Lib.Dialogs.Builder("ledger_desk_statement").SetText("I'd like a printed bank statement.").SetDialogLogic((IDialogLogic)(object)new StatementDesk()) .AddResponse(Answer(), true, false) .AddResponse("Sorry, the printer's down today.", false, false) .ModifyDialogOptions((Action<DialogPreset>)delegate(DialogPreset p) { p.cost = Fee; p.usePercentageCost = false; p.useSuccessTest = false; }) .CreateAndRegister(); if ((SoCustomComparison)(object)val.Preset != (SoCustomComparison)null) { DialogPreset preset = val.Preset; ((Object)preset).hideFlags = (HideFlags)(((Object)preset).hideFlags | 0x20); } DialogPreset preset2 = val.Preset; PlaceInTransactionTab((preset2 != null) ? preset2.msgID : null); } private static string Answer() { if (Fee <= 0) { return "Here you are."; } return "Here you are. The printing fee is on the statement."; } internal static bool AtDesk(Citizen? who) { object obj; if (who == null) { obj = null; } else { Occupation job = ((Human)who).job; obj = ((job != null) ? job.preset : null); } if ((SoCustomComparison)obj == (SoCustomComparison)null || !((Human)who).job.preset.receptionist) { return false; } NewGameLocation currentGameLocation = ((Actor)who).currentGameLocation; object obj2; if (currentGameLocation == null) { obj2 = null; } else { NewAddress thisAsAddress = currentGameLocation.thisAsAddress; obj2 = ((thisAsAddress != null) ? thisAsAddress.addressPreset : null); } AddressPreset val = (AddressPreset)obj2; if ((SoCustomComparison)(object)val != (SoCustomComparison)null) { return ((Object)val).name == "CityHallLobby"; } return false; } public bool IsDialogShown(DialogPreset preset, Citizen saysTo, SideJob jobRef) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown try { return AtDesk(saysTo) && GameplayController.Instance.money >= Fee; } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(7, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[desk] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); return false; } } public ForceSuccess ShouldDialogSucceedOverride(DialogController instance, DialogOption dialog, Citizen saysTo, NewNode where, Actor saidBy) { if (StatementWindow.CanPrint) { return (ForceSuccess)1; } return (ForceSuccess)2; } public void OnDialogExecute(DialogController instance, Citizen saysTo, Interactable saysToInteractable, NewNode where, Actor saidBy, bool success, NewRoom roomRef, SideJob jobRef) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown try { if (success) { if (Fee > 0) { Bank.LabelNext("dialog_cost", "Services", "Bank statement"); } StatementWindow.Print(Fee); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(7, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[desk] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } private static void PlaceInTransactionTab(string? msgId) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown if (string.IsNullOrEmpty(msgId)) { return; } try { MethodInfo methodInfo = (AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault((Assembly a) => a.GetName().Name == "DialogUIRework")?.GetType("DialogUIRework.TabbedDialogUI"))?.GetMethod("AddIDs", BindingFlags.Static | BindingFlags.Public, null, new Type[2] { typeof(string), typeof(string[]) }, null); if (!(methodInfo == null)) { methodInfo.Invoke(null, new object[2] { "Transaction", new string[1] { msgId } }); Plugin.Log.LogInfo((object)"[desk] placed the statement line in the 'Transaction' tab of DialogUIRework."); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[desk] DialogUIRework integration failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } } internal static class StatementWindow { private sealed record Line(string Text, int Amount, int Balance); private sealed record Snapshot(string Header, List<Line> Lines); [HarmonyPatch(typeof(BankStatementContentController), "CheckEnabled")] internal static class Fill { [HarmonyPrefix] private static bool Prefix(BankStatementContentController __instance) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown try { Snapshot snapshot = For(__instance); if (snapshot == null) { return true; } Build(__instance, snapshot); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[desk] statement window: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } return false; } } private const string Preset = "BankStatement"; private const string IdPrefix = "ledger_statement_"; private const int MaxRows = 14; private const int MaxLines = 13; private static readonly Dictionary<string, Snapshot> Printed = new Dictionary<string, Snapshot>(); private static int _counter; internal const string FeeMemo = "Bank statement"; internal static bool CanPrint => (SoCustomComparison)(object)FindPreset() != (SoCustomComparison)null; internal static void Print(int fee) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) EvidencePreset val = FindPreset(); if ((SoCustomComparison)(object)val == (SoCustomComparison)null) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[desk] no evidence preset for '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("BankStatement"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("', no statement window."); } log.LogWarning(val2); return; } Player instance = Player.Instance; string text; do { text = "ledger_statement_" + _counter++; } while (GameplayController.Instance.evidenceDictionary.ContainsKey(text)); Printed[text] = Take(fee); Evidence val3 = EvidenceCreator.Instance.CreateEvidence(val, text, (Controller)null, (Human)(object)instance, (Human)null, (Human)(object)instance, (Evidence)null, false, (List<Object>)null); if (val3 == null) { Plugin.Log.LogWarning((object)"[desk] could not create the statement evidence."); return; } InterfaceController.Instance.SpawnWindow(val3, (DataKey)0, (List<DataKey>)null, "", false, true, Vector2.zero, (Interactable)null, (Case)null, (CaseElement)null, true); Plugin.Debug($"[desk] printed statement {text} on preset {((Object)val).name}, {Printed[text].Lines.Count} lines."); } private static EvidencePreset? FindPreset() { Toolbox instance = Toolbox.Instance; EvidencePreset val = default(EvidencePreset); if (instance.evidencePresetDictionary.TryGetValue("BankStatement", ref val) && (SoCustomComparison)(object)val != (SoCustomComparison)null) { return val; } InteractablePreset val2 = default(InteractablePreset); if (instance.objectPresetDictionary.TryGetValue("BankStatement", ref val2) && (SoCustomComparison)(object)((val2 != null) ? val2.spawnEvidence : null) != (SoCustomComparison)null) { return val2.spawnEvidence; } Enumerator<string, EvidencePreset> enumerator = instance.evidencePresetDictionary.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair<string, EvidencePreset> current = enumerator.Current; if ((SoCustomComparison)(object)current.Value != (SoCustomComparison)null && ((Object)current.Value).name.Contains("BankStatement")) { return current.Value; } } return null; } private static Snapshot Take(int fee = 0) { float gameTime = SessionData.Instance.gameTime; List<Line> list = (from e in Journal.Entries.Where((Entry e) => e.Account == "main").TakeLast((fee > 0) ? 12 : 13) select new Line(ShortDate(e.T) + " " + Describe(e), e.Amount, e.Balance)).ToList(); int balance = Bank.Balance; if (fee > 0) { balance -= fee; list.Add(new Line(ShortDate(gameTime) + " Bank statement", -fee, balance)); } return new Snapshot(BankApp.Holder() + ", " + BankApp.Date(gameTime), list); } private static string ShortDate(float t) { string text = BankApp.Date(t); int num = text.LastIndexOf('/'); if (num <= 0) { return text; } return text.Substring(0, num); } private static string Describe(Entry e) { string text = BankApp.Memo(e); if (!string.IsNullOrEmpty(text)) { return text; } return e.Category; } private static Snapshot? For(BankStatementContentController c) { InfoWindow parentWindow = c.parentWindow; object obj; if (parentWindow == null) { obj = null; } else { Evidence passedEvidence = parentWindow.passedEvidence; obj = ((passedEvidence != null) ? passedEvidence.evID : null); } string text = (string)obj; if (text == null || !text.StartsWith("ledger_statement_")) { return null; } if (!Printed.TryGetValue(text, out Snapshot value)) { return Take(); } return value; } private static BankStatementEntryController? Spawn(BankStatementContentController c, Transform parent, string text, int amount, int balance) { BankStatementEntryController component = Object.Instantiate<GameObject>(c.entryPrefab, parent).GetComponent<BankStatementEntryController>(); if ((Object)(object)component == (Object)null) { return null; } component.Setup(text, amount, balance); if ((Object)(object)component.descriptionText != (Object)null) { ((TMP_Text)component.descriptionText).enableWordWrapping = false; ((TMP_Text)component.descriptionText).overflowMode = (TextOverflowModes)1; } c.spawnedEntries.Add(component); return component; } private static void Build(BankStatementContentController c, Snapshot s) { Enumerator<BankStatementEntryController> enumerator = c.spawnedEntries.GetEnumerator(); while (enumerator.MoveNext()) { BankStatementEntryController current = enumerator.Current; if ((Object)(object)current != (Object)null) { Object.Destroy((Object)(object)((Component)current).gameObject); } } c.spawnedEntries.Clear(); if ((Object)(object)c.descriptionText != (Object)null) { ((TMP_Text)c.descriptionText).text = ""; } Transform transform = ((Component)c.entryLayoutGroup).transform; BankStatementEntryController val = Spawn(c, transform, s.Header, 0, 0); if ((Object)(object)val != (Object)null) { if ((Object)(object)val.amountText != (Object)null) { ((TMP_Text)val.amountText).text = ""; } if ((Object)(object)val.balanceText != (Object)null) { ((TMP_Text)val.balanceText).text = ""; } } foreach (Line line in s.Lines) { Spawn(c, transform, line.Text, line.Amount, line.Balance); } } } } namespace Ledger.Cruncher { public enum Look { System, Retro, Modern } internal interface IView { void Build(RectTransform root); void Render(); } public class BankApp : CruncherAppContent { internal enum Tab { Account, Statement, Statistics, Bills, Accounts } internal enum Filter { All, In, Out } internal Tab Current; internal int Page; internal int Pages = 1; internal Filter Show; internal string? History; internal string Notice = ""; private float _noticeUntil; private bool _prepared; private bool _built; private IView? _view; private float _next; private string _signature = ""; internal bool Mine { get { ComputerController controller = ((CruncherAppContent)this).controller; if ((Object)(object)((controller != null) ? controller.loggedInAs : null) != (Object)null) { return ((Actor)((CruncherAppContent)this).controller.loggedInAs).isPlayer; } return false; } } internal static int Step => Math.Max(1, Plugin.Cfg.TransferStep.Value); public BankApp(IntPtr ptr) : base(ptr) { } public override void Setup(ComputerController cc) { ((CruncherAppContent)this).controller = cc; Prepare(); } public override void OnSetup() { Prepare(); } public override void PrintButton() { } private void Prepare() { //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_019f: 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) if (_prepared) { return; } _prepared = true; bool flag = default(bool); try { Transform obj = ((Component)this).transform.Find("AppTitleText"); TextMeshProUGUI val = ((obj != null) ? ((Component)obj).GetComponent<TextMeshProUGUI>() : null); Transform obj2 = ((Component)this).transform.Find("VmailDisplay/VmaiDisplay/ElementParent/VmailText"); object obj3 = ((obj2 != null) ? ((Component)obj2).GetComponent<TextMeshProUGUI>() : null); Transform obj4 = ((Component)this).transform.Find("VmaiList"); object obj5; if (obj4 == null) { obj5 = null; } else { ComputerOSMultiSelect component = ((Component)obj4).GetComponent<ComputerOSMultiSelect>(); if (component == null) { obj5 = null; } else { GameObject elementPrefab = component.elementPrefab; obj5 = ((elementPrefab != null) ? elementPrefab.GetComponent<ComputerOSMultiSelectElement>() : null); } } ComputerOSMultiSelectElement val2 = (ComputerOSMultiSelectElement)obj5; TextMeshProUGUI componentInChildren = ((Component)this).GetComponentInChildren<TextMeshProUGUI>(true); if (obj3 == null) { obj3 = ((val2 != null) ? val2.elementText2 : null) ?? componentInChildren; } Ui.Copy(Ui.From((TextMeshProUGUI?)obj3), Ui.BodyFont); Ui.Copy(Ui.From(((val2 != null) ? val2.elementText : null) ?? val ?? componentInChildren), Ui.CapsFont); Ui.Copy(Ui.From(val ?? ((val2 != null) ? val2.elementText : null) ?? componentInChildren), Ui.TitleFont); if (Plugin.Cfg.DebugLogging.Value) { IEnumerable<string> values = from i in Enumerable.Range(0, ((Component)this).transform.childCount) select ((Object)((Component)this).transform.GetChild(i)).name; ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(55, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[cruncher] bank app: children ["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(string.Join(", ", values)); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("]; fonts: body "); TMP_FontAsset? font = Ui.BodyFont.Font; ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>((font != null) ? ((Object)font).name : null); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<FontStyles>(Ui.BodyFont.Style); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", caps "); TMP_FontAsset? font2 = Ui.CapsFont.Font; ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>((font2 != null) ? ((Object)font2).name : null); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<FontStyles>(Ui.CapsFont.Style); } log.LogInfo(val3); } foreach (ComputerOSUIComponent componentsInChild in ((Component)this).GetComponentsInChildren<ComputerOSUIComponent>(true)) { if ((Object)(object)componentsInChild != (Object)null && (SoCustomComparison)(object)componentsInChild.sfx != (SoCustomComparison)null) { Ui.ClickSound = componentsInChild.sfx; break; } } if ((Object)(object)val != (Object)null) { ((TMP_Text)val).text = "Ledger"; } Transform obj6 = ((Component)this).transform.Find("Exit/Text (TMP)"); TextMeshProUGUI val4 = ((obj6 != null) ? ((Component)obj6).GetComponent<TextMeshProUGUI>() : null); if ((Object)(object)val4 != (Object)null) { ((TMP_Text)val4).text = "Exit"; } Transform obj7 = ((Component)this).transform.Find("Exit"); Button val5 = ((obj7 != null) ? ((Component)obj7).GetComponent<Button>() : null); if ((Object)(object)val5 != (Object)null) { ((UnityEvent)val5.onClick).AddListener(UnityAction.op_Implicit((Action)Exit)); } else { Plugin.Log.LogWarning((object)"[cruncher] bank app: no Exit button"); } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val6 = new BepInExErrorLogInterpolatedStringHandler(34, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("[cruncher] bank app setup failed: "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<Exception>(ex); } log2.LogError(val6); } } private void Update() { //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Expected O, but got Unknown //IL_0030: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00e2: 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) bool flag = default(bool); try { if (!_prepared) { return; } if (!_built) { RectTransform component = ((Component)this).GetComponent<RectTransform>(); float num; Rect rect; if (!((Object)(object)component != (Object)null)) { num = 0f; } else { rect = component.rect; num = ((Rect)(ref rect)).height; } float num2 = num; if (num2 <= 0.0001f) { return; } Ui.Height = num2; Look value = Plugin.Cfg.Look.Value; IView view2; if (value != Look.Modern) { IView view = new ClassicView(this, value == Look.Retro); view2 = view; } else { IView view = new ModernView(this); view2 = view; } _view = view2; _view.Build(component); _built = true; if (Plugin.Cfg.DebugLogging.Value) { ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(38, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[cruncher] bank app built ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Look>(value); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), window "); rect = component.rect; ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(((Rect)(ref rect)).width, "0.###"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("×"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num2, "0.###"); } log.LogInfo(val); } } if (!(Time.unscaledTime < _next)) { _next = Time.unscaledTime + 0.5f; if (Notice.Length > 0 && Time.unscaledTime > _noticeUntil) { Notice = ""; } string text = Signature(); if (!(text == _signature)) { _signature = text; _view?.Render(); } } } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[cruncher] bank app: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex); } log2.LogError(val2); _next = Time.unscaledTime + 5f; } } private string Signature() { float gameTime = SessionData.Instance.gameTime; object obj; if (Journal.Entries.Count <= 0) { obj = null; } else { List<Entry> entries = Journal.Entries; obj = entries[entries.Count - 1]; } Entry entry = (Entry)obj; return string.Join(";", Current, Page, Show, History ?? "", Notice, Mine, Bank.Balance, Journal.Entries.Count, entry?.T ?? 0f, entry?.Amount ?? 0, Mathf.FloorToInt(gameTime), string.Join(",", Bank.AllBills.Select((IBill b) => $"{b.Id}:{b.Status}:{b.AmountDue}")), string.Join(",", Bank.Accounts.Select((Account a) => $"{a.Id}:{a.Balance}"))); } internal void Exit() { ComputerController controller = ((CruncherAppContent)this).controller; if (controller != null) { controller.OnAppExit(); } } internal void Open(Tab tab) { Current = tab; Page = 0; if (tab != Tab.Statement) { History = null; } Refresh(); } internal void OpenHistory(string accountId) { Current = Tab.Statement; Page = 0; History = accountId; Refresh(); } internal void CloseHistory() { History = null; Page = 0; Refresh(); } internal void SetFilter(Filter filter) { Show = filter; Page = 0; Refresh(); } internal void NextFilter() { SetFilter(Show switch { Filter.All => Filter.In, Filter.In => Filter.Out, _ => Filter.All, }); } internal void Refresh() { _signature = ""; _next = 0f; } internal void Turn(int delta) { int num = Math.Clamp(Page + delta, 0, Math.Max(0, Pages - 1)); if (num != Page) { Page = num; Refresh(); } } internal void Say(string text) { Notice = text; _noticeUntil = Time.unscaledTime + 4f; Refresh(); } internal void Pay(IBill bill) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown try { if (Bank.Balance < bill.AmountDue) { Say("Not enough money."); return; } if (!bill.Pay()) { Say("The payment didn't go through."); return; } Say($"Paid {Money(bill.AmountDue)} to {bill.Payee}."); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[cruncher] bank app payment failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } internal void Deposit(string id) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown try { int num = Math.Min(Step, Bank.Balance); if (num <= 0 || !Bank.Deposit(id, num)) { Say("Not enough money."); } else { Refresh(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[cruncher] bank app deposit failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } internal void Withdraw(string id) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown try { Account account = Bank.GetAccount(id); int num = ((account != null) ? Math.Min(Step, account.Balance) : 0); if (num <= 0 || !Bank.Withdraw(id, num)) { Say("Nothing to withdraw."); } else { Refresh(); } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[cruncher] bank app withdraw failed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } internal static bool Internal(Entry e) { if (!(e.Category == "Transfers")) { return e.Category == "Bank"; } return true; } internal static string Memo(Entry e) { if (e.Count <= 1 || e.Memo.EndsWith("transactions")) { return e.Memo; } return $"{e.Memo} x{e.Count}"; } internal static string Holder() { try { return ((Object)(object)Player.Instance != (Object)null) ? ((Human)Player.Instance).GetCitizenName() : "You"; } catch { return "You"; } } internal static string Money(int amount) { CityControls instance = CityControls.Instance; string value = ((instance != null) ? instance.cityCurrency : null) ?? ""; if (amount < 0) { return $"-{value}{-amount:N0}"; } return $"{value}{amount:N0}"; } internal static string Signed(int amount) { if (amount < 0) { return Money(amount); } return "+" + Money(amount); } internal static string Clock(float t) { return SessionData.Instance.GameTimeToClock12String(t, false); } internal static string Date(float t) { return SessionData.Instance.ShortDateString(t, false); } internal unsafe static string LongDay(float t) { float num = default(float); WeekDay val = default(WeekDay); int num2 = default(int); Month val2 = default(Month); int num3 = default(int); SessionData.Instance.ParseTimeData(t, ref num, ref val, ref num2, ref val2, ref num3); string text = ((object)(*(WeekDay*)(&val))/*cast due to .constrained prefix*/).ToString(); return $"{char.ToUpperInvariant(text[0])}{text.Substring(1)} {Date(t)}"; } internal static string Day(float t, float now) { float num = now - SessionData.Instance.decimalClock; return Mathf.FloorToInt((t - num) / 24f) switch { 0 => "today", 1 => "tomorrow", -1 => "yesterday", _ => Date(t), }; } } [HarmonyPatch(typeof(MainMenuController), "Start")] public static class BankAppInstaller { [HarmonyPatch(typeof(DesktopApp), "OnSetup")] public static class HideForOthers { [HarmonyPrefix] public static void Prefix() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown try { SetLabel(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[cruncher] could not label the bank app: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } } [HarmonyPostfix] public static void Postfix(DesktopApp __instance) { //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) try { object obj; if (__instance == null) { obj = null; } else { ComputerController controller = ((CruncherAppContent)__instance).controller; obj = ((controller != null) ? controller.loggedInAs : null); } Human val = (Human)obj; if ((Object)(object)val != (Object)null && ((Actor)val).isPlayer) { return; } List<DesktopIconController> spawnedIcons = __instance.spawnedIcons; if (spawnedIcons == null) { return; } for (int num = spawnedIcons.Count - 1; num >= 0; num--) { DesktopIconController obj2 = spawnedIcons[num]; if (!((SoCustomComparison)(object)((obj2 != null) ? obj2.preset : null) == (SoCustomComparison)null) && !(((Object)spawnedIcons[num].preset).name != "Ledger")) { for (int num2 = spawnedIcons.Count - 1; num2 > num; num2--) { DesktopIconController obj3 = spawnedIcons[num2]; if ((Object)(object)((obj3 != null) ? obj3.rect : null) != (Object)null) { DesktopIconController obj4 = spawnedIcons[num2 - 1]; if ((Object)(object)((obj4 != null) ? obj4.rect : null) != (Object)null) { spawnedIcons[num2].rect.anchoredPosition = spawnedIcons[num2 - 1].rect.anchoredPosition; } } } Object.Destroy((Object)(object)((Component)spawnedIcons[num]).gameObject); spawnedIcons.RemoveAt(num); } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[cruncher] could not hide the bank app: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log.LogWarning(val2); } } } public const string AppName = "Ledger"; public const string Label = "Ledger"; private static bool _done; internal static CruncherAppPreset? Preset { get; private set; } [HarmonyPrefix] public static void Prefix() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown if (_done) { return; } _done = true; try { Install(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[cruncher] could not install the bank app: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Exception>(ex); } log.LogError(val); } } private static void Install() { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Expected O, but got Unknown CruncherAppPreset val = ((IEnumerable<CruncherAppPreset>)Resources.FindObjectsOfTypeAll<CruncherAppPreset>()).FirstOrDefault((Func<CruncherAppPreset, bool>)((CruncherAppPreset a) => ((Object)a).name == "VMail")); GameObject val2 = ((((val != null) ? val.appContent : null) != null && val.appContent.Count > 0) ? val.appContent[0] : null); if ((SoCustomComparison)(object)val == (SoCustomComparison)null || (Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"[cruncher] VMail app not found, no bank app"); return; } GameObject val3 = new GameObject("LedgerTemplates"); val3.SetActive(false); Object.DontDestroyOnLoad((Object)(object)val3); ((Object)val3).hideFlags = (HideFlags)61; GameObject val4 = Object.Instantiate<GameObject>(val2, val3.transform); ((Object)val4).name = "LedgerApp"; Rework(val4); val4.AddComponent<BankApp>(); CruncherAppPreset val5 = Object.Instantiate<CruncherAppPreset>(val); ((Object)val5).name = "Ledger"; ((Object)val5).hideFlags = (HideFlags)32; val5.appContent = new List<GameObject>(); val5.appContent.Add(val4); val5.onlyInAddresses = new List<AddressPreset>(); Sprite val6 = Icon(); if ((Object)(object)val6 != (Object)null) { val5.desktopIcon = val6; } else { Plugin.Log.LogWarning((object)"[cruncher] no bank app icon, keeping the mail one"); } Preset = val5; int num = 0; foreach (InteractablePreset item in Resources.FindObjectsOfTypeAll<InteractablePreset>()) { List<CruncherAppPreset> apps = item.additionalApps; if (apps == null || apps.Count == 0 || !((Object)item).name.Contains("Cruncher")) { continue; } if (Plugin.Cfg.DebugLogging.Value) { Plugin.Log.LogInfo((object)("[cruncher] " + ((Object)item).name + " apps: " + string.Join(", ", Enumerable.Range(0, apps.Count).Select(delegate(int i) { CruncherAppPreset obj = apps[i]; return ((obj != null) ? ((Object)obj).name : null) ?? "?"; })))); } int num2 = Enumerable.Range(0, apps.Count).FirstOrDefault(delegate(int i) { CruncherAppPreset obj = apps[i]; return ((obj != null) ? ((Object)obj).name : null) == "Login"; }, -1); int num3 = Enumerable.Range(0, apps.Count).FirstOrDefault(delegate(int i) { CruncherAppPreset obj = apps[i]; return ((obj != null) ? ((Object)obj).name : null) == "VMail"; }, -1); int num4 = ((num2 >= 0) ? num2 : ((num3 >= 0) ? (num3 + 1) : apps.Count)); apps.Insert(num4, val5); num++; } SetLabel(); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val7 = new BepInExInfoLogInterpolatedStringHandler(50, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("[cruncher] bank app installed on "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(" computer presets"); } log.LogInfo(val7); } internal static void SetLabel() { Lib.DdsStrings.AddOrUpdate("computer", "Ledger".ToLowerInvariant(), "Ledger"); } private static void Rework(GameObject content) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown VMailApp component = content.GetComponent<VMailApp>(); if ((Object)(object)component != (Object)null) { Object.DestroyImmediate((Object)(object)component); } foreach (ComputerAutoTextController componentsInChild in content.GetComponentsInChildren<ComputerAutoTextController>(true)) { Object.DestroyImmediate((Object)(object)componentsInChild); } foreach (Button componentsInChild2 in content.GetComponentsInChildren<Button>(true)) { if (!((Object)componentsInChild2).name.StartsWith("Scroll")) { componentsInChild2.onClick = new ButtonClickedEvent(); } } } private static Sprite? Icon() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_0096: 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) using Stream stream = typeof(BankAppInstaller).Assembly.GetManifestResourceStream("Ledger.Icons.ledger.png"); if (stream == null) { return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(memoryStream.ToArray()), false)) { Object.Destroy((Object)(object)val); return null; } ((Texture)val).filterMode = (FilterMode)0; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Object)val).name = "Ledger_icon"; ((Object)val).hideFlags = (HideFlags)61; Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); ((Object)obj).name = "Ledger_icon"; ((Object)obj).hideFlags = (HideFlags)61; return obj; } } internal sealed class ClassicView : IView { private readonly BankApp _app; private readonly bool _retro; private RectTransform? _tiles; private RectTransform? _header; private RectTransform? _body; private RectTransform? _actions; private int _rows = 6; private static readonly string[] MailContent = new string[2] { "VmaiList", "VmailDisplay" }; public ClassicView(BankApp app, bool retro) { _app = app; _retro = retro; Ui.UsePalette(retro); } public void Build(RectTransform root) { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: 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_01ea: Expected O, but got Unknown Transform transform = ((Component)_app).transform; (float, float, float, float) tuple; if (_retro) { for (int i = 0; i < transform.childCount; i++) { ((Component)transform.GetChild(i)).gameObject.SetActive(false); } tuple = RetroWindow(transform); } else { tuple = MailArea(root) ?? (0.01f, 0.01f, 0.99f, 0.88f); string[] mailContent = MailContent; foreach (string text in mailContent) { Transform obj = transform.Find(text); if (obj != null) { ((Component)obj).gameObject.SetActive(false); } } } RectTransform parent = Ui.Rect(transform, "LedgerUI", tuple.Item1, tuple.Item2, tuple.Item3, tuple.Item4); _tiles = Ui.Rect((Transform)(object)parent, "Tiles", 0f, 0f, 0.36f, 1f); _header = Ui.Frame((Transform)(object)parent, "Header", Ui.Field, raised: false, 0.37f, 0.79f, 1f, 1f); RectTransform parent2 = Ui.Frame((Transform)(object)parent, "Body", Ui.Field, raised: false, 0.37f, 0.12f, 1f, 0.78f); _body = Ui.Rect((Transform)(object)parent2, "Rows", 0.015f, 0.02f, 0.985f, 0.98f); _actions = Ui.Rect((Transform)(object)parent, "Actions", 0.37f, 0f, 1f, 0.11f); Rect rect = _body.rect; _rows = Math.Max(3, (int)(((Rect)(ref rect)).height / Ui.Size(0.068f))); if (Plugin.Cfg.DebugLogging.Value) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[cruncher] bank app area ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(tuple.Item1, "0.###"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(tuple.Item2, "0.###"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")-("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(tuple.Item3, "0.###"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(tuple.Item4, "0.###"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(_rows); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" rows"); } log.LogInfo(val); } } private (float, float, float, float) RetroWindow(Transform t) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) RectTransform parent = Ui.Dither(t, "LedgerWindow", 0f, 0f, 1f, 1f, Ui.WindowTop, Color.Lerp(Ui.WindowTop, Ui.WindowBottom, 0.5f), Ui.WindowBottom, 0.004f); RectTransform parent2 = Ui.Dither((Transform)(object)parent, "Title", 0f, 0.91f, 1f, 1f, Ui.TitleTop, Ui.TitleMid, Ui.TitleBottom); Ui.Panel((Transform)(object)parent, "TitleLine", Ui.Outline, 0f, 0.905f, 1f, 0.91f); Ui.Label((Transform)(object)parent2, "Ledger", 0.055f, Ui.TitleText, 0.02f, 0f, 0.7f, 1f, (TextAlignmentOptions)4097, Ui.TitleFont); Ui.ButtonAt((Transform)(object)parent, "Exit", _app.Exit, 0.82f, 0.915f, 0.995f, 0.995f, pressed: false, 0.05f); return (0.008f, 0.012f, 0.992f, 0.895f); } private (float x0, float y0, float x1, float y1)? MailArea(RectTransform root) { //IL_0025: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) float num = 1f; float num2 = 1f; float num3 = 0f; float num4 = 0f; bool flag = false; Il2CppStructArray<Vector3> val = new Il2CppStructArray<Vector3>(4L); Rect rect = root.rect; string[] mailContent = MailContent; foreach (string text in mailContent) { Transform obj = ((Component)_app).transform.Find(text); RectTransform val2 = ((obj != null) ? ((Component)obj).GetComponent<RectTransform>() : null); if (!((Object)(object)val2 == (Object)null)) { val2.GetWorldCorners(val); for (int j = 0; j < 4; j++) { Vector3 val3 = ((Transform)root).InverseTransformPoint(((Il2CppArrayBase<Vector3>)(object)val)[j]); float val4 = (val3.x - ((Rect)(ref rect)).xMin) / ((Rect)(ref rect)).width; float val5 = (val3.y - ((Rect)(ref rect)).yMin) / ((Rect)(ref rect)).height; num = Math.Min(num, val4); num3 = Math.Max(num3, val4); num2 = Math.Min(num2, val5); num4 = Math.Max(num4, val5); } flag = true; } } if (!flag || num3 - num < 0.3f || num4 - num2 < 0.3f) { return null; } return (Math.Clamp(num, 0f, 1f), Math.Clamp(num2, 0f, 1f), Math.Clamp(num3, 0f, 1f), Math.Clamp(num4, 0f, 1f)); } public void Render() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_tiles == (Object)null || (Object)(object)_header == (Object)null || (Object)(object)_body == (Object)null || (Object)(object)_actions == (Object)null) { return; } Ui.Clear((Transform)(object)_tiles); Ui.Clear((Transform)(object)_header); Ui.Clear((Transform)(object)_body); Ui.Clear((Transform)(object)_actions); List<string> list = new List<string>(); List<Ui.Line> lines = new List<Ui.Line>(); List<(string, Action)> actions = new List<(string, Action)>(); if (!_app.Mine) { Tile(0, 1, "Account", "Locked", Ui.Grey, on: true, delegate { }); list.Add("Access restricted"); list.Add("Log in under your own name"); list.Add("to see your account."); } else { Tiles(); switch (_app.Current) { case BankApp.Tab.Statement: StatementScreen(list, lines, actions); break; case BankApp.Tab.Statistics: Statistics.Fill(list, lines); break; case BankApp.Tab.Bills: BillsScreen(list, lines); break; case BankApp.Tab.Accounts: AccountsScreen(list, lines); break; default: AccountScreen(list, lines); break; } } if (_app.Notice.Length > 0) { while (list.Count < 3) { list.Add(""); } list[2] = $"<color={Ui.Tag(Ui.Out)}>{_app.Notice}</color>"; } Header(list); List<List<Ui.Line>> list2 = Ui.Pages(lines, _rows); _app.Pages = list2.Count; _app.Page = Math.Clamp(_app.Page, 0, _app.Pages - 1); Ui.Draw(_body, list2[_app.Page]); Actions(actions); } private void Header(List<string> header) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) RectTransform header2 = _header; if (header.Count > 0) { Ui.Label((Transform)(object)header2, header[0], 0.045f, Ui.Ink, 0.025f, 0.66f, 0.975f, 0.98f, (TextAlignmentOptions)4097, Ui.CapsFont); } if (header.Count > 1) { Ui.Label((Transform)(object)header2, header[1], 0.043f, Ui.Ink, 0.025f, 0.34f, 0.975f, 0.66f, (TextAlignmentOptions)4097); } if (header.Count > 2) { Ui.Label((Transform)(object)header2, header[2], 0.043f, Ui.Grey, 0.025f, 0.02f, 0.975f, 0.34f, (TextAlignmentOptions)4097); } } private void Actions(List<(string Label, Action Click)> actions) { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) RectTransform actions2 = _actions; bool flag = _app.Pages > 1; Ui.ButtonAt((Transform)(object)actions2, "<", delegate { _app.Turn(-1); }, 0f, 0f, 0.12f, 1f, !flag || _app.Page == 0, 0.055f); Ui.ButtonAt((Transform)(object)actions2, ">", delegate { _app.Turn(1); }, 0.88f, 0f, 1f, 1f, !flag || _app.Page >= _app.Pages - 1, 0.055f); if (actions.Count == 0) { Ui.Frame((Transform)(object)actions2, "Plate", Ui.Pale, raised: false, 0.135f, 0f, 0.865f, 1f); if (flag) { Ui.Label((Transform)(object)actions2, $"{_app.Page + 1} / {_app.Pages}", 0.043f, Ui.Grey, 0.135f, 0f, 0.865f, 1f, (TextAlignmentOptions)514); } return; } float num = 0.73f / (float)actions.Count; for (int num2 = 0; num2 < actions.Count; num2++) { (string Label, Action Click) tuple = actions[num2]; string item = tuple.Label; Action item2 = tuple.Click; float num3 = 0.135f + (float)num2 * num; Ui.ButtonAt((Transform)(object)actions2, item, item2, num3 + ((num2 > 0) ? 0.01f : 0f), 0f, num3 + num, 1f); } } private void Tiles() { //IL_010f: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) float now = SessionData.Instance.gameTime; List<Entry> list = Journal.Entries.Where((Entry e) => e.Account == "main" && e.T >= now - 168f).ToList(); int amount = -list.Where((Entry e) => e.Amount < 0 && !BankApp.Internal(e)).Sum((Entry e) => e.Amount); List<IBill> list2 = Bank.AllBills.Where((IBill b) => b.Status != BillStatus.Paid).ToList(); int num = list2.Count((IBill b) => b.Status == BillStatus.Overdue); int num2 = Bank.Accounts.Count(); BankApp.Tab current = _app.Current; Tile(0, 5, "Account", "Balance " + BankApp.Money(Bank.Balance), Ui.Grey, current == BankApp.Tab.Account, delegate { _app.Open(BankApp.Tab.Account); }); Tile(1, 5, "Statement", $"{list.Count} this week", Ui.Grey, current == BankApp.Tab.Statement, delegate { _app.Open(BankApp.Tab.Statement); }); Tile(2, 5, "Statistics", BankApp.Money(amount) + " spent", Ui.Grey, current == BankApp.Tab.Statistics, delegate { _app.Open(BankApp.Tab.Statistics); }); Tile(3, 5, "Bills", (num > 0) ? $"{num} overdue" : ((list2.Count > 0) ? $"{list2.Count} due" : "Nothing due"), (num > 0) ? Ui.Out : ((list2.Count > 0) ? Ui.Warn : Ui.Grey), current == BankApp.Tab.Bills, delegate { _app.Open(BankApp.Tab.Bills); }); Tile(4, 5, "Accounts", (num2 > 0) ? $"{num2} open" : "None yet", Ui.Grey, current == BankApp.Tab.Accounts, delegate { _app.Open(BankApp.Tab.Accounts); }); } private void Tile(int index, int count, string title, string subtitle, Color subColour, bool on, Action click) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_006e: 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) float num = (1f - 0.012f * (float)(count - 1)) / (float)count; float num2 = 1f - (float)index * (num + 0.012f); float y = num2 - num; var (rect, parent) = Ui.Framed((Transform)(object)_tiles, "Tile", on ? Ui.Pale : Ui.Field, raised: true, 0f, y, 1f, num2); Ui.Label((Transform)(object)parent, title, 0.045f, Ui.Ink, 0.05f, 0.5f, 0.97f, 0.95f, (TextAlignmentOptions)4097, Ui.CapsFont); Ui.Label((Transform)(object)parent, subtitle, 0.043f, subColour, 0.05f, 0.05f, 0.97f, 0.5f, (TextAlignmentOptions)4097); Ui.Clickable(rect, click); } private void AccountScreen(List<string> header, List<Ui.Line> lines) { //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0305: 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) float gameTime = SessionData.Instance.gameTime; float midnight = gameTime - SessionData.Instance.decimalClock; int amount = Journal.Entries.Where((Entry e) => e.Account == "main" && e.T >= midnight && !BankApp.Internal(e)).Sum((Entry e) => e.Amount); header.Add("Current account"); header.Add("Balance: " + BankApp.Money(Bank.Balance)); header.Add(BankApp.Holder() + " · today " + BankApp.Signed(amount)); List<IBill> list = Bank.AllBills.Where((IBill b) => b.Status != BillStatus.Paid).ToList(); if (list.Count > 0) { lines.Add(Ui.Line.Strip("Upcoming")); foreach (IBill item in list) { lines.Add(BillLine(item, gameTime)); } } List<Account> list2 = Bank.Accounts.OrderBy((Account account) => account.Title).ToList(); if (list2.Count > 0) { lines.Add(Ui.Line.Strip("Bill accounts")); foreach (Account a in list2) { Ui.Line line = Ui.Line.Text(a.Title, BankApp.Money(a.Balance)); line.Buttons = new List<(string, Action)> { ("+" + BankApp.Money(BankApp.Step), delegate { _app.Deposit(a.Id); }) }; lines.Add(line); } } lines.Add(Ui.Line.Strip("Recent")); List<Entry> list3 = Journal.Entries.Where((Entry e) => e.Account == "main").Reverse().Take(6) .ToList(); if (list3.Count == 0) { lines.Add(Ui.Line.Text("No transactions yet.", "", Ui.Grey)); } foreach (Entry item2 in list3) { lines.Add(Ui.Line.Text(BankApp.Clock(item2.T) + " " + BankApp.Memo(item2), BankApp.Signed(item2.Amount), null, (item2.Amount >= 0) ? Ui.In : Ui.Out)); } } private Ui.Line BillLine(IBill b, float now) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) Color value = ((b.Status == BillStatus.Overdue) ? Ui.Out : ((b.Status == BillStatus.Due) ? Ui.Warn : Ui.Ink)); string text = ((b.Status == BillStatus.Overdue) ? "overdue" : BankApp.Day(b.DueAt, now)); Ui.Line line = Ui.Line.Text(b.Title, BankApp.Money(b.AmountDue) + " " + text, null, value); line.Buttons = new List<(string, Action)> { ("Pay", delegate { _app.Pay(b); }) }; return line; } private void StatementScreen(List<string> header, List<Ui.Line> lines, List<(string, Action)> actions) { //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: 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) float now = SessionData.Instance.gameTime; Account account = ((_app.History != null) ? Bank.GetAccount(_app.History) : null); if (_app.History != null && account == null) { _app.History = null; } string id = account?.Id ?? "main"; int amount = account?.Balance ?? Bank.Balance; List<Entry> source = Journal.Entries.Where((Entry e) => e.Account == id && e.T >= now - 168f && !BankApp.Internal(e)).ToList(); header.Add((account != null) ? account.Title : "Statement"); header.Add("Balance " + BankApp.Money(amount)); header.Add($"7 days: in {BankApp.Money(source.Where((Entry e) => e.Amount > 0).Sum((Entry e) => e.Amount))}, out {BankApp.Money(-source.Where((Entry e) => e.Amount < 0).Sum((Entry e) => e.Amount))}"); BankApp.Filter filter = _app.Show; List<Entry> list = (from e in Journal.Entries where e.Account == id where account != null || filter == BankApp.Filter.All || ((filter != BankApp.Filter.In) ? (e.Amount < 0) : (e.Amount > 0)) select e).Reverse().ToList(); if (list.Count == 0) { lines.Add(Ui.Line.Text("No transactions yet.", "", Ui.Grey)); } string text = null; foreach (Entry item in list) { string text2 = BankApp.LongDay(item.T); if (text2 != text) { lines.Add(Ui.Line.Strip(text2)); text = text2; } lines.Add(new Ui.Line { Kind = Ui.Kind.Entry, Left = BankApp.Clock(item.T) + " " + BankApp.Memo(item), Mid = BankApp.Signed(item.Amount), MidColour = ((item.Amount >= 0) ? Ui.In : Ui.Out), Right = BankApp.Money(item.Balance) }); } if (account != null) { actions.Add(("Back", _app.CloseHistory)); } else { actions.Add(("Show: " + filter, _app.NextFilter)); } } private void BillsScreen(List<string> header, List<Ui.Line> lines) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) float gameTime = SessionData.Instance.gameTime; List<IBill> list = Bank.AllBills.Where((IBill b) => b.Status != BillStatus.Paid).ToList(); header.Add("Bills"); header.Add((list.Count == 0) ? "Nothing due" : $"{list.Count} due, {BankApp.Money(list.Sum((IBill b) => b.AmountDue))} in all"); header.Add("Your balance " + BankApp.Money(Bank.Balance)); if (list.Count == 0) { lines.Add(Ui.Line.Text("Nothing due.", "", Ui.Grey)); } foreach (IBill item in list) { lines.Add(Ui.Line.Strip(item.Payee)); lines.Add(BillLine(item, gameTime)); Account account = ((item.AccountId != null) ? Bank.GetAccount(item.AccountId) : null); Ui.Line line = Ui.Line.Text((account != null) ? ("from " + account.Title) : ("due " + BankApp.Date(item.DueAt)), (account != null) ? BankApp.Money(account.Balance) : BankApp.Clock(item.DueAt), Ui.Grey, Ui.Grey); line.KeepWithPrevious = true; lines.Add(line); } } private void AccountsScreen(List<string> header, List<Ui.Line> lines) { //IL_00a7: Unknown result type (might be due to invalid IL or missing references) List<Account> list = Bank.Accounts.OrderBy((Account account) => account.Title).ToList(); header.Add("Bill accounts"); header.Add("One press moves " + BankApp.Money(BankApp.Step)); header.Add("Current account " + BankApp.Money(Bank.Balance)); if (list.Count == 0) { lines.Add(Ui.Line.Text("No bill accounts yet.")); lines.Add(Ui.Line.Text("Mods that bill you open them.", "", Ui.Grey)); } foreach (Account a in list) { lines.Add(Ui.Line.Strip(a.Title)); Ui.Line line = Ui.Line.Text((a.Kind == AccountKind.Prepaid) ? "Prepaid" : "Savings", BankApp.Money(a.Balance)); line.Buttons = new List<(string, Action)> { ("+" + BankApp.Money(BankApp.Step), delegate { _app.Deposit(a.Id); }) }; if (a.Kind == AccountKind.Withdrawable) { line.Buttons.Add(("-" + BankApp.Money(BankApp.Step), delegate { _app.Withdraw(a.Id); })); } line.Buttons.Add(("Log", delegate { _app.OpenHistory(a.Id); })); lines.Add(line); } } } internal static class ModernUi { internal static readonly Color Screen = Ui.Hex("F1EFE8"); internal static readonly Color TopBar = Ui.Hex("085041"); internal static readonly Color TopText = Ui.Hex("E1F5EE"); internal static readonly Color Nav = Ui.Hex("D3D1C7"); internal static readonly Color NavText = Ui.Hex("444441"); internal static readonly Color NavOnText = Ui.Hex("04342C"); internal static readonly Color Accent = Ui.Hex("1D9E75"); internal static readonly Color Card = Ui.Hex("FFFFFF"); internal static readonly Color CardLine = Ui.Hex("5F5E5A"); internal static readonly Color Ink = Ui.Hex("2C2C2A"); internal static readonly Color Muted = Ui.Hex("5F5E5A"); internal static readonly Color Button = Ui.Hex("0F6E56"); internal static readonly Color ButtonText = Ui.Hex("E1F5EE"); internal static readonly Color In = Ui.Hex("27500A"); internal static readonly Color Out = Ui.Hex("791F1F"); internal static readonly Color WarnBg = Ui.Hex("FAEEDA"); internal static readonly Color WarnText = Ui.Hex("633806"); internal static readonly Color DangerBg = Ui.Hex("FCEBEB"); internal static readonly Color DangerText = Ui.Hex("791F1F"); internal static readonly Color Spend = Ui.Hex("D85A30"); internal static readonly Color Zebra = Ui.Hex("EEECE4"); internal const float Edge = 0.008f; private static RectTransform Inset(RectTransform frame, Color colour) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) RectTransform obj = Ui.Panel((Transform)(object)frame, "Inner", colour, 0f, 0f, 1f, 1f); float num = Ui.Size(0.008f); obj.offsetMin = new Vector2(num, num); obj.offsetMax = new Vector2(0f - num, 0f - num); return obj; } internal static RectTransform CardPanel(Transform parent, string name, float x0, float y0, float x1, float y1) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) return Inset(Ui.Panel(parent, name, CardLine, x0, y0, x1, y1), Card); } internal static TextMeshProUGUI Label(Transform parent, string text, float size, Color colour, float x0, float y0, float x1, float y1, TextAlignmentOptions align = (TextAlignmentOptions)4097, bool bold = false) { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = ((Component)Ui.Rect(parent, "Text", x0, y0, x1, y1)).gameObject.AddComponent<TextMeshProUGUI>(); Ui.FontSpec titleFont = Ui.TitleFont; if ((Object)(object)titleFont.Font != (Object)null) { ((TMP_Text)val).font = titleFont.Font; } if ((Object)(object)titleFont.Material != (Object)null) { ((TMP_Text)val).fontSharedMaterial = titleFont.Material; } ((Graphic)val).raycastTarget = false; ((TMP_Text)val).enableAutoSizing = false; ((TMP_Text)val).enableWordWrapping = false; ((TMP_Text)val).overflowMode = (TextOverflowModes)1; ((TMP_Text)val).richText = true; ((TMP_Text)val).fontSize = Ui.Size(size); ((Graphic)val).color = colour; ((TMP_Text)val).alignment = align; ((TMP_Text)val).fontStyle = (FontStyles)(bold ? 1 : 0); ((TMP_Text)val).text = text; return val; } internal static RectTransform ButtonAt(Transform parent, string text, Action onClick, float x0, float y0, float x1, float y1, bool filled = true, float size = 0.042f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Ui.Panel(parent, "Button", Button, x0, y0, x1, y1); if (!filled) { Inset(val, Card); } Ui.Clickable(val, onClick); Label((Transform)(object)val, text, size, filled ? ButtonText : Button, 0f, 0f, 1f, 1f, (TextAlignmentOptions)514); return val; } internal static (float y0, float y1) RowY(int i, int n, float top = 1f, float bottom = 0f) { float num = (top - bottom) / (float)n; return (y0: top - (float)(i + 1) * num, y1: top - (float)i * num); } internal static void Pill(Transform parent, string text, Color bg, Color fg, float x0, float y0, float x1, float y1) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Label((Transform)(object)Ui.Panel(parent, "Pill", bg, x0, y0, x1, y1), text, 0.036f, fg, 0f, 0f, 1f, 1f, (TextAlignmentOptions)514); } } internal sealed class ModernView : IView { private const int StatementLines = 7; private const int BillRows = 3; private const int AccountRows = 3; private const int MaxCategories = 4; private const float Text = 0.044f; private const float Small = 0.038f; private const float Nav = 0.05f; private readonly BankApp _app; private RectTransform? _nav; private RectTransform? _content; private TextMeshProUGUI? _right; public ModernView(BankApp app) { _app = app; } public void Build(RectTransform root) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_010d: 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) Transform transform = ((Component)_app).transform; for (int i = 0; i < transform.childCount; i++) { ((Component)transform.GetChild(i)).gameObject.SetActive(false); } RectTransform parent = Ui.Panel(transform, "LedgerUI", ModernUi.Screen, 0f, 0f, 1f, 1f); RectTransform parent2 = Ui.Panel((Transform)(object)parent, "Top", ModernUi.TopBar, 0f, 0.87f, 1f, 1f); ModernUi.Label((Transform)(object)parent2, "LEDGER", 0.07f, ModernUi.TopText, 0.025f, 0f, 0.4f, 1f, (TextAlignmentOptions)4097, bold: true); _right = ModernUi.Label((Transform)(object)parent2, "", 0.038f, ModernUi.TopText, 0.38f, 0f, 0.78f, 1f, (TextAlignmentOptions)4100); RectTransform obj = Ui.Panel((Transform)(object)parent2, "Exit", ModernUi.Card, 0.8f, 0.1f, 0.99f, 0.95f); ModernUi.Label((Transform)(object)obj, "Exit", 0.06f, ModernUi.Ink, 0f, 0f, 1f, 1f, (TextAlignmentOptions)514); Ui.Clickable(obj, _app.Exit); _nav = Ui.Panel((Transform)(object)parent, "Nav", ModernUi.Nav, 0f, 0f, 0.26f, 0.87f); _content = Ui.Rect((Transform)(object)parent, "Content", 0.28f, 0.025f, 0.985f, 0.85f); } public void Render() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_nav == (Object)null || (Object)(object)_content == (Object)null || (Object)(object)_right == (Object)null) { return; } Ui.Clear((Transform)(object)_nav); Ui.Clear((Transform)(object)_content); if (!_app.Mine) { ((TMP_Text)_right).text = ""; RectTransform parent = ModernUi.CardPanel((Transform)(object)_content, "Locked", 0.05f, 0.35f, 0.95f, 0.7f); ModernUi.Label((Transform)(object)parent, "Access restricted", 0.055f, ModernUi.Ink, 0.06f, 0.5f, 0.94f, 0.9f, (TextAlignmentOptions)4097, bold: true); ModernUi.Label((Transform)(object)parent, "Log in under your own name.", 0.044f, ModernUi.Muted, 0.06f, 0.1f, 0.94f, 0.5f, (TextAlignmentOptions)4097); return; } ((TMP_Text)_right).text = ((_app.Notice.Length > 0) ? ("<color=#FAC775>" + _app.Notice + "</color>") : TopRight()); int num = Bank.AllBills.Count((IBill b) => b.Status != BillStatus.Paid); BankApp.Tab[] array = new BankApp.Tab[5] { BankApp.Tab.Account, BankApp.Tab.Statement, BankApp.Tab.Statistics, BankApp.Tab.Bills, BankApp.Tab.Accounts }; for (int num2 = 0; num2 < array.Length; num2++) { BankApp.Tab tab = array[num2]; string name = ((tab == BankApp.Tab.Bills && num > 0) ? $"Bills ({num})" : tab.ToString()); NavItem(name, num2, tab == _app.Current, delegate { _app.Open(tab); }); } switch (_app.Current) { case BankApp.Tab.Statement: Statement(_content); break; case BankApp.Tab.Statistics: Statistics(_content); break; case BankApp.Tab.Bills: BillsScreen(_content); break; case BankApp.Tab.Accounts: AccountsScreen(_content); break; default: AccountScreen(_content); break; } } private string TopRight() { float now = SessionData.Instance.gameTime; List<Entry> source = Journal.Entries.Where((Entry e) => e.Account == "main" && e.T >= now - 168f && !BankApp.Internal(e)).ToList(); int amount = source.Where((Entry e) => e.Amount > 0).Sum((Entry e) => e.Amount); int amount2 = -source.Where((Entry e) => e.Amount < 0).Sum((Entry e) => e.Amount); switch (_app.Current) { case BankApp.Tab.Statement: if (_app.History == null) { return "week: +" + BankApp.Money(amount) + " -" + BankApp.Money(amount2); } break; case BankApp.Tab.Statistics: return "week: +" + BankApp.Money(amount) + " -" + BankApp.Money(amount2); case BankApp.Tab.Account: return BankApp.Holder(); } return "Balance " + BankApp.Money(Bank.Balance); } private void NavItem(string name, int index, bool on, Action click) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) float num = 0.98f - (float)index * 0.13f; float y = num - 0.13f; RectTransform val = Ui.Panel((Transform)(object)_nav, "NavItem", on ? ModernUi.Screen : ModernUi.Nav, 0f, y, 1f, num); if (on) { Ui.Panel((Transform)(object)val, "Stripe", ModernUi.Accent, 0f, 0f, 0.05f, 1f); } ModernUi.Label((Transform)(object)val, name, 0.05f, on ? ModernUi.NavOnText : ModernUi.NavText, 0.11f, 0f, 0.98f, 1f, (TextAlignmentOptions)4097, on); Ui.Clickable(val, click); } private void AccountScreen(RectTransform c) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_0137: 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_043f: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_04bb: Unknown result type (might be due to invalid IL or missing references) //IL_0510: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Unknown result type (might be due to invalid IL or missing references) float gameTime = SessionData.Instance.gameTime; float midnight = gameTime - SessionData.Instance.decimalClock; RectTransform parent = ModernUi.CardPanel((Transform)(object)c, "Balance", 0f, 0.71f, 1f, 1f); ModernUi.Label((Transform)(object)parent, "Current account", 0.038f, ModernUi.Muted, 0.04f, 0.62f, 0.6f, 0.94f, (TextAlignmentOptions)4097); ModernUi.Label((Transform)(object)parent, BankApp.Money(Bank.Balance), 0.11f, (Bank.Balance >= 0) ? ModernUi.Ink : ModernUi.Out, 0.04f, 0.04f, 0.68f, 0.66f, (TextAlignmentOptions)4097, bold: true); int num = Journal.Entries.Where((Entry e) => e.Account == "main" && e.T >= midnight && !BankApp.Internal(e)).Sum((Entry e) => e.Amount); ModernUi.Label((Transform)(object)parent, "Today", 0.038f, ModernUi.Muted, 0.6f, 0.62f, 0.96f, 0.94f, (TextAlignmentOptions)4100); ModernUi.Label((Transform)(object)parent, BankApp.Signed(num), 0.055f, (num >= 0) ? ModernUi.In : ModernUi.Out, 0.6f, 0.12f, 0.96f, 0.6f, (TextAlignmentOptions)4100); List<IBill> list = Bank.AllBills.Where((IBill b) => b.Status != BillStatus.Paid).Take(2).ToList(); RectTransform parent2 = ModernUi.CardPanel((Transform)(object)c, "Upcoming", 0f, 0.38f, 1f, 0.68f); if (list.Count == 0) { ModernUi.Label((Transform)(object)parent2, "Nothing due.", 0.044f, ModernUi.Muted, 0.04f, 0f, 0.96f, 1f, (TextAlignmentOptions)4097); } for (int num2 = 0; num2 < list.Count; num2++) { var (y, y2) = ModernUi.RowY(num2, 2, 0.95f, 0.05f); BillRow(Ui.Rect((Transform)(object)parent2, "Bill", 0.03f, y, 0.97f, y2), list[num2], gameTime); } List<Account> list2 = Bank.Accounts.OrderBy((Account account) => account.Title).Take(2).ToList(); float x = 0f; if (list2.Count > 0) { x = 0.51f; RectTransform parent3 = ModernUi.CardPanel((Transform)(object)c, "Accounts", 0f, 0f, 0.49f, 0.35f); for (int num3 = 0; num3 < list2.Count; num3++) { (float y0, float y1) tuple2 = ModernUi.RowY(num3, 2, 0.94f, 0.06f); float item = tuple2.y0; float item2 = tuple2.y1; RectTransform parent4 = Ui.Rect((Transform)(object)parent3, "Account", 0.05f, item, 0.95f, item2); Account a = list2[num3]; ModernUi.Label((Transform)(object)parent4, a.Title + "\n<color=#5F5E5A>" + BankApp.Money(a.Balance) + "</color>", 0.038f, ModernUi.Ink, 0f, 0f, 0.66f, 1f, (TextAlignmentOptions)4097); ModernUi.ButtonAt((Transform)(object)parent4, "+" + BankApp.Money(BankApp.Step), delegate { _app.Deposit(a.Id); }, 0.68f, 0.15f, 1f, 0.85f, filled: false, 0.038f); } } RectTransform parent5 = ModernUi.CardPanel((Transform)(object)c, "Recent", x, 0f, 1f, 0.35f); List<Entry> list3 = Journal.Entries.Where((Entry e) => e.Account == "main").Reverse().Take(3) .ToList(); if (list3.Count == 0) { ModernUi.Label((Transform)(object)parent5, "No transactions yet.", 0.044f, ModernUi.Muted, 0.05f, 0f, 0.95f, 1f, (TextAlignmentOptions)4097); } for (int num4 = 0; num4 < list3.Count; num4++) { (float y0, float y1) tuple3 = ModernUi.RowY(num4, 3, 0.94f, 0.06f); float item3 = tuple3.y0; float item4 = tuple3.y1; RectTransform parent6 = Ui.Rect((Transform)(object)parent5, "Recent", 0.04f, item3, 0.96f, item4); ModernUi.Label((Transform)(object)parent6, BankApp.Memo(list3[num4]), 0.038f, ModernUi.Ink, 0f, 0f, 0.66f, 1f, (TextAlignmentOptions)4097); ModernUi.Label((Transform)(object)parent6, BankApp.Signed(list3[num4].Amount), 0.038f, (list3[num4].Amount >= 0) ? ModernUi.In : ModernUi.Out, 0.6f, 0f, 1f, 1f, (TextAlignmentOptions)4100); } } private void BillRow(RectTransform row, IBill bill, float now) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or mi