Decompiled source of ChefBazaar v1.5.1

ChefBazaar.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
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.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using On.RoR2;
using R2API;
using R2API.Networking;
using R2API.Networking.Interfaces;
using RiskOfOptions;
using RiskOfOptions.OptionConfigs;
using RiskOfOptions.Options;
using RoR2;
using RoR2.ExpansionManagement;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
using UnityEngine.Networking;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ChefBazaar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+a02cd713077f8ca26c042710d97428b10d0a95f4")]
[assembly: AssemblyProduct("ChefBazaar")]
[assembly: AssemblyTitle("ChefBazaar")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ChefBazaar
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("acanthi.ChefBazaar", "ChefBazaar", "1.4.1")]
	public class ChefBazaar : BaseUnityPlugin
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_OnInteractionBegin <0>__PickupPickerController_OnInteractionBegin;

			public static hook_BeginCookingServer <1>__MealPrepController_BeginCookingServer;

			public static Action<Stage> <2>__Stage_onStageStartGlobal;
		}

		public const string PluginGUID = "acanthi.ChefBazaar";

		public const string PluginAuthor = "acanthi";

		public const string PluginName = "ChefBazaar";

		public const string PluginVersion = "1.4.1";

		public static List<string> chefPhrases;

		public static List<string> chefEscapePhrases;

		public static ConfigEntry<float> chefChance;

		public static ConfigEntry<bool> spawnScrapper;

		public static ConfigEntry<int> maxUsedTimes;

		public static ConfigEntry<bool> moonChef;

		public static ConfigEntry<bool> moonHooks;

		public static ConfigEntry<bool> classicChef;

		public static ConfigEntry<bool> guaranteedAfterSolusEvent;

		public static ConfigEntry<bool> allowedAfterSolusEvent;

		public static ExpansionDef expansionNeeded;

		public static bool isMoonFuckening = false;

		public static bool isChefInBazaar = false;

		public static Dictionary<PlayerCharacterMasterController, int> usedTimes = new Dictionary<PlayerCharacterMasterController, int>();

		public void Awake()
		{
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0148: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Expected O, but got Unknown
			Log.Init(((BaseUnityPlugin)this).Logger);
			InitConfig();
			SpawnTools.CreateTablePrefab();
			NetworkingAPI.RegisterMessageType<NetMessages.RequestChefMessage>();
			NetworkingAPI.RegisterMessageType<NetMessages.SpawnChefTableMessage>();
			LanguageAPI.Add("CHEFBAZAAR_IAMHERE_1", "I come and I go, but today I am here.");
			LanguageAPI.Add("CHEFBAZAAR_IAMHERE_2", "Come, mon ami, we shall cook!");
			LanguageAPI.Add("CHEFBAZAAR_IAMHERE_3", "Tired, mon ami? Surely a meal will help.");
			LanguageAPI.Add("CHEFBAZAAR_IAMHERE_4", "It is okay to take a break every once in a while. Come now.");
			LanguageAPI.Add("CHEFBAZAAR_IAMHERE_5", "Mon Chéri! How wonderful it is to see you here.");
			chefPhrases = new List<string>(5) { "CHEFBAZAAR_IAMHERE_1", "CHEFBAZAAR_IAMHERE_2", "CHEFBAZAAR_IAMHERE_3", "CHEFBAZAAR_IAMHERE_4", "CHEFBAZAAR_IAMHERE_5" };
			chefEscapePhrases = new List<string>(3) { "MEALPREP_DIALOGUE_MOONDETONATION_1", "MEALPREP_DIALOGUE_MOONDETONATION_2", "MEALPREP_DIALOGUE_MOONDETONATION_3" };
			if (spawnScrapper.Value)
			{
				LanguageAPI.Add("CHEFBAZAAR_IAMHERE_SCRAPPER", "Please, do not use the scrapper as a garbage bin.");
				chefPhrases.Add("CHEFBAZAAR_IAMHERE_SCRAPPER");
			}
			expansionNeeded = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC3/DLC3.asset").WaitForCompletion();
			object obj = <>O.<0>__PickupPickerController_OnInteractionBegin;
			if (obj == null)
			{
				hook_OnInteractionBegin val = Hooks.PickupPickerController_OnInteractionBegin;
				<>O.<0>__PickupPickerController_OnInteractionBegin = val;
				obj = (object)val;
			}
			PickupPickerController.OnInteractionBegin += (hook_OnInteractionBegin)obj;
			object obj2 = <>O.<1>__MealPrepController_BeginCookingServer;
			if (obj2 == null)
			{
				hook_BeginCookingServer val2 = Hooks.MealPrepController_BeginCookingServer;
				<>O.<1>__MealPrepController_BeginCookingServer = val2;
				obj2 = (object)val2;
			}
			MealPrepController.BeginCookingServer += (hook_BeginCookingServer)obj2;
			Stage.onStageStartGlobal += Hooks.Stage_onStageStartGlobal;
		}

		private void InitConfig()
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0133: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_0164: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Expected O, but got Unknown
			//IL_0174: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Expected O, but got Unknown
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Expected O, but got Unknown
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Expected O, but got Unknown
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b2: Expected O, but got Unknown
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Expected O, but got Unknown
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Expected O, but got Unknown
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e2: Expected O, but got Unknown
			chefChance = ((BaseUnityPlugin)this).Config.Bind<float>("ChefBazaar", "Wandering CHEF Chance", 35f, new ConfigDescription("How likely is the Wandering CHEF to appear in the Bazaar?", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
			guaranteedAfterSolusEvent = ((BaseUnityPlugin)this).Config.Bind<bool>("ChefBazaar", "Guaranteed After Solus Event", false, "Guarantees Wandering CHEF spawns in the Bazaar after the Solus Event.");
			allowedAfterSolusEvent = ((BaseUnityPlugin)this).Config.Bind<bool>("ChefBazaar", "Only Allowed After Solus Event", false, "Only allows Wandering CHEF spawns in the Bazaar or moon after the Solus Event.");
			spawnScrapper = ((BaseUnityPlugin)this).Config.Bind<bool>("ChefBazaar", "Spawn Scrapper", false, "Spawn a Scrapper next to the Wandering CHEF?");
			maxUsedTimes = ((BaseUnityPlugin)this).Config.Bind<int>("ChefBazaar", "Crafting Limit", 0, "How many times can the Wandering CHEF cook for you in the Bazaar? (0 = Infinite)");
			moonChef = ((BaseUnityPlugin)this).Config.Bind<bool>("Extras", "Moon CHEF", false, "Re-enables the unused Wandering CHEF on Commencement. Guaranteed.");
			moonHooks = ((BaseUnityPlugin)this).Config.Bind<bool>("Extras", "Moon Hooks", false, "Enable the Wandering CHEF shooing you away during moon detonation for mods that add the Wandering CHEF to the moon.");
			classicChef = ((BaseUnityPlugin)this).Config.Bind<bool>("Extras", "Classic Location", false, "Re-enables the pre-rework location for the Wandering CHEF! (Next to the lunar item table.)");
			ModSettingsManager.SetModDescription("Chance for the Wandering CHEF to appear in the Bazaar!");
			ModSettingsManager.AddOption((BaseOption)new StepSliderOption(chefChance, new StepSliderConfig
			{
				min = 0f,
				max = 100f,
				increment = 0.5f
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(guaranteedAfterSolusEvent));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(allowedAfterSolusEvent));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(spawnScrapper));
			ModSettingsManager.AddOption((BaseOption)new IntSliderOption(maxUsedTimes, new IntSliderConfig
			{
				min = 0,
				max = 100
			}));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(moonChef));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(moonHooks));
			ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(classicChef));
		}
	}
	public class Hooks
	{
		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__3_0;

			public static UnityAction <>9__3_1;

			public static UnityAction <>9__3_2;

			internal void <MoonHooksInit>b__3_0()
			{
				ChefBazaar.isMoonFuckening = true;
			}

			internal void <MoonHooksInit>b__3_1()
			{
				ChefBazaar.isMoonFuckening = false;
			}

			internal void <MoonHooksInit>b__3_2()
			{
				ChefBazaar.isMoonFuckening = false;
			}
		}

		public static void MealPrepController_BeginCookingServer(orig_BeginCookingServer orig, MealPrepController self, Interactor activator, PickupIndex[] itemsToTake, PickupIndex reward, int count)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			PlayerCharacterMasterController component = ((Component)((Component)activator).GetComponent<CharacterBody>().master).GetComponent<PlayerCharacterMasterController>();
			ChefBazaar.usedTimes[component] = ChefBazaar.usedTimes.GetValueOrDefault(component) + 1;
			orig.Invoke(self, activator, itemsToTake, reward, count);
		}

		public static void PickupPickerController_OnInteractionBegin(orig_OnInteractionBegin orig, PickupPickerController self, Interactor activator)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			if (!Object.op_Implicit((Object)(object)((Component)self).GetComponent<MealPrepController>()))
			{
				orig.Invoke(self, activator);
				return;
			}
			if (ChefBazaar.isMoonFuckening)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new NpcChatMessage
				{
					formatStringToken = "MEALPREP_DIALOGUE_FORMAT",
					baseToken = ChefBazaar.chefEscapePhrases[Random.Range(0, ChefBazaar.chefEscapePhrases.Count)],
					sender = null
				});
				return;
			}
			Scene activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name != "bazaar")
			{
				orig.Invoke(self, activator);
				return;
			}
			PlayerCharacterMasterController component = ((Component)((Component)activator).GetComponent<CharacterBody>().master).GetComponent<PlayerCharacterMasterController>();
			if (Object.op_Implicit((Object)(object)component) && ChefBazaar.usedTimes.GetValueOrDefault(component) >= ChefBazaar.maxUsedTimes.Value && ChefBazaar.maxUsedTimes.Value > 0)
			{
				Chat.SendBroadcastChat((ChatMessageBase)new NpcChatMessage
				{
					formatStringToken = "MEALPREP_DIALOGUE_FORMAT",
					baseToken = ChefBazaar.chefEscapePhrases[Random.Range(0, ChefBazaar.chefEscapePhrases.Count)],
					sender = null
				});
			}
			else
			{
				orig.Invoke(self, activator);
			}
		}

		public static void Stage_onStageStartGlobal(Stage stage)
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			if (NetworkServer.active)
			{
				Log.Warning("HERE! 1");
				ChefBazaar.isChefInBazaar = false;
				if (!Run.instance.IsExpansionEnabled(ChefBazaar.expansionNeeded) || (!Run.instance.GetEventFlag("SolusHeartBeaten") && ChefBazaar.allowedAfterSolusEvent.Value))
				{
					return;
				}
				Scene activeScene = SceneManager.GetActiveScene();
				string name = ((Scene)(ref activeScene)).name;
				string text = name;
				if (!(text == "moon2"))
				{
					if (text == "bazaar")
					{
						SpawnChefBazaarServer();
						Log.Warning("HERE! 2");
					}
				}
				else
				{
					MoonHooksInit();
					SpawnChefMoonServer();
				}
			}
			else
			{
				Log.Debug("Client :: " + DateTime.Now.ToString() + " " + DateTime.Now.Millisecond);
				LocalUser firstLocalUser = LocalUserManager.GetFirstLocalUser();
				NetworkUser val = ((firstLocalUser != null) ? firstLocalUser.currentNetworkUser : null);
				NetMessageExtensions.Send((INetMessage)(object)new NetMessages.RequestChefMessage(((NetworkBehaviour)val).netIdentity), (NetworkDestination)2);
			}
		}

		public static void MoonHooksInit()
		{
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Expected O, but got Unknown
			if (!ChefBazaar.moonHooks.Value)
			{
				return;
			}
			EscapeSequenceController component = GameObject.Find("EscapeSequenceController").GetComponent<EscapeSequenceController>();
			if (!((Object)(object)component != (Object)null))
			{
				return;
			}
			UnityEvent onEnterMainEscapeSequence = component.onEnterMainEscapeSequence;
			object obj = <>c.<>9__3_0;
			if (obj == null)
			{
				UnityAction val = delegate
				{
					ChefBazaar.isMoonFuckening = true;
				};
				<>c.<>9__3_0 = val;
				obj = (object)val;
			}
			onEnterMainEscapeSequence.AddListener((UnityAction)obj);
			UnityEvent onFailEscapeSequenceServer = component.onFailEscapeSequenceServer;
			object obj2 = <>c.<>9__3_1;
			if (obj2 == null)
			{
				UnityAction val2 = delegate
				{
					ChefBazaar.isMoonFuckening = false;
				};
				<>c.<>9__3_1 = val2;
				obj2 = (object)val2;
			}
			onFailEscapeSequenceServer.AddListener((UnityAction)obj2);
			UnityEvent onCompleteEscapeSequenceServer = component.onCompleteEscapeSequenceServer;
			object obj3 = <>c.<>9__3_2;
			if (obj3 == null)
			{
				UnityAction val3 = delegate
				{
					ChefBazaar.isMoonFuckening = false;
				};
				<>c.<>9__3_2 = val3;
				obj3 = (object)val3;
			}
			onCompleteEscapeSequenceServer.AddListener((UnityAction)obj3);
		}

		public static void SpawnChefBazaarServer()
		{
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014f: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_017b: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			if (Random.Range(0f, 100f) >= ChefBazaar.chefChance.Value && (!Run.instance.GetEventFlag("SolusHeartBeaten") || !ChefBazaar.guaranteedAfterSolusEvent.Value))
			{
				return;
			}
			ChefBazaar.isChefInBazaar = true;
			if (!ChefBazaar.classicChef.Value)
			{
				SpawnTools.SpawnChefMealPrep(new Vector3(-95.7066f, -24.9729f, 20.9845f), Quaternion.Euler(0f, 350.4501f, 0f));
				if (ChefBazaar.spawnScrapper.Value)
				{
					SpawnTools.SpawnScrapper(new Vector3(-94.3094f, -25.7118f, 25.2005f), Quaternion.Euler(2.21f, 1.35f, 0f));
				}
			}
			else
			{
				SpawnTools.SpawnChefMealPrepOld(new Vector3(-97.3184f, -24.2f, -49.48f), Quaternion.Euler(0f, 270f, 0f));
				if (ChefBazaar.spawnScrapper.Value)
				{
					SpawnTools.SpawnScrapper(new Vector3(-93.5723f, -25.8374f, -47.0965f), Quaternion.Euler(2.21f, 1.35f, 345.91f));
				}
			}
			Chat.SendBroadcastChat((ChatMessageBase)new NpcChatMessage
			{
				formatStringToken = "MEALPREP_DIALOGUE_FORMAT",
				baseToken = ChefBazaar.chefPhrases[Random.Range(0, ChefBazaar.chefPhrases.Count)],
				sender = null
			});
			ChefBazaar.usedTimes.Clear();
			if (!ChefBazaar.classicChef.Value)
			{
				SpawnTools.EnableVanillaTable((Vector3?)new Vector3(-82.2492f, -47.2163f, 14.0186f));
			}
			NetMessageExtensions.Send((INetMessage)(object)new NetMessages.SpawnChefTableMessage(), (NetworkDestination)1);
		}

		public static void SpawnChefMoonServer()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (ChefBazaar.moonChef.Value)
			{
				SpawnTools.SpawnChefMealPrep(new Vector3(-259.18f, -220.2f, -402.91f), Quaternion.Euler(0f, 120.9532f, 0f));
				if (ChefBazaar.spawnScrapper.Value)
				{
					SpawnTools.SpawnScrapper(new Vector3(-257.9419f, -221.2121f, -407.045f), Quaternion.Euler(359.7326f, 122.0352f, 346.4449f));
				}
				SpawnTools.EnableVanillaTable();
				NetMessageExtensions.Send((INetMessage)(object)new NetMessages.SpawnChefTableMessage(), (NetworkDestination)1);
			}
		}
	}
	internal static class Log
	{
		private static ManualLogSource _logSource;

		internal static void Init(ManualLogSource logSource)
		{
			_logSource = logSource;
		}

		internal static void Debug(object data)
		{
			_logSource.LogDebug(data);
		}

		internal static void Error(object data)
		{
			_logSource.LogError(data);
		}

		internal static void Fatal(object data)
		{
			_logSource.LogFatal(data);
		}

		internal static void Info(object data)
		{
			_logSource.LogInfo(data);
		}

		internal static void Message(object data)
		{
			_logSource.LogMessage(data);
		}

		internal static void Warning(object data)
		{
			_logSource.LogWarning(data);
		}
	}
	internal class NetMessages
	{
		public class SpawnChefTableMessage : INetMessage, ISerializableObject
		{
			public void Deserialize(NetworkReader reader)
			{
			}

			public void OnReceived()
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Unknown result type (might be due to invalid IL or missing references)
				Log.Debug("SpawnChefTableMessage Called...");
				Scene activeScene = SceneManager.GetActiveScene();
				string name = ((Scene)(ref activeScene)).name;
				string text = name;
				if (!(text == "moon2"))
				{
					if (text == "bazaar")
					{
						SpawnTools.EnableVanillaTable((Vector3?)new Vector3(-82.2492f, -47.2163f, 14.0186f));
					}
					else
					{
						Log.Debug("SpawnChefTableMessage called from invalid scene? How the fuck did you let this happen.");
					}
				}
				else
				{
					SpawnTools.EnableVanillaTable();
				}
			}

			public void Serialize(NetworkWriter writer)
			{
			}
		}

		public class RequestChefMessage : INetMessage, ISerializableObject
		{
			private NetworkIdentity playerNetID;

			public RequestChefMessage()
			{
			}

			public RequestChefMessage(NetworkIdentity netID)
			{
				playerNetID = netID;
			}

			public void Deserialize(NetworkReader reader)
			{
				playerNetID = reader.ReadNetworkIdentity();
			}

			public void OnReceived()
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_000d: Unknown result type (might be due to invalid IL or missing references)
				if (!ChefBazaar.isChefInBazaar)
				{
					Scene activeScene = SceneManager.GetActiveScene();
					if (!(((Scene)(ref activeScene)).name == "moon2"))
					{
						return;
					}
				}
				NetworkConnection connectionToClient = playerNetID.connectionToClient;
				Log.Debug(((object)playerNetID).ToString());
				if (!ChefBazaar.classicChef.Value)
				{
					NetMessageExtensions.Send((INetMessage)(object)new SpawnChefTableMessage(), connectionToClient);
				}
			}

			public void Serialize(NetworkWriter writer)
			{
				writer.Write(playerNetID);
			}
		}
	}
	public class SpawnTools
	{
		public static GameObject oldTablePrefab;

		public static void SpawnChefMealPrep(Vector3 location, Quaternion rotation)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/MealPrep/MealPrep.prefab").WaitForCompletion();
			GameObject val2 = Object.Instantiate<GameObject>(val, location, rotation);
			NetworkServer.Spawn(val2);
		}

		public static void SpawnChefMealPrepOld(Vector3 location, Quaternion rotation)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC3/MealPrep/MealPrep.prefab").WaitForCompletion();
			GameObject val2 = Object.Instantiate<GameObject>(val, location, rotation);
			NetworkServer.Spawn(val2);
			GameObject val3 = Object.Instantiate<GameObject>(oldTablePrefab);
			NetworkServer.Spawn(val3);
		}

		public static void SpawnScrapper(Vector3 location, Quaternion rotation)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/Scrapper/Scrapper.prefab").WaitForCompletion();
			GameObject val2 = Object.Instantiate<GameObject>(val, location, rotation);
			NetworkServer.Spawn(val2);
		}

		public static void EnableVanillaTable()
		{
			EnableVanillaTable(null);
		}

		public static void EnableVanillaTable(Vector3? newLocation)
		{
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = null;
			GameObject[] array = Object.FindObjectsByType<GameObject>((FindObjectsInactive)1, (FindObjectsSortMode)0);
			GameObject[] array2 = array;
			foreach (GameObject val2 in array2)
			{
				if (((Object)val2).name == "HOLDER: Mealprep" && !val2.activeSelf)
				{
					val = val2;
					break;
				}
			}
			if (!Object.op_Implicit((Object)(object)val) || (Object)(object)val == (Object)null)
			{
				Log.Warning("EnableVanillaTable - CHEF Platform could not be found, or already is enabled...");
				return;
			}
			val.gameObject.SetActive(true);
			((Component)val.transform.Find("MealPrep")).gameObject.SetActive(false);
			if (newLocation.HasValue)
			{
				val.gameObject.transform.position = newLocation.Value;
			}
		}

		public static void CreateTablePrefab()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
			oldTablePrefab = PrefabAPI.CreateEmptyPrefab("tablePrefab");
			oldTablePrefab.AddComponent<NetworkIdentity>();
			GameObject val = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/bazaar/Bazaar_LunarTable.prefab").WaitForCompletion();
			GameObject val2 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/bazaar/Bazaar_HangingLight.prefab").WaitForCompletion();
			GameObject val3 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/bazaar/Bazaar_CrystalLight.prefab").WaitForCompletion();
			GameObject val4 = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC2/lemuriantemple/Assets/LTWok.prefab").WaitForCompletion();
			GameObject val5 = Object.Instantiate<GameObject>(val, oldTablePrefab.transform);
			val5.transform.localPosition = new Vector3(-97.28f, -25.3f, -48.88f);
			val5.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
			val5.transform.localScale = Vector3.one;
			GameObject val6 = Object.Instantiate<GameObject>(val2, oldTablePrefab.transform);
			val6.transform.localPosition = new Vector3(-97.3327f, -4.507f, -48.562f);
			val6.transform.localRotation = Quaternion.identity;
			GameObject val7 = Object.Instantiate<GameObject>(val3, oldTablePrefab.transform);
			val7.transform.localPosition = new Vector3(-95.1891f, -24.0915f, -48.829f);
			val7.transform.localRotation = Quaternion.Euler(270f, 0f, 0f);
			val7.transform.localScale = Vector3.one;
			GameObject val8 = Object.Instantiate<GameObject>(val4, oldTablePrefab.transform);
			val8.transform.localPosition = new Vector3(-99.0918f, -23.18367f, -47.74821f);
			val8.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
			PrefabAPI.RegisterNetworkPrefab(oldTablePrefab);
		}
	}
}