Exemplo n.º 1
0
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    StringTokenizer st = new StringTokenizer(command, " ");
    command = st.nextToken(); // Get actual command

    // Get fort
    Fort fort = null;
    int fortId = 0;
    if (st.hasMoreTokens()) {
      fortId = Integer.parseInt(st.nextToken());
      fort = FortManager.getInstance().getFortById(fortId);
    }
    // Get fort
    if ((fort == null || fortId == 0))
      // No fort specified
      showFortSelectPage(activeChar);
    else {
      L2Object target = activeChar.getTarget();
      L2PcInstance player = null;
      if (target instanceof L2PcInstance) player = (L2PcInstance) target;

      if (command.equalsIgnoreCase("admin_add_fortattacker")) {
        if (player == null)
          activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
        else {
          if (fort.getSiege().checkIfCanRegister(player))
            fort.getSiege().registerAttacker(player, true);
        }
      } else if (command.equalsIgnoreCase("admin_clear_fortsiege_list")) {
        fort.getSiege().clearSiegeClan();
      } else if (command.equalsIgnoreCase("admin_endfortsiege")) {
        fort.getSiege().endSiege();
      } else if (command.equalsIgnoreCase("admin_list_fortsiege_clans")) {
        activeChar.sendMessage(218);
      } else if (command.equalsIgnoreCase("admin_setfort")) {
        if (player == null || player.getClan() == null)
          activeChar.sendPacket(new SystemMessage(SystemMessageId.TARGET_IS_INCORRECT));
        else fort.setOwner(player.getClan(), false);
      } else if (command.equalsIgnoreCase("admin_removefort")) {
        L2Clan clan = fort.getOwnerClan();
        if (clan != null) fort.removeOwner(true);
        else activeChar.sendMessage(356);
      } else if (command.equalsIgnoreCase("admin_spawn_fortdoors")) {
        fort.resetDoors();
      } else if (command.equalsIgnoreCase("admin_startfortsiege")) {
        fort.getSiege().startSiege();
      }

      showFortSiegePage(activeChar, fort);
    }
    return true;
  }
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    // Check if the player has a clan
    if (activeChar.getClan() == null) return;

    final Castle castle = CastleManager.getInstance().getCastleById(_castleId);
    if (castle == null) return;

    // Check if leader of the clan who owns the castle?
    if ((castle.getOwnerId() != activeChar.getClanId()) || (!activeChar.isClanLeader())) return;

    final L2Clan clan = ClanTable.getInstance().getClan(_clanId);
    if (clan == null) return;

    if (!castle.getSiege().getIsRegistrationOver()) {
      if (_approved == 1) {
        if (castle.getSiege().checkIsDefenderWaiting(clan))
          castle.getSiege().approveSiegeDefenderClan(_clanId);
        else return;
      } else {
        if ((castle.getSiege().checkIsDefenderWaiting(clan))
            || (castle.getSiege().checkIsDefender(clan)))
          castle.getSiege().removeSiegeClan(_clanId);
      }
    }

    // Update the defender list
    activeChar.sendPacket(new SiegeDefenderList(castle));
  }
Exemplo n.º 3
0
 private static void showPage3(L2PcInstance activeChar, String format, String command) {
   NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
   adminReply.setFile("data/html/admin/pforge3.htm");
   adminReply.replace("%format%", format);
   adminReply.replace("%command%", command);
   activeChar.sendPacket(adminReply);
 }
