Decompiled source of Teliots Paper Rolls Are The Best v1.0.5

TeliotsPaperRollsLethalCompanyMod.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Unity.Netcode;
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("TeliotsPaperRollsLethalCompanyMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TeliotsPaperRollsLethalCompanyMod")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("f5f77c01-780a-4165-819c-8ea229fd4190")]
[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 TeliotsPaperRollsLethalCompanyMod;

[HarmonyPatch(typeof(DepositItemsDesk))]
internal class DepositItemsDeskPatch
{
	private static ManualLogSource logger = Logger.CreateLogSource("B0BTR0N.teliots_saver");

	[HarmonyPatch("AddObjectToDeskClientRpc")]
	[HarmonyPostfix]
	private static void dontSellTeliots(DepositItemsDesk __instance)
	{
		if (((NetworkBehaviour)RoundManager.Instance).IsHost)
		{
			logger.LogInfo((object)"Player is host, continuing check");
			foreach (GrabbableObject item in __instance.itemsOnCounter)
			{
				string text = ((Object)item).name.ToLower();
				logger.LogInfo((object)(text ?? ""));
				if (text.Contains("toilet") || text.Contains("paper") || text.Contains("rolls"))
				{
					logger.LogInfo((object)"Attempting to sell Teliot's Paper Rolls, oopsies");
					Object.FindAnyObjectByType<DepositItemsDesk>().AttackPlayersServerRpc();
					Object.FindAnyObjectByType<DepositItemsDesk>().AttackPlayersClientRpc();
					__instance.AttackPlayersServerRpc();
				}
			}
		}
		logger.LogInfo((object)"Player is not host, skipping");
	}
}
[BepInPlugin("B0BTR0N.teliots_saver", "Teliots Paper Roll Saver", "1.0.2")]
public class ModBase : BaseUnityPlugin
{
	private const string modGUID = "B0BTR0N.teliots_saver";

	private const string modName = "Teliots Paper Roll Saver";

	private const string modVersion = "1.0.2";

	internal ManualLogSource logger;

	private void Awake()
	{
		logger = Logger.CreateLogSource("B0BTR0N.teliots_saver");
		logger.LogInfo((object)"Loading Teliots Paper Roll Saver");
		Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
	}
}