idz: Rename model Id<> to ExtId<>

This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent 84541e245c
commit 6516dc812d
28 changed files with 75 additions and 72 deletions
+2 -2
View File
@@ -1,7 +1,7 @@
import iconv = require("iconv-lite");
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { ExtId } from "../model/base";
import { Profile } from "../model/profile";
import { CreateTeamRequest } from "../request/createTeam";
@@ -11,7 +11,7 @@ createTeam.msgLen = 0x0050;
export function createTeam(buf: Buffer): CreateTeamRequest {
return {
type: "create_team_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
teamName: iconv.decode(buf.slice(0x0008, 0x0028), "shift_jis"),
field_0028: buf.readUInt16LE(0x0028),
field_002C: buf.readUInt32LE(0x002c),
+2 -2
View File
@@ -1,5 +1,5 @@
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { ExtId } from "../model/base";
import { Profile } from "../model/profile";
import { LoadGarageRequest } from "../request/loadGarage";
@@ -9,7 +9,7 @@ loadGarage.msgLen = 0x0010;
export function loadGarage(buf: Buffer): LoadGarageRequest {
return {
type: "load_garage_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
fetchOffset: buf.readUInt8(0x0008),
field_000A: buf.readUInt16LE(0x000a),
};
+2 -2
View File
@@ -1,5 +1,5 @@
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { ExtId } from "../model/base";
import { Profile } from "../model/profile";
import { LoadStockerRequest } from "../request/loadStocker";
@@ -9,6 +9,6 @@ loadStocker.msgLen = 0x0010;
export function loadStocker(buf: Buffer): LoadStockerRequest {
return {
type: "load_stocker_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
};
}
+3 -3
View File
@@ -1,5 +1,5 @@
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { ExtId } from "../model/base";
import { Profile } from "../model/profile";
import { Team } from "../model/team";
import { LoadTopTenRequest } from "../request/loadTopTen";
@@ -27,7 +27,7 @@ export function loadTopTen(buf: Buffer): LoadTopTenRequest {
field_C4: buf.readUInt8(0x00c4), // Boolean, true if profile ID is set
field_C5: buf.readUInt8(0x00c5), // Always zero
field_C6: buf.readUInt16LE(0x00c6),
profileId: profileId !== 0 ? (profileId as Id<Profile>) : undefined,
teamId: teamId !== 0xffffffff ? (teamId as Id<Team>) : undefined,
profileId: profileId !== 0 ? (profileId as ExtId<Profile>) : undefined,
teamId: teamId !== 0xffffffff ? (teamId as ExtId<Team>) : undefined,
};
}
+2 -2
View File
@@ -1,6 +1,6 @@
import { car } from "./_car";
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { ExtId } from "../model/base";
import { Profile } from "../model/profile";
import { SaveNewCarRequest } from "../request/saveNewCar";
@@ -10,7 +10,7 @@ saveNewCar.msgLen = 0x0090;
export function saveNewCar(buf: Buffer): SaveNewCarRequest {
return {
type: "save_new_car_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
luid: buf.slice(0x0008, buf.indexOf(0, 0x0008)).toString("ascii"),
car: car(buf.slice(0x0020, 0x0080)),
field_0080: buf.readUInt32LE(0x0080),
+2 -2
View File
@@ -1,7 +1,7 @@
import { car } from "./_car";
import { mission } from "./_mission";
import { RequestCode } from "./_defs";
import { BackgroundCode, Id, TitleCode } from "../model/base";
import { BackgroundCode, ExtId, TitleCode } from "../model/base";
import { Profile } from "../model/profile";
import { SaveProfileRequest } from "../request/saveProfile";
import { bitmap } from "./_bitmap";
@@ -46,7 +46,7 @@ export function saveProfile(buf: Buffer): SaveProfileRequest {
return {
type: "save_profile_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
lv: buf.readUInt16LE(0x0026),
exp: buf.readUInt32LE(0x0028),
fame: buf.readUInt32LE(0x0468),
+2 -2
View File
@@ -1,5 +1,5 @@
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { ExtId } from "../model/base";
import { Profile } from "../model/profile";
import { SaveSettingsRequest } from "../request/saveSettings";
@@ -13,7 +13,7 @@ export function saveSettings(buf: Buffer): SaveSettingsRequest {
return {
type: "save_settings_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
dpoint: buf.readUInt32LE(0x0008),
settings: {
music: buf.readUInt16LE(0x0002),
+2 -2
View File
@@ -1,7 +1,7 @@
import { bitmap } from "./_bitmap";
import { chara } from "./_chara";
import { RequestCode } from "./_defs";
import { BackgroundCode, Id } from "../model/base";
import { BackgroundCode, ExtId } from "../model/base";
import { CarSelector } from "../model/car";
import { Profile } from "../model/profile";
import { SaveStockerRequest } from "../request/saveStocker";
@@ -12,7 +12,7 @@ saveStocker.msgLen = 0x00c0;
export function saveStocker(buf: Buffer): SaveStockerRequest {
return {
type: "save_stocker_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
backgrounds: bitmap(buf.slice(0x0008, 0x002c)) as BackgroundCode[],
selectedCar: buf.readUInt16LE(0x009c) as CarSelector,
+2 -2
View File
@@ -1,5 +1,5 @@
import { RequestCode } from "./_defs";
import { Id } from "../model/base";
import { ExtId } from "../model/base";
import { Profile } from "../model/profile";
import { SaveTimeAttackRequest } from "../request/saveTimeAttack";
@@ -9,7 +9,7 @@ saveTimeAttack.msgLen = 0x0080;
export function saveTimeAttack(buf: Buffer): SaveTimeAttackRequest {
return {
type: "save_time_attack_req",
profileId: buf.readUInt32LE(0x0004) as Id<Profile>,
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
dayNight: buf.readUInt8(0x0054) & 1,
payload: {
courseId: buf.readUInt8(0x0054) >> 1,