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;
[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("ArcLightningRework")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ArcLightningRework")]
[assembly: AssemblyTitle("ArcLightningRework")]
[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(ScoutLaserRifle), "OnTargetDamaged")]
public static class ScoutLaserRifle_OnTargetDamaged_Patch
{
private static bool Prefix(ScoutLaserRifle __instance, in DamageCallbackData data)
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0116: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
if (!SparrohPlugin.enableArcLightningRework.Value)
{
return true;
}
if (__instance.IsLaserModeActive && __instance.LaserData.lightningArcChance > 0f && ((Random)(ref Random.shared)).NextFloat() <= __instance.LaserData.lightningArcChance && (!SparrohPlugin.lightningSpawned.ContainsKey(__instance) || !SparrohPlugin.lightningSpawned[__instance]))
{
bool flag = false;
foreach (UpgradeInstance activeUpgrade in ((Gun)__instance).ActiveUpgrades)
{
int num = 0;
while (true)
{
int num2 = num;
UpgradePropertyList properties = activeUpgrade.Upgrade.Properties;
if (num2 >= ((UpgradePropertyList)(ref properties)).Count)
{
break;
}
properties = activeUpgrade.Upgrade.Properties;
if (((UpgradePropertyList)(ref properties))[num] is UpgradeProperty_DMLR_LightningArc && activeUpgrade.IsTurbocharged)
{
flag = true;
break;
}
num++;
}
if (flag)
{
break;
}
}
if (flag)
{
GameManager.Instance.SpawnLightningForkEffect_ServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), data.position, 10f, (TargetType)1, 10, 15f);
}
else
{
GameManager.Instance.SpawnLightningForkEffect_ServerRpc(NetworkBehaviourReference.op_Implicit((NetworkBehaviour)(object)__instance), data.position, 10f, (TargetType)1, 1);
}
SparrohPlugin.lightningSpawned[__instance] = true;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(ScoutLaserRifle), "OnStartedFiring")]
public static class ScoutLaserRifle_OnStartedFiring_Patch
{
private static void Postfix(ScoutLaserRifle __instance)
{
if (SparrohPlugin.enableArcLightningRework.Value)
{
SparrohPlugin.lightningSpawned[__instance] = false;
}
}
}
[HarmonyPatch(typeof(ScoutLaserRifle), "OnStoppedFiring")]
public static class ScoutLaserRifle_OnStoppedFiring_Patch
{
private static void Postfix(ScoutLaserRifle __instance)
{
if (SparrohPlugin.enableArcLightningRework.Value && SparrohPlugin.lightningSpawned.ContainsKey(__instance))
{
SparrohPlugin.lightningSpawned[__instance] = false;
}
}
}
[HarmonyPatch(typeof(TextBlocks), "GetString", new Type[] { typeof(string) })]
public static class TextBlocks_GetString_Patch
{
private static void Postfix(ref string __result, string id)
{
if (SparrohPlugin.enableArcLightningRework.Value && id == "ArcLightning_2")
{
__result = "Chains to 5 enemies with 15 base damage\nMax Hits: 10\nDamage: 15";
}
}
}
[HarmonyPatch(typeof(Upgrade), "get_Flags")]
public static class Upgrade_Flags_Getter_Patch
{
private static void Postfix(ref UpgradeFlags __result, Upgrade __instance)
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: 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_0018: Unknown result type (might be due to invalid IL or missing references)
if (!SparrohPlugin.enableArcLightningRework.Value)
{
return;
}
try
{
int num = 0;
while (true)
{
int num2 = num;
UpgradePropertyList properties = __instance.Properties;
if (num2 < ((UpgradePropertyList)(ref properties)).Count)
{
properties = __instance.Properties;
if (((UpgradePropertyList)(ref properties))[num] is UpgradeProperty_DMLR_LightningArc)
{
__result = (UpgradeFlags)((uint)__result | 0x2000u);
break;
}
num++;
continue;
}
break;
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(Upgrade), "get_Description")]
public static class Upgrade_Description_Getter_Patch
{
private static void Postfix(ref string __result, Upgrade __instance)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: 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_0052: 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_0027: Unknown result type (might be due to invalid IL or missing references)
if (!SparrohPlugin.enableArcLightningRework.Value || (__instance.Flags & 0x2000) == 0)
{
return;
}
try
{
int num = 0;
while (true)
{
int num2 = num;
UpgradePropertyList properties = __instance.Properties;
if (num2 < ((UpgradePropertyList)(ref properties)).Count)
{
properties = __instance.Properties;
if (((UpgradePropertyList)(ref properties))[num] is UpgradeProperty_DMLR_LightningArc)
{
__result += "\nWhen Turbocharged:\nMax Hits: 10\nDamage: 15";
break;
}
num++;
continue;
}
break;
}
}
catch
{
}
}
}
[HarmonyPatch(typeof(UpgradeProperty), "GetTurbochargedInfo")]
public static class UpgradeProperty_GetTurbochargedInfo_Patch
{
private static bool Prefix(ref string __result, UpgradeProperty __instance)
{
if (!SparrohPlugin.enableArcLightningRework.Value)
{
return true;
}
if (__instance is UpgradeProperty_DMLR_LightningArc)
{
__result = "Chains to 10 enemies with 15 base damage";
return false;
}
return true;
}
}
[HarmonyPatch(typeof(UpgradeProperty_DMLR_LightningArc), "GetStatData")]
public static class UpgradeProperty_DMLR_LightningArc_GetStatData_Patch
{
private static void Postfix(ref IEnumerator<StatData> __result, Random rand, IUpgradable gear, UpgradeInstance upgrade)
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
if (SparrohPlugin.enableArcLightningRework.Value)
{
__result = GetModifiedStatData(__result, rand, gear, upgrade);
}
}
private static IEnumerator<StatData> GetModifiedStatData(IEnumerator<StatData> original, Random rand, IUpgradable gear, UpgradeInstance upgrade)
{
while (original.MoveNext())
{
yield return original.Current;
}
yield return StatData.Create("Max Hits", 10f, (OverrideType)3, (LabelType)1, (string)null);
yield return StatData.Create("Damage", 15f, (OverrideType)3, (LabelType)1, (string)null);
}
}
[BepInPlugin("sparroh.arclightningrework", "ArcLightningRework", "1.0.1")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class SparrohPlugin : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.arclightningrework";
public const string PluginName = "ArcLightningRework";
public const string PluginVersion = "1.0.1";
internal static ManualLogSource Logger;
internal static ConfigEntry<bool> enableArcLightningRework;
internal static Dictionary<ScoutLaserRifle, bool> lightningSpawned = new Dictionary<ScoutLaserRifle, bool>();
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;
enableArcLightningRework = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable Arc Lightning Rework", true, "Enhances lightning arc behavior for Scout Laser Rifle, allowing chaining and turbocharged upgrades.");
harmony = new Harmony("sparroh.arclightningrework");
harmony.PatchAll(typeof(ScoutLaserRifle_OnTargetDamaged_Patch));
harmony.PatchAll(typeof(ScoutLaserRifle_OnStartedFiring_Patch));
harmony.PatchAll(typeof(ScoutLaserRifle_OnStoppedFiring_Patch));
harmony.PatchAll(typeof(TextBlocks_GetString_Patch));
harmony.PatchAll(typeof(Upgrade_Flags_Getter_Patch));
harmony.PatchAll(typeof(Upgrade_Description_Getter_Patch));
harmony.PatchAll(typeof(UpgradeProperty_GetTurbochargedInfo_Patch));
harmony.PatchAll(typeof(UpgradeProperty_DMLR_LightningArc_GetStatData_Patch));
Logger.LogInfo((object)"ArcLightningRework v1.0.1 loaded successfully.");
}
private void OnDestroy()
{
Harmony obj = harmony;
if (obj != null)
{
obj.UnpatchSelf();
}
}
}
namespace ArcLightningRework
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ArcLightningRework";
public const string PLUGIN_NAME = "ArcLightningRework";
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)
{
}
}
}