idz: Add "loadGacha" message implementation
This commit is contained in:
@@ -9,6 +9,7 @@ import { load2on2_v1, load2on2_v2 } from "./load2on2";
|
||||
import { loadConfig } from "./loadConfig";
|
||||
import { loadConfig2 } from "./loadConfig2";
|
||||
import { loadEventInfo } from "./loadEventInfo";
|
||||
import { loadGacha } from "./loadGacha";
|
||||
import { loadGarage } from "./loadGarage";
|
||||
import { loadGeneralReward1, loadGeneralReward2 } from "./loadGeneralReward";
|
||||
import { loadGhost } from "./loadGhost";
|
||||
@@ -57,6 +58,7 @@ const funcList: ReaderFn[] = [
|
||||
loadConfig,
|
||||
loadConfig2,
|
||||
loadEventInfo,
|
||||
loadGacha,
|
||||
loadGarage,
|
||||
loadGeneralReward1,
|
||||
loadGeneralReward2,
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { RequestCode } from "./_defs";
|
||||
import { LoadGachaRequest } from "../request/loadGacha";
|
||||
import { ExtId } from "../model/base";
|
||||
import { Profile } from "../model/profile";
|
||||
|
||||
loadGacha.msgCode = 0x00c1 as RequestCode;
|
||||
loadGacha.msgLen = 0x0010;
|
||||
|
||||
export function loadGacha(buf: Buffer): LoadGachaRequest {
|
||||
return {
|
||||
type: "load_gacha_req",
|
||||
profileId: buf.readUInt32LE(0x0004) as ExtId<Profile>,
|
||||
};
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import { load2on2 } from "./load2on2";
|
||||
import { loadConfig } from "./loadConfig";
|
||||
import { loadConfig2 } from "./loadConfig2";
|
||||
import { loadEventInfo } from "./loadEventInfo";
|
||||
import { loadGacha } from "./loadGacha";
|
||||
import { loadGarage } from "./loadGarage";
|
||||
import { loadGeneralReward } from "./loadGeneralReward";
|
||||
import { loadGhost } from "./loadGhost";
|
||||
@@ -58,6 +59,9 @@ function encode(res: Response): Buffer {
|
||||
case "load_event_info_res":
|
||||
return loadEventInfo(res);
|
||||
|
||||
case "load_gacha_res":
|
||||
return loadGacha(res);
|
||||
|
||||
case "load_garage_res":
|
||||
return loadGarage(res);
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { LoadGachaResponse } from "../response/loadGacha";
|
||||
|
||||
export function loadGacha(res: LoadGachaResponse): Buffer {
|
||||
const buf = Buffer.alloc(0x0090);
|
||||
|
||||
buf.writeUInt16LE(0x00c2, 0x0000);
|
||||
buf.writeUInt8(res.awardedToday ? 0x01 : 0x00, 0x0002);
|
||||
|
||||
return buf;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { load2on2 } from "./load2on2";
|
||||
import { loadConfig } from "./loadConfig";
|
||||
import { loadConfig2 } from "./loadConfig2";
|
||||
import { loadEventInfo } from "./loadEventInfo";
|
||||
import { loadGacha } from "./loadGacha";
|
||||
import { loadGarage } from "./loadGarage";
|
||||
import { loadGeneralReward } from "./loadGeneralReward";
|
||||
import { loadGhost } from "./loadGhost";
|
||||
@@ -70,6 +71,9 @@ export async function dispatch(
|
||||
case "load_event_info_req":
|
||||
return loadEventInfo(w, req);
|
||||
|
||||
case "load_gacha_req":
|
||||
return loadGacha(w, req);
|
||||
|
||||
case "load_garage_req":
|
||||
return loadGarage(w, req);
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import { Repositories } from "../repo";
|
||||
import { LoadGachaRequest } from "../request/loadGacha";
|
||||
import { LoadGachaResponse } from "../response/loadGacha";
|
||||
|
||||
export function loadGacha(
|
||||
w: Repositories,
|
||||
req: LoadGachaRequest
|
||||
): LoadGachaResponse {
|
||||
return {
|
||||
type: "load_gacha_res",
|
||||
awardedToday: true, // Disable for now, not even mapped out yet.
|
||||
};
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { Load2on2Request } from "./load2on2";
|
||||
import { LoadConfigRequest } from "./loadConfig";
|
||||
import { LoadConfigRequest2 } from "./loadConfig2";
|
||||
import { LoadEventInfoRequest } from "./loadEventInfo";
|
||||
import { LoadGachaRequest } from "./loadGacha";
|
||||
import { LoadGarageRequest } from "./loadGarage";
|
||||
import { LoadGeneralRewardRequest } from "./loadGeneralReward";
|
||||
import { LoadGhostRequest } from "./loadGhost";
|
||||
@@ -46,6 +47,7 @@ export type Request =
|
||||
| LoadConfigRequest
|
||||
| LoadConfigRequest2
|
||||
| LoadEventInfoRequest
|
||||
| LoadGachaRequest
|
||||
| LoadGarageRequest
|
||||
| LoadGeneralRewardRequest
|
||||
| LoadGhostRequest
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import { ExtId } from "../model/base";
|
||||
import { Profile } from "../model/profile";
|
||||
|
||||
export interface LoadGachaRequest {
|
||||
type: "load_gacha_req";
|
||||
profileId: ExtId<Profile>;
|
||||
}
|
||||
@@ -7,6 +7,7 @@ import { Load2on2Response } from "./load2on2";
|
||||
import { LoadConfigResponse } from "./loadConfig";
|
||||
import { LoadConfigResponse2 } from "./loadConfig2";
|
||||
import { LoadEventInfoResponse } from "./loadEventInfo";
|
||||
import { LoadGachaResponse } from "./loadGacha";
|
||||
import { LoadGarageResponse } from "./loadGarage";
|
||||
import { LoadGeneralRewardResponse } from "./loadGeneralReward";
|
||||
import { LoadGhostResponse } from "./loadGhost";
|
||||
@@ -37,6 +38,7 @@ export type Response =
|
||||
| LoadConfigResponse
|
||||
| LoadConfigResponse2
|
||||
| LoadEventInfoResponse
|
||||
| LoadGachaResponse
|
||||
| LoadGarageResponse
|
||||
| LoadGeneralRewardResponse
|
||||
| LoadGhostResponse
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
export interface LoadGachaResponse {
|
||||
type: "load_gacha_res";
|
||||
awardedToday: boolean;
|
||||
}
|
||||
Reference in New Issue
Block a user