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 RegenChests v1.0.0
RegenChests.dll
Decompiled 2 years agousing System; 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 System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.ScavBackpack; using Microsoft.CodeAnalysis; using On.EntityStates.ScavBackpack; using On.RoR2; using On.RoR2.Artifacts; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.Artifacts; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("RegenChests")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+25763c68cb918e2f703c27d90830e2ad7eeab733")] [assembly: AssemblyProduct("RegenChests")] [assembly: AssemblyTitle("RegenChests")] [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 RegenChests { public class Disposable : IDisposable { private readonly Action _dispose; public static Disposable Empty { get; } = new Disposable(delegate { }); public Disposable(Action dispose) { _dispose = dispose; } public void Dispose() { _dispose(); } } public class CompositeDisposable : IDisposable { private readonly List<IDisposable> _disposables; public CompositeDisposable() { _disposables = new List<IDisposable>(); } public void Add(IDisposable disposable) { _disposables.Add(disposable); } public void AddRange(IEnumerable<IDisposable> disposables) { _disposables.AddRange(disposables); } public void Dispose() { foreach (IDisposable disposable in _disposables) { disposable.Dispose(); } } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Lawlzee.RegenChests", "Regen Chests", "1.0.0")] public class RegenChestsPlugin : BaseUnityPlugin { public const string PluginGUID = "Lawlzee.RegenChests"; public const string PluginAuthor = "Lawlzee"; public const string PluginName = "Regen Chests"; public const string PluginVersion = "1.0.0"; public static ConfigEntry<bool> ModEnabled; public static ConfigEntry<bool> ReplaceChestDropTable; public static ConfigEntry<bool> ReplaceMultiShopDropTable; public static ConfigEntry<bool> ReplaceAdaptiveChestDropTable; public static ConfigEntry<bool> ReplaceChanceShrineDropTable; public static ConfigEntry<bool> ReplaceLegendaryChestDropTable; public static ConfigEntry<bool> ReplaceVoidPotentialDropTable; public static ConfigEntry<bool> ReplaceVoidCradleDropTable; public static ConfigEntry<bool> ReplaceLunarPodDropTable; public static ConfigEntry<bool> ReplaceLunarBudsDropTable; public static ConfigEntry<float> WhitePrinterSpawnMultiplier; public static ConfigEntry<float> GreenPrinterSpawnMultiplier; public static ConfigEntry<float> RedPrinterSpawnMultiplier; public static ConfigEntry<float> YellowPrinterSpawnMultiplier; public static ConfigEntry<bool> ReplaceLockboxDropTable; public static ConfigEntry<bool> ReplaceCrashedMultishopDropTable; public static ConfigEntry<bool> ReplaceBossHunterDropTable; public static ConfigEntry<float> SpeedItemSpawnMultiplier; public static ConfigEntry<bool> ReplaceBossDropTable; public static ConfigEntry<bool> ReplaceAWUDropTable; public static ConfigEntry<bool> ReplaceScavengerDropTable; public static ConfigEntry<bool> ReplaceElderLemurianDropTable; public static ConfigEntry<bool> ReplaceDoppelgangerDropTable; public static ConfigEntry<bool> ReplaceSacrificeArtifactDropTable; public static ConfigEntry<bool> ReplaceSimulacrumOrbDropTable; public static ConfigEntry<bool> ReplaceVoidFieldsOrbDropTable; public void Awake() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Expected O, but got Unknown //IL_0485: Unknown result type (might be due to invalid IL or missing references) //IL_048f: Expected O, but got Unknown //IL_0494: Unknown result type (might be due to invalid IL or missing references) //IL_049e: Expected O, but got Unknown //IL_04a3: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Expected O, but got Unknown //IL_04b2: Unknown result type (might be due to invalid IL or missing references) //IL_04bc: Expected O, but got Unknown //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Expected O, but got Unknown //IL_04d0: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Expected O, but got Unknown //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Expected O, but got Unknown //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f8: Expected O, but got Unknown //IL_04fd: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Expected O, but got Unknown //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0516: Expected O, but got Unknown //IL_051b: Unknown result type (might be due to invalid IL or missing references) //IL_0520: Unknown result type (might be due to invalid IL or missing references) //IL_052b: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Unknown result type (might be due to invalid IL or missing references) //IL_0541: Unknown result type (might be due to invalid IL or missing references) //IL_0551: Expected O, but got Unknown //IL_054c: Unknown result type (might be due to invalid IL or missing references) //IL_0556: Expected O, but got Unknown //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0560: Unknown result type (might be due to invalid IL or missing references) //IL_056b: Unknown result type (might be due to invalid IL or missing references) //IL_0576: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Expected O, but got Unknown //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0596: Expected O, but got Unknown //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a0: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Unknown result type (might be due to invalid IL or missing references) //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05c1: Unknown result type (might be due to invalid IL or missing references) //IL_05d1: Expected O, but got Unknown //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Expected O, but got Unknown //IL_05db: Unknown result type (might be due to invalid IL or missing references) //IL_05e0: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Unknown result type (might be due to invalid IL or missing references) //IL_05f6: Unknown result type (might be due to invalid IL or missing references) //IL_0601: Unknown result type (might be due to invalid IL or missing references) //IL_0611: Expected O, but got Unknown //IL_060c: Unknown result type (might be due to invalid IL or missing references) //IL_0616: Expected O, but got Unknown //IL_061b: Unknown result type (might be due to invalid IL or missing references) //IL_0625: Expected O, but got Unknown //IL_062a: Unknown result type (might be due to invalid IL or missing references) //IL_0634: Expected O, but got Unknown //IL_0639: Unknown result type (might be due to invalid IL or missing references) //IL_0643: Expected O, but got Unknown //IL_0648: Unknown result type (might be due to invalid IL or missing references) //IL_064d: Unknown result type (might be due to invalid IL or missing references) //IL_0658: Unknown result type (might be due to invalid IL or missing references) //IL_0663: Unknown result type (might be due to invalid IL or missing references) //IL_066e: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Expected O, but got Unknown //IL_0679: Unknown result type (might be due to invalid IL or missing references) //IL_0683: Expected O, but got Unknown //IL_0688: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Expected O, but got Unknown //IL_0697: Unknown result type (might be due to invalid IL or missing references) //IL_06a1: Expected O, but got Unknown //IL_06a6: Unknown result type (might be due to invalid IL or missing references) //IL_06b0: Expected O, but got Unknown //IL_06b5: Unknown result type (might be due to invalid IL or missing references) //IL_06bf: Expected O, but got Unknown //IL_06c4: Unknown result type (might be due to invalid IL or missing references) //IL_06ce: Expected O, but got Unknown //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Expected O, but got Unknown //IL_06e2: Unknown result type (might be due to invalid IL or missing references) //IL_06ec: Expected O, but got Unknown //IL_06f1: Unknown result type (might be due to invalid IL or missing references) //IL_06fb: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); ChestBehavior.Roll += new hook_Roll(ChestBehavior_Roll); ShopTerminalBehavior.GenerateNewPickupServer_bool += new hook_GenerateNewPickupServer_bool(ShopTerminalBehavior_GenerateNewPickupServer_bool); RouletteChestController.GenerateEntriesServer += new hook_GenerateEntriesServer(RouletteChestController_GenerateEntriesServer); ShrineChanceBehavior.AddShrineStack += new hook_AddShrineStack(ShrineChanceBehavior_AddShrineStack); FreeChestDropTable.GenerateDropPreReplacement += new hook_GenerateDropPreReplacement(FreeChestDropTable_GenerateDropPreReplacement); OptionChestBehavior.Roll += new hook_Roll(OptionChestBehavior_Roll); SceneDirector.GenerateInteractableCardSelection += new hook_GenerateInteractableCardSelection(SceneDirector_GenerateInteractableCardSelection); EquipmentSlot.FireBossHunter += new hook_FireBossHunter(EquipmentSlot_FireBossHunter); BossGroup.DropRewards += new hook_DropRewards(BossGroup_DropRewards); Opening.FixedUpdate += new hook_FixedUpdate(Opening_FixedUpdate); MasterDropDroplet.DropItems += new hook_DropItems(MasterDropDroplet_DropItems); ChestBehavior.RollItem += new hook_RollItem(ChestBehavior_RollItem); DoppelgangerDropTable.GenerateDropPreReplacement += new hook_GenerateDropPreReplacement(DoppelgangerDropTable_GenerateDropPreReplacement); SacrificeArtifactManager.OnServerCharacterDeath += new hook_OnServerCharacterDeath(SacrificeArtifactManager_OnServerCharacterDeath); InfiniteTowerWaveController.DropRewards += new hook_DropRewards(InfiniteTowerWaveController_DropRewards); ArenaMonsterItemDropTable.GenerateUniqueDropsPreReplacement += new hook_GenerateUniqueDropsPreReplacement(ArenaMonsterItemDropTable_GenerateUniqueDropsPreReplacement); ArenaMissionController.EndRound += new hook_EndRound(ArenaMissionController_EndRound); ModEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Configuration", "Mod enabled", true, "Mod enabled"); ReplaceChestDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Chest", true, "Chests will drop Regenerating Scrap instead of items"); ReplaceMultiShopDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Multishop Terminal", true, "Multishop Terminals will drop Regenerating Scrap instead of items"); ReplaceAdaptiveChestDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Adaptive Chest", true, "Adaptive Chests will drop Regenerating Scrap instead of items"); ReplaceChanceShrineDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Shrine of Chance", true, "Shrine of Chance will drop Regenerating Scrap instead of items"); ReplaceLegendaryChestDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Legendary Chest", true, "Legendary Chests will drop Regenerating Scrap instead of items"); ReplaceVoidPotentialDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Void Potential", true, "Void Potential will drop Regenerating Scrap instead of items"); ReplaceVoidCradleDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Void Cradle", true, "Void Cradle will drop Regenerating Scrap instead of items"); ReplaceLunarPodDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Lunar Pod", false, "Lunar Pods will drop Regenerating Scrap instead of items"); ReplaceLunarBudsDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Chests", "Lunar Bud", false, "Lunar Buds in the Bazaar Between Time will always sell Regenerating Scrap"); WhitePrinterSpawnMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "White printer spawn multiplier", 0f, "Controls the spawn rate of white printers. 0.0x = never. 1.0x = default spawn rate. 2.0x = 2 times more likely to spawn printers."); GreenPrinterSpawnMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "Green printer spawn multiplier", 10f, "Controls the spawn rate of green printers. 0.0x = never. 1.0x = default spawn rate. 2.0x = 2 times more likely to spawn printers."); RedPrinterSpawnMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "Red printer spawn multiplier", 0f, "Controls the spawn rate of ref printers. 0.0x = never. 1.0x = default spawn rate. 2.0x = 2 times more likely to spawn printers."); YellowPrinterSpawnMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Printers", "Yellow printer spawn multiplier", 0f, "Controls the spawn rate of yellow printers. 0.0x = never. 1.0x = default spawn rate. 2.0x = 2 times more likely to spawn printers."); ReplaceLockboxDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Rusted Key", false, "Lockboxes will drop Regenerating Scrap instead of items"); ReplaceCrashedMultishopDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Crashed Multishop", false, "Crashed Multishop will drop Regenerating Scrap instead of items"); ReplaceBossHunterDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Trophy Hunters Tricorn", false, "Trophy Hunter's Tricorn will drop Regenerating Scrap instead of items"); SpeedItemSpawnMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Items", "Speed items spawn multiplier", 1f, "Controls the spawn rate of speed items. 0.0x = never. 1.0x = default spawn rate. 2.0x = 2 times more likely to spawn speed items."); ReplaceBossDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Mobs", "Boss", true, "Defeating a Boss will drop Regenerating Scrap instead of items"); ReplaceAWUDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Mobs", "Alloy Worship Unit", true, "Alloy Worship Unit will drop Regenerating Scrap instead of items"); ReplaceScavengerDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Mobs", "Scavenger", true, "Scavenger will drop Regenerating Scrap instead of items"); ReplaceElderLemurianDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Mobs", "Elite Elder Lemurian", true, "The Elite Elder Lemurian in the hidden chamber of Abandoned Aqueduct will drop Regenerating Scrap instead of bands"); ReplaceDoppelgangerDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Artifacts", "Relentless Doppelganger", false, "The Relentless Doppelganger from the Artifact of Vengeance will drop Regenerating Scrap instead of items"); ReplaceSacrificeArtifactDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Artifacts", "Artifact of Sacrifice", true, "When using the Artifact of Sacrifice, mobs will drop Regenerating Scrap instead of items"); ReplaceSimulacrumOrbDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Waves", "Simulacrum", true, "The orb reward after each wave of Simulacrum will drop Regenerating Scrap instead of items"); ReplaceVoidFieldsOrbDropTable = ((BaseUnityPlugin)this).Config.Bind<bool>("Waves", "Void Fields", true, "The orb reward after each wave of the Void Fields will drop Regenerating Scrap instead of items"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ModEnabled)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceChestDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceMultiShopDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceAdaptiveChestDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceChanceShrineDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceLegendaryChestDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceVoidPotentialDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceVoidCradleDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceLunarPodDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceLunarBudsDropTable)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(WhitePrinterSpawnMultiplier, new StepSliderConfig { min = 0f, max = 50f, increment = 0.05f, formatString = "{0:0.##}x" })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(GreenPrinterSpawnMultiplier, new StepSliderConfig { min = 0f, max = 50f, increment = 0.05f, formatString = "{0:0.##}x" })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(RedPrinterSpawnMultiplier, new StepSliderConfig { min = 0f, max = 50f, increment = 0.05f, formatString = "{0:0.##}x" })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(YellowPrinterSpawnMultiplier, new StepSliderConfig { min = 0f, max = 50f, increment = 0.05f, formatString = "{0:0.##}x" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceLockboxDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceCrashedMultishopDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceBossHunterDropTable)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(SpeedItemSpawnMultiplier, new StepSliderConfig { min = 0f, max = 5f, increment = 0.05f, formatString = "{0:0.##}x" })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceBossDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceAWUDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceScavengerDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceElderLemurianDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceDoppelgangerDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceSacrificeArtifactDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceSimulacrumOrbDropTable)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ReplaceVoidFieldsOrbDropTable)); ModSettingsManager.SetModIcon(LoadIconSprite()); Sprite LoadIconSprite() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(2, 2); ImageConversion.LoadImage(val, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "icon.png"))); return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0f, 0f)); } } private void ChestBehavior_Roll(orig_Roll orig, ChestBehavior self) { if (ModEnabled.Value && Object.op_Implicit((Object)(object)self.dropTable)) { if (((Object)self.dropTable).name == "dtGoldChest") { if (ReplaceLegendaryChestDropTable.Value) { using (ReplaceDropTable(self.dropTable, "ChestBehavior_Roll")) { orig.Invoke(self); return; } } } else if (((Object)self.dropTable).name == "dtLockbox") { if (ReplaceLockboxDropTable.Value) { using (ReplaceDropTable(self.dropTable, "ChestBehavior_Roll")) { orig.Invoke(self); return; } } } else if (((Object)self.dropTable).name == "dtLunarChest") { if (ReplaceLunarPodDropTable.Value) { using (ReplaceDropTable(self.dropTable, "ChestBehavior_Roll")) { orig.Invoke(self); return; } } } else if (ReplaceChestDropTable.Value) { using (ReplaceDropTable(self.dropTable, "ChestBehavior_Roll")) { orig.Invoke(self); return; } } } orig.Invoke(self); } private void ShopTerminalBehavior_GenerateNewPickupServer_bool(orig_GenerateNewPickupServer_bool orig, ShopTerminalBehavior self, bool newHidden) { if (ModEnabled.Value) { if ((Object)(object)self.serverMultiShopController == (Object)null) { if (ReplaceLunarBudsDropTable.Value && ((Object)self.dropTable).name == "dtLunarChest") { using (ReplaceDropTable(self.dropTable, "ShopTerminalBehavior_GenerateNewPickupServer_bool")) { orig.Invoke(self, newHidden); return; } } } else if (ReplaceMultiShopDropTable.Value) { using (ReplaceDropTable(self.dropTable, "ShopTerminalBehavior_GenerateNewPickupServer_bool")) { orig.Invoke(self, newHidden); return; } } } orig.Invoke(self, newHidden); } private void RouletteChestController_GenerateEntriesServer(orig_GenerateEntriesServer orig, RouletteChestController self, FixedTimeStamp startTime) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (ModEnabled.Value && ReplaceAdaptiveChestDropTable.Value) { using (ReplaceDropTable(self.dropTable, "RouletteChestController_GenerateEntriesServer")) { orig.Invoke(self, startTime); return; } } orig.Invoke(self, startTime); } private void ShrineChanceBehavior_AddShrineStack(orig_AddShrineStack orig, ShrineChanceBehavior self, Interactor activator) { if (ModEnabled.Value && ReplaceChanceShrineDropTable.Value) { using (ReplaceDropTable(self.dropTable, "ShrineChanceBehavior_AddShrineStack")) { orig.Invoke(self, activator); return; } } orig.Invoke(self, activator); } private void BossGroup_DropRewards(orig_DropRewards orig, BossGroup self) { if (ModEnabled.Value) { if (self.bossDropChance == 0f && ((Object)self.dropTable).name == "dtTier3Item" && self.bossDropTables.Count == 1 && ((Object)self.bossDropTables[0]).name == "dtBossRoboBallBoss") { if (ReplaceAWUDropTable.Value) { Replace(); return; } } else if (ReplaceBossDropTable.Value) { Replace(); return; } } orig.Invoke(self); void Replace() { using CompositeDisposable compositeDisposable = new CompositeDisposable(); if (Object.op_Implicit((Object)(object)self.dropTable)) { compositeDisposable.Add(ReplaceDropTable(self.dropTable, "BossGroup_DropRewards")); } else { Log.Info("dropTable is " + (((object)self.dropTable)?.GetType().Name ?? "null")); } foreach (PickupDropTable item in self.bossDropTables.Distinct()) { compositeDisposable.Add(ReplaceDropTable(item, "BossGroup_DropRewards")); } orig.Invoke(self); } } private bool EquipmentSlot_FireBossHunter(orig_FireBossHunter orig, EquipmentSlot self) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (ModEnabled.Value && ReplaceBossHunterDropTable.Value) { self.UpdateTargets(Equipment.BossHunter.equipmentIndex, true); HurtBox hurtBox = self.currentTarget.hurtBox; object obj; if (hurtBox == null) { obj = null; } else { HealthComponent healthComponent = hurtBox.healthComponent; if (healthComponent == null) { obj = null; } else { CharacterBody body = healthComponent.body; if (body == null) { obj = null; } else { GameObject gameObject = ((Component)body).gameObject; obj = ((gameObject != null) ? gameObject.GetComponent<DeathRewards>() : null); } } } DeathRewards val = (DeathRewards)obj; if (!Object.op_Implicit((Object)(object)hurtBox) || !Object.op_Implicit((Object)(object)val)) { return false; } using (ReplaceDropTable(val.bossDropTable, "EquipmentSlot_FireBossHunter")) { return orig.Invoke(self); } } return orig.Invoke(self); } private void Opening_FixedUpdate(orig_FixedUpdate orig, Opening self) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (ModEnabled.Value && ReplaceScavengerDropTable.Value) { ChestBehavior component = ((EntityState)self).GetComponent<ChestBehavior>(); BasicPickupDropTable dropTable = (BasicPickupDropTable)component.dropTable; using (CreateSelectorCopy(dropTable.selector, delegate(WeightedSelection<PickupIndex> x) { dropTable.selector = x; })) { dropTable.selector.Clear(); List<PickupIndex> list = new List<PickupIndex> { PickupCatalog.FindPickupIndex(MiscPickups.LunarCoin.miscPickupIndex) }; dropTable.Add(Run.instance.availableTier1DropList, component.tier1Chance / (float)Run.instance.availableTier1DropList.Count); dropTable.Add(Run.instance.availableTier2DropList, component.tier2Chance / (float)Run.instance.availableTier2DropList.Count); dropTable.Add(Run.instance.availableTier3DropList, component.tier3Chance / (float)Run.instance.availableTier3DropList.Count); dropTable.Add(Run.instance.availableLunarCombinedDropList, component.lunarChance / (float)Run.instance.availableLunarCombinedDropList.Count); dropTable.Add(list, component.lunarCoinChance); using (ReplaceDropTable((PickupDropTable)(object)dropTable, "Opening_FixedUpdate")) { orig.Invoke(self); return; } } } orig.Invoke(self); } private void ChestBehavior_RollItem(orig_RollItem orig, ChestBehavior self) { if (ModEnabled.Value && ReplaceScavengerDropTable.Value) { self.Roll(); } else { orig.Invoke(self); } } private PickupIndex FreeChestDropTable_GenerateDropPreReplacement(orig_GenerateDropPreReplacement orig, FreeChestDropTable self, Xoroshiro128Plus rng) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) if (ModEnabled.Value && ReplaceCrashedMultishopDropTable.Value) { orig.Invoke(self, rng); using (ReplaceDropTable((PickupDropTable)(object)self, "FreeChestDropTable_GenerateDropPreReplacement")) { return PickupDropTable.GenerateDropFromWeightedSelection(rng, self.selector); } } return orig.Invoke(self, rng); } private PickupIndex DoppelgangerDropTable_GenerateDropPreReplacement(orig_GenerateDropPreReplacement orig, DoppelgangerDropTable self, Xoroshiro128Plus rng) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (ModEnabled.Value && ReplaceDoppelgangerDropTable.Value) { using (ReplaceDropTable((PickupDropTable)(object)self, "DoppelgangerDropTable_GenerateDropPreReplacement")) { return orig.Invoke(self, rng); } } return orig.Invoke(self, rng); } private void SacrificeArtifactManager_OnServerCharacterDeath(orig_OnServerCharacterDeath orig, DamageReport damageReport) { if (ModEnabled.Value && ReplaceSacrificeArtifactDropTable.Value) { using (ReplaceDropTable(SacrificeArtifactManager.dropTable, "SacrificeArtifactManager_OnServerCharacterDeath")) { orig.Invoke(damageReport); return; } } orig.Invoke(damageReport); } private void MasterDropDroplet_DropItems(orig_DropItems orig, MasterDropDroplet self) { if (ModEnabled.Value && ReplaceElderLemurianDropTable.Value) { using (CompositeDisposable compositeDisposable = new CompositeDisposable()) { PickupDropTable[] dropTables = self.dropTables; foreach (PickupDropTable dropTable in dropTables) { compositeDisposable.Add(ReplaceDropTable(dropTable, "MasterDropDroplet_DropItems")); } orig.Invoke(self); return; } } orig.Invoke(self); } private void OptionChestBehavior_Roll(orig_Roll orig, OptionChestBehavior self) { if (ModEnabled.Value && ReplaceVoidPotentialDropTable.Value) { using (ReplaceDropTable(self.dropTable, "OptionChestBehavior_Roll")) { orig.Invoke(self); return; } } orig.Invoke(self); } private WeightedSelection<DirectorCard> SceneDirector_GenerateInteractableCardSelection(orig_GenerateInteractableCardSelection orig, SceneDirector self) { WeightedSelection<DirectorCard> val = orig.Invoke(self); if (ModEnabled.Value) { Dictionary<string, ConfigEntry<float>> dictionary = new Dictionary<string, ConfigEntry<float>> { ["iscDuplicator"] = WhitePrinterSpawnMultiplier, ["iscDuplicatorLarge"] = GreenPrinterSpawnMultiplier, ["iscDuplicatorMilitary"] = RedPrinterSpawnMultiplier, ["iscDuplicatorWild"] = YellowPrinterSpawnMultiplier }; for (int i = 0; i < val.choices.Length; i++) { ref ChoiceInfo<DirectorCard> reference = ref val.choices[i]; if (reference.value != null && dictionary.TryGetValue(((Object)reference.value.spawnCard).name, out var value) && value.Value != 1f) { float weight = reference.weight; val.ModifyChoiceWeight(i, reference.weight * value.Value); Log.Debug($"iscDuplicator weight changed from {weight} to {reference.weight}"); } } } return val; } private void InfiniteTowerWaveController_DropRewards(orig_DropRewards orig, InfiniteTowerWaveController self) { if (ModEnabled.Value && ReplaceSimulacrumOrbDropTable.Value) { using (ReplaceDropTable(self.rewardDropTable, "InfiniteTowerWaveController_DropRewards")) { orig.Invoke(self); return; } } orig.Invoke(self); } private PickupIndex[] ArenaMonsterItemDropTable_GenerateUniqueDropsPreReplacement(orig_GenerateUniqueDropsPreReplacement orig, ArenaMonsterItemDropTable self, int maxDrops, Xoroshiro128Plus rng) { if (ModEnabled.Value && ReplaceSimulacrumOrbDropTable.Value) { using (ReplaceDropTable((PickupDropTable)(object)self, "ArenaMonsterItemDropTable_GenerateUniqueDropsPreReplacement")) { return orig.Invoke(self, maxDrops, rng); } } return orig.Invoke(self, maxDrops, rng); } private void ArenaMissionController_EndRound(orig_EndRound orig, ArenaMissionController self) { if (ModEnabled.Value && ReplaceVoidFieldsOrbDropTable.Value) { using (CompositeDisposable compositeDisposable = new CompositeDisposable()) { PickupDropTable[] playerRewardOrder = self.playerRewardOrder; foreach (PickupDropTable dropTable in playerRewardOrder) { compositeDisposable.Add(ReplaceDropTable(dropTable, "ArenaMissionController_EndRound")); } orig.Invoke(self); return; } } orig.Invoke(self); } private IDisposable ReplaceDropTable(PickupDropTable dropTable, string caller) { BasicPickupDropTable basicDropTable = default(BasicPickupDropTable); ref BasicPickupDropTable reference = ref basicDropTable; PickupDropTable obj = dropTable; reference = (BasicPickupDropTable)(object)((obj is BasicPickupDropTable) ? obj : null); if (basicDropTable != null) { IDisposable result = CreateSelectorCopy(basicDropTable.selector, delegate(WeightedSelection<PickupIndex> x) { basicDropTable.selector = x; }); ReplaceDropTableSelector(basicDropTable.selector); return result; } ExplicitPickupDropTable explicitDropTable = default(ExplicitPickupDropTable); ref ExplicitPickupDropTable reference2 = ref explicitDropTable; PickupDropTable obj2 = dropTable; reference2 = (ExplicitPickupDropTable)(object)((obj2 is ExplicitPickupDropTable) ? obj2 : null); if (explicitDropTable != null) { IDisposable result2 = CreateSelectorCopy(explicitDropTable.weightedSelection, delegate(WeightedSelection<PickupIndex> x) { explicitDropTable.weightedSelection = x; }); ReplaceDropTableSelector(explicitDropTable.weightedSelection); return result2; } FreeChestDropTable freeChestDropTable = default(FreeChestDropTable); ref FreeChestDropTable reference3 = ref freeChestDropTable; PickupDropTable obj3 = dropTable; reference3 = (FreeChestDropTable)(object)((obj3 is FreeChestDropTable) ? obj3 : null); if (freeChestDropTable != null) { IDisposable result3 = CreateSelectorCopy(freeChestDropTable.selector, delegate(WeightedSelection<PickupIndex> x) { freeChestDropTable.selector = x; }); ReplaceDropTableSelector(freeChestDropTable.selector); return result3; } DoppelgangerDropTable doppelgangerDropTable = default(DoppelgangerDropTable); ref DoppelgangerDropTable reference4 = ref doppelgangerDropTable; PickupDropTable obj4 = dropTable; reference4 = (DoppelgangerDropTable)(object)((obj4 is DoppelgangerDropTable) ? obj4 : null); if (doppelgangerDropTable != null) { IDisposable result4 = CreateSelectorCopy(doppelgangerDropTable.selector, delegate(WeightedSelection<PickupIndex> x) { doppelgangerDropTable.selector = x; }); ReplaceDropTableSelector(doppelgangerDropTable.selector); return result4; } ArenaMonsterItemDropTable arenaMonsterItemDropTable = default(ArenaMonsterItemDropTable); ref ArenaMonsterItemDropTable reference5 = ref arenaMonsterItemDropTable; PickupDropTable obj5 = dropTable; reference5 = (ArenaMonsterItemDropTable)(object)((obj5 is ArenaMonsterItemDropTable) ? obj5 : null); if (arenaMonsterItemDropTable != null) { IDisposable result5 = CreateSelectorCopy(arenaMonsterItemDropTable.selector, delegate(WeightedSelection<PickupIndex> x) { arenaMonsterItemDropTable.selector = x; }); ReplaceDropTableSelector(arenaMonsterItemDropTable.selector); return result5; } Log.Warning("Failed to override " + caller + " dropTable"); Log.Warning(caller + " dropTable is of type " + (((object)dropTable)?.GetType().FullName ?? "null")); return Disposable.Empty; void ReplaceDropTableSelector(WeightedSelection<PickupIndex> selector) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < selector.Count; i++) { ref ChoiceInfo<PickupIndex> reference6 = ref selector.choices[i]; if ((int)((PickupIndex)(ref reference6.value)).itemIndex != -1) { reference6.value = PickupCatalog.FindPickupIndex("ItemIndex.RegeneratingScrap"); } } UpdateSpeedItemsSpawnRate(selector); Log.Debug(caller + " " + ((object)dropTable).GetType().Name + " replaced"); } } private void UpdateSpeedItemsSpawnRate(WeightedSelection<PickupIndex> selector) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) if (SpeedItemSpawnMultiplier.Value == 1f) { return; } (ItemIndex, float)[] source = new(ItemIndex, float)[14] { (Items.Hoof.itemIndex, 1f), (Items.SprintBonus.itemIndex, 1f), (Items.AttackSpeedAndMoveSpeed.itemIndex, 1f), (Items.SprintOutOfCombat.itemIndex, 1f), (Items.JumpBoost.itemIndex, 1f), (Items.MoveSpeedOnKill.itemIndex, 1f), (Items.WardOnLevel.itemIndex, 0.33f), (Items.WarCryOnMultiKill.itemIndex, 0.33f), (Items.LunarBadLuck.itemIndex, 0.33f), (Items.AlienHead.itemIndex, 0.33f), (Items.UtilitySkillMagazine.itemIndex, 0.33f), (Items.HalfAttackSpeedHalfCooldowns.itemIndex, 0.33f), (Items.Phasing.itemIndex, 0.25f), (Items.Bandolier.itemIndex, 0.25f) }; (EquipmentIndex, float)[] source2 = new(EquipmentIndex, float)[5] { (Equipment.TeamWarCry.equipmentIndex, 0.5f), (Equipment.Gateway.equipmentIndex, 0.5f), (Equipment.Jetpack.equipmentIndex, 0.5f), (Equipment.FireBallDash.equipmentIndex, 0.5f), (Equipment.Tonic.equipmentIndex, 0.5f) }; for (int i = 0; i < selector.choices.Length; i++) { ref ChoiceInfo<PickupIndex> reference = ref selector.choices[i]; PickupDef pickupDef = ((PickupIndex)(ref reference.value)).pickupDef; float num = (from x in source where x.Item == pickupDef.itemIndex select x.Weigth).Concat(from x in source2 where x.Equipement == pickupDef.equipmentIndex select x.Weigth).FirstOrDefault(); if (num > 0f) { float weight = reference.weight; selector.ModifyChoiceWeight(i, reference.weight + reference.weight * (SpeedItemSpawnMultiplier.Value - 1f) * num); Log.Debug($"{((PickupIndex)(ref reference.value)).pickupDef.nameToken} weight changed from {weight} to {reference.weight}"); } } } private IDisposable CreateSelectorCopy(WeightedSelection<PickupIndex> selector, Action<WeightedSelection<PickupIndex>> setSelector) { WeightedSelection<PickupIndex> oldSelector = selector; setSelector(new WeightedSelection<PickupIndex>(8) { Capacity = selector.Capacity, choices = selector.choices.ToArray(), totalWeight = selector.totalWeight, Count = selector.Count }); return new Disposable(delegate { setSelector(oldSelector); }); } } }