Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of CartelInfluenceEnhanced v0.3.0
CartelInfluenceEnhancements.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using HarmonyLib; using Il2CppScheduleOne.Cartel; using Il2CppScheduleOne.Economy; using Il2CppScheduleOne.ItemFramework; using Il2CppScheduleOne.Map; using Il2CppScheduleOne.Quests; using Il2CppScheduleOne.UI; using Il2CppScheduleOne.UI.Handover; using Il2CppScheduleOne.UI.Phone.ContactsApp; using Il2CppSystem; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using Schedule1_CartelInfluenceEnhancements; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(CartelInfluenceEnhancements), "CartelInfluenceEnhancements", "0.3.0", "TheHypnoticFox", null)] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: MelonAuthorColor(255, 44, 128, 27)] [assembly: MelonColor(255, 129, 37, 221)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("CartelInfluenceEnhancements")] [assembly: AssemblyConfiguration("IL2CPP")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CartelInfluenceEnhancements")] [assembly: AssemblyTitle("CartelInfluenceEnhancements")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace Schedule1_CartelInfluenceEnhancements { public class CartelInfluenceEnhancements : MelonMod { [HarmonyPatch(typeof(Customer), "ProcessHandover")] private static class ProcessHandoverPatch { public static void Prefix(Customer __instance, EHandoverOutcome outcome, Contract contract, List<ItemInstance> items, bool handoverByPlayer, bool giveBonuses = true) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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) try { Cartel cartelInstance = GetCartelInstance(); if (cartelInstance == null) { Melon<CartelInfluenceEnhancements>.Logger.Error("cartel instance is null"); } else if ((int)outcome == 1) { CartelInfluence influence = cartelInstance.Influence; EMapRegion region; if (handoverByPlayer) { Instance logger = Melon<CartelInfluenceEnhancements>.Logger; region = __instance.NPC.Region; logger.Msg("Player completed a Deal inside " + ((object)(EMapRegion)(ref region)).ToString() + " region!"); influence.ChangeInfluence(__instance.NPC.Region, 0f - InfluenceChangePerCompletedPlayerDeal.Value / 1000f); } else { Instance logger2 = Melon<CartelInfluenceEnhancements>.Logger; region = __instance.NPC.Region; logger2.Msg("Dealer completed a Deal inside " + ((object)(EMapRegion)(ref region)).ToString() + " region!"); influence.ChangeInfluence(__instance.NPC.Region, 0f - InfluenceChangePerCompletedDealerDeal.Value / 1000f); } } } catch (Exception ex) { Melon<CartelInfluenceEnhancements>.Logger.Error("Failed to execute ProcessHandover patch: " + ex.Message, ex); } } } [HarmonyPatch(typeof(CartelInfluenceChangePopup), "Show")] private static class CartelInfluenceChangePopupShowPatch { public static bool Prefix(EMapRegion region, float oldInfluence, float newInfluence) { return MathF.Abs(oldInfluence - newInfluence) > InfluenceChangePerCompletedDealerDeal.Value / 1000f + 1E-05f; } } [HarmonyPatch(typeof(CartelInfluenceChangePopup), "SetDisplayedInfluence")] private static class CartelInfluenceChangeSetDisplayedInfluencePopupPatch { public static void Postfix(CartelInfluenceChangePopup __instance, float influence) { try { ((TMP_Text)__instance.InfluenceCountLabel).text = Math.Round((double)(influence * 1000f), NumberOfDecimalPlaces.Value).ToString(CultureInfo.CurrentCulture) + " / 1000"; } catch (Exception ex) { Melon<CartelInfluenceEnhancements>.Logger.Error("Failed to execute SetDisplayedInfluence patch: " + ex.Message, ex); } } } [HarmonyPatch(typeof(ContactsApp), "SetSelectedRegion")] private static class ContactsAppPatch { public static void Postfix(ContactsApp __instance, EMapRegion region) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) try { Cartel cartelInstance = GetCartelInstance(); if (cartelInstance == null) { Melon<CartelInfluenceEnhancements>.Logger.Error("cartel instance is null"); } else { __instance.InfluenceCountLabel.text = Math.Round((double)(cartelInstance.Influence.GetInfluence(region) * 1000f), NumberOfDecimalPlaces.Value).ToString(CultureInfo.CurrentCulture) + " / 1000"; } } catch (Exception ex) { Melon<CartelInfluenceEnhancements>.Logger.Error("Failed to execute SetSelectedRegion patch: " + ex.Message, ex); } } } public const string TestedVersion = "0.4.0f9"; public static MelonPreferences_Category? PlayerSettingsCategory; public static MelonPreferences_Category? DealerSettingsCategory; public static MelonPreferences_Category? DisplaySettingsCategory; public static MelonPreferences_Entry<float> InfluenceChangePerCompletedPlayerDeal; public static MelonPreferences_Entry<float> InfluenceChangePerCompletedDealerDeal; public static MelonPreferences_Entry<int> NumberOfDecimalPlaces; private static Cartel? _cartelInstance; public override void OnInitializeMelon() { PlayerSettingsCategory = MelonPreferences.CreateCategory("CartelInfluenceEnhancements_01_Player", "Player Settings"); DealerSettingsCategory = MelonPreferences.CreateCategory("CartelInfluenceEnhancements_02_Dealer", "Dealer Settings"); DisplaySettingsCategory = MelonPreferences.CreateCategory("CartelInfluenceEnhancements_03_Display", "Display Settings"); InfluenceChangePerCompletedPlayerDeal = PlayerSettingsCategory.CreateEntry<float>("InfluenceChangePerCompletedPlayerDeal", 2.5f, "Influence change per completed player deal", "Influence change per completed player deal", false, false, (ValueValidator)null, (string)null); InfluenceChangePerCompletedDealerDeal = DealerSettingsCategory.CreateEntry<float>("InfluenceChangePerCompletedDealerDeal", 1f, "Influence change per completed dealer deal", "Influence change per completed dealer deal", false, false, (ValueValidator)null, (string)null); NumberOfDecimalPlaces = DisplaySettingsCategory.CreateEntry<int>("InfluenceNumberOfDecimalPlaces", 1, "Influence: Number of decimal places displayed", "Influence: Number of decimal places displayed", false, false, (ValueValidator)(object)new ValueRange<int>(0, 5), (string)null); ((MelonBase)this).LoggerInstance.Msg("Cartel Influence Enhancements initialized"); ((MelonBase)this).LoggerInstance.Msg("Tested on Schedule I version \"0.4.0f9\""); } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { try { GetCartelInstance(); } catch (Exception ex) { Melon<CartelInfluenceEnhancements>.Logger.Error("Something went wrong when the scene loaded: " + ex.Message, ex); throw; } } private static Cartel? GetCartelInstance() { if (_cartelInstance != null) { return _cartelInstance; } GameObject obj = GameObject.Find("@Cartel"); _cartelInstance = ((obj != null) ? obj.GetComponent<Cartel>() : null); return _cartelInstance; } public override void OnSceneWasUnloaded(int buildIndex, string sceneName) { _cartelInstance = null; } } }