idz: Add UpdateExpedition command
This commit is contained in:
@@ -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),
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
@@ -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,
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export interface UpdateExpeditionRequest {
|
||||||
|
type: "update_expedition_req";
|
||||||
|
expeditionRequestType: number;
|
||||||
|
}
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export interface UpdateExpeditionResponse {
|
||||||
|
type: "update_expedition_res";
|
||||||
|
expeditionType: number;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user