remove superwow requirement by using nampower, update nampower support to 3_1_0

This commit is contained in:
Jrc13245
2026-03-02 19:55:53 -05:00
parent 6fa4e28318
commit 82b2ab889f
5 changed files with 70 additions and 14 deletions
+6 -6
View File
@@ -2556,7 +2556,7 @@ function CleveRoids.DoCast(msg)
local parts = CleveRoids.splitStringIgnoringQuotes(msg)
for i = 1, table.getn(parts) do
local v = parts[i]
if CleveRoids.DoWithConditionals(v, CleveRoids.Hooks.CAST_SlashCmd, CleveRoids.FixEmptyTarget, not CleveRoids.hasSuperwow, CastSpellByName) then
if CleveRoids.DoWithConditionals(v, CleveRoids.Hooks.CAST_SlashCmd, CleveRoids.FixEmptyTarget, false, CastSpellByName) then
-- If /firstaction was used, stop macro evaluation after first successful cast
if CleveRoids.stopOnCastFlag then
CleveRoids.stopMacroFlag = true
@@ -2602,7 +2602,7 @@ function CleveRoids.DoPfCast(msg)
v = string.gsub(v, "%[", "[@" .. unit .. ",", 1)
end
end
if CleveRoids.DoWithConditionals(v, CleveRoids.Hooks.PFCAST_SlashCmd, CleveRoids.FixEmptyTarget, not CleveRoids.hasSuperwow, CastSpellByName) then
if CleveRoids.DoWithConditionals(v, CleveRoids.Hooks.PFCAST_SlashCmd, CleveRoids.FixEmptyTarget, false, CastSpellByName) then
if CleveRoids.stopOnCastFlag then
CleveRoids.stopMacroFlag = true
end
@@ -3643,7 +3643,7 @@ function CleveRoids.DoStopMacro(msg)
-- PERFORMANCE: Use numeric iteration to avoid pairs() iterator allocation
local parts = CleveRoids.splitStringIgnoringQuotes(CleveRoids.Trim(msg))
for i = 1, table.getn(parts) do
if CleveRoids.DoWithConditionals(parts[i], nil, nil, not CleveRoids.hasSuperwow, "STOPMACRO") then
if CleveRoids.DoWithConditionals(parts[i], nil, nil, false, "STOPMACRO") then
return true
end
end
@@ -3655,7 +3655,7 @@ function CleveRoids.DoSkipMacro(msg)
-- PERFORMANCE: Use numeric iteration to avoid pairs() iterator allocation
local parts = CleveRoids.splitStringIgnoringQuotes(CleveRoids.Trim(msg))
for i = 1, table.getn(parts) do
if CleveRoids.DoWithConditionals(parts[i], nil, nil, not CleveRoids.hasSuperwow, "SKIPMACRO") then
if CleveRoids.DoWithConditionals(parts[i], nil, nil, false, "SKIPMACRO") then
return true
end
end
@@ -3676,7 +3676,7 @@ function CleveRoids.DoFirstAction(msg)
-- Has conditionals - use DoWithConditionals to evaluate them
local parts = CleveRoids.splitStringIgnoringQuotes(CleveRoids.Trim(msg))
for i = 1, table.getn(parts) do
if CleveRoids.DoWithConditionals(parts[i], nil, nil, not CleveRoids.hasSuperwow, "FIRSTACTION") then
if CleveRoids.DoWithConditionals(parts[i], nil, nil, false, "FIRSTACTION") then
return true
end
end
@@ -3703,7 +3703,7 @@ function CleveRoids.DoNoFirstAction(msg)
-- Has conditionals - use DoWithConditionals to evaluate them
local parts = CleveRoids.splitStringIgnoringQuotes(CleveRoids.Trim(msg))
for i = 1, table.getn(parts) do
if CleveRoids.DoWithConditionals(parts[i], nil, nil, not CleveRoids.hasSuperwow, "NOFIRSTACTION") then
if CleveRoids.DoWithConditionals(parts[i], nil, nil, false, "NOFIRSTACTION") then
return true
end
end
+1 -1
View File
@@ -56,7 +56,7 @@ function Extension.OnNonUnitTooltip()
-- Also explicitly clear the game's mouseover to ensure UnitIsPlayer returns false.
-- This is defensive - the main fix is in Utility.lua:apply() using "" instead of nil.
if CleveRoids.hasSuperwow and _G.SetMouseoverUnit then
if _G.SetMouseoverUnit then
CleveRoids.__mo.selfTriggered = true
_G.SetMouseoverUnit("")
end
+1 -1
View File
@@ -17,7 +17,7 @@ CleveRoids.mouseOverUnit = nil
-- Environment flags
CleveRoids.hasSuperwow = SetAutoloot and true or false
CleveRoids.hasTurtle = (type(_G.TURTLE_WOW_VERSION) ~= "nil")
CleveRoids.supported = (CleveRoids.hasSuperwow or CleveRoids.hasTurtle)
CleveRoids.supported = CleveRoids.hasTurtle
CleveRoids.ParsedMsg = {}
CleveRoids.Items = {}
+47 -4
View File
@@ -165,7 +165,16 @@
APIs (UnitBuff/UnitDebuff won't show it). Useful for detecting hidden CC spells.
- luaSlot in BUFF/DEBUFF events now returns 0 for hidden auras (was incorrect before).
Current version: v3.0.0
No-Queue Cast by ID & SPELL_CAST_EVENT Target Default (v3.1+):
- CastSpellNoQueue(spellId, spellBook [, unit]) - Cast by spell ID without spell queueing.
spellBook: 0 for player spells, "pet" for pet spells.
Optional unit parameter for targeting (same tokens as CastSpellByName).
- CastSpellByNameNoQueue now accepts unit token as second parameter (same as CastSpellByName).
- SPELL_CAST_EVENT targetGuid now defaults to current target's GUID instead of null GUID
("0x0000000000000000"). Still overridden by explicit target (CastSpellByName 2nd param,
SpellTargetUnit mouseover).
Current version: v3.1.0
]]
local _G = _G or getfenv(0)
@@ -365,6 +374,10 @@ API.VERSION_REQUIREMENTS = {
["GetUnitGUID"] = { 3, 0, 0, "GetUnitGUID" },
["IsAuraHidden"] = { 3, 0, 0, "IsAuraHidden" },
["HiddenAuraLuaSlotFix"] = { 3, 0, 0 },
-- v3.1+ - CastSpellNoQueue by ID, SPELL_CAST_EVENT target default
["CastSpellNoQueue"] = { 3, 1, 0, "CastSpellNoQueue" }, -- Cast by spell ID without queueing; accepts optional unit token
["SpellCastEventDefaultTarget"] = { 3, 1, 0 }, -- SPELL_CAST_EVENT targetGuid now defaults to current target instead of null GUID
}
-- Check if a specific feature is available
@@ -548,6 +561,10 @@ local function InitializeFeatures()
f.hasIsAuraHidden = API.HasFeature("IsAuraHidden")
f.hasHiddenAuraLuaSlotFix = API.HasFeature("HiddenAuraLuaSlotFix")
-- v3.1+ CastSpellNoQueue by ID, SPELL_CAST_EVENT default target
f.hasCastSpellNoQueue = API.HasFeature("CastSpellNoQueue")
f.hasSpellCastEventDefaultTarget = API.HasFeature("SpellCastEventDefaultTarget")
-- Runtime detection for enhanced spell functions (verify by testing)
if f.hasEnhancedSpellFunctions and GetSpellTexture then
local success, result = pcall(function()
@@ -3117,19 +3134,23 @@ function API.SmartCast(spellName, target, forceQueue, forceNoQueue)
return false
end
-- Cast without queuing (uses CastSpellByNameNoQueue if available, v2.12+)
-- Cast without queuing (uses CastSpellByNameNoQueue if available, v2.12+; v3.1+ supports unit target)
function API.CastNoQueue(spellName, target)
if not spellName then return false end
-- Use Nampower's no-queue function if available (v2.12+)
if API.features.hasCastSpellByNameNoQueue and CastSpellByNameNoQueue then
CastSpellByNameNoQueue(spellName)
if target then
CastSpellByNameNoQueue(spellName, target)
else
CastSpellByNameNoQueue(spellName)
end
return true
end
-- Fall back to standard cast
if CastSpellByName then
if target and CleveRoids.hasSuperwow then
if target then
CastSpellByName(spellName, target)
else
CastSpellByName(spellName)
@@ -3140,6 +3161,28 @@ function API.CastNoQueue(spellName, target)
return false
end
-- Cast by spell ID without queuing (v3.1+)
function API.CastNoQueueById(spellId, target)
if not spellId then return false end
if API.features.hasCastSpellNoQueue and _G.CastSpellNoQueue then
if target then
_G.CastSpellNoQueue(spellId, 0, target)
else
_G.CastSpellNoQueue(spellId, 0)
end
return true
end
-- Fall back to CastNoQueue by name
local name = API.GetSpellNameById(spellId)
if name then
return API.CastNoQueue(name, target)
end
return false
end
-- Force queue a spell (uses QueueSpellByName directly, v2.0+)
function API.ForceQueue(spellName)
if not spellName then return false end
+15 -2
View File
@@ -313,13 +313,26 @@ do
local function apply(unit)
if _G.SetMouseoverUnit then
local resolved = unit
-- "focus" is not a valid unit token in 1.12.1; resolve to real token
if unit == "focus" then
if pfUI and pfUI.uf and pfUI.uf.focus and pfUI.uf.focus.label and pfUI.uf.focus.id
and UnitExists(pfUI.uf.focus.label .. pfUI.uf.focus.id) then
resolved = pfUI.uf.focus.label .. pfUI.uf.focus.id
else
-- No resolvable unit token; use fallback path
CleveRoids.mouseoverUnit = unit
if CleveRoids.QueueActionUpdate then CleveRoids.QueueActionUpdate() end
return
end
end
-- Available via SuperWoW or Nampower v2.37+
-- Set flag so UPDATE_MOUSEOVER_UNIT handler knows we triggered this
CleveRoids.__mo.selfTriggered = true
-- Use empty string instead of nil to properly clear mouseover.
-- SetMouseoverUnit(nil) doesn't properly clear the game's internal state,
-- causing UnitIsPlayer("mouseover") to return stale data (TurtleRP bug).
_G.SetMouseoverUnit(unit or "")
_G.SetMouseoverUnit(resolved or "")
else
CleveRoids.mouseoverUnit = unit
end
@@ -8783,7 +8796,7 @@ local function ProcessSpellMissSelf(spellId, targetGuid, missInfo)
end
-- Resolve spell name
local spellName = GetSpellRecField and GetSpellRecField(spellId, "name")
local spellName = GetSpellRecField and type(spellId) == "number" and spellId > 0 and GetSpellRecField(spellId, "name")
local baseName = spellName and string.gsub(spellName, "%s*%(.-%)%s*$", "") or nil
-- ========================================================================