Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of VanillaSurvivorTweaks v0.1.0
VanillaSurvivorTweaks.dll
Decompiled 2 days agousing System; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Commando; using EntityStates.Commando.CommandoWeapon; using EntityStates.Huntress; using EntityStates.Huntress.HuntressWeapon; using EntityStates.Mage.Weapon; using IL.EntityStates.Commando; using IL.EntityStates.Engi.EngiWeapon; using IL.EntityStates.Mage.Weapon; using IL.RoR2; using IL.RoR2.Orbs; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.Commando.CommandoWeapon; using R2API; using RoR2; using RoR2.Orbs; using RoR2.Projectile; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using VanillaSurvivorTweaks.Survivors; [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("VanillaSurvivorTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+b4302d439b6f24aee3abd081a442b23d64f1a9e7")] [assembly: AssemblyProduct("VanillaSurvivorTweaks")] [assembly: AssemblyTitle("VanillaSurvivorTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace VanillaSurvivorTweaks { internal class Log { internal static ManualLogSource _logSource; private string _classNameTag; internal Log(string className) { _classNameTag = "[" + className + "] "; } internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal void LogDebug(object data) { _logSource.LogDebug((object)(_classNameTag + data)); } internal void LogError(object data) { _logSource.LogError((object)(_classNameTag + data)); } internal void LogFatal(object data) { _logSource.LogFatal((object)(_classNameTag + data)); } internal void LogInfo(object data) { _logSource.LogInfo((object)(_classNameTag + data)); } internal void LogMessage(object data) { _logSource.LogMessage((object)(_classNameTag + data)); } internal void LogWarning(object data) { _logSource.LogWarning((object)(_classNameTag + data)); } internal void LogInstrNotFound(ILContext il) { LogError("GoToNext instructions not found at method: " + (object)il.Method); } } [BepInPlugin("OakPrime.VanillaSurvivorTweaks", "VanillaSurvivorTweaks", "0.1.0")] public class VanillaSurvivorTweaks : BaseUnityPlugin { public const string PluginGUID = "OakPrime.VanillaSurvivorTweaks"; public const string PluginAuthor = "OakPrime"; public const string PluginName = "VanillaSurvivorTweaks"; public const string PluginVersion = "0.1.0"; public static ManualLogSource logger; public void Awake() { logger = ((BaseUnityPlugin)this).Logger; Log.Init(logger); try { Init(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)(ex.Message + " - " + ex.StackTrace)); } } private void Init() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown ConfigFile configFile = new ConfigFile(Paths.ConfigPath + "\\OakPrime.VanillaSurvivorTweaks.cfg", true); Artificer.TryInit(configFile); Commando.TryInit(configFile); Engineer.TryInit(configFile); Huntress.TryInit(configFile); } } } namespace VanillaSurvivorTweaks.Survivors { public static class Artificer { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__7_2; public static Func<Instruction, bool> <>9__7_3; public static Func<Instruction, bool> <>9__7_4; public static Func<Instruction, bool> <>9__8_2; public static Func<Instruction, bool> <>9__8_3; public static Func<Instruction, bool> <>9__8_4; public static Manipulator <>9__8_0; public static Func<GameObject, GameObject> <>9__8_5; public static Manipulator <>9__8_1; internal bool <TweakIonSurgeCooldown>b__7_2(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdarg(x, ref num); } internal bool <TweakIonSurgeCooldown>b__7_3(Instruction x) { MethodReference val = default(MethodReference); return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val); } internal bool <TweakIonSurgeCooldown>b__7_4(Instruction x) { ILLabel val = default(ILLabel); return ILPatternMatchingExt.MatchBrfalse(x, ref val); } internal void <TweakFlamethrowerRange>b__8_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = default(int); MethodReference val2 = default(MethodReference); val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) }); val.Index += 2; val.Emit(OpCodes.Ldc_R4, _flameRangeIncrease); val.Emit(OpCodes.Mul); } internal bool <TweakFlamethrowerRange>b__8_2(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdarg(x, ref num); } internal bool <TweakFlamethrowerRange>b__8_3(Instruction x) { FieldReference val = default(FieldReference); return ILPatternMatchingExt.MatchLdfld(x, ref val); } internal bool <TweakFlamethrowerRange>b__8_4(Instruction x) { MethodReference val = default(MethodReference); return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val); } internal void <TweakFlamethrowerRange>b__8_1(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0018: 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_0076: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Index += 2; val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldfld, typeof(Flamethrower).GetField("flamethrowerEffectPrefab")); val.EmitDelegate<Func<GameObject, GameObject>>((Func<GameObject, GameObject>)delegate(GameObject prefab) { //IL_000d: 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_002c: Unknown result type (might be due to invalid IL or missing references) prefab.transform.localScale = new Vector3(prefab.transform.localScale.x, prefab.transform.localScale.y, _flameRangeIncrease); return prefab; }); val.Emit(OpCodes.Stfld, typeof(Flamethrower).GetField("flamethrowerEffectPrefab")); } internal GameObject <TweakFlamethrowerRange>b__8_5(GameObject prefab) { //IL_000d: 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_002c: Unknown result type (might be due to invalid IL or missing references) prefab.transform.localScale = new Vector3(prefab.transform.localScale.x, prefab.transform.localScale.y, _flameRangeIncrease); return prefab; } } private static Log _logger = new Log("Artificer"); private static bool _jetCdPauseUntilLand; private static bool _flameSprint; private static float _flameRangeIncrease; public static void TryInit(ConfigFile configFile) { bool value = configFile.Bind<bool>("Artificer", "Enable Artificer Tweaks", true, "Enables changes for Artificer.").Value; _jetCdPauseUntilLand = configFile.Bind<bool>("Artificer", "Enable Ion Surge Cooldown Nerf", true, "Pauses Ion Surge's cooldown until ground has been touched at least once.").Value; _flameSprint = configFile.Bind<bool>("Artificer", "Enable Spring During Flamethrower", true, "Allows Artificer to spring while using Flamethrower").Value; _flameRangeIncrease = configFile.Bind<float>("Artificer", "Artificer Flamethrower Range Increase", 1.5f, "Multiplies Artificer's Flamethrower range by this number.").Value; if (_flameRangeIncrease < 0f) { _flameRangeIncrease = 1f; } if (value) { Init(); } } private static void Init() { //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) try { if (_flameSprint) { SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Mage/MageBodyFlamethrower.asset").WaitForCompletion(); if (Object.op_Implicit((Object)(object)val)) { val.canceledFromSprinting = false; val.cancelSprintingOnActivation = true; } } if (_jetCdPauseUntilLand) { TweakIonSurgeCooldown(); } if ((double)_flameRangeIncrease != 1.0) { TweakFlamethrowerRange(); } } catch (Exception ex) { _logger.LogError(ex.Message + " - " + ex.StackTrace); } } private static void UpdateText() { LanguageAPI.Add("HUNTRESS_SECONDARY_DESCRIPTION", "Throw a seeking glaive that bounces up to <style=cIsDamage>6</style> times for <style=cIsDamage>250% damage</style>. Damage increases by <style=cIsDamage>15%</style> per bounce."); } private static void TweakIonSurgeCooldown() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown SkillDef ionSurge = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Mage/MageBodyFlyUp.asset").WaitForCompletion(); if (Object.op_Implicit((Object)(object)ionSurge)) { ionSurge.isCooldownBlockedUntilManuallyReset = true; } CharacterMotor.OnLanded += (Manipulator)delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = default(int); GenericSkill val2 = default(GenericSkill); if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchBrfalse(x, ref val2) })) { _logger.LogInstrNotFound(il); } else { val.Index += 3; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<CharacterMotor>>((Action<CharacterMotor>)delegate(CharacterMotor motor) { CharacterBody body = motor.body; val2 = ((body == null) ? null : body.skillLocator?.special); if ((Object)(object)((val2 != null) ? val2.skillDef : null) == (Object)(object)ionSurge) { _logger.LogDebug("Skill matched! Removing CD block..."); motor.body.skillLocator.special.SetBlockedCooldownSkillState(false); } else { _logger.LogDebug(((object)ionSurge)?.ToString() + " != " + (object)((val2 != null) ? val2.skillDef : null)); } }); } }; } private static void TweakFlamethrowerRange() { //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) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) ILCursor val3 = new ILCursor(il); int num = default(int); MethodReference val4 = default(MethodReference); val3.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val4) }); val3.Index += 2; val3.Emit(OpCodes.Ldc_R4, _flameRangeIncrease); val3.Emit(OpCodes.Mul); }; <>c.<>9__8_0 = val; obj = (object)val; } Flamethrower.FireGauntlet += (Manipulator)obj; object obj2 = <>c.<>9__8_1; if (obj2 == null) { Manipulator val2 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0018: 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_0076: Unknown result type (might be due to invalid IL or missing references) ILCursor val3 = new ILCursor(il); val3.Index += 2; val3.Emit(OpCodes.Ldarg_0); val3.Emit(OpCodes.Ldarg_0); val3.Emit(OpCodes.Ldfld, typeof(Flamethrower).GetField("flamethrowerEffectPrefab")); val3.EmitDelegate<Func<GameObject, GameObject>>((Func<GameObject, GameObject>)delegate(GameObject prefab) { //IL_000d: 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_002c: Unknown result type (might be due to invalid IL or missing references) prefab.transform.localScale = new Vector3(prefab.transform.localScale.x, prefab.transform.localScale.y, _flameRangeIncrease); return prefab; }); val3.Emit(OpCodes.Stfld, typeof(Flamethrower).GetField("flamethrowerEffectPrefab")); }; <>c.<>9__8_1 = val2; obj2 = (object)val2; } Flamethrower.OnEnter += (Manipulator)obj2; } } internal class Commando { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__5_3; public static Func<Instruction, bool> <>9__5_4; public static Func<Instruction, bool> <>9__5_5; public static Action<DodgeState> <>9__5_2; public static Manipulator <>9__5_0; public static Func<Instruction, bool> <>9__5_7; public static Func<Instruction, bool> <>9__5_8; public static Func<Instruction, bool> <>9__5_9; public static Action<DodgeState> <>9__5_6; public static Manipulator <>9__5_1; public static hook_ModifyProjectileInfo <>9__6_0; internal void <TweakTacticalDive>b__5_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); FieldReference val2 = default(FieldReference); if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { _logger.LogInstrNotFound(il); return; } val.Index += 2; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<DodgeState>>((Action<DodgeState>)delegate(DodgeState dodgeState) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { ((EntityState)dodgeState).characterBody.AddBuff(Buffs.HiddenInvincibility.buffIndex); } }); } internal bool <TweakTacticalDive>b__5_3(Instruction x) { MethodReference val = default(MethodReference); return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val); } internal bool <TweakTacticalDive>b__5_4(Instruction x) { FieldReference val = default(FieldReference); return ILPatternMatchingExt.MatchStfld(x, ref val); } internal bool <TweakTacticalDive>b__5_5(Instruction x) { return ILPatternMatchingExt.MatchRet(x); } internal void <TweakTacticalDive>b__5_2(DodgeState dodgeState) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { ((EntityState)dodgeState).characterBody.AddBuff(Buffs.HiddenInvincibility.buffIndex); } } internal void <TweakTacticalDive>b__5_1(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = default(int); MethodReference val2 = default(MethodReference); if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2), (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { _logger.LogInstrNotFound(il); return; } val.Index += 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Action<DodgeState>>((Action<DodgeState>)delegate(DodgeState dodgeState) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { ((EntityState)dodgeState).characterBody.RemoveBuff(Buffs.HiddenInvincibility.buffIndex); } }); } internal bool <TweakTacticalDive>b__5_7(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdarg(x, ref num); } internal bool <TweakTacticalDive>b__5_8(Instruction x) { MethodReference val = default(MethodReference); return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val); } internal bool <TweakTacticalDive>b__5_9(Instruction x) { return ILPatternMatchingExt.MatchRet(x); } internal void <TweakTacticalDive>b__5_6(DodgeState dodgeState) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { ((EntityState)dodgeState).characterBody.RemoveBuff(Buffs.HiddenInvincibility.buffIndex); } } internal void <TweakGrenades>b__6_0(orig_ModifyProjectileInfo orig, ThrowGrenade self, ref FireProjectileInfo projInfo) { orig.Invoke(self, ref projInfo); ProjectileImpactExplosion component = projInfo.projectilePrefab.GetComponent<ProjectileImpactExplosion>(); component.timerAfterImpact = false; component.lifetime = component.lifetimeAfterImpact; } } private static Log _logger = new Log("Commando"); private static bool _grenadeFuseOnThrow; public static void TryInit(ConfigFile configFile) { bool value = configFile.Bind<bool>("Commando", "Enable Commando Tweaks", true, "Enables changes for Commando.").Value; _grenadeFuseOnThrow = configFile.Bind<bool>("Commando", "Grenade fuse starts on throw", true, "Instead of upon impact, grenade fuse starts on throw").Value; if (value) { Init(); } } private static void Init() { try { if (_grenadeFuseOnThrow) { TweakGrenades(); } } catch (Exception ex) { _logger.LogError(ex.Message + " - " + ex.StackTrace); } } private static void UpdateText() { LanguageAPI.Add("HUNTRESS_SECONDARY_DESCRIPTION", "Throw a seeking glaive that bounces up to <style=cIsDamage>6</style> times for <style=cIsDamage>250% damage</style>. Damage increases by <style=cIsDamage>15%</style> per bounce."); } private static void TweakTacticalDive() { //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__5_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ILCursor val3 = new ILCursor(il); FieldReference val4 = default(FieldReference); if (!val3.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { _logger.LogInstrNotFound(il); } else { val3.Index += 2; val3.Emit(OpCodes.Ldarg_0); val3.EmitDelegate<Action<DodgeState>>((Action<DodgeState>)delegate(DodgeState dodgeState) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { ((EntityState)dodgeState).characterBody.AddBuff(Buffs.HiddenInvincibility.buffIndex); } }); } }; <>c.<>9__5_0 = val; obj = (object)val; } DodgeState.OnEnter += (Manipulator)obj; object obj2 = <>c.<>9__5_1; if (obj2 == null) { Manipulator val2 = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) ILCursor val3 = new ILCursor(il); int num = default(int); MethodReference val4 = default(MethodReference); if (!val3.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val4), (Instruction x) => ILPatternMatchingExt.MatchRet(x) })) { _logger.LogInstrNotFound(il); } else { val3.Index += 1; val3.Emit(OpCodes.Ldarg_0); val3.EmitDelegate<Action<DodgeState>>((Action<DodgeState>)delegate(DodgeState dodgeState) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { ((EntityState)dodgeState).characterBody.RemoveBuff(Buffs.HiddenInvincibility.buffIndex); } }); } }; <>c.<>9__5_1 = val2; obj2 = (object)val2; } DodgeState.OnExit += (Manipulator)obj2; } private static void TweakGrenades() { //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 object obj = <>c.<>9__6_0; if (obj == null) { hook_ModifyProjectileInfo val = delegate(orig_ModifyProjectileInfo orig, ThrowGrenade self, ref FireProjectileInfo projInfo) { orig.Invoke(self, ref projInfo); ProjectileImpactExplosion component = projInfo.projectilePrefab.GetComponent<ProjectileImpactExplosion>(); component.timerAfterImpact = false; component.lifetime = component.lifetimeAfterImpact; }; <>c.<>9__6_0 = val; obj = (object)val; } ThrowGrenade.ModifyProjectileInfo += (hook_ModifyProjectileInfo)obj; } } public static class Engineer { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__5_1; public static Func<Instruction, bool> <>9__5_2; public static Manipulator <>9__5_0; public static Func<Instruction, bool> <>9__6_1; public static Manipulator <>9__6_0; internal void <TweakGrenades>b__5_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); ILLabel val2 = default(ILLabel); if (!val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "EntityStates.Engi.EngiWeapon.ChargeGrenades", "totalDuration"), (Instruction x) => ILPatternMatchingExt.MatchBge(x, ref val2) })) { _logger.LogInstrNotFound(il); return; } int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldc_R4, 0f); val.Emit(OpCodes.Mul); } internal bool <TweakGrenades>b__5_1(Instruction x) { return ILPatternMatchingExt.MatchLdfld(x, "EntityStates.Engi.EngiWeapon.ChargeGrenades", "totalDuration"); } internal bool <TweakGrenades>b__5_2(Instruction x) { ILLabel val = default(ILLabel); return ILPatternMatchingExt.MatchBge(x, ref val); } internal void <TweakPressureMines>b__6_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "RoR2.Projectile.FireProjectileInfo", "force") })) { _logger.LogInstrNotFound(il); return; } val.Emit(OpCodes.Ldc_R4, 10000f); val.Emit(OpCodes.Add); } internal bool <TweakPressureMines>b__6_1(Instruction x) { return ILPatternMatchingExt.MatchStfld(x, "RoR2.Projectile.FireProjectileInfo", "force"); } } private static Log _logger = new Log("Engineer"); private static bool _holdGrenadeChargeForever; public static void TryInit(ConfigFile configFile) { bool value = configFile.Bind<bool>("Engineer", "Enable Engineer Tweaks", true, "Enables changes for Engineer.").Value; _holdGrenadeChargeForever = configFile.Bind<bool>("Engineer", "Hold Grenades Indefinitely", true, "Grenades no longer fire at max charge, only when you release the button.").Value; if (value) { Init(); } } private static void Init() { try { if (_holdGrenadeChargeForever) { TweakGrenades(); } } catch (Exception ex) { _logger.LogError(ex.Message + " - " + ex.StackTrace); } } private static void UpdateText() { LanguageAPI.Add("HUNTRESS_SECONDARY_DESCRIPTION", "Throw a seeking glaive that bounces up to <style=cIsDamage>6</style> times for <style=cIsDamage>250% damage</style>. Damage increases by <style=cIsDamage>15%</style> per bounce."); } private static void TweakGrenades() { //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 object obj = <>c.<>9__5_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); ILLabel val3 = default(ILLabel); if (!val2.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "EntityStates.Engi.EngiWeapon.ChargeGrenades", "totalDuration"), (Instruction x) => ILPatternMatchingExt.MatchBge(x, ref val3) })) { _logger.LogInstrNotFound(il); } else { int index = val2.Index; val2.Index = index - 1; val2.Emit(OpCodes.Ldc_R4, 0f); val2.Emit(OpCodes.Mul); } }; <>c.<>9__5_0 = val; obj = (object)val; } ChargeGrenades.FixedUpdate += (Manipulator)obj; } private static void TweakPressureMines() { //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 object obj = <>c.<>9__6_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); if (!val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStfld(x, "RoR2.Projectile.FireProjectileInfo", "force") })) { _logger.LogInstrNotFound(il); } else { val2.Emit(OpCodes.Ldc_R4, 10000f); val2.Emit(OpCodes.Add); } }; <>c.<>9__6_0 = val; obj = (object)val; } FireMines.OnEnter += (Manipulator)obj; } } public static class Huntress { private enum AdditionalBounceTargets { None, Self, AlliesAndSelf } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action <>9__6_0; public static Func<Instruction, bool> <>9__10_3; public static Func<Instruction, bool> <>9__10_4; public static Func<bool, LightningOrb, bool> <>9__10_1; public static Func<Instruction, bool> <>9__10_5; public static Func<HurtBox, LightningOrb, HurtBox> <>9__10_2; public static Manipulator <>9__10_0; internal void <Init>b__6_0() { //IL_0035: 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) ThrowGlaive.damageCoefficientPerBounce = _glaiveBounceMul; ThrowGlaive.glaiveProcCoefficient = _glaiveProcCoeff; ArrowRain.arrowRainRadius *= _arrowRainRadiusMul; Transform transform = ((Component)ArrowRain.projectilePrefab.GetComponent<ProjectileDotZone>()).transform; transform.localScale *= _arrowRainRadiusMul; _logger.LogDebug("ArrowRain proc before: " + ArrowRain.projectilePrefab.GetComponent<ProjectileDotZone>().overlapProcCoefficient); } internal void <TweakGlaiveBounce>b__10_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = default(int); HurtBox val2 = default(HurtBox); if (!val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val2) })) { _logger.LogInstrNotFound(il); return; } val.Index += 2; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<bool, LightningOrb, bool>>((Func<bool, LightningOrb, bool>)((bool isObj, LightningOrb orb) => isObj && ((int)orb.lightningType != 4 || (int)((Orb)orb).target.teamIndex != 1))); if (!val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<LightningOrb>(x, "PickNextTarget") })) { _logger.LogInstrNotFound(il); return; } int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<HurtBox, LightningOrb, HurtBox>>((Func<HurtBox, LightningOrb, HurtBox>)delegate(HurtBox hurtBox, LightningOrb orb) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hurtBox) || (int)orb.lightningType != 4) { _logger.LogDebug("Enemy target already found."); return hurtBox; } _logger.LogDebug("No enemy targets nearby, searching for ally targets..."); val2 = PickNextAllyTarget(orb, ((Component)((Orb)orb).target).transform.position); _logger.LogDebug("Valid ally found: " + Object.op_Implicit((Object)(object)val2)); return val2; }); } internal bool <TweakGlaiveBounce>b__10_3(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchLdloc(x, ref num); } internal bool <TweakGlaiveBounce>b__10_4(Instruction x) { MethodReference val = default(MethodReference); return ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val); } internal bool <TweakGlaiveBounce>b__10_1(bool isObj, LightningOrb orb) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 return isObj && ((int)orb.lightningType != 4 || (int)((Orb)orb).target.teamIndex != 1); } internal bool <TweakGlaiveBounce>b__10_5(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<LightningOrb>(x, "PickNextTarget"); } internal HurtBox <TweakGlaiveBounce>b__10_2(HurtBox hurtBox, LightningOrb orb) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hurtBox) || (int)orb.lightningType != 4) { _logger.LogDebug("Enemy target already found."); return hurtBox; } _logger.LogDebug("No enemy targets nearby, searching for ally targets..."); HurtBox val = PickNextAllyTarget(orb, ((Component)((Orb)orb).target).transform.position); _logger.LogDebug("Valid ally found: " + Object.op_Implicit((Object)(object)val)); return val; } } private static Log _logger = new Log("Huntress"); private static float _glaiveProcCoeff; private static float _glaiveBounceMul; private static float _arrowRainRadiusMul; private static AdditionalBounceTargets _additionalBounceTargets; public static void TryInit(ConfigFile configFile) { bool value = configFile.Bind<bool>("Huntress", "Enable Huntress Tweaks", true, "Enables changes for Huntress.").Value; _additionalBounceTargets = configFile.Bind<AdditionalBounceTargets>("Huntress", "Additional Glaive Bounce Targets", AdditionalBounceTargets.Self, "If no other valid targets are available, Glaive can bounce off of these kinds of targets too.").Value; _glaiveProcCoeff = configFile.Bind<float>("Huntress", "Glaive Proc Coefficient", 1f, "Sets Glaive's proc coefficient.\nDefault: 1.0f\nVanilla: 0.8f").Value; _glaiveBounceMul = configFile.Bind<float>("Huntress", "Glaive Bounce Multiplier", 1.15f, "Multiplies Glaive's damage by X per bounce.\nDefault: 1.15\nVanilla: 1.10").Value; _arrowRainRadiusMul = configFile.Bind<float>("Huntress", "Arrow Rain Radius Multiplier", 1.3f, "Multiplies Arrow Rain's radius by X.\nDefault: 1.3\nVanilla: 1.0").Value; if (value) { Init(); } } private static void Init() { try { RoR2Application.onLoad = (Action)Delegate.Combine(RoR2Application.onLoad, (Action)delegate { //IL_0035: 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) ThrowGlaive.damageCoefficientPerBounce = _glaiveBounceMul; ThrowGlaive.glaiveProcCoefficient = _glaiveProcCoeff; ArrowRain.arrowRainRadius *= _arrowRainRadiusMul; Transform transform = ((Component)ArrowRain.projectilePrefab.GetComponent<ProjectileDotZone>()).transform; transform.localScale *= _arrowRainRadiusMul; _logger.LogDebug("ArrowRain proc before: " + ArrowRain.projectilePrefab.GetComponent<ProjectileDotZone>().overlapProcCoefficient); }); if (_additionalBounceTargets != AdditionalBounceTargets.None) { TweakGlaiveBounce(); } UpdateText(); } catch (Exception ex) { _logger.LogError(ex.Message + " - " + ex.StackTrace); } } private static void UpdateText() { LanguageAPI.Add("HUNTRESS_SECONDARY_DESCRIPTION", "Throw a seeking glaive that bounces up to <style=cIsDamage>6</style> times for <style=cIsDamage>250% damage</style>. Damage increases by <style=cIsDamage>" + (_glaiveBounceMul - 1f) * 100f + "%</style> per bounce."); } private static HurtBox PickNextAllyTarget(LightningOrb orb, Vector3 position) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown if (orb.search == null) { orb.search = new BullseyeSearch(); } orb.search.searchOrigin = position; orb.search.searchDirection = Vector3.zero; orb.search.teamMaskFilter = TeamMask.none; ((TeamMask)(ref orb.search.teamMaskFilter)).AddTeam(orb.teamIndex); orb.search.filterByLoS = false; orb.search.sortMode = (SortMode)1; orb.search.maxDistanceFilter = orb.range; orb.search.RefreshCandidates(); HurtBox val = (from v in orb.search.GetResults() where !orb.bouncedObjects.Contains(v.healthComponent) && (_additionalBounceTargets != AdditionalBounceTargets.Self || (Object)(object)v.healthComponent == (Object)(object)orb.attacker.GetComponent<HealthComponent>()) select v).FirstOrDefault(); if (Object.op_Implicit((Object)(object)val)) { orb.bouncedObjects.Add(val.healthComponent); } return val; } private static void TweakGlaiveBounce() { //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 object obj = <>c.<>9__10_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); int num = default(int); HurtBox val3 = default(HurtBox); if (!val2.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, ref val3) })) { _logger.LogInstrNotFound(il); } else { val2.Index += 2; val2.Emit(OpCodes.Ldarg_0); val2.EmitDelegate<Func<bool, LightningOrb, bool>>((Func<bool, LightningOrb, bool>)((bool isObj, LightningOrb orb) => isObj && ((int)orb.lightningType != 4 || (int)((Orb)orb).target.teamIndex != 1))); if (!val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<LightningOrb>(x, "PickNextTarget") })) { _logger.LogInstrNotFound(il); } else { int index = val2.Index; val2.Index = index + 1; val2.Emit(OpCodes.Ldarg_0); val2.EmitDelegate<Func<HurtBox, LightningOrb, HurtBox>>((Func<HurtBox, LightningOrb, HurtBox>)delegate(HurtBox hurtBox, LightningOrb orb) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)hurtBox) || (int)orb.lightningType != 4) { _logger.LogDebug("Enemy target already found."); return hurtBox; } _logger.LogDebug("No enemy targets nearby, searching for ally targets..."); val3 = PickNextAllyTarget(orb, ((Component)((Orb)orb).target).transform.position); _logger.LogDebug("Valid ally found: " + Object.op_Implicit((Object)(object)val3)); return val3; }); } } }; <>c.<>9__10_0 = val; obj = (object)val; } LightningOrb.OnArrival += (Manipulator)obj; } } }