Пример #1
0
  @RegisterEvent(EventType.ON_PLAYER_LEVEL_CHANGED)
  @RegisterType(ListenerRegisterType.GLOBAL)
  public void OnPlayerLevelChanged(OnPlayerLevelChanged event) {
    final L2PcInstance player = event.getActiveChar();
    final int oldLevel = event.getOldLevel();
    final int newLevel = event.getNewLevel();

    if (((oldLevel == (newLevel - 1)) && (player.getLevel() >= MIN_LEVEL))
        && (player.getLevel() <= MAX_LEVEL)
        && !(player.getRace() == Race.ERTHEIA)) {
      final QuestState qs = getQuestState(player, false);
      if (qs == null) {
        final NpcHtmlMessage html = new NpcHtmlMessage(0, 0);
        html.setHtml(
            HtmCache.getInstance()
                .getHtm(
                    player.getHtmlPrefix(),
                    "scripts/quests/Q10390_KekropusLetter/"
                        + "Announce_"
                        + player.getRace().name()
                        + ".html"));
        player.sendPacket(html);
        // todo: get proper announce html && handle it
      }
      return;
    }
  }
 public boolean action(L2PcInstance activeChar, L2Object target, boolean interact) {
   if (activeChar.getAccessLevel().isGm()) {
     NpcHtmlMessage html = new NpcHtmlMessage(target.getObjectId());
     final String html1 =
         StringUtil.concat(
             "<html><body><center><font color=\"LEVEL\">Item Info</font></center><br><table border=0>",
             "<tr><td>Object ID: </td><td>",
             String.valueOf(target.getObjectId()),
             "</td></tr><tr><td>Item ID: </td><td>",
             String.valueOf(((L2ItemInstance) target).getItemId()),
             "</td></tr><tr><td>Owner ID: </td><td>",
             String.valueOf(((L2ItemInstance) target).getOwnerId()),
             "</td></tr><tr><td>Location: </td><td>",
             String.valueOf(((L2ItemInstance) target).getLocation()),
             "</td></tr><tr><td><br></td></tr><tr><td>Class: </td><td>",
             target.getClass().getSimpleName(),
             "</td></tr></table></body></html>");
     html.setHtml(html1);
     activeChar.sendPacket(html);
   }
   return true;
 }
