using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.RegularExpressions; using AllYourClientsWillOrder; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.Product; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.UI.Handover; using Il2CppScheduleOne.UI.Phone; using Il2CppSystem.Collections.Generic; using MelonLoader; using MelonLoader.Utils; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(AllYourClientsWillOrderMod), "All Your Clients Will Order", "1.54.0", "ionutbuzz", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("AllYourClientsWillOrder")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AllYourClientsWillOrder")] [assembly: AssemblyTitle("AllYourClientsWillOrder")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace AllYourClientsWillOrder; public class AllYourClientsWillOrderMod : MelonMod { private KeyCode forceOrderKey = (KeyCode)112; private KeyCode autoTransferKey = (KeyCode)114; private bool showHUD; private Rect hudWindowRect = new Rect(100f, 100f, 320f, 400f); private bool isDragging; private Vector2 dragOffset; private Rect infoHudRect = new Rect(20f, 200f, 280f, 150f); private bool infoHudDragging; private Vector2 infoHudDragOffset; private bool showProductCounter = true; private bool showClock; private bool showDealCounter; private string configPath; private bool capturingForceOrderKey; private bool capturingAutoTransferKey; private GUIStyle infoBoxStyle; private GUIStyle infoHudStyle; private GUIStyle infoHudTitleStyle; private GUIStyle infoHudContentStyle; private GUIStyle clockStyle; private GUIStyle productStyle; private GUIStyle dealCounterStyle; private GUIStyle notificationStyle; private bool stylesInitialized; private GUIStyle hudV2HeaderStyle; private Texture2D hudV2BgTex; private Texture2D hudV2HeaderTex; private Texture2D hudV2SeparatorTex; private Texture2D hudV2SectionBgTex; private Texture2D hudV2AccentTex; private Dictionary cachedProductRequirements = new Dictionary(); private float lastRequirementsUpdate; private const float REQUIREMENTS_UPDATE_INTERVAL = 0.5f; private int cachedActiveDealCount; private string notificationMessage = ""; private float notificationEndTime; private Color notificationColor = Color.white; private const float NOTIFICATION_DURATION = 3f; private bool isAutoTransferRunning; private bool phoneAppInjected; private GameObject phoneAppButton; private Sprite modAppIconSprite; private TimeManager cachedTimeManager; private bool timeManagerSearched; private bool timeValuesLogged; public override void OnInitializeMelon() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) configPath = Path.Combine(MelonEnvironment.UserDataDirectory, "AllYourClientsWillOrder.json"); MigrateOldConfig(); LoadConfig(); MelonLogger.Msg("All Your Clients Will Order v1.54.0 loaded!"); MelonLogger.Msg($"Force Order Key: {forceOrderKey}, Auto Transfer Key: {autoTransferKey}"); MelonLogger.Msg("Open settings via the phone app (AYCWO icon on home screen)"); } public override void OnUpdate() { //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0167: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (capturingForceOrderKey || capturingAutoTransferKey) { foreach (KeyCode value in Enum.GetValues(typeof(KeyCode))) { if ((int)value != 0 && (int)value != 323 && (int)value != 324 && (int)value != 325 && Input.GetKeyDown(value)) { if ((int)value == 27) { capturingForceOrderKey = false; capturingAutoTransferKey = false; } else if (capturingForceOrderKey) { forceOrderKey = value; capturingForceOrderKey = false; SaveConfig(); MelonLogger.Msg($"Force Order Key set to: {forceOrderKey}"); } else if (capturingAutoTransferKey) { autoTransferKey = value; capturingAutoTransferKey = false; SaveConfig(); MelonLogger.Msg($"Auto Transfer Key set to: {autoTransferKey}"); } break; } } return; } if (!phoneAppInjected) { TryInjectPhoneApp(); } if (Input.GetKeyDown(forceOrderKey) && !showHUD) { ForceAllPlayerClientsToOrder(); } if (Input.GetKeyDown(autoTransferKey) && !showHUD) { TryAutoTransfer(); } } private Sprite CreateModIconSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_0412: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) //IL_04a9: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03a7: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)modAppIconSprite != (Object)null) { return modAppIconSprite; } int num = 128; Texture2D val = new Texture2D(num, num, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[num * num]; Color val2 = default(Color); ((Color)(ref val2))..ctor(0.85f, 0.1f, 0.45f, 1f); Color val3 = default(Color); ((Color)(ref val3))..ctor(0.55f, 0.05f, 0.3f, 1f); Color val4 = default(Color); ((Color)(ref val4))..ctor(1f, 1f, 1f, 1f); Color val5 = default(Color); ((Color)(ref val5))..ctor(0.3f, 0.02f, 0.15f, 1f); float num2 = 20f; for (int i = 0; i < num; i++) { for (int j = 0; j < num; j++) { float num3 = 0f; float num4 = 0f; if ((float)j < num2 && (float)i < num2) { num3 = num2 - (float)j; num4 = num2 - (float)i; } else if ((float)j > (float)num - num2 && (float)i < num2) { num3 = (float)j - ((float)num - num2); num4 = num2 - (float)i; } else if ((float)j < num2 && (float)i > (float)num - num2) { num3 = num2 - (float)j; num4 = (float)i - ((float)num - num2); } else if ((float)j > (float)num - num2 && (float)i > (float)num - num2) { num3 = (float)j - ((float)num - num2); num4 = (float)i - ((float)num - num2); } if (Mathf.Sqrt(num3 * num3 + num4 * num4) > num2) { array[i * num + j] = Color.clear; continue; } float num5 = (float)j / (float)num - 0.5f; float num6 = (float)i / (float)num - 0.5f; float num7 = Mathf.Sqrt(num5 * num5 + num6 * num6) * 2f; array[i * num + j] = Color.Lerp(val2, val3, num7); } } float num8 = (float)num / 2f; float num9 = (float)num / 2f; for (int k = 0; k < num; k++) { for (int l = 0; l < num; l++) { if (array[k * num + l].a < 0.1f) { continue; } float num10 = (float)l - num8; float num11 = (float)k - num9; bool flag = false; float num12 = -18f; float num13 = 28f; if (num10 >= num12 && num10 <= num13) { float num14 = (num10 - num12) / (num13 - num12); float num15 = 6f + num14 * 22f; if (num11 >= 0f - num15 && num11 <= num15) { flag = true; } } if (num10 >= -30f && num10 <= -16f && num11 >= -6f && num11 <= 6f) { flag = true; } float num16 = num10 + 30f; float num17 = num11; if (Mathf.Sqrt(num16 * num16 + num17 * num17) <= 8f) { flag = true; } float num18 = 30f; float num19 = num10 - num18; float num20 = Mathf.Sqrt(num19 * num19 + num11 * num11); if (num20 >= 8f && num20 <= 12f && num19 > 0f && Mathf.Abs(num11) < num20 * 0.85f) { flag = true; } if (num20 >= 17f && num20 <= 20f && num19 > 0f && Mathf.Abs(num11) < num20 * 0.75f) { flag = true; } if (!flag) { continue; } int num21 = k - 2; int num22 = l + 2; if (num21 >= 0 && num21 < num && num22 >= 0 && num22 < num) { int num23 = num21 * num + num22; if (array[num23].a > 0.1f && array[num23] != val4) { array[num23] = Color.Lerp(array[num23], val5, 0.4f); } } array[k * num + l] = val4; } } val.SetPixels(Il2CppStructArray.op_Implicit(array)); val.Apply(true, false); Object.DontDestroyOnLoad((Object)(object)val); modAppIconSprite = Sprite.Create(val, new Rect(0f, 0f, (float)num, (float)num), new Vector2(0.5f, 0.5f), 100f); Object.DontDestroyOnLoad((Object)(object)modAppIconSprite); MelonLogger.Msg($"[PhoneApp] Created icon sprite: {((Object)modAppIconSprite).name}, texture: {((Texture)val).width}x{((Texture)val).height}, format: {val.format}"); return modAppIconSprite; } private void TryInjectPhoneApp() { //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) try { HomeScreen instance = PlayerSingleton.Instance; if ((Object)(object)instance == (Object)null) { return; } RectTransform appIconContainer = instance.appIconContainer; GameObject appIconPrefab = instance.appIconPrefab; if ((Object)(object)appIconContainer == (Object)null || (Object)(object)appIconPrefab == (Object)null) { return; } MelonLogger.Msg("[PhoneApp] HomeScreen found! Injecting mod app icon..."); phoneAppButton = Object.Instantiate(appIconPrefab, (Transform)(object)appIconContainer); ((Object)phoneAppButton).name = "AYCWO_ModApp"; phoneAppButton.SetActive(true); Sprite sprite = CreateModIconSprite(); Il2CppArrayBase componentsInChildren = phoneAppButton.GetComponentsInChildren(true); if (componentsInChildren != null) { foreach (Image item in componentsInChildren) { if ((Object)(object)item != (Object)null) { MelonLogger.Msg($"[PhoneApp] Found Image child: '{((Object)((Component)item).gameObject).name}' (isRoot={(Object)(object)((Component)item).gameObject == (Object)(object)phoneAppButton})"); } } } bool flag = false; string[] array = new string[6] { "Icon", "icon", "Image", "image", "AppIcon", "appicon" }; if (componentsInChildren != null) { string[] array2 = array; foreach (string value in array2) { foreach (Image item2 in componentsInChildren) { if ((Object)(object)item2 != (Object)null && (Object)(object)((Component)item2).gameObject != (Object)(object)phoneAppButton && ((Object)((Component)item2).gameObject).name.Equals(value, StringComparison.OrdinalIgnoreCase)) { item2.sprite = sprite; ((Graphic)item2).color = Color.white; item2.preserveAspect = true; flag = true; MelonLogger.Msg("[PhoneApp] ✅ Set icon sprite on preferred child: '" + ((Object)((Component)item2).gameObject).name + "'"); break; } } if (flag) { break; } } if (!flag) { foreach (Image item3 in componentsInChildren) { if ((Object)(object)item3 != (Object)null && (Object)(object)((Component)item3).gameObject != (Object)(object)phoneAppButton && !((Object)((Component)item3).gameObject).name.Equals("Outline", StringComparison.OrdinalIgnoreCase)) { item3.sprite = sprite; ((Graphic)item3).color = Color.white; item3.preserveAspect = true; flag = true; MelonLogger.Msg("[PhoneApp] Set icon sprite on fallback child: '" + ((Object)((Component)item3).gameObject).name + "'"); break; } } } if (!flag) { foreach (Image item4 in componentsInChildren) { if ((Object)(object)item4 != (Object)null) { item4.sprite = sprite; ((Graphic)item4).color = Color.white; item4.preserveAspect = true; MelonLogger.Msg("[PhoneApp] Set icon sprite on (last resort): '" + ((Object)((Component)item4).gameObject).name + "'"); } } } } bool flag2 = false; try { Il2CppArrayBase componentsInChildren2 = phoneAppButton.GetComponentsInChildren(true); if (componentsInChildren2 != null) { foreach (Component item5 in componentsInChildren2) { if (!((Object)(object)item5 != (Object)null) || !((object)item5).GetType().Name.Contains("TMP_Text")) { continue; } try { PropertyInfo property = ((object)item5).GetType().GetProperty("text"); if (property != null) { property.SetValue(item5, "AYCWO"); flag2 = true; MelonLogger.Msg("[PhoneApp] Set TMPro label: AYCWO on '" + ((Object)item5.gameObject).name + "'"); } } catch { } } } } catch { } if (!flag2) { Il2CppArrayBase componentsInChildren3 = phoneAppButton.GetComponentsInChildren(true); if (componentsInChildren3 != null) { foreach (Text item6 in componentsInChildren3) { if ((Object)(object)item6 != (Object)null) { item6.text = "AYCWO"; item6.fontSize = Mathf.Min(item6.fontSize, 14); MelonLogger.Msg("[PhoneApp] Set legacy Text label: AYCWO"); } } } } Button component = phoneAppButton.GetComponent