Convert some privates to protected + some publics to protected

This commit is contained in:
Dev 2023-07-15 10:45:33 +01:00
parent fefdb53fd6
commit 9288a59a77
5 changed files with 31 additions and 27 deletions

View File

@ -111,8 +111,9 @@ export class RepeatableQuestController
this.questConfig = this.configServer.getConfig(ConfigTypes.QUEST); 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. * Returns an array of objects in the format of repeatable quests to the client.
* repeatableQuestObject = { * repeatableQuestObject = {
* id: Unique Id, * 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). * 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 * 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, pmcLevel: number,
pmcTraderInfo: Record<string, TraderInfo>, pmcTraderInfo: Record<string, TraderInfo>,
questTypePool: IQuestTypePool, questTypePool: IQuestTypePool,
@ -343,7 +344,7 @@ export class RepeatableQuestController
* (needs to be filled with reward and conditions by called to make a valid quest) * (needs to be filled with reward and conditions by called to make a valid quest)
*/ */
// @Incomplete: define Type for "type". // @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<IRepeatableQuest>(this.databaseServer.getTables().templates.repeatableQuests.templates[type]); const quest = this.jsonUtil.clone<IRepeatableQuest>(this.databaseServer.getTables().templates.repeatableQuests.templates[type]);
quest._id = this.objectId.generate(); 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 * @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) * @returns {object} object of quest type format for "Exploration" (see assets/database/templates/repeatableQuests.json)
*/ */
public generateExplorationQuest( protected generateExplorationQuest(
pmcLevel: number, pmcLevel: number,
traderId: string, traderId: string,
questTypePool: IQuestTypePool, 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 * @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) * @returns {object} object of quest type format for "Completion" (see assets/database/templates/repeatableQuests.json)
*/ */
public generateCompletionQuest( protected generateCompletionQuest(
pmcLevel: number, pmcLevel: number,
traderId: string, traderId: string,
repeatableConfig: IRepeatableQuestConfig 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 * @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) * @returns {object} object of quest type format for "Elimination" (see assets/database/templates/repeatableQuests.json)
*/ */
public generateEliminationQuest( protected generateEliminationQuest(
pmcLevel: number, pmcLevel: number,
traderId: string, traderId: string,
questTypePool: IQuestTypePool, questTypePool: IQuestTypePool,
@ -790,7 +791,7 @@ export class RepeatableQuestController
* @param {string} exit The exit name to generate the condition for * @param {string} exit The exit name to generate the condition for
* @returns {object} Exit condition * @returns {object} Exit condition
*/ */
public generateExplorationExitCondition(exit: Exit): IExplorationCondition protected generateExplorationExitCondition(exit: Exit): IExplorationCondition
{ {
return { return {
_parent: "ExitName", _parent: "ExitName",
@ -811,7 +812,7 @@ export class RepeatableQuestController
* @param {integer} value amount of items of this specific type to request * @param {integer} value amount of items of this specific type to request
* @returns {object} object of "Completion"-condition * @returns {object} object of "Completion"-condition
*/ */
public generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor protected generateCompletionAvailableForFinish(targetItemId: string, value: number): ICompletionAvailableFor
{ {
let minDurability = 0; let minDurability = 0;
let onlyFoundInRaid = true; let onlyFoundInRaid = true;
@ -851,7 +852,7 @@ export class RepeatableQuestController
* @param {string} location the location on which to fulfill the elimination quest * @param {string} location the location on which to fulfill the elimination quest
* @returns {object} object of "Elimination"-location-subcondition * @returns {object} object of "Elimination"-location-subcondition
*/ */
public generateEliminationLocation(location: string[]): IEliminationCondition protected generateEliminationLocation(location: string[]): IEliminationCondition
{ {
return { return {
@ -873,7 +874,7 @@ export class RepeatableQuestController
* @param {number} distance distance from which to kill (currently only >= supported) * @param {number} distance distance from which to kill (currently only >= supported)
* @returns {object} object of "Elimination"-kill-subcondition * @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 = { const killConditionProps: IKillConditionProps = {
target: target, target: target,
@ -915,7 +916,7 @@ export class RepeatableQuestController
* @param pmcLevel level of pmc generating quest pool * @param pmcLevel level of pmc generating quest pool
* @returns IQuestTypePool * @returns IQuestTypePool
*/ */
public generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool protected generateQuestPool(repeatableConfig: IRepeatableQuestConfig, pmcLevel: number): IQuestTypePool
{ {
const questPool: IQuestTypePool = { const questPool: IQuestTypePool = {
types: repeatableConfig.types.slice(), 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 * @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 * @returns {object} object of "Reward"-type that can be given for a repeatable mission
*/ */
public generateReward( protected generateReward(
pmcLevel: number, pmcLevel: number,
difficulty: number, difficulty: number,
traderId: string, 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 * @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 * @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 id = this.objectId.generate();
const rewardItem: IReward = { const rewardItem: IReward = {
@ -1179,7 +1180,7 @@ export class RepeatableQuestController
} }
} }
public probabilityObjectArray<K, V>(configArrayInput: ProbabilityObject<K, V>[]): ProbabilityObjectArray<K, V> protected probabilityObjectArray<K, V>(configArrayInput: ProbabilityObject<K, V>[]): ProbabilityObjectArray<K, V>
{ {
const configArray = this.jsonUtil.clone(configArrayInput); const configArray = this.jsonUtil.clone(configArrayInput);
const probabilityArray = new ProbabilityObjectArray<K, V>(this.mathUtil); const probabilityArray = new ProbabilityObjectArray<K, V>(this.mathUtil);
@ -1190,6 +1191,9 @@ export class RepeatableQuestController
return probabilityArray; return probabilityArray;
} }
/**
* Handle RepeatableQuestChange event
*/
public changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse public changeRepeatableQuest(pmcData: IPmcData, body: IRepeatableQuestChangeRequest, sessionID: string): IItemEventRouterResponse
{ {
let repeatableToChange: IPmcDataRepeatableQuest; let repeatableToChange: IPmcDataRepeatableQuest;
@ -1301,7 +1305,7 @@ export class RepeatableQuestController
* @param {string} tpl template id of item to check * @param {string} tpl template id of item to check
* @returns boolean: true if item is valid reward * @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); let valid = this.itemHelper.isValidItem(tpl);
if (!valid) if (!valid)

View File

@ -5,7 +5,7 @@ import { IAkiProfile } from "../models/eft/profile/IAkiProfile";
export class Router export class Router
{ {
private handledRoutes: HandledRoute[] = []; protected handledRoutes: HandledRoute[] = [];
public getTopLevelRoute(): string public getTopLevelRoute(): string
{ {
@ -17,7 +17,7 @@ export class Router
throw new Error("This method needs to be overrode by the router classes"); throw new Error("This method needs to be overrode by the router classes");
} }
private getInternalHandledRoutes(): HandledRoute[] protected getInternalHandledRoutes(): HandledRoute[]
{ {
if (this.handledRoutes.length === 0) if (this.handledRoutes.length === 0)
{ {

View File

@ -111,7 +111,7 @@ export class DatabaseImporter implements OnLoad
this.databaseServer.setTables(dataToImport); this.databaseServer.setTables(dataToImport);
} }
private onReadValidate(fileWithPath: string, data: string): void protected onReadValidate(fileWithPath: string, data: string): void
{ {
// Validate files // Validate files
if (globalThis.G_RELEASE_CONFIGURATION && this.hashedFile && !this.validateFile(fileWithPath, data)) if (globalThis.G_RELEASE_CONFIGURATION && this.hashedFile && !this.validateFile(fileWithPath, data))
@ -123,7 +123,7 @@ export class DatabaseImporter implements OnLoad
return "aki-database"; return "aki-database";
} }
private validateFile(filePathAndName: string, fileData: any): boolean protected validateFile(filePathAndName: string, fileData: any): boolean
{ {
try try
{ {

View File

@ -2,9 +2,9 @@ import { IRagfairOffer } from "../models/eft/ragfair/IRagfairOffer";
export class RagfairOfferHolder export class RagfairOfferHolder
{ {
private offersById: Map<string, IRagfairOffer>; protected offersById: Map<string, IRagfairOffer>;
private offersByTemplate: Map<string, Map<string, IRagfairOffer>>; protected offersByTemplate: Map<string, Map<string, IRagfairOffer>>;
private offersByTrader: Map<string, Map<string, IRagfairOffer>>; protected offersByTrader: Map<string, Map<string, IRagfairOffer>>;
constructor() constructor()
{ {
@ -96,7 +96,7 @@ export class RagfairOfferHolder
return this.getOffers().filter(o => this.isStale(o, time)); 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)) 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)) if (this.offersByTrader.has(trader))
{ {

View File

@ -296,17 +296,17 @@ export class VFS
await this.rmdirPromisify(filepath); await this.rmdirPromisify(filepath);
} }
private lockFileSync(filepath: any): void protected lockFileSync(filepath: any): void
{ {
lockfile.lockSync(filepath); lockfile.lockSync(filepath);
} }
private checkFileSync(filepath: any): any protected checkFileSync(filepath: any): any
{ {
return lockfile.checkSync(filepath); return lockfile.checkSync(filepath);
} }
private unlockFileSync(filepath: any): void protected unlockFileSync(filepath: any): void
{ {
lockfile.unlockSync(filepath); lockfile.unlockSync(filepath);
} }