Пример #3
0
 private NpcHtmlMessage getHtmlPacket(L2PcInstance player, L2Npc npc, String htmlFile) {
   final NpcHtmlMessage packet = new NpcHtmlMessage(npc.getObjectId());
   packet.setHtml(getHtm(player.getHtmlPrefix(), htmlFile));
   return packet;
 }
  private static final void showHtmlMenu(L2PcInstance player, int objectId, int level) {
    NpcHtmlMessage html = new NpcHtmlMessage(objectId);

    if (!Config.ALLOW_CLASS_MASTERS) {
      html.setFile(player.getHtmlPrefix(), "data/html/classmaster/disabled.htm");
    } else if (!Config.CLASS_MASTER_SETTINGS.isAllowed(level)) {
      int jobLevel = player.getClassId().level();
      final StringBuilder sb = new StringBuilder(100);
      sb.append("<html><body>");
      switch (jobLevel) {
        case 0:
          if (Config.CLASS_MASTER_SETTINGS.isAllowed(1))
            sb.append("Come back here when you reached level 20 to change your class.<br>");
          else if (Config.CLASS_MASTER_SETTINGS.isAllowed(2))
            sb.append("Come back after your first occupation change.<br>");
          else if (Config.CLASS_MASTER_SETTINGS.isAllowed(3))
            sb.append("Come back after your second occupation change.<br>");
          else sb.append("I can't change your occupation.<br>");
          break;
        case 1:
          if (Config.CLASS_MASTER_SETTINGS.isAllowed(2))
            sb.append("Come back here when you reached level 40 to change your class.<br>");
          else if (Config.CLASS_MASTER_SETTINGS.isAllowed(3))
            sb.append("Come back after your second occupation change.<br>");
          else sb.append("I can't change your occupation.<br>");
          break;
        case 2:
          if (Config.CLASS_MASTER_SETTINGS.isAllowed(3))
            sb.append("Come back here when you reached level 76 to change your class.<br>");
          else sb.append("I can't change your occupation.<br>");
          break;
        case 3:
          sb.append("There is no class change available for you anymore.<br>");
          break;
      }
      sb.append("</body></html>");
      html.setHtml(sb.toString());
    } else {
      final ClassId currentClassId = player.getClassId();
      if (currentClassId.level() >= level) {
        html.setFile(player.getHtmlPrefix(), "data/html/classmaster/nomore.htm");
      } else {
        final int minLevel = getMinLevel(currentClassId.level());
        if (player.getLevel() >= minLevel || Config.ALLOW_ENTIRE_TREE) {
          final StringBuilder menu = new StringBuilder(100);
          for (ClassId cid : ClassId.values()) {
            if (cid == ClassId.inspector && player.getTotalSubClasses() < 2) continue;
            if (validateClassId(currentClassId, cid) && cid.level() == level) {
              StringUtil.append(
                  menu,
                  "<a action=\"bypass -h npc_%objectId%_change_class ",
                  String.valueOf(cid.getId()),
                  "\">",
                  CharTemplateTable.getInstance().getClassNameById(cid.getId()),
                  "</a><br>");
            }
          }

          if (menu.length() > 0) {
            html.setFile(player.getHtmlPrefix(), "data/html/classmaster/template.htm");
            html.replace(
                "%name%", CharTemplateTable.getInstance().getClassNameById(currentClassId.getId()));
            html.replace("%menu%", menu.toString());
          } else {
            html.setFile(player.getHtmlPrefix(), "data/html/classmaster/comebacklater.htm");
            html.replace("%level%", String.valueOf(getMinLevel(level - 1)));
          }
        } else {
          if (minLevel < Integer.MAX_VALUE) {
            html.setFile(player.getHtmlPrefix(), "data/html/classmaster/comebacklater.htm");
            html.replace("%level%", String.valueOf(minLevel));
          } else html.setFile(player.getHtmlPrefix(), "data/html/classmaster/nomore.htm");
        }
      }
    }

    html.replace("%objectId%", String.valueOf(objectId));
    html.replace("%req_items%", getRequiredItems(level));
    player.sendPacket(html);
  }
