Package javolution.text

Examples of javolution.text.TextBuilder


   * @param activeChar
   * @param name
   */
  private void showOldCommunityPI(L2PcInstance activeChar, String name)
  {
        TextBuilder htmlCode = new TextBuilder("<html><body><br>");
    htmlCode.append("<table border=0><tr><td FIXWIDTH=15></td><td align=center>L2J Community Board<img src=\"sek.cbui355\" width=610 height=1></td></tr><tr><td FIXWIDTH=15></td><td>");
    L2PcInstance player = L2World.getInstance().getPlayer(name);

    if (player != null)
    {
        String sex = "Male";
        if (player.getAppearance().getSex())
        {
            sex = "Female";
        }
        String levelApprox = "low";
        if (player.getLevel() >= 60)
            levelApprox = "very high";
        else if (player.getLevel() >= 40)
            levelApprox = "high";
        else if (player.getLevel() >= 20)
            levelApprox = "medium";
        htmlCode.append("<table border=0><tr><td>"+player.getName()+" ("+sex+" "+player.getTemplate().className+"):</td></tr>");
        htmlCode.append("<tr><td>Level: "+levelApprox+"</td></tr>");
        htmlCode.append("<tr><td><br></td></tr>");

        if (activeChar != null && (activeChar.isGM() || player.getObjectId() == activeChar.getObjectId()
                || Config.SHOW_LEVEL_COMMUNITYBOARD))
        {
            long nextLevelExp = 0;
            long nextLevelExpNeeded = 0;
            if (player.getLevel() < (Experience.MAX_LEVEL - 1))
            {
                nextLevelExp = Experience.LEVEL[player.getLevel() + 1];
                nextLevelExpNeeded = nextLevelExp-player.getExp();
            }

            htmlCode.append("<tr><td>Level: "+player.getLevel()+"</td></tr>");
            htmlCode.append("<tr><td>Experience: "+player.getExp()+"/"+nextLevelExp+"</td></tr>");
            htmlCode.append("<tr><td>Experience needed for level up: "+nextLevelExpNeeded+"</td></tr>");
            htmlCode.append("<tr><td><br></td></tr>");
        }

        int uptime = (int)player.getUptime()/1000;
        int h = uptime/3600;
        int m = (uptime-(h*3600))/60;
        int s = ((uptime-(h*3600))-(m*60));

        htmlCode.append("<tr><td>Uptime: "+h+"h "+m+"m "+s+"s</td></tr>");
        htmlCode.append("<tr><td><br></td></tr>");

        if (player.getClan() != null)
        {
            htmlCode.append("<tr><td>Clan: "+player.getClan().getName()+"</td></tr>");
            htmlCode.append("<tr><td><br></td></tr>");
        }

        htmlCode.append("<tr><td><multiedit var=\"pm\" width=240 height=40><button value=\"Send PM\" action=\"Write Region PM "+player.getName()+" pm pm pm\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><tr><td><br><button value=\"Back\" action=\"bypass _bbsloc\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr></table>");
        htmlCode.append("</td></tr></table>");
            htmlCode.append("</body></html>");
            separateAndSend(htmlCode.toString(),activeChar);
    }
    else
    {
      ShowBoard sb = new ShowBoard("<html><body><br><br><center>No player with name "+name+"</center><br><br></body></html>","101");
      activeChar.sendPacket(sb);
View Full Code Here


        if (activeChar == null)
            return;

    if (ar1.equals("PM"))
    {
            TextBuilder htmlCode = new TextBuilder("<html><body><br>");
            htmlCode.append("<table border=0><tr><td FIXWIDTH=15></td><td align=center>L2J Community Board<img src=\"sek.cbui355\" width=610 height=1></td></tr><tr><td FIXWIDTH=15></td><td>");

            try
            {

              L2PcInstance receiver = L2World.getInstance().getPlayer(ar2);
              if (receiver == null)
              {
                htmlCode.append("Player not found!<br><button value=\"Back\" action=\"bypass _bbsloc;playerinfo;"+ar2+"\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
                htmlCode.append("</td></tr></table></body></html>");
                separateAndSend(htmlCode.toString(),activeChar);
                return;
              }
            if (Config.JAIL_DISABLE_CHAT && receiver.isInJail())
            {
                    activeChar.sendMessage("Player is in jail.");
                    return;
            }
        if (receiver.isChatBanned())
            {
                    activeChar.sendMessage("Player is chat banned.");
                    return;
            }
                if (activeChar.isInJail() && Config.JAIL_DISABLE_CHAT)
                {
                    activeChar.sendMessage("You can not chat while in jail.");
                    return;
                }

                if (Config.LOG_CHAT)
              {
                LogRecord record = new LogRecord(Level.INFO, ar3);
                record.setLoggerName("chat");
                record.setParameters(new Object[]{"TELL", "[" + activeChar.getName() + " to "+receiver.getName()+"]"});
                _logChat.log(record);
        }
              CreatureSay cs = new CreatureSay(activeChar.getObjectId(), Say2.TELL, activeChar.getName(), ar3);
              if (!BlockList.isBlocked(receiver, activeChar))
        {
                if (!receiver.getMessageRefusal())
                {
                  receiver.sendPacket(cs);
                  activeChar.sendPacket(new CreatureSay(activeChar.getObjectId(), Say2.TELL, "->" + receiver.getName(), ar3));
                  htmlCode.append("Message Sent<br><button value=\"Back\" action=\"bypass _bbsloc;playerinfo;"+receiver.getName()+"\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
                  htmlCode.append("</td></tr></table></body></html>");
                  separateAndSend(htmlCode.toString(),activeChar;
          }
                else
                {
                  SystemMessage sm = new SystemMessage(SystemMessageId.THE_PERSON_IS_IN_MESSAGE_REFUSAL_MODE);
                  activeChar.sendPacket(sm);
View Full Code Here

  private void writeCommunityPages()
  {
    for (int page : _onlinePlayers.keySet())
    {
          FastMap<String, String> communityPage = new FastMap<String, String>();
          TextBuilder htmlCode = new TextBuilder("<html><body><br>");
          String tdClose = "</td>";
          String tdOpen = "<td align=left valign=top>";
          String trClose = "</tr>";
          String trOpen = "<tr>";
          String colSpacer = "<td FIXWIDTH=15></td>";

          htmlCode.append("<table>");

          htmlCode.append(trOpen);
          htmlCode.append("<td align=left valign=top>Server Restarted: " + GameServer.dateTimeServerStarted.getTime() + tdClose);
          htmlCode.append(trClose);

          htmlCode.append("</table>");

          htmlCode.append("<table>");

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + "XP Rate: " + Config.RATE_XP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Party XP Rate: " + Config.RATE_PARTY_XP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "XP Exponent: " + Config.ALT_GAME_EXPONENT_XP + tdClose);
          htmlCode.append(trClose);

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + "SP Rate: " + Config.RATE_SP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Party SP Rate: " + Config.RATE_PARTY_SP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "SP Exponent: " + Config.ALT_GAME_EXPONENT_SP + tdClose);
          htmlCode.append(trClose);

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + "Drop Rate: " + Config.RATE_DROP_ITEMS + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Spoil Rate: " + Config.RATE_DROP_SPOIL + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Adena Rate: " + Config.RATE_DROP_ADENA + tdClose);
          htmlCode.append(trClose);

          htmlCode.append("</table>");

          htmlCode.append("<table>");
          htmlCode.append(trOpen);
          htmlCode.append("<td><img src=\"sek.cbui355\" width=600 height=1><br></td>");
          htmlCode.append(trClose);

            htmlCode.append(trOpen);
            htmlCode.append(tdOpen + L2World.getInstance().getAllVisibleObjectsCount()
                + " Object count</td>");
            htmlCode.append(trClose);

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + getOnlineCount("gm") + " Player(s) Online</td>");
          htmlCode.append(trClose);
          htmlCode.append("</table>");

          htmlCode.append("<table border=0>");
          htmlCode.append("<tr><td><table border=0>");

          int cell = 0;
          for (L2PcInstance player : getOnlinePlayers(page))
          {
              cell++;

              if (cell == 1) htmlCode.append(trOpen);

              htmlCode.append("<td align=left valign=top FIXWIDTH=110><a action=\"bypass _bbsloc;playerinfo;"
                  + player.getName() + "\">");

              if (player.isGM()) htmlCode.append("<font color=\"LEVEL\">" + player.getName()
                  + "</font>");
              else htmlCode.append(player.getName());

              htmlCode.append("</a></td>");

              if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD) htmlCode.append(colSpacer);

              if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
              {
                  cell = 0;
                  htmlCode.append(trClose);
              }
          }
          if (cell > 0 && cell < Config.NAME_PER_ROW_COMMUNITYBOARD) htmlCode.append(trClose);
          htmlCode.append("</table><br></td></tr>");

          htmlCode.append(trOpen);
          htmlCode.append("<td><img src=\"sek.cbui355\" width=600 height=1><br></td>");
          htmlCode.append(trClose);

          htmlCode.append("</table>");

          if (getOnlineCount("gm") > Config.NAME_PAGE_SIZE_COMMUNITYBOARD)
          {
            htmlCode.append("<table border=0 width=600>");

            htmlCode.append("<tr>");
              if (page == 1) htmlCode.append("<td align=right width=190><button value=\"Prev\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              else htmlCode.append("<td align=right width=190><button value=\"Prev\" action=\"bypass _bbsloc;page;"
                  + (page - 1)
                  + "\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              htmlCode.append("<td FIXWIDTH=10></td>");
              htmlCode.append("<td align=center valign=top width=200>Displaying " + (((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + 1) + " - "
                  + (((page -1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + getOnlinePlayers(page).size()) + " player(s)</td>");
              htmlCode.append("<td FIXWIDTH=10></td>");
              if (getOnlineCount("gm") <= (page * Config.NAME_PAGE_SIZE_COMMUNITYBOARD)) htmlCode.append("<td width=190><button value=\"Next\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              else htmlCode.append("<td width=190><button value=\"Next\" action=\"bypass _bbsloc;page;"
                  + (page + 1)
                  + "\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              htmlCode.append("</tr>");
              htmlCode.append("</table>");
          }

          htmlCode.append("</body></html>");

          communityPage.put("gm", htmlCode.toString());

          htmlCode = new TextBuilder("<html><body><br>");
          htmlCode.append("<table>");

          htmlCode.append(trOpen);
          htmlCode.append("<td align=left valign=top>Server Restarted: " + GameServer.dateTimeServerStarted.getTime() + tdClose);
          htmlCode.append(trClose);

          htmlCode.append("</table>");

          htmlCode.append("<table>");

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + "XP Rate: " + Config.RATE_XP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Party XP Rate: " + Config.RATE_PARTY_XP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "XP Exponent: " + Config.ALT_GAME_EXPONENT_XP + tdClose);
          htmlCode.append(trClose);

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + "SP Rate: " + Config.RATE_SP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Party SP Rate: " + Config.RATE_PARTY_SP + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "SP Exponent: " + Config.ALT_GAME_EXPONENT_SP + tdClose);
          htmlCode.append(trClose);

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + "Drop Rate: " + Config.RATE_DROP_ITEMS + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Spoil Rate: " + Config.RATE_DROP_SPOIL + tdClose);
          htmlCode.append(colSpacer);
          htmlCode.append(tdOpen + "Adena Rate: " + Config.RATE_DROP_ADENA + tdClose);
          htmlCode.append(trClose);

          htmlCode.append("</table>");

          htmlCode.append("<table>");
          htmlCode.append(trOpen);
          htmlCode.append("<td><img src=\"sek.cbui355\" width=600 height=1><br></td>");
          htmlCode.append(trClose);

          htmlCode.append(trOpen);
          htmlCode.append(tdOpen + getOnlineCount("pl") + " Player(s) Online</td>");
          htmlCode.append(trClose);
          htmlCode.append("</table>");

          htmlCode.append("<table border=0>");
          htmlCode.append("<tr><td><table border=0>");

          cell = 0;
          for (L2PcInstance player : getOnlinePlayers(page))
          {
              if ((player == null) || (player.getAppearance().getInvisible()))
                  continue;                           // Go to next

              cell++;

              if (cell == 1) htmlCode.append(trOpen);

              htmlCode.append("<td align=left valign=top FIXWIDTH=110><a action=\"bypass _bbsloc;playerinfo;"
                  + player.getName() + "\">");

              if (player.isGM()) htmlCode.append("<font color=\"LEVEL\">" + player.getName()
                  + "</font>");
              else htmlCode.append(player.getName());

              htmlCode.append("</a></td>");

              if (cell < Config.NAME_PER_ROW_COMMUNITYBOARD) htmlCode.append(colSpacer);

              if (cell == Config.NAME_PER_ROW_COMMUNITYBOARD)
              {
                  cell = 0;
                  htmlCode.append(trClose);
              }
          }
          if (cell > 0 && cell < Config.NAME_PER_ROW_COMMUNITYBOARD) htmlCode.append(trClose);
          htmlCode.append("</table><br></td></tr>");

          htmlCode.append(trOpen);
          htmlCode.append("<td><img src=\"sek.cbui355\" width=600 height=1><br></td>");
          htmlCode.append(trClose);

          htmlCode.append("</table>");

          if (getOnlineCount("pl") > Config.NAME_PAGE_SIZE_COMMUNITYBOARD)
          {
            htmlCode.append("<table border=0 width=600>");

            htmlCode.append("<tr>");
              if (page == 1) htmlCode.append("<td align=right width=190><button value=\"Prev\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              else htmlCode.append("<td align=right width=190><button value=\"Prev\" action=\"bypass _bbsloc;page;"
                  + (page - 1)
                  + "\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              htmlCode.append("<td FIXWIDTH=10></td>");
              htmlCode.append("<td align=center valign=top width=200>Displaying " + (((page - 1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + 1) + " - "
                  + (((page -1) * Config.NAME_PAGE_SIZE_COMMUNITYBOARD) + getOnlinePlayers(page).size()) + " player(s)</td>");
              htmlCode.append("<td FIXWIDTH=10></td>");
              if (getOnlineCount("pl") <= (page * Config.NAME_PAGE_SIZE_COMMUNITYBOARD)) htmlCode.append("<td width=190><button value=\"Next\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              else htmlCode.append("<td width=190><button value=\"Next\" action=\"bypass _bbsloc;page;"
                  + (page + 1)
                  + "\" width=50 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
              htmlCode.append("</tr>");
              htmlCode.append("</table>");
          }

          htmlCode.append("</body></html>");

          communityPage.put("pl", htmlCode.toString());

          _communityPages.put(page, communityPage);
    }
  }
View Full Code Here

   * @param index
   */
  private void showMemoTopics(Forum forum, L2PcInstance activeChar, int index)
  {
    forum.vload();
        TextBuilder html = new TextBuilder("<html><body><br><br>");
    html.append("<table border=0 width=610><tr><td width=10></td><td width=600 align=left>");
    html.append("<a action=\"bypass _bbshome\">HOME</a>&nbsp;>&nbsp;<a action=\"bypass _bbsmemo\">Memo Form</a>");
    html.append("</td></tr>");
    html.append("</table>");
    html.append("<img src=\"L2UI.squareblank\" width=\"1\" height=\"10\">");
    html.append("<center>");
    html.append("<table border=0 cellspacing=0 cellpadding=2 bgcolor=888888 width=610>");
    html.append("<tr>");
    html.append("<td FIXWIDTH=5></td>");
    html.append("<td FIXWIDTH=415 align=center>&$413;</td>");
    html.append("<td FIXWIDTH=120 align=center></td>");
    html.append("<td FIXWIDTH=70 align=center>&$418;</td>");
    html.append("</tr>");
    html.append("</table>");

    for (int i = 0, j = getMaxID(forum) + 1; i < 12 * index; j--)
    {
      if (j < 0)
      {
        break;
      }
      Topic t = forum.gettopic(j);
      if (t != null)
      {
        if (i >= 12 * (index - 1))
        {
          html.append("<table border=0 cellspacing=0 cellpadding=5 WIDTH=610>");
          html.append("<tr>");
          html.append("<td FIXWIDTH=5></td>");
          html.append("<td FIXWIDTH=415><a action=\"bypass _bbsposts;read;" + forum.getID()
            + ";" + t.getID() + "\">" + t.getName() + "</a></td>");
          html.append("<td FIXWIDTH=120 align=center></td>");
          html.append("<td FIXWIDTH=70 align=center>"
            + DateFormat.getInstance().format(new Date(t.getDate())) + "</td>");
          html.append("</tr>");
          html.append("</table>");
          html.append("<img src=\"L2UI.Squaregray\" width=\"610\" height=\"1\">");
        }
        i++;
      }
    }

    html.append("<br>");
    html.append("<table width=610 cellspace=0 cellpadding=0>");
    html.append("<tr>");
    html.append("<td width=50>");
    html.append("<button value=\"&$422;\" action=\"bypass _bbsmemo\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\">");
    html.append("</td>");
    html.append("<td width=510 align=center>");
    html.append("<table border=0><tr>");

    if (index == 1)
    {
      html.append("<td><button action=\"\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");
    }
    else
    {
      html.append("<td><button action=\"bypass _bbstopics;read;" + forum.getID() + ";"
        + (index - 1)
        + "\" back=\"l2ui_ch3.prev1_down\" fore=\"l2ui_ch3.prev1\" width=16 height=16 ></td>");
    }
    int nbp;
    nbp = forum.getTopicSize() / 8;
    if (nbp * 8 != ClanTable.getInstance().getClans().length)
    {
      nbp++;
    }
    for (int i = 1; i <= nbp; i++)
    {
      if (i == index)
      {
        html.append("<td> " + i + " </td>");
      }
      else
      {
        html.append("<td><a action=\"bypass _bbstopics;read;" + forum.getID() + ";" + i + "\"> "
          + i + " </a></td>");
      }
    }
    if (index == nbp)
    {
      html.append("<td><button action=\"\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>");
    }
    else
    {
      html.append("<td><button action=\"bypass _bbstopics;read;" + forum.getID() + ";"
        + (index + 1)
        + "\" back=\"l2ui_ch3.next1_down\" fore=\"l2ui_ch3.next1\" width=16 height=16 ></td>");
    }

    html.append("</tr></table> </td> ");
    html.append("<td align=right><button value = \"&$421;\" action=\"bypass _bbstopics;crea;"
      + forum.getID()
      + "\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\" ></td></tr>");
    html.append("<tr><td><img src=\"l2ui.mini_logo\" width=5 height=10></td></tr>");
    html.append("<tr> ");
    html.append("<td></td>");
    html.append("<td align=center><table border=0><tr><td></td><td><edit var = \"Search\" width=130 height=11></td>");
    html.append("<td><button value=\"&$420;\" action=\"Write 5 -2 0 Search _ _\" back=\"l2ui_ch3.smallbutton2_down\" width=65 height=20 fore=\"l2ui_ch3.smallbutton2\"> </td> </tr></table> </td>");
    html.append("</tr>");
    html.append("</table>");
    html.append("<br>");
    html.append("<br>");
    html.append("<br>");
    html.append("</center>");
    html.append("</body>");
    html.append("</html>");
    separateAndSend(html.toString(), activeChar);
  }
View Full Code Here

    return s;
  }

  private void showMainPage(L2PcInstance activeChar) {
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
        TextBuilder replyMSG = new TextBuilder("<html><body>");

        replyMSG.append("<center><font color=\"LEVEL\"> [Manor System] </font></center><br>");
        replyMSG.append("<table width=\"100%\"><tr><td>");
        replyMSG.append("Disabled: " + (CastleManorManager.getInstance().isDisabled()?"yes":"no") + "</td><td>");
        replyMSG.append("Under Maintenance: " + (CastleManorManager.getInstance().isUnderMaintenance()?"yes":"no") + "</td></tr><tr><td>");
        replyMSG.append("Time to refresh: " + formatTime(CastleManorManager.getInstance().getMillisToManorRefresh()) + "</td><td>");
        replyMSG.append("Time to approve: " + formatTime(CastleManorManager.getInstance().getMillisToNextPeriodApprove()) + "</td></tr>");
        replyMSG.append("</table>");

        replyMSG.append("<center><table><tr><td>");
        replyMSG.append("<button value=\"Set Next\" action=\"bypass -h admin_manor_setnext\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td>");
        replyMSG.append("<button value=\"Approve Next\" action=\"bypass -h admin_manor_approve\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><tr><td>");
        replyMSG.append("<button value=\""+(CastleManorManager.getInstance().isUnderMaintenance()?"Set normal":"Set mainteance")+"\" action=\"bypass -h admin_manor_setmaintenance\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td>");
        replyMSG.append("<button value=\""+(CastleManorManager.getInstance().isDisabled()?"Enable":"Disable")+"\" action=\"bypass -h admin_manor_disable\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr><tr><td>");
        replyMSG.append("<button value=\"Refresh\" action=\"bypass -h admin_manor\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td>");
        replyMSG.append("<button value=\"Back\" action=\"bypass -h admin_admin\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
        replyMSG.append("</table></center>");

        replyMSG.append("<br><center>Castle Information:<table width=\"100%\">");
        replyMSG.append("<tr><td></td><td>Current Period</td><td>Next Period</td></tr>");

        for (Castle c : CastleManager.getInstance().getCastles()) {
          replyMSG.append("<tr><td>"+c.getName()+"</td>" +
                    "<td>"+c.getManorCost(CastleManorManager.PERIOD_CURRENT)+"a</td>" +
                "<td>"+c.getManorCost(CastleManorManager.PERIOD_NEXT)+"a</td>" +
              "</tr>");
        }

        replyMSG.append("</table><br>");

        replyMSG.append("</body></html>");

        adminReply.setHtml(replyMSG.toString());
        activeChar.sendPacket(adminReply);
  }
View Full Code Here

    }
  }

  private void showRemoveChat(L2PcInstance player)
  {
    TextBuilder html1 = new TextBuilder("<html><body>");
    html1.append("Select symbol you would like to remove:<br><br>");
    boolean hasHennas = false;

    for (int i=1;i<=3;i++)
    {
      L2HennaInstance henna = player.getHenna(i);

      if (henna != null)
      {
        hasHennas = true;
        html1.append("<a action=\"bypass -h npc_%objectId%_Remove "+i+"\">"+henna.getName()+"</a><br>");
      }
    }
    if (!hasHennas)
      html1.append("You don't have any symbol to remove!");
    html1.append("</body></html>");
    insertObjectIdAndShowChatWindow(player, html1.toString());
  }
View Full Code Here

  private void showCastleSelectPage(L2PcInstance activeChar)
  {
    int i=0;
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/castles.htm");
    TextBuilder cList = new TextBuilder();
    for (Castle castle: CastleManager.getInstance().getCastles())
    {
      if (castle != null)
      {
        String name=castle.getName();
        cList.append("<td fixwidth=90><a action=\"bypass -h admin_siege "+name+"\">"+name+"</a></td>");
        i++;
      }
      if (i>2)
      {
        cList.append("</tr><tr>");
        i=0;
      }
    }
    adminReply.replace("%castles%", cList.toString());
    cList.clear();
    i=0;
    for (ClanHall clanhall: ClanHallManager.getInstance().getClanHalls().values())
    {
      if (clanhall != null)
      {
        cList.append("<td fixwidth=134><a action=\"bypass -h admin_clanhall "+clanhall.getId()+"\">");
        cList.append(clanhall.getName()+"</a></td>");
        i++;
      }
      if (i>1)
      {
        cList.append("</tr><tr>");
        i=0;
      }
    }
    adminReply.replace("%clanhalls%", cList.toString());
    cList.clear();
    i=0;
    for (ClanHall clanhall: ClanHallManager.getInstance().getFreeClanHalls().values())
    {
      if (clanhall != null)
      {
        cList.append("<td fixwidth=134><a action=\"bypass -h admin_clanhall "+clanhall.getId()+"\">");
        cList.append(clanhall.getName()+"</a></td>");
        i++;
      }
      if (i>1)
      {
        cList.append("</tr><tr>");
        i=0;
      }
    }
    adminReply.replace("%freeclanhalls%", cList.toString());
    activeChar.sendPacket(adminReply);
  }
View Full Code Here

    }
  }

  private void showMonsters(L2PcInstance activeChar, int level, int from)
  {
    TextBuilder tb = new TextBuilder();

    L2NpcTemplate[] mobs = NpcTable.getInstance().getAllMonstersOfLevel(level);

    // Start
    tb.append("<html><title>Spawn Monster:</title><body><p> Level "+level+":<br>Total Npc's : "+mobs.length+"<br>");
    String end1 = "<br><center><button value=\"Next\" action=\"bypass -h admin_spawn_index "+level+" $from$\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>";
    String end2 = "<br><center><button value=\"Back\" action=\"bypass -h admin_show_spawns\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>";

    // Loop
    boolean ended = true;
    for (int i=from; i<mobs.length; i++)
    {
      String txt = "<a action=\"bypass -h admin_spawn_monster "+mobs[i].npcId+"\">"+mobs[i].name+"</a><br1>";

      if ((tb.length() + txt.length() + end2.length()) > 8192)
      {
        end1 = end1.replace("$from$", ""+i);
        ended = false;
        break;
      }

      tb.append(txt);
    }

    // End
    if (ended)
      tb.append(end2);
    else
      tb.append(end1);

    activeChar.sendPacket(new NpcHtmlMessage(5, tb.toString()));
  }
View Full Code Here

    activeChar.sendPacket(new NpcHtmlMessage(5, tb.toString()));
  }

  private void showNpcs(L2PcInstance activeChar, String starting, int from)
  {
    TextBuilder tb = new TextBuilder();
    L2NpcTemplate[] mobs = NpcTable.getInstance().getAllNpcStartingWith(starting);
    // Start
    tb.append("<html><title>Spawn Monster:</title><body><p> There are "+mobs.length+" Npcs whose name starts with "+starting+":<br>");
    String end1 = "<br><center><button value=\"Next\" action=\"bypass -h admin_npc_index "+starting+" $from$\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>";
    String end2 = "<br><center><button value=\"Back\" action=\"bypass -h admin_show_npcs\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>";
    // Loop
    boolean ended = true;
    for (int i=from; i<mobs.length; i++)
    {
      String txt = "<a action=\"bypass -h admin_spawn_monster "+mobs[i].npcId+"\">"+mobs[i].name+"</a><br1>";

      if ((tb.length() + txt.length() + end2.length()) > 8192)
      {
        end1 = end1.replace("$from$", ""+i);
        ended = false;
        break;
      }
      tb.append(txt);
    }
    // End
    if (ended)
      tb.append(end2);
    else
      tb.append(end1);
    activeChar.sendPacket(new NpcHtmlMessage(5, tb.toString()));
  }
View Full Code Here

    int SkillsEnd = skills.length;
    if (SkillsEnd - SkillsStart > MaxSkillsPerPage)
      SkillsEnd = SkillsStart + MaxSkillsPerPage;

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    TextBuilder replyMSG = new TextBuilder("<html><body>");
    replyMSG.append("<table width=260><tr>");
    replyMSG.append("<td width=40><button value=\"Main\" action=\"bypass -h admin_admin\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
    replyMSG.append("<td width=180><center>Character Selection Menu</center></td>");
    replyMSG.append("<td width=40><button value=\"Back\" action=\"bypass -h admin_show_skills\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
    replyMSG.append("</tr></table>");
    replyMSG.append("<br><br>");
    replyMSG.append("<center>Editing <font color=\"LEVEL\">" + player.getName() + "</font></center>");
    replyMSG.append("<br><table width=270><tr><td>Lv: " + player.getLevel() + " " + player.getTemplate().className + "</td></tr></table>");
    replyMSG.append("<br><table width=270><tr><td>Note: Dont forget that modifying players skills can</td></tr>");
    replyMSG.append("<tr><td>ruin the game...</td></tr></table>");
    replyMSG.append("<br><center>Click on the skill you wish to remove:</center>");
    replyMSG.append("<br>");
    String pages = "<center><table width=270><tr>";
    for (int x=0; x<MaxPages; x++)
    {
      int pagenr = x + 1;
      pages += "<td><a action=\"bypass -h admin_remove_skills " + x + "\">Page " + pagenr + "</a></td>";
    }
    pages += "</tr></table></center>";
    replyMSG.append(pages);
    replyMSG.append("<br><table width=270>");
    replyMSG.append("<tr><td width=80>Name:</td><td width=60>Level:</td><td width=40>Id:</td></tr>");
    for (int i = SkillsStart; i < SkillsEnd; i++)
      replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_remove_skill "+skills[i].getId()+"\">"+skills[i].getName()+"</a></td><td width=60>"+skills[i].getLevel()+"</td><td width=40>"+skills[i].getId()+"</td></tr>");
    replyMSG.append("</table>");
    replyMSG.append("<br><center><table>");
    replyMSG.append("Remove skill by ID :");
    replyMSG.append("<tr><td>Id: </td>");
    replyMSG.append("<td><edit var=\"id_to_remove\" width=110></td></tr>");
    replyMSG.append("</table></center>");
    replyMSG.append("<center><button value=\"Remove skill\" action=\"bypass -h admin_remove_skill $id_to_remove\" width=110 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
    replyMSG.append("<br><center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15></center>");
    replyMSG.append("</body></html>");
    adminReply.setHtml(replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
View Full Code Here

TOP

Related Classes of javolution.text.TextBuilder

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.