Refactor: rewrite itemFitsInto1By2Slot to improve readability

This commit is contained in:
Dev 2023-03-21 15:17:14 +00:00
parent a6838e9312
commit 1659211080
2 changed files with 9 additions and 18 deletions

View File

@ -297,7 +297,7 @@ export class BotGenerator
/** /**
* Get a bots skills with randomsied progress value between the min and max values * Get a bots skills with randomsied progress value between the min and max values
* @param botSkills * @param botSkills Skills that should have their progress value randomised
* @returns * @returns
*/ */
protected generateSkills(botSkills: botSkills): botSkills protected generateSkills(botSkills: botSkills): botSkills

View File

@ -105,32 +105,23 @@ export class PMCLootGenerator
} }
/** /**
* Check if item has a width/hide that lets it fit into a 1x2 slot * Check if item has a width/height that lets it fit into a 1x2/2x1 slot
* 1x1 / 1x2 / 2x1 * 1x1 / 1x2 / 2x1
* @param item Item to check size of * @param item Item to check size of
* @returns true if it fits * @returns true if it fits
*/ */
protected itemFitsInto1By2Slot(item: ITemplateItem): boolean protected itemFitsInto1By2Slot(item: ITemplateItem): boolean
{ {
if (item._props.Width === 1 switch (`{${item._props.Width}x${item._props.Height}}`)
&& item._props.Height === 1)
{ {
return true; case "1x1":
} case "1x2":
case "2x1":
return true;
if (item._props.Width === 1 default:
&& item._props.Height === 2) return false;
{
return true;
} }
if (item._props.Width === 2
&& item._props.Height === 1)
{
return true;
}
return false;
} }
/** /**