using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Math;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Pool;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("HeavensFuryRework")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HeavensFuryRework")]
[assembly: AssemblyTitle("HeavensFuryRework")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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;
}
}
}
[HarmonyPatch(typeof(WideGun), "Update")]
public static class WideGun_Update_Patch
{
private static readonly FieldRef<WideGun, int> smitesRemainingField = AccessTools.FieldRefAccess<WideGun, int>("smitesRemaining");
private static readonly FieldRef<WideGun, float> lastSmiteTimeField = AccessTools.FieldRefAccess<WideGun, float>("lastSmiteTime");
private static readonly FieldRef<WideGun, Vector3> smitePositionField = AccessTools.FieldRefAccess<WideGun, Vector3>("smitePosition");
private static readonly FieldRef<Gun, GunData> gunDataField = AccessTools.FieldRefAccess<Gun, GunData>("gunData");
[HarmonyPrefix]
private static bool Prefix(WideGun __instance)
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: 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_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: 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_01ee: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
if (!SparrohPlugin.enableHeavensFuryRework.Value)
{
return true;
}
if (!((NetworkBehaviour)__instance).IsOwner)
{
return true;
}
int num = smitesRemainingField.Invoke(__instance);
if (num <= 0)
{
return true;
}
float time = Time.time;
float num2 = lastSmiteTimeField.Invoke(__instance);
if (!(time - num2 > 0.155f))
{
return true;
}
lastSmiteTimeField.Invoke(__instance) = time;
smitesRemainingField.Invoke(__instance) = num - 1;
float value;
float num3 = (SparrohPlugin.lastSmiteDamage.TryGetValue(__instance, out value) ? value : 0f);
Vector3 val = smitePositionField.Invoke(__instance);
Vector2 val2 = ((Random)(ref Random.shared)).InsideUnitCircle();
val.x += val2.x * __instance.TridentData.smiteRadius;
val.z += val2.y * __instance.TridentData.smiteRadius;
val.y += 30f;
RaycastHit val4 = default(RaycastHit);
Vector3 val3 = ((!Physics.Raycast(val, Vector3.down, ref val4, 60f, 8193)) ? (val - new Vector3(0f, 60f, 0f)) : ((RaycastHit)(ref val4)).point);
bool flag = ((Random)(ref Random.shared)).NextFloat() < __instance.TridentData.smiteSoakChance;
List<ITarget> list = CollectionPool<List<ITarget>, ITarget>.Get();
try
{
float num4 = ((__instance.TridentData.smiteSoakChance > 0f) ? 4f : 2f);
if (IDamageSource.GetTargetsInCapsule(val, val3, num4, 83080, list, (TargetType)255))
{
DamageData val5 = default(DamageData);
((DamageData)(ref val5))..ctor((__instance.TridentData.smiteSoakChance > 0f) ? (num3 * 0.5f) : 0f, (EffectType)2, 10f);
for (int i = 0; i < list.Count; i++)
{
ITarget val6 = list[i];
Vector3 healthbarPosition = ((IFollowable)val6).GetHealthbarPosition();
IDamageSource.DamageTarget((IDamageSource)(object)__instance, val6, val5, healthbarPosition, (Collider)null);
if (flag)
{
IDamageSource.DamageTarget((IDamageSource)(object)__instance, val6, new DamageData(0f, (EffectType)9, 10f), healthbarPosition, (Collider)null);
}
}
}
}
finally
{
CollectionPool<List<ITarget>, ITarget>.Release(list);
}
GameManager.Instance.SpawnLightningEffect_Rpc(val, val3);
return false;
}
}
[HarmonyPatch(typeof(WideGun), "AfterDamageTarget")]
public static class WideGun_AfterDamageTarget_Patch
{
private static readonly FieldRef<Gun, GunData> gunDataField = AccessTools.FieldRefAccess<Gun, GunData>("gunData");
[HarmonyPostfix]
private static void Postfix(WideGun __instance, in DamageCallbackData data)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0033: Invalid comparison between Unknown and I4
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
if (SparrohPlugin.enableHeavensFuryRework.Value)
{
GunData val = gunDataField.Invoke((Gun)(object)__instance);
if ((object)data.source != __instance && ((int)data.damageData.effect <= 0 || data.damageData.effectAmount != 0f) && ((Random)(ref Random.shared)).NextFloat() <= __instance.TridentData.smiteChance / (float)val.bulletsPerShot)
{
SparrohPlugin.lastSmiteDamage[__instance] = data.damageData.damage;
}
}
}
}
[BepInPlugin("sparroh.heavensfuryrework", "HeavensFuryRework", "1.0.1")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class SparrohPlugin : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.heavensfuryrework";
public const string PluginName = "HeavensFuryRework";
public const string PluginVersion = "1.0.1";
internal static ManualLogSource Logger;
internal static ConfigEntry<bool> enableHeavensFuryRework;
internal static Dictionary<WideGun, float> lastSmiteDamage = new Dictionary<WideGun, float>();
private Harmony harmony;
private void Awake()
{
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
enableHeavensFuryRework = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Heaven's Fury Rework", true, "Enhances Heaven's Fury smite behavior with increased frequency and area damage.");
harmony = new Harmony("sparroh.heavensfuryrework");
harmony.PatchAll(typeof(WideGun_Update_Patch));
harmony.PatchAll(typeof(WideGun_AfterDamageTarget_Patch));
Logger.LogInfo((object)"HeavensFuryRework v1.0.1 loaded successfully.");
}
private void OnDestroy()
{
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
}
}
namespace HeavensFuryRework
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "HeavensFuryRework";
public const string PLUGIN_NAME = "HeavensFuryRework";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}