using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using EntityStates; using EntityStates.Halcyonite; using HG; using IL.EntityStates.Halcyonite; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates; using On.EntityStates.Halcyonite; using R2API; using RoR2; using RoR2.ContentManagement; using RoR2.Skills; using RoR2BepInExPack.GameAssetPathsBetter; using UnityEngine; using UnityEngine.AddressableAssets; 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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("HalcyonFixes")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c73dc8ea7b8a2d4a5242f4ad0ec56cb9c002c6ed")] [assembly: AssemblyProduct("HalcyonFixes")] [assembly: AssemblyTitle("HalcyonFixes")] [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 HalcyonFixes { [BepInPlugin("Onyx.HalcyonFixes", "HalcyonFixes", "1.2.5")] public class HalcyonFixes : BaseUnityPlugin { public const string PluginGUID = "Onyx.HalcyonFixes"; public const string PluginAuthor = "Onyx"; public const string PluginName = "HalcyonFixes"; public const string PluginVersion = "1.2.5"; public void Awake() { //IL_0012: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Expected O, but got Unknown //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Expected O, but got Unknown //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); SkillDef val = Addressables.LoadAssetAsync((object)"RoR2/DLC2/Halcyonite/HalcyoniteMonsterTriLaser.asset").WaitForCompletion(); val.interruptPriority = (InterruptPriority)0; SkillDef val2 = Addressables.LoadAssetAsync((object)"RoR2/DLC2/Halcyonite/HalcyoniteMonsterWhirlwindRush.asset").WaitForCompletion(); val2.interruptPriority = (InterruptPriority)0; AssetReferenceT val3 = new AssetReferenceT(RoR2_DLC2.ShrineHalcyonite_prefab); AsyncOperationHandle val4 = AssetAsyncReferenceManager.LoadAsset(val3, (AsyncReferenceHandleUnloadType)2); val4.Completed += delegate(AsyncOperationHandle x) { GameObject gameObject = ((Component)x.Result.transform.Find("RangeIndicator/RangeFX/CrystalLines/Particle SystemCollider Kill Trigger")).gameObject; gameObject.layer = (int)(ref LayerIndex.collideWithCharacterHullOnly); ((Behaviour)((Component)x.Result.transform.Find("Camp 1 - Flavor Props (Inner Radius)")).GetComponent()).enabled = false; ((Behaviour)((Component)x.Result.transform.Find("Camp 2 - Flavor Props (Outer Radius)")).GetComponent()).enabled = false; }; AssetReferenceT val5 = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_GoldenSwipe_asset); AsyncOperationHandle val6 = AssetAsyncReferenceManager.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle x) { //IL_0012: 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) x.Result.targetType = (SerializableSystemType)typeof(FixedSwipe); }; val5 = new AssetReferenceT(RoR2_DLC2_Halcyonite.EntityStates_HalcyoniteMonster_GoldenSlash_asset); val6 = AssetAsyncReferenceManager.LoadAsset(val5, (AsyncReferenceHandleUnloadType)2); val6.Completed += delegate(AsyncOperationHandle x) { //IL_0012: 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) x.Result.targetType = (SerializableSystemType)typeof(FixedSlash); }; AssetReferenceT val7 = new AssetReferenceT(RoR2_DLC2_Halcyonite.HalcyoniteMonsterGoldenSwipe_asset); AsyncOperationHandle val8 = AssetAsyncReferenceManager.LoadAsset(val7, (AsyncReferenceHandleUnloadType)2); val8.Completed += delegate(AsyncOperationHandle x) { //IL_0012: 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) x.Result.activationState = new SerializableEntityStateType(typeof(FixedSwipe)); }; val7 = new AssetReferenceT(RoR2_DLC2_Halcyonite.HalcyoniteMonsterGoldenSlash_asset); val8 = AssetAsyncReferenceManager.LoadAsset(val7, (AsyncReferenceHandleUnloadType)2); val8.Completed += delegate(AsyncOperationHandle x) { //IL_0012: 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) x.Result.activationState = new SerializableEntityStateType(typeof(FixedSlash)); }; bool flag = default(bool); ContentAddition.AddEntityState(ref flag); ContentAddition.AddEntityState(ref flag); SpawnState.OnEnter += new hook_OnEnter(SpawnState_OnEnter); WhirlwindWarmUp.OnExit += new hook_OnExit(WhirlwindWarmUp_OnExit); WhirlWindPersuitCycle.OnEnter += new hook_OnEnter(WhirlWindPersuitCycle_OnEnter); WhirlWindPersuitCycle.UpdateDecelerate += new hook_UpdateDecelerate(UpdateDecelerate); WhirlWindPersuitCycle.CheckIfArrived += new Manipulator(CheckIfArrived); WhirlWindPersuitCycle.GetMinimumInterruptPriority += new hook_GetMinimumInterruptPriority(GetMinimumInterruptPriority_PrioritySkill); EntityState.GetMinimumInterruptPriority += new hook_GetMinimumInterruptPriority(GetMinimumInterruptPriority_PrioritySkill); TriLaser.FireTriLaser += new Manipulator(FireTriLaser); } private void FireTriLaser(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); int laserVectorLoc = 0; if (val.TryGotoNext((MoveType)2, new Func[2] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, typeof(RaycastHit), "get_point"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref laserVectorLoc) })) { val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc, laserVectorLoc); val.EmitDelegate>((Func)checkWallDistance); val.Emit(OpCodes.Stloc, laserVectorLoc); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } static Vector3 checkWallDistance(TriLaser self, Vector3 laserVector) { //IL_0009: 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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) Vector3 origin = ((Ray)(ref self.modifiedAimRay)).origin; Vector3 direction = ((Ray)(ref self.modifiedAimRay)).direction; Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(origin + ((Vector3)(ref direction)).normalized * -1f, ((Ray)(ref self.modifiedAimRay)).direction); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2, ref val3, 2f, LayerMask.op_Implicit(((LayerIndex)(ref LayerIndex.world)).mask))) { return ((RaycastHit)(ref val3)).point; } return laserVector; } } private InterruptPriority GetMinimumInterruptPriority_PrioritySkill(orig_GetMinimumInterruptPriority orig, EntityState self) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) InterruptPriority val = orig.Invoke(self); if ((int)val < 2) { if (self is WhirlwindWarmUp) { return (InterruptPriority)2; } if (self is GoldenSlash) { return (InterruptPriority)2; } if (self is GoldenSwipe) { return (InterruptPriority)2; } } return val; } private InterruptPriority GetMinimumInterruptPriority_PrioritySkill(orig_GetMinimumInterruptPriority orig, WhirlWindPersuitCycle self) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0016: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) InterruptPriority val = orig.Invoke(self); if ((int)val < 2) { return (InterruptPriority)2; } return val; } private void SpawnState_OnEnter(orig_OnEnter orig, SpawnState self) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown orig.Invoke(self); ((EntityState)self).outer.nextStateModifier = new ModifyNextStateDelegate(fixInterruptinWhirlwind); void fixInterruptinWhirlwind(EntityStateMachine entityStateMachine, ref EntityState newNextState) { if (!(newNextState is WhirlWindPersuitCycle)) { ((EntityState)self).PlayCrossfade("FullBody Override", "Empty", "WhirlwindRush.playbackRate", 0.1f, 0.1f); } } } private void CheckIfArrived(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_003d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext((MoveType)2, new Func[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(WhirlWindPersuitCycle), "targetPos") })) { val.Emit(OpCodes.Ldarg_0); val.EmitDelegate>((Func)targetToCurrentPos); } else { Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!"); } static Vector3 targetToCurrentPos(Vector3 target, WhirlWindPersuitCycle self) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)self.targetBody)) { _ = self.targetBody.footPosition; if (true) { return self.targetBody.footPosition; } } return target; } } private void UpdateDecelerate(orig_UpdateDecelerate orig, WhirlWindPersuitCycle self) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); float num = Mathf.Lerp(WhirlWindPersuitCycle.dashSpeedCoefficient, 0f, (((EntityState)self).fixedAge - self.startDecelerateTimeStamp) / WhirlWindPersuitCycle.decelerateDuration); ((EntityState)self).characterMotor.velocity = ((Vector3)(ref self.targetMoveDirt)).normalized * num; ((EntityState)self).characterDirection.moveVector = ((Vector3)(ref self.targetMoveDirt)).normalized; } private void WhirlWindPersuitCycle_OnEnter(orig_OnEnter 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_0027: 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) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); CharacterGravityParameters gravityParameters = ((EntityState)self).characterMotor.gravityParameters; gravityParameters.channeledAntiGravityGranterCount++; ((EntityState)self).characterMotor.gravityParameters = gravityParameters; CharacterFlightParameters flightParameters = ((EntityState)self).characterMotor.flightParameters; flightParameters.channeledFlightGranterCount++; ((EntityState)self).characterMotor.flightParameters = flightParameters; } private void WhirlwindWarmUp_OnExit(orig_OnExit orig, WhirlwindWarmUp 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); CharacterGravityParameters gravityParameters = ((EntityState)self).characterMotor.gravityParameters; gravityParameters.channeledAntiGravityGranterCount = 0; ((EntityState)self).characterMotor.gravityParameters = gravityParameters; CharacterFlightParameters flightParameters = ((EntityState)self).characterMotor.flightParameters; flightParameters.channeledFlightGranterCount = 0; ((EntityState)self).characterMotor.flightParameters = flightParameters; } } public class FixedSwipe : GoldenSwipe { public override bool allowExitFire => false; public override void OnEnter() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((BasicMeleeAttack)this).pushAwayForce = 0f; ((BasicMeleeAttack)this).forceVector = new Vector3(((EntityState)this).inputBank.aimDirection.x, 0.5f, ((EntityState)this).inputBank.aimDirection.z) * 5000f; ((BasicMeleeAttack)this).OnEnter(); } public override void FixedUpdate() { ((BasicMeleeAttack)this).FixedUpdate(); } } public class FixedSlash : GoldenSlash { public override bool allowExitFire => false; public override void OnEnter() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) ((BasicMeleeAttack)this).pushAwayForce = 0f; ((BasicMeleeAttack)this).forceVector = new Vector3(((EntityState)this).inputBank.aimDirection.x, 0.5f, ((EntityState)this).inputBank.aimDirection.z) * 5000f; ((BasicMeleeAttack)this).OnEnter(); } public override void FixedUpdate() { ((BasicMeleeAttack)this).FixedUpdate(); } } 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); } } }