mirror of
https://github.com/brues-code/SuperCleveRoidMacros.git
synced 2026-09-16 03:38:00 +00:00
Adopt ClassicAPI in Conditionals: item cooldown, stealth, nameplates
- GetItemCooldownCached: resolve via ClassicAPI GetItemCooldown (by item id/name) instead of FindItemLocation + nampower GetItemIdCooldown + link parsing; equipment slots (1-19) still query the inventory slot. - [stealth]/[nostealth] and [stl]/[nostl], and the Rogue branch of GetCurrentShapeshiftIndex, now use ClassicAPI IsStealthed() (covers Rogue Stealth + Druid Prowl) instead of class-gated localized buff lookups. Note: [nostealth] is now true for non-stealth classes. - CountEnemiesMatching nameplate scan uses C_NamePlate.GetNamePlateGUIDs() instead of walking WorldFrame children and extracting GUIDs via pcall(frame.GetName). - Add ClassicAPI.IsStealthed / GetNamePlateGUIDs wrappers.
This commit is contained in:
@@ -118,3 +118,22 @@ end
|
||||
function API.GetActionInfo(slot)
|
||||
return GetActionInfo(slot)
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- State
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- True if the player is in Stealth (Rogue) or Prowl (Druid).
|
||||
function API.IsStealthed()
|
||||
return IsStealthed()
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- NamePlate
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
-- 1-based table of GUID strings (0x... format) for every unit with an allocated
|
||||
-- nameplate, including default vanilla nameplates. Order isn't stable.
|
||||
function API.GetNamePlateGUIDs()
|
||||
return C_NamePlate.GetNamePlateGUIDs()
|
||||
end
|
||||
|
||||
+18
-35
@@ -2012,7 +2012,7 @@ function CleveRoids.GetCurrentShapeshiftIndex()
|
||||
if CleveRoids.playerClass == "PRIEST" then
|
||||
return CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Shadowform"]) and 1 or 0
|
||||
elseif CleveRoids.playerClass == "ROGUE" then
|
||||
return CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Stealth"]) and 1 or 0
|
||||
return CleveRoids.ClassicAPI.IsStealthed() and 1 or 0
|
||||
end
|
||||
for i=1, GetNumShapeshiftForms() do
|
||||
_, _, active = GetShapeshiftFormInfo(i)
|
||||
@@ -3043,24 +3043,19 @@ function CleveRoids.CountEnemiesMatching(checkFunc)
|
||||
end
|
||||
end
|
||||
|
||||
-- 3. Nameplate scan: visible nameplates give live GUIDs without target switching
|
||||
-- Requires Nampower v2.28+ (hasNameplateGUID) or SuperWoW
|
||||
local API = CleveRoids.NampowerAPI
|
||||
if (API and API.features.hasNameplateGUID) or CleveRoids.hasSuperwow then
|
||||
local numChildren = WorldFrame:GetNumChildren()
|
||||
local children = { WorldFrame:GetChildren() }
|
||||
for i = 1, numChildren do
|
||||
local frame = children[i]
|
||||
if frame and frame:IsVisible() then
|
||||
local success, guid = pcall(frame.GetName, frame, 1)
|
||||
if success and guid and type(guid) == "string" and string.len(guid) > 0 and not checked[guid] then
|
||||
if UnitExists(guid) and UnitCanAttack("player", guid) then
|
||||
checked[guid] = true
|
||||
CleveRoids.knownEnemyGuids[guid] = true
|
||||
if checkFunc(guid) then
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
-- 3. Nameplate scan: visible nameplates give live GUIDs without target switching.
|
||||
-- ClassicAPI's C_NamePlate.GetNamePlateGUIDs() lists every unit with an
|
||||
-- allocated nameplate (including default vanilla nameplates), replacing the
|
||||
-- old WorldFrame child-walk + frame:GetName(1) GUID-extraction.
|
||||
local plateGuids = CleveRoids.ClassicAPI.GetNamePlateGUIDs()
|
||||
if plateGuids then
|
||||
for i = 1, table.getn(plateGuids) do
|
||||
local guid = plateGuids[i]
|
||||
if guid and not checked[guid] and UnitExists(guid) and UnitCanAttack("player", guid) then
|
||||
checked[guid] = true
|
||||
CleveRoids.knownEnemyGuids[guid] = true
|
||||
if checkFunc(guid) then
|
||||
count = count + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -5856,17 +5851,11 @@ CleveRoids.Keywords = {
|
||||
end,
|
||||
|
||||
stealth = function(conditionals)
|
||||
return (
|
||||
(CleveRoids.playerClass == "ROGUE" and CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Stealth"]))
|
||||
or (CleveRoids.playerClass == "DRUID" and CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Prowl"]))
|
||||
)
|
||||
return CleveRoids.ClassicAPI.IsStealthed()
|
||||
end,
|
||||
|
||||
nostealth = function(conditionals)
|
||||
return (
|
||||
(CleveRoids.playerClass == "ROGUE" and not CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Stealth"]))
|
||||
or (CleveRoids.playerClass == "DRUID" and not CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Prowl"]))
|
||||
)
|
||||
return not CleveRoids.ClassicAPI.IsStealthed()
|
||||
end,
|
||||
|
||||
casting = function(conditionals)
|
||||
@@ -9376,16 +9365,10 @@ CleveRoids.Keywords = {
|
||||
|
||||
-- stl / nostl → stealth / nostealth (saves 4/6 chars)
|
||||
stl = function(conditionals)
|
||||
return (
|
||||
(CleveRoids.playerClass == "ROGUE" and CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Stealth"]))
|
||||
or (CleveRoids.playerClass == "DRUID" and CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Prowl"]))
|
||||
)
|
||||
return CleveRoids.ClassicAPI.IsStealthed()
|
||||
end,
|
||||
nostl = function(conditionals)
|
||||
return (
|
||||
(CleveRoids.playerClass == "ROGUE" and not CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Stealth"]))
|
||||
or (CleveRoids.playerClass == "DRUID" and not CleveRoids.ValidatePlayerBuff(CleveRoids.Localized.Spells["Prowl"]))
|
||||
)
|
||||
return not CleveRoids.ClassicAPI.IsStealthed()
|
||||
end,
|
||||
|
||||
-- ic / ooc → combat / nocombat (saves 4/5 chars)
|
||||
|
||||
Reference in New Issue
Block a user