mirror of
https://github.com/brues-code/pfUI.git
synced 2026-10-22 04:00:49 +00:00
Merge pull request #126 from florian-gustin/master
Maul Swing color timer
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
.idea
|
||||||
|
/.idea
|
||||||
+1
-1
@@ -2090,7 +2090,7 @@ pfUI:RegisterModule("gui", "vanilla:tbc", function ()
|
|||||||
CreateConfig(nil, T["Offhand Bar Color"], C.unitframes, "swingtimerohcolor", "color")
|
CreateConfig(nil, T["Offhand Bar Color"], C.unitframes, "swingtimerohcolor", "color")
|
||||||
CreateConfig(nil, T["Ranged Bar Color"], C.unitframes, "swingtimerrangedcolor", "color")
|
CreateConfig(nil, T["Ranged Bar Color"], C.unitframes, "swingtimerrangedcolor", "color")
|
||||||
CreateConfig(nil, T["Ranged Warn Color (Hunter)"], C.unitframes, "swingtimerrangedwarncolor", "color")
|
CreateConfig(nil, T["Ranged Warn Color (Hunter)"], C.unitframes, "swingtimerrangedwarncolor", "color")
|
||||||
CreateConfig(nil, T["Show HS/Cleave Queue Color (Warrior)"], C.unitframes, "swingtimerhsqueue", "checkbox")
|
CreateConfig(nil, T["Show On Next Attack Queue Color"], C.unitframes, "swingtimerhsqueue", "checkbox")
|
||||||
CreateConfig(nil, T["Show Attack Speed"], C.unitframes, "swingtimerattackspeed", "checkbox")
|
CreateConfig(nil, T["Show Attack Speed"], C.unitframes, "swingtimerattackspeed", "checkbox")
|
||||||
|
|
||||||
CreateConfig(nil, "Mark Tracking", nil, nil, "header")
|
CreateConfig(nil, "Mark Tracking", nil, nil, "header")
|
||||||
|
|||||||
+36
-15
@@ -22,8 +22,9 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
inCombat = false,
|
inCombat = false,
|
||||||
pendingCastSpellId = nil,
|
pendingCastSpellId = nil,
|
||||||
mhFrozenAt = nil,
|
mhFrozenAt = nil,
|
||||||
hsQueued = false, cleaveQueued = false,
|
hsQueued = false, cleaveQueued = false, maulQueued = false,
|
||||||
isWarrior = false,
|
isWarrior = false,
|
||||||
|
isDruid = false,
|
||||||
cachedHSSlots = {}, cachedCleaveSlots = {},
|
cachedHSSlots = {}, cachedCleaveSlots = {},
|
||||||
useSpellQueueEvent = false,
|
useSpellQueueEvent = false,
|
||||||
playerGUID = nil,
|
playerGUID = nil,
|
||||||
@@ -64,7 +65,16 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
local cleaveSpellIDs = {
|
local cleaveSpellIDs = {
|
||||||
[845] = true, [7369] = true, [11608] = true, [11609] = true,
|
[845] = true, [7369] = true, [11608] = true, [11609] = true,
|
||||||
[20569] = true,
|
[20569] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Maul spell IDs (all ranks 1 to 7)
|
||||||
|
local maulSpellIDs = {
|
||||||
|
[6807] = true,
|
||||||
|
[6808] = true,
|
||||||
|
[6809] = true,
|
||||||
|
[8972] = true,
|
||||||
|
[9745] = true, [9880] = true, [9881] = true,
|
||||||
|
}
|
||||||
|
|
||||||
-- Read config
|
-- Read config
|
||||||
local sw_width = tonumber(C.unitframes.swingtimerwidth) or 200
|
local sw_width = tonumber(C.unitframes.swingtimerwidth) or 200
|
||||||
@@ -506,12 +516,16 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
|
|
||||||
-- HS/Cleave color
|
-- HS/Cleave color
|
||||||
local curR, curG, curB = mhDefaultR, mhDefaultG, mhDefaultB
|
local curR, curG, curB = mhDefaultR, mhDefaultG, mhDefaultB
|
||||||
if sw_hsqueue and S.isWarrior then
|
if sw_hsqueue then
|
||||||
local hs, cl = IsHSOrCleaveQueued()
|
if S.maulQueued and S.isDruid then
|
||||||
if cl then
|
curR, curG, curB = 1.0, 0.55, 0.0 -- orange for druid maul queue
|
||||||
curR, curG, curB = 0.2, 0.9, 0.2
|
elseif S.isWarrior then
|
||||||
elseif hs then
|
local hs, cl = IsHSOrCleaveQueued()
|
||||||
curR, curG, curB = 0.9, 0.9, 0.2
|
if cl then
|
||||||
|
curR, curG, curB = 0.2, 0.9, 0.2
|
||||||
|
elseif hs then
|
||||||
|
curR, curG, curB = 0.9, 0.9, 0.2
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -692,8 +706,9 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
-- Slam delays auto-attack but does NOT reset the swing timer. Ignore.
|
-- Slam delays auto-attack but does NOT reset the swing timer. Ignore.
|
||||||
S.pendingCastSpellId = nil
|
S.pendingCastSpellId = nil
|
||||||
return
|
return
|
||||||
elseif hsSpellIDs[spellId] or IsOnSwingSpell(spellId) then
|
elseif hsSpellIDs[spellId] or cleaveSpellIDs[spellId] or maulSpellIDs[spellId] or IsOnSwingSpell(spellId) then
|
||||||
S.hsQueued = false; S.cleaveQueued = false
|
S.hsQueued = false; S.cleaveQueued = false
|
||||||
|
S.maulQueued = false
|
||||||
ResetMH()
|
ResetMH()
|
||||||
elseif cleaveSpellIDs[spellId] then
|
elseif cleaveSpellIDs[spellId] then
|
||||||
S.hsQueued = false; S.cleaveQueued = false
|
S.hsQueued = false; S.cleaveQueued = false
|
||||||
@@ -716,11 +731,12 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
-- SPELL_CAST_EVENT hook: HS/Cleave queue tracking
|
-- SPELL_CAST_EVENT hook: HS/Cleave queue tracking
|
||||||
pfUI.libdebuff_spell_cast_hooks = pfUI.libdebuff_spell_cast_hooks or {}
|
pfUI.libdebuff_spell_cast_hooks = pfUI.libdebuff_spell_cast_hooks or {}
|
||||||
pfUI.libdebuff_spell_cast_hooks["swingtimer"] = function(success, spellId)
|
pfUI.libdebuff_spell_cast_hooks["swingtimer"] = function(success, spellId)
|
||||||
if success ~= 1 then return end
|
|
||||||
if hsSpellIDs[spellId] then
|
if hsSpellIDs[spellId] then
|
||||||
S.hsQueued = true; S.cleaveQueued = false
|
S.hsQueued = true; S.cleaveQueued = false; S.maulQueued = false
|
||||||
elseif cleaveSpellIDs[spellId] then
|
elseif cleaveSpellIDs[spellId] then
|
||||||
S.cleaveQueued = true; S.hsQueued = false
|
S.cleaveQueued = true; S.hsQueued = false; S.maulQueued = false
|
||||||
|
elseif maulSpellIDs[spellId] then
|
||||||
|
S.maulQueued = true; S.hsQueued = false; S.cleaveQueued = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -806,12 +822,14 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
if eventCode == ON_SWING_QUEUED then
|
if eventCode == ON_SWING_QUEUED then
|
||||||
S.useSpellQueueEvent = true
|
S.useSpellQueueEvent = true
|
||||||
if hsSpellIDs[spellId] then
|
if hsSpellIDs[spellId] then
|
||||||
S.hsQueued = true; S.cleaveQueued = false
|
S.hsQueued = true; S.cleaveQueued = false; S.maulQueued = false
|
||||||
elseif cleaveSpellIDs[spellId] then
|
elseif cleaveSpellIDs[spellId] then
|
||||||
S.cleaveQueued = true; S.hsQueued = false
|
S.cleaveQueued = true; S.hsQueued = false; S.maulQueued = false
|
||||||
|
elseif maulSpellIDs[spellId] then
|
||||||
|
S.maulQueued = true; S.hsQueued = false; S.cleaveQueued = false
|
||||||
end
|
end
|
||||||
elseif eventCode == ON_SWING_QUEUE_POPPED then
|
elseif eventCode == ON_SWING_QUEUE_POPPED then
|
||||||
S.hsQueued = false; S.cleaveQueued = false
|
S.hsQueued = false; S.cleaveQueued = false; S.maulQueued = false
|
||||||
end
|
end
|
||||||
|
|
||||||
elseif event == "START_AUTOATTACK" then
|
elseif event == "START_AUTOATTACK" then
|
||||||
@@ -823,6 +841,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
elseif event == "PLAYER_ENTERING_WORLD" then
|
elseif event == "PLAYER_ENTERING_WORLD" then
|
||||||
local _, class = UnitClass("player")
|
local _, class = UnitClass("player")
|
||||||
S.isWarrior = (class == "WARRIOR")
|
S.isWarrior = (class == "WARRIOR")
|
||||||
|
S.isDruid = (class == "DRUID")
|
||||||
S.playerGUID = GetUnitGUID("player")
|
S.playerGUID = GetUnitGUID("player")
|
||||||
UpdateWeaponSpeeds()
|
UpdateWeaponSpeeds()
|
||||||
RebuildQueueSlotCache()
|
RebuildQueueSlotCache()
|
||||||
@@ -850,6 +869,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
S.inCombat = false
|
S.inCombat = false
|
||||||
S.hsQueued = false
|
S.hsQueued = false
|
||||||
S.cleaveQueued = false
|
S.cleaveQueued = false
|
||||||
|
S.maulQueued = false
|
||||||
|
|
||||||
elseif event == "UNIT_DIED" then
|
elseif event == "UNIT_DIED" then
|
||||||
if arg1 and arg1 == S.playerGUID then
|
if arg1 and arg1 == S.playerGUID then
|
||||||
@@ -897,6 +917,7 @@ pfUI:RegisterModule("swingtimer", "vanilla:tbc", function ()
|
|||||||
-- Warrior HS/Cleave queue state
|
-- Warrior HS/Cleave queue state
|
||||||
IsHSQueued = function() return S.hsQueued end,
|
IsHSQueued = function() return S.hsQueued end,
|
||||||
IsCleaveQueued = function() return S.cleaveQueued end,
|
IsCleaveQueued = function() return S.cleaveQueued end,
|
||||||
|
IsMaulQueued = function() return S.maulQueued end,
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateWeaponSpeeds()
|
UpdateWeaponSpeeds()
|
||||||
|
|||||||
Reference in New Issue
Block a user