using System;
using System.Collections.Generic;
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 EntityStates;
using EntityStates.Treebot.Weapon;
using Microsoft.CodeAnalysis;
using On.EntityStates.Treebot.Weapon;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("FixREXCrash")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FixREXCrash")]
[assembly: AssemblyTitle("FixREXCrash")]
[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 FixREXCrash
{
[BepInPlugin("com.Nuxlar.FixREXCrash", "FixREXCrash", "1.0.1")]
public class FixREXCrash : BaseUnityPlugin
{
public void Awake()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Expected O, but got Unknown
FireSonicBoom.OnEnter += new hook_OnEnter(FireSonicBoom_OnEnter);
}
private void FireSonicBoom_OnEnter(orig_OnEnter orig, FireSonicBoom self)
{
//IL_0085: 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)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Expected O, but got Unknown
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0115: Unknown result type (might be due to invalid IL or missing references)
//IL_0116: 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)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: 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_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0166: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: 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_0216: Unknown result type (might be due to invalid IL or missing references)
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
//IL_0461: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02db: Unknown result type (might be due to invalid IL or missing references)
//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
//IL_02ec: 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_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02ff: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Unknown result type (might be due to invalid IL or missing references)
//IL_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_031d: Unknown result type (might be due to invalid IL or missing references)
//IL_032b: Expected O, but got Unknown
//IL_0332: Unknown result type (might be due to invalid IL or missing references)
//IL_0339: Unknown result type (might be due to invalid IL or missing references)
//IL_034c: Unknown result type (might be due to invalid IL or missing references)
//IL_0351: Unknown result type (might be due to invalid IL or missing references)
//IL_035d: Unknown result type (might be due to invalid IL or missing references)
//IL_0369: Unknown result type (might be due to invalid IL or missing references)
//IL_0371: Unknown result type (might be due to invalid IL or missing references)
//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_038c: Expected O, but got Unknown
IntPtr functionPointer = typeof(BaseState).GetMethod("OnEnter").MethodHandle.GetFunctionPointer();
((Action)Activator.CreateInstance(typeof(Action), self, functionPointer))();
self.duration = self.baseDuration / ((BaseState)self).attackSpeedStat;
((EntityState)self).PlayAnimation("Gesture, Additive", "FireSonicBoom");
Util.PlaySound(self.sound, ((EntityState)self).gameObject);
Ray aimRay = ((BaseState)self).GetAimRay();
if (!string.IsNullOrEmpty(self.muzzle))
{
EffectManager.SimpleMuzzleFlash(self.fireEffectPrefab, ((EntityState)self).gameObject, self.muzzle, false);
}
else
{
EffectManager.SpawnEffect(self.fireEffectPrefab, new EffectData
{
origin = ((Ray)(ref aimRay)).origin,
rotation = Quaternion.LookRotation(((Ray)(ref aimRay)).direction)
}, false);
}
((Ray)(ref aimRay)).origin = ((Ray)(ref aimRay)).origin - ((Ray)(ref aimRay)).direction * self.backupDistance;
if (NetworkServer.active)
{
BullseyeSearch val = new BullseyeSearch
{
teamMaskFilter = TeamMask.all,
maxAngleFilter = self.fieldOfView * 0.5f,
maxDistanceFilter = self.maxDistance,
searchOrigin = ((Ray)(ref aimRay)).origin,
searchDirection = ((Ray)(ref aimRay)).direction,
sortMode = (SortMode)1,
filterByLoS = false
};
val.RefreshCandidates();
val.FilterOutGameObject(((EntityState)self).gameObject);
IEnumerable<HurtBox> enumerable = val.GetResults().Where((Func<HurtBox, bool>)Util.IsValid).Distinct((IEqualityComparer<HurtBox>?)(object)default(EntityEqualityComparer));
TeamIndex team = ((BaseState)self).GetTeam();
foreach (HurtBox item in enumerable)
{
if (FriendlyFireManager.ShouldSplashHitProceed(item.healthComponent, team))
{
Vector3 val2 = ((Component)item).transform.position - ((Ray)(ref aimRay)).origin;
float magnitude = ((Vector3)(ref val2)).magnitude;
Vector2 val3 = new Vector2(val2.x, val2.z);
_ = ((Vector2)(ref val3)).magnitude;
Vector3 val4 = val2 / magnitude;
float num = 1f;
CharacterBody body = item.healthComponent.body;
if (Object.op_Implicit((Object)(object)body.characterMotor))
{
num = body.characterMotor.mass;
}
else if (Object.op_Implicit((Object)(object)((Component)item.healthComponent).GetComponent<Rigidbody>()))
{
num = ((EntityState)self).rigidbody.mass;
}
float num2 = FireSonicBoom.shoveSuitabilityCurve.Evaluate(num);
self.AddDebuff(body);
body.RecalculateStats();
float num3 = (double.IsNaN(body.acceleration) ? 1f : body.acceleration);
double num4 = (double)Trajectory.CalculateInitialYSpeedForHeight(Mathf.Abs(self.idealDistanceToPlaceTargets - magnitude), 0f - num3) * (double)Mathf.Sign(self.idealDistanceToPlaceTargets - magnitude);
Vector3 val5 = val4 * (float)num4;
val5.y = self.liftVelocity;
Vector3 val6 = val5;
DamageInfo val7 = new DamageInfo
{
attacker = ((EntityState)self).gameObject,
damage = self.CalculateDamage(),
position = ((Component)item).transform.position,
procCoefficient = self.CalculateProcCoefficient()
};
item.healthComponent.TakeDamageForce(val6 * (num * num2), true, true);
item.healthComponent.TakeDamage(new DamageInfo
{
attacker = ((EntityState)self).gameObject,
damage = self.CalculateDamage(),
position = ((Component)item).transform.position,
procCoefficient = self.CalculateProcCoefficient()
});
GlobalEventManager.instance.OnHitEnemy(val7, ((Component)item.healthComponent).gameObject);
}
}
}
if (((EntityState)self).isAuthority && Object.op_Implicit((Object)(object)((EntityState)self).characterBody) && Object.op_Implicit((Object)(object)((EntityState)self).characterBody.characterMotor))
{
double num5 = (((EntityState)self).characterBody.characterMotor.isGrounded ? ((double)self.groundKnockbackDistance) : ((double)self.airKnockbackDistance));
float num6 = (Object.op_Implicit((Object)(object)((EntityState)self).characterBody.characterMotor) ? ((EntityState)self).characterBody.characterMotor.mass : 1f);
double num7 = 0.0 - (double)((EntityState)self).characterBody.acceleration;
((EntityState)self).characterBody.characterMotor.ApplyForce((0f - Trajectory.CalculateInitialYSpeedForHeight((float)num5, (float)num7)) * num6 * ((Ray)(ref aimRay)).direction, false, false);
}
}
}
}