Some mods target the Mono version of the game, which is available by opting into the Steam beta branch "alternate"
Decompiled source of FeeningNPCs MONO v1.3.0
FeeningNPCs.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using FeeningNPCs; using FishNet.Connection; using FishNet.Object; using HarmonyLib; using MelonLoader; using MelonLoader.Utils; using Newtonsoft.Json; using ScheduleOne.DevUtilities; using ScheduleOne.Economy; using ScheduleOne.ItemFramework; using ScheduleOne.Levelling; using ScheduleOne.Money; using ScheduleOne.NPCs; using ScheduleOne.NPCs.Behaviour; using ScheduleOne.Persistence; using ScheduleOne.PlayerScripts; using ScheduleOne.Quests; using ScheduleOne.UI; using ScheduleOne.UI.Handover; using ScheduleOne.UI.MainMenu; using ScheduleOne.VoiceOver; using UnityEngine; using UnityEngine.Events; [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::FeeningNPCs.FeeningNPCs), "FeeningNPCs", "1.3.0", "XOWithSauce", null)] [assembly: MelonColor] [assembly: MelonOptionalDependencies(new string[] { "FishNet.Runtime" })] [assembly: MelonGame("TVGS", "Schedule I")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("FeeningNPCs")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FeeningNPCs")] [assembly: AssemblyTitle("FeeningNPCs")] [assembly: AssemblyVersion("1.0.0.0")] namespace FeeningNPCs; public static class BuildInfo { public const string Name = "FeeningNPCs"; public const string Description = "Your customers need more... and more.... AND MORE!!! HELP ME BRO YOU GOT SOME MORE??!!"; public const string Author = "XOWithSauce"; public const string Company = null; public const string Version = "1.3.0"; public const string DownloadLink = null; } [Serializable] public class ModConfig { public int maxFeensStack = 3; public int feeningTreshold = 50; public int feensClearThreshold = 1440; public int feeningRadius = 30; public bool randomEffects = true; public bool increaseEconomy = true; public int economyMultiplier = 10; public bool ignoreExistingDeals = false; public bool randomBonus = true; public float randomBonusChance = 0.3f; public bool persistEconomy = true; } [Serializable] public class CustomerEconomy { public string CustomerID = "defaultFeen"; public float MinWeeklySpend = 200f; public float MaxWeeklySpend = 500f; public int MinOrdersPerWeek = 1; public int MaxOrdersPerWeek = 5; } [Serializable] public class SaveEconomy { public List<CustomerEconomy> customers = new List<CustomerEconomy>(); } public static class ConfigLoader { private static string path = Path.Combine(MelonEnvironment.ModsDirectory, "FeeningNPCs", "config.json"); private static string pathEcon = Path.Combine(MelonEnvironment.ModsDirectory, "FeeningNPCs", "Economy"); public static ModConfig Load() { ModConfig modConfig; if (File.Exists(path)) { try { string text = File.ReadAllText(path); modConfig = JsonConvert.DeserializeObject<ModConfig>(text); } catch (Exception ex) { modConfig = new ModConfig(); MelonLogger.Warning("Failed to read FeeningNPCs config: " + ex); } } else { modConfig = new ModConfig(); Save(modConfig); } return modConfig; } public static void Save(ModConfig config) { try { string contents = JsonConvert.SerializeObject((object)config); Directory.CreateDirectory(Path.GetDirectoryName(path)); File.WriteAllText(path, contents); } catch (Exception ex) { MelonLogger.Warning("Failed to save FeeningNPCs config: " + ex); } } public static string SanitizeAndFormatName(string orgName) { string text = orgName; if (text != null) { text = text.Replace(" ", "_").ToLower(); text = text.Replace(",", ""); text = text.Replace(".", ""); text = text.Replace("<", ""); text = text.Replace(">", ""); text = text.Replace(":", ""); text = text.Replace("\"", ""); text = text.Replace("/", ""); text = text.Replace("\\", ""); text = text.Replace("|", ""); text = text.Replace("?", ""); text = text.Replace("*", ""); } return text + ".json"; } public static SaveEconomy LoadEconomy(Customer[] cmers) { SaveEconomy saveEconomy = new SaveEconomy(); saveEconomy.customers = new List<CustomerEconomy>(); string orgName = Singleton<LoadManager>.Instance.ActiveSaveInfo?.OrganisationName; string path = SanitizeAndFormatName(orgName); if (File.Exists(Path.Combine(pathEcon, path))) { try { string text = File.ReadAllText(Path.Combine(pathEcon, path)); saveEconomy = JsonConvert.DeserializeObject<SaveEconomy>(text); foreach (Customer c in cmers) { CustomerEconomy customerEconomy = saveEconomy.customers.FirstOrDefault((CustomerEconomy econC) => econC.CustomerID == c.NPC.ID); c.CustomerData.MinWeeklySpend = customerEconomy.MinWeeklySpend; c.CustomerData.MaxWeeklySpend = customerEconomy.MaxWeeklySpend; c.CustomerData.MinOrdersPerWeek = customerEconomy.MinOrdersPerWeek; c.CustomerData.MaxOrdersPerWeek = customerEconomy.MaxOrdersPerWeek; } } catch (Exception ex) { saveEconomy = new SaveEconomy(); MelonLogger.Warning("Failed to read SaveEconomy config: " + ex); } } else { saveEconomy = GenerateEconomyState(cmers); Save(cmers, saveEconomy); } return saveEconomy; } public static void Save(Customer[] cmers, SaveEconomy config) { try { config = ApplyEconomyState(cmers, config); string orgName = Singleton<LoadManager>.Instance.ActiveSaveInfo?.OrganisationName; string path = SanitizeAndFormatName(orgName); string text = Path.Combine(pathEcon, path); string contents = JsonConvert.SerializeObject((object)config, (Formatting)1); Directory.CreateDirectory(Path.GetDirectoryName(text)); File.WriteAllText(text, contents); } catch (Exception ex) { MelonLogger.Warning("Failed to save SaveEconomy config: " + ex); } } public static SaveEconomy GenerateEconomyState(Customer[] cmers) { SaveEconomy saveEconomy = new SaveEconomy(); foreach (Customer val in cmers) { CustomerEconomy customerEconomy = new CustomerEconomy(); customerEconomy.CustomerID = val.NPC.ID; customerEconomy.MinWeeklySpend = val.CustomerData.MinWeeklySpend; customerEconomy.MaxWeeklySpend = val.CustomerData.MaxWeeklySpend; customerEconomy.MinOrdersPerWeek = val.CustomerData.MinOrdersPerWeek; customerEconomy.MaxOrdersPerWeek = val.CustomerData.MaxOrdersPerWeek; saveEconomy.customers.Add(customerEconomy); } return saveEconomy; } public static SaveEconomy ApplyEconomyState(Customer[] cmers, SaveEconomy econ) { foreach (Customer c in cmers) { CustomerEconomy customerEconomy = econ.customers.FirstOrDefault((CustomerEconomy econC) => econC.CustomerID == c.NPC.ID); customerEconomy.MinWeeklySpend = c.CustomerData.MinWeeklySpend; customerEconomy.MaxWeeklySpend = c.CustomerData.MaxWeeklySpend; customerEconomy.MinOrdersPerWeek = c.CustomerData.MinOrdersPerWeek; customerEconomy.MaxOrdersPerWeek = c.CustomerData.MaxOrdersPerWeek; } return econ; } } public class FeeningNPCs : MelonMod { [HarmonyPatch(typeof(LoadManager), "ExitToMenu")] public static class LoadManager_ExitToMenu_Patch { public static bool Prefix(SaveInfo autoLoadSave = null, Data mainMenuPopup = null, bool preventLeaveLobby = false) { if (currentConfig.persistEconomy) { ConfigLoader.Save(Instance.cmers, currentEconomy); } lastSaveLoad = false; ExitPreTask(); return true; } } [HarmonyPatch(typeof(DeathScreen), "LoadSaveClicked")] public static class DeathScreen_LoadSaveClicked_Patch { public static bool Prefix(DeathScreen __instance) { lastSaveLoad = true; ExitPreTask(); return true; } } [HarmonyPatch(typeof(Customer), "ProcessHandover")] public static class Customer_ProcessHandover_Patch { public static bool Prefix(Customer __instance, EHandoverOutcome outcome, Contract contract, List<ItemInstance> items, bool handoverByPlayer, bool giveBonuses = true) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) coros.Add(MelonCoroutines.Start(PreProcessHandover(__instance, handoverByPlayer))); coros.Add(MelonCoroutines.Start(PreProcessBonuses(__instance, outcome, contract, handoverByPlayer))); return true; } } [CompilerGenerated] private sealed class <ChangeBehv>d__26 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public FeeningNPCs <>4__this; private Player <player>5__1; private List<Customer> <nearbyCustomers>5__2; private Customer[] <>s__3; private int <>s__4; private Customer <c>5__5; private string <currentBehavior>5__6; private Exception <ex>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ChangeBehv>d__26(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <player>5__1 = null; <nearbyCustomers>5__2 = null; <>s__3 = null; <c>5__5 = null; <currentBehavior>5__6 = null; <ex>5__7 = null; <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(5f); <>1__state = 1; return true; case 1: <>1__state = -1; goto IL_0050; case 2: { <>1__state = -1; if (!registered) { return false; } try { <player>5__1 = Player.Local; <nearbyCustomers>5__2 = new List<Customer>(); <>s__3 = <>4__this.cmers; for (<>s__4 = 0; <>s__4 < <>s__3.Length; <>s__4++) { <c>5__5 = <>s__3[<>s__4]; if ((currentConfig.ignoreExistingDeals || !((Object)(object)<c>5__5.CurrentContract != (Object)null)) && !((Object)(object)<c>5__5 == (Object)null)) { Customer obj = <c>5__5; if (!((Object)(object)((obj != null) ? obj.NPC : null) == (Object)null)) { NPC nPC = <c>5__5.NPC; if (!((Object)(object)((nPC != null) ? ((Component)nPC).transform : null) == (Object)null) && !(Vector3.Distance(((Component)<c>5__5.NPC).transform.position, ((Component)<player>5__1).transform.position) > (float)currentConfig.feeningRadius)) { <currentBehavior>5__6 = ""; if ((Object)(object)<c>5__5.NPC.Behaviour.activeBehaviour != (Object)null) { <currentBehavior>5__6 = ((object)<c>5__5.NPC.Behaviour.activeBehaviour).ToString(); } if (!<currentBehavior>5__6.Contains("Request product from player") && !feens.Contains(<c>5__5) && <c>5__5.NPC.RelationData.Unlocked && !<c>5__5.NPC.Health.IsKnockedOut && !<c>5__5.NPC.Health.IsDead && <c>5__5.NPC.Movement.CanMove()) { <nearbyCustomers>5__2.Add(<c>5__5); if (<nearbyCustomers>5__2.Count >= currentConfig.maxFeensStack) { break; } } <currentBehavior>5__6 = null; <c>5__5 = null; } } } } <>s__3 = null; if (<nearbyCustomers>5__2.Count > 0) { coros.Add(MelonCoroutines.Start(<>4__this.SetFeening(<nearbyCustomers>5__2, <player>5__1))); } <player>5__1 = null; <nearbyCustomers>5__2 = null; } catch (Exception ex) { <ex>5__7 = ex; MelonLogger.Error("Feening NPCs caught an error: " + <ex>5__7); } goto IL_0050; } IL_0050: <>2__current = (object)new WaitForSeconds((float)Random.Range(currentConfig.feeningTreshold, currentConfig.feeningTreshold * 2)); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ChangeCustomerEconomy>d__22 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Customer c; public FeeningNPCs <>4__this; private int <roll>5__1; private int <currMult>5__2; private int <>s__3; private int <baseMax>5__4; private int <current>5__5; private int <max>5__6; private int <result>5__7; private int <baseMax>5__8; private int <current>5__9; private int <result>5__10; private float <baseMax>5__11; private float <current>5__12; private float <result>5__13; private float <baseMax>5__14; private float <current>5__15; private float <max>5__16; private float <result>5__17; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ChangeCustomerEconomy>d__22(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <roll>5__1 = Random.Range(0, 4); <currMult>5__2 = 1; if (currentConfig.economyMultiplier >= 1 && currentConfig.economyMultiplier <= 10) { <currMult>5__2 = currentConfig.economyMultiplier; } int num = <roll>5__1; <>s__3 = num; switch (<>s__3) { case 0: if (!(Random.Range(0f, 1f) > 0.5f)) { <baseMax>5__4 = 4 * <currMult>5__2; <current>5__5 = c.CustomerData.MinOrdersPerWeek; <max>5__6 = c.CustomerData.MaxOrdersPerWeek; <result>5__7 = <current>5__5 + 1; if (<current>5__5 < <baseMax>5__4 && <result>5__7 < <max>5__6) { c.CustomerData.MinOrdersPerWeek = <result>5__7; } } break; case 1: if (!(Random.Range(0f, 1f) > 0.5f)) { <baseMax>5__8 = 7 * <currMult>5__2; <current>5__9 = c.CustomerData.MaxOrdersPerWeek; <result>5__10 = <current>5__9 + 1; if (<current>5__9 < <baseMax>5__8 && <result>5__10 < <baseMax>5__8) { c.CustomerData.MaxOrdersPerWeek = <result>5__10; } } break; case 2: <baseMax>5__11 = 8000f * (float)<currMult>5__2; <current>5__12 = c.CustomerData.MaxWeeklySpend; <result>5__13 = c.CustomerData.MaxWeeklySpend * (1f + 0.01f * (float)<currMult>5__2); if (!(<current>5__12 >= <baseMax>5__11)) { c.CustomerData.MaxWeeklySpend = Mathf.Round(<result>5__13); } break; case 3: <baseMax>5__14 = 2000f * (float)<currMult>5__2; <current>5__15 = c.CustomerData.MinWeeklySpend; <max>5__16 = c.CustomerData.MaxWeeklySpend; <result>5__17 = c.CustomerData.MinWeeklySpend * (1f + 0.01f * (float)<currMult>5__2); if (!(<current>5__15 >= <baseMax>5__14) && !(<result>5__17 >= <max>5__16)) { c.CustomerData.MinWeeklySpend = Mathf.Round(<result>5__17); } break; } <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <ClearFeens>d__15 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public FeeningNPCs <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <ClearFeens>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; goto IL_004d; case 2: { <>1__state = -1; if (!registered) { return false; } feens.Clear(); goto IL_004d; } IL_004d: <>2__current = (object)new WaitForSeconds((float)currentConfig.feensClearThreshold); <>1__state = 2; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <NPCAttackEffect>d__24 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Customer c; private float <num1>5__1; private int <maxIter>5__2; private int <i>5__3; private Player <closest>5__4; private float <dist>5__5; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <NPCAttackEffect>d__24(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <closest>5__4 = null; <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!registered || c.NPC.RelationData.RelationDelta > 3.8f) { return false; } Player.GetClosestPlayer(((Component)c).transform.position, ref <num1>5__1, (List<Player>)null); <maxIter>5__2 = 20; <i>5__3 = 0; goto IL_0124; case 2: <>1__state = -1; if (!registered) { return false; } Player.GetClosestPlayer(((Component)c).transform.position, ref <num1>5__1, (List<Player>)null); <i>5__3++; goto IL_0124; case 3: { <>1__state = -1; if (!registered) { return false; } <closest>5__4 = Player.GetClosestPlayer(((Component)c).transform.position, ref <dist>5__5, (List<Player>)null); if (<dist>5__5 < 6f && (Object)(object)<closest>5__4 != (Object)null && (Object)(object)((NetworkBehaviour)<closest>5__4).NetworkObject != (Object)null) { c.NPC.Behaviour.CombatBehaviour.SetTarget((NetworkConnection)null, ((NetworkBehaviour)<closest>5__4).NetworkObject); ((Behaviour)c.NPC.Behaviour.CombatBehaviour).SendEnable(); } return false; } IL_0124: if (<num1>5__1 > 6f && <i>5__3 != <maxIter>5__2) { <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PreProcessBonuses>d__20 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Customer __instance; public EHandoverOutcome outcome; public Contract contract; public bool handoverByPlayer; private float <rel>5__1; private int <times>5__2; private float <ratio>5__3; private float <basePay>5__4; private float <perReward>5__5; private int <>s__6; private int <i>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreProcessBonuses>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Invalid comparison between Unknown and I4 //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!currentConfig.randomBonus) { return false; } if (Random.Range(0f, 1f) > currentConfig.randomBonusChance) { return false; } if (((int)outcome == 1) & handoverByPlayer) { <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; } goto IL_0265; case 1: { <>1__state = -1; if (!registered) { return false; } <rel>5__1 = Mathf.Clamp(__instance.NPC.RelationData.RelationDelta, 1f, 5f); <times>5__2 = (int)<rel>5__1; int num = <times>5__2; <>s__6 = num; switch (<>s__6) { case 1: <ratio>5__3 = Random.Range(0.05f, 0.1f); break; case 2: <ratio>5__3 = Random.Range(0.05f, 0.13f); break; case 3: <ratio>5__3 = Random.Range(0.1f, 0.15f); break; case 4: <ratio>5__3 = Random.Range(0.1f, 0.2f); break; case 5: <ratio>5__3 = Random.Range(0.1f, 0.3f); break; default: <ratio>5__3 = 1f; break; } <basePay>5__4 = contract.Payment * <ratio>5__3; <perReward>5__5 = Mathf.Round(<basePay>5__4 / (float)<times>5__2); <i>5__7 = 0; goto IL_023c; } case 2: <>1__state = -1; if (!registered) { return false; } NetworkSingleton<MoneyManager>.Instance.ChangeCashBalance(<perReward>5__5, true, true); <i>5__7++; goto IL_023c; case 3: { <>1__state = -1; return false; } IL_023c: if (<i>5__7 <= <times>5__2) { <>2__current = (object)new WaitForSeconds(Random.Range(0.6f, 0.8f)); <>1__state = 2; return true; } NetworkSingleton<LevelManager>.Instance.AddXP(<times>5__2); goto IL_0265; IL_0265: <>2__current = null; <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <PreProcessHandover>d__21 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Customer __instance; public bool handoverByPlayer; private int <currMult>5__1; private float <lastNetWNorm>5__2; private float <lifetimeNorm>5__3; private float <cashBNorm>5__4; private float <economyTotal>5__5; private float <boostRateMin>5__6; private float <boostRateMax>5__7; private float <weekSpend>5__8; private float <minWeekSpend>5__9; private float <instSpendNorm>5__10; private float <diff>5__11; private float <target>5__12; private float <targetMin>5__13; private float <customerAdct>5__14; private float <customerDeps>5__15; private float <customerRela>5__16; private float <internalTotal>5__17; private float <adjustmentFactorMax>5__18; private float <res>5__19; private float <resultMax>5__20; private float <maxSpendNew>5__21; private float <adjustmentFactorMin>5__22; private float <resM>5__23; private float <resultMinMax>5__24; private float <minSpendNew>5__25; private int <xpReward>5__26; private int <xpReward>5__27; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PreProcessHandover>d__21(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!currentConfig.increaseEconomy) { return false; } <currMult>5__1 = 1; if (currentConfig.economyMultiplier >= 1 && currentConfig.economyMultiplier <= 10) { <currMult>5__1 = currentConfig.economyMultiplier; } if (handoverByPlayer) { <xpReward>5__26 = 1 + Random.Range(1, 3 + <currMult>5__1); NetworkSingleton<LevelManager>.Instance.AddXP(<xpReward>5__26); } else if (Random.Range(0f, 1f) < 0.8f) { <xpReward>5__27 = 2; NetworkSingleton<LevelManager>.Instance.AddXP(<xpReward>5__27); } <lastNetWNorm>5__2 = Mathf.Clamp01(NetworkSingleton<MoneyManager>.Instance.LastCalculatedNetworth / 5000000f); <lifetimeNorm>5__3 = Mathf.Clamp01(NetworkSingleton<MoneyManager>.Instance.LifetimeEarnings / 5000000f); <cashBNorm>5__4 = Mathf.Clamp01(NetworkSingleton<MoneyManager>.Instance.cashBalance / 5000000f); <economyTotal>5__5 = (<lastNetWNorm>5__2 + <lifetimeNorm>5__3 + <cashBNorm>5__4) / 3f; <economyTotal>5__5 = Mathf.Max(<economyTotal>5__5, 0.01f); if (<economyTotal>5__5 == 0.01f) { <boostRateMin>5__6 = 0.6f; <boostRateMax>5__7 = 0.9f; } else if ((double)<economyTotal>5__5 < 0.03) { <boostRateMin>5__6 = 0.5f; <boostRateMax>5__7 = 0.8f; } else if ((double)<economyTotal>5__5 < 0.06) { <boostRateMin>5__6 = 0.3f; <boostRateMax>5__7 = 0.5f; } else if (<economyTotal>5__5 < 0.1f) { <boostRateMin>5__6 = 0.15f; <boostRateMax>5__7 = 0.2f; } else if (<economyTotal>5__5 < 0.14f) { <boostRateMin>5__6 = 0.06f; <boostRateMax>5__7 = 0.1f; } else if (<economyTotal>5__5 < 0.2f) { <boostRateMin>5__6 = 0.02f; <boostRateMax>5__7 = 0.04f; } else { <boostRateMin>5__6 = 0.02f; <boostRateMax>5__7 = 0.03f; } <weekSpend>5__8 = __instance.CustomerData.MaxWeeklySpend; <minWeekSpend>5__9 = __instance.CustomerData.MinWeeklySpend; <instSpendNorm>5__10 = Mathf.Clamp01(<weekSpend>5__8 / 5000000f); if (<economyTotal>5__5 <= <instSpendNorm>5__10) { return false; } <diff>5__11 = <economyTotal>5__5 - <instSpendNorm>5__10; <target>5__12 = <weekSpend>5__8 + <weekSpend>5__8 * (float)<currMult>5__1 * <diff>5__11; if (<target>5__12 >= 500000f * (float)<currMult>5__1) { <target>5__12 = 500000f * (float)<currMult>5__1; } <targetMin>5__13 = <minWeekSpend>5__9 + <minWeekSpend>5__9 * (float)<currMult>5__1 * <diff>5__11; if (<targetMin>5__13 >= 166666f * (float)<currMult>5__1) { <targetMin>5__13 = 166666f * (float)<currMult>5__1; } <customerAdct>5__14 = __instance.CurrentAddiction; <customerDeps>5__15 = Mathf.Clamp01((0.01f + __instance.CustomerData.DependenceMultiplier) / 2f); <customerRela>5__16 = __instance.NPC.RelationData.NormalizedRelationDelta; <internalTotal>5__17 = Mathf.Clamp01((<customerAdct>5__14 + <customerDeps>5__15 + <customerRela>5__16) / 3.5f); <adjustmentFactorMax>5__18 = <diff>5__11 * ((float)<currMult>5__1 * <boostRateMax>5__7); <res>5__19 = Mathf.Lerp(<weekSpend>5__8, <target>5__12, <adjustmentFactorMax>5__18); <resultMax>5__20 = Mathf.Clamp(<res>5__19 - <weekSpend>5__8, Random.Range(1f, Mathf.Round(5f * (1f + <customerDeps>5__15))), Random.Range(30f, Mathf.Round(60f * (1f + <customerDeps>5__15)))); <maxSpendNew>5__21 = Mathf.Lerp(<weekSpend>5__8 + <resultMax>5__20, <res>5__19, <internalTotal>5__17); <res>5__19 = Mathf.Round(<maxSpendNew>5__21); if (<res>5__19 < 80000f) { __instance.CustomerData.MaxWeeklySpend = <res>5__19; } <adjustmentFactorMin>5__22 = <diff>5__11 * ((float)<currMult>5__1 * <boostRateMin>5__6); <resM>5__23 = Mathf.Lerp(<minWeekSpend>5__9, <targetMin>5__13, <adjustmentFactorMin>5__22); <resultMinMax>5__24 = Mathf.Clamp(<resM>5__23 - <minWeekSpend>5__9, Random.Range(1f, Mathf.Round(3f * (1f + <customerDeps>5__15))), Random.Range(20f, Mathf.Round(40f * (1f + <customerDeps>5__15)))); <minSpendNew>5__25 = Mathf.Lerp(<minWeekSpend>5__9 + <resultMinMax>5__24, <resM>5__23, <internalTotal>5__17); <resM>5__23 = Mathf.Round(<minSpendNew>5__25); if (<resM>5__23 < 20000f && <resM>5__23 < <maxSpendNew>5__21) { __instance.CustomerData.MinWeeklySpend = <resM>5__23; } <>2__current = null; <>1__state = 1; return true; case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RagdollEffect>d__25 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Customer c; private float <num3>5__1; private int <maxIter2>5__2; private int <j>5__3; private float <dist>5__4; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RagdollEffect>d__25(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0157: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!registered) { return false; } Player.GetClosestPlayer(((Component)c).transform.position, ref <num3>5__1, (List<Player>)null); <maxIter2>5__2 = 20; <j>5__3 = 0; goto IL_0106; case 2: <>1__state = -1; if (!registered) { return false; } Player.GetClosestPlayer(((Component)c).transform.position, ref <num3>5__1, (List<Player>)null); <j>5__3++; goto IL_0106; case 3: { <>1__state = -1; if (!registered) { return false; } Player.GetClosestPlayer(((Component)c).transform.position, ref <dist>5__4, (List<Player>)null); if (<dist>5__4 < 6f) { c.NPC.Movement.ActivateRagdoll(((Component)c.NPC).transform.position, Vector3.forward, 6f); } return false; } IL_0106: if (<num3>5__1 > 6f && <j>5__3 != <maxIter2>5__2) { <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <RandomFeenEffect>d__23 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Customer c; private int <roll>5__1; private int <>s__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <RandomFeenEffect>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: { <>1__state = -1; <roll>5__1 = Random.Range(0, 8); int num = <roll>5__1; <>s__2 = num; switch (<>s__2) { case 0: c.NPC.OverrideAggression(1f); break; case 1: c.CustomerData.CallPoliceChance = 1f; break; case 2: c.CustomerData.CallPoliceChance = 0.5f; break; case 3: c.NPC.PlayVO((EVOLineType)8, false); c.NPC.Avatar.EmotionManager.AddEmotionOverride("Annoyed", "product_request_fail", 30f, 1); break; case 4: c.NPC.OverrideAggression(0.5f); break; case 5: c.NPC.Avatar.Effects.SetSicklySkinColor(true); break; case 6: coros.Add(MelonCoroutines.Start(NPCAttackEffect(c))); break; case 7: coros.Add(MelonCoroutines.Start(RagdollEffect(c))); break; } <>2__current = null; <>1__state = 1; return true; } case 1: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SetFeening>d__27 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public List<Customer> cs; public Player player; public FeeningNPCs <>4__this; private List<Customer>.Enumerator <>s__1; private Customer <c>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SetFeening>d__27(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || (uint)(num - 1) <= 1u) { try { } finally { <>m__Finally1(); } } <>s__1 = default(List<Customer>.Enumerator); <c>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown bool result; try { switch (<>1__state) { default: result = false; break; case 0: <>1__state = -1; <>s__1 = cs.GetEnumerator(); <>1__state = -3; goto IL_01f2; case 1: <>1__state = -3; if (!registered) { result = false; goto IL_020b; } if (<c>5__2.NPC.isInBuilding) { <c>5__2.NPC.ExitBuilding(""); } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; result = true; break; case 2: <>1__state = -3; if (!registered) { result = false; goto IL_020b; } if (<c>5__2.NPC.Movement.CanGetTo(((Component)player).transform.position, (float)currentConfig.feeningRadius)) { if (Random.Range(0f, 1f) > 0.5f) { if (currentConfig.randomEffects) { coros.Add(MelonCoroutines.Start(RandomFeenEffect(<c>5__2))); } } else if (currentConfig.increaseEconomy) { coros.Add(MelonCoroutines.Start(<>4__this.ChangeCustomerEconomy(<c>5__2))); } <c>5__2.RequestProduct(player); feens.Add(<c>5__2); <c>5__2 = null; } goto IL_01f2; case 3: { <>1__state = -1; result = false; break; } IL_020b: <>m__Finally1(); break; IL_01f2: if (<>s__1.MoveNext()) { <c>5__2 = <>s__1.Current; <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 1; result = true; } else { <>m__Finally1(); <>s__1 = default(List<Customer>.Enumerator); <>2__current = null; <>1__state = 3; result = true; } break; } } catch { //try-fault ((IDisposable)this).Dispose(); throw; } return result; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private Customer[] cmers; public static List<object> coros = new List<object>(); public static HashSet<Customer> feens = new HashSet<Customer>(); public static bool registered = false; public static bool lastSaveLoad = false; public static bool firstTimeLoad = false; public static ModConfig currentConfig; public static SaveEconomy currentEconomy; public static FeeningNPCs Instance { get; set; } public override void OnApplicationStart() { MelonLogger.Msg("Your customers need more... and more.... AND MORE!!! HELP ME BRO YOU GOT SOME MORE??!!"); if (Instance == null) { Instance = this; } } public override void OnSceneWasInitialized(int buildIndex, string sceneName) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown if (buildIndex == 1 && (Object)(object)Singleton<LoadManager>.Instance != (Object)null && !registered && !lastSaveLoad && !firstTimeLoad) { firstTimeLoad = true; Singleton<LoadManager>.Instance.onLoadComplete.AddListener(new UnityAction(OnLoadCompleteCb)); } } private void OnLoadCompleteCb() { if (!registered) { registered = true; currentConfig = ConfigLoader.Load(); cmers = Object.FindObjectsOfType<Customer>(true); if (currentConfig.persistEconomy) { currentEconomy = ConfigLoader.LoadEconomy(cmers); } coros.Add(MelonCoroutines.Start(ChangeBehv())); coros.Add(MelonCoroutines.Start(ClearFeens())); } } [IteratorStateMachine(typeof(<ClearFeens>d__15))] private IEnumerator ClearFeens() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ClearFeens>d__15(0) { <>4__this = this }; } private static void ExitPreTask() { registered = false; foreach (object coro in coros) { if (coro != null) { MelonCoroutines.Stop(coro); } } coros.Clear(); feens.Clear(); } [IteratorStateMachine(typeof(<PreProcessBonuses>d__20))] public static IEnumerator PreProcessBonuses(Customer __instance, EHandoverOutcome outcome, Contract contract, bool handoverByPlayer) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreProcessBonuses>d__20(0) { __instance = __instance, outcome = outcome, contract = contract, handoverByPlayer = handoverByPlayer }; } [IteratorStateMachine(typeof(<PreProcessHandover>d__21))] public static IEnumerator PreProcessHandover(Customer __instance, bool handoverByPlayer) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PreProcessHandover>d__21(0) { __instance = __instance, handoverByPlayer = handoverByPlayer }; } [IteratorStateMachine(typeof(<ChangeCustomerEconomy>d__22))] private IEnumerator ChangeCustomerEconomy(Customer c) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ChangeCustomerEconomy>d__22(0) { <>4__this = this, c = c }; } [IteratorStateMachine(typeof(<RandomFeenEffect>d__23))] public static IEnumerator RandomFeenEffect(Customer c) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RandomFeenEffect>d__23(0) { c = c }; } [IteratorStateMachine(typeof(<NPCAttackEffect>d__24))] private static IEnumerator NPCAttackEffect(Customer c) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <NPCAttackEffect>d__24(0) { c = c }; } [IteratorStateMachine(typeof(<RagdollEffect>d__25))] private static IEnumerator RagdollEffect(Customer c) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <RagdollEffect>d__25(0) { c = c }; } [IteratorStateMachine(typeof(<ChangeBehv>d__26))] private IEnumerator ChangeBehv() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <ChangeBehv>d__26(0) { <>4__this = this }; } [IteratorStateMachine(typeof(<SetFeening>d__27))] private IEnumerator SetFeening(List<Customer> cs, Player player) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SetFeening>d__27(0) { <>4__this = this, cs = cs, player = player }; } }