Skip to content

Commit

Permalink
feat(const): update opcode for global server
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyupe committed Aug 29, 2021
1 parent 4e7dd37 commit b3dac5d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 18 deletions.
32 changes: 16 additions & 16 deletions Cafe.Matcha/Constant/MatchaOpcode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,22 @@ internal static class OpcodeStorage
{
public static Dictionary<ushort, MatchaOpcode> Global = new Dictionary<ushort, MatchaOpcode>
{
{ 0x0314, MatchaOpcode.ActorControlSelf },
{ 0x010d, MatchaOpcode.CEDirector },
{ 0x0250, MatchaOpcode.CompanyAirshipStatus },
{ 0x0292, MatchaOpcode.CompanySubmersibleStatus },
{ 0x01ac, MatchaOpcode.ContentFinderNotifyPop },
{ 0xf005, MatchaOpcode.DirectorStart },
{ 0x01ef, MatchaOpcode.EventPlay },
{ 0x00d3, MatchaOpcode.Examine },
{ 0x0100, MatchaOpcode.InitZone },
{ 0x03ac, MatchaOpcode.InventoryTransaction },
{ 0x00a7, MatchaOpcode.ItemInfo },
{ 0x00f5, MatchaOpcode.MarketBoardItemListing },
{ 0x0275, MatchaOpcode.MarketBoardItemListingCount },
{ 0x0112, MatchaOpcode.MarketBoardItemListingHistory },
{ 0x0296, MatchaOpcode.PlayerSetup },
{ 0x0249, MatchaOpcode.PlayerSpawn },
{ 0x02b6, MatchaOpcode.ActorControlSelf },
{ 0x0104, MatchaOpcode.CEDirector },
{ 0x0166, MatchaOpcode.CompanyAirshipStatus },
{ 0x0247, MatchaOpcode.CompanySubmersibleStatus },
{ 0x0327, MatchaOpcode.ContentFinderNotifyPop },
{ 0x01dd, MatchaOpcode.DirectorStart },
{ 0x016b, MatchaOpcode.EventPlay },
{ 0x0365, MatchaOpcode.Examine },
{ 0x0320, MatchaOpcode.InitZone },
{ 0x027f, MatchaOpcode.InventoryTransaction },
{ 0x01cc, MatchaOpcode.ItemInfo },
{ 0x0076, MatchaOpcode.MarketBoardItemListing },
{ 0x0068, MatchaOpcode.MarketBoardItemListingCount },
{ 0x01ba, MatchaOpcode.MarketBoardItemListingHistory },
{ 0x01d5, MatchaOpcode.PlayerSetup },
{ 0x01d8, MatchaOpcode.PlayerSpawn },
};
public static Dictionary<ushort, MatchaOpcode> China = new Dictionary<ushort, MatchaOpcode>
{
Expand Down
16 changes: 14 additions & 2 deletions utils/update-opcode.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ const opcodes = [
{
// https://github.com/quisquous/cactbot/blob/main/plugin/CactbotEventSource/FateWatcher.cs#L45
key: 'CEDirector',
global: parseInt('0x10D', 16)
// this is not the actual key, just a hack
karashiiro: '_GH_CEDirector'
},
{
key: 'CompanyAirshipStatus',
Expand All @@ -19,7 +20,8 @@ const opcodes = [
},
{
key: 'DirectorStart',
karashiiro: 'MiniCactpotInit'
global: 0x1dd
// karashiiro: 'MiniCactpotInit'
},
'EventPlay',
'Examine',
Expand Down Expand Up @@ -91,6 +93,16 @@ const outputFromWorker = (list) => opcodes.map((item, index) => {

const globalOpcodes = parsedData.find(item => item.region === 'Global')

const cactbotFate = await request('https://raw.githubusercontent.com/quisquous/cactbot/main/plugin/CactbotEventSource/FateWatcher.cs')
const ceDirector = /cedirector_intl.+\n.+0x30.+\n\s+(0x[0-9a-fA-F]+),?\s*\n\s*\)/.exec(cactbotFate.toString())

if (ceDirector) {
globalOpcodes.lists.ServerZoneIpcType.push({
name: '_GH_CEDirector',
opcode: parseInt(ceDirector[1], 16)
})
}

const workerData = await request('https://raw.githubusercontent.com/zhyupe/ffxiv-opcode-worker/master/cn-opcodes.csv')
const cnOpcodes = workerData.toString().split('\n').map(line => {
const [key, ...args] = line.trim().split(',')
Expand Down

0 comments on commit b3dac5d

Please sign in to comment.