public static final void main(String[] args) throws IOException {
   System.out.println("Starting..");
   Cache.init();
   for (int itemId = 113; itemId < Utils.getItemDefinitionsSize(); itemId++) {
     if (!ItemDefinitions.getItemDefinitions(itemId).isNoted())
       if (dumpItem(itemId)) System.out.println("DUMPED ITEM : " + itemId);
       else
         System.out.println(
             "FAILED ITEM: "
                 + itemId
                 + ", "
                 + ItemDefinitions.getItemDefinitions(itemId).getName());
   }
 }
示例#2
0
 public static final boolean checkRunes(Player player, boolean delete, int... runes) {
   int weaponId = player.getEquipment().getWeaponId();
   int shieldId = player.getEquipment().getShieldId();
   int runesCount = 0;
   while (runesCount < runes.length) {
     int runeId = runes[runesCount++];
     int ammount = runes[runesCount++];
     if (hasInfiniteRunes(runeId, weaponId, shieldId)) continue;
     if (hasStaffOfLight(weaponId)
         && Utils.getRandom(8) == 0
         && runeId != 21773) // 1 in eight chance of keeping runes
     continue;
     if (!player.getInventory().containsItem(runeId, ammount)) {
       player
           .getPackets()
           .sendGameMessage(
               "You do not have enough "
                   + ItemDefinitions.getItemDefinitions(runeId).getName().replace("rune", "Rune")
                   + "s to cast this spell.");
       return false;
     }
   }
   if (delete) {
     runesCount = 0;
     while (runesCount < runes.length) {
       int runeId = runes[runesCount++];
       int ammount = runes[runesCount++];
       if (hasInfiniteRunes(runeId, weaponId, shieldId)) continue;
       player.getInventory().deleteItem(runeId, ammount);
     }
   }
   return true;
 }
 public static boolean dumpItem(int itemId) {
   String pageName = ItemDefinitions.getItemDefinitions(itemId).getName();
   if (pageName == null || pageName.equals("null")) return false;
   pageName = pageName.replace("(p)", "");
   pageName = pageName.replace("(p+)", "");
   pageName = pageName.replace("(p++)", "");
   pageName = pageName.replaceAll(" ", "_");
   try {
     WebPage page = new WebPage("http://runescape.wikia.com/wiki/" + pageName);
     try {
       page.load();
     } catch (Exception e) {
       System.out.println("Invalid page: " + itemId + ", " + pageName);
       return false;
     }
     boolean isNextLine = false;
     for (String line : page.getLines()) {
       if (!isNextLine) {
         if (line.equals(
             "<th nowrap=\"nowrap\"><a href=\"/wiki/Examine\" title=\"Examine\">Examine</a>"))
           isNextLine = true;
       } else {
         String examine = line.replace("</th><td> ", "");
         examine = examine.replace("</th><td>", "");
         examine = examine.replace("<i> ", "");
         examine = examine.replace("</i> ", "");
         examine = examine.replace("&lt;colour&gt; ", "");
         examine = examine.replace("(bright/thick/warm)", "bright");
         examine = examine.replace("(Temple of Ikov) ", "");
         examine = examine.replace("(Fight Arena) ", "");
         try {
           BufferedWriter writer = new BufferedWriter(new FileWriter("itemExamines.txt", true));
           writer.write(itemId + " - " + examine);
           writer.newLine();
           writer.flush();
           writer.close();
         } catch (IOException e) {
           e.printStackTrace();
         }
         return true;
       }
     }
   } catch (MalformedURLException e) {
     e.printStackTrace();
   } catch (Exception e) {
     e.printStackTrace();
     return dumpItem(itemId);
   }
   return false;
 }