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 HaldorPocketPrices v1.1.1
Cjayride.HaldorPocketPrices.dll
Decompiled 6 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")] [assembly: AssemblyCompany("Cjayride.HaldorPocketPrices")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.1.0")] [assembly: AssemblyInformationalVersion("1.1.1+a402e955c3d573717b16ca6b588a930c60dd3f4f")] [assembly: AssemblyProduct("Cjayride.HaldorPocketPrices")] [assembly: AssemblyTitle("Cjayride.HaldorPocketPrices")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Cjayride.HaldorPocketPrices { [BepInPlugin("cjayride.HaldorPocketPrices", "Haldor Pocket Prices", "1.1.1")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "cjayride.HaldorPocketPrices"; public const string PluginName = "Haldor Pocket Prices"; public const string PluginVersion = "1.1.1"; internal static ConfigEntry<bool> EnableWiderPockets; internal static ConfigEntry<bool> EnableDeeperPockets; internal static ConfigEntry<int> WiderPocketsPrice; internal static ConfigEntry<int> DeeperPocketsPrice; private void Awake() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) EnableWiderPockets = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableWiderPockets", true, "When false, Wider Pockets (first inventory row upgrade) is removed from trader buy lists."); EnableDeeperPockets = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableDeeperPockets", true, "When false, Deeper Pockets (second inventory row upgrade) is removed from trader buy lists."); WiderPocketsPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "WiderPockets", 10000, "Coin price for Wider Pockets (typically after Moder)."); DeeperPocketsPrice = ((BaseUnityPlugin)this).Config.Bind<int>("Prices", "DeeperPockets", 20000, "Coin price for Deeper Pockets (typically after The Queen)."); new Harmony("cjayride.HaldorPocketPrices").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)($"Haldor pockets: Wider enabled={EnableWiderPockets.Value} price={WiderPocketsPrice.Value}, " + $"Deeper enabled={EnableDeeperPockets.Value} price={DeeperPocketsPrice.Value}")); } } [HarmonyPatch(typeof(Trader), "GetAvailableItems")] internal static class ApplyPocketSettings { [HarmonyPostfix] [HarmonyPriority(0)] private static void Postfix(ref List<TradeItem> __result) { if (__result == null || __result.Count == 0) { return; } for (int num = __result.Count - 1; num >= 0; num--) { TradeItem val = __result[num]; if (IsPocketUpgrade(val)) { if (IsDeeperPockets(val)) { if (!Plugin.EnableDeeperPockets.Value) { __result.RemoveAt(num); } else { val.m_price = Plugin.DeeperPocketsPrice.Value; } } else if (!Plugin.EnableWiderPockets.Value) { __result.RemoveAt(num); } else { val.m_price = Plugin.WiderPocketsPrice.Value; } } } } private static bool IsDeeperPockets(TradeItem item) { if (item == null) { return false; } if (Has(item.m_requiredGlobalKey, "defeated_queen")) { return true; } if (!Has(item.m_name, "deeper")) { return Has(item.m_tooltip, "deeper"); } return true; } private static bool IsPocketUpgrade(TradeItem item) { if (item == null) { return false; } if (Has(item.m_name, "extrainvslot")) { return true; } if (Has(item.m_buyKey, "invrows") || Has(item.m_incrementKey, "invrows")) { return true; } if (Has(item.m_incrementKey, "invrows")) { return true; } return false; } private static bool Has(string value, string token) { if (!string.IsNullOrEmpty(value)) { return value.IndexOf(token.Trim(), StringComparison.OrdinalIgnoreCase) >= 0; } return false; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }