Пример #1
0
  public void goTo(L2PcInstance player) {
    if (player == null) return;

    // Go to player holding the weapon
    if (_isActivated) player.teleToLocation(_player.getX(), _player.getY(), _player.getZ(), 0);
    // Go to item on the ground
    else if (_isDropped) player.teleToLocation(_item.getX(), _item.getY(), _item.getZ(), 0);
    else player.sendMessage(_name + " isn't in the world.");
  }
Пример #2
0
  private static void teleportToCharacter(L2PcInstance activeChar, L2PcInstance target) {
    if (target.getObjectId() == activeChar.getObjectId())
      activeChar.sendPacket(SystemMessageId.CANNOT_USE_ON_YOURSELF);
    else {
      int x = target.getX();
      int y = target.getY();
      int z = target.getZ();

      activeChar.getAI().setIntention(CtrlIntention.IDLE);
      activeChar.teleToLocation(x, y, z, 0);
      activeChar.sendMessage("You have teleported to " + target.getName() + ".");
    }
  }
Пример #3
0
  private static void teleportTo(L2PcInstance activeChar, String Cords) {
    try {
      StringTokenizer st = new StringTokenizer(Cords);
      String x1 = st.nextToken();
      int x = Integer.parseInt(x1);
      String y1 = st.nextToken();
      int y = Integer.parseInt(y1);
      String z1 = st.nextToken();
      int z = Integer.parseInt(z1);

      activeChar.getAI().setIntention(CtrlIntention.IDLE);
      activeChar.teleToLocation(x, y, z, 0);

      activeChar.sendMessage("You have been teleported to " + Cords + ".");
    } catch (NoSuchElementException nsee) {
      activeChar.sendMessage("Coordinates you entered as parameter [" + Cords + "] are wrong.");
    }
  }
Пример #4
0
 private static void teleportCharacter(L2PcInstance player, int x, int y, int z) {
   player.getAI().setIntention(CtrlIntention.IDLE);
   player.teleToLocation(x, y, z, 0);
   player.sendMessage("A GM is teleporting you.");
 }
Пример #5
0
 private static void sendHome(L2PcInstance player) {
   player.teleToLocation(MapRegionTable.TeleportWhereType.Town);
   player.setIsIn7sDungeon(false);
   player.sendMessage("A GM sent you at nearest town.");
 }
Пример #6
0
  @Override
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    StringTokenizer st = new StringTokenizer(command, " ");
    command = st.nextToken(); // Get actual command

    // Get castle
    Castle castle = null;
    ClanHall clanhall = null;

    if (command.startsWith("admin_clanhall"))
      clanhall = ClanHallManager.getInstance().getClanHallById(Integer.parseInt(st.nextToken()));
    else if (st.hasMoreTokens()) castle = CastleManager.getInstance().getCastle(st.nextToken());

    if (clanhall == null && (castle == null || castle.getCastleId() < 0)) {
      showCastleSelectPage(activeChar);
      return true;
    }

    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;
    if (target instanceof L2PcInstance) player = (L2PcInstance) target;

    if (castle != null) {
      if (command.equalsIgnoreCase("admin_add_attacker")) {
        if (player == null) activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
        else castle.getSiege().registerAttacker(player);
      } else if (command.equalsIgnoreCase("admin_add_defender")) {
        if (player == null) activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
        else castle.getSiege().registerDefender(player);
      } else if (command.equalsIgnoreCase("admin_add_guard")) {
        try {
          int npcId = Integer.parseInt(st.nextToken());
          castle.getSiege().getSiegeGuardManager().addSiegeGuard(activeChar, npcId);
        } catch (Exception e) {
          activeChar.sendMessage("Usage: //add_guard npcId");
        }
      } else if (command.equalsIgnoreCase("admin_clear_siege_list")) {
        castle.getSiege().clearSiegeClan();
      } else if (command.equalsIgnoreCase("admin_endsiege")) {
        castle.getSiege().endSiege();
      } else if (command.equalsIgnoreCase("admin_list_siege_clans")) {
        castle.getSiege().listRegisterClan(activeChar);
        return true;
      } else if (command.equalsIgnoreCase("admin_move_defenders")) {
        activeChar.sendPacket(SystemMessage.sendString("Not implemented yet."));
      } else if (command.equalsIgnoreCase("admin_setcastle")) {
        if (player == null || player.getClan() == null)
          activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
        else if (player.getClan().hasCastle())
          activeChar.sendMessage(player.getName() + "'s clan already owns a castle.");
        else castle.setOwner(player.getClan());
      } else if (command.equalsIgnoreCase("admin_removecastle")) {
        L2Clan clan = ClanTable.getInstance().getClan(castle.getOwnerId());
        if (clan != null) castle.removeOwner(clan);
        else activeChar.sendMessage("Unable to remove castle for this clan.");
      } else if (command.equalsIgnoreCase("admin_spawn_doors")) {
        castle.spawnDoors(false);
      } else if (command.equalsIgnoreCase("admin_startsiege")) {
        castle.getSiege().startSiege();
      }
      showSiegePage(activeChar, castle.getName());
    } else if (clanhall != null) {
      if (command.equalsIgnoreCase("admin_clanhallset")) {
        if (player == null || player.getClan() == null)
          activeChar.sendPacket(SystemMessageId.TARGET_IS_INCORRECT);
        else if (!ClanHallManager.getInstance().isFree(clanhall.getId()))
          activeChar.sendMessage("This ClanHall isn't free!");
        else if (!player.getClan().hasHideout()) {
          ClanHallManager.getInstance().setOwner(clanhall.getId(), player.getClan());
          if (AuctionManager.getInstance().getAuction(clanhall.getId()) != null)
            AuctionManager.getInstance().getAuction(clanhall.getId()).deleteAuctionFromDB();
        } else activeChar.sendMessage("You have already a ClanHall!");
      } else if (command.equalsIgnoreCase("admin_clanhalldel")) {
        if (!ClanHallManager.getInstance().isFree(clanhall.getId())) {
          ClanHallManager.getInstance().setFree(clanhall.getId());
          AuctionManager.getInstance().initNPC(clanhall.getId());
        } else activeChar.sendMessage("This ClanHall is already Free!");
      } else if (command.equalsIgnoreCase("admin_clanhallopendoors")) {
        clanhall.openCloseDoors(true);
      } else if (command.equalsIgnoreCase("admin_clanhallclosedoors")) {
        clanhall.openCloseDoors(false);
      } else if (command.equalsIgnoreCase("admin_clanhallteleportself")) {
        L2ClanHallZone zone = clanhall.getZone();
        if (zone != null) activeChar.teleToLocation(zone.getSpawnLoc(), 0);
      }
      showClanHallPage(activeChar, clanhall);
    }
    return true;
  }