Decompiled source of BeastheimDvergrCompat v1.0.1

BeastheimDvergrCompat.dll

Decompiled a day ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using Jotunn;
using Jotunn.Managers;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[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 BeastheimDvergrCompat
{
	[BepInPlugin("beastheim.dvergrcompat", "BeastheimDvergrCompat", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class BeastheimDvergrCompatPlugin : BaseUnityPlugin
	{
		private struct PrefabAlias
		{
			public string LegacyPrefabId;

			public string CurrentPrefabId;

			public PrefabAlias(string legacyPrefabId, string currentPrefabId)
			{
				LegacyPrefabId = legacyPrefabId;
				CurrentPrefabId = currentPrefabId;
			}
		}

		public const string PluginGuid = "beastheim.dvergrcompat";

		public const string PluginName = "BeastheimDvergrCompat";

		public const string PluginVersion = "1.0.0";

		private static readonly PrefabAlias[] Aliases = new PrefabAlias[1]
		{
			new PrefabAlias("dvergr_fermenter_tq", "teq_dv_ferm_fermenter")
		};

		private void Awake()
		{
			PrefabManager.OnVanillaPrefabsAvailable += CreateAliases;
		}

		private void CreateAliases()
		{
			PrefabAlias[] aliases = Aliases;
			for (int i = 0; i < aliases.Length; i++)
			{
				PrefabAlias prefabAlias = aliases[i];
				GameObject prefab = PrefabManager.Instance.GetPrefab(prefabAlias.LegacyPrefabId);
				if ((Object)(object)prefab != (Object)null)
				{
					Logger.LogInfo((object)("[BeastheimDvergrCompat] '" + prefabAlias.LegacyPrefabId + "' already resolves (no alias needed) - skipping."));
					continue;
				}
				GameObject val = PrefabManager.Instance.CreateClonedPrefab(prefabAlias.LegacyPrefabId, prefabAlias.CurrentPrefabId);
				if ((Object)(object)val == (Object)null)
				{
					Logger.LogError((object)("[BeastheimDvergrCompat] Failed to alias '" + prefabAlias.LegacyPrefabId + "' -> '" + prefabAlias.CurrentPrefabId + "' - is Tequila-Dvergr_Pieces actually loaded and does it still use that prefab name?"));
				}
				else
				{
					Logger.LogInfo((object)("[BeastheimDvergrCompat] Registered legacy alias '" + prefabAlias.LegacyPrefabId + "' -> '" + prefabAlias.CurrentPrefabId + "' (not added to any PieceTable - alias only, not player-craftable under the old name)."));
				}
			}
		}
	}
}