4ac12ef70a
These are the formatting & linting configuration changes from the `3.8.0` branch and the changes that they make to the overall project. The majority of these changes are from running two commands: `npm run lint:fix` `npm run style:fix` This has already been run on the `3.8.0` branch and this PR should make `master` play nicer when it comes to merges going forward. There are now four VSCode plugins recommended for server development. They've been added to the workspace file and a user should get a UI notification when the workspace is opened if they're not installed. The four plugins are: https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig https://marketplace.visualstudio.com/items?itemName=dprint.dprint https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint https://marketplace.visualstudio.com/items?itemName=biomejs.biome Once installed they should just work within the workspace. Also, be sure to `npm i` to get the new dprint application. Co-authored-by: Refringe <brownelltyler@gmail.com> Reviewed-on: https://dev.sp-tarkov.com/SPT-AKI/Server/pulls/168
96 lines
3.5 KiB
TypeScript
96 lines
3.5 KiB
TypeScript
import { inject, injectable } from "tsyringe";
|
|
|
|
import { QuestController } from "@spt-aki/controllers/QuestController";
|
|
import { RepeatableQuestController } from "@spt-aki/controllers/RepeatableQuestController";
|
|
import { IEmptyRequestData } from "@spt-aki/models/eft/common/IEmptyRequestData";
|
|
import { IPmcData } from "@spt-aki/models/eft/common/IPmcData";
|
|
import { IQuest } from "@spt-aki/models/eft/common/tables/IQuest";
|
|
import { IPmcDataRepeatableQuest } from "@spt-aki/models/eft/common/tables/IRepeatableQuests";
|
|
import { IGetBodyResponseData } from "@spt-aki/models/eft/httpResponse/IGetBodyResponseData";
|
|
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
|
import { IAcceptQuestRequestData } from "@spt-aki/models/eft/quests/IAcceptQuestRequestData";
|
|
import { ICompleteQuestRequestData } from "@spt-aki/models/eft/quests/ICompleteQuestRequestData";
|
|
import { IHandoverQuestRequestData } from "@spt-aki/models/eft/quests/IHandoverQuestRequestData";
|
|
import { IListQuestsRequestData } from "@spt-aki/models/eft/quests/IListQuestsRequestData";
|
|
import { IRepeatableQuestChangeRequest } from "@spt-aki/models/eft/quests/IRepeatableQuestChangeRequest";
|
|
import { HttpResponseUtil } from "@spt-aki/utils/HttpResponseUtil";
|
|
|
|
@injectable()
|
|
export class QuestCallbacks
|
|
{
|
|
constructor(
|
|
@inject("HttpResponseUtil") protected httpResponse: HttpResponseUtil,
|
|
@inject("QuestController") protected questController: QuestController,
|
|
@inject("RepeatableQuestController") protected repeatableQuestController: RepeatableQuestController,
|
|
)
|
|
{}
|
|
|
|
/**
|
|
* Handle RepeatableQuestChange event
|
|
*/
|
|
public changeRepeatableQuest(
|
|
pmcData: IPmcData,
|
|
body: IRepeatableQuestChangeRequest,
|
|
sessionID: string,
|
|
): IItemEventRouterResponse
|
|
{
|
|
return this.repeatableQuestController.changeRepeatableQuest(pmcData, body, sessionID);
|
|
}
|
|
|
|
/**
|
|
* Handle QuestAccept event
|
|
*/
|
|
public acceptQuest(pmcData: IPmcData, body: IAcceptQuestRequestData, sessionID: string): IItemEventRouterResponse
|
|
{
|
|
if (body.type === "repeatable")
|
|
{
|
|
return this.questController.acceptRepeatableQuest(pmcData, body, sessionID);
|
|
}
|
|
return this.questController.acceptQuest(pmcData, body, sessionID);
|
|
}
|
|
|
|
/**
|
|
* Handle QuestComplete event
|
|
*/
|
|
public completeQuest(
|
|
pmcData: IPmcData,
|
|
body: ICompleteQuestRequestData,
|
|
sessionID: string,
|
|
): IItemEventRouterResponse
|
|
{
|
|
return this.questController.completeQuest(pmcData, body, sessionID);
|
|
}
|
|
|
|
/**
|
|
* Handle QuestHandover event
|
|
*/
|
|
public handoverQuest(
|
|
pmcData: IPmcData,
|
|
body: IHandoverQuestRequestData,
|
|
sessionID: string,
|
|
): IItemEventRouterResponse
|
|
{
|
|
return this.questController.handoverQuest(pmcData, body, sessionID);
|
|
}
|
|
|
|
/**
|
|
* Handle client/quest/list
|
|
*/
|
|
public listQuests(url: string, info: IListQuestsRequestData, sessionID: string): IGetBodyResponseData<IQuest[]>
|
|
{
|
|
return this.httpResponse.getBody(this.questController.getClientQuests(sessionID));
|
|
}
|
|
|
|
/**
|
|
* Handle client/repeatalbeQuests/activityPeriods
|
|
*/
|
|
public activityPeriods(
|
|
url: string,
|
|
info: IEmptyRequestData,
|
|
sessionID: string,
|
|
): IGetBodyResponseData<IPmcDataRepeatableQuest[]>
|
|
{
|
|
return this.httpResponse.getBody(this.repeatableQuestController.getClientRepeatableQuests(info, sessionID));
|
|
}
|
|
}
|