Search in sources :

Example 1 with SoundEffectLoader

use of net.runelite.cache.definitions.loaders.sound.SoundEffectLoader in project runelite by runelite.

the class SoundEffectsDumperTest 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.SOUNDEFFECTS);
        for (Archive archive : index.getArchives()) {
            byte[] contents = archive.decompress(storage.loadArchive(archive));
            SoundEffectLoader soundEffectLoader = new SoundEffectLoader();
            SoundEffectDefinition soundEffect = soundEffectLoader.load(contents);
            Files.write(gson.toJson(soundEffect), new File(dumpDir, archive.getArchiveId() + ".json"), Charset.defaultCharset());
            ++count;
        }
    }
    logger.info("Dumped {} sound effects to {}", count, dumpDir);
}
Also used : Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) Store(net.runelite.cache.fs.Store) Index(net.runelite.cache.fs.Index) SoundEffectLoader(net.runelite.cache.definitions.loaders.sound.SoundEffectLoader) SoundEffectDefinition(net.runelite.cache.definitions.sound.SoundEffectDefinition) File(java.io.File) Test(org.junit.Test)

Aggregations

File (java.io.File)1 SoundEffectLoader (net.runelite.cache.definitions.loaders.sound.SoundEffectLoader)1 SoundEffectDefinition (net.runelite.cache.definitions.sound.SoundEffectDefinition)1 Archive (net.runelite.cache.fs.Archive)1 Index (net.runelite.cache.fs.Index)1 Storage (net.runelite.cache.fs.Storage)1 Store (net.runelite.cache.fs.Store)1 Test (org.junit.Test)1