Add combat error beacon and adjust combat recovery

This commit is contained in:
王鹏
2026-04-20 15:32:35 +08:00
parent 6ec468a78b
commit 66b8edf8e4
4 changed files with 82 additions and 12 deletions

View File

@@ -139,7 +139,41 @@ local function GetFollowSignal()
return 0
end
local combatErrorSignal = 255
local errorTimer = 0
local function UpdateCombatErrorSignal(message)
if not message or message == "" then
return
end
if message == "你需要面对目标" or message == ERR_BADATTACKFACING then
combatErrorSignal = 50
elseif message == "距离太远" or message == ERR_OUT_OF_RANGE then
combatErrorSignal = 100
elseif message == "目标不在视野中" or message == ERR_NOT_IN_LOS then
combatErrorSignal = 150
elseif message == "法术还没准备好" or message == "技能还没有准备好。" then
combatErrorSignal = 200
elseif message == "能量不足" or message == "符文能量不足" or message == "没有足够的符文" then
combatErrorSignal = 220
else
return
end
errorTimer = GetTime()
end
local errorFrame = CreateFrame("Frame")
errorFrame:RegisterEvent("UI_ERROR_MESSAGE")
errorFrame:SetScript("OnEvent", function(_, _, _, message)
UpdateCombatErrorSignal(message)
end)
f:SetScript("OnUpdate", function()
if combatErrorSignal ~= 255 and (GetTime() - errorTimer > 1.5) then
combatErrorSignal = 255
end
-- [1] 锚点:永远纯白 (255, 255, 255)
pixels[1]:SetColorTexture(1, 1, 1)
@@ -200,7 +234,7 @@ f:SetScript("OnUpdate", function()
-- [10] R=跟随信号0 / 0.5 需补跟随 / 1.0 跟随中)
local followSig = GetFollowSignal()
pixels[10]:SetColorTexture(followSig, 0, 0, 1)
pixels[10]:SetColorTexture(followSig, combatErrorSignal / 255, 0, 1)
end)
-- 可拖动