コード例 #1
0
  @Override
  public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    if (!target.isNpc()) {
      return false;
    }

    final L2Npc npc = (L2Npc) target;
    final NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
    {
      if (npc.getCastle().getOwnerId() > 0) {
        html.setFile(activeChar.getHtmlPrefix(), "data/html/territorystatus.htm");
        L2Clan clan = ClanTable.getInstance().getClan(npc.getCastle().getOwnerId());
        html.replace("%clanname%", clan.getName());
        html.replace("%clanleadername%", clan.getLeaderName());
      } else {
        html.setFile(activeChar.getHtmlPrefix(), "data/html/territorynoclan.htm");
      }
    }
    html.replace("%castlename%", npc.getCastle().getName());
    html.replace("%taxpercent%", "" + npc.getCastle().getTaxPercent());
    html.replace("%objectId%", String.valueOf(npc.getObjectId()));
    {
      if (npc.getCastle().getResidenceId() > 6) {
        html.replace("%territory%", "The Kingdom of Elmore");
      } else {
        html.replace("%territory%", "The Kingdom of Aden");
      }
    }
    activeChar.sendPacket(html);
    return true;
  }
コード例 #2
0
  private void showFortSelectPage(L2PcInstance activeChar) {
    int i = 0;
    final NpcHtmlMessage adminReply = new NpcHtmlMessage();
    adminReply.setFile(activeChar.getHtmlPrefix(), "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) {
        // L2JTW uses fort.getCName() instead of fort.getName()
        StringUtil.append(
            cList,
            "<td fixwidth=90><a action=\"bypass -h admin_fortsiege ",
            String.valueOf(fort.getResidenceId()),
            "\">",
            fort.getName(),
            " id: ",
            String.valueOf(fort.getResidenceId()),
            "</a></td>");
        i++;
      }
      // L2JTW: if (i > 0)
      if (i > 2) {
        cList.append("</tr><tr>");
        i = 0;
      }
    }

    adminReply.replace("%forts%", cList.toString());
    activeChar.sendPacket(adminReply);
  }
コード例 #3
0
  @RegisterEvent(EventType.ON_PLAYER_LEVEL_CHANGED)
  @RegisterType(ListenerRegisterType.GLOBAL)
  public void OnPlayerLevelChanged(OnPlayerLevelChanged event) {
    final L2PcInstance player = event.getActiveChar();
    final int oldLevel = event.getOldLevel();
    final int newLevel = event.getNewLevel();

    if (((oldLevel == (newLevel - 1)) && (player.getLevel() >= MIN_LEVEL))
        && (player.getLevel() <= MAX_LEVEL)
        && !(player.getRace() == Race.ERTHEIA)) {
      final QuestState qs = getQuestState(player, false);
      if (qs == null) {
        final NpcHtmlMessage html = new NpcHtmlMessage(0, 0);
        html.setHtml(
            HtmCache.getInstance()
                .getHtm(
                    player.getHtmlPrefix(),
                    "scripts/quests/Q10390_KekropusLetter/"
                        + "Announce_"
                        + player.getRace().name()
                        + ".html"));
        player.sendPacket(html);
        // todo: get proper announce html && handle it
      }
      return;
    }
  }
コード例 #4
0
 private void showSiegeTimePage(L2PcInstance activeChar) {
   final NpcHtmlMessage adminReply = new NpcHtmlMessage();
   adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/territorywartime.htm");
   adminReply.replace(
       "%time%", TerritoryWarManager.getInstance().getTWStart().getTime().toString());
   activeChar.sendPacket(adminReply);
 }
コード例 #5
0
 private void showFortSiegePage(L2PcInstance activeChar, Fort fort) {
   final NpcHtmlMessage adminReply = new NpcHtmlMessage();
   adminReply.setFile(activeChar.getHtmlPrefix(), "data/html/admin/fort.htm");
   // L2JTW uses fort.getCName() instead of fort.getName()
   adminReply.replace("%fortName%", fort.getName());
   adminReply.replace("%fortId%", String.valueOf(fort.getResidenceId()));
   activeChar.sendPacket(adminReply);
 }
