Package javolution.text

Examples of javolution.text.TextBuilder


                        showChatWindow(player, 3, "c", false);
                    else
                        showChatWindow(player, 3, "d", false);
                    break;
                case 4: // Current High Scores
                    TextBuilder strBuffer = new TextBuilder("<html><body>Festival Guide:<br>These are the top scores of the week, for the ");

                    final StatsSet dawnData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DAWN, _festivalType);
                    final StatsSet duskData = SevenSignsFestival.getInstance().getHighestScoreData(SevenSigns.CABAL_DUSK, _festivalType);
                    final StatsSet overallData = SevenSignsFestival.getInstance().getOverallHighestScoreData(_festivalType);

                    final int dawnScore = dawnData.getInteger("score");
                    final int duskScore = duskData.getInteger("score");
                    int overallScore = 0;

                    // If no data is returned, assume there is no record, or all scores are 0.
                    if (overallData != null)
                        overallScore = overallData.getInteger("score");

                    strBuffer.append(SevenSignsFestival.getFestivalName(_festivalType) + " festival.<br>");

                    if (dawnScore > 0)
                        strBuffer.append("Dawn: " + calculateDate(dawnData.getString("date")) + ". Score " + dawnScore + "<br>" + dawnData.getString("members") + "<br>");
                    else
                        strBuffer.append("Dawn: No record exists. Score 0<br>");

                    if (duskScore > 0)
                        strBuffer.append("Dusk: " + calculateDate(duskData.getString("date")) + ". Score " + duskScore + "<br>" + duskData.getString("members") + "<br>");
                    else
                        strBuffer.append("Dusk: No record exists. Score 0<br>");

                    if (overallScore > 0) {
                        String cabalStr = "Children of Dusk";

                        if (overallData.getString("cabal").equals("dawn"))
                            cabalStr = "Children of Dawn";

                        strBuffer.append("Consecutive top scores: " + calculateDate(overallData.getString("date")) + ". Score " + overallScore + "<br>Affilated side: " + cabalStr + "<br>" + overallData.getString("members") + "<br>");
                    }
                    else
                        strBuffer.append("Consecutive top scores: No record exists. Score 0<br>");

                    strBuffer.append("<a action=\"bypass -h npc_" + getObjectId() + "_Chat 0\">Go back.</a></body></html>");

                    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                    html.setHtml(strBuffer.toString());
                    player.sendPacket(html);
                    break;
                case 8: // Increase the Festival Challenge
                    if (playerParty == null)
                        return;
View Full Code Here


        player.sendPacket( new ActionFailed() );
    }

    private final String getStatsTable()
    {
        TextBuilder tableHtml = new TextBuilder();

        // Get the scores for each of the festival level ranges (types).
        for (int i = 0; i < 5; i++)
        {
            int dawnScore = SevenSignsFestival.getInstance().getHighestScore(SevenSigns.CABAL_DAWN, i);
            int duskScore = SevenSignsFestival.getInstance().getHighestScore(SevenSigns.CABAL_DUSK, i);
            String festivalName = SevenSignsFestival.getFestivalName(i);
            String winningCabal = "Children of Dusk";

            if (dawnScore > duskScore)
                winningCabal = "Children of Dawn";
            else if (dawnScore == duskScore)
                winningCabal = "None";

            tableHtml.append("<tr><td width=\"100\" align=\"center\">" + festivalName + "</td><td align=\"center\" width=\"35\">" +
                             duskScore + "</td><td align=\"center\" width=\"35\">" + dawnScore + "</td><td align=\"center\" width=\"130\">" + winningCabal + "</td></tr>");
        }

        return tableHtml.toString();
    }
View Full Code Here

        return tableHtml.toString();
    }

    private final String getBonusTable()
    {
        TextBuilder tableHtml = new TextBuilder();

        // Get the accumulated scores for each of the festival level ranges (types).
        for (int i = 0; i < 5; i++)
        {
            int accumScore = SevenSignsFestival.getInstance().getAccumulatedBonus(i);
            String festivalName = SevenSignsFestival.getFestivalName(i);

            tableHtml.append("<tr><td align=\"center\" width=\"150\">" + festivalName + "</td><td align=\"center\" width=\"150\">" + accumScore + "</td></tr>");
        }

        return tableHtml.toString();
    }
