From fe83793c0b43942e15fdafa01aee542efb1382cd Mon Sep 17 00:00:00 2001 From: Jrc13245 Date: Sat, 6 Sep 2025 20:02:12 -0400 Subject: [PATCH] new conditional druidmana --- Conditionals.lua | 33 +++++++++++++++++++++++++++++++-- README.md | 1 + 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Conditionals.lua b/Conditionals.lua index 621187c..0f31579 100644 --- a/Conditionals.lua +++ b/Conditionals.lua @@ -382,7 +382,7 @@ function CleveRoids.ValidatePower(unit, operator, amount) if not unit or not operator or not amount then return false end local powerPercent = 100 / UnitManaMax(unit) * UnitMana(unit) - if CleveRoids.operators[operator] then + if powerPercent and CleveRoids.operators[operator] then return CleveRoids.comparators[operator](powerPercent, amount) end @@ -398,13 +398,35 @@ function CleveRoids.ValidateRawPower(unit, operator, amount) if not unit or not operator or not amount then return false end local power = UnitMana(unit) - if CleveRoids.operators[operator] then + if power and CleveRoids.operators[operator] then return CleveRoids.comparators[operator](power, amount) end return false end +-- Raw caster-form mana for druids (SuperWoW: 2nd return of UnitMana) +function CleveRoids.ValidateDruidRawMana(unit, operator, amount) + unit = unit or "player" + if not operator or amount == nil then return false end + if (CleveRoids.playerClass ~= "DRUID") then return false end + + -- SuperWoW returns: current-form power, caster-form mana + local _, casterMana = UnitMana(unit) + + -- Fallback: if for some reason we didn't get a 2nd value and we're in caster form now + if type(casterMana) ~= "number" then + if UnitPowerType and UnitPowerType(unit) == 0 then + casterMana = UnitMana(unit) + else + return false + end + end + + local cmp = CleveRoids.comparators and CleveRoids.comparators[operator] + return cmp and cmp(casterMana, amount) or false +end + -- Checks whether or not the given unit has a power deficit vs the amount specified -- unit: The unit we're checking -- operator: valid comparitive operator symbol @@ -1112,6 +1134,13 @@ CleveRoids.Keywords = { end) end, + druidmana = function(conditionals) + return And(conditionals.druidmana, function(args) + if type(args) ~= "table" then return false end + return CleveRoids.ValidateDruidRawMana("player", args.operator, args.amount) + end) + end, + powerlost = function(conditionals) return And(conditionals.powerlost, function(args) if type(args) ~= "table" then return false end diff --git a/README.md b/README.md index 3d3ee29..74b3a5a 100644 --- a/README.md +++ b/README.md @@ -293,6 +293,7 @@ Check slash command and all conditional lists for new usages! | mypowerlost | [mypowerlost:>=X]
[mypowerlost:>=X/<=Y] | * | | The player's lost power (mana/rage/energy) compared to X. | | myrawhp | [myrawhp:>=X]
[myrawhp:>=X/<=Y] | * | | The player's health compared to X. | | myrawpower | [myrawpower:>=X]
[myrawpower:>=X/<=Y] | * | | The player's power (mana/rage/energy) compared to X. | +| druidmana | [druidmana:>=X]
[druidmana:>=X/<=Y] | * | | The druid's mana compared to X. **ONLY FOR DRUIDS** **Works in Cat or Bear form.** | | reactive | [reactive]
[reactive:Overpower] | * | | If the player has the reactive ability (Revenge, Overpower, Riposte, etc.) available to use.

**NOTE: Currently requires the reactive ability to be somewhere on your actionbars in addition to any macros you're using it in. A planned future update will remove this requirement if using [Nampower](https://github.com/pepopo978/nampower).** | | resting | [resting] | | * | If the player is resting (in an inn/capital city/etc.) | | stance | [stance:0/1/2/3/4/5] | * | | If the player is in stance #.
Supports Shadowform and Stealth as stance 1.|