using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using DealerAutoRestock; using HarmonyLib; using Il2CppEPOOutline; using Il2CppFishNet; using Il2CppFishNet.Connection; using Il2CppFishNet.Managing.Client; using Il2CppFishNet.Managing.Server; using Il2CppFishNet.Object; using Il2CppFishNet.Serializing; using Il2CppFishNet.Transporting; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.AvatarFramework; using Il2CppScheduleOne.AvatarFramework.Animation; using Il2CppScheduleOne.Building.Doors; using Il2CppScheduleOne.Delivery; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Dialogue; using Il2CppScheduleOne.Doors; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.EntityFramework; using Il2CppScheduleOne.Interaction; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.NPCs; using Il2CppScheduleOne.NPCs.Behaviour; using Il2CppScheduleOne.NPCs.Schedules; using Il2CppScheduleOne.ObjectScripts; using Il2CppScheduleOne.Persistence; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Product; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Storage; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Phone; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using S1API.Internal.Abstraction; using S1API.PhoneApp; using S1API.Saveables; using S1API.UI; using S1API.Utils; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(DealerAutoRestockMod), "Dealer Auto Restock", "0.10.0", "SeaDoge", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: MelonPlatformDomain(/*Could not decode attribute arguments.*/)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("DealerAutoRestock")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.10.0.0")] [assembly: AssemblyInformationalVersion("0.10.0")] [assembly: AssemblyProduct("DealerAutoRestock")] [assembly: AssemblyTitle("DealerAutoRestock")] [assembly: AssemblyVersion("0.10.0.0")] [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 DealerAutoRestock { public sealed class DealerAutoRestockSave : Saveable { [SaveableField("Assignments")] private List savedAssignments; private static DealerAutoRestockSave? instance; private DealerAutoRestockSave() { instance = this; savedAssignments = DealerAutoRestockMod.Instance?.CreateSaveSnapshot() ?? new List(); } internal static void SyncFromMod() { if (instance != null && DealerAutoRestockMod.Instance != null) { instance.savedAssignments = DealerAutoRestockMod.Instance.CreateSaveSnapshot(); } } protected override void OnCreated() { savedAssignments = new List(); DealerAutoRestockMod.Instance?.QueueSaveRestore(savedAssignments); } protected override void OnLoaded() { if (savedAssignments == null) { savedAssignments = new List(); } DealerAutoRestockMod.Instance?.QueueSaveRestore(savedAssignments); } protected override void OnDestroyed() { if (instance == this) { instance = null; } } } public sealed class SavedAssignment { public string DealerId { get; set; } = string.Empty; public RestockSourceKind SourceKind { get; set; } public string SourceGuid { get; set; } = string.Empty; public string SourceName { get; set; } = string.Empty; } public enum RestockSourceKind { PlaceableStorage, DeadDrop } public sealed class DealerRestockPhoneApp : PhoneApp { private sealed class DealerCardView { public Image Background { get; } public Image Accent { get; } public RectTransform AccentRect { get; } public Text Name { get; } public Text Status { get; } public Text Source { get; } public Image Portrait { get; } public Text Initials { get; } public DealerCardView(Image background, Image accent, RectTransform accentRect, Text name, Text status, Text source, Image portrait, Text initials) { Background = background; Accent = accent; AccentRect = accentRect; Name = name; Status = status; Source = source; Portrait = portrait; Initials = initials; } } private static readonly Color Canvas = new Color(0.025f, 0.035f, 0.047f, 1f); private static readonly Color Header = new Color(0.045f, 0.061f, 0.078f, 1f); private static readonly Color Panel = new Color(0.055f, 0.072f, 0.09f, 1f); private static readonly Color Raised = new Color(0.075f, 0.098f, 0.12f, 1f); private static readonly Color Card = new Color(0.085f, 0.11f, 0.135f, 1f); private static readonly Color CardSelected = new Color(0.12f, 0.135f, 0.145f, 1f); private static readonly Color Ink = new Color(0.93f, 0.95f, 0.96f, 1f); private static readonly Color MutedInk = new Color(0.57f, 0.65f, 0.71f, 1f); private static readonly Color Orange = new Color(0.94f, 0.35f, 0.075f, 1f); private static readonly Color Red = new Color(0.48f, 0.11f, 0.11f, 1f); private static Sprite? icon; private static DealerRestockPhoneApp? current; private RectTransform? dealerContent; private Text? summaryText; private Text? detailName; private Text? detailStatus; private Text? detailDescription; private Image? detailStatusBackground; private Image? detailPortrait; private Text? detailInitials; private Text? dealerStockText; private Text? sourceStockText; private Image? dealerStockFill; private Text? sourceTypeText; private Text? sourceNameText; private Text? sourceLocationText; private Text? sourceGlyph; private Text? actionLabel; private Button? actionButton; private Image? actionButtonImage; private Button? disableButton; private Image? disableButtonImage; private readonly Dictionary dealerCards = new Dictionary(StringComparer.Ordinal); private string rosterSignature = string.Empty; private Dealer? selectedDealer; private bool wasOpen; private float nextRefreshAt; protected override string AppName => "DealerAutoRestockApp"; protected override string AppTitle => "Auto Restock"; protected override string IconLabel => "Auto Restock"; protected override string IconFileName => string.Empty; protected override EOrientation Orientation => (EOrientation)0; protected override Sprite? IconSprite => icon ?? (icon = CreateIcon()); protected override void OnCreatedUI(GameObject container) { //IL_0011: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: 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_02f7: Unknown result type (might be due to invalid IL or missing references) current = this; GameObject val = UIFactory.Panel("DispatchRoot", container.transform, Canvas, (Vector2?)null, (Vector2?)null, true); Stretch(UIFactory.Panel("Signal", val.transform, Orange, (Vector2?)new Vector2(0f, 0.987f), (Vector2?)Vector2.one, false).GetComponent(), 0f, 0f, 0f, 0f); GameObject val2 = UIFactory.Panel("Header", val.transform, Header, (Vector2?)new Vector2(0.018f, 0.865f), (Vector2?)new Vector2(0.982f, 0.965f), false); Stretch(val2.GetComponent(), 0f, 0f, 0f, 0f); AnchorRect(((Graphic)MakeText("Eyebrow", "AUTO RESTOCK / OPERATIONS", val2.transform, 12, (TextAnchor)3, (FontStyle)1, Orange)).rectTransform, new Vector2(0f, 0.58f), new Vector2(0.55f, 0.92f), 20f, 0f, 0f, 0f); AnchorRect(((Graphic)MakeText("Title", "DEALER LOGISTICS", val2.transform, 25, (TextAnchor)3, (FontStyle)1, Ink)).rectTransform, new Vector2(0f, 0.08f), new Vector2(0.55f, 0.62f), 20f, 0f, 0f, 0f); summaryText = MakeText("Summary", "0 ACTIVE / 0 DEALERS", val2.transform, 15, (TextAnchor)5, (FontStyle)1, MutedInk); AnchorRect(((Graphic)summaryText).rectTransform, new Vector2(0.55f, 0f), Vector2.one, 0f, 22f, 0f, 0f); GameObject val3 = UIFactory.Panel("Roster", val.transform, Panel, (Vector2?)new Vector2(0.018f, 0.04f), (Vector2?)new Vector2(0.385f, 0.84f), false); Stretch(val3.GetComponent(), 0f, 0f, 0f, 0f); AnchorRect(((Graphic)MakeText("RosterTitle", "RECRUITED DEALERS", val3.transform, 14, (TextAnchor)3, (FontStyle)1, MutedInk)).rectTransform, new Vector2(0f, 0.91f), Vector2.one, 18f, 16f, 0f, 0f); dealerContent = CreateList("DealerList", val3.transform, 14f, 14f, 14f, 64f); GameObject val4 = UIFactory.Panel("Workspace", val.transform, Panel, (Vector2?)new Vector2(0.405f, 0.04f), (Vector2?)new Vector2(0.982f, 0.84f), false); Stretch(val4.GetComponent(), 0f, 0f, 0f, 0f); BuildDealerHeader(val4.transform); BuildMetrics(val4.transform); BuildSourceCard(val4.transform); BuildActions(val4.transform); Refresh(); } private void BuildDealerHeader(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_006f: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0170: 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) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) GameObject val = UIFactory.Panel("DealerHeader", parent, Raised, (Vector2?)new Vector2(0.025f, 0.69f), (Vector2?)new Vector2(0.975f, 0.965f), false); Stretch(val.GetComponent(), 0f, 0f, 0f, 0f); detailPortrait = CreatePortrait("Portrait", val.transform, new Vector2(0f, 0.5f), new Vector2(58f, 0f), 96f, out detailInitials); detailName = MakeText("DealerName", "SELECT A DEALER", val.transform, 25, (TextAnchor)3, (FontStyle)1, Ink); AnchorRect(((Graphic)detailName).rectTransform, new Vector2(0f, 0.49f), new Vector2(0.67f, 0.88f), 122f, 0f, 0f, 0f); detailDescription = MakeText("DealerDescription", "Choose a recruited dealer from the roster.", val.transform, 14, (TextAnchor)0, (FontStyle)0, MutedInk); AnchorRect(((Graphic)detailDescription).rectTransform, new Vector2(0f, 0.12f), new Vector2(0.72f, 0.5f), 122f, 0f, 0f, 0f); GameObject val2 = UIFactory.Panel("StatusBadge", val.transform, ToneColor(DealerUiTone.Muted), (Vector2?)new Vector2(0.73f, 0.57f), (Vector2?)new Vector2(0.965f, 0.82f), false); Stretch(val2.GetComponent(), 0f, 0f, 0f, 0f); detailStatusBackground = val2.GetComponent(); detailStatus = MakeText("Status", "DISABLED", val2.transform, 13, (TextAnchor)4, (FontStyle)1, Ink); Fill(((Graphic)detailStatus).rectTransform, 5f, 5f, 0f, 0f); } private void BuildMetrics(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0263: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Unknown result type (might be due to invalid IL or missing references) GameObject val = UIFactory.Panel("DealerStock", parent, Raised, (Vector2?)new Vector2(0.025f, 0.49f), (Vector2?)new Vector2(0.487f, 0.665f), false); Stretch(val.GetComponent(), 0f, 0f, 0f, 0f); AnchorRect(((Graphic)MakeText("Label", "DEALER STOCK", val.transform, 12, (TextAnchor)3, (FontStyle)1, MutedInk)).rectTransform, new Vector2(0f, 0.58f), new Vector2(0.65f, 0.94f), 16f, 0f, 0f, 0f); dealerStockText = MakeText("Value", "-- / --", val.transform, 22, (TextAnchor)5, (FontStyle)1, Ink); AnchorRect(((Graphic)dealerStockText).rectTransform, new Vector2(0.55f, 0.48f), new Vector2(0.95f, 0.96f), 0f, 0f, 0f, 0f); GameObject val2 = UIFactory.Panel("Track", val.transform, new Color(0.025f, 0.035f, 0.043f, 1f), (Vector2?)new Vector2(0.055f, 0.18f), (Vector2?)new Vector2(0.945f, 0.31f), false); Stretch(val2.GetComponent(), 0f, 0f, 0f, 0f); GameObject val3 = UIFactory.Panel("Fill", val2.transform, Orange, (Vector2?)Vector2.zero, (Vector2?)Vector2.one, false); dealerStockFill = val3.GetComponent(); RectTransform component = val3.GetComponent(); component.anchorMax = new Vector2(0f, 1f); Stretch(component, 0f, 0f, 0f, 0f); GameObject val4 = UIFactory.Panel("SourceStock", parent, Raised, (Vector2?)new Vector2(0.513f, 0.49f), (Vector2?)new Vector2(0.975f, 0.665f), false); Stretch(val4.GetComponent(), 0f, 0f, 0f, 0f); AnchorRect(((Graphic)MakeText("Label", "SOURCE INVENTORY", val4.transform, 12, (TextAnchor)3, (FontStyle)1, MutedInk)).rectTransform, new Vector2(0f, 0.58f), new Vector2(0.75f, 0.94f), 16f, 0f, 0f, 0f); sourceStockText = MakeText("Value", "--", val4.transform, 28, (TextAnchor)3, (FontStyle)1, Ink); AnchorRect(((Graphic)sourceStockText).rectTransform, new Vector2(0f, 0.12f), new Vector2(0.48f, 0.62f), 16f, 0f, 0f, 0f); AnchorRect(((Graphic)MakeText("Units", "PRODUCT UNITS", val4.transform, 11, (TextAnchor)5, (FontStyle)1, MutedInk)).rectTransform, new Vector2(0.45f, 0.12f), new Vector2(0.95f, 0.58f), 0f, 0f, 0f, 0f); } private void BuildSourceCard(Transform parent) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) GameObject val = UIFactory.Panel("Source", parent, Raised, (Vector2?)new Vector2(0.025f, 0.235f), (Vector2?)new Vector2(0.975f, 0.465f), false); Stretch(val.GetComponent(), 0f, 0f, 0f, 0f); GameObject val2 = UIFactory.Panel("GlyphBox", val.transform, new Color(0.1f, 0.125f, 0.14f, 1f), (Vector2?)new Vector2(0.025f, 0.18f), (Vector2?)new Vector2(0.17f, 0.82f), false); Stretch(val2.GetComponent(), 0f, 0f, 0f, 0f); sourceGlyph = MakeText("Glyph", "--", val2.transform, 21, (TextAnchor)4, (FontStyle)1, Orange); Fill(((Graphic)sourceGlyph).rectTransform, 0f, 0f, 0f, 0f); sourceTypeText = MakeText("Type", "RESTOCK SOURCE", val.transform, 12, (TextAnchor)3, (FontStyle)1, Orange); AnchorRect(((Graphic)sourceTypeText).rectTransform, new Vector2(0.2f, 0.63f), new Vector2(0.74f, 0.9f), 0f, 0f, 0f, 0f); sourceNameText = MakeText("Name", "No source assigned", val.transform, 20, (TextAnchor)3, (FontStyle)1, Ink); AnchorRect(((Graphic)sourceNameText).rectTransform, new Vector2(0.2f, 0.3f), new Vector2(0.94f, 0.67f), 0f, 0f, 0f, 0f); sourceLocationText = MakeText("Location", "Assign a storage or outdoor dead drop.", val.transform, 13, (TextAnchor)3, (FontStyle)0, MutedInk); AnchorRect(((Graphic)sourceLocationText).rectTransform, new Vector2(0.2f, 0.08f), new Vector2(0.94f, 0.34f), 0f, 0f, 0f, 0f); } private void BuildActions(Transform parent) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) GameObject val = CreateButton("PrimaryAction", "ASSIGN SOURCE", parent, Orange); RectTransform component = val.GetComponent(); component.anchorMin = new Vector2(0.025f, 0.055f); component.anchorMax = new Vector2(0.69f, 0.19f); Stretch(component, 0f, 0f, 0f, 0f); actionLabel = val.GetComponentInChildren(); actionButton = val.GetComponent