using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using YAPYAP;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("YapYapLostAndFoundMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("HP")]
[assembly: AssemblyProduct("YapYapLostAndFoundMod")]
[assembly: AssemblyCopyright("Copyright © HP 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4eb1cbbb-8df5-41c3-9737-6448f05f6cde")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace YapYapLostAndFoundMod;
[BepInPlugin("com.yourname.alwaysretrievelostitems", "Always Retrieve Lost Items", "1.1.0")]
public class AlwaysRetrieveMod : BaseUnityPlugin
{
public static ConfigEntry<float> ConfigRecoveryChance;
public static ConfigEntry<int> ConfigItemsPerPlayer;
private void Awake()
{
ConfigRecoveryChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RecoveryChance", 1f, "Probability (0.0 to 1.0) that an item is recovered.");
ConfigItemsPerPlayer = ((BaseUnityPlugin)this).Config.Bind<int>("General", "ItemsPerPlayerLimit", 999, "Maximum items recovered per non-extracted player. Set to 4 to match default inventory size, or 999 to recover everything.");
((BaseUnityPlugin)this).Logger.LogInfo((object)"AlwaysRetrieveLostItems with Config support loaded!");
Harmony.CreateAndPatchAll(typeof(AlwaysRetrieveMod), (string)null);
}
[HarmonyPatch(typeof(LostItemsTracker), "SvRecoverDroppedItemsToLobby")]
[HarmonyPrefix]
private static void Prefix(LostItemsTracker __instance)
{
Traverse.Create((object)__instance).Field("droppedItemsRecoveryChance").SetValue((object)ConfigRecoveryChance.Value);
Traverse.Create((object)__instance).Field("maxItemsRecoveryPercentage").SetValue((object)1f);
Traverse.Create((object)__instance).Field("maxItemsToRecoveryPerNonExtractedPlayer").SetValue((object)ConfigItemsPerPlayer.Value);
Debug.Log((object)$"[Mod] Recovery applied: Chance {ConfigRecoveryChance.Value}, PerPlayerLimit {ConfigItemsPerPlayer.Value}, TotalPercentage forced to 1.0");
}
}