using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Mirror;
using UnityEngine;
using YAPYAP;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("AerowithDamage")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("AerowithDamage")]
[assembly: AssemblyCopyright("Copyright © HP 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("b506744e-4f7f-4ce2-ac06-45efa5c9cd14")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace YapYapWindDamage;
[BepInPlugin("controllerv.aerowithdamage", "Aero with Damage", "1.0.0")]
public class WindDamageMod : BaseUnityPlugin
{
public static ConfigEntry<int> DamagetoNPC;
public static ConfigEntry<int> DamagetoPawn;
private void Awake()
{
DamagetoNPC = ((BaseUnityPlugin)this).Config.Bind<int>("General", "AeroDamagetoNPC", 10, "How much damage the wind spell deals to NPC.");
DamagetoPawn = ((BaseUnityPlugin)this).Config.Bind<int>("General", "AeroDamagetoPawn", 5, "How much damage the Aero spell deals to other players");
((BaseUnityPlugin)this).Logger.LogInfo((object)"Wind Damage Mod Loaded!");
Harmony.CreateAndPatchAll(typeof(WindDamagePatch), (string)null);
}
}
[HarmonyPatch(typeof(ProjectilePush), "OnTargetHit")]
public class WindDamagePatch
{
private static void Prefix(ProjectilePush __instance, Collider target, Rigidbody targetRigidbody, NetworkIdentity targetIdentity)
{
//IL_0096: 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_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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)
if (!NetworkServer.active || (Object)(object)__instance == (Object)null || (Object)(object)targetRigidbody == (Object)null || (Object)(object)targetIdentity == (Object)null)
{
return;
}
FieldInfo fieldInfo = AccessTools.Field(typeof(ProjectilePush), "affectedRigidbodies");
HashSet<Rigidbody> hashSet = (HashSet<Rigidbody>)fieldInfo.GetValue(__instance);
if (hashSet.Contains(targetRigidbody))
{
return;
}
int value = WindDamageMod.DamagetoNPC.Value;
int value2 = WindDamageMod.DamagetoPawn.Value;
Pawn val = default(Pawn);
NpcBehaviour val4 = default(NpcBehaviour);
if (((Component)targetIdentity).TryGetComponent<Pawn>(ref val))
{
HitInfo val2 = default(HitInfo);
val2.damage = value2;
val2.isDirectional = true;
val2.impactForce = 0f;
val2.sourceTransform = ((Component)__instance).transform;
val2.forceRagdoll = false;
HitInfo val3 = val2;
if ((Object)(object)val.Hurtbox != (Object)null)
{
val.Hurtbox.OnHitboxHit(val3);
}
}
else if (((Component)targetIdentity).TryGetComponent<NpcBehaviour>(ref val4))
{
Vector3 forward = ((Component)__instance).transform.forward;
val4.OnHit(value, forward, false);
}
}
}