idz: Add UpdateExpedition command

This commit is contained in:
BemaniWitch 2020-10-31 15:33:59 -04:00 committed by Tau
parent a6a80f0762
commit dcb4f12a99
5 changed files with 53 additions and 0 deletions

View File

@ -0,0 +1,13 @@
import { UpdateExpeditionRequest } from "../request/updateExpedition";
updateExpedition.msgCode = 0x013F;
updateExpedition.msgLen = 0x0010;
export function updateExpedition(
buf: Buffer
): UpdateExpeditionRequest {
return {
type: "update_expedition_req",
expeditionRequestType: buf.readUInt32LE(0x0004),
};
}

View File

@ -0,0 +1,18 @@
import { UpdateExpeditionResponse } from "../response/updateExpedition";
export function updateExpedition(res: UpdateExpeditionResponse) {
let buf: Buffer;
if (res.expeditionType == 0) {
buf = Buffer.alloc(0x0040);
buf.writeInt16LE(1, 0x0000);
} else {
buf = Buffer.alloc(0x19f0);
buf.writeInt16LE(0x0140, 0x0000);
// Experiments used to live here, removed because they're a not-really
// working mess. Hopefully, one day there will be beautiful code
// here, that works and makes people happy. One day.
}
return buf;
}

View File

@ -0,0 +1,14 @@
import { UpdateExpeditionRequest } from "../request/updateExpedition";
import { UpdateExpeditionResponse } from "../response/updateExpedition";
import { Repositories } from "../repo";
export async function updateExpedition(
w: Repositories,
req: UpdateExpeditionRequest
): Promise<UpdateExpeditionResponse> {
return {
type: "update_expedition_res",
expeditionType: req.expeditionRequestType,
};
}

View File

@ -0,0 +1,4 @@
export interface UpdateExpeditionRequest {
type: "update_expedition_req";
expeditionRequestType: number;
}

View File

@ -0,0 +1,4 @@
export interface UpdateExpeditionResponse {
type: "update_expedition_res";
expeditionType: number;
}