use nampower for default moving conditional when available. add rooted to mycc/nomycc/cc/nocc. add swimming/noswimming support with nampower 2_36

This commit is contained in:
Jrc13245
2026-02-15 14:38:58 -05:00
parent e3cfde0506
commit d5fefc3198
2 changed files with 47 additions and 13 deletions
+31 -12
View File
@@ -2569,11 +2569,16 @@ end
--- Falls back to basic position checking if MonkeySpeed isn't available
--- @return boolean True if player is moving
function CleveRoids.IsPlayerMoving()
-- If MonkeySpeed is available, use it for accurate detection
-- If MonkeySpeed is available, use it for accurate speed-based detection
if CleveRoids.HasMonkeySpeed() then
return (MonkeySpeed.m_fSpeed or 0) > 0
end
-- Nampower 2.36+ provides direct movement flag query (catches jumping, falling, pitching)
if CleveRoids.NampowerAPI.features.hasPlayerIsMoving then
return PlayerIsMoving() == 1
end
-- Fallback: use continuously tracked position history from OnUpdate
-- Core.lua tracks position at ~100 Hz with 4-sample circular buffer (matches MonkeySpeed's 0.01s).
-- Movement is detected if ANY consecutive pair of samples shows movement.
@@ -4541,6 +4546,7 @@ CleveRoids.CCTypesLossOfControl = {
[1] = true, -- charm
[2] = true, -- disoriented
[5] = true, -- fear
[7] = true, -- root (Entangling Roots, Frost Nova, etc.)
[10] = true, -- sleep
[12] = true, -- stun (Cheap Shot, Kidney Shot, etc.)
[13] = true, -- freeze
@@ -6413,16 +6419,29 @@ CleveRoids.Keywords = {
end, conditionals, "nopet")
end,
-- TODO: swimming/noswimming disabled - IsSpellUsable doesn't check environmental
-- requirements (swimming state is server-side only). Revisit when DLL mods expose
-- movement flags or IsSwimming() API.
-- swimming = function(conditionals)
-- return CleveRoids.IsReactiveUsable("Aquatic Form")
-- end,
--
-- noswimming = function(conditionals)
-- return not CleveRoids.IsReactiveUsable("Aquatic Form")
-- end,
-- [swimming] - Player is currently swimming (Nampower v2.36+)
swimming = function(conditionals)
if not CleveRoids.NampowerAPI.features.hasPlayerIsSwimming then
if not CleveRoids._swimmingErrorShown then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[SuperCleveRoidMacros]|r The [swimming] conditional requires Nampower v2.36.0 or newer.", 1, 0.5, 0.5)
CleveRoids._swimmingErrorShown = true
end
return false
end
return PlayerIsSwimming() == 1
end,
-- [noswimming] - Player is NOT swimming (Nampower v2.36+)
noswimming = function(conditionals)
if not CleveRoids.NampowerAPI.features.hasPlayerIsSwimming then
if not CleveRoids._swimmingErrorShown then
DEFAULT_CHAT_FRAME:AddMessage("|cffff0000[SuperCleveRoidMacros]|r The [swimming] conditional requires Nampower v2.36.0 or newer.", 1, 0.5, 0.5)
CleveRoids._swimmingErrorShown = true
end
return false
end
return PlayerIsSwimming() ~= 1
end,
distance = function(conditionals)
if not CleveRoids.hasUnitXP then return false end
@@ -7706,7 +7725,7 @@ CleveRoids.STATIC_CONDITIONALS = {
form = true, noform = true, stance = true, nostance = true,
equipped = true, noequipped = true,
mod = true, nomod = true,
-- swimming = true, noswimming = true, -- disabled: no client-side swimming detection
swimming = true, noswimming = true,
resting = true, noresting = true,
}
+16 -1
View File
@@ -97,7 +97,12 @@
(e.g., "0x0600000012345678") instead of raw numbers to avoid Lua 64-bit precision loss
- LearnTalentRank(talentPage, talentIndex, rank) - Learn a specific talent rank directly
Current version: v2.35.0
Player State Functions (v2.36+):
- PlayerIsMoving() - Returns 1 if player is moving, nil if stationary
- PlayerIsRooted() - Returns 1 if player is rooted, nil if not
- PlayerIsSwimming() - Returns 1 if player is swimming, nil if not
Current version: v2.36.0
]]
local _G = _G or getfenv(0)
@@ -262,6 +267,11 @@ API.VERSION_REQUIREMENTS = {
-- v2.35+ - GUID string fix and talent helper
["GuidStringFormat"] = { 2, 35, 0 }, -- GetUnitData/GetUnitField return GUID fields as hex strings
["LearnTalentRank"] = { 2, 35, 0, "LearnTalentRank" },
-- v2.36+ - Player state functions
["PlayerIsMoving"] = { 2, 36, 0, "PlayerIsMoving" },
["PlayerIsRooted"] = { 2, 36, 0, "PlayerIsRooted" },
["PlayerIsSwimming"] = { 2, 36, 0, "PlayerIsSwimming" },
}
-- Check if a specific feature is available
@@ -410,6 +420,11 @@ local function InitializeFeatures()
f.hasGuidStringFormat = API.HasFeature("GuidStringFormat")
f.hasLearnTalentRank = API.HasFeature("LearnTalentRank")
-- v2.36+ Player state functions
f.hasPlayerIsMoving = API.HasFeature("PlayerIsMoving")
f.hasPlayerIsRooted = API.HasFeature("PlayerIsRooted")
f.hasPlayerIsSwimming = API.HasFeature("PlayerIsSwimming")
-- Runtime detection for enhanced spell functions (verify by testing)
if f.hasEnhancedSpellFunctions and GetSpellTexture then
local success, result = pcall(function()