diff --git a/project/src/controllers/RepeatableQuestController.ts b/project/src/controllers/RepeatableQuestController.ts index f49632b6..f15d9d16 100644 --- a/project/src/controllers/RepeatableQuestController.ts +++ b/project/src/controllers/RepeatableQuestController.ts @@ -111,8 +111,9 @@ export class RepeatableQuestController this.questConfig = this.configServer.getConfig(ConfigTypes.QUEST); } + /** - * This is the method reached by the /client/repeatalbeQuests/activityPeriods endpoint + * Handle client/repeatalbeQuests/activityPeriods * Returns an array of objects in the format of repeatable quests to the client. * repeatableQuestObject = { * id: Unique Id, @@ -274,7 +275,7 @@ export class RepeatableQuestController * This method is called by GetClientRepeatableQuests and creates one element of quest type format (see assets/database/templates/repeatableQuests.json). * It randomly draws a quest type (currently Elimination, Completion or Exploration) as well as a trader who is providing the quest */ - public generateRepeatableQuest( + protected generateRepeatableQuest( pmcLevel: number, pmcTraderInfo: Record, questTypePool: IQuestTypePool, @@ -343,7 +344,7 @@ export class RepeatableQuestController * (needs to be filled with reward and conditions by called to make a valid quest) */ // @Incomplete: define Type for "type". - public generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest + protected generateRepeatableTemplate(type: string, traderId: string, side: string): IRepeatableQuest { const quest = this.jsonUtil.clone(this.databaseServer.getTables().templates.repeatableQuests.templates[type]); quest._id = this.objectId.generate(); @@ -377,7 +378,7 @@ export class RepeatableQuestController * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json) */ - public generateExplorationQuest( + protected generateExplorationQuest( pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, @@ -464,7 +465,7 @@ export class RepeatableQuestController * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json) */ - public generateCompletionQuest( + protected generateCompletionQuest( pmcLevel: number, traderId: string, repeatableConfig: IRepeatableQuestConfig @@ -583,7 +584,7 @@ export class RepeatableQuestController * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json) */ - public generateEliminationQuest( + protected generateEliminationQuest( pmcLevel: number, traderId: string, questTypePool: IQuestTypePool, @@ -790,7 +791,7 @@ export class RepeatableQuestController * @param {string} exit The exit name to generate the condition for * @returns {object} Exit condition */ - public generateExplorationExitCondition(exit: Exit): IExplorationCondition + protected generateExplorationExitCondition(exit: Exit): IExplorationCondition { return { _parent: "ExitName", @@ -811,7 +812,7 @@ export class RepeatableQuestController * @param {integer} value amount of items of this specific type to request * @returns {object} object of "Completion"-condition */ - public generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor + protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor { let minDurability = 0; let onlyFoundInRaid = true; @@ -851,7 +852,7 @@ export class RepeatableQuestController * @param {string} location the location on which to fulfill the elimination quest * @returns {object} object of "Elimination"-location-subcondition */ - public generateEliminationLocation(location: string[]): IEliminationCondition + protected generateEliminationLocation(location: string[]): IEliminationCondition { return { @@ -873,7 +874,7 @@ export class RepeatableQuestController * @param {number} distance distance from which to kill (currently only >= supported) * @returns {object} object of "Elimination"-kill-subcondition */ - public generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition + protected generateEliminationCondition(target: string, bodyPart: string[], distance: number): IEliminationCondition { const killConditionProps: IKillConditionProps = { target: target, @@ -915,7 +916,7 @@ export class RepeatableQuestController * @param pmcLevel level of pmc generating quest pool * @returns IQuestTypePool */ - public generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool + protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool { const questPool: IQuestTypePool = { types: repeatableConfig.types.slice(), @@ -978,7 +979,7 @@ export class RepeatableQuestController * @param {object} repeatableConfig The configuration for the repeatably kind (daily, weekly) as configured in QuestConfig for the requestd quest * @returns {object} object of "Reward"-type that can be given for a repeatable mission */ - public generateReward( + protected generateReward( pmcLevel: number, difficulty: number, traderId: string, @@ -1129,7 +1130,7 @@ export class RepeatableQuestController * @param {integer} index all rewards will be appended to a list, for unkown reasons the client wants the index * @returns {object} object of "Reward"-item-type */ - public generateRewardItem(tpl: string, value: number, index: number, preset = null): IReward + protected generateRewardItem(tpl: string, value: number, index: number, preset = null): IReward { const id = this.objectId.generate(); const rewardItem: IReward = { @@ -1179,7 +1180,7 @@ export class RepeatableQuestController } } - public probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray + protected probabilityObjectArray(configArrayInput: ProbabilityObject[]): ProbabilityObjectArray { const configArray = this.jsonUtil.clone(configArrayInput); const probabilityArray = new ProbabilityObjectArray(this.mathUtil); @@ -1190,6 +1191,9 @@ export class RepeatableQuestController return probabilityArray; } + /** + * Handle RepeatableQuestChange event + */ public changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse { let repeatableToChange: IPmcDataRepeatableQuest; @@ -1301,7 +1305,7 @@ export class RepeatableQuestController * @param {string} tpl template id of item to check * @returns boolean: true if item is valid reward */ - public isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean + protected isValidRewardItem(tpl: string, repeatableQuestConfig: IRepeatableQuestConfig): boolean { let valid = this.itemHelper.isValidItem(tpl); if (!valid) diff --git a/project/src/di/Router.ts b/project/src/di/Router.ts index 56518b72..aa461696 100644 --- a/project/src/di/Router.ts +++ b/project/src/di/Router.ts @@ -5,7 +5,7 @@ import { IAkiProfile } from "../models/eft/profile/IAkiProfile"; export class Router { - private handledRoutes: HandledRoute[] = []; + protected handledRoutes: HandledRoute[] = []; public getTopLevelRoute(): string { @@ -17,7 +17,7 @@ export class Router throw new Error("This method needs to be overrode by the router classes"); } - private getInternalHandledRoutes(): HandledRoute[] + protected getInternalHandledRoutes(): HandledRoute[] { if (this.handledRoutes.length === 0) { diff --git a/project/src/utils/DatabaseImporter.ts b/project/src/utils/DatabaseImporter.ts index 9b96fb30..0137724f 100644 --- a/project/src/utils/DatabaseImporter.ts +++ b/project/src/utils/DatabaseImporter.ts @@ -111,7 +111,7 @@ export class DatabaseImporter implements OnLoad this.databaseServer.setTables(dataToImport); } - private onReadValidate(fileWithPath: string, data: string): void + protected onReadValidate(fileWithPath: string, data: string): void { // Validate files if (globalThis.G_RELEASE_CONFIGURATION && this.hashedFile && !this.validateFile(fileWithPath, data)) @@ -123,7 +123,7 @@ export class DatabaseImporter implements OnLoad return "aki-database"; } - private validateFile(filePathAndName: string, fileData: any): boolean + protected validateFile(filePathAndName: string, fileData: any): boolean { try { diff --git a/project/src/utils/RagfairOfferHolder.ts b/project/src/utils/RagfairOfferHolder.ts index e6f869fa..f2b5e4ba 100644 --- a/project/src/utils/RagfairOfferHolder.ts +++ b/project/src/utils/RagfairOfferHolder.ts @@ -2,9 +2,9 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer"; export class RagfairOfferHolder { - private offersById: Map; - private offersByTemplate: Map>; - private offersByTrader: Map>; + protected offersById: Map; + protected offersByTemplate: Map>; + protected offersByTrader: Map>; constructor() { @@ -96,7 +96,7 @@ export class RagfairOfferHolder return this.getOffers().filter(o => this.isStale(o, time)); } - private addOfferByTemplates(template: string, offer: IRagfairOffer) + protected addOfferByTemplates(template: string, offer: IRagfairOffer): void { if (this.offersByTemplate.has(template)) { @@ -110,7 +110,7 @@ export class RagfairOfferHolder } } - private addOfferByTrader(trader: string, offer: IRagfairOffer): void + protected addOfferByTrader(trader: string, offer: IRagfairOffer): void { if (this.offersByTrader.has(trader)) { diff --git a/project/src/utils/VFS.ts b/project/src/utils/VFS.ts index b0b27268..db38c2de 100644 --- a/project/src/utils/VFS.ts +++ b/project/src/utils/VFS.ts @@ -296,17 +296,17 @@ export class VFS await this.rmdirPromisify(filepath); } - private lockFileSync(filepath: any): void + protected lockFileSync(filepath: any): void { lockfile.lockSync(filepath); } - private checkFileSync(filepath: any): any + protected checkFileSync(filepath: any): any { return lockfile.checkSync(filepath); } - private unlockFileSync(filepath: any): void + protected unlockFileSync(filepath: any): void { lockfile.unlockSync(filepath); }