コード例 #6
0
  @Override
  public boolean parseCommunityBoardCommand(String command, L2PcInstance activeChar) {
    if (command.equals("_friendlist")) {
      CommunityBoardHandler.getInstance().addBypass(activeChar, "Friends List", command);

      final String html =
          HtmCache.getInstance()
              .getHtm(activeChar.getHtmlPrefix(), "data/html/CommunityBoard/friends_list.html");

      CommunityBoardHandler.separateAndSend(html, activeChar);
    } else if (command.equals("_friendblocklist")) {
      CommunityBoardHandler.getInstance().addBypass(activeChar, "Ignore list", command);

      final String html =
          HtmCache.getInstance()
              .getHtm(
                  activeChar.getHtmlPrefix(), "data/html/CommunityBoard/friends_block_list.html");

      CommunityBoardHandler.separateAndSend(html, activeChar);
    } else {

    }
    return true;
  }
コード例 #7
0
ファイル: Link.java プロジェクト: GT-Games/Lineage-II
  @Override
  public boolean useBypass(String command, L2PcInstance activeChar, L2Character target) {
    String htmlPath = command.substring(4).trim();
    if (htmlPath.isEmpty()) {
      _log.warning("Player " + activeChar.getName() + " sent empty link html!");
      return false;
    }

    if (htmlPath.contains("..")) {
      _log.warning("Player " + activeChar.getName() + " sent invalid link html: " + htmlPath);
      return false;
    }

    String filename = "html/" + htmlPath;
    final NpcHtmlMessage html = new NpcHtmlMessage(target != null ? target.getObjectId() : 0);
    html.setFile(activeChar.getHtmlPrefix(), filename);
    html.replace("%objectId%", String.valueOf(target != null ? target.getObjectId() : 0));
    activeChar.sendPacket(html);
    return true;
  }
コード例 #8
0
 private NpcHtmlMessage getHtmlPacket(L2PcInstance player, L2Npc npc, String htmlFile) {
   final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
   packet.setHtml(getHtm(player.getHtmlPrefix(), htmlFile));
   return packet;
 }
