wip members in team load

This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent e101d74637
commit 1eaab8aaab
3 changed files with 57 additions and 13 deletions
+31 -8
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);