using System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Halcyonite; using EntityStates.ShrineHalcyonite; using HG; using HG.Reflection; using HalcyonFixes; using IL.EntityStates.Halcyonite; using IL.RoR2; using Logger; using Md.HalcyonFixes.FixedSlash; using Microsoft.CodeAnalysis; using MiscFixes.Modules; using Mono.Cecil; using Mono.Cecil.Cil; using MonoDetour; using MonoDetour.Cil; using MonoDetour.DetourTypes; using MonoDetour.HookGen; using MonoMod.Cil; using On.EntityStates.Halcyonite; using On.EntityStates.ShrineHalcyonite; using On.RoR2; using RiskOfOptions; using RiskOfOptions.Options; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Skills; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; using UnityEngine.ResourceManagement.AsyncOperations; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: OptIn] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HalcyonKnight")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d5f9a483d4434fed8b14091d2308cf543ddc7527")] [assembly: AssemblyProduct("HalcyonKnight")] [assembly: AssemblyTitle("HalcyonKnight")] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 Md.HalcyonFixes.FixedSlash { internal static class get_allowExitFire { public delegate void PrefixSignature(FixedSlash self); public delegate void PostfixSignature(FixedSlash self, ref bool returnValue); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(FixedSlash); MethodInfo method = typeFromHandle.GetMethod("get_allowExitFire", (BindingFlags)(-1), null, Array.Empty(), null); if ((object)method == null) { throw new MissingMethodException("HalcyonFixes.FixedSlash", "get_allowExitFire"); } return method; } } internal static class OnEnter { public delegate void PrefixSignature(FixedSlash self); public delegate void PostfixSignature(FixedSlash self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(FixedSlash); MethodInfo method = typeFromHandle.GetMethod("OnEnter", (BindingFlags)(-1), null, Array.Empty(), null); if ((object)method == null) { throw new MissingMethodException("HalcyonFixes.FixedSlash", "OnEnter"); } return method; } } internal static class FixedUpdate { public delegate void PrefixSignature(FixedSlash self); public delegate void PostfixSignature(FixedSlash self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(FixedSlash); MethodInfo method = typeFromHandle.GetMethod("FixedUpdate", (BindingFlags)(-1), null, Array.Empty(), null); if ((object)method == null) { throw new MissingMethodException("HalcyonFixes.FixedSlash", "FixedUpdate"); } return method; } } internal static class _ctor { public delegate void PrefixSignature(FixedSlash self); public delegate void PostfixSignature(FixedSlash self); public static MonoDetourHook Prefix(PrefixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook Postfix(PostfixSignature hook, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).Hook(Target(), (Delegate)hook, config, applyByDefault); } public static MonoDetourHook ILHook(Manipulator manipulator, MonoDetourConfig? config = null, bool applyByDefault = true, MonoDetourManager? manager = null) { return (manager ?? DefaultMonoDetourManager.Instance).ILHook(Target(), manipulator, config, applyByDefault); } public static MethodBase Target() { Type typeFromHandle = typeof(FixedSlash); ConstructorInfo constructor = typeFromHandle.GetConstructor((BindingFlags)(-1), null, Array.Empty(), null); if ((object)constructor == null) { throw new MissingMethodException("HalcyonFixes.FixedSlash", ".ctor"); } return constructor; } } } namespace MonoDetour.HookGen { internal static class DefaultMonoDetourManager { internal static MonoDetourManager Instance { get; } = New(); internal static MonoDetourManager New() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown return new MonoDetourManager(typeof(DefaultMonoDetourManager).Assembly.GetName().Name); } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class, AllowMultiple = true, Inherited = false)] internal class MonoDetourTargetsAttribute : Attribute, IMonoDetourTargets { public Type? TargetType { get; } public bool IncludeNestedTypes { get; set; } public string[]? Members { get; set; } public string[]? MemberNamePrefixes { get; set; } public string[]? MemberNameSuffixes { get; set; } public bool GenerateControlFlowVariants { get; set; } public MonoDetourTargetsAttribute(Type? targetType = null) { TargetType = targetType; IncludeNestedTypes = true; base..ctor(); } } } namespace Logger { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } internal static void Debug(object data) { _logSource.LogDebug(data); } internal static void Error(object data) { _logSource.LogError(data); } internal static void Fatal(object data) { _logSource.LogFatal(data); } internal static void Info(object data) { _logSource.LogInfo(data); } internal static void Message(object data) { _logSource.LogMessage(data); } internal static void Warning(object data) { _logSource.LogWarning(data); } } } namespace HalcyonKnight { internal static class AntiFallOff { [CompilerGenerated] private static class <>O { public static hook_OnEnter <0>__WhirlWindPersuitCycle_OnEnter; public static hook_OnExit <1>__WhirlWindPersuitCycle_OnExit; public static hook_OnEnter <2>__WhirlWindPersuitCycle_OnEnter; public static hook_OnExit <3>__WhirlWindPersuitCycle_OnExit; public static hook_UpdateLand <4>__WhirlWindPersuitCycle_UpdateLand; } [SystemInitializer(new Type[] { })] private static void Init() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown AssetReferenceT val = new AssetReferenceT(RoR2_DLC2_Halcyonite.HalcyoniteBody_prefab); AsyncOperationHandle val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { UnityObjectExtensions.EnsureComponent(x.Result); }; object obj = <>O.<0>__WhirlWindPersuitCycle_OnEnter; if (obj == null) { hook_OnEnter val3 = WhirlWindPersuitCycle_OnEnter; <>O.<0>__WhirlWindPersuitCycle_OnEnter = val3; obj = (object)val3; } WhirlWindPersuitCycle.OnEnter += (hook_OnEnter)obj; object obj2 = <>O.<1>__WhirlWindPersuitCycle_OnExit; if (obj2 == null) { hook_OnExit val4 = WhirlWindPersuitCycle_OnExit; <>O.<1>__WhirlWindPersuitCycle_OnExit = val4; obj2 = (object)val4; } WhirlWindPersuitCycle.OnExit += (hook_OnExit)obj2; object obj3 = <>O.<2>__WhirlWindPersuitCycle_OnEnter; if (obj3 == null) { hook_OnEnter val5 = WhirlWindPersuitCycle_OnEnter; <>O.<2>__WhirlWindPersuitCycle_OnEnter = val5; obj3 = (object)val5; } WhirlwindWarmUp.OnEnter += (hook_OnEnter)obj3; object obj4 = <>O.<3>__WhirlWindPersuitCycle_OnExit; if (obj4 == null) { hook_OnExit val6 = WhirlWindPersuitCycle_OnExit; <>O.<3>__WhirlWindPersuitCycle_OnExit = val6; obj4 = (object)val6; } WhirlwindWarmUp.OnExit += (hook_OnExit)obj4; object obj5 = <>O.<4>__WhirlWindPersuitCycle_UpdateLand; if (obj5 == null) { hook_UpdateLand val7 = WhirlWindPersuitCycle_UpdateLand; <>O.<4>__WhirlWindPersuitCycle_UpdateLand = val7; obj5 = (object)val7; } WhirlWindPersuitCycle.UpdateLand += (hook_UpdateLand)obj5; } private static void WhirlWindPersuitCycle_UpdateLand(orig_UpdateLand orig, WhirlWindPersuitCycle self) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown orig.Invoke(self); RaycastHit val = default(RaycastHit); if (!Physics.Raycast(new Ray(((EntityState)self).transform.position, Vector3.down), ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { ((EntityState)self).outer.SetNextState((EntityState)new WhirlwindWarmUp()); } } private static void WhirlWindPersuitCycle_OnExit(orig_OnExit orig, WhirlwindWarmUp self) { orig.Invoke(self); SetStunnable((EntityState)(object)self, stunnable: true); } private static void WhirlWindPersuitCycle_OnEnter(orig_OnEnter orig, WhirlwindWarmUp self) { orig.Invoke(self); SetStunnable((EntityState)(object)self, stunnable: false); } private static void WhirlWindPersuitCycle_OnExit(orig_OnExit orig, WhirlWindPersuitCycle self) { orig.Invoke(self); SetStunnable((EntityState)(object)self, stunnable: true); } private static void WhirlWindPersuitCycle_OnEnter(orig_OnEnter orig, WhirlWindPersuitCycle self) { orig.Invoke(self); SetStunnable((EntityState)(object)self, stunnable: false); } private static void SetStunnable(EntityState self, bool stunnable) { SetStateOnHurt val = default(SetStateOnHurt); ExtraChanges extraChanges = default(ExtraChanges); if (self.TryGetComponent(ref val) && self.TryGetComponent(ref extraChanges) && extraChanges.stunCooldown <= 0f) { val.canBeStunned = stunnable; } } } public class ExtraChanges : MonoBehaviour { private EntityStateMachine _weaponStateMachine; private EntityStateMachine _bodyStateMachine; private bool _wasStunned; public float stunCooldown; public const float maxStunCooldown = 3f; private void Awake() { EntityStateMachine[] components = ((Component)this).GetComponents(); foreach (EntityStateMachine val in components) { if (val.customName == "Weapon") { _weaponStateMachine = val; } if (val.customName == "Body") { _bodyStateMachine = val; } } } private void FixedUpdate() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown if (!Object.op_Implicit((Object)(object)_weaponStateMachine)) { return; } RaycastHit val = default(RaycastHit); if (!(_weaponStateMachine.state is WhirlwindWarmUp) && !(_weaponStateMachine.state is WhirlWindPersuitCycle) && !(_weaponStateMachine.nextState is WhirlwindWarmUp) && !(_weaponStateMachine.nextState is WhirlWindPersuitCycle) && !Physics.Raycast(new Ray(((Component)this).transform.position, Vector3.down), ref val, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1) && _bodyStateMachine.CanInterruptState((InterruptPriority)6)) { _weaponStateMachine.SetInterruptState((EntityState)new WhirlwindWarmUp(), (InterruptPriority)6); } if (_bodyStateMachine.state is StunState) { _wasStunned = true; } else { if (_wasStunned) { stunCooldown = 3f; SetStateOnHurt val2 = default(SetStateOnHurt); if (((Component)this).TryGetComponent(ref val2)) { val2.canBeStunned = false; } } _wasStunned = false; } if (!(_weaponStateMachine.state is WhirlwindWarmUp) && !(_weaponStateMachine.state is WhirlWindPersuitCycle) && !(_weaponStateMachine.nextState is WhirlwindWarmUp) && !(_weaponStateMachine.nextState is WhirlWindPersuitCycle)) { SetStateOnHurt val3 = default(SetStateOnHurt); if (stunCooldown > 0f && stunCooldown - Time.fixedDeltaTime <= 0f && ((Component)this).TryGetComponent(ref val3)) { val3.canBeStunned = true; } stunCooldown -= Time.fixedDeltaTime; } } } [BepInDependency(/*Could not decode attribute arguments.*/)] internal static class Options { public static bool IsEnabled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); public static void Init() { HalcyonKnight.ChangeShrineCredits = ((BaseUnityPlugin)HalcyonKnight.Instance).Config.Bind("General", "Increase credit cost", false, "Increase stage 1 shrine credit cost 0 -> 30 (for reference stage 2+ is 50)"); if (IsEnabled) { RiskOfOptionsConfig(); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void RiskOfOptionsConfig() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(HalcyonKnight.ChangeShrineCredits), "Onyx.HalcyonKnight", "HalcyonKnight"); ModSettingsManager.SetModDescription("Options for HalcyonKnight", "Onyx.HalcyonKnight", "HalcyonKnight"); FileInfo fileInfo = null; DirectoryInfo directoryInfo = new DirectoryInfo(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); do { FileInfo[] files = directoryInfo.GetFiles("icon.png", SearchOption.TopDirectoryOnly); if (files != null && files.Length != 0) { fileInfo = files[0]; break; } directoryInfo = directoryInfo.Parent; } while (directoryInfo != null && directoryInfo.Exists && !string.Equals(directoryInfo.Name, "plugins", StringComparison.OrdinalIgnoreCase)); if (fileInfo != null) { Texture2D val = new Texture2D(256, 256); if (ImageConversion.LoadImage(val, File.ReadAllBytes(fileInfo.FullName))) { Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); ((Object)val2).name = "HalcyonKnightIcon"; ModSettingsManager.SetModIcon(val2, "Onyx.HalcyonKnight", "HalcyonKnight"); } } } } [BepInPlugin("Onyx.HalcyonKnight", "HalcyonKnight", "1.1.9")] public sealed class HalcyonKnight : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static Manipulator <0>__TriLaser_FixedUpdate; public static hook_OnEnter <1>__TriLaser_OnEnter; public static hook_OnBodyStart <2>__OnBodyStart; public static hook_UpdateFindTarget <3>__UpdateFindTarget; public static Func <4>__AdjustHalcScaling; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Action> <>9__10_0; public static Action> <>9__10_1; public static Action> <>9__10_2; public static Action> <>9__10_3; public static Action> <>9__10_4; public static Action> <>9__10_5; public static Action> <>9__10_6; public static Action> <>9__10_7; public static Action> <>9__10_8; public static Action> <>9__10_9; public static hook_OnEnter <>9__10_10; public static hook_DestroyDrainVFX <>9__10_11; public static hook_OnEnter <>9__10_12; public static Action> <>9__11_0; public static Action> <>9__11_1; public static Func <>9__15_1; public static Func <>9__15_2; public static Func <>9__15_3; public static Func <>9__15_4; public static Func <>9__15_5; public static Func <>9__19_1; public static Func <>9__19_3; internal void b__10_0(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "baseDuration", 1.5f); } internal void b__10_1(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "blastRadius", 2f); } internal void b__10_2(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "duration", 0.7f); } internal void b__10_3(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "dashSpeedCoefficient", 40f); Extensions.TryModifyFieldValue(x.Result, "decelerateDuration", 0.5f); Extensions.TryModifyFieldValue(x.Result, "dashSafeExitDuration", 3f); } internal void b__10_4(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "baseDuration", 1.5f); } internal void b__10_5(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "baseDuration", 1.1f); } internal void b__10_6(AsyncOperationHandle x) { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_011b: Unknown result type (might be due to invalid IL or missing references) GameObject result = x.Result; AISkillDriver[] components = result.GetComponents(); foreach (AISkillDriver val in components) { switch (val.customName) { case "Golden Swipe": val.minDistance = 0f; val.movementType = (MovementType)0; val.maxDistance = 15f; val.driverUpdateTimerOverride = 1.5f; val.aimVectorMaxSpeedOverride = 0f; break; case "Golden Slash": val.movementType = (MovementType)3; val.maxDistance = 10f; val.driverUpdateTimerOverride = 2f; break; case "TriLaser": val.minDistance = 15f; val.moveInputScale = 0.7f; val.driverUpdateTimerOverride = 2.5f; val.movementType = (MovementType)1; break; case "WhirlwindRush": val.minDistance = 20f; break; case "Follow Target": val.minDistance = 5f; val.driverUpdateTimerOverride = 0.5f; break; case "Follow Nodegraph": val.minDistance = 5f; break; } } AISkillDriver val2 = result.AddComponent(); val2.minDistance = 0f; val2.maxDistance = float.MaxValue; val2.movementType = (MovementType)3; BaseAI val3 = default(BaseAI); if (result.TryGetComponent(ref val3)) { val3.prioritizePlayers = true; } } internal void b__10_7(AsyncOperationHandle x) { GameObject result = x.Result; BossGroup val = UnityObjectExtensions.EnsureComponent(result); result.GetComponent().setUnavailableOnTeleporterActivated = true; } internal void b__10_8(AsyncOperationHandle x) { SkillDef result = x.Result; result.baseRechargeInterval = 15f; } internal void b__10_9(AsyncOperationHandle x) { SkillDef result = x.Result; result.baseRechargeInterval = 7f; } internal void b__10_10(orig_OnEnter orig, ShrineHalcyoniteNoQuality self) { orig.Invoke(self); ((Component)((EntityState)self).transform.Find("meshHalcyoniteShrineStorm")).gameObject.SetActive(true); ((Component)((EntityState)self).transform.Find("Particle System")).gameObject.SetActive(true); } internal void b__10_11(orig_DestroyDrainVFX orig, HalcyoniteShrineInteractable self) { orig.Invoke(self); ((Component)((Component)self).transform.Find("meshHalcyoniteShrineStorm")).gameObject.SetActive(false); ((Component)((Component)self).transform.Find("Particle System")).gameObject.SetActive(false); } internal void b__10_12(orig_OnEnter orig, ShrineHalcyoniteFinished self) { orig.Invoke(self); ((Component)((EntityState)self).transform.Find("meshHalcyoniteShrineStorm")).gameObject.SetActive(false); ((Component)((EntityState)self).transform.Find("Particle System")).gameObject.SetActive(false); } internal void b__11_0(AsyncOperationHandle x) { x.Result.directorCreditCost = 30; halcshrineCard = x.Result; } internal void b__11_1(AsyncOperationHandle x) { x.Result.directorCreditCost = 0; halcshrineCard = x.Result; } internal bool b__15_1(Instruction x) { return ILPatternMatchingExt.MatchLdfld(x, typeof(HalcyoniteShrineInteractable), "goldDrained"); } internal bool b__15_2(Instruction x) { return ILPatternMatchingExt.MatchConvR4(x); } internal bool b__15_3(Instruction x) { float num = default(float); return ILPatternMatchingExt.MatchLdcR4(x, ref num); } internal bool b__15_4(Instruction x) { return ILPatternMatchingExt.MatchDiv(x); } internal bool b__15_5(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchStloc(x, ref num); } internal bool b__19_1(Instruction x) { return ILPatternMatchingExt.MatchLdfld(x, typeof(TriLaser), "timesFired"); } internal bool b__19_3(Instruction x) { return !ILPatternMatchingExt.MatchAdd(x); } } public const string PluginGUID = "Onyx.HalcyonKnight"; public const string PluginAuthor = "Onyx"; public const string PluginName = "HalcyonKnight"; public const string PluginVersion = "1.1.9"; public static HalcyonKnight Instance; private static SpawnCard halcshrineCard; public static ConfigEntry ChangeShrineCredits { get; set; } public void Awake() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Expected O, but got Unknown //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0313: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Expected O, but got Unknown //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Expected O, but got Unknown //IL_0337: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Expected O, but got Unknown //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ee: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Expected O, but got Unknown //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Expected O, but got Unknown //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Expected O, but got Unknown //IL_03c0: Unknown result type (might be due to invalid IL or missing references) //IL_03c5: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); Instance = SingletonHelper.Assign(Instance, this); Options.Init(); MonoDetourManager.InvokeHookInitializers(Assembly.GetExecutingAssembly()); AssetReferenceT val = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_ChargeTriLaser_asset); AsyncOperationHandle val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "baseDuration", 1.5f); }; val = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_TriLaser_asset); val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "blastRadius", 2f); }; val = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_WhirlwindWarmUp_asset); val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "duration", 0.7f); }; val = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_WhirlwindPersuitCycle_asset); val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "dashSpeedCoefficient", 40f); Extensions.TryModifyFieldValue(x.Result, "decelerateDuration", 0.5f); Extensions.TryModifyFieldValue(x.Result, "dashSafeExitDuration", 3f); }; val = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_GoldenSwipe_asset); val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "baseDuration", 1.5f); }; val = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_GoldenSlash_asset); val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { Extensions.TryModifyFieldValue(x.Result, "baseDuration", 1.1f); }; AssetReferenceT val3 = new AssetReferenceT(RoR2_DLC2_Halcyonite.HalcyoniteMaster_prefab); AsyncOperationHandle val4 = AssetAsyncReferenceManager.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle x) { //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_011b: Unknown result type (might be due to invalid IL or missing references) GameObject result4 = x.Result; AISkillDriver[] components = result4.GetComponents(); foreach (AISkillDriver val15 in components) { switch (val15.customName) { case "Golden Swipe": val15.minDistance = 0f; val15.movementType = (MovementType)0; val15.maxDistance = 15f; val15.driverUpdateTimerOverride = 1.5f; val15.aimVectorMaxSpeedOverride = 0f; break; case "Golden Slash": val15.movementType = (MovementType)3; val15.maxDistance = 10f; val15.driverUpdateTimerOverride = 2f; break; case "TriLaser": val15.minDistance = 15f; val15.moveInputScale = 0.7f; val15.driverUpdateTimerOverride = 2.5f; val15.movementType = (MovementType)1; break; case "WhirlwindRush": val15.minDistance = 20f; break; case "Follow Target": val15.minDistance = 5f; val15.driverUpdateTimerOverride = 0.5f; break; case "Follow Nodegraph": val15.minDistance = 5f; break; } } AISkillDriver val16 = result4.AddComponent(); val16.minDistance = 0f; val16.maxDistance = float.MaxValue; val16.movementType = (MovementType)3; BaseAI val17 = default(BaseAI); if (result4.TryGetComponent(ref val17)) { val17.prioritizePlayers = true; } }; val3 = new AssetReferenceT(RoR2_DLC2.ShrineHalcyonite_prefab); val4 = AssetAsyncReferenceManager.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle x) { GameObject result3 = x.Result; BossGroup val14 = UnityObjectExtensions.EnsureComponent(result3); result3.GetComponent().setUnavailableOnTeleporterActivated = true; }; AssetReferenceT val5 = new AssetReferenceT(RoR2_DLC2_Halcyonite.HalcyoniteMonsterWhirlwindRush_asset); AsyncOperationHandle val6 = AssetAsyncReferenceManager.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle x) { SkillDef result2 = x.Result; result2.baseRechargeInterval = 15f; }; val5 = new AssetReferenceT(RoR2_DLC2_Halcyonite.HalcyoniteMonsterGoldenSlash_asset); val6 = AssetAsyncReferenceManager.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle x) { SkillDef result = x.Result; result.baseRechargeInterval = 7f; }; object obj = <>O.<0>__TriLaser_FixedUpdate; if (obj == null) { Manipulator val7 = TriLaser_FixedUpdate; <>O.<0>__TriLaser_FixedUpdate = val7; obj = (object)val7; } TriLaser.FixedUpdate += (Manipulator)obj; object obj2 = <>O.<1>__TriLaser_OnEnter; if (obj2 == null) { hook_OnEnter val8 = TriLaser_OnEnter; <>O.<1>__TriLaser_OnEnter = val8; obj2 = (object)val8; } TriLaser.OnEnter += (hook_OnEnter)obj2; object obj3 = <>O.<2>__OnBodyStart; if (obj3 == null) { hook_OnBodyStart val9 = OnBodyStart; <>O.<2>__OnBodyStart = val9; obj3 = (object)val9; } CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj3; object obj4 = <>O.<3>__UpdateFindTarget; if (obj4 == null) { hook_UpdateFindTarget val10 = UpdateFindTarget; <>O.<3>__UpdateFindTarget = val10; obj4 = (object)val10; } WhirlWindPersuitCycle.UpdateFindTarget += (hook_UpdateFindTarget)obj4; HalcyoniteShrineInteractable.DrainConditionMet += new Manipulator(DrainConditionMet); PurchaseInteraction.OnTeleporterBeginCharging += new hook_OnTeleporterBeginCharging(OnTeleporterBeginCharging); HalcyoniteShrineInteractable.CalculateCredits += new hook_CalculateCredits(HalcyoniteShrineInteractable_CalculateCredits); TriLaser.FireTriLaser += new hook_FireTriLaser(TriLaser_FireTriLaser); OptionChangeShrineCredits(null, null); ChangeShrineCredits.SettingChanged += OptionChangeShrineCredits; object obj5 = <>c.<>9__10_10; if (obj5 == null) { hook_OnEnter val11 = delegate(orig_OnEnter orig, ShrineHalcyoniteNoQuality self) { orig.Invoke(self); ((Component)((EntityState)self).transform.Find("meshHalcyoniteShrineStorm")).gameObject.SetActive(true); ((Component)((EntityState)self).transform.Find("Particle System")).gameObject.SetActive(true); }; <>c.<>9__10_10 = val11; obj5 = (object)val11; } ShrineHalcyoniteNoQuality.OnEnter += (hook_OnEnter)obj5; object obj6 = <>c.<>9__10_11; if (obj6 == null) { hook_DestroyDrainVFX val12 = delegate(orig_DestroyDrainVFX orig, HalcyoniteShrineInteractable self) { orig.Invoke(self); ((Component)((Component)self).transform.Find("meshHalcyoniteShrineStorm")).gameObject.SetActive(false); ((Component)((Component)self).transform.Find("Particle System")).gameObject.SetActive(false); }; <>c.<>9__10_11 = val12; obj6 = (object)val12; } HalcyoniteShrineInteractable.DestroyDrainVFX += (hook_DestroyDrainVFX)obj6; object obj7 = <>c.<>9__10_12; if (obj7 == null) { hook_OnEnter val13 = delegate(orig_OnEnter orig, ShrineHalcyoniteFinished self) { orig.Invoke(self); ((Component)((EntityState)self).transform.Find("meshHalcyoniteShrineStorm")).gameObject.SetActive(false); ((Component)((EntityState)self).transform.Find("Particle System")).gameObject.SetActive(false); }; <>c.<>9__10_12 = val13; obj7 = (object)val13; } ShrineHalcyoniteFinished.OnEnter += (hook_OnEnter)obj7; } private void OptionChangeShrineCredits(object sender, EventArgs e) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (ChangeShrineCredits.Value) { SceneDirector.GenerateInteractableCardSelection += new hook_GenerateInteractableCardSelection(GenerateInteractableCardSelection); AssetReferenceT val = new AssetReferenceT(RoR2_DLC2.iscShrineHalcyoniteTier1_asset); AsyncOperationHandle val2 = AssetAsyncReferenceManager.LoadAsset(val, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { x.Result.directorCreditCost = 30; halcshrineCard = x.Result; }; } else { SceneDirector.GenerateInteractableCardSelection -= new hook_GenerateInteractableCardSelection(GenerateInteractableCardSelection); AssetReferenceT val3 = new AssetReferenceT(RoR2_DLC2.iscShrineHalcyoniteTier1_asset); AsyncOperationHandle val2 = AssetAsyncReferenceManager.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2); val2.Completed += delegate(AsyncOperationHandle x) { x.Result.directorCreditCost = 0; halcshrineCard = x.Result; }; } } private WeightedSelection GenerateInteractableCardSelection(orig_GenerateInteractableCardSelection orig, SceneDirector self) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) WeightedSelection val = orig.Invoke(self); for (int i = 0; i < val.Count; i++) { ChoiceInfo choice = val.GetChoice(i); if ((Object)(object)choice.value.spawnCard == (Object)(object)halcshrineCard) { val.ModifyChoiceWeight(i, choice.weight * 2f); } } return val; } private void HalcyoniteShrineInteractable_CalculateCredits(orig_CalculateCredits orig, HalcyoniteShrineInteractable self) { orig.Invoke(self); if (self.scaleMonsterCreditWithDifficultyCoefficient) { self.monsterCredit /= Math.Max(Run.instance.difficultyCoefficient * 0.3f, 1f); } } private void OnTeleporterBeginCharging(orig_OnTeleporterBeginCharging orig, TeleporterInteraction self) { orig.Invoke(self); if (!NetworkServer.active) { return; } ChildLocator val = default(ChildLocator); Transform val2 = default(Transform); foreach (PurchaseInteraction instances in InstanceTracker.GetInstancesList()) { if (((Object)instances).name == "ShrineHalcyonite(Clone)" && ((Component)instances).TryGetComponent(ref val)) { if (val.TryFindChild("GoldSiphonNearbyBodyAttachment", ref val2)) { ((Component)val2).gameObject.SetActive(false); } if (val.TryFindChild("StormPortalIndicator", ref val2)) { ((Component)val2).gameObject.SetActive(false); } if (val.TryFindChild("RangeIndicator", ref val2)) { ((Component)val2).gameObject.SetActive(false); } if (val.TryFindChild("GoldshoresPortalIndicator", ref val2)) { ((Component)val2).gameObject.SetActive(false); } } } } private void DrainConditionMet(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); float num2 = default(float); int num = default(int); if (val.TryGotoNext(new Func[4] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HalcyoniteShrineInteractable), "goldDrained"), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, ref num2), (Instruction x) => ILPatternMatchingExt.MatchDiv(x) }) && val.TryGotoNext((MoveType)0, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num) })) { val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)AdjustHalcScaling); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } static int AdjustHalcScaling(HalcyoniteShrineInteractable self) { if (self.goldDrained > self.lowGoldCost && self.goldDrained < self.midGoldCost) { return (int)(0.7 + 0.06 * (double)Run.instance.ambientLevel); } if (self.goldDrained > self.midGoldCost && self.goldDrained < self.maxGoldCost) { return (int)(1.4 + 0.12 * (double)Run.instance.ambientLevel); } if (self.goldDrained >= self.maxGoldCost) { return (int)(2.1 + 0.18 * (double)Run.instance.ambientLevel); } return 0; } } private static void UpdateFindTarget(orig_UpdateFindTarget orig, WhirlWindPersuitCycle self) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!Object.op_Implicit((Object)(object)self.targetBody)) { BaseAI[] aiComponents = ((EntityState)self).characterBody.master.AiComponents; foreach (BaseAI val in aiComponents) { if (val.hasAimTarget) { self.targetBody = val.skillDriverEvaluation.target.characterBody; Vector3 footPosition = self.targetBody.footPosition; Vector3 val2 = ((EntityState)self).transform.position - self.targetBody.footPosition; self.targetPos = footPosition + ((Vector3)(ref val2)).normalized * 2f; self.findTargetTimeStamp = ((EntityState)self).fixedAge; self.startForwardDirt = ((EntityState)self).characterDirection.forward; break; } } } orig.Invoke(self); RaycastHit val3 = default(RaycastHit); if (!Object.op_Implicit((Object)(object)self.targetBody) && Physics.Raycast(new Ray(((EntityState)self).transform.position, Vector3.down), ref val3, 50f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask), (QueryTriggerInteraction)1)) { ((EntityState)self).outer.SetNextStateToMain(); } } private static void OnBodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { //IL_0042: 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) orig.Invoke(self, body); if (((Object)body).name == "HalcyoniteBody(Clone)") { body.modelLocator.modelTransform.GetChild(4).localScale = new Vector3(2f, 6f, 12f); body.modelLocator.modelTransform.GetChild(7).localScale = new Vector3(15f, 0.5f, 10f); body.baseMoveSpeed = 9f; body.baseNameToken = "Halcyon Knight"; body.subtitleNameToken = "Forsaken Heir"; SetStateOnHurt val = default(SetStateOnHurt); if (((Component)body).TryGetComponent(ref val)) { val.canBeHitStunned = false; } } } private static void TriLaser_OnEnter(orig_OnEnter orig, TriLaser self) { orig.Invoke(self); self.targetTimeStamp = 0.1f; self.fireCooldown = 0.3f; } private static void TriLaser_FixedUpdate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int num = 0; int laserCount2 = 0; while (val.TryGotoNext((MoveType)2, new Func[3] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(TriLaser), "timesFired"), (Instruction x) => ILPatternMatchingExt.MatchLdcI4(x, ref laserCount2), (Instruction x) => !ILPatternMatchingExt.MatchAdd(x) })) { int index = val.Index; val.Index = index - 1; val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)MoreLasers); num++; } if (num == 0) { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } static int MoreLasers(int laserCount, TriLaser self) { HealthComponent val2 = default(HealthComponent); if (((EntityState)self).TryGetComponent(ref val2) && val2.health <= val2.fullCombinedHealth / 2f) { return laserCount + 12; } return laserCount + 2; } } private void TriLaser_FireTriLaser(orig_FireTriLaser orig, TriLaser self) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); BaseAI[] aiComponents = ((EntityState)self).characterBody.master.AiComponents; foreach (BaseAI val in aiComponents) { if (val.hasAimTarget) { if (Vector3.Distance(val.skillDriverEvaluation.target.characterBody.transform.position, ((EntityState)self).transform.position) < 15f) { ((EntityState)self).outer.SetNextStateToMain(); } break; } } } } [MonoDetourTargets(typeof(FixedSlash))] public class LibraryClassHooks { [MonoDetourHookInitialize] private static void Init() { OnEnter.Postfix(delegate(FixedSlash self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) HitBoxGroup val3 = ((BaseState)self).FindHitBoxGroup(((BasicMeleeAttack)self).GetHitBoxGroupName()); float y2 = ((EntityState)self).characterBody.footPosition.y; HitBox[] hitBoxes2 = val3.hitBoxes; foreach (HitBox val4 in hitBoxes2) { ((Component)val4).transform.position = new Vector3(((Component)val4).transform.position.x, y2 + 6f, ((Component)val4).transform.position.z); } }); FixedUpdate.Postfix(delegate(FixedSlash self) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) float? num = null; BaseAI[] aiComponents = ((EntityState)self).characterBody.master.AiComponents; foreach (BaseAI val in aiComponents) { if (val.hasAimTarget && val.skillDriverEvaluation.target.characterBody.isPlayerControlled) { num = val.skillDriverEvaluation.target.characterBody.footPosition.y + 1f; break; } } if (!num.HasValue) { num = float.MinValue; } else { float y = ((EntityState)self).characterBody.footPosition.y; num = Mathf.Clamp(num.Value, y - 2f, y + 4f); HitBox[] hitBoxes = ((BasicMeleeAttack)self).hitBoxGroup.hitBoxes; foreach (HitBox val2 in hitBoxes) { float num2 = ((EntityState)self).transform.position.y - ((EntityState)self).characterBody.previousPosition.y; ((Component)val2).transform.position = new Vector3(((Component)val2).transform.position.x, ((Component)val2).transform.position.y - num2, ((Component)val2).transform.position.z); if (num < ((Component)val2).transform.position.y) { ((Component)val2).transform.position = new Vector3(((Component)val2).transform.position.x, num.Value, ((Component)val2).transform.position.z); } } } }); } } }