Package net.sf.l2j.gameserver.serverpackets

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


  {
    int CharactersFound = 0;
    String name;
    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers();
    L2PcInstance[] players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/charfind.htm");
    TextBuilder replyMSG = new TextBuilder();
    for (int i = 0; i < players.length; i++)
    {  //Add player info into new Table row
      name = players[i].getName();
      if (name.toLowerCase().contains(CharacterToFind.toLowerCase()))
      {
        CharactersFound = CharactersFound+1;
        replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_list "+name+"\">"+name+"</a></td><td width=110>" + players[i].getTemplate().className + "</td><td width=40>"+players[i].getLevel()+"</td></tr>");
      }
      if (CharactersFound > 20)
        break;
    }
    adminReply.replace("%results%", replyMSG.toString());
    replyMSG.clear();
    if (CharactersFound==0)
      replyMSG.append("s. Please try again.");
    else if (CharactersFound > 20)
    {
      adminReply.replace("%number%", " more than 20");
      replyMSG.append("s.<br>Please refine your search to see all of the results.");
    }
    else if (CharactersFound==1)
      replyMSG.append(".");
    else
      replyMSG.append("s.");
    adminReply.replace("%number%", String.valueOf(CharactersFound));
    adminReply.replace("%end%", replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
View Full Code Here


    Collection<L2PcInstance> allPlayers = L2World.getInstance().getAllPlayers();
    L2PcInstance[] players = allPlayers.toArray(new L2PcInstance[allPlayers.size()]);
    int CharactersFound = 0;
    String name,ip="0.0.0.0";
    TextBuilder replyMSG = new TextBuilder();
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/ipfind.htm");
    for (int i = 0; i < players.length; i++)
    {
      ip=players[i].getClient().getConnection().getInetAddress().getHostAddress();
      if (ip.equals(IpAdress))
      {
        name = players[i].getName();
        CharactersFound = CharactersFound+1;
        replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_list "+name+"\">"+name+"</a></td><td width=110>" + players[i].getTemplate().className + "</td><td width=40>"+players[i].getLevel()+"</td></tr>");
      }
      if (CharactersFound > 20)
        break;
    }
    adminReply.replace("%results%", replyMSG.toString());
    replyMSG.clear();
    if (CharactersFound==0)
      replyMSG.append("s. Maybe they got d/c? :)");
    else if (CharactersFound > 20)
    {
      adminReply.replace("%number%", " more than "+String.valueOf(CharactersFound));
      replyMSG.append("s.<br>In order to avoid you a client crash I won't <br1>display results beyond the 20th character.");
    }
    else if (CharactersFound==1)
      replyMSG.append(".");
    else
      replyMSG.append("s.");
    adminReply.replace("%ip%", ip);
    adminReply.replace("%number%", String.valueOf(CharactersFound));
    adminReply.replace("%end%", replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
View Full Code Here

      if (player == null)
        throw new IllegalArgumentException("Player doesn't exist");
      chars=player.getAccountChars();
      account = player.getAccountName();
      TextBuilder replyMSG = new TextBuilder();
      NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
      adminReply.setFile("data/html/admin/accountinfo.htm");
      for (String charname : chars.values())
        replyMSG.append(charname+"<br1>");
      adminReply.replace("%characters%", replyMSG.toString());
      adminReply.replace("%account%", account);
      adminReply.replace("%player%", characterName);
      activeChar.sendPacket(adminReply);
    }
    else
      throw new IllegalArgumentException("Malformed character name");
  }
View Full Code Here

            else
            {
                // If player is a lord of this manor, alternative message from NPC
                if (CastleManorManager.getInstance().isDisabled())
                {
                    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                    html.setFile("data/html/npcdefault.htm");
                    html.replace("%objectId%", String.valueOf(getObjectId()));
                    html.replace("%npcname%", getName());
                    player.sendPacket(html);
                }
                else if (!player.isGM()                                         // Player is not GM
                        && getCastle() != null && getCastle().getCastleId() > 0 // Verification of castle
                        && player.getClan() != null                             // Player have clan
View Full Code Here

                           // to return from "Territory status"
                             // to initial screen.
  }

  private void showMessageWindow(L2PcInstance player, String filename) {
    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
    html.setFile(getHtmlPath() + filename);
    html.replace("%objectId%", String.valueOf(getObjectId()));
    html.replace("%npcId%", String.valueOf(getNpcId()));
    html.replace("%npcname%", getName());
    player.sendPacket(html);
  }
View Full Code Here

    else
    {
      activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
      return;
    }
    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/expsp.htm");
    adminReply.replace("%name%", player.getName());
    adminReply.replace("%level%", String.valueOf(player.getLevel()));
    adminReply.replace("%xp%", String.valueOf(player.getExp()));
    adminReply.replace("%sp%", String.valueOf(player.getSp()));
    adminReply.replace("%class%", player.getTemplate().className);
    activeChar.sendPacket(adminReply);
  }
View Full Code Here

                su.addAttribute(StatusUpdate.CUR_HP, (int) getCurrentHp());
                su.addAttribute(StatusUpdate.MAX_HP, getMaxHp());
                player.sendPacket(su);
            }

            NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
            TextBuilder html1 = new TextBuilder("<html><body><table border=0>");
            html1.append("<tr><td>Current Target:</td></tr>");
            html1.append("<tr><td><br></td></tr>");

            html1.append("<tr><td>Object ID: " + getObjectId() + "</td></tr>");
            html1.append("<tr><td>Template ID: " + getTemplate().npcId + "</td></tr>");
            html1.append("<tr><td><br></td></tr>");

            html1.append("<tr><td>HP: " + getCurrentHp() + "</td></tr>");
            html1.append("<tr><td>MP: " + getCurrentMp() + "</td></tr>");
            html1.append("<tr><td>Level: " + getLevel() + "</td></tr>");
            html1.append("<tr><td><br></td></tr>");

            html1.append("<tr><td>Class: " + getClass().getName() + "</td></tr>");
            html1.append("<tr><td><br></td></tr>");

            //changed by terry 2005-02-22 21:45
            html1.append("</table><table><tr><td><button value=\"Edit NPC\" action=\"bypass -h admin_edit_npc "
                + getTemplate().npcId
                + "\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td>");
            html1.append("<td><button value=\"Kill\" action=\"bypass -h admin_kill\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
            html1.append("<tr><td><button value=\"Show DropList\" action=\"bypass -h admin_show_droplist "
                + getTemplate().npcId
                + "\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
            html1.append("<td><button value=\"Delete\" action=\"bypass -h admin_delete\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td></tr>");
            html1.append("</table>");

            if (player.isGM())
            {
                html1.append("<button value=\"View Shop\" action=\"bypass -h admin_showShop "
                    + getTemplate().npcId
                    + "\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></br>");
                html1.append("<button value=\"Lease next week\" action=\"bypass -h npc_" + getObjectId()
                    + "_Lease\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
                html1.append("<button value=\"Abort current leasing\" action=\"bypass -h npc_"
                    + getObjectId()
                    + "_Lease next\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
                html1.append("<button value=\"Manage items\" action=\"bypass -h npc_" + getObjectId()
                    + "_Lease manage\" width=100 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
            }

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

            html.setHtml(html1.toString());
            player.sendPacket(html);
        }
        player.sendPacket(new ActionFailed());
    }
View Full Code Here

            return;
        }

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

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

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

        L2ItemInstance i;
        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;
        }

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

        for (L2PcInstance p : player.getParty().getPartyMembers())
View Full Code Here

        }
    }

    public void showHtmlFile(L2PcInstance player, String file, L2NpcInstance npc)
    {
        NpcHtmlMessage html = new NpcHtmlMessage(npc.getObjectId());
        html.setFile(file);
        html.replace("%npc_name%", npc.getName());
        player.sendPacket(html);
    }
View Full Code Here

    int CharactersStart = MaxCharactersPerPage*page;
    int CharactersEnd = players.length;
    if (CharactersEnd - CharactersStart > MaxCharactersPerPage)
      CharactersEnd = CharactersStart + MaxCharactersPerPage;

    NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
    adminReply.setFile("data/html/admin/charlist.htm");
    TextBuilder replyMSG = new TextBuilder();
    for (int x=0; x<MaxPages; x++)
    {
      int pagenr = x + 1;
      replyMSG.append("<center><a action=\"bypass -h admin_show_characters " + x + "\">Page " + pagenr + "</a></center>");
    }
    adminReply.replace("%pages%", replyMSG.toString());
    replyMSG.clear();
    for (int i = CharactersStart; i < CharactersEnd; i++)
    {  //Add player info into new Table row
      replyMSG.append("<tr><td width=80><a action=\"bypass -h admin_character_info " + players[i].getName() + "\">" + players[i].getName() + "</a></td><td width=110>" + players[i].getTemplate().className + "</td><td width=40>" + players[i].getLevel() + "</td></tr>");
    }
    adminReply.replace("%players%", replyMSG.toString());
    activeChar.sendPacket(adminReply);
  }
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.