Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

combopoints: Fix combo points on target frame #20

Open
wants to merge 1 commit into
base: classic
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/basecombopoints.lua
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function Combo:Update(frame, event, unit, powerType)
-- Anything power based will have an eventType to filter on
if( event and frame[key].cpConfig.eventType and frame[key].cpConfig.eventType ~= powerType ) then return end

local points = self:GetPoints(unit)
local points = self:GetPoints(unit, frame)

-- Bar display, hide it if we don't have any combo points
if( ShadowUF.db.profile.units[frame.unitType][key].isBar ) then
Expand Down
11 changes: 9 additions & 2 deletions modules/combopoints.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function Combo:OnEnable(frame)

frame:RegisterNormalEvent("UNIT_POWER_UPDATE", self, "Update", "player")
frame:RegisterNormalEvent("UNIT_POWER_FREQUENT", self, "Update", "player")
frame:RegisterNormalEvent("PLAYER_TARGET_CHANGED", self, "Update", "player")
frame:RegisterNormalEvent("UNIT_MAXPOWER", self, "UpdateBarBlocks", "player")

frame:RegisterUpdateFunc(self, "Update")
Expand All @@ -29,12 +30,18 @@ function Combo:GetMaxPoints()
end
end

function Combo:GetPoints(unit)
return UnitPower("player", cpConfig.powerType)
function Combo:GetPoints(unit, frame)
if frame.unit == "target" then
return GetComboPoints("player", "target")
else
return UnitPower("player", cpConfig.powerType)
end
end

function Combo:Update(frame, event, unit, powerType)
if( not event or ( unit == frame.unit or unit == "player" ) ) then
ShadowUF.ComboPoints.Update(self, frame, event, unit, powerType)
elseif(event == "PLAYER_TARGET_CHANGED" and frame.unit == "target") then
ShadowUF.ComboPoints.Update(self, frame, event, "player", cpConfig.powerType)
end
end