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 PlayerArmorPack v1.0.0
PlayerArmorPack.dll
Decompiled a year agousing System; 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 PlayerArmorPack.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("PlayerArmorPack")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("PlayerArmorPack")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("0acbd2dc-ef98-4b3c-b0db-943fc06facc8")] [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 static class Log { public static ManualLogSource _logSource; static Log() { _logSource = Logger.CreateLogSource("Player Armor Pack"); } 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 PlayerArmorPack { [BepInPlugin("upgame.REPO.PlayerArmorPack", "Player Armor Pack", "1.0.0")] public class PluginBase : BaseUnityPlugin { public const string PluginGUID = "upgame.REPO.PlayerArmorPack"; public const string PluginName = "Player Armor Pack"; public const string PluginVersion = "1.0.0"; private readonly Harmony _harmony = new Harmony("upgame.REPO.PlayerArmorPack"); private static PluginBase Instance; private ConfigEntry<bool> _armorEnable; private void Awake() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown if ((Object)Instance == (Object)null) { Instance = this; } Log.LogInfo("<减伤护甲包>加载成功! Successfully loaded plugin: upgame.REPO.PlayerArmorPack!"); _armorEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("ArmorPack", "Enable", true, "True is set to enable reduce damage."); _harmony.PatchAll(typeof(PluginBase)); _harmony.PatchAll(typeof(HurtCollider_PlayerHurt_Patch)); Log.LogInfo((_armorEnable.Value ? "已启用减伤护甲包!基础减伤5%" : "已禁用减伤护甲包") ?? ""); } public static bool GetEnable() { return Instance._armorEnable.Value; } } } namespace PlayerArmorPack.Patches { [HarmonyPatch(typeof(HurtCollider), "PlayerHurt")] internal class HurtCollider_PlayerHurt_Patch { private static readonly FieldRef<PlayerAvatar, string> _getSteamID; private static readonly FieldRef<PlayerAvatar, string> _getPlayerName; private static readonly float _armorUpper; private static readonly float _armorRatio; static HurtCollider_PlayerHurt_Patch() { _armorUpper = 0.6f; _armorRatio = 0.5f; FieldInfo field = typeof(PlayerAvatar).GetField("steamID", BindingFlags.Instance | BindingFlags.NonPublic); _getSteamID = AccessTools.FieldRefAccess<PlayerAvatar, string>(field); FieldInfo field2 = typeof(PlayerAvatar).GetField("playerName", BindingFlags.Instance | BindingFlags.NonPublic); _getPlayerName = AccessTools.FieldRefAccess<PlayerAvatar, string>(field2); } private static void Prefix(HurtCollider __instance, PlayerAvatar _player, bool ___playerKill, ref int ___playerDamage, out int __state) { __state = ___playerDamage; if ((!GameManager.Multiplayer() || _player.photonView.IsMine) && !(!PluginBase.GetEnable() || ___playerKill) && !__instance.playerKill && ___playerDamage != 0) { string text = _getPlayerName.Invoke(PlayerAvatar.instance); int num = StatsManager.instance.playerUpgradeStrength[_getSteamID.Invoke(PlayerAvatar.instance)]; float num2 = ((num != 0) ? ((float)((double)_armorUpper * (1.0 - Math.Exp((0f - _armorRatio) * (float)Mathf.Max(10, num))))) : 0.05f); int num3 = Mathf.CeilToInt((float)___playerDamage * num2); ___playerDamage -= num3; } } private static void Postfix(int __state, ref int ___playerDamage) { ___playerDamage = __state; } } }