Begin garage ops

This commit is contained in:
Tau
2019-11-06 17:28:29 -05:00
parent 9da2c7f8a6
commit 443c327680
16 changed files with 143 additions and 0 deletions
+8
View File
@@ -9,6 +9,7 @@ import { lockProfile } from "./lockProfile";
import { load2on2 } from "./load2on2";
import { loadConfig } from "./loadConfig";
import { loadConfig2 } from "./loadConfig2";
import { loadGarage } from "./loadGarage";
import { loadGeneralReward } from "./loadGeneralReward";
import { loadGhost } from "./loadGhost";
import { loadProfile } from "./loadProfile";
@@ -20,6 +21,7 @@ import { loadTeamRanking } from "./loadTeamRanking";
import { loadTopTen } from "./loadTopTen";
import { saveExpedition } from "./saveExpedition";
import { saveGarage } from "./saveGarage";
import { saveNewCar } from "./saveNewCar";
import { saveTimeAttack } from "./saveTimeAttack";
import { saveTopic } from "./saveTopic";
import { unlockProfile } from "./unlockProfile";
@@ -53,6 +55,9 @@ function encode(res: Response): Buffer {
case "load_config_v2_res":
return loadConfig2(res);
case "load_garage_res":
return loadGarage(res);
case "load_general_reward_res":
return loadGeneralReward(res);
@@ -92,6 +97,9 @@ function encode(res: Response): Buffer {
case "save_garage_res":
return saveGarage(res);
case "save_new_car_res":
return saveNewCar(res);
case "save_time_attack_res":
return saveTimeAttack(res);
+15
View File
@@ -0,0 +1,15 @@
import { car } from "./_car";
import { LoadGarageResponse } from "../response/loadGarage";
export function loadGarage(res: LoadGarageResponse): Buffer {
const buf = Buffer.alloc(0x03d0);
buf.writeUInt16LE(0x0091, 0x0000);
buf.writeUInt16LE(res.cars.length, 0x0002);
for (let i = 0; i < res.cars.length; i++) {
car(res.cars[i]).copy(buf, 0x0004 + 0x0060 * i);
}
return buf;
}
+1
View File
@@ -74,6 +74,7 @@ export function loadProfile2(res: LoadProfileResponse2) {
buf.writeUInt8(res.settings.gauges, 0x07da);
buf.writeUInt32LE(res.teamId || 0xffffffff, 0x07e0);
car(res.car).copy(buf, 0x0c5c);
buf.writeUInt32LE(1, 0x0c58); // Cars in garage
// [1] Currently unknown, but if this field is zero then the player will have
// a "model record" emblem in their profile card.
+10
View File
@@ -0,0 +1,10 @@
import { SaveNewCarResponse } from "../response/saveNewCar";
export function saveNewCar(res: SaveNewCarResponse): Buffer {
const buf = Buffer.alloc(0x0010);
buf.writeUInt16LE(0x007a, 0x0000);
buf.writeUInt8(res.status, 0x0002);
return buf;
}