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;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Jaysmod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Jaysmod")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("134a86c2-bafd-433a-819b-7aadf7be8921")]
[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 SoftcoreDeath;
[BepInPlugin("softcoredeath", "Softcore Death", "1.0.0")]
public class SoftcoreDeathPlugin : BaseUnityPlugin
{
public const string ModId = "softcoredeath";
public const string Author = "dch";
public static int DropItemsDistance = 60;
private static ConfigDefinition DeathDistanceFromHomeThreshold = new ConfigDefinition("basic", "keepitems_enable_distance");
private void Awake()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
ConfigEntry<int> val = default(ConfigEntry<int>);
if (((BaseUnityPlugin)this).Config.TryGetEntry<int>(DeathDistanceFromHomeThreshold, ref val))
{
DropItemsDistance = val.Value;
}
else
{
((BaseUnityPlugin)this).Config.Bind<int>(DeathDistanceFromHomeThreshold, 250, (ConfigDescription)null);
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Hi from softcoredeath.");
new Harmony("dch.softcoredeath.harmony").PatchAll();
}
}
[HarmonyPatch(typeof(Player), "FixedUpdate")]
public static class PlayerUpdateHook
{
private static void Postfix(Player __instance)
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)Game.instance == (Object)null) && ((Character)__instance).IsOwner())
{
Vector3 customSpawnPoint = Game.instance.GetPlayerProfile().GetCustomSpawnPoint();
PlayerCreateTombStoneHook.Passthrough = Vector3.Distance(((Component)__instance).transform.position, customSpawnPoint) < (float)SoftcoreDeathPlugin.DropItemsDistance;
}
}
}
[HarmonyPatch(typeof(Player), "CreateTombStone")]
public static class PlayerCreateTombStoneHook
{
public static bool Passthrough;
private static bool Prefix(Player __instance)
{
return Passthrough;
}
}