Exemplo n.º 4
0
  private void listCharacters(L2PcInstance activeChar, int page) {
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players;
    // synchronized (L2World.getInstance().getAllPlayers())
    {
      players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    }

    int maxCharactersPerPage = 20;
    int maxPages = players.length / maxCharactersPerPage;

    if (players.length > maxCharactersPerPage * maxPages) maxPages++;

    // Check if number of users changed
    if (page > maxPages) page = maxPages;

    int charactersStart = maxCharactersPerPage * page;
    int charactersEnd = players.length;
    if (charactersEnd - charactersStart > maxCharactersPerPage)
      charactersEnd = charactersStart + maxCharactersPerPage;

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/charlist.htm");

    final StringBuilder replyMSG = new StringBuilder(1000);

    for (int x = 0; x < maxPages; x++) {
      int pagenr = x + 1;
      StringUtil.append(
          replyMSG,
          "<center><a action=\"bypass -h admin_show_characters "
              + x
              + "\">"
              + MessageTable.Messages[677].getMessage()
              + pagenr
              + MessageTable.Messages[215].getMessage()
              + "</a></center>");
    }

    adminReply.replace("%pages%", replyMSG.toString());
    replyMSG.setLength(0);

    for (int i = charactersStart; i < charactersEnd; i++) {
      // Add player info into new Table row
      StringUtil.append(
          replyMSG,
          "<tr><td width=80><a action=\"bypass -h admin_character_info ",
          players[i].getName(),
          "\">",
          players[i].getName(),
          "</a></td><td width=110>",
          players[i].getTemplate().className,
          "</td><td width=40>",
          String.valueOf(players[i].getLevel()),
          "</td></tr>");
    }

    adminReply.replace("%players%", replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
Exemplo n.º 5
0
  /**
   * Remove the old crystal and add new one if stage, broken crystal if break. Send messages in both
   * cases.
   *
   * @param player : The player to check on (inventory and send messages).
   * @param scd : SoulCrystalData of to take information form.
   * @param stage : Switch to determine success or fail.
   */
  private void exchangeCrystal(L2PcInstance player, SoulCrystalData scd, boolean stage) {
    QuestState st = player.getQuestState(qn);

    st.takeItems(scd.getCrystalItemId(), 1);
    if (stage) {
      player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_SUCCEEDED);
      st.giveItems(scd.getStagedItemId(), 1);
      st.playSound(QuestState.SOUND_ITEMGET);
    } else {
      int broken = scd.getBrokenItemId();
      if (broken != 0) {
        player.sendPacket(SystemMessageId.SOUL_CRYSTAL_BROKE);
        st.giveItems(broken, 1);
      }
    }
  }
Exemplo n.º 6
0
  private void showFortSelectPage(L2PcInstance activeChar) {
    int i = 0;
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/forts.htm");

    final List<Fort> forts = FortManager.getInstance().getForts();
    final StringBuilder cList = new StringBuilder(forts.size() * 100);

    for (Fort fort : forts) {
      if (fort != null) {
        StringUtil.append(
            cList,
            "<td fixwidth=90><a action=\"bypass -h admin_fortsiege ",
            String.valueOf(fort.getFortId()),
            "\">",
            fort.getName(),
            " ID: ", // Update by rocknow
            String.valueOf(fort.getFortId()),
            "</a></td>");
        i++;
      }

      if (i > 0) { // Update by rocknow
        cList.append("</tr><tr>");
        i = 0;
      }
    }

    adminReply.replace("%forts%", cList.toString());
    activeChar.sendPacket(adminReply);
  }
Exemplo n.º 7
0
 private void showFortSiegePage(L2PcInstance activeChar, Fort fort) {
   NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
   adminReply.setFile("data/html/admin/fort.htm");
   adminReply.replace("%fortName%", fort.getName());
   adminReply.replace("%fortId%", String.valueOf(fort.getFortId()));
   activeChar.sendPacket(adminReply);
 }
Exemplo n.º 8
0
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    // You cannot do anything while fishing
    if (activeChar.isFishing()) {
      activeChar.sendPacket(SystemMessageId.CANNOT_DO_WHILE_FISHING_3);
      return;
    }

    // check if the actionId is allowed
    if (_actionId < 2 || _actionId > 13) {
      Util.handleIllegalPlayerAction(
          activeChar,
          activeChar.getName()
              + " of account "
              + activeChar.getAccountName()
              + " requested an internal Social Action.",
          Config.DEFAULT_PUNISH);
      return;
    }

    if (!activeChar.isInStoreMode()
        && activeChar.getActiveRequester() == null
        && !activeChar.isAlikeDead()
        && (!activeChar.isAllSkillsDisabled() || activeChar.isInDuel())
        && activeChar.getAI().getIntention() == CtrlIntention.IDLE) {
      if (Config.DEBUG) _log.fine("Social Action: " + _actionId);

      activeChar.broadcastPacket(new SocialAction(activeChar, _actionId));
    }
  }
Exemplo n.º 9
0
  /**
   * @param activeChar
   * @throws IllegalArgumentException
   */
  private void findDualbox(L2PcInstance activeChar, int multibox) throws IllegalArgumentException {
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);

    Map<String, List<L2PcInstance>> ipMap = new HashMap<String, List<L2PcInstance>>();

    String ip = "0.0.0.0";
    L2GameClient client;

    final Map<String, Integer> dualboxIPs = new HashMap<String, Integer>();

    for (L2PcInstance player : players) {
      client = player.getClient();
      if (client.isDetached()) continue;
      else {
        ip = client.getConnection().getInetAddress().getHostAddress();
        if (ipMap.get(ip) == null) ipMap.put(ip, new ArrayList<L2PcInstance>());
        ipMap.get(ip).add(player);

        if (ipMap.get(ip).size() >= multibox) {
          Integer count = dualboxIPs.get(ip);
          if (count == null) dualboxIPs.put(ip, multibox);
          else dualboxIPs.put(ip, count + 1);
        }
      }
    }

    List<String> keys = new ArrayList<String>(dualboxIPs.keySet());
    Collections.sort(
        keys,
        new Comparator<String>() {
          public int compare(String left, String right) {
            return dualboxIPs.get(left).compareTo(dualboxIPs.get(right));
          }
        });
    Collections.reverse(keys);

    final StringBuilder results = new StringBuilder();
    for (String dualboxIP : keys) {
      StringUtil.append(
          results,
          "<a action=\"bypass -h admin_find_ip "
              + dualboxIP
              + "\">"
              + dualboxIP
              + " ("
              + dualboxIPs.get(dualboxIP)
              + ")</a><br1>");
    }

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/dualbox.htm");
    adminReply.replace("%multibox%", String.valueOf(multibox));
    adminReply.replace("%results%", results.toString());
    activeChar.sendPacket(adminReply);
  }
