wip normalize response tags

This commit is contained in:
Tau 2019-04-02 21:32:59 -04:00
parent 5f50d610e1
commit ae5fe633ac
3 changed files with 34 additions and 35 deletions

View File

@ -37,7 +37,7 @@ export class Encoder extends Transform {
break;
case "create_team_res":
case "get_team_res":
case "load_team_res":
buf = Buffer.alloc(0x0ca0);
iconv.encode(obj.name, sjis).copy(buf, 0x0024);
@ -80,48 +80,48 @@ export class Encoder extends Transform {
break;
case "get_2on2_res":
case "load_2on2_res":
buf = Buffer.alloc(0x04c0);
buf.writeInt16LE(MSG.LOAD_2ON2_RES, 0x0000);
break;
case "get_config_res":
case "load_config_res":
buf = Buffer.alloc(0x01a0);
buf.writeInt16LE(MSG.LOAD_CONFIG_RES, 0x0000);
buf.writeInt8(obj.status, 0x0002);
break;
case "get_config_2_res":
case "load_config_v2_res":
buf = Buffer.alloc(0x230);
buf.writeInt16LE(MSG.LOAD_CONFIG_V2_RES, 0x0000);
buf.writeInt8(obj.status, 0x0002);
break;
case "get_exist_record_res":
case "discover_profile_res":
buf = Buffer.alloc(0x0010);
buf.writeInt16LE(MSG.DISCOVER_PROFILE_RES, 0x0000);
buf.writeInt8(obj.result ? 1 : 0, 0x0004);
break;
case "get_general_reward_res":
case "load_general_reward_res":
// A generic response is acceptable too so why even bother with this..
buf = Buffer.alloc(0x0330);
buf.writeInt16LE(MSG.LOAD_GENERAL_REWARD_RES, 0x0000);
break;
case "get_record_v1_res":
case "load_record_v1_res":
// Sending this causes an error
buf = Buffer.alloc(0x0c60);
buf.writeInt16LE(MSG.LOAD_PROFILE_V1_RES, 0x0000);
break;
case "get_record_v2_res":
case "load_record_v2_res":
buf = Buffer.alloc(0x0d30);
buf.writeInt16LE(MSG.LOAD_PROFILE_V2_RES, 0x0000);
@ -134,13 +134,13 @@ export class Encoder extends Transform {
break;
case "get_reward_table_res":
case "load_reward_table_res":
buf = Buffer.alloc(0x01c0);
buf.writeInt16LE(MSG.LOAD_REWARD_TABLE_RES, 0x0000);
break;
case "get_server_list_res":
case "load_server_list_res":
buf = Buffer.alloc(0x04b0);
buf.writeInt16LE(MSG.LOAD_SERVER_LIST_RES, 0x0000);
buf.writeInt16LE(obj.status, 0x0002);
@ -175,7 +175,7 @@ export class Encoder extends Transform {
break;
case "update_expedition_res":
case "save_expedition_res":
buf = Buffer.alloc(0x17c0);
buf.writeInt16LE(MSG.SAVE_EXPEDITION_RES, 0x0000);
// in awe of the size of this lad
@ -206,7 +206,7 @@ export class Encoder extends Transform {
break;
case "update_topic_res":
case "save_topic_res":
buf = Buffer.alloc(0x05d0);
buf.writeInt16LE(MSG.SAVE_TOPIC_RES, 0x0000);

View File

@ -51,14 +51,14 @@ export default async function idz(socket: Socket) {
case "load_2on2_req":
res = {
type: "get_2on2_res",
type: "load_2on2_res",
};
break;
case "load_config_req":
res = {
type: "get_config_res",
type: "load_config_res",
status: 1,
};
@ -66,7 +66,7 @@ export default async function idz(socket: Socket) {
case "load_config_v2_req":
res = {
type: "get_config_2_res",
type: "load_config_v2_res",
status: 1,
};
@ -74,7 +74,7 @@ export default async function idz(socket: Socket) {
case "discover_profile_req":
res = {
type: "get_exist_record_res",
type: "discover_profile_res",
result: true,
};
@ -91,7 +91,7 @@ export default async function idz(socket: Socket) {
case "load_profile_req":
res = {
type: "get_record_v2_res",
type: "load_record_v2_res",
name: "てすと",
profileId: 0x11223344,
lv: 69,
@ -104,7 +104,7 @@ export default async function idz(socket: Socket) {
case "load_reward_table_req":
res = {
type: "get_reward_table_res",
type: "load_reward_table_res",
};
break;
@ -113,7 +113,7 @@ export default async function idz(socket: Socket) {
const myHost = hostname();
res = {
type: "get_server_list_res",
type: "load_server_list_res",
status: 1,
userDb: {
addr: myHost,
@ -164,7 +164,7 @@ export default async function idz(socket: Socket) {
case "load_team_req":
res = {
type: "get_team_res",
type: "load_team_res",
name: " ",
members: [
{
@ -185,7 +185,7 @@ export default async function idz(socket: Socket) {
};
} else {
res = {
type: "update_expedition_res",
type: "save_expedition_res",
};
}
@ -224,7 +224,7 @@ export default async function idz(socket: Socket) {
case "save_topic_req":
res = {
type: "update_topic_res",
type: "save_topic_res",
};
break;

View File

@ -37,37 +37,36 @@ export interface CreateTeamResponse extends BaseTeamResponse {
}
export interface Get2on2Response {
type: "get_2on2_res";
type: "load_2on2_res";
// TODO?
}
export interface GetConfigResponse {
type: "get_config_res";
type: "load_config_res";
status: number;
}
export interface GetConfigResponse2 {
type: "get_config_2_res";
type: "load_config_v2_res";
status: number;
}
export interface GetExistRecordResponse {
type: "get_exist_record_res";
type: "discover_profile_res";
result: boolean;
}
export interface GetGeneralRewardResponse {
type: "get_general_reward_res";
type: "load_general_reward_res";
// TODO
}
export interface GetRecordResponse1 {
type: "get_record_v1_res";
// giga TODO
type: "load_record_v1_res";
}
export interface GetRecordResponse2 {
type: "get_record_v2_res";
type: "load_record_v2_res";
name: string;
profileId: number;
lv: number;
@ -78,12 +77,12 @@ export interface GetRecordResponse2 {
}
export interface GetRewardTableResponse {
type: "get_reward_table_res";
type: "load_reward_table_res";
// TODO
}
export interface GetServerListResponse {
type: "get_server_list_res";
type: "load_server_list_res";
status: number;
userDb: {
addr: string;
@ -129,11 +128,11 @@ export interface GetStockerResponse {
}
export interface GetTeamResponse extends BaseTeamResponse {
type: "get_team_res";
type: "load_team_res";
}
export interface UpdateExpeditionResponse {
type: "update_expedition_res";
type: "save_expedition_res";
// tera TODO
}
@ -155,7 +154,7 @@ export interface UpdateStoryClearNumResponse {
}
export interface UpdateTopicResponse {
type: "update_topic_res";
type: "save_topic_res";
// mega TODO
}