Add framework for BTR config
This commit is contained in:
parent
446b1ef4f9
commit
399bbb2e3b
1
project/assets/configs/btr.json
Normal file
1
project/assets/configs/btr.json
Normal file
@ -0,0 +1 @@
|
|||||||
|
{}
|
@ -1,12 +1,12 @@
|
|||||||
import { inject, injectable } from "tsyringe";
|
import { inject, injectable } from "tsyringe";
|
||||||
|
|
||||||
import { InraidController } from "@spt-aki/controllers/InraidController";
|
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 { 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 { IRegisterPlayerRequestData } from "@spt-aki/models/eft/inRaid/IRegisterPlayerRequestData";
|
||||||
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
|
import { ISaveProgressRequestData } from "@spt-aki/models/eft/inRaid/ISaveProgressRequestData";
|
||||||
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
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
|
* Handle client requests
|
||||||
@ -83,6 +83,15 @@ export class InraidCallbacks
|
|||||||
return this.httpResponse.noBody(this.inraidController.getAirdropConfig());
|
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
|
* Handle singleplayer/traderServices/getTraderServices
|
||||||
*/
|
*/
|
||||||
|
@ -21,6 +21,7 @@ import { PlayerRaidEndState } from "@spt-aki/models/enums/PlayerRaidEndState";
|
|||||||
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
|
import { QuestStatus } from "@spt-aki/models/enums/QuestStatus";
|
||||||
import { Traders } from "@spt-aki/models/enums/Traders";
|
import { Traders } from "@spt-aki/models/enums/Traders";
|
||||||
import { IAirdropConfig } from "@spt-aki/models/spt/config/IAirdropConfig";
|
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 { IInRaidConfig } from "@spt-aki/models/spt/config/IInRaidConfig";
|
||||||
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
|
import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig";
|
||||||
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
|
import { ITraderServiceModel } from "@spt-aki/models/spt/services/ITraderServiceModel";
|
||||||
@ -44,6 +45,7 @@ import { TimeUtil } from "@spt-aki/utils/TimeUtil";
|
|||||||
export class InraidController
|
export class InraidController
|
||||||
{
|
{
|
||||||
protected airdropConfig: IAirdropConfig;
|
protected airdropConfig: IAirdropConfig;
|
||||||
|
protected btrConfig: IBTRConfig;
|
||||||
protected inraidConfig: IInRaidConfig;
|
protected inraidConfig: IInRaidConfig;
|
||||||
protected traderConfig: ITraderConfig;
|
protected traderConfig: ITraderConfig;
|
||||||
|
|
||||||
@ -71,6 +73,7 @@ export class InraidController
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
this.airdropConfig = this.configServer.getConfig(ConfigTypes.AIRDROP);
|
this.airdropConfig = this.configServer.getConfig(ConfigTypes.AIRDROP);
|
||||||
|
this.btrConfig = this.configServer.getConfig(ConfigTypes.BTR);
|
||||||
this.inraidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
|
this.inraidConfig = this.configServer.getConfig(ConfigTypes.IN_RAID);
|
||||||
this.traderConfig = this.configServer.getConfig(ConfigTypes.TRADER);
|
this.traderConfig = this.configServer.getConfig(ConfigTypes.TRADER);
|
||||||
}
|
}
|
||||||
@ -511,6 +514,15 @@ export class InraidController
|
|||||||
return this.airdropConfig;
|
return this.airdropConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get BTR config from configs/btr.json
|
||||||
|
* @returns Airdrop config
|
||||||
|
*/
|
||||||
|
public getBTRConfig(): IBTRConfig
|
||||||
|
{
|
||||||
|
return this.btrConfig;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle singleplayer/traderServices/getTraderServices
|
* Handle singleplayer/traderServices/getTraderServices
|
||||||
* @returns Trader services data
|
* @returns Trader services data
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
export enum ConfigTypes
|
export enum ConfigTypes {
|
||||||
{
|
|
||||||
AIRDROP = "aki-airdrop",
|
AIRDROP = "aki-airdrop",
|
||||||
BOT = "aki-bot",
|
BOT = "aki-bot",
|
||||||
PMC = "aki-pmc",
|
PMC = "aki-pmc",
|
||||||
@ -26,4 +25,5 @@ export enum ConfigTypes
|
|||||||
SEASONAL_EVENT = "aki-seasonalevents",
|
SEASONAL_EVENT = "aki-seasonalevents",
|
||||||
LOST_ON_DEATH = "aki-lostondeath",
|
LOST_ON_DEATH = "aki-lostondeath",
|
||||||
GIFTS = "aki-gifts",
|
GIFTS = "aki-gifts",
|
||||||
|
BTR = "aki-btr"
|
||||||
}
|
}
|
||||||
|
6
project/src/models/spt/config/IBTRConfig.ts
Normal file
6
project/src/models/spt/config/IBTRConfig.ts
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import { IBaseConfig } from "./IBaseConfig";
|
||||||
|
|
||||||
|
export interface IBTRConfig extends IBaseConfig
|
||||||
|
{
|
||||||
|
kind: "aki-btr";
|
||||||
|
}
|
@ -41,6 +41,13 @@ export class InraidStaticRouter extends StaticRouter
|
|||||||
return this.inraidCallbacks.getAirdropConfig();
|
return this.inraidCallbacks.getAirdropConfig();
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
new RouteAction(
|
||||||
|
"/singleplayer/btr/config",
|
||||||
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
{
|
||||||
|
return this.inraidCallbacks.getBTRConfig();
|
||||||
|
},
|
||||||
|
),
|
||||||
new RouteAction(
|
new RouteAction(
|
||||||
"/singleplayer/traderServices/itemDelivery",
|
"/singleplayer/traderServices/itemDelivery",
|
||||||
(url: string, info: any, sessionID: string, output: string): any =>
|
(url: string, info: any, sessionID: string, output: string): any =>
|
||||||
|
Loading…
Reference in New Issue
Block a user