mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
new command feedpet, new conditional pethappiness
This commit is contained in:
@@ -5403,6 +5403,23 @@ local function MakeTypedPowerKeyword(condKey, unitDefault, powerType)
|
||||
end
|
||||
end
|
||||
|
||||
local PET_HAPPINESS_STATES = {
|
||||
unhappy = 1,
|
||||
content = 2,
|
||||
happy = 3,
|
||||
}
|
||||
|
||||
local function ResolvePetHappinessState(value)
|
||||
local state = tonumber(value)
|
||||
if state then
|
||||
return state
|
||||
end
|
||||
if type(value) ~= "string" then
|
||||
return nil
|
||||
end
|
||||
return PET_HAPPINESS_STATES[GetLowercaseString(value)]
|
||||
end
|
||||
|
||||
-- A list of Conditionals and their functions to validate them
|
||||
CleveRoids.Keywords = {
|
||||
exists = function(conditionals)
|
||||
@@ -7222,6 +7239,39 @@ CleveRoids.Keywords = {
|
||||
end, conditionals, "nopet")
|
||||
end,
|
||||
|
||||
-- Hunter pet happiness: 1=unhappy, 2=content, 3=happy.
|
||||
pethappiness = function(conditionals)
|
||||
local happiness = GetPetHappiness()
|
||||
local _, isHunterPet = HasPetUI()
|
||||
if not isHunterPet or not happiness then
|
||||
return false
|
||||
end
|
||||
|
||||
if conditionals.pethappiness == true then
|
||||
return true
|
||||
end
|
||||
|
||||
return Multi(conditionals.pethappiness, function(requiredState)
|
||||
return happiness == ResolvePetHappinessState(requiredState)
|
||||
end, conditionals, "pethappiness")
|
||||
end,
|
||||
|
||||
nopethappiness = function(conditionals)
|
||||
local happiness = GetPetHappiness()
|
||||
local _, isHunterPet = HasPetUI()
|
||||
if not isHunterPet or not happiness then
|
||||
return true
|
||||
end
|
||||
|
||||
if conditionals.nopethappiness == true then
|
||||
return false
|
||||
end
|
||||
|
||||
return NegatedMulti(conditionals.nopethappiness, function(forbiddenState)
|
||||
return happiness ~= ResolvePetHappinessState(forbiddenState)
|
||||
end, conditionals, "nopethappiness")
|
||||
end,
|
||||
|
||||
-- [focus] / [nofocus] - whether a focus is set. Covers pfUI's emulated focus
|
||||
-- and ClassicAPI's native focus token (set via /focus or the FOCUSTARGET keybind).
|
||||
focus = function(conditionals)
|
||||
|
||||
Reference in New Issue
Block a user