idz: Explicitly split team msg encoders
This commit is contained in:
@@ -3,7 +3,10 @@ import { CreateAutoTeamResponse } from "../response/createAutoTeam";
|
|||||||
import { LoadTeamResponse } from "../response/loadTeam";
|
import { LoadTeamResponse } from "../response/loadTeam";
|
||||||
import { encodeChara } from "./_chara";
|
import { encodeChara } from "./_chara";
|
||||||
|
|
||||||
export function _team(res: CreateAutoTeamResponse | LoadTeamResponse) {
|
function _team(
|
||||||
|
res: CreateAutoTeamResponse | LoadTeamResponse,
|
||||||
|
msgCode: number
|
||||||
|
) {
|
||||||
const buf = Buffer.alloc(0x0ca0);
|
const buf = Buffer.alloc(0x0ca0);
|
||||||
|
|
||||||
if (res.type === "create_auto_team_res") {
|
if (res.type === "create_auto_team_res") {
|
||||||
@@ -56,3 +59,11 @@ export function _team(res: CreateAutoTeamResponse | LoadTeamResponse) {
|
|||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function createAutoTeam(res: CreateAutoTeamResponse): Buffer {
|
||||||
|
return _team(res, 0x007c);
|
||||||
|
}
|
||||||
|
|
||||||
|
export function loadTeam(res: LoadTeamResponse): Buffer {
|
||||||
|
return _team(res, 0x0078);
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import logger from "debug";
|
import logger from "debug";
|
||||||
|
|
||||||
import { _team } from "./_team";
|
import { createAutoTeam, loadTeam } from "./_team";
|
||||||
import { checkTeamName } from "./checkTeamName";
|
import { checkTeamName } from "./checkTeamName";
|
||||||
import { createProfile } from "./createProfile";
|
import { createProfile } from "./createProfile";
|
||||||
import { createTeam } from "./createTeam";
|
import { createTeam } from "./createTeam";
|
||||||
@@ -46,7 +46,7 @@ function encode110(res: Response): Buffer {
|
|||||||
return checkTeamName(res);
|
return checkTeamName(res);
|
||||||
|
|
||||||
case "create_auto_team_res":
|
case "create_auto_team_res":
|
||||||
return _team(res);
|
return createAutoTeam(res);
|
||||||
|
|
||||||
case "create_profile_res":
|
case "create_profile_res":
|
||||||
return createProfile(res);
|
return createProfile(res);
|
||||||
@@ -94,7 +94,7 @@ function encode110(res: Response): Buffer {
|
|||||||
return loadStocker(res);
|
return loadStocker(res);
|
||||||
|
|
||||||
case "load_team_res":
|
case "load_team_res":
|
||||||
return _team(res);
|
return loadTeam(res);
|
||||||
|
|
||||||
case "load_team_ranking_res":
|
case "load_team_ranking_res":
|
||||||
return loadTeamRanking(res);
|
return loadTeamRanking(res);
|
||||||
@@ -151,7 +151,7 @@ function encode130(res: Response): Buffer {
|
|||||||
return checkTeamName(res);
|
return checkTeamName(res);
|
||||||
|
|
||||||
case "create_auto_team_res":
|
case "create_auto_team_res":
|
||||||
return _team(res);
|
return createAutoTeam(res);
|
||||||
|
|
||||||
case "create_profile_res":
|
case "create_profile_res":
|
||||||
return createProfile(res);
|
return createProfile(res);
|
||||||
@@ -199,7 +199,7 @@ function encode130(res: Response): Buffer {
|
|||||||
return loadStocker(res);
|
return loadStocker(res);
|
||||||
|
|
||||||
case "load_team_res":
|
case "load_team_res":
|
||||||
return _team(res);
|
return loadTeam(res);
|
||||||
|
|
||||||
case "load_team_ranking_res":
|
case "load_team_ranking_res":
|
||||||
return loadTeamRanking(res);
|
return loadTeamRanking(res);
|
||||||
|
|||||||
Reference in New Issue
Block a user