View Full Code Here

     * @param quests The table containing quests of the L2NpcInstance
     *
     */
    public void showQuestChooseWindow(L2PcInstance player, Quest[] quests)
    {
        TextBuilder sb = new TextBuilder();
       
        sb.append("<html><body><title>Talk about:</title><br>");
       
        for (Quest q : quests)
        {
            sb.append("<a action=\"bypass -h npc_").append(getObjectId())
            .append("_Quest ").append(q.getName()).append("\">")
            .append(q.getDescr()).append("</a><br>");
        }
       
        sb.append("</body></html>");
       
        // Send a Server->Client packet NpcHtmlMessage to the L2PcInstance in order to display the message of the L2NpcInstance
        insertObjectIdAndShowChatWindow(player, sb.toString());
    }
View Full Code Here

                                                                             new FileInputStream(
                                                                                                 "data/events/"
                                                                                                     + eventName)));
            BufferedReader inbr = new BufferedReader(new InputStreamReader(in));

            TextBuilder replyMSG = new TextBuilder("<html><body>");
            replyMSG.append("<center><font color=\"LEVEL\">" + eventName
                + "</font><font color=\"FF0000\"> bY " + inbr.readLine() + "</font></center><br>");

            replyMSG.append("<br>" + inbr.readLine());
            if (L2Event.participatingPlayers.contains(player.getName())) replyMSG.append("<br><center>You are already in the event players list !!</center></body></html>");
            else replyMSG.append("<br><center><button value=\"Participate !! \" action=\"bypass -h npc_"
                + objectid
                + "_event_participate\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center></body></html>");

            adminReply.setHtml(replyMSG.toString());
            player.sendPacket(adminReply);
        }
        catch (Exception e)
        {
            System.out.println(e);
View Full Code Here

                        new FileInputStream ("data/events/" + eventName)));
                  BufferedReader inbr =
                    new BufferedReader(new InputStreamReader(in));


                TextBuilder replyMSG = new TextBuilder("<html><body>");
                replyMSG.append("<center><font color=\"LEVEL\">" + eventName + "</font><font color=\"FF0000\"> bY " + inbr.readLine() + "</font></center><br>");

                replyMSG.append("<br>" + inbr.readLine());
                replyMSG.append("</body></html>");
                adminReply.setHtml(replyMSG.toString());
                activeChar.sendPacket(adminReply);
                }
                catch (Exception e) {System.out.println(e);}

        }
        else if (command.startsWith("admin_event_del"))
        {
            String eventName = command.substring(16);
            File file = new File("data/events/" + eventName);
            file.delete();
            showMainPage(activeChar);

        }

        else if (command.startsWith("admin_event_name"))
        {
            tempName+=command.substring(17);
            showNewEventPage(activeChar);

        }

        else if (command.equalsIgnoreCase("admin_delete_buffer"))
        {
            try {tempBuffer+=tempBuffer.substring(0,tempBuffer.length()-10);
            showNewEventPage(activeChar); }
            catch (Exception e) {tempBuffer="";}
        }

        else if (command.startsWith("admin_event_store"))
        {

            try{
                FileOutputStream file = new FileOutputStream("data/events/" + tempName);
                PrintStream p = new PrintStream(file);
                p.println(activeChar.getName());
                p.println(tempBuffer);
                file.close();
            }
            catch (Exception e) {System.out.println(e);}
            tempBuffer = "";
            tempName = "";
            showMainPage(activeChar);
        }
        else if (command.startsWith("admin_event_set"))
        {
            L2Event.eventName = command.substring(16);
            showEventParameters(activeChar, 2);

        }
        else if (command.startsWith("admin_event_change_teams_number"))
        {
            showEventParameters(activeChar, Integer.parseInt(command.substring(32)));
                }
        else if (command.startsWith("admin_event_panel"))
        {
             showEventControl(activeChar);
         }
        else if (command.startsWith("admin_event_control_begin"))
        {


            try {

            L2Event.active = true;
            L2Event.players.clear();
            L2Event.connectionLossData.clear();

            for(int j=0;j<L2Event.teamsNumber;j++){
                LinkedList<String> link = new LinkedList<String>();
                L2Event.players.put(j+1,link);

            }
            int i = 0;



            while(L2Event.participatingPlayers.size()>0){
                String target = getMaxLeveledPlayer();

                if(!target.equals("")) {

                    L2Event.players.get(i+1).add(target);
                    i=(i+1)%L2Event.teamsNumber;
                }



            }

            destroyEventNpcs();
            npcsDeleted = true;

            } catch(Exception e) {System.out.println(e);}
            showEventControl(activeChar);
        }
        else if (command.startsWith("admin_event_control_teleport"))
        {
            StringTokenizer st = new StringTokenizer(command.substring(29),"-");

            while(st.hasMoreElements()){
                teleportTeam(activeChar, Integer.parseInt(st.nextToken()));
            }
            showEventControl(activeChar);
        }


        else if (command.startsWith("admin_event_control_sit"))
        {
            StringTokenizer st = new StringTokenizer(command.substring(24),"-");

            while(st.hasMoreElements()){
                sitTeam(Integer.parseInt(st.nextToken()));
            }
            showEventControl(activeChar);
        }
        else if (command.startsWith("admin_event_control_kill"))
        {
            StringTokenizer st = new StringTokenizer(command.substring(25),"-");

            while(st.hasMoreElements()){
                killTeam(activeChar, Integer.parseInt(st.nextToken()));
            }
            showEventControl(activeChar);
        }
        else if (command.startsWith("admin_event_control_res"))
        {
            StringTokenizer st = new StringTokenizer(command.substring(24),"-");

            while(st.hasMoreElements()){
                resTeam(Integer.parseInt(st.nextToken()));
            }
            showEventControl(activeChar);
        }
          else if (command.startsWith("admin_event_control_poly"))
        {
            StringTokenizer st0 = new StringTokenizer(command.substring(25));
            StringTokenizer st = new StringTokenizer(st0.nextToken(),"-");
            String id = st0.nextToken();
            while(st.hasMoreElements()){
                polyTeam(Integer.parseInt(st.nextToken()), id);
            }
            showEventControl(activeChar);
        }
        else if (command.startsWith("admin_event_control_unpoly"))
        {
            StringTokenizer st = new StringTokenizer(command.substring(27),"-");

            while(st.hasMoreElements()){
                unpolyTeam(Integer.parseInt(st.nextToken()));
            }
            showEventControl(activeChar);
        }
        else if (command.startsWith("admin_event_control_prize"))
        {
            StringTokenizer st0 = new StringTokenizer(command.substring(26));
            StringTokenizer st = new StringTokenizer(st0.nextToken(),"-");
            String n = st0.nextToken();
            StringTokenizer st1 = new StringTokenizer(n,"*");
            n = st1.nextToken();
            String type = "";
            if(st1.hasMoreElements()) type = st1.nextToken();

            String id = st0.nextToken();
            while(st.hasMoreElements()){
                regardTeam(activeChar, Integer.parseInt(st.nextToken()),Integer.parseInt(n), Integer.parseInt(id), type);
            }
            showEventControl(activeChar);
        }
        else if (command.startsWith("admin_event_control_finish"))
        {
            for(int i = 0; i<L2Event.teamsNumber; i++){
                telePlayersBack(i+1);
            }

            L2Event.eventName = "";
            L2Event.teamsNumber = 0;
            L2Event.names.clear();
            L2Event.participatingPlayers.clear();
            L2Event.players.clear();
            L2Event.id = 12760;
            L2Event.npcs.clear();
            L2Event.active = false;
            npcsDeleted = false;


        }


        else if (command.startsWith("admin_event_announce"))
        {
            StringTokenizer st = new StringTokenizer(command.substring(21));
            L2Event.id = Integer.parseInt(st.nextToken());
            L2Event.teamsNumber = Integer.parseInt(st.nextToken());
            String temp = " ";
            String temp2 = "";
            while(st.hasMoreElements()){
                temp+=st.nextToken() + " ";
            }

            st = new StringTokenizer(temp,"-");

            Integer i = 1;

            while(st.hasMoreElements()){
                temp2 = st.nextToken();
                if(!temp2.equals(" ")){
                 L2Event.names.put (i, temp2.substring(1,temp2.length()-1));
                 i++;}
            }


            L2Event.participatingPlayers.clear();

            muestraNpcConInfoAPlayers(activeChar, L2Event.id);

            PlaySound _snd = new PlaySound(1,"B03_F",0,0,0,0,0);
            activeChar.sendPacket(_snd);
            activeChar.broadcastPacket(_snd);

            NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

            TextBuilder replyMSG = new TextBuilder("<html><body>");

            replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE</font></center><br>");
            replyMSG.append("<center>The event <font color=\"LEVEL\">"+ L2Event.eventName + "</font> has been announced, now you can type //event_panel to see the event panel control</center><br>");
            replyMSG.append("</body></html>");
            adminReply.setHtml(replyMSG.toString());
            activeChar.sendPacket(adminReply);
      }


    return true;
