Decompiled source of WesleysInteriors v2.0.11

WesleysInteriorShenanigans.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using DunGen;
using DunGen.Tags;
using HarmonyLib;
using Microsoft.CodeAnalysis;

[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("WesleysInteriorShenanigans")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WesleysInteriorShenanigans")]
[assembly: AssemblyTitle("WesleysInteriorShenanigans")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace WesleysInteriorShenanigans
{
	[BepInPlugin("MW.MagicWesleyInteriors", "Wesley's interior shenanigans", "1.0.0")]
	public class InteriorModifier : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("MW.MagicWesleyInteriors");

		internal ManualLogSource help;

		private TileConnectionRule acRule;

		private TileConnectionRule gaRule;

		public Tag dungRoomTag = new Tag(8886);

		public Tag dungTransRoomTag = new Tag(8887);

		public Tag normRoomTag = new Tag(8888);

		public Tag catRoomTag = new Tag(8889);

		public Tag hallRoomTag = new Tag(38843);

		private static readonly List<Tag> GrandDoorwayTags = new List<Tag>
		{
			new Tag(7770),
			new Tag(7771),
			new Tag(7772),
			new Tag(7773),
			new Tag(7774)
		};

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_0076: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Expected O, but got Unknown
			help = Logger.CreateLogSource("The man in the rubber rooms");
			help.LogError((object)"You made a mistake.. but it's fine.. the world will survive.. I think..");
			harmony.PatchAll();
			help.LogError((object)"Maybe not.");
			acRule = new TileConnectionRule(new CanTilesConnectDelegate(CitadelConnections), 0);
			DoorwayPairFinder.CustomConnectionRules.Add(acRule);
			gaRule = new TileConnectionRule(new CanTilesConnectDelegate(ArmoryConnections), 0);
			DoorwayPairFinder.CustomConnectionRules.Add(gaRule);
		}

		private ConnectionResult CitadelConnections(Tile tileA, Tile tileB, Doorway doorwayA, Doorway doorwayB)
		{
			//IL_0095: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			bool flag = tileA.Tags.HasTag(normRoomTag);
			bool flag2 = tileB.Tags.HasTag(catRoomTag);
			bool flag3 = tileA.Tags.HasTag(dungRoomTag);
			bool flag4 = tileB.Tags.HasTag(dungTransRoomTag);
			bool flag5 = doorwayA.Tags.HasTag(hallRoomTag);
			bool flag6 = doorwayB.Tags.HasTag(hallRoomTag);
			if ((flag && flag2) || (flag3 && flag4) || (flag5 && flag6))
			{
				return (ConnectionResult)1;
			}
			return (ConnectionResult)2;
		}

		private ConnectionResult ArmoryConnections(Tile tileA, Tile tileB, Doorway doorwayA, Doorway doorwayB)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			foreach (Tag tag in doorwayA.Tags)
			{
				if (GrandDoorwayTags.Contains(tag) && !((IEnumerable<Tag>)doorwayB.Tags).Contains(tag))
				{
					doorwayA.BlockerPrefabWeights.Clear();
					doorwayB.BlockerPrefabWeights.Clear();
					return (ConnectionResult)1;
				}
			}
			return (ConnectionResult)2;
		}
	}
}