Skip to content

Instantly share code, notes, and snippets.

@adraffy
Created October 29, 2014 23:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save adraffy/4bf9aa5567628b855e53 to your computer and use it in GitHub Desktop.
Save adraffy/4bf9aa5567628b855e53 to your computer and use it in GitHub Desktop.
static void dumpIds() {
WarKit wk = WarKit.load();
JSONObject root = new JSONObject();
root.put("items", wk.wearableMap.values().stream().map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new)));
root.put("gems", wk.gemMap.values().stream().map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new)));
// not all enchants have a corresponding item
root.put("enchants", wk.enchantMap.values().stream().filter(x -> x.itemId > 0).map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new)));
root.put("foods", wk.consumeMap.values().stream().filter(x -> x.type == ConsumeT.FOOD).map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new)));
root.put("potions", wk.consumeMap.values().stream().filter(x -> x.type == ConsumeT.POTION).map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new)));
// includes elixirs, flasks, scrolls
root.put("elixirs", wk.consumeMap.values().stream().filter(x -> x.type.isElixirFlaskScroll).map(x -> x.itemId).collect(Collectors.toCollection(JSONArray::new)));
try {
Files.write(Paths.get("ItemIds.json"), root.toJSONString().getBytes(StandardCharsets.UTF_8));
} catch (IOException err) {
throw new UncheckedIOException(err);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment