using GadgetCore.API;
using GadgetCore.Util;
using HarmonyLib;
using System;
using System.Reflection;

namespace LoopPortal.Patches
{

  [HarmonyPatch(typeof(PlayerScript))]
  [HarmonyPatch("Interact")]
  [HarmonyGadget("LoopPortal")]
  public static class Patch_PlayerScript_Interact
  {
    [HarmonyPrefix]
    public static void Prefix(PlayerScript __instance, int id)
    {
      try
      {
        if (id == Core.npcId)
        {
          __instance.Portal(4);
        }
      }
      catch (Exception e) { Core.logger.LogConsole(e); }
    }
  }
}