コード例 #1
0
ファイル: AdminSiege.java プロジェクト: sonizs123/Acis
  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);
  }
コード例 #2
0
ファイル: AdminTeleport.java プロジェクト: sonizs123/Acis
  @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;
  }