Search in sources :

Example 1 with SoundEffectDefinition

use of net.runelite.cache.definitions.sound.SoundEffectDefinition 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)

Example 2 with SoundEffectDefinition

use of net.runelite.cache.definitions.sound.SoundEffectDefinition in project runelite by runelite.

the class SoundEffectLoader method load.

public SoundEffectDefinition load(byte[] b) {
    SoundEffectDefinition se = new SoundEffectDefinition();
    InputStream in = new InputStream(b);
    load(se, in);
    return se;
}
Also used : InputStream(net.runelite.cache.io.InputStream) SoundEffectDefinition(net.runelite.cache.definitions.sound.SoundEffectDefinition)

Aggregations

SoundEffectDefinition (net.runelite.cache.definitions.sound.SoundEffectDefinition)2 File (java.io.File)1 SoundEffectLoader (net.runelite.cache.definitions.loaders.sound.SoundEffectLoader)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 InputStream (net.runelite.cache.io.InputStream)1 Test (org.junit.Test)1