-
Notifications
You must be signed in to change notification settings - Fork 3
/
get-passive-proc-names.js
29 lines (23 loc) · 1.04 KB
/
get-passive-proc-names.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
const GoogleSheetScraper = require('./gs-scraper');
const fs = require('fs');
const PUBLIC_SPREADSHEET_URL = 'https://docs.google.com/spreadsheets/d/e/2PACX-1vQq5h9NWuJ-1N--XE1Opd3f-0RrvSIxkANGuv05HdfV4FiRAi65mvdY7E9MwV08GwGeV_xLfxMVnNoe/pubhtml#';
function addTableDataToMapping (tableData = [], mapping = {}, columnKeyName) {
tableData.forEach(entry => {
mapping[entry[columnKeyName]] = entry;
});
}
async function main () {
const scraper = new GoogleSheetScraper();
const sheetData = await scraper.getContents(PUBLIC_SPREADSHEET_URL);
await scraper.close();
const mapping = {
passive: {},
proc: {},
};
const passiveTable = sheetData[Object.keys(sheetData).find(k => k.startsWith('Passive'))];
addTableDataToMapping(passiveTable, mapping.passive, 'ID');
const procTable = sheetData[Object.keys(sheetData).find(k => k.startsWith('Proc'))];
addTableDataToMapping(procTable, mapping.proc, 'ID');
fs.writeFileSync('src/assets/buff-translation/passive-proc-metadata.json', JSON.stringify(mapping, null, 2), 'utf8');
}
main();