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("Sturdier Valuables")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Sturdier Valuables")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("93372c08-3779-4652-9afa-6cf35a9582f5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SturdierValuables
{
[BepInPlugin("sandwich.sturdierValuables", "SturdierValuables", "1.0.2")]
public class Plugin : BaseUnityPlugin
{
internal static Plugin instance;
private const string modGUID = "sandwich.sturdierValuables";
private const string modName = "SturdierValuables";
private const string modVersion = "1.0.2";
internal static ConfigEntry<float> configMultiplier;
internal static ConfigEntry<bool> configEnabled;
private readonly Harmony harmony = new Harmony("sandwich.sturdierValuables");
internal ManualLogSource mls;
protected void Awake()
{
if ((Object)(object)instance == (Object)null)
{
instance = this;
}
mls = Logger.CreateLogSource("SturdierValuables");
configEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Use to enable the damage reduction");
configMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Damage Reduction Multiplier", 0.5f, "The multiplier of how much value is deducted from a hit (lower is better)");
mls.LogInfo((object)"SturdierValuables is loaded");
harmony.PatchAll();
}
}
}
namespace SturdierValuables.Patches
{
[HarmonyPatch(typeof(PhysGrabObjectImpactDetector))]
internal class PhysGrabObjectImpactDetectorPatch
{
[HarmonyPatch("Break")]
[HarmonyPrefix]
private static void Break(ref float valueLost)
{
if (Plugin.configEnabled.Value)
{
float value = Plugin.configMultiplier.Value;
float num = valueLost * value;
valueLost = num;
}
}
}
}