Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of CarRentals v1.0.0
RentalCars_IL2CPP.dll
Decompiled 15 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppScheduleOne.DevUtilities; using Il2CppScheduleOne.GameTime; using Il2CppScheduleOne.Money; using Il2CppScheduleOne.PlayerScripts; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Phone; using Il2CppScheduleOne.UI.Phone.Messages; using Il2CppScheduleOne.Vehicles; using Il2CppSystem; using MelonLoader; using MelonLoader.Preferences; using RentalCars; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::RentalCars.RentalCars), "Rental Cars", "1.0", "Jumble", null)] [assembly: MelonColor] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("RentalCars_IL2CPP")] [assembly: AssemblyConfiguration("Debug_IL2CPP")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+16752ab825d506ad698363ca3ccf59771a9b2b4b")] [assembly: AssemblyProduct("RentalCars_IL2CPP")] [assembly: AssemblyTitle("RentalCars_IL2CPP")] [assembly: AssemblyVersion("1.0.0.0")] namespace RentalCars; public class RentalCars : MelonMod { internal static RentalCars Instance; private bool _isAppOpen; private bool _appInitialized; private int _selectedVehicleIndex; private Button _appIconButton; private GameObject _appPanel; private Text _cashText; private Text _vehicleText; private Text _rentalText; private Text _statusTextLabel; private Button _prevVehicleButton; private Button _nextVehicleButton; private Button _rentButton; private Button _returnButton; private bool _closeAppsHooked; private Action _closeAppsHandler; private LandVehicle _rentalVehicle; private int _rentalEndsAtMinute = -1; private string _statusText = "Select a vehicle you want to rent."; private const string HomeIconLabel = "Rentals"; private Sprite _embeddedAppIcon; private bool _embeddedIconLoadAttempted; private void ChangeVehicleSelection(int direction) { VehicleManager instance = NetworkSingleton<VehicleManager>.Instance; List<LandVehicle> rentableVehicles = GetRentableVehicles(instance); if (rentableVehicles.Count != 0) { int count = rentableVehicles.Count; _selectedVehicleIndex = (_selectedVehicleIndex + direction + count) % count; RefreshAppContent(); } } private void SelectPreviousVehicle() { ChangeVehicleSelection(-1); } private void SelectNextVehicle() { ChangeVehicleSelection(1); } private void ReturnRentalNow() { EndRental("Rental returned."); } private void RentSelectedVehicle() { if (!TryGetCoreSystems(out var player, out var vehicleManager, out var moneyManager, out var timeManager, out var _)) { return; } List<LandVehicle> rentableVehicles = GetRentableVehicles(vehicleManager); if (rentableVehicles != null && rentableVehicles.Count != 0) { if (_selectedVehicleIndex < 0 || _selectedVehicleIndex >= rentableVehicles.Count) { _selectedVehicleIndex = 0; } LandVehicle val = rentableVehicles[_selectedVehicleIndex]; if (!((Object)(object)val == (Object)null)) { float fee = CalculateRentalFee(val); RentVehicle(val, player, vehicleManager, moneyManager, timeManager, fee); RefreshAppContent(); } } } private void RefreshAppContent() { if ((Object)(object)_cashText == (Object)null || (Object)(object)_vehicleText == (Object)null || (Object)(object)_rentalText == (Object)null || (Object)(object)_statusTextLabel == (Object)null || !TryGetCoreSystems(out var _, out var vehicleManager, out var moneyManager, out var timeManager, out var _)) { return; } _cashText.text = $"Bank: ${moneyManager.onlineBalance:0.00}"; List<LandVehicle> rentableVehicles = GetRentableVehicles(vehicleManager); if (rentableVehicles == null || rentableVehicles.Count == 0) { _vehicleText.text = "No rentable vehicles found."; ((Selectable)_rentButton).interactable = false; ((Selectable)_prevVehicleButton).interactable = false; ((Selectable)_nextVehicleButton).interactable = false; } else { if (_selectedVehicleIndex < 0 || _selectedVehicleIndex >= rentableVehicles.Count) { _selectedVehicleIndex = 0; } LandVehicle val = rentableVehicles[_selectedVehicleIndex]; float num = (((Object)(object)val != (Object)null) ? CalculateRentalFee(val) : 0f); _vehicleText.text = (((Object)(object)val == (Object)null) ? "Vehicle unavailable" : $"{GetVehicleDisplayName(val)} ({_selectedVehicleIndex + 1}/{rentableVehicles.Count}) - ${num:0.00}"); ((Selectable)_rentButton).interactable = (Object)(object)val != (Object)null && (Object)(object)_rentalVehicle == (Object)null && moneyManager.onlineBalance >= num; ((Selectable)_prevVehicleButton).interactable = rentableVehicles.Count > 1; ((Selectable)_nextVehicleButton).interactable = rentableVehicles.Count > 1; } if ((Object)(object)_rentalVehicle != (Object)null && _rentalEndsAtMinute >= 0) { int value = Mathf.Max(0, _rentalEndsAtMinute - timeManager.GetTotalMinSum()); _rentalText.text = $"Active rental: {GetVehicleDisplayName(_rentalVehicle)} ({value} min left)"; ((Selectable)_returnButton).interactable = true; } else { _rentalText.text = "Active rental: none"; ((Selectable)_returnButton).interactable = false; } _statusTextLabel.text = _statusText ?? string.Empty; } private static List<LandVehicle> GetRentableVehicles(VehicleManager vehicleManager) { List<LandVehicle> list = new List<LandVehicle>(); if (((vehicleManager != null) ? vehicleManager.VehiclePrefabs : null) == null) { return list; } bool flag = false; bool flag2 = false; for (int i = 0; i < vehicleManager.VehiclePrefabs.Count; i++) { LandVehicle val = vehicleManager.VehiclePrefabs[i]; if ((Object)(object)val == (Object)null) { continue; } string vehicleDisplayName = GetVehicleDisplayName(val); if (string.Equals(vehicleDisplayName, "Shitbox", StringComparison.OrdinalIgnoreCase)) { if (flag) { continue; } flag = true; } else if (string.Equals(vehicleDisplayName, "Bruiser", StringComparison.OrdinalIgnoreCase)) { if (flag2) { continue; } flag2 = true; } list.Add(val); } return list; } private static float CalculateRentalFee(LandVehicle vehicle) { float num = Mathf.Max(1f, vehicle.VehiclePrice); float num2 = num * Mathf.Max(0.01f, Config.RentalCostMultiplier); return Mathf.Max(new float[3] { 1f, Config.MinimumRentalFee, num2 }); } private static string GetVehicleDisplayName(LandVehicle vehicle) { if ((Object)(object)vehicle == (Object)null) { return "Unknown"; } if (!string.IsNullOrWhiteSpace(vehicle.VehicleName)) { return vehicle.VehicleName; } if (!string.IsNullOrWhiteSpace(vehicle.VehicleCode)) { return vehicle.VehicleCode; } return "Vehicle"; } private void RentVehicle(LandVehicle vehiclePrefab, Player player, VehicleManager vehicleManager, MoneyManager moneyManager, TimeManager timeManager, float fee) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rentalVehicle != (Object)null) { _statusText = "You already have an active rental."; return; } if (moneyManager.onlineBalance < fee) { _statusText = "Not enough bank balance for this rental."; return; } if (string.IsNullOrWhiteSpace(vehiclePrefab.VehicleCode)) { _statusText = "Vehicle cannot be rented (invalid vehicle code)."; return; } Vector3 val = ((Component)player).transform.position + ((Component)player).transform.forward * 5f + Vector3.up * 0.5f; Quaternion val2 = Quaternion.Euler(0f, ((Component)player).transform.eulerAngles.y, 0f); LandVehicle val3 = vehicleManager.SpawnAndReturnVehicle(vehiclePrefab.VehicleCode, val, val2, true); if ((Object)(object)val3 == (Object)null) { _statusText = "Failed to spawn rental vehicle."; return; } moneyManager.CreateOnlineTransaction("Vehicle rental", 0f - fee, 1f, GetVehicleDisplayName(val3)); _rentalVehicle = val3; float num = Mathf.Max(1f, Config.RentalDurationHours * 60f); _rentalEndsAtMinute = timeManager.GetTotalMinSum() + Mathf.RoundToInt(num); _statusText = $"Rented {GetVehicleDisplayName(val3)} for ${fee:0.00}."; RefreshAppContent(); } private void CheckRentalExpiry() { if (!((Object)(object)_rentalVehicle == (Object)null) && _rentalEndsAtMinute >= 0) { TimeManager instance = NetworkSingleton<TimeManager>.Instance; if (!((Object)(object)instance == (Object)null) && instance.GetTotalMinSum() >= _rentalEndsAtMinute) { EndRental("Rental time is up."); } } } private void EndRental(string reason) { if ((Object)(object)_rentalVehicle != (Object)null) { try { _rentalVehicle.DestroyVehicle(); } catch { } } _rentalVehicle = null; _rentalEndsAtMinute = -1; _statusText = reason; RefreshAppContent(); } public override void OnInitializeMelon() { Instance = this; Config.Load(); } public override void OnUpdate() { if (!Config.Enabled) { CloseApp(); return; } EnsurePhoneAppRegistered(); if ((Object)(object)_appIconButton != (Object)null) { ApplyIconVisualFixes(((Component)_appIconButton).transform, "Rentals"); } HookPhoneCloseApps(); if (!TryGetCoreSystems(out var _, out var _, out var _, out var _, out var _)) { return; } CheckRentalExpiry(); if (_isAppOpen) { if (!IsPhoneOpen()) { CloseApp(); } else { RefreshAppContent(); } } } private static bool TryGetCoreSystems(out Player player, out VehicleManager vehicleManager, out MoneyManager moneyManager, out TimeManager timeManager, out Phone phone) { player = Player.Local; vehicleManager = NetworkSingleton<VehicleManager>.Instance; moneyManager = NetworkSingleton<MoneyManager>.Instance; timeManager = NetworkSingleton<TimeManager>.Instance; phone = PlayerSingleton<Phone>.Instance; return (Object)(object)player != (Object)null && (Object)(object)vehicleManager != (Object)null && (Object)(object)moneyManager != (Object)null && (Object)(object)timeManager != (Object)null && (Object)(object)phone != (Object)null; } private static bool IsPhoneOpen() { return (Object)(object)PlayerSingleton<Phone>.Instance != (Object)null && PlayerSingleton<Phone>.Instance.IsOpen; } private static void SetIconLabelTexts(Transform root, string shortLabel, string fullName) { if ((Object)(object)root == (Object)null) { return; } Il2CppArrayBase<Component> componentsInChildren = ((Component)root).GetComponentsInChildren<Component>(true); for (int i = 0; i < componentsInChildren.Length; i++) { Component val = componentsInChildren[i]; if ((Object)(object)val == (Object)null) { continue; } Text val2 = (Text)(object)((val is Text) ? val : null); if (val2 != null) { if (string.IsNullOrWhiteSpace(val2.text) || string.Equals(val2.text, "Name", StringComparison.OrdinalIgnoreCase)) { val2.text = shortLabel; } continue; } PropertyInfo property = ((object)val).GetType().GetProperty("text"); if ((object)property == null || !property.CanWrite || property.PropertyType != typeof(string)) { continue; } try { string text = property.GetValue(val) as string; if (string.IsNullOrWhiteSpace(text) || string.Equals(text, "Name", StringComparison.OrdinalIgnoreCase)) { property.SetValue(val, shortLabel); } else if (string.Equals(text, fullName, StringComparison.OrdinalIgnoreCase)) { property.SetValue(val, fullName); } } catch { } } } private void ApplyEmbeddedIcon(Transform iconRoot) { Sprite embeddedAppIconSprite = GetEmbeddedAppIconSprite(); if ((Object)(object)embeddedAppIconSprite == (Object)null || (Object)(object)iconRoot == (Object)null) { return; } Transform val = FindDescendantByName(iconRoot, "Image"); if (!((Object)(object)val == (Object)null)) { Image component = ((Component)val).GetComponent<Image>(); if (!((Object)(object)component == (Object)null)) { component.sprite = embeddedAppIconSprite; component.preserveAspect = true; } } } private Sprite GetEmbeddedAppIconSprite() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_0140: 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) if ((Object)(object)_embeddedAppIcon != (Object)null) { return _embeddedAppIcon; } if (_embeddedIconLoadAttempted) { return null; } _embeddedIconLoadAttempted = true; try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); string text = null; foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("Assets.AppIcon.png", StringComparison.OrdinalIgnoreCase) || text2.EndsWith("AppIcon.png", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { return null; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); byte[] array = memoryStream.ToArray(); if (array == null || array.Length == 0) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array), false)) { return null; } _embeddedAppIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); return _embeddedAppIcon; } catch (Exception ex) { MelonLogger.Warning("Failed to load embedded AppIcon.png: " + ex.Message); return null; } } private static Transform FindBestAppIconsContainer(Transform root) { Transform best = null; int bestChildCount = -1; CollectBestAppIconsContainer(root, ref best, ref bestChildCount); return best; } private static void CollectBestAppIconsContainer(Transform node, ref Transform best, ref int bestChildCount) { if ((Object)(object)node == (Object)null) { return; } if (string.Equals(((Object)node).name, "AppIcons", StringComparison.Ordinal)) { int childCount = node.childCount; if (childCount > bestChildCount) { best = node; bestChildCount = childCount; } } for (int i = 0; i < node.childCount; i++) { CollectBestAppIconsContainer(node.GetChild(i), ref best, ref bestChildCount); } } private static Transform FindDescendantByName(Transform root, string targetName) { if ((Object)(object)root == (Object)null) { return null; } if (string.Equals(((Object)root).name, targetName, StringComparison.Ordinal)) { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = FindDescendantByName(root.GetChild(i), targetName); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static void ApplyIconVisualFixes(Transform root, string labelText) { if ((Object)(object)root == (Object)null) { return; } Transform val = FindDescendantByName(root, "Notifications"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } Transform val2 = FindDescendantByName(root, "NotificationContainer") ?? FindDescendantByName(root, "notificationContainer"); if ((Object)(object)val2 != (Object)null) { Text componentInChildren = ((Component)val2).GetComponentInChildren<Text>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = string.Empty; } ((Component)val2).gameObject.SetActive(false); } Transform val3 = FindDescendantByName(root, "NotificationText") ?? FindDescendantByName(root, "notificationText"); if ((Object)(object)val3 != (Object)null) { Text component = ((Component)val3).GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.text = string.Empty; } ((Component)val3).gameObject.SetActive(false); } Transform val4 = FindDescendantByName(root, "Label"); Text val5 = (((Object)(object)val4 != (Object)null) ? ((Component)val4).GetComponent<Text>() : null); if (!((Object)(object)val5 == (Object)null)) { if (!string.Equals(val5.text, labelText, StringComparison.Ordinal)) { val5.text = labelText; } ((Graphic)val5).SetLayoutDirty(); ((Graphic)val5).SetVerticesDirty(); Canvas.ForceUpdateCanvases(); RectTransform rectTransform = ((Graphic)val5).rectTransform; if ((Object)(object)rectTransform != (Object)null) { LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform); } } } private void EnsurePhoneAppRegistered() { //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Expected O, but got Unknown //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0547: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_0584: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05d7: Unknown result type (might be due to invalid IL or missing references) //IL_0623: Unknown result type (might be due to invalid IL or missing references) //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_0649: Unknown result type (might be due to invalid IL or missing references) //IL_0695: Unknown result type (might be due to invalid IL or missing references) //IL_06a4: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_0707: Unknown result type (might be due to invalid IL or missing references) //IL_0716: Unknown result type (might be due to invalid IL or missing references) //IL_072d: Unknown result type (might be due to invalid IL or missing references) //IL_0778: Unknown result type (might be due to invalid IL or missing references) //IL_0787: Unknown result type (might be due to invalid IL or missing references) //IL_0797: Unknown result type (might be due to invalid IL or missing references) if (_appInitialized) { return; } HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; AppsCanvas instance2 = PlayerSingleton<AppsCanvas>.Instance; MessagesApp instance3 = PlayerSingleton<MessagesApp>.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance2 == (Object)null) && !((Object)(object)instance.appIconPrefab == (Object)null) && !((Object)(object)instance.appIconContainer == (Object)null) && !((Object)(object)instance2.canvas == (Object)null)) { Transform val = (Transform)(((object)FindBestAppIconsContainer(((Component)instance).transform)) ?? ((object)instance.appIconContainer)); GameObject val2 = Object.Instantiate<GameObject>(instance.appIconPrefab, val); ((Object)val2).name = "Rental Cars"; _appIconButton = val2.GetComponent<Button>() ?? val2.AddComponent<Button>(); ((UnityEventBase)_appIconButton.onClick).RemoveAllListeners(); ((UnityEvent)_appIconButton.onClick).AddListener(ToUnityAction(OpenApp)); SetIconLabelTexts(val2.transform, "Rentals", "Rental Cars"); ApplyEmbeddedIcon(val2.transform); ApplyIconVisualFixes(val2.transform, "Rentals"); _appPanel = new GameObject("RentalCarsPanel"); _appPanel.AddComponent<RectTransform>(); _appPanel.AddComponent<Image>(); RectTransform component = _appPanel.GetComponent<RectTransform>(); RectTransform val3 = (((Object)(object)instance3 != (Object)null) ? ((App<MessagesApp>)(object)instance3).appContainer : null); if ((Object)(object)val3 != (Object)null) { ((Transform)component).SetParent(((Transform)val3).parent, false); component.anchorMin = val3.anchorMin; component.anchorMax = val3.anchorMax; component.pivot = val3.pivot; component.anchoredPosition = val3.anchoredPosition; component.sizeDelta = val3.sizeDelta; ((Transform)component).localScale = ((Transform)val3).localScale; ((Transform)component).localRotation = ((Transform)val3).localRotation; } else { ((Transform)component).SetParent(((Component)instance2.canvas).transform, false); component.anchorMin = new Vector2(0.18f, 0.04f); component.anchorMax = new Vector2(0.82f, 0.96f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } Image component2 = _appPanel.GetComponent<Image>(); component2.sprite = null; ((Graphic)component2).material = null; component2.type = (Type)0; ((Graphic)component2).color = new Color(0.07f, 0.09f, 0.12f, 0.98f); Text val4 = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponentInChildren<Text>(true) : null); Font font = (((Object)(object)val4 != (Object)null) ? val4.font : (((Object)(object)instance.timeText != (Object)null) ? instance.timeText.font : Resources.GetBuiltinResource<Font>("Arial.ttf"))); Color white = Color.white; Button val5 = null; if ((Object)(object)instance3 != (Object)null && instance3.CategoryButtons != null && ((Il2CppArrayBase<Button>)(object)instance3.CategoryButtons).Count > 0) { val5 = ((Il2CppArrayBase<Button>)(object)instance3.CategoryButtons)[0]; } if ((Object)(object)val5 == (Object)null && (Object)(object)instance3 != (Object)null && (Object)(object)instance3.ClearFilterButton != (Object)null) { val5 = ((Component)instance3.ClearFilterButton).GetComponent<Button>(); } Text val6 = CreateText("Title", _appPanel.transform, font, "Rental Cars", 24, (TextAnchor)1); ((Graphic)val6).color = white; ((Graphic)val6).rectTransform.anchorMin = new Vector2(0.08f, 0.9f); ((Graphic)val6).rectTransform.anchorMax = new Vector2(0.92f, 0.98f); _cashText = CreateText("Cash", _appPanel.transform, font, string.Empty, 18, (TextAnchor)3); ((Graphic)_cashText).color = white; ((Graphic)_cashText).rectTransform.anchorMin = new Vector2(0.08f, 0.82f); ((Graphic)_cashText).rectTransform.anchorMax = new Vector2(0.92f, 0.89f); _vehicleText = CreateText("Vehicle", _appPanel.transform, font, string.Empty, 40, (TextAnchor)4); ((Graphic)_vehicleText).color = white; ((Graphic)_vehicleText).rectTransform.anchorMin = new Vector2(0.08f, 0.68f); ((Graphic)_vehicleText).rectTransform.anchorMax = new Vector2(0.92f, 0.8f); _rentalText = CreateText("Rental", _appPanel.transform, font, string.Empty, 32, (TextAnchor)4); ((Graphic)_rentalText).color = white; ((Graphic)_rentalText).rectTransform.anchorMin = new Vector2(0.08f, 0.6f); ((Graphic)_rentalText).rectTransform.anchorMax = new Vector2(0.92f, 0.67f); _statusTextLabel = CreateText("Status", _appPanel.transform, font, string.Empty, 32, (TextAnchor)0); ((Graphic)_statusTextLabel).color = white; ((Graphic)_statusTextLabel).rectTransform.anchorMin = new Vector2(0.08f, 0.31f); ((Graphic)_statusTextLabel).rectTransform.anchorMax = new Vector2(0.92f, 0.58f); _prevVehicleButton = CreateButton("PrevButton", _appPanel.transform, font, "<", new Vector2(0.08f, 0.23f), new Vector2(0.24f, 0.3f)); ApplyButtonStyle(_prevVehicleButton, val5, white); ((UnityEvent)_prevVehicleButton.onClick).AddListener(ToUnityAction(SelectPreviousVehicle)); _nextVehicleButton = CreateButton("NextButton", _appPanel.transform, font, ">", new Vector2(0.76f, 0.23f), new Vector2(0.92f, 0.3f)); ApplyButtonStyle(_nextVehicleButton, val5, white); ((UnityEvent)_nextVehicleButton.onClick).AddListener(ToUnityAction(SelectNextVehicle)); _rentButton = CreateButton("RentButton", _appPanel.transform, font, "Rent", new Vector2(0.27f, 0.23f), new Vector2(0.73f, 0.3f)); ApplyButtonStyle(_rentButton, val5, white); ((UnityEvent)_rentButton.onClick).AddListener(ToUnityAction(RentSelectedVehicle)); _returnButton = CreateButton("ReturnButton", _appPanel.transform, font, "Return Rental", new Vector2(0.16f, 0.14f), new Vector2(0.84f, 0.21f)); ApplyButtonStyle(_returnButton, val5, white); ((UnityEvent)_returnButton.onClick).AddListener(ToUnityAction(ReturnRentalNow)); Button val7 = CreateButton("CloseButton", _appPanel.transform, font, "Close", new Vector2(0.16f, 0.05f), new Vector2(0.84f, 0.12f)); ApplyButtonStyle(val7, val5, white); ((UnityEvent)val7.onClick).AddListener(ToUnityAction(CloseApp)); _appPanel.SetActive(false); _appInitialized = true; RefreshAppContent(); } } private void HookPhoneCloseApps() { if (!_closeAppsHooked && !((Object)(object)PlayerSingleton<Phone>.Instance == (Object)null)) { _closeAppsHandler = DelegateSupport.ConvertDelegate<Action>((Delegate)new Action(OnPhoneCloseAppsRequested)); Phone instance = PlayerSingleton<Phone>.Instance; instance.closeApps += _closeAppsHandler; _closeAppsHooked = true; } } private void OnPhoneCloseAppsRequested() { if (_isAppOpen) { CloseApp(); } } private static Text CreateText(string name, Transform parent, Font font, string value, int fontSize, TextAnchor alignment) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.AddComponent<RectTransform>(); val.AddComponent<Text>(); Text component = val.GetComponent<Text>(); val.transform.SetParent(parent, false); component.font = font; component.text = value; component.fontSize = fontSize; component.alignment = alignment; ((Graphic)component).color = Color.white; component.horizontalOverflow = (HorizontalWrapMode)0; component.verticalOverflow = (VerticalWrapMode)1; return component; } private static Button CreateButton(string name, Transform parent, Font font, string label, Vector2 anchorMin, Vector2 anchorMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.AddComponent<RectTransform>(); val.AddComponent<Image>(); val.AddComponent<Button>(); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = new Color(0.18f, 0.22f, 0.28f, 0.98f); component2.type = (Type)0; Text val2 = CreateText("Label", val.transform, font, label, 14, (TextAnchor)4); ((Graphic)val2).rectTransform.anchorMin = Vector2.zero; ((Graphic)val2).rectTransform.anchorMax = Vector2.one; ((Graphic)val2).rectTransform.offsetMin = Vector2.zero; ((Graphic)val2).rectTransform.offsetMax = Vector2.zero; return val.GetComponent<Button>(); } private static void ApplyButtonStyle(Button target, Button template, Color fallbackTextColor) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } Image component = ((Component)target).GetComponent<Image>(); Text componentInChildren = ((Component)target).GetComponentInChildren<Text>(true); if ((Object)(object)template != (Object)null) { ((Selectable)target).transition = ((Selectable)template).transition; ((Selectable)target).colors = ((Selectable)template).colors; ((Selectable)target).spriteState = ((Selectable)template).spriteState; Image component2 = ((Component)template).GetComponent<Image>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component != (Object)null) { component.sprite = null; ((Graphic)component).material = null; component.type = (Type)0; ((Graphic)component).color = new Color(0.18f, 0.22f, 0.28f, 0.98f); } Text componentInChildren2 = ((Component)template).GetComponentInChildren<Text>(true); if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)componentInChildren != (Object)null) { componentInChildren.font = componentInChildren2.font; componentInChildren.fontSize = componentInChildren2.fontSize; ((Graphic)componentInChildren).color = fallbackTextColor; } else if ((Object)(object)componentInChildren != (Object)null) { ((Graphic)componentInChildren).color = fallbackTextColor; } } else { if ((Object)(object)component != (Object)null) { component.sprite = null; ((Graphic)component).material = null; component.type = (Type)0; ((Graphic)component).color = new Color(0.18f, 0.22f, 0.28f, 0.98f); } if ((Object)(object)componentInChildren != (Object)null) { ((Graphic)componentInChildren).color = fallbackTextColor; } } } private static UnityAction ToUnityAction(Action action) { return DelegateSupport.ConvertDelegate<UnityAction>((Delegate)action); } private void OpenApp() { if (!((Object)(object)_appPanel == (Object)null)) { _isAppOpen = true; _appPanel.SetActive(true); HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; AppsCanvas instance2 = PlayerSingleton<AppsCanvas>.Instance; if (instance != null) { instance.SetIsOpen(false); } if (instance2 != null) { instance2.SetIsOpen(true); } RefreshAppContent(); } } private void CloseApp() { _isAppOpen = false; GameObject appPanel = _appPanel; if (appPanel != null) { appPanel.SetActive(false); } HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; AppsCanvas instance2 = PlayerSingleton<AppsCanvas>.Instance; if (instance != null) { instance.SetIsOpen(true); } if (instance2 != null) { instance2.SetIsOpen(false); } } } public static class BuildInfo { public const string Name = "Rental Cars"; public const string Description = "Rent cars temporarily through a phone app."; public const string Author = "Jumble"; public const string Company = null; public const string Version = "1.0"; public const string DownloadLink = null; } public static class Config { private static MelonPreferences_Category configCategory; private static MelonPreferences_Entry<bool> enabledEntry; private static MelonPreferences_Entry<float> rentalDurationHoursEntry; private static MelonPreferences_Entry<float> rentalCostMultiplierEntry; private static MelonPreferences_Entry<float> minimumRentalFeeEntry; public static bool Enabled => enabledEntry?.Value ?? true; public static float RentalDurationHours => rentalDurationHoursEntry?.Value ?? 10f; public static float RentalCostMultiplier => rentalCostMultiplierEntry?.Value ?? 0.08f; public static float MinimumRentalFee => minimumRentalFeeEntry?.Value ?? 50f; public static void Load() { configCategory = MelonPreferences.CreateCategory("RentalCars"); enabledEntry = configCategory.CreateEntry<bool>("enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); rentalDurationHoursEntry = configCategory.CreateEntry<float>("rentalDurationHours", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); rentalCostMultiplierEntry = configCategory.CreateEntry<float>("rentalCostMultiplier", 0.08f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); minimumRentalFeeEntry = configCategory.CreateEntry<float>("minimumRentalFee", 50f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); } }
RentalCars_Mono.dll
Decompiled 15 hours agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using MelonLoader; using MelonLoader.Preferences; using RentalCars; using ScheduleOne.DevUtilities; using ScheduleOne.GameTime; using ScheduleOne.Money; using ScheduleOne.PlayerScripts; using ScheduleOne.UI.Phone; using ScheduleOne.UI.Phone.Messages; using ScheduleOne.Vehicles; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(global::RentalCars.RentalCars), "Rental Cars", "1.0", "Jumble", null)] [assembly: MelonColor] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("RentalCars_Mono")] [assembly: AssemblyConfiguration("Debug_Mono")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+16752ab825d506ad698363ca3ccf59771a9b2b4b")] [assembly: AssemblyProduct("RentalCars_Mono")] [assembly: AssemblyTitle("RentalCars_Mono")] [assembly: AssemblyVersion("1.0.0.0")] namespace RentalCars; public class RentalCars : MelonMod { internal static RentalCars Instance; private bool _isAppOpen; private bool _appInitialized; private int _selectedVehicleIndex; private Button _appIconButton; private GameObject _appPanel; private Text _cashText; private Text _vehicleText; private Text _rentalText; private Text _statusTextLabel; private Button _prevVehicleButton; private Button _nextVehicleButton; private Button _rentButton; private Button _returnButton; private bool _closeAppsHooked; private Action _closeAppsHandler; private LandVehicle _rentalVehicle; private int _rentalEndsAtMinute = -1; private string _statusText = "Select a vehicle you want to rent."; private const string HomeIconLabel = "Rentals"; private Sprite _embeddedAppIcon; private bool _embeddedIconLoadAttempted; private void ChangeVehicleSelection(int direction) { VehicleManager instance = NetworkSingleton<VehicleManager>.Instance; List<LandVehicle> rentableVehicles = GetRentableVehicles(instance); if (rentableVehicles.Count != 0) { int count = rentableVehicles.Count; _selectedVehicleIndex = (_selectedVehicleIndex + direction + count) % count; RefreshAppContent(); } } private void SelectPreviousVehicle() { ChangeVehicleSelection(-1); } private void SelectNextVehicle() { ChangeVehicleSelection(1); } private void ReturnRentalNow() { EndRental("Rental returned."); } private void RentSelectedVehicle() { if (!TryGetCoreSystems(out var player, out var vehicleManager, out var moneyManager, out var timeManager, out var _)) { return; } List<LandVehicle> rentableVehicles = GetRentableVehicles(vehicleManager); if (rentableVehicles != null && rentableVehicles.Count != 0) { if (_selectedVehicleIndex < 0 || _selectedVehicleIndex >= rentableVehicles.Count) { _selectedVehicleIndex = 0; } LandVehicle val = rentableVehicles[_selectedVehicleIndex]; if (!((Object)(object)val == (Object)null)) { float fee = CalculateRentalFee(val); RentVehicle(val, player, vehicleManager, moneyManager, timeManager, fee); RefreshAppContent(); } } } private void RefreshAppContent() { if ((Object)(object)_cashText == (Object)null || (Object)(object)_vehicleText == (Object)null || (Object)(object)_rentalText == (Object)null || (Object)(object)_statusTextLabel == (Object)null || !TryGetCoreSystems(out var _, out var vehicleManager, out var moneyManager, out var timeManager, out var _)) { return; } _cashText.text = $"Bank: ${moneyManager.onlineBalance:0.00}"; List<LandVehicle> rentableVehicles = GetRentableVehicles(vehicleManager); if (rentableVehicles == null || rentableVehicles.Count == 0) { _vehicleText.text = "No rentable vehicles found."; ((Selectable)_rentButton).interactable = false; ((Selectable)_prevVehicleButton).interactable = false; ((Selectable)_nextVehicleButton).interactable = false; } else { if (_selectedVehicleIndex < 0 || _selectedVehicleIndex >= rentableVehicles.Count) { _selectedVehicleIndex = 0; } LandVehicle val = rentableVehicles[_selectedVehicleIndex]; float num = (((Object)(object)val != (Object)null) ? CalculateRentalFee(val) : 0f); _vehicleText.text = (((Object)(object)val == (Object)null) ? "Vehicle unavailable" : $"{GetVehicleDisplayName(val)} ({_selectedVehicleIndex + 1}/{rentableVehicles.Count}) - ${num:0.00}"); ((Selectable)_rentButton).interactable = (Object)(object)val != (Object)null && (Object)(object)_rentalVehicle == (Object)null && moneyManager.onlineBalance >= num; ((Selectable)_prevVehicleButton).interactable = rentableVehicles.Count > 1; ((Selectable)_nextVehicleButton).interactable = rentableVehicles.Count > 1; } if ((Object)(object)_rentalVehicle != (Object)null && _rentalEndsAtMinute >= 0) { int num2 = Mathf.Max(0, _rentalEndsAtMinute - timeManager.GetTotalMinSum()); _rentalText.text = $"Active rental: {GetVehicleDisplayName(_rentalVehicle)} ({num2} min left)"; ((Selectable)_returnButton).interactable = true; } else { _rentalText.text = "Active rental: none"; ((Selectable)_returnButton).interactable = false; } _statusTextLabel.text = _statusText ?? string.Empty; } private static List<LandVehicle> GetRentableVehicles(VehicleManager vehicleManager) { List<LandVehicle> list = new List<LandVehicle>(); if (vehicleManager?.VehiclePrefabs == null) { return list; } bool flag = false; bool flag2 = false; for (int i = 0; i < vehicleManager.VehiclePrefabs.Count; i++) { LandVehicle val = vehicleManager.VehiclePrefabs[i]; if ((Object)(object)val == (Object)null) { continue; } string vehicleDisplayName = GetVehicleDisplayName(val); if (string.Equals(vehicleDisplayName, "Shitbox", StringComparison.OrdinalIgnoreCase)) { if (flag) { continue; } flag = true; } else if (string.Equals(vehicleDisplayName, "Bruiser", StringComparison.OrdinalIgnoreCase)) { if (flag2) { continue; } flag2 = true; } list.Add(val); } return list; } private static float CalculateRentalFee(LandVehicle vehicle) { float num = Mathf.Max(1f, vehicle.VehiclePrice); float num2 = num * Mathf.Max(0.01f, Config.RentalCostMultiplier); return Mathf.Max(new float[3] { 1f, Config.MinimumRentalFee, num2 }); } private static string GetVehicleDisplayName(LandVehicle vehicle) { if ((Object)(object)vehicle == (Object)null) { return "Unknown"; } if (!string.IsNullOrWhiteSpace(vehicle.VehicleName)) { return vehicle.VehicleName; } if (!string.IsNullOrWhiteSpace(vehicle.VehicleCode)) { return vehicle.VehicleCode; } return "Vehicle"; } private void RentVehicle(LandVehicle vehiclePrefab, Player player, VehicleManager vehicleManager, MoneyManager moneyManager, TimeManager timeManager, float fee) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_rentalVehicle != (Object)null) { _statusText = "You already have an active rental."; return; } if (moneyManager.onlineBalance < fee) { _statusText = "Not enough bank balance for this rental."; return; } if (string.IsNullOrWhiteSpace(vehiclePrefab.VehicleCode)) { _statusText = "Vehicle cannot be rented (invalid vehicle code)."; return; } Vector3 val = ((Component)player).transform.position + ((Component)player).transform.forward * 5f + Vector3.up * 0.5f; Quaternion val2 = Quaternion.Euler(0f, ((Component)player).transform.eulerAngles.y, 0f); LandVehicle val3 = vehicleManager.SpawnAndReturnVehicle(vehiclePrefab.VehicleCode, val, val2, true); if ((Object)(object)val3 == (Object)null) { _statusText = "Failed to spawn rental vehicle."; return; } moneyManager.CreateOnlineTransaction("Vehicle rental", 0f - fee, 1f, GetVehicleDisplayName(val3)); _rentalVehicle = val3; float num = Mathf.Max(1f, Config.RentalDurationHours * 60f); _rentalEndsAtMinute = timeManager.GetTotalMinSum() + Mathf.RoundToInt(num); _statusText = $"Rented {GetVehicleDisplayName(val3)} for ${fee:0.00}."; RefreshAppContent(); } private void CheckRentalExpiry() { if (!((Object)(object)_rentalVehicle == (Object)null) && _rentalEndsAtMinute >= 0) { TimeManager instance = NetworkSingleton<TimeManager>.Instance; if (!((Object)(object)instance == (Object)null) && instance.GetTotalMinSum() >= _rentalEndsAtMinute) { EndRental("Rental time is up."); } } } private void EndRental(string reason) { if ((Object)(object)_rentalVehicle != (Object)null) { try { _rentalVehicle.DestroyVehicle(); } catch { } } _rentalVehicle = null; _rentalEndsAtMinute = -1; _statusText = reason; RefreshAppContent(); } public override void OnInitializeMelon() { Instance = this; Config.Load(); } public override void OnUpdate() { if (!Config.Enabled) { CloseApp(); return; } EnsurePhoneAppRegistered(); if ((Object)(object)_appIconButton != (Object)null) { ApplyIconVisualFixes(((Component)_appIconButton).transform, "Rentals"); } HookPhoneCloseApps(); if (!TryGetCoreSystems(out var _, out var _, out var _, out var _, out var _)) { return; } CheckRentalExpiry(); if (_isAppOpen) { if (!IsPhoneOpen()) { CloseApp(); } else { RefreshAppContent(); } } } private static bool TryGetCoreSystems(out Player player, out VehicleManager vehicleManager, out MoneyManager moneyManager, out TimeManager timeManager, out Phone phone) { player = Player.Local; vehicleManager = NetworkSingleton<VehicleManager>.Instance; moneyManager = NetworkSingleton<MoneyManager>.Instance; timeManager = NetworkSingleton<TimeManager>.Instance; phone = PlayerSingleton<Phone>.Instance; return (Object)(object)player != (Object)null && (Object)(object)vehicleManager != (Object)null && (Object)(object)moneyManager != (Object)null && (Object)(object)timeManager != (Object)null && (Object)(object)phone != (Object)null; } private static bool IsPhoneOpen() { return (Object)(object)PlayerSingleton<Phone>.Instance != (Object)null && PlayerSingleton<Phone>.Instance.IsOpen; } private static void SetIconLabelTexts(Transform root, string shortLabel, string fullName) { if ((Object)(object)root == (Object)null) { return; } Component[] componentsInChildren = ((Component)root).GetComponentsInChildren<Component>(true); foreach (Component val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } Text val2 = (Text)(object)((val is Text) ? val : null); if (val2 != null) { if (string.IsNullOrWhiteSpace(val2.text) || string.Equals(val2.text, "Name", StringComparison.OrdinalIgnoreCase)) { val2.text = shortLabel; } continue; } PropertyInfo property = ((object)val).GetType().GetProperty("text"); if ((object)property == null || !property.CanWrite || property.PropertyType != typeof(string)) { continue; } try { string text = property.GetValue(val) as string; if (string.IsNullOrWhiteSpace(text) || string.Equals(text, "Name", StringComparison.OrdinalIgnoreCase)) { property.SetValue(val, shortLabel); } else if (string.Equals(text, fullName, StringComparison.OrdinalIgnoreCase)) { property.SetValue(val, fullName); } } catch { } } } private void ApplyEmbeddedIcon(Transform iconRoot) { Sprite embeddedAppIconSprite = GetEmbeddedAppIconSprite(); if ((Object)(object)embeddedAppIconSprite == (Object)null || (Object)(object)iconRoot == (Object)null) { return; } Transform val = FindDescendantByName(iconRoot, "Image"); if (!((Object)(object)val == (Object)null)) { Image component = ((Component)val).GetComponent<Image>(); if (!((Object)(object)component == (Object)null)) { component.sprite = embeddedAppIconSprite; component.preserveAspect = true; } } } private Sprite GetEmbeddedAppIconSprite() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_embeddedAppIcon != (Object)null) { return _embeddedAppIcon; } if (_embeddedIconLoadAttempted) { return null; } _embeddedIconLoadAttempted = true; try { Assembly executingAssembly = Assembly.GetExecutingAssembly(); string[] manifestResourceNames = executingAssembly.GetManifestResourceNames(); string text = null; foreach (string text2 in manifestResourceNames) { if (text2.EndsWith("Assets.AppIcon.png", StringComparison.OrdinalIgnoreCase) || text2.EndsWith("AppIcon.png", StringComparison.OrdinalIgnoreCase)) { text = text2; break; } } if (string.IsNullOrEmpty(text)) { return null; } using Stream stream = executingAssembly.GetManifestResourceStream(text); if (stream == null) { return null; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); byte[] array = memoryStream.ToArray(); if (array == null || array.Length == 0) { return null; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, array, false)) { return null; } _embeddedAppIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f); return _embeddedAppIcon; } catch (Exception ex) { MelonLogger.Warning("Failed to load embedded AppIcon.png: " + ex.Message); return null; } } private static Transform FindBestAppIconsContainer(Transform root) { Transform best = null; int bestChildCount = -1; CollectBestAppIconsContainer(root, ref best, ref bestChildCount); return best; } private static void CollectBestAppIconsContainer(Transform node, ref Transform best, ref int bestChildCount) { if ((Object)(object)node == (Object)null) { return; } if (string.Equals(((Object)node).name, "AppIcons", StringComparison.Ordinal)) { int childCount = node.childCount; if (childCount > bestChildCount) { best = node; bestChildCount = childCount; } } for (int i = 0; i < node.childCount; i++) { CollectBestAppIconsContainer(node.GetChild(i), ref best, ref bestChildCount); } } private static Transform FindDescendantByName(Transform root, string targetName) { if ((Object)(object)root == (Object)null) { return null; } if (string.Equals(((Object)root).name, targetName, StringComparison.Ordinal)) { return root; } for (int i = 0; i < root.childCount; i++) { Transform val = FindDescendantByName(root.GetChild(i), targetName); if ((Object)(object)val != (Object)null) { return val; } } return null; } private static void ApplyIconVisualFixes(Transform root, string labelText) { if ((Object)(object)root == (Object)null) { return; } Transform val = FindDescendantByName(root, "Notifications"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.SetActive(false); } Transform val2 = FindDescendantByName(root, "NotificationContainer") ?? FindDescendantByName(root, "notificationContainer"); if ((Object)(object)val2 != (Object)null) { Text componentInChildren = ((Component)val2).GetComponentInChildren<Text>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.text = string.Empty; } ((Component)val2).gameObject.SetActive(false); } Transform val3 = FindDescendantByName(root, "NotificationText") ?? FindDescendantByName(root, "notificationText"); if ((Object)(object)val3 != (Object)null) { Text component = ((Component)val3).GetComponent<Text>(); if ((Object)(object)component != (Object)null) { component.text = string.Empty; } ((Component)val3).gameObject.SetActive(false); } Transform val4 = FindDescendantByName(root, "Label"); Text val5 = (((Object)(object)val4 != (Object)null) ? ((Component)val4).GetComponent<Text>() : null); if (!((Object)(object)val5 == (Object)null)) { if (!string.Equals(val5.text, labelText, StringComparison.Ordinal)) { val5.text = labelText; } ((Graphic)val5).SetLayoutDirty(); ((Graphic)val5).SetVerticesDirty(); Canvas.ForceUpdateCanvases(); RectTransform rectTransform = ((Graphic)val5).rectTransform; if ((Object)(object)rectTransform != (Object)null) { LayoutRebuilder.ForceRebuildLayoutImmediate(rectTransform); } } } private void EnsurePhoneAppRegistered() { //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Expected O, but got Unknown //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_017e: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02de: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_0329: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Unknown result type (might be due to invalid IL or missing references) //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_042b: Unknown result type (might be due to invalid IL or missing references) //IL_0461: Unknown result type (might be due to invalid IL or missing references) //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Unknown result type (might be due to invalid IL or missing references) //IL_04d4: Unknown result type (might be due to invalid IL or missing references) //IL_04f1: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Unknown result type (might be due to invalid IL or missing references) //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Unknown result type (might be due to invalid IL or missing references) //IL_0622: Unknown result type (might be due to invalid IL or missing references) //IL_0631: Unknown result type (might be due to invalid IL or missing references) //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_0694: Unknown result type (might be due to invalid IL or missing references) //IL_06a3: Unknown result type (might be due to invalid IL or missing references) //IL_06ba: Unknown result type (might be due to invalid IL or missing references) //IL_0705: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_0724: Unknown result type (might be due to invalid IL or missing references) if (_appInitialized) { return; } HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; AppsCanvas instance2 = PlayerSingleton<AppsCanvas>.Instance; MessagesApp instance3 = PlayerSingleton<MessagesApp>.Instance; GameObject homeScreenAppIconPrefab = GetHomeScreenAppIconPrefab(instance); Transform homeScreenAppIconContainer = GetHomeScreenAppIconContainer(instance); if (!((Object)(object)instance == (Object)null) && !((Object)(object)instance2 == (Object)null) && !((Object)(object)homeScreenAppIconPrefab == (Object)null) && !((Object)(object)homeScreenAppIconContainer == (Object)null) && !((Object)(object)instance2.canvas == (Object)null)) { Transform val = FindBestAppIconsContainer(((Component)instance).transform) ?? homeScreenAppIconContainer; GameObject val2 = Object.Instantiate<GameObject>(homeScreenAppIconPrefab, val); ((Object)val2).name = "Rental Cars"; _appIconButton = val2.GetComponent<Button>() ?? val2.AddComponent<Button>(); ((UnityEventBase)_appIconButton.onClick).RemoveAllListeners(); ((UnityEvent)_appIconButton.onClick).AddListener(ToUnityAction(OpenApp)); SetIconLabelTexts(val2.transform, "Rentals", "Rental Cars"); ApplyEmbeddedIcon(val2.transform); ApplyIconVisualFixes(val2.transform, "Rentals"); _appPanel = new GameObject("RentalCarsPanel"); _appPanel.AddComponent<RectTransform>(); _appPanel.AddComponent<Image>(); RectTransform component = _appPanel.GetComponent<RectTransform>(); RectTransform messagesAppContainer = GetMessagesAppContainer(instance3); if ((Object)(object)messagesAppContainer != (Object)null) { ((Transform)component).SetParent(((Transform)messagesAppContainer).parent, false); component.anchorMin = messagesAppContainer.anchorMin; component.anchorMax = messagesAppContainer.anchorMax; component.pivot = messagesAppContainer.pivot; component.anchoredPosition = messagesAppContainer.anchoredPosition; component.sizeDelta = messagesAppContainer.sizeDelta; ((Transform)component).localScale = ((Transform)messagesAppContainer).localScale; ((Transform)component).localRotation = ((Transform)messagesAppContainer).localRotation; } else { ((Transform)component).SetParent(((Component)instance2.canvas).transform, false); component.anchorMin = new Vector2(0.18f, 0.04f); component.anchorMax = new Vector2(0.82f, 0.96f); component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; } Image component2 = _appPanel.GetComponent<Image>(); component2.sprite = null; ((Graphic)component2).material = null; component2.type = (Type)0; ((Graphic)component2).color = new Color(0.07f, 0.09f, 0.12f, 0.98f); Text val3 = (((Object)(object)messagesAppContainer != (Object)null) ? ((Component)messagesAppContainer).GetComponentInChildren<Text>(true) : null); Font font = (((Object)(object)val3 != (Object)null) ? val3.font : (((Object)(object)GetHomeScreenTimeText(instance) != (Object)null) ? GetHomeScreenTimeText(instance).font : Resources.GetBuiltinResource<Font>("Arial.ttf"))); Color white = Color.white; Button templateButton = GetTemplateButton(instance3); Text val4 = CreateText("Title", _appPanel.transform, font, "Rental Cars", 24, (TextAnchor)1); ((Graphic)val4).color = white; ((Graphic)val4).rectTransform.anchorMin = new Vector2(0.08f, 0.9f); ((Graphic)val4).rectTransform.anchorMax = new Vector2(0.92f, 0.98f); _cashText = CreateText("Cash", _appPanel.transform, font, string.Empty, 18, (TextAnchor)3); ((Graphic)_cashText).color = white; ((Graphic)_cashText).rectTransform.anchorMin = new Vector2(0.08f, 0.82f); ((Graphic)_cashText).rectTransform.anchorMax = new Vector2(0.92f, 0.89f); _vehicleText = CreateText("Vehicle", _appPanel.transform, font, string.Empty, 40, (TextAnchor)4); ((Graphic)_vehicleText).color = white; ((Graphic)_vehicleText).rectTransform.anchorMin = new Vector2(0.08f, 0.68f); ((Graphic)_vehicleText).rectTransform.anchorMax = new Vector2(0.92f, 0.8f); _rentalText = CreateText("Rental", _appPanel.transform, font, string.Empty, 32, (TextAnchor)4); ((Graphic)_rentalText).color = white; ((Graphic)_rentalText).rectTransform.anchorMin = new Vector2(0.08f, 0.6f); ((Graphic)_rentalText).rectTransform.anchorMax = new Vector2(0.92f, 0.67f); _statusTextLabel = CreateText("Status", _appPanel.transform, font, string.Empty, 32, (TextAnchor)0); ((Graphic)_statusTextLabel).color = white; ((Graphic)_statusTextLabel).rectTransform.anchorMin = new Vector2(0.08f, 0.31f); ((Graphic)_statusTextLabel).rectTransform.anchorMax = new Vector2(0.92f, 0.58f); _prevVehicleButton = CreateButton("PrevButton", _appPanel.transform, font, "<", new Vector2(0.08f, 0.23f), new Vector2(0.24f, 0.3f)); ApplyButtonStyle(_prevVehicleButton, templateButton, white); ((UnityEvent)_prevVehicleButton.onClick).AddListener(ToUnityAction(SelectPreviousVehicle)); _nextVehicleButton = CreateButton("NextButton", _appPanel.transform, font, ">", new Vector2(0.76f, 0.23f), new Vector2(0.92f, 0.3f)); ApplyButtonStyle(_nextVehicleButton, templateButton, white); ((UnityEvent)_nextVehicleButton.onClick).AddListener(ToUnityAction(SelectNextVehicle)); _rentButton = CreateButton("RentButton", _appPanel.transform, font, "Rent", new Vector2(0.27f, 0.23f), new Vector2(0.73f, 0.3f)); ApplyButtonStyle(_rentButton, templateButton, white); ((UnityEvent)_rentButton.onClick).AddListener(ToUnityAction(RentSelectedVehicle)); _returnButton = CreateButton("ReturnButton", _appPanel.transform, font, "Return Rental", new Vector2(0.16f, 0.14f), new Vector2(0.84f, 0.21f)); ApplyButtonStyle(_returnButton, templateButton, white); ((UnityEvent)_returnButton.onClick).AddListener(ToUnityAction(ReturnRentalNow)); Button val5 = CreateButton("CloseButton", _appPanel.transform, font, "Close", new Vector2(0.16f, 0.05f), new Vector2(0.84f, 0.12f)); ApplyButtonStyle(val5, templateButton, white); ((UnityEvent)val5.onClick).AddListener(ToUnityAction(CloseApp)); _appPanel.SetActive(false); _appInitialized = true; RefreshAppContent(); } } private static GameObject GetHomeScreenAppIconPrefab(HomeScreen homeScreen) { if ((Object)(object)homeScreen == (Object)null) { return null; } return GetMemberValue<GameObject>(homeScreen, "appIconPrefab"); } private static Transform GetHomeScreenAppIconContainer(HomeScreen homeScreen) { if ((Object)(object)homeScreen == (Object)null) { return null; } return GetMemberValue<Transform>(homeScreen, "appIconContainer"); } private static RectTransform GetMessagesAppContainer(MessagesApp messagesApp) { if ((Object)(object)messagesApp == (Object)null) { return null; } return GetMemberValue<RectTransform>(messagesApp, "appContainer"); } private static Text GetHomeScreenTimeText(HomeScreen homeScreen) { if ((Object)(object)homeScreen == (Object)null) { return null; } return GetMemberValue<Text>(homeScreen, "timeText"); } private static Button GetTemplateButton(MessagesApp messagesApp) { if ((Object)(object)messagesApp == (Object)null) { return null; } object memberValue = GetMemberValue<object>(messagesApp, "CategoryButtons"); if (memberValue is IList list && list.Count > 0) { object obj = list[0]; Button val = (Button)((obj is Button) ? obj : null); if (val != null) { return val; } } object memberValue2 = GetMemberValue<object>(messagesApp, "ClearFilterButton"); Component val2 = (Component)((memberValue2 is Component) ? memberValue2 : null); if (val2 != null) { return val2.GetComponent<Button>(); } return null; } private static T GetMemberValue<T>(object instance, string memberName) where T : class { if (instance == null || string.IsNullOrEmpty(memberName)) { return null; } Type type = instance.GetType(); BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic; FieldInfo field = type.GetField(memberName, bindingAttr); if (field != null) { return field.GetValue(instance) as T; } PropertyInfo property = type.GetProperty(memberName, bindingAttr); if (property != null) { return property.GetValue(instance, null) as T; } return null; } private void HookPhoneCloseApps() { if (!_closeAppsHooked && !((Object)(object)PlayerSingleton<Phone>.Instance == (Object)null)) { _closeAppsHandler = OnPhoneCloseAppsRequested; Phone instance = PlayerSingleton<Phone>.Instance; instance.closeApps = (Action)Delegate.Combine(instance.closeApps, _closeAppsHandler); _closeAppsHooked = true; } } private void OnPhoneCloseAppsRequested() { if (_isAppOpen) { CloseApp(); } } private static Text CreateText(string name, Transform parent, Font font, string value, int fontSize, TextAnchor alignment) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.AddComponent<RectTransform>(); val.AddComponent<Text>(); Text component = val.GetComponent<Text>(); val.transform.SetParent(parent, false); component.font = font; component.text = value; component.fontSize = fontSize; component.alignment = alignment; ((Graphic)component).color = Color.white; component.horizontalOverflow = (HorizontalWrapMode)0; component.verticalOverflow = (VerticalWrapMode)1; return component; } private static Button CreateButton(string name, Transform parent, Font font, string label, Vector2 anchorMin, Vector2 anchorMax) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.AddComponent<RectTransform>(); val.AddComponent<Image>(); val.AddComponent<Button>(); val.transform.SetParent(parent, false); RectTransform component = val.GetComponent<RectTransform>(); component.anchorMin = anchorMin; component.anchorMax = anchorMax; component.offsetMin = Vector2.zero; component.offsetMax = Vector2.zero; Image component2 = val.GetComponent<Image>(); ((Graphic)component2).color = new Color(0.18f, 0.22f, 0.28f, 0.98f); component2.type = (Type)0; Text val2 = CreateText("Label", val.transform, font, label, 14, (TextAnchor)4); ((Graphic)val2).rectTransform.anchorMin = Vector2.zero; ((Graphic)val2).rectTransform.anchorMax = Vector2.one; ((Graphic)val2).rectTransform.offsetMin = Vector2.zero; ((Graphic)val2).rectTransform.offsetMax = Vector2.zero; return val.GetComponent<Button>(); } private static void ApplyButtonStyle(Button target, Button template, Color fallbackTextColor) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)target == (Object)null) { return; } Image component = ((Component)target).GetComponent<Image>(); Text componentInChildren = ((Component)target).GetComponentInChildren<Text>(true); if ((Object)(object)template != (Object)null) { ((Selectable)target).transition = ((Selectable)template).transition; ((Selectable)target).colors = ((Selectable)template).colors; ((Selectable)target).spriteState = ((Selectable)template).spriteState; Image component2 = ((Component)template).GetComponent<Image>(); if ((Object)(object)component2 != (Object)null && (Object)(object)component != (Object)null) { component.sprite = null; ((Graphic)component).material = null; component.type = (Type)0; ((Graphic)component).color = new Color(0.18f, 0.22f, 0.28f, 0.98f); } Text componentInChildren2 = ((Component)template).GetComponentInChildren<Text>(true); if ((Object)(object)componentInChildren2 != (Object)null && (Object)(object)componentInChildren != (Object)null) { componentInChildren.font = componentInChildren2.font; componentInChildren.fontSize = componentInChildren2.fontSize; ((Graphic)componentInChildren).color = fallbackTextColor; } else if ((Object)(object)componentInChildren != (Object)null) { ((Graphic)componentInChildren).color = fallbackTextColor; } } else { if ((Object)(object)component != (Object)null) { component.sprite = null; ((Graphic)component).material = null; component.type = (Type)0; ((Graphic)component).color = new Color(0.18f, 0.22f, 0.28f, 0.98f); } if ((Object)(object)componentInChildren != (Object)null) { ((Graphic)componentInChildren).color = fallbackTextColor; } } } private static UnityAction ToUnityAction(Action action) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown return new UnityAction(action.Invoke); } private void OpenApp() { if (!((Object)(object)_appPanel == (Object)null)) { _isAppOpen = true; _appPanel.SetActive(true); HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; AppsCanvas instance2 = PlayerSingleton<AppsCanvas>.Instance; if (instance != null) { instance.SetIsOpen(false); } if (instance2 != null) { instance2.SetIsOpen(true); } RefreshAppContent(); } } private void CloseApp() { _isAppOpen = false; GameObject appPanel = _appPanel; if (appPanel != null) { appPanel.SetActive(false); } HomeScreen instance = PlayerSingleton<HomeScreen>.Instance; AppsCanvas instance2 = PlayerSingleton<AppsCanvas>.Instance; if (instance != null) { instance.SetIsOpen(true); } if (instance2 != null) { instance2.SetIsOpen(false); } } } public static class BuildInfo { public const string Name = "Rental Cars"; public const string Description = "Rent cars temporarily through a phone app."; public const string Author = "Jumble"; public const string Company = null; public const string Version = "1.0"; public const string DownloadLink = null; } public static class Config { private static MelonPreferences_Category configCategory; private static MelonPreferences_Entry<bool> enabledEntry; private static MelonPreferences_Entry<float> rentalDurationHoursEntry; private static MelonPreferences_Entry<float> rentalCostMultiplierEntry; private static MelonPreferences_Entry<float> minimumRentalFeeEntry; public static bool Enabled => enabledEntry?.Value ?? true; public static float RentalDurationHours => rentalDurationHoursEntry?.Value ?? 10f; public static float RentalCostMultiplier => rentalCostMultiplierEntry?.Value ?? 0.08f; public static float MinimumRentalFee => minimumRentalFeeEntry?.Value ?? 50f; public static void Load() { configCategory = MelonPreferences.CreateCategory("RentalCars"); enabledEntry = configCategory.CreateEntry<bool>("enabled", true, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); rentalDurationHoursEntry = configCategory.CreateEntry<float>("rentalDurationHours", 10f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); rentalCostMultiplierEntry = configCategory.CreateEntry<float>("rentalCostMultiplier", 0.08f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); minimumRentalFeeEntry = configCategory.CreateEntry<float>("minimumRentalFee", 50f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null); } }