idz: Add new saveExpedition msg format
This commit is contained in:
@@ -1,6 +1,25 @@
|
||||
import { SaveExpeditionResponse } from "../response/saveExpedition";
|
||||
import {
|
||||
SaveExpeditionResponse,
|
||||
SaveExpeditionResponse1,
|
||||
SaveExpeditionResponse2,
|
||||
} from "../response/saveExpedition";
|
||||
|
||||
export function saveExpedition(res: SaveExpeditionResponse) {
|
||||
export function saveExpedition(res: SaveExpeditionResponse): Buffer {
|
||||
switch (res.format) {
|
||||
case 1:
|
||||
return saveExpedition1(res);
|
||||
|
||||
case 2:
|
||||
return saveExpedition2(res);
|
||||
|
||||
default:
|
||||
const exhaust: never = res;
|
||||
|
||||
throw new Error(`Unsupported data format ${res["format"]}`);
|
||||
}
|
||||
}
|
||||
|
||||
function saveExpedition1(res: SaveExpeditionResponse1): Buffer {
|
||||
// in awe of the size of this lad
|
||||
const buf = Buffer.alloc(0x17c0);
|
||||
|
||||
@@ -8,3 +27,12 @@ export function saveExpedition(res: SaveExpeditionResponse) {
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
function saveExpedition2(res: SaveExpeditionResponse2): Buffer {
|
||||
// absolute unit
|
||||
const buf = Buffer.alloc(0x18ac);
|
||||
|
||||
buf.writeUInt16LE(0x0140, 0x0000);
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user