Decompiled source of LethalGrocery v1.0.5

toastnghosts.dll

Decompiled 10 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using LethalLib.Modules;
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("toastnghosts")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("toastnghosts")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d0ae110e-6ecf-46da-b45a-a120272ba7ab")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ItemTutorial
{
	[BepInPlugin("malice.itemtutorial", "itemtutorial", "0.0.1")]
	public class groceries : BaseUnityPlugin
	{
		private const string GUID = "malice.itemtutorial";

		private const string Name = "itemtutorial";

		private const string Version = "0.0.1";

		private readonly Harmony harmony = new Harmony("malice.itemtutorial");

		public static groceries instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			instance = this;
			string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "itemmod");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Item val2 = val.LoadAsset<Item>("Assets/Rawchicken.asset");
			if ((Object)(object)val2 != (Object)null && (Object)(object)val2.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
				Utilities.FixMixerGroups(val2.spawnPrefab);
				Items.RegisterScrap(val2, 100, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to load Chicken or spawnPrefab is null.");
			}
			Item val3 = val.LoadAsset<Item>("Assets/BreadLoaf.asset");
			if ((Object)(object)val3 != (Object)null && (Object)(object)val3.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val3.spawnPrefab);
				Utilities.FixMixerGroups(val3.spawnPrefab);
				Items.RegisterScrap(val3, 100, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to load BreadLoaf or spawnPrefab is null.");
			}
			Item val4 = val.LoadAsset<Item>("Assets/Carrot.asset");
			if ((Object)(object)val4 != (Object)null && (Object)(object)val4.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val4.spawnPrefab);
				Utilities.FixMixerGroups(val4.spawnPrefab);
				Items.RegisterScrap(val4, 150, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Carrot or spawnPrefab is null.");
			}
			Item val5 = val.LoadAsset<Item>("Assets/RedApple.asset");
			if ((Object)(object)val5 != (Object)null && (Object)(object)val5.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val5.spawnPrefab);
				Utilities.FixMixerGroups(val5.spawnPrefab);
				Items.RegisterScrap(val5, 190, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to RedApple or spawnPrefab is null.");
			}
			Item val6 = val.LoadAsset<Item>("Assets/GreenApple.asset");
			if ((Object)(object)val6 != (Object)null && (Object)(object)val6.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val6.spawnPrefab);
				Utilities.FixMixerGroups(val6.spawnPrefab);
				Items.RegisterScrap(val6, 150, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to GreenApple or spawnPrefab is null.");
			}
			Item val7 = val.LoadAsset<Item>("Assets/Steak.asset");
			if ((Object)(object)val7 != (Object)null && (Object)(object)val7.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val7.spawnPrefab);
				Utilities.FixMixerGroups(val7.spawnPrefab);
				Items.RegisterScrap(val7, 60, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Steak or spawnPrefab is null.");
			}
			Item val8 = val.LoadAsset<Item>("Assets/SliceofBread.asset");
			if ((Object)(object)val8 != (Object)null && (Object)(object)val8.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val8.spawnPrefab);
				Utilities.FixMixerGroups(val8.spawnPrefab);
				Items.RegisterScrap(val8, 170, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to SliceofBread or spawnPrefab is null.");
			}
			Item val9 = val.LoadAsset<Item>("Assets/Cheese.asset");
			if ((Object)(object)val9 != (Object)null && (Object)(object)val9.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val9.spawnPrefab);
				Utilities.FixMixerGroups(val9.spawnPrefab);
				Items.RegisterScrap(val9, 50, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Cheese or spawnPrefab is null.");
			}
			Item val10 = val.LoadAsset<Item>("Assets/SliceofCheese.asset");
			if ((Object)(object)val10 != (Object)null && (Object)(object)val10.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val10.spawnPrefab);
				Utilities.FixMixerGroups(val10.spawnPrefab);
				Items.RegisterScrap(val10, 30, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to SliceofCheese or spawnPrefab is null.");
			}
			Item val11 = val.LoadAsset<Item>("Assets/Onion.asset");
			if ((Object)(object)val11 != (Object)null && (Object)(object)val11.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val11.spawnPrefab);
				Utilities.FixMixerGroups(val11.spawnPrefab);
				Items.RegisterScrap(val11, 30, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Onion or spawnPrefab is null.");
			}
			Item val12 = val.LoadAsset<Item>("Assets/Fish.asset");
			if ((Object)(object)val12 != (Object)null && (Object)(object)val12.spawnPrefab != (Object)null)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val12.spawnPrefab);
				Utilities.FixMixerGroups(val12.spawnPrefab);
				Items.RegisterScrap(val12, 40, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Fish or spawnPrefab is null.");
			}
			Item val13 = val.LoadAsset<Item>("Assets/Ham.asset");
			if ((Object)(object)val13 != (Object)null && (Object)(object)val13.spawnPrefab != (Object)(object)val13)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val13.spawnPrefab);
				Utilities.FixMixerGroups(val13.spawnPrefab);
				Items.RegisterScrap(val13, 70, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Ham or spawnPrefab is null.");
			}
			Item val14 = val.LoadAsset<Item>("Assets/Hamshank.asset");
			if ((Object)(object)val14 != (Object)null && (Object)(object)val14.spawnPrefab != (Object)(object)val14)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val14.spawnPrefab);
				OccludeAudio val15 = val14.spawnPrefab.AddComponent<OccludeAudio>();
				val15.lowPassOverride = 20000f;
				Utilities.FixMixerGroups(val14.spawnPrefab);
				Items.RegisterScrap(val14, 70, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Ham or spawnPrefab is null.");
			}
			Item val16 = val.LoadAsset<Item>("Assets/mag.asset");
			if ((Object)(object)val16 != (Object)null && (Object)(object)val16.spawnPrefab != (Object)(object)val16)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val16.spawnPrefab);
				OccludeAudio val17 = val16.spawnPrefab.AddComponent<OccludeAudio>();
				val17.lowPassOverride = 20000f;
				Utilities.FixMixerGroups(val16.spawnPrefab);
				Items.RegisterScrap(val16, 70, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Ham or spawnPrefab is null.");
			}
			Item val18 = val.LoadAsset<Item>("Assets/tommygun.asset");
			if ((Object)(object)val18 != (Object)null && (Object)(object)val18.spawnPrefab != (Object)(object)val18)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val18.spawnPrefab);
				OccludeAudio val19 = val18.spawnPrefab.AddComponent<OccludeAudio>();
				val19.lowPassOverride = 20000f;
				Utilities.FixMixerGroups(val18.spawnPrefab);
				Items.RegisterScrap(val18, 70, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Ham or spawnPrefab is null.");
			}
			Item val20 = val.LoadAsset<Item>("Assets/fettpack.asset");
			if ((Object)(object)val20 != (Object)null && (Object)(object)val20.spawnPrefab != (Object)(object)val20)
			{
				NetworkPrefabs.RegisterNetworkPrefab(val20.spawnPrefab);
				OccludeAudio val21 = val20.spawnPrefab.AddComponent<OccludeAudio>();
				val21.lowPassOverride = 20000f;
				Utilities.FixMixerGroups(val20.spawnPrefab);
				Items.RegisterScrap(val20, 70, (LevelTypes)(-1));
			}
			else
			{
				Debug.LogError((object)"Failed to Ham or spawnPrefab is null.");
			}
			TerminalNode val22 = ScriptableObject.CreateInstance<TerminalNode>();
			val22.clearPreviousText = true;
			val22.displayText = "Its a battle ham you buyin or what\n\n";
			Items.RegisterShopItem(val14, (TerminalNode)null, (TerminalNode)null, val22, 120);
			TerminalNode val23 = ScriptableObject.CreateInstance<TerminalNode>();
			val23.clearPreviousText = true;
			val23.displayText = "Its a battle ham you buyin or what\n\n";
			Items.RegisterShopItem(val18, (TerminalNode)null, (TerminalNode)null, val23, 0);
			TerminalNode val24 = ScriptableObject.CreateInstance<TerminalNode>();
			val24.clearPreviousText = true;
			val24.displayText = "Its a battle ham you buyin or what\n\n";
			Items.RegisterShopItem(val16, (TerminalNode)null, (TerminalNode)null, val24, 0);
			TerminalNode val25 = ScriptableObject.CreateInstance<TerminalNode>();
			val25.clearPreviousText = true;
			val25.displayText = "Its a battle ham you buyin or what\n\n";
			Items.RegisterShopItem(val20, (TerminalNode)null, (TerminalNode)null, val25, 0);
			mls = Logger.CreateLogSource("malice.itemtutorial");
			mls.LogInfo((object)"Patched Item Tutorial");
			harmony.PatchAll(typeof(groceries));
			harmony.PatchAll(typeof(ShotgunItem));
		}
	}
}
namespace toastnghosts.patches
{
	[HarmonyPatch(typeof(ShotgunItem))]
	internal class Patchshottygun
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void extrashots(ref float ___shellsLoaded)
		{
			___shellsLoaded = 99f;
		}
	}
}
namespace toastnghosts.behaviors
{
	internal class Damageplayer : Shovel
	{
		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((Shovel)this).ItemActivate(used, buttonDown);
			if (buttonDown)
			{
				((GrabbableObject)this).playerHeldBy.ClickHoldInteraction();
			}
		}
	}
}