Decompiled source of CastleSpawnZ v1.2.3

CastleSpawn.dll

Decompiled 2 months ago
using System;
using System.Collections;
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 FishNet;
using FishNet.Managing.Server;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Steamworks;
using UnityEngine;
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("murderminemurder, murderminer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Gnome Wars, Happy Wars.")]
[assembly: AssemblyFileVersion("1.0.4.0")]
[assembly: AssemblyInformationalVersion("1.0.4")]
[assembly: AssemblyProduct("CastleSpawn")]
[assembly: AssemblyTitle("Gnome Wars, Happy Wars.")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.4.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 CastleSpawn
{
	[BepInPlugin("murderminemurderer.castlespawn", "CastleSpawn", "1.0.5")]
	[BepInProcess("MageArena.exe")]
	public class CastleSpawn : BaseUnityPlugin
	{
		public static ManualLogSource Logger;

		public static bool debug;

		public const string guid = "murderminemurderer.castlespawn";

		public static Func<IEnumerator, Coroutine> bootloopingmybrain;

		private void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"CastleSpawn loaded");
			configman.dotheconfig(((BaseUnityPlugin)this).Config);
			new Harmony("murderminemurderer.castlespawn").PatchAll();
			bootloopingmybrain = ((MonoBehaviour)this).StartCoroutine;
		}
	}
	public static class configman
	{
		public static ConfigEntry<string> lobbyname;

		public static ConfigEntry<int> biomeid;

		public static ConfigEntry<bool> gnomekingdom;

		public static ConfigEntry<bool> cryreact;

		public static ConfigEntry<bool> additionalfixes;

		public static ConfigEntry<bool> lobbyname_previewer;

		public static ConfigEntry<bool> recallnotifier;

		public static void dotheconfig(ConfigFile config)
		{
			string text = "config";
			lobbyname = config.Bind<string>(text, "lobbyname", "<color=#ffd700>Gnome Fortress (2?)</color> <color=white><size=14>(custom)</size></color>", (ConfigDescription)null);
			biomeid = config.Bind<int>(text, "biomeid", 5, "biome to set at castles");
			gnomekingdom = config.Bind<bool>(text, "gnomekingdom", true, "whether to spawn default GnomeKingdom map, or to simply use as a lobbyname Changer");
			cryreact = config.Bind<bool>(text, "cryreact", false, "spawn crystal reactors? (super cool but buggy cant be bothered to fix rn)");
			additionalfixes = config.Bind<bool>(text, "additionalfixes", true, "fixes for bonedog to not crash game");
			lobbyname_previewer = config.Bind<bool>(text, "lobbyname_previewer", false, "replace all lobbynames with set string");
			recallnotifier = config.Bind<bool>(text, "recallnotifier", true, "add a notifier for both teams when their base is captured, informing how to recall");
		}
	}
	[HarmonyPatch(typeof(BootstrapManager), "OnLobbyCreated")]
	public static class lobbynamechanger
	{
		[HarmonyPostfix]
		[HarmonyPriority(100)]
		private static void change(ref LobbyCreated_t callback)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			if ((int)callback.m_eResult == 1)
			{
				CSteamID val = default(CSteamID);
				((CSteamID)(ref val))..ctor(BootstrapManager.CurrentLobbyID);
				SteamMatchmaking.SetLobbyData(val, "name", configman.lobbyname.Value);
				SteamMatchmaking.SetLobbyMemberLimit(val, 12);
				if (CastleSpawn.debug)
				{
					CastleSpawn.Logger.LogInfo((object)("lobbyname is: " + SteamMatchmaking.GetLobbyData(val, "name")));
				}
			}
		}
	}
	[HarmonyPatch(typeof(DungeonGenerator))]
	public static class CastleSpawner
	{
		[CompilerGenerated]
		private sealed class <herohasreturned>d__15 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public CastleFlagCapturedNotifier __instance;

			private int <lastcontrolteam>5__1;

			private int <lastcontrolteam2>5__2;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <herohasreturned>d__15(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<lastcontrolteam>5__1 = 2;
					<lastcontrolteam2>5__2 = 2;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).gameObject != (Object)null && ((Behaviour)__instance).isActiveAndEnabled)
				{
					if ((Object)(object)prs != (Object)null)
					{
						if (__instance.fcon.controlTeam != <lastcontrolteam>5__1)
						{
							<lastcontrolteam>5__1 = __instance.fcon.controlTeam;
							if (<lastcontrolteam>5__1 != 0 && <lastcontrolteam>5__1 != 2)
							{
								prs.summonDeathMessage(whitespace, "dog", "<size=22><color=#367588>The sorcerers base has been captured, press [B] and stand still to recall.</color></size>");
							}
						}
						if (__instance.fcon2.controlTeam != <lastcontrolteam2>5__2)
						{
							<lastcontrolteam2>5__2 = __instance.fcon2.controlTeam;
							if (<lastcontrolteam2>5__2 != 1 && <lastcontrolteam2>5__2 != 2)
							{
								prs.summonDeathMessage(whitespace, "dog", "<size=22><color=#682860>The warlocks base has been captured, press [B] and stand still to recall.</color></size>");
							}
						}
					}
					<>2__current = sadsatan;
					<>1__state = 1;
					return true;
				}
				return false;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static int chosenhex = 5;

		private static GameObject excaliburhilt;

		private static GameObject excaliburblade;

		private static GameObject torch;

		private static GameObject ritualdagger;

		private static GameObject crystalreactor;

		private static GameObject soupman;

		private static GameObject theorb;

		private static GameObject testobj;

		private static ServerManager servman;

		private static PlayerRespawnManager prs;

		private static Vector3 cryingscale = new Vector3(0.4f, 0.4f, 0.4f);

		private static string whitespace = "             ";

		private static WaitForSeconds sadsatan = new WaitForSeconds(1f);

		[HarmonyPatch(typeof(FindPublicLobbies), "DisplayLobbies")]
		[HarmonyPrefix]
		private static bool ihatetheretarded(ref List<CSteamID> lobbyIDs, ref LobbyDataUpdate_t result, ref FindPublicLobbies __instance)
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: 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)
			if (configman.lobbyname_previewer.Value)
			{
				for (int i = 0; i < lobbyIDs.Count; i++)
				{
					if (lobbyIDs[i].m_SteamID == result.m_ulSteamIDLobby)
					{
						GameObject val = Object.Instantiate<GameObject>(__instance.lobbyDataItemPrefab);
						val.GetComponent<LobbyDataEntry>().lobbyID = (CSteamID)lobbyIDs[i].m_SteamID;
						val.GetComponent<LobbyDataEntry>().lobbyName = configman.lobbyname.Value;
						val.GetComponent<LobbyDataEntry>().SetLobbyData(SteamMatchmaking.GetNumLobbyMembers((CSteamID)lobbyIDs[i].m_SteamID).ToString(), SteamMatchmaking.GetLobbyMemberLimit((CSteamID)lobbyIDs[i].m_SteamID));
						val.transform.SetParent(__instance.lobbyListContent.transform);
						val.transform.localScale = Vector3.one;
						string lobbyData = SteamMatchmaking.GetLobbyData((CSteamID)lobbyIDs[i].m_SteamID, "HostAddress");
						if (!__instance.listOfLobbyOwners.Contains(lobbyData))
						{
							__instance.listOfLobbyOwners.Add(lobbyData);
							__instance.listOfLobbies.Add(val);
						}
						else
						{
							Object.Destroy((Object)(object)val);
						}
					}
				}
				return false;
			}
			return true;
		}

		[IteratorStateMachine(typeof(<herohasreturned>d__15))]
		private static IEnumerator herohasreturned(CastleFlagCapturedNotifier __instance)
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <herohasreturned>d__15(0)
			{
				__instance = __instance
			};
		}

		[HarmonyPatch(typeof(CastleFlagCapturedNotifier), "DeathcheckRoutine")]
		[HarmonyPrefix]
		private static void wasitweirdilistenedtoimgodbyclamscasinowheni(CastleFlagCapturedNotifier __instance)
		{
			if (configman.recallnotifier.Value)
			{
				CastleSpawn.bootloopingmybrain(herohasreturned(__instance));
			}
		}

		[HarmonyPatch(typeof(PlayerRespawnManager), "OnStartClient")]
		[HarmonyPostfix]
		private static void thiojoe_gayfemboymalwarevideo(PlayerRespawnManager __instance)
		{
			prs = __instance;
		}

		private static void spawnat(GameObject orig, Vector3 pos, Vector3 scale = default(Vector3), Vector3 rot = default(Vector3), bool trytor = false, bool net_trans = false)
		{
			//IL_000e: 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_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: 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)
			//IL_008e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(orig);
			val.transform.position = pos;
			if (rot != default(Vector3))
			{
				val.transform.eulerAngles = rot;
			}
			if (scale != default(Vector3))
			{
				val.transform.localScale = scale;
			}
			if (trytor)
			{
				try
				{
					TorchController component = val.GetComponent<TorchController>();
					Object.Destroy((Object)(object)component);
				}
				catch (Exception)
				{
				}
			}
			servman.Spawn(val, InstanceFinder.ClientManager.Connection, default(Scene));
		}

		private static void findexcalibur()
		{
			if ((Object)(object)excaliburhilt != (Object)null || (Object)(object)excaliburblade != (Object)null)
			{
				return;
			}
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			CastleSpawn.Logger.LogMessage((object)$"scanning {array.Length} for excalibur");
			GameObject[] array2 = array;
			BoneDogController val2 = default(BoneDogController);
			foreach (GameObject val in array2)
			{
				if (((Object)val).name.Contains("DungeonRock") && !((Object)val).name.Contains("2") && !Object.op_Implicit((Object)(object)excaliburblade))
				{
					excaliburblade = val;
					if (CastleSpawn.debug)
					{
						CastleSpawn.Logger.LogMessage((object)"Found Excalibur's Blade");
					}
				}
				else if (((Object)val).name.Contains("DungeonRock2") && !Object.op_Implicit((Object)(object)excaliburhilt))
				{
					excaliburhilt = val;
					if (CastleSpawn.debug)
					{
						CastleSpawn.Logger.LogMessage((object)"Found Excalibur's Hilt");
					}
				}
				else if (((Object)val).name.Contains("Torch") && !Object.op_Implicit((Object)(object)torch))
				{
					torch = val;
					if (CastleSpawn.debug)
					{
						CastleSpawn.Logger.LogMessage((object)"Found Torch");
					}
				}
				else if (((Object)val).name.Contains("CrystalREactorr") && !Object.op_Implicit((Object)(object)crystalreactor))
				{
					crystalreactor = val;
					if (CastleSpawn.debug)
					{
						CastleSpawn.Logger.LogMessage((object)"Found CrystalREactorr");
					}
				}
				else if (((Object)val).name.Contains("RitualDagger") && !Object.op_Implicit((Object)(object)ritualdagger))
				{
					ritualdagger = val;
					if (CastleSpawn.debug)
					{
						CastleSpawn.Logger.LogMessage((object)"Found RitualDagger");
					}
				}
				else if (((Object)val).name.Contains("SoupMan") && !Object.op_Implicit((Object)(object)soupman))
				{
					soupman = val;
					if (CastleSpawn.debug)
					{
						CastleSpawn.Logger.LogMessage((object)"Found SoupMan");
					}
				}
				else if (((Object)val).name.Contains("Orb") && !Object.op_Implicit((Object)(object)theorb))
				{
					theorb = val;
				}
				else if (val.TryGetComponent<BoneDogController>(ref val2) && !Object.op_Implicit((Object)(object)testobj))
				{
					testobj = val;
				}
			}
		}

		[HarmonyPatch("GenerateMap")]
		[HarmonyPrefix]
		private static void Prefix_CastleSpawn(DungeonGenerator __instance)
		{
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: 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_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: 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_019f: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: 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)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01db: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_022b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0241: Unknown result type (might be due to invalid IL or missing references)
			//IL_025e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_026b: Unknown result type (might be due to invalid IL or missing references)
			//IL_026e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Unknown result type (might be due to invalid IL or missing references)
			//IL_0307: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_032a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0331: Unknown result type (might be due to invalid IL or missing references)
			//IL_0337: Unknown result type (might be due to invalid IL or missing references)
			//IL_033a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0340: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_036a: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0373: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0403: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0429: Unknown result type (might be due to invalid IL or missing references)
			//IL_0430: Unknown result type (might be due to invalid IL or missing references)
			//IL_0436: Unknown result type (might be due to invalid IL or missing references)
			//IL_0439: Unknown result type (might be due to invalid IL or missing references)
			//IL_043f: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0463: Unknown result type (might be due to invalid IL or missing references)
			//IL_0469: Unknown result type (might be due to invalid IL or missing references)
			//IL_046c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0472: Unknown result type (might be due to invalid IL or missing references)
			//IL_048f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0496: Unknown result type (might be due to invalid IL or missing references)
			//IL_049c: Unknown result type (might be due to invalid IL or missing references)
			//IL_049f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_04cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0502: Unknown result type (might be due to invalid IL or missing references)
			//IL_0505: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0543: Unknown result type (might be due to invalid IL or missing references)
			//IL_054a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0553: Unknown result type (might be due to invalid IL or missing references)
			//IL_0559: Unknown result type (might be due to invalid IL or missing references)
			//IL_05df: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_08e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_07fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0804: Unknown result type (might be due to invalid IL or missing references)
			//IL_080a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0827: Unknown result type (might be due to invalid IL or missing references)
			//IL_082c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0833: Unknown result type (might be due to invalid IL or missing references)
			//IL_0839: Unknown result type (might be due to invalid IL or missing references)
			//IL_0881: Unknown result type (might be due to invalid IL or missing references)
			//IL_0888: Unknown result type (might be due to invalid IL or missing references)
			//IL_088e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0891: Unknown result type (might be due to invalid IL or missing references)
			//IL_0897: Unknown result type (might be due to invalid IL or missing references)
			//IL_061f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0630: Unknown result type (might be due to invalid IL or missing references)
			//IL_0635: Unknown result type (might be due to invalid IL or missing references)
			//IL_063a: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_064b: Unknown result type (might be due to invalid IL or missing references)
			//IL_065d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0662: Unknown result type (might be due to invalid IL or missing references)
			//IL_0667: Unknown result type (might be due to invalid IL or missing references)
			//IL_0669: Unknown result type (might be due to invalid IL or missing references)
			//IL_0678: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0690: Unknown result type (might be due to invalid IL or missing references)
			//IL_0695: Unknown result type (might be due to invalid IL or missing references)
			//IL_0697: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0700: Unknown result type (might be due to invalid IL or missing references)
			//IL_0711: Unknown result type (might be due to invalid IL or missing references)
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_071b: Unknown result type (might be due to invalid IL or missing references)
			//IL_071d: Unknown result type (might be due to invalid IL or missing references)
			//IL_072c: Unknown result type (might be due to invalid IL or missing references)
			//IL_073e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0743: Unknown result type (might be due to invalid IL or missing references)
			//IL_0748: Unknown result type (might be due to invalid IL or missing references)
			//IL_074a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0759: Unknown result type (might be due to invalid IL or missing references)
			//IL_076c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0771: Unknown result type (might be due to invalid IL or missing references)
			//IL_0776: Unknown result type (might be due to invalid IL or missing references)
			//IL_0778: Unknown result type (might be due to invalid IL or missing references)
			servman = InstanceFinder.ServerManager;
			if (!InstanceFinder.IsHostStarted || !configman.gnomekingdom.Value)
			{
				return;
			}
			chosenhex = configman.biomeid.Value;
			chosenhex = ((chosenhex < 7 && chosenhex > 0) ? chosenhex : 5);
			if ((Object)(object)__instance != (Object)null && CastleSpawn.debug)
			{
				CastleSpawn.Logger.LogMessage((object)"inst");
				CastleSpawn.Logger.LogMessage((object)((__instance.Hexes != null) ? "hexes" : "fail"));
				CastleSpawn.Logger.LogMessage((object)__instance.Hexes.Length);
				CastleSpawn.Logger.LogMessage((object)__instance.Hexes[chosenhex]);
			}
			for (int i = 0; i < 2; i++)
			{
				spawnat(__instance.Hexes[chosenhex], new Vector3(70.79f, 56.4f, -107.9f));
				spawnat(__instance.Hexes[chosenhex], new Vector3(71.5f, 56.4f, 370.2f));
			}
			findexcalibur();
			if ((Object)(object)excaliburblade != (Object)null && (Object)(object)excaliburhilt != (Object)null)
			{
				spawnat(excaliburblade, new Vector3(92.13f, 58.75f, -107.12f));
				spawnat(excaliburblade, new Vector3(92.13f, 58.75f, -104.84f));
				spawnat(excaliburblade, new Vector3(92.13f, 58.75f, -109.97f));
				spawnat(excaliburblade, new Vector3(92.13f, 58.75f, -116.2f));
				spawnat(excaliburblade, new Vector3(92.13f, 58.75f, -119.94f));
				spawnat(excaliburhilt, new Vector3(55.87f, 58.75f, 369.6f));
				spawnat(excaliburhilt, new Vector3(55.87f, 58.75f, 367.47f));
				spawnat(excaliburhilt, new Vector3(55.87f, 58.75f, 378.3f));
				spawnat(excaliburhilt, new Vector3(55.87f, 58.75f, 382.17f));
				spawnat(excaliburhilt, new Vector3(55.87f, 58.75f, 375.88f));
			}
			else
			{
				CastleSpawn.Logger.LogWarning((object)"excalibur is kill");
			}
			if ((Object)(object)torch != (Object)null)
			{
				for (int j = 0; j < 3; j++)
				{
					spawnat(theorb, new Vector3(72.91f, 58.9f, -94.52f));
					spawnat(theorb, new Vector3(73.06f, 58.76f, -113.75f));
					spawnat(theorb, new Vector3(66.67f, 58.76f, -136.86f));
					spawnat(theorb, new Vector3(77.54f, 57.94f, -63.15f));
					spawnat(theorb, new Vector3(88.91f, 58.66f, -138.81f));
					spawnat(theorb, new Vector3(75.08f, 58.89f, 352.23f));
					spawnat(theorb, new Vector3(57.93f, 58.67f, 404.76f));
				}
				for (int k = 0; k < 8; k++)
				{
					spawnat(theorb, new Vector3(75.7f, 58.9f, 357.03f));
				}
				Vector3 val = default(Vector3);
				((Vector3)(ref val))..ctor(58.37f, 107.7f, 377.12f);
				Vector3 val2 = default(Vector3);
				((Vector3)(ref val2))..ctor(51.2f, 107.7f, -124.6f);
				Vector3 scale = default(Vector3);
				((Vector3)(ref scale))..ctor(100f, 100f, 100f);
				Vector3 rot = default(Vector3);
				((Vector3)(ref rot))..ctor(90f, 180f, 90f);
				float num = 20f;
				float num2 = 15f;
				spawnat(torch, val, scale, rot, trytor: true);
				spawnat(torch, val2, scale, rot, trytor: true);
				for (float num3 = 0f; num3 < 3f; num3 += 1f)
				{
					for (float num4 = 1f; num4 < 4f; num4 += 1f)
					{
						spawnat(torch, val + new Vector3(num3 * num, 0f, num4 * num2), scale, rot, trytor: true);
						spawnat(torch, val + new Vector3(0f - num3 * num, 0f, num4 * num2), scale, rot, trytor: true);
						spawnat(torch, val + new Vector3(0f - num3 * num, 0f, 0f - num4 * num2), scale, rot, trytor: true);
						spawnat(torch, val + new Vector3(num3 * num, 0f, 0f - num4 * num2), scale, rot, trytor: true);
						spawnat(torch, val2 + new Vector3(num3 * num, 0f, 0f - num4 * num2), scale, rot, trytor: true);
						spawnat(torch, val2 + new Vector3(num3 * num, 0f, num4 * num2), scale, rot, trytor: true);
						spawnat(torch, val2 + new Vector3(0f - num3 * num, 0f, num4 * num2), scale, rot, trytor: true);
						spawnat(torch, val2 + new Vector3(0f - num3 * num, 0f, 0f - num4 * num2), scale, rot, trytor: true);
					}
				}
			}
			if ((Object)(object)crystalreactor != (Object)null && configman.cryreact.Value)
			{
				for (int l = 0; l < 2; l++)
				{
					spawnat(crystalreactor, new Vector3(76.25f, 58.9f, -94.19f), cryingscale, default(Vector3), trytor: false, net_trans: true);
					spawnat(crystalreactor, new Vector3(71.75f, 58.9f, 356.49f), cryingscale, default(Vector3), trytor: false, net_trans: true);
				}
			}
			if ((Object)(object)ritualdagger != (Object)null)
			{
				for (int m = 0; m < 6; m++)
				{
					spawnat(ritualdagger, new Vector3(-254.63f, 32.95f, 119.54f));
				}
			}
			if ((Object)(object)soupman != (Object)null)
			{
				spawnat(soupman, new Vector3(-264.22f, 32.95f, 119.53f));
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "CastleSpawn";

		public const string PLUGIN_NAME = "CastleSpawn";

		public const string PLUGIN_VERSION = "1.0.4";
	}
}