From 3327bc916a3185929e78b62fd38a32e03b5da0d8 Mon Sep 17 00:00:00 2001 From: Dev Date: Thu, 13 Jun 2024 11:05:10 +0100 Subject: [PATCH] Renamed functions to better explain what they do --- project/src/controllers/InraidController.ts | 2 +- project/src/helpers/ItemHelper.ts | 6 +++--- project/src/services/InsuranceService.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/project/src/controllers/InraidController.ts b/project/src/controllers/InraidController.ts index fedaf033..cd5d6325 100644 --- a/project/src/controllers/InraidController.ts +++ b/project/src/controllers/InraidController.ts @@ -228,7 +228,7 @@ export class InraidController // Not dead // Check for cultist amulets in special slot (only slot it can fit) - const sacredAmulet = this.itemHelper.getItemFromPool( + const sacredAmulet = this.itemHelper.getItemFromPoolByTpl( serverPmcProfile.Inventory.items, ItemTpl.SACRED_AMULET, "SpecialSlot"); diff --git a/project/src/helpers/ItemHelper.ts b/project/src/helpers/ItemHelper.ts index 9bb0dbbb..61a38753 100644 --- a/project/src/helpers/ItemHelper.ts +++ b/project/src/helpers/ItemHelper.ts @@ -60,7 +60,7 @@ export class ItemHelper * @param slotId OPTIONAL - slotid of desired item * @returns True if pool contains item */ - public hasItem(itemPool: Item[], item: ItemTpl, slotId?: string): boolean + public hasItemWithTpl(itemPool: Item[], item: ItemTpl, slotId?: string): boolean { // Filter the pool by slotId if provided const filteredPool = (slotId) @@ -72,13 +72,13 @@ export class ItemHelper } /** - * Get the desired item from provided pool + * Get the first item from provided pool with the desired tpl * @param itemPool Item collection to search * @param item Item to look for * @param slotId OPTIONAL - slotid of desired item * @returns Item or undefined */ - public getItemFromPool(itemPool: Item[], item: ItemTpl, slotId?: string): Item | undefined + public getItemFromPoolByTpl(itemPool: Item[], item: ItemTpl, slotId?: string): Item | undefined { // Filter the pool by slotId if provided const filteredPool = (slotId) diff --git a/project/src/services/InsuranceService.ts b/project/src/services/InsuranceService.ts index 7759eedb..89f8497c 100644 --- a/project/src/services/InsuranceService.ts +++ b/project/src/services/InsuranceService.ts @@ -206,7 +206,7 @@ export class InsuranceService let randomisedReturnTimeSeconds = this.randomUtil.getInt(traderMinReturnAsSeconds, traderMaxReturnAsSeconds); // Check for Mark of The Unheard in players special slots (only slot item can fit) - const hasMarkOfUnheard = this.itemHelper.hasItem( + const hasMarkOfUnheard = this.itemHelper.hasItemWithTpl( pmcData.Inventory.items, ItemTpl.MARK_OF_UNHEARD, "SpecialSlot");