From ef3413fa384ef146278cd4ae0f242f8752b8e2c1 Mon Sep 17 00:00:00 2001 From: Nina-1474 <62667047+Nina-1474@users.noreply.github.com> Date: Fri, 15 Jan 2021 20:49:47 +0000 Subject: [PATCH] Default Colour Check --- .../Screens/Character/ItemColor/ItemColor.js | 18 ++++++++++++++++++ .../Room/CollegeEntrance/CollegeEntrance.js | 10 ++++------ 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/BondageClub/Screens/Character/ItemColor/ItemColor.js b/BondageClub/Screens/Character/ItemColor/ItemColor.js index 918768ee36..f9ad02555b 100644 --- a/BondageClub/Screens/Character/ItemColor/ItemColor.js +++ b/BondageClub/Screens/Character/ItemColor/ItemColor.js @@ -687,3 +687,21 @@ function ItemColorReset() { ItemColorLayerNames = null; ItemColorGroupNames = null; } + +/** + * Check whether the current colors of the item match the item's default colors + * @param {Item} Item - The appearance item to check + * @returns {boolean} - Whether the item has default color(s) + */ +function ItemColorIsDefault(Item) { + const Color = Item.Color; + const AssetDefault = Item.Asset.DefaultColor; + if (typeof Color === "string") return (Color === "Default" || (typeof AssetDefault === "string" && Color === AssetDefault)); + if (Array.isArray(Color)) { + for (let C = 0; C < Color.length; C++) { + if (Color[C] !== "Default" && !(AssetDefault !== null && AssetDefault.length >= C && Color[C] === AssetDefault[C])) + return false; + } + } + return true; +} diff --git a/BondageClub/Screens/Room/CollegeEntrance/CollegeEntrance.js b/BondageClub/Screens/Room/CollegeEntrance/CollegeEntrance.js index 63a023d5b4..8e64810b40 100644 --- a/BondageClub/Screens/Room/CollegeEntrance/CollegeEntrance.js +++ b/BondageClub/Screens/Room/CollegeEntrance/CollegeEntrance.js @@ -109,12 +109,10 @@ function CollegeEntranceIsWearingTennisClothes() { */ function CollegeEntranceIsWearingCollegeClothes() { let CurrentClothes = InventoryGet(Player, "Cloth"); - if ((CurrentClothes == null) - || (CurrentClothes.Asset.Name != "CollegeOutfit1") - || (CurrentClothes.Color[0] != "Default") - || !(CurrentClothes.Color[1] == "#202020" || CurrentClothes.Color[1] == "Default") - || (CurrentClothes.Color[2] != "Default")) - return false; + if (CurrentClothes == null) return false; + else if (CurrentClothes.Asset.Name != "CollegeOutfit1") return false; + else if (!ItemColorIsDefault(CurrentClothes)) return false; + if (InventoryGet(Player, "Socks") == null) return false; if (InventoryGet(Player, "Shoes") == null) return false; if (InventoryGet(Player, "Wings") != null) return false; -- GitLab