Adjusted PMC loot generation to allow for 1x2 sized items to be added to the pocket pool to account for UhD bots' large pockets

This commit is contained in:
Dev 2024-06-16 18:52:42 +01:00
parent 1546bbfc16
commit 928f9068a3

View File

@ -63,8 +63,7 @@ export class PMCLootGenerator
&& this.itemHelper.isValidItem(item._id) && this.itemHelper.isValidItem(item._id)
&& !pmcItemBlacklist.includes(item._id) && !pmcItemBlacklist.includes(item._id)
&& !itemBlacklist.includes(item._id) && !itemBlacklist.includes(item._id)
&& item._props.Width === 1 && this.itemFitsInto1By2Slot(item),
&& item._props.Height === 1,
); );
for (const itemToAdd of itemsToAdd) for (const itemToAdd of itemsToAdd)
@ -166,6 +165,26 @@ export class PMCLootGenerator
return item._props.Width <= 2 && item._props.Height <= 2; return item._props.Width <= 2 && item._props.Height <= 2;
} }
/**
* Check if item has a width/height that lets it fit into a 1x2 slot
* 1x1 / 1x2 / 2x1
* @param item Item to check size of
* @returns true if it fits
*/
protected itemFitsInto1By2Slot(item: ITemplateItem): boolean
{
switch (`{${item._props.Width}x${item._props.Height}}`)
{
case "1x1":
case "1x2":
case "2x1":
return true;
default:
return false;
}
}
/** /**
* Create an array of loot items a PMC can have in their backpack * Create an array of loot items a PMC can have in their backpack
* @returns string array of tpls * @returns string array of tpls