Search in sources :

Example 11 with Store

use of net.runelite.cache.fs.Store in project runelite by runelite.

the class MapDumperTest method dunpJson.

@Test
@Ignore
public void dunpJson() throws IOException {
    File base = StoreLocation.LOCATION, outDir = folder.newFolder();
    try (Store store = new Store(base)) {
        store.load();
        Map<MapDefinition, LocationsDefinition> regions = loadRegions(store);
        for (Entry<MapDefinition, LocationsDefinition> entry : regions.entrySet()) {
            MapDefinition key = entry.getKey();
            LocationsDefinition value = entry.getValue();
            int x = key.getRegionX();
            int y = key.getRegionY();
            Files.write(gson.toJson(key).getBytes(), new File(outDir, "m" + x + "_" + y + ".json"));
            if (value != null) {
                Files.write(gson.toJson(value).getBytes(), new File(outDir, "l" + x + "_" + y + ".json"));
            }
        }
    }
    logger.info("Dumped regions to {}", outDir);
}
Also used : Store(net.runelite.cache.fs.Store) File(java.io.File) LocationsDefinition(net.runelite.cache.definitions.LocationsDefinition) MapDefinition(net.runelite.cache.definitions.MapDefinition) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 12 with Store

use of net.runelite.cache.fs.Store in project runelite by runelite.

the class ModelDumperTest method test.

@Test
public void test() throws IOException {
    File modelDir = folder.newFolder("models");
    int count = 0;
    try (Store store = new Store(StoreLocation.LOCATION)) {
        store.load();
        Storage storage = store.getStorage();
        Index index = store.getIndex(IndexType.MODELS);
        for (Archive archive : index.getArchives()) {
            byte[] contents = archive.decompress(storage.loadArchive(archive));
            ModelLoader loader = new ModelLoader();
            loader.load(archive.getArchiveId(), contents);
            Files.write(contents, new File(modelDir, archive.getArchiveId() + ".model"));
            ++count;
        }
    }
    logger.info("Dumped {} models to {}", count, modelDir);
}
Also used : ModelLoader(net.runelite.cache.definitions.loaders.ModelLoader) Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) Store(net.runelite.cache.fs.Store) Index(net.runelite.cache.fs.Index) File(java.io.File) Test(org.junit.Test)

Example 13 with Store

use of net.runelite.cache.fs.Store in project runelite by runelite.

the class ObjectManagerTest method test.

@Test
public void test() throws IOException {
    File dumpDir = folder.newFolder(), javaDir = folder.newFolder();
    try (Store store = new Store(StoreLocation.LOCATION)) {
        store.load();
        ObjectManager dumper = new ObjectManager(store);
        dumper.load();
        dumper.dump(dumpDir);
        dumper.java(javaDir);
    }
    logger.info("Dumped to {}, java {}", dumpDir, javaDir);
}
Also used : Store(net.runelite.cache.fs.Store) File(java.io.File) Test(org.junit.Test)

Example 14 with Store

use of net.runelite.cache.fs.Store in project runelite by runelite.

the class HeightMapDumperTest method extract.

// @Test
public void extract() throws IOException {
    File base = StoreLocation.LOCATION, outDir = folder.newFolder();
    try (Store store = new Store(base)) {
        store.load();
        HeightMapDumper dumper = new HeightMapDumper(store);
        dumper.load();
        BufferedImage image = dumper.drawHeightMap(0);
        File imageFile = new File(outDir, "heightmap-0.png");
        ImageIO.write(image, "png", imageFile);
        logger.info("Wrote image {}", imageFile);
    }
}
Also used : Store(net.runelite.cache.fs.Store) File(java.io.File) BufferedImage(java.awt.image.BufferedImage)

Example 15 with Store

use of net.runelite.cache.fs.Store in project runelite by runelite.

the class MapImageDumperTest method dumpMap.

@Test
@Ignore
public void dumpMap() throws IOException {
    File base = StoreLocation.LOCATION, outDir = folder.newFolder();
    try (Store store = new Store(base)) {
        store.load();
        MapImageDumper dumper = new MapImageDumper(store);
        dumper.load();
        for (int i = 0; i < Region.Z; ++i) {
            BufferedImage image = dumper.drawMap(i);
            File imageFile = new File(outDir, "img-" + i + ".png");
            ImageIO.write(image, "png", imageFile);
            logger.info("Wrote image {}", imageFile);
        }
    }
}
Also used : Store(net.runelite.cache.fs.Store) File(java.io.File) BufferedImage(java.awt.image.BufferedImage) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

Store (net.runelite.cache.fs.Store)38 File (java.io.File)34 Test (org.junit.Test)32 Archive (net.runelite.cache.fs.Archive)21 Index (net.runelite.cache.fs.Index)20 Storage (net.runelite.cache.fs.Storage)18 ArchiveFiles (net.runelite.cache.fs.ArchiveFiles)9 FSFile (net.runelite.cache.fs.FSFile)9 Ignore (org.junit.Ignore)7 BufferedImage (java.awt.image.BufferedImage)4 IOException (java.io.IOException)3 CacheClient (net.runelite.cache.client.CacheClient)3 ModelLoader (net.runelite.cache.definitions.loaders.ModelLoader)3 TextureManager (net.runelite.cache.TextureManager)2 FramemapDefinition (net.runelite.cache.definitions.FramemapDefinition)2 ModelDefinition (net.runelite.cache.definitions.ModelDefinition)2 FramemapLoader (net.runelite.cache.definitions.loaders.FramemapLoader)2 FileData (net.runelite.cache.index.FileData)2 HandshakeResponseType (net.runelite.protocol.api.login.HandshakeResponseType)2 RemoteCache (com.ostracker.cache.RemoteCache)1