mirror of
https://github.com/djhackersdev/minime.git
synced 2026-08-23 19:04:20 -05:00
idz: Add new saveExpedition msg format
This commit is contained in:
@@ -22,7 +22,7 @@ import { loadTeamRanking, loadTeamRanking2 } from "./loadTeamRanking";
|
||||
import { lockGarage } from "./lockGarage";
|
||||
import { lockProfile } from "./lockProfile";
|
||||
import { msg00AD } from "./msg00AD";
|
||||
import { saveExpedition } from "./saveExpedition";
|
||||
import { saveExpedition1, saveExpedition2 } from "./saveExpedition";
|
||||
import { saveGarage } from "./saveGarage";
|
||||
import { saveNewCar } from "./saveNewCar";
|
||||
import { saveProfile2 } from "./saveProfile2";
|
||||
@@ -75,7 +75,8 @@ const funcList: ReaderFn[] = [
|
||||
lockGarage,
|
||||
lockProfile,
|
||||
msg00AD,
|
||||
saveExpedition,
|
||||
saveExpedition1,
|
||||
saveExpedition2,
|
||||
saveGarage,
|
||||
saveNewCar,
|
||||
saveProfile2,
|
||||
|
||||
@@ -1,12 +1,27 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import { SaveExpeditionRequest } from "../request/saveExpedition";
|
||||
import {
|
||||
SaveExpeditionRequest1,
|
||||
SaveExpeditionRequest2,
|
||||
} from "../request/saveExpedition";
|
||||
|
||||
saveExpedition.msgCode = 0x008c as RequestCode;
|
||||
saveExpedition.msgLen = 0x0010;
|
||||
saveExpedition1.msgCode = 0x008c as RequestCode;
|
||||
saveExpedition1.msgLen = 0x0010;
|
||||
|
||||
export function saveExpedition(buf: Buffer): SaveExpeditionRequest {
|
||||
export function saveExpedition1(buf: Buffer): SaveExpeditionRequest1 {
|
||||
return {
|
||||
type: "save_expedition_req",
|
||||
format: 1,
|
||||
field_0004: buf.readUInt32LE(0x0004),
|
||||
};
|
||||
}
|
||||
|
||||
saveExpedition2.msgCode = 0x013f as RequestCode;
|
||||
saveExpedition2.msgLen = 0x0010;
|
||||
|
||||
export function saveExpedition2(buf: Buffer): SaveExpeditionRequest2 {
|
||||
return {
|
||||
type: "save_expedition_req",
|
||||
format: 2,
|
||||
field_0004: buf.readUInt32LE(0x0004),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ export function saveExpedition(
|
||||
} else {
|
||||
return {
|
||||
type: "save_expedition_res",
|
||||
format: req.format as any,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
export interface SaveExpeditionRequest {
|
||||
interface SaveExpeditionRequestBase {
|
||||
type: "save_expedition_req";
|
||||
field_0004: number;
|
||||
}
|
||||
|
||||
export interface SaveExpeditionRequest1 extends SaveExpeditionRequestBase {
|
||||
format: 1;
|
||||
}
|
||||
|
||||
export interface SaveExpeditionRequest2 extends SaveExpeditionRequestBase {
|
||||
format: 2;
|
||||
}
|
||||
|
||||
export type SaveExpeditionRequest =
|
||||
| SaveExpeditionRequest1
|
||||
| SaveExpeditionRequest2;
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
export interface SaveExpeditionResponse {
|
||||
interface SaveExpeditionResponseBase {
|
||||
type: "save_expedition_res";
|
||||
// tera TODO
|
||||
}
|
||||
|
||||
export interface SaveExpeditionResponse1 extends SaveExpeditionResponseBase {
|
||||
format: 1;
|
||||
}
|
||||
|
||||
export interface SaveExpeditionResponse2 extends SaveExpeditionResponseBase {
|
||||
format: 2;
|
||||
}
|
||||
|
||||
export type SaveExpeditionResponse =
|
||||
| SaveExpeditionResponse1
|
||||
| SaveExpeditionResponse2;
|
||||
|
||||
Reference in New Issue
Block a user