View Full Code Here

    public void showMainPage(L2PcInstance activeChar)
  {
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

    TextBuilder replyMSG = new TextBuilder("<html><body>");

    replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>");
    replyMSG.append("<br><center><button value=\"Create NEW event \" action=\"bypass -h admin_event_new\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
    replyMSG.append("<center><br>Stored Events<br></center>");
    replyMSG.append(showStoredEvents());
        replyMSG.append("</body></html>");

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

  }
    public void showNewEventPage(L2PcInstance activeChar)
    {
        NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

        TextBuilder replyMSG = new TextBuilder("<html><body>");

        replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>");
        replyMSG.append("<br><center>Event's Title <br><font color=\"LEVEL\">");
        if(tempName.equals(""))
            replyMSG.append("Use //event_name text to insert a new title");
        else replyMSG.append(tempName);
        replyMSG.append("</font></center><br><br>Event's description<br>");
       if(tempBuffer.equals(""))
            replyMSG.append("Use //add text o //delete_buffer to modify this text field");
        else replyMSG.append(tempBuffer);

       if(!(tempName.equals("")&&tempBuffer.equals(""))) replyMSG.append("<br><button value=\"Crear\" action=\"bypass -h admin_event_store\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");


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

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

    }
    public void showEventParameters(L2PcInstance activeChar, int teamnumbers)
    {
        NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

        TextBuilder replyMSG = new TextBuilder("<html><body>");

        replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br>");
        replyMSG.append("<center><font color=\"LEVEL\">" + L2Event.eventName + "</font></center><br>");
        replyMSG.append("<br><center><button value=\"Change number of teams to\" action=\"bypass -h admin_event_change_teams_number $event_teams_number\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"> <edit var=\"event_teams_number\" width=100 height=20><br><br>");
        replyMSG.append("<font color=\"LEVEL\">Team's Names</font><br>");
        for (int i = 0; i<teamnumbers; i++){
            replyMSG.append((i+1) + ".- <edit var=\"event_teams_name" + (i+1) + "\" width=100 height=20><br>");
        }
        replyMSG.append("<br><br>Announcer NPC id<edit var=\"event_npcid\" width=100 height=20><br><br><button value=\"Announce Event!!\" action=\"bypass -h admin_event_announce $event_npcid " + teamnumbers + " ");
        for (int i = 0; i<teamnumbers; i++){
            replyMSG.append("$event_teams_name" + (i+1) + " - ");
        }
        replyMSG.append("\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
        replyMSG.append("</body></html>");

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

    }
   void showEventControl(L2PcInstance activeChar){

       NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

       TextBuilder replyMSG = new TextBuilder("<html><body>");

       replyMSG.append("<center><font color=\"LEVEL\">[ L2J EVENT ENGINE ]</font></center><br><font color=\"LEVEL\">" + L2Event.eventName + "</font><br><br><table width=200>");
       replyMSG.append("<tr><td>Apply this command to teams number </td><td><edit var=\"team_number\" width=100 height=15></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       if(!npcsDeleted) replyMSG.append("<tr><td><button value=\"Start\" action=\"bypass -h admin_event_control_begin\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><font color=\"LEVEL\">Destroys all event npcs so no more people can't participate now on</font></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"Teleport\" action=\"bypass -h admin_event_control_teleport $team_number\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><font color=\"LEVEL\">Teleports the specified team to your position</font></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"Sit\" action=\"bypass -h admin_event_control_sit $team_number\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><font color=\"LEVEL\">Sits/Stands up the team</font></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"Kill\" action=\"bypass -h admin_event_control_kill $team_number\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><font color=\"LEVEL\">Finish with the life of all the players in the selected team</font></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"Resurrect\" action=\"bypass -h admin_event_control_res $team_number\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><font color=\"LEVEL\">Resurrect Team's members</font></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"Polymorph\" action=\"bypass -h admin_event_control_poly $team_number $poly_id\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><edit var=\"poly_id\" width=100 height=15><font color=\"LEVEL\">Polymorphs the team into the NPC with the id specified</font></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"UnPolymorph\" action=\"bypass -h admin_event_control_unpoly $team_number\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><font color=\"LEVEL\">Unpolymorph the team</font></td></tr>");replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"Give Item\" action=\"bypass -h admin_event_control_prize $team_number $n $id\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"> number <edit var=\"n\" width=100 height=15> item id <edit var=\"id\" width=100 height=15></td><td><font color=\"LEVEL\">Give the specified item id to every single member of the team, you can put 5*level, 5*kills or 5 in the number field for example</font></td></tr>");
       replyMSG.append("<tr><td>&nbsp;</td></tr>");
       replyMSG.append("<tr><td><button value=\"End\" action=\"bypass -h admin_event_control_finish\" width=90 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><td><font color=\"LEVEL\">Will finish the event teleporting back all the players</font></td></tr>");
       replyMSG.append("</table></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.