use of net.runelite.cache.definitions.AreaDefinition in project runelite by runelite.
the class AreaDumper 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();
AreaManager areaManager = new AreaManager(store);
areaManager.load();
for (AreaDefinition area : areaManager.getAreas()) {
Files.write(gson.toJson(area), new File(outDir, area.id + ".json"), Charset.defaultCharset());
++count;
}
}
logger.info("Dumped {} areas to {}", count, outDir);
}
use of net.runelite.cache.definitions.AreaDefinition in project runelite by runelite.
the class MapImageDumper method drawMapIcons.
private void drawMapIcons(Graphics2D graphics, Region region, int z, int drawBaseX, int drawBaseY) {
for (Location location : region.getLocations()) {
int localZ = location.getPosition().getZ();
if (z != 0 && localZ != z) {
// draw all icons on z=0
continue;
}
ObjectDefinition od = findObject(location.getId());
assert od != null;
int localX = location.getPosition().getX() - region.getBaseX();
int localY = location.getPosition().getY() - region.getBaseY();
int drawX = drawBaseX + localX;
int drawY = drawBaseY + (Region.Y - 1 - localY);
if (od.getMapAreaId() != -1) {
AreaDefinition area = areas.getArea(od.getMapAreaId());
assert area != null;
int spriteId = area.spriteId;
SpriteDefinition sprite = sprites.findSprite(spriteId, 0);
assert sprite != null;
BufferedImage iconImage = sprites.getSpriteImage(sprite);
graphics.drawImage(iconImage, drawX * MAP_SCALE, drawY * MAP_SCALE, null);
}
}
}
use of net.runelite.cache.definitions.AreaDefinition in project runelite by runelite.
the class AreaManager method load.
public void load() throws IOException {
Storage storage = store.getStorage();
Index index = store.getIndex(IndexType.CONFIGS);
Archive archive = index.getArchive(ConfigType.AREA.getId());
byte[] archiveData = storage.loadArchive(archive);
ArchiveFiles files = archive.getFiles(archiveData);
for (FSFile file : files.getFiles()) {
AreaLoader loader = new AreaLoader();
AreaDefinition area = loader.load(file.getContents(), file.getFileId());
areas.put(area.id, area);
}
}
use of net.runelite.cache.definitions.AreaDefinition in project runelite by runelite.
the class AreaLoader method load.
public AreaDefinition load(byte[] b, int id) {
InputStream in = new InputStream(b);
AreaDefinition def = new AreaDefinition();
def.id = id;
for (; ; ) {
int opcode = in.readUnsignedByte();
if (opcode == 0) {
break;
}
processOpcode(def, in, opcode);
}
return def;
}
Aggregations