Package services

Source Code of services.TeleToMDT

package services;

import l2p.extensions.scripts.Functions;
import l2p.extensions.scripts.ScriptFile;
import l2p.gameserver.model.L2Player;
import l2p.gameserver.model.instances.L2NpcInstance;
import l2p.util.Location;

public class TeleToMDT extends Functions implements ScriptFile
{
  public void onLoad()
  {
    System.out.println("Loaded Service: Teleport to Race Track");
  }

  public void onReload()
  {
  }

  public void onShutdown()
  {
  }

  public void toMDT()
  {
    L2Player player = (L2Player) getSelf();
    L2NpcInstance npc = getNpc();
    if(player == null || npc == null)
    {
      return;
    }
    if(!L2NpcInstance.canBypassCheck(player, npc))
    {
      return;
    }
    player.setVar("backCoords", player.getLoc().toXYZString());
    player.teleToLocation(12661, 181687, -3560);
  }

  public void fromMDT()
  {
    L2Player player = (L2Player) getSelf();
    L2NpcInstance npc = getNpc();
    if(player == null || npc == null)
    {
      return;
    }
    if(!L2NpcInstance.canBypassCheck(player, npc))
    {
      return;
    }
    String var = player.getVar("backCoords");
    if(var == null || var.equals(""))
    {
      teleOut();
      return;
    }
    player.teleToLocation(new Location(var));
  }

  public void teleOut()
  {
    L2Player player = (L2Player) getSelf();
    L2NpcInstance npc = getNpc();
    if(player == null || npc == null)
    {
      return;
    }
    player.teleToLocation(12902, 181011, -3563);
    show(player.isLangRus() ? "Я не знаю, как Вы попали сюда, но я могу Вас отправить за ограждение." : "I don't know from where you came here, but I can teleport you the another border side.", player, npc);
  }
}
TOP

Related Classes of services.TeleToMDT

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.