From 4661f0f924fb11bf5f2be888a9eefbb8a1b0a3d6 Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Sun, 9 Nov 2025 13:09:16 -0500 Subject: [PATCH] more equip fixes --- Conditionals.lua | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/Conditionals.lua b/Conditionals.lua index 98650ba..360f6c8 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -1200,33 +1200,45 @@ CleveRoids.Keywords = { end, equipped = function(conditionals) - -- If no explicit values OR it's a string, check the action itself - if not conditionals.equipped or - type(conditionals.equipped) ~= "table" or - table.getn(conditionals.equipped) == 0 then - local itemToCheck = conditionals.action - if not itemToCheck then return false end - return (CleveRoids.HasWeaponEquipped(itemToCheck) or CleveRoids.HasGearEquipped(itemToCheck)) + local itemsToCheck = {} + + -- Case 1: conditionals.equipped is a string (e.g., [equipped]ItemName) + if type(conditionals.equipped) == "string" then + table.insert(itemsToCheck, conditionals.equipped) + -- Case 2: conditionals.equipped is a table (e.g., [equipped:Shields]) + elseif type(conditionals.equipped) == "table" and table.getn(conditionals.equipped) > 0 then + itemsToCheck = conditionals.equipped + -- Case 3: No value provided, check the action + elseif conditionals.action then + table.insert(itemsToCheck, conditionals.action) + else + return false end - -- Otherwise check the provided values - return And(conditionals.equipped, function (v) + -- Check all items + return Or(itemsToCheck, function(v) return (CleveRoids.HasWeaponEquipped(v) or CleveRoids.HasGearEquipped(v)) end) end, noequipped = function(conditionals) - -- If no explicit values OR it's a string, check the action itself - if not conditionals.noequipped or - type(conditionals.noequipped) ~= "table" or - table.getn(conditionals.noequipped) == 0 then - local itemToCheck = conditionals.action - if not itemToCheck then return false end - return not (CleveRoids.HasWeaponEquipped(itemToCheck) or CleveRoids.HasGearEquipped(itemToCheck)) + local itemsToCheck = {} + + -- Case 1: conditionals.noequipped is a string (e.g., [noequipped]ItemName) + if type(conditionals.noequipped) == "string" then + table.insert(itemsToCheck, conditionals.noequipped) + -- Case 2: conditionals.noequipped is a table (e.g., [noequipped:Shields]) + elseif type(conditionals.noequipped) == "table" and table.getn(conditionals.noequipped) > 0 then + itemsToCheck = conditionals.noequipped + -- Case 3: No value provided, check the action + elseif conditionals.action then + table.insert(itemsToCheck, conditionals.action) + else + return false end - -- Otherwise check the provided values - return And(conditionals.noequipped, function (v) + -- Check all items - ALL must be NOT equipped for this to pass + return And(itemsToCheck, function(v) return not (CleveRoids.HasWeaponEquipped(v) or CleveRoids.HasGearEquipped(v)) end) end,