Exemplo n.º 10
0
 /**
  * @param activeChar
  * @param player
  */
 private void gatherCharacterInfo(L2PcInstance activeChar, L2PcInstance player, String filename) {
   String ip = "N/A";
   String account = "N/A";
   try {
     String clientInfo = player.getClient().toString();
     account =
         clientInfo.substring(clientInfo.indexOf("Account: ") + 9, clientInfo.indexOf(" - IP: "));
     ip = clientInfo.substring(clientInfo.indexOf(" - IP: ") + 7, clientInfo.lastIndexOf("]"));
   } catch (Exception e) {
   }
   NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
   adminReply.setFile("data/html/admin/" + filename);
   adminReply.replace("%name%", player.getName());
   adminReply.replace("%level%", String.valueOf(player.getLevel()));
   adminReply.replace(
       "%clan%", String.valueOf(ClanTable.getInstance().getClan(player.getClanId())));
   adminReply.replace("%xp%", String.valueOf(player.getExp()));
   adminReply.replace("%sp%", String.valueOf(player.getSp()));
   adminReply.replace("%class%", player.getTemplate().className);
   adminReply.replace("%ordinal%", String.valueOf(player.getClassId().ordinal()));
   adminReply.replace("%classid%", String.valueOf(player.getClassId()));
   adminReply.replace("%x%", String.valueOf(player.getX()));
   adminReply.replace("%y%", String.valueOf(player.getY()));
   adminReply.replace("%z%", String.valueOf(player.getZ()));
   adminReply.replace("%currenthp%", String.valueOf((int) player.getCurrentHp()));
   adminReply.replace("%maxhp%", String.valueOf(player.getMaxHp()));
   adminReply.replace("%karma%", String.valueOf(player.getKarma()));
   adminReply.replace("%currentmp%", String.valueOf((int) player.getCurrentMp()));
   adminReply.replace("%maxmp%", String.valueOf(player.getMaxMp()));
   adminReply.replace("%pvpflag%", String.valueOf(player.getPvpFlag()));
   adminReply.replace("%currentcp%", String.valueOf((int) player.getCurrentCp()));
   adminReply.replace("%maxcp%", String.valueOf(player.getMaxCp()));
   adminReply.replace("%pvpkills%", String.valueOf(player.getPvpKills()));
   adminReply.replace("%pkkills%", String.valueOf(player.getPkKills()));
   adminReply.replace("%currentload%", String.valueOf(player.getCurrentLoad()));
   adminReply.replace("%maxload%", String.valueOf(player.getMaxLoad()));
   adminReply.replace(
       "%percent%",
       String.valueOf(
           Util.roundTo(
               ((float) player.getCurrentLoad() / (float) player.getMaxLoad()) * 100, 2)));
   adminReply.replace("%patk%", String.valueOf(player.getPAtk(null)));
   adminReply.replace("%matk%", String.valueOf(player.getMAtk(null, null)));
   adminReply.replace("%pdef%", String.valueOf(player.getPDef(null)));
   adminReply.replace("%mdef%", String.valueOf(player.getMDef(null, null)));
   adminReply.replace("%accuracy%", String.valueOf(player.getAccuracy()));
   adminReply.replace("%evasion%", String.valueOf(player.getEvasionRate(null)));
   adminReply.replace("%critical%", String.valueOf(player.getCriticalHit(null, null)));
   adminReply.replace("%runspeed%", String.valueOf(player.getRunSpeed()));
   adminReply.replace("%patkspd%", String.valueOf(player.getPAtkSpd()));
   adminReply.replace("%matkspd%", String.valueOf(player.getMAtkSpd()));
   adminReply.replace("%access%", String.valueOf(player.getAccessLevel().getLevel()));
   adminReply.replace("%account%", account);
   adminReply.replace("%ip%", ip);
   activeChar.sendPacket(adminReply);
 }
Exemplo n.º 11
0
  @Override
  public void useItem(L2Playable playable, ItemInstance item, boolean forceUse) {
    if (!(playable instanceof L2PcInstance)) return;

    final L2PcInstance activeChar = (L2PcInstance) playable;
    final ItemInstance weaponInst = activeChar.getActiveWeaponInstance();
    final Weapon weaponItem = activeChar.getActiveWeaponItem();
    final int itemId = item.getItemId();

    // Check if bss can be used
    if (weaponInst == null || weaponItem == null || weaponItem.getSpiritShotCount() == 0) {
      if (!activeChar.getAutoSoulShot().contains(itemId))
        activeChar.sendPacket(SystemMessageId.CANNOT_USE_SPIRITSHOTS);
      return;
    }

    // Check if bss is already active (it can be charged over SpiritShot)
    if (activeChar.isChargedShot(ShotType.BLESSED_SPIRITSHOT)) return;

    // Check for correct grade.
    if (weaponItem.getCrystalType() != item.getItem().getCrystalType()) {
      if (!activeChar.getAutoSoulShot().contains(itemId))
        activeChar.sendPacket(SystemMessageId.SPIRITSHOTS_GRADE_MISMATCH);

      return;
    }

    // Consume bss if player has enough of them
    if (!activeChar.destroyItemWithoutTrace(
        "Consume", item.getObjectId(), weaponItem.getSpiritShotCount(), null, false)) {
      if (!activeChar.disableAutoShot(itemId))
        activeChar.sendPacket(SystemMessageId.NOT_ENOUGH_SPIRITSHOTS);

      return;
    }

    final IntIntHolder[] skills = item.getItem().getSkills();

    activeChar.sendPacket(SystemMessageId.ENABLED_SPIRITSHOT);
    activeChar.setChargedShot(ShotType.BLESSED_SPIRITSHOT, true);
    Broadcast.toSelfAndKnownPlayersInRadiusSq(
        activeChar, new MagicSkillUse(activeChar, activeChar, skills[0].getId(), 1, 0, 0), 360000);
  }
Exemplo n.º 12
0
  private static void showClanHallPage(L2PcInstance activeChar, ClanHall clanhall) {
    final L2Clan owner = ClanTable.getInstance().getClan(clanhall.getOwnerId());

    final NpcHtmlMessage html = new NpcHtmlMessage(0);
    html.setFile("data/html/admin/clanhall.htm");
    html.replace("%clanhallName%", clanhall.getName());
    html.replace("%clanhallId%", clanhall.getId());
    html.replace("%clanhallOwner%", (owner == null) ? "None" : owner.getName());
    activeChar.sendPacket(html);
  }
  @Override
  protected void runImpl() {
    final L2PcInstance _activeChar = getClient().getActiveChar();
    if (_activeChar == null) return;

    final PartyMatchRoom _room = PartyMatchRoomList.getInstance().getRoom(_roomid);
    if (_room == null) return;

    if ((_activeChar.isInParty() && _room.getOwner().isInParty())
        && (_activeChar.getParty().getPartyLeaderOID()
            == _room.getOwner().getParty().getPartyLeaderOID())) {
      // If user is in party with Room Owner is not removed from Room
    } else {
      _room.deleteMember(_activeChar);
      _activeChar.setPartyRoom(0);
      _activeChar.broadcastUserInfo();

      _activeChar.sendPacket(ExClosePartyRoom.STATIC_PACKET);
      _activeChar.sendPacket(SystemMessageId.PARTY_ROOM_EXITED);
    }
  }
