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 CombatRework v1.0.0
CombatRework.dll
Decompiled 2 years 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 CombatRework.Components; using CombatRework.Hooks; using EntityStates; using IL.EntityStates; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using On.RoR2; using R2API; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterAI; using RoR2.Skills; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("CombatRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("CombatRework")] [assembly: AssemblyTitle("CombatRework")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CombatRework { [BepInPlugin("HIFU.CombatRework", "CombatRework", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Main : BaseUnityPlugin { public const string PluginGUID = "HIFU.CombatRework"; public const string PluginAuthor = "HIFU"; public const string PluginName = "CombatRework"; public const string PluginVersion = "1.0.0"; public static ManualLogSource ASLogger; public static BuffDef slowdownBuff; public static BuffDef slowdownJumpBuff; public static BodyIndex huntressBodyIndex; public static ConfigEntry<bool> important1 { get; set; } public static ConfigEntry<bool> important2 { get; set; } public static ConfigEntry<bool> important3 { get; set; } public static ConfigEntry<bool> important4 { get; set; } public static ConfigEntry<bool> important5 { get; set; } public static ConfigEntry<bool> important6 { get; set; } public static ConfigEntry<float> slowdownPercent { get; set; } public static ConfigEntry<float> slowdownLinger { get; set; } public static ConfigEntry<bool> slowdownAgile { get; set; } public static ConfigEntry<bool> slowdownScale { get; set; } public static ConfigEntry<float> slowdownJumpPercent { get; set; } public static ConfigEntry<float> slowdownJumpLinger { get; set; } public static ConfigEntry<bool> changeCombatSkills { get; set; } public static ConfigEntry<bool> changeAgileSkills { get; set; } public static ConfigEntry<bool> fixHurtBoxes { get; set; } public static ConfigEntry<float> sprintSpeedMin { get; set; } public static ConfigEntry<float> sprintSpeedMax { get; set; } public static ConfigEntry<float> huntressSprintSpeedMin { get; set; } public static ConfigEntry<float> huntressSprintSpeedMax { get; set; } public static ConfigEntry<float> sprintSpeedDurationToMax { get; set; } public static ConfigEntry<float> hyperbolicSpeedCap { get; set; } public static ConfigEntry<bool> enemyAIChanges { get; set; } public void Awake() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Expected O, but got Unknown //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) ASLogger = ((BaseUnityPlugin)this).Logger; AddBuffs(); AddConfig(); if (changeCombatSkills.Value) { SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Engi/EngiHarpoons.asset").WaitForCompletion(); val.isCombatSkill = true; } if (changeAgileSkills.Value) { SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyWhirlwind.asset").WaitForCompletion(); val2.cancelSprintingOnActivation = false; SkillDef val3 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyUppercut.asset").WaitForCompletion(); val3.cancelSprintingOnActivation = false; SkillDef val4 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Merc/MercBodyEvisProjectile.asset").WaitForCompletion(); val4.cancelSprintingOnActivation = false; SkillDef val5 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Huntress/HuntressBodyGlaive.asset").WaitForCompletion(); val5.cancelSprintingOnActivation = false; SkillDef val6 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/Base/Commando/CommandoBodyRoll.asset").WaitForCompletion(); val6.cancelSprintingOnActivation = false; } if (fixHurtBoxes.Value) { GameObject val7 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Croco/CrocoBody.prefab").WaitForCompletion(); SphereCollider component = ((Component)val7.transform.GetChild(0).GetChild(2).Find("TempHurtbox")).GetComponent<SphereCollider>(); ((Component)component).transform.localPosition = new Vector3(0f, 7f, 2f); component.radius = 3.9450002f; GameObject val8 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Toolbot/ToolbotBody.prefab").WaitForCompletion(); CapsuleCollider component2 = ((Component)val8.transform.GetChild(0).GetChild(0).GetChild(0) .GetChild(0) .Find("tempHurtBox")).GetComponent<CapsuleCollider>(); component2.radius = 2.992f; component2.height = 9.632f; GameObject val9 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Treebot/TreebotBody.prefab").WaitForCompletion(); CapsuleCollider component3 = ((Component)val9.transform.GetChild(0).GetChild(0).GetChild(0) .GetChild(0) .Find("TempHurtbox")).GetComponent<CapsuleCollider>(); component3.radius = 0.9372f; component3.height = 2.8116002f; } BodyCatalog.Init += new hook_Init(BodyCatalog_Init); BodyStart.Init(); Movement.Init(); RecalculateStats.Init(); CharacterMaster.Init(); } private void BodyCatalog_Init(orig_Init orig) { //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) orig.Invoke(); huntressBodyIndex = BodyCatalog.FindBodyIndex("HuntressBody(Clone)"); } public void AddConfig() { //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Expected O, but got Unknown //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0344: Expected O, but got Unknown //IL_033f: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Expected O, but got Unknown //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Expected O, but got Unknown //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0374: Expected O, but got Unknown //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038a: Unknown result type (might be due to invalid IL or missing references) //IL_0395: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Expected O, but got Unknown //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03aa: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Expected O, but got Unknown //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f0: Expected O, but got Unknown //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_0411: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Expected O, but got Unknown //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0426: Expected O, but got Unknown //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0457: Expected O, but got Unknown //IL_0452: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Expected O, but got Unknown //IL_0462: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Expected O, but got Unknown //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0482: Unknown result type (might be due to invalid IL or missing references) //IL_048d: Unknown result type (might be due to invalid IL or missing references) //IL_049d: Expected O, but got Unknown //IL_0498: Unknown result type (might be due to invalid IL or missing references) //IL_04a2: Expected O, but got Unknown //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_04ad: Unknown result type (might be due to invalid IL or missing references) //IL_04b8: Unknown result type (might be due to invalid IL or missing references) //IL_04c3: Unknown result type (might be due to invalid IL or missing references) //IL_04d3: Expected O, but got Unknown //IL_04ce: Unknown result type (might be due to invalid IL or missing references) //IL_04d8: Expected O, but got Unknown //IL_04de: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Unknown result type (might be due to invalid IL or missing references) //IL_04ee: Unknown result type (might be due to invalid IL or missing references) //IL_04f9: Unknown result type (might be due to invalid IL or missing references) //IL_0509: Expected O, but got Unknown //IL_0504: Unknown result type (might be due to invalid IL or missing references) //IL_050e: Expected O, but got Unknown //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_053f: Expected O, but got Unknown //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Expected O, but got Unknown //IL_054a: Unknown result type (might be due to invalid IL or missing references) //IL_054f: Unknown result type (might be due to invalid IL or missing references) //IL_055a: Unknown result type (might be due to invalid IL or missing references) //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_0575: Expected O, but got Unknown //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Expected O, but got Unknown //IL_0580: Unknown result type (might be due to invalid IL or missing references) //IL_0585: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05ab: Expected O, but got Unknown //IL_05a6: Unknown result type (might be due to invalid IL or missing references) //IL_05b0: Expected O, but got Unknown //IL_05b6: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Expected O, but got Unknown important1 = ((BaseUnityPlugin)this).Config.Bind<bool>("_! IMPORTANT !", "Important", true, "All players must have the same config in order for the mod to work properly in multiplayer!"); important2 = ((BaseUnityPlugin)this).Config.Bind<bool>("Slowdown", "Important", true, "All players must have the same config in order for the mod to work properly in multiplayer!"); important3 = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes for Slowdown", "Important", true, "All players must have the same config in order for the mod to work properly in multiplayer!"); important4 = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes to Sprinting", "Important", true, "All players must have the same config in order for the mod to work properly in multiplayer!"); important5 = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes to AI", "Important", true, "All players must have the same config in order for the mod to work properly in multiplayer!"); important6 = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes to AI", "Important", true, "All players must have the same config in order for the mod to work properly in multiplayer!"); slowdownPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Slowdown", "Slowdown Percent", 1f, "Decimal. The percent of slow applied while using a combat skill."); slowdownLinger = ((BaseUnityPlugin)this).Config.Bind<float>("Slowdown", "Slowdown Linger", 0.75f, "How long slowdown should linger for after using a combat skill."); slowdownScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Slowdown", "Slowdown Scales?", true, "Should slowdown scale with the main hurtbox size to not feel as shit on survivors with a big hurtbox?"); slowdownJumpPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Slowdown", "Slowdown Jump Percent", 1f, "Decimal. The percent of jump force slow applied while using a combat skill."); slowdownJumpLinger = ((BaseUnityPlugin)this).Config.Bind<float>("Slowdown", "Slowdown Jump Linger", 1.25f, "How long jump slowdown should linger for after using a combat skill."); slowdownAgile = ((BaseUnityPlugin)this).Config.Bind<bool>("Slowdown", "Slowdown Affects Agile?", false, "Should slowdown apply to Agile skills?"); changeCombatSkills = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes for Slowdown", "Change Combat Skills?", true, "Changes some combat skills to count as combat skills."); changeAgileSkills = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes for Slowdown", "Change Agile Skills?", true, "Changes some non-agile skills to be agile."); fixHurtBoxes = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes for Slowdown", "Change Large Hurt Boxes?", true, "Changes Acrid's, REX' and MUL-T's hurt boxes to be smaller."); sprintSpeedMin = ((BaseUnityPlugin)this).Config.Bind<float>("Changes to Sprinting", "Minimum Sprint Speed Multiplier", 0.8f, "Decimal. This is a total multiplier, so the default 1.45x sprint speed is multiplied by this amount."); sprintSpeedMax = ((BaseUnityPlugin)this).Config.Bind<float>("Changes to Sprinting", "Maximum Sprint Speed Multiplier", 1.4f, "Decimal. This is a total multiplier, so the default 1.45x sprint speed is multiplied by this amount."); huntressSprintSpeedMin = ((BaseUnityPlugin)this).Config.Bind<float>("Changes to Sprinting", "Huntress Minimum Sprint Speed Multiplier", 0.85f, "Decimal. This is a total multiplier, so the default 1.45x sprint speed is multiplied by this amount."); huntressSprintSpeedMax = ((BaseUnityPlugin)this).Config.Bind<float>("Changes to Sprinting", "Huntress Maximum Sprint Speed Multiplier", 1.1f, "Decimal. This is a total multiplier, so the default 1.45x sprint speed is multiplied by this amount."); sprintSpeedDurationToMax = ((BaseUnityPlugin)this).Config.Bind<float>("Changes to Sprinting", "Time to achieve Maximum Sprint Speed Multiplier", 5f, ""); hyperbolicSpeedCap = ((BaseUnityPlugin)this).Config.Bind<float>("Changes to Speed", "Hyperbolic Speed Cap", 35f, "The Maximum Speed in m/s that items, buffs, etc slowly approach, but never reach, and never overcome. Set to a negative value to disable."); enemyAIChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("Changes to AI", "Enable Enemy AI Changes?", true, "Changes monsters to have longer range for the most part"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(important2)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(important4)); ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Default Preset", "Slowdown", "Click me to change your preset to Default. Settings don't update visually until you re-open this menu.", "> Click Me <", new UnityAction(DefaultValues))); ModSettingsManager.AddOption((BaseOption)new GenericButtonOption("Inferno Preset", "Slowdown", "Click me to change your preset to Inferno. Settings don't update visually until you re-open this menu.", "> Click Me <", new UnityAction(InfernoValues))); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(slowdownPercent, new StepSliderConfig { min = 0f, max = 10f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(slowdownLinger, new StepSliderConfig { min = 0f, max = 5f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(slowdownScale)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(slowdownJumpPercent, new StepSliderConfig { min = 0f, max = 1f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(slowdownJumpLinger, new StepSliderConfig { min = 0f, max = 5f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(slowdownAgile)); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(sprintSpeedMin, new StepSliderConfig { min = 0f, max = 2f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(sprintSpeedMax, new StepSliderConfig { min = 0f, max = 2f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(huntressSprintSpeedMin, new StepSliderConfig { min = 0f, max = 2f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(huntressSprintSpeedMax, new StepSliderConfig { min = 0f, max = 2f, increment = 0.05f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(sprintSpeedDurationToMax, new StepSliderConfig { min = 0.1f, max = 10f, increment = 0.1f })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(hyperbolicSpeedCap, new StepSliderConfig { min = -5f, max = 50f, increment = 5f })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(enemyAIChanges)); } public void DefaultValues() { slowdownPercent.Value = 1f; slowdownLinger.Value = 0.75f; slowdownScale.Value = true; slowdownJumpPercent.Value = 1f; slowdownJumpLinger.Value = 1.25f; slowdownAgile.Value = false; changeCombatSkills.Value = true; fixHurtBoxes.Value = true; sprintSpeedMin.Value = 0.8f; sprintSpeedMax.Value = 1.4f; huntressSprintSpeedMin.Value = 0.85f; huntressSprintSpeedMax.Value = 1.1f; sprintSpeedDurationToMax.Value = 5f; hyperbolicSpeedCap.Value = 35f; enemyAIChanges.Value = true; } public void InfernoValues() { slowdownPercent.Value = 0.35f; slowdownLinger.Value = 0.45f; slowdownScale.Value = true; slowdownJumpPercent.Value = 1f; slowdownJumpLinger.Value = 0.8f; slowdownAgile.Value = false; changeCombatSkills.Value = true; fixHurtBoxes.Value = true; sprintSpeedMin.Value = 0.8f; sprintSpeedMax.Value = 1.4f; huntressSprintSpeedMin.Value = 0.85f; huntressSprintSpeedMax.Value = 1.1f; sprintSpeedDurationToMax.Value = 3f; hyperbolicSpeedCap.Value = 35f; enemyAIChanges.Value = true; } public void AddBuffs() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) slowdownBuff = ScriptableObject.CreateInstance<BuffDef>(); slowdownBuff.isCooldown = false; slowdownBuff.isDebuff = true; slowdownBuff.isHidden = false; slowdownBuff.canStack = false; slowdownBuff.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdSlow50.asset").WaitForCompletion().iconSprite; slowdownBuff.buffColor = Color32.op_Implicit(new Color32((byte)174, (byte)53, (byte)56, byte.MaxValue)); ((Object)slowdownBuff).name = "Attack Slowdown"; ContentAddition.AddBuffDef(slowdownBuff); slowdownJumpBuff = ScriptableObject.CreateInstance<BuffDef>(); slowdownJumpBuff.isCooldown = false; slowdownJumpBuff.isDebuff = true; slowdownJumpBuff.isHidden = false; slowdownJumpBuff.canStack = false; slowdownJumpBuff.iconSprite = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Common/bdSlow50.asset").WaitForCompletion().iconSprite; slowdownJumpBuff.buffColor = Color32.op_Implicit(new Color32((byte)174, (byte)53, (byte)104, byte.MaxValue)); ((Object)slowdownJumpBuff).name = "Jump Slowdown"; ContentAddition.AddBuffDef(slowdownJumpBuff); } } } namespace CombatRework.Hooks { public static class BodyStart { public static void Init() { CharacterBody.onBodyStartGlobal += CharacterBody_onBodyStartGlobal; } public static void CharacterBody_onBodyStartGlobal(CharacterBody body) { if (body.isPlayerControlled) { SlowdownController component = ((Component)body).GetComponent<SlowdownController>(); SprintController component2 = ((Component)body).GetComponent<SprintController>(); if (!Object.op_Implicit((Object)(object)component)) { ((Component)body).gameObject.AddComponent<SlowdownController>(); } if (!Object.op_Implicit((Object)(object)component2)) { ((Component)body).gameObject.AddComponent<SprintController>(); } } } } public class CharacterMaster { public static void Init() { CharacterMaster.onStartGlobal += CharacterMaster_onStartGlobal; } private static void CharacterMaster_onStartGlobal(CharacterMaster master) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Invalid comparison between Unknown and I4 //IL_0ae4: Unknown result type (might be due to invalid IL or missing references) //IL_1449: Unknown result type (might be due to invalid IL or missing references) //IL_0665: Unknown result type (might be due to invalid IL or missing references) //IL_0951: Unknown result type (might be due to invalid IL or missing references) //IL_0e23: Unknown result type (might be due to invalid IL or missing references) //IL_069e: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_076a: Unknown result type (might be due to invalid IL or missing references) //IL_0e5c: Unknown result type (might be due to invalid IL or missing references) //IL_06ef: Unknown result type (might be due to invalid IL or missing references) //IL_0aa6: Unknown result type (might be due to invalid IL or missing references) //IL_0e95: Unknown result type (might be due to invalid IL or missing references) //IL_124f: Unknown result type (might be due to invalid IL or missing references) //IL_1294: Unknown result type (might be due to invalid IL or missing references) //IL_08c2: Unknown result type (might be due to invalid IL or missing references) //IL_0b22: Unknown result type (might be due to invalid IL or missing references) //IL_08fb: Unknown result type (might be due to invalid IL or missing references) if (!Main.enemyAIChanges.Value || ((int)master.teamIndex != 2 && (int)master.teamIndex != 4)) { return; } CharacterBody body = master.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { return; } if (body.isChampion) { master.inventory.GiveItem(Items.TeleportWhenOob, 1); } if (body.baseJumpPower < 20f) { body.baseJumpPower = 20f; } BaseAI component = ((Component)master).GetComponent<BaseAI>(); if (!Object.op_Implicit((Object)(object)component)) { return; } if (((Object)master).name != "GolemMaster(Clone)" && ((Object)master).name != "ClayBruiserMaster(Clone)") { component.fullVision = true; component.aimVectorDampTime = 0.031f; component.aimVectorMaxSpeed = 250f; component.enemyAttentionDuration = 1.5f; } else { component.fullVision = true; component.aimVectorDampTime = 0.09f; component.aimVectorMaxSpeed = 250f; component.enemyAttentionDuration = 1.5f; } string name = ((Object)master).name; string text = name; if (text == null) { return; } switch (text.Length) { case 24: switch (text[8]) { case 'e': if (text == "BeetleQueenMaster(Clone)") { AISkillDriver val4 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Chase" select x).First(); val4.minDistance = 0f; AISkillDriver val5 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "SpawnWards" select x).First(); val5.maxDistance = 100f; val5.maxUserHealthFraction = float.PositiveInfinity; } break; case 'p': if (text == "GravekeeperMaster(Clone)") { AISkillDriver val7 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "RunAndShoot" select x).First(); val7.movementType = (MovementType)2; AISkillDriver val8 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Hooks" select x).First(); val8.movementType = (MovementType)2; val8.maxUserHealthFraction = float.PositiveInfinity; val8.minDistance = 13f; AISkillDriver val9 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "WaitAroundUntilSkillIsBack" select x).First(); val9.movementType = (MovementType)2; } break; case 'u': if (text == "BrotherHurtMaster(Clone)") { AISkillDriver val11 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "SlamGround" select x).First(); val11.maxUserHealthFraction = float.PositiveInfinity; val11.movementType = (MovementType)2; AISkillDriver val12 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Shoot" select x).First(); val12.movementType = (MovementType)2; } break; case 'a': if (text == "BeetleGuardMaster(Clone)") { AISkillDriver val6 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "FireSunder" select x).First(); val6.maxDistance = 100f; } break; case 's': if (text == "ClayBruiserMaster(Clone)") { AISkillDriver val10 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "WalkAndShoot" select x).First(); val10.movementType = (MovementType)2; } break; case 'i': if (text == "GreaterWispMaster(Clone)") { AISkillDriver val3 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.minDistance == 15f select x).First(); val3.movementType = (MovementType)2; val3.maxDistance = 100f; } break; } break; case 20: switch (text[0]) { case 'I': if (text == "ImpBossMaster(Clone)") { AISkillDriver val17 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "GroundPound" select x).First(); val17.maxDistance = 12f; AISkillDriver val18 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "FireVoidspikesWhenInRange" select x).First(); val18.movementType = (MovementType)2; val18.minDistance = 16f; AISkillDriver val19 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "BlinkToTarget" select x).First(); val19.minDistance = 33f; } break; case 'B': if (text == "BrotherMaster(Clone)") { AISkillDriver val14 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Sprint and FireLunarShards" select x).First(); val14.minDistance = 0f; val14.maxUserHealthFraction = float.PositiveInfinity; AISkillDriver val15 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Sprint After Target" select x).First(); val15.minDistance = 40f; AISkillDriver val16 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "DashStrafe" select x).First(); val16.nextHighPriorityOverride = val14; } break; case 'V': if (text == "VagrantMaster(Clone)") { AISkillDriver val13 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Chase" select x).First(); val13.minDistance = 25f; } break; } break; case 18: switch (text[0]) { case 'T': if (text == "TitanMaster(Clone)") { AISkillDriver val55 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 3 select x).First(); val55.maxUserHealthFraction = float.PositiveInfinity; val55.minDistance = 16f; val55.movementType = (MovementType)2; AISkillDriver val56 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 2 select x).First(); val56.maxUserHealthFraction = 0.8f; val56.movementType = (MovementType)2; } break; case 'G': if (text == "GolemMaster(Clone)") { AISkillDriver val54 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 1 select x).First(); val54.selectionRequiresAimTarget = true; val54.activationRequiresAimTargetLoS = true; val54.activationRequiresAimConfirmation = true; val54.maxDistance = 100f; val54.minDistance = 0f; } break; } break; case 25: switch (text[0]) { case 'F': if (text == "FlyingVerminMaster(Clone)") { AISkillDriver val50 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 0 select x).First(); val50.minDistance = 10f; val50.maxDistance = 40f; } break; case 'M': if (text == "MiniMushroomMaster(Clone)") { AISkillDriver val51 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Spore Grenade" select x).First(); val51.maxDistance = 60f; AISkillDriver val52 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Path" select x).First(); val52.shouldSprint = true; AISkillDriver val53 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "PathStrafe" select x).First(); val53.shouldSprint = true; } break; case 'R': if (text == "RoboBallBossMaster(Clone)") { AISkillDriver val49 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 3 select x).First(); val49.maxUserHealthFraction = 0.5f; } break; case 'V': if (text == "VoidBarnacleMaster(Clone)") { AISkillDriver val48 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Shooty" select x).First(); val48.maxDistance = 100f; } break; } break; case 16: switch (text[0]) { case 'I': if (text == "ImpMaster(Clone)") { AISkillDriver val47 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Slash" select x).First(); val47.maxDistance = 12f; } break; case 'G': if (text == "GupMaster(Clone)") { AISkillDriver val46 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Spike" select x).First(); val46.maxDistance = 14f; } break; } break; case 17: switch (text[0]) { case 'W': if (text == "WispMaster(Clone)") { AISkillDriver val44 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.minDistance == 0f select x).First(); val44.maxDistance = 10f; AISkillDriver val45 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.maxDistance == 30f select x).First(); val45.minDistance = 10f; } break; case 'S': if (text == "ScavMaster(Clone)") { AISkillDriver val40 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Sit" select x).First(); val40.maxUserHealthFraction = 0.75f; AISkillDriver val41 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "FireCannon" select x).First(); val41.maxDistance = 100f; AISkillDriver val42 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "ThrowSack" select x).First(); val42.maxDistance = 100f; AISkillDriver val43 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "UseEquipmentAndFireCannon" select x).First(); val43.maxDistance = 100f; } break; } break; case 26: switch (text[0]) { case 'L': if (text == "LunarExploderMaster(Clone)") { AISkillDriver val26 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "StrafeAndShoot" select x).First(); val26.maxDistance = 100f; AISkillDriver val27 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "SprintNodegraphAndShoot" select x).First(); val27.maxDistance = 100f; } break; case 'M': if (text == "MegaConstructMaster(Clone)") { AISkillDriver val22 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 0 select x).First(); val22.maxDistance = 60f; val22.minDistance = 0f; AISkillDriver val23 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 2 select x).First(); val23.maxDistance = 60f; val23.minDistance = 0f; AISkillDriver val24 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 3 select x).First(); val24.maxDistance = 60f; val24.minDistance = 0f; AISkillDriver val25 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "StrafeStep" select x).First(); val24.maxDistance = 60f; val24.minDistance = 0f; } break; case 'C': if (text == "ClayGrenadierMaster(Clone)") { AISkillDriver val21 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "FaceSlam" select x).First(); val21.maxDistance = 35f; } break; } break; case 22: switch (text[0]) { case 'N': if (text == "NullifierMaster(Clone)") { AISkillDriver val31 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "PanicFireWhenClose" select x).First(); val31.movementType = (MovementType)1; AISkillDriver val32 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "FireAndStrafe" select x).First(); val32.movementType = (MovementType)1; AISkillDriver val33 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "FireAndChase" select x).First(); val33.movementType = (MovementType)1; } break; case 'L': if (text == "LunarWispMaster(Clone)") { AISkillDriver val34 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Back Up" select x).First(); val34.maxDistance = 13f; AISkillDriver val35 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Chase" select x).First(); val35.minDistance = 25f; } break; case 'T': if (text == "TitanGoldMaster(Clone)") { AISkillDriver val29 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 3 select x).First(); val29.maxUserHealthFraction = float.PositiveInfinity; val29.minDistance = 16f; val29.movementType = (MovementType)2; AISkillDriver val30 = (from x in ((Component)master).GetComponents<AISkillDriver>() where (int)x.skillSlot == 2 select x).First(); val30.maxUserHealthFraction = 0.8f; val30.movementType = (MovementType)2; } break; } break; case 27: if (text == "MinorConstructMaster(Clone)") { AISkillDriver val2 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Shooty" select x).First(); val2.maxDistance = 100f; } break; case 28: if (text == "LemurianBruiserMaster(Clone)") { AISkillDriver val28 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "StopAndShoot" select x).First(); val28.movementType = (MovementType)1; } break; case 21: if (text == "LemurianMaster(Clone)") { AISkillDriver val36 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "ChaseAndBiteOffNodegraph" select x).First(); val36.maxDistance = 8f; AISkillDriver val37 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "ChaseAndBiteOffNodegraphWhileSlowingDown" select x).First(); val37.maxDistance = 0f; AISkillDriver val38 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "StrafeAndShoot" select x).First(); val38.minDistance = 10f; val38.maxDistance = 100f; AISkillDriver val39 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "StrafeIdley" select x).First(); val39.minDistance = 10f; val39.maxDistance = 100f; } break; case 19: if (text == "ParentMaster(Clone)") { AISkillDriver val20 = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "Teleport" select x).First(); val20.maxUserHealthFraction = 1f; } break; case 30: if (text == "SuperRoboBallBossMaster(Clone)") { AISkillDriver val = (from x in ((Component)master).GetComponents<AISkillDriver>() where x.customName == "FireAndStop" select x).First(); val.movementType = (MovementType)2; } break; case 23: case 29: break; } } } public static class Movement { [CompilerGenerated] private static class <>O { public static hook_OnLanded <0>__CharacterMotor_OnLanded; public static hook_OnLeaveStableGround <1>__CharacterMotor_OnLeaveStableGround; public static Manipulator <2>__GenericCharacterMain_ProcessJump; public static Manipulator <3>__CharacterBody_RecalculateStats; } public 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) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown //IL_0053: 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_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown object obj = <>O.<0>__CharacterMotor_OnLanded; if (obj == null) { hook_OnLanded val = CharacterMotor_OnLanded; <>O.<0>__CharacterMotor_OnLanded = val; obj = (object)val; } CharacterMotor.OnLanded += (hook_OnLanded)obj; object obj2 = <>O.<1>__CharacterMotor_OnLeaveStableGround; if (obj2 == null) { hook_OnLeaveStableGround val2 = CharacterMotor_OnLeaveStableGround; <>O.<1>__CharacterMotor_OnLeaveStableGround = val2; obj2 = (object)val2; } CharacterMotor.OnLeaveStableGround += (hook_OnLeaveStableGround)obj2; object obj3 = <>O.<2>__GenericCharacterMain_ProcessJump; if (obj3 == null) { Manipulator val3 = GenericCharacterMain_ProcessJump; <>O.<2>__GenericCharacterMain_ProcessJump = val3; obj3 = (object)val3; } GenericCharacterMain.ProcessJump += (Manipulator)obj3; object obj4 = <>O.<3>__CharacterBody_RecalculateStats; if (obj4 == null) { Manipulator val4 = CharacterBody_RecalculateStats; <>O.<3>__CharacterBody_RecalculateStats = val4; obj4 = (object)val4; } CharacterBody.RecalculateStats += (Manipulator)obj4; } private static void CharacterBody_RecalculateStats(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) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterBody>(x, "sprintingSpeedMultiplier") })) { int index = val.Index; val.Index = index + 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, CharacterBody, float>>((Func<float, CharacterBody, float>)delegate(float orig, CharacterBody self) { SprintController component = ((Component)self).GetComponent<SprintController>(); if (Object.op_Implicit((Object)(object)component)) { orig *= (component.sprintSpeedMult = Mathf.Lerp(component.sprintSpeedMin, component.sprintSpeedMax, Util.Remap(component.sprintTimer, 0f, component.sprintSpeedDurationToMax / 1.45f, 0f, 1f))); } return orig; }); } else { Main.ASLogger.LogError((object)"Failed to apply Sprinting Changes Hook"); } val.Index = 0; if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "set_moveSpeed"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<CharacterBody>(x, "get_moveSpeed") })) { val.EmitDelegate<Func<float, float>>((Func<float, float>)delegate(float orig) { orig = Math.Min(orig, GetHyperbolic(orig, Main.hyperbolicSpeedCap.Value, orig)); return orig; }); } else { Main.ASLogger.LogError((object)"Failed to apply Hyperbolic Speed Increase hook"); } } public static float GetHyperbolic(float firstStack, float cap, float chance) { if (cap < 0f) { return firstStack; } if (firstStack >= cap) { return cap * (chance / firstStack); } float num = chance / firstStack; float num2 = 100f * firstStack / (cap - firstStack); return cap * (1f - 100f / (num * num2 + 100f)); } public static void GenericCharacterMain_ProcessJump(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<GenericCharacterMain>(x, "jumpInputReceived") })) { val.Index += 2; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<bool, GenericCharacterMain, bool>>((Func<bool, GenericCharacterMain, bool>)delegate(bool orig, GenericCharacterMain self) { if (Main.slowdownJumpPercent.Value >= 1f) { CharacterBody characterBody2 = ((EntityState)self).characterBody; if (Object.op_Implicit((Object)(object)characterBody2) && characterBody2.HasBuff(Main.slowdownJumpBuff)) { return false; } } return orig; }); } else { Main.ASLogger.LogError((object)"Failed to apply Jump Hook"); } val.Index = 0; int num = default(int); if (val.TryGotoNext((MoveType)0, new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<EntityState>(x, "get_characterBody"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ref num) })) { val.Index += 2; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<float, GenericCharacterMain, float>>((Func<float, GenericCharacterMain, float>)delegate(float orig, GenericCharacterMain self) { CharacterBody characterBody = ((EntityState)self).characterBody; return (Object.op_Implicit((Object)(object)characterBody) && characterBody.HasBuff(Main.slowdownJumpBuff)) ? 0f : orig; }); } else { Main.ASLogger.LogError((object)"Failed to apply Jump Speed Hook"); } } public static void CharacterMotor_OnLeaveStableGround(orig_OnLeaveStableGround orig, CharacterMotor self) { CharacterBody body = self.body; if (Object.op_Implicit((Object)(object)body) && (body.HasBuff(Main.slowdownBuff) || body.HasBuff(Main.slowdownJumpBuff))) { self.body.statsDirty = true; } orig.Invoke(self); } public static void CharacterMotor_OnLanded(orig_OnLanded orig, CharacterMotor self) { CharacterBody body = self.body; if ((Object.op_Implicit((Object)(object)body) && body.HasBuff(Main.slowdownBuff)) || body.HasBuff(Main.slowdownJumpBuff)) { self.body.statsDirty = true; } orig.Invoke(self); } } public static class RecalculateStats { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__RecalculateStatsAPI_GetStatCoefficients; } public 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) //IL_001c: Expected O, but got Unknown object obj = <>O.<0>__RecalculateStatsAPI_GetStatCoefficients; if (obj == null) { StatHookEventHandler val = RecalculateStatsAPI_GetStatCoefficients; <>O.<0>__RecalculateStatsAPI_GetStatCoefficients = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; } public static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)sender)) { return; } if (sender.HasBuff(Main.slowdownBuff)) { SlowdownController component = ((Component)sender).GetComponent<SlowdownController>(); if (Object.op_Implicit((Object)(object)component)) { float num; if (!Object.op_Implicit((Object)(object)component.capsuleCollider)) { if (!Object.op_Implicit((Object)(object)component.sphereCollider)) { if (!Object.op_Implicit((Object)(object)component.boxCollider)) { num = 1f; } else { Vector3 size = component.boxCollider.size; num = ((Vector3)(ref size)).magnitude; } } else { num = component.sphereCollider.radius; } } else { num = component.capsuleCollider.radius; } float num2 = num; args.moveSpeedReductionMultAdd += Main.slowdownPercent.Value / Mathf.Sqrt(num2); } } if (sender.HasBuff(Main.slowdownJumpBuff) && Main.slowdownJumpPercent.Value < 1f) { args.jumpPowerMultAdd -= Main.slowdownJumpPercent.Value; } } } } namespace CombatRework.Components { public class SlowdownController : MonoBehaviour { public CharacterBody characterBody; public HurtBox mainHurtBox; public BoxCollider boxCollider; public SphereCollider sphereCollider; public CapsuleCollider capsuleCollider; public bool isUsingNonAgileSkill = false; public bool shouldApplyBuff = false; public bool shouldApplyJumpBuff = false; public void Start() { characterBody = ((Component)this).GetComponent<CharacterBody>(); mainHurtBox = characterBody.mainHurtBox; boxCollider = ((Component)mainHurtBox).GetComponent<BoxCollider>(); if (!Object.op_Implicit((Object)(object)boxCollider)) { sphereCollider = ((Component)mainHurtBox).GetComponent<SphereCollider>(); } if (!Object.op_Implicit((Object)(object)sphereCollider)) { capsuleCollider = ((Component)mainHurtBox).GetComponent<CapsuleCollider>(); } characterBody.onSkillActivatedServer += CharacterBody_onSkillActivatedServer; } private void CharacterBody_onSkillActivatedServer(GenericSkill skill) { if (skill.skillDef.cancelSprintingOnActivation) { isUsingNonAgileSkill = true; } else { isUsingNonAgileSkill = false; } } public void SetSlowdown(bool shouldApplySlow, bool shouldApplyJump) { if (shouldApplySlow) { if (NetworkServer.active && !characterBody.HasBuff(Main.slowdownBuff)) { characterBody.AddBuff(Main.slowdownBuff); } } else if (NetworkServer.active && characterBody.HasBuff(Main.slowdownBuff)) { characterBody.RemoveBuff(Main.slowdownBuff); } if (shouldApplyJump) { if (NetworkServer.active && !characterBody.HasBuff(Main.slowdownJumpBuff)) { characterBody.AddBuff(Main.slowdownJumpBuff); } } else if (NetworkServer.active && characterBody.HasBuff(Main.slowdownJumpBuff)) { characterBody.RemoveBuff(Main.slowdownJumpBuff); } } public void FixedUpdate() { shouldApplyBuff = characterBody.outOfCombatStopwatch <= Main.slowdownLinger.Value && (Main.slowdownAgile.Value || isUsingNonAgileSkill); shouldApplyJumpBuff = characterBody.outOfCombatStopwatch <= Main.slowdownJumpLinger.Value && (Main.slowdownAgile.Value || isUsingNonAgileSkill); SetSlowdown(shouldApplyBuff, shouldApplyJumpBuff); } public void OnDisable() { SetSlowdown(shouldApplySlow: false, shouldApplyJump: false); } public void OnDestroy() { SetSlowdown(shouldApplySlow: false, shouldApplyJump: false); characterBody.onSkillActivatedServer -= CharacterBody_onSkillActivatedServer; } } public class SprintController : MonoBehaviour { public float sprintSpeedMult; public float sprintSpeedMin = Main.sprintSpeedMin.Value; public float sprintSpeedMax = Main.sprintSpeedMax.Value; public float sprintSpeedDurationToMax = Main.sprintSpeedDurationToMax.Value; public float sprintTimer; public float recalcTimer; public float recalcInterval = 0.1f; public bool shouldIncrementTimer = false; public CharacterBody characterBody; public void Start() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) characterBody = ((Component)this).GetComponent<CharacterBody>(); if (characterBody.bodyIndex == Main.huntressBodyIndex) { sprintSpeedMin = Main.huntressSprintSpeedMin.Value; sprintSpeedMax = Main.huntressSprintSpeedMax.Value; } sprintSpeedMult = sprintSpeedMin; } public void FixedUpdate() { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) shouldIncrementTimer = characterBody.isSprinting; if (shouldIncrementTimer) { sprintTimer += Time.fixedDeltaTime; } else { sprintTimer = 0f; } recalcTimer += Time.fixedDeltaTime; if (recalcTimer >= recalcInterval && sprintSpeedMult != sprintSpeedMax) { sprintSpeedMin = ((characterBody.bodyIndex == Main.huntressBodyIndex) ? Main.huntressSprintSpeedMin.Value : Main.sprintSpeedMin.Value); sprintSpeedMax = ((characterBody.bodyIndex == Main.huntressBodyIndex) ? Main.huntressSprintSpeedMax.Value : Main.sprintSpeedMax.Value); sprintSpeedDurationToMax = Main.sprintSpeedDurationToMax.Value; characterBody.statsDirty = true; recalcTimer = 0f; } } } }