Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of KLINE v1.0.0
Mods/KLINE.dll
Decompiled a month agousing System; using System.Collections.Generic; using System.Diagnostics; 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 KLINE; using MelonLoader; using Microsoft.CodeAnalysis; using ScheduleOne; using ScheduleOne.Delivery; using ScheduleOne.DevUtilities; using ScheduleOne.ItemFramework; using ScheduleOne.Money; using ScheduleOne.UI.Phone.Delivery; using Unity.Mathematics; using UnityEngine; 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(KLINEMod), "KLINE", "1.0.0", "Archie", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = "")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: AssemblyCompany("KLINE")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+fbbe99fcf417855fb2d2d175ee40cb7c341364b0")] [assembly: AssemblyProduct("KLINE")] [assembly: AssemblyTitle("KLINE")] [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 KLINE { [HarmonyPatch(typeof(DeliveryApp))] public class DeliveryAppPatch { } [HarmonyPatch(typeof(DeliveryShop))] public class DeliveryShopPatch { private static List<List<StringIntPair>> SplitItemsIntoVehicles(List<StringIntPair> items) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown try { if (items == null) { if (KLINEMod.debugLog) { MelonLogger.Warning("Items list is null in SplitItemsIntoVehicles."); } return new List<List<StringIntPair>>(); } List<List<StringIntPair>> list = new List<List<StringIntPair>>(); List<StringIntPair> list2 = new List<StringIntPair>(); int num = 0; foreach (StringIntPair item2 in items) { ItemDefinition item = Registry.GetItem(item2.String); if ((Object)(object)item == (Object)null) { if (KLINEMod.debugLog) { MelonLogger.Warning("Item definition not found for ID: " + item2.String + "."); } continue; } int num2 = item2.Int; int stackLimit = item.StackLimit; while (num2 > 0) { int num3 = Mathf.Min(num2, stackLimit); int num4 = Mathf.CeilToInt((float)num3 / (float)stackLimit); if (num + num4 > 16) { list.Add(list2); list2 = new List<StringIntPair>(); num = 0; } list2.Add(new StringIntPair(item2.String, num3)); num += num4; num2 -= num3; } } if (list2.Count > 0) { list.Add(list2); } return list; } catch (Exception arg) { if (KLINEMod.debugLog) { MelonLogger.Error($"Error in SplitItemsIntoVehicles: {arg}"); } return new List<List<StringIntPair>>(); } } private static int CalculateVehicleCount(List<ListingEntry> entries) { List<StringIntPair> items = entries.Where((ListingEntry le) => le.SelectedQuantity > 0).Select((Func<ListingEntry, StringIntPair>)((ListingEntry le) => new StringIntPair(((ItemDefinition)le.MatchingListing.Item).ID, le.SelectedQuantity))).ToList(); return math.max(SplitItemsIntoVehicles(items).Count, 1); } [HarmonyPrefix] [HarmonyPatch("WillCartFitInVehicle")] public static bool WillCartFitInVehiclePrefix(ref bool __result) { __result = true; return false; } [HarmonyPrefix] [HarmonyPatch("GetOrderTotal")] public static bool GetOrderTotalPrefix(DeliveryShop __instance, ref float __result) { float cartCost = __instance.GetCartCost(); int num = CalculateVehicleCount(__instance.listingEntries); __result = cartCost + __instance.DeliveryFee * (float)num; return false; } [HarmonyPrefix] [HarmonyPatch("OrderPressed")] public static bool OrderPressedPrefix(DeliveryShop __instance) { //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Expected O, but got Unknown string text = default(string); if (!__instance.CanOrder(ref text)) { if (KLINEMod.debugLog) { MelonLogger.Warning("Cannot order: " + text); } return false; } float orderTotal = __instance.GetOrderTotal(); List<StringIntPair> list = __instance.listingEntries.Where((ListingEntry le) => le.SelectedQuantity > 0).Select((Func<ListingEntry, StringIntPair>)((ListingEntry le) => new StringIntPair(((ItemDefinition)le.MatchingListing.Item).ID, le.SelectedQuantity))).ToList(); int num = list.Sum((StringIntPair i) => i.Int); int num2 = Mathf.RoundToInt(Mathf.Lerp(60f, 360f, Mathf.Clamp01((float)num / 160f))); List<List<StringIntPair>> list2 = SplitItemsIntoVehicles(list); foreach (List<StringIntPair> item in list2) { DeliveryInstance val = new DeliveryInstance(GUIDManager.GenerateUniqueGUID().ToString(), __instance.MatchingShopInterfaceName, __instance.destinationProperty.PropertyCode, __instance.loadingDockIndex - 1, item.ToArray(), (EDeliveryStatus)0, num2); NetworkSingleton<DeliveryManager>.Instance.SendDelivery(val); if (KLINEMod.debugLog) { MelonLogger.Msg($"Created delivery {val.DeliveryID} with {item.Sum((StringIntPair i) => i.Int)} items."); } } NetworkSingleton<MoneyManager>.Instance.CreateOnlineTransaction("Delivery from " + __instance.MatchingShop.ShopName, 0f - orderTotal, 1f, string.Empty); PlayerSingleton<DeliveryApp>.Instance.PlayOrderSubmittedAnim(); __instance.ResetCart(); return false; } [HarmonyPrefix] [HarmonyPatch("RefreshCart")] public static bool RefreshCartPrefix(DeliveryShop __instance) { __instance.ItemTotalLabel.text = MoneyManager.FormatAmount(__instance.GetCartCost(), false, false); __instance.OrderTotalLabel.text = MoneyManager.FormatAmount(__instance.GetOrderTotal(), false, false); int num = CalculateVehicleCount(__instance.listingEntries); float num2 = __instance.DeliveryFee * (float)num; __instance.DeliveryFeeLabel.text = MoneyManager.FormatAmount(num2, false, false); return false; } } [HarmonyPatch(typeof(DeliveryStatusDisplay))] public class DeliveryStatusDisplayPatch { [HarmonyPrefix] [HarmonyPatch("AssignDelivery")] public static bool AssignDeliveryPrefix(DeliveryInstance instance, DeliveryStatusDisplay __instance) { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0197: 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_01df: Unknown result type (might be due to invalid IL or missing references) if (instance == null || (Object)(object)__instance == (Object)null) { return false; } __instance.DeliveryInstance = instance; __instance.DestinationLabel.text = $"{instance.Destination.PropertyName} [{instance.LoadingDockIndex + 1}]"; __instance.ShopLabel.text = instance.StoreName; foreach (Transform item3 in (Transform)__instance.ItemEntryContainer) { Transform val = item3; Object.Destroy((Object)(object)((Component)val).gameObject); } StringIntPair[] array = (from item in instance.Items group item by item.String).Select((Func<IGrouping<string, StringIntPair>, StringIntPair>)((IGrouping<string, StringIntPair> group) => new StringIntPair(group.Key, group.Sum((StringIntPair item) => item.Int)))).ToArray(); StringIntPair[] array2 = array; foreach (StringIntPair val2 in array2) { Transform component = (Transform)(object)Object.Instantiate<GameObject>(__instance.ItemEntryPrefab, (Transform)(object)__instance.ItemEntryContainer).GetComponent<RectTransform>(); ItemDefinition item2 = Registry.GetItem(val2.String); ((Component)component.Find("Label")).GetComponent<Text>().text = $"{val2.Int}x {item2.Name}"; } int num = Mathf.CeilToInt((float)array.Length / 2f); __instance.Rect.sizeDelta = new Vector2(__instance.Rect.sizeDelta.x, (float)(70 + 20 * num)); __instance.RefreshStatus(); if (KLINEMod.debugLog) { MelonLogger.Msg($"Assigned delivery {instance.DeliveryID} with {array.Length} consolidated items, sizeDelta={__instance.Rect.sizeDelta}"); } return false; } } public class KLINEMod : MelonMod { public static readonly bool debugLog; public override void OnInitializeMelon() { try { ((MelonBase)this).HarmonyInstance.PatchAll(); if (debugLog) { MelonLogger.Msg("KLINE loaded!"); } } catch (Exception arg) { MelonLogger.Error($"Failed to initialize KLINE: {arg}"); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }