Package net.sf.l2j.gameserver.serverpackets

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


                    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


        String filename = SevenSigns.SEVEN_SIGNS_HTML_PATH + "festival/";
        filename += (isDescription) ? "desc_" : "festival_";
        filename += (suffix != null) ? val + suffix + ".htm" : val + ".htm";

        // Send a Server->Client NpcHtmlMessage containing the text of the L2NpcInstance to the L2PcInstance
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(filename);
        html.replace("%objectId%",String.valueOf(getObjectId()));
        html.replace("%festivalType%", SevenSignsFestival.getFestivalName(_festivalType));
        html.replace("%cycleMins%", String.valueOf(SevenSignsFestival.getInstance().getMinsToNextCycle()));
        if (!isDescription && "2b".equals(val + suffix))
            html.replace("%minFestivalPartyMembers%", String.valueOf(Config.ALT_FESTIVAL_MIN_PLAYER));

        // If the stats or bonus table is required, construct them.
        if (val == 5) html.replace("%statsTable%", getStatsTable());
        if (val == 6) html.replace("%bonusTable%", getBonusTable());

  //festival's fee
  if (val == 1)
        {
        html.replace("%blueStoneNeeded%",String.valueOf(_blueStonesNeeded));
        html.replace("%greenStoneNeeded%",String.valueOf(_greenStonesNeeded));
        html.replace("%redStoneNeeded%",String.valueOf(_redStonesNeeded));
        }

        player.sendPacket(html);

        // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
View Full Code Here

        else
        {
          activeChar.sendPacket(new SystemMessage(SystemMessageId.INCORRECT_TARGET));
            return;
        }
        NpcHtmlMessage adminReply = new NpcHtmlMessage(5);

        TextBuilder replyMSG = new TextBuilder("<html><title>Teleport Character</title>");
        replyMSG.append("<body>");
        replyMSG.append("The character you will teleport is " + player.getName() + ".");
        replyMSG.append("<br>");

        replyMSG.append("Co-ordinate x");
        replyMSG.append("<edit var=\"char_cord_x\" width=110>");
        replyMSG.append("Co-ordinate y");
        replyMSG.append("<edit var=\"char_cord_y\" width=110>");
        replyMSG.append("Co-ordinate z");
        replyMSG.append("<edit var=\"char_cord_z\" width=110>");
        replyMSG.append("<button value=\"Teleport\" action=\"bypass -h admin_teleport_character $char_cord_x $char_cord_y $char_cord_z\" width=60 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
        replyMSG.append("<button value=\"Teleport near you\" action=\"bypass -h admin_teleport_character " + activeChar.getX() + " " + activeChar.getY() + " " + activeChar.getZ() + "\" width=115 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\">");
        replyMSG.append("<center><button value=\"Back\" action=\"bypass -h admin_current_player\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></center>");
        replyMSG.append("</body></html>");

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

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

            // Send a Server->Client NpcHtmlMessage() containing the GM console about this L2NpcInstance
            NpcHtmlMessage html = new NpcHtmlMessage(0);
            TextBuilder html1 = new TextBuilder("<html><body><center><font color=\"LEVEL\">NPC Information</font></center>");
            String className = getClass().getName().substring(43);
            html1.append("<br>");

            html1.append("Instance Type: " + className + "<br1>Faction: " + getFactionId() + "<br1>Location ID: " + (getSpawn() != null ? getSpawn().getLocation() : 0) + "<br1>");

            if (this instanceof L2ControllableMobInstance)
                html1.append("Mob Group: " + MobGroupTable.getInstance().getGroupForMob((L2ControllableMobInstance)this).getGroupId() + "<br>");
            else
                html1.append("Respawn Time: " + (getSpawn()!=null ? (getSpawn().getRespawnDelay() / 1000)+"  Seconds<br>" : "?  Seconds<br>"));

            html1.append("<table border=\"0\" width=\"100%\">");
            html1.append("<tr><td>Object ID</td><td>"+getObjectId()+"</td><td>NPC ID</td><td>"+getTemplate().npcId+"</td></tr>");
            html1.append("<tr><td>Castle</td><td>"+getCastle().getCastleId()+"</td><td>Coords</td><td>"+getX()+","+getY()+","+getZ()+"</td></tr>");
            html1.append("<tr><td>Level</td><td>"+getLevel()+"</td><td>Aggro</td><td>"+((this instanceof L2Attackable)? ((L2Attackable)this).getAggroRange() : 0)+"</td></tr>");
            html1.append("</table><br>");

            html1.append("<font color=\"LEVEL\">Combat</font>");
            html1.append("<table border=\"0\" width=\"100%\">");
            html1.append("<tr><td>Current HP</td><td>"+getCurrentHp()+"</td><td>Current MP</td><td>"+getCurrentMp()+"</td></tr>");
            html1.append("<tr><td>Max.HP</td><td>"+(int)(getMaxHp()/getStat().calcStat(Stats.MAX_HP , 1, this, null))+"*"+getStat().calcStat(Stats.MAX_HP , 1, this, null)+"</td><td>Max.MP</td><td>"+getMaxMp()+"</td></tr>");
            html1.append("<tr><td>P.Atk.</td><td>"+getPAtk(null)+"</td><td>M.Atk.</td><td>"+getMAtk(null,null)+"</td></tr>");
            html1.append("<tr><td>P.Def.</td><td>"+getPDef(null)+"</td><td>M.Def.</td><td>"+getMDef(null,null)+"</td></tr>");
            html1.append("<tr><td>Accuracy</td><td>"+getAccuracy()+"</td><td>Evasion</td><td>"+getEvasionRate(null)+"</td></tr>");
            html1.append("<tr><td>Critical</td><td>"+getCriticalHit(null,null)+"</td><td>Speed</td><td>"+getRunSpeed()+"</td></tr>");
            html1.append("<tr><td>Atk.Speed</td><td>"+getPAtkSpd()+"</td><td>Cast.Speed</td><td>"+getMAtkSpd()+"</td></tr>");
            html1.append("</table><br>");

            html1.append("<font color=\"LEVEL\">Basic Stats</font>");
            html1.append("<table border=\"0\" width=\"100%\">");
            html1.append("<tr><td>STR</td><td>"+getSTR()+"</td><td>DEX</td><td>"+getDEX()+"</td><td>CON</td><td>"+getCON()+"</td></tr>");
            html1.append("<tr><td>INT</td><td>"+getINT()+"</td><td>WIT</td><td>"+getWIT()+"</td><td>MEN</td><td>"+getMEN()+"</td></tr>");
            html1.append("</table>");

            html1.append("<br><center><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\"><br1></td>");
            html1.append("<td><button value=\"Kill\" action=\"bypass -h admin_kill\" width=40 height=15 back=\"sek.cbui94\" fore=\"sek.cbui92\"></td><br1></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></center><br>");
            html1.append("</body></html>");

            html.setHtml(html1.toString());
            player.sendPacket(html);
        }
        else if(Config.ALT_GAME_VIEWNPC)
        {
            // Set the target of the L2PcInstance player
            player.setTarget(this);

            // Send a Server->Client packet MyTargetSelected to the L2PcInstance player
            // The player.getLevel() - getLevel() permit to display the correct color in the select window
            MyTargetSelected my = new MyTargetSelected(getObjectId(), player.getLevel() - getLevel());
            player.sendPacket(my);

            // Check if the player is attackable (without a forced attack)
            if (isAutoAttackable(player))
            {
                // Send a Server->Client packet StatusUpdate of the L2NpcInstance to the L2PcInstance to update its HP bar
                StatusUpdate su = new StatusUpdate(getObjectId());
                su.addAttribute(StatusUpdate.CUR_HP, (int)getCurrentHp() );
                su.addAttribute(StatusUpdate.MAX_HP, getMaxHp() );
                player.sendPacket(su);
            }

            NpcHtmlMessage html = new NpcHtmlMessage(0);
            TextBuilder html1 = new TextBuilder("<html><body>");

            html1.append("<br><center><font color=\"LEVEL\">[Combat Stats]</font></center>");
            html1.append("<table border=0 width=\"100%\">");
            html1.append("<tr><td>Max.HP</td><td>"+(int)(getMaxHp()/getStat().calcStat(Stats.MAX_HP , 1, this, null))+"*"+(int) getStat().calcStat(Stats.MAX_HP , 1, this, null)+"</td><td>Max.MP</td><td>"+getMaxMp()+"</td></tr>");
            html1.append("<tr><td>P.Atk.</td><td>"+getPAtk(null)+"</td><td>M.Atk.</td><td>"+getMAtk(null,null)+"</td></tr>");
            html1.append("<tr><td>P.Def.</td><td>"+getPDef(null)+"</td><td>M.Def.</td><td>"+getMDef(null,null)+"</td></tr>");
            html1.append("<tr><td>Accuracy</td><td>"+getAccuracy()+"</td><td>Evasion</td><td>"+getEvasionRate(null)+"</td></tr>");
            html1.append("<tr><td>Critical</td><td>"+getCriticalHit(null,null)+"</td><td>Speed</td><td>"+getRunSpeed()+"</td></tr>");
            html1.append("<tr><td>Atk.Speed</td><td>"+getPAtkSpd()+"</td><td>Cast.Speed</td><td>"+getMAtkSpd()+"</td></tr>");
            html1.append("<tr><td>Race</td><td>"+getTemplate().race+"</td><td></td><td></td></tr>");
            html1.append("</table>");

            html1.append("<br><center><font color=\"LEVEL\">[Basic Stats]</font></center>");
            html1.append("<table border=0 width=\"100%\">");
            html1.append("<tr><td>STR</td><td>"+getSTR()+"</td><td>DEX</td><td>"+getDEX()+"</td><td>CON</td><td>"+getCON()+"</td></tr>");
            html1.append("<tr><td>INT</td><td>"+getINT()+"</td><td>WIT</td><td>"+getWIT()+"</td><td>MEN</td><td>"+getMEN()+"</td></tr>");
            html1.append("</table>");

            html1.append("<br><center><font color=\"LEVEL\">[Drop Info]</font></center>");
            html1.append("Rates legend: <font color=\"ff0000\">50%+</font> <font color=\"00ff00\">30%+</font> <font color=\"0000ff\">less than 30%</font>");
            html1.append("<table border=0 width=\"100%\">");

            for(L2DropCategory cat:getTemplate().getDropData())
            for(L2DropData drop : cat.getAllDrops())
            {
              String name = ItemTable.getInstance().getTemplate(drop.getItemId()).getName();

              if(drop.getChance() >= 600000)
                html1.append("<tr><td><font color=\"ff0000\">" + name + "</font></td><td>" + (drop.isQuestDrop()?"Quest":(cat.isSweep()?"Sweep":"Drop")) + "</td></tr>");
              else if(drop.getChance() >= 300000)
                html1.append("<tr><td><font color=\"00ff00\">" + name + "</font></td><td>" + (drop.isQuestDrop()?"Quest":(cat.isSweep()?"Sweep":"Drop")) + "</td></tr>");
              else
                html1.append("<tr><td><font color=\"0000ff\">" + name + "</font></td><td>" + (drop.isQuestDrop()?"Quest":(cat.isSweep()?"Sweep":"Drop")) + "</td></tr>");
            }

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

            html.setHtml(html1.toString());
            player.sendPacket(html);
        }

        // Send a Server->Client ActionFailed to the L2PcInstance in order to avoid that the client wait another packet
        player.sendPacket(new ActionFailed());
View Full Code Here

        {
            if (isBusy() && getBusyMessage().length()>0)
            {
                player.sendPacket( new ActionFailed() );

                NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                html.setFile("data/html/npcbusy.htm");
                html.replace("%busymessage%", getBusyMessage());
                html.replace("%npcname%", getName());
                html.replace("%playername%", player.getName());
                player.sendPacket(html);
            }
            else if (command.equalsIgnoreCase("TerritoryStatus"))
            {
              NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
              {
                if (getCastle().getOwnerId() > 0)
                {
                  html.setFile("data/html/territorystatus.htm");
                  L2Clan clan = ClanTable.getInstance().getClan(getCastle().getOwnerId());
                  html.replace("%clanname%", clan.getName());
                  html.replace("%clanleadername%", clan.getLeaderName());
                }
                else
                {
                  html.setFile("data/html/territorynoclan.htm");
                }
              }
              html.replace("%castlename%", getCastle().getName());
              html.replace("%taxpercent%", "" + getCastle().getTaxPercent());
              html.replace("%objectId%", String.valueOf(getObjectId()));
              {
                if (getCastle().getCastleId() > 6)
                {
                  html.replace("%territory%", "The Kingdom of Elmore");
                }
                else
                {
                  html.replace("%territory%", "The Kingdom of Aden");
                }
              }
              player.sendPacket(html);
            }
            else if (command.startsWith("Quest"))
            {
                String quest = "";
                try
                {
                    quest = command.substring(5).trim();
                } catch (IndexOutOfBoundsException ioobe) {}
                if (quest.length() == 0)
                    showQuestWindow(player);
                else
                    showQuestWindow(player, quest);
            }
            else if (command.startsWith("Chat"))
            {
                int val = 0;
                try
                {
                    val = Integer.parseInt(command.substring(5));
                } catch (IndexOutOfBoundsException ioobe) {
                } catch (NumberFormatException nfe) {}
                showChatWindow(player, val);
            }
            else if (command.startsWith("Link"))
            {
                String path = command.substring(5).trim();
                if (path.indexOf("..") != -1)
                    return;
                String filename = "data/html/"+path;
                NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                html.setFile(filename);
                html.replace("%objectId%", String.valueOf(getObjectId()));
                player.sendPacket(html);
            }
            else if (command.startsWith("NobleTeleport"))
            {
                if (!player.isNoble())
                {
                    String filename = "data/html/teleporter/nobleteleporter-no.htm";
                    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                    html.setFile(filename);
                    html.replace("%objectId%", String.valueOf(getObjectId()));
                    html.replace("%npcname%", getName());
                    player.sendPacket(html);
                    return;
                }
                int val = 0;
                try
View Full Code Here

                getCastle().getSiege().listRegisterClan(player);   // List current register clan
                return;
            }
      else if (actualCommand.equalsIgnoreCase("receive_report"))
      {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile("data/html/chamberlain/chamberlain-report.htm");
        html.replace("%objectId%", String.valueOf(getObjectId()));
        L2Clan clan = ClanTable.getInstance().getClan(getCastle().getOwnerId());
          html.replace("%clanname%", clan.getName());
          html.replace("%clanleadername%", clan.getLeaderName());
        html.replace("%castlename%", getCastle().getName());
        {
          int currentPeriod = SevenSigns.getInstance().getCurrentPeriod();
          switch (currentPeriod)
          {
                    case SevenSigns.PERIOD_COMP_RECRUITING:
                      html.replace("%ss_event%", "Quest Event Initialization");
                        break;
                    case SevenSigns.PERIOD_COMPETITION:
                      html.replace("%ss_event%", "Competition (Quest Event)");
                        break;
                    case SevenSigns.PERIOD_COMP_RESULTS:
                      html.replace("%ss_event%", "Quest Event Results");
                        break;
                    case SevenSigns.PERIOD_SEAL_VALIDATION:
                      html.replace("%ss_event%", "Seal Validation");
                        break;
          }
        }
        {
          int sealOwner1 = SevenSigns.getInstance().getSealOwner(1);
          switch (sealOwner1)
          {
          case SevenSigns.CABAL_NULL:
            html.replace("%ss_avarice%", "Not in Possession");
            break;
          case SevenSigns.CABAL_DAWN:
            html.replace("%ss_avarice%", "Lords of Dawn");
            break;
          case SevenSigns.CABAL_DUSK:
            html.replace("%ss_avarice%", "Revolutionaries of Dusk");
            break;
          }
        }
        {
          int sealOwner2 = SevenSigns.getInstance().getSealOwner(2);
          switch (sealOwner2)
          {
          case SevenSigns.CABAL_NULL:
            html.replace("%ss_gnosis%", "Not in Possession");
            break;
          case SevenSigns.CABAL_DAWN:
            html.replace("%ss_gnosis%", "Lords of Dawn");
            break;
          case SevenSigns.CABAL_DUSK:
            html.replace("%ss_gnosis%", "Revolutionaries of Dusk");
            break;
          }
        }
        {
          int sealOwner3 = SevenSigns.getInstance().getSealOwner(3);
          switch (sealOwner3)
          {
          case SevenSigns.CABAL_NULL:
            html.replace("%ss_strife%", "Not in Possession");
            break;
          case SevenSigns.CABAL_DAWN:
            html.replace("%ss_strife%", "Lords of Dawn");
            break;
          case SevenSigns.CABAL_DUSK:
            html.replace("%ss_strife%", "Revolutionaries of Dusk");
            break;
          }
        }
        player.sendPacket(html);
        return;
      }
      else if (actualCommand.equalsIgnoreCase("items"))
      {
        if (val == "") return;
        player.tempInvetoryDisable();

        if (Config.DEBUG) _log.fine("Showing chamberlain buylist");

        int buy;
        {
          int castleId = getCastle().getCastleId();
          int circlet = CastleManager.getInstance().getCircletByCastleId(castleId);
          PcInventory s = player.getInventory();
          if (s.getItemByItemId(circlet)==null)
          {
            buy = (Integer.parseInt(val+"1"));
          }
          else
          {
            buy = (Integer.parseInt(val+"2"));
          }
        }
        L2TradeList list = TradeController.getInstance().getBuyList(buy);
        if (list != null && list.getNpcId().equals(String.valueOf(getNpcId())))
        {
          BuyList bl = new BuyList(list, player.getAdena(), 0);
          player.sendPacket(bl);
        }
        else
        {
          _log.warning("player: " + player.getName()
              + " attempting to buy from chamberlain that don't have buylist!");
          _log.warning("buylist id:" + buy);
        }
        player.sendPacket(new ActionFailed());
      }
      else if (actualCommand.equalsIgnoreCase("manage_siege_defender"))
      {
                getCastle().getSiege().listRegisterClan(player);
                return;
      }
      else if (actualCommand.equalsIgnoreCase("manage_vault")) {
        String filename = "data/html/chamberlain/chamberlain-vault.htm";
        int amount = 0;
        if (val.equalsIgnoreCase("deposit")) {
          try {
            amount = Integer.parseInt(st.nextToken());
          } catch(NoSuchElementException e) {}
          if (amount > 0 && (long)getCastle().getTreasury() + amount < Integer.MAX_VALUE) {
            if (player.reduceAdena("Castle", amount, this, true)) {
              getCastle().addToTreasuryNoTax(amount);
            } else {
              sendPacket(new SystemMessage(SystemMessageId.YOU_NOT_ENOUGH_ADENA));
            }
          }
        } else if (val.equalsIgnoreCase("withdraw")) {
          try {
            amount = Integer.parseInt(st.nextToken());
          } catch(NoSuchElementException e) {}
          if (amount > 0) {
            if (getCastle().getTreasury() < amount) {
              filename = "data/html/chamberlain/chamberlain-vault-no.htm";
            } else {
              if (getCastle().addToTreasuryNoTax((-1)*amount))
                player.addAdena("Castle", amount, this, true);

            }
          }
        }

        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(filename);
        html.replace("%objectId%", String.valueOf(getObjectId()));
        html.replace("%npcname%", getName());
        html.replace("%tax_income%", Util.formatAdena(getCastle().getTreasury()));
        html.replace("%withdraw_amount%", Util.formatAdena(amount));
        player.sendPacket(html);

        return;
      }
          else if(actualCommand.equalsIgnoreCase("manor")) {
        String filename = "";
        if (CastleManorManager.getInstance().isDisabled()) {
          filename = "data/html/npcdefault.htm";
        } else {
          int cmd = Integer.parseInt(val);
                switch(cmd) {
                  case 0:
                    filename = "data/html/chamberlain/manor/manor.htm";
              break;
            // TODO: correct in html's to 1
                  case 4:
                    filename = "data/html/chamberlain/manor/manor_help00"+st.nextToken()+".htm";
                    break;
                    default:
                      filename = "data/html/chamberlain/chamberlain-no.htm";
              break;
                }
        }

        if (filename.length()!=0) {
                NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
          html.setFile(filename);
          html.replace("%objectId%", String.valueOf(getObjectId()));
          html.replace("%npcname%", getName());
          player.sendPacket(html);
        }
        return;
      }
      else if (command.startsWith("manor_menu_select"))
      {// input string format:
       // manor_menu_select?ask=X&state=Y&time=X
        if (CastleManorManager.getInstance().isUnderMaintenance())
        {
          player.sendPacket(new ActionFailed());
          player.sendPacket(new SystemMessage(SystemMessageId.THE_MANOR_SYSTEM_IS_CURRENTLY_UNDER_MAINTENANCE));
          return;
        }

        String params = command.substring(command.indexOf("?")+1);
        StringTokenizer str = new StringTokenizer(params, "&");
        int ask   = Integer.parseInt(str.nextToken().split("=")[1]);
        int state = Integer.parseInt(str.nextToken().split("=")[1]);
        int time  = Integer.parseInt(str.nextToken().split("=")[1]);

        int castleId;
        if (state == -1) // info for current manor
          castleId = getCastle().getCastleId();
        else        // info for requested manor
          castleId = state;

        switch (ask) { // Main action
        case 3: // Current seeds (Manor info)
          if (time == 1 && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
            player.sendPacket(new ExShowSeedInfo(castleId, null));
          else
            player.sendPacket(new ExShowSeedInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getSeedProduction(time)));
          break;
        case 4: // Current crops (Manor info)
          if (time == 1 && !CastleManager.getInstance().getCastleById(castleId).isNextPeriodApproved())
            player.sendPacket(new ExShowCropInfo(castleId, null));
          else
            player.sendPacket(new ExShowCropInfo(castleId, CastleManager.getInstance().getCastleById(castleId).getCropProcure(time)));
          break;
        case 5: // Basic info (Manor info)
          player.sendPacket(new ExShowManorDefaultInfo());
          break;
        case 7: // Edit seed setup
          if (getCastle().isNextPeriodApproved()) {
            player.sendPacket(new SystemMessage(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM));
          } else {
            player.sendPacket(new ExShowSeedSetting(getCastle().getCastleId()));
          }
          break;
        case 8: // Edit crop setup
          if (getCastle().isNextPeriodApproved()) {
            player.sendPacket(new SystemMessage(SystemMessageId.A_MANOR_CANNOT_BE_SET_UP_BETWEEN_6_AM_AND_8_PM));
          } else {
            player.sendPacket(new ExShowCropSetting(getCastle().getCastleId()));
          }
          break;
        }
      }
          else if(actualCommand.equalsIgnoreCase("operate_door")) // door control
          {
              if (val != "")
              {
                boolean open = (Integer.parseInt(val) == 1);
                while (st.hasMoreTokens())
                 {
                     getCastle().openCloseDoor(player, Integer.parseInt(st.nextToken()), open);
                 }
              }

              NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
          html.setFile("data/html/chamberlain/" + getTemplate().npcId + "-d.htm");
          html.replace("%objectId%", String.valueOf(getObjectId()));
          html.replace("%npcname%", getName());
          player.sendPacket(html);
                return;
          }
          else if(actualCommand.equalsIgnoreCase("tax_set")) // tax rates control
          {
View Full Code Here

        super.onBypassFeedback(player, command);
    }

    private void sendHtmlMessage(L2PcInstance player, String htmlMessage)
    {
        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setHtml(htmlMessage);
    html.replace("%objectId%", String.valueOf(getObjectId()));
    html.replace("%npcname%", getName());
        player.sendPacket(html);
    }
View Full Code Here

              filename = "data/html/chamberlain/chamberlain-busy.htm";          // Busy because of siege
          else if (condition == COND_OWNER)                        // Clan owns castle
              filename = "data/html/chamberlain/chamberlain.htm";              // Owner message window
    }

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

                        content = content.replaceAll("%stoneValue%", String.valueOf(stoneValue));
                        content = content.replaceAll("%stoneCount%", String.valueOf(stoneCount));
                        content = content.replaceAll("%stoneItemId%", String.valueOf(stoneId));
                        content = content.replaceAll("%objectId%", String.valueOf(getObjectId()));

                        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                        html.setHtml(content);
                        player.sendPacket(html);
                    }
                    else
                    {
                        _log.warning("Problem with HTML text " + SevenSigns.SEVEN_SIGNS_HTML_PATH
                            + "signs_17.htm: " + path);
                    }
                    break;
                case 18: // Exchange Seal Stones for Ancient Adena - SevenSigns 18 xxxx xxxxxx
                    int convertStoneId = Integer.parseInt(command.substring(14, 18));
                    int convertCount = 0;

                    try
                    {
                        convertCount = Integer.parseInt(command.substring(19).trim());
                    }
                    catch (Exception NumberFormatException)
                    {
                        player.sendMessage("You must enter an integer amount.");
                        break;
                    }

                    L2ItemInstance convertItem = player.getInventory().getItemByItemId(convertStoneId);

                    if (convertItem == null)
                    {
                        player.sendMessage("You do not have any seal stones of that type.");
                        break;
                    }

                    int totalCount = convertItem.getCount();
                    int ancientAdenaReward = 0;

                    if (convertCount <= totalCount && convertCount > 0)
                    {
                        switch (convertStoneId)
                        {
                            case SevenSigns.SEAL_STONE_BLUE_ID:
                                ancientAdenaReward = SevenSigns.calcAncientAdenaReward(convertCount, 0,
                                                                                       0);
                                break;
                            case SevenSigns.SEAL_STONE_GREEN_ID:
                                ancientAdenaReward = SevenSigns.calcAncientAdenaReward(0, convertCount,
                                                                                       0);
                                break;
                            case SevenSigns.SEAL_STONE_RED_ID:
                                ancientAdenaReward = SevenSigns.calcAncientAdenaReward(0, 0,
                                                                                       convertCount);
                                break;
                        }

                        if (player.destroyItemByItemId("SevenSigns", convertStoneId, convertCount, this,
                                                       true))
                        {
                            player.addAncientAdena("SevenSigns", ancientAdenaReward, this, true);

                            // Send inventory update packet
                            iu = new InventoryUpdate();
                            iu.addModifiedItem(player.getInventory().getAncientAdenaInstance());
                            iu.addModifiedItem(convertItem);
                            sendPacket(iu);

                            // Update current load as well
                            su = new StatusUpdate(player.getObjectId());
                            su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
                            sendPacket(su);
                        }
                    }
                    else
                    {
                        player.sendMessage("You do not have that many seal stones.");
                    }
                    break;
                case 19: // Seal Information (for when joining a cabal)
                    int chosenSeal = Integer.parseInt(command.substring(16));
                    String fileSuffix = SevenSigns.getSealName(chosenSeal, true) + "_"
                        + SevenSigns.getCabalShortName(cabal);

                    showChatWindow(player, val, fileSuffix, false);
                    break;
                case 20: // Seal Status (for when joining a cabal)
                    TextBuilder contentBuffer = new TextBuilder("<html><body><font color=\"LEVEL\">[ Seal Status ]</font><br>");

                    for (int i = 1; i < 4; i++)
                    {
                        int sealOwner = SevenSigns.getInstance().getSealOwner(i);

                        if (sealOwner != SevenSigns.CABAL_NULL) contentBuffer.append("["
                            + SevenSigns.getSealName(i, false) + ": "
                            + SevenSigns.getCabalName(sealOwner) + "]<br>");
                        else contentBuffer.append("[" + SevenSigns.getSealName(i, false)
                            + ": Nothingness]<br>");
                    }

                    contentBuffer.append("<a action=\"bypass -h npc_" + getObjectId() + "_SevenSigns 3 "
                        + cabal + "\">Go back.</a></body></html>");

                    NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
                    html.setHtml(contentBuffer.toString());
                    player.sendPacket(html);
                    break;
                default:
                    // 1 = Purchase Record Intro
                    // 5 = Contrib Seal Stones Intro
View Full Code Here

        int condition = validateCondition(player);
        if (condition == COND_BUSY_BECAUSE_OF_SIEGE) filename = "data/html/mercmanager/mercmanager-busy.htm"; // Busy because of siege
        else if (condition == COND_OWNER) // Clan owns castle
            filename = "data/html/mercmanager/mercmanager.htm"; // Owner message window

        NpcHtmlMessage html = new NpcHtmlMessage(getObjectId());
        html.setFile(filename);
        html.replace("%objectId%", String.valueOf(getObjectId()));
        html.replace("%npcId%", String.valueOf(getNpcId()));
        html.replace("%npcname%", getName());
        player.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.