using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using LethalThings;
using UnityEngine;
using WeightlessUtils.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("WeightlessUtils")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WeightlessUtils")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3332E64E-5E33-4E1B-8CDB-87D33FC6653B")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace WeightlessUtils
{
[BepInPlugin("com.github.jhh0823.weightlessutils", "WeightlessUtils", "0.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class WeightlessUtilsBase : BaseUnityPlugin
{
private static WeightlessUtilsBase _instance;
private const string LethalThingsGuid = "evaisa.lethalthings";
private readonly Harmony _harmony = new Harmony("com.github.jhh0823.weightlessutils");
public static ManualLogSource LOG;
private async void Awake()
{
if ((Object)(object)_instance == (Object)null)
{
_instance = this;
}
LOG = Logger.CreateLogSource("com.github.jhh0823.weightlessutils");
PatchItems();
LOG.LogInfo((object)"WeightlessUtils has been loaded!");
}
private async void PatchItems()
{
_harmony.PatchAll(typeof(WeightlessUtilsBase));
_harmony.PatchAll(typeof(BaseUtilsWeightlessPatch));
if (LethalThingsInstalled())
{
LOG.LogInfo((object)"LethalThings is installed, patching PouchyBelt");
_harmony.PatchAll(typeof(LethalThingsWeightlessPatch));
}
}
private static bool LethalThingsInstalled()
{
return Chainloader.PluginInfos.ContainsKey("evaisa.lethalthings");
}
}
public static class PluginProperties
{
public const string GUID = "com.github.jhh0823.weightlessutils";
public const string NAME = "WeightlessUtils";
public const string VERSION = "0.0.1";
}
}
namespace WeightlessUtils.Patches
{
internal class BaseUtilsWeightlessPatch
{
[HarmonyPatch(typeof(GrabbableObject))]
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void PatchWeight(ref Item ___itemProperties)
{
if (isWeightlessItem(((Object)___itemProperties).name))
{
___itemProperties.weight = 0f;
}
}
private static bool isWeightlessItem(string name)
{
switch (name)
{
case "Boombox":
case "Jetpack":
case "Flashlight":
case "ProFlashlight":
return true;
default:
WeightlessUtilsBase.LOG.LogInfo((object)(name + " is not a weightless item"));
return false;
}
}
}
[HarmonyPatch(typeof(PouchyBelt))]
internal class LethalThingsWeightlessPatch
{
[HarmonyPatch("Awake")]
[HarmonyPostfix]
private static void PatchWeight(ref Item ___itemProperties)
{
___itemProperties.weight = 0f;
}
}
}