Exemplo n.º 14
0
  private static void playerHelp(L2PcInstance activeChar, String path) {
    if (path.indexOf("..") != -1) return;

    final StringTokenizer st = new StringTokenizer(path);
    final String[] cmd = st.nextToken().split("#");

    final NpcHtmlMessage html = new NpcHtmlMessage(0);
    html.setFile("data/html/help/" + cmd[0]);
    if (cmd.length > 1) html.setItemId(Integer.parseInt(cmd[1]));
    html.disableValidation();
    activeChar.sendPacket(html);
  }
Exemplo n.º 15
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() + ".");
    }
  }
Exemplo n.º 16
0
  /**
   * @param activeChar
   * @param CharacterToFind
   */
  private void findCharacter(L2PcInstance activeChar, String CharacterToFind) {
    int CharactersFound = 0;
    String name;
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers().values();
    L2PcInstance[] players;
    // synchronized (L2World.getInstance().getAllPlayers())
    {
      players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    }
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/charfind.htm");

    final StringBuilder replyMSG = new StringBuilder(1000);

    for (L2PcInstance player : players) { // Add player info into new Table row
      name = player.getName();
      if (name.toLowerCase().contains(CharacterToFind.toLowerCase())) {
        CharactersFound = CharactersFound + 1;
        StringUtil.append(
            replyMSG,
            "<tr><td width=80><a action=\"bypass -h admin_character_list ",
            name,
            "\">",
            name,
            "</a></td><td width=110>",
            player.getTemplate().className,
            "</td><td width=40>",
            String.valueOf(player.getLevel()),
            "</td></tr>");
      }
      if (CharactersFound > 20) break;
    }
    adminReply.replace("%results%", replyMSG.toString());

    final String replyMSG2;

    if (CharactersFound == 0) {
      replyMSG2 = MessageTable.Messages[678].getMessage();
    } else if (CharactersFound > 20) {
      adminReply.replace("%number%", MessageTable.Messages[679].getMessage());
      replyMSG2 = MessageTable.Messages[680].getMessage();
    } else if (CharactersFound == 1) {
      replyMSG2 = MessageTable.Messages[1196].getMessage();
    } else {
      replyMSG2 = MessageTable.Messages[1197].getMessage();
    }

    adminReply.replace("%number%", String.valueOf(CharactersFound));
    adminReply.replace("%end%", replyMSG2);
    activeChar.sendPacket(adminReply);
  }
Exemplo n.º 17
0
  @Override
  public void handleChat(int type, L2PcInstance activeChar, String target, String text) {
    if (!FloodProtectors.performAction(activeChar.getClient(), Action.TRADE_CHAT)) return;

    final CreatureSay cs =
        new CreatureSay(activeChar.getObjectId(), type, activeChar.getName(), text);
    final int region = MapRegionTable.getMapRegion(activeChar.getX(), activeChar.getY());

    for (L2PcInstance player : L2World.getInstance().getPlayers()) {
      if (!BlockList.isBlocked(player, activeChar)
          && region == MapRegionTable.getMapRegion(player.getX(), player.getY()))
        player.sendPacket(cs);
    }
  }
Exemplo n.º 18
0
  @Override
  public String onAdvEvent(String event, L2Npc npc, L2PcInstance player) {
    String htmltext = getNoQuestMsg();
    QuestState st = player.getQuestState(getName());
    if (st == null) return htmltext;

    if (Util.isDigit(event)) {
      final int eventId = Integer.parseInt(event);
      if (eventId >= 0 && eventId <= 7) {
        if (st.getQuestItemsCount(HORN) >= BUFF[eventId - 1][2]) {
          st.takeItems(HORN, BUFF[eventId - 1][2]);
          npc.setTarget(player);
          npc.doCast(SkillTable.getInstance().getInfo(BUFF[eventId - 1][0], BUFF[eventId - 1][1]));
          npc.setCurrentHpMp(npc.getMaxHp(), npc.getMaxMp());
          htmltext = "31372-4.htm";
        }
      }
    } else if (event.equals("Withdraw")) {
      if (player.getWarehouse().getSize() == 0) htmltext = "31374-0.htm";
      else {
        player.sendPacket(ActionFailed.STATIC_PACKET);
        player.setActiveWarehouse(player.getWarehouse());
        player.sendPacket(new WareHouseWithdrawalList(player, 1));
      }
    } else if (event.equals("Teleport")) {
      switch (player.getAllianceWithVarkaKetra()) {
        case 4:
          htmltext = "31376-4.htm";
          break;
        case 5:
          htmltext = "31376-5.htm";
          break;
      }
    }

    return htmltext;
  }
Exemplo n.º 19
0
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    final ItemInstance targetItem = activeChar.getInventory().getItemByObjectId(_targetItemObjId);
    if (targetItem == null) return;

    final ItemInstance refinerItem = activeChar.getInventory().getItemByObjectId(_refinerItemObjId);
    if (refinerItem == null) return;

    if (!isValid(activeChar, targetItem, refinerItem)) {
      activeChar.sendPacket(SystemMessageId.THIS_IS_NOT_A_SUITABLE_ITEM);
      return;
    }

    final int refinerItemId = refinerItem.getItem().getItemId();
    final CrystalType grade = targetItem.getItem().getCrystalType();
    final int gemStoneId = getGemStoneId(grade);
    final int gemStoneCount = getGemStoneCount(grade);

    activeChar.sendPacket(
        new ExConfirmVariationRefiner(_refinerItemObjId, refinerItemId, gemStoneId, gemStoneCount));
  }
