mirror of
https://github.com/djhackersdev/minime.git
synced 2026-04-24 23:47:21 -05:00
idz: Explicitly split team msg encoders
This commit is contained in:
parent
03d0e87b55
commit
f3be39823a
|
|
@ -3,7 +3,10 @@ import { CreateAutoTeamResponse } from "../response/createAutoTeam";
|
|||
import { LoadTeamResponse } from "../response/loadTeam";
|
||||
import { encodeChara } from "./_chara";
|
||||
|
||||
export function _team(res: CreateAutoTeamResponse | LoadTeamResponse) {
|
||||
function _team(
|
||||
res: CreateAutoTeamResponse | LoadTeamResponse,
|
||||
msgCode: number
|
||||
) {
|
||||
const buf = Buffer.alloc(0x0ca0);
|
||||
|
||||
if (res.type === "create_auto_team_res") {
|
||||
|
|
@ -56,3 +59,11 @@ export function _team(res: CreateAutoTeamResponse | LoadTeamResponse) {
|
|||
|
||||
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 { _team } from "./_team";
|
||||
import { createAutoTeam, loadTeam } from "./_team";
|
||||
import { checkTeamName } from "./checkTeamName";
|
||||
import { createProfile } from "./createProfile";
|
||||
import { createTeam } from "./createTeam";
|
||||
|
|
@ -46,7 +46,7 @@ function encode110(res: Response): Buffer {
|
|||
return checkTeamName(res);
|
||||
|
||||
case "create_auto_team_res":
|
||||
return _team(res);
|
||||
return createAutoTeam(res);
|
||||
|
||||
case "create_profile_res":
|
||||
return createProfile(res);
|
||||
|
|
@ -94,7 +94,7 @@ function encode110(res: Response): Buffer {
|
|||
return loadStocker(res);
|
||||
|
||||
case "load_team_res":
|
||||
return _team(res);
|
||||
return loadTeam(res);
|
||||
|
||||
case "load_team_ranking_res":
|
||||
return loadTeamRanking(res);
|
||||
|
|
@ -151,7 +151,7 @@ function encode130(res: Response): Buffer {
|
|||
return checkTeamName(res);
|
||||
|
||||
case "create_auto_team_res":
|
||||
return _team(res);
|
||||
return createAutoTeam(res);
|
||||
|
||||
case "create_profile_res":
|
||||
return createProfile(res);
|
||||
|
|
@ -199,7 +199,7 @@ function encode130(res: Response): Buffer {
|
|||
return loadStocker(res);
|
||||
|
||||
case "load_team_res":
|
||||
return _team(res);
|
||||
return loadTeam(res);
|
||||
|
||||
case "load_team_ranking_res":
|
||||
return loadTeamRanking(res);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user