Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RareMagicPortalPlus v3.3.4
RareMagicPortalPlus.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Linq.Expressions; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Guilds; using HarmonyLib; using ItemManager; using JetBrains.Annotations; using LocalizationManager; using Microsoft.CodeAnalysis; using PieceManager; using RareMagicPortal; using RareMagicPortal.PortalWorld; using RareMagicPortalPlus.Patches; using RareMagicPortalPlus.PortalScreens; using RareMagicPortalPlus.limit; using RareMagicPortal_3_Plus.PortalMode; using ServerSync; using Splatform; using StatusEffectManager; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; using YamlDotNet.Core; using YamlDotNet.Core.Events; using YamlDotNet.Core.Tokens; using YamlDotNet.Helpers; using YamlDotNet.Serialization; using YamlDotNet.Serialization.BufferedDeserialization; using YamlDotNet.Serialization.BufferedDeserialization.TypeDiscriminators; using YamlDotNet.Serialization.Converters; using YamlDotNet.Serialization.EventEmitters; using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NodeDeserializers; using YamlDotNet.Serialization.NodeTypeResolvers; using YamlDotNet.Serialization.ObjectFactories; using YamlDotNet.Serialization.ObjectGraphTraversalStrategies; using YamlDotNet.Serialization.ObjectGraphVisitors; using YamlDotNet.Serialization.Schemas; using YamlDotNet.Serialization.TypeInspectors; using YamlDotNet.Serialization.TypeResolvers; using YamlDotNet.Serialization.Utilities; using YamlDotNet.Serialization.ValueDeserializers; [assembly: AssemblyFileVersion("3.3.4")] [assembly: Guid("d61d6c3a-8f12-4acb-8ec9-90b9cc565aa6")] [assembly: ComVisible(false)] [assembly: AssemblyTrademark("")] [assembly: AssemblyCopyright("Copyright © 2024")] [assembly: AssemblyProduct("RareMagicPortalPlus")] [assembly: AssemblyCompany("WackyMole")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyDescription("")] [assembly: AssemblyTitle("RareMagicPortalPlus")] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: CompilationRelaxations(8)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.3.4.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [<fe596ac4-dc14-483a-bc9a-befb9de118d1>Embedded] internal sealed class <fe596ac4-dc14-483a-bc9a-befb9de118d1>EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] [<fe596ac4-dc14-483a-bc9a-befb9de118d1>Embedded] internal sealed class <47be4cb3-04e4-43fd-b61f-ec9e9307517e>NullableAttribute : Attribute { public readonly byte[] NullableFlags; public <47be4cb3-04e4-43fd-b61f-ec9e9307517e>NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public <47be4cb3-04e4-43fd-b61f-ec9e9307517e>NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] [<fe596ac4-dc14-483a-bc9a-befb9de118d1>Embedded] [CompilerGenerated] internal sealed class <21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContextAttribute : Attribute { public readonly byte Flag; public <21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContextAttribute(byte P_0) { Flag = P_0; } } } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] public class StargateVisualController : MonoBehaviour { public GameObject GateActive; public GameObject GateDeactive; private TeleportWorld _teleportWorld; private bool _playerInArea; private void Awake() { _teleportWorld = ((Component)this).GetComponentInChildren<TeleportWorld>(); if (!Object.op_Implicit((Object)(object)GateActive) || !Object.op_Implicit((Object)(object)GateDeactive)) { Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(true); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "GateActive") { GateActive = ((Component)val).gameObject; } if (((Object)val).name == "GateDeactive") { GateDeactive = ((Component)val).gameObject; } } } UpdateVisual(); } public void SetPlayerInArea(bool inArea) { _playerInArea = inArea; UpdateVisual(); } private void UpdateVisual() { if (Object.op_Implicit((Object)(object)_teleportWorld) && Object.op_Implicit((Object)(object)GateActive) && Object.op_Implicit((Object)(object)GateDeactive)) { bool flag = IsPortalConnected(_teleportWorld); bool flag2 = _playerInArea && flag; GateActive.SetActive(flag2); GateDeactive.SetActive(!flag2); } } private static bool IsPortalConnected(TeleportWorld tw) { if ((Object)(object)tw == (Object)null || (Object)(object)tw.m_nview == (Object)null) { return false; } return tw.HaveTarget(); } } [ExecuteInEditMode] public class PortalFX_AxisRotateByTime : MonoBehaviour { public Vector3 RotateAxis = new Vector3(1f, 5f, 10f); private void Start() { } private void Update() { //IL_0007: 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) ((Component)this).transform.Rotate(RotateAxis * Time.deltaTime); } } [ExecuteInEditMode] [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] public class PortalFX_Turbulence : MonoBehaviour { public float TurbulenceStrenght = 1f; public Vector3 Frequency = new Vector3(1f, 1f, 1f); public Vector3 OffsetSpeed = new Vector3(0.5f, 0.5f, 0.5f); public Vector3 Amplitude = new Vector3(5f, 5f, 5f); public Vector3 GlobalForce; private float lastStopTime; private Vector3 currentOffset; private float deltaTime; private Particle[] particleArray; private ParticleSystem particleSys; private float time; private void Start() { particleSys = ((Component)this).GetComponent<ParticleSystem>(); if (particleArray == null || particleArray.Length < particleSys.maxParticles) { particleArray = (Particle[])(object)new Particle[particleSys.maxParticles]; } } private void Update() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0078: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0131: 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_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: 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_0207: Unknown result type (might be due to invalid IL or missing references) //IL_020c: 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) int particles = particleSys.GetParticles(particleArray); if (!Application.isPlaying) { deltaTime = Time.realtimeSinceStartup - lastStopTime; lastStopTime = Time.realtimeSinceStartup; } else { deltaTime = Time.deltaTime; } currentOffset += OffsetSpeed * deltaTime; for (int i = 0; i < particles; i++) { Particle val = particleArray[i]; float num = 1f; Vector3 position = ((Particle)(ref val)).position; position.x /= Frequency.x; position.y /= Frequency.y; position.z /= Frequency.z; Vector3 val2 = new Vector3 { x = ((Mathf.PerlinNoise(position.z - currentOffset.z, position.y - currentOffset.y) * 2f - 1f) * Amplitude.x + GlobalForce.x) * deltaTime, y = ((Mathf.PerlinNoise(position.x - currentOffset.x, position.z - currentOffset.z) * 2f - 1f) * Amplitude.y + GlobalForce.y) * deltaTime, z = ((Mathf.PerlinNoise(position.y - currentOffset.y, position.x - currentOffset.x) * 2f - 1f) * Amplitude.z + GlobalForce.z) * deltaTime } * (TurbulenceStrenght * num); ref Particle reference = ref particleArray[i]; ((Particle)(ref reference)).position = ((Particle)(ref reference)).position + val2; } particleSys.SetParticles(particleArray, particles); } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] public class PortalFX_UVAnimation : MonoBehaviour { public int TilesX = 4; public int TilesY = 4; public float FPS = 30f; public int StartFrameOffset; public bool IsLoop = true; public float StartDelay; public bool IsReverse; public bool IsBump; public AnimationCurve FrameOverTime = AnimationCurve.Linear(0f, 1f, 1f, 1f); private bool isInizialised; private int index; private int count; private int allCount; private float animationLifeTime; private bool isVisible; private bool isCorutineStarted; private Renderer currentRenderer; private Material instanceMaterial; private float animationStartTime; private bool animationStoped; private void Start() { currentRenderer = ((Component)this).GetComponent<Renderer>(); InitDefaultVariables(); isInizialised = true; isVisible = true; Play(); } private void InitDefaultVariables() { //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: 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_010c: 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_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) currentRenderer = ((Component)this).GetComponent<Renderer>(); if ((Object)(object)currentRenderer == (Object)null) { throw new Exception("UvTextureAnimator can't get renderer"); } if (!currentRenderer.enabled) { currentRenderer.enabled = true; } allCount = 0; animationStoped = false; animationLifeTime = (float)(TilesX * TilesY) / FPS; count = TilesY * TilesX; index = TilesX - 1; Vector3 zero = Vector3.zero; StartFrameOffset -= StartFrameOffset / count * count; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1f / (float)TilesX, 1f / (float)TilesY); if ((Object)(object)currentRenderer != (Object)null) { instanceMaterial = currentRenderer.material; instanceMaterial.SetTextureScale("_MainTex", val); instanceMaterial.SetTextureOffset("_MainTex", Vector2.op_Implicit(zero)); if (IsBump) { instanceMaterial.SetTextureScale("_BumpMap", val); instanceMaterial.SetTextureOffset("_BumpMap", Vector2.op_Implicit(zero)); } } } private void Play() { if (!isCorutineStarted) { if (StartDelay > 0.0001f) { ((MonoBehaviour)this).Invoke("PlayDelay", StartDelay); } else { ((MonoBehaviour)this).StartCoroutine(UpdateCorutine()); } isCorutineStarted = true; } } private void PlayDelay() { ((MonoBehaviour)this).StartCoroutine(UpdateCorutine()); } private void OnEnable() { if (isInizialised) { InitDefaultVariables(); isVisible = true; Play(); } } private void OnDisable() { isCorutineStarted = false; isVisible = false; ((MonoBehaviour)this).StopAllCoroutines(); ((MonoBehaviour)this).CancelInvoke("PlayDelay"); } private IEnumerator UpdateCorutine() { animationStartTime = Time.time; while (isVisible && (IsLoop || !animationStoped)) { if (!IsReverse) { UpdateFrame(); } else { UpdateFrameReversed(); } if (!IsLoop && animationStoped) { break; } float num = (Time.time - animationStartTime) / animationLifeTime; float num2 = FrameOverTime.Evaluate(Mathf.Clamp01(num)); yield return (object)new WaitForSeconds(1f / (FPS * num2)); } isCorutineStarted = false; } private void UpdateFrame() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) allCount++; index++; if (index >= count) { index = 0; } if (count == allCount) { animationStartTime = Time.time; allCount = 0; animationStoped = true; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)index / (float)TilesX - (float)(index / TilesX), 1f - (float)(index / TilesX) / (float)TilesY); if ((Object)(object)currentRenderer != (Object)null) { instanceMaterial.SetTextureOffset("_MainTex", val); if (IsBump) { instanceMaterial.SetTextureOffset("_BumpMap", val); } } } private void UpdateFrameReversed() { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) allCount--; index--; if (index <= 0) { index = count; } if (count == allCount) { animationStartTime = Time.time; allCount = 0; animationStoped = true; } Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)index / (float)TilesX - (float)(index / TilesX), 1f - (float)(index / TilesX) / (float)TilesY); if ((Object)(object)currentRenderer != (Object)null) { instanceMaterial.SetTextureOffset("_MainTex", val); if (IsBump) { instanceMaterial.SetTextureOffset("_BumpMap", val); } } } private void OnDestroy() { if ((Object)(object)instanceMaterial != (Object)null) { Object.Destroy((Object)(object)instanceMaterial); instanceMaterial = null; } } } public class PortalsFX_RandomMoves : MonoBehaviour { public float TimeMultipler = 0.2f; public float RangeMultipler = 0.2f; [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(1)] private Transform t; private Vector3 StartPosition; private Vector3 RndArg1; private Vector3 RndArg2; private Vector3 RndArg3; private void Start() { //IL_0013: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0052: 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) t = ((Component)this).GetComponent<Transform>(); StartPosition = t.position; RndArg1 = Random.insideUnitSphere * 2f; RndArg2 = Random.insideUnitSphere * 2f; RndArg3 = Random.insideUnitSphere * 2f; } private void Update() { //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) float num = Time.time * TimeMultipler; float num2 = Mathf.Sin(Mathf.Sin(num * RndArg1.x) + num * RndArg1.y) + Mathf.Cos(Mathf.Cos(num) * RndArg1.z + num); float num3 = Mathf.Sin(Mathf.Sin(num * RndArg2.x) + num * RndArg2.y) + Mathf.Cos(Mathf.Cos(num) * RndArg2.z + num); float num4 = Mathf.Sin(Mathf.Sin(num * RndArg3.x) + num * RndArg3.y) + Mathf.Cos(Mathf.Cos(num) * RndArg3.z + num); t.position = StartPosition + new Vector3(num2, num3, num4) * RangeMultipler; } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] internal class RecipeData { public string name; public string craftingStation; public int minStationLevel; public int amount; public bool disabled; public List<string> reqs = new List<string>(); } namespace RareMagicPortalPlus.PortalScreens { [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] public class ps_patches { [HarmonyPatch(typeof(Hud), "Awake")] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] private class HudHud_AwakeRMP { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static void Postfix(Hud __instance) { if (Crossplay) { return; } try { if (ZPlayFabMatchmaking.instance != null && (ZPlayFabMatchmaking.instance.IsJoinedToNetwork() || ZPlayFabMatchmaking.instance.m_isConnectingToNetwork)) { Crossplay = true; MagicPortalFluid.RareMagicPortal.LogWarning((object)"Crossplay client detected, removing portalImages"); return; } } catch { } PortalImage.Initialize(); if (!configHandlersRegistered) { MagicPortalFluid.PortalImages.SettingChanged += PortalImageSettingChanged; MagicPortalFluid.PortalFullScreenImages.SettingChanged += PortalImageSettingChanged; MagicPortalFluid.PortalImagesFullScreenOnly.SettingChanged += PortalImageSettingChanged; configHandlersRegistered = true; } new PortalLayer { LayerName = "Swirl", LayerType = ScreenType.Static }; TryResolveLoadingBackground(); RefreshPortalLayers(); } } [HarmonyPatch(typeof(Uirotate), "Update")] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] private class UiRotate_UpdateRMP { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static bool Prefix(Uirotate __instance) { if (Crossplay) { return true; } if (!IsPortalLayer(__instance)) { return true; } if (MagicPortalFluid.PortalImages.Value == MagicPortalFluid.Toggle.Off) { ((Component)__instance).gameObject.SetActive(true); setBackgroundblack(); return true; } if (MagicPortalFluid.PortalImagesFullScreenOnly.Value == MagicPortalFluid.Toggle.On) { ((Component)__instance).gameObject.SetActive(false); return false; } string name = ((Object)((Component)__instance).gameObject).name; if (!name.StartsWith("layer", StringComparison.OrdinalIgnoreCase) || !int.TryParse(name.Substring("layer".Length), out var result)) { return true; } int num = result - 1; if (num >= 0 && num < PortalImage.PortalLayers.Count) { PortalLayer portalLayer = PortalImage.PortalLayers[num]; switch (portalLayer.LayerType) { case ScreenType.BiomeImage: return false; case ScreenType.Static: return false; case ScreenType.Rotating: ((Component)__instance).gameObject.SetActive(true); portalLayer.Rotate(); break; case ScreenType.Invisible: ((Component)__instance).gameObject.SetActive(false); break; } } return false; } } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [HarmonyPatch(typeof(Player), "TeleportTo")] private class Player_TeleportToRMPBiomeLayer { private unsafe static void Prefix(Vector3 pos) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Unknown result type (might be due to invalid IL or missing references) //IL_02d6: 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_0270: Unknown result type (might be due to invalid IL or missing references) if (Crossplay) { return; } if (MagicPortalFluid.PortalImages.Value == MagicPortalFluid.Toggle.Off || MagicPortalFluid.PortalFullScreenImages.Value == MagicPortalFluid.Toggle.Off) { setBackgroundblack(); } else { if (!TryResolveLoadingBackground()) { return; } Image component = privBKG.GetComponent<Image>(); PortalImage.LoadBackgroundSprite(); component.sprite = PortalImage.BackgroundSprite ?? defaultblack; ((Graphic)component).color = new Color(1f, 1f, 1f, 1f); portalBackgroundApplied = (Object)(object)PortalImage.BackgroundSprite != (Object)null; if (MagicPortalFluid.PortalImagesFullScreenOnly.Value != MagicPortalFluid.Toggle.On) { if (PortalImage.PortalLayers.Count() == 0) { GameObject gameObject = ((Component)GameObject.Find("_GameMain").transform.Find("LoadingGUI/PixelFix/IngameGui/HUD/LoadingBlack/Teleporting/Swirl")).gameObject; int num = 0; if ((Object)(object)gameObject != (Object)null) { Transform[] componentsInChildren = gameObject.GetComponentsInChildren<Transform>(); foreach (Transform val in componentsInChildren) { switch (num) { case 0: num++; continue; case 5: orginal5 = ((Component)val).gameObject; break; } string name = ((Object)((Component)val).gameObject).name; PortalLayer portalLayer = new PortalLayer(); portalLayer.LayerName = name; portalLayer.ImageComponent = ((Component)val).gameObject.GetComponent<Image>(); if (MagicPortalFluid.PortalImagesFullScreenOnly.Value == MagicPortalFluid.Toggle.On) { portalLayer.LayerType = ScreenType.Invisible; } else { portalLayer.LayerType = ScreenType.Rotating; } if (num < 5) { portalLayer.LayerType = ScreenType.Invisible; } portalLayer.RotationSpeed = 50f + (float)num * 10f; PortalImage.PortalLayers.Add(portalLayer); num++; } } } RefreshPortalLayers(); Biome biome = WorldGenerator.instance.GetBiome(pos); try { if (PortalImage.PortalLayers.Count <= 4 || (Object)(object)orginal5 == (Object)null) { return; } PortalLayer portalLayer2 = PortalImage.PortalLayers[4]; portalLayer2.LayerType = ScreenType.BiomeImage; if (portalLayer2 != null && portalLayer2.LayerType == ScreenType.BiomeImage && PortalImage.PortalBiomeTextures.ContainsKey(biome)) { MagicPortalFluid.RareMagicPortal.LogInfo((object)("Setting circle image to " + ((object)(*(Biome*)(&biome))/*cast due to .constrained prefix*/).ToString())); orginal5.GetComponent<Image>().sprite = PortalImage.MaskSprite; orginal5.SetActive(true); portalLayer2.RotationSpeed = 0f; Mask val2 = default(Mask); if (!orginal5.TryGetComponent<Mask>(ref val2)) { orginal5.AddComponent<Mask>().showMaskGraphic = false; GameObject val3 = new GameObject("ChildImage"); val3.transform.SetParent(orginal5.transform, false); val3.AddComponent<Image>(); } ((Behaviour)orginal5.GetComponent<Uirotate>()).enabled = false; Image component2 = ((Component)orginal5.transform.Find("ChildImage")).GetComponent<Image>(); ((Graphic)component2).rectTransform.sizeDelta = new Vector2((float)PortalImage.maskwidth, (float)PortalImage.maskheight); component2.sprite = PortalImage.PortalBiomeTextures[biome]; } return; } catch (Exception ex) { MagicPortalFluid.RareMagicPortal.LogWarning((object)("Unable to set portal biome image: " + ex.Message)); return; } } RefreshPortalLayers(); } } private static void Postfix(Player __instance) { if (portalBackgroundApplied && !((Object)(object)__instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !((Object)(object)MagicPortalFluid.context == (Object)null)) { ((MonoBehaviour)MagicPortalFluid.context).StartCoroutine(RestoreBackgroundAfterTeleport(__instance)); } } private static IEnumerator RestoreBackgroundAfterTeleport(Player player) { while ((Object)(object)player != (Object)null && ((Character)player).IsTeleporting()) { yield return null; } yield return null; setBackgroundblack(); RefreshPortalLayers(); } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] public enum ScreenType { Invisible, BiomeImage, Static, Rotating } private static Sprite defaultblack; private static GameObject privBKG; private static GameObject orginal5; internal static bool Crossplay; private static bool portalBackgroundApplied; private static bool configHandlersRegistered; private static bool TryResolveLoadingBackground() { if ((Object)(object)privBKG != (Object)null && (Object)(object)defaultblack != (Object)null) { return true; } GameObject obj = GameObject.Find("_GameMain"); Transform obj2 = ((obj != null) ? obj.transform : null); Transform val = ((obj2 != null) ? obj2.Find("LoadingGUI/PixelFix/IngameGui/HUD/LoadingBlack/Bkg") : null); if ((Object)(object)val == (Object)null) { return false; } privBKG = ((Component)val).gameObject; Image component = privBKG.GetComponent<Image>(); if ((Object)(object)component == (Object)null) { return false; } if ((Object)(object)defaultblack == (Object)null) { defaultblack = component.sprite; } return true; } internal static void setBackgroundblack() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (TryResolveLoadingBackground()) { Image component = privBKG.GetComponent<Image>(); component.sprite = PortalImage.DefaultBlackSprite ?? defaultblack; ((Graphic)component).color = new Color(1f, 1f, 1f, 1f); portalBackgroundApplied = false; } } private static bool IsPortalLayer(Uirotate instance) { if ((Object)(object)instance == (Object)null || (Object)(object)((Component)instance).transform == (Object)null) { return false; } Transform val = ((Component)instance).transform; while ((Object)(object)val != (Object)null) { if (((Object)val).name == "Swirl" && (Object)(object)val.parent != (Object)null && ((Object)val.parent).name == "Teleporting") { return true; } val = val.parent; } return false; } private static void RefreshPortalLayers() { bool flag = MagicPortalFluid.PortalImages.Value == MagicPortalFluid.Toggle.On && MagicPortalFluid.PortalImagesFullScreenOnly.Value == MagicPortalFluid.Toggle.On; foreach (PortalLayer portalLayer in PortalImage.PortalLayers) { if ((Object)(object)portalLayer?.ImageComponent != (Object)null) { ((Component)portalLayer.ImageComponent).gameObject.SetActive(!flag && portalLayer.LayerType != ScreenType.Invisible); } } } private static void PortalImageSettingChanged(object sender, EventArgs args) { if (MagicPortalFluid.PortalImages.Value == MagicPortalFluid.Toggle.Off || MagicPortalFluid.PortalFullScreenImages.Value == MagicPortalFluid.Toggle.Off) { setBackgroundblack(); } RefreshPortalLayers(); } } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] public static class PortalImage { public static List<PortalLayer> PortalLayers = new List<PortalLayer>(); public static Sprite BackgroundSprite; public static Sprite DefaultBlackSprite; public static Sprite MaskSprite; public static Dictionary<Biome, Sprite> PortalBiomeTextures = new Dictionary<Biome, Sprite>(); private static readonly Dictionary<string, Sprite> BackgroundSprites = new Dictionary<string, Sprite>(StringComparer.OrdinalIgnoreCase); private static readonly Random Random = new Random(); public static int maskwidth = 0; public static int maskheight = 0; public static void Initialize() { LoadBackgroundSprite(); LoadDefaultBlackSprite(); if (!ps_patches.Crossplay) { LoadPortalBiomeTextures(); } } private static void LoadDefaultBlackSprite() { DefaultBlackSprite = LoadSpriteFromFile(Path.Combine(MagicPortalFluid.BackgroundFolder, "default_black.png")); } internal static void LoadBackgroundSprite() { try { if (!Directory.Exists(MagicPortalFluid.BackgroundFolder)) { return; } string[] array = (from file in Directory.GetFiles(MagicPortalFluid.BackgroundFolder).Where(IsSupportedImageFile) where !Path.GetFileName(file).Equals("default_black.png", StringComparison.OrdinalIgnoreCase) select file).ToArray(); if (array.Length == 0) { BackgroundSprite = null; return; } string text = array[Random.Next(array.Length)]; if (!BackgroundSprites.TryGetValue(text, out var value) || (Object)(object)value == (Object)null) { value = LoadSpriteFromFile(text); if ((Object)(object)value != (Object)null) { BackgroundSprites[text] = value; } } BackgroundSprite = value; } catch (Exception ex) { BackgroundSprite = null; MagicPortalFluid.RareMagicPortal.LogWarning((object)("Unable to load portal background image: " + ex.Message)); } } private static void LoadPortalBiomeTextures() { //IL_0035: 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_0045: 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_007c: Unknown result type (might be due to invalid IL or missing references) if (!Directory.Exists(MagicPortalFluid.BiomeTexturesFolder)) { return; } string[] files = Directory.GetFiles(MagicPortalFluid.BiomeTexturesFolder); foreach (Biome value in Enum.GetValues(typeof(Biome))) { string filePath = Path.Combine(MagicPortalFluid.BiomeTexturesFolder, $"{(object)value}.png"); if (!PortalBiomeTextures.ContainsKey(value)) { Sprite val2 = LoadSpriteFromFile(filePath); if ((Object)(object)val2 != (Object)null) { PortalBiomeTextures[value] = val2; } } } string text = files.FirstOrDefault([<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] (string file) => Path.GetFileName(file).Equals("mask.png", StringComparison.OrdinalIgnoreCase)); if (!string.IsNullOrEmpty(text) && (Object)(object)MaskSprite == (Object)null) { Texture2D val3 = LoadTextureFromFile(text); if ((Object)(object)val3 != (Object)null) { MaskSprite = SpriteTools.CreateCircularSprite(val3); } } } public static Texture2D LoadTextureFromFile(string filePath) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (File.Exists(filePath)) { byte[] array = File.ReadAllBytes(filePath); Texture2D val = new Texture2D(2, 2); if (ImageConversion.LoadImage(val, array)) { return val; } } return null; } private static Sprite LoadSpriteFromFile(string filePath) { //IL_0029: 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) Texture2D val = LoadTextureFromFile(filePath); if (!((Object)(object)val == (Object)null)) { return Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); } return null; } private static bool IsSupportedImageFile(string filePath) { string extension = Path.GetExtension(filePath); if (!extension.Equals(".png", StringComparison.OrdinalIgnoreCase) && !extension.Equals(".jpg", StringComparison.OrdinalIgnoreCase)) { return extension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase); } return true; } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] public class PortalLayer { public string LayerName { get; set; } public ps_patches.ScreenType LayerType { get; set; } public Image ImageComponent { get; set; } public float RotationSpeed { get; set; } = 50f; public void ChangeBiomeSprite(Sprite newSprite) { if ((Object)(object)ImageComponent != (Object)null && (Object)(object)newSprite != (Object)null) { ImageComponent.sprite = newSprite; } } public void Rotate() { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ImageComponent != (Object)null) { ((Component)ImageComponent).transform.Rotate(Vector3.forward * Time.deltaTime * RotationSpeed); } } } } namespace RareMagicPortalPlus.limit { [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] internal class PortalLimit { [HarmonyPatch(typeof(ZNetScene), "Awake")] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] private static class ZNetScene_Awake_PatchRMPExtra { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static void Postfix(ZNetScene __instance) { if (ZNet.instance.IsServer()) { ZRoutedRpc.instance.Register("WackyPortal Portalplaced", (Action<long>)PortalPlaced); } else { ZRoutedRpc.instance.Register<bool>("RMPportal Data", (Action<long, bool>)ReceiveData_RMPPortals); } } private static void PortalPlaced(long sender) { ZNetPeer peer = ZNet.instance.GetPeer(sender); if (peer != null) { string playerName = peer.m_playerName; if (_portalManager.PlayersPortalData.ContainsKey(playerName)) { _portalManager.PlayersPortalData[playerName]++; } else { _portalManager.PlayersPortalData[playerName] = 1; } _portalManager.Save(); ZRoutedRpc.instance.InvokeRoutedRPC(peer.m_uid, "RMPportal Data", new object[1] { _portalManager.CanBuildPortal(playerName) }); } } private static void ReceiveData_RMPPortals(long sender, bool data) { MagicPortalFluid._canPlacePortal = data; } } [HarmonyPatch(typeof(Game), "Start")] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] private static class Game_Start_PatchRMPPortal { private static void Postfix() { MagicPortalFluid._canPlacePortal = false; if (MagicPortalFluid.MaxAmountOfPortals.Value == 0) { MagicPortalFluid._canPlacePortal = true; } } } [HarmonyPatch(typeof(ZNet), "RPC_PeerInfo")] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] private static class ZnetSync { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static void Postfix(ZRpc rpc) { if (ZNet.instance.IsServer() && ZNet.instance.IsDedicated()) { ZNetPeer peer = ZNet.instance.GetPeer(rpc); if (peer != null && _portalManager != null) { string playerName = peer.m_playerName; ZRoutedRpc.instance.InvokeRoutedRPC(peer.m_uid, "RMPportal Data", new object[1] { _portalManager.CanBuildPortal(playerName) }); } } } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] [HarmonyPatch(typeof(Piece), "SetCreator")] private static class Piece_SetCreator_PortalBuilder { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static void Postfix(Piece __instance) { if (MagicPortalFluid.PortalNames.Contains(Utils.GetPrefabName(((Component)__instance).gameObject))) { ZNetView component = ((Component)__instance).GetComponent<ZNetView>(); Player localPlayer = Player.m_localPlayer; if (!((Object)(object)component == (Object)null) && component.IsValid() && component.IsOwner() && !((Object)(object)localPlayer == (Object)null) && __instance.GetCreator() == localPlayer.GetPlayerID()) { component.GetZDO().Set(PortalBuilder, localPlayer.GetPlayerName()); } } } } [HarmonyPatch(typeof(ZDOMan), "HandleDestroyedZDO")] [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] private static class ZDOMan_PortalRemoved { private static void Prefix(ZDOMan __instance, ZDOID uid, [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(2)] out string __state) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) __state = null; if (!ZNet.instance.IsServer()) { return; } ZDO zdo = __instance.GetZDO(uid); if (zdo == null || !MagicPortalFluid.PortalNames.Any([<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] (string name) => StringExtensionMethods.GetStableHashCode(name) == zdo.GetPrefab())) { return; } __state = zdo.GetString(PortalBuilder, ""); if (!string.IsNullOrEmpty(__state)) { return; } long creator = zdo.GetLong(ZDOVars.s_creator, 0L); if (creator == 0L) { return; } Player player = Player.GetPlayer(creator); if ((Object)(object)player != (Object)null) { __state = player.GetPlayerName(); } else { __state = ZNet.instance.GetPeers().Find([<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] (ZNetPeer candidate) => { //IL_000c: Unknown result type (might be due to invalid IL or missing references) ZDO zDO = __instance.GetZDO(candidate.m_characterID); return zDO != null && zDO.GetLong(ZDOVars.s_playerID, 0L) == creator; })?.m_playerName; } if (string.IsNullOrEmpty(__state)) { MagicPortalFluid.RareMagicPortal.LogWarning((object)$"Cannot refund portal {uid}: legacy builder {creator} is offline and no builder name was saved."); } } private static void Postfix(ZDOMan __instance, ZDOID uid, [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(2)] string __state) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(__state) && __instance.GetZDO(uid) == null) { RefundPortal(__state); } } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] [HarmonyPatch(typeof(Player), "TryPlacePiece")] private static class PlacePiece_PatchRMPPre { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static bool Prefix(ref Player __instance, ref Piece piece, out bool __state) { __state = (Object)(object)piece != (Object)null && MagicPortalFluid.PortalNames.Contains(((Object)piece).name); if (__state) { if (MagicPortalFluid.AdminOnlyMakesPortals.Value == MagicPortalFluid.Toggle.On && !MagicPortalFluid.isAdmin) { MessageHud.instance.ShowMessage((MessageType)2, "<color=red> $rmp_admin_only_canPlace </color>", 0, (Sprite)null, false, true); return false; } if (Player.m_debugMode || MagicPortalFluid.MaxAmountOfPortals.Value == 0) { return true; } if (!MagicPortalFluid._canPlacePortal) { MessageHud.instance.ShowMessage((MessageType)2, "<color=yellow> $rmp_portal_limit </color>", 0, (Sprite)null, false, true); return false; } MagicPortalFluid._canPlacePortal = false; } return true; } private static void Postfix(bool __result, bool __state) { if (__state && __result) { if (ZNet.instance.IsServer() && !ZNet.instance.IsDedicated()) { handlelocalCountUP(); } else if (ZNet.instance.GetServerPeer() != null) { ZRoutedRpc.instance.InvokeRoutedRPC(ZNet.instance.GetServerPeer().m_uid, "WackyPortal Portalplaced", new object[1]); } } } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] private enum PlayerStatus { VIP, User } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] private class PortalManager { private readonly string _path; public Dictionary<string, int> PlayersPortalData { get; private set; } = new Dictionary<string, int>(); public PortalManager(string path) { _path = path; if (!File.Exists(_path)) { File.Create(_path).Dispose(); return; } string text = File.ReadAllText(_path); if (!string.IsNullOrEmpty(text)) { <03528d2a-db7c-471e-b043-6ce60cb4abe7>IDeserializer <03528d2a-db7c-471e-b043-6ce60cb4abe7>IDeserializer = new <13b765dd-bee4-4ce7-b208-6fb315d9e25e>DeserializerBuilder().Build(); PlayersPortalData = <03528d2a-db7c-471e-b043-6ce60cb4abe7>IDeserializer.Deserialize<Dictionary<string, int>>(text) ?? new Dictionary<string, int>(); } } public bool CanBuildPortal(string id) { if (!PlayersPortalData.ContainsKey(id)) { return true; } bool result = GetPlayerStatus(id) switch { PlayerStatus.VIP => PlayersPortalData[id] < MagicPortalFluid.MaxAmountOfPortals_VIP.Value, PlayerStatus.User => PlayersPortalData[id] < MagicPortalFluid.MaxAmountOfPortals.Value, _ => false, }; if (MagicPortalFluid.MaxAmountOfPortals.Value == 0) { return true; } if (MagicPortalFluid.MaxAmountOfPortals_VIP.Value == 0 && GetPlayerStatus(id) == PlayerStatus.VIP) { return true; } return result; } public void Save() { <f0c7a6ed-0ead-4438-8802-f3f04888ed6f>ISerializer <f0c7a6ed-0ead-4438-8802-f3f04888ed6f>ISerializer = new <96741211-3e26-42cc-a050-340a5f8a5cf0>SerializerBuilder().Build(); File.WriteAllText(_path, <f0c7a6ed-0ead-4438-8802-f3f04888ed6f>ISerializer.Serialize(PlayersPortalData)); } } private static SyncedList VIPportalplayersList; private static PortalManager _portalManager; private static FileSystemWatcher fsw; private static string pathPortalData; private static readonly int PortalBuilder = StringExtensionMethods.GetStableHashCode("WackyPortal_id"); private static void handlelocalCountUP() { string playerName = Player.m_localPlayer.GetPlayerName(); if (_portalManager.PlayersPortalData.ContainsKey(playerName)) { _portalManager.PlayersPortalData[playerName]++; } else { _portalManager.PlayersPortalData[playerName] = 1; } _portalManager.Save(); MagicPortalFluid._canPlacePortal = _portalManager.CanBuildPortal(playerName); } private static void RefundPortal(string id) { if (_portalManager == null) { MagicPortalFluid.RareMagicPortal.LogError((object)("Cannot refund a portal for " + id + ": portal limits have not been initialized.")); return; } if (_portalManager.PlayersPortalData.ContainsKey(id)) { _portalManager.PlayersPortalData[id]--; if (_portalManager.PlayersPortalData[id] < 0) { _portalManager.PlayersPortalData[id] = 0; } } else { _portalManager.PlayersPortalData[id] = 0; } _portalManager.Save(); bool flag = _portalManager.CanBuildPortal(id); if ((Object)(object)Player.m_localPlayer != (Object)null && Player.m_localPlayer.GetPlayerName() == id) { MagicPortalFluid._canPlacePortal = flag; } ZNetPeer peerByPlayerName = ZNet.instance.GetPeerByPlayerName(id); if (peerByPlayerName != null) { ZRoutedRpc.instance.InvokeRoutedRPC(peerByPlayerName.m_uid, "RMPportal Data", new object[1] { flag }); } } private static PlayerStatus GetPlayerStatus(string id) { if (!ZNet.instance.ListContainsId(VIPportalplayersList, id)) { return PlayerStatus.User; } return PlayerStatus.VIP; } internal static void ServerSidePortalInit() { //IL_008f: 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) //IL_00a3: Expected O, but got Unknown if (!Directory.Exists(MagicPortalFluid.YMLFULLFOLDER)) { Directory.CreateDirectory(MagicPortalFluid.YMLFULLFOLDER); } string text = Path.Combine(MagicPortalFluid.YMLFULLFOLDER, MagicPortalFluid.Worldname + "_PlayerPortals.json"); pathPortalData = Path.Combine(MagicPortalFluid.YMLFULLFOLDER, MagicPortalFluid.Worldname + "_PlayerPortals.yml"); if (!File.Exists(pathPortalData) && File.Exists(text)) { File.Move(text, pathPortalData); } _portalManager = new PortalManager(pathPortalData); string text2 = Path.Combine(MagicPortalFluid.YMLFULLFOLDER, "VIP_Portal_players.txt"); VIPportalplayersList = new SyncedList(new FileLocation((FileSource)2, text2), ""); } private void ConfigChanged(object sender, FileSystemEventArgs e) { MonoBehaviour.print((object)"[RareMagic Portal] RMP Portal Count changed..."); } private static IEnumerator DelayReloadConfigFile(ConfigFile file) { yield return (object)new WaitForSecondsRealtime(2.5f); file.Reload(); } } } namespace RareMagicPortalPlus.Patches { [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] internal class Ships { [HarmonyPatch(typeof(TeleportWorld), "Teleport")] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] public class TeleportPatch { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static bool Prefix(TeleportWorld __instance, Player player) { return PlayerBoatChecker(__instance, player); } } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] public static class ShipTeleportHelper { internal static Dictionary<string, Vector3> relativePositions = new Dictionary<string, Vector3>(); private static Vector3 holdVelocity = Vector3.zero; private static Vector3 offset = Vector3.zero; internal static Vector3 holdposition = Vector3.zero; internal static Quaternion holdrotation = Quaternion.identity; internal static bool PlayerisOnShip = false; internal static bool ShipisTargetPortal = false; private const float TeleportCompletionTimeout = 20f; internal static readonly HashSet<int> teleportedTames = new HashSet<int>(); private static float TameTransportRadius => Math.Max(0f, MagicPortalFluid.ConfigTransportTameRadius?.Value ?? 12f); public static Ship FindShip(Player player) { Ship[] array = Object.FindObjectsOfType<Ship>(); foreach (Ship val in array) { if (val.IsPlayerInBoat(player) && val.HasPlayerOnboard()) { return val; } } return null; } public static void StoreRelativePositions(Ship ship) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0072: Unknown result type (might be due to invalid IL or missing references) relativePositions.Clear(); teleportedTames.Clear(); foreach (Player player in ship.m_players) { if ((Object)(object)player == (Object)null) { ZLog.LogError((object)"A player in the ship's list is null!"); continue; } Vector3 val = ((Component)ship).transform.InverseTransformPoint(((Component)player).transform.position); relativePositions[player.GetPlayerName()] = val; ZLog.Log((object)$"Stored relative position for {player.GetPlayerName()}: {val}"); } } private static bool IsOwnedTame(Character character) { if ((Object)(object)character == (Object)null || character.IsPlayer()) { return false; } Tameable component = ((Component)character).GetComponent<Tameable>(); if ((Object)(object)component == (Object)null || !component.IsTamed()) { return false; } ZNetView nview = character.m_nview; if ((Object)(object)nview == (Object)null || !nview.IsValid() || !nview.IsOwner()) { return false; } return !HasDifferentClaimedOwner(nview.GetZDO()); } private static bool HasDifferentClaimedOwner(ZDO zdo) { Player localPlayer = Player.m_localPlayer; if (zdo == null || (Object)(object)localPlayer == (Object)null) { return false; } string[] array = new string[4] { "ownerName", "OwnerName", "tameOwnerName", "TameOwnerName" }; foreach (string text in array) { string text2 = zdo.GetString(text, ""); if (!string.IsNullOrEmpty(text2)) { return !string.Equals(text2, localPlayer.GetPlayerName(), StringComparison.Ordinal); } } array = new string[4] { "owner", "Owner", "tameOwner", "TameOwner" }; foreach (string text3 in array) { long num = zdo.GetLong(text3, 0L); if (num != 0L) { return num != localPlayer.GetPlayerID(); } } return false; } private static IEnumerable<Character> GetNearbyOwnedTames(Vector3 center, float radius) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) List<Character> list = new List<Character>(); foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)(object)allCharacter == (Object)null) && IsOwnedTame(allCharacter) && !allCharacter.IsAttached() && Vector3.Distance(((Component)allCharacter).transform.position, center) <= radius) { list.Add(allCharacter); } } return list; } public static void TeleportNearbyTames(Vector3 sourceCenter, Quaternion sourceRotation, Vector3 targetCenter, Quaternion targetRotation, float searchRadius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) if (searchRadius <= 0f) { return; } Rigidbody val3 = default(Rigidbody); foreach (Character nearbyOwnedTame in GetNearbyOwnedTames(sourceCenter, searchRadius)) { int instanceID = ((Object)nearbyOwnedTame).GetInstanceID(); if (teleportedTames.Add(instanceID)) { Vector3 val = ((Component)nearbyOwnedTame).transform.position - sourceCenter; val.y = 0f; Vector3 val2 = Quaternion.Inverse(sourceRotation) * val; Vector3 position = targetCenter + targetRotation * val2 + Vector3.up; ((Component)nearbyOwnedTame).transform.position = position; ((Component)nearbyOwnedTame).transform.rotation = targetRotation * Quaternion.Inverse(sourceRotation) * ((Component)nearbyOwnedTame).transform.rotation; if (((Component)nearbyOwnedTame).TryGetComponent<Rigidbody>(ref val3)) { val3.velocity = Vector3.zero; val3.angularVelocity = Vector3.zero; } } } } public static void TeleportShipTames(Ship ship, Vector3 targetCenter, Quaternion targetRotation) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ship == (Object)null) && MagicPortalFluid.ConfigShipPortalTransportTames.Value == MagicPortalFluid.Toggle.On) { TeleportNearbyTames(((Component)ship).transform.position, ((Component)ship).transform.rotation, targetCenter, targetRotation, TameTransportRadius); } } public static void TeleportPortalTames(Vector3 sourceCenter, Vector3 targetCenter, Quaternion targetRotation) { //IL_0036: 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_003b: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (MagicPortalFluid.ConfigPortalTransportTames.Value == MagicPortalFluid.Toggle.On) { teleportedTames.Clear(); Quaternion sourceRotation = (((Object)(object)Player.m_localPlayer != (Object)null) ? ((Component)Player.m_localPlayer).transform.rotation : Quaternion.identity); TeleportNearbyTames(sourceCenter, sourceRotation, targetCenter, targetRotation, TameTransportRadius); } } public static void TeleportShip(Ship ship, Vector3 targetPos, Quaternion targetRotation) { //IL_0010: 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) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0078: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)ship == (Object)null)) { _ = ((Component)ship).transform.position; offset = targetRotation * Vector3.forward * (MagicPortalFluid.wacky9_portalBoatOffset.Value + 1f); WaterVolume val = null; WaterVolume val2 = null; float num = Floating.GetWaterLevel(targetPos, ref val); float num2 = Floating.GetWaterLevel(((Component)ship).transform.position, ref val2); if (float.IsNaN(num) || float.IsNaN(num2)) { num = targetPos.y; num2 = ((Component)ship).transform.position.y; } float num3 = Mathf.Clamp(num - num2, -5f, 5f); targetPos.y += num3; ((Component)ship).transform.position = targetPos; ((Component)ship).transform.rotation = targetRotation; holdVelocity = targetPos; TeleportShipTames(ship, targetPos, targetRotation); } } public unsafe static IEnumerator FreakingWaitforTargetPortalShipTeleport(Ship ship, Vector3 targetPos, Quaternion targetRotation) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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) yield return (object)new WaitForSeconds(0.9f); try { if (!((Object)(object)ship == (Object)null)) { string[] obj = new string[6] { "RMP Teleporting Ship, ", ((Object)ship).name, " Current Position ", ((object)((Component)ship).transform.position/*cast due to .constrained prefix*/).ToString(), " Transport Position ", null }; Vector3 val = holdposition; obj[5] = ((object)(*(Vector3*)(&val))/*cast due to .constrained prefix*/).ToString(); ZLog.Log((object)string.Concat(obj)); TeleportShip(ship, targetPos, targetRotation); } } finally { ShipisTargetPortal = false; } } public static IEnumerator WaitForTeleportCompletion() { Player player = Player.m_localPlayer; if ((Object)(object)player == (Object)null) { yield break; } float deadline = Time.realtimeSinceStartup + 20f; while (((Character)player).IsTeleporting() && Time.realtimeSinceStartup < deadline) { yield return (object)new WaitForSeconds(0.5f); } while ((Object)(object)Ship.GetLocalShip() == (Object)null && Time.realtimeSinceStartup < deadline) { yield return (object)new WaitForSeconds(0.5f); } if ((Object)(object)Ship.GetLocalShip() == (Object)null) { ZLog.LogWarning((object)"Timed out waiting for the local ship after teleport."); relativePositions.Clear(); ShipisTargetPortal = false; yield break; } float y = holdVelocity.y; Ship shipFind = Ship.GetLocalShip(); if ((Object)(object)shipFind == (Object)null) { ZLog.LogError((object)"Ship reference is null during player teleport adjustment!"); relativePositions.Clear(); ShipisTargetPortal = false; yield break; } if (float.IsNaN(y)) { _ = ((Component)shipFind).transform.position.y; } ZLog.Log((object)($" Current position for Ship: {((Component)shipFind).transform.position} " + relativePositions.Keys.Count + " On Board")); yield return (object)new WaitForSeconds(1f); shipFind.UpdateOwner(); TeleportShipTames(shipFind, holdposition, holdrotation); foreach (Player kvp in shipFind.m_players) { if (!relativePositions.TryGetValue(kvp.GetPlayerName(), out var vp)) { ZLog.LogError((object)("Missing relative position for player: " + kvp.GetPlayerName())); continue; } while ((Object)(object)kvp != (Object)null && ((Character)kvp).IsTeleporting() && Time.realtimeSinceStartup < deadline) { yield return (object)new WaitForSeconds(0.5f); } ZLog.Log((object)$"Player relative stored position {kvp.GetPlayerName()}: {vp}"); Vector3 val = ((Component)shipFind).transform.TransformPoint(vp); ZLog.Log((object)$"Setting relative position for {kvp.GetPlayerName()}: {val}"); ((Component)kvp).transform.position = val; } relativePositions.Clear(); ShipisTargetPortal = false; } } internal static void HandleRemoteTeleport(long sender, Vector3 position) { } internal static bool PlayerBoatChecker(TeleportWorld __instance, Player player) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_008b: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00a5: 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_00af: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) Ship val = ShipTeleportHelper.FindShip(player); if ((Object)(object)val != (Object)null) { ShipTeleportHelper.PlayerisOnShip = true; if (val.IsOwner()) { object obj; if (__instance == null) { obj = null; } else { ZNetView nview = __instance.m_nview; obj = ((nview != null) ? nview.GetZDO() : null); } if (obj == null || ZDOMan.instance == null) { ZLog.LogError((object)"Unable to resolve portal ZDO for boat teleport."); return false; } ZDO zDO = ZDOMan.instance.GetZDO(__instance.m_nview.GetZDO().GetConnectionZDOID((ConnectionType)1)); if (zDO == null) { ZLog.LogError((object)"Connected portal ZDO was null for boat teleport."); return false; } Vector3 position = zDO.GetPosition(); Quaternion rotation = zDO.GetRotation(); Vector3 val2 = rotation * Vector3.forward; Vector3 pos = position + val2 * __instance.m_exitDistance + Vector3.up; return BoatPlayerTP(val, player, position, rotation, val2, pos); } return false; } ShipTeleportHelper.PlayerisOnShip = false; return true; } public unsafe static bool BoatPlayerTP(Ship ship, Player player, Vector3 position, Quaternion rotation, Vector3 vector, Vector3 pos) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_00c4: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)ship == (Object)null || (Object)(object)player == (Object)null || (Object)(object)MagicPortalFluid.context == (Object)null) { ShipTeleportHelper.ShipisTargetPortal = false; ZLog.LogError((object)"BoatPlayerTP received invalid state for ship teleport."); return false; } ShipTeleportHelper.StoreRelativePositions(ship); Game instance = Game.instance; if (instance != null) { instance.IncrementPlayerStat((PlayerStatType)15, 1f, false); } float num = Random.Range(0.5f, 3f); Vector3 val = rotation * Vector3.forward * (MagicPortalFluid.wacky9_portalBoatOffset.Value * num); ShipTeleportHelper.holdposition = pos + val; ShipTeleportHelper.holdrotation = rotation; Ship localShip = Ship.GetLocalShip(); foreach (Player player2 in ship.m_players) { if ((Object)(object)player2 == (Object)null) { ZLog.LogError((object)"Null player found in ship.m_players!"); continue; } ((Character)player2).TeleportTo(pos + val, rotation, true); ZLog.Log((object)("RMP Boat TP Player, " + player2.GetPlayerName())); } if ((Object)(object)localShip == (Object)null) { ShipTeleportHelper.ShipisTargetPortal = false; ZLog.Log((object)"RMP Ship is null!"); return false; } if (!ship.IsOwner()) { ZLog.Log((object)"RMP Ship not owner!"); } if (ShipTeleportHelper.ShipisTargetPortal) { ((MonoBehaviour)MagicPortalFluid.context).StartCoroutine(ShipTeleportHelper.FreakingWaitforTargetPortalShipTeleport(localShip, ShipTeleportHelper.holdposition, rotation)); } else { string[] obj = new string[6] { "RMP Teleporting Ship, ", ((Object)localShip).name, " Current Position ", ((object)((Component)localShip).transform.position/*cast due to .constrained prefix*/).ToString(), " Transport Position ", null }; Vector3 holdposition = ShipTeleportHelper.holdposition; obj[5] = ((object)(*(Vector3*)(&holdposition))/*cast due to .constrained prefix*/).ToString(); ZLog.Log((object)string.Concat(obj)); ShipTeleportHelper.TeleportShip(localShip, ShipTeleportHelper.holdposition, rotation); } if ((Object)(object)localShip.m_shipControlls != (Object)null) { localShip.m_shipControlls.RPC_ReleaseControl(player.GetPlayerID(), player.GetPlayerID()); } ((MonoBehaviour)MagicPortalFluid.context).StartCoroutine(ShipTeleportHelper.WaitForTeleportCompletion()); return false; } } internal class stoneportal { [HarmonyPatch(typeof(ZNetScene), "Awake")] private class StonePortalFixRMP { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static void Postfix(ZNetScene __instance) { if (!Object.op_Implicit((Object)(object)__instance) || !__instance.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode("portal"), out var value)) { return; } FixRecipe(__instance, value.GetComponent<Piece>()); if (!__instance.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode("Hammer"), out var value2)) { return; } ItemDrop component = value2.GetComponent<ItemDrop>(); if (component != null) { List<GameObject> pieces = component.m_itemData.m_shared.m_buildPieces.m_pieces; if (!pieces.Contains(value)) { pieces.Add(value); } } } } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(1)] private const string PREFAB = "portal"; [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] private static void FixRecipe(ZNetScene zs, Piece piece) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)piece)) { return; } piece.m_enabled = true; piece.m_category = PiecePrefabManager.GetCategory("Portals"); piece.m_craftingStation = null; CraftingStation craftingStation = default(CraftingStation); if (zs.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode(MagicPortalFluid.OrginalStonePortalconfigCraftingStation.Value), out var value) && value.TryGetComponent<CraftingStation>(ref craftingStation)) { piece.m_craftingStation = craftingStation; } piece.m_description = "$piece_portal_description"; piece.m_resources = (from req in (from s in MagicPortalFluid.OrginalStonePortalconfigRequirements.Value.Split(new char[1] { ',' }) select s.Split(new char[1] { ':' })).Select<string[], Requirement>((Func<string[], Requirement>)delegate(string[] s) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown Requirement val = new Requirement(); string text = s[0]; if (!zs.m_namedPrefabs.TryGetValue(StringExtensionMethods.GetStableHashCode(text), out var value2)) { return val; } val.m_resItem = value2.GetComponent<ItemDrop>(); val.m_amount = 1; if (s.Length > 1) { int.TryParse(s[1], out val.m_amount); } return val; }) where Object.op_Implicit((Object)(object)req.m_resItem) select req).ToArray(); } } } namespace RareMagicPortal_3_Plus { internal class TargetPortalPatches { [HarmonyPatch(typeof(Minimap), "SetMapMode")] public class LeavePortalModeOnMapCloseMagicPortal { internal static void Postfix(MapMode mode) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 if ((int)mode != 2) { MagicPortalFluid.Teleporting = false; } } } [HarmonyPatch(typeof(Minimap), "OnMapLeftClick")] internal class MapLeftClickForRareMagic { internal class SkipPortalException2 : Exception { } [HarmonyPriority(500)] internal static bool Prefix() { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: 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_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) if (!MagicPortalFluid.Teleporting) { return true; } if (!Chainloader.PluginInfos.ContainsKey("org.bepinex.plugins.targetportal")) { return true; } string text = null; Dictionary<PinData, ZDO> activePins = functions.GetActivePins(); Dictionary<PinData, bool> dictionary = activePins.Keys.Where((PinData pin) => pin != null).ToDictionary((PinData pin) => pin, (PinData pin) => pin.m_save); PinData closestPin; try { foreach (PinData key in dictionary.Keys) { key.m_save = true; } Minimap instance = Minimap.instance; closestPin = instance.GetClosestPin(instance.ScreenToWorldPoint(Input.mousePosition), instance.m_removeRadius * (instance.m_largeZoom * 2f), true); } finally { foreach (KeyValuePair<PinData, bool> item in dictionary) { if (item.Key != null) { item.Key.m_save = item.Value; } } } if (closestPin == null) { throw new SkipPortalException2(); } if (!activePins.TryGetValue(closestPin, out var value)) { throw new SkipPortalException2(); } text = value.GetString("tag", ""); if (text == null) { throw new SkipPortalException2(); } Ship val = Ships.ShipTeleportHelper.FindShip(Player.m_localPlayer); if ((Object)(object)val != (Object)null) { if (!val.IsOwner()) { ((Character)Player.m_localPlayer).Message((MessageType)2, "Only the owner of Zone/ship can activate tp.", 0, (Sprite)null, false); throw new SkipPortalException2(); } ZLog.Log((object)"RMP TargetPortal with Ship Owner, "); Vector3 position = value.GetPosition(); Quaternion rotation = value.GetRotation(); Vector3 val2 = rotation * Vector3.forward; Vector3 pos = position + val2 * 1f + Vector3.up; Ships.ShipTeleportHelper.ShipisTargetPortal = true; Ships.BoatPlayerTP(val, Player.m_localPlayer, position, rotation, val2, pos); throw new SkipPortalException2(); } if (!((Humanoid)Player.m_localPlayer).IsTeleportable(false)) { ((Character)Player.m_localPlayer).Message((MessageType)2, "$msg_noteleport", 0, (Sprite)null, false); return false; } if (PortalColorLogic.CrystalandKeyLogic(text, value.GetString(MagicPortalFluid._portalID, ""))) { ZLog.Log((object)"Teleportation TRIGGER from TargetPortal, Passed RMP"); return true; } throw new SkipPortalException2(); } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] [return: <47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(2)] internal static Exception Finalizer(Exception __exception) { if (!(__exception is SkipPortalException2)) { return __exception; } return null; } } [HarmonyPatch(typeof(Minimap), "Start")] [HarmonyPriority(200)] public class AddMinimapPortalIconRMP { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] internal static void Postfix(Minimap __instance) { } } } } namespace RareMagicPortal_3_Plus.PortalMode { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] public abstract class BasePopup : MonoBehaviour { public GameObject popupPrefab; internal GameObject Panel; internal GameObject Lists; protected GameObject popupInstance; protected Dropdown modeDropdown; protected Button submitButton; protected Text promptText; protected Button closeButton; public void ShowPopup(Action<PortalModeClass.PortalMode, ModeSelectionPopup> onSubmit, string color, string PortalName, string zdo) { //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Expected O, but got Unknown popupInstance = Object.Instantiate<GameObject>(MagicPortalFluid.uiasset.LoadAsset<GameObject>("RMPUIpop")); popupInstance.GetComponentInChildren<Canvas>().sortingOrder = 1530; Panel = ((Component)popupInstance.transform.Find("Canvas/MainPanel/Panel")).gameObject; closeButton = ((Component)popupInstance.transform.Find("Canvas/MainPanel/Close")).GetComponent<Button>(); Lists = ((Component)Panel.transform.Find("Lists")).gameObject; modeDropdown = ((Component)Lists.transform.Find("PortalMode/Dropdown")).GetComponent<Dropdown>(); if ((Object)(object)modeDropdown == (Object)null) { Debug.LogError((object)"Popup components not found. Please ensure the prefab has modeDropdown."); return; } if ((Object)(object)Player.m_localPlayer != (Object)null && !InventoryGui.IsVisible()) { InventoryGui.instance.Show((Container)null, 1); } submitButton = ((Component)Panel.transform.Find("SubmitButton/Button")).GetComponent<Button>(); Transform obj = Panel.transform.Find("ModeDescriptionText/Text"); promptText = ((obj != null) ? ((Component)obj).GetComponent<Text>() : null); if ((Object)(object)modeDropdown == (Object)null || (Object)(object)submitButton == (Object)null) { Debug.LogError((object)"Popup components not found. Please ensure the prefab has ModeDropdown and SubmitButton."); return; } if ((Object)(object)promptText != (Object)null) { promptText.text = "Select Portal Mode: or else"; } PopulateDropdown(); ((UnityEvent)closeButton.onClick).AddListener(new UnityAction(CloseUI)); ((UnityEvent)submitButton.onClick).AddListener((UnityAction)delegate { OnSubmit(onSubmit, color, PortalName, zdo); }); } private void PopulateDropdown() { List<string> list = new List<string>(Enum.GetNames(typeof(PortalModeClass.PortalMode))); modeDropdown.ClearOptions(); modeDropdown.AddOptions(list); } private void CloseUI() { if ((Object)(object)popupInstance != (Object)null) { ((UnityEventBase)closeButton.onClick).RemoveAllListeners(); ((UnityEventBase)submitButton.onClick).RemoveAllListeners(); Object.Destroy((Object)(object)popupInstance); popupInstance = null; } ModeSelectionPopup._popupInstance = null; } protected virtual void OnSubmit(Action<PortalModeClass.PortalMode, ModeSelectionPopup> onSubmit, string color, string PortalName, string zdo) { PortalModeClass.PortalMode value = (PortalModeClass.PortalMode)modeDropdown.value; onSubmit?.Invoke(value, ModeSelectionPopup._popupInstance); Object.Destroy((Object)(object)popupInstance); popupInstance = null; } } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] public class ModeSelectionPopup : BasePopup { public static ModeSelectionPopup _popupInstance; public GameObject password; public InputField passwordInputField; public GameObject coordinates; public InputField coordinatesInputField; public GameObject transportNet; public InputField transportNetInputField; public GameObject allowedUsers; public InputField allowedUsersInputField; public InputField addBlockField; public InputField addAllowField; public InputField weightField; public GameObject GuildsGame; public Dropdown GuilddropField; public Toggle allowEverythingBox; public Toggle hoverNameBox; public Toggle crystalsKeysBox; public GameObject crystalsKeysGameobject; public Toggle fastTeleportBox; public Image crystalsKeysBackgroundImage; public Toggle useItemInsteadBox; private Color currentcolor; private string colorName; private string colorNameLower; public PortalModeClass.PortalMode selectedMode; public string portalName; public string zdo; public void DestorySelf() { _popupInstance = null; Object.Destroy((Object)(object)popupInstance); popupInstance = null; } public void ShowModeSelectionPopup(Action<PortalModeClass.PortalMode, ModeSelectionPopup> onSubmit, string color, string PortalName, string Zdo) { //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_0425: Unknown result type (might be due to invalid IL or missing references) //IL_0570: Unknown result type (might be due to invalid IL or missing references) //IL_057a: Expected O, but got Unknown ShowPopup(onSubmit, color, PortalName, Zdo); _popupInstance = this; password = ((Component)Lists.transform.Find("PasswordInputField")).gameObject; Transform obj = Lists.transform.Find("PasswordInputField/InputField"); passwordInputField = ((obj != null) ? ((Component)obj).GetComponent<InputField>() : null); coordinates = ((Component)Lists.transform.Find("CoordinatesInputField")).gameObject; Transform obj2 = Lists.transform.Find("CoordinatesInputField/InputField"); coordinatesInputField = ((obj2 != null) ? ((Component)obj2).GetComponent<InputField>() : null); transportNet = ((Component)Lists.transform.Find("TransportNet")).gameObject; Transform obj3 = Lists.transform.Find("TransportNet/InputField"); transportNetInputField = ((obj3 != null) ? ((Component)obj3).GetComponent<InputField>() : null); allowedUsers = ((Component)Lists.transform.Find("AllowedUsers")).gameObject; Transform obj4 = Lists.transform.Find("AllowedUsers/InputField"); allowedUsersInputField = ((obj4 != null) ? ((Component)obj4).GetComponent<InputField>() : null); Transform obj5 = Lists.transform.Find("AddRestrict/InputField"); addBlockField = ((obj5 != null) ? ((Component)obj5).GetComponent<InputField>() : null); Transform obj6 = Lists.transform.Find("AddAllow/InputField"); addAllowField = ((obj6 != null) ? ((Component)obj6).GetComponent<InputField>() : null); Transform obj7 = Lists.transform.Find("Weight/InputField"); weightField = ((obj7 != null) ? ((Component)obj7).GetComponent<InputField>() : null); GuildsGame = ((Component)Lists.transform.Find("GuildInputField")).gameObject; Transform obj8 = Lists.transform.Find("GuildInputField/Dropdown"); GuilddropField = ((obj8 != null) ? ((Component)obj8).GetComponent<Dropdown>() : null); Transform obj9 = Lists.transform.Find("AllowEverything/Toggle"); allowEverythingBox = ((obj9 != null) ? ((Component)obj9).GetComponent<Toggle>() : null); Transform obj10 = Lists.transform.Find("DisplayPortalName/Toggle"); hoverNameBox = ((obj10 != null) ? ((Component)obj10).GetComponent<Toggle>() : null); Transform obj11 = Lists.transform.Find("CrystalKeyMode/Toggle"); crystalsKeysBox = ((obj11 != null) ? ((Component)obj11).GetComponent<Toggle>() : null); Transform obj12 = Lists.transform.Find("UseItemInstead/Toggle"); useItemInsteadBox = ((obj12 != null) ? ((Component)obj12).GetComponent<Toggle>() : null); crystalsKeysGameobject = ((Component)Lists.transform.Find("CrystalKeyMode")).gameObject; Transform obj13 = Lists.transform.Find("FastTeleport/Toggle"); fastTeleportBox = ((obj13 != null) ? ((Component)obj13).GetComponent<Toggle>() : null); Transform obj14 = Lists.transform.Find("CrystalKeyMode/Toggle/Background"); crystalsKeysBackgroundImage = ((obj14 != null) ? ((Component)obj14).GetComponent<Image>() : null); if ((Object)(object)passwordInputField == (Object)null || (Object)(object)coordinatesInputField == (Object)null || (Object)(object)transportNetInputField == (Object)null) { Debug.LogError((object)"Popup components not found. Please ensure the prefab has all necessary components."); return; } ((UnityEvent<int>)(object)modeDropdown.onValueChanged).AddListener((UnityAction<int>)delegate { OnModeChanged(); }); ((UnityEvent<bool>)(object)crystalsKeysBox.onValueChanged).AddListener((UnityAction<bool>)delegate { OnCrystalKeyChange(); }); if ((Object)(object)useItemInsteadBox != (Object)null) { ((UnityEvent<bool>)(object)useItemInsteadBox.onValueChanged).AddListener((UnityAction<bool>)delegate { OnUseItemInsteadChanged(); }); } password.SetActive(false); coordinates.SetActive(false); transportNet.SetActive(false); allowedUsers.SetActive(false); crystalsKeysGameobject.SetActive(false); GuildsGame.SetActive(false); currentcolor = PortalColorLogic.PortalColors[color].HexName; ((Graphic)crystalsKeysBackgroundImage).color = currentcolor; colorName = color; colorNameLower = color.ToLower(); portalName = PortalName; zdo = Zdo; selectedMode = PortalModeClass.GetCurrentMode(PortalName, zdo); PortalColorLogic.RMP.LogMessage((object)("Selected Mode is " + selectedMode)); modeDropdown.value = (int)selectedMode; crystalsKeysBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].CrystalActive; if ((Object)(object)useItemInsteadBox != (Object)null) { ((Component)useItemInsteadBox).gameObject.SetActive(false); useItemInsteadBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].UseItemInstead; } UpdateUIForMode(selectedMode); OnCrystalKeyChange(); PopulateSelected(); ((UnityEventBase)submitButton.onClick).RemoveAllListeners(); ((UnityEvent)submitButton.onClick).AddListener((UnityAction)delegate { OnSubmit(onSubmit, color, PortalName, zdo); }); } private void PopulateSelected() { switch (selectedMode) { case PortalModeClass.PortalMode.PasswordLock: if (PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].UseItemInstead) { passwordInputField.text = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].RequiredItem; } else { passwordInputField.text = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].Password; } crystalsKeysBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].CrystalActive; break; case PortalModeClass.PortalMode.OneWayPasswordLock: if (PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].UseItemInstead) { passwordInputField.text = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].RequiredItem; } else { passwordInputField.text = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].Password; } crystalsKeysBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].CrystalActive; break; case PortalModeClass.PortalMode.CordsPortal: { string coords = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].Coords; coordinatesInputField.text = coords; crystalsKeysBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].CrystalActive; break; } case PortalModeClass.PortalMode.TransportNetwork: transportNetInputField.text = portalName; transportNetInputField.readOnly = true; break; case PortalModeClass.PortalMode.AllowedUsersOnly: { crystalsKeysBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].CrystalActive; if (!MagicPortalFluid.GuildsLoaded || !API.IsLoaded()) { break; } GuildsGame.SetActive(true); List<Guild> guilds = API.GetGuilds(); GuilddropField.ClearOptions(); List<string> list = new List<string> { "None" }; list.AddRange(guilds.Select([<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] (Guild g) => g.Name)); GuilddropField.AddOptions(list); string assignedGuild = PortalColorLogic.PortalN.Portals[portalName].GuildOnly; if (string.IsNullOrEmpty(assignedGuild)) { GuilddropField.value = 0; break; } int num = list.FindIndex((string g) => g.Equals(assignedGuild, StringComparison.OrdinalIgnoreCase)); if (num >= 0) { GuilddropField.value = num; } break; } case PortalModeClass.PortalMode.CrystalKeyMode: crystalsKeysBox.isOn = true; break; case PortalModeClass.PortalMode.RandomTeleport: crystalsKeysBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].CrystalActive; break; case PortalModeClass.PortalMode.OneWay: crystalsKeysBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].CrystalActive; break; } allowEverythingBox.isOn = PortalColorLogic.PortalN.Portals[portalName].TeleportAnything; fastTeleportBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].FastTeleport; hoverNameBox.isOn = PortalColorLogic.PortalN.Portals[portalName].PortalZDOs[zdo].ShowName; addBlockField.text = ((PortalColorLogic.PortalN.Portals[portalName].AdditionalProhibitItems != null) ? string.Join(",", PortalColorLogic.PortalN.Portals[portalName].AdditionalProhibitItems) : string.Empty); addAllowField.text = ((PortalColorLogic.PortalN.Portals[portalName].AdditionalAllowItems != null) ? string.Join(",", PortalColorLogic.PortalN.Portals[portalName].AdditionalAllowItems) : string.Empty); allowedUsersInputField.text = ((PortalColorLogic.PortalN.Portals[portalName].AllowedUsers != null) ? string.Join(",", PortalColorLogic.PortalN.Portals[portalName].AllowedUsers) : string.Empty); weightField.text = PortalColorLogic.PortalN.Portals[portalName].MaxWeight.ToString(); } private void OnModeChanged() { selectedMode = (PortalModeClass.PortalMode)modeDropdown.value; UpdateModeDescription(); OnCrystalKeyChange(); UpdateUIForMode(selectedMode); PopulateSelected(); } private void OnCrystalKeyChange() { UpdateModeDescription(); if (crystalsKeysBox.isOn && ((UIBehaviour)crystalsKeysBox).IsActive()) { Text obj = promptText; obj.text += $" <color={colorNameLower}> {colorName} Key or {MagicPortalFluid.ConfigCrystalsConsumable.Value} Crystal required. </color>"; } } private void UpdateModeDescription() { promptText.text = GetModeDescription(selectedMode); } private void UpdateUIForMode(PortalModeClass.PortalMode selectedMode) { GuildsGame.SetActive(false); password.SetActive(selectedMode == PortalModeClass.PortalMode.PasswordLock || selectedMode == PortalModeClass.PortalMode.OneWayPasswordLock); coordinates.SetActive(selectedMode == PortalModeClass.PortalMode.CordsPortal); transportNet.SetActive(selectedMode == PortalModeClass.PortalMode.TransportNetwork); allowedUsers.SetActive(selectedMode == PortalModeClass.PortalMode.AllowedUsersOnly || selectedMode == PortalModeClass.PortalMode.PasswordLock || selectedMode == PortalModeClass.PortalMode.OneWayPasswordLock); crystalsKeysGameobject.SetActive(selectedMode == PortalModeClass.PortalMode.TargetPortal || selectedMode == PortalModeClass.PortalMode.PasswordLock || selectedMode == PortalModeClass.PortalMode.OneWayPasswordLock || selectedMode == PortalModeClass.PortalMode.OneWay || selectedMode == PortalModeClass.PortalMode.CordsPortal || selectedMode == PortalModeClass.PortalMode.CrystalKeyMode || selectedMode == PortalModeClass.PortalMode.RandomTeleport); if ((Object)(object)useItemInsteadBox != (Object)null) { bool flag = selectedMode == PortalModeClass.PortalMode.PasswordLock || selectedMode == PortalModeClass.PortalMode.OneWayPasswordLock; ((Component)useItemInsteadBox).gameObject.SetActive(flag); if (flag) { OnUseItemInsteadChanged(); } else { promptText.text = GetModeDescription(selectedMode); } } } private string GetModeDescription(PortalModeClass.PortalMode mode) { return mode switch { PortalModeClass.PortalMode.Normal => "Normal: Standard portal behavior.", PortalModeClass.PortalMode.TargetPortal => "Tareget Portal: You walk into it and a map appears, you click on the portal visual to be transported. ", PortalModeClass.PortalMode.CrystalKeyMode => "Crystal and Key: This is just Crystal&Key mode by itself, a lot of other modes also have crystal and key checkbox that can be enabled. ", PortalModeClass.PortalMode.PasswordLock => "Password Lock: Requires a password to use the portal. Then that playername is added to allowed list.", PortalModeClass.PortalMode.OneWay => "One-Way: Allows travel in one direction only. Deactives whatever portal this is connected to.", PortalModeClass.PortalMode.OneWayPasswordLock => "One-Way Password Lock: Allows travel in one direction only, but only if you enter the password. Afterwords that playername is added to allow list. Deactives whatever portal this is connected to.", PortalModeClass.PortalMode.AllowedUsersOnly => "Allowed Users Only: Only specified users can use the portal.", PortalModeClass.PortalMode.CordsPortal => "Coordinates Portal: Transports player to specified coordinates.", PortalModeClass.PortalMode.TransportNetwork => "Transport Network: Connects to a network of predefined locations. The name gets hidden, portal does not appear active. If you type name into chat/speak a correct name, you are taken there.", PortalModeClass.PortalMode.RandomTeleport => "Random Telport: This will teleport a person to a random coordinate anywhere on the map, dangerous. ", PortalModeClass.PortalMode.AdminOnly => "Admin Only: Only admins can use this portal. ", PortalModeClass.PortalMode.Rainbow => "Rainbow: This is a standard portal, but with flashing colors.", _ => "Select a mode to see its description.", }; } protected override void OnSubmit(Action<PortalModeClass.PortalMode, ModeSelectionPopup> onSubmit, string color, string PortalName, string zdo) { PortalModeClass.PortalMode value = (PortalModeClass.PortalMode)modeDropdown.value; onSubmit?.Invoke(value, _popupInstance); } private void OnUseItemInsteadChanged() { if ((Object)(object)useItemInsteadBox == (Object)null || (Object)(object)password == (Object)null) { return; } Transform obj = password.transform.Find("Text"); Text val = ((obj != null) ? ((Component)obj).GetComponent<Text>() : null); if ((Object)(object)val != (Object)null) { val.text = (useItemInsteadBox.isOn ? "Required Item" : "Enter Password"); } if ((Object)(object)passwordInputField != (Object)null) { try { Graphic placeholder = passwordInputField.placeholder; Text val2 = (Text)(object)((placeholder is Text) ? placeholder : null); if ((Object)(object)val2 != (Object)null) { val2.text = (useItemInsteadBox.isOn ? "Enter A Gameobject" : "Enter Password"); } } catch { } } if ((Object)(object)promptText != (Object)null) { if (useItemInsteadBox.isOn) { promptText.text = " Item Required: Requires a player to have this item on them to passthrough once. Then that player is added to the allowed list. Does not consume the item"; } else { promptText.text = GetModeDescription(selectedMode); } } } } [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] public class PasswordPopup : MonoBehaviour { public GameObject popupPrefab; public static GameObject _popupInstance; private InputField _passwordInputField; private Button _submitButton; private Button _closeButton; public void ShowPasswordPopup(Action<string> onSubmit) { //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Expected O, but got Unknown if ((Object)(object)_popupInstance != (Object)null) { return; } popupPrefab = Object.Instantiate<GameObject>(MagicPortalFluid.uiasset.LoadAsset<GameObject>("RMPassPopup")); if ((Object)(object)popupPrefab == (Object)null) { Debug.LogError((object)"Failed to load popup prefab."); return; } if ((Object)(object)Player.m_localPlayer != (Object)null && !InventoryGui.IsVisible()) { InventoryGui.instance.Show((Container)null, 1); } popupPrefab.GetComponentInChildren<Canvas>().sortingOrder = 1531; _passwordInputField = ((Component)popupPrefab.transform.Find("Canvas/MainPanel/Panel/PasswordInputField")).GetComponentInChildren<InputField>(); _submitButton = ((Component)popupPrefab.transform.Find("Canvas/MainPanel/Panel/SubmitButton")).GetComponentInChildren<Button>(); _closeButton = ((Component)popupPrefab.transform.Find("Canvas/MainPanel/Close")).GetComponentInChildren<Button>(); ((UnityEvent)_submitButton.onClick).AddListener((UnityAction)delegate { OnSubmit(onSubmit); }); ((UnityEvent)_closeButton.onClick).AddListener((UnityAction)delegate { CloseUI(); }); _popupInstance = popupPrefab; } private void OnSubmit(Action<string> onSubmit) { string text = _passwordInputField.text; onSubmit?.Invoke(text); CloseUI(); } private void CloseUI() { Object.Destroy((Object)(object)popupPrefab); _popupInstance = null; } } [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(1)] [<47be4cb3-04e4-43fd-b61f-ec9e9307517e>Nullable(0)] public class PortalModeClass { [<21ad733a-f5d2-4dae-82d4-f39e86d247cc>NullableContext(0)] public enum PortalMode { Normal, TargetPortal, CrystalKeyMode, PasswordLock, OneWay, OneWayPasswordLock, AllowedUsersOnly, TransportNetwork, CordsPortal, Rainbow, RandomTeleport, AdminOnly } internal static bool CheckPassword(string inputPassword, string actualPassword) { return inputPassword == actualPassword; } public static void HandlePortalModeSelection(TeleportWorld portalInstance, Player player, PortalMode selectedMode, ModeSelectionPopup PopInstance) { if (!PortalColorLogic.CanModifyTargetPortalMode(PopInstance.portalName, PopInstance.zdo, player)) { ((Character)player).Message((MessageType)2, "$rmp_onlyownercanchange", 0, (Sprite)null, false); PopInstance.DestorySelf(); return; } foreach (KeyValuePair<string, P