Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Artifacts Of The Void v1.1.1
plugins/ArtifactsOfTheVoid.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using ArtifactsOfTheVoid.Artifacts; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.DeepVoidPortalBattery; using EntityStates.DroneScrapper; using EntityStates.Duplicator; using EntityStates.Geode; using EntityStates.Missions.Arena.NullWard; using EntityStates.Missions.Moon; using EntityStates.Missions.RepurposedCrater; using EntityStates.NullifierMonster; using EntityStates.Scrapper; using EntityStates.VoidJailer; using EntityStates.VoidMegaCrab; using EntityStates.VoidRaidCrab; using HG; using HarmonyLib; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using R2API; using RoR2; using RoR2.Audio; using RoR2.ExpansionManagement; using RoR2.Projectile; using UnityEngine; using UnityEngine.AddressableAssets; 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: AssemblyCompany("ArtifactsOfTheVoid")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+5e3c555319dd87d2f546c9dd24af1b56852aa99f")] [assembly: AssemblyProduct("ArtifactsOfTheVoid")] [assembly: AssemblyTitle("ArtifactsOfTheVoid")] [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 ArtifactsOfTheVoid { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("SomeBunny.ArtifactsOfTheVoid", "ArtifactsOfTheVoid", "1.1.1")] public class ArtifactsVoidPlugin : BaseUnityPlugin { public const string PluginGUID = "SomeBunny.ArtifactsOfTheVoid"; public const string PluginAuthor = "SomeBunny"; public const string PluginName = "ArtifactsOfTheVoid"; public const string PluginVersion = "1.1.1"; public static ArtifactsVoidPlugin Inst; public static ConfigFile configurationFile; public void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("SomeBunny.ArtifactsOfTheVoid").PatchAll(); configurationFile = ((BaseUnityPlugin)this).Config; Inst = this; Log.Init(((BaseUnityPlugin)this).Logger); ArtifactOfInfestation artifactOfInfestation = new ArtifactOfInfestation(); artifactOfInfestation.Init(); ArtifactOfNullification artifactOfNullification = new ArtifactOfNullification(); artifactOfNullification.Init(); ArtifactOfInvasion artifactOfInvasion = new ArtifactOfInvasion(); artifactOfInvasion.Init(); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string Format(object data, string file, int line) { string fileName = Path.GetFileName(file); return $"[{fileName}:{line}] {data}"; } internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogDebug((object)Format(data, file, line)); } internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogError((object)Format(data, file, line)); } internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogFatal((object)Format(data, file, line)); } internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogInfo((object)Format(data, file, line)); } internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogMessage((object)Format(data, file, line)); } internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogWarning((object)Format(data, file, line)); } } public static class Tools { public static byte[] ExtractEmbeddedResource(string filePath) { filePath = filePath.Replace("/", "."); filePath = filePath.Replace("\\", "."); Assembly callingAssembly = Assembly.GetCallingAssembly(); using Stream stream = callingAssembly.GetManifestResourceStream(filePath); if (stream == null) { return null; } byte[] array = new byte[stream.Length]; stream.Read(array, 0, array.Length); return array; } public static Texture2D GetTextureFromResource(string resourceName) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown byte[] array = ExtractEmbeddedResource(resourceName); if (array == null) { return null; } Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false); ImageConversion.LoadImage(val, array); ((Texture)val).filterMode = (FilterMode)0; string text = resourceName.Substring(0, resourceName.LastIndexOf('.')); if (text.LastIndexOf('.') >= 0) { text = text.Substring(text.LastIndexOf('.') + 1); } ((Object)val).name = text; return val; } public static void Shuffle<T>(this IList<T> list) { int num = list.Count; while (num > 1) { num--; Random random = new Random(); int index = random.Next(num + 1); T value = list[index]; list[index] = list[num]; list[num] = value; } } } public class WeightedTypeCollection<T> { public WeightedType<T>[] elements; public T SelectByWeight(Random generatorRandom) { List<int> list = new List<int>(); int num = 0; for (int i = 0; i < elements.Length; i++) { WeightedType<T> weightedType = elements[i]; if ((float)weightedType.Weight > 0f) { list.Add(i); num += weightedType.Weight; } } list.Shuffle(); int num2 = 100; int? num3 = null; while (!num3.HasValue) { num2--; if (num2 < 0) { break; } int num4 = Random.Range(0, num + 1); for (int j = 0; j < list.Count; j++) { int num5 = list[j]; if (num4 >= 0 && num4 <= elements[num5].Weight) { num3 = num5; break; } } if (num3.HasValue) { break; } } return elements[num3.GetValueOrDefault()].value; } public T SelectByWeight() { return SelectByWeight(null); } } public class WeightedType<T> { public T value; public int Weight; } } namespace ArtifactsOfTheVoid.Artifacts { public class ArtifactOfInfestation { public class VoidInfestorContainer { public Type daType = typeof(TeleporterInteraction); public int Amount = 6; public Vector3 Offset = new Vector3(0f, 0f); public float chance = 1f; public float InitialDelay = 0.1f; public float DelayAfterEachInfestor = 0.25f; public Func<IInteractable, int> additionalConditional; public Func<IInteractable, float> modifyDelay; public VoidInfestorContainer(Type type, float _Chance = 1f, int _Amount = 6, float _InitialDelay = 0.1f, float _DelayAfterEachInfestor = 0.25f) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) daType = type; Amount = _Amount; chance = _Chance; InitialDelay = _InitialDelay; DelayAfterEachInfestor = _DelayAfterEachInfestor; } public VoidInfestorContainer(Type type, int _Amount = 6, float _InitialDelay = 0.1f, float _DelayAfterEachInfestor = 0.25f) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) daType = type; Amount = _Amount; InitialDelay = _InitialDelay; DelayAfterEachInfestor = _DelayAfterEachInfestor; chance = 1f; } } [HarmonyPatch(typeof(Charging), "OnEnter")] public class Charging_OnEnter_Patch { [HarmonyPostfix] public static void Postfix(Charging __instance) { if (Inst.ArtifactEnabled && Object.op_Implicit((Object)(object)VoidStageMissionController.instance)) { ((MonoBehaviour)VoidStageMissionController.instance).StartCoroutine(Inst.Delay(null, null, ((EntityState)__instance).gameObject, (MonoBehaviour)(object)VoidStageMissionController.instance, 8, 3f, 5f)); } } } [HarmonyPatch(typeof(WardOnAndReady), "OnEnter")] public class WardOnAndReady_OnEnter_Patch { [HarmonyPostfix] public static void Postfix(WardOnAndReady __instance) { if (Inst.ArtifactEnabled) { ((MonoBehaviour)((NullWardBaseState)__instance).purchaseInteraction).StartCoroutine(Inst.Delay(null, null, ((Component)((NullWardBaseState)__instance).purchaseInteraction).gameObject, (MonoBehaviour)(object)VoidStageMissionController.instance, 8, 3f, 5f)); } } } [HarmonyPatch(typeof(MoonBatteryActive), "OnEnter")] public class MoonBatteryActive_OnEnter_Patch { [HarmonyPostfix] public static void Postfix(MoonBatteryActive __instance) { if (Inst.ArtifactEnabled) { ((MonoBehaviour)__instance.chargeIndicatorController).StartCoroutine(Inst.Delay(null, null, ((EntityState)__instance).gameObject, (MonoBehaviour)(object)__instance.chargeIndicatorController, 5, 5f, 6f)); } } } [HarmonyPatch(typeof(RouletteChestController), "EjectPickupServer")] public class RouletteChestController_EjectPickupServer_Patch { [HarmonyPrefix] public static void Postfix(RouletteChestController __instance, UniquePickup pickup) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { VoidInfestorContainer voidInfestorContainer = CanTriggerInfestorSpawn(((Component)__instance).gameObject); if (voidInfestorContainer != null) { int amountFromPickupIndex = GetAmountFromPickupIndex(pickup); ((MonoBehaviour)__instance).StartCoroutine(Inst.Delay(voidInfestorContainer, (IInteractable)(object)((__instance is IInteractable) ? __instance : null), ((Component)__instance).gameObject, (MonoBehaviour)(object)__instance, amountFromPickupIndex)); } } } } [HarmonyPatch(typeof(ScrapperController), "PopRewardPickupQueue")] public class ScrapperController_PopRewardPickupQueue_Patch { [HarmonyPostfix] public static void Postfix(ScrapperController __instance, ref UniquePickup __result) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { VoidInfestorContainer voidInfestorContainer = CanTriggerInfestorSpawn(((Component)__instance).gameObject); if (voidInfestorContainer != null) { int amountFromPickupIndex = GetAmountFromPickupIndex(__result); ((MonoBehaviour)__instance).StartCoroutine(Inst.Delay(voidInfestorContainer, (IInteractable)(object)((__instance is IInteractable) ? __instance : null), ((Component)__instance).gameObject, (MonoBehaviour)(object)__instance, amountFromPickupIndex)); } } } } [HarmonyPatch] private static class ChestBehaviorBaseItemDrop { [HarmonyPatch(typeof(ChestBehavior), "BaseItemDrop")] [HarmonyILManipulator] private static void Bomk(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall<PickupDropletController>(instr, "CreatePickupDroplet") })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, 4); val.Emit(OpCodes.Call, (MethodBase)typeof(ChestBehaviorBaseItemDrop).GetMethod("Pop", BindingFlags.Static | BindingFlags.NonPublic)); } } private static void Pop(ChestBehavior chestBehavior, CreatePickupInfo pop) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { int amountFromPickupIndex = GetAmountFromPickupIndex(((CreatePickupInfo)(ref pop)).pickup); ((MonoBehaviour)chestBehavior).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((chestBehavior is IInteractable) ? chestBehavior : null), ((Component)chestBehavior).gameObject, (MonoBehaviour)(object)chestBehavior, amountFromPickupIndex, 0.25f)); } } } [HarmonyPatch(typeof(HalcyoniteShrineInteractable), "DrainConditionMet")] public class HalcyoniteShrineInteractable_DrainConditionMet_Patch { [HarmonyPostfix] public static void Postfix(HalcyoniteShrineInteractable __instance) { if (Inst.ArtifactEnabled) { VoidInfestorContainer voidInfestorContainer = CanTriggerInfestorSpawn(((Component)__instance).gameObject); if (voidInfestorContainer != null) { ((MonoBehaviour)ArtifactsVoidPlugin.Inst).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((__instance is IInteractable) ? __instance : null), ((Component)__instance).gameObject, (MonoBehaviour)(object)__instance, __instance.rewardOptionCount, 0.25f)); } } } } [HarmonyPatch(typeof(ShopTerminalBehavior), "DropPickup", new Type[] { typeof(bool) })] public class ShopTerminalBehavior_DropPickup_Patch { [HarmonyPrefix] public static void Postfix(ShopTerminalBehavior __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { int amountFromPickupIndex = GetAmountFromPickupIndex(__instance.pickup); ((MonoBehaviour)__instance).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((__instance is IInteractable) ? __instance : null), ((Component)__instance).gameObject, (MonoBehaviour)(object)__instance, amountFromPickupIndex, 0.25f)); } } } [HarmonyPatch(typeof(DroneVendorTerminalBehavior), "DispatchDrone")] public class DroneVendorTerminalBehavior_DispatchDrone_Patch { [HarmonyPrefix] public static void Postfix(DroneVendorTerminalBehavior __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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) if (Inst.ArtifactEnabled) { PickupDef pickupDef = PickupCatalog.GetPickupDef(__instance._cachedPickup.pickupIndex); DroneDef droneDef = DroneCatalog.GetDroneDef(pickupDef.droneIndex); int amountFromPickupIndex = GetAmountFromPickupIndex(droneDef.tier); ((MonoBehaviour)__instance).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((__instance is IInteractable) ? __instance : null), ((Component)__instance).gameObject, (MonoBehaviour)(object)__instance, amountFromPickupIndex, 0.25f)); } } } [HarmonyPatch] private static class ShrineChanceBehaviorAddShrineStack { [HarmonyPatch(typeof(ShrineChanceBehavior), "AddShrineStack")] [HarmonyILManipulator] private static void iojueafdijonefdijnlfda(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0079: 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_0093: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdstr(instr, "SHRINE_CHANCE_SUCCESS_MESSAGE") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdcR4(instr, 20f) })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, 0); val.Emit(OpCodes.Call, (MethodBase)typeof(ShrineChanceBehaviorAddShrineStack).GetMethod("HEEELP", BindingFlags.Static | BindingFlags.NonPublic)); } } private static void HEEELP(ShrineChanceBehavior chestBehavior, UniquePickup pop) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { int amountFromPickupIndex = GetAmountFromPickupIndex(pop); ((MonoBehaviour)chestBehavior).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((chestBehavior is IInteractable) ? chestBehavior : null), ((Component)chestBehavior).gameObject, (MonoBehaviour)(object)chestBehavior, amountFromPickupIndex, 0.25f)); } } } [HarmonyPatch] private static class ScrapperScrappingToIdleOnEnter { [HarmonyPatch(typeof(ScrappingToIdle), "OnEnter")] [HarmonyILManipulator] private static void fuck(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00b4: 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_00ce: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdstr(instr, "Base") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall<NetworkServer>(instr, "get_active") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall<PickupDropletController>(instr, "CreatePickupDroplet") })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, 0); val.Emit(OpCodes.Call, (MethodBase)typeof(ScrapperScrappingToIdleOnEnter).GetMethod("HEEELP", BindingFlags.Static | BindingFlags.NonPublic)); } } private static void HEEELP(ScrappingToIdle chestBehavior, UniquePickup pop) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { int amountFromPickupIndex = GetAmountFromPickupIndex(pop); ? val = ((ScrapperBaseState)chestBehavior).scrapperController; ArtifactOfInfestation inst = Inst; ScrapperController scrapperController = ((ScrapperBaseState)chestBehavior).scrapperController; ((MonoBehaviour)val).StartCoroutine(inst.Delay(null, (IInteractable)(object)((scrapperController is IInteractable) ? scrapperController : null), ((EntityState)chestBehavior).gameObject, (MonoBehaviour)(object)((ScrapperBaseState)chestBehavior).scrapperController, amountFromPickupIndex, 0.25f)); } } } [HarmonyPatch(typeof(DroneScrappingToIdle), "DropPickup")] public class DroneScrappingToIdle_DropPickup { [HarmonyPostfix] public static void Postfix(DroneScrappingToIdle __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { int amountFromPickupIndex = GetAmountFromPickupIndex(((DroneScrapperBaseState)__instance).scrapperController.lastScrappedTier); ? val = ((DroneScrapperBaseState)__instance).scrapperController; ArtifactOfInfestation inst = Inst; DroneScrapperController scrapperController = ((DroneScrapperBaseState)__instance).scrapperController; ((MonoBehaviour)val).StartCoroutine(inst.Delay(null, (IInteractable)(object)((scrapperController is IInteractable) ? scrapperController : null), ((Component)((DroneScrapperBaseState)__instance).scrapperController).gameObject, (MonoBehaviour)(object)((DroneScrapperBaseState)__instance).scrapperController, amountFromPickupIndex, 0.125f)); } } } [HarmonyPatch(typeof(GeodeShatter), "OnEnter")] public class EntityStatesGeode_GeodeShatter_OnEnter { [HarmonyPostfix] public static void Postfix(GeodeShatter __instance) { if (Inst.ArtifactEnabled) { int num = 1; if (((GeodeEntityStates)__instance).geodeController.ShouldDropReward) { num += 3; } if (((GeodeEntityStates)__instance).geodeController.ShouldRegenerate) { num /= 3; } num = Mathf.Max(1, num); ((MonoBehaviour)((GeodeEntityStates)__instance).geodeController).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((GeodeEntityStates)__instance).geodeController, ((Component)((GeodeEntityStates)__instance).geodeController).gameObject, (MonoBehaviour)(object)((GeodeEntityStates)__instance).geodeController, num, 0.125f)); } } } [HarmonyPatch(typeof(Duplicating), "DropDroplet")] public class EntityStatesDuplicatorDuplicating_DropDroplet { [HarmonyPostfix] public static void Postfix(Duplicating __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { ShopTerminalBehavior component = ((EntityState)__instance).GetComponent<ShopTerminalBehavior>(); int amountFromPickupIndex = GetAmountFromPickupIndex(component.pickup); ((MonoBehaviour)component).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((component is IInteractable) ? component : null), ((EntityState)__instance).gameObject, (MonoBehaviour)(object)component, amountFromPickupIndex * Mathf.Max(1, component.debt * component.dropAmount), 0.25f)); } } } [HarmonyPatch] private static class PickupDistributorBehaviorDrop { [HarmonyPatch(typeof(PickupDistributorBehavior), "Drop")] [HarmonyILManipulator] private static void fuck(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchConvI4(instr) }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdnull(instr) }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchLdfld<PickupDistributorBehavior>(instr, "itemsDropped") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction instr) => ILPatternMatchingExt.MatchCall<PickupDropletController>(instr, "CreatePickupDroplet") })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, 4); val.Emit(OpCodes.Call, (MethodBase)typeof(PickupDistributorBehaviorDrop).GetMethod("HEEELP", BindingFlags.Static | BindingFlags.NonPublic)); } } private static void HEEELP(PickupDistributorBehavior chestBehavior, CreatePickupInfo pop) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { int amountFromPickupIndex = GetAmountFromPickupIndex(((CreatePickupInfo)(ref pop)).pickup); ((MonoBehaviour)chestBehavior).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((chestBehavior is IInteractable) ? chestBehavior : null), ((Component)chestBehavior).gameObject, (MonoBehaviour)(object)chestBehavior, amountFromPickupIndex, 0.25f)); } } } [HarmonyPatch(typeof(PowerOrbPedestalManager), "DoInteractResult")] public class PowerOrbPedestalManager_DoInteractResult { [HarmonyPostfix] public static void Postfix(PowerOrbPedestalManager __instance) { if (Inst.ArtifactEnabled) { ((MonoBehaviour)__instance).StartCoroutine(Inst.Delay(null, (IInteractable)(object)((__instance is IInteractable) ? __instance : null), ((Component)__instance).gameObject, (MonoBehaviour)(object)__instance, 5, 1f, 0.5f)); } } } private static ArtifactDef InfestationArtifactDefinition; public static ArtifactOfInfestation Inst; private CharacterSpawnCard voidRaidCrabPhase2 = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/VoidRaidCrab/cscMiniVoidRaidCrabPhase2.asset").WaitForCompletion(); public CharacterSpawnCard InfestorPrefab = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/EliteVoid/cscVoidInfestor.asset").WaitForCompletion(); public static ConfigEntry<bool> FunkyMode; public static ConfigEntry<float> CrabSurprise; public static Dictionary<ItemTier, int> itemCount = new Dictionary<ItemTier, int> { { (ItemTier)4, 4 }, { (ItemTier)3, 4 }, { (ItemTier)5, 0 }, { (ItemTier)0, 1 }, { (ItemTier)1, 3 }, { (ItemTier)2, 8 }, { (ItemTier)9, 6 }, { (ItemTier)6, 2 }, { (ItemTier)7, 4 }, { (ItemTier)8, 10 }, { (ItemTier)10, 6 } }; public static List<VoidInfestorContainer> containers = new List<VoidInfestorContainer> { new VoidInfestorContainer(typeof(ShrineRestackBehavior), 4, 1f, 0.5f), new VoidInfestorContainer(typeof(ShrineBossBehavior), 3, 1f, 3f), new VoidInfestorContainer(typeof(ShrinePlaceTotem), 0), new VoidInfestorContainer(typeof(ShrineCleanseBehavior), 3, 0.1f, 0.2f), new VoidInfestorContainer(typeof(ShrineCombatBehavior), 3, 0.25f), new VoidInfestorContainer(typeof(TimedChestController), 12, 1.25f, 0.1f), new VoidInfestorContainer(typeof(BarrelInteraction), 0.25f, 1), new VoidInfestorContainer(typeof(PortalStatueBehavior), 3, 0.25f), new VoidInfestorContainer(typeof(RouletteChestController), 0), new VoidInfestorContainer(typeof(ScrapperController), 0, 3.25f, 0.3f), new VoidInfestorContainer(typeof(ShrineCombatBehavior), 3, 0.5f, 0.5f), new VoidInfestorContainer(typeof(ShrineHealingBehavior), 1, 0.125f, 0f), new VoidInfestorContainer(typeof(ShrineRebirthController), 16, 0.5f, 0.025f), new VoidInfestorContainer(typeof(ShrineBloodBehavior), 1) { additionalConditional = (IInteractable _) => ((ShrineBloodBehavior)(((_ is ShrineBloodBehavior) ? _ : null)?)).purchaseCount ?? 0 }, new VoidInfestorContainer(typeof(VendingMachineBehavior), 1, 1f, 0.1f) { additionalConditional = delegate(IInteractable _) { VendingMachineBehavior val6 = (VendingMachineBehavior)(object)((_ is VendingMachineBehavior) ? _ : null); return (val6 != null && Random.value < (float)Mathf.Max(val6.purchaseCount - 4, 0) * 0.0833f) ? 1 : 0; } }, new VoidInfestorContainer(typeof(ShrineHealingBehavior), 0, 0.25f, 0.5f) { additionalConditional = delegate(IInteractable _) { ShrineHealingBehavior val5 = (ShrineHealingBehavior)(object)((_ is ShrineHealingBehavior) ? _ : null); return (val5 != null) ? val5.purchaseCount : 0; } }, new VoidInfestorContainer(typeof(TeleporterInteraction), 8, 5f, 2.5f) { additionalConditional = delegate(IInteractable _) { TeleporterInteraction val4 = (TeleporterInteraction)(object)((_ is TeleporterInteraction) ? _ : null); return (val4 != null) ? (val4.shrineBonusStacks * 4) : 0; } }, new VoidInfestorContainer(typeof(ShopTerminalBehavior), 0, 0.1f, 0.1f) { modifyDelay = delegate(IInteractable _) { ShopTerminalBehavior val3 = (ShopTerminalBehavior)(object)((_ is ShopTerminalBehavior) ? _ : null); return (val3 != null && ((Object)((Component)val3).gameObject).name.Contains("Duplicator")) ? 2.66f : 0f; }, additionalConditional = delegate(IInteractable _) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) ShopTerminalBehavior val2 = (ShopTerminalBehavior)(object)((_ is ShopTerminalBehavior) ? _ : null); return (val2 != null) ? GetAmountFromPickupIndex(val2.pickupDisplay.pickupState) : 0; } }, new VoidInfestorContainer(typeof(ChestBehavior), 0, 0.5f, 0.1f) { additionalConditional = delegate(IInteractable _) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) ChestBehavior val = (ChestBehavior)(object)((_ is ChestBehavior) ? _ : null); return (val != null) ? GetAmountFromPickupIndex(val.currentPickup) : 0; } }, new VoidInfestorContainer(typeof(OptionChestBehavior), 0, 0.1f, 0.33f) { additionalConditional = (IInteractable _) => 0 } }; private static string ArtifactLangTokenName => "ARTIFACT_OF_INFEST"; private static string ArtifactName => "Artifact of Infestation"; private static string ArtifactDescription => "When enabled, causes most interactables to spawn Void Infestors when used."; public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(InfestationArtifactDefinition); public void Init() { //IL_0073: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) Inst = this; LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName); LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription); InfestationArtifactDefinition = ScriptableObject.CreateInstance<ArtifactDef>(); Texture2D textureFromResource = Tools.GetTextureFromResource("ArtifactsOfTheVoid/Textures/infestorEnabled.png"); Sprite smallIconSelectedSprite = Sprite.Create(textureFromResource, new Rect(0f, 0f, (float)((Texture)textureFromResource).width, (float)((Texture)textureFromResource).height), new Vector2(0.5f, 0.5f)); Texture2D textureFromResource2 = Tools.GetTextureFromResource("ArtifactsOfTheVoid/Textures/infestorDisabled.png"); Sprite smallIconDeselectedSprite = Sprite.Create(textureFromResource2, new Rect(0f, 0f, (float)((Texture)textureFromResource2).width, (float)((Texture)textureFromResource2).height), new Vector2(0.5f, 0.5f)); InfestationArtifactDefinition.smallIconSelectedSprite = smallIconSelectedSprite; InfestationArtifactDefinition.smallIconDeselectedSprite = smallIconDeselectedSprite; InfestationArtifactDefinition.requiredExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); InfestationArtifactDefinition.cachedName = "ARTIFACT_" + ArtifactLangTokenName; InfestationArtifactDefinition.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME"; InfestationArtifactDefinition.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION"; GlobalEventManager.OnInteractionsGlobal += GlobalEventManager_OnInteractionsGlobal; ContentAddition.AddArtifactDef(InfestationArtifactDefinition); FunkyMode = ArtifactsVoidPlugin.configurationFile.Bind<bool>("Artifact: " + ArtifactName, "Funky Mode", false, "get funky oh yeahhh"); CrabSurprise = ArtifactsVoidPlugin.configurationFile.Bind<float>("Artifact: " + ArtifactName, "Crab Surprise", 0f, "The chance of a Giant Enemy Crab appearing is low... but never zero. Unless it's been set to zero. Value should range from 0-1. Preferably use low values like 0.005."); } public static VoidInfestorContainer CanTriggerInfestorSpawn(GameObject gameObject) { foreach (VoidInfestorContainer container in containers) { if ((Object)(object)gameObject.GetComponent(container.daType) != (Object)null && Random.value < container.chance) { return container; } } return null; } public static VoidInfestorContainer CanTriggerInfestorSpawn<T>(T interactable) where T : Type { IEnumerable<VoidInfestorContainer> enumerable = containers.Where((VoidInfestorContainer aie) => aie.daType == interactable); if (enumerable != null && enumerable.Count() > 0) { VoidInfestorContainer voidInfestorContainer = enumerable.First(); if (voidInfestorContainer != null) { if (FunkyMode.Value && (double)Random.value < 0.3) { if (Random.value < Random.value) { return voidInfestorContainer; } } else if (Random.value < voidInfestorContainer.chance) { return voidInfestorContainer; } } } return null; } private void GlobalEventManager_OnInteractionsGlobal(Interactor arg1, IInteractable arg2, GameObject arg3) { if (ArtifactEnabled) { VoidInfestorContainer voidInfestorContainer = CanTriggerInfestorSpawn(arg3); if (voidInfestorContainer != null) { ((MonoBehaviour)arg1).StartCoroutine(Delay(voidInfestorContainer, arg2, arg3, (MonoBehaviour)(object)arg1)); } } } public IEnumerator Delay(VoidInfestorContainer container, IInteractable interactable, GameObject arg3, MonoBehaviour interactor, int? OverrideAmount = null, float overrideInitialDelay = -1f, float overrideDelatAfterEachInfestor = -1f, float offsetX = 0f, float offsetY = 0f, float offsetZ = 0f, Transform overrtansTrans = null) { if ((Object)(object)arg3 == (Object)null) { yield break; } float e = 0f; float d = ((overrideInitialDelay > -1f) ? overrideInitialDelay : (container?.InitialDelay ?? 1f)); if (container != null && container.modifyDelay != null) { d += container.modifyDelay(interactable); } if (FunkyMode.Value) { d = (((double)Random.value < 0.05) ? ((float)Random.Range(12, 30)) : ((!((double)Random.value < 0.5)) ? (d * Random.Range(0.25f, 2f)) : Random.Range(0.1f, 4f))); } while (e < d) { e += Time.deltaTime; if ((Object)(object)arg3 == (Object)null) { yield break; } yield return null; } ModelLocator component2 = arg3.GetComponent<ModelLocator>(); Transform transform2; if ((Object)(object)component2 == (Object)null) { transform2 = null; } else { Transform modelTransform = component2.modelTransform; if ((Object)(object)modelTransform == (Object)null) { transform2 = null; } else { ChildLocator component3 = ((Component)modelTransform).GetComponent<ChildLocator>(); transform2 = (((Object)(object)component3 != (Object)null) ? component3.FindChild("FireworkOrigin") : null); } } int amount = OverrideAmount ?? container.Amount; float daei = ((overrideDelatAfterEachInfestor > -1f) ? overrideDelatAfterEachInfestor : (container?.DelayAfterEachInfestor ?? 0.25f)); if (container != null && OverrideAmount.GetValueOrDefault() == -1 && container.additionalConditional != null && interactable != null) { amount += container.additionalConditional(interactable); } if (Object.op_Implicit((Object)(object)overrtansTrans)) { transform2 = overrtansTrans; } interactor.StartCoroutine(SpawnInfestorAmount(arg3.transform, amount, container?.Offset.x ?? offsetX, container?.Offset.y ?? offsetY, container?.Offset.z ?? offsetZ, transform2, daei)); } public IEnumerator SpawnInfestorAmount(Transform transformPosition, int Amount = 1, float x = 0f, float y = 0f, float z = 0f, Transform Th = null, float delay = 0.1f) { if (!ArtifactEnabled) { yield break; } if (FunkyMode.Value) { Amount = ((!((double)Random.value < 0.1)) ? Random.Range(Mathf.Max(Amount, 1), Mathf.Max(Amount + 4, 5)) : Random.Range(Mathf.Max(Amount, 8), Mathf.Max(Amount + 4, 16))); delay = (((double)Random.value < 0.2) ? (delay * 0.01f) : ((!((double)Random.value < 0.5)) ? Random.Range(delay * 0.33f, delay * 3f) : Random.Range(delay * 0.1f, delay * 10f))); } if ((Object)(object)((Component)transformPosition).gameObject == (Object)null) { yield break; } DirectorPlacementRule placementRule = new DirectorPlacementRule { placementMode = (PlacementMode)0, minDistance = 1f, maxDistance = 3f, spawnOnTarget = (Th ?? ((Component)transformPosition).transform), position = (((Object)(object)Th != (Object)null) ? (Th.position + new Vector3(x, y, z)) : (transformPosition.position + new Vector3(x, y, z))) }; ulong seed = Run.instance.seed ^ (ulong)Run.instance.stageClearCount; Xoroshiro128Plus rng = new Xoroshiro128Plus(seed); DirectorSpawnRequest directorSpawnRequest = new DirectorSpawnRequest((SpawnCard)(object)((CrabSurprise.Value > Random.value) ? voidRaidCrabPhase2 : InfestorPrefab), placementRule, rng); directorSpawnRequest.ignoreTeamMemberLimit = true; directorSpawnRequest.teamIndexOverride = (TeamIndex)4; directorSpawnRequest.onSpawnedServer = (Action<SpawnResult>)Delegate.Combine(directorSpawnRequest.onSpawnedServer, new Action<SpawnResult>(OnSp)); for (int i = 0; i < Amount; i++) { float e = 0f; float d = delay; while (e < d) { e += Time.deltaTime; if ((Object)(object)((Component)transformPosition).gameObject == (Object)null) { yield break; } yield return null; } DirectorCore.instance.TrySpawnObject(directorSpawnRequest); } } public void OnSp(SpawnResult b) { //IL_0001: 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) if (Object.op_Implicit((Object)(object)b.spawnedInstance)) { CharacterBody component = b.spawnedInstance.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { component.AddTimedBuff(Buffs.ArmorBoost, 3.5f); } } } public static int GetAmountFromPickupIndex(UniquePickup uniquePickup) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GetAmountFromPickupIndex(uniquePickup.pickupIndex); } public static int GetAmountFromPickupIndex(PickupIndex pickupIndex) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 int value = 0; PickupDef pickupDef = PickupCatalog.GetPickupDef(pickupIndex); if (pickupDef != null && ((int)pickupDef.itemIndex != -1 || (int)pickupDef.equipmentIndex != -1 || (int)pickupDef.itemTier != 5)) { itemCount.TryGetValue(pickupDef.itemTier, out value); if (((IEnumerable<EquipmentIndex>)(object)EquipmentCatalog.allEquipment).Contains(pickupDef.equipmentIndex)) { value += 3; } } return value; } public static int GetAmountFromPickupIndex(ItemTier tier) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) int value = 0; itemCount.TryGetValue(tier, out value); return value; } } public class ArtifactOfInvasion { [HarmonyPatch(typeof(DirectorCardCategorySelection), "GenerateDirectorCardWeightedSelection")] public class GenerateDirectorCardWeightedSelection_Patch { [HarmonyPrefix] public static bool Postfix(DirectorCardCategorySelection __instance, ref WeightedSelection<DirectorCard> __result) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (Inst.ArtifactEnabled) { WeightedSelection<DirectorCard> val = new WeightedSelection<DirectorCard>(8); for (int i = 0; i < __instance.categories.Length; i++) { ref Category reference = ref __instance.categories[i]; float num = __instance.SumAllWeightsInCategory(reference); float num2 = reference.selectionWeight / num; if (!(num > 0f)) { continue; } DirectorCard[] cards = reference.cards; foreach (DirectorCard val2 in cards) { if ((Object)(object)val2.spawnCard != (Object)null && (Object)(object)val2.spawnCard.prefab == (Object)(object)((SpawnCard)Inst.VoidCampSpawnCard).prefab) { if (!Stage1Free.Value) { val2.minimumStageCompletions = -1; } Inst.VoidCampSpawnCard.maxSpawnsPerStage = MaximumSeedAmount.Value; val2.spawnCard = (SpawnCard)(object)Inst.VoidCampSpawnCard; ((SpawnCard)Inst.VoidCampSpawnCard).directorCreditCost = Mathf.RoundToInt(Mult / DirectorCreditMult.Value); val2.selectionWeight = SeedSelectionWeight.Value; } if (val2.IsAvailable()) { float num3 = (float)val2.selectionWeight * num2; val.AddChoice(val2, num3); } } } __result = val; return false; } return true; } } private static ArtifactDef InvasionArtifactDefinition; public InteractableSpawnCard VoidCampSpawnCard; public DirectorCard VoidDirectorCard = null; private static float Mult; private static ArtifactOfInvasion Inst; public static ConfigEntry<int> MaximumSeedAmount; public static ConfigEntry<int> SeedSelectionWeight; public static ConfigEntry<float> DirectorCreditMult; public static ConfigEntry<bool> Stage1Free; private static string ArtifactLangTokenName => "ARTIFACT_OF_INVASION"; private static string ArtifactName => "Artifact of Invasion"; private static string ArtifactDescription => "Drastically increases Void Seed spawn rate and spawn amount."; public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(InvasionArtifactDefinition); public void Init() { //IL_0073: 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown Inst = this; LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName); LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription); InvasionArtifactDefinition = ScriptableObject.CreateInstance<ArtifactDef>(); Texture2D textureFromResource = Tools.GetTextureFromResource("ArtifactsOfTheVoid/Textures/invasionEnabled.png"); Sprite smallIconSelectedSprite = Sprite.Create(textureFromResource, new Rect(0f, 0f, (float)((Texture)textureFromResource).width, (float)((Texture)textureFromResource).height), new Vector2(0.5f, 0.5f)); Texture2D textureFromResource2 = Tools.GetTextureFromResource("ArtifactsOfTheVoid/Textures/invasionDisabled.png"); Sprite smallIconDeselectedSprite = Sprite.Create(textureFromResource2, new Rect(0f, 0f, (float)((Texture)textureFromResource2).width, (float)((Texture)textureFromResource2).height), new Vector2(0.5f, 0.5f)); InvasionArtifactDefinition.smallIconSelectedSprite = smallIconSelectedSprite; InvasionArtifactDefinition.smallIconDeselectedSprite = smallIconDeselectedSprite; InvasionArtifactDefinition.cachedName = "ARTIFACT_" + ArtifactLangTokenName; InvasionArtifactDefinition.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME"; InvasionArtifactDefinition.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION"; InvasionArtifactDefinition.requiredExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); ContentAddition.AddArtifactDef(InvasionArtifactDefinition); VoidCampSpawnCard = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC1/VoidCamp/iscVoidCamp.asset").WaitForCompletion(); VoidCampSpawnCard.maxSpawnsPerStage = 5; Mult = ((SpawnCard)VoidCampSpawnCard).directorCreditCost; VoidDirectorCard = new DirectorCard(); MaximumSeedAmount = ArtifactsVoidPlugin.configurationFile.Bind<int>("Artifact: " + ArtifactName, "Max Void Seed Amount", 5, "The maximum amount of Void Seeds that can be generated."); SeedSelectionWeight = ArtifactsVoidPlugin.configurationFile.Bind<int>("Artifact: " + ArtifactName, "Void Seed Selection Weight", 1000, "The probability this gets selected to generate compared to other interactables."); DirectorCreditMult = ArtifactsVoidPlugin.configurationFile.Bind<float>("Artifact: " + ArtifactName, "Void Seed Director Credit Mult", 0.5f, "The multiplier for director credits Void Seeds use."); Stage1Free = ArtifactsVoidPlugin.configurationFile.Bind<bool>("Artifact: " + ArtifactName, "Stage 1 Free", false, "Prevent first stage from having seeds?"); } } public class ArtifactOfNullification { private static ArtifactDef NullificationArtifactDefinition; public WeightedTypeCollection<int> collection = new WeightedTypeCollection<int>(); public WeightedTypeCollection<int> collectionTwo = new WeightedTypeCollection<int>(); public static GameObject DummyObject; public static ConfigEntry<int> VoidReaverBombCardAmount; public static ConfigEntry<int> VoidJailerBombCardAmount; public static ConfigEntry<int> VoidDevastatorBombCardAmount; public static ConfigEntry<int> VoidlingBombCardAmount; public static ConfigEntry<int> VoidReaverBombCardAmountChampion; public static ConfigEntry<int> VoidJailerBombCardAmountChampion; public static ConfigEntry<int> VoidDevastatorBombCardAmountChampion; public static ConfigEntry<int> VoidlingBombCardAmountChampion; public static ConfigEntry<bool> NonEnemyDeathSpawnBlackHoles; public static ConfigEntry<bool> DeadPlayersSpawnImplosions; public static ConfigEntry<bool> DeadPlayerFinalBreath; public static ConfigEntry<float> StormTime; private static string ArtifactLangTokenName => "ARTIFACT_OF_NULLIFY"; private static string ArtifactName => "Artifact of Nullification"; private static string ArtifactDescription => "When enabled, causes every non-Void enemy to spawn a random Void-related implosion on death."; public bool ArtifactEnabled => RunArtifactManager.instance.IsArtifactEnabled(NullificationArtifactDefinition); public void Init() { //IL_006d: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Expected O, but got Unknown LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_NAME", ArtifactName); LanguageAPI.Add("ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION", ArtifactDescription); NullificationArtifactDefinition = ScriptableObject.CreateInstance<ArtifactDef>(); Texture2D textureFromResource = Tools.GetTextureFromResource("ArtifactsOfTheVoid/Textures/nullifyEnabled.png"); Sprite smallIconSelectedSprite = Sprite.Create(textureFromResource, new Rect(0f, 0f, (float)((Texture)textureFromResource).width, (float)((Texture)textureFromResource).height), new Vector2(0.5f, 0.5f)); Texture2D textureFromResource2 = Tools.GetTextureFromResource("ArtifactsOfTheVoid/Textures/nullifyDisabled.png"); Sprite smallIconDeselectedSprite = Sprite.Create(textureFromResource2, new Rect(0f, 0f, (float)((Texture)textureFromResource2).width, (float)((Texture)textureFromResource2).height), new Vector2(0.5f, 0.5f)); NullificationArtifactDefinition.smallIconSelectedSprite = smallIconSelectedSprite; NullificationArtifactDefinition.smallIconDeselectedSprite = smallIconDeselectedSprite; NullificationArtifactDefinition.cachedName = "ARTIFACT_" + ArtifactLangTokenName; NullificationArtifactDefinition.nameToken = "ARTIFACT_" + ArtifactLangTokenName + "_NAME"; NullificationArtifactDefinition.descriptionToken = "ARTIFACT_" + ArtifactLangTokenName + "_DESCRIPTION"; NullificationArtifactDefinition.requiredExpansion = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); GlobalEventManager.onCharacterDeathGlobal += OnCharacterDeathGlobal; ContentAddition.AddArtifactDef(NullificationArtifactDefinition); CreateConfig(ArtifactsVoidPlugin.configurationFile); collection.elements = new WeightedType<int>[4] { CreateWeightedType(1, VoidReaverBombCardAmount.Value), CreateWeightedType(2, VoidDevastatorBombCardAmount.Value), CreateWeightedType(3, VoidJailerBombCardAmount.Value), CreateWeightedType(4, VoidlingBombCardAmount.Value) }; collectionTwo.elements = new WeightedType<int>[4] { CreateWeightedType(1, VoidReaverBombCardAmountChampion.Value), CreateWeightedType(2, VoidJailerBombCardAmountChampion.Value), CreateWeightedType(3, VoidDevastatorBombCardAmountChampion.Value), CreateWeightedType(4, VoidlingBombCardAmountChampion.Value) }; DummyObject = PrefabAPI.InstantiateClone(new GameObject("DummyObject_Voidling"), "VOIDLING_STORM_DUMMY_COPY", true); DummyObject.AddComponent<StormSelfController>(); DummyObject.AddComponent<NetworkIdentity>(); PrefabAPI.RegisterNetworkPrefab(DummyObject); PrefabAPI.RegisterNetworkPrefab(DummyObject); } public WeightedType<int> CreateWeightedType(int value, int weight) { WeightedType<int> weightedType = new WeightedType<int>(); weightedType.value = value; weightedType.Weight = weight; return weightedType; } private void CreateConfig(ConfigFile config) { VoidReaverBombCardAmount = config.Bind<int>("Artifact: " + ArtifactName, "Void Reaver Bomb Weight", 90, "The amount of weight that a Void Reaver Implosion has for when a death-roll is initiated."); VoidDevastatorBombCardAmount = config.Bind<int>("Artifact: " + ArtifactName, "Void Devastator Bomb Weight", 19, "The amount of weight that a Void Jailer Implosion has for when a death-roll is initiated."); VoidJailerBombCardAmount = config.Bind<int>("Artifact: " + ArtifactName, "Void Jailer Bomb Weight", 39, "The amount of weight that a Void Devastator Implosion has for when a death-roll is initiated."); VoidlingBombCardAmount = config.Bind<int>("Artifact: " + ArtifactName, "Voidling Storm Bomb Weight", 1, "The amount of weight that a Voidling Storm has for when a death-roll is initiated."); VoidReaverBombCardAmountChampion = config.Bind<int>("Artifact: " + ArtifactName, "Void Reaver Bomb Weight (Champion Enemies)", 40, "The amount of weight that a Void Reaver Implosion has for when a death-roll is initiated on a Champion enemy."); VoidJailerBombCardAmountChampion = config.Bind<int>("Artifact: " + ArtifactName, "Void Devastator Bomb Weight (Champion Enemies)", 10, "The amount of weight that a Void Jailer Implosion has for when a death-roll is initiated on a Champion enemy."); VoidDevastatorBombCardAmountChampion = config.Bind<int>("Artifact: " + ArtifactName, "Void Jailer Bomb Weight (Champion Enemies)", 20, "The amount of weight that a Void Devastator Implosion has for when a death-roll is initiated on a Champion enemy."); VoidlingBombCardAmountChampion = config.Bind<int>("Artifact: " + ArtifactName, "Voidling Storm Bomb Weight (Champion Enemies)", 5, "The amount of weight that a Voidling Storm has for when a death-roll is initiated on a Champion enemy."); StormTime = config.Bind<float>("Artifact: " + ArtifactName, "Voidling Black Hole Lifetime", 15f, "How long does the Black Hole last? Note, the longer the lifetime the larger it will become. Default is 15 seconds."); NonEnemyDeathSpawnBlackHoles = config.Bind<bool>("Artifact: " + ArtifactName, "Non-Enemies Spawn Void Implosions", false, "Do non-enemy entities spawn Void Implosions?"); DeadPlayersSpawnImplosions = config.Bind<bool>("Artifact: " + ArtifactName, "Killed Players Spawn Void Implosions", true, "Do players spawn implosions on death?"); DeadPlayerFinalBreath = config.Bind<bool>("Artifact: " + ArtifactName, "Players Retaliate Heavily", false, "Does player death now have higher consequences for everything around you?"); } private void OnCharacterDeathGlobal(DamageReport damageReport) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Invalid comparison between Unknown and I4 //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Invalid comparison between Unknown and I4 if (!ArtifactEnabled || (int)damageReport.victimBody.teamComponent.teamIndex == 4 || (int)DamageTypeCombo.op_Implicit(damageReport.damageInfo.damageType) == 65536 || !Run.instance.IsExpansionEnabled(Items.BearVoid.requiredExpansion)) { return; } bool flag = true; if ((int)damageReport.victimBody.teamComponent.teamIndex == 0) { flag = NonEnemyDeathSpawnBlackHoles.Value; } if (damageReport.victimBody.isPlayerControlled) { flag = DeadPlayersSpawnImplosions.Value; } if (!flag) { return; } if (damageReport.victimBody.isPlayerControlled && DeadPlayerFinalBreath.Value) { SpawnTheStorm(damageReport); } else if (damageReport.victimBody.isChampion) { switch (collectionTwo.SelectByWeight()) { case 1: SpawnVoidBomb(DeathState.deathBombProjectile, damageReport); break; case 2: SpawnVoidBomb(DeathState.deathBombProjectile, damageReport); break; case 3: SpawnVoidBomb(DeathState.deathBombProjectile, damageReport); break; case 4: SpawnTheStorm(damageReport); break; } } else { switch (collection.SelectByWeight()) { case 1: SpawnVoidBomb(DeathState.deathBombProjectile, damageReport); break; case 2: SpawnVoidBomb(DeathState.deathBombProjectile, damageReport); break; case 3: SpawnVoidBomb(DeathState.deathBombProjectile, damageReport); break; case 4: SpawnTheStorm(damageReport); break; } } } public void SpawnVoidBomb(GameObject projectilePrefab, DamageReport killedEntity) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_002f: 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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) FireProjectileInfo val = default(FireProjectileInfo); val.projectilePrefab = projectilePrefab; val.position = ((Component)killedEntity.victimBody).gameObject.transform.position; val.rotation = Util.QuaternionSafeLookRotation(Vector3.up); val.owner = ((Component)killedEntity.victimBody).gameObject; val.crit = killedEntity.victimBody.RollCrit(); ProjectileManager.instance.FireProjectile(val); } public static void SpawnTheStorm(DamageReport killedEntity) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_0042: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(DummyObject, ((Component)killedEntity.victimBody).gameObject.transform.position, Quaternion.identity); VacuumAttack val2 = new VacuumAttack(); val.transform.position = ((Component)killedEntity.victimBody).gameObject.transform.position; StormSelfController component = val.GetComponent<StormSelfController>(); component.killRadius = 1f; component.killRadiusCurve = VacuumAttack.killRadiusCurve; component.loopSound = VacuumAttack.loopSound; component.losObstructionFactor = VacuumAttack.losObstructionFactor; component.pullMagnitudeCurve = VacuumAttack.pullMagnitudeCurve; if (NetworkServer.active) { NetworkServer.Spawn(val); } } } public class StormSelfController : NetworkBehaviour { private bool active = true; private float timeSpent; public AnimationCurve killRadiusCurve; public AnimationCurve pullMagnitudeCurve; public float losObstructionFactor = 0.5f; public GameObject killSphereVfxPrefab; public GameObject environmentVfxPrefab; public LoopSoundDef loopSound; public CharacterLosTracker losTracker; public VFXHelper killSphereVfxHelper; public VFXHelper environmentVfxHelper; public SphereSearch killSearch; public float killRadius = 1f; public Vector3 pos; public SoundLoopPtr loopPtr; private bool ServerActive => NetworkServer.active; public void Start() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Expected O, but got Unknown losTracker = new CharacterLosTracker(); losTracker.enabled = true; killSphereVfxHelper = VFXHelper.Rent(); killSphereVfxHelper.vfxPrefabReference = VacuumAttack.killSphereVfxPrefab; pos = ((Component)this).transform.position; killSphereVfxHelper.followedTransform = ((Component)this).transform; killSphereVfxHelper.useFollowedTransformScale = false; killSphereVfxHelper.enabled = true; UpdateKillSphereVfx(); environmentVfxHelper = VFXHelper.Rent(); environmentVfxHelper.vfxPrefabReference = VacuumAttack.environmentVfxPrefab; environmentVfxHelper.followedTransform = ((Component)this).transform; environmentVfxHelper.useFollowedTransformScale = false; environmentVfxHelper.enabled = true; loopPtr = LoopSoundManager.PlaySoundLoopLocal(((Component)this).gameObject, VacuumAttack.loopSound); if (NetworkServer.active) { killSearch = new SphereSearch(); } } public void DestroyBomb() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) active = false; killSphereVfxHelper = VFXHelper.Return(killSphereVfxHelper); environmentVfxHelper = VFXHelper.Return(environmentVfxHelper); losTracker.enabled = false; losTracker.Dispose(); losTracker = null; LoopSoundManager.StopSoundLoopLocal(loopPtr); Object.Destroy((Object)(object)((Component)this).gameObject); } public float TimeInSecondsPassed() { return timeSpent; } public void Update() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_0113: 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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)this == (Object)null || !active) { return; } if (!PauseManager.isPaused) { timeSpent += Time.fixedDeltaTime; } if (timeSpent > ArtifactOfNullification.StormTime.Value) { DestroyBomb(); return; } killRadius = TimeInSecondsPassed() * 2f; UpdateKillSphereVfx(); Vector3 val = pos; losTracker.origin = val; losTracker.Step(); float num = TimeInSecondsPassed() * 0.8f; ReadOnlyCollection<CharacterBody> readOnlyInstancesList = CharacterBody.readOnlyInstancesList; for (int i = 0; i < readOnlyInstancesList.Count; i++) { CharacterBody val2 = readOnlyInstancesList[i]; bool flag = losTracker.CheckBodyHasLos(val2); if (val2.hasEffectiveAuthority) { IDisplacementReceiver component = ((Component)val2).GetComponent<IDisplacementReceiver>(); if (component != null) { float num2 = (flag ? 1f : losObstructionFactor); Vector3 val3 = val - val2.coreTransform.position; component.AddDisplacement(((Vector3)(ref val3)).normalized * (num * num2 * Time.fixedDeltaTime)); } } } if (!ServerActive) { return; } List<HurtBox> list = CollectionPool<HurtBox, List<HurtBox>>.RentCollection(); List<HealthComponent> list2 = CollectionPool<HealthComponent, List<HealthComponent>>.RentCollection(); try { killSearch.radius = killRadius; killSearch.origin = val; killSearch.mask = ((LayerIndex)(ref LayerIndex.entityPrecise)).mask; killSearch.RefreshCandidates(); killSearch.OrderCandidatesByDistance(); killSearch.FilterCandidatesByDistinctHurtBoxEntities(); killSearch.GetHurtBoxes(list); for (int j = 0; j < list.Count; j++) { HurtBox val4 = list[j]; if (Object.op_Implicit((Object)(object)val4.healthComponent)) { list2.Add(val4.healthComponent); } } for (int k = 0; k < list2.Count; k++) { HealthComponent val5 = list2[k]; val5.Suicide((GameObject)null, (GameObject)null, DamageTypeCombo.op_Implicit((DamageType)65536)); } } finally { list2 = CollectionPool<HealthComponent, List<HealthComponent>>.ReturnCollection(list2); list = CollectionPool<HurtBox, List<HurtBox>>.ReturnCollection(list); } } private void UpdateKillSphereVfx() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)killSphereVfxHelper.vfxInstanceTransform)) { killSphereVfxHelper.vfxInstanceTransform.localScale = Vector3.one * killRadius; } } } }