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 LevelStats v1.2.0
plugins/LevelStats/LevelStats.dll
Decompiled 5 months 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 IL.RoR2; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using RoR2; using UnityEngine; [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("LevelStats")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LevelStats")] [assembly: AssemblyTitle("LevelStats")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TPDespair.LevelStats; [BepInPlugin("com.TPDespair.LevelStats", "LevelStats", "1.2.0")] public class LevelStatsPlugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__33_8; public static Func<Instruction, bool> <>9__33_9; public static Func<Instruction, bool> <>9__33_10; public static Func<Instruction, bool> <>9__33_4; public static Func<Instruction, bool> <>9__33_5; public static Func<CharacterBody, float, float> <>9__33_7; public static Manipulator <>9__33_0; public static Func<Instruction, bool> <>9__34_6; public static Func<Instruction, bool> <>9__34_7; public static Func<Instruction, bool> <>9__34_8; public static Func<Instruction, bool> <>9__34_3; public static Func<CharacterBody, float, float> <>9__34_5; public static Manipulator <>9__34_0; public static Func<Instruction, bool> <>9__35_6; public static Func<Instruction, bool> <>9__35_7; public static Func<Instruction, bool> <>9__35_8; public static Func<Instruction, bool> <>9__35_3; public static Func<CharacterBody, float, float> <>9__35_5; public static Manipulator <>9__35_0; public static Func<Instruction, bool> <>9__36_6; public static Func<Instruction, bool> <>9__36_7; public static Func<Instruction, bool> <>9__36_8; public static Func<Instruction, bool> <>9__36_3; public static Func<CharacterBody, float, float> <>9__36_5; public static Manipulator <>9__36_0; public static Func<Instruction, bool> <>9__37_14; public static Func<Instruction, bool> <>9__37_15; public static Func<Instruction, bool> <>9__37_16; public static Func<Instruction, bool> <>9__37_17; public static Func<Instruction, bool> <>9__37_18; public static Func<Instruction, bool> <>9__37_19; public static Func<Instruction, bool> <>9__37_2; public static Func<Instruction, bool> <>9__37_3; public static Func<Instruction, bool> <>9__37_4; public static Func<Instruction, bool> <>9__37_6; public static Func<Instruction, bool> <>9__37_8; public static Func<Instruction, bool> <>9__37_9; public static Func<Instruction, bool> <>9__37_11; public static Func<Instruction, bool> <>9__37_12; public static Func<CharacterBody, float, float, float> <>9__37_13; public static Manipulator <>9__37_0; public static hook_RecalculateStats <>9__38_0; internal void <MovementSpeedHook>b__33_0(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass33_0 CS$<>8__locals0 = new <>c__DisplayClass33_0(); ILCursor val = new ILCursor(il); CS$<>8__locals0.BaseSpeedLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMoveSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMoveSpeed") }) && !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.BaseSpeedLocIndex) })) { logSource.LogWarning((object)"MovementSpeedHook Failed - Could not find BaseSpeedLocIndex"); return; } CS$<>8__locals0.MultSpeedLocIndex = -1; CS$<>8__locals0.DivSpeedLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, CS$<>8__locals0.BaseSpeedLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.MultSpeedLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.DivSpeedLocIndex), (Instruction x) => ILPatternMatchingExt.MatchDiv(x), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, CS$<>8__locals0.BaseSpeedLocIndex) })) { val.Index += 1; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, CS$<>8__locals0.MultSpeedLocIndex); val.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerMovSpdLevel.Value * (self.level - 1f); } return value; }); val.Emit(OpCodes.Stloc, CS$<>8__locals0.MultSpeedLocIndex); val.Emit(OpCodes.Ldloc, CS$<>8__locals0.BaseSpeedLocIndex); } else { logSource.LogWarning((object)"MovementSpeedHook Failed"); } } internal bool <MovementSpeedHook>b__33_8(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMoveSpeed"); } internal bool <MovementSpeedHook>b__33_9(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <MovementSpeedHook>b__33_10(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMoveSpeed"); } internal bool <MovementSpeedHook>b__33_4(Instruction x) { return ILPatternMatchingExt.MatchDiv(x); } internal bool <MovementSpeedHook>b__33_5(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal float <MovementSpeedHook>b__33_7(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerMovSpdLevel.Value * (self.level - 1f); } return value; } internal void <AttackSpeedHook>b__34_0(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass34_0 CS$<>8__locals0 = new <>c__DisplayClass34_0(); ILCursor val = new ILCursor(il); CS$<>8__locals0.BaseAtkSpdLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseAttackSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelAttackSpeed") }) && !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.BaseAtkSpdLocIndex) })) { logSource.LogWarning((object)"AttackSpeedHook Failed - Could not find BaseAtkSpdLocIndex"); return; } CS$<>8__locals0.MultAtkSpdLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, CS$<>8__locals0.BaseAtkSpdLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.MultAtkSpdLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, CS$<>8__locals0.BaseAtkSpdLocIndex) })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, CS$<>8__locals0.MultAtkSpdLocIndex); val.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerAtkSpdLevel.Value * (self.level - 1f); } return value; }); val.Emit(OpCodes.Stloc, CS$<>8__locals0.MultAtkSpdLocIndex); } else { logSource.LogWarning((object)"AttackSpeedHook Failed"); } } internal bool <AttackSpeedHook>b__34_6(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseAttackSpeed"); } internal bool <AttackSpeedHook>b__34_7(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <AttackSpeedHook>b__34_8(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelAttackSpeed"); } internal bool <AttackSpeedHook>b__34_3(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal float <AttackSpeedHook>b__34_5(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerAtkSpdLevel.Value * (self.level - 1f); } return value; } internal void <DamageHook>b__35_0(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass35_0 CS$<>8__locals0 = new <>c__DisplayClass35_0(); ILCursor val = new ILCursor(il); CS$<>8__locals0.BaseDamageLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseDamage"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelDamage") }) && !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.BaseDamageLocIndex) })) { logSource.LogWarning((object)"DamageHook Failed - Could not find BaseDamageLocIndex"); return; } CS$<>8__locals0.MultDamageLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, CS$<>8__locals0.BaseDamageLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.MultDamageLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, CS$<>8__locals0.BaseDamageLocIndex) })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, CS$<>8__locals0.BaseDamageLocIndex); val.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerDamageLevel.Value * (self.level - 1f); } return value; }); val.Emit(OpCodes.Stloc, CS$<>8__locals0.BaseDamageLocIndex); } else { logSource.LogWarning((object)"DamageHook Failed"); } } internal bool <DamageHook>b__35_6(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseDamage"); } internal bool <DamageHook>b__35_7(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <DamageHook>b__35_8(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelDamage"); } internal bool <DamageHook>b__35_3(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal float <DamageHook>b__35_5(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerDamageLevel.Value * (self.level - 1f); } return value; } internal void <HealthHook>b__36_0(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass36_0 CS$<>8__locals0 = new <>c__DisplayClass36_0(); ILCursor val = new ILCursor(il); CS$<>8__locals0.BaseHealthLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMaxHealth"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMaxHealth") }) && !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.BaseHealthLocIndex) })) { logSource.LogWarning((object)"HealthHook Failed - Could not find BaseHealthLocIndex"); return; } CS$<>8__locals0.MultHealthLocIndex = -1; if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, CS$<>8__locals0.BaseHealthLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.MultHealthLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, CS$<>8__locals0.BaseHealthLocIndex) })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, CS$<>8__locals0.BaseHealthLocIndex); val.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerHealthLevel.Value * (self.level - 1f); } return value; }); val.Emit(OpCodes.Stloc, CS$<>8__locals0.BaseHealthLocIndex); } else { logSource.LogWarning((object)"HealthHook Failed"); } } internal bool <HealthHook>b__36_6(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMaxHealth"); } internal bool <HealthHook>b__36_7(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <HealthHook>b__36_8(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMaxHealth"); } internal bool <HealthHook>b__36_3(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal float <HealthHook>b__36_5(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerHealthLevel.Value * (self.level - 1f); } return value; } internal void <RegenHook>b__37_0(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass37_0 CS$<>8__locals0 = new <>c__DisplayClass37_0(); ILCursor val = new ILCursor(il); int num = -1; if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseRegen"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelRegen") }) && !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref BaseRegenLocIndex) })) { logSource.LogWarning((object)"RegenHook Failed - Could not find BaseRegenLocIndex"); return; } num = val.Index; val.Index = 0; CS$<>8__locals0.KnurlCountLocIndex = -1; if (!val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Knurl")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.KnurlCountLocIndex) })) { logSource.LogWarning((object)"RegenHook Failed - Cound not find KnurlCountLocIndex"); return; } val.Index = num; CS$<>8__locals0.KnurlRegenLocIndex = -1; CS$<>8__locals0.LevelRegenScaleLocIndex = -1; float num4 = default(float); if (!val.TryGotoNext(new Func<Instruction, bool>[7] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, CS$<>8__locals0.KnurlCountLocIndex), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num4), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref CS$<>8__locals0.LevelRegenScaleLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.KnurlRegenLocIndex) })) { logSource.LogWarning((object)"RegenHook - Could not find KnurlRegen region! , assuming indexes..."); CS$<>8__locals0.LevelRegenScaleLocIndex = BaseRegenLocIndex + 1; CS$<>8__locals0.KnurlRegenLocIndex = -1; } else { logSource.LogWarning((object)("RegenHook - KnurlRegenLocIndex: " + CS$<>8__locals0.KnurlRegenLocIndex + ", LevelRegenScaleLocIndex: " + CS$<>8__locals0.LevelRegenScaleLocIndex)); if (CS$<>8__locals0.KnurlRegenLocIndex - CS$<>8__locals0.LevelRegenScaleLocIndex > 1) { logSource.LogWarning((object)"RegenHook - These indexes probably shouldnt be this far apart?"); } } CS$<>8__locals0.CrocoRegenLocIndex = -1; if (!val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs).GetField("CrocoRegen")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount") }) || !val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.CrocoRegenLocIndex) })) { logSource.LogWarning((object)"RegenHook Failed - Could not find CrocoRegen Region!"); return; } if (CS$<>8__locals0.KnurlRegenLocIndex == -1) { CS$<>8__locals0.KnurlRegenLocIndex = CS$<>8__locals0.CrocoRegenLocIndex + 1; } int num3 = default(int); if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num3) })) { val.Emit(OpCodes.Ldarg, 0); val.Emit(OpCodes.Ldloc, CS$<>8__locals0.KnurlRegenLocIndex); val.Emit(OpCodes.Ldloc, CS$<>8__locals0.LevelRegenScaleLocIndex); val.EmitDelegate<Func<CharacterBody, float, float, float>>((Func<CharacterBody, float, float, float>)delegate(CharacterBody self, float value, float scaling) { float num2 = 0f; if (IsPlayer(self)) { num2 += PlayerRegenLevel.Value * (self.level - 1f); } if (num2 != 0f) { value += num2 * scaling; } return value; }); val.Emit(OpCodes.Stloc, CS$<>8__locals0.KnurlRegenLocIndex); } else { logSource.LogWarning((object)"RegenHook Failed"); } } internal bool <RegenHook>b__37_14(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseRegen"); } internal bool <RegenHook>b__37_15(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 0); } internal bool <RegenHook>b__37_16(Instruction x) { return ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelRegen"); } internal bool <RegenHook>b__37_17(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref BaseRegenLocIndex); } internal bool <RegenHook>b__37_18(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Knurl")); } internal bool <RegenHook>b__37_19(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <RegenHook>b__37_2(Instruction x) { return ILPatternMatchingExt.MatchConvR4(x); } internal bool <RegenHook>b__37_3(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool <RegenHook>b__37_4(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal bool <RegenHook>b__37_6(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal bool <RegenHook>b__37_8(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs).GetField("CrocoRegen")); } internal bool <RegenHook>b__37_9(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount"); } internal bool <RegenHook>b__37_11(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 1f); } internal bool <RegenHook>b__37_12(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchStloc(x, ref num); } internal float <RegenHook>b__37_13(CharacterBody self, float value, float scaling) { float num = 0f; if (IsPlayer(self)) { num += PlayerRegenLevel.Value * (self.level - 1f); } if (num != 0f) { value += num * scaling; } return value; } internal void <ArmorHook>b__38_0(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && IsPlayer(self)) { self.armor += PlayerArmorLevel.Value * (self.level - 1f); } } } [CompilerGenerated] private sealed class <>c__DisplayClass33_0 { public int BaseSpeedLocIndex; public int MultSpeedLocIndex; public int DivSpeedLocIndex; internal bool <MovementSpeedHook>b__11(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref BaseSpeedLocIndex); } internal bool <MovementSpeedHook>b__1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, BaseSpeedLocIndex); } internal bool <MovementSpeedHook>b__2(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ref MultSpeedLocIndex); } internal bool <MovementSpeedHook>b__3(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ref DivSpeedLocIndex); } internal bool <MovementSpeedHook>b__6(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, BaseSpeedLocIndex); } } [CompilerGenerated] private sealed class <>c__DisplayClass34_0 { public int BaseAtkSpdLocIndex; public int MultAtkSpdLocIndex; internal bool <AttackSpeedHook>b__9(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref BaseAtkSpdLocIndex); } internal bool <AttackSpeedHook>b__1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, BaseAtkSpdLocIndex); } internal bool <AttackSpeedHook>b__2(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ref MultAtkSpdLocIndex); } internal bool <AttackSpeedHook>b__4(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, BaseAtkSpdLocIndex); } } [CompilerGenerated] private sealed class <>c__DisplayClass35_0 { public int BaseDamageLocIndex; public int MultDamageLocIndex; internal bool <DamageHook>b__9(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref BaseDamageLocIndex); } internal bool <DamageHook>b__1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, BaseDamageLocIndex); } internal bool <DamageHook>b__2(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ref MultDamageLocIndex); } internal bool <DamageHook>b__4(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, BaseDamageLocIndex); } } [CompilerGenerated] private sealed class <>c__DisplayClass36_0 { public int BaseHealthLocIndex; public int MultHealthLocIndex; internal bool <HealthHook>b__9(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref BaseHealthLocIndex); } internal bool <HealthHook>b__1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, BaseHealthLocIndex); } internal bool <HealthHook>b__2(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ref MultHealthLocIndex); } internal bool <HealthHook>b__4(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, BaseHealthLocIndex); } } [CompilerGenerated] private sealed class <>c__DisplayClass37_0 { public int KnurlCountLocIndex; public int LevelRegenScaleLocIndex; public int KnurlRegenLocIndex; public int CrocoRegenLocIndex; internal bool <RegenHook>b__20(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref KnurlCountLocIndex); } internal bool <RegenHook>b__1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, KnurlCountLocIndex); } internal bool <RegenHook>b__5(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ref LevelRegenScaleLocIndex); } internal bool <RegenHook>b__7(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref KnurlRegenLocIndex); } internal bool <RegenHook>b__10(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref CrocoRegenLocIndex); } } public const string ModVer = "1.2.0"; public const string ModName = "LevelStats"; public const string ModGuid = "com.TPDespair.LevelStats"; public static ManualLogSource logSource; public static int BaseRegenLocIndex = -1; public static ConfigEntry<float> PlayerMovSpdLevel { get; set; } public static ConfigEntry<float> PlayerAtkSpdLevel { get; set; } public static ConfigEntry<float> PlayerDamageLevel { get; set; } public static ConfigEntry<float> PlayerHealthLevel { get; set; } public static ConfigEntry<float> PlayerRegenLevel { get; set; } public static ConfigEntry<float> PlayerArmorLevel { get; set; } public void Awake() { RoR2Application.isModded = true; NetworkModCompatibilityHelper.networkModList = NetworkModCompatibilityHelper.networkModList.Append("com.TPDespair.LevelStats:1.2.0"); logSource = ((BaseUnityPlugin)this).Logger; SetupConfig(((BaseUnityPlugin)this).Config); StatHooks(); } private static void SetupConfig(ConfigFile Config) { PlayerMovSpdLevel = Config.Bind<float>("PlayerStats", "PlayerMovSpdLevel", 0.015f, "Movement Speed increase granted per Level."); PlayerAtkSpdLevel = Config.Bind<float>("PlayerStats", "PlayerAtkSpdLevel", 0.01f, "Attack Speed increase granted per Level."); PlayerDamageLevel = Config.Bind<float>("PlayerStats", "PlayerDamageLevel", 0f, "Added Damage per Level. This is not a percent increase! Most survivors have around 12 (+2.4 per level) damage."); PlayerHealthLevel = Config.Bind<float>("PlayerStats", "PlayerHealthLevel", 0f, "Added Health per Level. This is not a percent increase! Most survivors have around 110 (+33 per level) health."); PlayerRegenLevel = Config.Bind<float>("PlayerStats", "PlayerRegenLevel", 0.1f, "Added Health Regeneration per Level. This is not a percent increase! Most survivors have around 1 hp/s (+0.2 hp/s per level) regeneration."); PlayerArmorLevel = Config.Bind<float>("PlayerStats", "PlayerArmorLevel", 0f, "Added Armor per Level. This is not a percent increase! Most survivors have 0 or 20 armor."); } private static void StatHooks() { MovementSpeedHook(); AttackSpeedHook(); DamageHook(); HealthHook(); RegenHook(); ArmorHook(); } private static bool IsPlayer(CharacterBody body) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Invalid comparison between Unknown and I4 return (int)body.teamComponent.teamIndex == 1; } private static void MovementSpeedHook() { //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__33_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); int BaseSpeedLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMoveSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMoveSpeed") }) && !val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref BaseSpeedLocIndex) })) { logSource.LogWarning((object)"MovementSpeedHook Failed - Could not find BaseSpeedLocIndex"); } else { int MultSpeedLocIndex = -1; int DivSpeedLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[6] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, BaseSpeedLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref MultSpeedLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref DivSpeedLocIndex), (Instruction x) => ILPatternMatchingExt.MatchDiv(x), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, BaseSpeedLocIndex) })) { val2.Index += 1; val2.Emit(OpCodes.Pop); val2.Emit(OpCodes.Ldarg, 0); val2.Emit(OpCodes.Ldloc, MultSpeedLocIndex); val2.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerMovSpdLevel.Value * (self.level - 1f); } return value; }); val2.Emit(OpCodes.Stloc, MultSpeedLocIndex); val2.Emit(OpCodes.Ldloc, BaseSpeedLocIndex); } else { logSource.LogWarning((object)"MovementSpeedHook Failed"); } } }; <>c.<>9__33_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (Manipulator)obj; } private static void AttackSpeedHook() { //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__34_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); int BaseAtkSpdLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseAttackSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelAttackSpeed") }) && !val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref BaseAtkSpdLocIndex) })) { logSource.LogWarning((object)"AttackSpeedHook Failed - Could not find BaseAtkSpdLocIndex"); } else { int MultAtkSpdLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, BaseAtkSpdLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref MultAtkSpdLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, BaseAtkSpdLocIndex) })) { val2.Emit(OpCodes.Ldarg, 0); val2.Emit(OpCodes.Ldloc, MultAtkSpdLocIndex); val2.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerAtkSpdLevel.Value * (self.level - 1f); } return value; }); val2.Emit(OpCodes.Stloc, MultAtkSpdLocIndex); } else { logSource.LogWarning((object)"AttackSpeedHook Failed"); } } }; <>c.<>9__34_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (Manipulator)obj; } private static void DamageHook() { //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__35_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); int BaseDamageLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseDamage"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelDamage") }) && !val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref BaseDamageLocIndex) })) { logSource.LogWarning((object)"DamageHook Failed - Could not find BaseDamageLocIndex"); } else { int MultDamageLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, BaseDamageLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref MultDamageLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, BaseDamageLocIndex) })) { val2.Emit(OpCodes.Ldarg, 0); val2.Emit(OpCodes.Ldloc, BaseDamageLocIndex); val2.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerDamageLevel.Value * (self.level - 1f); } return value; }); val2.Emit(OpCodes.Stloc, BaseDamageLocIndex); } else { logSource.LogWarning((object)"DamageHook Failed"); } } }; <>c.<>9__35_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (Manipulator)obj; } private static void HealthHook() { //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__36_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); int BaseHealthLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseMaxHealth"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelMaxHealth") }) && !val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref BaseHealthLocIndex) })) { logSource.LogWarning((object)"HealthHook Failed - Could not find BaseHealthLocIndex"); } else { int MultHealthLocIndex = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, BaseHealthLocIndex), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref MultHealthLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, BaseHealthLocIndex) })) { val2.Emit(OpCodes.Ldarg, 0); val2.Emit(OpCodes.Ldloc, BaseHealthLocIndex); val2.EmitDelegate<Func<CharacterBody, float, float>>((Func<CharacterBody, float, float>)delegate(CharacterBody self, float value) { if (IsPlayer(self)) { value += PlayerHealthLevel.Value * (self.level - 1f); } return value; }); val2.Emit(OpCodes.Stloc, BaseHealthLocIndex); } else { logSource.LogWarning((object)"HealthHook Failed"); } } }; <>c.<>9__36_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (Manipulator)obj; } private static void RegenHook() { //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__37_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0437: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); int num = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "baseRegen"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "levelRegen") }) && !val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref BaseRegenLocIndex) })) { logSource.LogWarning((object)"RegenHook Failed - Could not find BaseRegenLocIndex"); } else { num = val2.Index; val2.Index = 0; int KnurlCountLocIndex = -1; if (!val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Knurl")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref KnurlCountLocIndex) })) { logSource.LogWarning((object)"RegenHook Failed - Cound not find KnurlCountLocIndex"); } else { val2.Index = num; int KnurlRegenLocIndex = -1; int LevelRegenScaleLocIndex = -1; float num4 = default(float); if (!val2.TryGotoNext(new Func<Instruction, bool>[7] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, KnurlCountLocIndex), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num4), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref LevelRegenScaleLocIndex), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref KnurlRegenLocIndex) })) { logSource.LogWarning((object)"RegenHook - Could not find KnurlRegen region! , assuming indexes..."); LevelRegenScaleLocIndex = BaseRegenLocIndex + 1; KnurlRegenLocIndex = -1; } else { logSource.LogWarning((object)("RegenHook - KnurlRegenLocIndex: " + KnurlRegenLocIndex + ", LevelRegenScaleLocIndex: " + LevelRegenScaleLocIndex)); if (KnurlRegenLocIndex - LevelRegenScaleLocIndex > 1) { logSource.LogWarning((object)"RegenHook - These indexes probably shouldnt be this far apart?"); } } int CrocoRegenLocIndex = -1; if (!val2.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Buffs).GetField("CrocoRegen")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "GetBuffCount") }) || !val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CrocoRegenLocIndex) })) { logSource.LogWarning((object)"RegenHook Failed - Could not find CrocoRegen Region!"); } else { if (KnurlRegenLocIndex == -1) { KnurlRegenLocIndex = CrocoRegenLocIndex + 1; } int num3 = default(int); if (val2.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 1f), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num3) })) { val2.Emit(OpCodes.Ldarg, 0); val2.Emit(OpCodes.Ldloc, KnurlRegenLocIndex); val2.Emit(OpCodes.Ldloc, LevelRegenScaleLocIndex); val2.EmitDelegate<Func<CharacterBody, float, float, float>>((Func<CharacterBody, float, float, float>)delegate(CharacterBody self, float value, float scaling) { float num2 = 0f; if (IsPlayer(self)) { num2 += PlayerRegenLevel.Value * (self.level - 1f); } if (num2 != 0f) { value += num2 * scaling; } return value; }); val2.Emit(OpCodes.Stloc, KnurlRegenLocIndex); } else { logSource.LogWarning((object)"RegenHook Failed"); } } } } }; <>c.<>9__37_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (Manipulator)obj; } private static void ArmorHook() { //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__38_0; if (obj == null) { hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (Object.op_Implicit((Object)(object)self) && IsPlayer(self)) { self.armor += PlayerArmorLevel.Value * (self.level - 1f); } }; <>c.<>9__38_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj; } }