Skip to content

Commit

Permalink
Remove RealMobHealth & #642
Browse files Browse the repository at this point in the history
Please remember to remove the RealMobHealth addon.
  • Loading branch information
Aviana committed Feb 20, 2020
1 parent 46c1aa0 commit 3632858
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 37 deletions.
2 changes: 1 addition & 1 deletion modules/Options.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4590,7 +4590,7 @@ function LunaUF:CreateConfig()
desc = L["Set the size of the group number."],
type = "range",
order = 2.37,
min = -6,
min = 1,
max = 20,
step = 1,
disabled = Lockdown,
Expand Down
41 changes: 5 additions & 36 deletions modules/Tags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@ local SML = LibStub:GetLibrary("LibSharedMedia-3.0")
local vex = LibStub("LibVexation-1.0", true)

local UnitHealth = UnitHealth
local realUnitHealth = UnitHealth
local UnitHealthMax = UnitHealthMax
local realUnitHealthMax = UnitHealthMax
local UnitHasHealthData = function(unit) return UnitIsUnit("player", unit) or UnitPlayerOrPetInParty(unit) or UnitPlayerOrPetInRaid(unit) end
local UnitHasHealthData = function(unit) return not UnitPlayerControlled(unit) or UnitIsUnit("player", unit) or UnitPlayerOrPetInParty(unit) or UnitPlayerOrPetInRaid(unit) end

local DruidForms = {
[24858] = GetSpellInfo(24858),
Expand Down Expand Up @@ -260,8 +258,6 @@ local defaultTags = {
return L["Dead"]
end
elseif not UnitHasHealthData(unit) then
hp = realUnitHealth(unit)
maxhp = realUnitHealthMax(unit)
if maxhp < 1 then
return "0%"
else
Expand All @@ -286,15 +282,13 @@ local defaultTags = {
return L["Dead"]
end
elseif not UnitHasHealthData(unit) then
hp = realUnitHealth(unit)
maxhp = realUnitHealthMax(unit)
if maxhp < 1 then
return "0%"
else
return math.ceil((hp / maxhp) * 100).."%"
end
end
return hp.."/"..maxhp.." "..math.ceil((realUnitHealth(unit) / realUnitHealthMax(unit)) * 100).."%"
return hp.."/"..maxhp.." "..math.ceil((UnitHealth(unit) / UnitHealthMax(unit)) * 100).."%"
end;
["ssmarthealth"] = function(frame, unit)
local hp = UnitHealth(unit)
Expand All @@ -317,8 +311,6 @@ local defaultTags = {
elseif not UnitIsConnected(unit) then
return L["Offline"]
elseif not UnitHasHealthData(unit) then
hp = realUnitHealth(unit)
maxhp = realUnitHealthMax(unit)
if maxhp < 1 then
return "0%"
else
Expand Down Expand Up @@ -348,15 +340,13 @@ local defaultTags = {
elseif not UnitIsConnected(unit) then
return L["Offline"]
elseif not UnitHasHealthData(unit) then
hp = realUnitHealth(unit)
maxhp = realUnitHealthMax(unit)
if maxhp < 1 then
return "0%"
else
return math.ceil((hp / maxhp) * 100).."%"
end
end
return hp.."/"..maxhp.." "..math.ceil((realUnitHealth(unit) / realUnitHealthMax(unit)) * 100).."%"
return hp.."/"..maxhp.." "..math.ceil((UnitHealth(unit) / UnitHealthMax(unit)) * 100).."%"
end;
["healhp"] = function(frame, unit)
local heal = frame.incomingHeal or 0
Expand Down Expand Up @@ -439,8 +429,8 @@ local defaultTags = {
end;
["perhp"] = function(frame, unit)
local hp,maxhp
hp = realUnitHealth(unit)
maxhp = realUnitHealthMax(unit)
hp = UnitHealth(unit)
maxhp = UnitHealthMax(unit)
if maxhp < 1 then
return 0
else
Expand Down Expand Up @@ -1054,25 +1044,4 @@ function Tags:SetupText(frame, config)
frame.tagUpdate:SetScript("OnUpdate", tagUpdate)
end
end
end

if RealMobHealth and RealMobHealth.GetUnitHealth then -- Changed function name for no reason :/
UnitHealth = function(unit)
local hp = RealMobHealth.GetUnitHealth(unit, true)
return hp or realUnitHealth(unit)
end
UnitHealthMax = function(unit)
local _,maxhp = RealMobHealth.GetUnitHealth(unit, true)
return maxhp or realUnitHealthMax(unit)
end
UnitHasHealthData = function(unit) return UnitIsUnit("player", unit) or UnitPlayerOrPetInParty(unit) or UnitPlayerOrPetInRaid(unit) or RealMobHealth.UnitHasHealthData(unit) end
elseif RealMobHealth then -- maintain compatibility for now
UnitHealth = function(unit)
local hp = RealMobHealth.GetHealth(unit, true)
return hp or realUnitHealth(unit)
end
UnitHealthMax = function(unit)
local _,maxhp = RealMobHealth.GetHealth(unit, true)
return maxhp or realUnitHealthMax(unit)
end
end

0 comments on commit 3632858

Please sign in to comment.