use of net.runelite.cache.fs.Store in project runelite by runelite.
the class FrameDumper 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 frameIndex = store.getIndex(IndexType.FRAMES);
Index framemapIndex = store.getIndex(IndexType.FRAMEMAPS);
for (Archive archive : frameIndex.getArchives()) {
List<FrameDefinition> frames = new ArrayList<>();
byte[] archiveData = storage.loadArchive(archive);
byte[] contents = archive.decompress(archiveData);
int framemapArchiveId = (contents[0] & 0xff) << 8 | contents[1] & 0xff;
Archive framemapArchive = framemapIndex.getArchives().get(framemapArchiveId);
archiveData = storage.loadArchive(framemapArchive);
byte[] framemapContents = framemapArchive.decompress(archiveData);
FramemapLoader fmloader = new FramemapLoader();
FramemapDefinition framemap = fmloader.load(0, framemapContents);
FrameLoader frameLoader = new FrameLoader();
FrameDefinition frame = frameLoader.load(framemap, contents);
frames.add(frame);
Files.write(gson.toJson(frames), new File(outDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
++count;
}
}
logger.info("Dumped {} frames to {}", count, outDir);
}
use of net.runelite.cache.fs.Store in project runelite by runelite.
the class InventoryDumper 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.CONFIGS);
Archive archive = index.getArchive(ConfigType.INV.getId());
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile file : files.getFiles()) {
InventoryLoader loader = new InventoryLoader();
InventoryDefinition inv = loader.load(file.getFileId(), file.getContents());
Files.write(gson.toJson(inv), new File(outDir, inv.id + ".json"), Charset.defaultCharset());
++count;
}
}
logger.info("Dumped {} inventories to {}", count, outDir);
}
use of net.runelite.cache.fs.Store in project runelite by runelite.
the class KitDumperTest method test.
@Test
public void test() throws IOException {
File dumpDir = folder.newFolder();
int count = 0;
try (Store store = new Store(StoreLocation.LOCATION)) {
store.load();
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.IDENTKIT.getId());
KitLoader loader = new KitLoader();
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile file : files.getFiles()) {
byte[] b = file.getContents();
KitDefinition def = loader.load(file.getFileId(), b);
Files.write(gson.toJson(def), new File(dumpDir, file.getFileId() + ".json"), Charset.defaultCharset());
++count;
}
}
logger.info("Dumped {} kits to {}", count, dumpDir);
}
use of net.runelite.cache.fs.Store in project runelite by runelite.
the class MapImageDumperTest method dumpRegions.
@Test
@Ignore
public void dumpRegions() throws Exception {
File base = StoreLocation.LOCATION, outDir = folder.newFolder();
try (Store store = new Store(base)) {
store.load();
RegionLoader regionLoader = new RegionLoader(store);
regionLoader.loadRegions();
MapImageDumper dumper = new MapImageDumper(store);
dumper.load();
int z = 0;
for (Region region : regionLoader.getRegions()) {
File imageFile = new File(outDir, "img-" + z + "-" + region.getRegionID() + ".png");
BufferedImage image = dumper.drawRegion(region, z);
ImageIO.write(image, "png", imageFile);
}
}
}
use of net.runelite.cache.fs.Store in project runelite by runelite.
the class NpcManagerTest method test.
@Test
public void test() throws IOException {
File dumpDir = folder.newFolder(), javaDir = folder.newFolder();
try (Store store = new Store(StoreLocation.LOCATION)) {
store.load();
NpcManager dumper = new NpcManager(store);
dumper.load();
dumper.dump(dumpDir);
dumper.java(javaDir);
}
logger.info("Dumped to {}, java {}", dumpDir, javaDir);
}
Aggregations