Search in sources :

Example 1 with ArchiveFiles

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

the class InventoryManager method load.

public void load() throws IOException {
    InventoryLoader loader = new InventoryLoader();
    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()) {
        InventoryDefinition inv = loader.load(file.getFileId(), file.getContents());
        inventories.add(inv);
    }
}
Also used : Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) Index(net.runelite.cache.fs.Index) InventoryLoader(net.runelite.cache.definitions.loaders.InventoryLoader) InventoryDefinition(net.runelite.cache.definitions.InventoryDefinition) FSFile(net.runelite.cache.fs.FSFile)

Example 2 with ArchiveFiles

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

the class InterfaceManager method load.

public void load() throws IOException {
    InterfaceLoader loader = new InterfaceLoader();
    Storage storage = store.getStorage();
    Index index = store.getIndex(IndexType.INTERFACES);
    int max = index.getArchives().stream().mapToInt(a -> a.getArchiveId()).max().getAsInt();
    interfaces = new InterfaceDefinition[max + 1][];
    for (Archive archive : index.getArchives()) {
        int archiveId = archive.getArchiveId();
        byte[] archiveData = storage.loadArchive(archive);
        ArchiveFiles files = archive.getFiles(archiveData);
        InterfaceDefinition[] ifaces = interfaces[archiveId];
        if (ifaces == null) {
            ifaces = interfaces[archiveId] = new InterfaceDefinition[archive.getFileData().length];
        }
        for (FSFile file : files.getFiles()) {
            int fileId = file.getFileId();
            int widgetId = (archiveId << 16) + fileId;
            InterfaceDefinition iface = loader.load(widgetId, file.getContents());
            ifaces[fileId] = iface;
        }
    }
}
Also used : InterfaceLoader(net.runelite.cache.definitions.loaders.InterfaceLoader) Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) InterfaceDefinition(net.runelite.cache.definitions.InterfaceDefinition) Index(net.runelite.cache.fs.Index) FSFile(net.runelite.cache.fs.FSFile)

Example 3 with ArchiveFiles

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

the class NpcManager method load.

public void load() throws IOException {
    NpcLoader loader = new NpcLoader();
    Storage storage = store.getStorage();
    Index index = store.getIndex(IndexType.CONFIGS);
    Archive archive = index.getArchive(ConfigType.NPC.getId());
    byte[] archiveData = storage.loadArchive(archive);
    ArchiveFiles files = archive.getFiles(archiveData);
    for (FSFile f : files.getFiles()) {
        NpcDefinition npc = loader.load(f.getFileId(), f.getContents());
        npcs.add(npc);
    }
}
Also used : Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) NpcLoader(net.runelite.cache.definitions.loaders.NpcLoader) NpcDefinition(net.runelite.cache.definitions.NpcDefinition) Index(net.runelite.cache.fs.Index) FSFile(net.runelite.cache.fs.FSFile)

Example 4 with ArchiveFiles

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

the class ObjectManager method load.

public void load() throws IOException {
    ObjectLoader loader = new ObjectLoader();
    Storage storage = store.getStorage();
    Index index = store.getIndex(IndexType.CONFIGS);
    Archive archive = index.getArchive(ConfigType.OBJECT.getId());
    byte[] archiveData = storage.loadArchive(archive);
    ArchiveFiles files = archive.getFiles(archiveData);
    for (FSFile f : files.getFiles()) {
        ObjectDefinition def = loader.load(f.getFileId(), f.getContents());
        objects.put(f.getFileId(), def);
    }
}
Also used : Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) ObjectLoader(net.runelite.cache.definitions.loaders.ObjectLoader) Index(net.runelite.cache.fs.Index) ObjectDefinition(net.runelite.cache.definitions.ObjectDefinition) FSFile(net.runelite.cache.fs.FSFile)

Example 5 with ArchiveFiles

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

the class TextureManager method load.

public void load() throws IOException {
    Storage storage = store.getStorage();
    Index index = store.getIndex(IndexType.TEXTURES);
    Archive archive = index.getArchive(0);
    byte[] archiveData = storage.loadArchive(archive);
    ArchiveFiles files = archive.getFiles(archiveData);
    TextureLoader loader = new TextureLoader();
    for (FSFile file : files.getFiles()) {
        TextureDefinition texture = loader.load(file.getFileId(), file.getContents());
        textures.add(texture);
    }
}
Also used : Storage(net.runelite.cache.fs.Storage) Archive(net.runelite.cache.fs.Archive) ArchiveFiles(net.runelite.cache.fs.ArchiveFiles) TextureLoader(net.runelite.cache.definitions.loaders.TextureLoader) Index(net.runelite.cache.fs.Index) TextureDefinition(net.runelite.cache.definitions.TextureDefinition) FSFile(net.runelite.cache.fs.FSFile)

Aggregations

ArchiveFiles (net.runelite.cache.fs.ArchiveFiles)24 FSFile (net.runelite.cache.fs.FSFile)24 Archive (net.runelite.cache.fs.Archive)18 Index (net.runelite.cache.fs.Index)18 Storage (net.runelite.cache.fs.Storage)18 File (java.io.File)9 Store (net.runelite.cache.fs.Store)9 Test (org.junit.Test)9 ArchiveEntry (net.runelite.http.service.cache.beans.ArchiveEntry)5 NotFoundException (net.runelite.http.service.util.exception.NotFoundException)4 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)4 InterfaceDefinition (net.runelite.cache.definitions.InterfaceDefinition)2 InventoryDefinition (net.runelite.cache.definitions.InventoryDefinition)2 ItemDefinition (net.runelite.cache.definitions.ItemDefinition)2 NpcDefinition (net.runelite.cache.definitions.NpcDefinition)2 ObjectDefinition (net.runelite.cache.definitions.ObjectDefinition)2 OverlayDefinition (net.runelite.cache.definitions.OverlayDefinition)2 SpriteDefinition (net.runelite.cache.definitions.SpriteDefinition)2 TextureDefinition (net.runelite.cache.definitions.TextureDefinition)2 UnderlayDefinition (net.runelite.cache.definitions.UnderlayDefinition)2