Decompiled source of RiskOfInsanity v1.1.1
RandomizerMod.dll
Decompiled 2 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; 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.FalseSonBoss; using Microsoft.CodeAnalysis; using MonoMod.RuntimeDetour; using On.RoR2; using On.RoR2.CharacterSpeech; using On.RoR2.Projectile; using R2API.Networking; using R2API.Networking.Interfaces; using RandomizerMod.Networking; using RandomizerMod.RandomizerScripts.BuffRandomizers; using RandomizerMod.RandomizerScripts.EnemyRandomizers; using RandomizerMod.RandomizerScripts.ItemRandomizers; using RandomizerMod.RandomizerScripts.MusicRandomizers; using RandomizerMod.RandomizerScripts.ProjectileRandomizers; using RandomizerMod.RandomizerScripts.StageRandomizers; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterSpeech; using RoR2.Projectile; using UnityEngine; using UnityEngine.Events; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("RoR2")] [assembly: AssemblyCompany("RandomizerMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+826b060602e095c6af424eb5d0a092c85c750734")] [assembly: AssemblyProduct("RandomizerMod")] [assembly: AssemblyTitle("RandomizerMod")] [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 RandomizerMod { public enum RandomizeOption { Disabled, UniquePerKind, UniquePerKindWithDuplicates, AlwaysUnique } public class RandomConfigs { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__19_0; public static UnityAction <>9__19_1; public static UnityAction <>9__19_2; public static UnityAction <>9__19_3; public static Func<KeyValuePair<string, ConfigEntry<bool>>, bool> <>9__25_0; public static Func<KeyValuePair<string, ConfigEntry<bool>>, string> <>9__25_1; public static Func<KeyValuePair<string, ConfigEntry<bool>>, bool> <>9__26_0; public static Func<KeyValuePair<string, ConfigEntry<bool>>, string> <>9__26_1; public static Func<KeyValuePair<string, ConfigEntry<bool>>, bool> <>9__27_0; public static Func<KeyValuePair<string, ConfigEntry<bool>>, string> <>9__27_1; public static Func<KeyValuePair<string, ConfigEntry<bool>>, bool> <>9__28_0; public static Func<KeyValuePair<string, ConfigEntry<bool>>, string> <>9__28_1; internal void <SetupConfigs>b__19_0() { foreach (string playerCharacterName in playerCharacterNames) { if (blacklist.TryGetValue(playerCharacterName, out var value)) { value.Value = true; } } } internal void <SetupConfigs>b__19_1() { foreach (string playerCharacterName in playerCharacterNames) { if (blacklist.TryGetValue(playerCharacterName, out var value)) { value.Value = false; } } } internal void <SetupConfigs>b__19_2() { foreach (string droneMasterName in droneMasterNames) { if (blacklist.TryGetValue(droneMasterName, out var value)) { value.Value = true; } } } internal void <SetupConfigs>b__19_3() { foreach (string droneMasterName in droneMasterNames) { if (blacklist.TryGetValue(droneMasterName, out var value)) { value.Value = true; } } } internal bool <GetBlacklistedItems>b__25_0(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Value.Value; } internal string <GetBlacklistedItems>b__25_1(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Key; } internal bool <GetBlacklistedBuffs>b__26_0(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Value.Value; } internal string <GetBlacklistedBuffs>b__26_1(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Key; } internal bool <GetBlacklistedProjectiles>b__27_0(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Value.Value; } internal string <GetBlacklistedProjectiles>b__27_1(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Key; } internal bool <GetBlacklistedHitscans>b__28_0(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Value.Value; } internal string <GetBlacklistedHitscans>b__28_1(KeyValuePair<string, ConfigEntry<bool>> kv) { return kv.Key; } } public static ConfigEntry<EnemyRandomOptions> randomizeEnemiesOption; public static ConfigEntry<bool> replaceChampionsWithChampions; public static ConfigEntry<bool> allowRandomizeWithSelf; public static ConfigEntry<bool> slightBalancing; public static Dictionary<string, ConfigEntry<bool>> blacklist = new Dictionary<string, ConfigEntry<bool>>(); public static ConfigEntry<RandomizeOption> randomizeItems; public static ConfigEntry<bool> randomizeLunars; public static ConfigEntry<bool> randomizeEquipment; public static ConfigEntry<bool> randomizeDronePickups; public static Dictionary<string, ConfigEntry<bool>> itemBlacklist = new Dictionary<string, ConfigEntry<bool>>(); public static ConfigEntry<RandomizeOption> randomizeBuffs; public static Dictionary<string, ConfigEntry<bool>> buffBlacklist = new Dictionary<string, ConfigEntry<bool>>(); public static ConfigEntry<RandomizeOption> randomizeMusic; public static ConfigEntry<RandomizeOption> randomizeProjectiles; public static ConfigEntry<bool> separateStationaryProjectiles; public static Dictionary<string, ConfigEntry<bool>> projectileBlacklist = new Dictionary<string, ConfigEntry<bool>>(); public static ConfigEntry<RandomizeOption> randomizeHitscans; public static Dictionary<string, ConfigEntry<bool>> hitscanBlacklist = new Dictionary<string, ConfigEntry<bool>>(); public static ConfigEntry<bool> randomizeStages; private static List<string> droneMasterNames = new List<string> { "BombardmentDroneMaster", "CleanupDroneMaster", "CopycatDroneMaster", "Drone1Master", "Drone2Master", "DroneBackupMaster", "DroneBomberMaster", "DroneCommanderMaster", "DroneMissileMaster", "EmergencyDroneMaster", "EngiBeamTurretMaster", "EngiTurretMaster", "EngiWalkerTurretMaster", "EquipmentDroneMaster", "FlameDroneMaster", "HaulerDroneMaster", "JailerDroneMaster", "JunkDroneMaster", "MegaDroneMaster", "RechargeDroneMaster", "SquidTurretMaster", "Turret1Master" }; private static List<string> playerCharacterNames = new List<string> { "HuntressMonsterMaster", "DroneTechMonsterMaster", "ToolbotMonsterMaster", "Bandit2MonsterMaster", "CommandoMonsterMaster", "CrocoMonsterMaster", "EngiMonsterMaster", "HereticMonsterMaster", "LoaderMonsterMaster", "MageMonsterMaster", "MercMonsterMaster", "VoidSurvivorMonsterMaster", "ChefMonsterMaster", "FalseSonMonsterMaster", "SeekerMonsterMaster", "DrifterMonsterMaster", "ToolbotMonsterMasterVariant", "RailgunnerMonsterMaster", "TreebotMonsterMaster" }; public static void SetupConfigs(ConfigFile Config) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011c: 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_0132: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Expected O, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Expected O, but got Unknown //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Expected O, but got Unknown //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Expected O, but got Unknown //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Expected O, but got Unknown //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Expected O, but got Unknown //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Expected O, but got Unknown //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Expected O, but got Unknown //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Expected O, but got Unknown //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Expected O, but got Unknown //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Expected O, but got Unknown //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Expected O, but got Unknown randomizeEnemiesOption = Config.Bind<EnemyRandomOptions>("Enemies", "Randomize Enemies", EnemyRandomOptions.UniquePerEnemyType, (ConfigDescription)null); replaceChampionsWithChampions = Config.Bind<bool>("Enemies", "Replace bosses with bosses", false, (ConfigDescription)null); allowRandomizeWithSelf = Config.Bind<bool>("Enemies", "Allow to Randomize With Itself", true, (ConfigDescription)null); slightBalancing = Config.Bind<bool>("Enemies", "Slight balancing", false, "With this enabled, it will pick similar enemies to not make insanely overpowered enemies be picked."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)randomizeEnemiesOption)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(replaceChampionsWithChampions)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowRandomizeWithSelf)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(slightBalancing)); randomizeItems = Config.Bind<RandomizeOption>("Items", "Randomize Items", RandomizeOption.Disabled, "Disabled = no randomization. UniquePerKind = every item maps to one fixed replacement for the whole run. UniquePerKindWithDuplicates = Same as Unique Per Kind, but allows duplicates AlwaysUnique = a new random replacement is picked each time an item drops."); randomizeLunars = Config.Bind<bool>("Items", "Randomize Lunars", false, "Mainly for the bazaar between times, for 5 free items"); randomizeDronePickups = Config.Bind<bool>("Items", "Randomize Drone Pickups", true, "When enabled, drone pickups will also be added to the pool."); randomizeEquipment = Config.Bind<bool>("Items", "Randomize Equipment With Equipment", false, "When enabled, equipment will only randomize with itself (including aspect)"); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)randomizeItems)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(randomizeLunars)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(randomizeDronePickups)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(randomizeEquipment)); randomizeBuffs = Config.Bind<RandomizeOption>("Buffs", "Randomize Buffs", RandomizeOption.Disabled, "Disabled = no randomization. UniquePerKind = each buff always maps to the same replacement. UniquePerKindWithDuplicates = Same as Unique Per Kind, but allows duplicates AlwaysUnique = a new random buff is picked every time one is applied."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)randomizeBuffs)); randomizeMusic = Config.Bind<RandomizeOption>("Music", "Randomize Music", RandomizeOption.Disabled, "Disabled = no randomization. UniquePerKind = each track maps to one fixed replacement. UniquePerKindWithDuplicates = Same as Unique Per Kind, but allows duplicates AlwaysUnique = a new random track is picked every time."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)randomizeMusic)); randomizeProjectiles = Config.Bind<RandomizeOption>("Projectiles", "Randomize Projectiles", RandomizeOption.Disabled, "Disabled = no randomization. UniquePerKind = each projectile prefab maps to one fixed replacement. UniquePerKindWithDuplicates = Same as Unique Per Kind, but allows duplicates AlwaysUnique = a new random prefab is picked on every fire."); separateStationaryProjectiles = Config.Bind<bool>("Projectiles", "Separate Stationary Projectiles", false, "When enabled, moving projectiles will only be randomized with other moving projectiles, and stationary projectiles with stationary projectiles. When disabled, all projectiles can be randomized together."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)randomizeProjectiles)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(separateStationaryProjectiles)); randomizeHitscans = Config.Bind<RandomizeOption>("Hitscans", "Randomize Hitscans", RandomizeOption.Disabled, "Disabled = no randomization. UniquePerKind = each hitscan visual/damage-type maps to one fixed replacement. UniquePerKindWithDuplicates = Same as Unique Per Kind, but allows duplicates AlwaysUnique = a new random hitscan is picked on every shot."); ModSettingsManager.AddOption((BaseOption)new ChoiceOption((ConfigEntryBase)(object)randomizeHitscans)); randomizeStages = Config.Bind<bool>("Stages", "Randomize Stages", false, "False = disabled, True = Enabled."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(randomizeStages)); object obj = <>c.<>9__19_0; if (obj == null) { UnityAction val = delegate { foreach (string playerCharacterName in playerCharacterNames) { if (blacklist.TryGetValue(playerCharacterName, out var value4)) { value4.Value = true; } } }; <>c.<>9__19_0 = val; obj = (object)val; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Blacklist all player monster", "Enemies/Blacklist", (UnityAction)obj)); object obj2 = <>c.<>9__19_1; if (obj2 == null) { UnityAction val2 = delegate { foreach (string playerCharacterName2 in playerCharacterNames) { if (blacklist.TryGetValue(playerCharacterName2, out var value3)) { value3.Value = false; } } }; <>c.<>9__19_1 = val2; obj2 = (object)val2; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Whitelist all player monster", "Enemies/Blacklist", (UnityAction)obj2)); object obj3 = <>c.<>9__19_2; if (obj3 == null) { UnityAction val3 = delegate { foreach (string droneMasterName in droneMasterNames) { if (blacklist.TryGetValue(droneMasterName, out var value2)) { value2.Value = true; } } }; <>c.<>9__19_2 = val3; obj3 = (object)val3; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Blacklist all drones", "Enemies/Blacklist", (UnityAction)obj3)); object obj4 = <>c.<>9__19_3; if (obj4 == null) { UnityAction val4 = delegate { foreach (string droneMasterName2 in droneMasterNames) { if (blacklist.TryGetValue(droneMasterName2, out var value)) { value.Value = true; } } }; <>c.<>9__19_3 = val4; obj4 = (object)val4; } ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Whitelist all drones", "Enemies/Blacklist", (UnityAction)obj4)); } public static void SetupBlacklistOptionsMonsters(ConfigFile Config) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown foreach (CharacterMaster allMaster in MasterCatalog.allMasters) { try { if (!((Object)(object)allMaster == (Object)null) && !blacklist.ContainsKey(((Object)((Component)allMaster).gameObject).name)) { bool flag = RandomizerPlugin.GetForbiddenMasters().Contains(((Object)((Component)allMaster).gameObject).name); ConfigEntry<bool> val = Config.Bind<bool>("Enemies/Blacklist", ((Object)((Component)allMaster).gameObject).name, flag, "Set to true to EXCLUDE this monster from the randomization pool."); blacklist.Add(((Object)((Component)allMaster).gameObject).name, val); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val)); } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[RandomConfigs] Error setting up monster blacklist for master: " + ex.Message)); } } } public static void SetupBlacklistOptionsItem(ConfigFile Config) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Invalid comparison between Unknown and I4 //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Invalid comparison between Unknown and I4 //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Invalid comparison between Unknown and I4 //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Expected O, but got Unknown foreach (PickupDef allPickup in PickupCatalog.allPickups) { try { if (allPickup != null && (int)allPickup.artifactIndex == -1 && (int)allPickup.miscPickupIndex == -1 && ((int)allPickup.itemIndex != -1 || (int)allPickup.equipmentIndex != -1) && !itemBlacklist.ContainsKey(allPickup.internalName)) { bool flag = RandomizerPlugin.GetBlacklist().Contains(allPickup.internalName); ConfigEntry<bool> val = Config.Bind<bool>("Items/Blacklist", allPickup.internalName, flag, "Set to true to EXCLUDE this item from the randomization pool."); itemBlacklist.Add(allPickup.internalName, val); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val)); } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[RandomConfigs] Error setting up item blacklist for pickup: " + ex.Message)); } } } public static void SetupBlacklistOptionsBuff(ConfigFile Config) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown BuffDef[] buffDefs = BuffCatalog.buffDefs; foreach (BuffDef val in buffDefs) { try { if (!((Object)(object)val == (Object)null) && !buffBlacklist.ContainsKey(((Object)val).name)) { ConfigEntry<bool> val2 = Config.Bind<bool>("Buffs/Blacklist", ((Object)val).name, false, "Set to true to EXCLUDE this buff from the randomization pool."); buffBlacklist.Add(((Object)val).name, val2); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val2)); } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[RandomConfigs] Error setting up buff blacklist for buff " + (((val != null) ? ((Object)val).name : null) ?? "null") + ": " + ex.Message)); } } } public static void SetupBlacklistOptionsProjectile(ConfigFile Config) { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Expected O, but got Unknown GameObject[] projectilePrefabs = ProjectileCatalog.projectilePrefabs; foreach (GameObject val in projectilePrefabs) { try { if (!((Object)(object)val == (Object)null)) { string name = ((Object)val).name; if (!string.IsNullOrEmpty(name) && !projectileBlacklist.ContainsKey(name)) { bool flag = RandomizerPlugin.GetForbiddenProjectiles().Contains(name); ConfigEntry<bool> val2 = Config.Bind<bool>("Projectiles/Blacklist", name, flag, "Set to true to EXCLUDE this projectile from being used as a replacement in randomization."); projectileBlacklist.Add(name, val2); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val2)); } } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[RandomConfigs] Error setting up projectile blacklist for prefab " + (((val != null) ? ((Object)val).name : null) ?? "null") + ": " + ex.Message)); } } } public static void SetupBlacklistOptionsHitscan(ConfigFile Config) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown foreach (BulletAttackIdentifier bulletAttackIdentifier in BulletAttackCatalog.bulletAttackIdentifiers) { try { if (bulletAttackIdentifier == null) { continue; } object obj; if ((int)bulletAttackIdentifier.TracerEffectIndex == -1) { obj = "NoTracer"; } else { EffectDef effectDef = EffectCatalog.GetEffectDef(bulletAttackIdentifier.TracerEffectIndex); if (effectDef == null) { obj = null; } else { GameObject prefab = effectDef.prefab; obj = ((prefab != null) ? ((Object)prefab).name : null); } if (obj == null) { obj = "NoTracer"; } } string text = (string)obj; object obj2; if ((int)bulletAttackIdentifier.HitEffectIndex == -1) { obj2 = "NoHit"; } else { EffectDef effectDef2 = EffectCatalog.GetEffectDef(bulletAttackIdentifier.HitEffectIndex); if (effectDef2 == null) { obj2 = null; } else { GameObject prefab2 = effectDef2.prefab; obj2 = ((prefab2 != null) ? ((Object)prefab2).name : null); } if (obj2 == null) { obj2 = "NoHit"; } } string text2 = (string)obj2; string text3 = $"{text}_{text2}_{bulletAttackIdentifier.DamageType}_{bulletAttackIdentifier.Flags}"; if (!hitscanBlacklist.ContainsKey(text3)) { ConfigEntry<bool> val = Config.Bind<bool>("Hitscans/Blacklist", text3, false, "Set to true to EXCLUDE this hitscan (Tracer: " + text + ", Hit: " + text2 + ") from being used as a replacement in randomization."); hitscanBlacklist.Add(text3, val); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(val)); } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[RandomConfigs] Error setting up hitscan blacklist for identifier: " + ex.Message)); } } } public static HashSet<string> GetBlacklistedItems() { return new HashSet<string>(from kv in itemBlacklist where kv.Value.Value select kv.Key); } public static HashSet<string> GetBlacklistedBuffs() { return new HashSet<string>(from kv in buffBlacklist where kv.Value.Value select kv.Key); } public static HashSet<string> GetBlacklistedProjectiles() { return new HashSet<string>(from kv in projectileBlacklist where kv.Value.Value select kv.Key); } public static HashSet<string> GetBlacklistedHitscans() { return new HashSet<string>(from kv in hitscanBlacklist where kv.Value.Value select kv.Key); } } public enum EnemyRandomOptions { Disabled, UniquePerEnemyType, UniquePerEnemyTypeWithinFamily, AlwaysUnique } [BepInPlugin("com.bananastudio.randomizer", "RiskofInsanity", "1.1.0")] public class RandomizerPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static hook_Perform <0>__MasterSummon_Perform; public static hook_OnBodyStart <1>__CharacterMaster_OnBodyStart; public static hook_SpawnRemoteOperationDrone <2>__CharacterMaster_SpawnRemoteOperationDrone; public static hook_PickNextStageScene <3>__Run_PickNextStageScene; public static hook_FireProjectile_FireProjectileInfo <4>__ProjectileManager_FireProjectile_FireProjectileInfo; public static hook_AddBuff_BuffDef <5>__CharacterBody_AddBuff_BuffDef; public static hook_RemoveBuff_BuffDef <6>__CharacterBody_RemoveBuff_BuffDef; public static hook_AddTimedBuff_BuffDef_float <7>__CharacterBody_AddTimedBuff_BuffDef_float; public static hook_AddTimedBuff_BuffDef_float_int <8>__CharacterBody_AddTimedBuff_BuffDef_float_int; public static hook_Fire <9>__BulletAttack_Fire; public static hook_FireSingle <10>__BulletAttack_FireSingle; public static hook_PickCurrentTrack <11>__MusicController_PickCurrentTrack; public static hook_SpeakNow <12>__CharacterSpeechController_SpeakNow; } public const string PluginGUID = "com.bananastudio.randomizer"; public const string PluginName = "RiskofInsanity"; public const string PluginVersion = "1.1.0"; public static ManualLogSource log; private Hook generateDropHook; private Hook generatePickupHook; public static List<Family> families = new List<Family> { new Family("Lemurians", new List<string> { "LemurianMaster", "LemurianBruiserMasterPoison", "LemurianBruiserMasterIce", "LemurianBruiserMasterHaunted", "LemurianBruiserMasterFire", "LemurianBruiserMaster" }), new Family("Beetle", new List<string> { "BeetleQueenMaster", "BeetleMaster", "BeetleGuardMasterCrystal", "BeetleGuardMaster", "BeetleGuardAllyMaster", "BeetleCrystalMaster" }), new Family("Collective", new List<string> { "SolusAmalgamatorFlamethrowerCannonMaster", "SolusAmalgamatorMaster", "SolusAmalgamatorMissilePodMaster", "SolusAmalgamatorThrusterMaster", "SolusHeartMaster", "SolusWingMaster", "DefectiveUnitMaster", "WorkerUnitMaster", "MinePodMaster", "SolusMineMaster", "ExtractorUnitMaster", "IronHaulerMaster", "RoboBallBossMaster" }), new Family("Void", new List<string> { "VoidBarnacleMaster", "VoidBarnacleNoCastMaster", "VoidBarnacleAllyMaster", "VoidInfestorMaster", "VoidJailerAllyMaster", "VoidJailerMaster", "VoidMegaCrabAllyMaster", "VoidMegaCrabMaster", "MiniVoidRaidCrabMasterBase", "MiniVoidRaidCrabMasterPhase1", "MiniVoidRaidCrabMasterPhase2", "MiniVoidRaidCrabMasterPhase3" }), new Family("Constructs", new List<string> { "MegaConstructMaster", "MinorConstructMaster", "MinorConstructOnKillMaster", "MegaConstructMaster" }), new Family("Titans", new List<string> { "TitanGoldAllyMaster", "TitanGoldMaster", "TitanMaster", "GolemMaster", "HalcyoniteMaster", "FalseSonBossLunarShardMaster", "FalseSonBossMaster", "FalseSonBossLunarShardBrokenMaster" }), new Family("Lunars", new List<string> { "LunarWispMaster", "LunarGolemMaster", "LunarExploderMaster", "ITBrotherMaster", "BrotherMaster", "BrotherHurtMaster", "BrotherHauntMaster", "BrotherGlassMaster" }), new Family("Jellys", new List<string> { "JellyfishMaster", "VagrantMaster" }), new Family("Imps", new List<string> { "ImpMaster", "ImpBossMaster" }), new Family("The Family", new List<string> { "ParentMaster", "ParentPodMaster", "GrandparentMaster", "ChildMaster" }), new Family("Wisps", new List<string> { "GravekeeperMaster", "GreaterWispMaster", "WispMaster", "WispSoulMaster" }), new Family("THE GUPS!!!!!!", new List<string> { "GupMaster", "GipMaster", "GeepMaster" }), new Family("Vultures", new List<string> { "VultureHunterMaster", "VultureMaster" }), new Family("Clays", new List<string> { "ClaymanMaster", "ClayBruiserMaster", "ClayBossMaster", "ClayGrenadierMaster" }), new Family("Worms", new List<string> { "ScorchlingMaster", "MagmaWormMaster", "ElectricWormMaster" }), new Family("Scavengers", new List<string> { "ScavLunar1Master", "ScavLunar2Master", "ScavLunar3Master", "ScavLunar4Master", "ScavMaster" }) }; public static RandomizerPlugin Instance { get; private set; } public void Awake() { //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Expected O, but got Unknown //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_022b: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Expected O, but got Unknown //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Expected O, but got Unknown //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Expected O, but got Unknown //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Expected O, but got Unknown //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Expected O, but got Unknown //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Expected O, but got Unknown //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Expected O, but got Unknown //IL_0302: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Expected O, but got Unknown //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Expected O, but got Unknown //IL_035f: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_032e: Expected O, but got Unknown //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Randomizer Mod loaded!"); log = ((BaseUnityPlugin)this).Logger; Instance = this; RandomConfigs.SetupConfigs(((BaseUnityPlugin)this).Config); NetworkingAPI.RegisterMessageType<ProjectileRandomizerSync>(); NetworkingAPI.RegisterMessageType<HitscanRandomizerSync>(); NetworkingAPI.RegisterMessageType<SyncSettings>(); try { MethodInfo method = typeof(PickupDropTable).GetMethod("GenerateDrop", BindingFlags.Instance | BindingFlags.Public); MethodInfo method2 = typeof(ItemRandomizer).GetMethod("PickupDropTable_GenerateDrop", BindingFlags.Static | BindingFlags.Public); if (method != null && method2 != null) { generateDropHook = new Hook((MethodBase)method, method2); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hooked GenerateDrop"); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Could not find methods - GenerateDrop: {method != null}, Hook: {method2 != null}"); } MethodInfo method3 = typeof(PickupDropTable).GetMethod("GeneratePickup", BindingFlags.Instance | BindingFlags.Public); MethodInfo method4 = typeof(ItemRandomizer).GetMethod("PickupDropTable_GeneratePickup", BindingFlags.Static | BindingFlags.Public); if (method3 != null && method4 != null) { generatePickupHook = new Hook((MethodBase)method3, method4); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Hooked GeneratePickup"); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)$"Could not find methods - GeneratePickup: {method3 != null}, Hook: {method4 != null}"); } } catch (Exception arg) { ((BaseUnityPlugin)this).Logger.LogError((object)$"Error setting up pickup hooks: {arg}"); } object obj = <>O.<0>__MasterSummon_Perform; if (obj == null) { hook_Perform val = EnemyRandomizer.MasterSummon_Perform; <>O.<0>__MasterSummon_Perform = val; obj = (object)val; } MasterSummon.Perform += (hook_Perform)obj; object obj2 = <>O.<1>__CharacterMaster_OnBodyStart; if (obj2 == null) { hook_OnBodyStart val2 = EnemyRandomizer.CharacterMaster_OnBodyStart; <>O.<1>__CharacterMaster_OnBodyStart = val2; obj2 = (object)val2; } CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj2; object obj3 = <>O.<2>__CharacterMaster_SpawnRemoteOperationDrone; if (obj3 == null) { hook_SpawnRemoteOperationDrone val3 = EnemyRandomizer.CharacterMaster_SpawnRemoteOperationDrone; <>O.<2>__CharacterMaster_SpawnRemoteOperationDrone = val3; obj3 = (object)val3; } CharacterMaster.SpawnRemoteOperationDrone += (hook_SpawnRemoteOperationDrone)obj3; object obj4 = <>O.<3>__Run_PickNextStageScene; if (obj4 == null) { hook_PickNextStageScene val4 = StageRandomizer.Run_PickNextStageScene; <>O.<3>__Run_PickNextStageScene = val4; obj4 = (object)val4; } Run.PickNextStageScene += (hook_PickNextStageScene)obj4; Run.Start += new hook_Start(Run_Start); object obj5 = <>O.<4>__ProjectileManager_FireProjectile_FireProjectileInfo; if (obj5 == null) { hook_FireProjectile_FireProjectileInfo val5 = ProjectileRandomizer.ProjectileManager_FireProjectile_FireProjectileInfo; <>O.<4>__ProjectileManager_FireProjectile_FireProjectileInfo = val5; obj5 = (object)val5; } ProjectileManager.FireProjectile_FireProjectileInfo += (hook_FireProjectile_FireProjectileInfo)obj5; object obj6 = <>O.<5>__CharacterBody_AddBuff_BuffDef; if (obj6 == null) { hook_AddBuff_BuffDef val6 = BuffRandomizer.CharacterBody_AddBuff_BuffDef; <>O.<5>__CharacterBody_AddBuff_BuffDef = val6; obj6 = (object)val6; } CharacterBody.AddBuff_BuffDef += (hook_AddBuff_BuffDef)obj6; object obj7 = <>O.<6>__CharacterBody_RemoveBuff_BuffDef; if (obj7 == null) { hook_RemoveBuff_BuffDef val7 = BuffRandomizer.CharacterBody_RemoveBuff_BuffDef; <>O.<6>__CharacterBody_RemoveBuff_BuffDef = val7; obj7 = (object)val7; } CharacterBody.RemoveBuff_BuffDef += (hook_RemoveBuff_BuffDef)obj7; object obj8 = <>O.<7>__CharacterBody_AddTimedBuff_BuffDef_float; if (obj8 == null) { hook_AddTimedBuff_BuffDef_float val8 = BuffRandomizer.CharacterBody_AddTimedBuff_BuffDef_float; <>O.<7>__CharacterBody_AddTimedBuff_BuffDef_float = val8; obj8 = (object)val8; } CharacterBody.AddTimedBuff_BuffDef_float += (hook_AddTimedBuff_BuffDef_float)obj8; object obj9 = <>O.<8>__CharacterBody_AddTimedBuff_BuffDef_float_int; if (obj9 == null) { hook_AddTimedBuff_BuffDef_float_int val9 = BuffRandomizer.CharacterBody_AddTimedBuff_BuffDef_float_int; <>O.<8>__CharacterBody_AddTimedBuff_BuffDef_float_int = val9; obj9 = (object)val9; } CharacterBody.AddTimedBuff_BuffDef_float_int += (hook_AddTimedBuff_BuffDef_float_int)obj9; object obj10 = <>O.<9>__BulletAttack_Fire; if (obj10 == null) { hook_Fire val10 = HitscanRandomizer.BulletAttack_Fire; <>O.<9>__BulletAttack_Fire = val10; obj10 = (object)val10; } BulletAttack.Fire += (hook_Fire)obj10; object obj11 = <>O.<10>__BulletAttack_FireSingle; if (obj11 == null) { hook_FireSingle val11 = HitscanRandomizer.BulletAttack_FireSingle; <>O.<10>__BulletAttack_FireSingle = val11; obj11 = (object)val11; } BulletAttack.FireSingle += (hook_FireSingle)obj11; object obj12 = <>O.<11>__MusicController_PickCurrentTrack; if (obj12 == null) { hook_PickCurrentTrack val12 = MusicRandomizer.MusicController_PickCurrentTrack; <>O.<11>__MusicController_PickCurrentTrack = val12; obj12 = (object)val12; } MusicController.PickCurrentTrack += (hook_PickCurrentTrack)obj12; MasterCatalog.Init += new hook_Init(MasterCatalog_Init); ItemCatalog.Init += new hook_Init(ItemCatalog_Init); BuffCatalog.Init += new hook_Init(BuffCatalog_Init); ProjectileCatalog.Init += new hook_Init(ProjectileCatalog_Init); object obj13 = <>O.<12>__CharacterSpeechController_SpeakNow; if (obj13 == null) { hook_SpeakNow val13 = DialogueRandomizer.CharacterSpeechController_SpeakNow; <>O.<12>__CharacterSpeechController_SpeakNow = val13; obj13 = (object)val13; } CharacterSpeechController.SpeakNow += (hook_SpeakNow)obj13; } private void ProjectileCatalog_Init(orig_Init orig) { orig.Invoke(); RandomConfigs.SetupBlacklistOptionsProjectile(((BaseUnityPlugin)this).Config); BulletAttackCatalog.Init(); } private void BuffCatalog_Init(orig_Init orig) { orig.Invoke(); RandomConfigs.SetupBlacklistOptionsBuff(((BaseUnityPlugin)this).Config); } private void ItemCatalog_Init(orig_Init orig) { orig.Invoke(); RandomConfigs.SetupBlacklistOptionsItem(((BaseUnityPlugin)this).Config); } private void MasterCatalog_Init(orig_Init orig) { orig.Invoke(); RandomConfigs.SetupBlacklistOptionsMonsters(((BaseUnityPlugin)this).Config); } private void Update() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!Input.GetKeyDown((KeyCode)284)) { return; } PlayerCharacterMasterController val = PlayerCharacterMasterController.instances[0]; CharacterMaster master = val.master; MinionGroup val2 = MinionGroup.FindGroup(((NetworkBehaviour)master).netId); if (val2 == null) { return; } MinionOwnership[] members = val2.members; foreach (MinionOwnership val3 in members) { if ((Object)(object)val3 != (Object)null) { CharacterMaster component = ((Component)val3).GetComponent<CharacterMaster>(); if ((Object)(object)component != (Object)null) { CharacterBody body = component.GetBody(); ((BaseUnityPlugin)this).Logger.LogInfo((object)((Object)body).name); } } } } private void Run_Start(orig_Start orig, Run self) { if (NetworkServer.active) { NetMessageExtensions.Send((INetMessage)(object)new SyncSettings(), (NetworkDestination)1); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Host initializing randomizers..."); RandomConfigs.SetupBlacklistOptionsHitscan(((BaseUnityPlugin)this).Config); RandomConfigs.SetupBlacklistOptionsProjectile(((BaseUnityPlugin)this).Config); RandomConfigs.SetupBlacklistOptionsBuff(((BaseUnityPlugin)this).Config); RandomConfigs.SetupBlacklistOptionsItem(((BaseUnityPlugin)this).Config); EnemyRandomizer.Init(); ProjectileRandomizer.Reset(); ProjectileRandomizer.Init(); BulletAttackCatalog.Init(); ItemRandomizer.Init(); MusicRandomizer.Init(); BuffRandomizer.Init(); if (NetworkServer.active) { ProjectileRandomizerSync.SendChunked(ProjectileRandomizer.projectileRandomized); HitscanRandomizerSync.SendChunked(BulletAttackCatalog.toRandomize); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Sent projectile sync to clients"); } } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)"Client waiting for sync from host..."); } orig.Invoke(self); } private void OnDestroy() { //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_0040: Expected O, but got Unknown Hook obj = generateDropHook; if (obj != null) { obj.Dispose(); } Hook obj2 = generatePickupHook; if (obj2 != null) { obj2.Dispose(); } object obj3 = <>O.<0>__MasterSummon_Perform; if (obj3 == null) { hook_Perform val = EnemyRandomizer.MasterSummon_Perform; <>O.<0>__MasterSummon_Perform = val; obj3 = (object)val; } MasterSummon.Perform -= (hook_Perform)obj3; } public static HashSet<string> GetBlacklist() { return new HashSet<string> { "ItemIndex.HealthDecay", "ItemIndex.MinHealthPercentage", "ItemIndex.Ghost", "ItemIndex.GummyCloneIdentifier", "ItemIndex.TransferDebuffOnHit", "ItemIndex.TonicAffliction", "ItemIndex.InvadingDoppelganger", "ItemIndex.Junk", "ItemIndex.UseAmbientLevel", "ItemIndex.VoidmanPassiveItem", "ItemIndex.ConvertCritChanceToCritDamage", "ItemIndex.CutHp", "ItemIndex.ExtraLifeVoidConsumed", "ItemIndex.AdaptiveArmor", "ItemIndex.MonsoonPlayerHelper", "ItemIndex.TeleportWhenOob", "ItemIndex.RandomlyLunar", "ItemIndex.BurnNearby", "ItemIndex.ExtraLifeConsumed", "ItemIndex.FragileDamageBonusConsumed", "ItemIndex.HealingPotionConsumed", "ItemIndex.AACannon", "ItemIndex.CrippleWardOnLevel", "ItemIndex.DroneDynamiteDisplay", "ItemIndex.DrizzlePlayerHelper", "ItemIndex.DroneWeaponsDisplay1", "ItemIndex.DroneWeaponsDisplay2", "ItemIndex.EmpowerAlways", "ItemIndex.LemurianHarness", "ItemIndex.LunarWings", "ItemIndex.MageAttunement", "ItemIndex.MinionLeash", "ItemIndex.PlantOnHit", "ItemIndex.PlasmaCore", "ItemIndex.TeamSizeDamageBonus", "ItemIndex.DroneUpgradeHidden", "ItemIndex.CritHeal", "ItemIndex.SkullCounter", "ItemIndex.TempestOnKill", "DroneIndex.DroneCommander", "DroneIndex.BackupDrone", "DroneIndex.EquipmentDrone", "DroneIndex.BomberDrone", "DroneIndex.DTGunnerDrone", "DroneIndex.DTHaulerDrone", "DroneIndex.DTHealDrone", "DroneIndex.MegaDrone", "EquipmentIndex.EliteSecretSpeedEquipment", "EquipmentIndex.EliteGoldEquipment", "EquipmentIndex.Enigma", "EquipmentIndex.IrradiatingLaser", "EquipmentIndex.LunarPotion", "EquipmentIndex.OrbOnUse", "EquipmentIndex.OrbitalLaser", "EquipmentIndex.SoulJar", "EquipmentIndex.GhostGun" }; } public static HashSet<string> GetForbiddenMasters() { return new HashSet<string> { "VoidRaidCrabJointMaster", "VoidRaidCrabMaster", "SolusHeartMaster", "SolusHeartMaster_Offering", "SolusMineMaster", "MajorConstructMaster", "NullifierAllyMaster", "VoidJailerAllyMaster", "VoidBarnacleAllyMaster", "MinorConstructAttachableMaster", "ArchWispMaster", "ParentPodMaster", "DTHaulerDroneMaster", "DTGunnerDroneMaster", "DTHeallingDroneMaster", "ArtifactShellMaster", "BrotherHauntMaster", "LemurianBruiserMasterFire", "LemurianBruiserMasterIce", "LemurianBruiserMasterHaunted", "LemurianBruiserMasterPoison", "ShopkeeperMaster", "SolusVendorMaster", "EngiBeamTurretMaster", "RailgunnerMaster", "PlayerMaster" }; } public static HashSet<string> GetForbiddenProjectiles() { return new HashSet<string> { "AACannon", "BeetleGrubMine", "BellBallSmall", "BellDevice", "EngiMineDeployer", "EngiSeekerGrenadeProjectile", "Funball", "GatewayProjectile", "GummyCloneProjectle", "HaulerThrowProjectile", "LoaderHook", "LoaderYankHook", "MinorConstructOnKillProjectile", "PaladinBigRocket", "PlasmaCore", "RedAffixMissileProjectile", "Rocket", "ScoutGrenade", "SoulSearchGhost", "SoulSearchProjectile", "Spine", "ThrownObjectProjectile", "ThrownObjectProjectileNoStun", "ToolbotDroneHeal", "ToolbotDroneStun", "TransferDebuffOnHitProjectile", "TreebotPounderProjectile", "VultureHunterXiSpearProjectileTeleported", "VultureHunterXiSpearProjectileThrown" }; } public static bool isBlacklistedEnemy(string name) { if (RandomConfigs.blacklist.TryGetValue(name, out var value)) { return value.Value; } return GetForbiddenMasters().Contains(name); } public static Family GetFamily(string prefabName) { return families.FirstOrDefault((Family x) => x.children.Contains(prefabName)); } } public class Family { public string familyName; public List<string> children; public Family(string name, List<string> children) { familyName = name; this.children = children; } } } namespace RandomizerMod.RandomizerScripts.StageRandomizers { public class StageRandomizer { public static void Run_PickNextStageScene(orig_PickNextStageScene orig, Run self, WeightedSelection<SceneDef> choices) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, choices); if (RandomConfigs.randomizeStages.Value) { List<SceneType> forbiddenScenes = new List<SceneType> { (SceneType)3, (SceneType)(-1), (SceneType)6, (SceneType)2, (SceneType)0, (SceneType)4 }; SceneDef[] array = ((IEnumerable<SceneDef>)(object)SceneCatalog.allSceneDefs).Where((SceneDef x) => !forbiddenScenes.Contains(x.sceneType) && !x.baseSceneName.ToLower().Contains("simulacrum") && x.nameToken != "MAP_INFINITETOWER_TITLE").ToArray(); WeightedSelection<SceneDef> val = new WeightedSelection<SceneDef>(8); SceneDef[] array2 = array; foreach (SceneDef val2 in array2) { RandomizerPlugin.log.LogInfo((object)val2.nameToken); val.AddChoice(val2, 1f); } orig.Invoke(self, val); } } } } namespace RandomizerMod.RandomizerScripts.ProjectileRandomizers { public class BulletAttackIdentifier { public EffectIndex TracerEffectIndex; public EffectIndex HitEffectIndex; public DamageType DamageType; public BulletAttackFlags Flags; public BulletAttackIdentifier(EffectIndex tracerEffectIndex, EffectIndex hitEffectIndex, DamageType damageType, BulletAttackFlags flags) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) TracerEffectIndex = tracerEffectIndex; HitEffectIndex = hitEffectIndex; DamageType = damageType; Flags = flags; } public string GetBlacklistKey() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) try { object obj; if ((int)TracerEffectIndex == -1) { obj = "NoTracer"; } else { EffectDef effectDef = EffectCatalog.GetEffectDef(TracerEffectIndex); if (effectDef == null) { obj = null; } else { GameObject prefab = effectDef.prefab; obj = ((prefab != null) ? ((Object)prefab).name : null); } if (obj == null) { obj = "NoTracer"; } } string text = (string)obj; object obj2; if ((int)HitEffectIndex == -1) { obj2 = "NoHit"; } else { EffectDef effectDef2 = EffectCatalog.GetEffectDef(HitEffectIndex); if (effectDef2 == null) { obj2 = null; } else { GameObject prefab2 = effectDef2.prefab; obj2 = ((prefab2 != null) ? ((Object)prefab2).name : null); } if (obj2 == null) { obj2 = "NoHit"; } } string text2 = (string)obj2; return $"{text}_{text2}_{DamageType}_{Flags}"; } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[BulletAttackIdentifier] Error generating blacklist key: " + ex.Message)); return "ErrorGeneratingKey"; } } public bool IsBlacklisted() { try { string blacklistKey = GetBlacklistKey(); HashSet<string> blacklistedHitscans = RandomConfigs.GetBlacklistedHitscans(); return blacklistedHitscans.Contains(blacklistKey); } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[BulletAttackIdentifier] Error checking blacklist status: " + ex.Message)); return false; } } } public class BulletAttackCatalog { public static readonly BulletAttackCatalog Instance = new BulletAttackCatalog(); public static List<BulletAttackIdentifier> bulletAttackIdentifiers = new List<BulletAttackIdentifier>(); public static Dictionary<BulletAttackIdentifier, BulletAttackIdentifier> toRandomize = new Dictionary<BulletAttackIdentifier, BulletAttackIdentifier>(); [SystemInitializer(new Type[] { typeof(EffectCatalog) })] public static void Init() { //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Expected O, but got Unknown bulletAttackIdentifiers.Clear(); initIdentifier("TracerBanditPistol", "HitsparkBandit2Pistol", (DamageType)524292); initIdentifier("TracerBanditPistol", "HitsparkBandit2Pistol", (DamageType)268959744); initIdentifier(null, "OmniImpactVFXSlash", (DamageType)0); initIdentifier("TracerClayBruiserMinigun", "Hitspark1", (DamageType)0); initIdentifier("TracerCommandoBoost", "HitsparkCommandoBarrage", (DamageType)32); initIdentifier("TracerBanditPistol", "HitsparkBanditPistol", (DamageType)4); initIdentifier("TracerCommandoDefault", "HitsparkCommando", (DamageType)0); initIdentifier("TracerBanditShotgun", "HitsparkBandit", (DamageType)0); initIdentifier("TracerBanditPistol", "WeakPointProcEffect", (DamageType)0); initIdentifier("TracerNoSmoke", "Hitspark1", (DamageType)0); initIdentifier("TracerCommandoBoost", "MuzzleflashBarrage", (DamageType)0); initIdentifier(null, "Hitspark1", (DamageType)8); initIdentifier("TracerEngiTurret", "ImpactEngiTurret", (DamageType)0); initIdentifier("TracerBandit2Rifle", "HitsparkBandit", (DamageType)0); initIdentifier("TracerBandit2Shotgun", "HitsparkBandit", (DamageType)0); initIdentifier("TracerCaptainShotgun", "HitsparkCaptainShotgun", (DamageType)0); initIdentifier("TracerCommandoShotgun", "HitsparkCommandoShotgun", (DamageType)0); initIdentifier("TracerHuntressSnipe", "OmniImpactVFXHuntress", (DamageType)0); initIdentifier("TracerRailgunCryo", "ImpactRailgun", (DamageType)256, BulletAttackFlags.Sniper); initIdentifier("TracerRailgun", "ImpactRailgun", (DamageType)0, BulletAttackFlags.Sniper); initIdentifier("TracerRailgunLight", "ImpactRailgunLight", (DamageType)0, BulletAttackFlags.Sniper); initIdentifier("TracerRailgunSuper", "ImpactRailgun", (DamageType)0, BulletAttackFlags.Sniper); initIdentifier("TracerToolbotRebar", "ImpactSpear", (DamageType)0); initIdentifier("TracerGoldGat", null, (DamageType)0); initIdentifier("TracerLaserTurbine", null, (DamageType)0); initIdentifier("TracerLaserTurbineReturn", null, (DamageType)0); initIdentifier(null, "MissileExplosionVFX", (DamageType)0); initIdentifier(null, "MissileExplosionVFX", (DamageType)128); initIdentifier("TracerLunarWispMinigun", "LunarWispMinigunHitspark", (DamageType)0); initIdentifier("TracerMageLightningLaser", "LightningFlash", (DamageType)0); initIdentifier("TracerToolbotNails", "ImpactNailgun", (DamageType)0); initIdentifier(null, "LaserImpactEffect", (DamageType)0); initIdentifier(null, "VoidSurvivorBeamImpactCorrupt", (DamageType)0); initIdentifier("VoidSurvivorBeamTracer", "VoidSurvivorBeamImpact", (DamageType)8); initIdentifier("TracerEmbers", "OmniImpactVFX", (DamageType)0); initIdentifier("TracerNanoPistolCharged", "NanoPistolImpactVFX", (DamageType)0); initIdentifier("TracerNanoPistol", "NanoPistolImpactVFX", (DamageType)0); toRandomize.Clear(); if (RandomConfigs.randomizeHitscans.Value != RandomizeOption.UniquePerKind && RandomConfigs.randomizeHitscans.Value != RandomizeOption.UniquePerKindWithDuplicates) { return; } try { Xoroshiro128Plus val = new Xoroshiro128Plus(Run.instance.seed); List<BulletAttackIdentifier> list = new List<BulletAttackIdentifier>(); foreach (BulletAttackIdentifier bulletAttackIdentifier3 in bulletAttackIdentifiers) { if (bulletAttackIdentifier3 != null && !bulletAttackIdentifier3.IsBlacklisted()) { list.Add(bulletAttackIdentifier3); } } if (list.Count == 0) { RandomizerPlugin.log.LogWarning((object)"[HitRandomizer] All hitscan identifiers are blacklisted! Using full list instead."); list = new List<BulletAttackIdentifier>(bulletAttackIdentifiers); } List<BulletAttackIdentifier> list2 = new List<BulletAttackIdentifier>(list); bool flag = RandomConfigs.randomizeHitscans.Value == RandomizeOption.UniquePerKindWithDuplicates; foreach (BulletAttackIdentifier bulletAttackIdentifier4 in bulletAttackIdentifiers) { if (bulletAttackIdentifier4 == null || toRandomize.ContainsKey(bulletAttackIdentifier4)) { continue; } if (list2.Count == 0) { if (!flag) { break; } list2 = new List<BulletAttackIdentifier>(list); } BulletAttackIdentifier bulletAttackIdentifier = list2[val.RangeInt(0, list2.Count)]; toRandomize.Add(bulletAttackIdentifier4, bulletAttackIdentifier); if (!flag) { list2.Remove(bulletAttackIdentifier); } } RandomizerPlugin.log.LogInfo((object)$"[HitRandomizer] Initialized {toRandomize.Count} hitscan mappings from {list.Count} available identifiers."); } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[HitRandomizer] Error during hitscan randomization initialization: " + ex.Message)); } static EffectIndex findEffectIndex(string name) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: 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) if (string.IsNullOrEmpty(name)) { return (EffectIndex)(-1); } try { for (int i = 0; i < EffectCatalog.effectCount; i++) { EffectDef effectDef = EffectCatalog.GetEffectDef((EffectIndex)i); if (Object.op_Implicit((Object)(object)((effectDef != null) ? effectDef.prefab : null)) && ((Object)effectDef.prefab).name == name) { return effectDef.index; } } } catch (Exception ex2) { RandomizerPlugin.log.LogError((object)("[HitRandomizer] Error finding effect index for " + name + ": " + ex2.Message)); } return (EffectIndex)(-1); } static void initIdentifier(string tracerEffectName, string hitEffectName, DamageType damageType = 0u, BulletAttackFlags flags = BulletAttackFlags.None) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) try { RandomizerPlugin.log.LogInfo((object)("[HitRandomizer] Generating bulletattack for " + tracerEffectName + " with effect name " + hitEffectName)); BulletAttackIdentifier bulletAttackIdentifier2 = new BulletAttackIdentifier(findEffectIndex(tracerEffectName), findEffectIndex(hitEffectName), damageType, flags); RandomizerPlugin.log.LogInfo((object)("[HitRandomizer] Generated bulletattack for " + tracerEffectName + $"effect index is {bulletAttackIdentifier2.HitEffectIndex}")); bulletAttackIdentifiers.Add(bulletAttackIdentifier2); } catch (Exception ex3) { RandomizerPlugin.log.LogError((object)("[HitRandomizer] Error initializing identifier for " + tracerEffectName + "/" + hitEffectName + ": " + ex3.Message)); } } } public static int getIndex(BulletAttackIdentifier attack) { if (bulletAttackIdentifiers.Contains(attack)) { return bulletAttackIdentifiers.IndexOf(attack); } return -999; } public static bool TryGetIdentifier(BulletAttack bulletAttack, out BulletAttackIdentifier identifier) { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 //IL_0058: 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_0077: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) identifier = null; try { RandomizerPlugin.log.LogInfo((object)$"[HitscanRandomizer] TryGetIdentifier - bulletAttackIdentifiers.Count={bulletAttackIdentifiers.Count}"); GameObject tracerEffectPrefab = bulletAttack.tracerEffectPrefab; GameObject hitEffectPrefab = bulletAttack.hitEffectPrefab; for (int i = 0; i < bulletAttackIdentifiers.Count; i++) { BulletAttackIdentifier bulletAttackIdentifier = bulletAttackIdentifiers[i]; object obj; if ((int)bulletAttackIdentifier.TracerEffectIndex == -1) { obj = null; } else { EffectDef effectDef = EffectCatalog.GetEffectDef(bulletAttackIdentifier.TracerEffectIndex); obj = ((effectDef != null) ? effectDef.prefab : null); } GameObject val = (GameObject)obj; object obj2; if ((int)bulletAttackIdentifier.HitEffectIndex == -1) { obj2 = null; } else { EffectDef effectDef2 = EffectCatalog.GetEffectDef(bulletAttackIdentifier.HitEffectIndex); obj2 = ((effectDef2 != null) ? effectDef2.prefab : null); } GameObject val2 = (GameObject)obj2; if (i == 0) { RandomizerPlugin.log.LogInfo((object)("[HitscanRandomizer] TryGetIdentifier - Looking for tracer=" + (((tracerEffectPrefab != null) ? ((Object)tracerEffectPrefab).name : null) ?? "null") + ", hit=" + (((hitEffectPrefab != null) ? ((Object)hitEffectPrefab).name : null) ?? "null"))); RandomizerPlugin.log.LogInfo((object)("[HitscanRandomizer] TryGetIdentifier - First candidate: tracer=" + (((val != null) ? ((Object)val).name : null) ?? "null") + ", hit=" + (((val2 != null) ? ((Object)val2).name : null) ?? "null"))); } if ((Object)(object)val == (Object)(object)tracerEffectPrefab && (Object)(object)val2 == (Object)(object)hitEffectPrefab) { identifier = bulletAttackIdentifier; return true; } } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[HitscanRandomizer] Error in TryGetIdentifier: " + ex.Message)); } return false; } public static BulletAttackIdentifier RandomizeAttack(BulletAttackIdentifier attack) { try { switch (RandomConfigs.randomizeHitscans.Value) { case RandomizeOption.Disabled: return attack; case RandomizeOption.UniquePerKind: case RandomizeOption.UniquePerKindWithDuplicates: { BulletAttackIdentifier value; return toRandomize.TryGetValue(attack, out value) ? value : attack; } case RandomizeOption.AlwaysUnique: { if (bulletAttackIdentifiers.Count == 0) { return attack; } List<BulletAttackIdentifier> list = new List<BulletAttackIdentifier>(); foreach (BulletAttackIdentifier bulletAttackIdentifier in bulletAttackIdentifiers) { if (bulletAttackIdentifier != null && !bulletAttackIdentifier.IsBlacklisted()) { list.Add(bulletAttackIdentifier); } } if (list.Count == 0) { RandomizerPlugin.log.LogWarning((object)"[HitscanRandomizer] All hitscan identifiers are blacklisted! Using original attack."); return attack; } return list[Random.Range(0, list.Count)]; } default: return attack; } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[HitscanRandomizer] Error in RandomizeAttack: " + ex.Message)); return attack; } } public static void ApplyIdentifier(BulletAttack bulletAttack, BulletAttackIdentifier identifier) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) try { if ((int)identifier.TracerEffectIndex != -1) { EffectDef effectDef = EffectCatalog.GetEffectDef(identifier.TracerEffectIndex); bulletAttack.tracerEffectPrefab = ((effectDef != null) ? effectDef.prefab : null); } if ((int)identifier.HitEffectIndex != -1) { EffectDef effectDef2 = EffectCatalog.GetEffectDef(identifier.HitEffectIndex); bulletAttack.hitEffectPrefab = ((effectDef2 != null) ? effectDef2.prefab : null); } DamageTypeCombo damageType = default(DamageTypeCombo); ((DamageTypeCombo)(ref damageType))..ctor(DamageTypeCombo.op_Implicit(identifier.DamageType), bulletAttack.damageType.damageTypeExtended, bulletAttack.damageType.damageSource); bulletAttack.damageType = damageType; } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[HitscanRandomizer] Error applying identifier to bullet attack: " + ex.Message)); } } } [Flags] public enum BulletAttackFlags : uint { None = 0u, Sniper = 1u } public class HitscanRandomizer { public static void BulletAttack_Fire(orig_Fire orig, BulletAttack self) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) if (RandomConfigs.randomizeHitscans.Value == RandomizeOption.Disabled) { orig.Invoke(self); return; } try { ManualLogSource log = RandomizerPlugin.log; GameObject tracerEffectPrefab = self.tracerEffectPrefab; string arg = ((tracerEffectPrefab != null) ? ((Object)tracerEffectPrefab).name : null) ?? "null"; GameObject hitEffectPrefab = self.hitEffectPrefab; log.LogInfo((object)string.Format("[HitscanRandomizer] BulletAttack.Fire called. tracerEffectPrefab={0}, hitEffectPrefab={1}, damageType={2}", arg, ((hitEffectPrefab != null) ? ((Object)hitEffectPrefab).name : null) ?? "null", self.damageType)); if (BulletAttackCatalog.TryGetIdentifier(self, out var identifier)) { RandomizerPlugin.log.LogInfo((object)$"[HitscanRandomizer] Fire - Matched identifier. Tracer={identifier.TracerEffectIndex}, Hit={identifier.HitEffectIndex}, DamageType={identifier.DamageType}"); BulletAttackIdentifier bulletAttackIdentifier = BulletAttackCatalog.RandomizeAttack(identifier); RandomizerPlugin.log.LogInfo((object)$"[HitscanRandomizer] Fire - Randomized to. Tracer={bulletAttackIdentifier.TracerEffectIndex}, Hit={bulletAttackIdentifier.HitEffectIndex}, DamageType={bulletAttackIdentifier.DamageType}"); BulletAttackCatalog.ApplyIdentifier(self, bulletAttackIdentifier); } else { RandomizerPlugin.log.LogInfo((object)"[HitscanRandomizer] Fire - No identifier match found, skipping."); } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[HitscanRandomizer] Error in BulletAttack_Fire hook: " + ex.Message + "\n" + ex.StackTrace)); } orig.Invoke(self); } public static void BulletAttack_FireSingle(orig_FireSingle orig, BulletAttack self, FireSingleArgs args) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) if (RandomConfigs.randomizeHitscans.Value == RandomizeOption.Disabled) { orig.Invoke(self, args); return; } try { ManualLogSource log = RandomizerPlugin.log; GameObject tracerEffectPrefab = self.tracerEffectPrefab; string arg = ((tracerEffectPrefab != null) ? ((Object)tracerEffectPrefab).name : null) ?? "null"; GameObject hitEffectPrefab = self.hitEffectPrefab; log.LogInfo((object)string.Format("[HitscanRandomizer] BulletAttack.FireSingle called. tracerEffectPrefab={0}, hitEffectPrefab={1}, damageType={2}", arg, ((hitEffectPrefab != null) ? ((Object)hitEffectPrefab).name : null) ?? "null", self.damageType)); if (BulletAttackCatalog.TryGetIdentifier(self, out var identifier)) { RandomizerPlugin.log.LogInfo((object)$"[HitscanRandomizer] FireSingle - Matched identifier. Tracer={identifier.TracerEffectIndex}, Hit={identifier.HitEffectIndex}, DamageType={identifier.DamageType}"); BulletAttackIdentifier bulletAttackIdentifier = BulletAttackCatalog.RandomizeAttack(identifier); RandomizerPlugin.log.LogInfo((object)$"[HitscanRandomizer] FireSingle - Randomized to. Tracer={bulletAttackIdentifier.TracerEffectIndex}, Hit={bulletAttackIdentifier.HitEffectIndex}, DamageType={bulletAttackIdentifier.DamageType}"); BulletAttackCatalog.ApplyIdentifier(self, bulletAttackIdentifier); } else { RandomizerPlugin.log.LogInfo((object)"[HitscanRandomizer] FireSingle - No identifier match found, skipping."); } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[HitscanRandomizer] Error in BulletAttack_FireSingle hook: " + ex.Message + "\n" + ex.StackTrace)); } orig.Invoke(self, args); } } public class ProjectileRandomizer { public static Dictionary<GameObject, GameObject> projectileRandomized = new Dictionary<GameObject, GameObject>(); private static GameObject[] allPrefabs; private static List<GameObject> movingProjectiles = new List<GameObject>(); private static List<GameObject> stationaryProjectiles = new List<GameObject>(); public static void Init() { //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown projectileRandomized.Clear(); movingProjectiles.Clear(); stationaryProjectiles.Clear(); GameObject[] projectilePrefabs = ProjectileCatalog.projectilePrefabs; if (projectilePrefabs == null || projectilePrefabs.Length == 0) { RandomizerPlugin.log.LogError((object)"[ProjectileRandomizer] ProjectileCatalog.projectilePrefabs is null or empty!"); return; } try { if ((Object)(object)Run.instance == (Object)null) { RandomizerPlugin.log.LogError((object)"[ProjectileRandomizer] Run.instance is null during Init!"); return; } Xoroshiro128Plus val = new Xoroshiro128Plus(Run.instance.seed); HashSet<string> blacklistedProjectiles = RandomConfigs.GetBlacklistedProjectiles(); GameObject[] array = (allPrefabs = projectilePrefabs.Where((GameObject x) => (Object)(object)x != (Object)null && !blacklistedProjectiles.Contains(((Object)x).name)).ToArray()); if (RandomConfigs.separateStationaryProjectiles.Value || RandomConfigs.randomizeProjectiles.Value == RandomizeOption.UniquePerKind || RandomConfigs.randomizeProjectiles.Value == RandomizeOption.UniquePerKindWithDuplicates) { GameObject[] array2 = array; foreach (GameObject val2 in array2) { try { if (!((Object)(object)val2 == (Object)null)) { ProjectileSimple component = val2.GetComponent<ProjectileSimple>(); if ((Object)(object)component != (Object)null && component.desiredForwardSpeed > 0f) { movingProjectiles.Add(val2); } else { stationaryProjectiles.Add(val2); } } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error categorizing projectile " + (((val2 != null) ? ((Object)val2).name : null) ?? "null") + ": " + ex.Message)); } } } if ((!NetworkServer.active && NetworkClient.active) || (RandomConfigs.randomizeProjectiles.Value != RandomizeOption.UniquePerKind && RandomConfigs.randomizeProjectiles.Value != RandomizeOption.UniquePerKindWithDuplicates)) { return; } bool flag = RandomConfigs.randomizeProjectiles.Value == RandomizeOption.UniquePerKindWithDuplicates; if (RandomConfigs.separateStationaryProjectiles.Value) { if (movingProjectiles.Count == 0) { RandomizerPlugin.log.LogWarning((object)"[ProjectileRandomizer] No non-blacklisted moving projectiles available!"); } else { List<GameObject> list = new List<GameObject>(movingProjectiles); foreach (GameObject movingProjectile in movingProjectiles) { try { if (projectileRandomized.ContainsKey(movingProjectile)) { continue; } if (list.Count == 0) { if (!flag) { break; } list = new List<GameObject>(movingProjectiles); } GameObject val3 = list[val.RangeInt(0, list.Count)]; projectileRandomized.Add(movingProjectile, val3); if (!flag) { list.Remove(val3); } } catch (Exception ex2) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error randomizing moving projectile " + (((movingProjectile != null) ? ((Object)movingProjectile).name : null) ?? "null") + ": " + ex2.Message)); } } } if (stationaryProjectiles.Count == 0) { RandomizerPlugin.log.LogWarning((object)"[ProjectileRandomizer] No non-blacklisted stationary projectiles available!"); } else { List<GameObject> list2 = new List<GameObject>(stationaryProjectiles); foreach (GameObject stationaryProjectile in stationaryProjectiles) { try { if (projectileRandomized.ContainsKey(stationaryProjectile)) { continue; } if (list2.Count == 0) { if (!flag) { break; } list2 = new List<GameObject>(stationaryProjectiles); } GameObject val4 = list2[val.RangeInt(0, list2.Count)]; projectileRandomized.Add(stationaryProjectile, val4); if (!flag) { list2.Remove(val4); } } catch (Exception ex3) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error randomizing stationary projectile " + (((stationaryProjectile != null) ? ((Object)stationaryProjectile).name : null) ?? "null") + ": " + ex3.Message)); } } } } else { List<GameObject> list3 = new List<GameObject>(array); if (list3.Count == 0) { RandomizerPlugin.log.LogWarning((object)"[ProjectileRandomizer] No non-blacklisted projectiles available!"); return; } List<GameObject> list4 = new List<GameObject>(list3); foreach (GameObject item in list3) { try { if (projectileRandomized.ContainsKey(item)) { continue; } if (list4.Count == 0) { if (!flag) { break; } list4 = new List<GameObject>(list3); } GameObject val5 = list4[val.RangeInt(0, list4.Count)]; projectileRandomized.Add(item, val5); if (!flag) { list4.Remove(val5); } } catch (Exception ex4) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error randomizing projectile " + (((item != null) ? ((Object)item).name : null) ?? "null") + ": " + ex4.Message)); } } } RandomizerPlugin.log.LogInfo((object)($"[ProjectileRandomizer] Initialized {projectileRandomized.Count} projectile mappings. " + $"Moving: {movingProjectiles.Count}, Stationary: {stationaryProjectiles.Count}")); } catch (Exception ex5) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error during projectile randomization initialization: " + ex5.Message + "\n" + ex5.StackTrace)); } } public static void Reset() { projectileRandomized.Clear(); movingProjectiles.Clear(); stationaryProjectiles.Clear(); } private static GameObject Resolve(GameObject original) { try { HashSet<string> blacklistedProjectiles = RandomConfigs.GetBlacklistedProjectiles(); switch (RandomConfigs.randomizeProjectiles.Value) { case RandomizeOption.Disabled: return original; case RandomizeOption.UniquePerKind: case RandomizeOption.UniquePerKindWithDuplicates: { if (projectileRandomized.TryGetValue(original, out var value)) { return value; } if (RandomConfigs.separateStationaryProjectiles.Value) { ProjectileSimple component2 = original.GetComponent<ProjectileSimple>(); List<GameObject> list3 = (((Object)(object)component2 != (Object)null && component2.desiredForwardSpeed > 0f) ? movingProjectiles : stationaryProjectiles); if (list3.Count > 0) { GameObject val2 = list3[Random.Range(0, list3.Count)]; projectileRandomized[original] = val2; return val2; } } return original; } case RandomizeOption.AlwaysUnique: { if (allPrefabs == null || allPrefabs.Length == 0) { return original; } if (blacklistedProjectiles.Contains(((Object)original).name)) { return original; } if (RandomConfigs.separateStationaryProjectiles.Value) { ProjectileSimple component = original.GetComponent<ProjectileSimple>(); bool flag = (Object)(object)component != (Object)null && component.desiredForwardSpeed > 0f; List<GameObject> list = (flag ? movingProjectiles : stationaryProjectiles); if (list.Count > 0) { return list[Random.Range(0, list.Count)]; } RandomizerPlugin.log.LogWarning((object)("[ProjectileRandomizer] No available projectiles in pool for " + (flag ? "moving" : "stationary") + " projectile " + (((original != null) ? ((Object)original).name : null) ?? "null"))); return original; } List<GameObject> list2 = new List<GameObject>(); GameObject[] array = allPrefabs; foreach (GameObject val in array) { if ((Object)(object)val != (Object)null && !blacklistedProjectiles.Contains(((Object)val).name)) { list2.Add(val); } } if (list2.Count == 0) { RandomizerPlugin.log.LogWarning((object)"[ProjectileRandomizer] All projectiles are blacklisted! Using original."); return original; } return list2[Random.Range(0, list2.Count)]; } default: return original; } } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error in Resolve for " + (((original != null) ? ((Object)original).name : null) ?? "null") + ": " + ex.Message)); return original; } } public static void ProjectileManager_FireProjectileServer(orig_FireProjectileServer orig, ProjectileManager self, FireProjectileInfo fireProjectileInfo, NetworkConnection clientAuthorityOwner, ushort predictionId, double fastForwardTime) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) try { fireProjectileInfo.projectilePrefab = Resolve(fireProjectileInfo.projectilePrefab); } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error in ProjectileManager_FireProjectileServer hook: " + ex.Message)); } orig.Invoke(self, fireProjectileInfo, clientAuthorityOwner, predictionId, fastForwardTime); } public static void ProjectileManager_FireProjectile_FireProjectileInfo(orig_FireProjectile_FireProjectileInfo orig, ProjectileManager self, FireProjectileInfo fireProjectileInfo) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) try { fireProjectileInfo.projectilePrefab = Resolve(fireProjectileInfo.projectilePrefab); } catch (Exception ex) { RandomizerPlugin.log.LogError((object)("[ProjectileRandomizer] Error in ProjectileManager_FireProjectile_FireProjectileInfo hook: " + ex.Message)); } orig.Invoke(self, fireProjectileInfo); } } } namespace RandomizerMod.RandomizerScripts.MusicRandomizers { public class MusicRandomizer { public static Dictionary<MusicTrackDef, MusicTrackDef> toRandomize = new Dictionary<MusicTrackDef, MusicTrackDef>(); private static MusicTrackDef[] allTracks; public static void Init() { toRandomize.Clear(); allTracks = MusicTrackCatalog.musicTrackDefs; if (RandomConfigs.randomizeMusic.Value != RandomizeOption.UniquePerKind && RandomConfigs.randomizeMusic.Value != RandomizeOption.UniquePerKindWithDuplicates) { return; } List<MusicTrackDef> list = new List<MusicTrackDef>(allTracks); bool flag = RandomConfigs.randomizeMusic.Value == RandomizeOption.UniquePerKindWithDuplicates; MusicTrackDef[] array = allTracks; foreach (MusicTrackDef key in array) { if (!toRandomize.ContainsKey(key)) { if (list.Count == 0) { break; } MusicTrackDef val = list[Random.Range(0, list.Count)]; toRandomize.Add(key, val); if (!flag) { list.Remove(val); } } } } public static void MusicController_PickCurrentTrack(orig_PickCurrentTrack orig, MusicController self, ref MusicTrackDef newTrack) { orig.Invoke(self, ref newTrack); if ((Object)(object)newTrack == (Object)null) { return; } switch (RandomConfigs.randomizeMusic.Value) { case RandomizeOption.Disabled: break; case RandomizeOption.UniquePerKind: case RandomizeOption.UniquePerKindWithDuplicates: { if (toRandomize.TryGetValue(newTrack, out var value)) { newTrack = value; } break; } case RandomizeOption.AlwaysUnique: if (allTracks != null && allTracks.Length != 0) { newTrack = allTracks[Random.Range(0, allTracks.Length)]; } break; } } } } namespace RandomizerMod.RandomizerScripts.ItemRandomizers { public class ItemRandomizer { public delegate PickupIndex orig_GenerateDrop(PickupDropTable self, Xoroshiro128Plus rng); public delegate UniquePickup orig_GeneratePickup(PickupDropTable self, Xoroshiro128Plus rng); private static Dictionary<PickupDef, PickupDef> toRandomize = new Dictionary<PickupDef, PickupDef>(); private static List<PickupDef> candidatePool = new List<PickupDef>(); private static List<PickupDef> equipmentPool = new List<PickupDef>(); public static void Init() { toRandomize.Clear(); candidatePool.Clear(); equipmentPool.Clear(); HashSet<string> blacklist = RandomizerPlugin.GetBlacklist(); bool droneBlacklist = RandomConfigs.randomizeDronePickups.Value; List<PickupDef> list = (from p in PickupCatalog.allPickups where !blacklist.Contains(p.internalName) where (int)p.artifactIndex == -1 && (int)p.miscPickupIndex == -1 && (droneBlacklist || (int)p.droneIndex == -1) select p).ToList(); if (RandomConfigs.randomizeEquipment.Value) { equipmentPool.AddRange(list.Where((PickupDef p) => (int)p.equipmentIndex != -1)); candidatePool.AddRange(list.Where((PickupDef p) => (int)p.equipmentIndex == -1)); } else { candidatePool.AddRange(list); } if (RandomConfigs.randomizeItems.Value != RandomizeOption.UniquePerKind && RandomConfigs.randomizeItems.Value != RandomizeOption.UniquePerKindWithDuplicates) { return; } bool flag = RandomConfigs.randomizeItems.Value == RandomizeOption.UniquePerKindWithDuplicates; List<PickupDef> list2 = new List<PickupDef>(candidatePool); foreach (PickupDef item in candidatePool) { if (!toRandomize.ContainsKey(item)) { if (list2.Count == 0) { break; } PickupDef val = list2[Random.Range(0, list2.Count)]; toRandomize.Add(item, val); if (!flag) { list2.Remove(val); } } } if (!RandomConfigs.randomizeEquipment.Value || equipmentPool.Count <= 0) { return; } List<PickupDef> list3 = new List<PickupDef>(equipmentPool); foreach (PickupDef item2 in equipmentPool) { if (!toRandomize.ContainsKey(item2)) { if (list3.Count == 0) { break; } PickupDef val2 = list3[Random.Range(0, list3.Count)]; toRandomize.Add(item2, val2); if (!flag) { list3.Remove(val2); } } } } public static PickupIndex PickupDropTable_GenerateDrop(orig_GenerateDrop orig, PickupDropTable self, Xoroshiro128Plus rng) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: 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_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) PickupIndex val = orig(self, rng); if (val == PickupIndex.none || !((PickupIndex)(ref val)).isValid) { return val; } return ApplyPickupRandomization(val, rng); } public static UniquePickup PickupDropTable_GeneratePickup(orig_GeneratePickup orig, PickupDropTable self, Xoroshiro128Plus rng) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) UniquePickup val = orig(self, rng); if (val.pickupIndex == PickupIndex.none || !((PickupIndex)(ref val.pickupIndex)).isValid) { return val; } ItemDef itemDef = ItemCatalog.GetItemDef(((PickupIndex)(ref val.pickupIndex)).itemIndex); if ((Object)(object)itemDef != (Object)null && itemDef.tags.Contains((ItemTag)33)) { return val; } PickupIndex val2 = ApplyPickupRandomization(val.pickupIndex, rng); return ((UniquePickup)(ref val)).WithPickupIndex(val2); } public static PickupIndex ApplyPickupRandomization(PickupIndex pickupIndex, Xoroshiro128Plus rng) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_002b: 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) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Invalid comparison between Unknown and I4 //IL_0072: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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) if (RandomConfigs.randomizeItems.Value == RandomizeOption.Disabled) { return pickupIndex; } PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef == null) { return pickupIndex; } if ((int)pickupDef.itemTier == 3 && !RandomConfigs.randomizeLunars.Value) { return pickupIndex; } HashSet<string> blacklist = RandomizerPlugin.GetBlacklist(); if (blacklist.Contains(pickupDef.internalName)) { return pickupIndex; } bool flag = (int)pickupDef.equipmentIndex != -1; switch (RandomConfigs.randomizeItems.Value) { case RandomizeOption.UniquePerKind: case RandomizeOption.UniquePerKindWithDuplicates: { if (toRandomize.TryGetValue(pickupDef, out var value)) { return value.pickupIndex; } return pickupIndex; } case RandomizeOption.AlwaysUnique: { List<PickupDef> list = ((flag && RandomConfigs.randomizeEquipment.Value) ? equipmentPool : candidatePool); if (list.Count == 0) { return pickupIndex; } return list[rng.RangeInt(0, list.Count)].pickupIndex; } default: return pickupIndex; } } } } namespace RandomizerMod.RandomizerScripts.EnemyRandomizers { public class DialogueRandomizer { public static void CharacterSpeechController_SpeakNow(orig_SpeakNow orig, CharacterSpeechController self, ref SpeechInfo speechInfo) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_012b: 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_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown if (!NetworkServer.active) { return; } if (CharacterSpeechController.cvEnableLogging.value) { self.Log($"Playing speech: {speechInfo}"); } self.nextSpeakTime = self.localTime + speechInfo.duration; GameObject sender = null; SfxLocator val = null; if (Object.op_Implicit((Object)(object)self.characterMaster)) { CharacterBody body = self.characterMaster.GetBody(); if (Object.op_Implicit((Object)(object)body)) { val = ((Component)body).GetComponent<SfxLocator>(); } } EnemyRandomizer.RandomizedFrom randomizedFrom = default(EnemyRandomizer.RandomizedFrom); if (((Component)self.characterMaster).TryGetComponent<EnemyRandomizer.RandomizedFrom>(ref randomizedFrom)) { string originalNameString = randomizedFrom.originalNameString; string @string = Language.GetString(self.chatFormatToken); @string = @string.Replace(Language.GetString(originalNameString), Language.GetString(self.characterMaster.GetBody().baseNameToken)); RandomizerPlugin.log.LogInfo((object)("Sending dialogue: bossname: " + originalNameString + ", original: " + @string + ", " + self.characterMaster.GetBody().baseNameToken)); Chat.SendBroadcastChat((ChatMessageBase)new NpcChatMessage { baseToken = speechInfo.token, formatStringToken = @string, sender = sender, sound = (((Object)(object)val != (Object)null) ? val.barkSound : null) }); } else { Chat.SendBroadcastChat((ChatMessageBase)new BodyChatMessage { bodyObject = ((Component)self.characterMaster.GetBody()).gameObject, token = speechInfo.token }); } } } public class EnemyRandomizer { public class RandomizedFrom : MonoBehaviour { public string originalMasterName; public string originalNameString; } public static Dictionary<GameObject, GameObject> toRandomizeWith = new Dictionary<GameObject, GameObject>(); public static Dictionary<GameObject, GameObject> masterPrefabToRandomMaster = new Dictionary<GameObject, GameObject>(); private static Dictionary<GameObject, GameObject> bodyPrefabToRandomBody = new Dictionary<GameObject, GameObject>(); private static Dictionary<GameObject, float> masterPrefabToDirectorCost = new Dictionary<GameObject, float>(); private static float HealthScore(CharacterBody body) { if ((Object)(object)body == (Object)null) { return 0f; } return body.baseMaxHealth + body.levelMaxHealth * 10f; } private static void CacheSpawnCardCosts() { CharacterSpawnCard[] array = Resources.FindObjectsOfTypeAll<CharacterSpawnCard>(); CharacterSpawnCard[] array2 = array; foreach (CharacterSpawnCard val in array2) { if ((Object)(object)val != (Object)null && (Object)(object)((SpawnCard)val).prefab != (Object)null) { masterPrefabToDirectorCost[((SpawnCard)val).prefab] = ((SpawnCard)val).directorCreditCost; } } } private static float GetDirectorCost(GameObject masterPrefab) { if (masterPrefabToDirectorCost.TryGetValue(masterPrefab, out var value)) { return value; } return 0f; } public static void Init() { toRandomizeWith.Clear(); masterPrefabToRandomMaster.Clear(); bodyPrefabToRandomBody.Clear(); masterPrefabToDirectorCost.Clear(); if (RandomConfigs.randomizeEnemiesOption.Value == EnemyRandomOptions.Disabled || RandomConfigs.randomizeEnemiesOption.Value == EnemyRandomOptions.AlwaysUnique) { return; } if (RandomConfigs.slightBalancing.Value) { CacheSpawnCardCosts(); } var array = (from <>h__TransparentIdentifier0 in MasterCatalog.allMasters.Select(delegate(CharacterMaster master) { object body; if (master == null) { body = null; } else { GameObject bodyPrefab = master.bodyPrefab; body = ((bodyPrefab != null) ? bodyPrefab.GetComponent<CharacterBody>() : null); } return new { master = master, body = (CharacterBody)body }; }) where (Object)(object)<>h__TransparentIdentifier0.body != (Object)null && !RandomizerPlugin.isBlacklistedEnemy(((Object)<>h__TransparentIdentifier0.master).name) select new { masterPrefab = ((Component)<>h__TransparentIdentifier0.master).gameObject, body = <>h__TransparentIdentifier0.body, masterName = ((Object)<>h__TransparentIdentifier0.master).name }).ToArray(); List<GameObject> list = new List<GameObject>(); list.AddRange(array.Select(p => p.masterPrefab)); var array2 = array; foreach (var anon in array2) { if (!toRandomizeWith.ContainsKey(anon.masterPrefab)) { int num = 0; Family family = null; if (RandomConfigs.randomizeEnemiesOption.Value == EnemyRandomOptions.UniquePerEnemyTypeWithinFamily) { family = RandomizerPlugin.GetFamily(anon.masterName); } GameObject randomMaster; do { randomMaster = getRandomMaster(list, anon.body.isChampion, family, anon.masterPrefab, anon.body); num++; } while ((Object)(object)randomMaster == (Object)(object)anon.masterPrefab && !RandomConfigs.allowRandomizeWithSelf.Value && list.Count > 1 && num < 50); toRandomizeWith.Add(anon.masterPrefab, randomMaster); if (!masterPrefabToRandomMaster.ContainsKey(anon.masterPrefab)) { masterPrefabToRandomMaster.Add(anon.masterPrefab, randomMaster); } list.Remove(randomMaster); } } } private static void LogAllComponents(GameObject tologg) { Component[] components = tologg.GetComponents<Component>(); foreach (Component val in components) { RandomizerPlugin.log.LogInfo((object)((object)val).GetType().Name); } } public static void CharacterMaster_SpawnRemoteOperationDrone(orig_SpawnRemoteOperationDrone orig, CharacterMaster self, string droneBodyToSpawn, uint moneyToUse) { //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if (RandomConfigs.randomizeEnemiesOption.Value == EnemyRandomOptions.Disabled) { orig.Invoke(self, droneBodyToSpawn, moneyToUse); return; } GameObject val = BodyCatalog.FindBodyPrefab(droneBodyToSpawn); if ((Object)(object)val == (Object)null) { orig.Invoke(self, droneBodyToSpawn, moneyToUse); return; } CharacterBody component = val.GetComponent<CharacterBody>(); if ((Object)(object)component == (Object)null) { orig.Invoke(self, droneBodyToSpawn, moneyToUse); return; } string name = ((Object)val).name; GameObject val2 = ((RandomConfigs.randomizeEnemiesOption.Value != EnemyRandomOptions.AlwaysUnique) ? GetRandomBodyConsistent(val, component) : GetRandomBodyDirect(val, component)); if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)val) { CharacterBody component2 = val2.GetComponent<CharacterBody>(); if ((Object)(object)component2 != (Object)null) { droneBodyToSpawn = BodyCatalog.GetBodyName(component2.bodyIndex); } } orig.Invoke(self, droneBodyToSpawn, moneyToUse); } private static GameObject GetRandomBodyDirect(GameObject originalBodyPrefab, CharacterBody originalBody) { bool isChampion = originalBody?.isChampion ?? false; GameObject[] array = (from body in BodyCatalog.allBodyPrefabs let charBody = (body != null) ? body.GetComponent<CharacterBody>() : null where (Object)(object)charBody != (Object)null && MasterCatalog.allMasters.Any((CharacterMaster m) => (Object)(object)m != (Object)null && (Object)(object)m.bodyPrefab == (Object)(object)body && !RandomizerPlugin.isBlacklistedEnemy(((Object)m).name)) && !((Object)charBody).name.StartsWith("DTGunnerDroneBody") && !((Object)charBody).name.StartsWith("DTHealingDroneBody") && !((Object)charBody).name.StartsWith("DTHaulerDroneBody") && (!RandomConfigs.replaceChampionsWithChampions.Value || isChampion == charBody.isChampion) select body).ToArray(); if (array.Length == 0) { return originalBodyPrefab; } if (RandomConfigs.slightBalancing.Value) { return ApplyBalancingToBodySelection(array, originalBodyPrefab, originalBody); } int num = 0; GameObject val; do { val = array[Random.Range(0, array.Length)]; num++; } while ((Object)(object)val == (Object)(object)originalBodyPrefab && !RandomConfigs.allowRandomizeWithSelf.Value && array.Length > 1 && num < 50); return val; } private static GameObject GetRandomBodyConsistent(GameObject originalBodyPrefab, CharacterBody originalBody) { if (bodyPrefabToRandomBody.ContainsKey(originalBodyPrefab)) { ret