mirror of
https://github.com/djhackersdev/minime.git
synced 2026-08-20 01:14:08 -05:00
Rename CreateAutoTeam req/res
This commit is contained in:
@@ -1,14 +0,0 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import { CreateTeamRequest } from "../request/createTeam";
|
||||
|
||||
createTeam.msgCode = 0x007b as RequestCode;
|
||||
createTeam.msgLen = 0x0010;
|
||||
|
||||
export function createTeam(buf: Buffer): CreateTeamRequest {
|
||||
return {
|
||||
type: "create_team_req",
|
||||
field_0004: buf.readUInt32LE(0x0004),
|
||||
field_0008: buf.readUInt32LE(0x0008),
|
||||
field_000C: buf.readUInt8(0x000c),
|
||||
};
|
||||
}
|
||||
@@ -2,7 +2,7 @@ import { Transform } from "stream";
|
||||
|
||||
import { saveTimeAttack } from "./saveTimeAttack";
|
||||
import { createProfile } from "./createProfile";
|
||||
import { createTeam } from "./createTeam";
|
||||
import { joinAutoTeam } from "./joinAutoTeam";
|
||||
import { discoverProfile } from "./discoverProfile";
|
||||
import { load2on2 } from "./load2on2";
|
||||
import { loadConfig } from "./loadConfig";
|
||||
@@ -42,7 +42,7 @@ export type ReaderFn = ((buf: Buffer) => Request) & {
|
||||
|
||||
const funcList: ReaderFn[] = [
|
||||
createProfile,
|
||||
createTeam,
|
||||
joinAutoTeam,
|
||||
discoverProfile,
|
||||
load2on2,
|
||||
loadConfig,
|
||||
|
||||
14
src/idz/decoder/joinAutoTeam.ts
Normal file
14
src/idz/decoder/joinAutoTeam.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import { JoinAutoTeamRequest } from "../request/joinAutoTeam";
|
||||
|
||||
joinAutoTeam.msgCode = 0x007b as RequestCode;
|
||||
joinAutoTeam.msgLen = 0x0010;
|
||||
|
||||
export function joinAutoTeam(buf: Buffer): JoinAutoTeamRequest {
|
||||
return {
|
||||
type: "join_auto_team_req",
|
||||
field_0004: buf.readUInt32LE(0x0004),
|
||||
field_0008: buf.readUInt32LE(0x0008),
|
||||
field_000C: buf.readUInt8(0x000c),
|
||||
};
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import iconv = require("iconv-lite");
|
||||
import { CreateTeamResponse } from "../response/createTeam";
|
||||
import { JoinAutoTeamResponse } from "../response/joinAutoTeam";
|
||||
import { LoadTeamResponse } from "../response/loadTeam";
|
||||
|
||||
export function _team(res: CreateTeamResponse | LoadTeamResponse) {
|
||||
export function _team(res: JoinAutoTeamResponse | LoadTeamResponse) {
|
||||
const buf = Buffer.alloc(0x0ca0);
|
||||
|
||||
buf.writeUInt32LE(res.team.id, 0x000c);
|
||||
@@ -32,7 +32,7 @@ export function _team(res: CreateTeamResponse | LoadTeamResponse) {
|
||||
buf.writeInt32LE(0x00000004, 0x0344 + 0x001c);
|
||||
*/
|
||||
|
||||
if (res.type === "create_team_res") {
|
||||
if (res.type === "join_auto_team_res") {
|
||||
buf.writeInt16LE(0x007c, 0x0000);
|
||||
} else {
|
||||
buf.writeInt16LE(0x0078, 0x0000);
|
||||
|
||||
@@ -27,12 +27,12 @@ import { Response } from "../response";
|
||||
|
||||
function encode(res: Response): Buffer {
|
||||
switch (res.type) {
|
||||
case "create_team_res":
|
||||
return _team(res);
|
||||
|
||||
case "discover_profile_res":
|
||||
return discoverProfile(res);
|
||||
|
||||
case "join_auto_team_res":
|
||||
return _team(res);
|
||||
|
||||
case "generic_res":
|
||||
return generic(res);
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ export function loadProfile2(res: LoadProfileResponse2) {
|
||||
bitmap(res.titles, 0xb4).copy(buf, 0x720);
|
||||
buf.writeUInt8(res.settings.paperCup, 0x07d9);
|
||||
buf.writeUInt8(res.settings.gauges, 0x07da);
|
||||
buf.writeInt32LE(res.teamId || 0, 0x07e0);
|
||||
buf.writeUInt32LE(res.teamId || 0xffffffff, 0x07e0);
|
||||
car(res.car).copy(buf, 0x0c5c);
|
||||
|
||||
return buf;
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
import { Id } from "../model/base";
|
||||
import { Team } from "../model/team";
|
||||
import { CreateTeamRequest } from "../request/createTeam";
|
||||
import { JoinAutoTeamRequest } from "../request/joinAutoTeam";
|
||||
import { LoadTeamRequest } from "../request/loadTeam";
|
||||
import { CreateTeamResponse } from "../response/createTeam";
|
||||
import { JoinAutoTeamResponse } from "../response/joinAutoTeam";
|
||||
import { LoadTeamResponse } from "../response/loadTeam";
|
||||
import { World } from "../world";
|
||||
|
||||
export function _team(
|
||||
w: World,
|
||||
req: CreateTeamRequest | LoadTeamRequest
|
||||
): CreateTeamResponse | LoadTeamResponse {
|
||||
req: JoinAutoTeamRequest | LoadTeamRequest
|
||||
): JoinAutoTeamResponse | LoadTeamResponse {
|
||||
const bits = {
|
||||
team: {
|
||||
id: 2 as Id<Team>,
|
||||
@@ -18,8 +18,8 @@ export function _team(
|
||||
members: [],
|
||||
};
|
||||
|
||||
if (req.type === "create_team_req") {
|
||||
return { type: "create_team_res", ...bits };
|
||||
if (req.type === "join_auto_team_req") {
|
||||
return { type: "join_auto_team_res", ...bits };
|
||||
} else {
|
||||
return { type: "load_team_res", ...bits };
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ export async function dispatch(w: World, req: Request): Promise<Response> {
|
||||
case "create_profile_req":
|
||||
return createProfile(w, req);
|
||||
|
||||
case "create_team_req":
|
||||
case "join_auto_team_req":
|
||||
return _team(w, req);
|
||||
|
||||
case "load_2on2_req":
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
export interface CreateTeamRequest {
|
||||
type: "create_team_req";
|
||||
field_0004: number;
|
||||
field_0008: number;
|
||||
field_000C: number;
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CreateProfileRequest } from "./createProfile";
|
||||
import { CreateTeamRequest } from "./createTeam";
|
||||
import { DiscoverProfileRequest } from "./discoverProfile";
|
||||
import { JoinAutoTeamRequest } from "./joinAutoTeam";
|
||||
import { Load2on2Request } from "./load2on2";
|
||||
import { LoadConfigRequest } from "./loadConfig";
|
||||
import { LoadConfigRequest2 } from "./loadConfig2";
|
||||
@@ -33,8 +33,8 @@ import { UpdateUserLogRequest } from "./updateUserLog";
|
||||
|
||||
export type Request =
|
||||
| CreateProfileRequest
|
||||
| CreateTeamRequest
|
||||
| DiscoverProfileRequest
|
||||
| JoinAutoTeamRequest
|
||||
| Load2on2Request
|
||||
| LoadConfigRequest
|
||||
| LoadConfigRequest2
|
||||
|
||||
6
src/idz/request/joinAutoTeam.ts
Normal file
6
src/idz/request/joinAutoTeam.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
export interface JoinAutoTeamRequest {
|
||||
type: "join_auto_team_req";
|
||||
field_0004: number;
|
||||
field_0008: number;
|
||||
field_000C: number;
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
import { BaseTeamResponse } from "./_team";
|
||||
|
||||
export interface CreateTeamResponse extends BaseTeamResponse {
|
||||
type: "create_team_res";
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { CreateTeamResponse } from "./createTeam";
|
||||
import { DiscoverProfileResponse } from "./discoverProfile";
|
||||
import { GenericResponse } from "./generic";
|
||||
import { JoinAutoTeamResponse } from "./joinAutoTeam";
|
||||
import { Load2on2Response } from "./load2on2";
|
||||
import { LoadConfigResponse } from "./loadConfig";
|
||||
import { LoadConfigResponse2 } from "./loadConfig2";
|
||||
@@ -24,9 +24,9 @@ import { UpdateStoryClearNumResponse } from "./updateStoryClearNum";
|
||||
import { UnlockProfileResponse } from "./unlockProfile";
|
||||
|
||||
export type Response =
|
||||
| CreateTeamResponse
|
||||
| DiscoverProfileResponse
|
||||
| GenericResponse
|
||||
| JoinAutoTeamResponse
|
||||
| Load2on2Response
|
||||
| LoadConfigResponse
|
||||
| LoadConfigResponse2
|
||||
|
||||
5
src/idz/response/joinAutoTeam.ts
Normal file
5
src/idz/response/joinAutoTeam.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
import { BaseTeamResponse } from "./_team";
|
||||
|
||||
export interface JoinAutoTeamResponse extends BaseTeamResponse {
|
||||
type: "join_auto_team_res";
|
||||
}
|
||||
Reference in New Issue
Block a user