wip members in team load

This commit is contained in:
Tau 2019-04-01 21:07:45 -04:00
parent e101d74637
commit 1eaab8aaab
3 changed files with 57 additions and 13 deletions

View File

@ -37,10 +37,40 @@ export class Encoder extends Transform {
break;
case "create_team_res":
case "get_team_res":
buf = Buffer.alloc(0x0ca0);
buf.writeUInt16LE(MSG.CREATE_TEAM_RES, 0x0000);
iconv.encode(obj.name, sjis).copy(buf, 0x0024);
for (let i = 0; i < 6; i++) {
const base = 0x011c + i * 0x004c;
const member = obj.members[i];
if (member === undefined) {
break;
}
buf.writeUInt32LE(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);
}
// xM
/*
buf.writeUInt16LE(0x00001, 0x0344 + 0x0000);
buf.writeUInt8(0x02, 0x0344 + 0x0003);
buf.writeUInt32LE(0x00000003, 0x0344 + 0x0004);
iconv.encode("str\0", sjis).copy(buf, 0x0344 + 0x0008);
buf.writeUInt32LE(0x00000004, 0x0344 + 0x001c);
*/
if (obj.type === "create_team_res") {
buf.writeUInt16LE(MSG.CREATE_TEAM_RES, 0x0000);
} else {
buf.writeUInt16LE(MSG.GET_TEAM_RES, 0x0000);
}
break;
case "generic_res":
@ -144,13 +174,6 @@ export class Encoder extends Transform {
break;
case "get_team_res":
buf = Buffer.alloc(0x0ca0);
buf.writeUInt16LE(MSG.GET_TEAM_RES, 0x0000);
iconv.encode(obj.name, sjis).copy(buf, 0x0024);
break;
case "update_provisional_store_rank_res":
buf = Buffer.alloc(0x02b0);
buf.writeUInt16LE(MSG.UPDATE_PROVISIONAL_STORE_RANK_RES, 0x0000);

View File

@ -42,6 +42,7 @@ export default async function idz(socket: Socket) {
output.write({
type: "create_team_res",
name: " ",
members: [],
});
break;
@ -162,6 +163,13 @@ export default async function idz(socket: Socket) {
output.write({
type: "get_team_res",
name: " ",
members: [
{
name: "てすと",
lv: 69,
monthPoints: 1234,
},
],
});
break;

View File

@ -1,3 +1,19 @@
//
// Common defs
//
export interface TeamMember {
name: string;
lv: number;
monthPoints: number;
}
export interface BaseTeamResponse {
name: string;
members: TeamMember[];
// giga TODO
}
export interface AccountLockResponse {
type: "account_lock_res";
field_0018: number;
@ -15,9 +31,8 @@ export interface GenericResponse {
status: number;
}
export interface CreateTeamResponse {
export interface CreateTeamResponse extends BaseTeamResponse {
type: "create_team_res";
name: string;
}
export interface Get2on2Response {
@ -111,10 +126,8 @@ export interface GetStockerResponse {
// mega TODO
}
export interface GetTeamResponse {
export interface GetTeamResponse extends BaseTeamResponse {
type: "get_team_res";
name: string;
// giga TODO
}
export interface UpdateProvisionalStoreRankResponseRow {