using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Portalvator")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Portalvator")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1ecc2e28-9647-471b-8872-0cef956d9094")]
[assembly: AssemblyFileVersion("1.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
namespace Portalvator;
[BepInPlugin("org.ssmvc.portalvator", "Portalvator", "1.1.0")]
[BepInProcess("valheim.exe")]
public class Portalvator : BaseUnityPlugin
{
[HarmonyPatch(typeof(Player))]
public static class PlayerPatch
{
[HarmonyPostfix]
[HarmonyPatch("TeleportTo")]
public static void TeleportToPostfix(Player __instance, Vector3 pos, Quaternion rot, ref bool distantTeleport, ref bool __result)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: 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_0029: 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)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
if (__result && distantTeleport && ZNetScene.instance.IsAreaReady(pos))
{
Vector2i zone = ZoneSystem.GetZone(((Component)__instance).transform.position);
Vector2i zone2 = ZoneSystem.GetZone(pos);
if (Mathf.Abs(zone.x - zone2.x) <= 1 && Mathf.Abs(zone.y - zone2.y) <= 1)
{
__instance.m_distantTeleport = false;
}
}
}
}
public const string PluginGUID = "org.ssmvc.portalvator";
public const string PluginName = "Portalvator";
public const string PluginVersion = "1.1.0";
private static Harmony _harmony;
public void Awake()
{
_harmony = Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "org.ssmvc.portalvator");
}
public void OnDestroy()
{
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
}