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 ArmorModifier v1.0.2
ArmorModifier.dll
Decompiled 2 months agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn; using Jotunn.Utils; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("ArmorModifier")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Main Street Gaming")] [assembly: AssemblyProduct("Armor Modifier")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("e3243d22-4307-4008-ba36-9f326008cde5")] [assembly: AssemblyFileVersion("1.0.2")] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] namespace ArmorModifier; [BepInPlugin("MainStreetGaming.ArmorModifier", "ArmorModifier", "1.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] internal class ArmorModifier : BaseUnityPlugin { [HarmonyPatch(typeof(ItemData), "GetArmor", new Type[] { typeof(int), typeof(float) })] public class ArmorValueModifierPatch { public static bool Prefix(ref ItemData __instance, ref int quality, ref float __result) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Invalid comparison between Unknown and I4 //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 float num = (__result = __instance.m_shared.m_armor + (float)Mathf.Max(0, quality - 1) * __instance.m_shared.m_armorPerLevel); ItemType itemType = __instance.m_shared.m_itemType; if ((int)itemType <= 7) { if ((int)itemType != 6) { if ((int)itemType == 7) { num = ModUtils.ApplyModifier(num, _chestModifier.Value); } } else { num = ModUtils.ApplyModifier(num, _helmetModifier.Value); } } else if ((int)itemType != 11) { if ((int)itemType == 17) { num = ModUtils.ApplyModifier(num, _capeModifier.Value); } } else { num = ModUtils.ApplyModifier(num, _legModifier.Value); } if (num != __result) { __result = num; } return false; } } public static class ModUtils { public static float ApplyModifier(float targetValue, float modifier) { modifier = Mathf.Max(modifier, -100f); float num = targetValue; if (modifier >= 0f) { return num + targetValue * (modifier / 100f); } return num - targetValue * (modifier / -100f); } } public const string PluginGUID = "MainStreetGaming.ArmorModifier"; public const string PluginName = "ArmorModifier"; public const string PluginVersion = "1.0.1"; public static ConfigEntry<float> _helmetModifier; public static ConfigEntry<float> _chestModifier; public static ConfigEntry<float> _legModifier; public static ConfigEntry<float> _capeModifier; private void Awake() { Logger.LogInfo((object)"Thanks for using ArmorModifier by MainStreet Gaming!"); CreateConfigValues(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } private void CreateConfigValues() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown ConfigurationManagerAttributes val = new ConfigurationManagerAttributes { IsAdminOnly = true }; _helmetModifier = ((BaseUnityPlugin)this).Config.Bind<float>("ArmorModifiers", "HelmetModifier", 0f, new ConfigDescription("Percentage modifier for helmet armor (negative values decrease armor, positive values increase armor)", (AcceptableValueBase)null, new object[1] { val })); _chestModifier = ((BaseUnityPlugin)this).Config.Bind<float>("ArmorModifiers", "ChestModifier", 0f, new ConfigDescription("Percentage modifier for chest armor (negative values decrease armor, positive values increase armor)", (AcceptableValueBase)null, new object[1] { val })); _legModifier = ((BaseUnityPlugin)this).Config.Bind<float>("ArmorModifiers", "LegModifier", 0f, new ConfigDescription("Percentage modifier for leg armor (negative values decrease armor, positive values increase armor)", (AcceptableValueBase)null, new object[1] { val })); _capeModifier = ((BaseUnityPlugin)this).Config.Bind<float>("ArmorModifiers", "CapeModifier", 0f, new ConfigDescription("Percentage modifier for cape armor (negative values decrease armor, positive values increase armor)", (AcceptableValueBase)null, new object[1] { val })); } }