From 295ed59739c5235bd364fa332c74527f6c8a5552 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 15 Jul 2023 14:49:25 +0100 Subject: [PATCH] Additional code comments --- project/src/callbacks/DialogueCallbacks.ts | 2 + project/src/callbacks/HideoutCallbacks.ts | 14 ++-- project/src/callbacks/InraidCallbacks.ts | 1 + project/src/callbacks/InventoryCallbacks.ts | 4 + project/src/callbacks/LocationCallbacks.ts | 3 + project/src/callbacks/MatchCallbacks.ts | 13 ++- project/src/callbacks/NoteCallbacks.ts | 3 + project/src/callbacks/NotifierCallbacks.ts | 3 + project/src/callbacks/PresetBuildCallbacks.ts | 3 + project/src/callbacks/RagfairCallbacks.ts | 81 ++++++++++--------- project/src/callbacks/RepairCallbacks.ts | 26 +++--- project/src/callbacks/TradeCallbacks.ts | 3 +- project/src/callbacks/TraderCallbacks.ts | 3 + project/src/callbacks/WishlistCallbacks.ts | 2 + project/src/controllers/BotController.ts | 1 + project/src/controllers/HideoutController.ts | 7 ++ project/src/controllers/InraidController.ts | 1 + .../src/controllers/InventoryController.ts | 1 + project/src/controllers/LocationController.ts | 10 ++- project/src/controllers/MatchController.ts | 14 +++- project/src/controllers/NotifierController.ts | 1 + .../src/controllers/PresetBuildController.ts | 6 +- project/src/controllers/RepairController.ts | 2 + project/src/controllers/TradeController.ts | 3 +- project/src/controllers/TraderController.ts | 3 + project/src/controllers/WeatherController.ts | 1 + project/src/controllers/WishlistController.ts | 10 +-- project/src/utils/Watermark.ts | 7 +- 28 files changed, 153 insertions(+), 75 deletions(-) diff --git a/project/src/callbacks/DialogueCallbacks.ts b/project/src/callbacks/DialogueCallbacks.ts index 0dfc6487..97033098 100644 --- a/project/src/callbacks/DialogueCallbacks.ts +++ b/project/src/callbacks/DialogueCallbacks.ts @@ -179,12 +179,14 @@ export class DialogueCallbacks implements OnUpdate return this.httpResponse.getBody(true); } + /** Handle client/friend/delete */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public deleteFriend(url: string, request: IDeleteFriendRequest, sessionID: string): INullResponseData { return this.httpResponse.nullResponse(); } + /** Handle client/friend/ignore/set */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public sendMessage(url: string, request: ISendMessageRequest, sessionID: string): IGetBodyResponseData { diff --git a/project/src/callbacks/HideoutCallbacks.ts b/project/src/callbacks/HideoutCallbacks.ts index 3d1001f9..539f76a2 100644 --- a/project/src/callbacks/HideoutCallbacks.ts +++ b/project/src/callbacks/HideoutCallbacks.ts @@ -48,7 +48,7 @@ export class HideoutCallbacks implements OnUpdate } /** - * Handle HideoutUpgrade + * Handle HideoutUpgrade event */ public upgrade(pmcData: IPmcData, body: IHideoutUpgradeRequestData, sessionID: string): IItemEventRouterResponse { @@ -56,7 +56,7 @@ export class HideoutCallbacks implements OnUpdate } /** - * Handle HideoutUpgradeComplete + * Handle HideoutUpgradeComplete event */ public upgradeComplete(pmcData: IPmcData, body: IHideoutUpgradeCompleteRequestData, sessionID: string): IItemEventRouterResponse { @@ -72,7 +72,7 @@ export class HideoutCallbacks implements OnUpdate } /** - * Handle HideoutTakeItemsFromAreaSlots + * Handle HideoutTakeItemsFromAreaSlots event */ public takeItemsFromAreaSlots(pmcData: IPmcData, body: IHideoutTakeItemOutRequestData, sessionID: string): IItemEventRouterResponse { @@ -80,7 +80,7 @@ export class HideoutCallbacks implements OnUpdate } /** - * Handle HideoutToggleArea + * Handle HideoutToggleArea event */ public toggleArea(pmcData: IPmcData, body: IHideoutToggleAreaRequestData, sessionID: string): IItemEventRouterResponse { @@ -88,7 +88,7 @@ export class HideoutCallbacks implements OnUpdate } /** - * Handle HideoutSingleProductionStart + * Handle HideoutSingleProductionStart event */ public singleProductionStart(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData, sessionID: string): IItemEventRouterResponse { @@ -96,7 +96,7 @@ export class HideoutCallbacks implements OnUpdate } /** - * Handle HideoutScavCaseProductionStart + * Handle HideoutScavCaseProductionStart event */ public scavCaseProductionStart(pmcData: IPmcData, body: IHideoutScavCaseStartRequestData, sessionID: string): IItemEventRouterResponse { @@ -112,7 +112,7 @@ export class HideoutCallbacks implements OnUpdate } /** - * Handle HideoutTakeProduction + * Handle HideoutTakeProduction event */ public takeProduction(pmcData: IPmcData, body: IHideoutTakeProductionRequestData, sessionID: string): IItemEventRouterResponse { diff --git a/project/src/callbacks/InraidCallbacks.ts b/project/src/callbacks/InraidCallbacks.ts index 6cd108f7..bfb9980a 100644 --- a/project/src/callbacks/InraidCallbacks.ts +++ b/project/src/callbacks/InraidCallbacks.ts @@ -20,6 +20,7 @@ export class InraidCallbacks /** * Handle client/location/getLocalloot + * Store active map in profile + applicationContext * @param url * @param info register player request * @param sessionID Session id diff --git a/project/src/callbacks/InventoryCallbacks.ts b/project/src/callbacks/InventoryCallbacks.ts index 7882e215..ebfd031d 100644 --- a/project/src/callbacks/InventoryCallbacks.ts +++ b/project/src/callbacks/InventoryCallbacks.ts @@ -66,6 +66,7 @@ export class InventoryCallbacks return this.inventoryController.transferItem(pmcData, body, sessionID); } + /** Handle Swap */ // TODO: how is this triggered public swapItem(pmcData: IPmcData, body: IInventorySwapRequestData, sessionID: string): IItemEventRouterResponse { @@ -97,11 +98,13 @@ export class InventoryCallbacks return this.inventoryController.examineItem(pmcData, body, sessionID); } + /** Handle ReadEncyclopedia */ public readEncyclopedia(pmcData: IPmcData, body: IInventoryReadEncyclopediaRequestData, sessionID: string): IItemEventRouterResponse { return this.inventoryController.readEncyclopedia(pmcData, body, sessionID); } + /** Handle ApplyInventoryChanges */ public sortInventory(pmcData: IPmcData, body: IInventorySortRequestData, sessionID: string): IItemEventRouterResponse { return this.inventoryController.sortInventory(pmcData, body, sessionID); @@ -122,6 +125,7 @@ export class InventoryCallbacks return this.inventoryController.editMapMarker(pmcData, body, sessionID); } + /** Handle OpenRandomLootContainer */ public openRandomLootContainer(pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string): IItemEventRouterResponse { return this.inventoryController.openRandomLootContainer(pmcData, body, sessionID); diff --git a/project/src/callbacks/LocationCallbacks.ts b/project/src/callbacks/LocationCallbacks.ts index 5471b523..9c4411e3 100644 --- a/project/src/callbacks/LocationCallbacks.ts +++ b/project/src/callbacks/LocationCallbacks.ts @@ -19,18 +19,21 @@ export class LocationCallbacks ) { } + /** Handle client/locations */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public getLocationData(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.locationController.generateAll()); } + /** Handle client/location/getLocalloot */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public getLocation(url: string, info: IGetLocationRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.locationController.get(info.locationId)); } + /** Handle client/location/getAirdropLoot */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public getAirdropLoot(url: string, info: IEmptyRequestData, sessionID: string): string { diff --git a/project/src/callbacks/MatchCallbacks.ts b/project/src/callbacks/MatchCallbacks.ts index 9ef1ffd0..46531ba9 100644 --- a/project/src/callbacks/MatchCallbacks.ts +++ b/project/src/callbacks/MatchCallbacks.ts @@ -37,6 +37,7 @@ export class MatchCallbacks ) { } + /** Handle client/match/updatePing */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public updatePing(url: string, info: IUpdatePingRequestData, sessionID: string): INullResponseData { @@ -50,6 +51,7 @@ export class MatchCallbacks return this.httpResponse.nullResponse(); } + /** Handle client/match/group/exit_from_menu */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public exitToMenu(url: string, info: IEmptyRequestData, sessionID: string): INullResponseData { @@ -68,6 +70,7 @@ export class MatchCallbacks return this.httpResponse.nullResponse(); } + /** Handle client/match/group/invite/send */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public sendGroupInvite(url: string, info: ISendGroupInviteRequest, sessionID: string): IGetBodyResponseData { @@ -97,6 +100,7 @@ export class MatchCallbacks return this.httpResponse.getBody(true); } + /** Handle client/match/group/invite/cancel-all */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public cancelAllGroupInvite(url: string, info: any, sessionID: string): INullResponseData { @@ -109,6 +113,7 @@ export class MatchCallbacks return this.httpResponse.nullResponse(); } + /** Handle raid/profile/list */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public getProfile(url: string, info: IGetProfileRequestData, sessionID: string): IGetBodyResponseData { @@ -129,12 +134,13 @@ export class MatchCallbacks return this.httpResponse.getBody(output); } - // Handle match/group/start_game + /** Handle match/group/start_game */ public joinMatch(url: string, info: IJoinMatchRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.matchController.joinMatch(info, sessionID)); } + /** Handle client/getMetricsConfig */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public getMetrics(url: string, info: any, sessionID: string): IGetBodyResponseData { @@ -151,11 +157,13 @@ export class MatchCallbacks return this.httpResponse.getBody(this.matchController.getGroupStatus(info)); } + /** Handle client/match/group/create */ public createGroup(url: string, info: ICreateGroupRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.matchController.createGroup(sessionID, info)); } + /** Handle client/match/group/delete */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public deleteGroup(url: string, info: any, sessionID: string): INullResponseData { @@ -170,18 +178,21 @@ export class MatchCallbacks return this.httpResponse.getBody(true); } + /** Handle client/match/group/player/remove */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public removePlayerFromGroup(url: string, info: IRemovePlayerFromGroupRequest, sessionID: string): INullResponseData { return this.httpResponse.nullResponse(); } + /** Handle client/match/offline/end */ public endOfflineRaid(url: string, info: IEndOfflineRaidRequestData, sessionID: string): INullResponseData { this.matchController.endOfflineRaid(info, sessionID); return this.httpResponse.nullResponse(); } + /** Handle client/raid/configuration */ public getRaidConfiguration(url: string, info: IGetRaidConfigurationRequestData, sessionID: string): INullResponseData { this.matchController.startOfflineRaid(info, sessionID); diff --git a/project/src/callbacks/NoteCallbacks.ts b/project/src/callbacks/NoteCallbacks.ts index 5420bc7d..d297bee2 100644 --- a/project/src/callbacks/NoteCallbacks.ts +++ b/project/src/callbacks/NoteCallbacks.ts @@ -12,16 +12,19 @@ export class NoteCallbacks @inject("NoteController") protected noteController: NoteController) { } + /** Handle AddNote event */ public addNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse { return this.noteController.addNote(pmcData, body, sessionID); } + /** Handle EditNote event */ public editNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse { return this.noteController.editNote(pmcData, body, sessionID); } + /** Handle DeleteNote event */ public deleteNote(pmcData: IPmcData, body: INoteActionData, sessionID: string): IItemEventRouterResponse { return this.noteController.deleteNote(pmcData, body, sessionID); diff --git a/project/src/callbacks/NotifierCallbacks.ts b/project/src/callbacks/NotifierCallbacks.ts index bf6ff56b..c25779ca 100644 --- a/project/src/callbacks/NotifierCallbacks.ts +++ b/project/src/callbacks/NotifierCallbacks.ts @@ -39,12 +39,15 @@ export class NotifierCallbacks .then((text) => this.httpServerHelper.sendTextJson(resp, text)); } + /** Handle push/notifier/get */ + /** Handle push/notifier/getwebsocket */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public getNotifier(url: string, info: any, sessionID: string): IGetBodyResponseData { return this.httpResponse.emptyArrayResponse(); } + /** Handle client/notifier/channel/create */ public createNotifierChannel(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.notifierController.getChannel(sessionID)); diff --git a/project/src/callbacks/PresetBuildCallbacks.ts b/project/src/callbacks/PresetBuildCallbacks.ts index 6cddeb36..01d3e0f4 100644 --- a/project/src/callbacks/PresetBuildCallbacks.ts +++ b/project/src/callbacks/PresetBuildCallbacks.ts @@ -19,16 +19,19 @@ export class PresetBuildCallbacks @inject("PresetBuildController") protected presetBuildController: PresetBuildController) { } + /** Handle client/handbook/builds/my/list */ public getHandbookUserlist(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.presetBuildController.getUserBuilds(sessionID)); } + /** Handle SaveBuild event */ public saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse { return this.presetBuildController.saveBuild(pmcData, body, sessionID); } + /** Handle RemoveBuild event*/ public removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse { return this.presetBuildController.removeBuild(pmcData, body, sessionID); diff --git a/project/src/callbacks/RagfairCallbacks.ts b/project/src/callbacks/RagfairCallbacks.ts index 33979dc9..2985a289 100644 --- a/project/src/callbacks/RagfairCallbacks.ts +++ b/project/src/callbacks/RagfairCallbacks.ts @@ -52,42 +52,6 @@ export class RagfairCallbacks implements OnLoad, OnUpdate return "aki-ragfair"; } - public search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData - { - return this.httpResponse.getBody(this.ragfairController.getOffers(sessionID, info)); - } - - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData - { - return this.httpResponse.getBody(this.ragfairController.getItemMinAvgMaxFleaPriceValues(info)); - } - - public addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse - { - return this.ragfairController.addPlayerOffer(pmcData, info, sessionID); - } - - public removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse - { - return this.ragfairController.removeOffer(info.offerId, sessionID); - } - - public extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse - { - return this.ragfairController.extendOffer(info, sessionID); - } - - /** - * Handle /client/items/prices - * Called when clicking an item to list on flea - */ - // eslint-disable-next-line @typescript-eslint/no-unused-vars - public getFleaPrices(url: string, request: IEmptyRequestData, sessionID: string): IGetBodyResponseData> - { - return this.httpResponse.getBody(this.ragfairController.getAllFleaPrices()); - } - public async onUpdate(timeSinceLastRun: number): Promise { if (timeSinceLastRun > this.ragfairConfig.runIntervalSeconds) @@ -104,6 +68,51 @@ export class RagfairCallbacks implements OnLoad, OnUpdate return false; } + /** + * Handle client/ragfair/search + * Handle client/ragfair/find + */ + public search(url: string, info: ISearchRequestData, sessionID: string): IGetBodyResponseData + { + return this.httpResponse.getBody(this.ragfairController.getOffers(sessionID, info)); + } + + /** Handle client/ragfair/itemMarketPrice */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public getMarketPrice(url: string, info: IGetMarketPriceRequestData, sessionID: string): IGetBodyResponseData + { + return this.httpResponse.getBody(this.ragfairController.getItemMinAvgMaxFleaPriceValues(info)); + } + + /** Handle RagFairAddOffer event */ + public addOffer(pmcData: IPmcData, info: IAddOfferRequestData, sessionID: string): IItemEventRouterResponse + { + return this.ragfairController.addPlayerOffer(pmcData, info, sessionID); + } + + /** \Handle RagFairRemoveOffer event */ + public removeOffer(pmcData: IPmcData, info: IRemoveOfferRequestData, sessionID: string): IItemEventRouterResponse + { + return this.ragfairController.removeOffer(info.offerId, sessionID); + } + + /** Handle RagFairRenewOffer event */ + public extendOffer(pmcData: IPmcData, info: IExtendOfferRequestData, sessionID: string): IItemEventRouterResponse + { + return this.ragfairController.extendOffer(info, sessionID); + } + + /** + * Handle /client/items/prices + * Called when clicking an item to list on flea + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + public getFleaPrices(url: string, request: IEmptyRequestData, sessionID: string): IGetBodyResponseData> + { + return this.httpResponse.getBody(this.ragfairController.getAllFleaPrices()); + } + + /** Handle client/reports/ragfair/send */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public sendReport(url: string, info: ISendRagfairReportRequestData, sessionID: string): INullResponseData { diff --git a/project/src/callbacks/RepairCallbacks.ts b/project/src/callbacks/RepairCallbacks.ts index 5d2bfbcc..7354db15 100644 --- a/project/src/callbacks/RepairCallbacks.ts +++ b/project/src/callbacks/RepairCallbacks.ts @@ -16,26 +16,28 @@ export class RepairCallbacks { } /** + * Handle TraderRepair event * use trader to repair item - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param traderRepairRequest Request object + * @param sessionID Session id + * @returns IItemEventRouterResponse */ - public traderRepair(pmcData: IPmcData, body: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse + public traderRepair(pmcData: IPmcData, traderRepairRequest: ITraderRepairActionDataRequest, sessionID: string): IItemEventRouterResponse { - return this.repairController.traderRepair(sessionID, body, pmcData); + return this.repairController.traderRepair(sessionID, traderRepairRequest, pmcData); } /** + * Handle Repair event * Use repair kit to repair item - * @param pmcData - * @param body - * @param sessionID - * @returns + * @param pmcData Player profile + * @param repairRequest Request object + * @param sessionID Session id + * @returns IItemEventRouterResponse */ - public repair(pmcData: IPmcData, body: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse + public repair(pmcData: IPmcData, repairRequest: IRepairActionDataRequest, sessionID: string): IItemEventRouterResponse { - return this.repairController.repairWithKit(sessionID, body, pmcData); + return this.repairController.repairWithKit(sessionID, repairRequest, pmcData); } } \ No newline at end of file diff --git a/project/src/callbacks/TradeCallbacks.ts b/project/src/callbacks/TradeCallbacks.ts index 87db97b8..392d0eac 100644 --- a/project/src/callbacks/TradeCallbacks.ts +++ b/project/src/callbacks/TradeCallbacks.ts @@ -17,7 +17,7 @@ export class TradeCallbacks { } /** - * Handle client/game/profile/items/moving TradingConfirm + * Handle client/game/profile/items/moving TradingConfirm event */ public processTrade(pmcData: IPmcData, body: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse { @@ -25,6 +25,7 @@ export class TradeCallbacks return this.tradeController.confirmTrading(pmcData, body, sessionID); } + /** Handle RagFairBuyOffer event */ public processRagfairTrade(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse { return this.tradeController.confirmRagfairTrading(pmcData, body, sessionID); diff --git a/project/src/callbacks/TraderCallbacks.ts b/project/src/callbacks/TraderCallbacks.ts index aa6cccf1..fc7f3dbe 100644 --- a/project/src/callbacks/TraderCallbacks.ts +++ b/project/src/callbacks/TraderCallbacks.ts @@ -31,17 +31,20 @@ export class TraderCallbacks implements OnLoad, OnUpdate return "aki-traders"; } + /** Handle client/trading/api/traderSettings */ public getTraderSettings(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { return this.httpResponse.getBody(this.traderController.getAllTraders(sessionID)); } + /** Handle client/trading/api/getTrader */ public getTrader(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { const traderID = url.replace("/client/trading/api/getTrader/", ""); return this.httpResponse.getBody(this.traderController.getTrader(sessionID, traderID)); } + /** Handle client/trading/api/getTraderAssort */ public getAssort(url: string, info: IEmptyRequestData, sessionID: string): IGetBodyResponseData { const traderID = url.replace("/client/trading/api/getTraderAssort/", ""); diff --git a/project/src/callbacks/WishlistCallbacks.ts b/project/src/callbacks/WishlistCallbacks.ts index cdafa6b9..42adf86f 100644 --- a/project/src/callbacks/WishlistCallbacks.ts +++ b/project/src/callbacks/WishlistCallbacks.ts @@ -12,11 +12,13 @@ export class WishlistCallbacks @inject("WishlistController") protected wishlistController: WishlistController) { } + /** Handle AddToWishList event */ public addToWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse { return this.wishlistController.addToWishList(pmcData, body, sessionID); } + /** Handle RemoveFromWishList event */ public removeFromWishlist(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse { return this.wishlistController.removeFromWishList(pmcData, body, sessionID); diff --git a/project/src/controllers/BotController.ts b/project/src/controllers/BotController.ts index 0f5b315c..dd7d423d 100644 --- a/project/src/controllers/BotController.ts +++ b/project/src/controllers/BotController.ts @@ -61,6 +61,7 @@ export class BotController } /** + * Handle singleplayer/settings/bot/difficulty * Get the core.json difficulty settings from database\bots * @returns IBotCore */ diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index a39a90a9..f2ca0687 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -88,6 +88,7 @@ export class HideoutController } /** + * Handle HideoutUpgrade event * Start a hideout area upgrade * @param pmcData Player profile * @param request upgrade start request @@ -158,6 +159,7 @@ export class HideoutController } /** + * Handle HideoutUpgradeComplete event * Complete a hideout area upgrade * @param pmcData Player profile * @param request Completed upgrade request @@ -259,6 +261,7 @@ export class HideoutController } /** + * Handle HideoutTakeItemsFromAreaSlots event * Remove item from hideout area and place into player inventory * @param pmcData Player profile * @param request Take item out of area request @@ -333,6 +336,7 @@ export class HideoutController } /** + * Handle HideoutToggleArea event * Toggle area on/off * @param pmcData Player profile * @param request Toggle area request @@ -356,6 +360,7 @@ export class HideoutController } /** + * Handle HideoutSingleProductionStart event * Start production for an item from hideout area * @param pmcData Player profile * @param body Start prodution of single item request @@ -392,6 +397,7 @@ export class HideoutController } /** + * Handle HideoutScavCaseProductionStart event * Handles event after clicking 'start' on the scav case hideout page * @param pmcData player profile * @param body client request object @@ -486,6 +492,7 @@ export class HideoutController } /** + * Handle HideoutTakeProduction event * Take completed item out of hideout area and place into player inventory * @param pmcData Player profile * @param request Remove production from area request diff --git a/project/src/controllers/InraidController.ts b/project/src/controllers/InraidController.ts index 97651ee0..45e53606 100644 --- a/project/src/controllers/InraidController.ts +++ b/project/src/controllers/InraidController.ts @@ -74,6 +74,7 @@ export class InraidController } /** + * Handle raid/profile/save * Save profile state to disk * Handles pmc/pscav * @param offraidData post-raid request data diff --git a/project/src/controllers/InventoryController.ts b/project/src/controllers/InventoryController.ts index 586354fa..14cf5ce6 100644 --- a/project/src/controllers/InventoryController.ts +++ b/project/src/controllers/InventoryController.ts @@ -778,6 +778,7 @@ export class InventoryController } /** + * Handle OpenRandomLootContainer event * Handle event fired when a container is unpacked (currently only the halloween pumpkin) * @param pmcData Profile data * @param body open loot container request data diff --git a/project/src/controllers/LocationController.ts b/project/src/controllers/LocationController.ts index 6f679b7f..7779d2d6 100644 --- a/project/src/controllers/LocationController.ts +++ b/project/src/controllers/LocationController.ts @@ -44,7 +44,14 @@ export class LocationController this.airdropConfig = this.configServer.getConfig(ConfigTypes.AIRDROP); } - /* get a location with generated loot data */ + /* */ + + /** + * Handle client/location/getLocalloot + * Get a location (map) with generated loot data + * @param location Map to generate loot for + * @returns ILocationBase + */ public get(location: string): ILocationBase { const name = location.toLowerCase().replace(" ", ""); @@ -140,6 +147,7 @@ export class LocationController } /** + * Handle client/location/getAirdropLoot * Get loot for an airdop container * Generates it randomly based on config/airdrop.json values * @returns Array of LootItem objects diff --git a/project/src/controllers/MatchController.ts b/project/src/controllers/MatchController.ts index 686c951f..acabb378 100644 --- a/project/src/controllers/MatchController.ts +++ b/project/src/controllers/MatchController.ts @@ -57,6 +57,7 @@ export class MatchController return this.matchConfig.enabled; } + /** Handle raid/profile/list */ public getProfile(info: IGetProfileRequestData): IPmcData[] { if (info.profileId.includes("pmcAID")) @@ -72,16 +73,20 @@ export class MatchController return []; } + /** Handle client/match/group/create */ public createGroup(sessionID: string, info: ICreateGroupRequestData): any { return this.matchLocationService.createGroup(sessionID, info); } + /** Handle client/match/group/delete */ public deleteGroup(info: any): void { this.matchLocationService.deleteGroup(info); } + /** Handle match/group/start_game */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars public joinMatch(info: IJoinMatchRequestData, sessionId: string): IJoinMatchResult { const output: IJoinMatchResult = { @@ -109,22 +114,24 @@ export class MatchController return output; } + /** Handle client/match/group/status */ // eslint-disable-next-line @typescript-eslint/no-unused-vars public getGroupStatus(info: IGetGroupStatusRequestData): any { return { - "players": [], + players: [], maxPveCountExceeded: false }; } /** * Handle /client/raid/configuration - * @param request - * @param sessionID + * @param request Raid config request + * @param sessionID Session id */ public startOfflineRaid(request: IGetRaidConfigurationRequestData, sessionID: string): void { + // Store request data for access during bot generation this.applicationContext.addValue(ContextVariableType.RAID_CONFIGURATION, request); //TODO: add code to strip PMC of equipment now they've started the raid @@ -156,6 +163,7 @@ export class MatchController return botDifficulty; } + /** Handle client/match/offline/end */ public endOfflineRaid(info: IEndOfflineRaidRequestData, sessionId: string): void { const pmcData: IPmcData = this.profileHelper.getPmcProfile(sessionId); diff --git a/project/src/controllers/NotifierController.ts b/project/src/controllers/NotifierController.ts index e250af92..124bb398 100644 --- a/project/src/controllers/NotifierController.ts +++ b/project/src/controllers/NotifierController.ts @@ -78,6 +78,7 @@ export class NotifierController return `${this.httpServerHelper.getBackendUrl()}/notifierServer/get/${sessionID}`; } + /** Handle client/notifier/channel/create */ public getChannel(sessionID: string): INotifierChannel { return { diff --git a/project/src/controllers/PresetBuildController.ts b/project/src/controllers/PresetBuildController.ts index 26e956ee..9aa50b28 100644 --- a/project/src/controllers/PresetBuildController.ts +++ b/project/src/controllers/PresetBuildController.ts @@ -22,12 +22,13 @@ export class PresetBuildController ) { } - + /** Handle client/handbook/builds/my/list */ public getUserBuilds(sessionID: string): WeaponBuild[] { return Object.values(this.saveServer.getProfile(sessionID).weaponbuilds); } + /** Handle SaveBuild event */ public saveBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse { delete body.Action; @@ -47,7 +48,8 @@ export class PresetBuildController output.profileChanges[sessionID].builds.push(body); return output; } - + + /** Handle RemoveBuild event*/ public removeBuild(pmcData: IPmcData, body: IPresetBuildActionRequestData, sessionID: string): IItemEventRouterResponse { const savedBuilds = this.saveServer.getProfile(sessionID).weaponbuilds; diff --git a/project/src/controllers/RepairController.ts b/project/src/controllers/RepairController.ts index 6985ed7f..3d9a78e4 100644 --- a/project/src/controllers/RepairController.ts +++ b/project/src/controllers/RepairController.ts @@ -34,6 +34,7 @@ export class RepairController { } /** + * Handle TraderRepair event * Repair with trader * @param sessionID session id * @param body endpoint request data @@ -67,6 +68,7 @@ export class RepairController } /** + * Handle Repair event * Repair with repair kit * @param sessionID session id * @param body endpoint request data diff --git a/project/src/controllers/TradeController.ts b/project/src/controllers/TradeController.ts index 28aadcd7..9d9574d4 100644 --- a/project/src/controllers/TradeController.ts +++ b/project/src/controllers/TradeController.ts @@ -45,12 +45,13 @@ class TradeController this.traderConfig = this.configServer.getConfig(ConfigTypes.TRADER); } + /** Handle TradingConfirm event */ public confirmTrading(pmcData: IPmcData, request: IProcessBaseTradeRequestData, sessionID: string): IItemEventRouterResponse { return this.confirmTradingInternal(pmcData, request, sessionID, this.traderConfig.purchasesAreFoundInRaid); } - // Ragfair trading + /** Handle RagFairBuyOffer event */ public confirmRagfairTrading(pmcData: IPmcData, body: IProcessRagfairTradeRequestData, sessionID: string): IItemEventRouterResponse { let output = this.eventOutputHolder.getOutput(sessionID); diff --git a/project/src/controllers/TraderController.ts b/project/src/controllers/TraderController.ts index 681e5545..f8d6a7e4 100644 --- a/project/src/controllers/TraderController.ts +++ b/project/src/controllers/TraderController.ts @@ -108,6 +108,7 @@ export class TraderController } /** + * Handle client/trading/api/traderSettings * Return an array of all traders * @param sessionID Session id * @returns array if ITraderBase objects @@ -155,11 +156,13 @@ export class TraderController return 0; } + /** Handle client/trading/api/getTrader */ public getTrader(sessionID: string, traderID: string): ITraderBase { return this.traderHelper.getTrader(sessionID, traderID); } + /** Handle client/trading/api/getTraderAssort */ public getAssort(sessionId: string, traderId: string): ITraderAssort { return this.traderAssortHelper.getAssort(sessionId, traderId); diff --git a/project/src/controllers/WeatherController.ts b/project/src/controllers/WeatherController.ts index 9ca3b053..264fc3a3 100644 --- a/project/src/controllers/WeatherController.ts +++ b/project/src/controllers/WeatherController.ts @@ -21,6 +21,7 @@ export class WeatherController this.weatherConfig = this.configServer.getConfig(ConfigTypes.WEATHER); } + /** Handle client/weather */ public generate(): IWeatherData { let result: IWeatherData = { diff --git a/project/src/controllers/WishlistController.ts b/project/src/controllers/WishlistController.ts index 90318897..177c01b5 100644 --- a/project/src/controllers/WishlistController.ts +++ b/project/src/controllers/WishlistController.ts @@ -13,10 +13,7 @@ export class WishlistController ) { } - /* Adding item to wishlist - * input: playerProfileData, Request body - * output: OK (saved profile) - * */ + /** Handle AddToWishList */ public addToWishList(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse { for (const item in pmcData.WishList) @@ -33,10 +30,7 @@ export class WishlistController return this.eventOutputHolder.getOutput(sessionID); } - /* Removing item to wishlist - * input: playerProfileData, Request body - * output: OK (saved profile) - * */ + /** Handle RemoveFromWishList event */ public removeFromWishList(pmcData: IPmcData, body: IWishlistActionData, sessionID: string): IItemEventRouterResponse { for (let i = 0; i < pmcData.WishList.length; i++) diff --git a/project/src/utils/Watermark.ts b/project/src/utils/Watermark.ts index 6ca0c21d..f38942eb 100644 --- a/project/src/utils/Watermark.ts +++ b/project/src/utils/Watermark.ts @@ -125,6 +125,7 @@ export class Watermark } /** + * Handle singleplayer/settings/version * Get text shown in game on screen, can't be translated as it breaks bsgs client when certian characters are used * @returns string */ @@ -138,19 +139,19 @@ export class Watermark } /** Set window title */ - public setTitle(): void + protected setTitle(): void { process.title = this.versionLabel; } /** Reset console cursor to top */ - public resetCursor(): void + protected resetCursor(): void { process.stdout.write("\u001B[2J\u001B[0;0f"); } /** Draw the watermark */ - public draw(): void + protected draw(): void { const result = [];