Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of TeamHealthPacks v1.0.1
TeamHealthPacks.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Photon.Pun; using TeamHealthPacks.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("TeamHealthPacks")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("TeamHealthPacks")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("a73a5899-1115-4e8c-97bf-c6305900b678")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] public enum HealType { FullHeal, PackHeal, EvenlyHeal } public static class Log { public static ManualLogSource _logSource; static Log() { _logSource = Logger.CreateLogSource("Team Health Packs"); } public static void LogInfo(object data) { _logSource.LogInfo(data); } public static void LogWarning(object data) { _logSource.LogWarning(data); } public static void LogError(object data) { _logSource.LogError(data); } public static void LogDebug(object data) { _logSource.LogDebug(data); } public static void LogFatal(object data) { _logSource.LogFatal(data); } public static void LogMessage(object data) { _logSource.LogMessage(data); } } namespace TeamHealthPacks { [BepInPlugin("upgame.REPO.TeamHealthPacks", "Team Health Packs", "1.0.0")] public class PluginBase : BaseUnityPlugin { public const string PluginGUID = "upgame.REPO.TeamHealthPacks"; public const string PluginName = "Team Health Packs"; public const string PluginVersion = "1.0.0"; private readonly Harmony _harmony = new Harmony("upgame.REPO.TeamHealthPacks"); private static PluginBase Instance; private ConfigEntry<bool> _enable; private ConfigEntry<HealType> _healType; private ConfigEntry<int> _reviveHealth; private ConfigEntry<int> _truckHealth; private AcceptableValueRange<int> reviveHealthRange = new AcceptableValueRange<int>(1, 100); private AcceptableValueRange<int> truckHealthRange = new AcceptableValueRange<int>(1, 100); public Dictionary<HealType, string> HealTypeDesc = new Dictionary<HealType, string> { { HealType.FullHeal, "回复满血" }, { HealType.PackHeal, "回复医疗包的治愈量" }, { HealType.EvenlyHeal, "全员平分医疗包的治愈量" } }; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown if ((Object)Instance == (Object)null) { Instance = this; } Log.LogInfo("<R.E.P.O.医疗包>加载成功! Successfully loaded plugin: upgame.REPO.TeamHealthPacks!"); _enable = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enable", true, "True is set the healing pack to heal team when used."); _healType = ((BaseUnityPlugin)this).Config.Bind<HealType>("General", "Healing Type", HealType.FullHeal, "Select the type of healing for the health pack. (Optional values: " + string.Join(", ", Enum.GetNames(typeof(HealType))) + ")"); _reviveHealth = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Revive Health", 20, new ConfigDescription("Set the players' health upon revival.", (AcceptableValueBase)(object)reviveHealthRange, Array.Empty<object>())); _reviveHealth.Value = Mathf.Clamp(_reviveHealth.Value, 1, 100); _truckHealth = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Truck Health", 50, new ConfigDescription("Set the amount of health restored when the player returns to the truck.", (AcceptableValueBase)(object)truckHealthRange, Array.Empty<object>())); _truckHealth.Value = Mathf.Clamp(_truckHealth.Value, 1, 100); _harmony.PatchAll(typeof(PluginBase)); _harmony.PatchAll(typeof(ItemHealthPack_OnDestroy_Patch)); _harmony.PatchAll(typeof(PlayerAvatar_ReviveRPC_Patch)); _harmony.PatchAll(typeof(PlayerAvatar_FinalHealRPC_Patch)); Log.LogInfo((_enable.Value ? ("已启用团队医疗包!治愈方式:" + HealTypeDesc[_healType.Value]) : "已禁用团队医疗包。") ?? ""); } public static bool GetEnable() { return Instance._enable.Value; } public static HealType GetHealType() { return Instance._healType.Value; } public static int GetReviveHealth() { return Instance._reviveHealth.Value; } public static int GetTruckHealth() { return Instance._truckHealth.Value; } } } namespace TeamHealthPacks.Patches { [HarmonyPatch(typeof(ItemHealthPack), "OnDestroy")] public class ItemHealthPack_OnDestroy_Patch { private static readonly FieldRef<PlayerHealth, int> _getMaxHealth; static ItemHealthPack_OnDestroy_Patch() { FieldInfo field = typeof(PlayerHealth).GetField("maxHealth", BindingFlags.Instance | BindingFlags.NonPublic); _getMaxHealth = AccessTools.FieldRefAccess<PlayerHealth, int>(field); } public static void Prefix(ItemHealthPack __instance) { } public static void Postfix(ItemHealthPack __instance) { if (!PluginBase.GetEnable()) { return; } int num = PluginBase.GetHealType() switch { HealType.FullHeal => -101, HealType.PackHeal => __instance.healAmount, HealType.EvenlyHeal => (int)Mathf.Ceil((float)(__instance.healAmount / GameDirector.instance.PlayerList.Count)), _ => 0, }; List<PlayerAvatar> playerList = GameDirector.instance.PlayerList; foreach (PlayerAvatar item in playerList) { if (num == -101) { num = _getMaxHealth.Invoke(item.playerHealth); } item.playerHealth.HealOther(num, true); } } } [HarmonyPatch(typeof(PlayerAvatar), "ReviveRPC")] public class PlayerAvatar_ReviveRPC_Patch { private static readonly FieldRef<PlayerHealth, int> _getMaxHealth; static PlayerAvatar_ReviveRPC_Patch() { FieldInfo field = typeof(PlayerHealth).GetField("maxHealth", BindingFlags.Instance | BindingFlags.NonPublic); _getMaxHealth = AccessTools.FieldRefAccess<PlayerHealth, int>(field); } public static void Prefix(PlayerAvatar __instance) { } public static void Postfix(PlayerAvatar __instance, string ___steamID, PhotonView ___photonView) { StatsManager.instance.SetPlayerHealth(___steamID, PluginBase.GetReviveHealth(), false); if (GameManager.Multiplayer()) { ___photonView.RPC("UpdateHealthRPC", (RpcTarget)1, new object[3] { PluginBase.GetReviveHealth(), _getMaxHealth.Invoke(__instance.playerHealth), true }); } } } [HarmonyPatch(typeof(PlayerAvatar), "FinalHealRPC")] public class PlayerAvatar_FinalHealRPC_Patch { private static readonly FieldRef<PlayerHealth, int> _getMaxHealth; static PlayerAvatar_FinalHealRPC_Patch() { FieldInfo field = typeof(PlayerHealth).GetField("maxHealth", BindingFlags.Instance | BindingFlags.NonPublic); _getMaxHealth = AccessTools.FieldRefAccess<PlayerHealth, int>(field); } public static bool Prefix(PlayerAvatar __instance, ref bool ___finalHeal, bool ___isLocal, string ___playerName) { //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (___finalHeal) { return false; } if (___isLocal) { int truckHealth = PluginBase.GetTruckHealth(); __instance.playerHealth.EyeMaterialOverride((EyeOverrideState)2, 2f, 1); TruckScreenText.instance.MessageSendCustom("", ___playerName + " {arrowright}{truck}{check}\n {point}{shades}{pointright}<b><color=#00FF00>+" + truckHealth + "</color></b>{heart}", 0); __instance.playerHealth.Heal(truckHealth, true); } TruckHealer.instance.Heal(__instance); __instance.truckReturn.Play(__instance.PlayerVisionTarget.VisionTransform.position, 1f, 1f, 1f, 1f); __instance.truckReturnGlobal.Play(__instance.PlayerVisionTarget.VisionTransform.position, 1f, 1f, 1f, 1f); ((Component)__instance.playerAvatarVisuals.effectGetIntoTruck).gameObject.SetActive(true); ___finalHeal = true; return false; } public static void Postfix(PlayerAvatar __instance, string ___steamID, PhotonView ___photonView) { } } }