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 IL.EntityStates.Halcyonite;
using Microsoft.CodeAnalysis;
using Mono.Cecil;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.EntityStates;
using On.EntityStates.Halcyonite;
using RoR2;
using RoR2.Skills;
using UnityEngine;
using UnityEngine.AddressableAssets;
[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+9b36bc48e4fc02134a22da7d0a8b2a191604c6d1")]
[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.1")]
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.1";
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_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Expected O, but got Unknown
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Expected O, but got Unknown
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Expected O, but got Unknown
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
Log.Init(((BaseUnityPlugin)this).Logger);
SkillDef val = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC2/Halcyonite/HalcyoniteMonsterTriLaser.asset").WaitForCompletion();
val.interruptPriority = (InterruptPriority)0;
SkillDef val2 = Addressables.LoadAssetAsync<SkillDef>((object)"RoR2/DLC2/Halcyonite/HalcyoniteMonsterWhirlwindRush.asset").WaitForCompletion();
val2.interruptPriority = (InterruptPriority)0;
SpawnState.OnEnter += new hook_OnEnter(SpawnState_OnEnter);
WhirlwindWarmUp.OnExit += new hook_OnExit(WhirlwindWarmUp_OnExit);
WhirlWindPersuitCycle.OnEnter += new hook_OnEnter(WhirlwindWarmUp_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<Instruction, bool>[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<TriLaser, Vector3, Vector3>>((Func<TriLaser, Vector3, Vector3>)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)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(WhirlWindPersuitCycle), "targetPos")
}))
{
val.Emit(OpCodes.Pop);
val.Emit(OpCodes.Ldarg_0);
val.EmitDelegate<Func<WhirlWindPersuitCycle, Vector3>>((Func<WhirlWindPersuitCycle, Vector3>)targetToCurrentPos);
}
else
{
Log.Error(((MemberReference)il.Method).Name + " IL Hook failed!");
}
static Vector3 targetToCurrentPos(WhirlWindPersuitCycle self)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
return self.targetBody.footPosition;
}
}
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 WhirlwindWarmUp_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;
}
}
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);
}
}
}