-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathexample.js
30 lines (22 loc) · 908 Bytes
/
example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const fs = require('fs');
const { Landscape } = require('./src');
const landscape = new Landscape();
landscape.loadJag(fs.readFileSync('./land63.jag'),
fs.readFileSync('./maps63.jag'));
landscape.loadMem(fs.readFileSync('./land63.mem'),
fs.readFileSync('./maps63.mem'));
landscape.parseArchives();
const lumbridge = landscape.sectors[50][50][0];
const tile = lumbridge.tiles[0][0];
console.log(tile.colour, tile.getGameCoords());
const tile2 = landscape.getTileAtGameCoords(126, 1468);
console.log(tile2.getTileDef());
process.stdout.write(lumbridge.toString(true));
fs.writeFileSync(`./sector-lumbridge.png`, lumbridge.toCanvas().toBuffer());
(async () => {
fs.writeFileSync('./worldmap.png', (await landscape.toCanvas({
points: require('./map-points.json'),
objects: require('./object-locs.json'),
labels: require('./map-labels.json')
})).toBuffer());
})();