Decompiled source of OldPortalMetal v1.0.0

OldPortalMetal.dll

Decompiled 7 hours ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("OldPortalMetal")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("OldPortalMetal")]
[assembly: AssemblyTitle("OldPortalMetal")]
[assembly: AssemblyVersion("1.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 OldPortalMetal
{
	[BepInPlugin("com.custom.oldportalmetal", "Old Portal Metal", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			new Harmony("com.custom.oldportalmetal").PatchAll();
		}
	}
	[HarmonyPatch(typeof(ZNetScene), "Awake")]
	public static class ZNetScene_Awake_Patch
	{
		private static void Postfix(ZNetScene __instance)
		{
			if (!((Object)(object)__instance == (Object)null))
			{
				GameObject prefab = __instance.GetPrefab("portal");
				GameObject prefab2 = __instance.GetPrefab("portal_stone");
				TeleportWorld val = default(TeleportWorld);
				TeleportWorld val2 = default(TeleportWorld);
				if ((Object)(object)prefab != (Object)null && (Object)(object)prefab2 != (Object)null && prefab.TryGetComponent<TeleportWorld>(ref val) && prefab2.TryGetComponent<TeleportWorld>(ref val2))
				{
					JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)val2), (object)val);
				}
			}
		}
	}
}