-
Notifications
You must be signed in to change notification settings - Fork 11
/
update_definitions.mjs
28 lines (25 loc) · 1.23 KB
/
update_definitions.mjs
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
import fs from 'node:fs/promises';
const opcodesUrl = 'https://raw.githubusercontent.com/karashiiro/FFXIVOpcodes/master/opcodes.min.json';
function getOpcode(list, messageType) {
const { opcode } = list.find((o) => o.name === messageType);
return opcode;
}
fetch(opcodesUrl)
.then((res) => res.json())
.then((res) => res.find((regionLists) => regionLists.region === 'Global').lists)
.then((lists) => ({
ClientTrigger: -1,
PlayerSpawn: getOpcode(lists.ServerZoneIpcType, 'PlayerSpawn'),
PlayerSetup: getOpcode(lists.ServerZoneIpcType, 'PlayerSetup'),
ItemMarketBoardInfo: getOpcode(lists.ServerZoneIpcType, 'ItemMarketBoardInfo'),
MarketBoardItemRequestStart: getOpcode(lists.ServerZoneIpcType, 'MarketBoardItemListingCount'),
MarketBoardOfferings: getOpcode(lists.ServerZoneIpcType, 'MarketBoardItemListing'),
MarketBoardHistory: getOpcode(lists.ServerZoneIpcType, 'MarketBoardItemListingHistory'),
MarketTaxRates: getOpcode(lists.ServerZoneIpcType, 'ResultDialog'),
ContentIdNameMapResp: -1,
}))
.then(async (res) => {
console.log(res);
await fs.writeFile('definitions.json', JSON.stringify(res) + '\n');
})
.catch(console.error);