コード例 #9
0
ファイル: Hero.java プロジェクト: LucusAngel/L2J_Server_BETA
  public void showHeroFights(L2PcInstance activeChar, int heroclass, int charid, int page) {
    final int perpage = 20;
    int _win = 0;
    int _loss = 0;
    int _draw = 0;

    if (_herofights.containsKey(charid)) {
      List<StatsSet> _list = _herofights.get(charid);

      final NpcHtmlMessage FightReply = new NpcHtmlMessage();
      final String htmContent =
          HtmCache.getInstance()
              .getHtm(activeChar.getHtmlPrefix(), "data/html/olympiad/herohistory.htm");
      if (htmContent != null) {
        FightReply.setHtml(htmContent);
        FightReply.replace("%heroname%", CharNameTable.getInstance().getNameById(charid));

        if (!_list.isEmpty()) {
          if (_herocounts.containsKey(charid)) {
            StatsSet _herocount = _herocounts.get(charid);
            _win = _herocount.getInt("victory");
            _loss = _herocount.getInt("loss");
            _draw = _herocount.getInt("draw");
          }

          boolean color = true;
          final StringBuilder fList = new StringBuilder(500);
          int counter = 0;
          int breakat = 0;
          for (int i = ((page - 1) * perpage); i < _list.size(); i++) {
            breakat = i;
            StatsSet fight = _list.get(i);
            StringUtil.append(fList, "<tr><td>");
            if (color) {
              StringUtil.append(fList, "<table width=270 bgcolor=\"131210\">");
            } else {
              StringUtil.append(fList, "<table width=270>");
            }
            StringUtil.append(
                fList,
                "<tr><td width=220><font color=\"LEVEL\">"
                    + fight.getString("start")
                    + "</font>&nbsp;&nbsp;"
                    + fight.getString("result")
                    + "</td><td width=50 align=right>"
                    + (fight.getInt("classed") > 0
                        ? "<font color=\"FFFF99\">cls</font>"
                        : "<font color=\"999999\">non-cls<font>")
                    + "</td></tr>");
            StringUtil.append(
                fList,
                "<tr><td width=220>vs "
                    + fight.getString("oponent")
                    + " ("
                    + fight.getString("oponentclass")
                    + ")</td><td width=50 align=right>("
                    + fight.getString("time")
                    + ")</td></tr>");
            StringUtil.append(fList, "<tr><td colspan=2>&nbsp;</td></tr></table>");
            StringUtil.append(fList, "</td></tr>");
            color = !color;
            counter++;
            if (counter >= perpage) {
              break;
            }
          }

          if (breakat < (_list.size() - 1)) {
            FightReply.replace(
                "%buttprev%",
                "<button value=\"Prev\" action=\"bypass _match?class="
                    + heroclass
                    + "&page="
                    + (page + 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            FightReply.replace("%buttprev%", "");
          }

          if (page > 1) {
            FightReply.replace(
                "%buttnext%",
                "<button value=\"Next\" action=\"bypass _match?class="
                    + heroclass
                    + "&page="
                    + (page - 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            FightReply.replace("%buttnext%", "");
          }

          FightReply.replace("%list%", fList.toString());
        } else {
          FightReply.replace("%list%", "");
          FightReply.replace("%buttprev%", "");
          FightReply.replace("%buttnext%", "");
        }

        FightReply.replace("%win%", String.valueOf(_win));
        FightReply.replace("%draw%", String.valueOf(_draw));
        FightReply.replace("%loos%", String.valueOf(_loss));

        activeChar.sendPacket(FightReply);
      }
    }
  }
コード例 #10
0
ファイル: Hero.java プロジェクト: LucusAngel/L2J_Server_BETA
  public void showHeroDiary(L2PcInstance activeChar, int heroclass, int charid, int page) {
    final int perpage = 10;

    if (_herodiary.containsKey(charid)) {
      List<StatsSet> _mainlist = _herodiary.get(charid);
      final NpcHtmlMessage DiaryReply = new NpcHtmlMessage();
      final String htmContent =
          HtmCache.getInstance()
              .getHtm(activeChar.getHtmlPrefix(), "data/html/olympiad/herodiary.htm");
      if ((htmContent != null) && _heroMessage.containsKey(charid)) {
        DiaryReply.setHtml(htmContent);
        DiaryReply.replace("%heroname%", CharNameTable.getInstance().getNameById(charid));
        DiaryReply.replace("%message%", _heroMessage.get(charid));
        DiaryReply.disableValidation();

        if (!_mainlist.isEmpty()) {
          FastList<StatsSet> _list = FastList.newInstance();
          _list.addAll(_mainlist);
          Collections.reverse(_list);

          boolean color = true;
          final StringBuilder fList = new StringBuilder(500);
          int counter = 0;
          int breakat = 0;
          for (int i = ((page - 1) * perpage); i < _list.size(); i++) {
            breakat = i;
            StatsSet _diaryentry = _list.get(i);
            StringUtil.append(fList, "<tr><td>");
            if (color) {
              StringUtil.append(fList, "<table width=270 bgcolor=\"131210\">");
            } else {
              StringUtil.append(fList, "<table width=270>");
            }
            StringUtil.append(
                fList,
                "<tr><td width=270><font color=\"LEVEL\">"
                    + _diaryentry.getString("date")
                    + ":xx</font></td></tr>");
            StringUtil.append(
                fList, "<tr><td width=270>" + _diaryentry.getString("action") + "</td></tr>");
            StringUtil.append(fList, "<tr><td>&nbsp;</td></tr></table>");
            StringUtil.append(fList, "</td></tr>");
            color = !color;
            counter++;
            if (counter >= perpage) {
              break;
            }
          }

          if (breakat < (_list.size() - 1)) {
            DiaryReply.replace(
                "%buttprev%",
                "<button value=\"Prev\" action=\"bypass _diary?class="
                    + heroclass
                    + "&page="
                    + (page + 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            DiaryReply.replace("%buttprev%", "");
          }

          if (page > 1) {
            DiaryReply.replace(
                "%buttnext%",
                "<button value=\"Next\" action=\"bypass _diary?class="
                    + heroclass
                    + "&page="
                    + (page - 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            DiaryReply.replace("%buttnext%", "");
          }

          DiaryReply.replace("%list%", fList.toString());

          FastList.recycle(_list);
        } else {
          DiaryReply.replace("%list%", "");
          DiaryReply.replace("%buttprev%", "");
          DiaryReply.replace("%buttnext%", "");
        }

        activeChar.sendPacket(DiaryReply);
      }
    }
  }
コード例 #11
0
 public void showHtmlFile(L2PcInstance player, String file, L2Npc npc) {
   NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
   html.setFile(player.getHtmlPrefix(), file);
   html.replace("%npc_name%", npc.getName());
   player.sendPacket(html);
 }
コード例 #12
0
  public synchronized void start(L2PcInstance player, byte type, L2Npc npc) {
    boolean canPass = true;
    if (!player.isInParty()) {
      showHtmlFile(player, "data/html/seven_signs/rift/NoParty.htm", npc);
      return;
    }

    if (player.getParty().getPartyLeaderOID() != player.getObjectId()) {
      showHtmlFile(player, "data/html/seven_signs/rift/NotPartyLeader.htm", npc);
      return;
    }

    if (player.getParty().isInDimensionalRift()) {
      handleCheat(player, npc);
      return;
    }

    if (player.getParty().getMemberCount() < Config.RIFT_MIN_PARTY_SIZE) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/SmallParty.htm");
      html.replace("%npc_name%", npc.getName());
      html.replace("%count%", Integer.toString(Config.RIFT_MIN_PARTY_SIZE));
      player.sendPacket(html);
      return;
    }

    // max parties inside is rooms count - 1
    if (!isAllowedEnter(type)) {
      player.sendMessage("Rift is full. Try later.");
      return;
    }

    for (L2PcInstance p : player.getParty().getPartyMembers())
      if (!checkIfInPeaceZone(p.getX(), p.getY(), p.getZ())) {
        canPass = false;
        break;
      }

    if (!canPass) {
      showHtmlFile(player, "data/html/seven_signs/rift/NotInWaitingRoom.htm", npc);
      return;
    }

    L2ItemInstance i;
    int count = getNeededItems(type);
    for (L2PcInstance p : player.getParty().getPartyMembers()) {
      i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID);

      if (i == null) {
        canPass = false;
        break;
      }

      if (i.getCount() > 0) {
        if (i.getCount() < getNeededItems(type)) {
          canPass = false;
          break;
        }
      } else {
        canPass = false;
        break;
      }
    }

    if (!canPass) {
      NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
      html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm");
      html.replace("%npc_name%", npc.getName());
      html.replace("%count%", Integer.toString(count));
      player.sendPacket(html);
      return;
    }

    for (L2PcInstance p : player.getParty().getPartyMembers()) {
      i = p.getInventory().getItemByItemId(DIMENSIONAL_FRAGMENT_ITEM_ID);
      if (!p.destroyItem("RiftEntrance", i, count, null, false)) {
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setFile(player.getHtmlPrefix(), "data/html/seven_signs/rift/NoFragments.htm");
        html.replace("%npc_name%", npc.getName());
        html.replace("%count%", Integer.toString(count));
        player.sendPacket(html);
        return;
      }
    }

    byte room;
    FastList<Byte> emptyRooms;
    do {
      emptyRooms = getFreeRooms(type);
      room = emptyRooms.get(Rnd.get(1, emptyRooms.size()) - 1);
    }
    // find empty room
    while (_rooms.get(type).get(room).ispartyInside());
    new DimensionalRift(player.getParty(), type, room);
  }
コード例 #13
0
ファイル: Race.java プロジェクト: rukhavi/l2j-mobius
 private void showMenu(L2PcInstance activeChar) {
   final NpcHtmlMessage html = new NpcHtmlMessage();
   String content = getHtm(activeChar.getHtmlPrefix(), "admin_menu.htm");
   html.setHtml(content);
   activeChar.sendPacket(html);
 }