Exemplo n.º 20
0
  private static void showPage2(L2PcInstance activeChar, String format) {
    NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
    adminReply.setFile("data/html/admin/pforge2.htm");
    adminReply.replace("%format%", format);

    StringBuilder replyMSG = new StringBuilder();
    for (int i = 0; i < format.length(); i++)
      replyMSG.append(format.charAt(i) + " : <edit var=\"v" + i + "\" width=100><br1>");
    adminReply.replace("%valueditors%", replyMSG.toString());
    replyMSG.setLength(0);

    for (int i = 0; i < format.length(); i++) replyMSG.append(" \\$v" + i);
    adminReply.replace("%send%", replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
Exemplo n.º 21
0
  private void setTargetKarma(L2PcInstance activeChar, int newKarma) {
    // function to change karma of selected char
    L2Object target = activeChar.getTarget();
    L2PcInstance player = null;
    if (target instanceof L2PcInstance) player = (L2PcInstance) target;
    else return;

    if (newKarma >= 0) {
      // for display
      int oldKarma = player.getKarma();
      // update karma
      player.setKarma(newKarma);
      // Common character information
      player.sendPacket(
          new SystemMessage(SystemMessageId.YOUR_KARMA_HAS_BEEN_CHANGED_TO)
              .addString(String.valueOf(newKarma)));
      // Admin information
      L2CoreMessage cm = new L2CoreMessage(MessageTable.Messages[275]);
      cm.addString(player.getName());
      cm.addNumber(oldKarma);
      cm.addNumber(newKarma);
      cm.sendMessage(activeChar);
      if (Config.DEBUG)
        _log.fine(
            "[SET KARMA] [GM]"
                + activeChar.getName()
                + " Changed karma for "
                + player.getName()
                + " from ("
                + oldKarma
                + ") to ("
                + newKarma
                + ").");
    } else {
      // tell admin of mistake
      activeChar.sendMessage(569);
      if (Config.DEBUG)
        _log.fine(
            "[SET KARMA] ERROR: [GM]"
                + activeChar.getName()
                + " entered an incorrect value for new karma: "
                + newKarma
                + " for "
                + player.getName()
                + ".");
    }
  }
Exemplo n.º 22
0
  @Override
  protected void runImpl() {
    final L2PcInstance player = getClient().getActiveChar();
    if (player == null) return;

    final L2PcInstance partner = player.getActiveRequester();
    if (partner == null || L2World.getInstance().getPlayer(partner.getObjectId()) == null) {
      // Partner hasn't be found, cancel the invitation
      player.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);
      player.setActiveRequester(null);
      return;
    }

    // If answer is positive, join the requester's PartyRoom.
    if (_answer == 1 && !partner.isRequestExpired()) {
      PartyMatchRoom _room = PartyMatchRoomList.getInstance().getRoom(partner.getPartyRoom());
      if (_room == null) return;

      if ((player.getLevel() >= _room.getMinLvl()) && (player.getLevel() <= _room.getMaxLvl())) {
        // Remove from waiting list
        PartyMatchWaitingList.getInstance().removePlayer(player);

        player.setPartyRoom(partner.getPartyRoom());

        player.sendPacket(new PartyMatchDetail(player, _room));
        player.sendPacket(new ExPartyRoomMember(player, _room, 0));

        for (L2PcInstance _member : _room.getPartyMembers()) {
          if (_member == null) continue;

          _member.sendPacket(new ExManagePartyRoomMember(player, _room, 0));
          _member.sendPacket(
              SystemMessage.getSystemMessage(SystemMessageId.S1_ENTERED_PARTY_ROOM)
                  .addPcName(player));
        }
        _room.addMember(player);

        // Info Broadcast
        player.broadcastUserInfo();
      } else player.sendPacket(SystemMessageId.CANT_ENTER_PARTY_ROOM);
    }
    // Else, send a message to requester.
    else partner.sendPacket(SystemMessageId.PARTY_MATCHING_REQUEST_NO_RESPONSE);

    // reset transaction timers
    player.setActiveRequester(null);
    partner.onTransactionResponse();
  }
Exemplo n.º 23
0
  /**
   * Method used to send messages.<br>
   *
   * <ul>
   *   <li>one is broadcasted to warn ppl CW is online.
   *   <li>the other shows left timer for for CW owner (either in hours or minutes).
   * </ul>
   */
  public void cursedOnLogin() {
    SystemMessage msg =
        SystemMessage.getSystemMessage(SystemMessageId.S2_OWNER_HAS_LOGGED_INTO_THE_S1_REGION);
    msg.addZoneName(_player.getX(), _player.getY(), _player.getZ());
    msg.addItemName(_player.getCursedWeaponEquippedId());
    Broadcast.toAllOnlinePlayers(msg);

    int timeLeft = (int) (getTimeLeft() / 60000);
    if (timeLeft > 60) {
      msg = SystemMessage.getSystemMessage(SystemMessageId.S2_HOUR_OF_USAGE_TIME_ARE_LEFT_FOR_S1);
      msg.addItemName(_player.getCursedWeaponEquippedId());
      msg.addNumber(Math.round(timeLeft / 60));
    } else {
      msg = SystemMessage.getSystemMessage(SystemMessageId.S2_MINUTE_OF_USAGE_TIME_ARE_LEFT_FOR_S1);
      msg.addItemName(_player.getCursedWeaponEquippedId());
      msg.addNumber(timeLeft);
    }
    _player.sendPacket(msg);
  }
Exemplo n.º 24
0
  /**
   * Increase the number of kills.<br>
   * In case actual counter reaches the number generated to reach next stage, than rank up the CW.
   */
  public void increaseKills() {
    if (_player != null && _player.isOnline()) {
      _nbKills++;
      _hungryTime = _durationLost * 60;

      _player.setPkKills(_player.getPkKills() + 1);
      _player.sendPacket(new UserInfo(_player));

      // If current number of kills is >= to the given number, than rankUp the weapon.
      if (_nbKills >= _numberBeforeNextStage) {
        // Reset the number of kills to 0.
        _nbKills = 0;

        // Setup the new random number.
        _numberBeforeNextStage =
            Rnd.get((int) Math.round(_stageKills * 0.5), (int) Math.round(_stageKills * 1.5));

        // Rank up the CW.
        rankUp();
      }
    }
  }
Exemplo n.º 25
0
  /**
   * @param activeChar
   * @param characterName
   * @throws IllegalArgumentException
   */
  private void findCharactersPerAccount(L2PcInstance activeChar, String characterName)
      throws IllegalArgumentException {
    if (characterName.matches(Config.CNAME_TEMPLATE)) {
      String account = null;
      Map<Integer, String> chars;
      L2PcInstance player = L2World.getInstance().getPlayer(characterName);
      if (player == null) throw new IllegalArgumentException("Player doesn't exist");
      chars = player.getAccountChars();
      account = player.getAccountName();
      final StringBuilder replyMSG = new StringBuilder(chars.size() * 20);
      NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
      adminReply.setFile("data/html/admin/accountinfo.htm");
      for (String charname : chars.values()) {
        StringUtil.append(replyMSG, charname, "<br1>");
      }

      adminReply.replace("%characters%", replyMSG.toString());
      adminReply.replace("%account%", account);
      adminReply.replace("%player%", characterName);
      activeChar.sendPacket(adminReply);
    } else throw new IllegalArgumentException("Malformed character name");
  }
Exemplo n.º 26
0
  @Override
  protected void runImpl() {
    final L2PcInstance activeChar = getClient().getActiveChar();
    if (activeChar == null) return;

    // Noblesse can bestow a title to themselves
    if (activeChar.isNoble() && _target.matches(activeChar.getName())) {
      activeChar.setTitle(_title);
      activeChar.sendPacket(SystemMessageId.TITLE_CHANGED);
      activeChar.broadcastTitleInfo();
    } else {
      // Can the player change/give a title?
      if ((activeChar.getClanPrivileges() & L2Clan.CP_CL_GIVE_TITLE) != L2Clan.CP_CL_GIVE_TITLE) {
        activeChar.sendPacket(SystemMessageId.YOU_ARE_NOT_AUTHORIZED_TO_DO_THAT);
        return;
      }

      if (activeChar.getClan().getLevel() < 3) {
        activeChar.sendPacket(SystemMessageId.CLAN_LVL_3_NEEDED_TO_ENDOWE_TITLE);
        return;
      }

      final L2ClanMember member = activeChar.getClan().getClanMember(_target);
      if (member != null) {
        final L2PcInstance playerMember = member.getPlayerInstance();
        if (playerMember != null) {
          playerMember.setTitle(_title);

          playerMember.sendPacket(SystemMessageId.TITLE_CHANGED);
          if (activeChar != playerMember)
            activeChar.sendPacket(
                SystemMessage.getSystemMessage(SystemMessageId.CLAN_MEMBER_S1_TITLE_CHANGED_TO_S2)
                    .addPcName(playerMember)
                    .addString(_title));

          playerMember.broadcastTitleInfo();
        } else activeChar.sendPacket(SystemMessageId.TARGET_IS_NOT_FOUND_IN_THE_GAME);
      } else activeChar.sendPacket(SystemMessageId.TARGET_MUST_BE_IN_CLAN);
    }
  }
Exemplo n.º 27
0
  @Override
  protected void runImpl() {
    if (_items == null || _items.isEmpty() || !Config.ALLOW_FREIGHT) return;

    final L2PcInstance player = getClient().getActiveChar();
    if (player == null) return;

    // player attempts to send freight to the different account
    if (!player.getAccountChars().containsKey(_objectID)) return;

    final PcFreight freight = player.getDepositedFreight(_objectID);
    player.setActiveWarehouse(freight);

    final ItemContainer warehouse = player.getActiveWarehouse();
    if (warehouse == null) return;

    final L2Npc manager = player.getCurrentFolkNPC();
    if ((manager == null
            || !player.isInsideRadius(manager, L2Npc.INTERACTION_DISTANCE, false, false))
        && !player.isGM()) return;

    if (warehouse instanceof PcFreight && !player.getAccessLevel().allowTransaction()) {
      player.sendMessage("Transactions are disabled for your Access Level.");
      return;
    }

    // Alt game - Karma punishment
    if (!Config.KARMA_PLAYER_CAN_USE_WH && player.getKarma() > 0) return;

    // Freight price from config or normal price per item slot (30)
    int fee = _items.size() * Config.ALT_GAME_FREIGHT_PRICE;
    int currentAdena = player.getAdena();
    int slots = 0;

    for (Item i : _items) {
      int objectId = i.id;
      int count = i.count;

      // Check validity of requested item
      ItemInstance item = player.checkItemManipulation(objectId, count);
      if (item == null) {
        _log.warning(
            "Error depositing a warehouse object for char "
                + player.getName()
                + " (validity check)");
        i.id = 0;
        i.count = 0;
        continue;
      }

      if (!item.isTradable() || item.isQuestItem()) return;

      // Calculate needed adena and slots
      if (item.getItemId() == 57) currentAdena -= count;

      if (!item.isStackable()) slots += count;
      else if (warehouse.getItemByItemId(item.getItemId()) == null) slots++;
    }

    // Item Max Limit Check
    if (!warehouse.validateCapacity(slots)) {
      sendPacket(
          SystemMessage.getSystemMessage(
              SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED));
      return;
    }

    // Check if enough adena and charge the fee
    if (currentAdena < fee
        || !player.reduceAdena("Warehouse", fee, player.getCurrentFolkNPC(), false)) {
      sendPacket(SystemMessage.getSystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
      return;
    }

    // Proceed to the transfer
    InventoryUpdate playerIU = new InventoryUpdate();
    for (Item i : _items) {
      int objectId = i.id;
      int count = i.count;

      // check for an invalid item
      if (objectId == 0 && count == 0) continue;

      ItemInstance oldItem = player.getInventory().getItemByObjectId(objectId);
      if (oldItem == null) {
        _log.warning(
            "Error depositing a warehouse object for char "
                + player.getName()
                + " (olditem == null)");
        continue;
      }

      if (oldItem.isHeroItem()) continue;

      ItemInstance newItem =
          player
              .getInventory()
              .transferItem(
                  "Warehouse", objectId, count, warehouse, player, player.getCurrentFolkNPC());
      if (newItem == null) {
        _log.warning(
            "Error depositing a warehouse object for char "
                + player.getName()
                + " (newitem == null)");
        continue;
      }

      if (oldItem.getCount() > 0 && oldItem != newItem) playerIU.addModifiedItem(oldItem);
      else playerIU.addRemovedItem(oldItem);
    }

    // Send updated item list to the player
    player.sendPacket(playerIU);

    // Update current load status on player
    StatusUpdate su = new StatusUpdate(player);
    su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
    player.sendPacket(su);
  }
Exemplo n.º 28
0
  /**
   * Define the Soul Crystal and try to stage it. Checks for quest enabled, crystal(s) in inventory,
   * required usage of crystal, mob's ability to level crystal and mob vs player level gap.
   *
   * @param player : The player to make checks on.
   * @param mob : The mob to make checks on.
   * @param npcInfo : The mob's leveling informations.
   * @param chance : Input variable used to determine keep/stage/break of the crystal.
   * @return Returns true only, when crystal is staged or broken (aka any type of crystal change is
   *     made), else returns false.
   */
  private void tryToStageCrystal(
      L2PcInstance player, L2Attackable mob, LevelingInfo npcInfo, int chance) {
    SoulCrystalData crystalData = null;
    ItemInstance crystalItem = null;

    // Iterate through player's inventory to find crystal(s).
    for (ItemInstance item : player.getInventory().getItems()) {
      SoulCrystalData data = SoulCrystalsTable.getSoulCrystalInfos().get(item.getItemId());
      if (data == null) continue;

      // More crystals found.
      if (crystalData != null) {
        // Leveling requires soul crystal being used?
        if (npcInfo.skillRequired()) {
          // Absorb list contains killer and his AbsorbInfo is registered.
          final AbsorbInfo ai = mob.getAbsorbInfo(player.getObjectId());
          if (ai != null && ai.isRegistered())
            player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_FAILED_RESONATION);
        } else player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_FAILED_RESONATION);

        return;
      }

      crystalData = data;
      crystalItem = item;
    }

    // No crystal found, return without any notification.
    if (crystalData == null || crystalItem == null) return;

    // Leveling requires soul crystal being used?
    if (npcInfo.skillRequired()) {
      // Absorb list doesn't contain killer or his AbsorbInfo is not registered.
      final AbsorbInfo ai = mob.getAbsorbInfo(player.getObjectId());
      if (ai == null || !ai.isRegistered()) return;

      // Check if Absorb list contains valid crystal and whether it was used properly.
      if (!ai.isValid(crystalItem.getObjectId())) {
        player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_REFUSED);
        return;
      }
    }

    // Check, if npc stages this type of crystal.
    if (!npcInfo.isInLevelList(crystalData.getLevel())) {
      player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_REFUSED);
      return;
    }

    // Check level difference limitation, dark blue monsters does not stage.
    if (player.getLevel() - mob.getLevel() > 8) {
      player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_REFUSED);
      return;
    }

    // Lucky, crystal successfully stages.
    if (chance < npcInfo.getChanceStage()) exchangeCrystal(player, crystalData, true);
    // Bad luck, crystal accidentally breaks.
    else if (chance < (npcInfo.getChanceStage() + npcInfo.getChanceBreak()))
      exchangeCrystal(player, crystalData, false);
    // Bad luck, crystal doesn't stage.
    else player.sendPacket(SystemMessageId.SOUL_CRYSTAL_ABSORBING_FAILED);
  }
