mirror of
https://github.com/djhackersdev/minime.git
synced 2026-09-11 20:15:13 -05:00
wip brand message codes
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import iconv = require("iconv-lite");
|
||||
import { Transform } from "stream";
|
||||
|
||||
import { MSG, REQ_LEN } from "./defs";
|
||||
import { MSG, RequestId, getRequestLength } from "./defs";
|
||||
import { Request } from "./request";
|
||||
|
||||
type ReaderFn = (buf: Buffer) => Request;
|
||||
@@ -226,8 +226,8 @@ export class Decoder extends Transform {
|
||||
return callback(null);
|
||||
}
|
||||
|
||||
const msgCode = this.state.readUInt16LE(0x30);
|
||||
const msgLen = REQ_LEN.get(msgCode);
|
||||
const msgCode = this.state.readUInt16LE(0x30) as RequestId;
|
||||
const msgLen = getRequestLength(msgCode);
|
||||
|
||||
if (msgLen === undefined) {
|
||||
return callback(
|
||||
|
||||
134
src/idz/defs.ts
134
src/idz/defs.ts
@@ -1,64 +1,76 @@
|
||||
export const MSG = {
|
||||
GENERIC_RES: 0x0001,
|
||||
LOAD_CONFIG_REQ: 0x0004,
|
||||
LOAD_CONFIG_RES: 0x0005,
|
||||
LOAD_SERVER_LIST_REQ: 0x0006,
|
||||
LOAD_SERVER_LIST_RES: 0x0007,
|
||||
LOAD_PROFILE_V1_RES: 0x0064,
|
||||
LOAD_PROFILE_V2_RES: 0x0065,
|
||||
CREATE_PROFILE_REQ: 0x0066,
|
||||
LOAD_PROFILE_REQ: 0x0067,
|
||||
SAVE_RECORD_REQ: 0x0068,
|
||||
ACCOUNT_LOCK_REQ: 0x0069,
|
||||
ACCOUNT_LOCK_RES: 0x006a,
|
||||
DISCOVER_PROFILE_REQ: 0x006b,
|
||||
DISCOVER_PROFILE_RES: 0x006c,
|
||||
ACCOUNT_UNLOCK_REQ: 0x006f,
|
||||
ACCOUNT_UNLOCK_RES: 0x0070,
|
||||
LOAD_TEAM_REQ: 0x77,
|
||||
LOAD_TEAM_RES: 0x78,
|
||||
CREATE_TEAM_REQ: 0x007b,
|
||||
CREATE_TEAM_RES: 0x007c,
|
||||
UPDATE_STORY_CLEAR_NUM_REQ: 0x007f,
|
||||
UPDATE_STORY_CLEAR_NUM_RES: 0x0080,
|
||||
UPDATE_PROVISIONAL_STORE_RANK_REQ: 0x0082,
|
||||
UPDATE_PROVISIONAL_STORE_RANK_RES: 0x0083,
|
||||
LOAD_REWARD_TABLE_REQ: 0x0086,
|
||||
LOAD_REWARD_TABLE_RES: 0x0087,
|
||||
SAVE_EXPEDITION_REQ: 0x008c,
|
||||
SAVE_EXPEDITION_RES: 0x008d,
|
||||
SAVE_TOPIC_REQ: 0x009a,
|
||||
SAVE_TOPIC_RES: 0x009b,
|
||||
LOAD_GENERAL_REWARD_REQ: 0x009c,
|
||||
LOAD_GENERAL_REWARD_RES: 0x009d,
|
||||
SAVE_SETTINGS_REQ: 0x00a5,
|
||||
LOAD_CONFIG_V2_REQ: 0x00ab,
|
||||
LOAD_CONFIG_V2_RES: 0x00ac,
|
||||
LOAD_STOCKER_REQ: 0x00a7,
|
||||
LOAD_STOCKER_RES: 0x00a8,
|
||||
LOAD_2ON2_REQ: 0x00b0,
|
||||
LOAD_2ON2_RES: 0x00b1,
|
||||
// Quasi-nominative typing "brands".
|
||||
// The double-underscore properties never actually exist at runtime, we just
|
||||
// pretend they do.
|
||||
|
||||
export type RequestId = number & { __requestId: null };
|
||||
export type ResponseId = number & { __responseId: null };
|
||||
|
||||
const _MSG = {
|
||||
GENERIC_RES: 0x0001 as ResponseId,
|
||||
LOAD_CONFIG_REQ: 0x0004 as RequestId,
|
||||
LOAD_CONFIG_RES: 0x0005 as ResponseId,
|
||||
LOAD_SERVER_LIST_REQ: 0x0006 as RequestId,
|
||||
LOAD_SERVER_LIST_RES: 0x0007 as ResponseId,
|
||||
LOAD_PROFILE_V1_RES: 0x0064 as ResponseId,
|
||||
LOAD_PROFILE_V2_RES: 0x0065 as ResponseId,
|
||||
CREATE_PROFILE_REQ: 0x0066 as RequestId,
|
||||
LOAD_PROFILE_REQ: 0x0067 as RequestId,
|
||||
SAVE_RECORD_REQ: 0x0068 as RequestId,
|
||||
ACCOUNT_LOCK_REQ: 0x0069 as RequestId,
|
||||
ACCOUNT_LOCK_RES: 0x006a as ResponseId,
|
||||
DISCOVER_PROFILE_REQ: 0x006b as RequestId,
|
||||
DISCOVER_PROFILE_RES: 0x006c as ResponseId,
|
||||
ACCOUNT_UNLOCK_REQ: 0x006f as RequestId,
|
||||
ACCOUNT_UNLOCK_RES: 0x0070 as ResponseId,
|
||||
LOAD_TEAM_REQ: 0x0077 as RequestId,
|
||||
LOAD_TEAM_RES: 0x0078 as ResponseId,
|
||||
CREATE_TEAM_REQ: 0x007b as RequestId,
|
||||
CREATE_TEAM_RES: 0x007c as ResponseId,
|
||||
UPDATE_STORY_CLEAR_NUM_REQ: 0x007f as RequestId,
|
||||
UPDATE_STORY_CLEAR_NUM_RES: 0x0080 as ResponseId,
|
||||
UPDATE_PROVISIONAL_STORE_RANK_REQ: 0x0082 as RequestId,
|
||||
UPDATE_PROVISIONAL_STORE_RANK_RES: 0x0083 as ResponseId,
|
||||
LOAD_REWARD_TABLE_REQ: 0x0086 as RequestId,
|
||||
LOAD_REWARD_TABLE_RES: 0x0087 as ResponseId,
|
||||
SAVE_EXPEDITION_REQ: 0x008c as RequestId,
|
||||
SAVE_EXPEDITION_RES: 0x008d as ResponseId,
|
||||
SAVE_TOPIC_REQ: 0x009a as RequestId,
|
||||
SAVE_TOPIC_RES: 0x009b as ResponseId,
|
||||
LOAD_GENERAL_REWARD_REQ: 0x009c as RequestId,
|
||||
LOAD_GENERAL_REWARD_RES: 0x009d as ResponseId,
|
||||
SAVE_SETTINGS_REQ: 0x00a5 as RequestId,
|
||||
LOAD_CONFIG_V2_REQ: 0x00ab as RequestId,
|
||||
LOAD_CONFIG_V2_RES: 0x00ac as ResponseId,
|
||||
LOAD_STOCKER_REQ: 0x00a7 as RequestId,
|
||||
LOAD_STOCKER_RES: 0x00a8 as ResponseId,
|
||||
LOAD_2ON2_REQ: 0x00b0 as RequestId,
|
||||
LOAD_2ON2_RES: 0x00b1 as ResponseId,
|
||||
};
|
||||
|
||||
export const REQ_LEN = new Map<number, number>();
|
||||
export const MSG = _MSG as Readonly<typeof _MSG>;
|
||||
const RL = new Map<RequestId, number>();
|
||||
|
||||
REQ_LEN.set(MSG.ACCOUNT_LOCK_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.ACCOUNT_UNLOCK_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.CREATE_PROFILE_REQ, 0x00c0);
|
||||
REQ_LEN.set(MSG.CREATE_TEAM_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.LOAD_2ON2_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.LOAD_CONFIG_REQ, 0x0050);
|
||||
REQ_LEN.set(MSG.LOAD_CONFIG_V2_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.DISCOVER_PROFILE_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.LOAD_GENERAL_REWARD_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.LOAD_PROFILE_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.LOAD_REWARD_TABLE_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.LOAD_SERVER_LIST_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.LOAD_STOCKER_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.LOAD_TEAM_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.SAVE_EXPEDITION_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.SAVE_RECORD_REQ, 0x0940);
|
||||
REQ_LEN.set(MSG.SAVE_SETTINGS_REQ, 0x0020);
|
||||
REQ_LEN.set(MSG.SAVE_TOPIC_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.UPDATE_PROVISIONAL_STORE_RANK_REQ, 0x0010);
|
||||
REQ_LEN.set(MSG.UPDATE_STORY_CLEAR_NUM_REQ, 0x0010);
|
||||
RL.set(MSG.ACCOUNT_LOCK_REQ, 0x0020);
|
||||
RL.set(MSG.ACCOUNT_UNLOCK_REQ, 0x0020);
|
||||
RL.set(MSG.CREATE_PROFILE_REQ, 0x00c0);
|
||||
RL.set(MSG.CREATE_TEAM_REQ, 0x0010);
|
||||
RL.set(MSG.LOAD_2ON2_REQ, 0x0010);
|
||||
RL.set(MSG.LOAD_CONFIG_REQ, 0x0050);
|
||||
RL.set(MSG.LOAD_CONFIG_V2_REQ, 0x0010);
|
||||
RL.set(MSG.DISCOVER_PROFILE_REQ, 0x0010);
|
||||
RL.set(MSG.LOAD_GENERAL_REWARD_REQ, 0x0010);
|
||||
RL.set(MSG.LOAD_PROFILE_REQ, 0x0020);
|
||||
RL.set(MSG.LOAD_REWARD_TABLE_REQ, 0x0010);
|
||||
RL.set(MSG.LOAD_SERVER_LIST_REQ, 0x0020);
|
||||
RL.set(MSG.LOAD_STOCKER_REQ, 0x0010);
|
||||
RL.set(MSG.LOAD_TEAM_REQ, 0x0010);
|
||||
RL.set(MSG.SAVE_EXPEDITION_REQ, 0x0010);
|
||||
RL.set(MSG.SAVE_RECORD_REQ, 0x0940);
|
||||
RL.set(MSG.SAVE_SETTINGS_REQ, 0x0020);
|
||||
RL.set(MSG.SAVE_TOPIC_REQ, 0x0010);
|
||||
RL.set(MSG.UPDATE_PROVISIONAL_STORE_RANK_REQ, 0x0010);
|
||||
RL.set(MSG.UPDATE_STORY_CLEAR_NUM_REQ, 0x0010);
|
||||
|
||||
export function getRequestLength(id: RequestId): number | undefined {
|
||||
return RL.get(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user