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 2R4R v1.3.45
SwanSongExtended.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using 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.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BetterSoulCost; using BossDropRework; using EntityStates; using EntityStates.AI.Walker; using EntityStates.Bandit2; using EntityStates.BrotherMonster.Weapon; using EntityStates.Captain.Weapon; using EntityStates.CaptainSupplyDrop; using EntityStates.GrandParent; using EntityStates.LaserTurbine; using EntityStates.Mage.Weapon; using EntityStates.NullifierMonster; using EntityStates.TeleporterHealNovaController; using FabricatorStandalone; using HG; using HG.BlendableTypes; using HG.Reflection; using HarmonyLib; using IL.RoR2; using IL.RoR2.Items; using IL.RoR2.Orbs; using KinematicCharacterController; using MissileRework; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MoreStats; using On.EntityStates; using On.EntityStates.LaserTurbine; using On.EntityStates.TeleporterHealNovaController; using On.RoR2; using On.RoR2.Items; using On.RoR2.Orbs; using R2API; using R2API.Utils; using RainrotSharedUtils; using RainrotSharedUtils.Components; using RainrotSharedUtils.Difficulties; using RainrotSharedUtils.Shelters; using RainrotSharedUtils.Status; using RoR2; using RoR2.Achievements; using RoR2.Artifacts; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.Hologram; using RoR2.Items; using RoR2.Navigation; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using RoR2BepInExPack.GameAssetPaths; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RoR2BepInExPack.GameAssetPathsBetter; using SwanSongExtended.Artifacts; using SwanSongExtended.Characters; using SwanSongExtended.Components; using SwanSongExtended.Elites; using SwanSongExtended.Equipment; using SwanSongExtended.Equipment.Zapinator; using SwanSongExtended.Interactables; using SwanSongExtended.Items; using SwanSongExtended.Modules; using SwanSongExtended.Scavengers; using SwanSongExtended.Skills; using SwanSongExtended.States; using SwanSongExtended.Storms; using ThreeEyedGames; using Unity; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("SwanSongExtended")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("SwanSongExtended")] [assembly: AssemblyTitle("SwanSongExtended")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace RiskierRainContent.Interactables { internal static class CombatEncounterHelper { public enum CustomDirectorType { GalleryDirector = 1, ConstructDirector } public static GameObject MethodOne(PurchaseInteraction purchaseInteraction, Interactor activator, int credits, CustomDirectorType directorType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown Vector3 val = Vector3.zero; Quaternion rotation = Quaternion.identity; Transform transform = ((Component)purchaseInteraction).gameObject.transform; if (Object.op_Implicit((Object)(object)transform)) { val = transform.position; rotation = transform.rotation; } GameObject val2 = LegacyResourcesAPI.Load<GameObject>("Prefabs/NetworkedObjects/Encounters/MonstersOnShrineUseEncounter"); if ((Object)(object)val2 == (Object)null) { return null; } GameObject val3 = Object.Instantiate<GameObject>(val2, val, Quaternion.identity); NetworkServer.Spawn(val3); CombatDirector component = val3.GetComponent<CombatDirector>(); ParseDirectorType(((Component)component).gameObject, directorType); if (!Object.op_Implicit((Object)(object)component) || !Object.op_Implicit((Object)(object)Stage.instance)) { return null; } float num = (float)credits * Stage.instance.entryDifficultyCoefficient; DirectorCard val4 = component.SelectMonsterCardForCombatShrine(num); if (val4 != null) { component.CombatShrineActivation(activator, num, val4); EffectData val5 = new EffectData { origin = val, rotation = rotation }; if (directorType == CustomDirectorType.ConstructDirector) { GameObject val6 = LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/MonstersOnShrineUse"); EffectManager.SpawnEffect(val6, val5, true); } } return val3; } public static void ParseDirectorType(GameObject obj, CustomDirectorType value) { switch (value) { case CustomDirectorType.GalleryDirector: obj.AddComponent<GalleryDirector>(); break; case CustomDirectorType.ConstructDirector: obj.AddComponent<ConstructDirector>(); break; default: obj.AddComponent<GalleryDirector>(); break; } } } internal class GalleryDirector : MonoBehaviour { } internal class ConstructDirector : MonoBehaviour { } } namespace SwanSongExtended { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [R2APISubmoduleDependency(new string[] { "LanguageAPI", "PrefabAPI", "RecalculateStatsAPI", "DotAPI" })] [BepInPlugin("com.RiskOfBrainrot.SwanSongExtended", "SwanSongExtended", "0.1.0")] public class SwanSongPlugin : BaseUnityPlugin { public delegate void orig_idc(LaserTurbineController self); private class ResDiscContext { public LaserTurbineController laserTurbineController; public ResDiscContext(LaserTurbineController passive) { laserTurbineController = passive; } } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__15_0; public static Func<Instruction, bool> <>9__35_0; public static Func<Instruction, bool> <>9__35_1; public static Func<Instruction, bool> <>9__36_0; public static Action<PayCostContext> <>9__38_0; public static Func<Instruction, bool> <>9__44_0; public static Func<Inventory, int> <>9__44_1; public static Func<Instruction, bool> <>9__54_0; public static Func<int, int> <>9__54_1; public static Func<Instruction, bool> <>9__56_0; public static Func<Instruction, bool> <>9__56_1; public static Func<Instruction, bool> <>9__56_2; public static Func<Instruction, bool> <>9__57_0; public static Func<float, float> <>9__57_1; public static Func<Instruction, bool> <>9__64_0; public static Func<int, EquipmentSlot, int> <>9__64_1; public static Func<Instruction, bool> <>9__65_0; public static Func<Instruction, bool> <>9__65_1; public static Func<Instruction, bool> <>9__65_2; public static Func<int, Inventory, int> <>9__65_3; public static Func<Instruction, bool> <>9__69_0; public static Func<Instruction, bool> <>9__69_1; public static Func<Instruction, bool> <>9__72_0; public static Func<Instruction, bool> <>9__72_1; public static Action<EquipmentSlot> <>9__72_2; public static Func<Instruction, bool> <>9__74_0; public static Func<Instruction, bool> <>9__74_1; public static Func<Instruction, bool> <>9__82_0; public static Func<Instruction, bool> <>9__82_1; public static Func<Instruction, bool> <>9__84_0; public static Func<Instruction, bool> <>9__84_1; public static Func<Instruction, bool> <>9__84_2; public static Func<Instruction, bool> <>9__84_3; public static Func<int, int> <>9__84_4; public static Func<Instruction, bool> <>9__85_0; public static Func<Instruction, bool> <>9__85_1; public static Func<Instruction, bool> <>9__85_3; public static Func<Instruction, bool> <>9__85_6; public static Func<Instruction, bool> <>9__85_7; public static Func<Instruction, bool> <>9__85_8; public static Func<float, int, float> <>9__85_11; public static Func<int, int, CharacterBody, int> <>9__85_12; public static Func<Instruction, bool> <>9__93_0; public static Func<Instruction, bool> <>9__93_1; public static Func<Instruction, bool> <>9__99_0; public static Func<Instruction, bool> <>9__99_1; public static Func<bool, DamageInfo, bool> <>9__99_2; public static Func<Instruction, bool> <>9__106_0; public static hook_TrackBeadExperience <>9__111_1; public static Func<Instruction, bool> <>9__115_0; public static Func<Instruction, bool> <>9__115_1; public static Func<Instruction, bool> <>9__115_4; public static Func<Instruction, bool> <>9__115_5; public static Action<int, CharacterBody> <>9__115_7; public static Func<Instruction, bool> <>9__115_8; public static Func<Instruction, bool> <>9__115_9; public static Func<int, int> <>9__115_10; public static Func<Instruction, bool> <>9__115_17; public static Func<Instruction, bool> <>9__115_18; public static Func<Instruction, bool> <>9__129_0; public static Func<HealthComponent, LightningOrb, HealthComponent> <>9__129_3; public static Func<Instruction, bool> <>9__130_0; public static Func<Instruction, bool> <>9__130_1; public static Func<Instruction, bool> <>9__130_2; public static Func<Instruction, bool> <>9__130_3; public static Func<Instruction, bool> <>9__130_4; public static Func<Instruction, bool> <>9__130_5; public static Func<Instruction, bool> <>9__130_6; public static Func<Instruction, bool> <>9__130_8; public static Func<Instruction, bool> <>9__130_9; public static Func<Instruction, bool> <>9__130_10; public static Func<Instruction, bool> <>9__130_11; public static Func<Instruction, bool> <>9__130_12; public static Action<CraftableDef> <>9__205_0; internal bool <RemoveAegisOverheal>b__15_0(Instruction x) { return ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "barrierOnOverHeal"); } internal bool <RemoveCrownReward>b__35_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "GoldOnHit"); } internal bool <RemoveCrownReward>b__35_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <RemoveCrownPenalty>b__36_0(Instruction x) { return ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "goldOnHit"); } internal void <PatchMoneyCostForBrittleCrown>b__38_0(PayCostContext ctx) { CharacterBody activatorBody = ctx.activatorBody; if (Object.op_Implicit((Object)(object)activatorBody) && Object.op_Implicit((Object)(object)ctx.activatorMaster) && ctx.activatorMaster.money < ctx.cost) { ctx.cost = 0; } } internal bool <FreezeCard>b__44_0(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "get_currentEquipmentIndex"); } internal int <FreezeCard>b__44_1(Inventory inv) { return -1; } internal bool <FoconUpdate>b__54_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "cap"); } internal int <FoconUpdate>b__54_1(int cap) { return foconMaxStack; } internal bool <FoconApplyRadius>b__56_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceRadiusDivisor"); } internal bool <FoconApplyRadius>b__56_1(Instruction x) { return ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceRadiusDivisor"); } internal bool <FoconApplyRadius>b__56_2(Instruction x) { return ILPatternMatchingExt.MatchStindR4(x); } internal bool <FoconApplyRate>b__57_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceChargeRateBonus"); } internal float <FoconApplyRate>b__57_1(float chargeBonus) { return foconChargeBonus; } internal bool <AllowGestureUndercast>b__64_0(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<EquipmentSlot>(x, "get_stock"); } internal int <AllowGestureUndercast>b__64_1(int stock, EquipmentSlot slot) { if (stock > 0) { return stock; } if (slot.inventory.GetItemCountEffective(Items.AutoCastEquipment) > 0) { return 1; } return 0; } internal bool <FixMaxStock>b__65_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "EquipmentMagazine"); } internal bool <FixMaxStock>b__65_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <FixMaxStock>b__65_2(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchStloc(x, ref num); } internal int <FixMaxStock>b__65_3(int stock, Inventory inv) { stock += GetGestureStockFromInventory(inv); return stock; } internal bool <RemoveGestureCdr>b__69_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "AutoCastEquipment"); } internal bool <RemoveGestureCdr>b__69_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <AddPreonAccumulatorBreak>b__72_0(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 0f); } internal bool <AddPreonAccumulatorBreak>b__72_1(Instruction x) { return ILPatternMatchingExt.MatchStfld<EquipmentSlot>(x, "bfgChargeTimer"); } internal void <AddPreonAccumulatorBreak>b__72_2(EquipmentSlot self) { TryGestureEquipmentBreak(self); } internal bool <RemoveGestureAutocast>b__74_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "AutoCastEquipment"); } internal bool <RemoveGestureAutocast>b__74_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <RevokeHappiestMaskRights>b__82_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "GhostOnKill"); } internal bool <RevokeHappiestMaskRights>b__82_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <ChangeMoveSpeed>b__84_0(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <ChangeMoveSpeed>b__84_1(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <ChangeMoveSpeed>b__84_2(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Buffs", "KillMoveSpeed"); } internal bool <ChangeMoveSpeed>b__84_3(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount"); } internal int <ChangeMoveSpeed>b__84_4(int buffCount) { if (buffCount > 0) { return 1; } return 0; } internal bool <ChangeDuration>b__85_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "MoveSpeedOnKill"); } internal bool <ChangeDuration>b__85_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <ChangeDuration>b__85_3(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 5); } internal bool <ChangeDuration>b__85_6(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Buffs", "KillMoveSpeed"); } internal bool <ChangeDuration>b__85_7(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "ClearTimedBuffs"); } internal bool <ChangeDuration>b__85_8(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "AddTimedBuff"); } internal float <ChangeDuration>b__85_11(float baseBuffDuration, int iterator) { return iterator + 1; } internal int <ChangeDuration>b__85_12(int vanillaBuffCount, int itemCount, CharacterBody attackerBody) { if (itemCount > 25) { return itemCount; } int buffCount = attackerBody.GetBuffCount(Buffs.KillMoveSpeed); return Mathf.Min(25, buffCount + itemCount); } internal bool <RevokeScopeRights>b__93_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "CritDamage"); } internal bool <RevokeScopeRights>b__93_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <FuckLeechingSeed>b__99_0(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 6); } internal bool <FuckLeechingSeed>b__99_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.ProcChainMask", "HasProc"); } internal bool <FuckLeechingSeed>b__99_2(bool cantProc, DamageInfo damageInfo) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 return cantProc || (!((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased && (int)damageInfo.damageType.damageSource != 64); } internal bool <FuckPlanula>b__106_0(Instruction x) { return ILPatternMatchingExt.MatchLdfld(x, "RoR2.HealthComponent/ItemCounts", "parentEgg"); } internal void <PrayerBeadsRework>b__111_1(orig_TrackBeadExperience orig, CharacterMaster self, ulong idk) { } internal bool <ChangeBeadAppliedStats>b__115_0(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC2Content/Items", "ExtraStatsOnLevelUp"); } internal bool <ChangeBeadAppliedStats>b__115_1(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountPermanent"); } internal bool <ChangeBeadAppliedStats>b__115_4(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <ChangeBeadAppliedStats>b__115_5(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "extraStatsOnLevelUpCount_CachedLastApplied"); } internal void <ChangeBeadAppliedStats>b__115_7(int itemCount, CharacterBody self) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) int num = self.extraStatsOnLevelUpCount_CachedLastApplied - itemCount; self.extraStatsOnLevelUpCount_CachedLastApplied = itemCount; Inventory inventory = self.inventory; inventory.beadAppliedHealth += (float)num; Inventory inventory2 = self.inventory; inventory2.beadAppliedShield += (float)num; Inventory inventory3 = self.inventory; inventory3.beadAppliedRegen += (float)num; Inventory inventory4 = self.inventory; inventory4.beadAppliedDamage += (float)num; self.SetBuffCount(Buffs.ExtraStatsOnLevelUpBuff.buffIndex, (int)self.inventory.beadAppliedHealth); } internal bool <ChangeBeadAppliedStats>b__115_8(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC2Content/Buffs", "ExtraStatsOnLevelUpBuff"); } internal bool <ChangeBeadAppliedStats>b__115_9(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount"); } internal int <ChangeBeadAppliedStats>b__115_10(int buffCount) { return 0; } internal bool <ChangeBeadAppliedStats>b__115_17(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <ChangeBeadAppliedStats>b__115_18(Instruction x) { ILLabel val = default(ILLabel); return ILPatternMatchingExt.MatchBleUn(x, ref val); } internal bool <RazorwireArrival>b__129_0(Instruction x) { return ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent"); } internal HealthComponent <RazorwireArrival>b__129_3(HealthComponent hc, LightningOrb orb) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)orb.lightningType == 6 && (Object)(object)hc != (Object)null) { for (int i = 0; (float)i < orb.procCoefficient; i++) { DotController.InflictDot(((Component)hc).gameObject, orb.attacker, hc.body.mainHurtBox, (DotIndex)0, razorwireBleedDuration, orb.damageValue, (uint?)null); } return null; } return hc; } internal bool <RazorwireBegin>b__130_0(Instruction x) { return ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"); } internal bool <RazorwireBegin>b__130_1(Instruction x) { return ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "thorns"); } internal bool <RazorwireBegin>b__130_2(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdcI4(x, ref num); } internal bool <RazorwireBegin>b__130_3(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdcI4(x, ref num); } internal bool <RazorwireBegin>b__130_4(Instruction x) { return ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"); } internal bool <RazorwireBegin>b__130_5(Instruction x) { return ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "thorns"); } internal bool <RazorwireBegin>b__130_6(Instruction x) { return ILPatternMatchingExt.MatchLdcI4(x, 0); } internal bool <RazorwireBegin>b__130_8(Instruction x) { return ILPatternMatchingExt.MatchLdflda<HealthComponent>(x, "itemCounts"); } internal bool <RazorwireBegin>b__130_9(Instruction x) { return ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "thorns"); } internal bool <RazorwireBegin>b__130_10(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdcI4(x, ref num); } internal bool <RazorwireBegin>b__130_11(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdcI4(x, ref num); } internal bool <RazorwireBegin>b__130_12(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<OrbManager>(x, "AddOrb"); } internal void <RemoveCraftingRecipe>b__205_0(CraftableDef craftableDef) { craftableDef.recipes = (Recipe[])(object)new Recipe[0]; } } public static int ignitionTankBurnChance = 15; public float ignitionBurnDamage = 2f; public float ignitionBurnDuration = 2f; private bool shouldIgnitionDamageAndDurationCompound = false; public static int stacheBurnChance = 25; public static int brandBurnChance = 30; public static float _aegisBarrierFlat = 40f; public static float _aegisBarrierPercent = 10f; public static BuffDef aegisDecayBuff; public static int brittleCrownStealCountBase = 2; public static int brittleCrownStealCountStack = 1; public static float crownCommonStealSoulCost = 0.25f; public static float crownUncommonStealSoulCost = 0.5f; public static float crownRareStealSoulCost = 0.8f; private string common = Tools.ConvertDecimal(crownCommonStealSoulCost); private string uncommon = Tools.ConvertDecimal(crownUncommonStealSoulCost); private string rare = Tools.ConvertDecimal(crownRareStealSoulCost); public static float cooldown = 90f; public static float secondsPerCost = 0.5f; public static float foconMinRadius = 8f; public static float foconRadiusMultiplier = 0.5f; public static float foconChargeBonus = 1f; public static int foconMaxStack = 5; public static float gestureEquipBreakChance = 40f; public static int gestureStockBase = 4; public static int gestureStockStack = 2; public static float gestureCdiBase = 1f; public static float gestureCdiStack = 0.5f; public static float hauntExecutionThreshold = 0.25f; private float ghostSpawnChanceOnExecute = 100f; private float ghostDurationPerStack = 6.66f; public int scopeBaseCrit = 5; public int scopeStackCrit = 0; public int scopeBaseStationaryCrit = 40; public int scopeStackStationaryCrit = 0; public static ItemDef seedItemDef; public static float seedRegenDurationBase = 0.25f; public static float seedRegenDurationStack = 0.25f; public static float sunDurationBase = 10f; public static float sunDurationStack = 5f; public static float beadsPermanentStatBonus = 0.07f; private static float razorwireArmorBase = 8f; private static float razorwireArmorStack = 8f; private static float razorwireRangeBase = 40f; private static float razorwireRangeStack = 0f; private static float razorwireTargetsBase = 5f; private static float razorwireTargetsStack = 2f; private static float razorwireBleedDuration = 5f; private static float razorwireDamage = 3.6f; private static float razorwireProcCoeff = 0.2f; private static float razorwireCooldown = 1f; public static GameObject laserTurbineControllerPrefab; private readonly Dictionary<EntityState, ResDiscContext> resDiscStateContext = new Dictionary<EntityState, ResDiscContext>(); public const string guid = "com.RiskOfBrainrot.SwanSongExtended"; public const string teamName = "RiskOfBrainrot"; public const string modName = "SwanSongExtended"; public const string version = "0.1.0"; public const string expansionName = "Swan Song"; public const string expansionName2 = "Secrets of the Scug"; public const string expansionToken = "EXPANSION2R4R"; public const string expansionToken2 = "EXPANSIONSOTS"; public const string DEVELOPER_PREFIX = "FRUIT"; public static SwanSongPlugin instance; public static ExpansionDef expansionDefSS2; public static ExpansionDef expansionDefSOTS; public const string iconsPath = ""; private BuffDef brittleCrownBuff => CommonAssets.brittleCrownCursePurchase; private static float minSpin => LaserTurbineController.minSpin; private static float maxSpin => LaserTurbineController.maxSpin; private static float spinPerKill => LaserTurbineController.spinGeneratedOnKill; private static float spinDecayRate => LaserTurbineController.spinDecayPerSecondAfterRefresh; private GameObject meatballNapalmPool => CommonAssets.meatballNapalmPool; public static AssetBundle mainAssetBundle => CommonAssets.mainAssetBundle; public static AssetBundle retierAssetBundle => CommonAssets.retierAssetBundle; public static bool iabMissilesLoaded => ModLoaded("com.RiskOfBrainrot.IAmBecomeMissiles"); public static bool isAELoaded => ModLoaded("com.Borbo.ArtificerExtended"); public static bool is2R4RLoaded => ModLoaded("com.RiskOfBrainrot.RiskierRain"); public static bool isHBULoaded => ModLoaded("com.Borbo.HuntressBuffULTIMATE"); public static bool isScepterLoaded => ModLoaded("com.DestroyedClone.AncientScepter"); public static bool autosprintLoaded => ModLoaded("com.johnedwa.RTAutoSprintEx"); public static bool acridLungeLoaded => ModLoaded("Withor.AcridBiteLunge"); public static bool ucrLoaded => ModLoaded("HIFU.UltimateCustomRun"); public static bool fabricatorsLoaded => ModLoaded("com.RiskOfBrainrot.Fabricators"); private void BurnReworks() { IgnitionTankRework(); } private void IgnitionTankRework() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(IgniTankBurnChance); StrengthenBurnUtils.CheckDotForUpgrade += new hook_CheckDotForUpgrade(OverrideIgnitionBurn); LanguageAPI.Add("ITEM_STRENGTHENBURN_PICKUP", "Your ignite effects deal triple damage."); LanguageAPI.Add("ITEM_STRENGTHENBURN_DESC", $"Gain <style=cIsDamage>{ignitionTankBurnChance}% ignite chance</style>. " + "All ignition effects deal <style=cIsDamage>+" + Tools.ConvertDecimal(ignitionBurnDamage) + "</style> <style=cStack>(+" + Tools.ConvertDecimal(ignitionBurnDamage) + " per stack)</style> more damage and last <style=cIsUtility>+" + Tools.ConvertDecimal(ignitionBurnDuration) + "</style> <style=cStack>(+" + Tools.ConvertDecimal(ignitionBurnDuration) + " per stack)</style> longer."); } private void IgniTankBurnChance(CharacterBody sender, MoreStatHookEventArgs args) { Inventory inventory = sender.inventory; if (Object.op_Implicit((Object)(object)inventory) && inventory.GetItemCountEffective(Items.StrengthenBurn) > 0) { args.burnChanceOnHit += (float)ignitionTankBurnChance; } } private void OverrideIgnitionBurn(orig_CheckDotForUpgrade orig, Inventory inventory, ref InflictDotInfo dotInfo) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_0038: 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) if ((int)dotInfo.dotIndex != 1 && (int)dotInfo.dotIndex != 2) { return; } int itemCountEffective = inventory.GetItemCountEffective(Items.StrengthenBurn); if (itemCountEffective > 0) { dotInfo.preUpgradeDotIndex = dotInfo.dotIndex; dotInfo.dotIndex = (DotIndex)7; float num = 1f + ignitionBurnDamage * (float)itemCountEffective; float num2 = 1f + ignitionBurnDuration * (float)itemCountEffective; if (shouldIgnitionDamageAndDurationCompound) { dotInfo.totalDamage *= num * num2; dotInfo.damageMultiplier *= num; } else { dotInfo.totalDamage *= num; dotInfo.damageMultiplier *= num / num2; } } } public static int GetBurnCount(CharacterBody victimBody) { return victimBody.GetBuffCount(Buffs.OnFire) + victimBody.GetBuffCount(Buffs.StrongerBurn); } public void ReworkAegis() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown CreateBuff(); Hooks(); HealthComponent.Heal += new Manipulator(RemoveAegisOverheal); LanguageAPI.Add("ITEM_BARRIERONOVERHEAL_PICKUP", "Gain barrier on any interaction. While out of danger, barrier stops decaying."); LanguageAPI.Add("ITEM_BARRIERONOVERHEAL_DESC", "Using any interactable grants a <style=cIsHealing>temporary barrier</style> " + $"for <style=cIsHealing>{_aegisBarrierFlat} health</style> <style=cStack>(+{_aegisBarrierFlat} per stack)</style> " + "plus an additional " + $"<style=cIsHealing>{_aegisBarrierPercent}%</style> <style=cStack>(+{_aegisBarrierPercent}% per stack)</style> " + "of <style=cIsHealing>maximum health</style>. While outside of danger, <style=cIsUtility>barrier will not decay</style>."); } private void RemoveAegisOverheal(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "barrierOnOverHeal") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4_0); } private void CreateBuff() { //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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) aegisDecayBuff = ScriptableObject.CreateInstance<BuffDef>(); ((Object)aegisDecayBuff).name = "AegisDecayFreeze"; aegisDecayBuff.buffColor = new Color(0.95f, 0.85f, 0.08f); aegisDecayBuff.canStack = false; aegisDecayBuff.isDebuff = false; aegisDecayBuff.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffGenericShield.tif").WaitForCompletion(); ContentAddition.AddBuffDef(aegisDecayBuff); } public void Hooks() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown MultiShopCardUtils.OnMoneyPurchase += new hook_OnMoneyPurchase(OnMoneyPurchase); MultiShopCardUtils.OnNonMoneyPurchase += new hook_OnNonMoneyPurchase(OnNonMoneyPurchase); CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddItemBehavior); StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(AegisDecayFreeze); } private void AegisDecayFreeze(CharacterBody body, MoreStatHookEventArgs args) { if (body.HasBuff(aegisDecayBuff)) { args.barrierFreezeCount++; } } private void OnNonMoneyPurchase(orig_OnNonMoneyPurchase orig, PayCostContext context) { AegisBarrierGrant(context); orig.Invoke(context); } private void OnMoneyPurchase(orig_OnMoneyPurchase orig, PayCostContext context) { AegisBarrierGrant(context); orig.Invoke(context); } private void AddItemBehavior(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active) { self.AddItemBehavior<AegisDecayBehavior>(self.inventory.GetItemCountEffective(Items.BarrierOnOverHeal)); } } private void AegisBarrierGrant(PayCostContext context) { CharacterMaster activatorMaster = context.activatorMaster; CharacterBody val = ((activatorMaster != null) ? activatorMaster.GetBody() : null); if (Object.op_Implicit((Object)(object)val)) { int itemCountEffective = val.inventory.GetItemCountEffective(Items.BarrierOnOverHeal); HealthComponent healthComponent = val.healthComponent; if (itemCountEffective > 0 && (Object)(object)healthComponent != (Object)null) { float num = Util.ConvertAmplificationPercentageIntoReductionNormalized(_aegisBarrierPercent * 0.01f) * healthComponent.fullCombinedHealth; float num2 = (float)itemCountEffective * _aegisBarrierFlat; healthComponent.AddBarrierAuthority(num + num2); } } } public void BrittleCrownChanges() { //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown LanguageAPI.Add("ITEM_GOLDONHIT_NAME", "Sunken Crown"); LanguageAPI.Add("ITEM_GOLDONHIT_PICKUP", "Steal from chests... " + Language.Styling.HealthColor("at the cost of health.")); LanguageAPI.Add("ITEM_GOLDONHIT_DESC", "Allows interacting with chests without the ability to afford them, opening the chest " + Language.Styling.UtilityColor("without spending ANY money") + ". Stealing from chests costs " + Language.Styling.HealthColor("[ " + common + " / " + uncommon + " / " + rare + " ]") + " of your " + Language.Styling.HealthColor("maximum health") + ", depending on the size of the chest. " + $"Can steal up to {brittleCrownStealCountBase} {Language.Styling.StackText($"+{brittleCrownStealCountStack}")} times per stage."); HealthComponent.TakeDamageProcess += new Manipulator(RemoveCrownPenalty); GlobalEventManager.ProcessHitEnemy += new Manipulator(RemoveCrownReward); PurchaseInteraction.CanBeAffordedByInteractor += new hook_CanBeAffordedByInteractor(PurchaseInteraction_CanBeAffordedByInteractor); CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddBrittleCrownBehavior); } private void AddBrittleCrownBehavior(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active) { self.AddItemBehavior<BrittleCrownBehavior>(self.inventory.GetItemCountEffective(Items.GoldOnHit)); } } private void RemoveCrownReward(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "GoldOnHit"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4, 0); } private void RemoveCrownPenalty(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<ItemCounts>(x, "goldOnHit") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4, 0); } private void CTCInit(orig_Init orig) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown orig.Invoke(); CostTypeDef costTypeDef = CostTypeCatalog.GetCostTypeDef((CostTypeIndex)1); MethodInfo method = ((Delegate)(object)costTypeDef.payCost).Method; ILHook val = new ILHook((MethodBase)method, new Manipulator(PatchMoneyCostForBrittleCrown)); } private void PatchMoneyCostForBrittleCrown(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0009: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Action<PayCostContext>>((Action<PayCostContext>)delegate(PayCostContext ctx) { CharacterBody activatorBody = ctx.activatorBody; if (Object.op_Implicit((Object)(object)activatorBody) && Object.op_Implicit((Object)(object)ctx.activatorMaster) && ctx.activatorMaster.money < ctx.cost) { ctx.cost = 0; } }); } private bool PurchaseInteraction_CanBeAffordedByInteractor(orig_CanBeAffordedByInteractor orig, PurchaseInteraction self, Interactor activator) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 bool flag = orig.Invoke(self, activator); if (flag) { return flag; } CharacterBody val = null; if ((int)self.costType == 1 && self.saleStarCompatible && ((Component)activator).gameObject.TryGetComponent<CharacterBody>(ref val) && val.HasBuff(brittleCrownBuff) && val.master.money < self.cost) { int num = 1; int difficultyScaledCost = Run.instance.GetDifficultyScaledCost(45, Stage.instance.entryDifficultyCoefficient); int difficultyScaledCost2 = Run.instance.GetDifficultyScaledCost(245, Stage.instance.entryDifficultyCoefficient); if (self.cost >= num && self.cost < difficultyScaledCost) { CounterfeitCalculations(val, crownCommonStealSoulCost); } else if (self.cost >= difficultyScaledCost && self.cost < difficultyScaledCost2) { CounterfeitCalculations(val, crownUncommonStealSoulCost); } else { CounterfeitCalculations(val, crownRareStealSoulCost); } flag = true; } return flag; } public void CounterfeitCalculations(CharacterBody activator, float soulCost) { SoulCostPlugin.AddSoulCostToBody(activator, soulCost); Util.PlaySound("sfx_lunarmoney_start", ((Component)activator).gameObject); if (NetworkServer.active) { activator.AddBuff(Buffs.FreeUnlocks); activator.RemoveBuff(brittleCrownBuff); } } public void ExecutiveCardChanges() { //IL_0006: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown EquipmentDef val = Addressables.LoadAssetAsync<EquipmentDef>((object)"RoR2/DLC1/MultiShopCard/MultiShopCard.asset").WaitForCompletion(); val.cooldown = cooldown; LanguageAPI.Add("EQUIPMENT_MULTISHOPCARD_PICKUP", "Hack a targeted interactable. Hacked Multishops remain open."); LanguageAPI.Add("EQUIPMENT_MULTISHOPCARD_DESC", "Target an interactable to <style=cIsUtility>hack</style> it, unlocking its contents for <style=cIsUtility>free</style>. If the target is a <style=cIsUtility>multishop</style> terminal, the other terminals will <style=cIsUtility>remain open</style>."); MultiShopCardUtils.OnPurchase += new Manipulator(FreezeCard); EquipmentSlot.UpdateTargets += new hook_UpdateTargets(CardTargetInteractables); EquipmentSlot.PerformEquipmentAction += new hook_PerformEquipmentAction(PerformEquipmentAction); } private void FreezeCard(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "get_currentEquipmentIndex") }); val.Remove(); val.EmitDelegate<Func<Inventory, int>>((Func<Inventory, int>)((Inventory inv) => -1)); } private bool PerformEquipmentAction(orig_PerformEquipmentAction orig, EquipmentSlot self, EquipmentDef equipmentDef) { if ((Object)(object)equipmentDef == (Object)(object)Equipment.MultiShopCard) { return ActivateEquipment(self); } return orig.Invoke(self, equipmentDef); static bool ActivateEquipment(EquipmentSlot slot) { bool result = false; GameObject rootObject = slot.currentTarget.rootObject; if ((Object)(object)rootObject != (Object)null) { PurchaseInteraction component = rootObject.GetComponent<PurchaseInteraction>(); if ((Object)(object)component != (Object)null && HackingMainState.PurchaseInteractionIsValidTarget(component)) { component.Networkcost = 0; ShopTerminalBehavior val = default(ShopTerminalBehavior); if (rootObject.TryGetComponent<ShopTerminalBehavior>(ref val) && Object.op_Implicit((Object)(object)val.serverMultiShopController)) { val.serverMultiShopController.SetCloseOnTerminalPurchase(component, false); } DroneVendorTerminalBehavior val2 = default(DroneVendorTerminalBehavior); if (rootObject.TryGetComponent<DroneVendorTerminalBehavior>(ref val2) && Object.op_Implicit((Object)(object)val2.serverMultiShopController)) { val2.serverMultiShopController.SetCloseOnTerminalPurchase(component, false); } Interactor val3 = default(Interactor); if ((Object)(object)slot.characterBody != (Object)null && ((Component)slot.characterBody).TryGetComponent<Interactor>(ref val3)) { val3.AttemptInteraction(rootObject); } slot.InvalidateCurrentTarget(); result = true; } } return result; } } private void CardTargetInteractables(orig_UpdateTargets orig, EquipmentSlot self, EquipmentIndex targetingEquipmentIndex, bool userShouldAnticipateTarget) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: 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) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: 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_02dc: 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_011b: Unknown result type (might be due to invalid IL or missing references) //IL_011d: 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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) if (targetingEquipmentIndex != Equipment.MultiShopCard.equipmentIndex || !userShouldAnticipateTarget) { orig.Invoke(self, targetingEquipmentIndex, userShouldAnticipateTarget); return; } float num = 150f; float num2 = 10f; float num3 = Mathf.Cos(Mathf.Clamp(num2, 0f, 180f) * MathF.PI / 180f); float num4 = default(float); Ray val = CameraRigController.ModifyAimRayIfApplicable(self.GetAimRay(), ((Component)self.characterBody).gameObject, ref num4); Collider[] array = Physics.OverlapSphere(((Ray)(ref val)).origin, num + num4, -1, (QueryTriggerInteraction)2); bool flag = false; GameObject rootObject = self.currentTarget.rootObject; Vector3 val3; if ((Object)(object)rootObject != (Object)null) { PurchaseInteraction val2 = ((rootObject != null) ? rootObject.GetComponent<PurchaseInteraction>() : null); if ((Object)(object)val2 != (Object)null) { flag = HackingMainState.PurchaseInteractionIsValidTarget(val2) && val2.available; } Vector3 origin = ((Ray)(ref val)).origin; Vector3 position = rootObject.transform.position; if (flag) { val3 = position - origin; if (!(((Vector3)(ref val3)).sqrMagnitude > num * num)) { Vector3 direction = ((Ray)(ref val)).direction; val3 = position - origin; if (!(Vector3.Dot(direction, ((Vector3)(ref val3)).normalized) < num3)) { goto IL_0146; } } } self.InvalidateCurrentTarget(); } goto IL_0146; IL_0146: bool flag2 = false; PurchaseInteraction val4 = null; Collider[] array2 = array; foreach (Collider val5 in array2) { Vector3 direction2 = ((Ray)(ref val)).direction; val3 = ((Component)val5).transform.position - ((Ray)(ref val)).origin; float num5 = Vector3.Dot(direction2, ((Vector3)(ref val3)).normalized); if (num5 < num3) { continue; } Vector3 origin2 = ((Ray)(ref val)).origin; Vector3 position2 = ((Component)val5).transform.position; if (!HasLos(origin2, position2)) { continue; } EntityLocator component = ((Component)val5).GetComponent<EntityLocator>(); if (!Object.op_Implicit((Object)(object)component)) { continue; } PurchaseInteraction component2 = component.entity.GetComponent<PurchaseInteraction>(); if (Object.op_Implicit((Object)(object)component2)) { flag2 = HackingMainState.PurchaseInteractionIsValidTarget(component2); if (flag2) { flag2 = true; val4 = component2; break; } if ((Object)(object)val4 == (Object)null && component2.available) { val4 = component2; } } } if ((Object)(object)val4 != (Object)null) { if (flag2 && userShouldAnticipateTarget) { self.targetIndicator.visualizerPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/RecyclerIndicator"); } else { self.targetIndicator.visualizerPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/RecyclerBadIndicator"); } self.currentTarget = new UserTargetInfo { transformToIndicateAt = ((Component)val4).gameObject.transform, pickupController = null, hurtBox = null, rootObject = ((Component)val4).gameObject }; self.targetIndicator.active = true; self.targetIndicator.targetTransform = self.currentTarget.transformToIndicateAt; } else { self.InvalidateCurrentTarget(); self.targetIndicator.active = false; } } public bool HasLos(Vector3 origin, Vector3 targetPosition) { //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) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_001f: Unknown result type (might be due to invalid IL or missing references) Vector3 val = targetPosition - origin; RaycastHit val2 = default(RaycastHit); return !Physics.Raycast(origin, val, ref val2, ((Vector3)(ref val)).magnitude - 1f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1); } private void FreezeCardf(orig_OnPurchase orig, PayCostContext context, int moneyCost) { } public void FocusedConvergenceChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown FocusConvergenceController.ApplyRadius += new hook_ApplyRadius(FoconNewRadius); FocusConvergenceController.ApplyRate += new Manipulator(FoconApplyRate); FocusConvergenceController.DoUpdate += new Manipulator(FoconUpdate); LanguageAPI.Add("ITEM_FOCUSEDCONVERGENCE_PICKUP", $"Increase the speed Holdout Zones charge... <color=#FF7F7F>BUT reduce the size of the zone</color>. Max of {foconMaxStack}."); LanguageAPI.Add("ITEM_FOCUSEDCONVERGENCE_DESC", "Holdout Zones charge <style=cIsUtility>" + Tools.ConvertDecimal(foconChargeBonus) + " <style=cStack>(+" + Tools.ConvertDecimal(foconChargeBonus) + " per stack)</style> faster</style>, but are <style=cIsHealth>" + Tools.ConvertDecimal(1f - foconRadiusMultiplier) + " smaller</style> <style=cStack>(-" + Tools.ConvertDecimal(1f - foconRadiusMultiplier) + " per stack)</style>. " + $"Max of {foconMaxStack}."); } private void FoconUpdate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "cap") }); val.EmitDelegate<Func<int, int>>((Func<int, int>)((int cap) => foconMaxStack)); } private void FoconNewRadius(orig_ApplyRadius orig, MonoBehaviour self, ref float radius) { FocusConvergenceController val = (FocusConvergenceController)(object)((self is FocusConvergenceController) ? self : null); if (val.currentFocusConvergenceCount > 0) { radius -= foconMinRadius; radius *= Mathf.Pow(foconRadiusMultiplier, (float)val.currentFocusConvergenceCount); radius += foconMinRadius; } } private void FoconApplyRadius(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceRadiusDivisor") }); val.Emit(OpCodes.Ldc_R4, foconMinRadius); val.Emit(OpCodes.Sub); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceRadiusDivisor") }); val.Remove(); val.Emit(OpCodes.Ldc_R4, 2); val.GotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStindR4(x) }); val.Emit(OpCodes.Ldc_R4, foconMinRadius); val.Emit(OpCodes.Add); } private void FoconApplyRate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld<FocusConvergenceController>(x, "convergenceChargeRateBonus") }); val.EmitDelegate<Func<float, float>>((Func<float, float>)((float chargeBonus) => foconChargeBonus)); } public void GestureChanges() { //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: 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_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Expected O, but got Unknown //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Expected O, but got Unknown //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Expected O, but got Unknown LanguageAPI.Add("ITEM_AUTOCASTEQUIPMENT_PICKUP", "Greatly increase equipment stock... " + Language.Styling.HealthColor("BUT greatly increase equipment cooldown.") + " Equipments can be activated during their cooldown, " + Language.Styling.HealthColor("with a chance to break.")); LanguageAPI.Add("ITEM_AUTOCASTEQUIPMENT_DESC", "Hold " + Language.Styling.UtilityColor($"{gestureStockBase} additional equipment charges") + " " + Language.Styling.StackText($"+{gestureStockStack}") + "... " + Language.Styling.HealthColor("BUT increase equipment cooldown by +" + Tools.ConvertDecimal(gestureCdiBase)) + " " + Language.Styling.StackText("+" + Tools.ConvertDecimal(gestureCdiStack)) + ". Using your equipment without charges " + Language.Styling.UtilityColor("under-casts") + " it, allowing it to be used " + Language.Styling.HealthColor($"with a {gestureEquipBreakChance}% chance to break") + ". " + Language.Styling.UtilityColor("Unaffected by luck.")); EquipmentSlot.MyFixedUpdate += new Manipulator(RemoveGestureAutocast); Inventory.CalculateEquipmentCooldownScale += new Manipulator(RemoveGestureCdr); EquipmentSlot.ExecuteIfReady += new Manipulator(AllowGestureUndercast); EquipmentSlot.OnEquipmentExecuted += new hook_OnEquipmentExecuted(AddGestureUndercast); Inventory.CalculateEquipmentCooldownScale += new hook_CalculateEquipmentCooldownScale(AddGestureCdi); Inventory.GetEquipmentSlotMaxCharges += new hook_GetEquipmentSlotMaxCharges(AddGestureStock); EquipmentSlot.MyFixedUpdate += new hook_MyFixedUpdate(AddGestureBreak); Inventory.UpdateEquipment += new Manipulator(FixMaxStock); } private void AllowGestureUndercast(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EquipmentSlot>(x, "get_stock") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<int, EquipmentSlot, int>>((Func<int, EquipmentSlot, int>)delegate(int stock, EquipmentSlot slot) { if (stock > 0) { return stock; } return (slot.inventory.GetItemCountEffective(Items.AutoCastEquipment) > 0) ? 1 : 0; }); } private void FixMaxStock(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "EquipmentMagazine"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); int num = default(int); val.GotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num) }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<int, Inventory, int>>((Func<int, Inventory, int>)delegate(int stock, Inventory inv) { stock += GetGestureStockFromInventory(inv); return stock; }); } private int AddGestureStock(orig_GetEquipmentSlotMaxCharges orig, Inventory self) { int num = orig.Invoke(self); return num + GetGestureStockFromInventory(self); } public static int GetGestureStockFromInventory(Inventory inv) { int itemCountEffective = inv.GetItemCountEffective(Items.AutoCastEquipment); if (itemCountEffective > 0) { return 4 + 2 * (itemCountEffective - 1); } return 0; } private float AddGestureCdi(orig_CalculateEquipmentCooldownScale orig, Inventory self) { float num = orig.Invoke(self); int itemCountEffective = self.GetItemCountEffective(Items.AutoCastEquipment); if (itemCountEffective > 0) { num *= 1f + gestureCdiBase + gestureCdiStack * (float)(itemCountEffective - 1); } return num; } private void RemoveGestureCdr(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "AutoCastEquipment"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4, 0); } private void AddGestureUndercast(orig_OnEquipmentExecuted orig, EquipmentSlot self) { bool flag = false; if (NetworkServer.active && self.stock <= 0 && self.inventory.GetItemCountEffective(Items.AutoCastEquipment) > 0) { self.inventory.RestockEquipmentCharges(self.activeEquipmentSlot, 1); flag = true; } orig.Invoke(self); if (NetworkServer.active && flag) { self.characterBody.AddBuff(CommonAssets.gestureQueueEquipBreak); if (self.subcooldownTimer <= 0f) { TryGestureEquipmentBreak(self); } } } private void AddGestureBreak(orig_MyFixedUpdate orig, EquipmentSlot self, float deltaTime) { orig.Invoke(self, deltaTime); if (NetworkServer.active && self.subcooldownTimer <= 0f) { TryGestureEquipmentBreak(self); } } private void AddPreonAccumulatorBreak(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f), (Instruction x) => ILPatternMatchingExt.MatchStfld<EquipmentSlot>(x, "bfgChargeTimer") }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<EquipmentSlot>>((Action<EquipmentSlot>)delegate(EquipmentSlot self) { TryGestureEquipmentBreak(self); }); } public static void TryGestureEquipmentBreak(EquipmentSlot self) { if (NetworkServer.active && self.characterBody.HasBuff(CommonAssets.gestureQueueEquipBreak)) { if (Util.CheckRoll(gestureEquipBreakChance, 0f, (CharacterMaster)null)) { self.inventory.SetEquipmentIndex((EquipmentIndex)(-1)); } self.characterBody.RemoveBuff(CommonAssets.gestureQueueEquipBreak); } } private void RemoveGestureAutocast(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "AutoCastEquipment"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4, 0); } public void HappiestMaskRework() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(MaskExecution); GlobalEventManager.onServerCharacterExecuted += HappiestMaskGhostSpawn; GlobalEventManager.OnCharacterDeath += new Manipulator(RevokeHappiestMaskRights); CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddMaskBehavior); LanguageAPI.Add("ITEM_GHOSTONKILL_PICKUP", "Haunt nearby enemies, marking them for execution. Executing enemies summons a ghost."); LanguageAPI.Add("ITEM_GHOSTONKILL_DESC", $"Once every <style=cIsDamage>{HappiestMaskBehavior.baseHauntInterval}</style> seconds, " + "<style=cIsDamage>Haunt</style> a nearby non-boss enemy, marking them for Execution below <style=cIsHealth>" + Tools.ConvertDecimal(hauntExecutionThreshold) + "</style> health. Execution <style=cIsDamage>spawns a ghost</style> of the killed enemy with <style=cIsDamage>1500%</style> damage, " + $"lasting for <style=cIsDamage>{ghostDurationPerStack}s</style> <style=cStack>(+{ghostDurationPerStack}s per stack)</style> " + Language.Styling.UtilityColor("(double for Haunted enemies)") + "."); LanguageAPI.Add("ITEM_GHOSTONKILL_LORE", "<style=cMono>\r\n//--AUTO-TRANSCRIPTION FROM RALLYPOINT DELTA --//</style>\r\n\r\n“Sir, the ghosts are back.”\r\n\r\nThe man sighed. After a routine expedition, one of the crew members – a simple soldier - had recovered an artifact thought to have been aboard the Contact Light – a simple mask, adorned with a painfully happy grin. \r\n\r\n“I’ll take care of it.” The man trudged down the hall towards the barracks. The Lemurians he had killed earlier that day walked down the hall by him, barely earning a second glance from the man. This had become so commonplace that most of the crew members in this block had grown accustomed to having a ghostly room-mate.\r\n\r\nBut enough was enough. Stepping through the ghost of an Imp, the man slammed the door open. The lights were off, and in the corner sat the soldier.\r\n\r\n“Alright, we’ve had enough fun playing with the dead. Fork it over.”\r\n\r\nNo response. The man grunted and hoisted the soldier to his feet, giving him a few rough shakes. “Hey, can you hear me!? I said hand over the mask! I’m tired of waking up next to Beetles, so give it a rest already--”\r\n\r\nThe soldier’s limp body moved. Slowly, the soldier raised his finger – pointing directly at the man.\r\n\r\n“What are you...?” With a sense of dread, the man turned and saw the Lemurians he had killed earlier step into the room. Their mouths began to glow with an otherworldly light.\r\n\r\nThe man cursed under his breath as he loaded his shotgun. “This planet, I tell you...”"); } private void MaskExecution(CharacterBody sender, MoreStatHookEventArgs args) { bool flag = sender.HasBuff(CommonAssets.hauntDebuff); args.ModifyBaseExecutionThreshold(hauntExecutionThreshold, flag); } private void AddMaskBehavior(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); int itemCountEffective = self.inventory.GetItemCountEffective(Items.GhostOnKill); self.AddItemBehavior<HappiestMaskBehavior>(itemCountEffective); } private void HappiestMaskGhostSpawn(DamageReport damageReport, float executionHealthLost) { CharacterBody victimBody = damageReport.victimBody; CharacterBody attackerBody = damageReport.attackerBody; if (!Object.op_Implicit((Object)(object)victimBody) || !Object.op_Implicit((Object)(object)attackerBody)) { return; } Inventory inventory = attackerBody.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } int num = inventory.GetItemCountEffective(Items.GhostOnKill); if (num > 0 && Object.op_Implicit((Object)(object)victimBody) && Util.CheckRoll(ghostSpawnChanceOnExecute, attackerBody.master)) { if (victimBody.HasBuff(CommonAssets.hauntDebuff)) { num *= 2; } Util.TryToCreateGhost(victimBody, attackerBody, Mathf.CeilToInt((float)num * ghostDurationPerStack)); } } private void RevokeHappiestMaskRights(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "GhostOnKill"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); val.Emit(OpCodes.Ldc_I4, 0); val.Emit(OpCodes.Mul); } public void HuntersHarpoonRework() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown CharacterBody.RecalculateStats += new Manipulator(ChangeMoveSpeed); GlobalEventManager.OnCharacterDeath += new Manipulator(ChangeDuration); LanguageAPI.Add("ITEM_MOVESPEEDONKILL_DESC", "Killing an enemy increases <style=cIsUtility>movement speed</style> by <style=cIsUtility>125%</style> for <style=cIsUtility>1</style> <style=cStack>(+1 per stack)</style> seconds. Consecutive kills increase buff duration to up to 25 seconds."); } public static void ChangeMoveSpeed(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); float num = default(float); if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Buffs", "KillMoveSpeed"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount") })) { Log.DebugBreakpoint("ChangeMoveSpeed"); return; } val.Next.Operand = 1.25f; val.Index += 4; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int buffCount) => (buffCount > 0) ? 1 : 0)); } private void ChangeDuration(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int attackerBodyLoc = 16; int itemCountLoc = 54; int buffCountLoc = 86; int iteratorLoc = 91; ILLabel val2 = val.DefineLabel(); ILLabel val3 = val.DefineLabel(); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "MoveSpeedOnKill"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref itemCountLoc) })) { Log.DebugBreakpoint("ChangeDuration", 1); return; } if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 5), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref buffCountLoc) })) { Log.DebugBreakpoint("ChangeDuration", 2); return; } int index = val.Index; val.Index = index + 1; val2 = val.MarkLabel(); if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref attackerBodyLoc), (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Buffs", "KillMoveSpeed"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "ClearTimedBuffs") })) { Log.DebugBreakpoint("ChangeDuration", 3); return; } if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "AddTimedBuff") })) { Log.DebugBreakpoint("ChangeDuration", 4); return; } val3 = val.MarkLabel(); if (!val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref iteratorLoc), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, buffCountLoc) })) { Log.DebugBreakpoint("ChangeDuration", 5); return; } val.GotoLabel(val3, (MoveType)1, false); val.Emit(OpCodes.Ldloc, iteratorLoc); val.EmitDelegate<Func<float, int, float>>((Func<float, int, float>)((float baseBuffDuration, int iterator) => iterator + 1)); val.GotoLabel(val2, (MoveType)1, false); val.Emit(OpCodes.Ldloc, itemCountLoc); val.Emit(OpCodes.Ldloc, attackerBodyLoc); val.EmitDelegate<Func<int, int, CharacterBody, int>>((Func<int, int, CharacterBody, int>)delegate(int vanillaBuffCount, int itemCount, CharacterBody attackerBody) { if (itemCount > 25) { return itemCount; } int buffCount = attackerBody.GetBuffCount(Buffs.KillMoveSpeed); return Mathf.Min(25, buffCount + itemCount); }); } public void ReworkLaserScope() { //IL_0006: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/DLC1/CritDamage/CritDamage.asset").WaitForCompletion(); RetierItemAsync(RoR2_DLC1_CritDamage.CritDamage_asset, (ItemTier)1, FixIcon); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(ScopeCritChance); CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddScopeItemBehavior); LanguageAPI.Add("ITEM_CRITDAMAGE_NAME", "Combat Telescope"); LanguageAPI.Add("ITEM_CRITDAMAGE_PICKUP", "Increases 'Critical Strike' chance and damage while stationary."); LanguageAPI.Add("ITEM_CRITDAMAGE_DESC", "<style=cIsDamage>Critical Strikes</style> deal an additional <style=cIsDamage>100% damage</style> <style=cStack>(+100% per stack)</style>. " + $"Gain <style=cIsDamage>{scopeBaseCrit}% critical chance</style>, " + $"or <style=cIsDamage>{scopeBaseStationaryCrit}%</style> after standing still " + $"for <style=cIsUtility>{CombatTelescopeBehavior.combatTelescopeWaitTime}</style> seconds."); static void FixIcon(ItemDef itemDef) { Sprite val2 = retierAssetBundle.LoadAsset<Sprite>("Assets/Icons/Laser_Scope.png"); if (Object.op_Implicit((Object)(object)val2)) { itemDef.pickupIconSprite = val2; } } } private void AddScopeItemBehavior(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); self.AddItemBehavior<CombatTelescopeBehavior>(self.inventory.GetItemCountEffective(Items.CritDamage)); } private void ScopeCritChance(CharacterBody sender, StatHookEventArgs args) { if (!Object.op_Implicit((Object)(object)sender.inventory)) { return; } int itemCountEffective = sender.inventory.GetItemCountEffective(Items.CritDamage); if (itemCountEffective > 0) { int num = scopeBaseCrit; int buffCount = sender.GetBuffCount(CommonAssets.combatTelescopeCritChance); if (buffCount > 0) { num = scopeBaseStationaryCrit; } args.critAdd += (float)num; } } private void RevokeScopeRights(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC1Content/Items", "CritDamage"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); val.Emit(OpCodes.Ldc_I4, 0); val.Emit(OpCodes.Mul); } public void ReworkLeechingSeed() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown RetierItemAsync(RoR2_Base_Seed.Seed_asset, (ItemTier)0, FixIcon); GlobalEventManager.ProcessHitEnemy += new Manipulator(FuckLeechingSeed); static void FixIcon(ItemDef itemDef) { Sprite val = retierAssetBundle.LoadAsset<Sprite>("Assets/Icons/Leeching_Seed.png"); if (Object.op_Implicit((Object)(object)val)) { itemDef.pickupIconSprite = val; } } } private void NewSeedBehavior(CharacterBody body, DamageInfo damageInfo, CharacterBody victimBody) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)6)) { return; } Inventory inventory = body.inventory; if ((Object)(object)inventory != (Object)null) { int itemCountEffective = inventory.GetItemCountEffective(seedItemDef); if (itemCountEffective > 0) { ProcChainMask procChainMask = damageInfo.procChainMask; ((ProcChainMask)(ref procChainMask)).AddProc((ProcType)6); body.AddTimedBuff(Buffs.MeatRegenBoost, (seedRegenDurationBase + seedRegenDurationStack * (float)(itemCountEffective - 1)) * damageInfo.procCoefficient); } } } private void FuckLeechingSeed(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0065: 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>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 6), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.ProcChainMask", "HasProc") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<bool, DamageInfo, bool>>((Func<bool, DamageInfo, bool>)((bool cantProc, DamageInfo damageInfo) => cantProc || (!((DamageTypeCombo)(ref damageInfo.damageType)).IsDamageSourceSkillBased && (int)damageInfo.damageType.damageSource != 64))); } } public void ReworkFreshMeat() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown ChangeBuffStacking("MeatRegenBoost", canStack: true); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(LetMeatActuallyStack); GlobalEventManager.OnCharacterDeath += new hook_OnCharacterDeath(MeatRegen); LanguageAPI.Add("ITEM_FLATHEALTH_PICKUP", "Regenerate health after killing an enemy."); LanguageAPI.Add("ITEM_FLATHEALTH_DESC", "Increases <style=cIsHealing>base health regeneration</style> by <style=cIsHealing>+2 hp/s</style> for <style=cIsUtility>3s</style> <style=cStack>(+3s per stack)</style> after killing an enemy."); } private void MeatRegen(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) CharacterBody attackerBody = damageReport.attackerBody; if ((Object)(object)attackerBody != (Object)null && (Object)(object)attackerBody.inventory != (Object)null) { Inventory inventory = attackerBody.inventory; int itemCountEffective = inventory.GetItemCountEffective(Items.FlatHealth); if (itemCountEffective > 0) { attackerBody.AddTimedBuffAuthority(Buffs.MeatRegenBoost.buffIndex, (float)(3 * itemCountEffective)); } } orig.Invoke(self, damageReport); } private void LetMeatActuallyStack(CharacterBody sender, StatHookEventArgs args) { int buffCount = sender.GetBuffCount(Buffs.MeatRegenBoost); if (buffCount > 1) { args.baseRegenAdd += 2f * (1f + 0.2f * (sender.level - 1f)) * (float)(buffCount - 1); } Inventory inventory = sender.inventory; if ((Object)(object)inventory != (Object)null) { args.baseHealthAdd -= (float)(inventory.GetItemCountEffective(Items.FlatHealth) * 25); } } private void PlanulaChanges() { //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown LanguageAPI.Add("ITEM_PARENTEGG_PICKUP", "The unmatched power of the sun!"); LanguageAPI.Add("ITEM_PARENTEGG_DESC", "After beginning the teleporter event, " + Language.Styling.DamageColor("summon a sun overhead") + " that lasts for " + Language.Styling.DamageColor(sunDurationBase.ToString()) + " seconds " + Language.Styling.StackText($"+{sunDurationStack}") + ". " + Language.Styling.HealthColor("All enemies and allies burn near the sun") + "."); HealthComponent.TakeDamageProcess += new Manipulator(FuckPlanula); IdleToChargingState.OnEnter += new hook_OnEnter(OnTeleporterEventPreStart); ChargingState.OnEnter += new hook_OnEnter(OnTeleporterEventStart); ChargingState.FixedUpdate += new hook_FixedUpdate(OnTeleporterEventUpdate); } private void FuckPlanula(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "RoR2.HealthComponent/ItemCounts", "parentEgg") }); val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldc_I4_0); } private void OnTeleporterEventPreStart(orig_OnEnter orig, IdleToChargingState self) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!NetworkServer.active) { return; } int itemCountForTeam = Util.GetItemCountForTeam((TeamIndex)1, Items.ParentEgg.itemIndex, false, false); if (itemCountForTeam <= 0) { return; } TeleporterInteraction teleporterInteraction = ((BaseTeleporterState)self).teleporterInteraction; GameObject chargeActivatorServer = teleporterInteraction.chargeActivatorServer; PlanulaSunController planulaSunController = ((Component)teleporterInteraction).gameObject.AddComponent<PlanulaSunController>(); Debug.Log((object)((Object)(object)planulaSunController != (Object)null)); if ((Object)(object)planulaSunController != (Object)null) { planulaSunController.holdoutZoneController = teleporterInteraction.holdoutZoneController; Transform val = ((EntityState)self).transform.Find("FireworkOrigin"); if ((Object)(object)val == (Object)null) { val = ((Component)teleporterInteraction).transform; } planulaSunController.activator = chargeActivatorServer; planulaSunController.CreateBeamEffect(val); planulaSunController.SetSunDuration(itemCountForTeam); } } private void OnTeleporterEventStart(orig_OnEnter orig, ChargingState self) { orig.Invoke(self); if (NetworkServer.active) { PlanulaSunController component = ((EntityState)self).gameObject.GetComponent<PlanulaSunController>(); if ((Object)(object)component != (Object)null) { component.EndBeamEffect(); component.CreateSun(); } } } private void OnTeleporterEventUpdate(orig_FixedUpdate orig, ChargingState self) { orig.Invoke(self); if (NetworkServer.active) { } } public void PrayerBeadsRework() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Expected O, but got Unknown //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown RetierItemAsync(RoR2_DLC2_Items_ExtraStatsOnLevelUp.ExtraStatsOnLevelUp_asset, (ItemTier)1, ChangeTags); CharacterMaster.OnBodyStart += new hook_OnBodyStart(InitializeBeadBuff); object obj = <>c.<>9__111_1; if (obj == null) { hook_TrackBeadExperience val = delegate { }; <>c.<>9__111_1 = val; obj = (object)val; } CharacterMaster.TrackBeadExperience += (hook_TrackBeadExperience)obj; CharacterBody.RecalculateStats += new Manipulator(ChangeBeadAppliedStats); ExperienceManager.AwardExperience += new hook_AwardExperience(BeadExperience); StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(BeadScrapCount); LanguageAPI.Add("ITEM_EXTRASTATSONLEVELUP_PICKUP", "Prioritized when used with <style=cIsHealing>Uncommon</style> 3D Printers. Permanently increase ALL stats after removal."); LanguageAPI.Add("ITEM_EXTRASTATSONLEVELUP_DESC", "Prioritized when used with <style=cIsHealing>Uncommon</style> 3D Printers. After removal, permanently grants a " + Language.Styling.ConvertDecimal(beadsPermanentStatBonus) + " increase to <style=cIsUtility>experience gain</style>, <style=cIsHealing>health</style>, <style=cIsHealing>shield</style>, <style=cIsHealing>regeneration</style>, and <style=cIsDamage>damage</style>."); static void ChangeTags(ItemDef itemDef) { ItemTag[] array = new ItemTag[6]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); itemDef.tags = (ItemTag[])(object)array; } } private void BeadScrapCount(CharacterBody sender, MoreStatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { args.scrapGreenCountAdd += sender.inventory.GetItemCountEffective(Items.ExtraStatsOnLevelUp); } } private void BeadExperience(orig_AwardExperience orig, ExperienceManager self, Vector3 origin, CharacterBody body, ulong amount) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body.master != (Object)null && (Object)(object)body.inventory != (Object)null) { float num = 1f + body.inventory.beadAppliedHealth * beadsPermanentStatBonus; amount += (ulong)((float)amount * num); } orig.Invoke(self, origin, body, amount); } private void InitializeBeadBuff(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, body); Inventory inventory = body.inventory; if (!((Object)(object)inventory == (Object)null) && !(inventory.beadAppliedHealth <= 0f)) { body.SetBuffCount(Buffs.ExtraStatsOnLevelUpBuff.buffIndex, (int)inventory.beadAppliedHealth); } } private void ChangeBeadAppliedStats(ILContext il) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) ILCursor c = new ILCursor(il); int itemCountLoc = 69; ILLabel label = null; if (!c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC2Content/Items", "ExtraStatsOnLevelUp"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountPermanent"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref itemCountLoc) })) { Log.DebugBreakpoint("ChangeBeadAppliedStats", 1); return; } if (!c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, itemCountLoc), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "extraStatsOnLevelUpCount_CachedLastApplied"), (Instruction x) => ILPatternMatchingExt.MatchBge(x, ref label) })) { Log.DebugBreakpoint("ChangeBeadAppliedStats", 2); return; } c.Emit(OpCodes.Ldloc, itemCountLoc); c.Emit(OpCodes.Ldarg_0); c.EmitDelegate<Action<int, CharacterBody>>((Action<int, CharacterBody>)delegate(int itemCount, CharacterBody self) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) int num6 = self.extraStatsOnLevelUpCount_CachedLastApplied - itemCount; self.extraStatsOnLevelUpCount_CachedLastApplied = itemCount; Inventory inventory = self.inventory; inventory.beadAppliedHealth += (float)num6; Inventory inventory2 = self.inventory; inventory2.beadAppliedShield += (float)num6; Inventory inventory3 = self.inventory; inventory3.beadAppliedRegen += (float)num6; Inventory inventory4 = self.inventory; inventory4.beadAppliedDamage += (float)num6; self.SetBuffCount(Buffs.ExtraStatsOnLevelUpBuff.buffIndex, (int)self.inventory.beadAppliedHealth); }); if (!c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC2Content/Buffs", "ExtraStatsOnLevelUpBuff"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount") })) { Log.DebugBreakpoint("ChangeBeadAppliedStats", 3); return; } c.EmitDelegate<Func<int, int>>((Func<int, int>)((int buffCount) => 0)); c.GotoLabel(label, (MoveType)1, false); ChangeBeadStat("beadAppliedHealth", ChangeBeadHealthBonus); ChangeBeadStat("beadAppliedShield", ChangeBeadShieldBonus); ChangeBeadStat("beadAppliedRegen", ChangeBeadRegenBonus); ChangeBeadStat("beadAppliedDamage", ChangeBeadDamageBonus); static float ChangeBeadDamageBonus(float beadBonusStacks, CharacterBody self, float level) { float num = self.baseDamage + self.levelDamage * level; return num * beadsPermanentStatBonus * beadBonusStacks; } static float ChangeBeadHealthBonus(float beadBonusStacks, CharacterBody self, float level) { float num5 = self.baseMaxHealth + self.levelMaxHealth * level; return num5 * beadsPermanentStatBonus * beadBonusStacks; } static float ChangeBeadRegenBonus(float beadBonusStacks, CharacterBody self, float level) { float num2 = Mathf.Abs(self.baseRegen + self.levelRegen * level); return num2 * beadsPermanentStatBonus * beadBonusStacks; } static float ChangeBeadShieldBonus(float beadBonusStacks, CharacterBody self, float level) { float num3 = self.baseMaxHealth + self.levelMaxHealth * level; return num3 * beadsPermanentStatBonus * beadBonusStacks; } void ChangeBeadStat(string beadStatName, Func<float, CharacterBody, float, float> callback) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) float num4 = default(float); ILLabel val = default(ILLabel); if (!c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<Inventory>(x, beadStatName), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num4), (Instruction x) => ILPatternMatchingExt.MatchBleUn(x, ref val) }) || !c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<Inventory>(x, beadStatName) })) { Log.DebugBreakpoint("ChangeBeadStat:" + beadStatName, 3); } else { c.Emit(OpCodes.Ldarg_0); c.EmitDelegate<Func<float, CharacterBody, float>>((Func<float, CharacterBody, float>)delegate(float beadBonus, CharacterBody self) { float arg = self.level - 1f; return callback(beadBonus, self, arg); }); } } } public void RazorwireRework() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RazorwireArmor); CharacterBody.OnInventoryChanged += new hook_OnInventoryChanged(AddRazorBehavior); HealthComponent.TakeDamageProcess += new Manipulator(RazorwireBegin); LightningOrb.OnArrival += new Manipulator(RazorwireArrival); LanguageAPI.Add("ITEM_THORNS_PICKUP", "Retaliate in a burst of bleeding razors on taking damage. Recharges over time."); LanguageAPI.Add("ITEM_THORNS_DESC", $"Increase <style=cIsHealing>armor</style> by <style=cIsHealing>{razorwireArmorBase}</style> <style=cStack>(+{razorwireArmorStack} per stack)</stack>" + "Getting hit causes you to explode in a burst of razors, " + $"<style=cIsDamage>bleeding</style> up to <style=cIsDamage>{razorwireTargetsBase}</style> " + $"<style=cStack>(+{razorwireTargetsStack} per stack)</style> nearby enemies " + "for <style=cIsDamage>" + Tools.ConvertDecimal(razorwireBleedDuration * 0.8f) + "</style> base damage per <style=cIsDamage>razor charge</style> expelled. " + $"You can hold up to {RazorwireBehavior.baseRazors} <style=cStack>(+{RazorwireBehavior.stackRazors} per stack)</style> " + $"razor charges, all reloading over <style=cIsUtility>{RazorwireBehavior.rechargeTime}</style> seconds."); } private void RazorwireArmor(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { int itemCountEffective = sender.inventory.GetItemCountEffective(Items.Thorns); if (itemCountEffective > 0) { args.armorAdd += razorwireArmorBase + razorwireArmorStack * (float)(itemCountEffective - 1); } } } private void AddRazorBehavior(orig_OnInventoryChanged orig, CharacterBody self) { orig.Invoke(self); int itemCountEffective = self.inventory.GetItemCountEffective(Items.Thorns); self.AddItemBehavior<RazorwireBehavior>(itemCountEffective); } private void RazorwireArrival(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int healthComponentLoc = 0; val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref healthComponentLoc) }); val.GotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, healthComponentLoc) }); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<HealthComponent, LightningOrb, HealthComponent>>((Func<HealthComponent, LightningOrb, HealthComponent>)delegate(HealthComponent hc, LightningOrb orb) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)orb.lightningType == 6 && (Object)(object)hc != (Object)null) { for (int i = 0; (float)i < orb.procCoefficient; i++) { DotController.InflictDot(((Component)hc).gameObject, orb.attacker, hc.body.mainHurtBox, (DotIndex)0, razorwireBleedDuration, orb.damageValue, (uint?)null); } return null; } return hc; }); } private void RazorwireBegin(ILContext il) { //IL_0008: Unknown result type (might
NewMoon.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.AI.Walker; using EntityStates.Missions.BrotherEncounter; using EntityStates.MoonElevator; using HG; using IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using NewMoon.Artifacts; using NewMoon.Components; using NewMoon.Items; using NewMoon.Modules; using On.EntityStates.Missions.BrotherEncounter; using On.RoR2; using R2API; using R2API.Utils; using RainrotSharedUtils.Shelters; using RoR2; using RoR2.Achievements; using RoR2.Audio; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.EntitlementManagement; using RoR2.ExpansionManagement; using RoR2.Navigation; using RoR2.Projectile; using RoR2.Skills; using RoR2BepInExPack.GameAssetPaths; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.ResourceManagement.AsyncOperations; [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 = "")] [assembly: AssemblyCompany("NewMoon")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NewMoon")] [assembly: AssemblyTitle("NewMoon")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace NewMoon { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.NewMoon", "NewMoon", "2.0.0")] public class NewMoonPlugin : BaseUnityPlugin { public static float pillarDropOffset = 2.5f; public static float pillarDropForce = 20f; public static int baseRewardCount = 1; public static bool scaleRewardsByPlayerCount = true; public static SpawnCard exploderCard = Resources.Load<SpawnCard>("spawncards/characterspawncards/cscLunarExploder"); private List<DirectorCard> exploderCards = new List<DirectorCard>(); public static ExploderDirector exploderDirector; internal static float phaseTwoRate = 0f; internal static float phaseThreeRate = 1f; public const string guid = "com.RiskOfBrainrot.NewMoon"; public const string teamName = "RiskOfBrainrot"; public const string modName = "NewMoon"; public const string version = "2.0.0"; public static NewMoonPlugin instance; public static ItemTierDef lunarRelicTierDef; public static bool DoPillarItemDrop = false; public static AssetBundle mainAssetBundle => CommonAssets.mainAssetBundle; internal static event Action onLoaded; private void MakePillarsFun() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) MoonBatteryMissionController.Awake += new hook_Awake(ReduceRequiredPillars); AsyncOperationHandle<GameObject> val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatteryBlood_prefab); val.Completed += delegate(AsyncOperationHandle<GameObject> ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Blood); }; val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatteryDesign_prefab); val.Completed += delegate(AsyncOperationHandle<GameObject> ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Design); }; val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatteryMass_prefab); val.Completed += delegate(AsyncOperationHandle<GameObject> ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Mass); }; val = Addressables.LoadAssetAsync<GameObject>((object)RoR2_Base_moon2.MoonBatterySoul_prefab); val.Completed += delegate(AsyncOperationHandle<GameObject> ctx) { AddPillarItemDrop(ctx.Result, PillarItemDropper.PillarType.Soul); }; static void AddPillarItemDrop(GameObject pillarPrefab, PillarItemDropper.PillarType pillarType) { PillarItemDropper pillarItemDropper = pillarPrefab.AddComponent<PillarItemDropper>(); pillarItemDropper.pillarType = pillarType; } } private void ReduceRequiredPillars(orig_Awake orig, MoonBatteryMissionController self) { orig.Invoke(self); self._numRequiredBatteries = 2; GameObject[] moonBatteries = self.moonBatteries; foreach (GameObject val in moonBatteries) { PillarItemDropper pillarItemDropper = val.GetComponent<PillarItemDropper>(); if (!Object.op_Implicit((Object)(object)pillarItemDropper)) { pillarItemDropper = val.AddComponent<PillarItemDropper>(); PillarItemDropper.PillarType pillarType = PillarItemDropper.PillarType.None; string name = ((Object)val).name; switch (name.Substring(11, 4)) { case "Mass": pillarType = PillarItemDropper.PillarType.Mass; break; case "Desi": pillarType = PillarItemDropper.PillarType.Design; break; case "Bloo": pillarType = PillarItemDropper.PillarType.Blood; break; case "Soul": pillarType = PillarItemDropper.PillarType.Soul; break; } pillarItemDropper.pillarType = pillarType; } pillarItemDropper.shouldDropItem = true; } } private void PillarsDropItems(orig_OnBatteryCharged orig, MoonBatteryMissionController self, HoldoutZoneController holdoutZone) { //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown int participatingPlayerCount = Run.instance.participatingPlayerCount; if (participatingPlayerCount != 0) { DropPillarItemFromHoldout(holdoutZone, participatingPlayerCount); } self.Network_numChargedBatteries = self._numChargedBatteries + 1; if (self._numChargedBatteries < self._numRequiredBatteries || !NetworkServer.active) { return; } for (int i = 0; i < self.batteryHoldoutZones.Length; i++) { if (((Behaviour)self.batteryHoldoutZones[i]).enabled) { self.batteryHoldoutZones[i].FullyChargeHoldoutZone(); ((UnityEvent<HoldoutZoneController>)(object)self.batteryHoldoutZones[i].onCharged).RemoveListener((UnityAction<HoldoutZoneController>)self.OnBatteryCharged); } } for (int j = 0; j < self.elevatorStateMachines.Length; j++) { self.elevatorStateMachines[j].SetNextState((EntityState)new InactiveToReady()); } } public static void DropPillarItemFromHoldout(HoldoutZoneController holdoutZone) { Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "3"); DropPillarItemFromHoldout(holdoutZone, Object.op_Implicit((Object)(object)Run.instance) ? Run.instance.participatingPlayerCount : 0); } public static void DropPillarItemFromHoldout(HoldoutZoneController holdoutZone, int participatingPlayerCount) { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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) Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "4"); if (participatingPlayerCount == 0) { return; } Vector3 val = ((Component)holdoutZone).gameObject.transform.position + Vector3.up * pillarDropOffset; PickupIndex pickupIndexFromPillarType = GetPickupIndexFromPillarType(((Component)holdoutZone).gameObject); if (pickupIndexFromPillarType != PickupIndex.none) { Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "5"); int num = baseRewardCount; if (scaleRewardsByPlayerCount) { num *= participatingPlayerCount; } float num2 = 360f / (float)num; Vector3 val2 = Quaternion.AngleAxis((float)Random.Range(0, 360), Vector3.up) * (Vector3.up * pillarDropForce + Vector3.forward * 5f); Quaternion val3 = Quaternion.AngleAxis(num2, Vector3.up); int num3 = 0; while (num3 < num) { Log.Warning(((Object)((Component)holdoutZone).gameObject).name + "6"); PickupDropletController.CreatePickupDroplet(new UniquePickup(pickupIndexFromPillarType), val, val2, false); num3++; val2 = val3 * val2; } } } public static PickupIndex GetPickupIndexFromPillarType(GameObject pillar) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008c: 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_00a9: Unknown result type (might be due to invalid IL or missing references) ItemBase itemBase = null; string name = ((Object)pillar).name; switch (name.Substring(11, 4)) { case "Mass": itemBase = ItemBase<MassAnomaly>.instance; break; case "Desi": itemBase = ItemBase<DesignAnomaly>.instance; break; case "Bloo": itemBase = ItemBase<BloodAnomaly>.instance; break; case "Soul": itemBase = ItemBase<SoulAnomaly>.instance; break; } if (itemBase != null) { ItemIndex itemIndex = itemBase.ItemsDef.itemIndex; return PickupCatalog.FindPickupIndex(itemIndex); } Debug.Log((object)"No pickup index found!"); return PickupIndex.none; } public void LunarExplodersDuringBrother() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown Phase1.OnEnter += new hook_OnEnter(InitializeExploderDirector); Phase2.OnEnter += new hook_OnEnter(DisableExploderDirector); Phase3.OnEnter += new hook_OnEnter(RestoreExploderDirector); Phase4.OnEnter += new hook_OnEnter(KillExploderDirector); } private void GetExploderCard(List<DirectorCardHolder> cardList, StageInfo currentStage) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 Debug.Log((object)"jsd fjsn"); if ((int)currentStage.stage != 65536) { return; } List<DirectorCardHolder> list = new List<DirectorCardHolder>(); foreach (DirectorCardHolder card2 in cardList) { if ((int)card2.MonsterCategory == 2) { DirectorCard card = card2.Card; SpawnCard spawnCard = card.spawnCard; GameObject prefab = spawnCard.prefab; if (((Object)spawnCard).name == "cscLunarExploder") { exploderCards.Add(card); } } } foreach (DirectorCardHolder item in list) { cardList.Remove(item); } } private void InitializeExploderDirector(orig_OnEnter orig, Phase1 self) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if ((Object)(object)exploderDirector == (Object)null) { GameObject val = new GameObject("CommencementPerfected_ChimeraExploderDirector_OrTheCPCEDForShort"); val.transform.position = new Vector3(-88f, 491.1f, 0f); exploderDirector = val.AddComponent<ExploderDirector>(); exploderDirector.baseState = (BrotherEncounterBaseState)(object)self; } } private void DisableExploderDirector(orig_OnEnter orig, Phase2 self) { orig.Invoke(self); exploderDirector.SetDirectorRate(phaseTwoRate); } private void RestoreExploderDirector(orig_OnEnter orig, Phase3 self) { orig.Invoke(self); exploderDirector.SetDirectorRate(phaseThreeRate); } private void KillExploderDirector(orig_OnEnter orig, Phase4 self) { orig.Invoke(self); Object.Destroy((Object)(object)((Component)exploderDirector).gameObject); } private void Awake() { instance = this; Config.Init(); Log.Init(((BaseUnityPlugin)this).Logger); Language.Init(); Hooks.Init(); CommonAssets.Init(); EliteModule.Init(); DoPillarItemDrop = GetConfigBool(defaultValue: true, "Global : Endgame Items", "Setting to TRUE will enable the Moon Relic items, which drop from pillars, and all features that rely on these items."); if (DoPillarItemDrop) { MakePillarsFun(); } if (GetConfigBool(defaultValue: true, "Global : Mithrix : Lunar Exploders Spawn On Ramps", "Setting to TRUE will cause Lunar Exploders to spawn on arena ramps during the fight.")) { LunarExplodersDuringBrother(); } InitializeContent(); NewMoonPlugin.onLoaded(); Config.Save(); new ContentPacks().Initialize(); } private void InitializeContent() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); BeginInitializing<ItemBase>(types, "NewMoonItems.txt"); BeginInitializing<ArtifactBase>(types, "NewMoonArtifacts.txt"); } private void BeginInitializing<T>(Type[] allTypes, string fileName = "") where T : SharedBase { Type baseType = typeof(T); if (!baseType.IsAbstract) { Log.Error(Log.Combine() + "Incorrect BaseType: " + baseType.Name); return; } IEnumerable<Type> source = allTypes.Where((Type type) => !type.IsAbstract && type.IsSubclassOf(baseType)); if (source.Count() <= 0) { return; } IEnumerable<SharedBase> enumerable = from objType in source select (T)Activator.CreateInstance(objType) into sharedBase orderby sharedBase.loadOrder select sharedBase; Log.Debug(Log.Combine(baseType.Name) + "Initializing"); foreach (SharedBase item in enumerable) { string text = Log.Combine(baseType.Name, item.ConfigName); if (ValidateBaseType(item)) { Log.Debug(text + "Validated"); InitializeBaseType(item); Log.Debug(text + "Initialized"); } } if (!string.IsNullOrEmpty(fileName)) { Language.TryPrintOutput(fileName); } } private bool ValidateBaseType(SharedBase obj) { bool isEnabled = obj.isEnabled; if (obj.forcePrerequisites) { return isEnabled && obj.GetPrerequisites(); } return obj.Bind(isEnabled, "Should This Content Be Enabled") && obj.GetPrerequisites(); } private void InitializeBaseType(SharedBase obj) { obj.Init(); } public static bool GetConfigBool(bool defaultValue, string packetTitle, string desc = "") { return ConfigManager.DualBindToConfig(packetTitle, Config.MyConfig, "Should This Content Be Enabled", defaultValue, desc); } public static Sprite TryLoadSpriteFromBundle(string path, AssetBundle assetBundle = null, bool fallBackOnWrench = false) { //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) Sprite val = NewMoonPlugin.TryLoadFromBundle<Sprite>(path, assetBundle); if (Object.op_Implicit((Object)(object)val)) { return val; } return Addressables.LoadAssetAsync<Sprite>((object)(fallBackOnWrench ? RoR2_Base_Core.texNullIcon_png : RoR2_Base_Common_MiscIcons.texWIPIcon_png)).WaitForCompletion(); } public static T TryLoadFromBundle<T>(string path, AssetBundle assetBundle = null) where T : Object { if ((Object)(object)assetBundle == (Object)null) { assetBundle = mainAssetBundle; } if (Object.op_Implicit((Object)(object)assetBundle) && !string.IsNullOrWhiteSpace(path) && assetBundle.Contains(path)) { return assetBundle.LoadAsset<T>(path); } return default(T); } public static AssetReferenceT<T> LoadAsync<T>(string guid, Action<T> callback) where T : Object { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) AssetReferenceT<T> val = new AssetReferenceT<T>(guid); AsyncOperationHandle<T> handle2 = AssetAsyncReferenceManager<T>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); if (callback == null) { return val; } if (handle2.IsDone) { onCompleted(handle2); return val; } handle2.Completed += onCompleted; return val; void onCompleted(AsyncOperationHandle<T> handle) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 if (handle.Result == null || (int)handle.Status != 1) { Debug.LogError((object)$"Failed to load asset [{handle.DebugName}] : {handle.OperationException}"); } else { callback(handle.Result); } } } public static void RemoveCraftingRecipe(string guid) { NewMoonPlugin.LoadAsync<CraftableDef>(guid, (Action<CraftableDef>)delegate(CraftableDef craftableDef) { craftableDef.recipes = (Recipe[])(object)new Recipe[0]; }); } public static void RetierItemAsync(string itemGuid, ItemTier tier = 5, Action<ItemDef> callback = null) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) AssetReferenceT<ItemDef> val = new AssetReferenceT<ItemDef>(itemGuid); AsyncOperationHandle<ItemDef> val2 = AssetAsyncReferenceManager<ItemDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<ItemDef> ctx) { //IL_000b: 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) //IL_001d: Unknown result type (might be due to invalid IL or missing references) ItemDef result = ctx.Result; result.tier = tier; result.deprecatedTier = tier; if (callback != null) { callback(result); } }; } public static void RemoveEquipmentAsync(string equipmentGuid, Action<EquipmentDef> callback = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT<EquipmentDef> val = new AssetReferenceT<EquipmentDef>(equipmentGuid); AsyncOperationHandle<EquipmentDef> val2 = AssetAsyncReferenceManager<EquipmentDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<EquipmentDef> ctx) { EquipmentDef result = ctx.Result; result.canDrop = false; result.canBeRandomlyTriggered = false; result.enigmaCompatible = false; result.dropOnDeathChance = 0f; if (callback != null) { callback(result); } }; } } internal static class Log { public static bool enableDebugging; internal static ManualLogSource _logSource; public static void DebugBreakpoint(string methodName, int breakpointNumber = -1) { string text = "NewMoon: " + methodName + " IL hook failed!"; if (breakpointNumber >= 0) { text += $" (breakpoint {breakpointNumber})"; } Error(text); } internal static void Init(ManualLogSource logSource) { enableDebugging = ConfigManager.DualBindToConfig("Swan Song", Config.MyConfig, "Enable Debugging", defaultValue: false, "Enable debug outputs to the log for troubleshooting purposes. Enabling this will slow down the game."); _logSource = logSource; } internal static string Combine(params string[] parameters) { string text = "NewMoon : "; foreach (string text2 in parameters) { text = text + text2 + " : "; } return text; } internal static void Debug(object data) { if (enableDebugging) { _logSource.LogDebug(data); } } internal static void Error(object data) { _logSource.LogError(data); } internal static void ErrorAssetBundle(string assetName, string bundleName) { Error("failed to load asset, " + assetName + ", because it does not exist in asset bundle, " + bundleName); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } public abstract class SharedBase { public virtual int loadOrder => 0; public virtual bool forcePrerequisites { get; } = false; public abstract string ConfigName { get; } public virtual bool isEnabled { get; } = true; public static ManualLogSource Logger => Log._logSource; public abstract AssetBundle assetBundle { get; } public abstract void Hooks(); public abstract void Lang(); public virtual bool GetPrerequisites() { return true; } public virtual void Init() { ConfigManager.HandleConfigAttributes(GetType(), ConfigName, Config.MyConfig); Hooks(); Lang(); NewMoonPlugin.onLoaded += PostInit; } public T Bind<T>(T defaultValue, string configName, string configDesc = "") { return ConfigManager.DualBindToConfig(ConfigName, Config.MyConfig, configName, defaultValue, configDesc); } public virtual void PostInit() { } public static float GetHyperbolic(float firstStack, float cap, float chance) { if (firstStack >= cap) { return cap * (chance / firstStack); } float num = chance / firstStack; float num2 = 100f * firstStack / (cap - firstStack); return cap * (1f - 100f / (num * num2 + 100f)); } public static ExpansionDef SotvExpansionDef() { //IL_0006: 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) return Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); } } public class ExploderDirector : MonoBehaviour { internal BrotherEncounterBaseState baseState; private bool isActive = false; private static float baseSpawnFrequency = 20f; private static float spawnRateModifier = 1f; private float spawnFrequency; private float exploderSpawnTimer = 0f; public const float rampHeight = 524.3f; public List<ExploderSpawnNode> SpawnNodes = new List<ExploderSpawnNode>(); public void SetDirectorRate(float rate) { if (rate <= 0f) { exploderSpawnTimer = 0f; spawnRateModifier = 0f; isActive = false; } else { isActive = true; spawnRateModifier = rate; spawnFrequency = baseSpawnFrequency / spawnRateModifier; } } private void Start() { if (baseState != null) { CreateSpawnNodes(); SetDirectorRate(1f); isActive = true; } else { Object.Destroy((Object)(object)this); } } private void CreateSpawnNodes() { //IL_0029: 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_0044: 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_005f: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { Vector3[] array = (Vector3[])(object)new Vector3[4] { new Vector3(65f, 524.3f, 155f), new Vector3(65f, 524.3f, -145f), new Vector3(-240f, 524.3f, 155f), new Vector3(-240f, 524.3f, -145f) }; for (int i = 0; i < array.Length; i++) { GameObject val = new GameObject($"CommencementPerfected_ExploderSpawnNode_{i}"); val.transform.position = array[i]; val.transform.parent = ((Component)this).transform; ExploderSpawnNode item = val.AddComponent<ExploderSpawnNode>(); SpawnNodes.Add(item); } } } private void FixedUpdate() { if (NetworkServer.active && spawnFrequency != 0f) { exploderSpawnTimer += Time.fixedDeltaTime * spawnRateModifier; while (exploderSpawnTimer > spawnFrequency) { exploderSpawnTimer -= spawnFrequency; List<CharacterMaster> list = new List<CharacterMaster>(); foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.body.healthComponent.alive) { list.Add(instance.master); } } StartExploderWaveStacked(list.Count, list); } } else { Debug.Log((object)"uuu"); } if (((EntityState)baseState).outer.destroying) { SetDirectorRate(0f); Debug.Log((object)"Destroying Exploder Director! Ahhhhhh!!!!!!"); Object.Destroy((Object)(object)this); } } private void StartExploderWaveStacked(int spawnCount, List<CharacterMaster> playersList) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < playersList.Count; i++) { CharacterMaster val = playersList[i]; Vector3 position = val.GetBody().transform.position; float num = float.PositiveInfinity; ExploderSpawnNode exploderSpawnNode = null; foreach (ExploderSpawnNode spawnNode in SpawnNodes) { float num2 = Vector3.Distance(((Component)spawnNode).transform.position, position); Vector2 zero = Vector2.zero; if (num2 < num) { exploderSpawnNode = spawnNode; num = num2; } } int num3 = playersList.Count - i; int num4 = spawnCount / num3; if (spawnCount % num3 != 0) { num4 = Mathf.CeilToInt((float)num4); } if ((Object)(object)exploderSpawnNode != (Object)null && num4 > 0) { exploderSpawnNode.QueueSpawns(num4); } } } private void StartExploderWaveDispersed(int spawnCount, List<CharacterMaster> playersList, Vector2 searchRange) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) if (searchRange.x >= searchRange.y && searchRange.y != 0f) { StartExploderWaveStacked(spawnCount, playersList); return; } for (int i = 0; i < playersList.Count; i++) { CharacterMaster val = playersList[i]; float num = float.PositiveInfinity; ExploderSpawnNode exploderSpawnNode = null; foreach (ExploderSpawnNode spawnNode in SpawnNodes) { if ((float)spawnNode.spawnQueue <= searchRange.y) { float num2 = Vector3.Distance(((Component)spawnNode).transform.position, ((Component)val).transform.position); if (num2 < num) { exploderSpawnNode = spawnNode; num = num2; } } else { if (searchRange.x < (float)spawnNode.spawnQueue) { searchRange.x = searchRange.y; } searchRange.y = spawnNode.spawnQueue; } } int num3 = playersList.Count - i; int num4 = spawnCount / num3; if (spawnCount % num3 != 0) { num4 = Mathf.CeilToInt((float)num4); } if ((Object)(object)exploderSpawnNode != (Object)null && num4 > 0) { exploderSpawnNode.QueueSpawns(num4); } } } } public class ExploderSpawnNode : MonoBehaviour { internal int spawnQueue = 0; private static float spawnInterval = 1f; private float spawnTimer = 0f; private void Start() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) spawnQueue = 0; Debug.Log((object)((Component)this).transform.position); } public void QueueSpawns(int spawnCount, float delay = 0f) { spawnQueue += spawnCount; spawnTimer = 0f - delay; } private void FixedUpdate() { //IL_0070: 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_009a: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown if (spawnQueue > 0) { spawnTimer += Time.fixedDeltaTime; while (spawnTimer > spawnInterval && spawnQueue > 0) { spawnTimer -= spawnInterval; spawnQueue--; Debug.Log((object)$"Spawn {((Object)NewMoonPlugin.exploderCard).name} at position {((Component)this).transform.position}!. Remaining queue: {spawnQueue}"); DirectorSpawnRequest val = new DirectorSpawnRequest(NewMoonPlugin.exploderCard, new DirectorPlacementRule { placementMode = (PlacementMode)1, minDistance = 0f, maxDistance = 10f, spawnOnTarget = ((Component)this).transform }, RoR2Application.rng); val.teamIndexOverride = (TeamIndex)2; val.ignoreTeamMemberLimit = true; DirectorCore instance = DirectorCore.instance; if ((Object)(object)instance == (Object)null) { break; } instance.TrySpawnObject(val); } } else { spawnTimer = 0f; } } } public static class Extensions { public static void AddAllRecipePermutations(this CraftableDef craftableDef, RecipeIngredient[] firstSlotIngredients, RecipeIngredient[] secondSlotIngredients) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown List<Recipe> list = new List<Recipe>(); foreach (RecipeIngredient val in firstSlotIngredients) { foreach (RecipeIngredient val2 in secondSlotIngredients) { Recipe val3 = new Recipe(); val3.ingredients = (RecipeIngredient[])(object)new RecipeIngredient[2] { val, val2 }; list.Add(val3); } } if (craftableDef.recipes.Length == 0) { craftableDef.recipes = list.ToArray(); } else { craftableDef.recipes = craftableDef.recipes.Concat(list).ToArray(); } } public static bool InteractableIsPermittedForSpawn(this GameObject interactableObject, bool disallowPickups = true) { if ((Object)(object)interactableObject == (Object)null) { return false; } InteractionProcFilter val = default(InteractionProcFilter); if (interactableObject.TryGetComponent<InteractionProcFilter>(ref val)) { return val.shouldAllowOnInteractionBeginProc; } PurchaseInteraction val2 = default(PurchaseInteraction); if (interactableObject.TryGetComponent<PurchaseInteraction>(ref val2)) { return !val2.disableSpawnOnInteraction; } DelusionChestController val3 = default(DelusionChestController); if (interactableObject.TryGetComponent<DelusionChestController>(ref val3)) { PickupPickerController val4 = default(PickupPickerController); if (interactableObject.TryGetComponent<PickupPickerController>(ref val4) && ((Behaviour)val4).enabled) { return false; } return true; } GenericPickupController val5 = default(GenericPickupController); if (interactableObject.TryGetComponent<GenericPickupController>(ref val5)) { return disallowPickups || val5.Duplicated; } if (Object.op_Implicit((Object)(object)interactableObject.GetComponent<VehicleSeat>())) { return false; } if (Object.op_Implicit((Object)(object)interactableObject.GetComponent<NetworkUIPromptController>())) { return false; } PowerPedestal val6 = default(PowerPedestal); if (interactableObject.TryGetComponent<PowerPedestal>(ref val6)) { return val6.CanTriggerFireworks; } AccessCodesNodeController val7 = default(AccessCodesNodeController); if (interactableObject.TryGetComponent<AccessCodesNodeController>(ref val7)) { return val7.CheckInteractionOrder(); } return true; } public static GameObject FixItemModel(this GameObject prefab) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null) { prefab = Resources.Load<GameObject>("prefabs/NullModel"); } ModelPanelParameters val = prefab.AddComponent<ModelPanelParameters>(); val.minDistance = 1f; val.maxDistance = 15f; Transform val2 = prefab.transform.Find("FocusPos"); if ((Object)(object)val2 == (Object)null) { GameObject val3 = new GameObject("FocusPos"); val2 = val3.transform; val2.parent = prefab.transform; val2.localPosition = Vector3.zero; } val.focusPointTransform = val2; Transform val4 = prefab.transform.Find("CameraPos"); if ((Object)(object)val4 == (Object)null) { GameObject val5 = new GameObject("CameraPos"); val4 = val5.transform; val4.parent = prefab.transform; val4.SetPositionAndRotation(val2.position + Vector3.forward * -7f + Vector3.right * -1f, val4.rotation); } val.cameraPositionTransform = val4; return prefab; } public static string AsPercent(this float d) { return d * 100f + "%"; } public static void AddPersistentListener(this HoldoutZoneControllerChargedUnityEvent unityEvent, UnityAction<HoldoutZoneController> action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } public static void AddPersistentListener(this UnityEvent<Interactor> unityEvent, UnityAction<Interactor> action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } public static void AddPersistentListener(this UnityEvent<CharacterMaster> unityEvent, UnityAction<CharacterMaster> action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } public static void AddPersistentListener(this UnityEvent<GameObject> unityEvent, UnityAction<GameObject> action) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_004c: 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) PersistentCallGroup persistentCalls = ((UnityEventBase)unityEvent).m_PersistentCalls; PersistentCall val = new PersistentCall(); ref Object target = ref val.m_Target; object? target2 = ((Delegate)(object)action).Target; target = (Object)((target2 is Object) ? target2 : null); val.m_TargetAssemblyTypeName = UnityEventTools.TidyAssemblyTypeName(((Delegate)(object)action).Method.DeclaringType.AssemblyQualifiedName); val.m_MethodName = ((Delegate)(object)action).Method.Name; val.m_CallState = (UnityEventCallState)2; val.m_Mode = (PersistentListenerMode)0; persistentCalls.AddListener(val); } } public static class Tools { public static string modPrefix = string.Format("@{0}+{1}", "ArtificerExtended", "artiskillicons"); public static AssetBundle LoadAssetBundle(byte[] resourceBytes) { if (resourceBytes == null) { throw new ArgumentNullException("resourceBytes"); } return AssetBundle.LoadFromMemory(resourceBytes); } public static string GetModPrefix(this BaseUnityPlugin plugin, string bundleName) { return $"@{plugin.Info.Metadata.Name}+{bundleName}"; } internal static bool isLoaded(string modguid) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { string key = pluginInfo.Key; PluginInfo value = pluginInfo.Value; if (key == modguid) { return true; } } return false; } internal static string ConvertDecimal(float d) { return d * 100f + "%"; } internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; if (string.Equals(((Object)val).name, childObject)) { if (color == Color.clear) { Object.Destroy((Object)(object)val); break; } if ((Object)(object)material == (Object)null) { material = new Material(val.material); material.mainTexture = val.material.mainTexture; material.shader = val.material.shader; material.color = color; } val.material = material; Transform transform = ((Component)val).transform; transform.localScale *= scaleMultiplier; if (!replaceAll) { break; } } } } internal static void DebugMaterial(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; Debug.Log((object)("Material: " + ((Object)val2).name.ToString())); } } internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; MainModule main = val2.main; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ColorBySpeedModule colorBySpeed = val2.colorBySpeed; if (string.Equals(((Object)val2).name, childObject)) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color); ((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color); if (!replaceAll) { break; } } } } internal static void DebugParticleSystem(GameObject model) { ParticleSystem[] components = model.GetComponents<ParticleSystem>(); ParticleSystem[] array = components; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; Debug.Log((object)("Particle: " + ((Object)val2).name.ToString())); } } internal static void GetLight(GameObject model, string childObject, Color color, bool replaceAll = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) Light[] componentsInChildren = model.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; if (string.Equals(((Object)val2).name, childObject)) { val2.color = color; if (!replaceAll) { break; } } } } internal static void DebugLight(GameObject model) { Light[] componentsInChildren = model.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; Debug.Log((object)("Light: " + ((Object)val2).name.ToString())); } } public static void ClearDotStacksForType(this DotController dotController, DotIndex dotIndex) { //IL_001e: 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) for (int num = dotController.dotStackList.Count - 1; num >= 0; num--) { if (dotController.dotStackList[num].dotIndex == dotIndex) { dotController.RemoveDotStackAtServer(num); } } } public static void ApplyCooldownScale(GenericSkill skillSlot, float cooldownScale) { if ((Object)(object)skillSlot != (Object)null) { skillSlot.cooldownScale *= cooldownScale; } } public static int CountOverspillTriangular(float totalValue, float incrementor = 1f) { int num = 0; while (totalValue > 0f) { num++; totalValue -= incrementor * (float)num; } return num; } public static int CountOverspillFibonacci(float totalValue, float thresholdScale = 1f, int startingIndex = 1) { int num = 1; int num2 = 1; int num3 = 0; while (totalValue > (float)num2 * thresholdScale) { num2 += num; num = num2 - num; if (num3 > startingIndex) { num3++; } } return num3; } public static RecipeIngredient[] GetAllIngredientsWithTags(ItemTag[] required, ItemTag[] forbidden, int maxTier = 3) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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_0046: 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_004f: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) List<RecipeIngredient> list = new List<RecipeIngredient>(); for (int i = 1; i <= maxTier; i++) { ItemTier itemTier = (ItemTier)0; switch (i) { case 1: itemTier = (ItemTier)0; break; case 2: itemTier = (ItemTier)1; break; case 3: itemTier = (ItemTier)2; break; case 4: itemTier = (ItemTier)4; break; case 5: itemTier = (ItemTier)10; break; } RecipeIngredient val = new RecipeIngredient(); val.requiredTags = required; val.forbiddenTags = forbidden; val.type = (IngredientTypeIndex)1; val.itemTier = itemTier; list.Add(val); } return list.ToArray(); } } } namespace NewMoon.Modules { public static class CommonAssets { private static AssetBundle _mainAssetBundle; public static string dropPrefabsPath = "Assets/Models/DropPrefabs"; public static string iconsPath = "Assets/Textures/Icons/"; public static string eliteMaterialsPath = "Assets/Textures/Materials/Elite/"; public static AssetBundle mainAssetBundle { get { if ((Object)(object)_mainAssetBundle == (Object)null) { _mainAssetBundle = Assets.LoadAssetBundle("fruityendings"); } return _mainAssetBundle; } set { _mainAssetBundle = value; } } public static void Init() { } } public class CustomRendererInfo { public string childName; public Material material = null; public bool dontHotpoo = false; public bool ignoreOverlays = false; } internal static class Assets { internal static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>(); internal static AssetBundle LoadAssetBundle(string bundleName) { if (loadedBundles.ContainsKey(bundleName)) { return loadedBundles[bundleName]; } AssetBundle val = null; val = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)NewMoonPlugin.instance).Info.Location), bundleName)); loadedBundles[bundleName] = val; return val; } internal static GameObject CloneTracer(string originalTracerName, string newTracerName) { if ((Object)(object)LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName) == (Object)null) { return null; } GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Effects/Tracers/" + originalTracerName), newTracerName, true); if (!Object.op_Implicit((Object)(object)val.GetComponent<EffectComponent>())) { val.AddComponent<EffectComponent>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<VFXAttributes>())) { val.AddComponent<VFXAttributes>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } val.GetComponent<Tracer>().speed = 250f; val.GetComponent<Tracer>().length = 50f; Content.CreateAndAddEffectDef(val); return val; } internal static void ConvertAllRenderersToHopooShader(GameObject objectToConvert) { if (!Object.op_Implicit((Object)(object)objectToConvert)) { return; } MeshRenderer[] componentsInChildren = objectToConvert.GetComponentsInChildren<MeshRenderer>(); foreach (MeshRenderer val in componentsInChildren) { if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)((Renderer)val).sharedMaterial)) { ((Renderer)val).sharedMaterial.ConvertDefaultShaderToHopoo(); } } SkinnedMeshRenderer[] componentsInChildren2 = objectToConvert.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer val2 in componentsInChildren2) { if (Object.op_Implicit((Object)(object)val2) && Object.op_Implicit((Object)(object)((Renderer)val2).sharedMaterial)) { ((Renderer)val2).sharedMaterial.ConvertDefaultShaderToHopoo(); } } } internal static GameObject LoadCrosshair(string crosshairName) { GameObject val = LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/" + crosshairName + "Crosshair"); if ((Object)(object)val == (Object)null) { Log.Error("could not load crosshair with the name " + crosshairName + ". defaulting to Standard"); return LegacyResourcesAPI.Load<GameObject>("Prefabs/Crosshair/StandardCrosshair"); } return val; } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, bool parentToTransform) { return assetBundle.LoadEffect(resourceName, "", parentToTransform); } internal static GameObject LoadEffect(this AssetBundle assetBundle, string resourceName, string soundName = "", bool parentToTransform = false) { //IL_0046: 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) GameObject val = assetBundle.LoadAsset<GameObject>(resourceName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(resourceName, ((Object)assetBundle).name); return null; } val.AddComponent<DestroyOnTimer>().duration = 12f; val.AddComponent<NetworkIdentity>(); val.AddComponent<VFXAttributes>().vfxPriority = (VFXPriority)2; EffectComponent val2 = val.AddComponent<EffectComponent>(); val2.applyScale = false; val2.effectIndex = (EffectIndex)(-1); val2.parentToReferencedTransform = parentToTransform; val2.positionAtReferencedTransform = true; val2.soundName = soundName; Content.CreateAndAddEffectDef(val); return val; } internal static GameObject CreateProjectileGhostPrefab(this AssetBundle assetBundle, string ghostName) { GameObject val = assetBundle.LoadAsset<GameObject>(ghostName); if ((Object)(object)val == (Object)null) { Log.Error("Failed to load ghost prefab " + ghostName); } if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>())) { val.AddComponent<ProjectileGhostController>(); } ConvertAllRenderersToHopooShader(val); return val; } internal static GameObject CreateProjectileGhostPrefab(GameObject ghostObject, string newName) { if ((Object)(object)ghostObject == (Object)null) { Log.Error("Failed to load ghost prefab " + ((Object)ghostObject).name); } GameObject val = PrefabAPI.InstantiateClone(ghostObject, newName); if (!Object.op_Implicit((Object)(object)val.GetComponent<NetworkIdentity>())) { val.AddComponent<NetworkIdentity>(); } if (!Object.op_Implicit((Object)(object)val.GetComponent<ProjectileGhostController>())) { val.AddComponent<ProjectileGhostController>(); } return val; } internal static GameObject CloneProjectilePrefab(string prefabName, string newPrefabName) { return PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/Projectiles/" + prefabName), newPrefabName); } internal static GameObject LoadAndAddProjectilePrefab(this AssetBundle assetBundle, string newPrefabName) { GameObject val = assetBundle.LoadAsset<GameObject>(newPrefabName); if ((Object)(object)val == (Object)null) { Log.ErrorAssetBundle(newPrefabName, ((Object)assetBundle).name); return null; } Content.AddProjectilePrefab(val); return val; } } internal static class Prefabs { private static PhysicMaterial ragdollMaterial; public static GameObject CreateDisplayPrefab(AssetBundle assetBundle, string displayPrefabName, GameObject prefab) { GameObject val = assetBundle.LoadAsset<GameObject>(displayPrefabName); if ((Object)(object)val == (Object)null) { Log.Error("could not load display prefab " + displayPrefabName + ". Make sure this prefab exists in assetbundle " + ((Object)assetBundle).name); return null; } CharacterModel val2 = val.GetComponent<CharacterModel>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = val.AddComponent<CharacterModel>(); } val2.baseRendererInfos = prefab.GetComponentInChildren<CharacterModel>().baseRendererInfos; Assets.ConvertAllRenderersToHopooShader(val); return val; } public static CharacterModel SetupCharacterModel(GameObject bodyPrefab, CustomRendererInfo[] customInfos = null) { CharacterModel val = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject.GetComponent<CharacterModel>(); bool flag = (Object)(object)val != (Object)null; if (!flag) { val = ((Component)bodyPrefab.GetComponent<ModelLocator>().modelTransform).gameObject.AddComponent<CharacterModel>(); } val.body = bodyPrefab.GetComponent<CharacterBody>(); val.autoPopulateLightInfos = true; val.invisibilityCount = 0; val.temporaryOverlays = new List<TemporaryOverlayInstance>(); if (!flag) { SetupCustomRendererInfos(val, customInfos); } else { SetupPreAttachedRendererInfos(val); } SetupHurtboxGroup(bodyPrefab, ((Component)val).gameObject); SetupAimAnimator(bodyPrefab, ((Component)val).gameObject); SetupFootstepController(((Component)val).gameObject); SetupRagdoll(((Component)val).gameObject); return val; } public static void SetupPreAttachedRendererInfos(CharacterModel characterModel) { for (int i = 0; i < characterModel.baseRendererInfos.Length; i++) { if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { characterModel.baseRendererInfos[i].defaultMaterial = characterModel.baseRendererInfos[i].renderer.sharedMaterial; } if ((Object)(object)characterModel.baseRendererInfos[i].defaultMaterial == (Object)null) { Log.Error($"no material for rendererinfo of this renderer: {characterModel.baseRendererInfos[i].renderer}"); } characterModel.baseRendererInfos[i].defaultMaterial.ConvertDefaultShaderToHopoo(); } } public static void SetupCustomRendererInfos(CharacterModel characterModel, CustomRendererInfo[] customInfos) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) ChildLocator component = ((Component)characterModel).GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component)) { Log.Error("Failed CharacterModel setup: ChildLocator component does not exist on the model"); return; } List<RendererInfo> list = new List<RendererInfo>(); for (int i = 0; i < customInfos.Length; i++) { if (!Object.op_Implicit((Object)(object)component.FindChild(customInfos[i].childName))) { Log.Error("Trying to add a RendererInfo for a renderer that does not exist: " + customInfos[i].childName); continue; } Renderer component2 = ((Component)component.FindChild(customInfos[i].childName)).GetComponent<Renderer>(); if (Object.op_Implicit((Object)(object)component2)) { Material val = customInfos[i].material; if ((Object)(object)val == (Object)null) { val = ((!customInfos[i].dontHotpoo) ? component2.sharedMaterial.ConvertDefaultShaderToHopoo() : component2.sharedMaterial); } list.Add(new RendererInfo { renderer = component2, defaultMaterial = val, ignoreOverlays = customInfos[i].ignoreOverlays, defaultShadowCastingMode = (ShadowCastingMode)1 }); } } characterModel.baseRendererInfos = list.ToArray(); } private static void SetupHurtboxGroup(GameObject bodyPrefab, GameObject model) { SetupMainHurtboxesFromChildLocator(bodyPrefab, model); SetHurtboxesHealthComponents(bodyPrefab); } private static void SetupMainHurtboxesFromChildLocator(GameObject bodyPrefab, GameObject model) { //IL_011e: 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) if ((Object)(object)bodyPrefab.GetComponent<HurtBoxGroup>() != (Object)null) { Log.Debug("Hitboxgroup already exists on model prefab. aborting code setup"); return; } ChildLocator component = model.GetComponent<ChildLocator>(); if (!Object.op_Implicit((Object)(object)component.FindChild("MainHurtbox"))) { Log.Error("Could not set up main hurtbox: make sure you have a transform pair in your prefab's ChildLocator called 'MainHurtbox'"); return; } HurtBoxGroup val = model.AddComponent<HurtBoxGroup>(); HurtBox val2 = null; GameObject val3 = component.FindChildGameObject("HeadHurtbox"); if (Object.op_Implicit((Object)(object)val3)) { Log.Debug("HeadHurtboxFound. Setting up"); val2 = val3.AddComponent<HurtBox>(); ((Component)val2).gameObject.layer = LayerIndex.entityPrecise.intVal; val2.healthComponent = bodyPrefab.GetComponent<HealthComponent>(); val2.isBullseye = false; val2.isSniperTarget = true; val2.damageModifier = (DamageModifier)0; val2.hurtBoxGroup = val; val2.indexInGroup = 1; } HurtBox val4 = component.FindChildGameObject("MainHurtbox").AddComponent<HurtBox>(); ((Component)val4).gameObject.layer = LayerIndex.entityPrecise.intVal; val4.healthComponent = bodyPrefab.GetComponent<HealthComponent>(); val4.isBullseye = true; val4.isSniperTarget = (Object)(object)val2 == (Object)null; val4.damageModifier = (DamageModifier)0; val4.hurtBoxGroup = val; val4.indexInGroup = 0; if (Object.op_Implicit((Object)(object)val2)) { val.hurtBoxes = (HurtBox[])(object)new HurtBox[2] { val4, val2 }; } else { val.hurtBoxes = (HurtBox[])(object)new HurtBox[1] { val4 }; } val.mainHurtBox = val4; val.bullseyeCount = 1; } public static void SetHurtboxesHealthComponents(GameObject bodyPrefab) { HealthComponent component = bodyPrefab.GetComponent<HealthComponent>(); HurtBoxGroup[] componentsInChildren = bodyPrefab.GetComponentsInChildren<HurtBoxGroup>(); foreach (HurtBoxGroup val in componentsInChildren) { val.mainHurtBox.healthComponent = component; for (int j = 0; j < val.hurtBoxes.Length; j++) { val.hurtBoxes[j].healthComponent = component; } } } private static void SetupFootstepController(GameObject model) { FootstepHandler val = model.AddComponent<FootstepHandler>(); val.baseFootstepString = "Play_player_footstep"; val.sprintFootstepOverrideString = ""; val.enableFootstepDust = true; val.footstepDustPrefab = LegacyResourcesAPI.Load<GameObject>("Prefabs/GenericFootstepDust"); } private static void SetupRagdoll(GameObject model) { RagdollController component = model.GetComponent<RagdollController>(); if (!Object.op_Implicit((Object)(object)component)) { return; } if ((Object)(object)ragdollMaterial == (Object)null) { ragdollMaterial = ((Component)LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterBodies/CommandoBody").GetComponentInChildren<RagdollController>().bones[1]).GetComponent<Collider>().material; } Transform[] bones = component.bones; foreach (Transform val in bones) { if (Object.op_Implicit((Object)(object)val)) { ((Component)val).gameObject.layer = LayerIndex.ragdoll.intVal; Collider component2 = ((Component)val).GetComponent<Collider>(); if (Object.op_Implicit((Object)(object)component2)) { component2.sharedMaterial = ragdollMaterial; } else { Log.Error($"Ragdoll bone {((Component)val).gameObject} doesn't have a collider. Ragdoll will break."); } } } } private static void SetupAimAnimator(GameObject prefab, GameObject model) { AimAnimator val = model.AddComponent<AimAnimator>(); val.directionComponent = prefab.GetComponent<CharacterDirection>(); val.pitchRangeMax = 60f; val.pitchRangeMin = -60f; val.yawRangeMin = -80f; val.yawRangeMax = 80f; val.pitchGiveupRange = 30f; val.yawGiveupRange = 10f; val.giveupDuration = 3f; val.inputBank = prefab.GetComponent<InputBankTest>(); } public static void CreateGenericDoppelganger(GameObject bodyPrefab, string masterName, string masterToCopy) { CloneDopplegangerMaster(bodyPrefab, masterName, masterToCopy); } public static GameObject CloneDopplegangerMaster(GameObject bodyPrefab, string masterName, string masterToCopy) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/" + masterToCopy + "MonsterMaster"), masterName, true); val.GetComponent<CharacterMaster>().bodyPrefab = bodyPrefab; Content.AddMasterPrefab(val); return val; } public static GameObject CreateBlankMasterPrefab(GameObject bodyPrefab, string masterName) { GameObject val = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("Prefabs/CharacterMasters/CommandoMonsterMaster"), masterName, true); ContentPacks.masterPrefabs.Add(val); CharacterMaster component = val.GetComponent<CharacterMaster>(); component.bodyPrefab = bodyPrefab; AISkillDriver[] components = val.GetComponents<AISkillDriver>(); for (int i = 0; i < components.Length; i++) { Object.Destroy((Object)(object)components[i]); } return val; } public static GameObject LoadMaster(this AssetBundle assetBundle, GameObject bodyPrefab, string assetName) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) GameObject val = assetBundle.LoadAsset<GameObject>(assetName); BaseAI val2 = val.GetComponent<BaseAI>(); if ((Object)(object)val2 == (Object)null) { val2 = val.AddComponent<BaseAI>(); val2.aimVectorDampTime = 0.1f; val2.aimVectorMaxSpeed = 360f; } val2.scanState = new SerializableEntityStateType(typeof(Wander)); EntityStateMachine component = val.GetComponent<EntityStateMachine>(); if ((Object)(object)component == (Object)null) { AddEntityStateMachine(val, "AI", typeof(Wander), typeof(Wander)); } val2.stateMachine = component; CharacterMaster val3 = val.GetComponent<CharacterMaster>(); if ((Object)(object)val3 == (Object)null) { val3 = val.AddComponent<CharacterMaster>(); } val3.bodyPrefab = bodyPrefab; val3.teamIndex = (TeamIndex)2; Content.AddMasterPrefab(val); return val; } public static void ClearEntityStateMachines(GameObject bodyPrefab) { EntityStateMachine[] components = bodyPrefab.GetComponents<EntityStateMachine>(); for (int num = components.Length - 1; num >= 0; num--) { Object.DestroyImmediate((Object)(object)components[num]); } NetworkStateMachine component = bodyPrefab.GetComponent<NetworkStateMachine>(); component.stateMachines = Array.Empty<EntityStateMachine>(); CharacterDeathBehavior component2 = bodyPrefab.GetComponent<CharacterDeathBehavior>(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = Array.Empty<EntityStateMachine>(); } SetStateOnHurt component3 = bodyPrefab.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component3)) { component3.idleStateMachine = Array.Empty<EntityStateMachine>(); } } public static void AddMainEntityStateMachine(GameObject bodyPrefab, string machineName = "Body", Type mainStateType = null, Type initalStateType = null) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) EntityStateMachine val = EntityStateMachine.FindByCustomName(bodyPrefab, machineName); if ((Object)(object)val == (Object)null) { val = bodyPrefab.AddComponent<EntityStateMachine>(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(GenericCharacterMain); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(SpawnTeleporterState); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = bodyPrefab.GetComponent<NetworkStateMachine>(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = bodyPrefab.GetComponent<CharacterDeathBehavior>(); if (Object.op_Implicit((Object)(object)component2)) { component2.deathStateMachine = val; } SetStateOnHurt component3 = bodyPrefab.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component3)) { component3.targetStateMachine = val; } } public static void AddEntityStateMachine(GameObject prefab, string machineName, Type mainStateType = null, Type initalStateType = null) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) EntityStateMachine val = EntityStateMachine.FindByCustomName(prefab, machineName); if ((Object)(object)val == (Object)null) { val = prefab.AddComponent<EntityStateMachine>(); } else { Log.Message("An Entity State Machine already exists with the name " + machineName + ". replacing."); } val.customName = machineName; if (mainStateType == null) { mainStateType = typeof(Idle); } val.mainStateType = new SerializableEntityStateType(mainStateType); if (initalStateType == null) { initalStateType = typeof(Idle); } val.initialStateType = new SerializableEntityStateType(initalStateType); NetworkStateMachine component = prefab.GetComponent<NetworkStateMachine>(); if (Object.op_Implicit((Object)(object)component)) { component.stateMachines = component.stateMachines.Append(val).ToArray(); } CharacterDeathBehavior component2 = prefab.GetComponent<CharacterDeathBehavior>(); if (Object.op_Implicit((Object)(object)component2)) { component2.idleStateMachine = component2.idleStateMachine.Append(val).ToArray(); } SetStateOnHurt component3 = prefab.GetComponent<SetStateOnHurt>(); if (Object.op_Implicit((Object)(object)component3)) { component3.idleStateMachine = component3.idleStateMachine.Append(val).ToArray(); } } public static void SetupHitBoxGroup(GameObject modelPrefab, string hitBoxGroupName, params string[] hitboxChildNames) { ChildLocator component = modelPrefab.GetComponent<ChildLocator>(); Transform[] array = (Transform[])(object)new Transform[hitboxChildNames.Length]; for (int i = 0; i < hitboxChildNames.Length; i++) { array[i] = component.FindChild(hitboxChildNames[i]); if ((Object)(object)array[i] == (Object)null) { Log.Error("missing hitbox for " + hitboxChildNames[i]); } } SetupHitBoxGroup(modelPrefab, hitBoxGroupName, array); } public static void SetupHitBoxGroup(GameObject prefab, string hitBoxGroupName, params Transform[] hitBoxTransforms) { List<HitBox> list = new List<HitBox>(); foreach (Transform val in hitBoxTransforms) { if ((Object)(object)val == (Object)null) { Log.Error("Error setting up hitboxGroup for " + hitBoxGroupName + ": hitbox transform was null"); continue; } HitBox item = ((Component)val).gameObject.AddComponent<HitBox>(); ((Component)val).gameObject.layer = LayerIndex.projectile.intVal; list.Add(item); } if (list.Count == 0) { Log.Error("No hitboxes were set up. aborting setting up hitboxGroup for " + hitBoxGroupName); return; } HitBoxGroup val2 = prefab.AddComponent<HitBoxGroup>(); val2.hitBoxes = list.ToArray(); val2.groupName = hitBoxGroupName; } } internal static class Materials { private static List<Material> cachedMaterials = new List<Material>(); internal static Shader hotpoo = LegacyResourcesAPI.Load<Shader>("Shaders/Deferred/HGStandard"); public static List<Material> MaterialsWithSwappedShaders { get; } = new List<Material>(); internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; if (string.Equals(((Object)val).name, childObject)) { if (color == Color.clear) { Object.Destroy((Object)(object)val); break; } if ((Object)(object)material == (Object)null) { material = new Material(val.material); material.mainTexture = val.material.mainTexture; material.shader = val.material.shader; material.color = color; } val.material = material; Transform transform = ((Component)val).transform; transform.localScale *= scaleMultiplier; if (!replaceAll) { break; } } } } internal static void DebugMaterial(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; Debug.Log((object)("Material: " + ((Object)val2).name.ToString())); } } public static void SwapShadersFromMaterialsInBundle(AssetBundle bundle) { SwapAllShaders(bundle); } internal static void SwapAllShaders(AssetBundle assetBundle) { Material[] array = assetBundle.LoadAllAssets<Material>(); foreach (Material val in array) { Log.Debug("Trying to swap shader for " + ((Object)val).name); TrySwapShader(val); } } internal static void TrySwapShader(Material material) { //IL_0039: 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_0105: Unknown result type (might be due to invalid IL or missing references) string name = ((Object)material.shader).name; if (name.Contains("Stubbed")) { name = name.Replace("Stubbed", string.Empty) + ".shader"; Shader val = Addressables.LoadAssetAsync<Shader>((object)name).WaitForCompletion(); if ((Object)(object)val != (Object)null) { material.shader = val; } else { Log.Error("Failed to load shader " + name); } } else if (name == "Standard") { Texture texture = material.GetTexture("_BumpMap"); float @float = material.GetFloat("_BumpScale"); Texture texture2 = material.GetTexture("_EmissionMap"); material.shader = Resources.Load<Shader>("Shaders/Deferred/HGStandard"); material.SetTexture("_NormalMap", texture); material.SetFloat("_NormalStrength", @float); material.SetTexture("_EmTex", texture2); material.SetColor("_EmColor", new Color(0.2f, 0.2f, 0.2f)); material.SetFloat("_EmPower", 0.15f); } } private static void SwapShader(Material material) { //IL_0029: 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) string text = ((Object)material.shader).name.Substring("Stubbed".Length); string text2 = text + ".shader"; Shader shader = Addressables.LoadAssetAsync<Shader>((object)text2).WaitForCompletion(); material.shader = shader; MaterialsWithSwappedShaders.Add(material); } public static Material LoadMaterial(this AssetBundle assetBundle, string materialName) { return assetBundle.CreateHopooMaterialFromBundle(materialName); } public static Material CreateHopooMaterialFromBundle(this AssetBundle assetBundle, string materialName) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown Material val = cachedMaterials.Find(delegate(Material mat) { materialName.Replace(" (Instance)", ""); return ((Object)mat).name.Contains(materialName); }); if (Object.op_Implicit((Object)(object)val)) { Log.Debug(((Object)val).name + " has already been loaded. returning cached"); return val; } val = assetBundle.LoadAsset<Material>(materialName); if (!Object.op_Implicit((Object)(object)val)) { Log.ErrorAssetBundle(materialName, ((Object)assetBundle).name); return new Material(hotpoo); } return val.ConvertDefaultShaderToHopoo(); } public static Material SetHopooMaterial(this Material tempMat) { return tempMat.ConvertDefaultShaderToHopoo(); } public static Material ConvertDefaultShaderToHopoo(this Material tempMat) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) if (cachedMaterials.Contains(tempMat)) { Log.Debug(((Object)tempMat).name + " has already been loaded. returning cached"); return tempMat; } float? num = null; Color? val = null; if (tempMat.IsKeywordEnabled("_NORMALMAP")) { num = tempMat.GetFloat("_BumpScale"); } if (tempMat.IsKeywordEnabled("_EMISSION")) { val = tempMat.GetColor("_EmissionColor"); } tempMat.shader = hotpoo; tempMat.SetTexture("_EmTex", tempMat.GetTexture("_EmissionMap")); tempMat.EnableKeyword("DITHER"); if (num.HasValue) { tempMat.SetFloat("_NormalStrength", num.Value); tempMat.SetTexture("_NormalTex", tempMat.GetTexture("_BumpMap")); } if (val.HasValue) { tempMat.SetColor("_EmColor", val.Value); tempMat.SetFloat("_EmPower", 1f); } if (tempMat.IsKeywordEnabled("NOCULL")) { tempMat.SetInt("_Cull", 0); } if (tempMat.IsKeywordEnabled("LIMBREMOVAL")) { tempMat.SetInt("_LimbRemovalOn", 1); } cachedMaterials.Add(tempMat); return tempMat; } public static Material MakeUnique(this Material material) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (cachedMaterials.Contains(material)) { return new Material(material); } return material; } public static Material SetColor(this Material material, Color color) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) material.SetColor("_Color", color); return material; } public static Material SetNormal(this Material material, float normalStrength = 1f) { material.SetFloat("_NormalStrength", normalStrength); return material; } public static Material SetEmission(this Material material) { return material.SetEmission(1f); } public static Material SetEmission(this Material material, float emission) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return material.SetEmission(emission, Color.white); } public static Material SetEmission(this Material material, float emission, Color emissionColor) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) material.SetFloat("_EmPower", emission); material.SetColor("_EmColor", emissionColor); return material; } public static Material SetCull(this Material material, bool cull = false) { material.SetInt("_Cull", cull ? 1 : 0); return material; } public static Material SetSpecular(this Material material, float strength) { material.SetFloat("_SpecularStrength", strength); return material; } public static Material SetSpecular(this Material material, float strength, float exponent) { material.SetFloat("_SpecularStrength", strength); material.SetFloat("SpecularExponent", exponent); return material; } } internal static class Particles { internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; MainModule main = val2.main; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ColorBySpeedModule colorBySpeed = val2.colorBySpeed; if (string.Equals(((Object)val2).name, childObject)) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color); ((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color); if (!replaceAll) { break; } } } } internal static void DebugParticleSystem(GameObject model) { ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; Debug.Log((object)("Particle: " + ((Object)val2).name.ToString())); } } } internal class Content { internal static void AddExpansionDef(ExpansionDef expansion) { ContentPacks.expansionDefs.Add(expansion); } internal static void AddCharacterBodyPrefab(GameObject bprefab) { ContentPacks.bodyPrefabs.Add(bprefab); } internal static void AddMasterPrefab(GameObject prefab) { ContentPacks.masterPrefabs.Add(prefab); } internal static void AddProjectilePrefab(GameObject prefab) { ContentPacks.projectilePrefabs.Add(prefab); } internal static void AddSurvivorDef(SurvivorDef survivorDef) { ContentPacks.survivorDefs.Add(survivorDef); } internal static void AddVoidItemRelationship(ItemDef itemToCorrupt, ItemDef itemThatCorrupts) { //IL_002a: 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_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) ItemRelationshipProvider val = ScriptableObject.CreateInstance<ItemRelationshipProvider>(); ((Object)val).name = ((Object)itemThatCorrupts).name + ((Object)itemToCorrupt).name + "Relationship"; val.relationshipType = Addressables.LoadAssetAsync<ItemRelationshipType>((object)"RoR2/DLC1/Common/ContagiousItem.asset").WaitForCompletion(); val.relationships = (Pair[])(object)new Pair[1] { new Pair { itemDef1 = itemToCorrupt, itemDef2 = itemThatCorrupts } }; ContentPacks.itemRelationships.Add(val); } internal static void AddItemDef(ItemDef itemDef) { ContentPacks.itemDefs.Add(itemDef); } internal static void AddCraftableDef(CraftableDef itemDef) { ContentPacks.craftableDefs.Add(itemDef); } internal static void AddEliteDef(EliteDef eliteDef) { ContentPacks.eliteDefs.Add(eliteDef); } internal static void AddArtifactDef(ArtifactDef artifactDef) { ContentPacks.artifactDefs.Add(artifactDef); } internal static void AddNetworkedObjectPrefab(GameObject prefab) { ContentPacks.networkedObjectPrefabs.Add(prefab); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, float sortPosition) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, null, sortPosition); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) CreateSurvivor(bodyPrefab, displayPrefab, charColor, tokenPrefix, unlockableDef, 100f); } internal static void CreateSurvivor(GameObject bodyPrefab, GameObject displayPrefab, Color charColor, string tokenPrefix, UnlockableDef unlockableDef, float sortPosition) { //IL_0016: 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) SurvivorDef val = ScriptableObject.CreateInstance<SurvivorDef>(); val.bodyPrefab = bodyPrefab; val.displayPrefab = displayPrefab; val.primaryColor = charColor; val.cachedName = ((Object)bodyPrefab).name.Replace("Body", ""); val.displayNameToken = tokenPrefix + "NAME"; val.descriptionToken = tokenPrefix + "DESCRIPTION"; val.outroFlavorToken = tokenPrefix + "OUTRO_FLAVOR"; val.mainEndingEscapeFailureFlavorToken = tokenPrefix + "OUTRO_FAILURE"; val.desiredSortPosition = sortPosition; val.unlockableDef = unlockableDef; AddSurvivorDef(val); } internal static void AddUnlockableDef(UnlockableDef unlockableDef) { ContentPacks.unlockableDefs.Add(unlockableDef); } internal static UnlockableDef CreateAndAddUnlockbleDef(string identifier, string nameToken, Sprite achievementIcon) { UnlockableDef val = ScriptableObject.CreateInstance<UnlockableDef>(); val.cachedName = identifier; val.nameToken = nameToken; val.achievementIcon = achievementIcon; AddUnlockableDef(val); return val; } internal static void AddSkillDef(SkillDef skillDef) { ContentPacks.skillDefs.Add(skillDef); } internal static void AddSkillFamily(SkillFamily skillFamily) { ContentPacks.skillFamilies.Add(skillFamily); } internal static void AddEntityState(Type entityState) { ContentPacks.entityStates.Add(entityState); } internal static void AddBuffDef(BuffDef buffDef) { ContentPacks.buffDefs.Add(buffDef); } internal static BuffDef CreateAndAddBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, StackingDisplayMethod stackingDisplayMethod = 0) { //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_0034: 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) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; val.stackingDisplayMethod = stackingDisplayMethod; AddBuffDef(val); return val; } internal static void AddEffectDef(EffectDef effectDef) { ContentPacks.effectDefs.Add(effectDef); } internal static EffectDef CreateAndAddEffectDef(GameObject effectPrefab) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown EffectDef val = new EffectDef(effectPrefab); AddEffectDef(val); return val; } internal static void AddNetworkSoundEventDef(NetworkSoundEventDef networkSoundEventDef) { ContentPacks.networkSoundEventDefs.Add(networkSoundEventDef); } internal static NetworkSoundEventDef CreateAndAddNetworkSoundEventDef(string eventName) { NetworkSoundEventDef val = ScriptableObject.CreateInstance<NetworkSoundEventDef>(); val.akId = AkSoundEngine.GetIDFromString(eventName); val.eventName = eventName; AddNetworkSoundEventDef(val); return val; } } internal static class Skills { public static Dictionary<string, SkillLocator> characterSkillLocators = new Dictionary<string, SkillLocator>(); public static void CreateSkillFamilies(GameObject targetPrefab) { SkillSlot[] array = new SkillSlot[4]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); CreateSkillFamilies(targetPrefab, (SkillSlot[])(object)array); } public static void CreateSkillFamilies(GameObject targetPrefab, params SkillSlot[] slots) { //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_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); foreach (SkillSlot val in slots) { SkillSlot val2 = val; switch (val2 - -1) { case 1: component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary"); break; case 2: component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary"); break; case 3: component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility"); break; case 4: component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special"); break; } } } public static void ClearGenericSkills(GameObject targetPrefab) { GenericSkill[] componentsInChildren = targetPrefab.GetComponentsInChildren<GenericSkill>(); foreach (GenericSkill val in componentsInChildren) { Object.DestroyImmediate((Object)(object)val); } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, SkillSlot skillSlot, bool hidden = false) { //IL_0008: 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_000c: 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_0028: Expected I4, but got Unknown SkillLocator component = targetPrefab.GetComponent<SkillLocator>(); switch (skillSlot - -1) { case 1: return component.primary = CreateGenericSkillWithSkillFamily(targetPrefab, "Primary", hidden); case 2: return component.secondary = CreateGenericSkillWithSkillFamily(targetPrefab, "Secondary", hidden); case 3: return component.utility = CreateGenericSkillWithSkillFamily(targetPrefab, "Utility", hidden); case 4: return component.special = CreateGenericSkillWithSkillFamily(targetPrefab, "Special", hidden); case 0: Log.Error("Failed to create GenericSkill with skillslot None. If making a GenericSkill outside of the main 4, specify a familyName, and optionally a genericSkillName"); return null; default: return null; } } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string familyName, bool hidden = false) { return CreateGenericSkillWithSkillFamily(targetPrefab, familyName, familyName, hidden); } public static GenericSkill CreateGenericSkillWithSkillFamily(GameObject targetPrefab, string genericSkillName, string familyName, bool hidden = false) { GenericSkill val = targetPrefab.AddComponent<GenericSkill>(); val.skillName = genericSkillName; val.hideInCharacterSelect = hidden; SkillFamily val2 = ScriptableObject.CreateInstance<SkillFamily>(); ((Object)val2).name = ((Object)targetPrefab).name + familyName + "Family"; val2.variants = (Variant[])(object)new Variant[0]; val._skillFamily = val2; Content.AddSkillFamily(val2); return val; } public static void AddSkillToFamily(SkillFamily skillFamily, SkillDef skillDef, UnlockableDef unlockableDef = null) { //IL_0029: 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_0053: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) Array.Resize(ref skillFamily.variants, skillFamily.variants.Length + 1); Variant[] variants = skillFamily.variants; int num = skillFamily.variants.Length - 1; Variant val = new Variant { skillDef = skillDef, unlockableDef = unlockableDef }; ((Variant)(ref val)).viewableNode = new Node(skillDef.skillNameToken, false, (Node)null); variants[num] = val; } public static void AddSkillsToFamily(SkillFamily skillFamily, params SkillDef[] skillDefs) { foreach (SkillDef skillDef in skillDefs) { AddSkillToFamily(skillFamily, skillDef); } } public static void AddPrimarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().primary.skillFamily, skillDefs); } public static void AddSecondarySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().secondary.skillFamily, skillDefs); } public static void AddUtilitySkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().utility.skillFamily, skillDefs); } public static void AddSpecialSkills(GameObject targetPrefab, params SkillDef[] skillDefs) { AddSkillsToFamily(targetPrefab.GetComponent<SkillLocator>().special.skillFamily, skillDefs); } public static void AddUnlockablesToFamily(SkillFamily skillFamily, params UnlockableDef[] unlockableDefs) { //IL_000d: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < unlockableDefs.Length; i++) { Variant val = skillFamily.variants[i]; val.unlockableDef = unlockableDefs[i]; skillFamily.variants[i] = val; } } public static Combo ComboFromType(Type t) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0016: Unknown res
RiskierRain.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using EntityStates; using EntityStates.BeetleQueenMonster; using EntityStates.ClayBruiser.Weapon; using EntityStates.GoldGat; using EntityStates.Gup; using EntityStates.ImpBossMonster; using EntityStates.LunarWisp; using EntityStates.Missions.Arena.NullWard; using EntityStates.NullifierMonster; using EntityStates.QuestVolatileBattery; using EntityStates.ShrineHalcyonite; using EntityStates.VagrantMonster; using EntityStates.VagrantNovaItem; using HG; using IL.RoR2; using IL.RoR2.Artifacts; using IL.RoR2.Items; using IL.RoR2.Orbs; using IL.RoR2.Projectile; using IL.RoR2.Skills; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using MoreStats; using On.EntityStates.CaptainSupplyDrop; using On.EntityStates.ClayBruiser.Weapon; using On.EntityStates.Gup; using On.EntityStates.LunarWisp; using On.EntityStates.Missions.Arena.NullWard; using On.EntityStates.NullifierMonster; using On.EntityStates.QuestVolatileBattery; using On.EntityStates.ShrineHalcyonite; using On.EntityStates.VagrantMonster; using On.EntityStates.VagrantNovaItem; using On.RoR2; using On.RoR2.Items; using On.RoR2.Orbs; using On.RoR2.UI; using R2API; using R2API.Utils; using RainrotSharedUtils.Difficulties; using RainrotSharedUtils.Shelters; using RiskierRain.Changes; using RiskierRain.Changes.Components; using RiskierRain.Components; using RiskierRain.CoreModules; using RoR2; using RoR2.ContentManagement; using RoR2.Items; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using RoR2.UI; using RoR2BepInExPack.GameAssetPaths.Version_1_39_0; using RoR2BepInExPack.GameAssetPathsBetter; using SwanSongExtended.Modules; using SwanSongExtended.Storms; using ThreeEyedGames; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [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 = "")] [assembly: AssemblyCompany("RiskierRain")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RiskierRain")] [assembly: AssemblyTitle("RiskierRain")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: UnverifiableCode] namespace RiskierRain { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.RiskOfBrainrot.RiskierRain", "RiskierRain", "1.3.38")] [R2APISubmoduleDependency(new string[] { "LanguageAPI", "PrefabAPI", "DirectorAPI", "ItemAPI", "RecalculateStatsAPI", "EliteAPI" })] internal class RiskierRainPlugin : BaseUnityPlugin { public static int sacrificeDropCount = 12; public static int sacrificeDropCountRestricted = 5; public static float sacrificeDropRate = 8f; public static float sacrificeDropRateLimited = 20f; public static int sonorousDropCountBase = 4; public static int sonorousDropCountStack = 2; public static int sonorousDropCountRestrictedBase = 5; public static int sonorousDropCountRestrictedStack = 1; public static float sonorousDropRateBase = 5f; public static float sonorousDropRateStack = 5f; public static float sonorousDropRateLimited = 20f; private static int serverSacrificeDropTally = 0; private static int serverSonorousDropTally = 0; public static int minSpikes = 3; public static int maxSpikes = 4; public static int baseSpikesPerBuff = 2; public static int stackSpikesPerBuff = 1; public static float minDamageCoefficient = 5f; public static float releaseSpeed = 2f; public static float spikeDamageCoefficient = 0.3f; public static float spikeProcCoefficient = 1f; public static int shatterspleenBleedChance = 20; public static GameObject impBleedSpikePrefab; public const string guid = "com.RiskOfBrainrot.RiskierRain"; public const string teamName = "RiskOfBrainrot"; public const string modName = "RiskierRain"; public const string version = "1.3.38"; public static bool isAELoaded = Tools.isLoaded("com.Borbo.ArtificerExtended"); public static bool isHBULoaded = Tools.isLoaded("com.Borbo.HuntressBuffULTIMATE"); public static bool isScepterLoaded = Tools.isLoaded("com.DestroyedClone.AncientScepter"); public static bool autosprintLoaded = Tools.isLoaded("com.johnedwa.RTAutoSprintEx"); public static bool acridLungeLoaded = Tools.isLoaded("Withor.AcridBiteLunge"); public static bool ucrLoaded = Tools.isLoaded("HIFU.UltimateCustomRun"); public static string drizzleDesc = "Simplifies difficulty for players new to the game. Weeping and gnashing is replaced by laughter and tickles.<style=cStack>\n\n>Player Health Regeneration: <style=cIsHealing>+50%</style> \n>Difficulty Scaling: <style=cIsHealing>-50%</style> \n>Player Damage Reduction: <style=cIsHealing>+38%</style>"; public static string rainstormDesc = "This is the way the game is meant to be played! Test your abilities and skills against formidable foes.<style=cStack>\n\n>Player Health Regeneration: +0% \n>Difficulty Scaling: +0% "; public static string monsoonDesc = "For hardcore players. Every bend introduces pain and horrors of the planet. You will die.<style=cStack>\n\n>Player Health Regeneration: <style=cIsHealth>-40%</style> \n>Difficulty Scaling: <style=cIsHealth>+50%</style>"; public static GameObject meatballNapalmPool; public static PluginInfo PInfo { get; private set; } public static string dropPrefabsPath => Assets.dropPrefabsPath; public static string iconsPath => Assets.iconsPath; public static string eliteMaterialsPath => Assets.eliteMaterialsPath; internal static ConfigFile CustomConfigFile { get; set; } public static ConfigEntry<bool> EnableConfig { get; set; } public static void DoSacrificeDropLimit() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown SacrificeArtifactManager.OnServerCharacterDeath += new Manipulator(DropLimitForSacrifice); GlobalEventManager.OnCharacterDeath += new Manipulator(DropLimitForSonorous); Stage.onServerStageBegin += ResetServerDropCount; LanguageAPI.Add("ITEM_ITEMDROPCHANCEONKILL_DESC", "On killing a large monster, it will <style=cIsDamage>always</style> drop an item. " + $"Elite monsters have a <style=cIsUtility>{sonorousDropRateBase}%</style> chance of " + $"dropping an item <style=cStack>(+{sonorousDropRateStack}% per stack)</style>."); } public static int GetDropCountForSacrifice() { if (!Object.op_Implicit((Object)(object)Run.instance)) { return 0; } if (UsingRestrictedSacrifice()) { return sacrificeDropCountRestricted * Run.instance.participatingPlayerCount; } return sacrificeDropCount * Run.instance.participatingPlayerCount; } public static int GetDropCountForSonorous() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Run.instance)) { return 0; } int itemCountForTeam = Util.GetItemCountForTeam((TeamIndex)1, Items.ItemDropChanceOnKill.itemIndex, false, true); if (UsingRestrictedSacrifice()) { return sonorousDropCountRestrictedBase + sonorousDropCountRestrictedStack * (itemCountForTeam - 1); } return sonorousDropCountBase + sonorousDropCountStack * (itemCountForTeam - 1); } internal static bool UsingRestrictedSacrifice() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 return (int)Stage.instance.sceneDef.sceneType == 2 || (int)Stage.instance.sceneDef.sceneType == 5; } private static void ResetServerDropCount(Stage obj) { serverSacrificeDropTally = 0; serverSonorousDropTally = 0; } private static void DropLimitForSacrifice(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); FixSacrificeDropChance(val); val.Index = 0; AddSacrificeDropTally(val); } private static void FixSacrificeDropChance(ILCursor c) { float num = default(float); if (!c.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, "RoR2.Util", "GetExpAdjustedDropChancePercent") }) || !c.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num) })) { DebugBreakpoint("FixSacrificeDropChance"); return; } c.EmitDelegate<Func<float, float>>((Func<float, float>)((float _) => (serverSacrificeDropTally >= GetDropCountForSacrifice() && !Util.CheckRoll(sacrificeDropRateLimited, 0f, (CharacterMaster)null)) ? 0f : sacrificeDropRate)); } private static void AddSacrificeDropTally(ILCursor c) { if (!c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreatePickupDroplet") })) { DebugBreakpoint("AddSacrificeDropTally"); return; } c.EmitDelegate<Action>((Action)delegate { serverSacrificeDropTally++; }); } private static void DropLimitForSonorous(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown ILCursor val = new ILCursor(il); ILLabel val2 = val.DefineLabel(); int masterLoc = 17; int itemCountLoc = 102; if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.DLC2Content/Items", "ItemDropChanceOnKill") }) || !val.TryGotoPrev((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref masterLoc) }) || !val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") })) { DebugBreakpoint("DropLimitForSonorous", 1); return; } SonorousUseTeamItemCount(val, masterLoc); if (!val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref itemCountLoc) })) { DebugBreakpoint("DropLimitForSonorous", 2); return; } val2 = val.MarkLabel(); FixSonorousDropChance(val, itemCountLoc, masterLoc); val.GotoLabel(val2, (MoveType)1, false); AddSonorousDropTally(val, itemCountLoc); } private static void SonorousUseTeamItemCount(ILCursor c, int masterLoc) { DoTheRoar(); if (!c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") })) { DebugBreakpoint("SonorousUseTeamItemCount"); } else { DoTheRoar(); } void DoTheRoar() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) c.Emit(OpCodes.Ldloc, masterLoc); c.EmitDelegate<Func<int, CharacterMaster, int>>((Func<int, CharacterMaster, int>)((int oldItemCount, CharacterMaster master) => Util.GetItemCountForTeam(master.teamIndex, Items.ItemDropChanceOnKill.itemIndex, true, true))); } } private static void FixSonorousDropChance(ILCursor c, int itemCountLoc, int masterLoc) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!c.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_isElite") }) || !c.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, itemCountLoc) }) || !c.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, masterLoc) })) { DebugBreakpoint("FixSonorousDropChance"); return; } c.Emit(OpCodes.Ldloc, itemCountLoc); c.EmitDelegate<Func<float, int, float>>((Func<float, int, float>)((float chanceIn, int stack) => (serverSonorousDropTally >= GetDropCountForSacrifice() && !Util.CheckRoll(sonorousDropRateLimited, 0f, (CharacterMaster)null)) ? 0f : (sonorousDropRateBase + sonorousDropRateStack * (float)(stack - 1)))); } private static void AddSonorousDropTally(ILCursor c, int itemCountLoc) { if (!c.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_isElite") }) || !c.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, itemCountLoc) }) || !c.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<PickupDropletController>(x, "CreatePickupDroplet") })) { DebugBreakpoint("AddSonorousDropTally"); return; } c.EmitDelegate<Action>((Action)delegate { serverSonorousDropTally++; }); } private void ReworkShatterspleen() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Expected O, but got Unknown impBleedSpikePrefab = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/ImpVoidspikeProjectile"), "ShatterspleenBleedSpike", true); ProjectileController component = impBleedSpikePrefab.GetComponent<ProjectileController>(); component.procCoefficient = 1f; ProjectileImpactExplosion component2 = impBleedSpikePrefab.GetComponent<ProjectileImpactExplosion>(); ((ProjectileExplosion)component2).blastRadius = 4f; Rigidbody component3 = impBleedSpikePrefab.GetComponent<Rigidbody>(); component3.useGravity = true; AntiGravityForce val = impBleedSpikePrefab.AddComponent<AntiGravityForce>(); val.antiGravityCoefficient = -1f; val.rb = component3; ProjectileDirectionalTargetFinder val2 = impBleedSpikePrefab.AddComponent<ProjectileDirectionalTargetFinder>(); ((Behaviour)val2).enabled = true; val2.lookRange = 50f; val2.lookCone = 10f; ProjectileSteerTowardTarget val3 = impBleedSpikePrefab.AddComponent<ProjectileSteerTowardTarget>(); val3.yAxisOnly = false; val3.rotationSpeed = 50f; Assets.projectilePrefabs.Add(impBleedSpikePrefab); GlobalEventManager.ProcessHitEnemy += new Manipulator(RevokeShatterspleenBleedRights); GlobalEventManager.OnCharacterDeath += new Manipulator(RevokeShatterspleenDeathRights); RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RemoveShatterspleenCrit); CharacterBody.RecalculateStats += new hook_RecalculateStats(ShatterspleenBleedChance); GlobalEventManager.ProcessHitEnemy += new hook_ProcessHitEnemy(NewShatterspleenFunctionality); CharacterBody.RemoveBuff_BuffIndex += new hook_RemoveBuff_BuffIndex(FireShatterspleenBleedSpike); LanguageAPI.Add("ITEM_BLEEDONHITANDEXPLODE_PICKUP", "Massive hits charge a volley of bleed spikes."); LanguageAPI.Add("ITEM_BLEEDONHITANDEXPLODE_DESC", $"Gain {shatterspleenBleedChance}% bleed chance. " + "Hits that deal <style=cIsDamage>more than " + Tools.ConvertDecimal(minDamageCoefficient) + " damage</style> also " + $"charge {minSpikes}-{maxSpikes} volleys of " + $"{baseSpikesPerBuff} void spikes (+{stackSpikesPerBuff} per stack). " + $"These spikes release {releaseSpeed} seconds at a time, " + "dealing " + Tools.ConvertDecimal(spikeDamageCoefficient) + " BASE damage and bleeding enemies hit for " + Tools.ConvertDecimal(2.4f * spikeProcCoefficient) + " base damage."); } private void ShatterspleenBleedChance(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); Inventory inventory = self.inventory; if (inventory != null && inventory.GetItemCountEffective(Items.BleedOnHitAndExplode) > 0) { self.bleedChance += (float)shatterspleenBleedChance; } } private void RemoveShatterspleenCrit(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { Inventory inventory = sender.inventory; if (inventory.GetItemCountEffective(Items.BleedOnHitAndExplode) > 0) { args.critAdd -= 5f; } } } private void FireShatterspleenBleedSpike(orig_RemoveBuff_BuffIndex orig, CharacterBody self, BuffIndex buffType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_006e: 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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (buffType == Assets.shatterspleenSpikeBuff.buffIndex) { int itemCountEffective = self.inventory.GetItemCountEffective(Items.BleedOnHitAndExplode); if (itemCountEffective > 0) { Util.PlaySound(FireVoidspikes.attackSoundString, ((Component)self).gameObject); EffectManager.SimpleMuzzleFlash(FireVoidspikes.swipeEffectPrefab, ((Component)self).gameObject, "Head", false); Ray val = default(Ray); ((Ray)(ref val))..ctor(self.inputBank.aimOrigin, self.inputBank.aimDirection); int num = baseSpikesPerBuff + stackSpikesPerBuff * (itemCountEffective - 1); Debug.Log((object)num); for (int i = 0; i < num; i++) { float num2 = 0f; float num3 = FireVoidspikes.projectileSpeed * 0.3f * (float)(i + 1); Vector3 val2 = Util.ApplySpread(((Ray)(ref val)).direction, 0f, 0f, 1f, 1f, num2, 0f); ProjectileManager.instance.FireProjectile(impBleedSpikePrefab, ((Ray)(ref val)).origin, Util.QuaternionSafeLookRotation(val2), ((Component)self).gameObject, self.damage * spikeDamageCoefficient, 0f, Util.CheckRoll(self.crit, self.master), (DamageColorIndex)0, (GameObject)null, num3, (DamageTypeCombo?)null); } } } orig.Invoke(self, buffType); } private void NewShatterspleenFunctionality(orig_ProcessHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)damageInfo.attacker) && damageInfo.procCoefficient > 0f && !((ProcChainMask)(ref damageInfo.procChainMask)).HasProc((ProcType)5)) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = victim.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component)) { int num = 0; Inventory inventory = component.inventory; if (Object.op_Implicit((Object)(object)inventory)) { num = inventory.GetItemCountEffective(Items.BleedOnHitAndExplode); if ((Object)(object)component2 != (Object)null && num > 0) { int num2 = Random.Range(minSpikes, maxSpikes + 1); int buffCount = component.GetBuffCount(Assets.shatterspleenSpikeBuff); if (damageInfo.damage / component.damage >= minDamageCoefficient && num2 > buffCount) { ((ProcChainMask)(ref damageInfo.procChainMask)).AddProc((ProcType)5); for (int i = buffCount; i < num2; i++) { component.AddTimedBuffAuthority(Assets.shatterspleenSpikeBuff.buffIndex, releaseSpeed * (float)(i + 1)); } } } } } } orig.Invoke(self, damageInfo, victim); } private void RevokeShatterspleenBleedRights(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "BleedOnHitAndExplode"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); val.Emit(OpCodes.Ldc_I4, 0); val.Emit(OpCodes.Mul); } private void RevokeShatterspleenDeathRights(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_005b: 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) ILCursor val = new ILCursor(il); val.GotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, "RoR2.RoR2Content/Items", "BleedOnHitAndExplode"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective") }); val.Emit(OpCodes.Ldc_I4, 0); val.Emit(OpCodes.Mul); } private bool IsCategoryEnabled(bool category) { return category; } private void Awake() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown PInfo = ((BaseUnityPlugin)this).Info; InitializeCoreModules(); InitializeConfig(); InitializeEverything(); CharacterBody.RemoveBuff_BuffDef += new hook_RemoveBuff_BuffDef(Gah); SaveConfig(); new ContentPacks().Initialize(); } public static void DebugBreakpoint(string methodName, int breakpointNumber = -1) { string text = "RiskierRain: " + methodName + " IL hook failed!"; if (breakpointNumber >= 0) { text += $" (breakpoint {breakpointNumber})"; } Debug.LogError((object)text); } private void Gah(orig_RemoveBuff_BuffDef orig, CharacterBody self, BuffDef buffType) { if (!NetworkServer.active) { Debug.Log((object)((Object)buffType).name); } orig.Invoke(self, buffType); } private void InitializeEverything() { ItemChanges.Initialize(); EquipmentChanges.Initialize(); DifficultyChanges.Initialize(); EnemyChanges.Initialize(); InteractableChanges.Initialize(); DoSacrificeDropLimit(); LanguageAPI.Add("DIFFICULTY_EASY_DESCRIPTION", drizzleDesc + "</style>"); LanguageAPI.Add("DIFFICULTY_NORMAL_DESCRIPTION", rainstormDesc + "</style>"); LanguageAPI.Add("DIFFICULTY_HARD_DESCRIPTION", monsoonDesc + "</style>"); } public static AssetReferenceT<T> LoadAsync<T>(string guid, Action<T> callback) where T : Object { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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) AssetReferenceT<T> val = new AssetReferenceT<T>(guid); AsyncOperationHandle<T> handle2 = AssetAsyncReferenceManager<T>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); if (callback == null) { return val; } if (handle2.IsDone) { onCompleted(handle2); return val; } handle2.Completed += onCompleted; return val; void onCompleted(AsyncOperationHandle<T> handle) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 if (handle.Result == null || (int)handle.Status != 1) { Debug.LogError((object)$"Failed to load asset [{handle.DebugName}] : {handle.OperationException}"); } else { callback(handle.Result); } } } public static void RetierItemAsync(string itemGuid, ItemTier tier = 5, Action<ItemDef> callback = null) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) AssetReferenceT<ItemDef> val = new AssetReferenceT<ItemDef>(itemGuid); AsyncOperationHandle<ItemDef> val2 = AssetAsyncReferenceManager<ItemDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<ItemDef> ctx) { //IL_000b: 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) //IL_001d: Unknown result type (might be due to invalid IL or missing references) ItemDef result = ctx.Result; result.tier = tier; result.deprecatedTier = tier; if (callback != null) { callback(result); } }; } public static void RemoveEquipmentAsync(string equipmentGuid, Action<EquipmentDef> callback = null) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT<EquipmentDef> val = new AssetReferenceT<EquipmentDef>(equipmentGuid); AsyncOperationHandle<EquipmentDef> val2 = AssetAsyncReferenceManager<EquipmentDef>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<EquipmentDef> ctx) { EquipmentDef result = ctx.Result; result.canDrop = false; result.canBeRandomlyTriggered = false; result.enigmaCompatible = false; result.dropOnDeathChance = 0f; if (callback != null) { callback(result); } }; } public static void ChangeEquipmentEnigma(string equipName, bool canEnigma) { EquipmentDef val = LoadEquipDef(equipName); if ((Object)(object)val != (Object)null) { val.enigmaCompatible = canEnigma; } } public static void ChangeBuffStacking(string buffName, bool canStack) { BuffDef val = LoadBuffDef(buffName); if ((Object)(object)val != (Object)null) { val.canStack = canStack; } } public static ItemDef LoadItemDef(string name) { return LegacyResourcesAPI.Load<ItemDef>("ItemDefs/" + name); } public static EquipmentDef LoadEquipDef(string name) { return LegacyResourcesAPI.Load<EquipmentDef>("EquipmentDefs/" + name); } public static BuffDef LoadBuffDef(string name) { return LegacyResourcesAPI.Load<BuffDef>("BuffDefs/" + name); } public static void CreateMeatballNapalm() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0059: Expected O, but got Unknown //IL_005f: 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_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) meatballNapalmPool = PrefabAPI.InstantiateClone(LegacyResourcesAPI.Load<GameObject>("prefabs/projectiles/beetlequeenacid"), "NapalmFire", true); Color val = Color32.op_Implicit(new Color32(byte.MaxValue, (byte)120, (byte)0, byte.MaxValue)); Transform val2 = meatballNapalmPool.transform.Find("FX/Decal"); Material val3 = new Material(((Component)val2).GetComponent<Decal>().Material); val3.SetColor("_Color", val); ((Component)val2).GetComponent<Decal>().Material = val3; ProjectileDotZone component = meatballNapalmPool.GetComponent<ProjectileDotZone>(); component.lifetime = 5f; component.fireFrequency = 2f; component.damageCoefficient = 0.5f; component.overlapProcCoefficient = 0.5f; component.attackerFiltering = (AttackerFiltering)0; meatballNapalmPool.GetComponent<ProjectileDamage>().damageType = DamageTypeCombo.op_Implicit((DamageType)128); meatballNapalmPool.GetComponent<ProjectileController>().procCoefficient = 1f; float num = 2.5f; meatballNapalmPool.GetComponent<Transform>().localScale = new Vector3(num, num, num); Transform val4 = meatballNapalmPool.transform.Find("FX"); ((Component)val4.Find("Spittle")).gameObject.SetActive(false); GameObject val5 = Object.Instantiate<GameObject>(LegacyResourcesAPI.Load<GameObject>("prefabs/FireTrail").GetComponent<DamageTrail>().segmentPrefab, ((Component)val4).transform); MainModule main = val5.GetComponent<ParticleSystem>().main; ((MainModule)(ref main)).duration = 8f; ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(-0.075f); MinMaxCurve startSizeX = ((MainModule)(ref main)).startSizeX; ((MinMaxCurve)(ref startSizeX)).constantMin = ((MinMaxCurve)(ref startSizeX)).constantMin * 0.6f; ((MinMaxCurve)(ref startSizeX)).constantMax = ((MinMaxCurve)(ref startSizeX)).constantMax * 0.8f; MinMaxCurve startSizeY = ((MainModule)(ref main)).startSizeY; ((MinMaxCurve)(ref startSizeY)).constantMin = ((MinMaxCurve)(ref startSizeY)).constantMin * 0.8f; ((MinMaxCurve)(ref startSizeY)).constantMax = ((MinMaxCurve)(ref startSizeY)).constantMax * 1f; MinMaxCurve startSizeZ = ((MainModule)(ref main)).startSizeZ; ((MinMaxCurve)(ref startSizeZ)).constantMin = ((MinMaxCurve)(ref startSizeZ)).constantMin * 0.6f; ((MinMaxCurve)(ref startSizeZ)).constantMax = ((MinMaxCurve)(ref startSizeZ)).constantMax * 0.8f; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; ((MinMaxCurve)(ref startLifetime)).constantMin = 0.9f; ((MinMaxCurve)(ref startLifetime)).constantMax = 1.1f; ((Behaviour)val5.GetComponent<DestroyOnTimer>()).enabled = false; val5.transform.localPosition = Vector3.zero; val5.transform.localPosition = Vector3.zero; val5.transform.localScale = Vector3.one; ShapeModule shape = val5.GetComponent<ParticleSystem>().shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)0; ((ShapeModule)(ref shape)).scale = Vector3.one * 0.5f; GameObject gameObject = ((Component)val4.Find("Point Light")).gameObject; Light component2 = gameObject.GetComponent<Light>(); component2.color = new Color(1f, 0.5f, 0f); component2.intensity = 6f; component2.range = 12f; Assets.projectilePrefabs.Add(meatballNapalmPool); } private bool GetConfigBool(bool defaultValue, string packetTitle, string desc = "") { if (desc != "") { return CustomConfigFile.Bind<bool>("Packets - See README For Details.", packetTitle + " Packet", defaultValue, "The changes in this Packet will be enabled if set to true.").Value; } return CustomConfigFile.Bind<bool>("Packets", packetTitle + " Packet", defaultValue, "(The following changes will be enabled if set to true) " + desc).Value; } private void InitializeConfig() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown CustomConfigFile = new ConfigFile(Paths.ConfigPath + "\\RiskierRain.cfg", true); CustomConfigFile.SaveOnConfigSet = false; EnableConfig = CustomConfigFile.Bind<bool>("Allow Config Options", "Enable Config", false, "Set this to true to enable config options. Please keep in mind that it was not within my design intentions to play this way. This is primarily meant for modpack users with tons of mods installed. If you have any issues or feedback on my mod balance, please feel free to send in feedback with the contact info in the README or Thunderstore description."); Debug.Log((object)"Config initialized!"); } private void SaveConfig() { CustomConfigFile.SaveOnConfigSet = true; CustomConfigFile.Save(); } private void InitializeCoreModules() { IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(CoreModule)) select type; foreach (Type item in enumerable) { CoreModule coreModule = (CoreModule)Activator.CreateInstance(item); coreModule.Init(); Debug.Log((object)("Core Module: " + coreModule?.ToString() + " Initialized!")); } } } public static class Extensions { public static string AsPercent(this float d) { return d * 100f + "%"; } } public static class Tools { public static string modPrefix = string.Format("@{0}+{1}", "ArtificerExtended", "artiskillicons"); public static AssetBundle LoadAssetBundle(byte[] resourceBytes) { if (resourceBytes == null) { throw new ArgumentNullException("resourceBytes"); } return AssetBundle.LoadFromMemory(resourceBytes); } public static string GetModPrefix(this BaseUnityPlugin plugin, string bundleName) { return $"@{plugin.Info.Metadata.Name}+{bundleName}"; } internal static bool isLoaded(string modguid) { foreach (KeyValuePair<string, PluginInfo> pluginInfo in Chainloader.PluginInfos) { string key = pluginInfo.Key; PluginInfo value = pluginInfo.Value; if (key == modguid) { return true; } } return false; } internal static string ConvertDecimal(float d) { return d.AsPercent(); } internal static void GetMaterial(GameObject model, string childObject, Color color, ref Material material, float scaleMultiplier = 1f, bool replaceAll = false) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_0092: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; if (string.Equals(((Object)val).name, childObject)) { if (color == Color.clear) { Object.Destroy((Object)(object)val); break; } if ((Object)(object)material == (Object)null) { material = new Material(val.material); material.mainTexture = val.material.mainTexture; material.shader = val.material.shader; material.color = color; } val.material = material; Transform transform = ((Component)val).transform; transform.localScale *= scaleMultiplier; if (!replaceAll) { break; } } } } internal static void DebugMaterial(GameObject model) { Renderer[] componentsInChildren = model.GetComponentsInChildren<Renderer>(); Renderer[] array = componentsInChildren; foreach (Renderer val in array) { Renderer val2 = val; Debug.Log((object)("Material: " + ((Object)val2).name.ToString())); } } internal static void GetParticle(GameObject model, string childObject, Color color, float sizeMultiplier = 1f, bool replaceAll = false) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) ParticleSystem[] componentsInChildren = model.GetComponentsInChildren<ParticleSystem>(); ParticleSystem[] array = componentsInChildren; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; MainModule main = val2.main; ColorOverLifetimeModule colorOverLifetime = val2.colorOverLifetime; ColorBySpeedModule colorBySpeed = val2.colorBySpeed; if (string.Equals(((Object)val2).name, childObject)) { ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); ((MainModule)(ref main)).startSizeMultiplier = ((MainModule)(ref main)).startSizeMultiplier * sizeMultiplier; ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(color); ((ColorBySpeedModule)(ref colorBySpeed)).color = MinMaxGradient.op_Implicit(color); if (!replaceAll) { break; } } } } internal static void DebugParticleSystem(GameObject model) { ParticleSystem[] components = model.GetComponents<ParticleSystem>(); ParticleSystem[] array = components; foreach (ParticleSystem val in array) { ParticleSystem val2 = val; Debug.Log((object)("Particle: " + ((Object)val2).name.ToString())); } } internal static void GetLight(GameObject model, string childObject, Color color, bool replaceAll = false) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) Light[] componentsInChildren = model.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; if (string.Equals(((Object)val2).name, childObject)) { val2.color = color; if (!replaceAll) { break; } } } } internal static void DebugLight(GameObject model) { Light[] componentsInChildren = model.GetComponentsInChildren<Light>(); Light[] array = componentsInChildren; foreach (Light val in array) { Light val2 = val; Debug.Log((object)("Light: " + ((Object)val2).name.ToString())); } } public static void ClearDotStacksForType(this DotController dotController, DotIndex dotIndex) { //IL_001e: 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) for (int num = dotController.dotStackList.Count - 1; num >= 0; num--) { if (dotController.dotStackList[num].dotIndex == dotIndex) { dotController.RemoveDotStackAtServer(num); } } } public static void LoadCharacterBodyAsync(string guid, Action<CharacterBody> callback) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) AssetReferenceT<GameObject> val = new AssetReferenceT<GameObject>(guid); AsyncOperationHandle<GameObject> val2 = AssetAsyncReferenceManager<GameObject>.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle<GameObject> ctx) { GameObject result = ctx.Result; CharacterBody obj = default(CharacterBody); if (!((Object)(object)result == (Object)null) && result.TryGetComponent<CharacterBody>(ref obj)) { callback(obj); } }; } } } namespace RiskierRain.CoreModules { public class Assets : CoreModule { public static AssetBundle _retierAssetBundle; public static string dropPrefabsPath = "Assets/Models/DropPrefabs"; public static string iconsPath = "Assets/Textures/Icons/"; public static string eliteMaterialsPath = "Assets/Textures/Materials/Elite/"; public static List<ArtifactDef> artifactDefs = new List<ArtifactDef>(); public static List<BuffDef> buffDefs = new List<BuffDef>(); public static List<EffectDef> effectDefs = new List<EffectDef>(); public static List<SkillFamily> skillFamilies = new List<SkillFamily>(); public static List<SkillDef> skillDefs = new List<SkillDef>(); public static List<GameObject> projectilePrefabs = new List<GameObject>(); public static List<GameObject> networkedObjectPrefabs = new List<GameObject>(); public static List<Type> entityStates = new List<Type>(); public static List<ItemDef> itemDefs = new List<ItemDef>(); public static List<EquipmentDef> equipDefs = new List<EquipmentDef>(); public static List<EliteDef> eliteDefs = new List<EliteDef>(); public static List<GameObject> masterPrefabs = new List<GameObject>(); public static List<GameObject> bodyPrefabs = new List<GameObject>(); public static string shredKeywordToken = "DUCK_SHRED_KEYWORD"; public static BuffDef soulShrineLuckBuff; public static BuffDef voidCradleCurse; public static BuffDef shockMarker; public static int shockMarkerDuration = 4; public static BuffDef shockHealCooldown; public static float survivorExecuteThreshold = 0.15f; public static float banditExecutionThreshold = 0.1f; public static float harvestExecutionThreshold = 0.2f; public static BuffDef shatterspleenSpikeBuff; public static BuffDef noRazorwire; public static AssetBundle retierAssetBundle { get { if ((Object)(object)_retierAssetBundle == (Object)null) { _retierAssetBundle = AssetBundle.LoadFromFile(GetAssetBundlePath("retier2")); } return _retierAssetBundle; } set { _retierAssetBundle = value; } } public static List<Material> MaterialsWithSwappedShaders { get; } = new List<Material>(); public static string GetAssetBundlePath(string bundleName) { return Path.Combine(Path.GetDirectoryName(RiskierRainPlugin.PInfo.Location), bundleName); } public static bool RegisterEntityState(Type entityState) { if (entityStates.Contains(entityState) || !entityState.IsSubclassOf(typeof(EntityState)) || entityState.IsAbstract) { return false; } entityStates.Add(entityState); return true; } public static EffectDef CreateEffect(GameObject effect) { //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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown if ((Object)(object)effect == (Object)null) { Debug.LogError((object)"Effect prefab was null"); return null; } EffectComponent component = effect.GetComponent<EffectComponent>(); if ((Object)(object)component == (Object)null) { Debug.LogErrorFormat("Effect prefab: \"{0}\" does not have an EffectComponent.", new object[1] { ((Object)effect).name }); return null; } VFXAttributes component2 = effect.GetComponent<VFXAttributes>(); if ((Object)(object)component2 == (Object)null) { Debug.LogErrorFormat("Effect prefab: \"{0}\" does not have a VFXAttributes component.", new object[1] { ((Object)effect).name }); return null; } EffectDef val = new EffectDef { prefab = effect, prefabEffectComponent = component, prefabVfxAttributes = component2, prefabName = ((Object)effect).name, spawnSoundEventName = component.soundName }; effectDefs.Add(val); return val; } public override void Init() { AddShatterspleenSpikeBuff(); AddRazorwireCooldown(); AddVoidCradleCurse(); AddShockDebuff(); AddShockCooldown(); AddSoulShrineLuckBuff(); } private void AddSoulShrineLuckBuff() { //IL_0006: 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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) //IL_009c: Expected O, but got Unknown BuffDef val = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/DLC2/bdExtraLifeBuff.asset").WaitForCompletion(); soulShrineLuckBuff = ScriptableObject.CreateInstance<BuffDef>(); soulShrineLuckBuff.buffColor = val.buffColor; soulShrineLuckBuff.canStack = true; soulShrineLuckBuff.isDebuff = val.isDebuff; soulShrineLuckBuff.flags = val.flags; ((Object)soulShrineLuckBuff).name = "bdExtraLuckBuff"; soulShrineLuckBuff.iconSprite = val.iconSprite; buffDefs.Add(soulShrineLuckBuff); StatHooks.GetMoreStatCoefficients += new MoreStatHookEventHandler(SoulShrineLuck); } private void SoulShrineLuck(CharacterBody sender, MoreStatHookEventArgs args) { int buffCount = sender.GetBuffCount(soulShrineLuckBuff); if (buffCount > 0) { args.luckAdd += (float)(buffCount * InteractableChanges.soulShrineLuckIncrease); } } private void AddVoidCradleCurse() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) voidCradleCurse = ScriptableObject.CreateInstance<BuffDef>(); voidCradleCurse.buffColor = Color.black; voidCradleCurse.canStack = false; voidCradleCurse.isDebuff = false; ((Object)voidCradleCurse).name = "VoidCradleCurse"; voidCradleCurse.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/texBuffVoidFog.tif").WaitForCompletion(); buffDefs.Add(voidCradleCurse); } private void AddShockDebuff() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) shockMarker = ScriptableObject.CreateInstance<BuffDef>(); ((Object)shockMarker).name = "Shock"; shockMarker.buffColor = new Color(0f, 0f, 0.6f); shockMarker.canStack = false; shockMarker.isDebuff = true; BuffDef obj = shockMarker; obj.flags = (Flags)(obj.flags | 1); shockMarker.isHidden = true; shockMarker.iconSprite = null; buffDefs.Add(shockMarker); } private void AddShockCooldown() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) shockHealCooldown = ScriptableObject.CreateInstance<BuffDef>(); ((Object)shockHealCooldown).name = "Shock"; shockHealCooldown.buffColor = new Color(0f, 0f, 0.6f); shockHealCooldown.canStack = true; shockHealCooldown.isDebuff = false; shockHealCooldown.isCooldown = true; shockHealCooldown.iconSprite = null; buffDefs.Add(shockHealCooldown); } private void AddShatterspleenSpikeBuff() { //IL_0024: 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_005e: 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) shatterspleenSpikeBuff = ScriptableObject.CreateInstance<BuffDef>(); shatterspleenSpikeBuff.buffColor = new Color(0.7f, 0f, 0.2f, 1f); shatterspleenSpikeBuff.canStack = true; shatterspleenSpikeBuff.isDebuff = false; ((Object)shatterspleenSpikeBuff).name = "ShatterspleenSpikeCharge"; shatterspleenSpikeBuff.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/LunarSkillReplacements/texBuffLunarDetonatorIcon.tif").WaitForCompletion(); buffDefs.Add(shatterspleenSpikeBuff); } private void AddRazorwireCooldown() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) noRazorwire = ScriptableObject.CreateInstance<BuffDef>(); noRazorwire.buffColor = Color.black; noRazorwire.canStack = false; noRazorwire.isDebuff = true; BuffDef obj = noRazorwire; obj.flags = (Flags)(obj.flags | 1); ((Object)noRazorwire).name = "NoRazorwire"; noRazorwire.iconSprite = null; buffDefs.Add(noRazorwire); } public static void SwapShadersFromMaterialsInBundle(AssetBundle bundle) { if (bundle.isStreamedSceneAssetBundle) { Debug.LogWarning((object)"Cannot swap material shaders from a streamed scene assetbundle."); return; } Material[] array = (from mat in bundle.LoadAllAssets<Material>() where ((Object)mat.shader).name.StartsWith("Stubbed") select mat).ToArray(); foreach (Material val in array) { if (!((Object)val.shader).name.StartsWith("Stubbed")) { Debug.LogWarning((object)$"The material {val} has a shader which's name doesnt start with \"Stubbed\" ({((Object)val.shader).name}), this is not allowed for stubbed shaders for MSU. not swapping shader."); continue; } try { SwapShader(val); } catch (Exception arg) { Debug.LogError((object)$"Failed to swap shader of material {val}: {arg}"); } } } private static void SwapShader(Material material) { //IL_0029: 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) string text = ((Object)material.shader).name.Substring("Stubbed".Length); string text2 = text + ".shader"; Shader shader = Addressables.LoadAssetAsync<Shader>((object)text2).WaitForCompletion(); material.shader = shader; MaterialsWithSwappedShaders.Add(material); } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public string identifier => "RiskierRain"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.artifactDefs.Add(Assets.artifactDefs.ToArray()); contentPack.buffDefs.Add(Assets.buffDefs.ToArray()); contentPack.effectDefs.Add(Assets.effectDefs.ToArray()); contentPack.equipmentDefs.Add(Assets.equipDefs.ToArray()); contentPack.itemDefs.Add(Assets.itemDefs.ToArray()); contentPack.eliteDefs.Add(Assets.eliteDefs.ToArray()); contentPack.projectilePrefabs.Add(Assets.projectilePrefabs.ToArray()); contentPack.bodyPrefabs.Add(Assets.bodyPrefabs.ToArray()); contentPack.masterPrefabs.Add(Assets.masterPrefabs.ToArray()); contentPack.entityStateTypes.Add(Assets.entityStates.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public abstract class CoreModule { public abstract void Init(); } public class EliteModule : CoreModule { public class CustomEliteDef : ScriptableObject { public EliteDef eliteDef; public EliteTiers eliteTier; public Color lightColor = Color.clear; public Texture eliteRamp; public Material overlayMaterial; public GameObject spawnEffect; } public enum EliteTiers { Tier1, Tier2, Other } public static List<CustomEliteDef> Elites = new List<CustomEliteDef>(); public static Texture defaultShaderRamp = null; public override void Init() { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AddElites)); } private static void AddElites() { foreach (CustomEliteDef elite in Elites) { switch (elite.eliteTier) { case EliteTiers.Tier1: ArrayUtils.ArrayAppend<EliteDef>(ref CombatDirector.eliteTiers[1].eliteTypes, ref elite.eliteDef); ArrayUtils.ArrayAppend<EliteDef>(ref CombatDirector.eliteTiers[2].eliteTypes, ref elite.eliteDef); break; case EliteTiers.Tier2: ArrayUtils.ArrayAppend<EliteDef>(ref CombatDirector.eliteTiers[3].eliteTypes, ref elite.eliteDef); break; } } } } public class Spawnlists : CoreModule { public override void Init() { SpawnCards.Init(); } public static void AddMonsterCardToSpawnlist(DirectorCardCategorySelection categorySelection, DirectorCard directorCard, MonsterCategory monsterCategory) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected I4, but got Unknown categorySelection.AddCard((int)monsterCategory, directorCard); } } public static class SpawnCards { public static bool initialized; public static CharacterSpawnCard AlphaConstruct; public static CharacterSpawnCard Beetle; public static CharacterSpawnCard Lemurian; public static CharacterSpawnCard Larva; public static CharacterSpawnCard Wisp; public static CharacterSpawnCard Jellyfish; public static CharacterSpawnCard BlindPestSnowy; public static CharacterSpawnCard BlindVerminSnowy; public static CharacterSpawnCard Imp; public static CharacterSpawnCard Vulture; public static CharacterSpawnCard Golem; public static CharacterSpawnCard BeetleGuard; public static CharacterSpawnCard Mushrum; public static CharacterSpawnCard Bison; public static CharacterSpawnCard ClayApothecary; public static CharacterSpawnCard ElderLemurian; public static CharacterSpawnCard Parent; public static CharacterSpawnCard Gup; public static CharacterSpawnCard Bronzong; public static CharacterSpawnCard GreaterWisp; public static CharacterSpawnCard TitanBlackBeach; public static CharacterSpawnCard TitanDampCave; public static CharacterSpawnCard TitanGolemPlains; public static CharacterSpawnCard TitanGooLake; public static CharacterSpawnCard Vagrant; public static CharacterSpawnCard BeetleQueen; public static CharacterSpawnCard Dunestrider; public static CharacterSpawnCard MagmaWorm; public static CharacterSpawnCard ImpOverlord; public static CharacterSpawnCard Grovetender; public static CharacterSpawnCard RoboBall; public static CharacterSpawnCard XiConstruct; public static CharacterSpawnCard Grandparent; public static CharacterSpawnCard OverloadingWorm; public static CharacterSpawnCard solusInvalidator; public static CharacterSpawnCard solusScorcher; public static CharacterSpawnCard solusTransporter; public static CharacterSpawnCard solusExtractor; public static CharacterSpawnCard solusProspector; public static CharacterSpawnCard solusDistributor; public static CharacterSpawnCard solusAmalgamator; public static void Init() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00c0: 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_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0294: 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_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d4: Unknown result type (might be due to invalid IL or missing references) //IL_02d9: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //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) if (!initialized) { initialized = true; AlphaConstruct = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/MajorAndMinorConstruct/cscMinorConstruct.asset").WaitForCompletion(); Beetle = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscbeetle"); Lemurian = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csclemurian"); Wisp = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csclesserwisp"); Jellyfish = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscjellyfish"); Imp = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscimp"); Vulture = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscvulture"); Golem = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Golem/cscGolem.asset").WaitForCompletion(); BeetleGuard = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscbeetleguard"); Mushrum = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscminimushroom"); Bison = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Bison/cscBison.asset").WaitForCompletion(); ElderLemurian = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/LemurianBruiser/cscLemurianBruiser.asset").WaitForCompletion(); Parent = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Parent/cscParent.asset").WaitForCompletion(); Gup = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/Gup/cscGupBody.asset").WaitForCompletion(); Bronzong = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscbell"); GreaterWisp = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscgreaterwisp"); TitanBlackBeach = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csctitanblackbeach"); TitanDampCave = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csctitandampcave"); TitanGolemPlains = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csctitangolemplains"); TitanGooLake = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/csctitangoolake"); Vagrant = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscvagrant"); BeetleQueen = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscbeetlequeen"); Dunestrider = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscclayboss"); MagmaWorm = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscmagmaworm"); ImpOverlord = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscimpboss"); Grovetender = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscgravekeeper"); RoboBall = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscroboballboss"); Grandparent = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Grandparent/cscGrandparent.asset").WaitForCompletion(); OverloadingWorm = LegacyResourcesAPI.Load<CharacterSpawnCard>("spawncards/characterspawncards/cscelectricworm"); BlindVerminSnowy = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/Vermin/cscVerminSnowy.asset").WaitForCompletion(); BlindPestSnowy = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/FlyingVermin/cscFlyingVerminSnowy.asset").WaitForCompletion(); ClayApothecary = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/ClayGrenadier/cscClayGrenadier.asset").WaitForCompletion(); Larva = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/AcidLarva/cscAcidLarva.asset").WaitForCompletion(); XiConstruct = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC1/MajorAndMinorConstruct/cscMegaConstruct.asset").WaitForCompletion(); solusDistributor = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/MinePod/cscMinePod.asset").WaitForCompletion(); solusExtractor = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/ExtractorUnit/cscExtractorUnit.asset ").WaitForCompletion(); solusInvalidator = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/DefectiveUnit/cscDefectiveUnit.asset").WaitForCompletion(); solusProspector = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/WorkerUnit/cscWorkerUnit.asset").WaitForCompletion(); solusScorcher = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/Tanker/cscTanker.asset").WaitForCompletion(); solusTransporter = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/IronHauler/cscIronHauler.asset").WaitForCompletion(); solusAmalgamator = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/SolusAmalgamator/cscSolusAmalgamator.asset").WaitForCompletion(); DirectorCards.Init(); } } } public static class DirectorCards { public static bool initialized; public static DirectorCard AlphaConstruct; public static DirectorCard AlphaConstructNear; public static DirectorCard Beetle; public static DirectorCard Lemurian; public static DirectorCard Larva; public static DirectorCard Wisp; public static DirectorCard Jellyfish; public static DirectorCard BlindPestSnowy; public static DirectorCard BlindVerminSnowy; public static DirectorCard Imp; public static DirectorCard Vulture; public static DirectorCard Golem; public static DirectorCard BeetleGuard; public static DirectorCard Mushrum; public static DirectorCard ClayApothecary; public static DirectorCard Bison; public static DirectorCard BisonLoop; public static DirectorCard ElderLemurian; public static DirectorCard Parent; public static DirectorCard Gup; public static DirectorCard Bronzong; public static DirectorCard GreaterWisp; public static DirectorCard TitanBlackBeach; public static DirectorCard TitanDampCave; public static DirectorCard TitanGolemPlains; public static DirectorCard TitanGooLake; public static DirectorCard Vagrant; public static DirectorCard BeetleQueen; public static DirectorCard Dunestrider; public static DirectorCard MagmaWorm; public static DirectorCard ImpOverlord; public static DirectorCard Grovetender; public static DirectorCard RoboBall; public static DirectorCard Grandparent; public static DirectorCard OverloadingWorm; public static DirectorCard XiConstruct; public static DirectorCard LunarGolemSkyMeadow; public static DirectorCard LunarGolemSkyMeadowBasic; public static DirectorCard SolusInvalidator; public static DirectorCard SolusScorcher; public static DirectorCard SolusTransporter; public static DirectorCard SolusExtractor; public static DirectorCard SolusProspector; public static DirectorCard SolusDistributor; public static DirectorCard SolusAmalgamator; public static bool logCardInfo; public static void Init() { if (!initialized) { initialized = true; AlphaConstruct = BuildDirectorCard(SpawnCards.AlphaConstruct, 1, 1, (MonsterSpawnDistance)0); AlphaConstructNear = BuildDirectorCard(SpawnCards.AlphaConstruct, 1, 1, (MonsterSpawnDistance)1); Beetle = BuildDirectorCard(SpawnCards.Beetle); Lemurian = BuildDirectorCard(SpawnCards.Lemurian); Larva = BuildDirectorCard(SpawnCards.Larva); Wisp = BuildDirectorCard(SpawnCards.Wisp); Jellyfish = BuildDirectorCard(SpawnCards.Jellyfish, 1, 0, (MonsterSpawnDistance)2); BlindPestSnowy = BuildDirectorCard(SpawnCards.BlindPestSnowy); BlindVerminSnowy = BuildDirectorCard(SpawnCards.BlindVerminSnowy); Imp = BuildDirectorCard(SpawnCards.Imp); Vulture = BuildDirectorCard(SpawnCards.Vulture, 1, 3, (MonsterSpawnDistance)0); Golem = BuildDirectorCard(SpawnCards.Golem); BeetleGuard = BuildDirectorCard(SpawnCards.BeetleGuard); Mushrum = BuildDirectorCard(SpawnCards.Mushrum); ClayApothecary = BuildDirectorCard(SpawnCards.ClayApothecary); Bison = BuildDirectorCard(SpawnCards.Bison, 1, 2, (MonsterSpawnDistance)0); Bronzong = BuildDirectorCard(SpawnCards.Bronzong); GreaterWisp = BuildDirectorCard(SpawnCards.GreaterWisp); ElderLemurian = BuildDirectorCard(SpawnCards.ElderLemurian, 1, 3, (MonsterSpawnDistance)0); Parent = BuildDirectorCard(SpawnCards.Parent, 1, 3, (MonsterSpawnDistance)0); Gup = BuildDirectorCard(SpawnCards.Gup, 1, 3, (MonsterSpawnDistance)0); TitanBlackBeach = BuildDirectorCard(SpawnCards.TitanBlackBeach); TitanDampCave = BuildDirectorCard(SpawnCards.TitanDampCave); TitanGolemPlains = BuildDirectorCard(SpawnCards.TitanGolemPlains); TitanGooLake = BuildDirectorCard(SpawnCards.TitanGooLake); Vagrant = BuildDirectorCard(SpawnCards.Vagrant); BeetleQueen = BuildDirectorCard(SpawnCards.BeetleQueen); Dunestrider = BuildDirectorCard(SpawnCards.Dunestrider); ImpOverlord = BuildDirectorCard(SpawnCards.ImpOverlord, 1, 1, (MonsterSpawnDistance)0); Grovetender = BuildDirectorCard(SpawnCards.Grovetender); RoboBall = BuildDirectorCard(SpawnCards.RoboBall, 1, 3, (MonsterSpawnDistance)0); MagmaWorm = BuildDirectorCard(SpawnCards.MagmaWorm, 1, 2, (MonsterSpawnDistance)0); Grandparent = BuildDirectorCard(SpawnCards.Grandparent, 1, 2, (MonsterSpawnDistance)0); OverloadingWorm = BuildDirectorCard(SpawnCards.OverloadingWorm); XiConstruct = BuildDirectorCard(SpawnCards.XiConstruct, 1, 2, (MonsterSpawnDistance)0); SolusInvalidator = BuildDirectorCard(SpawnCards.solusInvalidator); SolusScorcher = BuildDirectorCard(SpawnCards.solusScorcher); SolusTransporter = BuildDirectorCard(SpawnCards.solusTransporter); SolusExtractor = BuildDirectorCard(SpawnCards.solusExtractor); SolusProspector = BuildDirectorCard(SpawnCards.solusProspector); SolusDistributor = BuildDirectorCard(SpawnCards.solusDistributor); SolusAmalgamator = BuildDirectorCard(SpawnCards.solusAmalgamator); } } public static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard) { return BuildDirectorCard(spawnCard, 1, 0, (MonsterSpawnDistance)0); } public static DirectorCard BuildDirectorCard(CharacterSpawnCard spawnCard, int weight, int minStages, MonsterSpawnDistance spawnDistance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0022: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown return new DirectorCard { spawnCard = (SpawnCard)(object)spawnCard, selectionWeight = weight, preventOverhead = false, minimumStageCompletions = minStages, spawnDistance = spawnDistance }; } public static DirectorCard BuildDirectorCard(InteractableSpawnCard spawnCard, int weight, int minStages) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0023: Expected O, but got Unknown return new DirectorCard { spawnCard = (SpawnCard)(object)spawnCard, selectionWeight = weight, preventOverhead = false, minimumStageCompletions = minStages }; } } public class StatHooks : CoreModule { public class BorboStatHookEventArgs : EventArgs { public float attackSpeedMultAdd = 1f; public float attackSpeedDivAdd = 1f; } public delegate void StatHookEventHandler(CharacterBody sender, BorboStatHookEventArgs args); public static event StatHookEventHandler BorboStatCoefficients; public static void ApplyCooldownScale(GenericSkill skillSlot, float cooldownScale) { if ((Object)(object)skillSlot != (Object)null) { skillSlot.cooldownScale *= cooldownScale; } } public override void Init() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown CharacterBody.RecalculateStats += new hook_RecalculateStats(AttackSpeedBs); } private void AttackSpeedBs(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); BorboStatHookEventArgs borboStatHookEventArgs = new BorboStatHookEventArgs(); StatHooks.BorboStatCoefficients?.Invoke(self, borboStatHookEventArgs); float num = borboStatHookEventArgs.attackSpeedMultAdd / borboStatHookEventArgs.attackSpeedDivAdd; self.attackSpeed *= num; } } } namespace RiskierRain.Components { internal class CopyInventoryFromOwner : MonoBehaviour { public Func<ItemIndex, bool> inventoryItemCopyFilter = Inventory.defaultItemCopyFilterDelegate.Invoke; public bool copyInventory = true; public bool copyEquipment = true; public void Start() { CharacterMaster component = ((Component)this).gameObject.GetComponent<CharacterMaster>(); MinionOwnership component2 = ((Component)this).gameObject.GetComponent<MinionOwnership>(); if (!((Object)(object)component2 != (Object)null) || !((Object)(object)component != (Object)null)) { return; } CharacterMaster ownerMaster = component2.ownerMaster; Inventory val = ((ownerMaster != null) ? ownerMaster.inventory : null); if (Object.op_Implicit((Object)(object)val)) { if (copyEquipment) { component.inventory.CopyEquipmentFrom(val); } if (copyInventory) { component.inventory.CopyItemsFrom(val, inventoryItemCopyFilter); } } } } internal class InteractableBuffController : MonoBehaviour { private PurchaseInteraction _purchaseInteraction; public BuffDef buffDef; public float duration = -1f; public PurchaseInteraction purchaseInteraction { get { if (Object.op_Implicit((Object)(object)_purchaseInteraction)) { return _purchaseInteraction; } _purchaseInteraction = ((Component)this).GetComponent<PurchaseInteraction>(); return _purchaseInteraction; } } internal virtual void Start() { ((UnityEvent<Interactor>)(object)purchaseInteraction.onPurchase).AddListener((UnityAction<Interactor>)OnPurchase); } private void OnPurchase(Interactor interactor) { if (!((Object)(object)buffDef == (Object)null)) { CharacterBody component = ((Component)interactor).GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && NetworkServer.active) { AddDebuff(component); } } } internal virtual void AddDebuff(CharacterBody interactorBody) { if (duration <= 0f) { interactorBody.AddBuff(buffDef); } else { interactorBody.AddTimedBuff(buffDef, duration); } } } internal class StatBuffer : MonoBehaviour { public int levelOffset = 0; public float levelDamage = 0f; public float levelAttackSpeed = 0f; public float levelMoveSpeed = 0f; public float levelShield = 0f; public float levelArmor = 0f; } } namespace RiskierRain.Changes { public static class DifficultyChanges { public delegate bool orig_getHasOneShotProtection(CharacterBody self); [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Manipulator <>9__79_0; public static Manipulator <>9__79_1; public static Manipulator <>9__79_2; public static Manipulator <>9__79_3; public static Func<Instruction, bool> <>9__85_0; public static Func<Instruction, bool> <>9__85_2; public static Func<Instruction, bool> <>9__87_0; public static Func<Instruction, bool> <>9__89_0; public static Func<Instruction, bool> <>9__89_1; public static Func<Instruction, bool> <>9__89_2; public static Func<Instruction, bool> <>9__103_0; public static Func<Instruction, bool> <>9__103_1; public static Func<Instruction, bool> <>9__103_2; public static Func<Instruction, bool> <>9__103_3; public static Func<Instruction, bool> <>9__103_4; public static Func<Instruction, bool> <>9__104_1; public static Func<Instruction, bool> <>9__104_2; public static Func<Instruction, bool> <>9__104_3; public static Func<Instruction, bool> <>9__104_4; public static Func<Instruction, bool> <>9__104_5; public static Func<Instruction, bool> <>9__104_6; public static Func<Instruction, bool> <>9__104_8; public static Func<Instruction, bool> <>9__104_9; public static Func<Instruction, bool> <>9__104_10; public static Func<Instruction, bool> <>9__104_11; public static Func<Instruction, bool> <>9__104_12; public static Func<Instruction, bool> <>9__104_13; public static Func<float, float> <>9__104_14; internal void <ChangeEclipse>b__79_0(ILContext ctx) { RemoveEclipseEffect(ctx, "E1"); } internal void <ChangeEclipse>b__79_1(ILContext ctx) { RemoveEclipseEffect(ctx, "E3"); } internal void <ChangeEclipse>b__79_2(ILContext ctx) { RemoveEclipseEffect(ctx, "E5"); } internal void <ChangeEclipse>b__79_3(ILContext ctx) { RemoveEclipseEffect(ctx, "E6"); } internal bool <ChangeRequiredDifficultyLevelForStats>b__85_0(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "get_selectedDifficulty"); } internal bool <ChangeRequiredDifficultyLevelForStats>b__85_2(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <RemoveEclipseEffect>b__87_0(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "get_selectedDifficulty"); } internal bool <EclipseHoldoutScale>b__89_0(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Run>(x, "get_selectedDifficulty"); } internal bool <EclipseHoldoutScale>b__89_1(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdcI4(x, ref num); } internal bool <EclipseHoldoutScale>b__89_2(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<HealthComponent>(x, "get_fullHealth"); } internal bool <DirectorCreditGainChanges>b__103_0(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <DirectorCreditGainChanges>b__103_1(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <DirectorCreditGainChanges>b__103_2(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <DirectorCreditGainChanges>b__103_3(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchStloc(x, ref num); } internal bool <DirectorCreditGainChanges>b__103_4(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <AmbientLevelChanges>b__104_1(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <AmbientLevelChanges>b__104_2(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal bool <AmbientLevelChanges>b__104_3(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Mathf>(x, "Floor"); } internal bool <AmbientLevelChanges>b__104_4(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <AmbientLevelChanges>b__104_5(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <AmbientLevelChanges>b__104_6(Instruction x) { return ILPatternMatchingExt.MatchLdfld<Run>(x, "stageClearCount"); } internal bool <AmbientLevelChanges>b__104_8(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <AmbientLevelChanges>b__104_9(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal bool <AmbientLevelChanges>b__104_10(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <AmbientLevelChanges>b__104_11(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <AmbientLevelChanges>b__104_12(Instruction x) { return ILPatternMatchingExt.MatchLdfld<Run>(x, "stageClearCount"); } internal bool <AmbientLevelChanges>b__104_13(Instruction x) { return ILPatternMatchingExt.MatchLdsfld<Run>(x, "ambientLevelCap"); } internal float <AmbientLevelChanges>b__104_14(float levelIn) { float ambientLevelBoost = GetAmbientLevelBoost(); return levelIn + ambientLevelBoost; } } public static string Tier2EliteName = "Rare"; public static bool potentialProtectionVisibility = true; public static float potentialProtectionDuration = 4f; public static bool pityChargeOn = false; public static float pityChargeShrinkDelta = 0f; public static float pityChargeRecolorDelta = 0f; public static float fastDirectorEliteBias = 1.2f; public static float fastDirectorCreditMultiplier = 0.75f; public static float slowDirectorEliteBias = 1.2f; public static float slowDirectorCreditMultiplier = 1f; public static float teleLesserEliteBias = 1f; public static float teleLesserCreditMultiplier = 0.8f; public static float teleBossEliteBias = 1f; public static float teleBossCreditMultiplier = 1f; public static float teleBossCreditMultiplierStage1 = 0.5f; public static float interactableCreditsAdd = 125f; public static float monsterCreditsMultiplier = 1f; public static float drizzleDifficultyBoost = 0f; public static float rainstormDifficultyBoost = 0f; public static float monsoonDifficultyBoost = 3f; public static float eclipseDifficultyBoost = 6f; public static int ambientLevelCapDrizzle = 99; public static int ambientLevelCap = 999; public static float easyTeleParticleRadius = 1f; public static float normalTeleParticleRadius = 0.8f; public static float hardTeleParticleRadius = 0.4f; public static float eclipseTeleParticleRadius = 0.4f; public static float defaultTeleParticleRadius = 0.9f; public static int Tier2EliteMinimumStageDefault = 6; public static int Tier2EliteMinimumStageDrizzle = 11; public static int Tier2EliteMinimumStageRainstorm = 6; public static int Tier2EliteMinimumStageMonsoon = 4; public static int Tier2EliteMinimumStageEclipse = 4; public static DifficultyIndex eclipseLevelBossElite = (DifficultyIndex)3; public static string eclipseOneDesc = "\n<mspace=0.5em>(1)</mspace> Boss Enemies: <style=cIsHealth>Always Elite</style>"; public static DifficultyIndex eclipseLevelEnemyMspd = (DifficultyIndex)4; public static float eclipseEnemyMspd = 0.3f; public static string eclipseTwoDesc = "\n<mspace=0.5em>(2)</mspace> Enemy Speed: <style=cIsHealth>+" + eclipseEnemyMspd.AsPercent() + "</style>"; public static DifficultyIndex eclipseLevelSmallHoldout = (DifficultyIndex)5; public static DifficultyIndex eclipseLevelHoldoutLoss = (DifficultyIndex)5; public static float eclipseHoldoutLossRate = 0.02f; public static float eclipseHoldoutScale = 0.6f; public static string eclipseThreeDesc = "\n<mspace=0.5em>(3)</mspace> All Holdout Zones are <style=cIsHealth>Eclipsed</style>"; public static DifficultyIndex eclipseHealingLoss = (DifficultyIndex)6; public static float eclipseHealingMultiplier = 0.75f; public static string eclipseFourDesc = "\n<mspace=0.5em>(4)</mspace> Ally Healing: <style=cIsHealth>-" + (1f - eclipseHealingMultiplier).AsPercent() + "</style>"; public static DifficultyIndex eclipseLevelEnemyCdr = (DifficultyIndex)7; public static float eclipseEnemyCooldownScale = 0.6f; public static string eclipseFiveDesc = "\n<mspace=0.5em>(5)</mspace> Enemy Cooldowns: <style=cIsHealth>-" + (1f - eclipseEnemyCooldownScale).AsPercent() + "</style>"; public static DifficultyIndex eclipseLevelSpiteArtifact = (DifficultyIndex)8; public static string eclipseSixDesc = "\n<mspace=0.5em>(6)</mspace> On Kill: <style=cIsHealth>Enemies drop exploding bombs</style>"; public static DifficultyIndex eclipseLevelItemTax = (DifficultyIndex)9; public static int eclipseItemTaxCount = 2; public static float eclipseItemTaxPercent = 0.2f; public static string eclipseSevenDesc = "\n<mspace=0.5em>(7)</mspace> Item Tax: <style=cIsHealth>" + eclipseItemTaxPercent.AsPercent() + " per Stage</style>"; public static string eclipseEightDesc = "\n<mspace=0.5em>(8)</mspace> Allies recieve <style=cIsHealth>permanent damage</style>"; public static float baseScalingMultiplier = 0.8f; public static float difficultyIncreasePerMinutePerDifficulty = 0.01f; public static float difficultyIncreasePerMinuteBase = 1f; public static float difficultyIncreasePerStage = 0.9f; public static float difficultyIncreasePerLoop = 1.3f; public static float playerBaseDifficultyFactor = 0.2f; public static float playerScalingDifficultyFactor = 0.2f; public static float playerSpawnRateFactor = 0.5f; public static float difficultySpawnRateFactor = 0.4f; public static float voidFieldsTimeCost = 120f; private static GameObject awu = LegacyResourcesAPI.Load<GameObject>("prefabs/characterbodies/SuperRoboBallBossBody"); private static CharacterBody awuBody; private static float awuArmor = 40f; private static float awuAdditionalArmor = 0f; private static int awuAdaptiveArmorCount = 1; private static float costExponent = 1f; private static float goldRewardMultiplierGlobal = 0.35f; private static float expRewardMultiplierGlobal = 0.4f; private static float compensationForStartingLevel = 1f; internal static float GetAmbientLevelBoost() { return DifficultyUtilsModule.GetAmbientLevelBoost(); } public static void Initialize() { RemoveOspForever(); AddPotentialProtection(); AddPityCharge(); FreezeDifficultyScalingOnFinalLevels(); ChangeDifficultyCoefficientCalculation(); ChangeEnemyRewards(); DifficultyUtilsModule.EnableAll(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(AddDifficultyStats)); AddMonsoonScalingStats(); ChangeEclipse(); ChangeDirectorStats(); DirectorAPI.StageSettingsActions += IncreaseStageInteractableCredits; DirectorAPI.StageSettingsActions += IncreaseStageMonsterCredits; } public static void RemoveOspForever() { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown Hook val = new Hook((MethodBase)typeof(CharacterBody).GetMethod("get_hasOneShotProtection", (BindingFlags)(-1)), typeof(DifficultyChanges).GetMethod("ReflectOnThatThang", (BindingFlags)(-1))); } public static bool ReflectOnThatThang(orig_getHasOneShotProtection orig, CharacterBody self) { return false; } public static void AddPotentialProtection() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown PickupPickerPanel.Awake += new hook_Awake(CommandOrPotentialArmor); static void CommandOrPotentialArmor(orig_Awake orig, PickupPickerPanel self) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser(); CharacterBody cachedBody = firstLocalUser.cachedBody; cachedBody.AddTimedBuffAuthority(GetBuffIndex(), potentialProtectionDuration); orig.Invoke(self); } static BuffIndex GetBuffIndex() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (potentialProtectionVisibility) { return Buffs.Immune.buffIndex; } return Buffs.HiddenInvincibility.buffIndex; } } public static void AddPityCharge() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown ChargingState.FixedUpdate += new hook_FixedUpdate(WeakenBossPostTpCharge); ChargingState.OnExit += new hook_OnExit(PityChargeOnExit); } public static void PityChargeOnExit(orig_OnExit orig, ChargingState self) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown orig.Invoke(self); if (pityChargeOn) { pityChargeOn = false; pityChargeShrinkDelta = 0f; pityChargeRecolorDelta = 0f; ((BaseTeleporterState)self).teleporterInteraction.holdoutZoneController.calcColor -= new CalcColorDelegate(PityChargeCalcColor); ((BaseTeleporterState)self).teleporterInteraction.holdoutZoneController.calcRadius -= new CalcRadiusDelegate(PityChargeCalcRadius); } } public static void PityChargeCalcRadius(ref float radius) { radius = Mathf.Max(radius * (1f - pityChargeShrinkDelta), 10f); } public static void PityChargeCalcColor(ref Color color) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) color = FocusConvergenceController.convergenceMaterialColor; } public static void WeakenBossPostTpCharge(orig_FixedUpdate orig, ChargingState baseState) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //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_0246: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(baseState); if (!StormRunBehavior.IsStormStage(Stage.instance.sceneDef)) { return; } if (((BaseTeleporterState)baseState).teleporterInteraction.holdoutZoneController.charge >= 1f) { if (((BaseTeleporterState)baseState).teleporterInteraction.monstersCleared || !((BaseTeleporterState)baseState).teleporterInteraction.holdoutZoneController.isAnyoneCharging) { return; } if (!pityChargeOn) { pityChargeOn = true; ((BaseTeleporterState)baseState).teleporterInteraction.holdoutZoneController.calcColor += new CalcColorDelegate(PityChargeCalcColor); ((BaseTeleporterState)baseState).teleporterInteraction.holdoutZoneController.calcRadius += new CalcRadiusDelegate(PityChargeCalcRadius); Chat.AddMessage("<style=cIsUtility>The overcharged teleporter begins its Convergence...</style>"); } if (pityChargeRecolorDelta < 1f) { pityChargeRecolorDelta += Time.fixedDeltaTime; } pityChargeShrinkDelta += Time.fixedDeltaTime * 0.01f; if (!NetworkServer.active) { return; } BossGroup bossGroup = ((BaseTeleporterState)baseState).teleporterInteraction.bossGroup; BossMemory[] bossMemories = bossGroup.bossMemories; foreach (BossMemory val in bossMemories) { CharacterBody val2 = val.cachedBody; if ((Object)(object)val2 == (Object)null && (Object)(object)val.cachedMaster != (Object)null) { val2 = val.cachedMaster.GetBody(); } if ((Object)(object)val2 != (Object)null) { val2.AddTimedBuff(Buffs.Cripple, 9999f); val2.AddTimedBuff(Buffs.HealingDisabled, 9999f); HealthComponent healthComponent = val2.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.health > 1f) { DamageInfo val3 = new DamageInfo(); val3.damage = (val2.maxHealth + val2.maxShield) * 0.01f * Time.fixedDeltaTime; val3.damageType = new DamageTypeCombo(DamageTypeCombo.op_Implicit((DamageType)2048), (DamageTypeExtended)0, (DamageSource)0); val3.damageType |= DamageTypeCombo.op_Implicit((DamageType)2); val3.damageType |= DamageTypeCombo.op_Implicit((DamageType)64); val3.procCoefficient = 1f; val3.position = val2.corePosition; healthComponent.TakeDamage(val3); } } } } else { pityChargeOn = false; } } public static void ChangeDirectorStats() { //IL_0006: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Common/Director.prefab").WaitForCompletion(); CombatDirector[] components = val.GetComponents<CombatDirector>(); if (components.Length != 0) { CombatDirector val2 = components[0]; if ((Object)(object)val2 != (Object)null) { val2.eliteBias = fastDirectorEliteBias; val2.eliteBias = fastDirectorCreditMultiplier; } CombatDirector val3 = components[1]; if ((Object)(object)val3 != (Object)null) { val3.eliteBias = slowDirectorEliteBias; val3.eliteBias = slowDirectorCreditMultiplier; } } CombatDirector.Awake += new hook_Awake(AdjustTpDirectors); CombatDirector.SetNextSpawnAsBoss += new hook_SetNextSpawnAsBoss(FixBossDirectorCredits); } private static void FixBossDirectorCredits(orig_SetNextSpawnAsBoss orig, CombatDirector self) { self.monsterCredit *= teleBossCreditMultiplier; orig.Invoke(self); } private static void AdjustTpDirectors(orig_Awake orig, CombatDirector director) { if (director.customName == "Boss") { AdjustTpBossDirector(director); } if (director.customName == "Monsters") { AdjustTpMonsterDirector(director); } orig.Invoke(director); } private static void AdjustDirectorsForTeleporter(orig_Awake orig, TeleporterInteraction self) { AdjustTpBossDirector(self.bossDirector); AdjustTpBossDirector(self.companionBoss); AdjustTpMonsterDirector(self.bonusDirector); orig.Invoke(self); } private static void AdjustTeleporterDirectors(CombatDirector[] directors) { if (directors != null && directors.Length != 0) { foreach (CombatDirector val in directors) { } } } private static void AdjustTpBossDirector(CombatDirector director) { director.eliteBias = teleBossEliteBias; director.creditMultiplier = teleBoss