Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of RiskyFixes v1.9.6
RiskyFixes.dll
Decompiled 5 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using EntityStates; using EntityStates.Bandit2; using EntityStates.BrotherMonster; using EntityStates.ClayBoss; using EntityStates.Croco; using EntityStates.DefectiveUnit; using EntityStates.Huntress.HuntressWeapon; using EntityStates.Merc; using EntityStates.Missions.BrotherEncounter; using EntityStates.Railgunner.Weapon; using EntityStates.Toolbot; using IL.EntityStates.Bandit2; using IL.EntityStates.Bandit2.Weapon; using IL.EntityStates.ClayBoss; using IL.EntityStates.Commando.CommandoWeapon; using IL.EntityStates.DefectiveUnit; using IL.EntityStates.Merc; using IL.EntityStates.Railgunner.Weapon; using IL.EntityStates.Toolbot; using IL.EntityStates.Treebot.Weapon; using IL.RoR2; using IL.RoR2.Items; using Local.Difficulty.Multitudes; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using Multitudes; using On.EntityStates.BrotherMonster; using On.EntityStates.Croco; using On.EntityStates.Huntress.HuntressWeapon; using On.EntityStates.Missions.BrotherEncounter; using On.EntityStates.Toolbot; using On.RoR2; using On.RoR2.Artifacts; using On.RoR2.EntityLogic; using On.RoR2.Projectile; using On.RoR2.UI; using R2API.Utils; using RiskyFixes.Fixes; using RoR2; using RoR2.Artifacts; using RoR2.EntityLogic; using RoR2.Orbs; using RoR2.Projectile; using RoR2.UI; using SneedHooks; using TPDespair.ZetArtifacts; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("RiskyFixes")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+494729af7b64ae6adcb8a6d9e73c65f174e0aa6d")] [assembly: AssemblyProduct("RiskyFixes")] [assembly: AssemblyTitle("RiskyFixes")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace RiskyFixes { internal static class ModCompat { public static class LinearDamageCompat { public static bool pluginLoaded; } public static class RiskOfOptionsCompat { public static bool pluginLoaded; } public static class EnigmaBlacklistCompat { public static bool pluginLoaded; } public static class MultitudesCompat { public static bool pluginLoaded; public static int GetMultiplier() { if (!pluginLoaded) { return 1; } return GetMultiplierInternal(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static int GetMultiplierInternal() { return Multitudes.Multiplier; } } public static class ZetArtifactsCompat { public static class Multifact { public static int GetMultiplier() { if (!pluginLoaded) { return 1; } return GetMultiplierInternal(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static int GetMultiplierInternal() { if (ZetMultifact.Enabled && RunArtifactManager.instance.IsArtifactEnabled(Artifacts.ZetMultifact)) { return Mathf.Max(2, ZetArtifactsPlugin.MultifactMultiplier.Value); } return 1; } } public static bool pluginLoaded; } public static class MultitudesDifficultyCompat { public static bool pluginLoaded; public static int GetAdditional() { if (!pluginLoaded) { return 0; } return GetAdditionalInternal(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static int GetAdditionalInternal() { //IL_001c: 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_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) if (!Setup.forceEnable) { Run instance = Run.instance; if (((instance != null) ? new DifficultyIndex?(instance.selectedDifficulty) : null) != (DifficultyIndex?)Setup.index) { return 0; } } return (int)Session.additionalPlayers; } } public static class AIBlacklist { public static bool pluginLoaded; } internal static void Init() { RiskOfOptionsCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); EnigmaBlacklistCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.Moffein.EnigmaBlacklist"); MultitudesCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("dev.wildbook.multitudes"); ZetArtifactsCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.TPDespair.ZetArtifacts"); AIBlacklist.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.Moffein.AI_Blacklist"); MultitudesDifficultyCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("local.difficulty.multitudes"); LinearDamageCompat.pluginLoaded = Chainloader.PluginInfos.ContainsKey("com.Moffein.LinearDamage"); } } [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.Moffein.RiskyFixes", "RiskyFixes", "1.9.6")] public class RiskyFixesPlugin : BaseUnityPlugin { private void Awake() { ModCompat.Init(); AddToAssembly(); } private void AddToAssembly() { IEnumerable<Type> enumerable = from type in Assembly.GetExecutingAssembly().GetTypes() where !type.IsAbstract && type.IsSubclassOf(typeof(FixBase)) select type; foreach (Type item in enumerable) { FixBase fixBase = (FixBase)Activator.CreateInstance(item); fixBase.Init(((BaseUnityPlugin)this).Config); } } } public static class SneedUtils { public static void DumpEntityStateConfig(EntityStateConfiguration esc) { for (int i = 0; i < esc.serializedFieldsCollection.serializedFields.Length; i++) { if (Object.op_Implicit(esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue)) { Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + (object)esc.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue)); } else { Debug.Log((object)(esc.serializedFieldsCollection.serializedFields[i].fieldName + " - " + esc.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue)); } } } public static void DumpEntityStateConfig(string entityStateName) { EntityStateConfiguration esc = LegacyResourcesAPI.Load<EntityStateConfiguration>("entitystateconfigurations/" + entityStateName); DumpEntityStateConfig(esc); } public static void DumpAddressableEntityStateConfig(string addressablePath) { //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) EntityStateConfiguration esc = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)addressablePath).WaitForCompletion(); DumpEntityStateConfig(esc); } public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, string value) { //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) EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion(); for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++) { if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName) { val.serializedFieldsCollection.serializedFields[i].fieldValue.stringValue = value; return true; } } return false; } public static bool SetAddressableEntityStateField(string fullEntityStatePath, string fieldName, Object newObject) { //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) EntityStateConfiguration val = Addressables.LoadAssetAsync<EntityStateConfiguration>((object)fullEntityStatePath).WaitForCompletion(); for (int i = 0; i < val.serializedFieldsCollection.serializedFields.Length; i++) { if (val.serializedFieldsCollection.serializedFields[i].fieldName == fieldName) { val.serializedFieldsCollection.serializedFields[i].fieldValue.objectValue = newObject; return true; } } return false; } } } namespace RiskyFixes.Fixes { public abstract class FixBase<T> : FixBase where T : FixBase<T> { public static T Instance { get; private set; } public FixBase() { if (Instance != null) { throw new InvalidOperationException("Singleton class \"" + typeof(T).Name + "\" inheriting FixBase was instantiated twice"); } Instance = this as T; } } public abstract class FixBase { public abstract string ConfigCategoryString { get; } public abstract string ConfigOptionName { get; } public abstract string ConfigDescriptionString { get; } public ConfigEntry<bool> Enabled { get; private set; } public virtual bool StopLoadOnConfigDisable => true; protected virtual void ReadConfig(ConfigFile config) { Enabled = config.Bind<bool>(ConfigCategoryString, ConfigOptionName, true, ConfigDescriptionString); } internal void Init(ConfigFile config) { ReadConfig(config); if (!StopLoadOnConfigDisable || Enabled.Value) { ApplyChanges(); } } protected virtual void ApplyChanges() { } } } namespace RiskyFixes.Fixes.Survivors.Treebot { public class HarvestAnim : FixBase<HarvestAnim> { public override string ConfigCategoryString => "Survivors - REX"; public override string ConfigOptionName => "(Client-Side) DIRECTIVE: Harvest Animation"; public override string ConfigDescriptionString => "Restores the missing prep animation for DIRECTIVE: Harvest."; protected override void ApplyChanges() { SneedUtils.SetAddressableEntityStateField("RoR2/Base/Treebot/EntityStates.Treebot.TreebotPrepFruitSeed.asset", "baseDuration", "0.1"); } } public class UtilityCrash : FixBase<UtilityCrash> { public override string ConfigCategoryString => "Survivors - REX"; public override string ConfigOptionName => "Utility Crash Fix"; public override string ConfigDescriptionString => "(Server-Side) Fixes error spam and crashes related to the Utility skill."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown FireSonicBoom.OnEnter += new Manipulator(FireSonicBoom_OnEnter); } private void FireSonicBoom_OnEnter(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); bool flag = true; if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(Vector3), "get_magnitude") })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)((float magnitude) => (magnitude <= 0f) ? 1f : magnitude)); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(CharacterMotor), "mass") })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)((float mass) => (mass <= 0f) ? 1f : mass)); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(Rigidbody), "get_mass") })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)((float mass) => (mass <= 0f) ? 1f : mass)); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(CharacterBody), "get_acceleration") })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)((float accel) => (accel <= 0f) ? 1f : accel)); flag = false; } } } } if (flag) { Debug.LogError((object)"RiskyFixes: Treebot UtilityCrash IL Hook failed."); } } } } namespace RiskyFixes.Fixes.Survivors.Toolbot { public class FixNailgunBurst : FixBase<FixNailgunBurst> { public override string ConfigCategoryString => "Survivors - MUL-T"; public override string ConfigOptionName => "(Client-Side) Nailgun Burst Always Triggers"; public override string ConfigDescriptionString => "Nailgun ending shotgun burst always triggers when ending the skill."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown FireNailgun.OnExit += new hook_OnExit(FireNailgun_OnExit); } private void FireNailgun_OnExit(orig_OnExit orig, FireNailgun self) { //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) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (((BaseSkillState)self).IsKeyDownAuthority() && (!Object.op_Implicit((Object)(object)((EntityState)self).characterBody) || !((EntityState)self).characterBody.isSprinting)) { if (Object.op_Implicit((Object)(object)((EntityState)self).characterBody)) { ((EntityState)self).characterBody.SetSpreadBloom(1f, false); } Ray aimRay = ((BaseState)self).GetAimRay(); ((BaseNailgunState)self).FireBullet(((BaseState)self).GetAimRay(), NailgunFinalBurst.finalBurstBulletCount, BaseNailgunState.spreadPitchScale, BaseNailgunState.spreadYawScale); Util.PlaySound(NailgunFinalBurst.burstSound, ((EntityState)self).gameObject); if (((EntityState)self).isAuthority) { float num = NailgunFinalBurst.selfForce * (((EntityState)self).characterMotor.isGrounded ? 0.5f : 1f) * ((EntityState)self).characterMotor.mass; ((EntityState)self).characterMotor.ApplyForce(((Ray)(ref aimRay)).direction * (0f - num), false, false); } Util.PlaySound(BaseNailgunState.fireSoundString, ((EntityState)self).gameObject); Util.PlaySound(BaseNailgunState.fireSoundString, ((EntityState)self).gameObject); Util.PlaySound(BaseNailgunState.fireSoundString, ((EntityState)self).gameObject); } } } public class NailgunShotRadius : FixBase<NailgunShotRadius> { public override string ConfigCategoryString => "Survivors - MUL-T"; public override string ConfigOptionName => "(Client-Side) Nailgun Shot Radius"; public override string ConfigDescriptionString => "Gives Nailgun shots a small radius like most other bullet attacks in the game."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BaseNailgunState.FireBullet += new Manipulator(BaseNailgunState_FireBullet); } private void BaseNailgunState_FireBullet(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); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<BulletAttack>(x, "Fire") })) { val.EmitDelegate<Func<BulletAttack, BulletAttack>>((Func<BulletAttack, BulletAttack>)delegate(BulletAttack bulletAttack) { bulletAttack.radius = 0.2f; bulletAttack.smartCollision = true; return bulletAttack; }); } else { Debug.LogError((object)"RiskyFixes: Toolbot NailgunShotRadius IL Hook failed"); } } } } namespace RiskyFixes.Fixes.Survivors.Railgunner { public class FixBungus : FixBase<FixBungus> { public override string ConfigCategoryString => "Survivors - Railgunner"; public override string ConfigOptionName => "(Client-Side) Fix Bungus"; public override string ConfigDescriptionString => "Disables self-knockback while standing still."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //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 BaseFireSnipe.OnFireBulletAuthority += new Manipulator(BaseFireSnipe_OnFireBulletAuthority); FirePistol.FireBullet += new Manipulator(FirePistol_FireBullet); } private void FirePistol_FireBullet(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(FirePistol), "selfKnockbackForce") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, FirePistol, float>>((Func<float, FirePistol, float>)((float force, FirePistol self) => (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor) && ((EntityState)self).characterMotor.isGrounded) ? 0f : force)); } else { Debug.LogError((object)"RiskyFixes: Railgunner FixBungus FirePistol IL Hook failed"); } } private void BaseFireSnipe_OnFireBulletAuthority(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(BaseFireSnipe), "selfKnockbackForce") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, BaseFireSnipe, float>>((Func<float, BaseFireSnipe, float>)((float force, BaseFireSnipe self) => (Object.op_Implicit((Object)(object)((EntityState)self).characterMotor) && ((EntityState)self).characterMotor.velocity == Vector3.zero) ? 0f : force)); } else { Debug.LogError((object)"RiskyFixes: Railgunner FixBungus Snipe IL Hook failed"); } } } } namespace RiskyFixes.Fixes.Survivors.Merc { public class EviscerateFix : FixBase<EviscerateFix> { public override string ConfigCategoryString => "Survivors - Mercenary"; public override string ConfigOptionName => "(Client-Side) Eviscerate Targeting"; public override string ConfigDescriptionString => "Fixes Eviscerate from getting caught on allies."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown EvisDash.FixedUpdate += new Manipulator(EvisDash_FixedUpdate); } private void EvisDash_FixedUpdate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HurtBox), "healthComponent") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<HealthComponent, EvisDash, HealthComponent>>((Func<HealthComponent, EvisDash, HealthComponent>)((HealthComponent healthComponent, EvisDash self) => (HealthComponent)(((int)FriendlyFireManager.friendlyFireMode == 0 && (Object)(object)healthComponent != (Object)(object)((EntityState)self).healthComponent && Object.op_Implicit((Object)(object)healthComponent) && Object.op_Implicit((Object)(object)healthComponent.body) && Object.op_Implicit((Object)(object)healthComponent.body.teamComponent) && !FriendlyFireManager.ShouldDirectHitProceed(healthComponent, ((BaseState)self).GetTeam())) ? ((object)((EntityState)self).healthComponent) : ((object)healthComponent)))); } else { Debug.LogError((object)"RiskyFixes: Merc EviscerateFix EvisDash IL Hook failed"); } } } } namespace RiskyFixes.Fixes.Survivors.Mage { public class PrimaryRange : FixBase<PrimaryRange> { public override string ConfigCategoryString => "Survivors - Artificer"; public override string ConfigOptionName => "(Server-Side) Primary Range"; public override string ConfigDescriptionString => "Fix projectiles disappearing at midrange."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) GameObject projectile = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageFireboltBasic.prefab").WaitForCompletion(); IncreaseProjectileLifetime(projectile); GameObject projectile2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Mage/MageLightningboltBasic.prefab").WaitForCompletion(); IncreaseProjectileLifetime(projectile2); } private void IncreaseProjectileLifetime(GameObject projectile) { ProjectileSimple component = projectile.GetComponent<ProjectileSimple>(); component.lifetime = 10f; ProjectileImpactExplosion component2 = projectile.GetComponent<ProjectileImpactExplosion>(); if (Object.op_Implicit((Object)(object)component2)) { component2.lifetime = 10f; } } } } namespace RiskyFixes.Fixes.Survivors.Huntress { public class FixFlurry : FixBase<FixFlurry> { public override string ConfigCategoryString => "Survivors - Huntress"; public override string ConfigOptionName => "(Server-Side) Flurry Attack Speed Fix"; public override string ConfigDescriptionString => "Fixes Flurry losing arrows at high attack speeds."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown FireSeekingArrow.OnExit += new hook_OnExit(FireSeekingArrow_OnExit); } private void FireSeekingArrow_OnExit(orig_OnExit orig, FireSeekingArrow self) { orig.Invoke(self); if (NetworkServer.active) { int num = self.maxArrowCount - self.firedArrowCount; for (int i = 0; i < num; i++) { self.arrowReloadTimer = 0f; self.FireOrbArrow(); } } } } } namespace RiskyFixes.Fixes.Survivors.FalseSon { public class LunarRuinReproc : FixBase<LunarRuinReproc> { public static float damageMultPerBuff = 0.1f; public override string ConfigCategoryString => "Survivors - False Son"; public override string ConfigOptionName => "(Server-Side) Lunar Ruin Exponential Damage Removal"; public override string ConfigDescriptionString => "Prevent Lunar Ruin from exponentially increasing damage in a proc chain."; protected override void ApplyChanges() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown if (Chainloader.PluginInfos.ContainsKey("LordVGames.LunarRuinDamageNerf")) { Debug.LogWarning((object)"RiskyFixes: Skipping LunarRuinReproc because standalone plugin is loaded."); return; } HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); if (ModCompat.LinearDamageCompat.pluginLoaded) { ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamageDelegate)Delegate.Combine((Delegate?)(object)ModifyFinalDamage.ModifyFinalDamageActions, (Delegate?)new ModifyFinalDamageDelegate(ModifyFinalDamage_Additive)); } else { ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamageDelegate)Delegate.Combine((Delegate?)(object)ModifyFinalDamage.ModifyFinalDamageActions, (Delegate?)new ModifyFinalDamageDelegate(ModifyFinalDamage)); } } private void ModifyFinalDamage(DamageModifierArgs damageModifierArgs, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) int buffCount = victimBody.GetBuffCount(Buffs.lunarruin); if (buffCount > 0) { damageModifierArgs.damageMultFinal *= 1f + damageMultPerBuff * (float)buffCount; damageInfo.damageColorIndex = (DamageColorIndex)9; } } private void ModifyFinalDamage_Additive(DamageModifierArgs damageModifierArgs, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) int buffCount = victimBody.GetBuffCount(Buffs.lunarruin); if (buffCount > 0) { damageModifierArgs.damageMultAdd += damageMultPerBuff * (float)buffCount; damageInfo.damageColorIndex = (DamageColorIndex)9; } } private void HealthComponent_TakeDamageProcess(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); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "lunarruin") })) { val.EmitDelegate<Func<BuffDef, BuffDef>>((Func<BuffDef, BuffDef>)((BuffDef buff) => null)); } else { Debug.LogError((object)"RiskyFixes: LunarRuinReproc IL hook failed."); } } } } namespace RiskyFixes.Fixes.Survivors.Croco { public class ExtendSpawnInvuln : FixBase<ExtendSpawnInvuln> { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnEnter <>9__8_0; public static hook_OnExit <>9__8_1; public static hook_OnEnter <>9__8_2; public static hook_OnExit <>9__8_3; internal void <ApplyChanges>b__8_0(orig_OnEnter orig, Spawn self) { orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody)) { ((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility); } } internal void <ApplyChanges>b__8_1(orig_OnExit orig, Spawn self) { if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility)) { ((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility); } orig.Invoke(self); } internal void <ApplyChanges>b__8_2(orig_OnEnter orig, WakeUp self) { orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody)) { ((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility); } } internal void <ApplyChanges>b__8_3(orig_OnExit orig, WakeUp self) { if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility)) { ((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility); ((EntityState)self).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.5f); } orig.Invoke(self); } } public override string ConfigCategoryString => "Survivors - Acrid"; public override string ConfigOptionName => "(Server-Side) Spawn Protection"; public override string ConfigDescriptionString => "Spawn protection lasts until after waking up."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //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_006a: Expected O, but got Unknown //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) //IL_008f: Expected O, but got Unknown object obj = <>c.<>9__8_0; if (obj == null) { hook_OnEnter val = delegate(orig_OnEnter orig, Spawn self) { orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody)) { ((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility); } }; <>c.<>9__8_0 = val; obj = (object)val; } Spawn.OnEnter += (hook_OnEnter)obj; object obj2 = <>c.<>9__8_1; if (obj2 == null) { hook_OnExit val2 = delegate(orig_OnExit orig, Spawn self) { if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility)) { ((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility); } orig.Invoke(self); }; <>c.<>9__8_1 = val2; obj2 = (object)val2; } Spawn.OnExit += (hook_OnExit)obj2; object obj3 = <>c.<>9__8_2; if (obj3 == null) { hook_OnEnter val3 = delegate(orig_OnEnter orig, WakeUp self) { orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody)) { ((EntityState)self).characterBody.AddBuff(Buffs.HiddenInvincibility); } }; <>c.<>9__8_2 = val3; obj3 = (object)val3; } WakeUp.OnEnter += (hook_OnEnter)obj3; object obj4 = <>c.<>9__8_3; if (obj4 == null) { hook_OnExit val4 = delegate(orig_OnExit orig, WakeUp self) { if (NetworkServer.active && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && ((EntityState)self).characterBody.HasBuff(Buffs.HiddenInvincibility)) { ((EntityState)self).characterBody.RemoveBuff(Buffs.HiddenInvincibility); ((EntityState)self).characterBody.AddTimedBuff(Buffs.HiddenInvincibility, 0.5f); } orig.Invoke(self); }; <>c.<>9__8_3 = val4; obj4 = (object)val4; } WakeUp.OnExit += (hook_OnExit)obj4; } } } namespace RiskyFixes.Fixes.Survivors.Commando { public class PrimaryFireRate : FixBase<PrimaryFireRate> { public override string ConfigCategoryString => "Survivors - Commando"; public override string ConfigOptionName => "(Client-Side) Double Tap Fire Rate"; public override string ConfigDescriptionString => "Fixes Double Tap having a hidden reload state that lowers its fire rate at high attack speeds."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown FirePistol2.FixedUpdate += new Manipulator(FirePistol2_FixedUpdate); } private void FirePistol2_FixedUpdate(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); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, 0) })) { int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int zero) => -1000000000)); } else { Debug.LogError((object)"RiskyFixes: Commando PrimaryFireRate IL Hook failed"); } } } } namespace RiskyFixes.Fixes.Survivors.CHEF { public class CleaverAttackSpeed : FixBase<CleaverAttackSpeed> { public override string ConfigCategoryString => "Survivors - CHEF"; public override string ConfigOptionName => "Dice Attack Speed"; public override string ConfigDescriptionString => "Fixes various aspects of Dice not scaling with attack speed."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown CleaverProjectile.Start += new hook_Start(CleaverProjectile_Start); } private void CleaverProjectile_Start(orig_Start orig, CleaverProjectile self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.chefController) && Object.op_Implicit((Object)(object)self.chefController.characterBody)) { self.holdChargeTime /= self.chefController.characterBody.attackSpeed; self.minTravelTime /= self.chefController.characterBody.attackSpeed; } } } } namespace RiskyFixes.Fixes.Survivors.Bandit2 { public class KnifeHitboxCancel : FixBase<KnifeHitboxCancel> { public override string ConfigCategoryString => "Survivors - Bandit"; public override string ConfigOptionName => "(Client-Side) Knife Hitbox Cancel Fix"; public override string ConfigDescriptionString => "Knife hitbox no longer gets cancelled by other animations."; protected override void ApplyChanges() { //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 ThrowSmokebomb.OnEnter += new Manipulator(ThrowSmokebomb_OnEnter); Bandit2FirePrimaryBase.OnEnter += new Manipulator(Bandit2FirePrimaryBase_OnEnter); Reload.OnEnter += new Manipulator(Reload_OnEnter); EnterReload.OnEnter += new Manipulator(EnterReload_OnEnter); } private void ThrowSmokebomb_OnEnter(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self) { //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) Animator modelAnimator = ((EntityState)self).GetModelAnimator(); if (Object.op_Implicit((Object)(object)modelAnimator)) { int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive"); if (layerIndex >= 0) { AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade")) { return "BanditTweaksInvalidLayer"; } } } return animLayer; }); } else { Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel ThrowSmokebomb IL Hook failed."); } } private void Bandit2FirePrimaryBase_OnEnter(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self) { //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) Animator modelAnimator = ((EntityState)self).GetModelAnimator(); if (Object.op_Implicit((Object)(object)modelAnimator)) { int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive"); if (layerIndex >= 0) { AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade")) { return "BanditTweaksInvalidLayer"; } } } return animLayer; }); } else { Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel Bandit2FirePrimaryBase IL Hook failed."); } } private void Reload_OnEnter(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self) { //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) Animator modelAnimator = ((EntityState)self).GetModelAnimator(); if (Object.op_Implicit((Object)(object)modelAnimator)) { int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive"); if (layerIndex >= 0) { AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade")) { return "BanditTweaksInvalidLayer"; } } } return animLayer; }); } else { Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel Reload IL Hook failed."); } } private void EnterReload_OnEnter(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdstr(x, "Gesture, Additive") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<string, ThrowSmokebomb, string>>((Func<string, ThrowSmokebomb, string>)delegate(string animLayer, ThrowSmokebomb self) { //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) Animator modelAnimator = ((EntityState)self).GetModelAnimator(); if (Object.op_Implicit((Object)(object)modelAnimator)) { int layerIndex = modelAnimator.GetLayerIndex("Gesture, Additive"); if (layerIndex >= 0) { AnimatorStateInfo currentAnimatorStateInfo = modelAnimator.GetCurrentAnimatorStateInfo(layerIndex); if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("SlashBlade")) { return "BanditTweaksInvalidLayer"; } } } return animLayer; }); } else { Debug.LogError((object)"RiskyFixes: Bandit KnifeHitboxCancel EnterReload IL Hook failed."); } } } public class PrimaryShotRadius : FixBase<PrimaryShotRadius> { public override string ConfigCategoryString => "Survivors - Bandit"; public override string ConfigOptionName => "(Client-Side) Primary Shot Radius"; public override string ConfigDescriptionString => "Gives Bandit primary bullets a small radius like most other bullet attacks in the game."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { SneedUtils.SetAddressableEntityStateField("RoR2/Base/Bandit2/EntityStates.Bandit2.Weapon.Bandit2FireRifle.asset", "radius", "0.3"); SneedUtils.SetAddressableEntityStateField("RoR2/Base/Bandit2/EntityStates.Bandit2.Weapon.FireShotgun2.asset", "radius", "0.5"); } } } namespace RiskyFixes.Fixes.Stages.VoidRaid { public class VoidRaidCutsceneProtection : FixBase<VoidRaidCutsceneProtection> { private static bool hookAdded; public override string ConfigCategoryString => "Stages - Planeterium"; public override string ConfigOptionName => "(Server-Side) Cutscene Protection"; public override string ConfigDescriptionString => "Players are immuneduring the initial Voidling spawn cutscesne."; protected override void ApplyChanges() { Stage.onServerStageBegin += Stage_onServerStageBegin; } private void Stage_onServerStageBegin(Stage stage) { //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) Scene activeScene = SceneManager.GetActiveScene(); if (((Scene)(ref activeScene)).name == "voidraid") { SetHookEnabled(enabled: true); } else { SetHookEnabled(enabled: false); } } private static void SetHookEnabled(bool enabled) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (enabled != hookAdded) { if (enabled) { hookAdded = true; DelayedEvent.CallDelayed += new hook_CallDelayed(DelayedEvent_CallDelayed); } else { hookAdded = false; DelayedEvent.CallDelayed -= new hook_CallDelayed(DelayedEvent_CallDelayed); } } } private static void DelayedEvent_CallDelayed(orig_CallDelayed orig, DelayedEvent self, float timer) { //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_002d: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected I4, but got Unknown //IL_0087: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, timer); if (!(((Object)((Component)self).gameObject).name == "BossStartTrigger")) { return; } TimerQueue val = null; TimeStepType timeStepType = self.timeStepType; TimeStepType val2 = timeStepType; switch ((int)val2) { case 0: val = RoR2Application.timeTimers; break; case 1: val = RoR2Application.unscaledTimeTimers; break; case 2: val = RoR2Application.fixedTimeTimers; break; } if (val != null) { val.CreateTimer(timer, (Action)delegate { Util.SetPlayersInvulnerableServer(true, 7.6f); }); SetHookEnabled(enabled: false); } } } } namespace RiskyFixes.Fixes.Stages.Moon { public class KillVoidTeam : FixBase<KillVoidTeam> { public override string ConfigCategoryString => "Stages - Commencement"; public override string ConfigOptionName => "(Server-Side) Kill Void Team"; public override string ConfigDescriptionString => "Kills Void team enemies when the bossfight starts."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BrotherEncounterBaseState.KillAllMonsters += new hook_KillAllMonsters(BrotherEncounterBaseState_KillAllMonsters); } private void BrotherEncounterBaseState_KillAllMonsters(orig_KillAllMonsters orig, BrotherEncounterBaseState self) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!NetworkServer.active) { return; } foreach (TeamComponent item in new List<TeamComponent>(TeamComponent.GetTeamMembers((TeamIndex)4))) { if (Object.op_Implicit((Object)(object)item)) { HealthComponent component = ((Component)item).GetComponent<HealthComponent>(); if (Object.op_Implicit((Object)(object)component)) { component.Suicide((GameObject)null, (GameObject)null, DamageTypeCombo.op_Implicit((DamageType)0)); } } } } } } namespace RiskyFixes.Fixes.Items { public class ChargedPerfCrit : FixBase<ChargedPerfCrit> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Charged Perforator Crit Fix"; public override string ConfigDescriptionString => "Charged Perforator inherits crit instead of rerolling."; protected override void ApplyChanges() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (Chainloader.PluginInfos.ContainsKey("Gorakh.CherfInheritCrit")) { Debug.LogWarning((object)"RiskyFixes: Skipping ChargedPerfCrit because standalone plugin is loaded."); } else { GlobalEventManager.ProcessHitEnemy += new Manipulator(FixChargedPerforator); } } private void FixChargedPerforator(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "LightningStrikeOnHit") }) && val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(GenericDamageOrb), "isCrit") })) { val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<bool, DamageInfo, bool>>((Func<bool, DamageInfo, bool>)((bool isCrit, DamageInfo damageInfo) => damageInfo.crit)); } else { Debug.LogError((object)"RiskyFixes: ChargedPerfCrit IL Hook failed"); } } } public class DynamiteNullref : FixBase<DynamiteNullref> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Client-Side) Box of Dynamite Nullref"; public override string ConfigDescriptionString => "Fixes this nullref."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown DroneDynamiteBehaviour.IsEnemyNearby += new Manipulator(DroneDynamiteBehaviour_IsEnemyNearby); } private void DroneDynamiteBehaviour_IsEnemyNearby(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); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall<Physics>(x, "CapsuleCastAll") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt(x, typeof(Component), "GetComponent") })) { val.EmitDelegate<Func<HurtBox, HurtBox>>((Func<HurtBox, HurtBox>)((HurtBox orig) => ((Object)(object)orig != (Object)null && (Object)(object)orig.healthComponent == (Object)null) ? null : orig)); } else { Debug.LogError((object)"RiskyFixes: Box of Dynamite Nullref IL hook failed."); } } } public class ElusiveAntlerNullref : FixBase<ElusiveAntlerNullref> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Elusive Antler - Fix Nullref"; public override string ConfigDescriptionString => "Fixes nullref on orb despawn."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ElusiveAntlersPickup.OnShardDestroyed += new hook_OnShardDestroyed(ElusiveAntlersPickup_OnShardDestroyed); } private void ElusiveAntlersPickup_OnShardDestroyed(orig_OnShardDestroyed orig, ElusiveAntlersPickup self, ElusiveAntlersDestroyCondition destroyCondition) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (!NetworkServer.active) { Debug.LogWarning((object)"[Server] function 'System.Void RoR2.ElusiveAntlersPickup::OnShardDestroyed(RoR2.ElusiveAntlersPickup/ElusiveAntlersDestroyCondition)' called on client"); } else { if (!((Object)(object)self.ownerBody != (Object)null)) { return; } self.ownerBody.OnShardDestroyed(); if ((int)destroyCondition > 0) { ElusiveAntlersBehavior component = ((Component)self.ownerBody).GetComponent<ElusiveAntlersBehavior>(); if (Object.op_Implicit((Object)(object)component)) { component.ShardDestroyed(destroyCondition); } } } } } public class FinReproc : FixBase<FinReproc> { public static float damageBuffPerStack = 0.1f; public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Breaching Fin - Fix Re-Proc"; public override string ConfigDescriptionString => "Fixes Fin being able to boost damage multiple times in the same proc chain."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown KnockbackFinUtil.ModifyDamageInfo += new hook_ModifyDamageInfo(KnockbackFinUtil_ModifyDamageInfo); if (ModCompat.LinearDamageCompat.pluginLoaded) { ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamageDelegate)Delegate.Combine((Delegate?)(object)ModifyFinalDamage.ModifyFinalDamageActions, (Delegate?)new ModifyFinalDamageDelegate(ModifyFinalDamage_Additive)); } else { ModifyFinalDamage.ModifyFinalDamageActions = (ModifyFinalDamageDelegate)Delegate.Combine((Delegate?)(object)ModifyFinalDamage.ModifyFinalDamageActions, (Delegate?)new ModifyFinalDamageDelegate(ModifyFinalDamage)); } } private void ModifyFinalDamage(DamageModifierArgs damageModifierArgs, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) int buffCount = victimBody.GetBuffCount(Buffs.KnockUpHitEnemiesJuggleCount); if (buffCount > 0) { damageModifierArgs.damageMultFinal *= 1f + (float)Mathf.Max(1, buffCount) * damageBuffPerStack; if (!damageInfo.crit) { damageInfo.damageColorIndex = (DamageColorIndex)14; } } } private void ModifyFinalDamage_Additive(DamageModifierArgs damageModifierArgs, DamageInfo damageInfo, HealthComponent victim, CharacterBody victimBody) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) int buffCount = victimBody.GetBuffCount(Buffs.KnockUpHitEnemiesJuggleCount); if (buffCount > 0) { damageModifierArgs.damageMultAdd += (float)Mathf.Max(1, buffCount) * damageBuffPerStack; if (!damageInfo.crit) { damageInfo.damageColorIndex = (DamageColorIndex)14; } } } private void KnockbackFinUtil_ModifyDamageInfo(orig_ModifyDamageInfo orig, ref DamageInfo damageInfo, CharacterBody attacker, CharacterBody victim) { } } public class FocusCrystalSelfDamage : FixBase<FocusCrystalSelfDamage> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Focus Crystal Self Damage"; public override string ConfigDescriptionString => "Prevents Focus Crystal from applying to self damage."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0070: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "NearbyDamageBonus") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<Inventory>(x, "GetItemCountEffective") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<int, HealthComponent, DamageInfo, int>>((Func<int, HealthComponent, DamageInfo, int>)delegate(int itemCount, HealthComponent self, DamageInfo damageInfo) { if (itemCount > 0 && Object.op_Implicit((Object)(object)self.body) && Object.op_Implicit((Object)(object)damageInfo.attacker) && (Object)(object)((Component)self.body).gameObject == (Object)(object)damageInfo.attacker) { itemCount = 0; } return itemCount; }); } else { Debug.LogError((object)"RiskyFixes: Items FixFocusCrystalSelfDamage IL Hook failed"); } } } internal class LongstandingSolitudeNullref : FixBase<LongstandingSolitudeNullref> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Client-Side) Longstanding Solitude Nullref Fix"; public override string ConfigDescriptionString => "Fixes a nullref related to this item."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown TeamManager.LongstandingSolitudesInParty += new hook_LongstandingSolitudesInParty(TeamManager_LongstandingSolitudesInParty); } private int TeamManager_LongstandingSolitudesInParty(orig_LongstandingSolitudesInParty orig) { int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (Object.op_Implicit((Object)(object)instance) && Object.op_Implicit((Object)(object)instance.master)) { CharacterBody body = instance.master.GetBody(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.inventory) && body.inventory.GetItemCount(Items.OnLevelUpFreeUnlock) > 0) { num += body.inventory.GetItemCount(Items.OnLevelUpFreeUnlock); } } } return num; } } public class SaferSpacesCooldown : FixBase<SaferSpacesCooldown> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Safer Spaces Cooldown"; public override string ConfigDescriptionString => "Fixes Safer Spaces starting with +1 stacks."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private void HealthComponent_TakeDamageProcess(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); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "BearVoid") })) { int index = val.Index; val.Index = index + 1; val.EmitDelegate<Func<int, int>>((Func<int, int>)((int itemCount) => itemCount - 1)); } else { Debug.LogError((object)"RiskyFixes: SaferSpacesCoodlown IL Hook failed."); } } } public class SaferSpacesInvulnProc : FixBase<SaferSpacesInvulnProc> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Safer Spaces Invuln Fix"; public override string ConfigDescriptionString => "Fixes Safer Spaces being wasted when hit while invincible."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_004e: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs), "BearVoidReady") })) { int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<bool, HealthComponent, DamageInfo, bool>>((Func<bool, HealthComponent, DamageInfo, bool>)delegate(bool hasBuff, HealthComponent self, DamageInfo damageInfo) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (!hasBuff) { return false; } bool flag = !damageInfo.rejected && !self.godMode; if (Object.op_Implicit((Object)(object)self.body)) { bool flag2 = self.body.HasBuff(Buffs.Immune) && !self.body.HasBuff(Buffs.GoldEmpowered); bool flag3 = self.body.HasBuff(Buffs.HiddenInvincibility) && !((Enum)damageInfo.damageType.damageType).HasFlag((Enum)(object)(DamageType)2); bool flag4 = (DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageTypeExtended)134217728)) == 0) & self.body.HasBuff(Buffs.SojournVehicle); flag = flag && !flag3 && !flag2 && !flag4; } return flag; }); } else { Debug.LogError((object)"RiskyFixes: SaferSpacesInvulnProc IL Hook failed."); } } } public class ScorpionSelfProc : FixBase<ScorpionSelfProc> { public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Symbiotic Scorpion Self Proc"; public override string ConfigDescriptionString => "Fixes cases where Symbiotic Scorpion can proc on self damage."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: 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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "PermanentDebuffOnHit") })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_1); val.EmitDelegate<Func<BuffDef, HealthComponent, DamageInfo, BuffDef>>((Func<BuffDef, HealthComponent, DamageInfo, BuffDef>)((BuffDef buff, HealthComponent self, DamageInfo damageInfo) => ((Object)(object)((Component)self).gameObject != (Object)(object)damageInfo.attacker) ? buff : null)); } else { Debug.LogError((object)"RiskyFixes: ScorpionSelfProc IL Hook failed"); } } } public class VoidsentNewtProc : FixBase<VoidsentNewtProc> { private BodyIndex newtIndex; public override string ConfigCategoryString => "Items"; public override string ConfigOptionName => "(Server-Side) Voidsent Flame disabled in Bazaar"; public override string ConfigDescriptionString => "Prevents Voidsent Flame from proccing against the Newt due to the risk of crashing."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad)); HealthComponent.TakeDamageProcess += new Manipulator(HealthComponent_TakeDamageProcess); } private void HealthComponent_TakeDamageProcess(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "ExplodeOnDeathVoid") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<ItemDef, HealthComponent, ItemDef>>((Func<ItemDef, HealthComponent, ItemDef>)((ItemDef item, HealthComponent self) => (self.body.bodyIndex == newtIndex) ? null : item)); } else { Debug.LogError((object)"RiskyFixes: VoidsentNewtProc IL Hook Failed."); } } private void OnLoad() { //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) newtIndex = BodyCatalog.FindBodyIndex("ShopkeeperBody"); } } } namespace RiskyFixes.Fixes.General { public class BulletFix : FixBase<BulletFix> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Client-Side) Bullet Self-Hit Fix"; public override string ConfigDescriptionString => "Fixes bulletattacks sometimes being able to hit yourself."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown BulletAttack.ProcessHitList += new hook_ProcessHitList(BulletAttack_ProcessHitList); } private GameObject BulletAttack_ProcessHitList(orig_ProcessHitList orig, BulletAttack self, List<BulletHit> hits, ref Vector3 endPosition, List<GameObject> ignoreList) { if (Object.op_Implicit((Object)(object)self.owner)) { ignoreList.Add(self.owner); } return orig.Invoke(self, hits, ref endPosition, ignoreList); } } public class DroneVendorMultishopNullref : FixBase<DroneVendorMultishopNullref> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Client-Side) DroneVendorMultiShopController.OnDestroy Nullref"; public override string ConfigDescriptionString => "Fixes this nullref."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown DroneVendorMultiShopController.OnDestroy += new hook_OnDestroy(DroneVendorMultiShopController_OnDestroy); } private void DroneVendorMultiShopController_OnDestroy(orig_OnDestroy orig, DroneVendorMultiShopController self) { if (self._terminals != null) { self._terminals = self._terminals.Where((DroneVendorTerminalBehavior t) => (Object)(object)t != (Object)null).ToArray(); } orig.Invoke(self); } } public class HiddenNames : FixBase<HiddenNames> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Client-Side) Hidden Names Fix"; public override string ConfigDescriptionString => "Fixes people sometimes having hidden names by refreshing the list on stage start."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { Stage.onStageStartGlobal += Stage_onStageStartGlobal; } private void Stage_onStageStartGlobal(Stage obj) { foreach (NetworkUser instances in NetworkUser.instancesList) { instances.UpdateUserName(); } } } public class ModdedPrismaticTrials : FixBase<ModdedPrismaticTrials> { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_ClientSubmitLeaderboardScore <>9__8_0; public static hook_OnEnable <>9__8_1; internal void <ApplyChanges>b__8_0(orig_ClientSubmitLeaderboardScore orig, WeeklyRun self, RunReport runReport) { } internal void <ApplyChanges>b__8_1(orig_OnEnable orig, DisableIfGameModded self) { } } public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "Prismatic Trials"; public override string ConfigDescriptionString => "Enables Prismatic Trials while modded. Runs will not count towards the Leaderboard."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown object obj = <>c.<>9__8_0; if (obj == null) { hook_ClientSubmitLeaderboardScore val = delegate { }; <>c.<>9__8_0 = val; obj = (object)val; } WeeklyRun.ClientSubmitLeaderboardScore += (hook_ClientSubmitLeaderboardScore)obj; object obj2 = <>c.<>9__8_1; if (obj2 == null) { hook_OnEnable val2 = delegate { }; <>c.<>9__8_1 = val2; obj2 = (object)val2; } DisableIfGameModded.OnEnable += (hook_OnEnable)obj2; } } public class MultipleGoldShrine : FixBase<MultipleGoldShrine> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Server-Side) Shrine of Gold Spawnlimit"; public override string ConfigDescriptionString => "Limits Shrine of Gold to 1 per stage."; protected override void ApplyChanges() { //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) InteractableSpawnCard val = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/Base/ShrineGoldshoresAccess/iscShrineGoldshoresAccess.asset").WaitForCompletion(); val.maxSpawnsPerStage = 1; } } public class Playercount : FixBase<Playercount> { private static int maxPlayersOnStage; public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Server-Side) Playercount Fix"; public override string ConfigDescriptionString => "Fixes disconnected players counting towards the playercount."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown Stage.Start += new hook_Start(Stage_Start); Hook val = new Hook((MethodBase)Reflection.GetMethodCached(typeof(Run), "get_participatingPlayerCount"), Reflection.GetMethodCached(typeof(Playercount), "GetParticipatingPlayerCountHook")); } private IEnumerator Stage_Start(orig_Start orig, Stage self) { maxPlayersOnStage = 0; return orig.Invoke(self); } private static int GetParticipatingPlayerCountHook(Run self) { return GetConnectedPlayers(); } public static int GetConnectedPlayers() { int num = 0; foreach (PlayerCharacterMasterController instance in PlayerCharacterMasterController.instances) { if (instance.isConnected) { num++; } } if (num > maxPlayersOnStage) { maxPlayersOnStage = num; } else { num = maxPlayersOnStage; } num *= ModCompat.MultitudesCompat.GetMultiplier(); num *= ModCompat.ZetArtifactsCompat.Multifact.GetMultiplier(); if (num != 0) { num += ModCompat.MultitudesDifficultyCompat.GetAdditional(); } return num; } } public class RemoveMenuAdvertisement : FixBase<RemoveMenuAdvertisement> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Client-Side) Remove Main Menu Advertisement"; public override string ConfigDescriptionString => "Removes the DLC advertisement from the main menu."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown MPButton.Awake += new hook_Awake(MPButton_Awake); } private void MPButton_Awake(orig_Awake orig, MPButton self) { if (((Object)self).name == "PlatformStoreButton") { Object.Destroy((Object)(object)((Component)self).gameObject); } else { orig.Invoke(self); } } } public class Slayer : FixBase<Slayer> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Server-Side) Slayer Procs"; public override string ConfigDescriptionString => "Fixes Slayer damagetype (bonus damage to low health) not affecting procs."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess); } private void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { //IL_0002: 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 result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 if ((int)DamageTypeCombo.op_Implicit(damageInfo.damageType & DamageTypeCombo.op_Implicit((DamageType)524288)) == 524288) { ref DamageType damageType = ref damageInfo.damageType.damageType; damageType = (DamageType)((uint)damageType & 0xFFF7FFFFu); damageInfo.damage *= Mathf.Lerp(3f, 1f, self.combinedHealthFraction); } orig.Invoke(self, damageInfo); } } public class SmallHoldoutCharging : FixBase<SmallHoldoutCharging> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Server-Side) Small Holdout Charging"; public override string ConfigDescriptionString => "Small holdouts charge at full speed as long as 1 player is in the radius."; protected override void ApplyChanges() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) string[] array = new string[7] { "RoR2/Base/moon2/MoonBatteryBlood.prefab", "RoR2/Base/moon2/MoonBatteryDesign.prefab", "RoR2/Base/moon2/MoonBatteryMass.prefab", "RoR2/Base/moon2/MoonBatterySoul.prefab", "RoR2/DLC1/DeepVoidPortalBattery/DeepVoidPortalBattery.prefab", "RoR2/Base/NullSafeWard/NullSafeWard.prefab", "RoR2/Base/moon2/Moon2DropshipZone.prefab" }; string[] array2 = array; foreach (string text in array2) { FixHoldout(Addressables.LoadAssetAsync<GameObject>((object)text).WaitForCompletion()); } } public static void FixHoldout(GameObject gameObject) { if (Object.op_Implicit((Object)(object)gameObject)) { HoldoutZoneController componentInChildren = gameObject.GetComponentInChildren<HoldoutZoneController>(); if (Object.op_Implicit((Object)(object)componentInChildren)) { componentInChildren.playerCountScaling = 0f; } } } } public class TrueKillNullref : FixBase<TrueKillNullref> { public override string ConfigCategoryString => "General"; public override string ConfigOptionName => "(Server-Side) TrueKill Nullref"; public override string ConfigDescriptionString => "Fixes this nullref."; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown CharacterMaster.TrueKill_GameObject_GameObject_DamageTypeCombo += new Manipulator(CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo); } private void CharacterMaster_TrueKill_GameObject_GameObject_DamageTypeCombo(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); int bodyLoc = -1; if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCall<CharacterMaster>(x, "GetBody"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref bodyLoc) }) && val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, bodyLoc), (Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "op_Implicit") }) && val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, bodyLoc), (Instruction x) => ILPatternMatchingExt.MatchCall<Object>(x, "op_Implicit") })) { int index = val.Index; val.Index = index - 1; val.EmitDelegate<Func<CharacterBody, CharacterBody>>((Func<CharacterBody, CharacterBody>)((CharacterBody body) => Object.op_Implicit((Object)(object)body.healthComponent) ? body : null)); } } } } namespace RiskyFixes.Fixes.Enemies { public class CollectiveEliteIcon : FixBase<CollectiveEliteIcon> { public override string ConfigCategoryString => "Enenemies - DLC3"; public override string ConfigOptionName => "Collective Elite Icon"; public override string ConfigDescriptionString => "Fixes missing Collective Elite Icon."; protected override void ApplyChanges() { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) BuffDef val = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/DLC3/Collective/bdEliteCollective.asset").WaitForCompletion(); if ((Object)(object)val.iconSprite == (Object)null) { val.iconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/DLC3/Collective/texEliteCollectiveIcon.png").WaitForCompletion(); } } } public class SolusSpawnrates : FixBase<SolusSpawnrates> { public override string ConfigCategoryString => "Enenemies - DLC3"; public override string ConfigOptionName => "Fix spawncosts."; public override string ConfigDescriptionString => "Fix spawncosts for most DLC3 enemies being set too low."; protected override void ApplyChanges() { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_005d: Unknown result type (might be due to invalid IL or missing references) SetSpawnCost(Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/WorkerUnit/cscWorkerUnit.asset").WaitForCompletion(), 16); SetSpawnCost(Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/Tanker/cscTanker.asset").WaitForCompletion(), 35); SetSpawnCost(Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/MinePod/cscMinePod.asset").WaitForCompletion(), 52); SetSpawnCost(Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/DLC3/DefectiveUnit/cscDefectiveUnit.asset").WaitForCompletion(), 54); } private void SetSpawnCost(CharacterSpawnCard csc, int cost) { if (((SpawnCard)csc).directorCreditCost < cost) { ((SpawnCard)csc).directorCreditCost = cost; } } } } namespace RiskyFixes.Fixes.Enemies.MagmaWorm { public class FixFallDeath : FixBase<FixFallDeath> { private BodyIndex magmaWormIndex; private BodyIndex overloadingWormIndex; public override string ConfigCategoryString => "Enemies - Magma Worm"; public override string ConfigOptionName => "(Server-Side) Prevent Fall Death"; public override string ConfigDescriptionString => "Prevents Magma Worms from dying to fall triggers."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(RoR2Application_OnLoad)); CharacterBody.Start += new hook_Start(CharacterBody_Start); } private void CharacterBody_Start(orig_Start orig, CharacterBody self) { //IL_0017: 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_0025: 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) orig.Invoke(self); if (Object.op_Implicit((Object)(object)self.inventory) && (self.bodyIndex == magmaWormIndex || self.bodyIndex == overloadingWormIndex)) { self.inventory.GiveItem(Items.TeleportWhenOob, 1); } } private void RoR2Application_OnLoad() { //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_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) magmaWormIndex = BodyCatalog.FindBodyIndex("MagmaWormBody"); overloadingWormIndex = BodyCatalog.FindBodyIndex("ElectricWormBody"); } } } namespace RiskyFixes.Fixes.Enemies.Grandparent { internal class GhostFriendlyFire : FixBase<GhostFriendlyFire> { public override string ConfigCategoryString => "Enemies - Grandparent"; public override string ConfigOptionName => "(Server-Side) Disable Ghost Friendly Fire."; public override string ConfigDescriptionString => "Prevents ghosts from teamkilling you."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //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 GrandParentSunController.ServerFixedUpdate += new Manipulator(GrandParentSunController_ServerFixedUpdate); GrandParentSunController.FixedUpdate += new Manipulator(GrandParentSunController_FixedUpdate); } private void GrandParentSunController_FixedUpdate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<HealthComponent>(x, "body") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<CharacterBody, GrandParentSunController, CharacterBody>>((Func<CharacterBody, GrandParentSunController, CharacterBody>)delegate(CharacterBody victimBody, GrandParentSunController self) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 GameObject ownerObject = self.ownership.ownerObject; if (Object.op_Implicit((Object)(object)ownerObject)) { TeamComponent component = ownerObject.GetComponent<TeamComponent>(); if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)victimBody) && Object.op_Implicit((Object)(object)victimBody.teamComponent) && (int)victimBody.teamComponent.teamIndex == 1) { return null; } } return victimBody; }); } else { Debug.LogError((object)"RiskyFixes: Grandparent GhostFriendlyFire FixedUpdate IL Hook failed"); } } private void GrandParentSunController_ServerFixedUpdate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<HurtBox>(x, "healthComponent") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<HealthComponent, GrandParentSunController, HealthComponent>>((Func<HealthComponent, GrandParentSunController, HealthComponent>)delegate(HealthComponent victimHealth, GrandParentSunController self) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 GameObject ownerObject = self.ownership.ownerObject; if (Object.op_Implicit((Object)(object)ownerObject)) { TeamComponent component = ownerObject.GetComponent<TeamComponent>(); if (Object.op_Implicit((Object)(object)component) && (int)component.teamIndex == 1 && Object.op_Implicit((Object)(object)victimHealth) && Object.op_Implicit((Object)(object)victimHealth.body.teamComponent) && (int)victimHealth.body.teamComponent.teamIndex == 1) { return null; } } return victimHealth; }); } else { Debug.LogError((object)"RiskyFixes: Grandparent GhostFriendlyFire ServerFixedUpdate IL Hook failed"); } } } } namespace RiskyFixes.Fixes.Enemies.DefectiveUnit { public class DefectiveDeathNullref : FixBase<DefectiveDeathNullref> { public override string ConfigCategoryString => "Enemies - Solus Invalidator"; public override string ConfigOptionName => "(Client-Side) Death Nullref Fix"; public override string ConfigDescriptionString => "Fixes this nullref"; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown DeathState.AttemptDeathBehavior += new Manipulator(DeathState_AttemptDeathBehavior); } private void DeathState_AttemptDeathBehavior(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld<DeathState>(x, "deathEffect") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<GameObject, DeathState, GameObject>>((Func<GameObject, DeathState, GameObject>)((GameObject effect, DeathState self) => Object.op_Implicit((Object)(object)((GenericCharacterDeath)self).cachedModelTransform) ? effect : null)); } else { Debug.LogError((object)"RiskyFixes: DefectiveDeathNullref IL hook failed."); } } } } namespace RiskyFixes.Fixes.Enemies.ClayBoss { public class GhostFriendlyFire : FixBase<GhostFriendlyFire> { public override string ConfigCategoryString => "Enemies - Clay Dunestrider"; public override string ConfigOptionName => "(Server-Side) Disable Ghost Friendly Fire"; public override string ConfigDescriptionString => "Prevents ghosts from teamkilling you."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown Recover.FireTethers += new Manipulator(Recover_FireTethers); } private void Recover_FireTethers(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallvirt<BullseyeSearch>(x, "RefreshCandidates") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<BullseyeSearch, Recover, BullseyeSearch>>((Func<BullseyeSearch, Recover, BullseyeSearch>)delegate(BullseyeSearch search, Recover self) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 if ((int)((BaseState)self).GetTeam() == 1) { ((TeamMask)(ref search.teamMaskFilter)).RemoveTeam((TeamIndex)1); } return search; }); } else { Debug.LogError((object)"RiskyFixes: ClayBoss Recover_FireTethers IL Hook failed"); } } } } namespace RiskyFixes.Fixes.Enemies.BrotherHurt { public class NoPhase4Skip : FixBase<NoPhase4Skip> { private BodyIndex brotherHurtIndex; public override string ConfigCategoryString => "Enemies - Mithrix (Phase 4)"; public override string ConfigOptionName => "(Server-Side) Prevent Phase Skip"; public override string ConfigDescriptionString => "Fixes the bug where Mithrix is instakilled if he takes damage at the start of the phase."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Brother/BrotherHurtBody.prefab").WaitForCompletion(); val.AddComponent<Phase4ImmuneComponent>(); RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, new Action(OnLoad)); HealthComponent.TakeDamageProcess += new hook_TakeDamageProcess(HealthComponent_TakeDamageProcess); SpellBaseState.OnExit += new hook_OnExit(SpellBaseState_OnExit); } private void SpellBaseState_OnExit(orig_OnExit orig, SpellBaseState self) { Phase4ImmuneComponent component = ((EntityState)self).GetComponent<Phase4ImmuneComponent>(); if (Object.op_Implicit((Object)(object)component) && component.spawnImmuneDuration > 0.1f) { component.spawnImmuneDuration = 0.1f; } orig.Invoke(self); } private void HealthComponent_TakeDamageProcess(orig_TakeDamageProcess orig, HealthComponent self, DamageInfo damageInfo) { //IL_000e: 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) if (NetworkServer.active && self.body.bodyIndex == brotherHurtIndex && Object.op_Implicit((Object)(object)((Component)self).GetComponent<Phase4ImmuneComponent>())) { damageInfo.rejected = true; } orig.Invoke(self, damageInfo); } private void OnLoad() { //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) brotherHurtIndex = BodyCatalog.FindBodyIndex("BrotherHurtBody"); } } public class Phase4ImmuneComponent : MonoBehaviour { public float spawnImmuneDuration = 10f; private void Awake() { if (!NetworkServer.active) { Object.Destroy((Object)(object)this); } } private void FixedUpdate() { spawnImmuneDuration -= Time.fixedDeltaTime; if (spawnImmuneDuration <= 0f) { Object.Destroy((Object)(object)this); } } } } namespace RiskyFixes.Fixes.Enemies.ArtifactReliquary { public class PreventArtifactHeal : FixBase<PreventArtifactHeal> { public override string ConfigCategoryString => "Enemies - Artifact Reliquary"; public override string ConfigOptionName => "(Server-Side) Prevent Heal"; public override string ConfigDescriptionString => "Prevents Artifact Reliquary from healing and softlocking runs."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown HealthComponent.Heal += new hook_Heal(HealthComponent_Heal); } private float HealthComponent_Heal(orig_Heal orig, HealthComponent self, float amount, ProcChainMask procChainMask, bool nonRegen) { //IL_0014: 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_0038: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)self.body) && self.body.bodyIndex == BodyPrefabs.ArtifactShellBody.bodyIndex) { return 0f; } return orig.Invoke(self, amount, procChainMask, nonRegen); } } } namespace RiskyFixes.Fixes.Elites { public class MendingHealCore : FixBase<MendingHealCore> { public override string ConfigCategoryString => "Elites"; public override string ConfigOptionName => "(Server-Side) Mending Healing Core Level Scaling"; public override string ConfigDescriptionString => "Fixes Healing Cores not scaling with level."; protected override void ApplyChanges() { //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) GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/EliteEarth/AffixEarthHealerBody.prefab").WaitForCompletion(); CharacterBody component = val.GetComponent<CharacterBody>(); component.levelMaxHealth = component.baseMaxHealth * 0.3f; component.levelDamage = component.baseDamage * 0.2f; } } } namespace RiskyFixes.Fixes.Artifacts { public class EnigmaBlacklistCheck : FixBase<EnigmaBlacklistCheck> { public override string ConfigCategoryString => "Artifacts"; public override string ConfigOptionName => "(Server-Side) Enigma Blacklist Fix"; public override string ConfigDescriptionString => "Fixes blacklisted equipment being able to spawn during Enigma runs."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown EnigmaArtifactManager.OnRunStartGlobal += new hook_OnRunStartGlobal(EnigmaArtifactManager_OnRunStartGlobal); } private void EnigmaArtifactManager_OnRunStartGlobal(orig_OnRunStartGlobal orig, Run run) { //IL_001f: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(run); List<EquipmentIndex> list = new List<EquipmentIndex>(); foreach (EquipmentIndex item in EnigmaArtifactManager.validEquipment) { if (!Run.instance.availableEquipment.Contains(item)) { list.Add(item); } } foreach (EquipmentIndex item2 in list) { EnigmaArtifactManager.validEquipment.Remove(item2); } } } public class VengeanceLevel : FixBase<VengeanceLevel> { public override string ConfigCategoryString => "Artifacts"; public override string ConfigOptionName => "(Server-Side) Vengeance Umbra Level"; public override string ConfigDescriptionString => "Vengeance Umbras copy player levels."; public override bool StopLoadOnConfigDisable => true; protected override void ApplyChanges() { if (ModCompat.AIBlacklist.pluginLoaded) { Debug.LogWarning((object)"RiskyFixes: Disabling VengeanceLevel due to AI Blacklist being loaded."); } else { CharacterMaster.onStartGlobal += RunVengeanceChanges; } } private void RunVengeanceChanges(CharacterMaster self) { if (NetworkServer.active && Object.op_Implicit((Object)(object)self.inventory) && self.inventory.GetItemCount(Items.InvadingDoppelganger) > 0) { int itemCount = self.inventory.GetItemCount(Items.UseAmbientLevel); if (itemCount > 0) { self.inventory.RemoveItem(Items.UseAmbientLevel, itemCount); } int itemCount2 = self.inventory.GetItemCount(Items.LevelBonus); if (itemCount2 > 0) { self.inventory.RemoveItem(Items.LevelBonus, itemCount2); } self.inventory.GiveItem(Items.LevelBonus, (int)(TeamManager.instance.GetTeamLevel((TeamIndex)1) - 1)); } } } }