wip found team id in profile

This commit is contained in:
Tau
2019-04-02 21:28:08 -04:00
parent 448cdb9175
commit 5f50d610e1
6 changed files with 106 additions and 71 deletions

View File

@@ -130,8 +130,8 @@ readers.set(MSG.LOAD_SERVER_LIST_REQ, () => {
readers.set(MSG.LOAD_TEAM_REQ, buf => {
return {
type: "load_team_req",
teamId: buf.readUInt32LE(0x0004),
field_0008: buf.readUInt32LE(0x0008),
profileId: buf.readUInt32LE(0x0004),
teamId: buf.readUInt32LE(0x0008),
};
});
@@ -156,6 +156,20 @@ readers.set(MSG.SAVE_RECORD_REQ, buf => {
};
});
readers.set(MSG.SAVE_SETTINGS_REQ, buf => {
return {
type: "save_settings_req",
field_0002: buf.readUInt16LE(0x0002),
profileId: buf.readUInt32LE(0x0004),
dpoint: buf.readUInt32LE(0x0008),
field_000C: buf.readUInt32LE(0x000c),
field_0010: buf.readUInt8(0x0010),
field_0011: buf.readUInt8(0x0011),
field_0012: buf.readUInt8(0x0012),
field_0013: buf.readUInt8(0x0013),
};
});
readers.set(MSG.UPDATE_STORY_CLEAR_NUM_REQ, () => {
return {
type: "update_story_clear_num_req",

View File

@@ -31,6 +31,7 @@ export const MSG = {
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,
@@ -56,7 +57,8 @@ 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.UPDATE_PROVISIONAL_STORE_RANK_REQ, 0x0010);
REQ_LEN.set(MSG.SAVE_RECORD_REQ, 0x0940);
REQ_LEN.set(MSG.UPDATE_STORY_CLEAR_NUM_REQ, 0x0010);
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);

View File

@@ -22,17 +22,17 @@ export class Encoder extends Transform {
switch (obj.type) {
case "account_lock_res":
buf = Buffer.alloc(0x0020);
buf.writeUInt16LE(MSG.ACCOUNT_LOCK_RES, 0x0000);
buf.writeUInt8(obj.field_0018, 0x0018);
buf.writeUInt16LE(obj.field_001A, 0x001a);
buf.writeUInt32LE(obj.field_001C.getTime() / 1000, 0x001c);
buf.writeInt16LE(MSG.ACCOUNT_LOCK_RES, 0x0000);
buf.writeInt8(obj.field_0018, 0x0018);
buf.writeInt16LE(obj.field_001A, 0x001a);
buf.writeInt32LE(obj.field_001C.getTime() / 1000, 0x001c);
break;
case "account_unlock_res":
buf = Buffer.alloc(0x0010);
buf.writeUInt16LE(MSG.ACCOUNT_UNLOCK_RES, 0x0000);
buf.writeUInt8(obj.status, 0x0004);
buf.writeInt16LE(MSG.ACCOUNT_UNLOCK_RES, 0x0000);
buf.writeInt8(obj.status, 0x0004);
break;
@@ -49,124 +49,120 @@ export class Encoder extends Transform {
break;
}
buf.writeUInt32LE(1, base + 0x0000); // Presence
buf.writeInt32LE(1, base + 0x0000); // Presence
iconv.encode(member.name + "\0", sjis).copy(buf, base + 0x0004);
buf.writeUInt32LE(member.lv, base + 0x0018);
buf.writeUInt32LE(member.monthPoints, base + 0x0024);
buf.writeInt32LE(member.lv, base + 0x0018);
buf.writeInt32LE(member.monthPoints, base + 0x0024);
}
// xM
/*
buf.writeUInt16LE(0x00001, 0x0344 + 0x0000);
buf.writeUInt8(0x02, 0x0344 + 0x0003);
buf.writeUInt32LE(0x00000003, 0x0344 + 0x0004);
buf.writeInt16LE(0x00001, 0x0344 + 0x0000);
buf.writeInt8(0x02, 0x0344 + 0x0003);
buf.writeInt32LE(0x00000003, 0x0344 + 0x0004);
iconv.encode("str\0", sjis).copy(buf, 0x0344 + 0x0008);
buf.writeUInt32LE(0x00000004, 0x0344 + 0x001c);
buf.writeInt32LE(0x00000004, 0x0344 + 0x001c);
*/
if (obj.type === "create_team_res") {
buf.writeUInt16LE(MSG.CREATE_TEAM_RES, 0x0000);
buf.writeInt16LE(MSG.CREATE_TEAM_RES, 0x0000);
} else {
buf.writeUInt16LE(MSG.LOAD_TEAM_RES, 0x0000);
buf.writeInt16LE(MSG.LOAD_TEAM_RES, 0x0000);
}
break;
case "generic_res":
buf = Buffer.alloc(0x0020);
buf.writeUInt16LE(MSG.GENERIC_RES, 0x0000);
buf.writeUInt32LE(obj.status, 0x0004);
buf.writeInt16LE(MSG.GENERIC_RES, 0x0000);
buf.writeInt32LE(obj.status, 0x0004);
break;
case "get_2on2_res":
buf = Buffer.alloc(0x04c0);
buf.writeUInt16LE(MSG.LOAD_2ON2_RES, 0x0000);
buf.writeInt16LE(MSG.LOAD_2ON2_RES, 0x0000);
break;
case "get_config_res":
buf = Buffer.alloc(0x01a0);
buf.writeUInt16LE(MSG.LOAD_CONFIG_RES, 0x0000);
buf.writeUInt8(obj.status, 0x0002);
buf.writeInt16LE(MSG.LOAD_CONFIG_RES, 0x0000);
buf.writeInt8(obj.status, 0x0002);
break;
case "get_config_2_res":
buf = Buffer.alloc(0x230);
buf.writeUInt16LE(MSG.LOAD_CONFIG_V2_RES, 0x0000);
buf.writeUInt8(obj.status, 0x0002);
buf.writeInt16LE(MSG.LOAD_CONFIG_V2_RES, 0x0000);
buf.writeInt8(obj.status, 0x0002);
break;
case "get_exist_record_res":
buf = Buffer.alloc(0x0010);
buf.writeUInt16LE(MSG.DISCOVER_PROFILE_RES, 0x0000);
buf.writeUInt8(obj.result ? 1 : 0, 0x0004);
buf.writeInt16LE(MSG.DISCOVER_PROFILE_RES, 0x0000);
buf.writeInt8(obj.result ? 1 : 0, 0x0004);
break;
case "get_general_reward_res":
// A generic response is acceptable too so why even bother with this..
buf = Buffer.alloc(0x0330);
buf.writeUInt16LE(MSG.LOAD_GENERAL_REWARD_RES, 0x0000);
buf.writeInt16LE(MSG.LOAD_GENERAL_REWARD_RES, 0x0000);
break;
case "get_record_v1_res":
// Sending this causes an error
buf = Buffer.alloc(0x0c60);
buf.writeUInt16LE(MSG.LOAD_PROFILE_V1_RES, 0x0000);
buf.writeInt16LE(MSG.LOAD_PROFILE_V1_RES, 0x0000);
break;
case "get_record_v2_res":
buf = Buffer.alloc(0x0d30);
//buf.fill(1, 0x01a6, 0x0279); // -------- SPRAYING -----------
for (let i = 0x1a; i < 0x26; i++) {
//buf.writeUInt8(1, 0x0206 + i);
}
buf.writeUInt16LE(MSG.LOAD_PROFILE_V2_RES, 0x0000);
buf.writeUInt32LE(obj.teamId, 4 + 0x3b4);
buf.writeUInt16LE(obj.lv, 4 + 0x03c8);
buf.writeUInt32LE(obj.dpoint, 4 + 0x03e4);
buf.writeUInt32LE(obj.fame, 4 + 0x0400);
buf.writeInt16LE(MSG.LOAD_PROFILE_V2_RES, 0x0000);
buf.writeInt32LE(obj.profileId, 4 + 0x3b4);
buf.writeInt16LE(obj.lv, 4 + 0x03c8);
buf.writeInt32LE(obj.dpoint, 4 + 0x03e4);
buf.writeInt32LE(obj.fame, 4 + 0x0400);
iconv.encode(obj.name + "\0", sjis).copy(buf, 4 + 0x03ea);
buf.writeInt32LE(obj.teamId, 0x07e0);
break;
case "get_reward_table_res":
buf = Buffer.alloc(0x01c0);
buf.writeUInt16LE(MSG.LOAD_REWARD_TABLE_RES, 0x0000);
buf.writeInt16LE(MSG.LOAD_REWARD_TABLE_RES, 0x0000);
break;
case "get_server_list_res":
buf = Buffer.alloc(0x04b0);
buf.writeUInt16LE(MSG.LOAD_SERVER_LIST_RES, 0x0000);
buf.writeUInt16LE(obj.status, 0x0002);
buf.writeInt16LE(MSG.LOAD_SERVER_LIST_RES, 0x0000);
buf.writeInt16LE(obj.status, 0x0002);
buf.write(obj.userDb.addr, 0x0004);
buf.writeUInt16LE(obj.userDb.tcp, 0x0084);
buf.writeUInt16LE(obj.userDb.http, 0x0086);
buf.writeInt16LE(obj.userDb.tcp, 0x0084);
buf.writeInt16LE(obj.userDb.http, 0x0086);
buf.write(obj.matchAddr, 0x0088);
buf.writeUInt16LE(obj.matchPort.tcp, 0x0108);
buf.writeUInt16LE(obj.matchPort.udpSend, 0x010a);
buf.writeUInt16LE(obj.matchPort.udpRecv, 0x010c);
buf.writeUInt16LE(obj.tagMatchPort.tcp, 0x010e);
buf.writeUInt16LE(obj.tagMatchPort.udpSend, 0x0110);
buf.writeUInt16LE(obj.tagMatchPort.udpRecv, 0x0112);
buf.writeInt16LE(obj.matchPort.tcp, 0x0108);
buf.writeInt16LE(obj.matchPort.udpSend, 0x010a);
buf.writeInt16LE(obj.matchPort.udpRecv, 0x010c);
buf.writeInt16LE(obj.tagMatchPort.tcp, 0x010e);
buf.writeInt16LE(obj.tagMatchPort.udpSend, 0x0110);
buf.writeInt16LE(obj.tagMatchPort.udpRecv, 0x0112);
buf.write(obj.event.addr, 0x0114);
buf.writeUInt16LE(obj.event.tcp, 0x0194);
buf.writeInt16LE(obj.event.tcp, 0x0194);
buf.write(obj.screenshot.addr, 0x0198);
buf.writeUInt16LE(obj.screenshot.tcp, 0x0218);
buf.writeInt16LE(obj.screenshot.tcp, 0x0218);
buf.write(obj.pingReturn, 0x021c);
buf.write(obj.echo1.addr, 0x029c);
buf.write(obj.echo2.addr, 0x031c);
buf.writeUInt16LE(obj.echo1.udp, 0x39c);
buf.writeUInt16LE(obj.echo2.udp, 0x39e);
buf.writeInt16LE(obj.echo1.udp, 0x39c);
buf.writeInt16LE(obj.echo2.udp, 0x39e);
buf.write(obj.newsUrl, 0x03a0);
buf.write(obj.reportErrorUrl, 0x0424);
@@ -174,29 +170,29 @@ export class Encoder extends Transform {
case "get_stocker_res":
buf = Buffer.alloc(0x00a0);
buf.writeUInt16LE(MSG.LOAD_STOCKER_RES, 0x0000);
buf.writeUInt8(obj.status, 0x0002);
buf.writeInt16LE(MSG.LOAD_STOCKER_RES, 0x0000);
buf.writeInt8(obj.status, 0x0002);
break;
case "update_expedition_res":
buf = Buffer.alloc(0x17c0);
buf.writeUInt16LE(MSG.SAVE_EXPEDITION_RES, 0x0000);
buf.writeInt16LE(MSG.SAVE_EXPEDITION_RES, 0x0000);
// in awe of the size of this lad
break;
case "update_provisional_store_rank_res":
buf = Buffer.alloc(0x02b0);
buf.writeUInt16LE(MSG.UPDATE_PROVISIONAL_STORE_RANK_RES, 0x0000);
buf.writeInt16LE(MSG.UPDATE_PROVISIONAL_STORE_RANK_RES, 0x0000);
for (let i = 0; i < 10; i++) {
const offset = 0x44 + i;
const row = obj.rows[i];
if (row !== undefined) {
buf.writeUInt16LE(row.field_0000, offset + 0x0000);
buf.writeUInt32LE(row.field_0004, offset + 0x0004);
buf.writeInt16LE(row.field_0000, offset + 0x0000);
buf.writeInt32LE(row.field_0004, offset + 0x0004);
iconv.encode(row.field_0010, sjis).copy(buf, offset + 0x0010);
iconv.encode(row.field_003B, sjis).copy(buf, offset + 0x003b);
}
@@ -206,13 +202,13 @@ export class Encoder extends Transform {
case "update_story_clear_num_res":
buf = Buffer.alloc(0x0220);
buf.writeUInt16LE(MSG.UPDATE_STORY_CLEAR_NUM_RES, 0x0000);
buf.writeInt16LE(MSG.UPDATE_STORY_CLEAR_NUM_RES, 0x0000);
break;
case "update_topic_res":
buf = Buffer.alloc(0x05d0);
buf.writeUInt16LE(MSG.SAVE_TOPIC_RES, 0x0000);
buf.writeInt16LE(MSG.SAVE_TOPIC_RES, 0x0000);
break;

View File

@@ -18,7 +18,7 @@ export default async function idz(socket: Socket) {
res = {
type: "account_lock_res",
field_0018: 1,
field_001A: 0xffff,
field_001A: -1,
field_001C: new Date(Date.now() + 3600000),
};
@@ -93,10 +93,11 @@ export default async function idz(socket: Socket) {
res = {
type: "get_record_v2_res",
name: "てすと",
teamId: 0x11223344,
profileId: 0x11223344,
lv: 69,
fame: 1234,
dpoint: 54321,
teamId: 0x22334455,
};
break;
@@ -206,6 +207,14 @@ export default async function idz(socket: Socket) {
break;
case "save_settings_req":
res = {
type: "generic_res",
status: 1, // ignored but whatever
};
break;
case "update_story_clear_num_req":
res = {
type: "update_story_clear_num_res",

View File

@@ -90,8 +90,8 @@ export interface LoadStockerRequest {
export interface LoadTeamRequest {
type: "load_team_req";
profileId: number;
teamId: number;
field_0008: number;
}
export interface SaveExpeditionRequest {
@@ -113,6 +113,18 @@ export interface UpdateStoryClearNumRequest {
type: "update_story_clear_num_req";
}
export interface SaveSettingsRequest {
type: "save_settings_req";
field_0002: number;
profileId: number;
dpoint: number; // ?? why
field_000C: number;
field_0010: number;
field_0011: number;
field_0012: number;
field_0013: number;
}
export interface SaveTopicRequest {
type: "save_topic_req";
aimeId?: number;
@@ -123,10 +135,10 @@ export type Request =
| AccountUnlockRequest
| CreateProfileRequest
| CreateTeamRequest
| DiscoverProfileRequest
| Load2on2Request
| LoadConfigRequest
| LoadConfigRequest2
| DiscoverProfileRequest
| LoadGeneralRewardRequest
| LoadProfileRequest
| LoadRewardTableRequest
@@ -134,7 +146,8 @@ export type Request =
| LoadStockerRequest
| LoadTeamRequest
| SaveExpeditionRequest
| UpdateProvisionalStoreRankRequest
| SaveProfileRequest
| UpdateStoryClearNumRequest
| SaveTopicRequest;
| SaveSettingsRequest
| SaveTopicRequest
| UpdateProvisionalStoreRankRequest
| UpdateStoryClearNumRequest;

View File

@@ -69,10 +69,11 @@ export interface GetRecordResponse1 {
export interface GetRecordResponse2 {
type: "get_record_v2_res";
name: string;
teamId: number;
profileId: number;
lv: number;
fame: number;
dpoint: number;
teamId: number;
// giga TODO
}