28 lines
1.5 KiB
JavaScript
28 lines
1.5 KiB
JavaScript
// Run in the browser console on https://octowow.st/db/ (after its browser check has passed).
|
|
// Reads every woodcutting tree page and prints trees.txt: "objectId|zoneId|x,y x,y ..."
|
|
// (zone maps in tenths of a percent; zone 0 = Octo custom zones, continent map in hundredths).
|
|
// Then: py -I dbcdump.py client.json and py -I build_data.py trees.txt seeds.txt client.json ..\Data.lua
|
|
// To find new tree ids, search the database for "wood tree".
|
|
(async () => {
|
|
const ids = [2020267, 2020268, 2020269, 2020270, 2020271, 2020272, 2020273, 2020274, 2020275, 2020276,
|
|
2020277, 2020278, 2020279, 2020280, 2020281, 2020301, 2020282, 2020283, 2020284, 2020285, 2020286,
|
|
2020287, 2020288, 2020289, 2020290, 2020291, 2020292, 2020293, 2020294, 2020295, 2020296, 2020297,
|
|
2020309, 2020298, 2020300, 2020299];
|
|
const lines = [];
|
|
for (const id of ids) {
|
|
const html = await (await fetch('/db/?object=' + id)).text();
|
|
const locs = html.split('id="locations"')[1] || '';
|
|
const re = /myMapper\.update\(\{zone: (\d*),coords: \[(.*?)\]\}\);g_setSelectedLink/g;
|
|
let m;
|
|
while ((m = re.exec(locs))) {
|
|
if (!m[1]) continue;
|
|
const zone = +m[1], mult = zone === 0 ? 100 : 10;
|
|
const pts = [...m[2].matchAll(/\[(\d+(?:\.\d+)?),(\d+(?:\.\d+)?),/g)]
|
|
.map(p => Math.round(+p[1] * mult) + ',' + Math.round(+p[2] * mult));
|
|
lines.push(id + '|' + zone + '|' + pts.join(' '));
|
|
}
|
|
await new Promise(r => setTimeout(r, 250));
|
|
}
|
|
console.log(lines.join('\n'));
|
|
})();
|