Created
October 29, 2014 23:27
-
-
Save adraffy/4bf9aa5567628b855e53 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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