Add framework for BTR config

This commit is contained in:
Dev 2024-01-20 18:47:57 +00:00
parent 446b1ef4f9
commit 399bbb2e3b
6 changed files with 39 additions and 4 deletions

View File

@ -0,0 +1 @@
{}

View File

@ -1,12 +1,12 @@
import { inject, injectable } from "tsyringe";
import { InraidController } from "@spt-aki/controllers/InraidController";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { INullResponseData } from "@spt-aki/models/eft/httpResponse/INullResponseData";
import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData";
import { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData";
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
import { IItemDeliveryRequestData } from "@spt-aki/models/eft/inRaid/IItemDeliveryRequestData";
/**
* Handle client requests
@ -83,6 +83,15 @@ export class InraidCallbacks
return this.httpResponse.noBody(this.inraidController.getAirdropConfig());
}
/**
* Handle singleplayer/btr/config
* @returns JSON as string
*/
public getBTRConfig(): string
{
return this.httpResponse.noBody(this.inraidController.getBTRConfig());
}
/**
* Handle singleplayer/traderServices/getTraderServices
*/

View File

@ -21,6 +21,7 @@ import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
import { Traders } from "@spt-aki/models/enums/Traders";
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
import { IBTRConfig } from "@spt-aki/models/spt/config/IBTRConfig";
import { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
@ -44,6 +45,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
export class InraidController
{
protected airdropConfig: IAirdropConfig;
protected btrConfig: IBTRConfig;
protected inraidConfig: IInRaidConfig;
protected traderConfig: ITraderConfig;
@ -71,6 +73,7 @@ export class InraidController
)
{
this.airdropConfig = this.configServer.getConfig(ConfigTypes.AIRDROP);
this.btrConfig = this.configServer.getConfig(ConfigTypes.BTR);
this.inraidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
this.traderConfig = this.configServer.getConfig(ConfigTypes.TRADER);
}
@ -511,6 +514,15 @@ export class InraidController
return this.airdropConfig;
}
/**
* Get BTR config from configs/btr.json
* @returns Airdrop config
*/
public getBTRConfig(): IBTRConfig
{
return this.btrConfig;
}
/**
* Handle singleplayer/traderServices/getTraderServices
* @returns Trader services data

View File

@ -1,5 +1,4 @@
export enum ConfigTypes
{
export enum ConfigTypes {
AIRDROP = "aki-airdrop",
BOT = "aki-bot",
PMC = "aki-pmc",
@ -26,4 +25,5 @@ export enum ConfigTypes
SEASONAL_EVENT = "aki-seasonalevents",
LOST_ON_DEATH = "aki-lostondeath",
GIFTS = "aki-gifts",
BTR = "aki-btr"
}

View File

@ -0,0 +1,6 @@
import { IBaseConfig } from "./IBaseConfig";
export interface IBTRConfig extends IBaseConfig
{
kind: "aki-btr";
}

View File

@ -41,6 +41,13 @@ export class InraidStaticRouter extends StaticRouter
return this.inraidCallbacks.getAirdropConfig();
},
),
new RouteAction(
"/singleplayer/btr/config",
(url: string, info: any, sessionID: string, output: string): any =>
{
return this.inraidCallbacks.getBTRConfig();
},
),
new RouteAction(
"/singleplayer/traderServices/itemDelivery",
(url: string, info: any, sessionID: string, output: string): any =>