use of net.runelite.cache.definitions.loaders.WorldMapLoader in project runelite by runelite.
the class WorldMapDumperTest method extract.
@Test
public void extract() throws IOException {
File base = StoreLocation.LOCATION, outDir = folder.newFolder();
int count = 0;
try (Store store = new Store(base)) {
store.load();
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.WORLDMAP);
// there is also archive 1/2, but their data format is not this
Archive archive = index.getArchive(0);
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile file : files.getFiles()) {
WorldMapLoader loader = new WorldMapLoader();
WorldMapDefinition def = loader.load(file.getContents(), file.getFileId());
Files.write(gson.toJson(def), new File(outDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}
logger.info("Dumped {} world map data to {}", count, outDir);
}
Aggregations