using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Photon.Pun;
using UltimateHealthPacks.Patches;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("UltimateHealthPacks")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("UltimateHealthPacks")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f51a3d37-3c99-4ff2-b7fa-504830825378")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace UltimateHealthPacks
{
[BepInPlugin("Godji.UltimateHealthPacks", "REPO Ultimate Health Packs Mod", "1.0.0")]
public class UltimateHealthPacksMod : BaseUnityPlugin
{
private const string modGUID = "Godji.UltimateHealthPacks";
private const string modName = "REPO Ultimate Health Packs Mod";
private const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Godji.UltimateHealthPacks");
private static UltimateHealthPacksMod Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Godji.UltimateHealthPacks");
mls.LogInfo((object)"[Godji] Ultiumate Health Packs Inited.");
harmony.PatchAll(typeof(UltimateHealthPacksMod));
harmony.PatchAll(typeof(ItemHealthPackPatch));
}
}
}
namespace UltimateHealthPacks.Patches
{
[HarmonyPatch(typeof(ItemHealthPack))]
internal class ItemHealthPackPatch
{
[HarmonyPatch("UsedRPC")]
[HarmonyPrefix]
private static bool UsedRPCPatch(ItemHealthPack __instance)
{
FieldInfo fieldInfo = AccessTools.Field(typeof(ItemHealthPack), "itemToggle");
FieldInfo fieldInfo2 = AccessTools.Field(typeof(ItemHealthPack), "used");
FieldInfo fieldInfo3 = AccessTools.Field(typeof(ItemToggle), "playerTogglePhotonID");
int num = (int)fieldInfo3.GetValue(fieldInfo.GetValue(__instance));
PhotonView component = ((Component)PlayerController.instance.playerAvatarScript).GetComponent<PhotonView>();
if (component.ViewID != num && !(bool)fieldInfo2.GetValue(__instance))
{
PlayerController.instance.playerAvatarScript.playerHealth.Heal(__instance.healAmount, true);
}
return true;
}
}
}