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 ItemResistUpgrade v1.0.4
ItemResistUpgrade.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using MoreUpgrades.Classes; 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("CarefulUpgrade")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CarefulUpgrade")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7cb998b0-02aa-4eee-92fa-7ca8822e7a50")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ItemResistUpgrade { [BepInPlugin("sandwich.itemResistUpgrade", "ItemResistUpgrade", "1.0.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static Plugin instance; internal const string modGUID = "sandwich.itemResistUpgrade"; private const string modName = "ItemResistUpgrade"; private const string modVersion = "1.0.4"; internal static ConfigEntry<float> configPower; private readonly Harmony harmony = new Harmony("sandwich.itemResistUpgrade"); internal ManualLogSource mls; protected void Awake() { //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Expected O, but got Unknown if ((Object)(object)instance == (Object)null) { instance = this; } mls = Logger.CreateLogSource("ItemResistUpgrade"); string text = "Item Resist"; string value = ((BaseUnityPlugin)this).Config.Bind<string>("General", "Upgrade Name", text, "The name to use for the upgrade.").Value; configPower = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Item Resist Upgrade Power", 0.8f, "The multiplier of item resist per upgrade on an item (Lower is stronger)"); float value2 = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Minimum Price", 4000f, "The minimum base price of the upgrade.").Value; float value3 = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Maximum Price", 6000f, "The maximum base price of the upgrade.").Value; float value4 = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Price Scaling", 0.5f, "The amount the upgrade price increases by (multiplier of base value) per upgrade already purchased.").Value; int value5 = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Shop Amount Maximum", 2, "The maximum amount of times the upgrade can appear in the shop.").Value; string text2 = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemresistbundle"); AssetBundle val = AssetBundle.LoadFromFile(text2); Item val2 = val.LoadAsset<Item>(text); GameObject val3 = val.LoadAsset<GameObject>(text + " Prefab"); List<string> excludeConfigs = new List<string> { "Max Amount", "Max Amount In Shop", "Minimum Price", "Maximum Price", "Price Increase Scaling", "Max Purchase Amount", "Display Name" }; UpgradeItemBase val4 = new UpgradeItemBase { name = value, maxAmount = 1000, maxAmountInShop = value5, minPrice = value2, maxPrice = value3, maxPurchaseAmount = 0, priceIncreaseScaling = value4, excludeConfigs = excludeConfigs }; MoreUpgradesLib.Register("sandwich.itemResistUpgrade", val2, val3, val4); mls.LogInfo((object)"ItemResistUpgrade is loaded"); harmony.PatchAll(); } } } namespace ItemResistUpgrade.Patches { [HarmonyPatch(typeof(PhysGrabObjectImpactDetector))] internal class PhysGrabObjectImpactDetectorPatch { [HarmonyPatch("Break")] [HarmonyPrefix] private static void Break(PhysGrabObjectImpactDetector __instance, ref float valueLost) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Expected O, but got Unknown //IL_0106: Expected O, but got Unknown PhysGrabObject val = (PhysGrabObject)AccessTools.Field(typeof(PhysGrabObjectImpactDetector), "physGrabObject").GetValue(__instance); List<PhysGrabber> playerGrabbing = val.playerGrabbing; if (playerGrabbing != null && playerGrabbing.Count > 0) { List<string> list = playerGrabbing.Select((PhysGrabber player) => SemiFunc.PlayerGetSteamID(player.playerAvatar)).ToList(); IReadOnlyList<UpgradeItem> upgradeItemsByMod = MoreUpgradesLib.GetUpgradeItemsByMod("sandwich.itemResistUpgrade"); if (upgradeItemsByMod.Count <= 0) { return; } int num = 0; foreach (string item in list) { num += upgradeItemsByMod[0].GetAmount(item); } valueLost = ReduceValueLost(valueLost, num); return; } PlayerAvatar val2 = (PlayerAvatar)AccessTools.Field(typeof(PhysGrabObject), "lastPlayerGrabbing").GetValue(val); PlayerAvatar val3 = val2; if ((Object)val2 != (Object)null) { string text = SemiFunc.PlayerGetSteamID(val3); IReadOnlyList<UpgradeItem> upgradeItemsByMod2 = MoreUpgradesLib.GetUpgradeItemsByMod("sandwich.itemResistUpgrade"); int upgradeTotal = 0; if (upgradeItemsByMod2.Count > 0) { upgradeTotal = upgradeItemsByMod2[0].GetAmount(text); } valueLost = ReduceValueLost(valueLost, upgradeTotal); } } private static float ReduceValueLost(float valueLost, int upgradeTotal) { float num = (float)Math.Pow(Plugin.configPower.Value, upgradeTotal); return valueLost * num; } } }