Renamed functions to better explain what they do

This commit is contained in:
Dev 2024-06-13 11:05:10 +01:00
parent 8c05345b85
commit 3327bc916a
3 changed files with 5 additions and 5 deletions

View File

@ -228,7 +228,7 @@ export class InraidController
// Not dead // Not dead
// Check for cultist amulets in special slot (only slot it can fit) // 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, serverPmcProfile.Inventory.items,
ItemTpl.SACRED_AMULET, ItemTpl.SACRED_AMULET,
"SpecialSlot"); "SpecialSlot");

View File

@ -60,7 +60,7 @@ export class ItemHelper
* @param slotId OPTIONAL - slotid of desired item * @param slotId OPTIONAL - slotid of desired item
* @returns True if pool contains 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 // Filter the pool by slotId if provided
const filteredPool = (slotId) 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 itemPool Item collection to search
* @param item Item to look for * @param item Item to look for
* @param slotId OPTIONAL - slotid of desired item * @param slotId OPTIONAL - slotid of desired item
* @returns Item or undefined * @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 // Filter the pool by slotId if provided
const filteredPool = (slotId) const filteredPool = (slotId)

View File

@ -206,7 +206,7 @@ export class InsuranceService
let randomisedReturnTimeSeconds = this.randomUtil.getInt(traderMinReturnAsSeconds, traderMaxReturnAsSeconds); let randomisedReturnTimeSeconds = this.randomUtil.getInt(traderMinReturnAsSeconds, traderMaxReturnAsSeconds);
// Check for Mark of The Unheard in players special slots (only slot item can fit) // 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, pmcData.Inventory.items,
ItemTpl.MARK_OF_UNHEARD, ItemTpl.MARK_OF_UNHEARD,
"SpecialSlot"); "SpecialSlot");