mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-26 14:00:48 +00:00
hunterbar: delay and queue ability scanner events
This commit is contained in:
+30
-18
@@ -12,29 +12,41 @@ pfUI:RegisterModule("hunterbar", "vanilla", function ()
|
|||||||
pfUI.hunterbar:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
|
pfUI.hunterbar:RegisterEvent("ACTIONBAR_SLOT_CHANGED")
|
||||||
pfUI.hunterbar:RegisterEvent("PLAYER_ENTERING_WORLD")
|
pfUI.hunterbar:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
pfUI.hunterbar:SetScript("OnEvent", function()
|
pfUI.hunterbar:SetScript("OnEvent", function()
|
||||||
pfUI.hunterbar.melee = nil
|
if event == "PLAYER_ENTERING_WORLD" then
|
||||||
pfUI.hunterbar.ranged = nil
|
this.event = GetTime() + 3
|
||||||
|
elseif this.event and this.event < GetTime() + .2 then
|
||||||
for i=1,120 do
|
this.event = GetTime() + .1
|
||||||
if pfUI.hunterbar.melee and pfUI.hunterbar.ranged then return end
|
|
||||||
|
|
||||||
scanner:SetAction(i)
|
|
||||||
|
|
||||||
local left = scanner:Line(1)
|
|
||||||
if left then
|
|
||||||
if left == L["hunterpaging"]["MELEE"] then
|
|
||||||
pfUI.hunterbar.melee = i
|
|
||||||
elseif left == L["hunterpaging"]["RANGED"] then
|
|
||||||
pfUI.hunterbar.ranged = i
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
pfUI.hunterbar:SetScript("OnUpdate", function()
|
pfUI.hunterbar:SetScript("OnUpdate", function()
|
||||||
if not pfUI.hunterbar.melee or not pfUI.hunterbar.ranged then return end
|
-- we got an event 0.1s ago, scanning for new Skills
|
||||||
|
if this.event and this.event <= GetTime() then
|
||||||
|
this.event = nil
|
||||||
|
this.melee = nil
|
||||||
|
this.ranged = nil
|
||||||
|
|
||||||
if IsActionInRange(pfUI.hunterbar.melee) == 1 and IsActionInRange(pfUI.hunterbar.ranged) == 0 then
|
for i=1,120 do
|
||||||
|
if this.melee and this.ranged then return end
|
||||||
|
|
||||||
|
scanner:SetAction(i)
|
||||||
|
|
||||||
|
local left = scanner:Line(1)
|
||||||
|
if left then
|
||||||
|
if left == L["hunterpaging"]["MELEE"] then
|
||||||
|
this.melee = i
|
||||||
|
elseif left == L["hunterpaging"]["RANGED"] then
|
||||||
|
this.ranged = i
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- skip further code when no abilities were found
|
||||||
|
if not this.melee or not this.ranged then return end
|
||||||
|
|
||||||
|
-- do the actual rangedetection and barswapping
|
||||||
|
if IsActionInRange(this.melee) == 1 and IsActionInRange(this.ranged) == 0 then
|
||||||
if _G.CURRENT_ACTIONBAR_PAGE == 1 then
|
if _G.CURRENT_ACTIONBAR_PAGE == 1 then
|
||||||
_G.CURRENT_ACTIONBAR_PAGE = 9
|
_G.CURRENT_ACTIONBAR_PAGE = 9
|
||||||
ChangeActionBarPage()
|
ChangeActionBarPage()
|
||||||
|
|||||||
Reference in New Issue
Block a user