Skip to content

Commit

Permalink
Remove 9.0 compat code
Browse files Browse the repository at this point in the history
  • Loading branch information
nebularg committed Oct 14, 2020
1 parent e80b269 commit 17a9584
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 52 deletions.
2 changes: 0 additions & 2 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ globals = {
"UnitHealth",
"UnitHealthMax",
"UnitInParty",
"UnitInPhase", -- gone in wow_900
"UnitInRaid",
"UnitInRange",
"UnitIsAFK",
Expand All @@ -168,7 +167,6 @@ globals = {
"UnitIsTapDenied",
"UnitIsUnit",
"UnitIsVisible",
"UnitIsWarModePhased", -- gone in wow_900
"UnitIsWildBattlePet",
"UnitLevel",
"UnitName",
Expand Down
4 changes: 1 addition & 3 deletions Modules/HealthBar/HealthBar.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local wow_900 = select(4, GetBuildInfo()) > 90000

local PitBull4 = _G.PitBull4
local L = PitBull4.L

Expand Down Expand Up @@ -40,7 +38,7 @@ function PitBull4_HealthBar:OnEnable()

timerFrame:Show()

self:RegisterEvent(wow_900 and "UNIT_HEALTH" or "UNIT_HEALTH_FREQUENT", "UNIT_HEALTH")
self:RegisterEvent("UNIT_HEALTH")
self:RegisterEvent("UNIT_MAXHEALTH", "UNIT_HEALTH")
self:RegisterEvent("UNIT_CONNECTION", "UNIT_HEALTH")
self:RegisterEvent("PLAYER_ALIVE")
Expand Down
20 changes: 1 addition & 19 deletions Modules/HolyPower/HolyPower.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@ if select(2, UnitClass("player")) ~= "PALADIN" then
return
end

local wow_900 = select(4, GetBuildInfo()) > 90000

local PitBull4 = _G.PitBull4
local L = PitBull4.L

-- CONSTANTS ----------------------------------------------------------------

local PALADINPOWERBAR_SHOW_LEVEL = _G.PALADINPOWERBAR_SHOW_LEVEL
local SPELL_POWER_HOLY_POWER = 9 -- Enum.PowerType.HolyPower
local SPEC_PALADIN_RETRIBUTION = _G.SPEC_PALADIN_RETRIBUTION

Expand Down Expand Up @@ -42,18 +39,11 @@ PitBull4_HolyPower:SetDefaults({
background_color = { 0, 0, 0, 0.5 }
})

local player_level = UnitLevel("player")

function PitBull4_HolyPower:OnEnable()
player_level = UnitLevel("player")

self:RegisterEvent("UNIT_POWER_FREQUENT")
self:RegisterEvent("UNIT_DISPLAYPOWER")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_TALENT_UPDATE", "PLAYER_ENTERING_WORLD")
if player_level < PALADINPOWERBAR_SHOW_LEVEL then
self:RegisterEvent("PLAYER_LEVEL_UP")
end
end

local function update_player(self)
Expand Down Expand Up @@ -82,14 +72,6 @@ function PitBull4_HolyPower:PLAYER_ENTERING_WORLD(event)
update_player(self)
end

function PitBull4_HolyPower:PLAYER_LEVEL_UP(event, level)
player_level = level
if player_level >= PALADINPOWERBAR_SHOW_LEVEL then
self:UnregisterEvent("PLAYER_LEVEL_UP")
update_player(self)
end
end

function PitBull4_HolyPower:ClearFrame(frame)
local container = frame.HolyPower
if not container then
Expand Down Expand Up @@ -121,7 +103,7 @@ local function update_container_size(container, vertical, max_holy_power)
end

function PitBull4_HolyPower:UpdateFrame(frame)
if frame.unit ~= "player" or (not wow_900 and GetSpecialization() ~= SPEC_PALADIN_RETRIBUTION) or player_level < PALADINPOWERBAR_SHOW_LEVEL then
if frame.unit ~= "player" then
return self:ClearFrame(frame)
end

Expand Down
6 changes: 1 addition & 5 deletions Modules/LuaTexts/LuaTexts.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local wow_900 = select(4, GetBuildInfo()) > 90000

local PitBull4 = _G.PitBull4
local L = PitBull4.L

Expand Down Expand Up @@ -697,9 +695,7 @@ local protected_events = {
-- continue to work transparently to end users.
local compat_event_map = {}
compat_event_map.UNIT_POWER = 'UNIT_POWER_UPDATE'
if wow_900 then
compat_event_map.UNIT_HEALTH_FREQUENT = 'UNIT_HEALTH'
end
compat_event_map.UNIT_HEALTH_FREQUENT = 'UNIT_HEALTH'
compat_event_map.UNIT_HEALTHMAX = 'UNIT_MAXHEALTH'
compat_event_map.UNIT_MANA = 'UNIT_POWER_FREQUENT'
compat_event_map.UNIT_MAXMANA = 'UNIT_MAXPOWER'
Expand Down
24 changes: 4 additions & 20 deletions Modules/PhaseIcon/PhaseIcon.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local wow_900 = select(4, GetBuildInfo()) > 90000

local PitBull4 = _G.PitBull4
local L = PitBull4.L

Expand Down Expand Up @@ -31,19 +29,9 @@ end
function PitBull4_PhaseIcon:OnEnter()
local unit = self:GetParent().unit
local tooltip = _G.PARTY_PHASED_MESSAGE
if wow_900 then
local phaseReason = UnitPhaseReason(unit)
if phaseReason then
tooltip = PartyUtil.GetPhasedReasonString(phaseReason, unit)
end
else
if UnitIsWarModePhased(unit) then
if C_PvP.IsWarModeDesired() then
tooltip = _G.PARTY_PLAYER_WARMODE_DISABLED
else
tooltip = _G.PARTY_PLAYER_WARMODE_ENABLED
end
end
local phaseReason = UnitPhaseReason(unit)
if phaseReason then
tooltip = PartyUtil.GetPhasedReasonString(phaseReason, unit)
end
GameTooltip:SetOwner(self, "ANCHOR_RIGHT")
GameTooltip:SetText(tooltip, nil, nil, nil, nil, true)
Expand All @@ -61,11 +49,7 @@ function PitBull4_PhaseIcon:GetTexture(frame)
return nil
end

if wow_900 then
if not UnitPhaseReason(unit) then
return nil
end
elseif UnitInPhase(unit) and not UnitIsWarModePhased(unit) then
if not UnitPhaseReason(unit) then
return nil
end

Expand Down
4 changes: 1 addition & 3 deletions Modules/VisualHeal/VisualHeal.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
local wow_900 = select(4, GetBuildInfo()) > 90000

local PitBull4 = _G.PitBull4
local L = PitBull4.L

Expand Down Expand Up @@ -40,7 +38,7 @@ end

function PitBull4_VisualHeal:OnEnable()
self:RegisterEvent("UNIT_HEAL_PREDICTION")
self:RegisterEvent(wow_900 and "UNIT_HEALTH" or "UNIT_HEALTH_FREQUENT", "UNIT_HEAL_PREDICTION")
self:RegisterEvent("UNIT_HEALTH", "UNIT_HEAL_PREDICTION")
self:RegisterEvent("UNIT_MAXHEALTH", "UNIT_HEAL_PREDICTION")
self:RegisterEvent("UNIT_ABSORB_AMOUNT_CHANGED", "UNIT_HEAL_PREDICTION")
end
Expand Down

0 comments on commit 17a9584

Please sign in to comment.