From e313e679aec02b3fc0d77bc6eaa6f5528ebe3590 Mon Sep 17 00:00:00 2001 From: Parnic Date: Sun, 9 May 2021 12:04:23 -0500 Subject: [PATCH] Basic Classic-BC support This has been tested on Classic PTR and Retail, but only with a Rogue character. Don't have a ton of time to do more exhaustive tests right now. Fixes #11 --- IceCastBar.lua | 12 +++++------ IceHUD.lua | 26 ++++++++++++++++++----- IceStackCounter.lua | 2 +- IceUnitBar.lua | 2 +- modules/ArcaneCharges.lua | 2 +- modules/ComboPoints.lua | 29 +++++++++++++------------ modules/ComboPointsBar.lua | 16 +++++++------- modules/CustomBar.lua | 10 ++++----- modules/FocusMana.lua | 2 +- modules/GlobalCoolDown.lua | 43 +++++++++++++++++++------------------- modules/HarmonyPower.lua | 2 +- modules/HolyPower.lua | 2 +- modules/PetHealth.lua | 2 +- modules/PetMana.lua | 10 ++++----- modules/PlayerAltMana.lua | 2 +- modules/PlayerHealth.lua | 2 +- modules/PlayerMana.lua | 6 +++--- modules/Resolve.lua | 2 +- modules/RollTheBones.lua | 2 +- modules/Runes.lua | 2 +- modules/Shards.lua | 2 +- modules/SliceAndDice.lua | 27 ++++++++++++++++-------- modules/Stagger.lua | 4 ++-- modules/TargetCC.lua | 4 ++-- modules/TargetCast.lua | 4 ++-- modules/TargetInfo.lua | 4 ++-- modules/TargetInvuln.lua | 4 ++-- modules/TargetMana.lua | 6 +++--- modules/TargetOfTarget.lua | 2 +- modules/Threat.lua | 2 +- 30 files changed, 132 insertions(+), 103 deletions(-) diff --git a/IceCastBar.lua b/IceCastBar.lua index 862ebf8..713a060 100644 --- a/IceCastBar.lua +++ b/IceCastBar.lua @@ -13,12 +13,12 @@ IceCastBar.prototype.unit = nil IceCastBar.prototype.current = nil local SPELL_POWER_MANA = SPELL_POWER_MANA -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_MANA = Enum.PowerType.Mana end local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo -if IceHUD.WowClassic then +if not UnitCastingInfo then UnitCastingInfo = CastingInfo UnitChannelInfo = ChannelInfo end @@ -407,13 +407,13 @@ end function IceCastBar.prototype:StartBar(action, message) local spell, rank, displayName, icon, startTime, endTime, isTradeSkill - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then spell, rank, displayName, icon, startTime, endTime, isTradeSkill = UnitCastingInfo(self.unit) else spell, displayName, icon, startTime, endTime, isTradeSkill = UnitCastingInfo(self.unit) end if not (spell) then - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(self.unit) else spell, displayName, icon, startTime, endTime = UnitChannelInfo(self.unit) @@ -568,7 +568,7 @@ function IceCastBar.prototype:SpellCastDelayed(event, unit, castGuid, spellId) if (unit ~= self.unit) then return end --IceHUD:Debug("SpellCastDelayed", unit, UnitCastingInfo(unit)) - local endTime = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 6 or 5, UnitCastingInfo(self.unit)) + local endTime = select(IceHUD.SpellFunctionsReturnRank and 6 or 5, UnitCastingInfo(self.unit)) if (endTime and self.actionStartTime) then -- apparently this check is needed, got nils during a horrible lag spike @@ -629,7 +629,7 @@ function IceCastBar.prototype:SpellCastChannelUpdate(event, unit) --IceHUD:Debug("SpellCastChannelUpdate", unit, UnitChannelInfo(unit)) local spell, rank, displayName, icon, startTime, endTime - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(unit) else spell, displayName, icon, startTime, endTime = UnitChannelInfo(unit) diff --git a/IceHUD.lua b/IceHUD.lua index a7881a1..1cf8eb9 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -17,9 +17,25 @@ IceHUD.CurrTagVersion = 3 IceHUD.debugging = false IceHUD.WowVer = select(4, GetBuildInfo()) +IceHUD.WowMain = not WOW_PROJECT_ID or WOW_PROJECT_ID == WOW_PROJECT_MAINLINE IceHUD.WowClassic = WOW_PROJECT_ID and WOW_PROJECT_ID == WOW_PROJECT_CLASSIC IceHUD.WowClassicBC = WOW_PROJECT_ID and WOW_PROJECT_ID == WOW_PROJECT_BURNING_CRUSADE_CLASSIC +-- compatibility/feature flags +IceHUD.SpellFunctionsReturnRank = IceHUD.WowMain and IceHUD.WowVer < 80000 +IceHUD.EventExistsPlayerPetChanged = IceHUD.WowVer < 80000 and not IceHUD.WowClassic and not IceHUD.WowClassicBC +IceHUD.EventExistsPetBarChanged = IceHUD.WowVer < 80000 and not IceHUD.WowClassic and not IceHUD.WowClassicBC +IceHUD.EventExistsPlayerComboPoints = IceHUD.WowMain and IceHUD.WowVer < 30000 +IceHUD.EventExistsUnitComboPoints = IceHUD.WowMain and IceHUD.WowVer < 70000 +IceHUD.EventExistsUnitMaxPower = IceHUD.WowMain and IceHUD.WowVer < 80000 +IceHUD.EventExistsGroupRosterUpdate = IceHUD.WowVer >= 50000 or IceHUD.WowClassic or IceHUD.WowClassicBC +IceHUD.EventExistsUnitDynamicFlags = IceHUD.WowMain and IceHUD.WowVer < 80000 +IceHUD.PerPowerEventsExist = IceHUD.WowMain and IceHUD.WowVer < 40000 +IceHUD.PerTargetComboPoints = IceHUD.WowVer < 60000 +IceHUD.CanTrackOtherUnitBuffs = not IceHUD.WowClassicBC +IceHUD.CanTrackGCD = not IceHUD.WowClassic +IceHUD.GetSpellInfoReturnsFunnel = IceHUD.WowMain and IceHUD.WowVer < 60000 + IceHUD.UnitPowerEvent = "UNIT_POWER_UPDATE" IceHUD.validBarList = { "Bar", "HiBar", "RoundBar", "ColorBar", "RivetBar", "RivetBar2", "CleanCurves", "GlowArc", @@ -325,7 +341,7 @@ end -- blizzard interface options local blizOptionsPanel = CreateFrame("FRAME", "IceHUDConfigPanel", UIParent) blizOptionsPanel.name = "IceHUD" -blizOptionsPanel.button = CreateFrame("BUTTON", "IceHUDOpenConfigButton", blizOptionsPanel, (IceHUD.WowVer >= 50000 or IceHUD.WowClassic) and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") +blizOptionsPanel.button = CreateFrame("BUTTON", "IceHUDOpenConfigButton", blizOptionsPanel, (IceHUD.WowVer >= 50000 or IceHUD.WowClassic or IceHUD.WowClassicBC) and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") blizOptionsPanel.button:SetText("Open IceHUD configuration") blizOptionsPanel.button:SetWidth(240) blizOptionsPanel.button:SetHeight(30) @@ -417,7 +433,7 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName) local i = 1 local name, _, texture, applications - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) else name, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) @@ -429,7 +445,7 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName) end i = i + 1 - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) else name, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) @@ -449,7 +465,7 @@ do local i = 1 local name, _, texture, applications, _, _, _, _, _, _, auraID - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) else name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) @@ -463,7 +479,7 @@ do end i = i + 1 - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) else name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) diff --git a/IceStackCounter.lua b/IceStackCounter.lua index 3f71813..05f7560 100644 --- a/IceStackCounter.lua +++ b/IceStackCounter.lua @@ -128,7 +128,7 @@ end function IceStackCounter_Enable(frame) frame:RegisterEvent("UNIT_AURA", "UpdateCustomCount") frame:RegisterEvent("UNIT_PET", "UpdateCustomCount") - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsPlayerPetChanged then frame:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomCount") end if FocusUnit then diff --git a/IceUnitBar.lua b/IceUnitBar.lua index e5e9ec9..8dd3fd6 100644 --- a/IceUnitBar.lua +++ b/IceUnitBar.lua @@ -20,7 +20,7 @@ IceUnitBar.prototype.hasPet = nil IceUnitBar.prototype.noFlash = nil local SPELL_POWER_INSANITY, SPELL_POWER_RAGE = SPELL_POWER_INSANITY, SPELL_POWER_RAGE -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_INSANITY = Enum.PowerType.Insanity SPELL_POWER_RAGE = Enum.PowerType.Rage end diff --git a/modules/ArcaneCharges.lua b/modules/ArcaneCharges.lua index 876d271..bd0776d 100644 --- a/modules/ArcaneCharges.lua +++ b/modules/ArcaneCharges.lua @@ -2,7 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local ArcaneCharges = IceCore_CreateClass(IceClassPowerCounter) local SPELL_POWER_ARCANE_CHARGES = SPELL_POWER_ARCANE_CHARGES -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_ARCANE_CHARGES = Enum.PowerType.ArcaneCharges end diff --git a/modules/ComboPoints.lua b/modules/ComboPoints.lua index bfd7d4a..a3719b6 100644 --- a/modules/ComboPoints.lua +++ b/modules/ComboPoints.lua @@ -4,11 +4,12 @@ local ComboPoints = IceCore_CreateClass(IceElement) local IceHUD = _G.IceHUD local AnticipationSpellId = 114015 +local AnticipationExists = GetSpellInfo(AnticipationSpellId) and IceHUD.WowVer < 70000 ComboPoints.prototype.comboSize = 20 local SPELL_POWER_COMBO_POINTS = SPELL_POWER_COMBO_POINTS -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints end @@ -24,7 +25,9 @@ function ComboPoints.prototype:init() ComboPoints.super.prototype.init(self, "ComboPoints") self:SetDefaultColor("ComboPoints", 1, 1, 0) - self:SetDefaultColor("AnticipationPoints", 1, 0, 1) + if AnticipationExists then + self:SetDefaultColor("AnticipationPoints", 1, 0, 1) + end self:SetDefaultColor("KyrianAnimaComboPoint", 0.3137254901960784, 0.3725490196078432, 1) self.scalingEnabled = true end @@ -171,7 +174,7 @@ function ComboPoints.prototype:GetOptions() order = 33.2 } - if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then + if AnticipationExists then opts["anticipation"] = { type = "toggle", name = L["Show Anticipation"], @@ -283,8 +286,8 @@ function ComboPoints.prototype:Enable(core) ComboPoints.super.prototype.Enable(self, core) self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints") - if IceHUD.WowVer >= 30000 or IceHUD.WowClassic then - if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then + if not IceHUD.EventExistsPlayerComboPoints then + if IceHUD.EventExistsUnitComboPoints then self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateComboPoints") else self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateComboPoints") @@ -296,7 +299,7 @@ function ComboPoints.prototype:Enable(core) self:RegisterEvent("UNIT_ENTERED_VEHICLE", "UpdateComboPoints") self:RegisterEvent("UNIT_EXITED_VEHICLE", "UpdateComboPoints") end - if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then + if AnticipationExists then self:RegisterEvent("PLAYER_TALENT_UPDATE", "AddAnticipation") self:AddAnticipation() end @@ -452,7 +455,7 @@ function ComboPoints.prototype:CreateComboFrame(forceTextureUpdate) end -- create Anticipation points - if IceHUD.WowVer < 70000 then + if AnticipationExists then for i = 1, 5 do if (not self.frame.graphicalAnt[i]) then local frame = CreateFrame("Frame", nil, self.frame) @@ -499,17 +502,17 @@ function ComboPoints.prototype:UpdateComboPoints(...) local points, anticipate, _ if IceHUD.IceCore:IsInConfigMode() then points = self:GetMaxComboPoints() - elseif IceHUD.WowVer >= 30000 or IceHUD.WowClassic then + elseif IceHUD.WowVer >= 30000 or IceHUD.WowClassic or IceHUD.WowClassicBC then -- Parnic: apparently some fights have combo points while the player is in a vehicle? local isInVehicle = UnitHasVehicleUI and UnitHasVehicleUI("player") local checkUnit = isInVehicle and "vehicle" or "player" - if IceHUD.WowVer >= 60000 or IceHUD.WowClassic then - points = UnitPower(checkUnit, SPELL_POWER_COMBO_POINTS) - else + if IceHUD.PerTargetComboPoints then points = GetComboPoints(checkUnit, "target") + else + points = UnitPower(checkUnit, SPELL_POWER_COMBO_POINTS) end - if IceHUD.WowVer < 70000 and IceHUD.WowVer >= 50000 then + if AnticipationExists then _, _, _, anticipate = UnitAura("player", GetSpellInfo(AnticipationSpellId)) else anticipate = 0 @@ -601,6 +604,6 @@ end -- Load us up local _, class = UnitClass("player") -if not IceHUD.WowClassic or class == "ROGUE" or class == "DRUID" then +if (not IceHUD.WowClassic and not IceHUD.WowClassicBC) or class == "ROGUE" or class == "DRUID" then IceHUD.ComboPoints = ComboPoints:new() end diff --git a/modules/ComboPointsBar.lua b/modules/ComboPointsBar.lua index cd22d1f..e5be02c 100644 --- a/modules/ComboPointsBar.lua +++ b/modules/ComboPointsBar.lua @@ -2,7 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local ComboPointsBar = IceCore_CreateClass(IceBarElement) local SPELL_POWER_COMBO_POINTS = SPELL_POWER_COMBO_POINTS -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints end @@ -76,8 +76,8 @@ function ComboPointsBar.prototype:Enable(core) ComboPointsBar.super.prototype.Enable(self, core) self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints") - if IceHUD.WowVer >= 30000 or IceHUD.WowClassic then - if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then + if not IceHUD.EventExistsPlayerComboPoints then + if IceHUD.EventExistsUnitComboPoints then self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateComboPoints") else self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateComboPoints") @@ -119,14 +119,14 @@ function ComboPointsBar.prototype:UpdateComboPoints(...) local points if IceHUD.IceCore:IsInConfigMode() then points = UnitPowerMax("player", SPELL_POWER_COMBO_POINTS) - elseif IceHUD.WowVer >= 30000 or IceHUD.WowClassic then + elseif IceHUD.WowVer >= 30000 or IceHUD.WowClassic or IceHUD.WowClassicBC then -- Parnic: apparently some fights have combo points while the player is in a vehicle? local isInVehicle = UnitHasVehicleUI and UnitHasVehicleUI("player") local checkUnit = isInVehicle and "vehicle" or "player" - if IceHUD.WowVer >= 60000 or IceHUD.WowClassic then - points = UnitPower(checkUnit, SPELL_POWER_COMBO_POINTS) - else + if IceHUD.PerTargetComboPoints then points = GetComboPoints(checkUnit, "target") + else + points = UnitPower(checkUnit, SPELL_POWER_COMBO_POINTS) end else points = GetComboPoints("target") @@ -155,6 +155,6 @@ function ComboPointsBar.prototype:Update() end local _, class = UnitClass("player") -if not IceHUD.WowClassic or class == "ROGUE" or class == "DRUID" then +if (not IceHUD.WowClassic and not IceHUD.WowClassicBC) or class == "ROGUE" or class == "DRUID" then IceHUD.ComboPointsBar = ComboPointsBar:new() end diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index b133cde..c646557 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -36,7 +36,7 @@ function IceCustomBar.prototype:Enable(core) self:RegisterEvent("UNIT_AURA", "UpdateCustomBarEvent") self:RegisterEvent("UNIT_PET", "UpdateCustomBarEvent") - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsPlayerPetChanged then self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBarEvent") end if FocusUnit then @@ -81,7 +81,7 @@ function IceCustomBar.prototype:Disable(core) end function IceCustomBar.prototype:GetUnitToTrack() - if IceHUD.WowClassic then + if not IceHUD.CanTrackOtherUnitBuffs then return "player" end @@ -262,7 +262,7 @@ function IceCustomBar.prototype:GetOptions() order = 30.3, } - if not IceHUD.WowClassic then + if IceHUD.CanTrackOtherUnitBuffs then opts["unitToTrack"] = { type = 'select', values = validUnits, @@ -673,7 +673,7 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName) local isBuff = self.moduleSettings.buffOrDebuff == "buff" and true or false local buffFilter = (isBuff and "HELPFUL" or "HARMFUL") .. (self.moduleSettings.trackOnlyMine and "|PLAYER" or "") local buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter) else buff, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter) @@ -703,7 +703,7 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName) i = i + 1; - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then buff, rank, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter) else buff, texture, count, type, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, buffFilter) diff --git a/modules/FocusMana.lua b/modules/FocusMana.lua index 70d01f0..0a66da1 100644 --- a/modules/FocusMana.lua +++ b/modules/FocusMana.lua @@ -4,7 +4,7 @@ local FocusMana = IceCore_CreateClass(IceUnitBar) local SPELL_POWER_RAGE = SPELL_POWER_RAGE local SPELL_POWER_FOCUS = SPELL_POWER_FOCUS local SPELL_POWER_ENERGY = SPELL_POWER_ENERGY -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_RAGE = Enum.PowerType.Rage SPELL_POWER_FOCUS = Enum.PowerType.Focus SPELL_POWER_ENERGY = Enum.PowerType.Energy diff --git a/modules/GlobalCoolDown.lua b/modules/GlobalCoolDown.lua index 1778271..8545eab 100644 --- a/modules/GlobalCoolDown.lua +++ b/modules/GlobalCoolDown.lua @@ -165,7 +165,7 @@ function GlobalCoolDown.prototype:GetSpellCastTime(spell) end local spellname, castTime, _ - if IceHUD.WowVer < 60000 then + if IceHUD.GetSpellInfoReturnsFunnel then spellName, _, _, _, _, _, castTime = GetSpellInfo(spell) else spellName, _, _, castTime = GetSpellInfo(spell) @@ -267,30 +267,31 @@ function GlobalCoolDown.prototype:CreateLagBar() end function GlobalCoolDown.prototype:GetSpellId() - return 61304 ---[[ - local defaultSpells + if GetSpellInfo(61304) then + return 61304 + else + local defaultSpells - defaultSpells = { - ROGUE=1752, -- sinister strike - PRIEST=585, -- smite - DRUID=5176, -- wrath - WARRIOR=34428, -- victory rush (not available until 5, sadly) - MAGE=44614, -- frostfire bolt - WARLOCK=686, -- shadow bolt - PALADIN=105361, -- seal of command (level 3) - SHAMAN=403, -- lightning bolt - HUNTER=3044, -- arcane shot - DEATHKNIGHT=47541, -- death coil - MONK=100780, -- jab - } + defaultSpells = { + ROGUE=1752, -- sinister strike + PRIEST=585, -- smite + DRUID=5176, -- wrath + WARRIOR=34428, -- victory rush (not available until 5, sadly) + MAGE=44614, -- frostfire bolt + WARLOCK=686, -- shadow bolt + PALADIN=105361, -- seal of command (level 3) + SHAMAN=403, -- lightning bolt + HUNTER=3044, -- arcane shot + DEATHKNIGHT=47541, -- death coil + MONK=100780, -- jab + } - local _, unitClass = UnitClass("player") - return defaultSpells[unitClass] -]] + local _, unitClass = UnitClass("player") + return defaultSpells[unitClass] + end end -- Load us up -if not IceHUD.WowClassic then +if IceHUD.CanTrackGCD then IceHUD.GlobalCoolDown = GlobalCoolDown:new() end diff --git a/modules/HarmonyPower.lua b/modules/HarmonyPower.lua index 088969d..68bab94 100644 --- a/modules/HarmonyPower.lua +++ b/modules/HarmonyPower.lua @@ -2,7 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local HarmonyPower = IceCore_CreateClass(IceClassPowerCounter) local SPELL_POWER_CHI = SPELL_POWER_CHI -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_CHI = Enum.PowerType.Chi end diff --git a/modules/HolyPower.lua b/modules/HolyPower.lua index 1d695be..2321c8f 100644 --- a/modules/HolyPower.lua +++ b/modules/HolyPower.lua @@ -2,7 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local HolyPower = IceCore_CreateClass(IceClassPowerCounter) local SPELL_POWER_HOLY_POWER = SPELL_POWER_HOLY_POWER -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_HOLY_POWER = Enum.PowerType.HolyPower end diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index d6a06a7..0c84069 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -42,7 +42,7 @@ function PetHealth.prototype:Enable(core) PetHealth.super.prototype.Enable(self, core) self:RegisterEvent("PET_UI_UPDATE", "CheckPet"); - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsPlayerPetChanged then self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet"); end self:RegisterEvent("PET_BAR_UPDATE_USABLE", "CheckPet"); diff --git a/modules/PetMana.lua b/modules/PetMana.lua index 35b77da..44b7109 100644 --- a/modules/PetMana.lua +++ b/modules/PetMana.lua @@ -5,7 +5,7 @@ local SPELL_POWER_RAGE = SPELL_POWER_RAGE local SPELL_POWER_FOCUS = SPELL_POWER_FOCUS local SPELL_POWER_ENERGY = SPELL_POWER_ENERGY local SPELL_POWER_RUNIC_POWER = SPELL_POWER_RUNIC_POWER -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_RAGE = Enum.PowerType.Rage SPELL_POWER_FOCUS = Enum.PowerType.Focus SPELL_POWER_ENERGY = Enum.PowerType.Energy @@ -62,15 +62,15 @@ function PetMana.prototype:Enable(core) PetMana.super.prototype.Enable(self, core) self:RegisterEvent("PET_UI_UPDATE", "CheckPet") - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsPlayerPetChanged then self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet") end - self:RegisterEvent(IceHUD.WowVer < 80000 and not IceHUD.WowClassic and "PET_BAR_CHANGED" or "PET_BAR_UPDATE_USABLE", "CheckPet") + self:RegisterEvent(IceHUD.EventExistsPetBarChanged and "PET_BAR_CHANGED" or "PET_BAR_UPDATE_USABLE", "CheckPet") self:RegisterEvent("UNIT_PET", "CheckPet") - if IceHUD.WowVer >= 40000 or IceHUD.WowClassic then + if not IceHUD.PerPowerEventsExist then self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateEvent") - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsUnitMaxPower then self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent") end else diff --git a/modules/PlayerAltMana.lua b/modules/PlayerAltMana.lua index 7436107..d297b73 100644 --- a/modules/PlayerAltMana.lua +++ b/modules/PlayerAltMana.lua @@ -8,7 +8,7 @@ local _, unitClass = UnitClass("player") local SPELL_POWER_MANA = SPELL_POWER_MANA local SPELL_POWER_INSANITY = SPELL_POWER_INSANITY -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_MANA = Enum.PowerType.Mana SPELL_POWER_INSANITY = Enum.PowerType.Insanity end diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index b12296b..8da66a2 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -81,7 +81,7 @@ function PlayerHealth.prototype:Enable(core) self:RegisterEvent("PLAYER_REGEN_DISABLED", "CheckCombat") self:RegisterEvent("PARTY_LEADER_CHANGED", "CheckLeader") - if IceHUD.WowVer >= 50000 or IceHUD.WowClassic then + if IceHUD.EventExistsGroupRosterUpdate then self:RegisterEvent("GROUP_ROSTER_UPDATE", "CheckLeader") else self:RegisterEvent("PARTY_MEMBERS_CHANGED", "CheckLeader") diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index e13af53..b07ca27 100644 --- a/modules/PlayerMana.lua +++ b/modules/PlayerMana.lua @@ -13,7 +13,7 @@ local SPELL_POWER_FURY = SPELL_POWER_FURY local SPELL_POWER_MAELSTROM = SPELL_POWER_MAELSTROM local SPELL_POWER_PAIN = SPELL_POWER_PAIN local SPELL_POWER_LUNAR_POWER = SPELL_POWER_LUNAR_POWER -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_MANA = Enum.PowerType.Mana SPELL_POWER_RAGE = Enum.PowerType.Rage SPELL_POWER_FOCUS = Enum.PowerType.Focus @@ -153,9 +153,9 @@ function PlayerMana.prototype:Enable(core) self:CreateTickerFrame() - if IceHUD.WowVer >= 40000 or IceHUD.WowClassic then + if not IceHUD.PerPowerEventsExist then self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateEvent") - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsUnitMaxPower then self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent") end else diff --git a/modules/Resolve.lua b/modules/Resolve.lua index ad903e1..642ebe6 100644 --- a/modules/Resolve.lua +++ b/modules/Resolve.lua @@ -56,7 +56,7 @@ do return end - self.current = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 15 or 14, UnitAura(self.unit, spellName)) or 0 + self.current = select(IceHUD.SpellFunctionsReturnRank and 15 or 14, UnitAura(self.unit, spellName)) or 0 self:Update() end diff --git a/modules/RollTheBones.lua b/modules/RollTheBones.lua index f41ef1b..08f8d76 100644 --- a/modules/RollTheBones.lua +++ b/modules/RollTheBones.lua @@ -22,7 +22,7 @@ for _, v in ipairs(RtBBuffs) do end local SPELL_POWER_COMBO_POINTS = SPELL_POWER_COMBO_POINTS -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints end diff --git a/modules/Runes.lua b/modules/Runes.lua index 112dc1f..d20631e 100644 --- a/modules/Runes.lua +++ b/modules/Runes.lua @@ -44,7 +44,7 @@ Runes.prototype.numRunes = 6 Runes.prototype.lastRuneState = {} local SPELL_POWER_RUNES = SPELL_POWER_RUNES -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_RUNES = Enum.PowerType.Runes end diff --git a/modules/Shards.lua b/modules/Shards.lua index 72196dc..aa1c03d 100644 --- a/modules/Shards.lua +++ b/modules/Shards.lua @@ -38,7 +38,7 @@ local DemonologyCoords = } local SPELL_POWER_SOUL_SHARDS = SPELL_POWER_SOUL_SHARDS -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_SOUL_SHARDS = Enum.PowerType.SoulShards end diff --git a/modules/SliceAndDice.lua b/modules/SliceAndDice.lua index a3d4401..aa8a2ac 100644 --- a/modules/SliceAndDice.lua +++ b/modules/SliceAndDice.lua @@ -25,6 +25,11 @@ local sixComboPointsTalentID = 19240 local CurrMaxSnDDuration = 0 local PotentialSnDDuration = 0 +local sndBuffName = 132306 +if IceHUD.WowMain and IceHUD.WowVer < 80000 then + sndBuffName = "Ability_Rogue_SliceDice" +end + if IceHUD.WowVer >= 50000 then baseTime = 12 gapPerComboPoint = 6 @@ -33,10 +38,14 @@ if IceHUD.WowClassic then impSndBonusPerRank = 0.15 impSndTalentPage = 1 impSndTalentIdx = 6 +elseif IceHUD.WowClassicBC then + impSndBonusPerRank = 0.15 + impSndTalentPage = 2 + impSndTalentIdx = 4 end local SPELL_POWER_COMBO_POINTS = SPELL_POWER_COMBO_POINTS -if IceHUD.WowVer >= 80000 then +if Enum and Enum.PowerType then SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints end @@ -61,7 +70,7 @@ function SliceAndDice.prototype:Enable(core) SliceAndDice.super.prototype.Enable(self, core) self:RegisterEvent("UNIT_AURA", "UpdateSliceAndDice") - if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then + if IceHUD.EventExistsUnitComboPoints then self:RegisterEvent("UNIT_COMBO_POINTS", "ComboPointsChanged") else self:RegisterEvent(IceHUD.UnitPowerEvent, "ComboPointsChanged") @@ -227,7 +236,7 @@ end function SliceAndDice.prototype:GetBuffDuration(unitName, buffName) local i = 1 local buff, _, texture, duration, endTime, remaining - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then buff, _, texture, _, _, duration, endTime = UnitBuff(unitName, i) else buff, texture, _, _, duration, endTime = UnitBuff(unitName, i) @@ -243,7 +252,7 @@ function SliceAndDice.prototype:GetBuffDuration(unitName, buffName) i = i + 1; - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then buff, _, texture, _, _, duration, endTime = UnitBuff(unitName, i) else buff, texture, _, _, duration, endTime = UnitBuff(unitName, i) @@ -264,10 +273,10 @@ function SliceAndDice.prototype:MyOnUpdate() end local function SNDGetComboPoints(unit) - if IceHUD.WowVer >= 60000 or IceHUD.WowClassic then - return UnitPower(unit, SPELL_POWER_COMBO_POINTS) - elseif IceHUD.WowVer >= 30000 then + if IceHUD.PerTargetComboPoints then return GetComboPoints(unit, "target") + elseif IceHUD.WowVer >= 60000 then + return UnitPower(unit, SPELL_POWER_COMBO_POINTS) else return GetComboPoints() end @@ -281,7 +290,7 @@ local function HasSpell(id) end local function ShouldHide() - if IceHUD.WowVer >= 90000 then + if IceHUD.WowVer >= 90000 or IceHUD.WowClassicBC then return false end @@ -300,7 +309,7 @@ function SliceAndDice.prototype:UpdateSliceAndDice(event, unit, fromUpdate) local remaining = nil if not fromUpdate or IceHUD.WowVer < 30000 then - sndDuration, remaining = self:GetBuffDuration(self.unit, (IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and "Ability_Rogue_SliceDice" or 132306) + sndDuration, remaining = self:GetBuffDuration(self.unit, sndBuffName) if not remaining then sndEndTime = 0 diff --git a/modules/Stagger.lua b/modules/Stagger.lua index ad3d289..bbdeb60 100644 --- a/modules/Stagger.lua +++ b/modules/Stagger.lua @@ -190,8 +190,8 @@ function StaggerBar.prototype:GetDebuffInfo() if debuffID == LightID or debuffID == ModerateID or debuffID == HeavyID then local spellName = UnitDebuff(self.unit, i) - duration = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 6 or 5, UnitAura(self.unit, spellName, "", "HARMFUL")) - amount = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 15 or 14, UnitAura(self.unit, spellName, "", "HARMFUL")) + duration = select(IceHUD.SpellFunctionsReturnRank and 6 or 5, UnitAura(self.unit, spellName, "", "HARMFUL")) + amount = select(IceHUD.SpellFunctionsReturnRank and 15 or 14, UnitAura(self.unit, spellName, "", "HARMFUL")) staggerLevel = (debuffID == LightID) and 1 or (debuffID == ModerateID) and 2 or 3 break diff --git a/modules/TargetCC.lua b/modules/TargetCC.lua index 860f2d1..58715c2 100644 --- a/modules/TargetCC.lua +++ b/modules/TargetCC.lua @@ -336,7 +336,7 @@ end function TargetCC.prototype:GetMaxDebuffDuration(unitName, debuffNames) local i = 1 local debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL") else debuff, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL") @@ -360,7 +360,7 @@ function TargetCC.prototype:GetMaxDebuffDuration(unitName, debuffNames) i = i + 1; - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then debuff, rank, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL") else debuff, texture, count, debuffType, duration, endTime, unitCaster, _, _, spellId = UnitAura(unitName, i, "HARMFUL") diff --git a/modules/TargetCast.lua b/modules/TargetCast.lua index d56f8b5..3d6eecf 100644 --- a/modules/TargetCast.lua +++ b/modules/TargetCast.lua @@ -91,7 +91,7 @@ function TargetCast.prototype:TargetChanged(unit) if UnitCastingInfo then local spell = UnitCastingInfo(self.unit) - local notInterruptible = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 9 or 8, UnitCastingInfo(self.unit)) + local notInterruptible = select(IceHUD.SpellFunctionsReturnRank and 9 or 8, UnitCastingInfo(self.unit)) if spell then self.notInterruptible = notInterruptibleCast self:StartBar(IceCastBar.Actions.Cast) @@ -101,7 +101,7 @@ function TargetCast.prototype:TargetChanged(unit) if UnitChannelInfo then local channel = UnitChannelInfo(self.unit) - notInterruptible = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 8 or 7, UnitChannelInfo(self.unit)) + notInterruptible = select(IceHUD.SpellFunctionsReturnRank and 8 or 7, UnitChannelInfo(self.unit)) if channel then self.notInterruptible = notInterruptibleChannel self:StartBar(IceCastBar.Actions.Channel) diff --git a/modules/TargetInfo.lua b/modules/TargetInfo.lua index bc53487..1c54ede 100644 --- a/modules/TargetInfo.lua +++ b/modules/TargetInfo.lua @@ -133,7 +133,7 @@ function IceTargetInfo.prototype:Enable(core) self:RegisterEvent("UNIT_LEVEL", "TargetLevel") self:RegisterEvent("UNIT_FLAGS", "TargetFlags") - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsUnitDynamicFlags then self:RegisterEvent("UNIT_DYNAMIC_FLAGS", "TargetFlags") end @@ -1419,7 +1419,7 @@ function IceTargetInfo.prototype:UpdateBuffType(aura) local spellID ---- end change by Fulzamoth - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(self.unit, i, reaction .. (filter and "|PLAYER" or "")) else ---- Fulzamoth - 2019-09-04 : support for cooldowns on target buffs/debuffs (classic) diff --git a/modules/TargetInvuln.lua b/modules/TargetInvuln.lua index 135a245..24d8785 100644 --- a/modules/TargetInvuln.lua +++ b/modules/TargetInvuln.lua @@ -147,7 +147,7 @@ end function TargetInvuln.prototype:GetMaxbuffDuration(unitName, buffNames) local i = 1 local buff, rank, texture, count, buffType, duration, endTime, unitCaster - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then buff, rank, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL") else buff, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL") @@ -178,7 +178,7 @@ function TargetInvuln.prototype:GetMaxbuffDuration(unitName, buffNames) i = i + 1; - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then buff, rank, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL") else buff, texture, count, buffType, duration, endTime, unitCaster = UnitAura(unitName, i, "HELPFUL") diff --git a/modules/TargetMana.lua b/modules/TargetMana.lua index cae4201..998a50e 100644 --- a/modules/TargetMana.lua +++ b/modules/TargetMana.lua @@ -14,7 +14,7 @@ local SPELL_POWER_FURY = SPELL_POWER_FURY local SPELL_POWER_MAELSTROM = SPELL_POWER_MAELSTROM local SPELL_POWER_PAIN = SPELL_POWER_PAIN local SPELL_POWER_LUNAR_POWER = SPELL_POWER_LUNAR_POWER -if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then +if Enum and Enum.PowerType then SPELL_POWER_MANA = Enum.PowerType.Mana SPELL_POWER_RAGE = Enum.PowerType.Rage SPELL_POWER_FOCUS = Enum.PowerType.Focus @@ -66,9 +66,9 @@ function IceTargetMana.prototype:Enable(core) IceTargetMana.super.prototype.Enable(self, core) if self.registerEvents then - if IceHUD.WowVer >= 40000 or IceHUD.WowClassic then + if not IceHUD.PerPowerEventsExist then self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateEvent") - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.EventExistsUnitMaxPower then self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent") end else diff --git a/modules/TargetOfTarget.lua b/modules/TargetOfTarget.lua index 0abec91..e285374 100644 --- a/modules/TargetOfTarget.lua +++ b/modules/TargetOfTarget.lua @@ -486,7 +486,7 @@ function TargetOfTarget.prototype:UpdateBuffs() if (self.moduleSettings.showDebuffs) then for i = 1, IceCore.BuffLimit do local buffName, buffRank, buffTexture, buffApplications - if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then + if IceHUD.SpellFunctionsReturnRank then buffName, buffRank, buffTexture, buffApplications = UnitDebuff(self.unit, i) else buffName, buffTexture, buffApplications = UnitDebuff(self.unit, i) diff --git a/modules/Threat.lua b/modules/Threat.lua index ec6cc3a..01869e5 100644 --- a/modules/Threat.lua +++ b/modules/Threat.lua @@ -16,7 +16,7 @@ IceThreat.prototype.scheduledEvent = nil local GetNumPartyMembers, GetNumRaidMembers = GetNumPartyMembers, GetNumRaidMembers local MAX_NUM_RAID_MEMBERS, MAX_NUM_PARTY_MEMBERS = MAX_NUM_RAID_MEMBERS, MAX_NUM_PARTY_MEMBERS -if IceHUD.WowVer >= 50000 or IceHUD.WowClassic then +if not GetNumPartyMembers then GetNumPartyMembers = GetNumGroupMembers GetNumRaidMembers = GetNumGroupMembers MAX_NUM_PARTY_MEMBERS = MAX_PARTY_MEMBERS