Skip to content
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
3 changes: 2 additions & 1 deletion modules/power.lua
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,8 @@ function Power:Update(frame, event, unit, powerType)
if( event and powerType and powerType ~= frame.powerBar.currentType ) then return end
if( frame.powerBar.minusMob ) then return end

local powerType = UnitPowerType(frame.unit)
frame.powerBar.currentPower = UnitPower(frame.unit)
frame.powerBar:SetMinMaxValues(0, UnitPowerMax(frame.unit))
frame.powerBar:SetMinMaxValues(0, UnitPowerMax(frame.unit, powerType))
frame.powerBar:SetValue(UnitIsDeadOrGhost(frame.unit) and 0 or not UnitIsConnected(frame.unit) and 0 or frame.powerBar.currentPower)
end
27 changes: 18 additions & 9 deletions modules/tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,8 @@ Tags.defaultTags = {
return string.format("%s%s|r", color, name)
end]],
["curpp"] = [[function(unit, unitOwner)
if( UnitPowerMax(unit) <= 0 ) then
local powerType = UnitPowerType(unit)
if( UnitPowerMax(unit, powerType) <= 0 ) then
return nil
elseif( UnitIsDeadOrGhost(unit) ) then
return 0
Expand Down Expand Up @@ -644,7 +645,8 @@ Tags.defaultTags = {
end]],
["absmaxhp"] = [[function(unit, unitOwner) return UnitHealthMax(unit) end]],
["abscurpp"] = [[function(unit, unitOwner)
if( UnitPowerMax(unit) <= 0 ) then
local powerType = UnitPowerType(unit)
if( UnitPowerMax(unit, powerType) <= 0 ) then
return nil
elseif( UnitIsDeadOrGhost(unit) ) then
return 0
Expand All @@ -653,11 +655,13 @@ Tags.defaultTags = {
return UnitPower(unit)
end]],
["absmaxpp"] = [[function(unit, unitOwner)
local power = UnitPowerMax(unit)
local powerType = UnitPowerType(unit)
local power = UnitPowerMax(unit, powerType)
return power > 0 and power or nil
end]],
["absolutepp"] = [[function(unit, unitOwner)
local maxPower = UnitPowerMax(unit)
local powerType = UnitPowerType(unit)
local maxPower = UnitPowerMax(unit, powerType)
local power = UnitPower(unit)
if( UnitIsDeadOrGhost(unit) ) then
return string.format("0/%s", maxPower)
Expand All @@ -668,7 +672,8 @@ Tags.defaultTags = {
return string.format("%s/%s", power, maxPower)
end]],
["curmaxpp"] = [[function(unit, unitOwner)
local maxPower = UnitPowerMax(unit)
local powerType = UnitPowerType(unit)
local maxPower = UnitPowerMax(unit, powerType)
local power = UnitPower(unit)
if( UnitIsDeadOrGhost(unit) ) then
return string.format("0/%s", ShadowUF:FormatLargeNumber(maxPower))
Expand All @@ -679,7 +684,8 @@ Tags.defaultTags = {
return string.format("%s/%s", ShadowUF:FormatLargeNumber(power), ShadowUF:FormatLargeNumber(maxPower))
end]],
["smart:curmaxpp"] = [[function(unit, unitOwner)
local maxPower = UnitPowerMax(unit)
local powerType = UnitPowerType(unit)
local maxPower = UnitPowerMax(unit, powerType)
local power = UnitPower(unit)
if( UnitIsDeadOrGhost(unit) ) then
return string.format("0/%s", maxPower)
Expand Down Expand Up @@ -713,7 +719,8 @@ Tags.defaultTags = {
end]],
["maxhp"] = [[function(unit, unitOwner) return ShadowUF:FormatLargeNumber(UnitHealthMax(unit)) end]],
["maxpp"] = [[function(unit, unitOwner)
local power = UnitPowerMax(unit)
local powerType = UnitPowerType(unit)
local power = UnitPowerMax(unit, powerType)
if( power <= 0 ) then
return nil
elseif( UnitIsDeadOrGhost(unit) ) then
Expand All @@ -736,7 +743,8 @@ Tags.defaultTags = {
return "-" .. ShadowUF:FormatLargeNumber(missing)
end]],
["missingpp"] = [[function(unit, unitOwner)
local power = UnitPowerMax(unit)
local powerType = UnitPowerType(unit)
local power = UnitPowerMax(unit, powerType)
if( power <= 0 ) then
return nil
end
Expand Down Expand Up @@ -769,7 +777,8 @@ Tags.defaultTags = {
return math.floor(UnitHealth(unit) / max * 100 + 0.5) .. "%"
end]],
["perpp"] = [[function(unit, unitOwner)
local maxPower = UnitPowerMax(unit)
local powerType = UnitPowerType(unit)
local maxPower = UnitPowerMax(unit, powerType)
if( maxPower <= 0 ) then
return nil
elseif( UnitIsDeadOrGhost(unit) or not UnitIsConnected(unit) ) then
Expand Down