Exemplo n.º 29
0
  private static void showHtml(L2PcInstance activeChar) {
    int worldX = activeChar.getX();
    int worldY = activeChar.getY();
    int geoX = ((((worldX - (-327680)) >> 4) >> 11) + 10);
    int geoY = ((((worldY - (-262144)) >> 4) >> 11) + 10);

    NpcHtmlMessage adminReply = new NpcHtmlMessage(0);
    adminReply.setFile("data/html/admin/zone.htm");

    adminReply.replace(
        "%MAPREGION%",
        "[x:"
            + MapRegionTable.getMapRegionX(activeChar.getX())
            + " y:"
            + MapRegionTable.getMapRegionX(activeChar.getY())
            + "]");
    adminReply.replace("%GEOREGION%", "" + geoX + "_" + geoY);
    adminReply.replace(
        "%CLOSESTTOWN%", MapRegionTable.getInstance().getClosestTownName(activeChar));
    adminReply.replace(
        "%CURRENTLOC%",
        "" + activeChar.getX() + ", " + activeChar.getY() + ", " + activeChar.getZ());

    adminReply.replace(
        "%PVP%", (activeChar.isInsideZone(ZoneId.PVP) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%PEACE%",
        (activeChar.isInsideZone(ZoneId.PEACE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%SIEGE%",
        (activeChar.isInsideZone(ZoneId.SIEGE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%MOTHERTREE%",
        (activeChar.isInsideZone(ZoneId.MOTHER_TREE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%CLANHALL%",
        (activeChar.isInsideZone(ZoneId.CLAN_HALL) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%NOLANDING%",
        (activeChar.isInsideZone(ZoneId.NO_LANDING) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%WATER%",
        (activeChar.isInsideZone(ZoneId.WATER) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%JAIL%",
        (activeChar.isInsideZone(ZoneId.JAIL) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%MONSTERTRACK%",
        (activeChar.isInsideZone(ZoneId.MONSTER_TRACK)
            ? "<font color=\"LEVEL\">YES</font>"
            : "NO"));
    adminReply.replace(
        "%CASTLE%",
        (activeChar.isInsideZone(ZoneId.CASTLE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%SWAMP%",
        (activeChar.isInsideZone(ZoneId.SWAMP) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%NOSUMMONFRIEND%",
        (activeChar.isInsideZone(ZoneId.NO_SUMMON_FRIEND)
            ? "<font color=\"LEVEL\">YES</font>"
            : "NO"));
    adminReply.replace(
        "%NOSTORE%",
        (activeChar.isInsideZone(ZoneId.NO_STORE) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%TOWN%",
        (activeChar.isInsideZone(ZoneId.TOWN) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%HQ%", (activeChar.isInsideZone(ZoneId.HQ) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%DANGERAREA%",
        (activeChar.isInsideZone(ZoneId.DANGER_AREA) ? "<font color=\"LEVEL\">YES</font>" : "NO"));
    adminReply.replace(
        "%CASTONARTIFACT%",
        (activeChar.isInsideZone(ZoneId.CAST_ON_ARTIFACT)
            ? "<font color=\"LEVEL\">YES</font>"
            : "NO"));
    adminReply.replace(
        "%NORESTART%",
        (activeChar.isInsideZone(ZoneId.NO_RESTART) ? "<font color=\"LEVEL\">YES</font>" : "NO"));

    StringBuilder zones = new StringBuilder(100);
    L2WorldRegion region = L2World.getInstance().getRegion(activeChar.getX(), activeChar.getY());
    for (L2ZoneType zone : region.getZones()) {
      if (zone.isCharacterInZone(activeChar)) {
        StringUtil.append(zones, String.valueOf(zone.getId()));
        StringUtil.append(zones, " ");
      }
    }
    adminReply.replace("%ZLIST%", zones.toString());
    activeChar.sendPacket(adminReply);
  }
Exemplo n.º 30
0
  @Override
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    // runmod
    if (command.equals("admin_runmod") || command.equals("admin_instant_move"))
      activeChar.setTeleMode(1);
    if (command.equals("admin_runmod tele")) activeChar.setTeleMode(2);
    if (command.equals("admin_runmod norm")) activeChar.setTeleMode(0);

    // teleport via panels
    if (command.equals("admin_tele")) AdminHelpPage.showHelpPage(activeChar, "teleports.htm");
    if (command.equals("admin_tele_areas"))
      AdminHelpPage.showHelpPage(activeChar, "tele/other.htm");

    // recalls / goto types
    if (command.startsWith("admin_goto") || command.startsWith("admin_teleportto")) {
      StringTokenizer st = new StringTokenizer(command);
      if (st.countTokens() > 1) {
        st.nextToken();
        String plyr = st.nextToken();
        L2PcInstance player = L2World.getInstance().getPlayer(plyr);
        if (player == null) {
          activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
          return false;
        }

        teleportToCharacter(activeChar, player);
      }
    } else if (command.startsWith("admin_recall ")) {
      try {
        String targetName = command.substring(13);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        if (player == null) {
          activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
          return false;
        }

        teleportCharacter(player, activeChar.getX(), activeChar.getY(), activeChar.getZ());
      } catch (StringIndexOutOfBoundsException e) {
      }
    } else if (command.startsWith("admin_recall_party")) {
      try {
        String targetName = command.substring(19);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        if (player == null) {
          activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
          return false;
        }

        if (player.isInParty()) {
          for (L2PcInstance pm : player.getParty().getPartyMembers())
            teleportCharacter(pm, activeChar.getX(), activeChar.getY(), activeChar.getZ());

          activeChar.sendMessage("You recall " + player.getName() + "'s party.");
        } else {
          activeChar.sendMessage("You recall " + player.getName() + ", but he isn't in a party.");
          teleportCharacter(player, activeChar.getX(), activeChar.getY(), activeChar.getZ());
        }
      } catch (StringIndexOutOfBoundsException e) {
      }
    } else if (command.startsWith("admin_recall_clan")) {
      try {
        String targetName = command.substring(18);
        L2PcInstance player = L2World.getInstance().getPlayer(targetName);
        if (player == null) {
          activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
          return false;
        }

        L2Clan clan = player.getClan();
        if (clan != null) {
          for (L2PcInstance member : clan.getOnlineMembers())
            teleportCharacter(member, activeChar.getX(), activeChar.getY(), activeChar.getZ());

          activeChar.sendMessage("You recall " + player.getName() + "'s clan.");
        } else {
          activeChar.sendMessage(
              "You recall " + player.getName() + ", but he isn't a clan member.");
          teleportCharacter(player, activeChar.getX(), activeChar.getY(), activeChar.getZ());
        }
      } catch (StringIndexOutOfBoundsException e) {
      }
    } else if (command.startsWith("admin_move_to")) {
      try {
        String val = command.substring(14);
        teleportTo(activeChar, val);
      } catch (Exception e) {
        // Case of empty or missing coordinates
        AdminHelpPage.showHelpPage(activeChar, "teleports.htm");
      }
    } else if (command.startsWith("admin_sendhome")) {
      StringTokenizer st = new StringTokenizer(command);
      if (st.countTokens() > 1) {
        st.nextToken();
        String plyr = st.nextToken();
        L2PcInstance player = L2World.getInstance().getPlayer(plyr);
        if (player == null) {
          activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
          return false;
        }

        sendHome(player);
      } else {
        L2Object target = activeChar.getTarget();
        L2PcInstance player = null;

        // if target isn't a player, select yourself as target
        if (target instanceof L2PcInstance) player = (L2PcInstance) target;
        else player = activeChar;

        sendHome(player);
      }
    }
    return true;
  }