idz: Split/fix loadServerList encoder

This commit is contained in:
BemaniWitch 2021-02-03 18:19:40 -05:00 committed by Tau
parent eb358e3547
commit 122cb51ed9
2 changed files with 35 additions and 5 deletions

View File

@ -34,7 +34,7 @@ import { loadProfile2 } from "./loadProfile2";
import { loadProfile3 } from "./loadProfile3";
import { loadProfile4 } from "./loadProfile4";
import { loadRewardTable1, loadRewardTable2 } from "./loadRewardTable";
import { loadServerList } from "./loadServerList";
import { loadServerList1, loadServerList2 } from "./loadServerList";
import { loadStocker1, loadStocker2 } from "./loadStocker";
import { loadTeamRanking1, loadTeamRanking2 } from "./loadTeamRanking";
import { loadTopTen } from "./loadTopTen1";
@ -115,7 +115,7 @@ function encode110(res: Response): Buffer {
return loadRewardTable1(res);
case "load_server_list_res":
return loadServerList(res);
return loadServerList1(res);
case "load_stocker_res":
return loadStocker1(res);
@ -226,7 +226,7 @@ function encode130(res: Response): Buffer {
return loadRewardTable1(res);
case "load_server_list_res":
return loadServerList(res);
return loadServerList1(res);
case "load_stocker_res":
return loadStocker2(res);
@ -337,7 +337,7 @@ function encode210(res: Response): Buffer {
return loadRewardTable2(res);
case "load_server_list_res":
return loadServerList(res);
return loadServerList2(res);
case "load_stocker_res":
return loadStocker1(res);

View File

@ -1,6 +1,6 @@
import { LoadServerListResponse } from "../response/loadServerList";
export function loadServerList(res: LoadServerListResponse) {
export function loadServerList1(res: LoadServerListResponse) {
const buf = Buffer.alloc(0x04b0);
buf.writeInt16LE(0x0007, 0x0000);
@ -29,3 +29,33 @@ export function loadServerList(res: LoadServerListResponse) {
return buf;
}
export function loadServerList2(res: LoadServerListResponse) {
const buf = Buffer.alloc(0x04b0);
buf.writeInt16LE(0x0007, 0x0000);
buf.writeInt16LE(res.status, 0x0004);
buf.write(res.userDb.addr, 0x0006);
buf.writeInt16LE(res.userDb.tcp, 0x0086);
buf.writeInt16LE(res.userDb.http, 0x0088);
buf.write(res.matchAddr, 0x008a);
buf.writeInt16LE(res.matchPort.tcp, 0x010a);
buf.writeInt16LE(res.matchPort.udpSend, 0x010c);
buf.writeInt16LE(res.matchPort.udpRecv, 0x010e);
buf.writeInt16LE(res.tagMatchPort.tcp, 0x0110);
buf.writeInt16LE(res.tagMatchPort.udpSend, 0x0112);
buf.writeInt16LE(res.tagMatchPort.udpRecv, 0x0114);
buf.write(res.event.addr, 0x0116);
buf.writeInt16LE(res.event.tcp, 0x0196);
buf.write(res.screenshot.addr, 0x019a);
buf.writeInt16LE(res.screenshot.tcp, 0x021a);
buf.write(res.pingReturn, 0x021e);
buf.write(res.echo1.addr, 0x029e);
buf.write(res.echo2.addr, 0x031e);
buf.writeInt16LE(res.echo1.udp, 0x39e);
buf.writeInt16LE(res.echo2.udp, 0x3a0);
buf.write(res.newsUrl, 0x03a2);
buf.write(res.reportErrorUrl, 0x0426);
return buf;
}