mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
new conditional druidmana
This commit is contained in:
+31
-2
@@ -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
|
||||
|
||||
@@ -293,6 +293,7 @@ Check slash command and all conditional lists for new usages!
|
||||
| mypowerlost | [mypowerlost:>=X]<br/>[mypowerlost:>=X/<=Y] | * | | The player's lost power (mana/rage/energy) compared to X. |
|
||||
| myrawhp | [myrawhp:>=X]<br/>[myrawhp:>=X/<=Y] | * | | The player's health compared to X. |
|
||||
| myrawpower | [myrawpower:>=X]<br/>[myrawpower:>=X/<=Y] | * | | The player's power (mana/rage/energy) compared to X. |
|
||||
| druidmana | [druidmana:>=X]<br/>[druidmana:>=X/<=Y] | * | | The druid's mana compared to X. **ONLY FOR DRUIDS** **Works in Cat or Bear form.** |
|
||||
| reactive | [reactive]<br/>[reactive:Overpower] | * | | If the player has the reactive ability (Revenge, Overpower, Riposte, etc.) available to use.<br/><br/>**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 #.<br/>Supports Shadowform and Stealth as stance 1.|
|
||||
|
||||
Reference in New Issue
Block a user