Package net.sf.l2j.gameserver.serverpackets

Examples of net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage


      StatusUpdate statusUpdate = new StatusUpdate(playerInstance.getObjectId());

      statusUpdate.addAttribute(StatusUpdate.CUR_LOAD, playerInstance.getCurrentLoad());
      playerInstance.sendPacket(statusUpdate);

      NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

      npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Your team won the event. Look in your inventory, there should be your reward.</body></html>");
      playerInstance.sendPacket(npcHtmlMessage);
    }

    return "TvT Event: Event finish. Team " + team.getName() + " won with " + team.getPoints() + " kills.";
  }
View Full Code Here


    if (playerInstance == null || !isParticipating())
      return;

    if (command.equals("tvt_event_participation"))
    {
      NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);
      int playerLevel = playerInstance.getLevel();

      if (playerInstance.isCursedWeaponEquiped())
        npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Cursed weapon owners are not allowed to participate.</body></html>");
      else if (playerInstance.getKarma() > 0)
        npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Chaotic players are not allowed to participate.</body></html>");
      else if (_teams[0].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS && _teams[1].getParticipatedPlayerCount() >= Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS)
        npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Sorry the event is full!</body></html>");
      else if (playerLevel < Config.TVT_EVENT_MIN_LVL || playerLevel > Config.TVT_EVENT_MAX_LVL)
        npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>Only players from level " + Config.TVT_EVENT_MIN_LVL + " to level " + Config.TVT_EVENT_MAX_LVL + " are allowed tro participate.</body></html>");
      else if (_teams[0].getParticipatedPlayerCount() > 19 && _teams[1].getParticipatedPlayerCount() > 19)
        npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>The event is full! Maximum of " + Config.TVT_EVENT_MAX_PLAYERS_IN_TEAMS + "  player are allowed in one team.</body></html>");
      else if (addParticipant(playerInstance))
        npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>You are on the registration list now.</body></html>");
      else // addParticipant returned false cause playerInstance == null
        return;

      playerInstance.sendPacket(npcHtmlMessage);
    }
    else if (command.equals("tvt_event_remove_participation"))
    {
      removeParticipant(playerInstance.getName());

      NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0);

      npcHtmlMessage.setHtml("<html><head><title>TvT Event</title></head><body>You are not longer on the registration list.</body></html>");
      playerInstance.sendPacket(npcHtmlMessage);
    }
  }
View Full Code Here

      asl.addSkill(s.getId(), s.getLevel(), s.getLevel(), s.getSpCost(), 1);
    }

    if (counts == 0)
    {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        int minlevel = SkillTreeTable.getInstance().getMinLevelForNewSkill(player);

        if (minlevel > 0)
            {
                // No more skills to learn, come back when you level.
            SystemMessage sm = new SystemMessage(SystemMessageId.DO_NOT_HAVE_FURTHER_SKILLS_TO_LEARN);
            sm.addNumber(minlevel);
            player.sendPacket(sm);
        }
            else
            {
                TextBuilder sb = new TextBuilder();
                sb.append("<html><head><body>");
                sb.append("You've learned all skills.<br>");
                sb.append("</body></html>");
                html.setHtml(sb.toString());
                player.sendPacket(html);
        }
    }
    else
    {
View Full Code Here

        }
         else if (command.startsWith("admin_event_see"))
        {
            String eventName = command.substring(16);
            try {
                NpcHtmlMessage adminReply = new NpcHtmlMessage(5);


                DataInputStream in =
                    new DataInputStream(
                      new BufferedInputStream(
                        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

        adminReply.setHtml(replyMSG.toString());
        activeChar.sendPacket(adminReply);
  }
    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

        adminReply.setHtml(replyMSG.toString());
        activeChar.sendPacket(adminReply);
    }
    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

        }
        L2Event.announceAllPlayers(activeChar.getName() + " wants to make an event !!! (you'll find a npc with the details around)");
    }
   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

    {
     player.getInventory().addItem("Event", id, num, player, activeChar);
        ItemList il = new ItemList(player, true);
        player.sendPacket(il);

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

        replyMSG.append("CONGRATULATIONS, you should have a present in your inventory");
        replyMSG.append("</body></html>");

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

  {
        if (path.indexOf("..") != -1)
            return;

    String filename = "data/html/help/"+path;
    NpcHtmlMessage html = new NpcHtmlMessage(1);
    html.setFile(filename);
    activeChar.sendPacket(html);
  }
View Full Code Here

TOP

Related Classes of net.sf.l2j.gameserver.serverpackets.NpcHtmlMessage

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.