idz: Add explicit CreateProfileResponse
This commit is contained in:
@@ -0,0 +1,11 @@
|
|||||||
|
import { CreateProfileResponse } from "../response/createProfile";
|
||||||
|
|
||||||
|
export function createProfile(res: CreateProfileResponse) {
|
||||||
|
const buf = Buffer.alloc(0x0020);
|
||||||
|
|
||||||
|
// Shares message type code with the "generic" response
|
||||||
|
buf.writeInt16LE(0x0001, 0x0000);
|
||||||
|
buf.writeInt32LE(res.aimeId, 0x0004);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ import logger from "debug";
|
|||||||
|
|
||||||
import { _team } from "./_team";
|
import { _team } from "./_team";
|
||||||
import { checkTeamName } from "./checkTeamName";
|
import { checkTeamName } from "./checkTeamName";
|
||||||
|
import { createProfile } from "./createProfile";
|
||||||
import { createTeam } from "./createTeam";
|
import { createTeam } from "./createTeam";
|
||||||
import { discoverProfile } from "./discoverProfile";
|
import { discoverProfile } from "./discoverProfile";
|
||||||
import { generic } from "./generic";
|
import { generic } from "./generic";
|
||||||
@@ -47,6 +48,9 @@ function encode110(res: Response): Buffer {
|
|||||||
case "create_auto_team_res":
|
case "create_auto_team_res":
|
||||||
return _team(res);
|
return _team(res);
|
||||||
|
|
||||||
|
case "create_profile_res":
|
||||||
|
return createProfile(res);
|
||||||
|
|
||||||
case "create_team_res":
|
case "create_team_res":
|
||||||
return createTeam(res);
|
return createTeam(res);
|
||||||
|
|
||||||
@@ -149,6 +153,9 @@ function encode130(res: Response): Buffer {
|
|||||||
case "create_auto_team_res":
|
case "create_auto_team_res":
|
||||||
return _team(res);
|
return _team(res);
|
||||||
|
|
||||||
|
case "create_profile_res":
|
||||||
|
return createProfile(res);
|
||||||
|
|
||||||
case "create_team_res":
|
case "create_team_res":
|
||||||
return createTeam(res);
|
return createTeam(res);
|
||||||
|
|
||||||
|
|||||||
@@ -4,13 +4,13 @@ import { Settings } from "../model/settings";
|
|||||||
import { Story } from "../model/story";
|
import { Story } from "../model/story";
|
||||||
import { Unlocks } from "../model/unlocks";
|
import { Unlocks } from "../model/unlocks";
|
||||||
import { CreateProfileRequest } from "../request/createProfile";
|
import { CreateProfileRequest } from "../request/createProfile";
|
||||||
import { GenericResponse } from "../response/generic";
|
import { CreateProfileResponse } from "../response/createProfile";
|
||||||
import { Repositories } from "../repo";
|
import { Repositories } from "../repo";
|
||||||
|
|
||||||
export async function createProfile(
|
export async function createProfile(
|
||||||
w: Repositories,
|
w: Repositories,
|
||||||
req: CreateProfileRequest
|
req: CreateProfileRequest
|
||||||
): Promise<GenericResponse> {
|
): Promise<CreateProfileResponse> {
|
||||||
const { aimeId, version, name } = req;
|
const { aimeId, version, name } = req;
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ export async function createProfile(
|
|||||||
await w.teamReservations().commitHack(aimeId);
|
await w.teamReservations().commitHack(aimeId);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: "generic_res",
|
type: "create_profile_res",
|
||||||
status: aimeId, // "Generic response" my fucking *ass*
|
aimeId: aimeId,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { AimeId } from "../../../model";
|
||||||
|
|
||||||
|
export interface CreateProfileResponse {
|
||||||
|
type: "create_profile_res";
|
||||||
|
aimeId: AimeId;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
import { CheckTeamNameResponse } from "./checkTeamName";
|
import { CheckTeamNameResponse } from "./checkTeamName";
|
||||||
import { CreateAutoTeamResponse } from "./createAutoTeam";
|
import { CreateAutoTeamResponse } from "./createAutoTeam";
|
||||||
|
import { CreateProfileResponse } from "./createProfile";
|
||||||
import { CreateTeamResponse } from "./createTeam";
|
import { CreateTeamResponse } from "./createTeam";
|
||||||
import { DiscoverProfileResponse } from "./discoverProfile";
|
import { DiscoverProfileResponse } from "./discoverProfile";
|
||||||
import { GenericResponse } from "./generic";
|
import { GenericResponse } from "./generic";
|
||||||
@@ -33,6 +34,7 @@ import { UnlockProfileResponse } from "./unlockProfile";
|
|||||||
export type Response =
|
export type Response =
|
||||||
| CheckTeamNameResponse
|
| CheckTeamNameResponse
|
||||||
| CreateAutoTeamResponse
|
| CreateAutoTeamResponse
|
||||||
|
| CreateProfileResponse
|
||||||
| CreateTeamResponse
|
| CreateTeamResponse
|
||||||
| DiscoverProfileResponse
|
| DiscoverProfileResponse
|
||||||
| GenericResponse
|
| GenericResponse
|
||||||
|
|||||||
Reference in New Issue
Block a user