From 165921108044df7c622ca1378bda3b50937316bf Mon Sep 17 00:00:00 2001 From: Dev Date: Tue, 21 Mar 2023 15:17:14 +0000 Subject: [PATCH] Refactor: rewrite itemFitsInto1By2Slot to improve readability --- project/src/generators/BotGenerator.ts | 2 +- project/src/generators/PMCLootGenerator.ts | 25 +++++++--------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/project/src/generators/BotGenerator.ts b/project/src/generators/BotGenerator.ts index 02a8e8f9..a7f27d57 100644 --- a/project/src/generators/BotGenerator.ts +++ b/project/src/generators/BotGenerator.ts @@ -297,7 +297,7 @@ export class BotGenerator /** * 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 */ protected generateSkills(botSkills: botSkills): botSkills diff --git a/project/src/generators/PMCLootGenerator.ts b/project/src/generators/PMCLootGenerator.ts index 41b57186..a2f7d736 100644 --- a/project/src/generators/PMCLootGenerator.ts +++ b/project/src/generators/PMCLootGenerator.ts @@ -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 * @param item Item to check size of * @returns true if it fits */ protected itemFitsInto1By2Slot(item: ITemplateItem): boolean { - if (item._props.Width === 1 - && item._props.Height === 1) + switch (`{${item._props.Width}x${item._props.Height}}`) { - return true; - } + case "1x1": + case "1x2": + case "2x1": + return true; - if (item._props.Width === 1 - && item._props.Height === 2) - { - return true; + default: + return false; } - - if (item._props.Width === 2 - && item._props.Height === 1) - { - return true; - } - - return false; } /**