using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Pigeon.Movement;
using UnityEngine;
[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("LivewireFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0.2+5a166ce6947cf6357293d6995383e847dd01171c")]
[assembly: AssemblyProduct("LivewireFix")]
[assembly: AssemblyTitle("LivewireFix")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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;
}
}
}
[BepInPlugin("sparroh.livewirefix", "LivewireFix", "1.0.0")]
[MycoMod(/*Could not decode attribute arguments.*/)]
public class SparrohPlugin : BaseUnityPlugin
{
public const string PluginGUID = "sparroh.livewirefix";
public const string PluginName = "LivewireFix";
public const string PluginVersion = "1.0.0";
internal static ManualLogSource Logger;
private void Awake()
{
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
new Harmony("sparroh.livewirefix").PatchAll();
Logger.LogInfo((object)"LivewireFix loaded successfully.");
}
}
[HarmonyPatch(typeof(VoltaicGrenade), "OverrideActivate")]
public class VoltaicGrenade_OverrideActivate_Patch
{
private static bool Prefix(VoltaicGrenade __instance, ref bool __result)
{
Traverse val = Traverse.Create((object)__instance);
Traverse val2 = val.Field("grenadeData");
float value = val2.Field("selfGrenadeDuration").GetValue<float>();
float value2 = val.Field("selfGrenadeTimer").GetValue<float>();
float value3 = val.Field("cooldownData").Field("charge").GetValue<float>();
if (value > 0f && value2 < 0f)
{
if (value3 >= 1f)
{
val.Field("selfGrenadeTimer").SetValue((object)0f);
float value4 = val2.Field("selfGrenadeExplodeInterval").GetValue<float>();
val.Field("selfGrenadeExplosionTimer").SetValue((object)value4);
Player value5 = val.Field("player").GetValue<Player>();
Sprite value6 = val.Field("livewireIcon").GetValue<Sprite>();
value5.UpdateStackDisplay((object)typeof(UpgradeProperty_VoltaicGrenade_Livewire), TextBlocks.GetString("Livewire", 0), value6, 1, value);
float num = value3;
val.Field("cooldownData").Field("charge").SetValue((object)(num - 1f));
val.Method("InvokeOnCooldownChanged", new object[1] { num - 1f }).GetValue();
__result = true;
return false;
}
__result = false;
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Player), "TryThrow")]
public class Player_TryThrow_Patch
{
private static bool Prefix(Player __instance)
{
IGear throwableGear = __instance.ThrowableGear;
VoltaicGrenade val = (VoltaicGrenade)(object)((throwableGear is VoltaicGrenade) ? throwableGear : null);
if ((Object)(object)val != (Object)null)
{
Traverse val2 = Traverse.Create((object)val);
Traverse val3 = val2.Field("grenadeData");
float value = val3.Field("selfGrenadeDuration").GetValue<float>();
if (value <= 0f)
{
return true;
}
if (val2.Field("selfGrenadeTimer").GetValue<float>() < 0f)
{
float value2 = val2.Field("cooldownData").Field("charge").GetValue<float>();
if (value2 >= 1f)
{
float value3 = val3.Field("selfGrenadeExplodeInterval").GetValue<float>();
val2.Field("selfGrenadeTimer").SetValue((object)0f);
val2.Field("selfGrenadeExplosionTimer").SetValue((object)value3);
Sprite value4 = val2.Field("livewireIcon").GetValue<Sprite>();
__instance.UpdateStackDisplay((object)typeof(UpgradeProperty_VoltaicGrenade_Livewire), TextBlocks.GetString("Livewire", 0), value4, 1, value);
float num = value2;
val2.Field("cooldownData").Field("charge").SetValue((object)(num - 1f));
int value5 = Traverse.Create((object)__instance).Property("SelectedGearSlot", (object[])null).GetValue<int>();
Traverse.Create((object)__instance).Property("SelectedGearSlot", (object[])null).SetValue((object)4);
val2.Method("InvokeOnCooldownChanged", new object[1] { num - 1f }).GetValue();
Traverse.Create((object)__instance).Property("SelectedGearSlot", (object[])null).SetValue((object)value5);
return false;
}
return false;
}
return false;
}
return true;
}
}
[HarmonyPatch(typeof(Throwable), "Fire")]
public class Throwable_Fire_Patch
{
private static bool Prefix(Throwable __instance)
{
if (__instance is VoltaicGrenade)
{
if (Traverse.Create((object)__instance).Field("grenadeData").Field("selfGrenadeDuration")
.GetValue<float>() <= 0f)
{
return true;
}
if (Traverse.Create((object)__instance).Field("selfGrenadeTimer").GetValue<float>() >= 0f)
{
return false;
}
}
return true;
}
}
[HarmonyPatch(typeof(Throwable))]
[HarmonyPatch("get_CanEquipWhenUncharged")]
public class Throwable_CanEquipWhenUncharged_Patch
{
private static void Postfix(ref bool __result, Throwable __instance)
{
if (__instance is VoltaicGrenade && Traverse.Create((object)__instance).Field("grenadeData").Field("selfGrenadeDuration")
.GetValue<float>() > 0f)
{
__result = true;
}
}
}
[CompilerGenerated]
[ExcludeFromCodeCoverage]
internal static class GitVersionInformation
{
public const string AssemblySemFileVer = "0.0.1.0";
public const string AssemblySemVer = "0.0.1.0";
public const string BranchName = "master";
public const string BuildMetaData = "";
public const string CommitDate = "2025-11-27";
public const string CommitsSinceVersionSource = "3";
public const string EscapedBranchName = "master";
public const string FullBuildMetaData = "Branch.master.Sha.5a166ce6947cf6357293d6995383e847dd01171c";
public const string FullSemVer = "0.0.1-3";
public const string InformationalVersion = "0.0.1-3+Branch.master.Sha.5a166ce6947cf6357293d6995383e847dd01171c";
public const string Major = "0";
public const string MajorMinorPatch = "0.0.1";
public const string Minor = "0";
public const string Patch = "1";
public const string PreReleaseLabel = "";
public const string PreReleaseLabelWithDash = "";
public const string PreReleaseNumber = "3";
public const string PreReleaseTag = "3";
public const string PreReleaseTagWithDash = "-3";
public const string SemVer = "0.0.1-3";
public const string Sha = "5a166ce6947cf6357293d6995383e847dd01171c";
public const string ShortSha = "5a166ce";
public const string UncommittedChanges = "8";
public const string VersionSourceSha = "";
public const string WeightedPreReleaseNumber = "55003";
}
namespace LivewireFix
{
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "LivewireFix";
public const string PLUGIN_NAME = "LivewireFix";
public const string PLUGIN_VERSION = "0.0.0";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}