diff --git a/IceCastBar.lua b/IceCastBar.lua index 9fe1bb8..771c8b8 100644 --- a/IceCastBar.lua +++ b/IceCastBar.lua @@ -13,10 +13,16 @@ IceCastBar.prototype.unit = nil IceCastBar.prototype.current = nil local SPELL_POWER_MANA = SPELL_POWER_MANA -if IceHUD.WowVer >= 80000 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_MANA = Enum.PowerType.Mana end +local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo +if IceHUD.WowClassic then + UnitCastingInfo = CastingInfo + UnitChannelInfo = ChannelInfo +end + local AuraIconWidth = 20 local AuraIconHeight = 20 @@ -352,13 +358,13 @@ end function IceCastBar.prototype:StartBar(action, message) local spell, rank, displayName, icon, startTime, endTime, isTradeSkill - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic 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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(self.unit) else spell, displayName, icon, startTime, endTime = UnitChannelInfo(self.unit) @@ -510,7 +516,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 6 or 5, UnitCastingInfo(self.unit)) + local endTime = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) 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 @@ -571,7 +577,7 @@ function IceCastBar.prototype:SpellCastChannelUpdate(event, unit) --IceHUD:Debug("SpellCastChannelUpdate", unit, UnitChannelInfo(unit)) local spell, rank, displayName, icon, startTime, endTime - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then spell, rank, displayName, icon, startTime, endTime = UnitChannelInfo(unit) else spell, displayName, icon, startTime, endTime = UnitChannelInfo(unit) diff --git a/IceCore.lua b/IceCore.lua index 1e742e2..27cbecb 100644 --- a/IceCore.lua +++ b/IceCore.lua @@ -251,10 +251,14 @@ function IceCore.prototype:Enable(userToggle) IceHUD_Options:GenerateModuleOptions() end - self.IceHUDFrame:RegisterEvent("PET_BATTLE_OPENING_START") - self.IceHUDFrame:RegisterEvent("PET_BATTLE_OVER") - self.IceHUDFrame:RegisterEvent("BARBER_SHOP_OPEN") - self.IceHUDFrame:RegisterEvent("BARBER_SHOP_CLOSE") + if UnitCanPetBattle then + self.IceHUDFrame:RegisterEvent("PET_BATTLE_OPENING_START") + self.IceHUDFrame:RegisterEvent("PET_BATTLE_OVER") + end + if GetBarberShopStyleInfo then + self.IceHUDFrame:RegisterEvent("BARBER_SHOP_OPEN") + self.IceHUDFrame:RegisterEvent("BARBER_SHOP_CLOSE") + end self.IceHUDFrame:RegisterEvent("UNIT_AURA") self.IceHUDFrame:SetScript("OnEvent", function(self, event, ...) if (event == "PET_BATTLE_OPENING_START") then diff --git a/IceHUD.lua b/IceHUD.lua index 6608de9..1a16148 100644 --- a/IceHUD.lua +++ b/IceHUD.lua @@ -6,7 +6,7 @@ local IceHUD = IceHUD local SML = LibStub("LibSharedMedia-3.0") local ACR = LibStub("AceConfigRegistry-3.0") local ConfigDialog = LibStub("AceConfigDialog-3.0") -local icon = LibStub("LibDBIcon-1.0") +local icon = LibStub("LibDBIcon-1.0", true) local AceGUI = LibStub("AceGUI-3.0") local AceSerializer = LibStub("AceSerializer-3.0", 1) @@ -17,8 +17,9 @@ IceHUD.CurrTagVersion = 3 IceHUD.debugging = false IceHUD.WowVer = select(4, GetBuildInfo()) +IceHUD.WowClassic = WOW_PROJECT_ID and WOW_PROJECT_ID == WOW_PROJECT_CLASSIC -IceHUD.UnitPowerEvent = IceHUD.WowVer < 80000 and "UNIT_POWER" or "UNIT_POWER_UPDATE" +IceHUD.UnitPowerEvent = "UNIT_POWER_UPDATE" IceHUD.validBarList = { "Bar", "HiBar", "RoundBar", "ColorBar", "RivetBar", "RivetBar2", "CleanCurves", "GlowArc", "BloodGlaives", "ArcHUD", "FangRune", "DHUD", "CleanCurvesOut", "CleanTank", "PillTank", "GemTank" } @@ -324,7 +325,7 @@ end -- blizzard interface options local blizOptionsPanel = CreateFrame("FRAME", "IceHUDConfigPanel", UIParent) blizOptionsPanel.name = "IceHUD" -blizOptionsPanel.button = CreateFrame("BUTTON", "IceHUDOpenConfigButton", blizOptionsPanel, IceHUD.WowVer >= 50000 and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") +blizOptionsPanel.button = CreateFrame("BUTTON", "IceHUDOpenConfigButton", blizOptionsPanel, (IceHUD.WowVer >= 50000 or IceHUD.WowClassic) and "UIPanelButtonTemplate" or "UIPanelButtonTemplate2") blizOptionsPanel.button:SetText("Open IceHUD configuration") blizOptionsPanel.button:SetWidth(240) blizOptionsPanel.button:SetHeight(30) @@ -412,7 +413,7 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName) local i = 1 local name, _, texture, applications - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) else name, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) @@ -424,7 +425,7 @@ function IceHUD:GetAuraCount(auraType, unit, ability, onlyMine, matchByName) end i = i + 1 - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then name, _, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) else name, texture, applications = UnitAura(unit, i, auraType..(onlyMine and "|PLAYER" or "")) @@ -444,7 +445,7 @@ do local i = 1 local name, _, texture, applications, _, _, _, _, _, _, auraID - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) else name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) @@ -458,7 +459,7 @@ do end i = i + 1 - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then name, _, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) else name, texture, applications, _, _, _, _, _, _, auraID = UnitAura(unit, i, filter) @@ -605,6 +606,10 @@ local function CheckLFGMode(mode) end function IceHUD:GetIsInLFGGroup() + if not GetLFGMode then + return false + end + local mode, submode if IceHUD.WowVer >= 50000 then mode, submode = GetLFGMode(LE_LFG_CATEGORY_LFD) diff --git a/IceHUD.toc b/IceHUD.toc index 69a556b..1552c38 100644 --- a/IceHUD.toc +++ b/IceHUD.toc @@ -9,6 +9,7 @@ ## X-Category: HUDs ## X-Website: https://www.wowace.com/projects/ice-hud ## X-WoWI-ID: 8149 +## X-Compatible-With: 11302 #@no-lib-strip@ # Libraries diff --git a/IceHUD_Options/Options.lua b/IceHUD_Options/Options.lua index c2e4717..894b5df 100644 --- a/IceHUD_Options/Options.lua +++ b/IceHUD_Options/Options.lua @@ -1,6 +1,6 @@ local LibDualSpec = LibStub('LibDualSpec-1.0', true) local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) -local icon = LibStub("LibDBIcon-1.0") +local icon = LibStub("LibDBIcon-1.0", true) local lastCustomModule = "Bar" IceHUD_Options = {} @@ -379,6 +379,7 @@ Blizzard added a "Personal Resource Display" feature in the 7.0 game client. You IceHUD.IceCore.IceHUDFrame:Show() end end, + hidden = not UnitCanPetBattle, order = 34, }, @@ -396,6 +397,7 @@ Blizzard added a "Personal Resource Display" feature in the 7.0 game client. You IceHUD.IceCore.IceHUDFrame:Show() end end, + hidden = not GetBarberShopStyleInfo, order = 35, }, @@ -413,6 +415,7 @@ Blizzard added a "Personal Resource Display" feature in the 7.0 game client. You IceHUD.IceCore.IceHUDFrame:Show() end end, + hidden = IceHUD.WowVer < 80000, order = 36, }, } diff --git a/IceStackCounter.lua b/IceStackCounter.lua index 3d82093..6e18f00 100644 --- a/IceStackCounter.lua +++ b/IceStackCounter.lua @@ -131,7 +131,9 @@ function IceStackCounter_Enable(frame) if IceHUD.WowVer < 80000 then frame:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomCount") end - frame:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomCount") + if FocusUnit then + frame:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomCount") + end frame:RegisterEvent("PLAYER_DEAD", "UpdateCustomCount") frame:RegisterEvent("SPELL_UPDATE_CHARGES", "UpdateCustomCount") diff --git a/IceUnitBar.lua b/IceUnitBar.lua index fb93eb1..e083023 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_INSANITY -if IceHUD.WowVer >= 80000 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_INSANITY = Enum.PowerType.Insanity end @@ -220,7 +220,7 @@ end function IceUnitBar.prototype:Update() IceUnitBar.super.prototype.Update(self) - if IceHUD.WowVer < 70000 then + if UnitIsTapped then self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit)) else self.tapped = UnitIsTapDenied(self.unit) diff --git a/changelog.txt b/changelog.txt index 9f388f3..38592c0 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,6 @@ +unreleased: +- WoW Classic compatibility + v1.11.11: - Updated TOC to 8.2 diff --git a/modules/ArcaneCharges.lua b/modules/ArcaneCharges.lua index 4130788..876d271 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_ARCANE_CHARGES = Enum.PowerType.ArcaneCharges end diff --git a/modules/CastBar.lua b/modules/CastBar.lua index a257a3b..d396a9d 100644 --- a/modules/CastBar.lua +++ b/modules/CastBar.lua @@ -313,8 +313,10 @@ end function CastBar.prototype:Enable(core) CastBar.super.prototype.Enable(self, core) - self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") - self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + if UnitHasVehicleUI then + self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") + self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + end self:RegisterEvent("PLAYER_ENTERING_WORLD", "CheckVehicle") self:RegisterEvent("CVAR_UPDATE", "CVarUpdate") @@ -348,10 +350,12 @@ end function CastBar.prototype:CheckVehicle() - if UnitHasVehicleUI("player") then - self:EnteringVehicle(nil, "player", true) - else - self:ExitingVehicle(nil, "player") + if UnitHasVehicleUI then + if UnitHasVehicleUI("player") then + self:EnteringVehicle(nil, "player", true) + else + self:ExitingVehicle(nil, "player") + end end end diff --git a/modules/ComboPoints.lua b/modules/ComboPoints.lua index 2e8b8ff..e819171 100644 --- a/modules/ComboPoints.lua +++ b/modules/ComboPoints.lua @@ -8,7 +8,7 @@ local AnticipationSpellId = 114015 ComboPoints.prototype.comboSize = 20 local SPELL_POWER_COMBO_POINTS = SPELL_POWER_COMBO_POINTS -if IceHUD.WowVer >= 80000 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints end @@ -163,7 +163,7 @@ function ComboPoints.prototype:GetOptions() order = 33.2 } - if IceHUD.WowVer < 70000 then + if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then opts["anticipation"] = { type = "toggle", name = L["Show Anticipation"], @@ -253,8 +253,8 @@ function ComboPoints.prototype:Enable(core) ComboPoints.super.prototype.Enable(self, core) self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints") - if IceHUD.WowVer >= 30000 then - if IceHUD.WowVer < 70000 then + if IceHUD.WowVer >= 30000 or IceHUD.WowClassic then + if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateComboPoints") else self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateComboPoints") @@ -262,9 +262,11 @@ function ComboPoints.prototype:Enable(core) self:RegisterEvent("UNIT_MAXPOWER", "UpdateMaxComboPoints") end end - self:RegisterEvent("UNIT_ENTERED_VEHICLE", "UpdateComboPoints") - self:RegisterEvent("UNIT_EXITED_VEHICLE", "UpdateComboPoints") - if IceHUD.WowVer < 70000 then + if UnitHasVehicleUI then + self:RegisterEvent("UNIT_ENTERED_VEHICLE", "UpdateComboPoints") + self:RegisterEvent("UNIT_EXITED_VEHICLE", "UpdateComboPoints") + end + if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then self:RegisterEvent("PLAYER_TALENT_UPDATE", "AddAnticipation") self:AddAnticipation() end @@ -450,22 +452,18 @@ function ComboPoints.prototype:UpdateComboPoints(...) local points, anticipate, _ if IceHUD.IceCore:IsInConfigMode() then points = self:GetMaxComboPoints() - elseif IceHUD.WowVer >= 30000 then + elseif IceHUD.WowVer >= 30000 or IceHUD.WowClassic then -- Parnic: apparently some fights have combo points while the player is in a vehicle? - local isInVehicle = UnitHasVehicleUI("player") + local isInVehicle = UnitHasVehicleUI and UnitHasVehicleUI("player") local checkUnit = isInVehicle and "vehicle" or "player" - if IceHUD.WowVer >= 60000 then + if IceHUD.WowVer >= 60000 or IceHUD.WowClassic then points = UnitPower(checkUnit, SPELL_POWER_COMBO_POINTS) else points = GetComboPoints(checkUnit, "target") end - if IceHUD.WowVer < 70000 then - if IceHUD.WowVer < 80000 then - _, _, _, anticipate = UnitAura("player", GetSpellInfo(AnticipationSpellId)) - else - _, _, anticipate = UnitAura("player", GetSpellInfo(AnticipationSpellId)) - end + if IceHUD.WowVer < 70000 and IceHUD.WowVer >= 50000 then + _, _, _, anticipate = UnitAura("player", GetSpellInfo(AnticipationSpellId)) else anticipate = 0 end diff --git a/modules/ComboPointsBar.lua b/modules/ComboPointsBar.lua index b2d77b5..0b624b7 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints end @@ -70,14 +70,16 @@ function ComboPointsBar.prototype:Enable(core) ComboPointsBar.super.prototype.Enable(self, core) self:RegisterEvent("PLAYER_TARGET_CHANGED", "UpdateComboPoints") - if IceHUD.WowVer >= 30000 then - if IceHUD.WowVer < 70000 then + if IceHUD.WowVer >= 30000 or IceHUD.WowClassic then + if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then self:RegisterEvent("UNIT_COMBO_POINTS", "UpdateComboPoints") else self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateComboPoints") end - self:RegisterEvent("UNIT_ENTERED_VEHICLE", "UpdateComboPoints") - self:RegisterEvent("UNIT_EXITED_VEHICLE", "UpdateComboPoints") + if UnitHasVehicleUI then + self:RegisterEvent("UNIT_ENTERED_VEHICLE", "UpdateComboPoints") + self:RegisterEvent("UNIT_EXITED_VEHICLE", "UpdateComboPoints") + end else self:RegisterEvent("PLAYER_COMBO_POINTS", "UpdateComboPoints") end @@ -99,11 +101,11 @@ function ComboPointsBar.prototype:UpdateComboPoints(...) local points if IceHUD.IceCore:IsInConfigMode() then points = UnitPowerMax("player", SPELL_POWER_COMBO_POINTS) - elseif IceHUD.WowVer >= 30000 then + elseif IceHUD.WowVer >= 30000 or IceHUD.WowClassic then -- Parnic: apparently some fights have combo points while the player is in a vehicle? - local isInVehicle = UnitHasVehicleUI("player") + local isInVehicle = UnitHasVehicleUI and UnitHasVehicleUI("player") local checkUnit = isInVehicle and "vehicle" or "player" - if IceHUD.WowVer >= 60000 then + if IceHUD.WowVer >= 60000 or IceHUD.WowClassic then points = UnitPower(checkUnit, SPELL_POWER_COMBO_POINTS) else points = GetComboPoints(checkUnit, "target") diff --git a/modules/CustomBar.lua b/modules/CustomBar.lua index 7c0ac76..6a78143 100644 --- a/modules/CustomBar.lua +++ b/modules/CustomBar.lua @@ -36,10 +36,12 @@ function IceCustomBar.prototype:Enable(core) self:RegisterEvent("UNIT_AURA", "UpdateCustomBarEvent") self:RegisterEvent("UNIT_PET", "UpdateCustomBarEvent") - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then self:RegisterEvent("PLAYER_PET_CHANGED", "UpdateCustomBarEvent") end - self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomBarEvent") + if FocusUnit then + self:RegisterEvent("PLAYER_FOCUS_CHANGED", "UpdateCustomBarEvent") + end if self.unitClass == "SHAMAN" then self:RegisterEvent("PLAYER_TOTEM_UPDATE", "UpdateTotems") end @@ -665,7 +667,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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic 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) @@ -695,7 +697,7 @@ function IceCustomBar.prototype:GetAuraDuration(unitName, buffName) i = i + 1; - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic 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/FocusAbsorb.lua b/modules/FocusAbsorb.lua index 07a78f2..dd511e3 100644 --- a/modules/FocusAbsorb.lua +++ b/modules/FocusAbsorb.lua @@ -26,4 +26,6 @@ function FocusAbsorb.prototype:MyUnregisterCustomEvents() end -- Load us up -IceHUD.FocusAbsorb = FocusAbsorb:new() +if UnitGetTotalAbsorbs ~= nil then + IceHUD.FocusAbsorb = FocusAbsorb:new() +end diff --git a/modules/FocusCC.lua b/modules/FocusCC.lua index f02e160..39155a8 100644 --- a/modules/FocusCC.lua +++ b/modules/FocusCC.lua @@ -23,4 +23,6 @@ end -- 'Protected' methods -------------------------------------------------------- -- Load us up -IceHUD.FocusCC = FocusCC:new() +if FocusUnit then + IceHUD.FocusCC = FocusCC:new() +end diff --git a/modules/FocusCast.lua b/modules/FocusCast.lua index 5f825d7..bafaf68 100644 --- a/modules/FocusCast.lua +++ b/modules/FocusCast.lua @@ -1,6 +1,12 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local FocusCast = IceCore_CreateClass(IceCastBar) +local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo +if IceHUD.WowClassic then + UnitCastingInfo = CastingInfo + UnitChannelInfo = ChannelInfo +end + -- Constructor -- function FocusCast.prototype:init() FocusCast.super.prototype.init(self, "FocusCast") @@ -112,4 +118,6 @@ end -- Load us up -IceHUD.FocusCast = FocusCast:new() +if FocusUnit then + IceHUD.FocusCast = FocusCast:new() +end diff --git a/modules/FocusHealth.lua b/modules/FocusHealth.lua index 6c2e077..fb61007 100644 --- a/modules/FocusHealth.lua +++ b/modules/FocusHealth.lua @@ -471,4 +471,6 @@ function FocusHealth.prototype:HideBlizz() end -- Load us up -IceHUD.FocusHealth = FocusHealth:new() +if FocusUnit then + IceHUD.FocusHealth = FocusHealth:new() +end diff --git a/modules/FocusMana.lua b/modules/FocusMana.lua index dff3f8d..70d01f0 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_RAGE = Enum.PowerType.Rage SPELL_POWER_FOCUS = Enum.PowerType.Focus SPELL_POWER_ENERGY = Enum.PowerType.Energy @@ -136,4 +136,6 @@ end -- Load us up -IceHUD.FocusMana = FocusMana:new() +if FocusUnit then + IceHUD.FocusMana = FocusMana:new() +end diff --git a/modules/FocusThreat.lua b/modules/FocusThreat.lua index c308643..4a70a35 100644 --- a/modules/FocusThreat.lua +++ b/modules/FocusThreat.lua @@ -16,4 +16,6 @@ function IceFocusThreat.prototype:GetDefaultSettings() end -- Load us up -IceHUD.IceFocusThreat = IceFocusThreat:new() +if FocusUnit then + IceHUD.IceFocusThreat = IceFocusThreat:new() +end diff --git a/modules/HarmonyPower.lua b/modules/HarmonyPower.lua index 56c73f2..088969d 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_CHI = Enum.PowerType.Chi end diff --git a/modules/HolyPower.lua b/modules/HolyPower.lua index 5936bd3..58b3af9 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_HOLY_POWER = Enum.PowerType.HolyPower end diff --git a/modules/PetHealth.lua b/modules/PetHealth.lua index d944bc2..b1eff49 100644 --- a/modules/PetHealth.lua +++ b/modules/PetHealth.lua @@ -42,18 +42,20 @@ function PetHealth.prototype:Enable(core) PetHealth.super.prototype.Enable(self, core) self:RegisterEvent("PET_UI_UPDATE", "CheckPet"); - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet"); end - self:RegisterEvent(IceHUD.WowVer < 80000 and "PET_BAR_CHANGED" or "PET_BAR_UPDATE_USABLE", "CheckPet"); + self:RegisterEvent("PET_BAR_UPDATE_USABLE", "CheckPet"); self:RegisterEvent("UNIT_PET", "CheckPet"); self:RegisterEvent("UNIT_HEALTH", "UpdateEvent") self:RegisterEvent("UNIT_HEALTH_FREQUENT", "UpdateEvent") self:RegisterEvent("UNIT_MAXHEALTH", "UpdateEvent") - self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") - self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + if UnitHasVehicleUI then + self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") + self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + end self:RegisterEvent("PLAYER_ENTERING_WORLD", "EnteringWorld") self.frame:SetAttribute("unit", self.unit) @@ -223,10 +225,12 @@ end function PetHealth.prototype:EnteringWorld() self:Update(self.unit) - if UnitHasVehicleUI("player") then - self:EnteringVehicle(nil, "player", true) - else - self:ExitingVehicle(nil, "player") + if UnitHasVehicleUI then + if UnitHasVehicleUI("player") then + self:EnteringVehicle(nil, "player", true) + else + self:ExitingVehicle(nil, "player") + end end end diff --git a/modules/PetMana.lua b/modules/PetMana.lua index a8f4a07..939a1f3 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic 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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then self:RegisterEvent("PLAYER_PET_CHANGED", "CheckPet") end - self:RegisterEvent(IceHUD.WowVer < 80000 and "PET_BAR_CHANGED" or "PET_BAR_UPDATE_USABLE", "CheckPet") + self:RegisterEvent(IceHUD.WowVer < 80000 and not IceHUD.WowClassic and "PET_BAR_CHANGED" or "PET_BAR_UPDATE_USABLE", "CheckPet") self:RegisterEvent("UNIT_PET", "CheckPet") - if IceHUD.WowVer >= 40000 then + if IceHUD.WowVer >= 40000 or IceHUD.WowClassic then self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateEvent") - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent") end else @@ -86,8 +86,10 @@ function PetMana.prototype:Enable(core) self:RegisterEvent("UNIT_DISPLAYPOWER", "ManaType") - self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") - self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + if UnitHasVehicleUI then + self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") + self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + end self:RegisterEvent("PLAYER_ENTERING_WORLD", "EnteringWorld") self:CheckPet() @@ -242,10 +244,12 @@ end function PetMana.prototype:EnteringWorld() self:Update(self.unit) - if UnitHasVehicleUI("player") then - self:EnteringVehicle(nil, "player", true) - else - self:ExitingVehicle(nil, "player") + if UnitHasVehicleUI then + if UnitHasVehicleUI("player") then + self:EnteringVehicle(nil, "player", true) + else + self:ExitingVehicle(nil, "player") + end end end diff --git a/modules/PlayerAbsorb.lua b/modules/PlayerAbsorb.lua index 7c980f8..2c19ab1 100644 --- a/modules/PlayerAbsorb.lua +++ b/modules/PlayerAbsorb.lua @@ -19,4 +19,6 @@ function PlayerAbsorb.prototype:GetDefaultSettings() end -- Load us up -IceHUD.PlayerAbsorb = PlayerAbsorb:new() +if UnitGetTotalAbsorbs ~= nil then + IceHUD.PlayerAbsorb = PlayerAbsorb:new() +end diff --git a/modules/PlayerAltMana.lua b/modules/PlayerAltMana.lua index 320d472..7436107 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_MANA = Enum.PowerType.Mana SPELL_POWER_INSANITY = Enum.PowerType.Insanity end diff --git a/modules/PlayerAlternatePower.lua b/modules/PlayerAlternatePower.lua index d575c47..e86277d 100644 --- a/modules/PlayerAlternatePower.lua +++ b/modules/PlayerAlternatePower.lua @@ -132,4 +132,6 @@ function IceHUDPlayerAlternatePower.prototype:HideBlizz() end -- Load us up -IceHUD.PlayerAlternatePower = IceHUDPlayerAlternatePower:new() +if ALTERNATE_POWER_INDEX then + IceHUD.PlayerAlternatePower = IceHUDPlayerAlternatePower:new() +end diff --git a/modules/PlayerHealth.lua b/modules/PlayerHealth.lua index a8335da..6eeaa95 100644 --- a/modules/PlayerHealth.lua +++ b/modules/PlayerHealth.lua @@ -79,14 +79,16 @@ function PlayerHealth.prototype:Enable(core) self:RegisterEvent("PLAYER_REGEN_DISABLED", "CheckCombat") self:RegisterEvent("PARTY_LEADER_CHANGED", "CheckLeader") - if IceHUD.WowVer >= 50000 then + if IceHUD.WowVer >= 50000 or IceHUD.WowClassic then self:RegisterEvent("GROUP_ROSTER_UPDATE", "CheckLeader") else self:RegisterEvent("PARTY_MEMBERS_CHANGED", "CheckLeader") end - self:RegisterEvent("LFG_PROPOSAL_UPDATE", "CheckPartyRole") - self:RegisterEvent("LFG_PROPOSAL_FAILED", "CheckPartyRole") - self:RegisterEvent("LFG_ROLE_UPDATE", "CheckPartyRole") + if GetLFGProposal then + self:RegisterEvent("LFG_PROPOSAL_UPDATE", "CheckPartyRole") + self:RegisterEvent("LFG_PROPOSAL_FAILED", "CheckPartyRole") + self:RegisterEvent("LFG_ROLE_UPDATE", "CheckPartyRole") + end --self:RegisterEvent("PARTY_MEMBERS_CHANGED", "CheckPartyFrameStatus") @@ -96,8 +98,10 @@ function PlayerHealth.prototype:Enable(core) self:RegisterEvent("PLAYER_FLAGS_CHANGED", "CheckPvP") self:RegisterEvent("UNIT_FACTION", "CheckPvP") - self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") - self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + if UnitHasVehicleUI then + self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") + self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + end if IceHUD.WowVer < 40000 then HealComm = LibStub("LibHealComm-4.0", true) @@ -112,7 +116,9 @@ function PlayerHealth.prototype:Enable(core) self:RegisterEvent("UNIT_HEAL_PREDICTION", "IncomingHealPrediction") end - self:RegisterEvent("UNIT_ABSORB_AMOUNT_CHANGED", "UpdateAbsorbAmount") + if UnitGetTotalAbsorbs then + self:RegisterEvent("UNIT_ABSORB_AMOUNT_CHANGED", "UpdateAbsorbAmount") + end if (self.moduleSettings.hideBlizz) then self:HideBlizz() @@ -995,10 +1001,12 @@ function PlayerHealth.prototype:EnteringWorld() end function PlayerHealth.prototype:CheckVehicle() - if UnitHasVehicleUI("player") then - self:EnteringVehicle(nil, "player", true) - else - self:ExitingVehicle(nil, "player") + if UnitHasVehicleUI then + if UnitHasVehicleUI("player") then + self:EnteringVehicle(nil, "player", true) + else + self:ExitingVehicle(nil, "player") + end end end @@ -1161,7 +1169,7 @@ end function PlayerHealth.prototype:CheckLeader() local isLeader - if IceHUD.WowVer >= 50000 then + if UnitIsGroupLeader then isLeader = UnitIsGroupLeader("player") else isLeader = IsPartyLeader() diff --git a/modules/PlayerMana.lua b/modules/PlayerMana.lua index 4c5130f..d1aaad8 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic 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 then + if IceHUD.WowVer >= 40000 or IceHUD.WowClassic then self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateEvent") - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent") end else @@ -170,8 +170,10 @@ function PlayerMana.prototype:Enable(core) self:RegisterEvent("UNIT_RUNIC_POWER", "UpdateEvent") end - self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") - self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + if UnitHasVehicleUI then + self:RegisterEvent("UNIT_ENTERED_VEHICLE", "EnteringVehicle") + self:RegisterEvent("UNIT_EXITED_VEHICLE", "ExitingVehicle") + end self:RegisterEvent("PLAYER_ENTERING_WORLD", "EnteringWorld") if not self.CustomOnUpdate then @@ -191,10 +193,12 @@ function PlayerMana.prototype:EnteringWorld() end function PlayerMana.prototype:CheckVehicle() - if UnitHasVehicleUI("player") then - self:EnteringVehicle(nil, "player", true) - else - self:ExitingVehicle(nil, "player") + if UnitHasVehicleUI then + if UnitHasVehicleUI("player") then + self:EnteringVehicle(nil, "player", true) + else + self:ExitingVehicle(nil, "player") + end end end diff --git a/modules/Resolve.lua b/modules/Resolve.lua index 6ddae67..ad903e1 100644 --- a/modules/Resolve.lua +++ b/modules/Resolve.lua @@ -56,7 +56,7 @@ do return end - self.current = select(IceHUD.WowVer < 80000 and 15 or 14, UnitAura(self.unit, spellName)) or 0 + self.current = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 15 or 14, UnitAura(self.unit, spellName)) or 0 self:Update() end diff --git a/modules/RollTheBones.lua b/modules/RollTheBones.lua index 680c93c..2538cc8 100644 --- a/modules/RollTheBones.lua +++ b/modules/RollTheBones.lua @@ -20,7 +20,7 @@ for _, v in ipairs(RtBBuffs) do end local SPELL_POWER_COMBO_POINTS = SPELL_POWER_COMBO_POINTS -if IceHUD.WowVer >= 80000 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_COMBO_POINTS = Enum.PowerType.ComboPoints end diff --git a/modules/Runes.lua b/modules/Runes.lua index ff57aae..020a56c 100644 --- a/modules/Runes.lua +++ b/modules/Runes.lua @@ -4,7 +4,7 @@ local Runes = IceCore_CreateClass(IceElement) local IceHUD = _G.IceHUD local CooldownFrame_SetTimer = CooldownFrame_SetTimer -if IceHUD.WowVer >= 70000 then +if CooldownFrame_Set then CooldownFrame_SetTimer = CooldownFrame_Set end @@ -44,7 +44,7 @@ Runes.prototype.numRunes = 6 Runes.prototype.lastRuneState = {} local SPELL_POWER_RUNES = SPELL_POWER_RUNES -if IceHUD.WowVer >= 80000 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_RUNES = Enum.PowerType.Runes end diff --git a/modules/Shards.lua b/modules/Shards.lua index a761451..f0135bc 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic then SPELL_POWER_SOUL_SHARDS = Enum.PowerType.SoulShards end diff --git a/modules/SliceAndDice.lua b/modules/SliceAndDice.lua index 264b77e..ad95273 100644 --- a/modules/SliceAndDice.lua +++ b/modules/SliceAndDice.lua @@ -28,6 +28,11 @@ if IceHUD.WowVer >= 50000 then baseTime = 12 gapPerComboPoint = 6 end +if IceHUD.WowClassic then + impSndBonusPerRank = 0.15 + impSndTalentPage = 1 + impSndTalentIdx = 6 +end local SPELL_POWER_COMBO_POINTS = SPELL_POWER_COMBO_POINTS if IceHUD.WowVer >= 80000 then @@ -55,7 +60,7 @@ function SliceAndDice.prototype:Enable(core) SliceAndDice.super.prototype.Enable(self, core) self:RegisterEvent("UNIT_AURA", "UpdateSliceAndDice") - if IceHUD.WowVer < 70000 then + if IceHUD.WowVer < 70000 and not IceHUD.WowClassic then self:RegisterEvent("UNIT_COMBO_POINTS", "ComboPointsChanged") else self:RegisterEvent(IceHUD.UnitPowerEvent, "ComboPointsChanged") @@ -211,7 +216,7 @@ end function SliceAndDice.prototype:GetBuffDuration(unitName, buffName) local i = 1 local buff, _, texture, duration, endTime, remaining - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then buff, _, texture, _, _, duration, endTime = UnitBuff(unitName, i) else buff, texture, _, _, duration, endTime = UnitBuff(unitName, i) @@ -227,7 +232,7 @@ function SliceAndDice.prototype:GetBuffDuration(unitName, buffName) i = i + 1; - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then buff, _, texture, _, _, duration, endTime = UnitBuff(unitName, i) else buff, texture, _, _, duration, endTime = UnitBuff(unitName, i) @@ -248,7 +253,7 @@ function SliceAndDice.prototype:MyOnUpdate() end local function SNDGetComboPoints(unit) - if IceHUD.WowVer >= 60000 then + if IceHUD.WowVer >= 60000 or IceHUD.WowClassic then return UnitPower(unit, SPELL_POWER_COMBO_POINTS) elseif IceHUD.WowVer >= 30000 then return GetComboPoints(unit, "target") @@ -280,7 +285,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 "Ability_Rogue_SliceDice" or 132306) + sndDuration, remaining = self:GetBuffDuration(self.unit, (IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and "Ability_Rogue_SliceDice" or 132306) if not remaining then sndEndTime = 0 @@ -404,8 +409,10 @@ function SliceAndDice.prototype:GetMaxBuffTime(numComboPoints) end local rank = 0 - local _ - _, _, _, _, rank = GetTalentInfo(impSndTalentPage, impSndTalentIdx) + if GetTalentInfo then + local _ + _, _, _, _, rank = GetTalentInfo(impSndTalentPage, impSndTalentIdx) + end maxduration = maxduration * (1 + (rank * impSndBonusPerRank)) end @@ -466,6 +473,9 @@ function SliceAndDice.prototype:HasNineTailedBonus() end function SliceAndDice.prototype:HasGlyphBonus() + if not GetNumGlyphSockets then + return false + end for i=1,GetNumGlyphSockets() do local enabled, _, _, spell = GetGlyphSocketInfo(i) diff --git a/modules/Stagger.lua b/modules/Stagger.lua index b7779f1..13037e4 100644 --- a/modules/Stagger.lua +++ b/modules/Stagger.lua @@ -189,8 +189,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 6 or 5, UnitAura(self.unit, spellName, "", "HARMFUL")) - amount = select(IceHUD.WowVer < 80000 and 15 or 14, UnitAura(self.unit, spellName, "", "HARMFUL")) + 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")) staggerLevel = (debuffID == LightID) and 1 or (debuffID == ModerateID) and 2 or 3 break diff --git a/modules/TargetCC.lua b/modules/TargetCC.lua index e0c616c..860f2d1 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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic 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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic 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 4f13283..5dd2431 100644 --- a/modules/TargetCast.lua +++ b/modules/TargetCast.lua @@ -3,6 +3,12 @@ local TargetCast = IceCore_CreateClass(IceCastBar) TargetCast.prototype.notInterruptible = false +local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo +if IceHUD.WowClassic then + UnitCastingInfo = CastingInfo + UnitChannelInfo = ChannelInfo +end + -- Constructor -- function TargetCast.prototype:init() TargetCast.super.prototype.init(self, "TargetCast") @@ -15,8 +21,10 @@ end function TargetCast.prototype:Enable(core) TargetCast.super.prototype.Enable(self, core) - self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", "SpellCastInterruptible") - self:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "SpellCastNotInterruptible") + if IceHUD.WowVer >= 30200 then + self:RegisterEvent("UNIT_SPELLCAST_INTERRUPTIBLE", "SpellCastInterruptible") + self:RegisterEvent("UNIT_SPELLCAST_NOT_INTERRUPTIBLE", "SpellCastNotInterruptible") + end end @@ -83,7 +91,7 @@ function TargetCast.prototype:TargetChanged(unit) end local spell = UnitCastingInfo(self.unit) - local notInterruptible = select(IceHUD.WowVer < 80000 and 9 or 8, UnitCastingInfo(self.unit)) + local notInterruptible = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 9 or 8, UnitCastingInfo(self.unit)) if spell then self.notInterruptible = notInterruptibleCast self:StartBar(IceCastBar.Actions.Cast) @@ -91,7 +99,7 @@ function TargetCast.prototype:TargetChanged(unit) end local channel = UnitChannelInfo(self.unit) - notInterruptible = select(IceHUD.WowVer < 80000 and 8 or 7, UnitChannelInfo(self.unit)) + notInterruptible = select((IceHUD.WowVer < 80000 and not IceHUD.WowClassic) and 8 or 7, UnitChannelInfo(self.unit)) if channel then self.notInterruptible = notInterruptibleChannel self:StartBar(IceCastBar.Actions.Channel) diff --git a/modules/TargetHealth.lua b/modules/TargetHealth.lua index f19c811..367b1b0 100644 --- a/modules/TargetHealth.lua +++ b/modules/TargetHealth.lua @@ -637,9 +637,11 @@ function IceTargetHealth.prototype:Enable(core) self:RegisterEvent("UPDATE_FACTION", "CheckPvP") self:RegisterEvent("PLAYER_FLAGS_CHANGED", "CheckPvP") self:RegisterEvent("UNIT_FACTION", "CheckPvP") - self:RegisterEvent("LFG_PROPOSAL_UPDATE", "CheckPartyRole") - self:RegisterEvent("LFG_PROPOSAL_FAILED", "CheckPartyRole") - self:RegisterEvent("LFG_ROLE_UPDATE", "CheckPartyRole") + if GetLFGRoles then + self:RegisterEvent("LFG_PROPOSAL_UPDATE", "CheckPartyRole") + self:RegisterEvent("LFG_PROPOSAL_FAILED", "CheckPartyRole") + self:RegisterEvent("LFG_ROLE_UPDATE", "CheckPartyRole") + end end if (self.moduleSettings.hideBlizz) then diff --git a/modules/TargetInfo.lua b/modules/TargetInfo.lua index c359a1f..afa7e99 100644 --- a/modules/TargetInfo.lua +++ b/modules/TargetInfo.lua @@ -2,7 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) IceTargetInfo = IceCore_CreateClass(IceElement) local CooldownFrame_SetTimer = CooldownFrame_SetTimer -if IceHUD.WowVer >= 70000 then +if CooldownFrame_Set then CooldownFrame_SetTimer = CooldownFrame_Set end @@ -129,7 +129,7 @@ function IceTargetInfo.prototype:Enable(core) self:RegisterEvent("UNIT_LEVEL", "TargetLevel") self:RegisterEvent("UNIT_FLAGS", "TargetFlags") - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then self:RegisterEvent("UNIT_DYNAMIC_FLAGS", "TargetFlags") end @@ -1410,7 +1410,7 @@ function IceTargetInfo.prototype:UpdateBuffType(aura) if self.moduleSettings.auras[aura].show then for i = 1, IceCore.BuffLimit do local name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then name, rank, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(self.unit, i, reaction .. (filter and "|PLAYER" or "")) else name, icon, count, debuffType, duration, expirationTime, unitCaster, isStealable = UnitAura(self.unit, i, reaction .. (filter and "|PLAYER" or "")) @@ -1584,7 +1584,7 @@ function IceTargetInfo.prototype:TargetName(event, unit) end - if IceHUD.WowVer < 50000 then + if UnitIsPartyLeader then self.leader = UnitIsPartyLeader(self.unit) and " |cffcccc11Leader|r" or "" else self.leader = UnitIsGroupLeader(self.unit) and " |cffcccc11Leader|r" or "" @@ -1655,7 +1655,7 @@ end function IceTargetInfo.prototype:TargetFlags(event, unit) if (unit == self.unit or unit == internal) then - if IceHUD.WowVer < 70000 then + if UnitIsTapped then self.tapped = UnitIsTapped(self.unit) and (not UnitIsTappedByPlayer(self.unit)) else self.tapped = UnitIsTapDenied(self.unit) diff --git a/modules/TargetInvuln.lua b/modules/TargetInvuln.lua index 53242df..135a245 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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic 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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic 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 d735edb..8b827c2 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 then +if IceHUD.WowVer >= 80000 or IceHUD.WowClassic 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 then + if IceHUD.WowVer >= 40000 or IceHUD.WowClassic then self:RegisterEvent(IceHUD.UnitPowerEvent, "UpdateEvent") - if IceHUD.WowVer < 80000 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then self:RegisterEvent("UNIT_MAXPOWER", "UpdateEvent") end else diff --git a/modules/TargetOfTarget.lua b/modules/TargetOfTarget.lua index 34a1d1c..0abec91 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 then + if IceHUD.WowVer < 80000 and not IceHUD.WowClassic then buffName, buffRank, buffTexture, buffApplications = UnitDebuff(self.unit, i) else buffName, buffTexture, buffApplications = UnitDebuff(self.unit, i) diff --git a/modules/TargetOfTargetCast.lua b/modules/TargetOfTargetCast.lua index 1b04299..e0c1dc7 100644 --- a/modules/TargetOfTargetCast.lua +++ b/modules/TargetOfTargetCast.lua @@ -4,6 +4,12 @@ TargetTargetCast.prototype.scheduledEvent = nil local SelfDisplayModeOptions = {"Hide", "Normal"} +local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo +if IceHUD.WowClassic then + UnitCastingInfo = CastingInfo + UnitChannelInfo = ChannelInfo +end + -- Constructor -- function TargetTargetCast.prototype:init() TargetTargetCast.super.prototype.init(self, "TargetTargetCast") diff --git a/modules/Threat.lua b/modules/Threat.lua index 742f0c4..703956b 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 then +if IceHUD.WowVer >= 50000 or IceHUD.WowClassic then GetNumPartyMembers = GetNumGroupMembers GetNumRaidMembers = GetNumGroupMembers MAX_NUM_PARTY_MEMBERS = MAX_PARTY_MEMBERS @@ -468,4 +468,6 @@ function IceThreat.prototype:Show(bShouldShow) end -- Load us up -IceHUD.IceThreat = IceThreat:new() +if UnitDetailedThreatSituation then + IceHUD.IceThreat = IceThreat:new() +end diff --git a/modules/Totems.lua b/modules/Totems.lua index ba365e3..1938839 100644 --- a/modules/Totems.lua +++ b/modules/Totems.lua @@ -2,7 +2,7 @@ local L = LibStub("AceLocale-3.0"):GetLocale("IceHUD", false) local Totems = IceCore_CreateClass(IceElement) local CooldownFrame_SetTimer = CooldownFrame_SetTimer -if IceHUD.WowVer >= 70000 then +if CooldownFrame_Set then CooldownFrame_SetTimer = CooldownFrame_Set end @@ -247,6 +247,7 @@ function Totems.prototype:UpdateTotem(event, totem, ...) CooldownFrame_SetTimer(self.frame.graphical[totem].cd, startTime, duration, true) self.frame.graphical[totem].cd:Show() self.frame.graphical[totem]:Show() + self.frame.graphical[totem].name = name else self.frame.graphical[totem].cd:Hide() self.frame.graphical[totem]:Hide() @@ -293,14 +294,18 @@ function Totems.prototype:GetAlphaAdd() end function Totems.prototype:ShowBlizz() - TotemFrame:Show() - TotemFrame:GetScript("OnLoad")(TotemFrame) + if TotemFrame then + TotemFrame:Show() + TotemFrame:GetScript("OnLoad")(TotemFrame) + end end function Totems.prototype:HideBlizz() - TotemFrame:Hide() - TotemFrame:UnregisterAllEvents() + if TotemFrame then + TotemFrame:Hide() + TotemFrame:UnregisterAllEvents() + end end function Totems.prototype:TargetChanged() @@ -354,7 +359,14 @@ function Totems.prototype:CreateTotem(i, name) end if not self.graphicalOnEnter then - self.graphicalOnEnter = function(button) GameTooltip:SetOwner(button); GameTooltip:SetTotem(button.slot) end + self.graphicalOnEnter = function(button) + GameTooltip:SetOwner(button) + if IceHUD.WowClassic then + GameTooltip:SetText(button.name) + else + GameTooltip:SetTotem(button.slot) + end + end end if not self.graphicalOnLeave then self.graphicalOnLeave = function() GameTooltip:Hide() end @@ -396,6 +408,7 @@ function Totems.prototype:CreateTotem(i, name) self.frame.graphical[i]:SetScript("OnLeave", nil) end self.frame.graphical[i].slot = i + self.frame.graphical[i].name = name -- it looks like HookScript will continue to add handlers every time instead of replacing them like SetScript if (bWasNewFrame) then