use of net.runelite.cache.definitions.WorldMapDefinition in project runelite by runelite.
the class WorldMapLoader method load.
public WorldMapDefinition load(byte[] b, int fileId) {
WorldMapDefinition def = new WorldMapDefinition();
InputStream in = new InputStream(b);
def.fileId = fileId;
def.safeName = in.readString();
def.name = in.readString();
int packedPos = in.readInt();
if (packedPos == -1) {
def.position = new Position(-1, -1, -1);
} else {
int y = packedPos >> 28 & 3;
int x = packedPos >> 14 & 16383;
int z = packedPos & 16383;
def.position = new Position(x, y, z);
}
def.field450 = in.readInt();
in.readUnsignedByte();
def.field457 = in.readUnsignedByte() == 1;
def.field451 = in.readUnsignedByte();
int var3 = in.readUnsignedByte();
def.field458 = new LinkedList();
for (int var4 = 0; var4 < var3; ++var4) {
def.field458.add(this.loadType(in));
}
return def;
}
use of net.runelite.cache.definitions.WorldMapDefinition 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