Package net.sf.l2j.gameserver.model

Examples of net.sf.l2j.gameserver.model.L2TeleportLocation


    try
    {
      con = L2DatabaseFactory.getInstance().getConnection();
      PreparedStatement statement = con.prepareStatement("SELECT Description, id, loc_x, loc_y, loc_z, price, fornoble FROM teleport");
      ResultSet rset = statement.executeQuery();
      L2TeleportLocation teleport;

      while (rset.next())
      {
        teleport = new L2TeleportLocation();

        teleport.setTeleId(rset.getInt("id"));
        teleport.setLocX(rset.getInt("loc_x"));
        teleport.setLocY(rset.getInt("loc_y"));
        teleport.setLocZ(rset.getInt("loc_z"));
        teleport.setPrice(rset.getInt("price"));
        teleport.setIsForNoble(rset.getInt("fornoble")==1);

        _teleports.put(teleport.getTeleId(), teleport);
      }

      rset.close();
      statement.close();
View Full Code Here


    private void doTeleport(L2PcInstance player, int val)
    {
       if(Config.DEBUG)
         player.sendMessage("doTeleport(L2PcInstance player, int val) is called");
        L2TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(val);
        if (list != null)
        {
            //you cannot teleport to village that is in siege Not sure about this one though
            if (SiegeManager.getInstance().getSiege(list.getLocX(), list.getLocY(), list.getLocZ()) != null)
            {
                player.sendPacket(new SystemMessage(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE));
                return;
            }
            else if(player.reduceAdena("Teleport", list.getPrice(), this, true))
            {
                if (Config.DEBUG)
                 _log.warning("Teleporting player "+player.getName()+" for CH to new location: "+list.getLocX()+":"+list.getLocY()+":"+list.getLocZ());
                player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ());
            }
        }
        else
        {
            _log.warning("No teleport destination with id:" +val);
View Full Code Here

        player.sendPacket(html);
    }

    private void doTeleport(L2PcInstance player, int val)
    {
        L2TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(val);
        if (list != null)
        {
            //you cannot teleport to village that is in siege
            if (SiegeManager.getInstance().getSiege(list.getLocX(), list.getLocY(), list.getLocZ()) != null)
            {
                player.sendPacket(new SystemMessage(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE));
                return;
            }
            else if (TownManager.getInstance().townHasCastleInSiege(list.getLocX(), list.getLocY()))
            {
                player.sendPacket(new SystemMessage(SystemMessageId.NO_PORT_THAT_IS_IN_SIGE));
                return;
            }
            else if (!Config.ALT_GAME_KARMA_PLAYER_CAN_USE_GK && player.getKarma() > 0) //karma
            {
                SystemMessage sm = new SystemMessage(SystemMessageId.S1_S2);
                sm.addString("Go away, you're not welcome here.");
                player.sendPacket(sm);
                return;
            }
            else if (list.getIsForNoble() && !player.isNoble())
            {
              String filename = "data/html/teleporter/nobleteleporter-no.htm";
              NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                html.setFile(filename);
                html.replace("%objectId%", String.valueOf(getObjectId()));
                html.replace("%npcname%", getName());
                player.sendPacket(html);
              return;
            }
            else if (player.isAlikeDead())
            {
              return;
            }
            else if (!list.getIsForNoble() && (Config.ALT_GAME_FREE_TELEPORT || player.reduceAdena("Teleport", list.getPrice(), this, true)))
            {
                if (Config.DEBUG)
                    _log.fine("Teleporting player " + player.getName() + " to new location: "
                        + list.getLocX() + ":" + list.getLocY() + ":" + list.getLocZ());
                player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);
            }
            else if(list.getIsForNoble() && (Config.ALT_GAME_FREE_TELEPORT || player.destroyItemByItemId("Noble Teleport", 6651, list.getPrice(), this, true)))
            {
              if (Config.DEBUG)
                    _log.fine("Teleporting player " + player.getName() + " to new location: "
                        + list.getLocX() + ":" + list.getLocY() + ":" + list.getLocZ());
                player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);
            }
        }
        else
        {
            _log.warning("No teleport destination with id:" + val);
View Full Code Here

    player.sendPacket(html);
  }

  private void doTeleport(L2PcInstance player, int val)
  {
    L2TeleportLocation list = TeleportLocationTable.getInstance().getTemplate(val);
    if (list != null)
    {
      if(player.reduceAdena("Teleport", list.getPrice(), player.getLastFolkNPC(), true))
      {
        if (Config.DEBUG)
          _log.fine("Teleporting player "+player.getName()+" to new location: "+list.getLocX()+":"+list.getLocY()+":"+list.getLocZ());

        // teleport
        player.teleToLocation(list.getLocX(), list.getLocY(), list.getLocZ(), true);
        player.stopMove(new L2CharPosition(list.getLocX(), list.getLocY(), list.getLocZ(), player.getHeading()));
      }
    }
    else
    {
      _log.warning("No teleport destination with id:" +val);
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.model.L2TeleportLocation

Copyright © 2018 www.massapicom. 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.