using System.Diagnostics; 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("RepoDiscountMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("RepoDiscountMod")] [assembly: AssemblyCopyright("Copyright © 2026")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("1828326a-73a1-4301-89ee-1f74fa0da660")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [BepInPlugin("RepoDiscountMod", "Repo Discount Mod", "1.0.11")] public class RepoDiscountMod : BaseUnityPlugin { public static ManualLogSource Log; public static ConfigEntry DiscountPercent; private void Awake() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; DiscountPercent = ((BaseUnityPlugin)this).Config.Bind("Discount", "DiscountPercent", 70, "Pourcentage de remise appliqué aux objets du shop. 70 = -70%."); Harmony val = new Harmony("RepoDiscountMod"); val.PatchAll(); Log.LogInfo((object)("[RepoDiscountMod] V11 loaded. Discount: " + DiscountPercent.Value + "%")); } } [HarmonyPatch(typeof(ItemAttributes), "GetValue")] public static class ItemAttributes_GetValue_Patch { private static readonly FieldInfo ValueField = AccessTools.Field(typeof(ItemAttributes), "value"); private static void Postfix(ItemAttributes __instance) { if (!((Object)(object)__instance == (Object)null) && !(ValueField == null) && SemiFunc.RunIsShop() && SemiFunc.IsMasterClientOrSingleplayer()) { int num = (int)ValueField.GetValue(__instance); if (num > 0) { float num2 = Mathf.Clamp01(1f - (float)RepoDiscountMod.DiscountPercent.Value / 100f); int num3 = Mathf.Max(1, Mathf.RoundToInt((float)num * num2)); ValueField.SetValue(__instance, num3); } } } }