Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of CryptoTrader v1.1.2
Mods/CryptoMod.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; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using CryptoMod; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne; using Il2CppScheduleOne.Avatar; using Il2CppScheduleOne.AvatarFramework; using Il2CppScheduleOne.Core.Avatar; using Il2CppScheduleOne.Core.Items.Framework; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Equipping; using Il2CppScheduleOne.Interaction; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Levelling; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.Messaging; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.Persistence.Datas; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.State; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Compass; using Il2CppScheduleOne.UI.Phone; using Il2CppScheduleOne.UI.Phone.Messages; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(/*Could not decode attribute arguments.*/)] [assembly: MelonInfo(typeof(Core), "Crypto Trader", "1.1.2", "WykwintnyBocian", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: SecurityPermission((SecurityAction)8, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : System.Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class NullableAttribute : System.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(/*Could not decode attribute arguments.*/)] internal sealed class NullableContextAttribute : System.Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(/*Could not decode attribute arguments.*/)] internal sealed class RefSafetyRulesAttribute : System.Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CryptoMod { public struct ComputerInfo { public int Id; public Vector3 Position; public float Yaw; public string Property; public bool InUse; } public static class CryptoTraderApi { public const string Version = "1.1.2"; private static Core C => Core.Instance; public static bool IsReady => C != null && C.ApiReady; public static string SaveFolder => (C != null) ? C.ApiSaveFolder : null; public static int ComputerCount => IsReady ? C.ApiComputers().Count : 0; public static bool IsPlacingComputer => IsReady && C.ApiPlacing; public static bool IsUsingComputer => IsReady && C.ApiUsing; public static string[] CoinSymbols => (C != null) ? C.ApiSymbols() : new string[0]; public static bool EventsEnabled { get { return C != null && C.ApiEventsOn; } set { if (C != null) { C.ApiEventsOn = value; } } } public static string[] PartIds { get { Hardware.Init(); return Hardware.All.ConvertAll<string>((Converter<PartDef, string>)((PartDef d) => d.Id)).ToArray(); } } public static float MiningSpeed { get { return (C != null) ? C.MiningSpeed : 1f; } set { if (C != null) { C.MiningSpeed = Mathf.Clamp(value, 1f, 1000f); } } } public static float MinedWalletUsd => IsReady ? C.ApiWalletUsd() : 0f; public static Vector3 HeldBoxOffset { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) return Core.HeldOffset; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) Core.HeldOffset = value; } } public static float HeldBoxPitch { get { return Core.HeldPitch; } set { Core.HeldPitch = value; } } public static float HeldBoxYaw { get { return Core.HeldYaw; } set { Core.HeldYaw = value; } } public static string MeetingState => (C != null) ? C.ApiMeetState() : "mod not loaded"; public static int MeetSpotCount => Core.MeetSpots.Count; public static string ByteChatState => (C != null) ? C.ApiByteState() : "mod not loaded"; public static string SupplierName => "Byte"; public static bool IsSupplierSpawned => C != null && C.SupplierSpawned; public static string SupplierLog => (C != null) ? C.SupplierLog : ""; public static Texture2D SupplierPortrait { get { Sprite val = ((C != null) ? C.SupplierPicture() : null); return ((Object)(object)val != (Object)null) ? val.texture : null; } } public static bool HasSupplierPhoto => C != null && C.HasSupplierPhoto; public static bool SupplierPhotoBusy => C != null && C.SupplierPhotoBusy; public static float PhotoDistance { get { return Core.PhotoDistance; } set { Core.PhotoDistance = Mathf.Clamp(value, 0.5f, 3f); } } public static float PhotoFov { get { return Core.PhotoFov; } set { Core.PhotoFov = Mathf.Clamp(value, 8f, 40f); } } public static float PhotoYaw { get { return Core.PhotoYaw; } set { Core.PhotoYaw = Mathf.Clamp(value, -60f, 60f); } } public static float PhotoLift { get { return Core.PhotoLift; } set { Core.PhotoLift = Mathf.Clamp(value, -0.3f, 0.3f); } } public static float PhotoLight { get { return Core.PhotoLight; } set { Core.PhotoLight = Mathf.Clamp(value, 0f, 8f); } } public static string[] SupplierOutfitSlots => Core.SupSlots; public static string[] SupplierColorNames => Core.SupColorNames; public static string[] SupplierSkinNames => Core.SupSkinNames; public static int SupplierSkin { get { return (C != null) ? C.SupSkin : 0; } set { if (C != null) { int num = Core.SupSkinNames.Length; C.SupSkin = (value % num + num) % num; } } } public static float SupplierBuild { get { return (C != null) ? C.SupWeight : 0f; } set { if (C != null) { C.SupWeight = Mathf.Clamp01(value); } } } public static string SupplierLook { get { return (C != null) ? C.SupLookString() : ""; } set { if (C != null) { C.SupLoadLookString(value); } } } public static List<ComputerInfo> GetComputers() { return IsReady ? C.ApiComputers() : new List<ComputerInfo>(); } public static bool StartPlacingComputer() { return IsReady && C.ApiStartPlacing(); } public static bool MoveComputer(int id) { return IsReady && C.ApiMove(id); } public static bool OpenComputer(int id) { return IsReady && C.ApiOpen(id); } public static bool RemoveComputer(int id) { return IsReady && C.ApiRemove(id); } public static int RemoveAllComputers() { return IsReady ? C.ApiRemoveAll() : 0; } public static void RebuildComputerModels() { if (IsReady) { C.ApiRebuildModels(); } } public static float GetPrice(string symbol) { return (C != null) ? C.ApiPrice(symbol) : 0f; } public static float GetOwned(string symbol) { return IsReady ? C.ApiOwned(symbol) : 0f; } public static bool GiveCoins(string symbol, float units) { return IsReady && C.ApiGive(symbol, units); } public static bool TriggerMarketEvent() { return IsReady && C.ApiEvent(); } public static void FastForwardMarket(int minutes) { if (IsReady) { C.ApiFastForward(minutes); } } public static string PartName(string id) { PartDef partDef = Hardware.Get(id); return (partDef != null) ? partDef.Name : id; } public static string PartKindName(string id) { PartDef partDef = Hardware.Get(id); return (partDef != null) ? Hardware.KindName(partDef.Kind) : ""; } public static Texture2D PartIcon(string id) { PartDef partDef = Hardware.Get(id); Sprite val = ((partDef != null) ? Hardware.Icon(partDef) : null); return ((Object)(object)val != (Object)null) ? val.texture : null; } public static void GivePart(string id, int count) { if (IsReady) { C.ApiGivePart(id, count); } } public static int PartsBoxCount(string id) { return IsReady ? C.ApiBoxCount(id) : 0; } public static void ClearPartsBox() { if (IsReady) { C.ApiClearBox(); } } public static void SimulateMining(int minutes) { if (IsReady) { C.ApiSimulateMining(minutes); } } public static string GetRigSummary(int computerId) { return IsReady ? C.ApiRigSummary(computerId) : ""; } public static void MeetNow(int spot) { if (C != null) { C.ApiMeetNow(spot); } } public static void CancelMeeting() { if (C != null) { C.ApiMeetCancel(); } } public static Vector3 GetMeetSpot(int i) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) return (i >= 0 && i < Core.MeetSpots.Count) ? Core.MeetSpots[i].Pos : Vector3.zero; } public static float GetMeetSpotYaw(int i) { return (i >= 0 && i < Core.MeetSpots.Count) ? Core.MeetSpots[i].Yaw : 0f; } public static void AddMeetSpotHere() { Core.ApiAddSpotHere(); } public static void RemoveMeetSpot(int i) { if (C != null) { C.ApiRemoveSpot(i); } } public static bool TeleportToMeetSpot(int i) { return Core.ApiTeleportToSpot(i); } public static bool SaveMeetSpots() { return Core.SaveMeetSpots(); } public static void ResetMeetSpots() { Core.ResetMeetSpots(); } public static bool GiveComputerBox() { return C != null && C.InvGive("pc"); } public static void ByteTextNow() { if (C != null) { C.ApiByteTextNow(); } } public static void ByteRestartChat() { if (C != null) { C.ApiByteRestart(); } } public static bool SpawnSupplier(Vector3 feet, float yaw) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) return IsReady && C.SpawnSupplier(feet, yaw); } public static void DespawnSupplier() { if (C != null) { C.DespawnSupplier(); } } public static void RetakeSupplierPhoto() { if (IsReady) { C.EnsureSupplierPhoto(force: true); } } public static bool SavePhotoCameraAsDefault() { return Core.SavePhotoSettings(); } public static void ResetPhotoCamera() { Core.ResetPhotoSettings(); } public static string[] GetSupplierOutfitOptions(int slot) { return (slot >= 0 && slot < Core.SupOptions.Length) ? Core.SupOptions[slot] : new string[0]; } public static int GetSupplierOutfit(int slot) { return (C != null && slot >= 0 && slot < C.SupPick.Length) ? C.SupPick[slot] : 0; } public static void SetSupplierOutfit(int slot, int option) { if (C != null && slot >= 0 && slot < C.SupPick.Length) { int num = Core.SupOptions[slot].Length; C.SupPick[slot] = (option % num + num) % num; } } public static int GetSupplierColor(int slot) { return (C != null && slot >= 0 && slot < C.SupColor.Length) ? C.SupColor[slot] : 0; } public static void SetSupplierColor(int slot, int color) { if (C != null && slot >= 0 && slot < C.SupColor.Length) { int num = Core.SupColorNames.Length; C.SupColor[slot] = (color % num + num) % num; } } public static float GetBankBalance() { return IsReady ? C.ApiBalance() : 0f; } public static void AddBankMoney(float amount, string note) { if (IsReady) { C.ApiAddMoney(amount, note); } } } public class Core : MelonMod { internal enum ByteStage { NotMet, Asking, Ignored, Closing, Introduced } private struct ByteLine { public bool Player; public string Text; public bool End; } private class MarketCard { public GameObject root; public Image bg; public Image bar; public Image icon; public Image star; public Text letter; public Text sym; public Text name; public Text price; public Text ch1; public Text ch24; public LineGraphic spark; public float[] buf = new float[40]; } private class MarketRow { public GameObject root; public Image bg; public Image icon; public Image star; public Text letter; public Text name; public Text sym; public Text price; public Text c24; public Text c7; public LineGraphic spark; public float[] buf = new float[32]; } internal struct MeetSpot { public Vector3 Pos; public float Yaw; public MeetSpot(float x, float y, float z, float yaw) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) Pos = new Vector3(x, y, z); Yaw = yaw; } } private class RigState { public string[] Gpu = new string[4]; public string Cpu; public string[] Asic = new string[2]; public string Psu; public string Cooler; public string[] Ram = new string[2]; public string Board; public string Ssd; public string Hdd; public string[] Fans = new string[10]; public bool On; public string ShaCoin = "BTC"; public string ScryptCoin = "LTC"; public float Temp = 26f; public bool Cooldown; public float TotalUsd; public float PowerUsd; public long UptimeMin; public float[] Hour = new float[24]; public int HourSlot = -1; public RigStatus Status; public float Throttle = 1f; public float CaseLoad; public float WallWatts; public float UsdPerDay; public float CostPerDay; public bool CaseRunning; } private class PcData { public int Id; public Vector3 Pos; public float Yaw; public GameObject Root; public InteractableObject Io; public Transform CamPoint; public Canvas Screen; public GraphicRaycaster Raycaster; public Collider[] Cols; public GameObject LockLayer; public GameObject DesktopLayer; public GameObject Window; public GameObject PowerMenu; public Text LockClock; public Text LockDate; public Text TopClock; public Text WinTitle; public Text PickLabel; public Text WidgetTitle; public Text WidgetSub; public Image WidgetBar; public Image WinIcon; public float PickArm; public RigState Rig; public RectTransform WinContent; public Action WinRefresh; public int WinApp = -1; public int BoxPage; public int SelSlot = -1; public string SelBox; public Text WinMsg; public float WinMsgTimer; public RectTransform InsideRoot; public GameObject[] AsicObj; public PcCase3D Case; public List<GameObject> Chair; public Image WinBg; public Image WinMsgBg; public Text LockStatus; public Action DeskRefresh; public Action<float> DeskAnim; public Action<float> AppAnim; public List<string> Log; public float[] TempHist; public float[] WattHist; public int HistTick; public int TempState; public int WalletSel = -1; public long LastShareMin; public List<Object> AppOwned = new List<Object>(); } private class Tween { public float T; public float Dur; public Action<float> Step; public Action Done; } private class BuildLabel { public RectTransform Box; public RectTransform Line; public RectTransform Dot; public RectTransform Ring; public Image BoxImg; public Image Icon; public Image LineImg; public Image DotImg; public Image RingImg; public Text State; public Text Name; public RectTransform[] Edge; } private struct LabelInfo { public Vector3 World; public bool Fit; public string State; public string Name; public Sprite Icon; } private class CtmObj { public string Name; public Vector3 Pivot; public Mesh Mesh; public string[] Mats; } private class PcCase3D { public Transform Root; public Transform Interior; public readonly Dictionary<string, Transform> Parts = new Dictionary<string, Transform>(); public readonly List<Transform> Rotors = new List<Transform>(); public readonly List<Vector3> RotorAxis = new List<Vector3>(); public Transform Board; public string BoardId; public readonly Transform[] Fan = (Transform[])(object)new Transform[10]; public readonly string[] FanId = new string[10]; public readonly Transform[] Vis = (Transform[])(object)new Transform[24]; public readonly string[] VisId = new string[24]; public Vector3 BasePos; public Collider Use; public bool InteriorOn = true; } private class KitPart { public string Name; public Mesh Mesh; public Material[] Mats; public Matrix4x4 M; } private enum GlowKind { Outline, Solid, Fan, Dot, Interior } private class KitGlow { public string Name; public Vector3 Pos; public Quaternion Rot; public Vector2 Size; public GlowKind Kind; public Color Col; } private class PcKit { public readonly List<KitPart> Parts = new List<KitPart>(); public readonly List<KitGlow> Glows = new List<KitGlow>(); public Vector3 CamPos; public Vector3 ScrPos; public Vector3 ScrPivot; public Vector3 PromptPos; public Quaternion CamRot; public Quaternion ScrRot; public Vector2 ScrSize; public Vector3 ScrScale; public Bounds Desk; public Bounds Chair; public Bounds All; public Bounds Computer; public bool HasChair; public float TableTop; public Mesh Cube; public Mesh Cylinder; public int UseLayer; public bool WoodFromGame; public Material AsicMat; public Material AsicDark; public int ChairStart = -1; public bool Case3D; public bool Alive() { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (Parts.Count == 0 || (Object)(object)Cube == (Object)null || (Object)(object)Cylinder == (Object)null) { return false; } Enumerator<KitPart> enumerator = Parts.GetEnumerator(); try { while (enumerator.MoveNext()) { KitPart current = enumerator.Current; if ((Object)(object)current.Mesh == (Object)null || current.Mats == null || (Object)(object)current.Mats[0] == (Object)null) { return false; } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return true; } } private class HoldRow { public GameObject root; public Image icon; public Text letter; public Text sym; public Text val; public RectTransform fill; public int coin = -1; } private class FavRow { public GameObject root; public Image icon; public Text letter; public Text name; public Text sym; public Text price; public Text chg; public LineGraphic spark; public float[] buf = new float[40]; public int coin = -1; } private class ShopItem { public string Id; public string Name; public string Sub; public int Tier; public float Price; public Sprite Icon; public int Tab; } [CompilerGenerated] private sealed class <BuildParts>d__1071 : System.Collections.Generic.IEnumerable<string>, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator<string>, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private string <>2__current; private int <>l__initialThreadId; private RigState r; public RigState <>3__r; private string[] <>s__1; private int <>s__2; private string <f>5__3; string System.Collections.Generic.IEnumerator<string>.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BuildParts>d__1071(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = r.Board; <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = r.Ssd; <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = r.Hdd; <>1__state = 3; return true; case 3: <>1__state = -1; <>s__1 = r.Fans; <>s__2 = 0; break; case 4: <>1__state = -1; <f>5__3 = null; <>s__2++; break; } if (<>s__2 < <>s__1.Length) { <f>5__3 = <>s__1[<>s__2]; <>2__current = <f>5__3; <>1__state = 4; return true; } <>s__1 = null; return false; } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator<string> System.Collections.Generic.IEnumerable<string>.GetEnumerator() { <BuildParts>d__1071 <BuildParts>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <BuildParts>d__ = this; } else { <BuildParts>d__ = new <BuildParts>d__1071(0); } <BuildParts>d__.r = <>3__r; return <BuildParts>d__; } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable<string>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <CaseParts>d__673 : System.Collections.Generic.IEnumerable<PartDef>, System.Collections.IEnumerable, System.Collections.Generic.IEnumerator<PartDef>, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private PartDef <>2__current; private int <>l__initialThreadId; private RigState r; public RigState <>3__r; private PartDef <c>5__1; private string[] <>s__2; private int <>s__3; private string <g>5__4; private PartDef <d>5__5; private string[] <>s__6; private int <>s__7; private string <m>5__8; private PartDef <d>5__9; PartDef System.Collections.Generic.IEnumerator<PartDef>.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <CaseParts>d__673(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void System.IDisposable.Dispose() { } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__2 = r.Gpu; <>s__3 = 0; goto IL_00bd; case 1: <>1__state = -1; goto IL_00a0; case 2: <>1__state = -1; goto IL_0113; case 3: { <>1__state = -1; goto IL_017c; } IL_00bd: if (<>s__3 < <>s__2.Length) { <g>5__4 = <>s__2[<>s__3]; <d>5__5 = Hardware.Get(<g>5__4); if (<d>5__5 != null) { <>2__current = <d>5__5; <>1__state = 1; return true; } goto IL_00a0; } <>s__2 = null; <c>5__1 = Hardware.Get(r.Cpu); if (<c>5__1 != null) { <>2__current = <c>5__1; <>1__state = 2; return true; } goto IL_0113; IL_00a0: <d>5__5 = null; <g>5__4 = null; <>s__3++; goto IL_00bd; IL_017c: <d>5__9 = null; <m>5__8 = null; <>s__7++; goto IL_0199; IL_0113: <>s__6 = r.Ram; <>s__7 = 0; goto IL_0199; IL_0199: if (<>s__7 < <>s__6.Length) { <m>5__8 = <>s__6[<>s__7]; <d>5__9 = Hardware.Get(<m>5__8); if (<d>5__9 != null) { <>2__current = <d>5__9; <>1__state = 3; return true; } goto IL_017c; } <>s__6 = null; return false; } } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } [DebuggerHidden] System.Collections.Generic.IEnumerator<PartDef> System.Collections.Generic.IEnumerable<PartDef>.GetEnumerator() { <CaseParts>d__673 <CaseParts>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <CaseParts>d__ = this; } else { <CaseParts>d__ = new <CaseParts>d__673(0); } <CaseParts>d__.r = <>3__r; return <CaseParts>d__; } [DebuggerHidden] System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { return (System.Collections.IEnumerator)((System.Collections.Generic.IEnumerable<PartDef>)this).GetEnumerator(); } } [CompilerGenerated] private sealed class <FetchRoutine>d__404 : System.Collections.Generic.IEnumerator<object>, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private object <>2__current; public bool applyToMarket; public Core <>4__this; private StringBuilder <ids>5__1; private UnityWebRequest <req>5__2; private Enumerator<Coin> <>s__3; private Coin <c>5__4; private string <why>5__5; private int <found>5__6; private string <body>5__7; private Enumerator<Coin> <>s__8; private Coin <c>5__9; private Match <m>5__10; private float <v>5__11; private System.Exception <e>5__12; object System.Collections.Generic.IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <FetchRoutine>d__404(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void System.IDisposable.Dispose() { } private bool MoveNext() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Invalid comparison between Unknown and I4 //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <ids>5__1 = new StringBuilder(); <>s__3 = <>4__this.coins.GetEnumerator(); try { while (<>s__3.MoveNext()) { <c>5__4 = <>s__3.Current; if (<ids>5__1.Length > 0) { <ids>5__1.Append(','); } <ids>5__1.Append(<c>5__4.GeckoId); <c>5__4 = null; } } finally { ((System.IDisposable)<>s__3/*cast due to .constrained prefix*/).Dispose(); } <>s__3 = default(Enumerator<Coin>); <req>5__2 = UnityWebRequest.Get("https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd&ids=" + (object)<ids>5__1); <req>5__2.timeout = 12; <req>5__2.SetRequestHeader("Accept", "application/json"); <>2__current = <req>5__2.SendWebRequest(); <>1__state = 1; return true; case 1: <>1__state = -1; try { if ((int)<req>5__2.result != 1) { <why>5__5 = ((<req>5__2.responseCode == 429) ? "rate limit reached, try again later" : (<req>5__2.error ?? "no connection")); <>4__this.refStatus = (<>4__this.refLive ? "Using saved prices. " : "Using built-in prices. ") + "Download failed: " + <why>5__5; ((MelonBase)<>4__this).LoggerInstance.Msg("Reference prices not updated (" + <why>5__5 + ")."); <why>5__5 = null; } else { <found>5__6 = 0; <body>5__7 = <req>5__2.downloadHandler.text ?? ""; <>s__8 = <>4__this.coins.GetEnumerator(); try { while (<>s__8.MoveNext()) { <c>5__9 = <>s__8.Current; <m>5__10 = Regex.Match(<body>5__7, "\"" + Regex.Escape(<c>5__9.GeckoId) + "\"\\s*:\\s*\\{\\s*\"usd\"\\s*:\\s*([0-9eE\\.\\-\\+]+)"); if (((Group)<m>5__10).Success && float.TryParse(((Capture)<m>5__10.Groups[1]).Value, (NumberStyles)167, (IFormatProvider)(object)Inv, ref <v>5__11) && <v>5__11 > 0f) { <>4__this.refPrices[<c>5__9.Symbol] = <v>5__11; <found>5__6++; } <m>5__10 = null; <c>5__9 = null; } } finally { ((System.IDisposable)<>s__8/*cast due to .constrained prefix*/).Dispose(); } <>s__8 = default(Enumerator<Coin>); if (<found>5__6 > 0) { <>4__this.refFetched = System.DateTime.UtcNow; <>4__this.refLive = true; <>4__this.SaveRefCache(); <>4__this.refStatus = string.Concat(new string[5] { "CoinGecko prices from ", <>4__this.refFetched.ToLocalTime().ToString("dd MMM HH:mm", (IFormatProvider)(object)Inv), " (", <found>5__6.ToString(), " coins)" }); ((MelonBase)<>4__this).LoggerInstance.Msg("Downloaded real-world reference prices for " + <found>5__6 + " coins."); if (applyToMarket && <>4__this.sessionLoaded) { <>4__this.ApplyReferenceToMarket(); } } else { <>4__this.refStatus = "Download returned no prices, keeping current ones"; } <body>5__7 = null; } } catch (System.Exception ex) { <e>5__12 = ex; <>4__this.refStatus = "Price download failed"; ((MelonBase)<>4__this).LoggerInstance.Warning("Reference price download failed: " + <e>5__12.Message); } finally { <>4__this.refFetching = false; <req>5__2.Dispose(); <>4__this.forceRefresh = true; } return false; } } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PhotoRoutine>d__1334 : System.Collections.Generic.IEnumerator<object>, System.IDisposable, System.Collections.IEnumerator { private int <>1__state; private object <>2__current; public Core <>4__this; private GameObject <body>5__1; private GameObject <rig>5__2; private RenderTexture <rt>5__3; private StringBuilder <log>5__4; private int <layer>5__5; private Avatar <av>5__6; private float <until>5__7; private Texture2D <result>5__8; private string <takenKey>5__9; private System.Exception <e>5__10; private Transform <head>5__11; private Vector3 <target>5__12; private Vector3 <fwd>5__13; private Camera <cam>5__14; private RenderTexture <prev>5__15; private Texture2D <big>5__16; private Animator <an>5__17; private System.Exception <e>5__18; private System.Exception <e>5__19; object System.Collections.Generic.IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object System.Collections.IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PhotoRoutine>d__1334(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void System.IDisposable.Dispose() { } private bool MoveNext() { //IL_078a: Unknown result type (might be due to invalid IL or missing references) //IL_0799: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_02e8: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Expected O, but got Unknown //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Unknown result type (might be due to invalid IL or missing references) //IL_04e6: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Expected O, but got Unknown //IL_054b: Unknown result type (might be due to invalid IL or missing references) //IL_0555: Expected O, but got Unknown //IL_056f: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Unknown result type (might be due to invalid IL or missing references) //IL_05dd: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <body>5__1 = null; <rig>5__2 = null; <rt>5__3 = null; <log>5__4 = new StringBuilder(); try { <body>5__1 = <>4__this.BuildSupplierBody(PhotoSpot, 0f, <log>5__4); } catch (System.Exception ex) { <e>5__10 = ex; <log>5__4.Append(<e>5__10.Message); } if ((Object)(object)<body>5__1 == (Object)null) { ((MelonBase)<>4__this).LoggerInstance.Warning("Byte's photo: no character to copy yet. " + ((object)<log>5__4).ToString().Replace("\n", " ")); <>4__this.supplierPhotoBusy = false; return false; } ((Object)<body>5__1).name = "CryptoTrader_BytePhoto"; <layer>5__5 = LayerMask.NameToLayer("RuntimePreviewGeneration"); if (<layer>5__5 < 0) { <layer>5__5 = 31; } <av>5__6 = <body>5__1.GetComponent<Avatar>(); KeepAwake(<av>5__6, <body>5__1); SetLayer(<body>5__1, <layer>5__5); <until>5__7 = Time.realtimeSinceStartup + 0.7f; break; case 1: <>1__state = -1; if ((Object)(object)<body>5__1 == (Object)null) { <>4__this.supplierPhotoBusy = false; return false; } KeepAwake(<av>5__6, <body>5__1); SetLayer(<body>5__1, <layer>5__5); break; } if (Time.realtimeSinceStartup < <until>5__7) { <>2__current = null; <>1__state = 1; return true; } KeepAwake(<av>5__6, <body>5__1); <result>5__8 = null; try { <head>5__11 = null; try { if ((Object)(object)<av>5__6 != (Object)null && (Object)(object)<av>5__6.LookController != (Object)null) { <head>5__11 = <av>5__6.LookController.HeadBone; } } catch { } if ((Object)(object)<head>5__11 == (Object)null) { <an>5__17 = <body>5__1.GetComponentInChildren<Animator>(); if ((Object)(object)<an>5__17 != (Object)null && <an>5__17.isHuman) { <head>5__11 = <an>5__17.GetBoneTransform((HumanBodyBones)10); } <an>5__17 = null; } if ((Object)(object)<head>5__11 != (Object)null) { <target>5__12 = <head>5__11.position + Vector3.up * PhotoLift; } else { <target>5__12 = PhotoSpot + Vector3.up * 1.65f; } <fwd>5__13 = Quaternion.Euler(0f, PhotoYaw, 0f) * <body>5__1.transform.forward; <rig>5__2 = new GameObject("CryptoTrader_PhotoRig"); <rig>5__2.transform.position = <target>5__12 + <fwd>5__13 * PhotoDistance + Vector3.up * 0.02f; <rig>5__2.transform.LookAt(<target>5__12); <cam>5__14 = <rig>5__2.AddComponent<Camera>(); ((Behaviour)<cam>5__14).enabled = false; <cam>5__14.cullingMask = 1 << <layer>5__5; <cam>5__14.clearFlags = (CameraClearFlags)2; <cam>5__14.backgroundColor = new Color(1f, 0f, 1f, 0f); <cam>5__14.fieldOfView = PhotoFov; <cam>5__14.nearClipPlane = 0.05f; <cam>5__14.farClipPlane = 10f; <cam>5__14.allowHDR = false; <cam>5__14.allowMSAA = false; AddPhotoLight(<rig>5__2.transform, new Vector3(-0.7f, 0.5f, 0.2f), PhotoLight, <layer>5__5); AddPhotoLight(<rig>5__2.transform, new Vector3(0.8f, 0.1f, 0.1f), PhotoLight * 0.45f, <layer>5__5); AddPhotoLight(<rig>5__2.transform, new Vector3(0f, 0.9f, -1.6f), PhotoLight * 0.35f, <layer>5__5); <rt>5__3 = new RenderTexture(1024, 1024, 24, (RenderTextureFormat)0); <rt>5__3.antiAliasing = 1; <rt>5__3.Create(); <cam>5__14.targetTexture = <rt>5__3; <cam>5__14.Render(); <prev>5__15 = RenderTexture.active; RenderTexture.active = <rt>5__3; <big>5__16 = new Texture2D(1024, 1024, (TextureFormat)4, false); <big>5__16.ReadPixels(new Rect(0f, 0f, 1024f, 1024f), 0, 0); <big>5__16.Apply(); RenderTexture.active = <prev>5__15; <cam>5__14.targetTexture = null; <result>5__8 = Downsample(<big>5__16, 512); Object.Destroy((Object)(object)<big>5__16); <head>5__11 = null; <target>5__12 = default(Vector3); <fwd>5__13 = default(Vector3); <cam>5__14 = null; <prev>5__15 = null; <big>5__16 = null; } catch (System.Exception ex) { <e>5__18 = ex; ((MelonBase)<>4__this).LoggerInstance.Warning("Byte's photo failed: " + <e>5__18.Message); } if ((Object)(object)<rig>5__2 != (Object)null) { Object.Destroy((Object)(object)<rig>5__2); } if ((Object)(object)<body>5__1 != (Object)null) { Object.Destroy((Object)(object)<body>5__1); } if ((Object)(object)<rt>5__3 != (Object)null) { <rt>5__3.Release(); Object.Destroy((Object)(object)<rt>5__3); } <>4__this.supplierPhotoBusy = false; <takenKey>5__9 = <>4__this.PhotoKey; if ((Object)(object)<result>5__8 == (Object)null || IsEmptyPhoto(<result>5__8)) { ((MelonBase)<>4__this).LoggerInstance.Warning("Byte's photo came out empty; keeping the drawn picture."); return false; } try { File.WriteAllBytes(PhotoFile, Il2CppArrayBase<byte>.op_Implicit((Il2CppArrayBase<byte>)(object)ImageConversion.EncodeToPNG(<result>5__8))); File.WriteAllText(PhotoKeyFile, <takenKey>5__9); } catch (System.Exception ex) { <e>5__19 = ex; ((MelonBase)<>4__this).LoggerInstance.Warning("Could not keep Byte's photo: " + <e>5__19.Message); } ((Texture)<result>5__8).wrapMode = (TextureWrapMode)1; <>4__this.supplierPhoto = Sprite.Create(<result>5__8, new Rect(0f, 0f, (float)((Texture)<result>5__8).width, (float)((Texture)<result>5__8).height), new Vector2(0.5f, 0.5f), 100f); <>4__this.photoKeyInUse = <takenKey>5__9; <>4__this.photoCheckedKey = <takenKey>5__9; ((MelonBase)<>4__this).LoggerInstance.Msg("Byte's photo taken (" + PhotoFile + ")."); try { if (<>4__this.SupplierPhotoChanged != null) { <>4__this.SupplierPhotoChanged.Invoke(); } } catch { } return false; } bool System.Collections.IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void System.Collections.IEnumerator.Reset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) throw new NotSupportedException(); } } public const string ModVersion = "1.1.2"; private const string ByteConvId = "cryptotrader_byte"; private const int ByteLogMax = 30; private ByteStage byteStage = ByteStage.NotMet; private bool byteKnown; private bool byteRead = true; private long byteNextMin = -1L; private readonly List<ByteLine> byteLog = new List<ByteLine>(); private MSGConversation byteConv; private SendableMessage byteSendable; private readonly List<KeyValuePair<float, Action>> byteQueue = new List<KeyValuePair<float, Action>>(); private float byteQueueClock; private float byteRetry; private bool byteForce; private const int ByteFirstDelayMin = 15; private const float ByteUnlockSpent = 300f; private float cryptoSpent = -1f; private float byteUnlockCheck; private bool byteUnlocked; private const int ByteRetryDelayMin = 1440; private float bytePhotoRetry = 30f; private Quest meetQuest; private float meetQuestTimer; private string meetQuestTitle = "Meet Byte"; private const string MeetQuestName = "CryptoTrader_MeetByteQuest"; public static Core Instance; public const int MaxPoints = 20160; public const int Pts1H = 60; public const int Pts24H = 1440; public const int Pts7D = 10080; private const int StripCards = 3; private const int PortRows = 6; private const int HistRows = 9; private const int MarketRows = 9; private const int MaxCatchUp = 2880; private const float FontScale = 1f; private const int EventCooldown = 360; private const float EventMeanExtra = 1960f; private const int EventMaxGap = 5760; private const int EventsPerDayMax = 2; public const string SaveFileName = "CryptoTrader.txt"; private const string GeckoUrl = "https://api.coingecko.com/api/v3/simple/price?vs_currencies=usd&ids="; private const double RefCacheHours = 12.0; private static readonly Color cBg = new Color(0.031f, 0.035f, 0.047f, 1f); private static readonly Color cPanel = new Color(0.11f, 0.122f, 0.153f, 1f); private static readonly Color cPanel2 = new Color(0.078f, 0.086f, 0.11f, 1f); private static readonly Color cRowSel = new Color(0.09f, 0.15f, 0.25f, 1f); private static readonly Color cBorder = new Color(1f, 1f, 1f, 0.09f); private static readonly Color cAccent = new Color(0.122f, 0.561f, 1f, 1f); private static readonly Color cAccentSoft = new Color(0.122f, 0.561f, 1f, 0.22f); private static readonly Color cText = new Color(0.97f, 0.97f, 1f, 1f); private static readonly Color cDim = new Color(0.541f, 0.588f, 0.698f, 1f); private static readonly Color cUp = new Color(0.184f, 0.827f, 0.541f, 1f); private static readonly Color cDown = new Color(1f, 0.361f, 0.424f, 1f); private static readonly Color cGold = new Color(1f, 0.83f, 0.3f, 1f); private static readonly Color cBuy = new Color(0.122f, 0.561f, 1f, 1f); private static readonly Color cSell = new Color(0.78f, 0.25f, 0.31f, 1f); private static readonly Color cCardBlue = new Color(0.36f, 0.78f, 1f, 1f); private static readonly CultureInfo Inv = CultureInfo.InvariantCulture; private const int PDash = 0; private const int PMarket = 1; private const int PPort = 2; private const int PHist = 3; private const int PSet = 4; private const int PHome = 5; private static readonly string[] PageNames = new string[6] { "Coin", "Market", "Wallet", "History", "Settings", "Home" }; private readonly List<Coin> coins = new List<Coin>(); private readonly List<TradeRecord> history = new List<TradeRecord>(); private readonly List<NewsItem> news = new List<NewsItem>(); private readonly int[] rigCount = new int[3]; private float[] pending; private float minedUsd; private float realized; private int mineCoin; private string currentSavePath; private bool sessionLoaded; private string pendingSnapshot; private string pendingSnapshotPath; private bool saveHooks; private static bool cleanupPatched; private readonly List<string> favs = new List<string>(); private bool candleMode; private bool eventsOn = true; private readonly Dictionary<string, float> refPrices = new Dictionary<string, float>(); private System.DateTime refFetched = System.DateTime.MinValue; private bool refLive; private bool refFetching; private string refStatus = "Built-in reference prices"; private System.Type timeType; private int lastDaily = -1; private long totalGameMin; private long nextEventMin = -1L; private long lastEventMin = -100000L; private long eventDayIdx = -1L; private int eventsToday; private int timeMode; private float timeFailTimer; private float realTickTimer; private bool lastEventWasCrash; private bool catchUpEventFired; private MethodInfo miTo24; private MethodInfo miTo12; private int sel; private int page; private int rangeSel = 1; private int stripScroll; private int histScroll; private int portScroll; private int marketScroll; private int unread; private int sortKey = 3; private int viewSpan = 1440; private int viewOffset; private bool sortDesc; private float panRemainder; private bool favOnly; private bool buyMode = true; private bool newsOpen; private string search = ""; private float qty; private float mQty; private float iconTimer; private float uiTimer; private float toastTimer; private float resetArm; private float flash; private float lastShownPrice; private float chartFade; private bool flashIsUp; private bool sparkDirty = true; private readonly List<int> shown = new List<int>(); private readonly List<int> marketOrder = new List<int>(); private GameObject appIcon; private GameObject appRoot; private RectTransform rootRT; private int refLayer; private bool isOpen; private bool uiBuilt; private bool exitRegistered; private bool forceRefresh; private bool chartDirty; private bool warnedOnce; private System.Type phoneType; private System.Type appsCanvasType; private Font uiFont; private Camera overlayCam; private Sprite iconSprite; private Sprite roundSprite; private float U = 5f; private float cornerMult = 1f; private float borderW = 1f; private Transform cp; private GameObject pageDash; private GameObject pageMarket; private GameObject pagePort; private GameObject pageHist; private GameObject pageSet; private GameObject newsPanel; private GameObject searchBox; private GameObject favBtnGo; private Image[] navBg; private Image[] navIcon; private Image[] navBar; private Text[] navLabel; private Text hdrTitle; private Text bellCount; private Image bellBadge; private Image favFilterImg; private Image toastBg; private Text toastText; private InputField searchField; private InputField qtyField; private InputField mQtyField; private MarketCard[] cards; private PointerZone stripZone; private PointerZone chartZone; private PointerZone histZone; private PointerZone portZone; private PointerZone marketZone; private Text stripEmpty; private Image ctIcon; private Image ctStarImg; private Image chartBg; private Image tagImg; private Image hoverTagImg; private Image sideBuyImg; private Image sideSellImg; private Image actionImg; private Image liveImg; private Text ctLetter; private Text ctName; private Text ctTicker; private Text ctPrice; private Text ctChange; private Text actionLabel; private Text totalTxt; private Text balTxt; private Text ownedTxt; private Text tipL1; private Text tipL2; private Text tipL3; private Text hoverTagText; private Image[] rangeImg = (Image[])(object)new Image[4]; private Image[] styleImg = (Image[])(object)new Image[2]; private Text[] yLabels = (Text[])(object)new Text[5]; private Text[] xLabels = (Text[])(object)new Text[5]; private LineGraphic line; private ChartGraphic candleChart; private RectTransform tagRT; private RectTransform tipRT; private RectTransform crossV; private RectTransform crossH; private RectTransform crossDot; private RectTransform hoverTagRT; private Text tagText; private readonly float[] lineBuf = new float[240]; private List<Candle> viewCandles = new List<Candle>(); private int vStart; private int vN; private int vBuckets; private float vLo; private float vHi; private int lastHoverKey = -2147483648; private MarketRow[] mRows; private Text[] sortLabels = (Text[])(object)new Text[5]; private Image[] sortArrows = (Image[])(object)new Image[5]; private Text mEmpty; private Text mCount; private Image mdIcon; private Image mdStar; private Text mdLetter; private Text mdName; private Text mdSym; private Text mdPrice; private Text mdOwned; private Text mdValue; private Text mdPl; private Text mdTotal; private Text[] mdChg = (Text[])(object)new Text[3]; private Image[] mdChgBg = (Image[])(object)new Image[3]; private LineGraphic mdSpark; private readonly float[] mdBuf = new float[96]; private Text rTotal; private Text rPl; private Text rCash; private Text rHold; private Text dCenter1; private Text dCenter2; private Text rNewsEmpty; private Image[] legDot = (Image[])(object)new Image[4]; private Text[] legSym = (Text[])(object)new Text[4]; private Text[] legPct = (Text[])(object)new Text[4]; private Image[] rNewsDot = (Image[])(object)new Image[3]; private Text[] rNewsTxt = (Text[])(object)new Text[3]; private Text[] rNewsTime = (Text[])(object)new Text[3]; private Image cardIcon0; private Text[] cardVal = (Text[])(object)new Text[4]; private Text[] cardSub = (Text[])(object)new Text[4]; private Text[] newsTexts; private Text[] newsTimes; private Image[] newsDots; private Text newsEmpty; private Text[] pCardVal = (Text[])(object)new Text[4]; private GameObject[] pRow = (GameObject[])(object)new GameObject[6]; private Image[] pIcon = (Image[])(object)new Image[6]; private Text[][] pTxt = new Text[6][]; private Text pEmpty; private Text pCount; private Image[] pRowBg = (Image[])(object)new Image[6]; private readonly List<int> portOrder = new List<int>(); private int portSel = -1; private float pSellQty; private InputField pSellField; private Image pSellIcon; private Text pSellName; private Text pSellOwned; private Text pSellTotal; private Text pSellHint; private Text pSellBtnLabel; private GameObject[] pSellParts; private Transform pSellPctRoot; private GameObject[] hRow = (GameObject[])(object)new GameObject[9]; private Image[] hKindBg = (Image[])(object)new Image[9]; private Text[][] hTxt = new Text[9][]; private Text hEmpty; private Image[] setStyleImg = (Image[])(object)new Image[2]; private Image[] setEvImg = (Image[])(object)new Image[2]; private Text resetLabel; private Text refLabel; private Button[] navBtn = (Button[])(object)new Button[5]; private readonly HashSet<string> uiWarned = new HashSet<string>(); private object hookedPhone; private Action closeAppsHandler; private Action closeAppsIl; private ExitDelegate exitIl; private System.Delegate exitDelegate; private const BindingFlags AnyInst = (BindingFlags)52; private const BindingFlags AnyStatic = (BindingFlags)56; private static readonly Dictionary<string, MemberInfo> memberCache = new Dictionary<string, MemberInfo>(); public const string ItemPrefix = "cryptotrader_"; private readonly Dictionary<string, StorableItemDefinition> itemDefs = new Dictionary<string, StorableItemDefinition>(); private GameObject boxEquipPrefab; private float itemCheckTimer; private bool itemsLogged; private bool itemsFailedLogged; private static Dictionary<string, Vector3> pkgSizes; private static readonly Dictionary<string, Texture2D> pkgAtlas = new Dictionary<string, Texture2D>(); private static readonly Dictionary<string, Material> pkgMats = new Dictionary<string, Material>(); private static readonly Dictionary<string, Sprite> pkgIcons = new Dictionary<string, Sprite>(); internal const string PcItemId = "pc"; internal const string PcItemName = "Mining Computer"; internal const float PcItemPrice = 950f; private StoredItem genericStored; private bool storedSearched; internal const float BoxGlow = 0.22f; private static readonly Dictionary<string, Mesh> modelMeshes = new Dictionary<string, Mesh>(); private static Mesh boxMesh; internal static Vector3 HeldOffset = new Vector3(0f, -0.26f, 0f); internal static float HeldPitch = 12f; internal static float HeldYaw = -14f; private Equippable heldEq; private HeldBoxView heldView; private bool heldWarned; private static readonly MeetSpot[] BuiltInSpots = new MeetSpot[7] { new MeetSpot(71.89f, -4.53f, 27.4f, 45f), new MeetSpot(92.02f, 5.22f, -129.59f, 359f), new MeetSpot(136.51f, 0.97f, 30.47f, 330f), new MeetSpot(-12.82f, -3.16f, 164.2f, 108f), new MeetSpot(-57.74f, -4.03f, 166.85f, 2f), new MeetSpot(-55.05f, -1.54f, -85.19f, 59f), new MeetSpot(-97.88f, -1.53f, -36.17f, 251f) }; internal static readonly List<MeetSpot> MeetSpots = new List<MeetSpot>((System.Collections.Generic.IEnumerable<MeetSpot>)BuiltInSpots); private static readonly Vector3 SewerSpot = new Vector3(71.85f, -4.53f, 27.37f); private const float SewerChance = 0.25f; private const int MeetLeadMin = 20; private const int MeetLeadMax = 40; private const int MeetWait = 120; private const int MeetEarly = 10; private const int CooldownAfterDeal = 180; private const int CooldownNoShow = 1440; private const int CooldownCancel = 360; private int meetStage; private int meetSpot = -1; private long meetStart = -1L; private long meetEnd = -1L; private long meetCooldownUntil = -1L; private int meetLastSpot = -1; private int meetDeals; private GameObject meetMarker; private GameObject meetPoiGo; private Element meetCompass; private bool meetByteHere; private float meetAwakeTimer; private float meetFaceTimer; private SendableMessage sendNeedParts; private SendableMessage sendWhere; private SendableMessage sendCancel; private const float MeetFarSpot = 80f; private const float MeetSeeRange = 70f; private const float RoomTemp = 26f; private const float ThrottleTemp = 82f; private const float MaxTemp = 100f; private const float RestartTemp = 68f; private const float BaseSystemWatts = 40f; private Dictionary<string, int> partsBoxData; private float powerDebt; private float powerBillTimer; internal float MiningSpeed = 1f; private const int SlotCount = 24; internal const int SlotBoard = 11; internal const int SlotSsd = 12; internal const int SlotHdd = 13; internal const int SlotFan0 = 14; private const string PcUiName = "CryptoTrader_PC"; private List<PcData> pcs; private PcKit kit; private bool pcsSpawned; private bool kitFailedLogged; private float pcSpawnTimer; private float pcClockTimer; private int pcNextId = 1; private PcData usingPc; private MonoState useState; private MonoState placeState; private GameObject stateGo; private bool statesTried; private bool placing; private bool placeValid; private bool placeCommitted; private PcData placeTarget; private GameObject ghost; private float placeYaw; private float placeDelay; private bool placeYawSet; private Vector3 placeOrigPos; private float placeOrigYaw; private Transform placeOrigParent; private GameObject hintCanvas; private Text hintMain; private Text hintStatus; private GameObject hintKeys; private CanvasGroup hintPlaceKey; private float noticeTimer; private MaterialPropertyBlock tintBlock; private float pendingMoveTimer = -1f; private PcData pendingMove; private bool placeFromBox; internal float placeEndedAt = -10f; private bool pendingNew; private PcData ghostData; private static System.Type playerType; private static readonly string[] AppTitles = new string[4] { "Miner", "Hardware", "Statistics", "Wallet" }; private static readonly Color rowBg = new Color(1f, 1f, 1f, 0.045f); private static readonly Color hwOff = new Color(1f, 1f, 1f, 0.14f); private static readonly Color hwWarm = new Color(1f, 0.6f, 0.25f, 1f); private static readonly Color hwSel = new Color(0.6f, 0.46f, 1f, 0.32f); private const string BuildUiName = "CryptoTrader_Build"; private const float SlideOut = 0.42f; private float buildSlide = 0.42f; private static readonly string[] BuildTabs = new string[9] { "All", "Board", "CPU", "Cooling", "RAM", "Storage", "GPU", "Power", "Fans" }; private const int TilesPerPage = 12; private readonly List<Tween> tweens = new List<Tween>(); private MonoState buildState; private PcData buildPc; private GameObject buildCanvas; private Transform buildPanel; private Text buildHint; private Text buildMsgText; private string buildMsg = ""; private Color buildMsgCol = Color.white; private readonly bool[] buildHide = new bool[24]; private bool panelOff; private bool backOff; private bool backView; private int screwsOut; private int buildTab; private int buildPage; private string buildSel; private string buildHover; private bool dragging; private Transform dragVis; private string dragId; private Vector3 dragCenter; private float dragStartY; private readonly List<Transform> ghosts = new List<Transform>(); private readonly List<int> ghostSlot = new List<int>(); private int ghostHot = -1; private Material ghostMat; private Material ghostHotMat; private readonly Dictionary<Transform, Pose> restPose = new Dictionary<Transform, Pose>(); private const float FrameLeft = 0.26f; private const float FrameRight = 0.985f; private const float CaseHalfW = 0.275f; private static bool roomWarned; private string roomBlocker = ""; private static readonly int[] RemoveOrder; private static readonly Color bInk; private static readonly Color bPaper; private static readonly Color bYellow; private static readonly Color bDim; private static readonly Color bGreen; private static readonly Color bRed; private static readonly string[] BuildSteps; private int buildStepSel = -1; private float buildErrTimer; private RectTransform buildCard; private Text detailName; private Text detailSpec; private Text detailFit; private RectTransform buildOverlay; private readonly List<BuildLabel> buildLabels = new List<BuildLabel>(); private RectTransform buildImpact; private Text impTitle; private Text impName; private Text impPow; private Text impCool; private Text impEarn; private Text impWarn; private Image impPowBar; private Image impPowNew; private Image impCoolBar; private Image impCoolNew; private Image impIcon; private float buildOverlayTimer; private readonly List<RectTransform> buildTargetRings = new List<RectTransform>(); private static readonly Color lblOk; private static readonly Color lblFit; private bool argbNear; private static readonly Vector3 CaseKitPos; private static readonly Dictionary<string, List<CtmObj>> ctmCache; private Dictionary<string, Material> pcMats; private Dictionary<string, string[]> pcMatDefs; private Dictionary<string, float[]> pcLay; private readonly Dictionary<string, Texture2D> pcTex = new Dictionary<string, Texture2D>(); private bool pcAssetsTried; private bool pcAssetsOk; private float caseLodTimer; private const string CasePreviewName = "Case3DPreview"; internal static readonly Bounds CaseLocalBox; private const float DeskW = 1.4f; private const float DeskD = 0.72f; private const float DeskH = 0.75f; private const float TopT = 0.035f; private const float ScrW = 0.6f; private const float ScrH = 0.3375f; private const float MonZ = -0.21f; private const float MonY = 1.075f; private const float CanvasPx = 1600f; private static readonly Color RgbCyan; private static readonly Color RgbViolet; private static readonly Color RgbPink; private static readonly Color FanGrey; private static readonly Color TrimGreen; private Material litBase; private Sprite fanSprite; private Sprite outlineSprite; private Sprite interiorSprite; private static readonly Vector3[] AsicSpots; internal const int FanSlots = 10; internal static readonly string[] StockSet; private static readonly Color osPanel; private static readonly Color osBar; private Sprite wallpaper; private static readonly Color tGreen; private static readonly Color tGreenDim; private static readonly Color tGreenFaint; private static readonly Color tBg; private static readonly Color tAmber; private static readonly Color tRed; private static readonly Color tCyan; private static readonly Color tYellow; private static readonly Color tClear; private Font monoFont; private static Texture2D scanTex; private static Texture2D vignetteTex; private static Texture2D diagTex; private static readonly Dictionary<string, Texture2D> gradCache; private static Texture2D gridTex; private List<string[]> walletLog = new List<string[]>(); private float[] walletSnap; private long walletHour = -1L; private bool hudHidden; private static readonly Color rackSel; private static Sprite fullRing; private const int TraceW = 640; private const int TraceH = 112; private Color32[] traceBuf; private static readonly Color cNavDim; private static readonly Color cSpark; private static readonly Color cToggleOn; private Transform scr; private GameObject pageHome; private int prevPage = 5; private readonly int[] navPages; private Text hBalance; private Text hChange; private Text hCoinsTotal; private Text hFavTitle; private Text hNoCoins; private HoldRow[] hHold; private const int FavRows = 7; private FavRow[] hFav; private int favScroll; private PointerZone favZone; private readonly List<int> favOrder; private Text cStats; private Text cWorth; private Text modeOwnLabel; private readonly Text[] pSellAllLabel; private float sellAllArm; private int sellAllCoin; internal static readonly string[] CurSigns; internal static readonly string[] CurCodes; private static int curIdx; private static readonly float[] AlertSteps; private int alertIdx; private bool homeMine; private readonly Dictionary<string, long> alertedAt; private Image[] setCurImg; private Image[] setAlertImg; private Image[] setHomeImg; private Image[] setLangImg; private int pendingLang; private const string ShopUiName = "CryptoTrader_ByteShop"; private const int ShopPerPage = 15; private const int ShopMaxQty = 10; private MonoState shopState; private bool shopOpen; private GameObject shopCanvas; private Transform shopPanel; private int shopTab; private int shopPage; private string shopWarn; private string shopInfo; private readonly Dictionary<string, int> shopCart; private readonly List<string> shopCartOrder; private static readonly string[] ShopTabs; private static Texture2D brickTex; private static Texture2D plankTex; private RectTransform shopHover; private Text shopHoverName; private Text shopHoverSpec; private Transform shopHoverStars; private static Texture2D shadowTex; public const string SupplierName = "Byte"; public const string SupplierUnknownName = "Unknown"; private static readonly Color SupSkinCol; internal static readonly string[] SupSlots; internal static readonly bool[] SupNatural; internal static readonly string[][] SupOptions; internal readonly int[] SupPick; internal static readonly string[] SupColorNames; internal static readonly Color[] SupColorValues; internal readonly int[] SupColor; internal static readonly string[] SupSkinNames; internal static readonly Color[] SupSkinValues; internal int SupSkin; internal const string DefaultSupplierLook = "Hair=Bowl Cut/Navy;Facial hair=None/Default;Face=Neutral Face/Default;Eye detail=None/Default;Hat=None/Black;Glasses=None/Black;Face wear=None/Default;Jacket=Open Vest/Black;Top=T-Shirt/Navy;Bottom=Cargo Pants/Dark grey;Shoes=None/Tan;Hands=Gloves/Black;Neck=Chain/Default;Waist=None/Black;Wrist=Polex/Default;Full body=Hazmat Suit/Charcoal;Skin=Medium;Build=0.31"; internal float SupWeight; private GameObject supplier; private Sprite supplierPortrait; private string supplierLog; private const int ShoesSlot = 10; private const int FullBodySlot = 15; private Sprite supplierPhoto; private bool supplierPhotoBusy; [CompilerGenerated] [DebuggerBrowsable(/*Could not decode attribute arguments.*/)] private Action m_SupplierPhotoChanged; internal static float PhotoFov; internal static float PhotoDistance; internal static float PhotoYaw; internal static float PhotoLift; internal static float PhotoLight; private const int PhotoRender = 1024; private const int PhotoSize = 512; private static readonly Vector3 PhotoSpot; private string photoKeyInUse; private string photoCheckedKey; internal const float DefPhotoFov = 11.25f; internal const float DefPhotoDistance = 1.73f; internal const float DefPhotoYaw = 0f; internal const float DefPhotoLift = 0.1f; internal const float DefPhotoLight = 3f; internal bool ApiReady => sessionLoaded; internal string ApiSaveFolder => currentSavePath; internal bool ApiPlacing => placing; internal bool ApiUsing => usingPc != null; internal bool ApiEventsOn { get { return eventsOn; } set { eventsOn = value; SaveSettings(); forceRefresh = true; } } internal float CryptoSpent { get { //IL_0020: 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) if (cryptoSpent < 0f) { float num = 0f; Enumerator<TradeRecord> enumerator = history.GetEnumerator(); try { while (enumerator.MoveNext()) { TradeRecord current = enumerator.Current; if (current.Kind == "BUY") { num += current.Total; } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } cryptoSpent = num; } return cryptoSpent; } } private string DataDir => MelonEnvironment.UserDataDirectory; private string SettingsPath => Path.Combine(DataDir, "CryptoTraderSettings.txt"); private string RefCachePath => Path.Combine(DataDir, "CryptoReferencePrices.txt"); private bool MeetInSewers => meetSpot >= 0 && meetSpot < MeetSpots.Count && IsSewerSpot(MeetSpots[meetSpot].Pos); private static string SpotsFile => Path.Combine(MelonEnvironment.UserDataDirectory, "CryptoTrader_MeetSpots.txt"); private Dictionary<string, int> partsBox { get { if (partsBoxData == null) { partsBoxData = new Dictionary<string, int>(); } return partsBoxData; } } private List<PcData> Pcs { get { if (pcs == null) { pcs = new List<PcData>(); } return pcs; } } private bool BuildBusy => tweens.Count > 0; private bool CaseOpen => backView ? backOff : panelOff; private static Quaternion FaceFront => Quaternion.Euler(0f, 180f, 0f); private static Quaternion FaceUp => Quaternion.Euler(90f, 0f, 0f); private static Quaternion FaceLeft => Quaternion.Euler(0f, 90f, 0f); private static bool CurSuffix => curIdx == 3; internal bool SupplierSpawned => (Object)(object)supplier != (Object)null; internal string SupplierLog => supplierLog ?? ""; private bool WearsHazmat => SupOptions[15][Mathf.Clamp(SupPick[15], 0, SupOptions[15].Length - 1)] == "Hazmat Suit"; private bool WearsFootwear => WearsHazmat || SupOptions[10][Mathf.Clamp(SupPick[10], 0, SupOptions[10].Length - 1)] != "None"; private static string PhotoFile => Path.Combine(MelonEnvironment.UserDataDirectory, "CryptoTrader_BytePhoto.png"); private static string PhotoKeyFile => Path.Combine(MelonEnvironment.UserDataDirectory, "CryptoTrader_BytePhoto.txt"); private string PhotoKey => string.Concat(new string[12] { SupLookString(), "|", PhotoFov.ToString(), "|", PhotoDistance.ToString(), "|", PhotoYaw.ToString(), "|", PhotoLift.ToString(), "|", PhotoLight.ToString(), "|v2" }); internal bool HasSupplierPhoto => ((Object)(object)supplierPhoto != (Object)null && photoKeyInUse == PhotoKey) || LoadSupplierPhoto(); private static string PhotoSettingsFile => Path.Combine(MelonEnvironment.UserDataDirectory, "CryptoTrader_PhotoCamera.txt"); internal bool SupplierPhotoBusy => supplierPhotoBusy; internal event Action SupplierPhotoChanged { [CompilerGenerated] add { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Action val = this.m_SupplierPhotoChanged; Action val2; do { val2 = val; Action val3 = (Action)System.Delegate.Combine((System.Delegate)(object)val2, (System.Delegate)(object)value); val = Interlocked.CompareExchange<Action>(ref this.m_SupplierPhotoChanged, val3, val2); } while (val != val2); } [CompilerGenerated] remove { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown Action val = this.m_SupplierPhotoChanged; Action val2; do { val2 = val; Action val3 = (Action)System.Delegate.Remove((System.Delegate)(object)val2, (System.Delegate)(object)value); val = Interlocked.CompareExchange<Action>(ref this.m_SupplierPhotoChanged, val3, val2); } while (val != val2); } } internal List<ComputerInfo> ApiComputers() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) List<ComputerInfo> val = new List<ComputerInfo>(); Enumerator<PcData> enumerator = Pcs.GetEnumerator(); try { while (enumerator.MoveNext()) { PcData current = enumerator.Current; ComputerInfo computerInfo = new ComputerInfo { Id = current.Id, Position = current.Pos, Yaw = current.Yaw, InUse = (current == usingPc) }; GameOwnedPropertyName(current.Pos, out computerInfo.Property); val.Add(computerInfo); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return val; } private static void GameOwnedPropertyName(Vector3 p, out string name) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) name = ""; try { Property val = PropertyAt(p); if ((Object)(object)val != (Object)null) { name = val.PropertyName; } } catch { } } private PcData FindPc(int id) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) Enumerator<PcData> enumerator = Pcs.GetEnumerator(); try { while (enumerator.MoveNext()) { PcData current = enumerator.Current; if (current.Id == id) { return current; } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } return null; } internal bool ApiStartPlacing() { if (placing || usingPc != null) { return false; } StartPlacement(); return true; } internal bool ApiMove(int id) { PcData pcData = FindPc(id); if (pcData == null || (Object)(object)pcData.Root == (Object)null || placing) { return false; } if (usingPc != null) { LeavePc(); } pendingNew = false; pendingMove = pcData; pendingMoveTimer = 0.3f; return true; } internal bool ApiOpen(int id) { PcData pcData = FindPc(id); if (pcData == null || (Object)(object)pcData.Root == (Object)null || placing || usingPc != null) { return false; } OpenPcView(pcData); return usingPc == pcData; } internal bool ApiRemove(int id) { PcData pcData = FindPc(id); if (pcData == null) { return false; } if (placing && ghostData == pcData) { FinishPlacement(commit: false); } if (usingPc == pcData) { LeavePc(); } Pcs.Remove(pcData); if ((Object)(object)pcData.Root != (Object)null) { Object.Destroy((Object)(object)pcData.Root); } return true; } internal int ApiRemoveAll() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) List<int> val = new List<int>(); Enumerator<PcData> enumerator = Pcs.GetEnumerator(); try { while (enumerator.MoveNext()) { PcData current = enumerator.Current; val.Add(current.Id); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } Enumerator<int> enumerator2 = val.GetEnumerator(); try { while (enumerator2.MoveNext()) { int current2 = enumerator2.Current; ApiRemove(current2); } } finally { ((System.IDisposable)enumerator2/*cast due to .constrained prefix*/).Dispose(); } return val.Count; } internal void ApiRebuildModels() { //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) if (placing) { FinishPlacement(commit: false); } if (usingPc != null) { LeavePc(); } Enumerator<PcData> enumerator = Pcs.GetEnumerator(); try { while (enumerator.MoveNext()) { PcData current = enumerator.Current; if ((Object)(object)current.Root != (Object)null) { Object.Destroy((Object)(object)current.Root); current.Root = null; } } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } kit = null; kitFailedLogged = false; pcsSpawned = false; pcSpawnTimer = 0.1f; } internal string[] ApiSymbols() { string[] array = new string[coins.Count]; for (int i = 0; i < coins.Count; i++) { array[i] = coins[i].Symbol; } return array; } internal float ApiPrice(string sym) { int num = IndexOf(sym); return (num >= 0) ? coins[num].Price : 0f; } internal float ApiOwned(string sym) { int num = IndexOf(sym); return (num >= 0) ? coins[num].Owned : 0f; } internal bool ApiGive(string sym, float units) { int num = IndexOf(sym); if (num < 0 || units <= 0f) { return false; } Coin coin = coins[num]; coin.Owned += units; coin.Invested += units * coin.Price; forceRefresh = true; return true; } internal bool ApiEvent() { SpawnEvent(); forceRefresh = true; chartDirty = true; sparkDirty = true; return true; } internal void ApiFastForward(int minutes) { RunTicks(minutes); forceRefresh = true; chartDirty = true; sparkDirty = true; } internal void ApiGivePart(string id, int n) { for (int i = 0; i < n; i++) { GiveSpare(id); } RefreshOpenApp(); } internal int ApiBoxCount(string id) { return SpareCount(id); } internal void ApiClearBox() { partsBox.Clear(); RefreshOpenApp(); } internal float ApiWalletUsd() { return PendingUsd(); } internal void ApiSimulateMining(int minutes) { minutes = Mathf.Clamp(minutes, 0, 10080); for (int i = 0; i < minutes; i++) { totalGameMin++; MineMinute(); } totalGameMin -= minutes; RefreshOpenApp(); } internal string ApiRigSummary(int id) { PcData pcData = FindPc(id); if (pcData == null) { return ""; } RigState rigState = RigOf(pcData); EvaluateRig(rigState, advance: false); return string.Concat(new string[9] { StatusText(rigState.Status), ", ", rigState.Temp.ToString("0", (IFormatProvider)(object)Inv), " C, $", rigState.UsdPerDay.ToString("N0", (IFormatProvider)(object)Inv), "/day, ", rigState.WallWatts.ToString("0", (IFormatProvider)(object)Inv), " W, mined $", rigState.TotalUsd.ToString("N2", (IFormatProvider)(object)Inv) }); } private void RefreshOpenApp() { if (usingPc != null && usingPc.WinApp >= 0) { try { OpenPcWindow(usingPc, usingPc.WinApp); } catch { } } } internal float ApiBalance() { return GetBalance(); } internal void ApiAddMoney(float amount, string note) { AddBalance(amount, string.IsNullOrEmpty(note) ? "Developer" : note); } internal void NoteCryptoBuy(float cost) { cryptoSpent = CryptoSpent + cost; } private static bool RankAtLeastHoodlum() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 try { if (!NetworkSingleton<LevelManager>.InstanceExists) { return false; } return (int)NetworkSingleton<LevelManager>.Instance.Rank >= 1; } catch { return false; } } private bool ByteUnlocked(float dt) { if (byteUnlocked) { return true; } byteUnlockCheck -= dt; if (byteUnlockCheck > 0f) { return false; } byteUnlockCheck = 2f; byteUnlocked = RankAtLeastHoodlum() && CryptoSpent >= 300f; return byteUnlocked; } private void ByteUpdate(float dt) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!EnsureByteConversation(dt)) { return; } byteQueueClock += dt; while (byteQueue.Count > 0 && byteQueue[0].Key <= byteQueueClock) { Action value = byteQueue[0].Value; byteQueue.RemoveAt(0); try { value.Invoke(); } catch (System.Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Byte message failed: " + ex.Message); } } if (byteQueue.Count > 0) { return; } if (byteStage == ByteStage.NotMet || byteStage == ByteStage.Ignored) { if (byteStage == ByteStage.NotMet && !byteForce && !ByteUnlocked(dt)) { return; } if (byteForce) { byteForce = false; byteNextMin = totalGameMin; } if (byteNextMin < 0) { byteNextMin = totalGameMin + ((byteStage == ByteStage.NotMet) ? 15 : 1440); } if (totalGameMin >= byteNextMin) { ByteOpening(); } } if (byteConv != null) { byteRead = byteConv.Read; } bytePhotoRetry -= dt; if (bytePhotoRetry <= 0f) { bytePhotoRetry = 30f; EnsureSupplierPhoto(); } } private bool EnsureByteConversation(float dt) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown if (byteConv != null) { return true; } byteRetry -= dt; if (byteRetry > 0f) { return false; } byteRetry = 1f; try { if (!NetworkSingleton<MessagingManager>.InstanceExists || !PlayerSingleton<MessagesApp>.InstanceExists) { return false; } MessagingManager instance = NetworkSingleton<MessagingManager>.Instance; MSGConversation val = default(MSGConversation); if (instance.TryGetConversation("cryptotrader_byte", ref val) && val != null) { DropConversation(val); } EnsureSupplierPhoto(); SupplierPhotoChanged -= new Action(ByteRefreshPicture); SupplierPhotoChanged += new Action(ByteRefreshPicture); MessageContactInfo val2 = new MessageContactInfo("Byte", "cryptotrader_byte", SupplierPicture(), false, false); byteConv = new MSGConversation(val2, "cryptotrader_byte"); MSGConversation obj = byteConv; List<EConversationCategory> obj2 = new List<EConversationCategory>(); obj2.Add((EConversationCategory)1); obj.SetCategories(Compat.GL<EConversationCategory>(obj2)); byteConv.SetIsKnown(byteKnown); Enumerator<ByteLine> enumerator = byteLog.GetEnumerator(); try { while (enumerator.MoveNext()) { ByteLine current = enumerator.Current; byteConv.SendMessage(new Message(Lang.T(current.Text), (ESenderType)(!current.Player), current.End, -1), false, false); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } if (byteLog.Count > 0) { byteConv.SetEntryVisibility(true); } byteConv.SetRead(byteRead); byteSendable = byteConv.CreateSendableMessage(Lang.T("Ok, what have you got?")); byteSendable.ShouldShowCheck = Check([CompilerGenerated] (SendableMessage m) => byteStage == ByteStage.Ignored); byteSendable.disableDefaultSendBehaviour = false; byteSendable.onSent = Compat.GA((Action)([CompilerGenerated] () => { if (byteStage == ByteStage.Ignored) { byteStage = ByteStage.Asking; byteNextMin = -1L; ByteLog(player: true, "Ok, what have you got?", end: true); ByteWhatParts(); } })); ByteAddMeetingTexts(); ByteResumeResponses(); ((MelonBase)this).LoggerInstance.Msg(string.Concat(new string[5] { "Byte's chat is ready (", byteLog.Count.ToString(), " messages, stage ", ((object)byteStage/*cast due to .constrained prefix*/).ToString(), ")." })); return true; } catch (System.Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Could not create Byte's chat yet: " + ex.Message); byteConv = null; byteRetry = 5f; return false; } } private static void DropConversation(MSGConversation c) { try { MessagesApp.Conversations.Remove(c); MessagesApp.ActiveConversations.Remove(c); string[] array = new string[2] { "entry", "container" }; foreach (string name in array) { object obj = Compat.Get(c, name); RectTransform val = (RectTransform)((obj is RectTransform) ? obj : null); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)((Component)val).gameObject); } } if (NetworkSingleton<MessagingManager>.InstanceExists) { NetworkSingleton<MessagingManager>.Instance._senderIdConversationMap?.Remove("cryptotrader_byte"); } } catch { } } private void ByteRefreshPicture() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown if (byteConv == null) { return; } try { Compat.Set(byteConv, "_sender", (object)new MessageContactInfo("Byte", "cryptotrader_byte", SupplierPicture(), false, false)); byteConv.SetIsKnown(byteKnown); } catch (System.Exception ex) { ((MelonBase)this).LoggerInstance.Warning("Could not update Byte's picture: " + ex.Message); } } private void ByteOpening() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown byteNextMin = -1L; if (byteStage == ByteStage.NotMet) { ByteSay("yo. heard you're into crypto.", 0f); ByteSay("trading on your phone is small money. mining is where it's at.", 2.5f); ByteSay("i can get you a mining rig and parts. cheap. no receipts.", 2.5f, endOfGroup: true); } else { ByteSay("still mining on stock parts?", 0f); ByteSay("offer's still open.", 2f, endOfGroup: true); } ByteThen((Action)([CompilerGenerated] () => { byteStage = ByteStage.Asking; ByteResumeResponses(); })); } private void ByteWhoIsThis() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown ByteSay("friend of a friend.", 1.5f); ByteSay("call me Byte.", 2f, endOfGroup: true); ByteThen(new Action(ByteReveal)); ByteTerms(); } private void ByteWhatParts() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown ByteSay("full mining computers. graphics cards. processors. ASIC miners.", 1.5f); ByteSay("stuff that fell off a truck, if you know what i mean.", 2.5f); ByteSay("name's Byte.", 2f, endOfGroup: true); ByteThen(new Action(ByteReveal)); ByteTerms(); } private void ByteNotInterested() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown ByteSay("your call.", 1.5f); ByteSay("you'll think about me when the power bill comes.", 2.5f, endOfGroup: true); ByteThen((Action)([CompilerGenerated] () => { byteStage = ByteStage.Ignored; byteNextMin = totalGameMin + 1440; })); } private void ByteTerms() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown ByteSay("i don't do shops. i don't do deliveries.", 3f); ByteSay("we meet in person. you bring cash, you get the box.", 3f); ByteSay("text me when you need something.", 2.5f, endOfGroup: true); ByteThen((Action)([CompilerGenerated] () => { byteStage = ByteStage.Closing; ByteResumeResponses(); })); } private void ByteReveal() { byteKnown = true; if (byteConv != null) { byteConv.SetIsKnown(true); } } private void ByteResumeResponses() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown if (byteConv == null) { return; } List<Response> val = new List<Response>(); if (byteStage == ByteStage.Asking) { val.Add(ByteReply("Who is this?", new Action(ByteWhoIsThis))); val.Add(ByteReply("What kind of parts?", new Action(ByteWhatParts))); val.Add(ByteReply("Not interested.", new Action(ByteNotInterested))); } else if (byteStage == ByteStage.Closing) { val.Add(ByteReply("Deal.", (Action)([CompilerGenerated] () => { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ByteSay("good.", 1.5f, endOfGroup: true); ByteThen((Action)([CompilerGenerated] () => { byteStage = ByteStage.Introduced; })); }))); val.Add(ByteReply("Sounds shady.", (Action)([CompilerGenerated] () => { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown ByteSay("it is. that's why it's cheap.", 2f, endOfGroup: true); ByteThen((Action)([CompilerGenerated] () => { byteStage = ByteStage.Introduced; })); }))); } if (val.Count > 0) { byteConv.ShowResponses(Compat.GL<Response>(val), 0.4f, false); } } private Response ByteReply(string text, Action then) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown return new Response(Lang.T(text), "byte_" + text, Compat.GA((Action)delegate { ByteLog(player: true, text, end: true); then.Invoke(); }), false); } private static BoolCheck Check(Func<SendableMessage, bool> f) { return DelegateSupport.ConvertDelegate<BoolCheck>((System.Delegate)(object)f); } private void ByteLanguageChanged() { if (byteConv != null) { byteConv = null; byteRetry = 0f; } if (!((Object)(object)supplier == (Object)null)) { InteractableObject component = supplier.GetComponent<InteractableObject>(); if ((Object)(object)component != (Object)null) { component.SetMessage(Lang.T(meetByteHere ? "Buy from Byte" : "Talk to Byte")); } } } private void ByteSay(string text, float delay, bool endOfGroup = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown ByteThen((Action)delegate { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown ByteLog(player: false, text, endOfGroup); if (byteConv != null) { byteConv.SendMessage(new Message(Lang.T(text), (ESenderType)1, endOfGroup, -1), true, false); } }, delay); } private void ByteThen(Action a, float delay = 0f) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) float num = ((byteQueue.Count > 0) ? byteQueue[byteQueue.Count - 1].Key : byteQueueClock); byteQueue.Add(new KeyValuePair<float, Action>(Mathf.Max(num, byteQueueClock) + delay, a)); } private void ByteLog(bool player, string text, bool end) { byteLog.Add(new ByteLine { Player = player, Text = text, End = end }); while (byteLog.Count > 30) { byteLog.RemoveAt(0); } } private void ByteAppendSave(StringBuilder sb) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) ByteStage byteStage = this.byteStage; sb.Append("BYT;").Append((int)byteStage).Append(';') .Append(byteKnown ? 1 : 0) .Append(';') .Append(byteNextMin) .Append(';') .Append(byteRead ? 1 : 0) .Append(';') .Append(CryptoSpent.ToString("0.##", (IFormatProvider)(object)Inv)) .Append('\n'); Enumerator<ByteLine> enumerator = byteLog.GetEnumerator(); try { while (enumerator.MoveNext()) { ByteLine current = enumerator.Current; sb.Append("BYM;").Append((!current.Player) ? 1 : 0).Append(';') .Append(current.End ? 1 : 0) .Append(';') .Append(Convert.ToBase64String(Encoding.UTF8.GetBytes(current.Text))) .Append('\n'); } } finally { ((System.IDisposable)enumerator/*cast due to .constrained prefix*/).Dispose(); } } private void ByteParseLine(string[] f) { if (f[0] == "BYT" && f.Length >= 5) { int num = int.Parse(f[1], (IFormatProvider)(object)Inv); byteStage = (ByteStage)Mathf.Clamp(num, 0, 4); byteKnown = f[2] == "1"; byteNextMin = long.Parse(f[3], (IFormatProvider)(object)Inv); byteRead = f[4] == "1"; float num2 = default(float); if (f.Length >= 6 && float.TryParse(f[5], (NumberStyles)167, (IFormatProvider)(object)Inv, ref num2)) { cryptoSpent = num2; } } else if (f[0] == "BYM" && f.Length >= 4) { string text = Encoding.UTF8.GetString(Convert.FromBase64String(f[3])); ByteLog(f[1] == "0", text, f[2] == "1"); } } private void ByteReset() { byteStage = ByteStage.NotMet; byteKnown = false; byteRead = true; byteNextMin = -1L; byteLog.Clear(); byteQueue.Clear(); byteQueueClock = 0f; byteRetry = 0f; byteForce = false; cryptoSpent = -1f; byteUnlocked = false; byteUnlockCheck = 0f; if (byteConv != null) { DropConversation(byteConv); } byteConv = null; byteSendable = null; } internal void ApiByteTextNow() { if (byteStage == ByteStage.NotMet || byteStage == ByteStage.Ignored) { byteForce = true; } } internal void ApiByteRestart() { bool flag = sessionLoaded; ByteReset(); if (flag) { byteRetry = 0f; } } internal string ApiByteState() { string text = string.Concat(new string[6] { "stage: ", ((object)byteStage/*cast due to .constrained prefix*/).ToString(), byteKnown ? ", known as Byte" : ", shown as Unknown", ", ", byteLog.Count.ToString(), " messages" }); if (byteNextMin >= 0) { text = text + ", next text in " + Mathf.Max(0f, (float)(byteNextMin - totalGameMin)) + " game min"; } if (byteConv == null) { text += " (chat not created yet)"; } return text; } private static bool IsMeetQuest(Quest x) { try { return (Object)(object)x != (Object)null && (Object)(object)((Component)x).gameObject != (Object)null && ((Object)((Component)x).gameObject).name == "CryptoTrader_MeetByteQuest"; } catch { return false; } } private bool MeetCreateQuest(Transform target) { //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Expected O, but got Unknown //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Expected O, but got Unknown //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Expected O, but got Unknown //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Expected O, but got Unknown //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)meetQuest != (Object)null) { MeetKillQuest(meetQuest); meetQuest = null; } MeetClearOldQuests(); Quest q = null; try { Quest val = QuestTemplate(); if ((Object)(object)val == (Object)null) { return false; } GameObject val2 = new GameObject("CryptoTrader_MeetByteQuest"); val2.SetActive(false); q = val2.AddComponent<Quest>(); SetMember(q, "autoInitialize", false); q.IconPrefab = val.IconPrefab; q.PoIPrefab = val.PoIPrefab; q.TrackOnBegin = true; q.AutoStartFirstEntry = true; q.AutoCompleteOnAllEntriesComplete = false; q.PlayQuestCompleteSound = true; q.CompletionXP = 0; if (q.Entries == null) { q.Entries = Compat.GL<QuestEntry>(new List<QuestEntry>()); } FillEvents(q); val2.SetActive(true); meetQuestTitle = "Meet Byte"; q.InitializeQuest(Lang.T("Meet Byte"), Lang.T("Byte is waiting with his stock. Bring cash."), Il2CppReferenceArray<QuestEntryData>.op_Implicit((QuestEntryData[])(object)new QuestEntryData[1] { new QuestEntryData(Lang.T("Be there before " + MeetClock(meetEnd) + (MeetInSewers ? " - in the sewers" : "")), (EQuestState)0) }), ((object)Guid.NewGuid()/*cast due to .constrained prefix*/).ToString()); if (q.Entries.Count == 0) { MeetKillQuest(q); return false; } Enumerator<QuestEntry> enumerator = q.Entries.GetEnumerator(); while (enumerator.MoveNext()) { QuestEntry current = enumerator.Current; FillEvents(current); } try { List<ISaveable> saveables = Singleton<SaveManager>.Instance.Saveables; for (int num = saveables.Count - 1; num >= 0; num--) { ISaveable val3 = saveables[num]; if (val3 != null && ((I