Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of MoreRealisticLaundering v1.2.5
mods/MoreRealisticLaundering.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using HarmonyLib; using Il2CppFluffyUnderware.DevTools.Extensions; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.Dialogue; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.Property; using Il2CppScheduleOne.Tools; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.Vehicles; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using MelonLoader; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using MoreRealisticLaundering; using MoreRealisticLaundering.Config; using MoreRealisticLaundering.PhoneApp; using MoreRealisticLaundering.Util; using Newtonsoft.Json; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(MRLCore), "MoreRealisticLaundering", "1.2.5", "KampfBallerina", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("MoreRealisticLaundering")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+a4c6a2e189d308f8020cc07aee1cb9714c5dd1a8")] [assembly: AssemblyProduct("MoreRealisticLaundering")] [assembly: AssemblyTitle("MoreRealisticLaundering")] [assembly: NeutralResourcesLanguage("en-US")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 MoreRealisticLaundering { public class MRLCore : MelonMod { private bool isFirstStart = true; private bool isLegitVersion; public readonly HashSet<string> processedBusinesses = new HashSet<string>(); public readonly HashSet<string> createdBusinessesEntries = new HashSet<string>(); public Sprite CreditCardIcon; public ConfigState config; public static LaunderingApp launderingApp = new LaunderingApp(); public Dictionary<string, float> maxiumumLaunderValues; public Dictionary<string, string> aliasMap; public Dictionary<string, string> vehicleAliasMap; public Dictionary<string, string> skateboardAliasMap; private readonly HashSet<string> createdAppEntries = new HashSet<string>(); public bool isWaitAndApplyCapsRunning; private static readonly string ConfigFolder = Path.Combine(MelonEnvironment.UserDataDirectory, "MoreRealisticLaundering"); private readonly HashSet<LaunderingOperation> boostedOperations = new HashSet<LaunderingOperation>(); public DialogueController_SkateboardSeller shackShopDialogueController; public MoneyManager moneyManager; public NotificationsManager notificationsManager; public VehicleManager vehicleManager; public static MRLCore Instance { get; private set; } public override void OnInitializeMelon() { ((MelonBase)this).LoggerInstance.Msg("Initialized."); Instance = this; Instance.maxiumumLaunderValues = new Dictionary<string, float>(); Instance.aliasMap = new Dictionary<string, string> { { "Laundromat", "Laundromat" }, { "Taco Ticklers", "Taco Ticklers" }, { "Car Wash", "Car Wash" }, { "Post Office", "Post Office" }, { "PostOffice", "Post Office" }, { "Motel", "Motel" }, { "MotelRoom", "Motel" }, { "Motel Room", "Motel" }, { "Sweatshop", "Sweatshop" }, { "Bungalow", "Bungalow" }, { "Barn", "Barn" }, { "Docks Warehouse", "Docks Warehouse" }, { "DocksWarehouse", "Docks Warehouse" }, { "Manor", "Manor" }, { "StorageUnit", "Storage Unit" }, { "Storage Unit", "Storage Unit" } }; Instance.vehicleAliasMap = new Dictionary<string, string> { { "Shitbox", "Shitbox" }, { "Shitbox_Police", "Shitbox" }, { "Veeper", "Veeper" }, { "Van", "Veeper" }, { "SUV", "Bruiser" }, { "SUV_Police", "Bruiser" }, { "Bruiser", "Bruiser" }, { "Pickup", "Dinkler" }, { "Pickup_Police", "Dinkler" }, { "Dinkler", "Dinkler" }, { "Hounddog", "Hounddog" }, { "Sedan", "Hounddog" }, { "Cheetah", "Cheetah" }, { "Coupe", "Cheetah" } }; Instance.skateboardAliasMap = new Dictionary<string, string> { { "Cheap Skateboard", "Cheap Skateboard" }, { "CheapSkateboard", "Cheap Skateboard" }, { "Skateboard", "Skateboard" }, { "SkateBoard", "Skateboard" }, { "Cruiser", "Cruiser" }, { "Cruiser_Skateboard", "Cruiser" }, { "Lightweight Board", "Lightweight Board" }, { "LightweightBoard", "Lightweight Board" }, { "Lightweight Skateboard", "Lightweight Board" }, { "LightweightSkateboard", "Lightweight Board" }, { "Golden Skateboard", "Golden Skateboard" }, { "GoldenSkateboard", "Golden Skateboard" } }; } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { if (sceneName == "Main") { Instance.config = ConfigManager.Load(); if (Instance.config.Use_Legit_Version) { ((MelonBase)this).LoggerInstance.Msg("Use_Legit_Version is enabled. Adjusting behavior accordingly."); isLegitVersion = true; } else { ((MelonBase)this).LoggerInstance.Msg("Use_Legit_Version is disabled. Proceeding with default behavior."); } Instance.FillCapDictionary(); Instance.InitializeListeners(); Instance.moneyManager = Object.FindObjectOfType<MoneyManager>(); Instance.notificationsManager = Object.FindObjectOfType<NotificationsManager>(); Instance.vehicleManager = Object.FindObjectOfType<VehicleManager>(); MelonCoroutines.Start(StartCoroutinesAfterDelay()); isFirstStart = false; } else if (sceneName.Equals("Menu", StringComparison.OrdinalIgnoreCase) && !isFirstStart) { ResetAllVariables(); isFirstStart = false; } } private void InitializeListeners() { try { Business.onOperationStarted = Action<LaunderingOperation>.op_Implicit((Action<LaunderingOperation>)OnLaunderingStarted); Business.onOperationFinished = Action<LaunderingOperation>.op_Implicit((Action<LaunderingOperation>)OnLaunderingFinished); } catch (Exception ex) { MelonLogger.Error("Failed to register laundering listeners: " + ex.Message); } } public IEnumerator StartCoroutinesAfterDelay() { bool delayedInit = false; while (!delayedInit && !isLegitVersion) { delayedInit = true; yield return (object)new WaitForSeconds(5f); } MelonCoroutines.Start(Instance.WaitAndApplyCaps()); if (!isLegitVersion) { MelonCoroutines.Start(launderingApp.InitializeLaunderApp()); } MelonCoroutines.Start(Instance.ApplyPropertyConfig()); } private void ResetAllVariables() { ((MelonBase)this).LoggerInstance.Msg("Resetting all variables to default values.."); Instance.config = null; isLegitVersion = false; Instance.maxiumumLaunderValues.Clear(); Instance.createdAppEntries.Clear(); Instance.processedBusinesses.Clear(); Instance.createdBusinessesEntries.Clear(); Instance.boostedOperations.Clear(); Instance.moneyManager = null; Instance.notificationsManager = null; if (launderingApp != null) { launderingApp._isLaunderingAppLoaded = false; launderingApp.launderingAppViewportContentTransform = null; launderingApp.DansHardwareTemplate = null; launderingApp.GasMartWestTemplate = null; launderingApp.viewPortContentSpaceTemplate = null; } Instance.CreditCardIcon = null; Business.onOperationStarted = null; Business.onOperationFinished = null; } public void ChangeAppIconImage(GameObject appIcon, string ImagePath) { //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) if (ImagePath == null) { MelonLogger.Msg("ImagePath is null, skipping image change."); return; } Transform val = appIcon.transform.Find("Mask/Image"); GameObject val2 = (((Object)(object)val != (Object)null) ? ((Component)val).gameObject : null); if ((Object)(object)val2 == (Object)null) { return; } Image component = val2.GetComponent<Image>(); if (!((Object)(object)component == (Object)null)) { Texture2D val3 = Utils.LoadCustomImage(ImagePath); if (!((Object)(object)val3 == (Object)null)) { Sprite sprite = Sprite.Create(val3, new Rect(0f, 0f, (float)((Texture)val3).width, (float)((Texture)val3).height), new Vector2(0.5f, 0.5f)); component.sprite = sprite; } else { ((MelonBase)this).LoggerInstance.Msg("Custom image failed to load"); } } } public void RegisterApp(GameObject App, string Title = "Unknown App") { GameObject val = GameObject.Find("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/HomeScreen/AppIcons"); App.transform.SetParent(val.transform, false); ((MelonBase)this).LoggerInstance.Msg("Added " + Title + " to Homescreen."); } public IEnumerator ApplyPropertyConfig() { MelonLogger.Msg("Found unowned businesses. Processing..."); if (!isLegitVersion) { while (!launderingApp._isLaunderingAppLoaded) { yield return (object)new WaitForSeconds(1f); } string imagePath = Path.Combine(ConfigFolder, "Jeff.png"); launderingApp.AddEntryFromTemplate("Shred Shack", "Shred Shack", "We're all about the grind, bro — street and money.", null, launderingApp.DansHardwareTemplate, Color32.op_Implicit(ColorUtil.GetColor("Redpurple")), imagePath, null, isFirstEntry: true); imagePath = Path.Combine(ConfigFolder, "HylandAuto.png"); launderingApp.AddEntryFromTemplate("Hyland Auto", "Hyland Auto", "We make you drive crazy.", null, launderingApp.DansHardwareTemplate, Color32.op_Implicit(ColorUtil.GetColor("Dark Green")), imagePath, null, isFirstEntry: true); imagePath = Path.Combine(ConfigFolder, "RaysRealEstate.png"); launderingApp.AddEntryFromTemplate("Rays Real Estate", "Ray's Real Estate", "No credit check. No judgment. Just opportunity.", null, launderingApp.DansHardwareTemplate, Color32.op_Implicit(ColorUtil.GetColor("Light Purple")), imagePath, null, isFirstEntry: true); } ApplyPricesToProperties(); ApplyPricesToPropertyListings(); ApplyPricesToVehicles(); ApplyPricesToSkateboards(); } public void FillCapDictionary() { Instance.maxiumumLaunderValues.Clear(); Instance.maxiumumLaunderValues["Laundromat"] = Instance.config.Businesses.Laundromat.Laundromat_Cap; Instance.maxiumumLaunderValues["Taco Ticklers"] = Instance.config.Businesses.TacoTicklers.Taco_Ticklers_Cap; Instance.maxiumumLaunderValues["Car Wash"] = Instance.config.Businesses.CarWash.Car_Wash_Cap; Instance.maxiumumLaunderValues["PostOffice"] = Instance.config.Businesses.PostOffice.Post_Office_Cap; Instance.maxiumumLaunderValues["Post Office"] = Instance.config.Businesses.PostOffice.Post_Office_Cap; } public IEnumerator WaitAndApplyCaps() { while (true) { if (Business.OwnedBusinesses != null) { Enumerator<Business> enumerator = Business.OwnedBusinesses.GetEnumerator(); while (enumerator.MoveNext()) { Business current = enumerator.Current; if (Business.OwnedBusinesses.Count > 0) { if ((Object)(object)current == (Object)null) { MelonLogger.Warning("Encountered a null business in OwnedBusinesses. Skipping..."); continue; } if (!processedBusinesses.Contains(((Object)current).name)) { if (Instance.config != null) { Instance.ApplyCap(current); processedBusinesses.Add(((Object)current).name); if (!createdBusinessesEntries.Contains(((Object)current).name)) { createdBusinessesEntries.Add(((Object)current).name); Instance.CreateAppEntryForBusiness(current); } } else { MelonLogger.Warning("Config is not loaded yet. Skipping ApplyCap for business: " + ((Object)current).name); } } if (processedBusinesses.Count >= 4) { isWaitAndApplyCapsRunning = false; yield break; } } else { MelonLogger.Warning("Didn't found OwnedBusinesses yet. Retrying..."); } } } else { MelonLogger.Warning("OwnedBusinesses is null. Retrying..."); } yield return (object)new WaitForSeconds(3f); } } public void ApplyCap(Business business) { if (Instance.aliasMap.TryGetValue(((Object)business).name, out var value) && Instance.maxiumumLaunderValues.TryGetValue(value, out var value2)) { business.LaunderCapacity = value2; } } public void CreateAppEntryForBusiness(Business business) { //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: 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_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) if (isLegitVersion) { return; } if (createdAppEntries.Contains(((Object)business).name)) { MelonLogger.Warning("App entry for business '" + ((Object)business).name + "' already exists. Skipping creation."); } else if (!launderingApp._isLaunderingAppLoaded) { MelonCoroutines.Start(WaitForLaunderingAppAndCreateEntry(business)); } else if ((Object)(object)launderingApp.DansHardwareTemplate != (Object)null) { GameObject val = (GameObject)(((Object)business).name switch { "Laundromat" => launderingApp.DansHardwareTemplate, "Taco Ticklers" => launderingApp.DansHardwareTemplate, "Car Wash" => launderingApp.DansHardwareTemplate, "PostOffice" => launderingApp.DansHardwareTemplate, _ => null, }); if ((Object)(object)val != (Object)null) { string text = ((((Object)business).name == "PostOffice") ? "Post Office" : ((Object)business).name); Color newBackgroundColor; string imagePath; string newSubtitle; switch (((Object)business).name) { case "Laundromat": newBackgroundColor = Color32.op_Implicit(ColorUtil.GetColor("Yellow")); imagePath = Path.Combine(ConfigFolder, "Laundromat.png"); newSubtitle = "Efficient, subtle, and always turning dirty into clean."; break; case "Taco Ticklers": newBackgroundColor = Color32.op_Implicit(ColorUtil.GetColor("Orange")); imagePath = Path.Combine(ConfigFolder, "TacoTickler.png"); newSubtitle = "We wrap more than burritos."; break; case "Car Wash": newBackgroundColor = Color32.op_Implicit(ColorUtil.GetColor("Dark Blue")); imagePath = Path.Combine(ConfigFolder, "CarWash.png"); newSubtitle = "From powder to polish – all clean."; break; case "PostOffice": newBackgroundColor = Color32.op_Implicit(ColorUtil.GetColor("Light Blue")); imagePath = Path.Combine(ConfigFolder, "PostOffice.png"); newSubtitle = "Dead drops, fake names but real profits."; break; default: newBackgroundColor = default(Color); imagePath = ""; newSubtitle = "Just a regular business. Nothing to see here."; break; } launderingApp.AddEntryFromTemplate(text, text, newSubtitle, business, val, newBackgroundColor, imagePath); MelonLogger.Msg("Created app entry for business: " + ((Object)business).name); createdAppEntries.Add(((Object)business).name); } else { MelonLogger.Warning("No template found for business: " + ((Object)business).name); } } else { MelonLogger.Error("Templates are not initialized. Cannot create app entries."); } } private IEnumerator WaitForLaunderingAppAndCreateEntry(Business business) { while (!launderingApp._isLaunderingAppLoaded) { yield return (object)new WaitForSeconds(2f); } CreateAppEntryForBusiness(business); } public void AdjustLaunderingTime(LaunderingOperation operation) { if (operation != null && !Instance.boostedOperations.Contains(operation) && Instance.aliasMap.TryGetValue(((Object)operation.business).name, out var value)) { operation.completionTime_Minutes = value switch { "Laundromat" => Instance.config.Businesses.Laundromat.Laundromat_Laundering_time_hours, "Taco Ticklers" => Instance.config.Businesses.TacoTicklers.Taco_Ticklers_Laundering_time_hours, "Car Wash" => Instance.config.Businesses.CarWash.Car_Wash_Laundering_time_hours, "PostOffice" => Instance.config.Businesses.PostOffice.Post_Office_Laundering_time_hours, "Post Office" => Instance.config.Businesses.PostOffice.Post_Office_Laundering_time_hours, _ => 24, } * 60; if (!(((Object)operation.business).name == "PostOffice")) { _ = ((Object)operation.business).name; } Instance.boostedOperations.Add(operation); } } private void OnLaunderingStarted(LaunderingOperation operation) { try { if (operation != null && (Object)(object)operation.business != (Object)null && !(((Object)operation.business).name == "PostOffice")) { _ = ((Object)operation.business).name; } } catch (Exception ex) { MelonLogger.Error("Error in OnLaunderingStarted: " + ex.Message); } } private void OnLaunderingFinished(LaunderingOperation operation) { try { if (operation != null && (Object)(object)operation.business != (Object)null) { if (!(((Object)operation.business).name == "PostOffice")) { _ = ((Object)operation.business).name; } float num = CalculateTaxes(operation); if (num > 0f) { RemoveTaxesFromBankBalance(num, ((Object)operation.business).name); } } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("Error in OnLaunderingFinished: " + ex.Message); } } private void RemoveTaxesFromBankBalance(float amount, string businessName) { try { if ((Object)(object)moneyManager != (Object)null) { string text = "Tax for " + businessName; moneyManager.CreateOnlineTransaction(text, 0f - amount, 1f, text); if ((Object)(object)notificationsManager != (Object)null) { string text2 = $"<color=#E60000>${amount:N0}</color> Lost in Taxes"; string text3 = businessName ?? ""; Sprite creditCardIcon = GetCreditCardIcon(); notificationsManager.SendNotification(text3, text2, creditCardIcon, 5f, true); } } } catch (Exception ex) { ((MelonBase)this).LoggerInstance.Error("An error occurred while deducting bank money: " + ex.Message); } } public float CalculateTaxes(LaunderingOperation operation) { if (Instance.aliasMap.TryGetValue(((Object)operation.business).name, out var value)) { float num = value switch { "Laundromat" => Instance.config.Businesses.Laundromat.Laundromat_Tax_Percentage / 100f, "Taco Ticklers" => Instance.config.Businesses.TacoTicklers.Taco_Ticklers_Tax_Percentage / 100f, "Car Wash" => Instance.config.Businesses.CarWash.Car_Wash_Tax_Percentage / 100f, "PostOffice" => Instance.config.Businesses.PostOffice.Post_Office_Tax_Percentage / 100f, "Post Office" => Instance.config.Businesses.PostOffice.Post_Office_Tax_Percentage / 100f, _ => 0.19f, }; float amount = operation.amount; float num2 = Mathf.RoundToInt(amount * num); float amount2 = amount - num2; if (!(((Object)operation.business).name == "PostOffice")) { _ = ((Object)operation.business).name; } operation.amount = amount2; return num2; } return 0f; } private Sprite GetCreditCardIcon() { if ((Object)(object)Instance.CreditCardIcon != (Object)null) { return Instance.CreditCardIcon; } GameObject val = GameObject.Find("UI/HUD/HotbarContainer/Slots/CashSlotContainer/OnlineSlot/ItemUI_Cash/Icon"); if ((Object)(object)val != (Object)null) { Image component = val.GetComponent<Image>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sprite != (Object)null && ((Object)component.sprite).name == "CreditCard") { Instance.CreditCardIcon = component.sprite; return component.sprite; } } ((MelonBase)this).LoggerInstance.Error("Failed to find the CreditCard icon."); return null; } public void ApplyPricesToProperties() { if (Business.UnownedBusinesses != null) { Enumerator<Business> enumerator = Business.UnownedBusinesses.GetEnumerator(); while (enumerator.MoveNext()) { Business current = enumerator.Current; string value; if ((Object)(object)current == (Object)null) { MelonLogger.Warning("Encountered a null business in UnownedBusinesses. Skipping..."); } else if (Instance.aliasMap.TryGetValue(((Object)current).name, out value)) { ((Property)current).Price = value switch { "Laundromat" => Instance.config.Properties.BusinessProperties.Laundromat_Price, "Taco Ticklers" => Instance.config.Properties.BusinessProperties.Taco_Ticklers_Price, "Car Wash" => Instance.config.Properties.BusinessProperties.Car_Wash_Price, "PostOffice" => Instance.config.Properties.BusinessProperties.Post_Office_Price, "Post Office" => Instance.config.Properties.BusinessProperties.Post_Office_Price, _ => 1000f, }; } else { MelonLogger.Warning("Business '" + ((Object)current).name + "' not found in aliasMap. Skipping price assignment."); } } } else { MelonLogger.Warning("UnownedBusinesses is null. Cannot apply prices."); } ApplyPricesForHomeProperties(); } public void ApplyPricesForHomeProperties() { if (Property.UnownedProperties != null) { Enumerator<Property> enumerator = Property.UnownedProperties.GetEnumerator(); while (enumerator.MoveNext()) { Property current = enumerator.Current; string value; if ((Object)(object)current == (Object)null) { MelonLogger.Warning("Encountered a null property in UnownedProperties. Skipping..."); } else if (Instance.aliasMap.TryGetValue(((Object)current).name, out value)) { current.Price = value switch { "Motel Room" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "Motel" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "MotelRoom" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "Sweatshop" => Instance.config.Properties.PrivateProperties.Sweatshop_Price, "Bungalow" => Instance.config.Properties.PrivateProperties.Bungalow_Price, "Barn" => Instance.config.Properties.PrivateProperties.Barn_Price, "Docks Warehouse" => Instance.config.Properties.PrivateProperties.Docks_Warehouse_Price, "Manor" => Instance.config.Properties.PrivateProperties.Manor_Price, "Storage Unit" => Instance.config.Properties.PrivateProperties.Storage_Unit_Price, _ => 1000f, }; } else { MelonLogger.Warning("Property '" + ((Object)current).name + "' / '" + current.propertyName + "' not found in aliasMap. Skipping price assignment."); } } if (Property.OwnedProperties != null) { enumerator = Property.OwnedProperties.GetEnumerator(); while (enumerator.MoveNext()) { Property current2 = enumerator.Current; string value2; if ((Object)(object)current2 == (Object)null) { MelonLogger.Warning("Encountered a null property in OwnedProperties. Skipping..."); } else if (Instance.aliasMap.TryGetValue(((Object)current2).name, out value2)) { current2.Price = value2 switch { "Motel Room" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "Motel" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "MotelRoom" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "Sweatshop" => Instance.config.Properties.PrivateProperties.Sweatshop_Price, "Bungalow" => Instance.config.Properties.PrivateProperties.Bungalow_Price, "Barn" => Instance.config.Properties.PrivateProperties.Barn_Price, "Docks Warehouse" => Instance.config.Properties.PrivateProperties.Docks_Warehouse_Price, "Manor" => Instance.config.Properties.PrivateProperties.Manor_Price, "Storage Unit" => Instance.config.Properties.PrivateProperties.Storage_Unit_Price, _ => 1000f, }; } else if (!(((Object)current2).name == "RV")) { MelonLogger.Warning("Property '" + ((Object)current2).name + "' not found in aliasMap. Skipping price assignment."); } } } DialogueController_Ming[] array = Il2CppArrayBase<DialogueController_Ming>.op_Implicit(Object.FindObjectsOfType<DialogueController_Ming>()); foreach (DialogueController_Ming val in array) { Transform parent = ((Component)val).gameObject.transform.parent; string text = ((parent != null) ? ((Object)parent).name : null); if (text != null) { val.Price = ConfigManager.GetPropertyPrice(Instance.config, text); } } } else { MelonLogger.Warning("UnownedProperties is null. Cannot apply prices."); } } public void ApplyPricesToPropertyListings() { GameObject val = GameObject.Find("Map/Container/RE Office/Interior/Whiteboard (1)"); if ((Object)(object)val == (Object)null) { MelonLogger.Warning("RE Office not found. Cannot apply prices to PropertyListings."); return; } Transform[] array = (Transform[])(object)new Transform[4] { val.transform.Find("PropertyListing Laundromat"), val.transform.Find("PropertyListing Taco Ticklers"), val.transform.Find("PropertyListing Car Wash"), val.transform.Find("PropertyListing Post Office") }; foreach (Transform val2 in array) { if ((Object)(object)val2 == (Object)null) { MelonLogger.Warning("A PropertyListing was not found. Skipping..."); continue; } string text = ((Object)val2).name.Replace("PropertyListing ", "").Trim(); if (Instance.aliasMap.TryGetValue(text, out var value)) { float num = value switch { "Laundromat" => Instance.config.Properties.BusinessProperties.Laundromat_Price, "Taco Ticklers" => Instance.config.Properties.BusinessProperties.Taco_Ticklers_Price, "Car Wash" => Instance.config.Properties.BusinessProperties.Car_Wash_Price, "Post Office" => Instance.config.Properties.BusinessProperties.Post_Office_Price, "PostOffice" => Instance.config.Properties.BusinessProperties.Post_Office_Price, _ => 1000f, }; Transform val3 = val2.Find("Price"); if ((Object)(object)val3 != (Object)null) { TextMeshPro component = ((Component)val3).GetComponent<TextMeshPro>(); if ((Object)(object)component != (Object)null) { ((TMP_Text)component).text = $"${num}"; } else { MelonLogger.Warning("Price TextMeshPro component not found for " + text + "."); } } else { MelonLogger.Warning("Price object not found for " + text + "."); } } else { MelonLogger.Warning("Business '" + text + "' not found in aliasMap. Skipping price assignment."); } } GameObject val4 = GameObject.Find("Map/Container/RE Office/Interior/Whiteboard"); if ((Object)(object)val4 == (Object)null) { MelonLogger.Warning("RE Office not found. Cannot apply prices to PropertyListings."); return; } array = (Transform[])(object)new Transform[7] { val4.transform.Find("PropertyListing Motel Room"), val4.transform.Find("PropertyListing Sweatshop"), val4.transform.Find("PropertyListing Bungalow"), val4.transform.Find("PropertyListing Barn"), val4.transform.Find("PropertyListing Docks Warehouse"), val4.transform.Find("PropertyListing Manor"), val4.transform.Find("PropertyListing Storage Unit") }; foreach (Transform val5 in array) { if ((Object)(object)val5 == (Object)null) { continue; } string text2 = ((Object)val5).name.Replace("PropertyListing ", "").Trim(); if (Instance.aliasMap.TryGetValue(text2, out var value2)) { float num2 = value2 switch { "Motel Room" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "Sweatshop" => Instance.config.Properties.PrivateProperties.Sweatshop_Price, "Bungalow" => Instance.config.Properties.PrivateProperties.Bungalow_Price, "Barn" => Instance.config.Properties.PrivateProperties.Barn_Price, "Docks Warehouse" => Instance.config.Properties.PrivateProperties.Docks_Warehouse_Price, "Manor" => Instance.config.Properties.PrivateProperties.Manor_Price, "Storage Unit" => Instance.config.Properties.PrivateProperties.Storage_Unit_Price, _ => 1000f, }; Transform val6 = val5.Find("Price"); if ((Object)(object)val6 != (Object)null) { TextMeshPro component2 = ((Component)val6).GetComponent<TextMeshPro>(); if ((Object)(object)component2 != (Object)null) { ((TMP_Text)component2).text = $"${num2}"; } else { MelonLogger.Warning("Price TextMeshPro component not found for " + text2 + "."); } } else { MelonLogger.Warning("Price object not found for " + text2 + "."); } } else { MelonLogger.Warning("Property '" + text2 + "' not found in aliasMap. Skipping price assignment."); } } UpdateSellSignPrices(); } private void UpdateSellSignPrices() { GameObject sellSign = GameObject.Find("@Businesses/PostOffice/ForSaleSign_Blue (1)"); GameObject sellSign2 = GameObject.Find("@Businesses/Car Wash/ForSaleSign_Blue"); GameObject sellSign3 = GameObject.Find("@Businesses/Laundromat/ForSaleSign_Blue (1)"); GameObject sellSign4 = GameObject.Find("@Businesses/Taco Ticklers/ForSaleSign_Blue (1)"); GameObject sellSign5 = GameObject.Find("@Properties/MotelRoom/ForSaleSign"); GameObject sellSign6 = GameObject.Find("@Properties/Sweatshop/ForSaleSign"); GameObject sellSign7 = GameObject.Find("@Properties/Bungalow/ForSaleSign"); GameObject sellSign8 = GameObject.Find("@Properties/Barn/ForSaleSign"); GameObject sellSign9 = GameObject.Find("@Properties/DocksWarehouse/ForSaleSign"); GameObject sellSign10 = GameObject.Find("@Properties/Manor/ForSaleSign (1)"); GameObject sellSign11 = GameObject.Find("@Properties/StorageUnit/ForSaleSign"); UpdateSignPrice(sellSign, "Post Office"); UpdateSignPrice(sellSign2, "Car Wash"); UpdateSignPrice(sellSign3, "Laundromat"); UpdateSignPrice(sellSign4, "Taco Ticklers"); UpdateSignPrice(sellSign5, "Motel Room"); UpdateSignPrice(sellSign6, "Sweatshop"); UpdateSignPrice(sellSign7, "Bungalow"); UpdateSignPrice(sellSign8, "Barn"); UpdateSignPrice(sellSign9, "Docks Warehouse"); UpdateSignPrice(sellSign10, "Manor"); UpdateSignPrice(sellSign11, "Storage Unit"); } public void ApplyPricesToVehicles() { if ((Object)(object)vehicleManager == (Object)null) { MelonLogger.Warning("VehicleManager not found. Attempting to find it again..."); Instance.vehicleManager = Object.FindObjectOfType<VehicleManager>(); if ((Object)(object)vehicleManager == (Object)null) { MelonLogger.Warning("VehicleManager still not found. Cannot apply prices to vehicles (most likely because of Multiplayer)."); } } if ((Object)(object)vehicleManager != (Object)null) { Enumerator<LandVehicle> enumerator = vehicleManager.VehiclePrefabs.GetEnumerator(); while (enumerator.MoveNext()) { LandVehicle current = enumerator.Current; string value; if ((Object)(object)current == (Object)null) { MelonLogger.Warning("Encountered a null vehicle. Skipping..."); } else if (Instance.vehicleAliasMap.TryGetValue(((Object)current).name, out value)) { current.vehiclePrice = value switch { "Shitbox" => Instance.config.Vehicles.Shitbox_Price, "Veeper" => Instance.config.Vehicles.Veeper_Price, "Bruiser" => Instance.config.Vehicles.Bruiser_Price, "Dinkler" => Instance.config.Vehicles.Dinkler_Price, "Hounddog" => Instance.config.Vehicles.Hounddog_Price, "Cheetah" => Instance.config.Vehicles.Cheetah_Price, _ => 1000f, }; } else { MelonLogger.Warning("Vehicle '" + ((Object)current).name + "' not found in vehicleAliasMap. Skipping price assignment."); } } } UpdateVehicleSignPrices(); } private void UpdateVehicleSignPrices() { if ((Object)(object)Object.FindObjectOfType<VehicleSaleSign>() != (Object)null) { VehicleSaleSign[] array = Il2CppArrayBase<VehicleSaleSign>.op_Implicit(Object.FindObjectsOfType<VehicleSaleSign>()); foreach (VehicleSaleSign obj in array) { TextMeshPro nameLabel = obj.NameLabel; TextMeshPro priceLabel = obj.PriceLabel; if ((Object)(object)nameLabel != (Object)null && (Object)(object)priceLabel != (Object)null) { if (Instance.vehicleAliasMap.TryGetValue(((TMP_Text)nameLabel).text, out var value)) { ((TMP_Text)priceLabel).text = string.Format("${0}", value switch { "Shitbox" => Instance.config.Vehicles.Shitbox_Price, "Veeper" => Instance.config.Vehicles.Veeper_Price, "Bruiser" => Instance.config.Vehicles.Bruiser_Price, "Dinkler" => Instance.config.Vehicles.Dinkler_Price, "Hounddog" => Instance.config.Vehicles.Hounddog_Price, "Cheetah" => Instance.config.Vehicles.Cheetah_Price, _ => 1000f, }); } else { MelonLogger.Warning("Vehicle '" + ((TMP_Text)nameLabel).text + "' not found in vehicleAliasMap. Skipping price update."); } } else { MelonLogger.Warning("NameLabel or PriceLabel not found for a VehicleSaleSign."); } } } else { MelonLogger.Warning("No VehicleSaleSign objects found in the scene."); } } public void ApplyPricesToSkateboards() { DialogueController_SkateboardSeller[] array = Il2CppArrayBase<DialogueController_SkateboardSeller>.op_Implicit(Object.FindObjectsOfType<DialogueController_SkateboardSeller>()); foreach (DialogueController_SkateboardSeller val in array) { Transform parent = ((Component)val).gameObject.transform.parent; string text = ((parent != null) ? ((Object)parent).name : null); if (text == null || !text.Contains("Jeff")) { continue; } shackShopDialogueController = val; Enumerator<Option> enumerator = val.Options.GetEnumerator(); while (enumerator.MoveNext()) { Option current = enumerator.Current; if (Instance.skateboardAliasMap.TryGetValue(current.Name, out var value)) { current.Price = value switch { "Cheap Skateboard" => Instance.config.Skateboards.Cheap_Skateboard_Price, "Skateboard" => Instance.config.Skateboards.Skateboard_Price, "Cruiser" => Instance.config.Skateboards.Cruiser_Price, "Lightweight Board" => Instance.config.Skateboards.Lightweight_Board_Price, "Golden Skateboard" => Instance.config.Skateboards.Golden_Skateboard_Price, _ => 1000f, }; } else { MelonLogger.Warning("Skateboard '" + current.Name + "' not found in skateBoardAliasMap. Skipping price assignment."); } } UpdateSkateboardSign(); } } private void UpdateSkateboardSign() { GameObject sellSign = GameObject.Find("Map/Container/North town/Jeff's Shred Shack/Shred Shack/Catalog/Paper (1)/Text (TMP)"); GameObject sellSign2 = GameObject.Find("Map/Container/North town/Jeff's Shred Shack/Shred Shack/Catalog/Paper (2)/Text (TMP)"); GameObject sellSign3 = GameObject.Find("Map/Container/North town/Jeff's Shred Shack/Shred Shack/Catalog/Paper (3)/Text (TMP)"); GameObject sellSign4 = GameObject.Find("Map/Container/North town/Jeff's Shred Shack/Shred Shack/Catalog/Paper (4)/Text (TMP)"); GameObject sellSign5 = GameObject.Find("Map/Container/North town/Jeff's Shred Shack/Shred Shack/Catalog/Paper (5)/Text (TMP)"); UpdateSignPrice(sellSign, "Cheap Skateboard"); UpdateSignPrice(sellSign2, "Skateboard"); UpdateSignPrice(sellSign3, "Cruiser_Skateboard"); UpdateSignPrice(sellSign4, "Lightweight Board"); UpdateSignPrice(sellSign5, "Golden Skateboard"); } private void UpdateSignPrice(GameObject sellSign, string objectName) { if ((Object)(object)sellSign == (Object)null) { MelonLogger.Warning("Sell sign for " + objectName + " not found. Skipping..."); return; } float num; string value2; if (Instance.aliasMap.TryGetValue(objectName, out var value)) { num = value switch { "Laundromat" => Instance.config.Properties.BusinessProperties.Laundromat_Price, "Taco Ticklers" => Instance.config.Properties.BusinessProperties.Taco_Ticklers_Price, "Car Wash" => Instance.config.Properties.BusinessProperties.Car_Wash_Price, "Post Office" => Instance.config.Properties.BusinessProperties.Post_Office_Price, "PostOffice" => Instance.config.Properties.BusinessProperties.Post_Office_Price, "Motel" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "MotelRoom" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "Motel Room" => Instance.config.Properties.PrivateProperties.Motel_Room_Price, "Sweatshop" => Instance.config.Properties.PrivateProperties.Sweatshop_Price, "Bungalow" => Instance.config.Properties.PrivateProperties.Bungalow_Price, "Barn" => Instance.config.Properties.PrivateProperties.Barn_Price, "Docks Warehouse" => Instance.config.Properties.PrivateProperties.Docks_Warehouse_Price, "Manor" => Instance.config.Properties.PrivateProperties.Manor_Price, "Storage Unit" => Instance.config.Properties.PrivateProperties.Storage_Unit_Price, _ => 1000f, }; } else if (Instance.vehicleAliasMap.TryGetValue(objectName, out value2)) { num = value2 switch { "Shitbox" => Instance.config.Vehicles.Shitbox_Price, "Veeper" => Instance.config.Vehicles.Veeper_Price, "Bruiser" => Instance.config.Vehicles.Bruiser_Price, "Dinkler" => Instance.config.Vehicles.Dinkler_Price, "Hounddog" => Instance.config.Vehicles.Hounddog_Price, "Cheetah" => Instance.config.Vehicles.Cheetah_Price, _ => 1000f, }; } else { if (!Instance.skateboardAliasMap.TryGetValue(objectName, out var value3)) { MelonLogger.Warning("Property/Vehicle '" + objectName + "' not found in aliasMap, vehicleAliasMap or skateboardAliasMap. Skipping sell sign price assignment."); return; } num = value3 switch { "Cheap Skateboard" => Instance.config.Skateboards.Cheap_Skateboard_Price, "Skateboard" => Instance.config.Skateboards.Skateboard_Price, "Cruiser" => Instance.config.Skateboards.Cruiser_Price, "Lightweight Board" => Instance.config.Skateboards.Lightweight_Board_Price, "Golden Skateboard" => Instance.config.Skateboards.Golden_Skateboard_Price, _ => 1000f, }; } if (objectName.ToLower().Contains("board")) { TextMeshPro component = sellSign.GetComponent<TextMeshPro>(); if ((Object)(object)component != (Object)null) { string[] array = ((TMP_Text)component).text.Split(new char[1] { '\n' }); ((TMP_Text)component).text = array[0]; ((TMP_Text)component).text = ((TMP_Text)component).text + $"\n<color=#55C61E>${num}</color>"; } else { MelonLogger.Warning("Price TextMeshPro component not found for sell sign of " + objectName + "."); } return; } Transform val = sellSign.transform.Find("Price"); if ((Object)(object)val != (Object)null) { TextMeshPro component2 = ((Component)val).GetComponent<TextMeshPro>(); if ((Object)(object)component2 != (Object)null) { ((TMP_Text)component2).text = $"${num}"; } else { MelonLogger.Warning("Price TextMeshPro component not found for sell sign of " + objectName + "."); } } else { MelonLogger.Warning("Price object not found for sell sign of " + objectName + "."); } } } } namespace MoreRealisticLaundering.Util { public static class FontLoader { public static Font openSansBold; public static bool openSansBoldIsInitialized; public static Font openSansSemiBold; public static bool openSansSemiBoldIsInitialized; public static IEnumerator InitializeFonts() { openSansBold = FindFontFromOtherApp("openSansBold"); openSansSemiBold = FindFontFromOtherApp("openSansSemiBold"); yield break; } public static Font FindFontFromOtherApp(string fontName) { Font result = Resources.GetBuiltinResource<Font>("Arial.ttf"); if (fontName == "openSansBold") { Text componentInChildren = Utils.GetAppCanvasByName("ProductManagerApp/Container/Topbar").GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren != (Object)null) { result = componentInChildren.font; openSansBoldIsInitialized = true; } else { MelonLogger.Msg("openSansBold Font not found"); } return result; } if (fontName == "openSansSemiBold") { Text componentInChildren2 = Utils.GetAppCanvasByName("DeliveryApp/Container/Scroll View/Viewport/Content/Albert Hoover/Header").GetComponentInChildren<Text>(); if ((Object)(object)componentInChildren2 != (Object)null) { result = componentInChildren2.font; openSansSemiBoldIsInitialized = true; } else { MelonLogger.Msg("openSansSemiBold Font not found"); } return result; } return Resources.GetBuiltinResource<Font>("Arial.ttf"); } } public static class Utils { public static GameObject GetAppIconByName(string Name, int? Index, string newObjectName = null) { int valueOrDefault = Index.GetValueOrDefault(); GameObject[] array = (from t in (IEnumerable<Transform>)GameObject.Find("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/HomeScreen/AppIcons/").GetComponentsInChildren<Transform>(true) let labelTransform = ((Component)t).gameObject.transform.Find("Label") let textComponent = ((Object)(object)labelTransform != (Object)null) ? ((Component)labelTransform).GetComponent<Text>() : null where (Object)(object)textComponent != (Object)null && textComponent.text != null && textComponent.text.StartsWith(Name) select ((Component)t).gameObject).ToArray(); if (valueOrDefault >= array.Length) { MelonLogger.Error($"Index {valueOrDefault} is out of range. Returning null."); return null; } GameObject val = array[valueOrDefault]; if (newObjectName != null) { ((Object)val).name = newObjectName; } return val; } public static GameObject ChangeLabelFromAppIcon(string appIconName, string newLabel) { if (string.IsNullOrEmpty(appIconName) || string.IsNullOrEmpty(newLabel)) { MelonLogger.Error("AppIcon name or new label is null or empty."); return null; } GameObject appIconByName = GetAppIconByName(appIconName, 1, newLabel); Transform val = appIconByName.transform.Find("Label"); GameObject val2 = (((Object)(object)appIconByName != (Object)null) ? ((Component)val).gameObject : null); if ((Object)(object)val2 != (Object)null) { Text component = val2.GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.text = newLabel; } } return appIconByName; } public static GameObject GetAppCanvasByName(string Name) { return ((Component)GameObject.Find("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/AppsCanvas/").transform.Find(Name)).gameObject; } public static IEnumerator WaitForObjectByFrame(string path, Action<GameObject> callback) { GameObject obj = null; while ((Object)(object)obj == (Object)null) { obj = GameObject.Find(path); yield return null; } callback?.Invoke(obj); } public static IEnumerator WaitForObject(string path, Action<GameObject> callback, float timeout = 30f) { GameObject obj = null; float timer = 0f; while ((Object)(object)obj == (Object)null && timer < timeout) { obj = GameObject.Find(path); if ((Object)(object)obj != (Object)null) { break; } yield return (object)new WaitForSeconds(0.1f); timer += 0.1f; } callback?.Invoke(obj); } public static void ClearChildren(Transform parent, Func<GameObject, bool> keepFilter = null) { GameObject[] array = (from t in (IEnumerable<Transform>)((Component)parent).GetComponentsInChildren<Transform>(true) select ((Component)t).gameObject into obj where (Object)(object)obj.transform != (Object)(object)parent select obj).ToArray(); foreach (GameObject val in array) { if (keepFilter == null || !keepFilter(val)) { val.transform.parent = null; Object.Destroy((Object)(object)val); } } } public static Texture2D LoadCustomImage(string path) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0043: Expected O, but got Unknown string path2 = Path.Combine(MelonEnvironment.UserDataDirectory, path); Texture2D result; if (!File.Exists(path2)) { result = null; Debug.LogError(Object.op_Implicit("Specified path does not exist.")); } else { byte[] array = File.ReadAllBytes(path2); Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array)); result = val; } return result; } } public static class ColorUtil { public static Dictionary<string, Color32> GetColors() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: 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_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) return new Dictionary<string, Color32> { { "Dark Blue", new Color32((byte)33, (byte)64, (byte)115, byte.MaxValue) }, { "Light Blue", new Color32((byte)83, (byte)126, (byte)158, byte.MaxValue) }, { "Light Purple", new Color32((byte)87, (byte)82, (byte)153, (byte)127) }, { "Purple", new Color32((byte)108, (byte)35, (byte)114, byte.MaxValue) }, { "Bright Green", new Color32((byte)85, (byte)198, (byte)30, byte.MaxValue) }, { "Olive Green", new Color32((byte)67, (byte)99, (byte)33, byte.MaxValue) }, { "Dark Green", new Color32((byte)91, (byte)127, (byte)9, byte.MaxValue) }, { "Cyan", new Color32((byte)9, (byte)115, (byte)119, byte.MaxValue) }, { "Dark Red", new Color32((byte)99, (byte)33, (byte)37, byte.MaxValue) }, { "Yellow", new Color32((byte)208, (byte)174, (byte)54, byte.MaxValue) }, { "Orange", new Color32((byte)178, (byte)78, (byte)44, byte.MaxValue) }, { "Grey", new Color32((byte)49, (byte)49, (byte)49, byte.MaxValue) }, { "Light Grey", new Color32((byte)90, (byte)90, (byte)90, byte.MaxValue) }, { "Ultra Light Grey", new Color32((byte)150, (byte)150, (byte)150, byte.MaxValue) }, { "Dark Grey", new Color32((byte)30, (byte)30, (byte)30, byte.MaxValue) }, { "Redpurple", new Color32((byte)112, (byte)21, (byte)37, byte.MaxValue) }, { "White", new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue) }, { "Black", new Color32((byte)0, (byte)0, (byte)0, byte.MaxValue) } }; } public static Color32 GetColor(string colorName) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (GetColors().TryGetValue(colorName, out var value)) { return value; } throw new KeyNotFoundException("Color '" + colorName + "' not found."); } } } namespace MoreRealisticLaundering.PhoneApp { public class LaunderingApp { public GameObject DansHardwareTemplate; public GameObject GasMartWestTemplate; public GameObject viewPortContentSpaceTemplate; public Transform launderingAppViewportContentTransform; private static readonly string ConfigFolder = Path.Combine(MelonEnvironment.UserDataDirectory, "MoreRealisticLaundering"); private static readonly string FilePath = Path.Combine(ConfigFolder, "LaunderingIcon.png"); public static string _appName; public bool _isLaunderingAppLoaded; private GameObject detailsTitleObject; private GameObject InstructionsTextObject; private GameObject detailsSubtitleObject; private Transform settingsContentTransform; public Transform optionsTransform; public Transform priceOptionsTransform; public Transform vehicleOptionsTransform; public Transform skateboardOptionsTransform; public GameObject checkboxTemplate; private Sprite inputBackgroundSprite; private Sprite saveButtonSprite; private Sprite toggleButtonSprite; private Sprite toggleButtonPressedSprite; private Sprite appIconSprite; private Sprite raysRealEstateSprite; private Sprite shredShackSprite; private Sprite hylandAutoSprite; private Sprite laundromatSprite; private Sprite postOfficeSprite; private Sprite carWashSprite; private Sprite tacoTicklersSprite; private Business _selectedBusiness; public bool isSaveStillRunning; public IEnumerator InitializeLaunderApp() { while (MRLCore.Instance == null) { MelonLogger.Msg("Waiting for Instance to be initialized..."); yield return (object)new WaitForSeconds(1f); } MelonCoroutines.Start(FontLoader.InitializeFonts()); while (!FontLoader.openSansBoldIsInitialized || !FontLoader.openSansSemiBoldIsInitialized) { MelonLogger.Msg("Waiting for Fonts to be loaded..."); yield return (object)new WaitForSeconds(2f); } yield return MelonCoroutines.Start(CreateApp("TaxNWash", "Tax & Wash", IsRotated: true, FilePath)); } public IEnumerator CreateApp(string IDName, string Title, bool IsRotated = true, string IconPath = null) { GameObject cloningCandidateProducts = null; string cloningNameProducts = null; GameObject cloningCandidateDeliveries = null; string cloningNameDeliveries = null; GameObject cloningCandidateProductsCopy = null; string cloningNameProductsCopy = null; GameObject icons = null; yield return MelonCoroutines.Start(Utils.WaitForObject("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/HomeScreen/AppIcons/", delegate(GameObject obj) { icons = obj; })); if (IsRotated) { yield return MelonCoroutines.Start(Utils.WaitForObject("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/AppsCanvas/DeliveryApp", delegate(GameObject objD) { cloningCandidateDeliveries = objD; cloningNameDeliveries = "Deliveries"; })); yield return MelonCoroutines.Start(Utils.WaitForObject("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/AppsCanvas/ProductManagerApp", delegate(GameObject objP) { cloningCandidateProductsCopy = objP; cloningNameProductsCopy = "Products"; })); yield return MelonCoroutines.Start(Utils.WaitForObject("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/AppsCanvas/ProductManagerApp", delegate(GameObject obj) { cloningCandidateProducts = obj; cloningNameProducts = "Products"; })); } GameObject val = GameObject.Find("Player_Local/CameraContainer/Camera/OverlayCamera/GameplayMenu/Phone/phone/AppsCanvas/"); GameObject obj2 = Object.Instantiate<GameObject>(cloningCandidateDeliveries, val.transform); ((Object)obj2).name = "DeliveriesTemp"; GameObject val2 = Object.Instantiate<GameObject>(cloningCandidateProductsCopy, val.transform); ((Object)obj2).name = "ProductsTemp"; GameObject obj3 = Object.Instantiate<GameObject>(cloningCandidateProducts, val.transform); ((Object)obj3).name = IDName; GameObject val3 = Utils.ChangeLabelFromAppIcon(cloningNameDeliveries, "DeliveriesCopy"); GameObject val4 = Utils.ChangeLabelFromAppIcon(cloningNameProductsCopy, "ProductsCopy"); Transform val5 = obj3.transform.Find("Container"); Transform val6 = val5.Find("Topbar"); if ((Object)(object)val6 != (Object)null) { ((Graphic)((Component)val6).GetComponent<Image>()).color = Color32.op_Implicit(ColorUtil.GetColor("Cyan")); Transform val7 = val6.Find("Title"); if ((Object)(object)val7 != (Object)null) { ((Component)val7).GetComponent<Text>().text = Title; } Transform val8 = val6.Find("Subtitle"); if ((Object)(object)val8 != (Object)null) { ((Component)val8).GetComponent<Text>().text = "by KampfBallerina"; ((Component)val8).GetComponent<Text>().alignment = (TextAnchor)5; ((Graphic)((Component)val8).GetComponent<Text>()).color = Color32.op_Implicit(ColorUtil.GetColor("White")); ((Component)val8).GetComponent<RectTransform>().anchorMax = new Vector2(0.98f, 1f); } } Transform val9 = val5.Find("Scroll View"); if ((Object)(object)val9 != (Object)null) { ((Component)val9).gameObject.SetActive(false); ((Object)((Component)val9).gameObject).name = "DeactivatedScrollView"; } Transform val10 = obj2.transform.Find("Container"); if ((Object)(object)val10 != (Object)null) { Transform val11 = val10.Find("Scroll View"); if ((Object)(object)val11 != (Object)null) { Transform val12 = ((Component)val11).transform.Find("Viewport"); if ((Object)(object)val12 != (Object)null) { ((Component)val12).transform.Find("Content"); } Transform val13 = ((Component)val11).transform.Find("OrderSubmitted"); if ((Object)(object)val13 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val13).gameObject); } ((Component)((Component)val11).transform).GetComponent<RectTransform>().sizeDelta = new Vector2(-100f, -60f); ((Component)((Component)val11).transform).GetComponent<RectTransform>().anchoredPosition = new Vector2(-50f, -30f); val11.SetParent(val5, false); } } Transform val14 = val5.Find("Details"); if ((Object)(object)val14 != (Object)null) { ((Object)val14).name = "Details"; ((Component)val14).GetComponent<RectTransform>().sizeDelta = new Vector2(95f, -60f); ((Component)val14).GetComponent<RectTransform>().anchoredPosition = new Vector2(-47.5f, -30f); Transform val15 = val14.Find("Scroll View/Viewport/Content/Title"); if ((Object)(object)val15 != (Object)null) { detailsTitleObject = ((Component)val15).gameObject; detailsTitleObject.SetActive(false); ((Component)val15).GetComponent<Text>().text = "DetailsTitleText"; } Transform val16 = val14.Find("Scroll View/Viewport/Content/Description"); if ((Object)(object)val16 != (Object)null) { ((Component)val16).GetComponent<Text>().text = "This is going to be the description of the app."; ((Component)val16).GetComponent<RectTransform>().anchoredPosition = new Vector2(0f, 0f); ((Component)val16).GetComponent<RectTransform>().sizeDelta = new Vector2(400f, 50f); ((Component)val16).GetComponent<Text>().fontSize = 18; ((Component)val16).gameObject.SetActive(false); detailsSubtitleObject = ((Component)val16).gameObject; } settingsContentTransform = val14.Find("Scroll View/Viewport/Content"); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("Value")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("Effects")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("Addiction")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("Recipes")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("RecipesContainer")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("Listed")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("Delisted")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("NotDiscovered")).gameObject); ObjectExt.Destroy((Object)(object)((Component)settingsContentTransform.Find("Properties")).gameObject); Transform val17 = val14.Find("Instruction"); if ((Object)(object)val17 != (Object)null) { InstructionsTextObject = ((Component)val17).gameObject; Text component = ((Component)val17).GetComponent<Text>(); component.text = "Select a section to adjust settings"; component.fontSize = 20; } Transform val18 = settingsContentTransform.Find("Space"); if ((Object)(object)val18 != (Object)null) { ((Component)val18).gameObject.SetActive(true); RectTransform component2 = ((Component)val18).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(component2.sizeDelta.x, 200f); } } CreateTemplates(val5, settingsContentTransform); Object.DestroyImmediate((Object)(object)val3.gameObject); ObjectExt.Destroy((Object)(object)obj2); Object.DestroyImmediate((Object)(object)val4.gameObject); ObjectExt.Destroy((Object)(object)val2); GameObject val19 = Utils.ChangeLabelFromAppIcon(cloningNameProducts, Title); MRLCore.Instance.ChangeAppIconImage(val19, IconPath); MRLCore.Instance.RegisterApp(val19, Title); ((Component)settingsContentTransform).gameObject.SetActive(true); AddOptionsForBusiness(settingsContentTransform); AddPriceOptionsWithToggleButton(settingsContentTransform); AddVehicleOptions(settingsContentTransform); AddSkateboardOptions(settingsContentTransform); _isLaunderingAppLoaded = true; } private void CreateTemplates(Transform deliveriesContainer, Transform productsContainer = null) { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)deliveriesContainer == (Object)null) { MelonLogger.Error("Container not found!"); return; } if ((Object)(object)productsContainer != (Object)null) { Transform val = productsContainer.Find("Toggle"); if ((Object)(object)val != (Object)null) { _ = (Object)(object)((Component)val).GetComponent<RectTransform>() != (Object)null; if ((Object)(object)((Component)val).GetComponent<HorizontalLayoutGroup>() == (Object)null) { HorizontalLayoutGroup obj = ((Component)val).gameObject.AddComponent<HorizontalLayoutGroup>(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = 100f; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true; ((LayoutGroup)obj).childAlignment = (TextAnchor)3; } if ((Object)(object)((Component)val).GetComponent<ContentSizeFitter>() == (Object)null) { ContentSizeFitter obj2 = ((Component)val).gameObject.AddComponent<ContentSizeFitter>(); obj2.horizontalFit = (FitMode)2; obj2.verticalFit = (FitMode)0; } Transform val2 = val.Find("Text"); if ((Object)(object)val2 != (Object)null) { Text component = ((Component)val2).GetComponent<Text>(); component.font = FontLoader.openSansSemiBold ?? Resources.GetBuiltinResource<Font>("Arial.ttf"); component.text = "toggleTransformText"; ((Graphic)component).color = Color32.op_Implicit(ColorUtil.GetColor("White")); component.fontSize = 18; val2.SetAsFirstSibling(); ((Component)val2).GetComponent<RectTransform>().sizeDelta = new Vector2(325f, 30f); if ((Object)(object)((Component)val2).GetComponent<LayoutElement>() == (Object)null) { ((Component)val2).gameObject.AddComponent<LayoutElement>().minWidth = 325f; } } Toggle component2 = ((Component)val).GetComponent<Toggle>(); if ((Object)(object)component2 != (Object)null) { component2.isOn = false; ((UnityEventBase)component2.onValueChanged).RemoveAllListeners(); } Transform val3 = val.Find("Background"); if ((Object)(object)val3 != (Object)null) { ((Object)val3).name = "CheckboxBackground"; if ((Object)(object)((Component)val3).GetComponent<LayoutElement>() == (Object)null) { LayoutElement obj3 = ((Component)val3).gameObject.AddComponent<LayoutElement>(); obj3.minWidth = 30f; obj3.preferredWidth = 30f; obj3.minHeight = 30f; obj3.preferredHeight = 30f; } } Transform val4 = val3.Find("Checkmark"); if ((Object)(object)val4 != (Object)null) { ((Graphic)((Component)val4).GetComponent<Image>()).color = Color32.op_Implicit(ColorUtil.GetColor("Cyan")); } RectTransform component3 = ((Component)val).gameObject.GetComponent<RectTransform>(); if ((Object)(object)component3 != (Object)null) { component3.sizeDelta = new Vector2(30f, 30f); } checkboxTemplate = Object.Instantiate<GameObject>(((Component)val).gameObject); ((Object)checkboxTemplate).name = "Checkbox Template"; checkboxTemplate.SetActive(true); ObjectExt.Destroy((Object)(object)((Component)val).gameObject); } } Transform val5 = deliveriesContainer.Find("Scroll View"); if (!((Object)(object)val5 != (Object)null)) { return; } Transform val6 = val5.Find("OrderSubmitted"); if ((Object)(object)val6 != (Object)null) { ObjectExt.Destroy((Object)(object)((Component)val6).gameObject); } Transform val7 = val5.Find("Viewport"); if (!((Object)(object)val7 != (Object)null)) { return; } Transform val8 = val7.Find("Content"); if ((Object)(object)val8 != (Object)null) { launderingAppViewportContentTransform = val8; GameObject gameObject = ((Component)val8.Find("Dan's Hardware")).gameObject; GameObject gameObject2 = ((Component)val8.Find("Gas-Mart (West)")).gameObject; GameObject gameObject3 = ((Component)val8.Find("Space")).gameObject; if ((Object)(object)gameObject != (Object)null && (Object)(object)DansHardwareTemplate == (Object)null) { DansHardwareTemplate = Object.Instantiate<GameObject>(gameObject); ((Object)DansHardwareTemplate).name = "Dan's Hardware Template"; DansHardwareTemplate.SetActive(false); Transform val9 = DansHardwareTemplate.transform.Find("Contents"); if ((Object)(object)val9 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val9).gameObject); } Object.Destroy((Object)(object)gameObject); } if ((Object)(object)gameObject2 != (Object)null && (Object)(object)GasMartWestTemplate == (Object)null) { GasMartWestTemplate = Object.Instantiate<GameObject>(gameObject2); ((Object)GasMartWestTemplate).name = "Gas-Mart (West) Template"; GasMartWestTemplate.SetActive(false); Transform val10 = GasMartWestTemplate.transform.Find("Contents"); if ((Object)(object)val10 != (Object)null) { Object.DestroyImmediate((Object)(object)((Component)val10).gameObject); } Object.Destroy((Object)(object)gameObject2); } if ((Object)(object)gameObject3 != (Object)null && (Object)(object)viewPortContentSpaceTemplate == (Object)null) { viewPortContentSpaceTemplate = Object.Instantiate<GameObject>(gameObject3); ((Object)viewPortContentSpaceTemplate).name = "Space Template"; viewPortContentSpaceTemplate.SetActive(false); Object.Destroy((Object)(object)gameObject3); } Utils.ClearChildren(val8); AddSpaceFromTemplate(val8); } else { MelonLogger.Error("Viewport Content not found!"); } } public void AddSpaceFromTemplate(Transform viewportContentTransform = null) { if ((Object)(object)viewportContentTransform == (Object)null) { viewportContentTransform = launderingAppViewportContentTransform; if ((Object)(object)viewportContentTransform == (Object)null) { MelonLogger.Error("ViewportContentTransform is null!"); return; } } if ((Object)(object)viewPortContentSpaceTemplate == (Object)null) { MelonLogger.Error("Can't find Space Template!"); return; } Transform val = viewportContentTransform.Find("Space"); if ((Object)(object)val != (Object)null) { val.SetAsLastSibling(); return; } GameObject obj = Object.Instantiate<GameObject>(viewPortContentSpaceTemplate, viewportContentTransform); ((Object)obj).name = "Space"; obj.transform.SetAsLastSibling(); obj.SetActive(true); } public void AddEntryFromTemplate(string newObjectName, string newTitle, string newSubtitle, Business business, GameObject template = null, Color newBackgroundColor = default(Color), string imagePath = null, Transform viewportContentTransform = null, bool isFirstEntry = false) { //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0156: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)viewportContentTransform == (Object)null) { if ((Object)(object)launderingAppViewportContentTransform == (Object)null) { MelonLogger.Error("ViewportContentTransform is null!"); return; } viewportContentTransform = launderingAppViewportContentTransform; } if ((Object)(object)template == (Object)null && (Object)(object)GasMartWestTemplate != (Object)null) { template = GasMartWestTemplate; } GameObject val = Object.Instantiate<GameObject>(template, viewportContentTransform); ((Object)val).name = newObjectName; Transform val2 = val.transform.Find("Header"); Transform val3 = val2.Find("Icon").Find("Image"); Transform val4 = val2.Find("Title"); Transform val5 = val2.Find("Description"); ((Component)val2.Find("Arrow")).gameObject.SetActive(false); Text component = ((Component)val4).GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.text = newTitle; } Text component2 = ((Component)val5).GetComponent<Text>(); if ((Object)(object)component2 != (Object)null) { component2.text = newSubtitle; } Image component3 = ((Component)val2).GetComponent<Image>(); if ((Object)(object)component3 != (Object)null && newBackgroundColor != default(Color)) { ((Graphic)component3).color = newBackgroundColor; } if (!string.IsNullOrEmpty(imagePath) && File.Exists(imagePath)) { byte[] array = File.ReadAllBytes(imagePath); Texture2D val6 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val6, Il2CppStructArray<byte>.op_Implicit(array))) { Sprite sprite = Sprite.Create(val6, new Rect(0f, 0f, (float)((Texture)val6).width, (float)((Texture)val6).height), new Vector2(0.5f, 0.5f)); Image component4 = ((Component)val3).GetComponent<Image>(); if ((Object)(object)component4 != (Object)null) { component4.sprite = sprite; if (imagePath.Contains("Laundromat.png")) { laundromatSprite = sprite; } else if (imagePath.Contains("TacoTickler.png")) { tacoTicklersSprite = sprite; } else if (imagePath.Contains("CarWash.png")) { carWashSprite = sprite; } else if (imagePath.Contains("PostOffice.png")) { postOfficeSprite = sprite; } else if (imagePath.Contains("HylandAuto.png")) { hylandAutoSprite = sprite; } else if (imagePath.Contains("Jeff.png")) { shredShackSprite = sprite; } else if (imagePath.Contains("RaysRealEstate.png")) { raysRealEstateSprite = sprite; } } } else { MelonLogger.Error("Failed to load image from path: " + imagePath); } } if (Object.op_Implicit((Object)(object)business)) { Button component5 = ((Component)val2).GetComponent<Button>(); if ((Object)(object)component5 != (Object)null) { ((Object)component5).name = newObjectName + " Button"; ((UnityEventBase)component5.onClick).RemoveAllListeners(); ((UnityEvent)component5.onClick).AddListener(UnityAction.op_Implicit((Action)FuncThatCallsFunc)); } } if (newObjectName == "Rays Real Estate") { Button component6 = ((Component)val2).GetComponent<Button>(); if ((Object)(object)component6 != (Object)null) { ((Object)component6).name = newObjectName + " Button"; ((UnityEventBase)component6.onClick).RemoveAllListeners(); ((UnityEvent)component6.onClick).AddListener(UnityAction.op_Implicit((Action)FuncThatCallsFunc)); } } if (newObjectName == "Hyland Auto") { Button component7 = ((Component)val2).GetComponent<Button>(); if ((Object)(object)component7 != (Object)null) { ((Object)component7).name = newObjectName + " Button"; ((UnityEventBase)component7.onClick).RemoveAllListeners(); ((UnityEvent)component7.onClick).AddListener(UnityAction.op_Implicit((Action)FuncThatCallsFunc)); } } if (newObjectName == "Shred Shack") { Button component8 = ((Component)val2).GetComponent<Button>(); if ((Object)(object)component8 != (Object)null) { ((Object)component8).name = newObjectName + " Button"; ((UnityEventBase)component8.onClick).RemoveAllListeners(); ((UnityEvent)component8.onClick).AddListener(UnityAction.op_Implicit((Action)FuncThatCallsFunc)); } } if (isFirstEntry) { val.transform.SetAsFirstSibling(); } val.SetActive(true); AddSpaceFromTemplate(viewportContentTransform); void FuncThatCallsFunc() { BusinessButtonClicked(business); } void FuncThatCallsFunc() { RealEstateButtonClicked(); } void FuncThatCallsFunc() { HylandAutoButtonClicked(); } void FuncThatCallsFunc() { ShredShackButtonClicked(); } } private void ShredShackButtonClicked() { if ((Object)(object)optionsTransform == (Object)null) { MelonLogger.Error("optionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if ((Object)(object)priceOptionsTransform == (Object)null) { MelonLogger.Error("priceOptionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if ((Object)(object)vehicleOptionsTransform == (Object)null) { MelonLogger.Error("vehicleOptionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if ((Object)(object)skateboardOptionsTransform == (Object)null) { MelonLogger.Error("skateboardOptionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if (InstructionsTextObject.activeSelf) { InstructionsTextObject.SetActive(false); } if (!detailsTitleObject.activeSelf) { detailsTitleObject.SetActive(true); } detailsTitleObject.GetComponent<Text>().text = "Shred Shack"; if (!detailsSubtitleObject.activeSelf) { detailsSubtitleObject.SetActive(true); } detailsSubtitleObject.GetComponent<Text>().text = "Adjusting the prices of skateboards."; if (((Component)priceOptionsTransform).gameObject.activeSelf) { ((Component)priceOptionsTransform).gameObject.SetActive(false); } if (((Component)optionsTransform).gameObject.activeSelf) { ((Component)optionsTransform).gameObject.SetActive(false); } if (((Component)vehicleOptionsTransform).gameObject.activeSelf) { ((Component)vehicleOptionsTransform).gameObject.SetActive(false); } if (!((Component)skateboardOptionsTransform).gameObject.activeSelf) { ((Component)skateboardOptionsTransform).gameObject.SetActive(true); } Transform val = skateboardOptionsTransform.Find("Save Button"); if ((Object)(object)val != (Object)null && !((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } Transform val2 = skateboardOptionsTransform.Find("Cheap Skateboard Horizontal Container"); Transform val3 = skateboardOptionsTransform.Find("Skateboard Horizontal Container"); Transform val4 = skateboardOptionsTransform.Find("Lightweight Board Horizontal Container"); Transform val5 = skateboardOptionsTransform.Find("Cruiser Horizontal Container"); Transform val6 = skateboardOptionsTransform.Find("Golden Skateboard Horizontal Container"); if ((Object)(object)val2 != (Object)null && !((Component)val2).gameObject.activeSelf) { ((Component)val2).gameObject.SetActive(true); } if ((Object)(object)val3 != (Object)null && !((Component)val3).gameObject.activeSelf) { ((Component)val3).gameObject.SetActive(true); } if ((Object)(object)val4 != (Object)null && !((Component)val4).gameObject.activeSelf) { ((Component)val4).gameObject.SetActive(true); } if ((Object)(object)val5 != (Object)null && !((Component)val5).gameObject.activeSelf) { ((Component)val5).gameObject.SetActive(true); } if ((Object)(object)val6 != (Object)null && !((Component)val6).gameObject.activeSelf) { ((Component)val6).gameObject.SetActive(true); } Enumerator<Option> enumerator = MRLCore.Instance.shackShopDialogueController.Options.GetEnumerator(); while (enumerator.MoveNext()) { Option current = enumerator.Current; if (current != null) { string displayName = (MRLCore.Instance.skateboardAliasMap.ContainsKey(current.Name) ? MRLCore.Instance.skateboardAliasMap[current.Name] : current.Name); float price = current.Price; SetInputFieldValue(skateboardOptionsTransform, displayName, price); } } } private void HylandAutoButtonClicked() { if ((Object)(object)optionsTransform == (Object)null) { MelonLogger.Error("optionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if ((Object)(object)priceOptionsTransform == (Object)null) { MelonLogger.Error("priceOptionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if ((Object)(object)vehicleOptionsTransform == (Object)null) { MelonLogger.Error("vehicleOptionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if ((Object)(object)skateboardOptionsTransform == (Object)null) { MelonLogger.Error("skateboardOptionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if (InstructionsTextObject.activeSelf) { InstructionsTextObject.SetActive(false); } if (!detailsTitleObject.activeSelf) { detailsTitleObject.SetActive(true); } detailsTitleObject.GetComponent<Text>().text = "Hyland Auto"; if (!detailsSubtitleObject.activeSelf) { detailsSubtitleObject.SetActive(true); } detailsSubtitleObject.GetComponent<Text>().text = "Adjusting the prices of vehicles."; if (((Component)priceOptionsTransform).gameObject.activeSelf) { ((Component)priceOptionsTransform).gameObject.SetActive(false); } if (((Component)optionsTransform).gameObject.activeSelf) { ((Component)optionsTransform).gameObject.SetActive(false); } if (((Component)skateboardOptionsTransform).gameObject.activeSelf) { ((Component)skateboardOptionsTransform).gameObject.SetActive(false); } if (!((Component)vehicleOptionsTransform).gameObject.activeSelf) { ((Component)vehicleOptionsTransform).gameObject.SetActive(true); } Transform val = vehicleOptionsTransform.Find("Save Button"); if ((Object)(object)val != (Object)null && !((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } Transform val2 = vehicleOptionsTransform.Find("Shitbox Horizontal Container"); Transform val3 = vehicleOptionsTransform.Find("Veeper Horizontal Container"); Transform val4 = vehicleOptionsTransform.Find("Bruiser Horizontal Container"); Transform val5 = vehicleOptionsTransform.Find("Dinkler Horizontal Container"); Transform val6 = vehicleOptionsTransform.Find("Hounddog Horizontal Container"); Transform val7 = vehicleOptionsTransform.Find("Cheetah Horizontal Container"); if ((Object)(object)val2 != (Object)null && !((Component)val2).gameObject.activeSelf) { ((Component)val2).gameObject.SetActive(true); } if ((Object)(object)val3 != (Object)null && !((Component)val3).gameObject.activeSelf) { ((Component)val3).gameObject.SetActive(true); } if ((Object)(object)val4 != (Object)null && !((Component)val4).gameObject.activeSelf) { ((Component)val4).gameObject.SetActive(true); } if ((Object)(object)val5 != (Object)null && !((Component)val5).gameObject.activeSelf) { ((Component)val5).gameObject.SetActive(true); } if ((Object)(object)val6 != (Object)null && !((Component)val6).gameObject.activeSelf) { ((Component)val6).gameObject.SetActive(true); } if ((Object)(object)val7 != (Object)null && !((Component)val7).gameObject.activeSelf) { ((Component)val7).gameObject.SetActive(true); } Enumerator<LandVehicle> enumerator = MRLCore.Instance.vehicleManager.VehiclePrefabs.GetEnumerator(); while (enumerator.MoveNext()) { LandVehicle current = enumerator.Current; if (!((Object)(object)current == (Object)null)) { string displayName = (MRLCore.Instance.vehicleAliasMap.ContainsKey(((Object)current).name) ? MRLCore.Instance.vehicleAliasMap[((Object)current).name] : ((Object)current).name); float vehiclePrice = current.vehiclePrice; SetInputFieldValue(vehicleOptionsTransform, displayName, vehiclePrice); } } } private void RealEstateButtonClicked() { //IL_044c: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Expected O, but got Unknown //IL_04cf: Unknown result type (might be due to invalid IL or missing references) //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Expected O, but got Unknown //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)optionsTransform == (Object)null) { MelonLogger.Error("optionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if ((Object)(object)priceOptionsTransform == (Object)null) { MelonLogger.Error("priceOptionsTransform is null! Ensure it is initialized before calling RealEstateButtonClicked."); return; } if (!((Component)priceOptionsTransform).gameObject.activeSelf) { ((Component)priceOptionsTransform).gameObject.SetActive(true); } if (((Component)optionsTransform).gameObject.activeSelf) { ((Component)optionsTransform).gameObject.SetActive(false); } if (((Component)vehicleOptionsTransform).gameObject.activeSelf) { ((Component)vehicleOptionsTransform).gameObject.SetActive(false); } if (((Component)skateboardOptionsTransform).gameObject.activeSelf) { ((Component)skateboardOptionsTransform).gameObject.SetActive(false); } if (InstructionsTextObject.activeSelf) { InstructionsTextObject.SetActive(false); } if (!detailsTitleObject.activeSelf) { detailsTitleObject.SetActive(true); } detailsTitleObject.GetComponent<Text>().text = "Ray's Real Estate"; if (!detailsSubtitleObject.activeSelf) { detailsSubtitleObject.SetActive(true); } detailsSubtitleObject.GetComponent<Text>().text = "Adjusting the prices of properties."; Transform val = priceOptionsTransform.Find("Laundromat Horizontal Container"); Transform val2 = priceOptionsTransform.Find("Post Office Horizontal Container"); Transform val3 = priceOptionsTransform.Find("Car Wash Horizontal Container"); Transform val4 = priceOptionsTransform.Find("Taco Ticklers Horizontal Container"); if ((Object)(object)val != (Object)null && !((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } if ((Object)(object)val2 != (Object)null && !((Component)val2).gameObject.activeSelf) { ((Component)val2).gameObject.SetActive(true); } if ((Object)(object)val3 != (Object)null && !((Component)val3).gameObject.activeSelf) { ((Component)val3).gameObject.SetActive(true); } if ((Object)(object)val4 != (Object)null && !((Component)val4).gameObject.activeSelf) { ((Component)val4).gameObject.SetActive(true); } Transform val5 = priceOptionsTransform.Find("Save Button"); if ((Object)(object)val5 != (Object)null && (Object)(object)((Component)val5).gameObject != (Object)null && !((Component)val5).gameObject.activeSelf) { ((Component)val5).gameObject.SetActive(true); } Transform val6 = priceOptionsTransform.Find("Storage Unit Horizontal Container"); Transform val7 = priceOptionsTransform.Find("Motel Horizontal Container"); Transform val8 = priceOptionsTransform.Find("Sweatshop Horizontal Container"); Transform val9 = priceOptionsTransform.Find("Bungalow Horizontal Container"); Transform val10 = priceOptionsTransform.Find("Barn Horizontal Container"); Transform val11 = priceOptionsTransform.Find("Docks Warehouse Horizontal Container"); Transform val12 = priceOptionsTransform.Find("Manor Horizontal Container"); if ((Object)(object)val6 != (Object)null && ((Component)val6).gameObject.activeSelf) { ((Component)val6).gameObject.SetActive(false); } if ((Object)(object)val7 != (Object)null && ((Component)val7).gameObject.activeSelf) { ((Component)val7).gameObject.SetActive(false); } if ((Object)(object)val8 != (Object)null && ((Component)val8).gameObject.activeSelf) { ((Component)val8).gameObject.SetActive(false); } if ((Object)(object)val9 != (Object)null && ((Component)val9).gameObject.activeSelf) { ((Component)val9).gameObject.SetActive(false); } if ((Object)(object)val10 != (Object)null && ((Component)val10).gameObject.activeSelf) { ((Component)val10).gameObject.SetActive(false); } if ((Object)(object)val11 != (Object)null && ((Component)val11).gameObject.activeSelf) { ((Component)val11).gameObject.SetActive(false); } if ((Object)(object)val12 != (Object)null && ((Component)val12).gameObject.activeSelf) { ((Component)val12).gameObject.SetActive(false); } Transform obj = priceOptionsTransform.Find("ToggleContainer/ToggleButton"); GameObject val13 = ((obj != null) ? ((Component)obj).gameObject : null); if ((Object)(object)val13 != (Object)null) { Image component = val13.GetComponent<Image>(); if ((Object)(object)component != (Object)null) { if ((Object)(object)toggleButtonPressedSprite == (Object)null) { string text = Path.Combine(ConfigFolder, "ToggleButtonPressed.png"); if (!string.IsNullOrEmpty(text) && File.Exists(text)) { byte[] array = File.ReadAllBytes(text); Texture2D val14 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val14, Il2CppStructArray<byte>.op_Implicit(array))) { component.sprite = (toggleButtonPressedSprite = Sprite.Create(val14, new Rect(0f, 0f, (float)((Texture)val14).width, (float)((Texture)val14).height), new Vector2(0.5f, 0.5f))); } else { MelonLogger.Error("Failed to load image from path: " + text); ((Graphic)component).color = new Color(0.2f, 0.6f, 0.2f); } } } else { component.sprite = toggleButtonPressedSprite; } } else { MelonLogger.Warning("Button Image component not found!"); } } Transform obj2 = priceOptionsTransform.Find("ToggleContainer/SecondToggleButton"); GameObject val15 = ((obj2 != null) ? ((Component)obj2).gameObject : null); if ((Object)(object)val15 != (Object)null) { Image component2 = val15.GetComponent<Image>(); if ((Object)(object)component2 != (Object)null) { if ((Object)(object)toggleButtonSprite == (Object)null) { string text2 = Path.Combine(ConfigFolder, "ToggleButton.png"); if (!string.IsNullOrEmpty(text2) && File.Exists(text2)) { byte[] array2 = File.ReadAllBytes(text2); Texture2D val16 = new Texture2D(2, 2); if (ImageConversion.LoadImage(val16, Il2CppStructArray<byte>.op_Implicit(array2))) { component2.sprite = (toggleButtonSprite = Sprite.Create(val16, new Rect(0f, 0f, (float)((Texture)val16).width, (float)((Texture)val16).height), new Vector2(0.5f, 0.5f))); } else { MelonLogger.Error("Failed to load image from path: " + text2); ((Graphic)component2).color = new Color(0.2f, 0.6f, 0.2f); } } } else { component2.sprite = toggleButtonSprite; } } else { MelonLogger.Warning("Home Button Image component not found!"); } } if (Business.OwnedBusinesses == null && Business.UnownedBusinesses == null) { MelonLogger.Error("OwnedBusinesses or UnownedBusinesses is null! Cannot load price values."); return; } Enumerator<Business> enumerator = Business.OwnedBusinesses.GetEnumerator(); while (enumerator.MoveNext()) { Business current = enumerator.Current; if (!((Object)(object)current == (Object)null)) { string text3 = ((Object)current).name; if (text3 == "PostOffice") { text3 = "Post Office"; } float price = ((Property)current).Price; SetInputFieldValue(priceOptionsTransform, text3, price); } } enumerator = Business.UnownedBusinesses.GetEnumerator(); while (enumerator.MoveNext()) { Business current2 = enumerator.Current; if (!((Object)(object)current2 == (Object)null)) { string text4 = ((Object)current2).name; if (text4 == "PostOffice") { text4 = "Post Office"; } float price2 = ((Property)current2).Price; SetInputFieldValue(priceOptionsTransform, text4, price2); } } if (Property.UnownedProperties == null && Property.OwnedProperties == null) { MelonLogger.Error("UnownedProperties or OwnedProperties is null! Cannot load price values."); return; } Enumerator<Property> enumerator2 = Property.UnownedProperties.GetEnumerator(); while (enumerator2.MoveNext()) { Property current3 = enumerator2.Current; if (!((Object)(object)current3 == (Object)null) && !(((Object)current3).name == "RV")) { string text5 = ((Object)current3).name; if (text5 == "MotelRoom") { text5 = "Motel"; } if (text5 == "DocksWarehouse") { text5 = "Docks Warehouse"; } if (text5 == "StorageUnit") { text5 = "Storage Unit"; } float price3 = current3.Price; SetInputFieldValue(priceOptionsTransform, text5, price3); } } enumerator2 = Property.OwnedProperties.GetEnumerator(); while (enumerator2.MoveNext()) { Property current4 = enumerator2.Current; if (!((Object)(object)current4 == (Object)null) && !(((Object)current4).name == "RV")) { string text6 = ((Object)current4).name; if (text6 == "MotelRoom") { text6 = "Motel"; } if (text6 == "DocksWarehouse") { text6 = "Docks Warehouse"; } if (text6 == "StorageUnit") { text6 = "Storage Unit"; } float price4 = current4.Price; SetInputFieldValue(priceOptionsTransform, text6, price4); } } } private void SetInputFieldValue(Transform parentTransform, string displayName, float value) { Transform val = parentTransform.Find(displayName + " Horizontal Container/" + displayName + " Input"); if ((Object)(object)val != (Object)null) { InputField component = ((Component)val).GetComponent<InputField>(); if ((Object)(object)component != (Object)null) { component.text = value.ToString(); } else { MelonLogger.Error("InputField component not found for " + displayName + "."); } } else { MelonLogger.Error("Transform not found for " + displayName + "."); } } private void BusinessButtonClicked(Business business) { if ((Object)(object)optionsTransform == (Object)null) { MelonLogger.Error("optionsTransform is null! Ensure it is initialized before calling BusinessButtonClicked."); return; } if ((Object)(object)priceOptionsTransform != (Object)null && ((Component)priceOptionsTransform).gameObject.activeSelf) { ((Component)priceOptionsTransform).gameObject.SetActive(false); } if ((Object)(object)vehicleOptionsTransform != (Object)null && ((Component)vehicleOptionsTransform).gameObject.activeSelf) { ((Component)vehicleOptionsTransform).gameObject.SetActive(false); } if ((Object)(object)skateboardOptionsTransform != (Object)null && ((Component)skateboardOptionsTransform).gameObject.activeSelf) { ((Component)skateboardOptionsTransform).gameObject.SetActive(false); } _selectedBusiness = business; Transform val = optionsTransform.Find("Maximum Launder Horizontal Container"); Transform val2 = optionsTransform.Find("Launder Time Horizontal Container"); Transform val3 = optionsTransform.Find("Taxation Horizontal Container"); if (!((Component)optionsTransform).gameObject.activeSelf) { ((Component)optionsTransform).gameObject.SetActive(true); } if ((Object)(object)val != (Object)null && !((Component)val).gameObject.activeSelf) { ((Component)val).gameObject.SetActive(true); } if ((Object)(object)val2 != (Object)null && !((Component)val2).gameObject.activeSelf) { ((Component)val2).gameObject.SetActive(true); } if ((Object)(object)val3 != (Object)null && !((Component)val3).gameObject.activeSelf) { ((Component)val3).gameObject.SetActive(true); } string text = ((Object)business).name; if (((Object)business).name == "PostOffice") { text = "Post Office"; } string text2 = "Adjusting the settings for " + text; if (InstructionsTextObject.activeSelf) { InstructionsTextObject.SetActive(false); } if (!detailsTitleObject.activeSelf) { detailsTitleObject.SetActive(true); } detailsTitleObject.GetComponent<Text>().text = text; if (!detailsSubtitleObject.activeSelf) { detailsSubtitleObject.SetActive(true); } detailsSubtitleObject.GetComponent<Text>().text = text2; Transform val4 = optionsTransform.Find("Maximum Launder Horizontal Container/Maximum Launder Input"); if ((Object)(object)val4 != (Object)null) { InputField component = ((Component)val4).GetComponent<InputField>(); if ((Object)(object)component != (Object)null) { component.text = business.LaunderCapacity.ToString(); } else { MelonLogger.Error("Maximum Launder Input Field component not found!"); } } else { MelonLogger.Error("Maximum Launder Input Transform not found!"); } Transform val5 = optionsTransform.Find("Launder Time Horizontal Container/Launder Time Input"); if ((Object)(object)val5 != (Object)null) { InputField component2 = ((Component)val5).GetComponent<InputField>(); if ((Object)(object)component2 != (Object)null) { if (MRLCore.Instance.config != null) { component2.text = ConfigManager.GetLaunderingTimeHours(MRLCore.Instance.config, ((Object)business).name).ToString(); } else { MelonLogger.Error("LaunderTimeHours not found in config for business " + text); } } else { MelonLogger.Error("Launder Time Input Field component not found!"); } } else { MelonLogger.Error("Launder Time Input Transform not found!"); } Transform val6 = optionsTransform.Find("Taxation Horizontal Container/Taxation Input"); if ((Object)(object)val6 != (Object)null) { InputField component3 = ((Component)val6).GetComponent<InputField>(); if ((Object)(object)component3 != (Object)null) { if (MRLCore.Instance.config != null) { component3.text = ConfigManager.GetTaxationPercentage(MRLCore.Instance.config, ((Object)business).name).ToString(); } else { MelonLogger.Error("Taxation Percentage not found in config for business " + text); } } else { MelonLogger.Error("Taxation Input Field component not found!"); } } else { MelonLogger.Error("Taxation Input Transform not found!"); } } public void AddOptionsForBusiness(Transform parentTransform) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)parentTransform == (Object)null) { MelonLogger.Error("parentTransform is null! Cannot add options."); return; } GameObject val = new GameObject("Options"); VerticalLayoutGroup val2 = val.GetComponent<VerticalLayoutGroup>(); if ((Object)(object)val2 == (Object)null) { val2 = val.gameObject.AddComponent<VerticalLayoutGroup>(); } ((LayoutGroup)val2).childAlignment = (TextAnchor)0; ((HorizontalOrVerticalLayoutGroup)val2).spacing = 15f; ((HorizontalOrVerticalLayoutGroup)val2).childControlWidth = true; ((HorizontalOrVerticalLayoutGroup)val2).childControlHeight = true; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandWidth = false; ((HorizontalOrVerticalLayoutGroup)val2).childForceExpandHeight = false; ((LayoutGroup)val2).padding = new RectOffset(15, 15, 15, 15); RectTransform component = val.GetComponent<RectTransform>(); if ((Object)(object)component != (Object)null) { component.offsetMin = new Vector2(60f, component.offsetMin.y + 60f); } ContentSizeFitter val3 = val.GetComponent<ContentSizeFitter>(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent<ContentSizeFitter>(); } val3.verticalFit = (FitMode)2; val3.horizontalFit = (FitMode)0; val.transform.SetParent(parentTransform, false); optionsTransform = val.transform; AddLabelInputPair("Maximum Launder", optionsTransform, "$"); AddLabelInputPair("Launder Time", optionsTransform, "hr"); AddLabelInputPair("Taxation", optionsTransform, "%"); AddSaveButton(optionsTransform, "BusinessDetails"); if ((Object)(object)parentTransform.FindChild("Space") != (Object)null) { parentTransform.FindChild("Space").SetAsLastSibling(); } val.SetActive(false); } private void AddLabelInputPair(string labelText, Transform parentTransform, string prefixText) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0350: 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_037c: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_04d7: Unknown result type (might be due to invalid IL or missing references) //IL_04de: Expected O, but got Unknown //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Unknown result type (might be due to invalid IL or missing references) //IL_044e: Unknown result type (might be due to invalid IL or missing references) //IL_0453: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or mi