Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Exchange Changes v1.1.4
ExchangeChanges.dll
Decompiled 6 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.DroneCombiner; using EntityStates.DroneScrapper; using EntityStates.DroneVendor; using EntityStates.Duplicator; using EntityStates.MealPrep; using EntityStates.Scrapper; using Microsoft.CodeAnalysis; using On.EntityStates.DroneVendor; using On.EntityStates.Duplicator; using On.RoR2; using On.RoR2.EntityLogic; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.Components.Panel; using RiskOfOptions.Options; using RoR2; using RoR2.EntityLogic; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ExchangeChanges")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6d68c1d417bc55b8d1807356627973adbfda9a19")] [assembly: AssemblyProduct("ExchangeChanges")] [assembly: AssemblyTitle("ExchangeChanges")] [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 ExchangeChanges { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("FlyingComputer.ExchangeChanges", "ExchangeChanges", "1.1.4")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class ExchangeChanges : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_DropDroplet <>9__109_2; public static hook_CallDelayed <>9__109_6; internal void <Awake>b__109_2(orig_DropDroplet orig, Duplicating self) { orig.Invoke(self); if (NetworkServer.active && self.hasDroppedDroplet) { ((EntityState)self).GetComponent<PurchaseInteraction>().Networkavailable = true; } } internal void <Awake>b__109_6(orig_CallDelayed orig, DelayedEvent self, float timer) { if (!((object)self).ToString().Contains("Duplicator")) { orig.Invoke(self, timer); } } } public const string PluginGUID = "FlyingComputer.ExchangeChanges"; public const string PluginAuthor = "FlyingComputer"; public const string PluginName = "ExchangeChanges"; public const string PluginVersion = "1.1.4"; private UnityAction ResetToDefault; public static ConfigEntry<float> printerDelay { get; set; } public static ConfigEntry<float> scrapperDelay { get; set; } public static ConfigEntry<float> chanceDelay { get; set; } public static ConfigEntry<float> mountainDelay { get; set; } public static ConfigEntry<float> bazaarDelay { get; set; } public static ConfigEntry<float> cleanseDelay { get; set; } public static ConfigEntry<float> woodsDelay { get; set; } public static ConfigEntry<float> bloodDelay { get; set; } public static ConfigEntry<float> droneVendorDelay { get; set; } public static ConfigEntry<float> droneScrapperStartupDelay { get; set; } public static ConfigEntry<float> droneScrapperDelay { get; set; } public static ConfigEntry<float> droneCombinerDelay { get; set; } public static ConfigEntry<float> chefDelay { get; set; } private static float baseDroneVendorDelay { get; set; } private static float baseDroneVendorSpawnDelay { get; set; } private static float baseDroneVendorIdleDelay { get; set; } private static float baseDroneVendorTotalDelay { get; set; } private static float baseDroneCombinerInitDelay { get; set; } private static float baseDroneCombinerAbsorbDelay { get; set; } private static float baseDroneCombinerAnimDelay { get; set; } private static float baseDroneCombinerTotalDelay { get; set; } private static float baseChefWaitDelay { get; set; } private static float baseChefCookingDelay { get; set; } private static float baseChefIdleDelay { get; set; } private static float baseChefTotalDelay { get; set; } private static bool hasGatheredDefaults { get; set; } public void Awake() { //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Expected O, but got Unknown //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Expected O, but got Unknown //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_026c: Expected O, but got Unknown //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Expected O, but got Unknown //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Expected O, but got Unknown //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Expected O, but got Unknown //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Expected O, but got Unknown //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Expected O, but got Unknown //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Expected O, but got Unknown //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Expected O, but got Unknown //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Expected O, but got Unknown //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Expected O, but got Unknown //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_034d: Expected O, but got Unknown //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Expected O, but got Unknown //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Expected O, but got Unknown //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a4: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Expected O, but got Unknown //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Expected O, but got Unknown //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Expected O, but got Unknown //IL_03b8: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Expected O, but got Unknown ConfigEntry<float> printerDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Printer Delay", 0.6f, "Printer delay in seconds"); ConfigEntry<float> scrapperDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Scrapper Delay", 0.3f, "Scrapper startup delay in seconds"); ConfigEntry<float> scrapperItemDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Scrapper Item Delay", 0.3f, "Scrapper delay between item drops in seconds"); ConfigEntry<float> chanceDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Shrine of Chance Delay", 0.4f, "Shrine of Chance delay in seconds"); ConfigEntry<float> mountainDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Shrine of the Mountain Delay", 0.4f, "Shrine of the Mountain delay in seconds, for those with mods enabling more than one use"); ConfigEntry<float> bazaarDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Bazaar trade Delay", 0.5f, "Bazaar item trade delay in seconds"); ConfigEntry<float> cleanseDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Cleansing Pool Delay", 0.5f, "Cleansing Pool delay in seconds"); ConfigEntry<float> woodsDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Shrine of the Woods Delay", 0.5f, "Shrine of the Woods delay in seconds"); ConfigEntry<float> bloodDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Shrine of Blood Delay", 0.5f, "Shrine of Blood delay in seconds"); ConfigEntry<float> droneVendorDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Drone Vendor Delay", 1f, "Drone Vendor delay in seconds"); ConfigEntry<float> droneScrapperStartupDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Drone Scrapper Startup Delay", 0.1f, "Drone Scrapper startup delay in seconds"); ConfigEntry<float> droneScrapperDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Drone Scrapper Delay", 0.5f, "Drone Scrapper delay in seconds"); ConfigEntry<float> droneCombinerDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Drone Combiner Delay", 0.7f, "Drone Combiner Station delay in seconds"); ConfigEntry<float> chefDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Delay Settings", "Wandering Chef Delay", 0.5f, "Wandering Chef delay in seconds"); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(printerDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(scrapperDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(scrapperItemDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(chanceDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(mountainDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(bazaarDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(cleanseDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(woodsDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(bloodDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(droneVendorDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(droneScrapperStartupDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(droneScrapperDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(droneCombinerDelay)); ModSettingsManager.AddOption((BaseOption)new FloatFieldOption(chefDelay)); ResetToDefault = (UnityAction)Delegate.Combine((Delegate?)(object)ResetToDefault, (Delegate?)(UnityAction)delegate { ModOptionPanelController obj3 = Object.FindObjectOfType<ModOptionPanelController>(); printerDelay.Value = 0.6f; scrapperDelay.Value = 0.3f; scrapperItemDelay.Value = 0.3f; chanceDelay.Value = 0.4f; mountainDelay.Value = 0.4f; bazaarDelay.Value = 0.5f; cleanseDelay.Value = 0.5f; woodsDelay.Value = 0.5f; bloodDelay.Value = 0.5f; droneVendorDelay.Value = 1f; droneScrapperStartupDelay.Value = 0.1f; droneScrapperDelay.Value = 0.5f; droneCombinerDelay.Value = 0.7f; chefDelay.Value = 0.5f; obj3.RevertChanges(); }); ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Reset delay settings to default:", "Delay Settings", "", "RESET", ResetToDefault)); ModSettingsManager.SetModDescription("Adjust the speed of repeatable interactions"); Stage.Start += (hook_Start)delegate(orig_Start orig, Stage self) { if (!hasGatheredDefaults) { baseDroneVendorDelay = DroneVendorDispatchState.duration; baseDroneVendorSpawnDelay = DroneVendorDispatchState.spawnTime; baseDroneVendorIdleDelay = DroneVendorAssumeIdle.duration; baseDroneVendorTotalDelay = baseDroneVendorDelay + baseDroneVendorIdleDelay; baseDroneCombinerInitDelay = DroneCombinerCombining.initialDelayDuration; baseDroneCombinerAbsorbDelay = DroneCombinerCombining.droneAbsorbDelay; baseDroneCombinerAnimDelay = DroneCombinerCombining.animDelayDuration; baseDroneCombinerTotalDelay = baseDroneCombinerInitDelay + baseDroneCombinerAbsorbDelay + baseDroneCombinerAnimDelay; baseChefWaitDelay = WaitToBeginCooking.duration; baseChefCookingDelay = Cooking.duration; baseChefIdleDelay = CookingToIdle.duration; baseChefTotalDelay = baseChefWaitDelay + baseChefCookingDelay + baseChefIdleDelay; hasGatheredDefaults = true; } Reflection.SetFieldValue<float>(typeof(Duplicating), "initialDelayDuration", printerDelay.Value / 2f); Reflection.SetFieldValue<float>(typeof(Duplicating), "timeBetweenStartAndDropDroplet", printerDelay.Value / 2f); Reflection.SetFieldValue<float>(typeof(WaitToBeginScrapping), "duration", scrapperDelay.Value / 2f); Reflection.SetFieldValue<float>(typeof(Scrapping), "duration", scrapperDelay.Value / 2f); Reflection.SetFieldValue<float>(typeof(ScrappingToIdle), "duration", scrapperItemDelay.Value * 2f); DroneVendorDispatchState.duration = baseDroneVendorDelay / baseDroneVendorTotalDelay * droneVendorDelay.Value; DroneVendorDispatchState.spawnTime = baseDroneVendorSpawnDelay / baseDroneVendorTotalDelay * droneVendorDelay.Value; DroneVendorAssumeIdle.duration = baseDroneVendorIdleDelay / baseDroneVendorTotalDelay * droneVendorDelay.Value; DroneScrapping.duration = droneScrapperDelay.Value; WaitToBeginScrappingDrone.duration = droneScrapperStartupDelay.Value; DroneCombinerCombining.initialDelayDuration = baseDroneCombinerInitDelay / baseDroneCombinerTotalDelay * droneCombinerDelay.Value; DroneCombinerCombining.droneAbsorbDelay = baseDroneCombinerAbsorbDelay / baseDroneCombinerTotalDelay * droneCombinerDelay.Value; DroneCombinerCombining.animDelayDuration = baseDroneCombinerAnimDelay / baseDroneCombinerTotalDelay * droneCombinerDelay.Value; WaitToBeginCooking.duration = baseChefWaitDelay / baseChefTotalDelay * chefDelay.Value; Cooking.duration = baseChefCookingDelay / baseChefTotalDelay * chefDelay.Value; CookingToIdle.duration = baseChefIdleDelay / baseChefTotalDelay * chefDelay.Value; return orig.Invoke(self); }; object obj = <>c.<>9__109_2; if (obj == null) { hook_DropDroplet val = delegate(orig_DropDroplet orig, Duplicating self) { orig.Invoke(self); if (NetworkServer.active && self.hasDroppedDroplet) { ((EntityState)self).GetComponent<PurchaseInteraction>().Networkavailable = true; } }; <>c.<>9__109_2 = val; obj = (object)val; } Duplicating.DropDroplet += (hook_DropDroplet)obj; PurchaseInteraction.OnInteractionBegin += (hook_OnInteractionBegin)delegate(orig_OnInteractionBegin orig, PurchaseInteraction self, Interactor interactor) { orig.Invoke(self, interactor); if (self.displayNameToken == "SHRINE_BOSS_NAME") { ((Component)self).GetComponent<ShrineBossBehavior>().refreshTimer = mountainDelay.Value; } if (self.displayNameToken == "SHRINE_CHANCE_NAME") { ((Component)self).GetComponent<ShrineChanceBehavior>().refreshTimer = chanceDelay.Value; } }; ShrineHealingBehavior.AddShrineStack += (hook_AddShrineStack)delegate(orig_AddShrineStack orig, ShrineHealingBehavior self, Interactor interactor) { orig.Invoke(self, interactor); self.refreshTimer = woodsDelay.Value; }; ShrineBloodBehavior.AddShrineStack += (hook_AddShrineStack)delegate(orig_AddShrineStack orig, ShrineBloodBehavior self, Interactor interactor) { orig.Invoke(self, interactor); self.refreshTimer = bloodDelay.Value; }; object obj2 = <>c.<>9__109_6; if (obj2 == null) { hook_CallDelayed val2 = delegate(orig_CallDelayed orig, DelayedEvent self, float timer) { if (!((object)self).ToString().Contains("Duplicator")) { orig.Invoke(self, timer); } }; <>c.<>9__109_6 = val2; obj2 = (object)val2; } DelayedEvent.CallDelayed += (hook_CallDelayed)obj2; TimerQueue.CreateTimer += (hook_CreateTimer)delegate(orig_CreateTimer orig, TimerQueue self, float time, Action action) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (action.Target.ToString().Contains("LunarCauldron")) { return orig.Invoke(self, bazaarDelay.Value, action); } return action.Target.ToString().Contains("ShrineCleanse") ? orig.Invoke(self, cleanseDelay.Value, action) : orig.Invoke(self, time, action); }; DroneVendorDispatchState.OnEnter += (hook_OnEnter)delegate(orig_OnEnter orig, DroneVendorDispatchState self) { ((EntityState)self).GetModelAnimator().speed = baseDroneVendorTotalDelay / droneVendorDelay.Value; orig.Invoke(self); }; DroneVendorAssumeIdle.OnEnter += (hook_OnEnter)delegate(orig_OnEnter orig, DroneVendorAssumeIdle self) { ((EntityState)self).GetModelAnimator().speed = baseDroneVendorTotalDelay / droneVendorDelay.Value; orig.Invoke(self); }; } } internal static class Log { internal static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void LogDebug(object data) { _logSource.LogDebug(data); } internal static void LogError(object data) { _logSource.LogError(data); } internal static void LogFatal(object data) { _logSource.LogFatal(data); } internal static void LogInfo(object data) { _logSource.LogInfo(data); } internal static void LogMessage(object data) { _logSource.LogMessage(data); } internal static void LogWarning(object data) { _logSource.LogWarning(data); } } }