mirror of
https://github.com/djhackersdev/minime.git
synced 2026-04-24 15:37:12 -05:00
idz: Add UpdateExpedition command
This commit is contained in:
parent
a6a80f0762
commit
dcb4f12a99
13
src/idz/userdb/decoder/updateExpedition.ts
Normal file
13
src/idz/userdb/decoder/updateExpedition.ts
Normal 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),
|
||||
};
|
||||
}
|
||||
18
src/idz/userdb/encoder/updateExpedition.ts
Normal file
18
src/idz/userdb/encoder/updateExpedition.ts
Normal 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;
|
||||
}
|
||||
14
src/idz/userdb/handler/updateExpedition.ts
Normal file
14
src/idz/userdb/handler/updateExpedition.ts
Normal 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,
|
||||
};
|
||||
}
|
||||
4
src/idz/userdb/request/updateExpedition.ts
Normal file
4
src/idz/userdb/request/updateExpedition.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export interface UpdateExpeditionRequest {
|
||||
type: "update_expedition_req";
|
||||
expeditionRequestType: number;
|
||||
}
|
||||
4
src/idz/userdb/response/updateExpedition.ts
Normal file
4
src/idz/userdb/response/updateExpedition.ts
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
export interface UpdateExpeditionResponse {
|
||||
type: "update_expedition_res";
|
||||
expeditionType: number;
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user