using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("SellInShip")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("SellInShip")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("SellInShip")]
[assembly: AssemblyTitle("SellInShip")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace SellInShip
{
[BepInPlugin("viviko.SellInShip", "SellInShip", "1.0.1")]
public class SellInShip : BaseUnityPlugin
{
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerBPatch
{
[HarmonyPostfix]
[HarmonyPatch("ThrowObjectServerRpc")]
private static void ThrowObjectServerRpcPatch(ref NetworkObjectReference grabbedObject, bool droppedInElevator, bool droppedInShipRoom)
{
NetworkObject val = default(NetworkObject);
if (((NetworkObjectReference)(ref grabbedObject)).TryGet(ref val, (NetworkManager)null))
{
GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>();
if (!(component.__getTypeName() == "GiftBoxItem") && (Object)(object)component.playerHeldBy == (Object)null && component.itemProperties.isScrap && component.scrapValue > 0 && droppedInShipRoom)
{
HUDManager.Instance.DisplayGlobalNotification(component.itemProperties.itemName + " sold for " + component.scrapValue + " scrap");
Terminal terminalScript = HUDManager.Instance.terminalScript;
terminalScript.groupCredits += component.scrapValue;
EndOfGameStats gameStats = StartOfRound.Instance.gameStats;
gameStats.scrapValueCollected += component.scrapValue;
TimeOfDay instance = TimeOfDay.Instance;
instance.quotaFulfilled += component.scrapValue;
TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
((Component)component).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}
}
}
private const string modGUID = "viviko.SellInShip";
private const string modName = "SellInShip";
private const string modVersion = "1.0.1";
private readonly Harmony harmony = new Harmony("viviko.SellInShip");
private static SellInShip Instance;
internal ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("viviko.SellInShip");
harmony.PatchAll();
mls.LogInfo((object)"Plugin SellInShip is loaded!");
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SellInShip";
public const string PLUGIN_NAME = "SellInShip";
public const string PLUGIN_VERSION = "1.0.1";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}