Пример #5
0
 /**
  * Sends the given html to the player.
  *
  * @param activeChar
  * @param html
  */
 public static void sendHtml(L2PcInstance activeChar, String html) {
   NpcHtmlMessage npcHtml = new NpcHtmlMessage(0);
   npcHtml.setHtml(html);
   activeChar.sendPacket(npcHtml);
 }
  @Override
  public boolean useAdminCommand(String command, L2PcInstance activeChar) {
    StringTokenizer st = new StringTokenizer(command);
    command = st.nextToken();

    if (command.equals("admin_territory_war")) {
      showMainPage(activeChar);
    } else if (command.equalsIgnoreCase("admin_territory_war_time")) {
      if (st.hasMoreTokens()) {
        final Calendar cal = Calendar.getInstance();
        cal.setTimeInMillis(TerritoryWarManager.getInstance().getTWStartTimeInMillis());

        final String val = st.nextToken();
        if ("month".equals(val)) {
          int month = cal.get(Calendar.MONTH) + Integer.parseInt(st.nextToken());
          if ((cal.getActualMinimum(Calendar.MONTH) > month)
              || (cal.getActualMaximum(Calendar.MONTH) < month)) {
            activeChar.sendMessage(
                "Unable to change Siege Date - Incorrect month value only "
                    + cal.getActualMinimum(Calendar.MONTH)
                    + "-"
                    + cal.getActualMaximum(Calendar.MONTH)
                    + " is accepted!");
            return false;
          }
          cal.set(Calendar.MONTH, month);
        } else if ("day".equals(val)) {
          int day = Integer.parseInt(st.nextToken());
          if ((cal.getActualMinimum(Calendar.DAY_OF_MONTH) > day)
              || (cal.getActualMaximum(Calendar.DAY_OF_MONTH) < day)) {
            activeChar.sendMessage(
                "Unable to change Siege Date - Incorrect day value only "
                    + cal.getActualMinimum(Calendar.DAY_OF_MONTH)
                    + "-"
                    + cal.getActualMaximum(Calendar.DAY_OF_MONTH)
                    + " is accepted!");
            return false;
          }
          cal.set(Calendar.DAY_OF_MONTH, day);
        } else if ("hour".equals(val)) {
          int hour = Integer.parseInt(st.nextToken());
          if ((cal.getActualMinimum(Calendar.HOUR_OF_DAY) > hour)
              || (cal.getActualMaximum(Calendar.HOUR_OF_DAY) < hour)) {
            activeChar.sendMessage(
                "Unable to change Siege Date - Incorrect hour value only "
                    + cal.getActualMinimum(Calendar.HOUR_OF_DAY)
                    + "-"
                    + cal.getActualMaximum(Calendar.HOUR_OF_DAY)
                    + " is accepted!");
            return false;
          }
          cal.set(Calendar.HOUR_OF_DAY, hour);
        } else if ("min".equals(val)) {
          int min = Integer.parseInt(st.nextToken());
          if ((cal.getActualMinimum(Calendar.MINUTE) > min)
              || (cal.getActualMaximum(Calendar.MINUTE) < min)) {
            activeChar.sendMessage(
                "Unable to change Siege Date - Incorrect minute value only "
                    + cal.getActualMinimum(Calendar.MINUTE)
                    + "-"
                    + cal.getActualMaximum(Calendar.MINUTE)
                    + " is accepted!");
            return false;
          }
          cal.set(Calendar.MINUTE, min);
        }

        if (cal.getTimeInMillis() < Calendar.getInstance().getTimeInMillis()) {
          activeChar.sendMessage("Unable to change TW Date!");
        } else if (cal.getTimeInMillis()
            != TerritoryWarManager.getInstance().getTWStartTimeInMillis()) {
          TerritoryWarManager.getInstance().setTWStartTimeInMillis(cal.getTimeInMillis());
          GlobalVariablesManager.getInstance()
              .set(TerritoryWarManager.GLOBAL_VARIABLE, cal.getTimeInMillis());
        }
      }
      showSiegeTimePage(activeChar);
    } else if (command.equalsIgnoreCase("admin_territory_war_start")) {
      TerritoryWarManager.getInstance().setTWStartTimeInMillis(System.currentTimeMillis());
    } else if (command.equalsIgnoreCase("admin_territory_war_end")) {
      TerritoryWarManager.getInstance()
          .setTWStartTimeInMillis(System.currentTimeMillis() - TerritoryWarManager.WARLENGTH);
    } else if (command.equalsIgnoreCase("admin_territory_wards_list")) {
      // build beginning of html page
      final NpcHtmlMessage npcHtmlMessage = new NpcHtmlMessage(0, 1);
      StringBuilder sb = new StringBuilder();
      sb.append(
          "<html><title>Territory War</title><body><br><center><font color=\"LEVEL\">Active Wards List:</font></center>");

      // get,build & send current Wards list
      if (TerritoryWarManager.getInstance().isTWInProgress()) {
        List<TerritoryWard> territoryWardList =
            TerritoryWarManager.getInstance().getAllTerritoryWards();
        for (TerritoryWard ward : territoryWardList) {
          if (ward.getNpc() != null) {
            sb.append("<table width=270><tr>");
            sb.append("<td width=135 ALIGN=\"LEFT\">" + ward.getNpc().getName() + "</td>");
            sb.append(
                "<td width=135 ALIGN=\"RIGHT\"><button value=\"TeleTo\" action=\"bypass -h admin_move_to "
                    + ward.getNpc().getX()
                    + " "
                    + ward.getNpc().getY()
                    + " "
                    + ward.getNpc().getZ()
                    + "\" width=50 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>");
            sb.append("</tr></table>");
          } else if (ward.getPlayer() != null) {
            sb.append("<table width=270><tr>");
            sb.append(
                "<td width=135 ALIGN=\"LEFT\">"
                    + ward.getPlayer().getActiveWeaponInstance().getItemName()
                    + " - "
                    + ward.getPlayer().getName()
                    + "</td>");
            sb.append(
                "<td width=135 ALIGN=\"RIGHT\"><button value=\"TeleTo\" action=\"bypass -h admin_move_to "
                    + ward.getPlayer().getX()
                    + " "
                    + ward.getPlayer().getY()
                    + " "
                    + ward.getPlayer().getZ()
                    + "\" width=50 height=20 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_ct1.button_df\"></td>");
            sb.append("</tr></table>");
          }
        }
        sb.append(
            "<br><center><button value=\"Back\" action=\"bypass -h admin_territory_war\" width=50 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
        npcHtmlMessage.setHtml(sb.toString());
        activeChar.sendPacket(npcHtmlMessage);
      } else {
        sb.append("<br><br><center>The Ward List is empty!<br>TW has probably NOT started!");
        sb.append(
            "<br><button value=\"Back\" action=\"bypass -h admin_territory_war\" width=50 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center></body></html>");
        npcHtmlMessage.setHtml(sb.toString());
        activeChar.sendPacket(npcHtmlMessage);
      }
    }
    return true;
  }
Пример #7
0
  public void showHeroFights(L2PcInstance activeChar, int heroclass, int charid, int page) {
    final int perpage = 20;
    int _win = 0;
    int _loss = 0;
    int _draw = 0;

    if (_herofights.containsKey(charid)) {
      List<StatsSet> _list = _herofights.get(charid);

      final NpcHtmlMessage FightReply = new NpcHtmlMessage();
      final String htmContent =
          HtmCache.getInstance()
              .getHtm(activeChar.getHtmlPrefix(), "data/html/olympiad/herohistory.htm");
      if (htmContent != null) {
        FightReply.setHtml(htmContent);
        FightReply.replace("%heroname%", CharNameTable.getInstance().getNameById(charid));

        if (!_list.isEmpty()) {
          if (_herocounts.containsKey(charid)) {
            StatsSet _herocount = _herocounts.get(charid);
            _win = _herocount.getInt("victory");
            _loss = _herocount.getInt("loss");
            _draw = _herocount.getInt("draw");
          }

          boolean color = true;
          final StringBuilder fList = new StringBuilder(500);
          int counter = 0;
          int breakat = 0;
          for (int i = ((page - 1) * perpage); i < _list.size(); i++) {
            breakat = i;
            StatsSet fight = _list.get(i);
            StringUtil.append(fList, "<tr><td>");
            if (color) {
              StringUtil.append(fList, "<table width=270 bgcolor=\"131210\">");
            } else {
              StringUtil.append(fList, "<table width=270>");
            }
            StringUtil.append(
                fList,
                "<tr><td width=220><font color=\"LEVEL\">"
                    + fight.getString("start")
                    + "</font>&nbsp;&nbsp;"
                    + fight.getString("result")
                    + "</td><td width=50 align=right>"
                    + (fight.getInt("classed") > 0
                        ? "<font color=\"FFFF99\">cls</font>"
                        : "<font color=\"999999\">non-cls<font>")
                    + "</td></tr>");
            StringUtil.append(
                fList,
                "<tr><td width=220>vs "
                    + fight.getString("oponent")
                    + " ("
                    + fight.getString("oponentclass")
                    + ")</td><td width=50 align=right>("
                    + fight.getString("time")
                    + ")</td></tr>");
            StringUtil.append(fList, "<tr><td colspan=2>&nbsp;</td></tr></table>");
            StringUtil.append(fList, "</td></tr>");
            color = !color;
            counter++;
            if (counter >= perpage) {
              break;
            }
          }

          if (breakat < (_list.size() - 1)) {
            FightReply.replace(
                "%buttprev%",
                "<button value=\"Prev\" action=\"bypass _match?class="
                    + heroclass
                    + "&page="
                    + (page + 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            FightReply.replace("%buttprev%", "");
          }

          if (page > 1) {
            FightReply.replace(
                "%buttnext%",
                "<button value=\"Next\" action=\"bypass _match?class="
                    + heroclass
                    + "&page="
                    + (page - 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            FightReply.replace("%buttnext%", "");
          }

          FightReply.replace("%list%", fList.toString());
        } else {
          FightReply.replace("%list%", "");
          FightReply.replace("%buttprev%", "");
          FightReply.replace("%buttnext%", "");
        }

        FightReply.replace("%win%", String.valueOf(_win));
        FightReply.replace("%draw%", String.valueOf(_draw));
        FightReply.replace("%loos%", String.valueOf(_loss));

        activeChar.sendPacket(FightReply);
      }
    }
  }
Пример #8
0
  public void showHeroDiary(L2PcInstance activeChar, int heroclass, int charid, int page) {
    final int perpage = 10;

    if (_herodiary.containsKey(charid)) {
      List<StatsSet> _mainlist = _herodiary.get(charid);
      final NpcHtmlMessage DiaryReply = new NpcHtmlMessage();
      final String htmContent =
          HtmCache.getInstance()
              .getHtm(activeChar.getHtmlPrefix(), "data/html/olympiad/herodiary.htm");
      if ((htmContent != null) && _heroMessage.containsKey(charid)) {
        DiaryReply.setHtml(htmContent);
        DiaryReply.replace("%heroname%", CharNameTable.getInstance().getNameById(charid));
        DiaryReply.replace("%message%", _heroMessage.get(charid));
        DiaryReply.disableValidation();

        if (!_mainlist.isEmpty()) {
          FastList<StatsSet> _list = FastList.newInstance();
          _list.addAll(_mainlist);
          Collections.reverse(_list);

          boolean color = true;
          final StringBuilder fList = new StringBuilder(500);
          int counter = 0;
          int breakat = 0;
          for (int i = ((page - 1) * perpage); i < _list.size(); i++) {
            breakat = i;
            StatsSet _diaryentry = _list.get(i);
            StringUtil.append(fList, "<tr><td>");
            if (color) {
              StringUtil.append(fList, "<table width=270 bgcolor=\"131210\">");
            } else {
              StringUtil.append(fList, "<table width=270>");
            }
            StringUtil.append(
                fList,
                "<tr><td width=270><font color=\"LEVEL\">"
                    + _diaryentry.getString("date")
                    + ":xx</font></td></tr>");
            StringUtil.append(
                fList, "<tr><td width=270>" + _diaryentry.getString("action") + "</td></tr>");
            StringUtil.append(fList, "<tr><td>&nbsp;</td></tr></table>");
            StringUtil.append(fList, "</td></tr>");
            color = !color;
            counter++;
            if (counter >= perpage) {
              break;
            }
          }

          if (breakat < (_list.size() - 1)) {
            DiaryReply.replace(
                "%buttprev%",
                "<button value=\"Prev\" action=\"bypass _diary?class="
                    + heroclass
                    + "&page="
                    + (page + 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            DiaryReply.replace("%buttprev%", "");
          }

          if (page > 1) {
            DiaryReply.replace(
                "%buttnext%",
                "<button value=\"Next\" action=\"bypass _diary?class="
                    + heroclass
                    + "&page="
                    + (page - 1)
                    + "\" width=60 height=25 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\">");
          } else {
            DiaryReply.replace("%buttnext%", "");
          }

          DiaryReply.replace("%list%", fList.toString());

          FastList.recycle(_list);
        } else {
          DiaryReply.replace("%list%", "");
          DiaryReply.replace("%buttprev%", "");
          DiaryReply.replace("%buttnext%", "");
        }

        activeChar.sendPacket(DiaryReply);
      }
    }
  }
 @Override
 public boolean useAdminCommand(String command, L2PcInstance activeChar) {
   if (command.equals("admin_show_spawns")) {
     AdminHtml.showAdminHtml(activeChar, "spawns.htm");
   } else if (command.equalsIgnoreCase("admin_spawn_debug_menu")) {
     AdminHtml.showAdminHtml(activeChar, "spawns_debug.htm");
   } else if (command.startsWith("admin_spawn_debug_print")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     L2Object target = activeChar.getTarget();
     if (target instanceof L2Npc) {
       try {
         st.nextToken();
         int type = Integer.parseInt(st.nextToken());
         printSpawn((L2Npc) target, type);
         if (command.contains("_menu")) {
           AdminHtml.showAdminHtml(activeChar, "spawns_debug.htm");
         }
       } catch (Exception e) {
       }
     } else {
       activeChar.sendPacket(SystemMessageId.INCORRECT_TARGET);
     }
   } else if (command.startsWith("admin_spawn_index")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       st.nextToken();
       int level = Integer.parseInt(st.nextToken());
       int from = 0;
       try {
         from = Integer.parseInt(st.nextToken());
       } catch (NoSuchElementException nsee) {
       }
       showMonsters(activeChar, level, from);
     } catch (Exception e) {
       AdminHtml.showAdminHtml(activeChar, "spawns.htm");
     }
   } else if (command.equals("admin_show_npcs")) {
     AdminHtml.showAdminHtml(activeChar, "npcs.htm");
   } else if (command.startsWith("admin_npc_index")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       st.nextToken();
       String letter = st.nextToken();
       int from = 0;
       try {
         from = Integer.parseInt(st.nextToken());
       } catch (NoSuchElementException nsee) {
       }
       showNpcs(activeChar, letter, from);
     } catch (Exception e) {
       AdminHtml.showAdminHtml(activeChar, "npcs.htm");
     }
   } else if (command.startsWith("admin_instance_spawns")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       st.nextToken();
       int instance = Integer.parseInt(st.nextToken());
       if (instance >= 300000) {
         final StringBuilder html =
             StringUtil.startAppend(
                 500 + 1000,
                 "<html><table width=\"100%\"><tr><td width=45><button value=\"Main\" action=\"bypass -h admin_admin\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td width=180><center>",
                 "<font color=\"LEVEL\">Spawns for " + String.valueOf(instance) + "</font>",
                 "</td><td width=45><button value=\"Back\" action=\"bypass -h admin_current_player\" width=45 height=21 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td></tr></table><br>",
                 "<table width=\"100%\"><tr><td width=200>NpcName</td><td width=70>Action</td></tr>");
         int counter = 0;
         int skiped = 0;
         Instance inst = InstanceManager.getInstance().getInstance(instance);
         if (inst != null) {
           for (L2Npc npc : inst.getNpcs()) {
             if (!npc.isDead()) {
               // Only 50 because of client html limitation
               if (counter < 50) {
                 StringUtil.append(
                     html,
                     "<tr><td>" + npc.getName() + "</td><td>",
                     "<a action=\"bypass -h admin_move_to "
                         + npc.getX()
                         + " "
                         + npc.getY()
                         + " "
                         + npc.getZ()
                         + "\">Go</a>",
                     "</td></tr>");
                 counter++;
               } else {
                 skiped++;
               }
             }
           }
           StringUtil.append(
               html,
               "<tr><td>Skipped:</td><td>"
                   + String.valueOf(skiped)
                   + "</td></tr></table></body></html>");
           final NpcHtmlMessage ms = new NpcHtmlMessage();
           ms.setHtml(html.toString());
           activeChar.sendPacket(ms);
         } else {
           activeChar.sendMessage("Cannot find instance " + instance);
         }
       } else {
         activeChar.sendMessage("Invalid instance number.");
       }
     } catch (Exception e) {
       activeChar.sendMessage("Usage //instance_spawns <instance_number>");
     }
   } else if (command.startsWith("admin_unspawnall")) {
     Broadcast.toAllOnlinePlayers(
         SystemMessage.getSystemMessage(SystemMessageId.NPC_SERVER_NOT_OPERATING));
     RaidBossSpawnManager.getInstance().cleanUp();
     DayNightSpawnManager.getInstance().cleanUp();
     L2World.getInstance().deleteVisibleNpcSpawns();
     AdminTable.getInstance().broadcastMessageToGMs("NPC Unspawn completed!");
   } else if (command.startsWith("admin_spawnday")) {
     DayNightSpawnManager.getInstance().spawnDayCreatures();
   } else if (command.startsWith("admin_spawnnight")) {
     DayNightSpawnManager.getInstance().spawnNightCreatures();
   } else if (command.startsWith("admin_respawnall") || command.startsWith("admin_spawn_reload")) {
     // make sure all spawns are deleted
     RaidBossSpawnManager.getInstance().cleanUp();
     DayNightSpawnManager.getInstance().cleanUp();
     L2World.getInstance().deleteVisibleNpcSpawns();
     // now respawn all
     NpcData.getInstance().load();
     SpawnTable.getInstance().load();
     RaidBossSpawnManager.getInstance().load();
     AutoSpawnHandler.getInstance().reload();
     SevenSigns.getInstance().spawnSevenSignsNPC();
     QuestManager.getInstance().reloadAllScripts();
     AdminTable.getInstance().broadcastMessageToGMs("NPC Respawn completed!");
   } else if (command.startsWith("admin_spawn_monster") || command.startsWith("admin_spawn")) {
     StringTokenizer st = new StringTokenizer(command, " ");
     try {
       String cmd = st.nextToken();
       String id = st.nextToken();
       int respawnTime = 0;
       int mobCount = 1;
       if (st.hasMoreTokens()) {
         mobCount = Integer.parseInt(st.nextToken());
       }
       if (st.hasMoreTokens()) {
         respawnTime = Integer.parseInt(st.nextToken());
       }
       if (cmd.equalsIgnoreCase("admin_spawn_once")) {
         spawnMonster(activeChar, id, respawnTime, mobCount, false);
       } else {
         spawnMonster(activeChar, id, respawnTime, mobCount, true);
       }
     } catch (Exception e) { // Case of wrong or missing monster data
       AdminHtml.showAdminHtml(activeChar, "spawns.htm");
     }
   } else if (command.startsWith("admin_list_spawns")
       || command.startsWith("admin_list_positions")) {
     int npcId = 0;
     int teleportIndex = -1;
     try { // admin_list_spawns x[xxxx] x[xx]
       String[] params = command.split(" ");
       Pattern pattern = Pattern.compile("[0-9]*");
       Matcher regexp = pattern.matcher(params[1]);
       if (regexp.matches()) {
         npcId = Integer.parseInt(params[1]);
       } else {
         params[1] = params[1].replace('_', ' ');
         npcId = NpcData.getInstance().getTemplateByName(params[1]).getId();
       }
       if (params.length > 2) {
         teleportIndex = Integer.parseInt(params[2]);
       }
     } catch (Exception e) {
       activeChar.sendMessage("Command format is //list_spawns <npcId|npc_name> [tele_index]");
     }
     if (command.startsWith("admin_list_positions")) {
       findNPCInstances(activeChar, npcId, teleportIndex, true);
     } else {
       findNPCInstances(activeChar, npcId, teleportIndex, false);
     }
   }
   return true;
 }
Пример #10
0
 private void showMenu(L2PcInstance activeChar) {
   final NpcHtmlMessage html = new NpcHtmlMessage();
   String content = getHtm(activeChar.getHtmlPrefix(), "admin_menu.htm");
   html.setHtml(content);
   activeChar.sendPacket(html);
 }