2022-07-30 00:35:54 -04:00
|
|
|
import { IPmcData } from "../models/eft/common/IPmcData";
|
|
|
|
import { AvailableForConditions, AvailableForProps, IQuest, Reward } from "../models/eft/common/tables/IQuest";
|
|
|
|
import { IItemEventRouterResponse } from "../models/eft/itemEvent/IItemEventRouterResponse";
|
|
|
|
import { IAcceptQuestRequestData } from "../models/eft/quests/IAcceptQuestRequestData";
|
|
|
|
import { ICompleteQuestRequestData } from "../models/eft/quests/ICompleteQuestRequestData";
|
2022-08-08 20:03:48 -04:00
|
|
|
import { QuestStatus } from "../models/enums/QuestStatus";
|
2022-07-30 00:35:54 -04:00
|
|
|
import { IQuestConfig } from "../models/spt/config/IQuestConfig";
|
|
|
|
import { ILogger } from "../models/spt/utils/ILogger";
|
2022-12-25 18:45:37 -05:00
|
|
|
import { EventOutputHolder } from "../routers/EventOutputHolder";
|
2022-07-30 00:35:54 -04:00
|
|
|
import { ConfigServer } from "../servers/ConfigServer";
|
|
|
|
import { DatabaseServer } from "../servers/DatabaseServer";
|
|
|
|
import { LocaleService } from "../services/LocaleService";
|
2022-12-25 18:45:37 -05:00
|
|
|
import { LocalisationService } from "../services/LocalisationService";
|
2022-07-30 00:35:54 -04:00
|
|
|
import { HashUtil } from "../utils/HashUtil";
|
|
|
|
import { JsonUtil } from "../utils/JsonUtil";
|
|
|
|
import { TimeUtil } from "../utils/TimeUtil";
|
|
|
|
import { DialogueHelper } from "./DialogueHelper";
|
|
|
|
import { ItemHelper } from "./ItemHelper";
|
|
|
|
import { PaymentHelper } from "./PaymentHelper";
|
|
|
|
import { ProfileHelper } from "./ProfileHelper";
|
|
|
|
import { RagfairServerHelper } from "./RagfairServerHelper";
|
|
|
|
import { TraderHelper } from "./TraderHelper";
|
|
|
|
export declare class QuestHelper {
|
|
|
|
protected logger: ILogger;
|
|
|
|
protected jsonUtil: JsonUtil;
|
|
|
|
protected timeUtil: TimeUtil;
|
|
|
|
protected hashUtil: HashUtil;
|
|
|
|
protected itemHelper: ItemHelper;
|
2022-12-25 18:45:37 -05:00
|
|
|
protected eventOutputHolder: EventOutputHolder;
|
2022-07-30 00:35:54 -04:00
|
|
|
protected databaseServer: DatabaseServer;
|
|
|
|
protected localeService: LocaleService;
|
|
|
|
protected ragfairServerHelper: RagfairServerHelper;
|
|
|
|
protected dialogueHelper: DialogueHelper;
|
|
|
|
protected profileHelper: ProfileHelper;
|
|
|
|
protected paymentHelper: PaymentHelper;
|
2022-12-25 18:45:37 -05:00
|
|
|
protected localisationService: LocalisationService;
|
2022-07-30 00:35:54 -04:00
|
|
|
protected traderHelper: TraderHelper;
|
|
|
|
protected configServer: ConfigServer;
|
|
|
|
protected questConfig: IQuestConfig;
|
2022-12-25 18:45:37 -05:00
|
|
|
constructor(logger: ILogger, jsonUtil: JsonUtil, timeUtil: TimeUtil, hashUtil: HashUtil, itemHelper: ItemHelper, eventOutputHolder: EventOutputHolder, databaseServer: DatabaseServer, localeService: LocaleService, ragfairServerHelper: RagfairServerHelper, dialogueHelper: DialogueHelper, profileHelper: ProfileHelper, paymentHelper: PaymentHelper, localisationService: LocalisationService, traderHelper: TraderHelper, configServer: ConfigServer);
|
2022-07-30 00:35:54 -04:00
|
|
|
/**
|
2022-08-29 17:07:55 -04:00
|
|
|
* Get status of a quest by quest id
|
|
|
|
* @param pmcData Profile to search
|
|
|
|
* @param questID Quest id to look up
|
|
|
|
* @returns QuestStauts enum
|
|
|
|
*/
|
|
|
|
getQuestStatus(pmcData: IPmcData, questID: string): QuestStatus;
|
|
|
|
/**
|
|
|
|
* returns true is the level condition is satisfied
|
|
|
|
* @param playerLevel Players level
|
|
|
|
* @param condition Quest condition
|
|
|
|
* @returns true if player level is greater than or equal to quest
|
2022-07-30 00:35:54 -04:00
|
|
|
*/
|
2022-08-29 17:07:55 -04:00
|
|
|
doesPlayerLevelFulfilCondition(playerLevel: number, condition: AvailableForConditions): boolean;
|
2022-12-25 18:45:37 -05:00
|
|
|
/**
|
|
|
|
* Get the quests found in both arrays (inner join)
|
|
|
|
* @param before Array of qeusts #1
|
|
|
|
* @param after Array of quests #2
|
|
|
|
* @returns Reduction of cartesian product between two quest arrays
|
|
|
|
*/
|
2022-07-30 00:35:54 -04:00
|
|
|
getDeltaQuests(before: IQuest[], after: IQuest[]): IQuest[];
|
2022-08-17 02:18:04 -04:00
|
|
|
/**
|
|
|
|
* Increase skill points of a skill on player profile
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @param pmcData Player profile
|
|
|
|
* @param output output object to send back to client
|
|
|
|
* @param skillName Name of skill to increase skill points of
|
|
|
|
* @param progressAmount Amount of skill points to add to skill
|
|
|
|
*/
|
|
|
|
rewardSkillPoints(sessionID: string, pmcData: IPmcData, output: IItemEventRouterResponse, skillName: string, progressAmount: number): void;
|
2022-07-30 00:35:54 -04:00
|
|
|
/**
|
2022-12-25 18:45:37 -05:00
|
|
|
* Get quest name by quest id
|
|
|
|
* @param questId id to get
|
|
|
|
* @returns
|
|
|
|
*/
|
|
|
|
getQuestNameFromLocale(questId: string): string;
|
|
|
|
/**
|
|
|
|
* Check if trader has sufficient loyalty to fullfill quest requirement
|
|
|
|
* @param questProperties Quest props
|
|
|
|
* @param profile Player profile
|
|
|
|
* @returns true if loyalty is high enough to fulfil quest requirement
|
|
|
|
*/
|
|
|
|
traderStandingRequirementCheck(questProperties: AvailableForProps, profile: IPmcData): boolean;
|
|
|
|
protected processReward(reward: Reward): Reward[];
|
|
|
|
/**
|
|
|
|
* Gets a flat list of reward items for the given quest at a specific state (e.g. Fail/Success)
|
|
|
|
* @param quest quest to get rewards for
|
|
|
|
* @param state Quest status that holds the items (Started, Success, Fail)
|
|
|
|
* @returns array of items with the correct maxStack
|
2022-07-30 00:35:54 -04:00
|
|
|
*/
|
2022-08-08 20:03:48 -04:00
|
|
|
getQuestRewardItems(quest: IQuest, state: QuestStatus): Reward[];
|
|
|
|
/**
|
2022-12-25 18:45:37 -05:00
|
|
|
* Update player profile with quest status (e.g. Fail/Success)
|
2022-08-08 20:03:48 -04:00
|
|
|
* @param pmcData profile to add quest to
|
|
|
|
* @param newState state the new quest should be in when added
|
|
|
|
* @param acceptedQuest Details of quest being added
|
|
|
|
*/
|
|
|
|
addQuestToPMCData(pmcData: IPmcData, newState: QuestStatus, acceptedQuest: IAcceptQuestRequestData): void;
|
2022-12-25 18:45:37 -05:00
|
|
|
/**
|
|
|
|
* TODO: what is going on here
|
|
|
|
* @param acceptedQuestId Quest to add to profile
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @returns Array of quests in profile + quest passed in as param
|
|
|
|
*/
|
2022-07-30 00:35:54 -04:00
|
|
|
acceptedUnlocked(acceptedQuestId: string, sessionID: string): IQuest[];
|
2022-12-25 18:45:37 -05:00
|
|
|
/**
|
|
|
|
* TODO: what is going on here
|
|
|
|
* @param failedQuestId
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @returns
|
|
|
|
*/
|
2022-07-30 00:35:54 -04:00
|
|
|
failedUnlocked(failedQuestId: string, sessionID: string): IQuest[];
|
|
|
|
/**
|
2022-12-25 18:45:37 -05:00
|
|
|
* Adjust quest money rewards by passed in multipler
|
|
|
|
* @param quest Quest to multiple money rewards
|
|
|
|
* @param multipler Value to adjust money rewards by
|
|
|
|
* @returns Updated quest
|
|
|
|
*/
|
|
|
|
applyMoneyBoost(quest: IQuest, multipler: number): IQuest;
|
|
|
|
/**
|
|
|
|
* Sets the item stack to new value, or delete the item if value <= 0
|
|
|
|
* // TODO maybe merge this function and the one from customization
|
|
|
|
* @param pmcData Profile
|
|
|
|
* @param itemId id of item to adjust stack size of
|
|
|
|
* @param newStackSize Stack size to adjust to
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @param output ItemEvent router response
|
|
|
|
*/
|
|
|
|
changeItemStack(pmcData: IPmcData, itemId: string, newStackSize: number, sessionID: string, output: IItemEventRouterResponse): void;
|
|
|
|
/**
|
|
|
|
* Get List of All Quests from db
|
|
|
|
* NOT CLONED
|
2022-07-30 00:35:54 -04:00
|
|
|
* @returns Array of IQuest objects
|
|
|
|
*/
|
2022-12-25 18:45:37 -05:00
|
|
|
getQuestsFromDb(): IQuest[];
|
2022-07-30 00:35:54 -04:00
|
|
|
/**
|
2022-12-25 18:45:37 -05:00
|
|
|
* Get quests, strip all requirement conditions except level
|
|
|
|
* @param quests quests to process
|
2022-07-30 00:35:54 -04:00
|
|
|
* @returns quest array without conditions
|
|
|
|
*/
|
2022-12-25 18:45:37 -05:00
|
|
|
protected getQuestsWithOnlyLevelRequirementStartCondition(quests: IQuest[]): IQuest[];
|
2022-07-30 00:35:54 -04:00
|
|
|
/**
|
2022-12-25 18:45:37 -05:00
|
|
|
* Remove all quest conditions except for level requirement
|
2022-07-30 00:35:54 -04:00
|
|
|
* @param quest quest to clean
|
|
|
|
* @returns reset IQuest object
|
|
|
|
*/
|
2022-12-25 18:45:37 -05:00
|
|
|
getQuestWithOnlyLevelRequirementStartCondition(quest: IQuest): IQuest;
|
|
|
|
/**
|
|
|
|
* Fail a quest in a player profile
|
|
|
|
* @param pmcData Profile
|
|
|
|
* @param failRequest fail quest request data
|
|
|
|
* @param sessionID Session id
|
|
|
|
* @returns Item event router response
|
|
|
|
*/
|
|
|
|
failQuest(pmcData: IPmcData, failRequest: any, sessionID: string): IItemEventRouterResponse;
|
2022-07-30 00:35:54 -04:00
|
|
|
/**
|
|
|
|
* Get quest by id from database
|
|
|
|
* @param questId questid to look for
|
|
|
|
* @param pmcData player profile
|
|
|
|
* @returns IQuest object
|
|
|
|
*/
|
|
|
|
getQuestFromDb(questId: string, pmcData: IPmcData): IQuest;
|
2022-12-25 18:45:37 -05:00
|
|
|
/**
|
|
|
|
* Get the locale Id from locale db for a quest message
|
|
|
|
* @param questMessageId Quest mesage id to look up
|
|
|
|
* @returns Locale Id from locale db
|
|
|
|
*/
|
|
|
|
getQuestLocaleIdFromDb(questMessageId: string): string;
|
2022-08-08 20:03:48 -04:00
|
|
|
/**
|
|
|
|
* Alter a quests state + Add a record to tis status timers object
|
|
|
|
* @param pmcData Profile to update
|
|
|
|
* @param newQuestState new state the qeust should be in
|
|
|
|
* @param questId id of the quest to alter the status of
|
|
|
|
*/
|
|
|
|
updateQuestState(pmcData: IPmcData, newQuestState: QuestStatus, questId: string): void;
|
2022-07-30 00:35:54 -04:00
|
|
|
/**
|
|
|
|
* Give player quest rewards - Skills/exp/trader standing/items/assort unlocks
|
|
|
|
* @param pmcData Player profile
|
|
|
|
* @param body complete quest request
|
|
|
|
* @param state State of the quest now its complete
|
|
|
|
* @param sessionID Seession id
|
|
|
|
* @returns array of reward objects
|
|
|
|
*/
|
2022-08-08 20:03:48 -04:00
|
|
|
applyQuestReward(pmcData: IPmcData, body: ICompleteQuestRequestData, state: QuestStatus, sessionID: string): Reward[];
|
2022-07-30 00:35:54 -04:00
|
|
|
/**
|
|
|
|
* Get the intel center bonus a player has
|
|
|
|
* @param pmcData player profile
|
|
|
|
* @returns bonus in percent
|
|
|
|
*/
|
|
|
|
protected getIntelCenterRewardBonus(pmcData: IPmcData): number;
|
2022-12-25 18:45:37 -05:00
|
|
|
/**
|
|
|
|
* Find quest with 'findItem' requirement that needs the item tpl be handed in
|
|
|
|
* @param itemTpl item tpl to look for
|
|
|
|
* @returns 'FindItem' condition id
|
|
|
|
*/
|
|
|
|
getFindItemIdForQuestHandIn(itemTpl: string): string;
|
2023-01-08 01:06:33 -05:00
|
|
|
/**
|
|
|
|
* Add All quests to a profile with the provided statuses
|
|
|
|
* @param pmcProfile profile to update
|
|
|
|
* @param statuses statuses quests should have
|
|
|
|
*/
|
|
|
|
addAllQuestsToProfile(pmcProfile: IPmcData, statuses: QuestStatus[]): void;
|
2022-07-30 00:35:54 -04:00
|
|
|
}
|