Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion ShadowedUnitFrames.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@

ShadowUF = select(2, ...)

-- MoP 5.5.4 compat: DebuffTypeColor was replaced by individual globals
-- (DEBUFF_TYPE_MAGIC_COLOR etc.). Rebuild the table from those if present,
-- falling back to the classic WoW defaults so debuff border colours remain
-- correct without hardcoding values that could differ per locale/patch.
if not DebuffTypeColor then
DebuffTypeColor = {
["Magic"] = DEBUFF_TYPE_MAGIC_COLOR or {r = 0.20, g = 0.60, b = 1.00},
["Curse"] = DEBUFF_TYPE_CURSE_COLOR or {r = 0.60, g = 0.00, b = 1.00},
["Disease"] = DEBUFF_TYPE_DISEASE_COLOR or {r = 0.60, g = 0.40, b = 0.00},
["Poison"] = DEBUFF_TYPE_POISON_COLOR or {r = 0.00, g = 0.60, b = 0.00},
["none"] = DEBUFF_TYPE_NONE_COLOR or {r = 0.80, g = 0.00, b = 0.00},
[""] = DEBUFF_TYPE_NONE_COLOR or {r = 0.80, g = 0.00, b = 0.00},
}
end

local L = ShadowUF.L
ShadowUF.dbRevision = 63
ShadowUF.playerUnit = "player"
Expand Down Expand Up @@ -680,6 +695,7 @@ end
local function basicHideBlizzardFrames(...)
for i=1, select("#", ...) do
local frame = select(i, ...)
if not frame then break end
frame:UnregisterAllEvents()
frame:HookScript("OnShow", rehideFrame)
frame:Hide()
Expand All @@ -689,6 +705,7 @@ end
local function hideBlizzardFrames(taint, ...)
for i=1, select("#", ...) do
local frame = select(i, ...)
if not frame then break end
UnregisterUnitWatch(frame)
frame:UnregisterAllEvents()
frame:Hide()
Expand All @@ -709,8 +726,10 @@ end

local active_hiddens = {}
function ShadowUF:HideBlizzardFrames()
if not self.db then return end
if( self.db.profile.hidden.cast and not active_hiddens.cast ) then
hideBlizzardFrames(true, PlayerCastingBarFrame, PetCastingBarFrame)
-- MoP 5.5.x uses CastingBarFrame; newer builds renamed it PlayerCastingBarFrame
hideBlizzardFrames(true, PlayerCastingBarFrame or CastingBarFrame, PetCastingBarFrame)
end

if( self.db.profile.hidden.party and not active_hiddens.party ) then
Expand Down
6 changes: 3 additions & 3 deletions modules/auras.lua
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ local function renderAura(parent, frame, type, config, displayConfig, index, fil
if( isRemovable and not isFriendly and not ShadowUF.db.profile.auras.disableColor ) then
button.border:SetVertexColor(ShadowUF.db.profile.auraColors.removable.r, ShadowUF.db.profile.auraColors.removable.g, ShadowUF.db.profile.auraColors.removable.b)
elseif( ( not isFriendly or type == "debuffs" ) and not ShadowUF.db.profile.auras.disableColor ) then
local color = auraType and DebuffTypeColor[auraType] or DebuffTypeColor.none
local color = (auraType and DebuffTypeColor[auraType]) or DebuffTypeColor.none or DebuffTypeColor[""]
button.border:SetVertexColor(color.r, color.g, color.b)
else
button.border:SetVertexColor(0.60, 0.60, 0.60)
Expand Down Expand Up @@ -655,12 +655,12 @@ function Auras:Update(frame)
scan(frame.auras, frame.auras.anchor, frame.auras.primary, config[frame.auras.primary], config[frame.auras.primary], frame.auras[frame.auras.primary].filter)
scan(frame.auras, frame.auras.anchor, frame.auras.secondary, config[frame.auras.secondary], config[frame.auras.primary], frame.auras[frame.auras.secondary].filter)
else
if( config.buffs.enabled ) then
if( config.buffs.enabled and frame.auras.buffs ) then
frame.auras.buffs.totalAuras = frame.auras.buffs.temporaryEnchants
scan(frame.auras, frame.auras.buffs, "buffs", config.buffs, config.buffs, frame.auras.buffs.filter)
end

if( config.debuffs.enabled ) then
if( config.debuffs.enabled and frame.auras.debuffs ) then
frame.auras.debuffs.totalAuras = 0
scan(frame.auras, frame.auras.debuffs, "debuffs", config.debuffs, config.debuffs, frame.auras.debuffs.filter)
end
Expand Down
12 changes: 7 additions & 5 deletions modules/basecombopoints.lua
Original file line number Diff line number Diff line change
Expand Up @@ -184,11 +184,13 @@ function Combo:Update(frame, event, unit, powerType)
ShadowUF.Layout:SetBarVisibility(frame, key, ShadowUF.db.profile.units[frame.unitType][key].showAlways or (points and points > 0))
end

for id, pointTexture in pairs(frame[key].points) do
if( id <= points ) then
pointTexture:Show()
else
pointTexture:Hide()
if frame[key].points then
for id, pointTexture in pairs(frame[key].points) do
if( id <= points ) then
pointTexture:Show()
else
pointTexture:Hide()
end
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions modules/defaultlayout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,10 @@ function ShadowUF:LoadDefaultLayout(useMerge)
FOCUS = {r = 1.0, g = 0.50, b = 0.25},
ENERGY = {r = 1.0, g = 0.85, b = 0.10},
RUNES = {r = 0.50, g = 0.50, b = 0.50},
RUNES_BLOOD = {r = 0.95, g = 0.0, b = 0.08},
RUNES_FROST = {r = 0.0, g = 0.85, b = 1.0},
RUNES_UNHOLY = {r = 0.0, g = 1.0, b = 0.35},
RUNES_DEATH = {r = 0.69, g = 0.15, b = 1.0},
RUNIC_POWER = {b = 0.60, g = 0.45, r = 0.35},
AMMOSLOT = {r = 0.85, g = 0.60, b = 0.55},
FUEL = {r = 0.85, g = 0.47, b = 0.36},
Expand Down
14 changes: 12 additions & 2 deletions modules/incheal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,19 @@ function IncHeal:OnLayoutApplied(frame)
bar.total = nil

bar:SetSize(frame.healthBar:GetSize())
bar:SetStatusBarTexture(ShadowUF.Layout.mediaPath.statusbar)

local statusbar = ShadowUF.Layout.mediaPath.statusbar
if statusbar and statusbar ~= "" then
bar:SetStatusBarTexture(statusbar)
end

bar:SetStatusBarColor(ShadowUF.db.profile.healthColors[self.colorKey].r, ShadowUF.db.profile.healthColors[self.colorKey].g, ShadowUF.db.profile.healthColors[self.colorKey].b, ShadowUF.db.profile.bars.alpha)
bar:GetStatusBarTexture():SetHorizTile(false)

local statusBarTexture = bar:GetStatusBarTexture()
if statusBarTexture then
statusBarTexture:SetHorizTile(false)
end

bar:SetOrientation(frame.healthBar:GetOrientation())
bar:SetReverseFill(frame.healthBar:GetReverseFill())
bar:Hide()
Expand Down
30 changes: 21 additions & 9 deletions modules/indicators.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ ShadowUF:RegisterModule(Indicators, "indicators", ShadowUF.L["Indicators"])
function Indicators:UpdateArenaSpec(frame)
if( not frame.indicators.arenaSpec or not frame.indicators.arenaSpec.enabled ) then return end

local specID = GetArenaOpponentSpec(frame.unitID)
local specIcon = specID and select(4, GetSpecializationInfoByID(specID))
local specID = GetArenaOpponentSpec and GetArenaOpponentSpec(frame.unitID)
local specIcon = specID and GetSpecializationInfoByID and select(4, GetSpecializationInfoByID(specID))
if( specIcon ) then
frame.indicators.arenaSpec:SetTexture(specIcon)
frame.indicators.arenaSpec:Show()
Expand Down Expand Up @@ -112,7 +112,7 @@ end
function Indicators:UpdateQuestBoss(frame)
if( not frame.indicators.questBoss or not frame.indicators.questBoss.enabled ) then return end

if( UnitIsQuestBoss(frame.unit) ) then
if( UnitIsQuestBoss and UnitIsQuestBoss(frame.unit) ) then
frame.indicators.questBoss:Show()
else
frame.indicators.questBoss:Hide()
Expand All @@ -126,8 +126,8 @@ function Indicators:UpdateLFDRole(frame, event)
if( frame.unitType ~= "arena" ) then
role = UnitGroupRolesAssigned(frame.unitOwner)
else
local specID = GetArenaOpponentSpec(frame.unitID)
role = specID and select(6, GetSpecializationInfoByID(specID))
local specID = GetArenaOpponentSpec and GetArenaOpponentSpec(frame.unitID)
role = specID and GetSpecializationInfoByID and select(6, GetSpecializationInfoByID(specID))
end

if( role == "TANK" ) then
Expand Down Expand Up @@ -250,6 +250,18 @@ function Indicators:UpdateStatus(frame)
end
end

-- MoP 5.5.4 compat: READY_CHECK_*_TEXTURE may be plain texture paths instead of
-- atlas names depending on the client, so fall back to SetTexture if the atlas
-- doesn't actually exist.
local function setReadyCheckTexture(texture, atlas)
if( atlas and C_Texture and C_Texture.GetAtlasInfo and C_Texture.GetAtlasInfo(atlas) ) then
texture:SetAtlas(atlas, TextureKitConstants and TextureKitConstants.IgnoreAtlasSize)
elseif( atlas ) then
texture:SetTexCoord(0, 1, 0, 1)
texture:SetTexture(atlas)
end
end

local FADEOUT_TIME = 6
function Indicators:UpdateReadyCheck(frame, event)
if( not frame.indicators.ready or not frame.indicators.ready.enabled ) then return end
Expand Down Expand Up @@ -288,7 +300,7 @@ function Indicators:UpdateReadyCheck(frame, event)

-- Player never responded so they are AFK
if( frame.indicators.ready.status == "waiting" ) then
frame.indicators.ready:SetAtlas(READY_CHECK_NOT_READY_TEXTURE, TextureKitConstants.IgnoreAtlasSize)
setReadyCheckTexture(frame.indicators.ready, READY_CHECK_NOT_READY_TEXTURE)
end
return
end
Expand All @@ -302,11 +314,11 @@ function Indicators:UpdateReadyCheck(frame, event)
end

if( status == "ready" ) then
frame.indicators.ready:SetAtlas(READY_CHECK_READY_TEXTURE, TextureKitConstants.IgnoreAtlasSize)
setReadyCheckTexture(frame.indicators.ready, READY_CHECK_READY_TEXTURE)
elseif( status == "notready" ) then
frame.indicators.ready:SetAtlas(READY_CHECK_NOT_READY_TEXTURE, TextureKitConstants.IgnoreAtlasSize)
setReadyCheckTexture(frame.indicators.ready, READY_CHECK_NOT_READY_TEXTURE)
elseif( status == "waiting" ) then
frame.indicators.ready:SetAtlas(READY_CHECK_WAITING_TEXTURE, TextureKitConstants.IgnoreAtlasSize)
setReadyCheckTexture(frame.indicators.ready, READY_CHECK_WAITING_TEXTURE)
end

frame.indicators:SetScript("OnUpdate", nil)
Expand Down
10 changes: 8 additions & 2 deletions modules/layout.lua
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,14 @@ function Layout:SetupBars(frame, config)
end

if( ( widget:IsShown() or ( not frame[key].visibilityManaged and module.defaultVisibility == false ) ) and widget.SetStatusBarTexture ) then
widget:SetStatusBarTexture(mediaPath.statusbar)
widget:GetStatusBarTexture():SetHorizTile(false)
if mediaPath.statusbar and mediaPath.statusbar ~= "" then
widget:SetStatusBarTexture(mediaPath.statusbar)
end

local statusBarTexture = widget:GetStatusBarTexture()
if statusBarTexture then
statusBarTexture:SetHorizTile(false)
end

widget:SetOrientation(config[key].vertical and "VERTICAL" or "HORIZONTAL")
widget:SetReverseFill(config[key].reverse and true or false)
Expand Down
6 changes: 4 additions & 2 deletions modules/monkstagger.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ function Stagger:Update(frame)

-- Figure out how screwed they are
local percent = stagger / frame.staggerBar.maxHealth
local yellowThreshold = STAGGER_STATES and STAGGER_STATES.YELLOW.threshold or STAGGER_YELLOW_TRANSITION or 0.3
local redThreshold = STAGGER_STATES and STAGGER_STATES.RED.threshold or STAGGER_RED_TRANSITION or 0.6
local state
if( percent < STAGGER_STATES.YELLOW.threshold ) then
if( percent < yellowThreshold ) then
state = "STAGGER_GREEN"
elseif( percent < STAGGER_STATES.RED.threshold ) then
elseif( percent < redThreshold ) then
state = "STAGGER_YELLOW"
else
state = "STAGGER_RED"
Expand Down
43 changes: 40 additions & 3 deletions modules/runes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ function Runes:OnEnable(frame)
end

frame:RegisterNormalEvent("RUNE_POWER_UPDATE", self, "UpdateUsable")
frame:RegisterNormalEvent("RUNE_TYPE_UPDATE", self, "UpdateType")
frame:RegisterUpdateFunc(self, "UpdateUsable")
end

Expand All @@ -47,11 +48,16 @@ function Runes:OnLayoutApplied(frame)
rune.background:SetTexture(ShadowUF.Layout.mediaPath.statusbar)
rune.background:SetHorizTile(false)
rune:SetStatusBarTexture(ShadowUF.Layout.mediaPath.statusbar)
rune:GetStatusBarTexture():SetHorizTile(false)

local statusBarTexture = rune:GetStatusBarTexture()
if statusBarTexture then
statusBarTexture:SetHorizTile(false)
end

rune:SetWidth(barWidth)

local color = ShadowUF.db.profile.powerColors.RUNES
frame:SetBlockColor(rune, "runeBar", color.r, color.g, color.b)
frame:SetBlockColor(rune, "runeBar", 0.5, 0.5, 0.5)
self:UpdateType(frame, "RUNE_TYPE_UPDATE", id)
end
end

Expand Down Expand Up @@ -99,4 +105,35 @@ function Runes:UpdateUsable(frame, event, id, usable)
if( rune.fontString ) then
rune.fontString:UpdateTags()
end

self:UpdateType(frame, event, id)
end

-- Colorize a rune based off its current rune type (Blood/Frost/Unholy/Death)
function Runes:UpdateType(frame, event, id, ...)
if( not id or not frame.runeBar.runes[id] ) then
return
end

local rune = frame.runeBar.runes[id]

local runeType = GetRuneType(id)
local color
-- RUNETYPE_BLOOD
if( runeType == 1 ) then
color = ShadowUF.db.profile.powerColors.RUNES_BLOOD
-- RUNETYPE_UNHOLY ("CHROMATIC")
elseif( runeType == 2 ) then
color = ShadowUF.db.profile.powerColors.RUNES_UNHOLY
-- RUNETYPE_FROST
elseif( runeType == 3 ) then
color = ShadowUF.db.profile.powerColors.RUNES_FROST
-- RUNETYPE_DEATH
elseif( runeType == 4 ) then
color = ShadowUF.db.profile.powerColors.RUNES_DEATH
end

if( color ) then
frame:SetBlockColor(rune, "runeBar", color.r, color.g, color.b)
end
end
15 changes: 9 additions & 6 deletions modules/soulshards.lua
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
if( not ShadowUF.ComboPoints ) then return end

-- MoP 5.5.4 compat: GetSpec() may not exist in this build
local function GetSpec() return GetSpecialization and GetSpecialization() or 1 end

local Souls = setmetatable({}, {__index = ShadowUF.ComboPoints})
ShadowUF:RegisterModule(Souls, "soulShards", ShadowUF.L["Soul Shards"], nil, "WARLOCK")
local soulsConfig = {max = 5, key = "soulShards", colorKey = "SOULSHARDS", powerType = Enum.PowerType.SoulShards, eventType = "SOUL_SHARDS", icon = "Interface\\AddOns\\ShadowedUnitFrames\\media\\textures\\shard"}

function Souls:OnEnable(frame)
frame.soulShards = frame.soulShards or CreateFrame("Frame", nil, frame)
frame.soulShards.cpConfig = soulsConfig
frame.soulShards.cpConfig.max = (GetSpecialization() == SPEC_WARLOCK_DESTRUCTION) and 50 or 5
frame.soulShards.cpConfig.grouping = (GetSpecialization() == SPEC_WARLOCK_DESTRUCTION) and UnitPowerDisplayMod(soulsConfig.powerType) or 1
frame.soulShards.cpConfig.max = (GetSpec() == SPEC_WARLOCK_DESTRUCTION) and 50 or 5
frame.soulShards.cpConfig.grouping = (GetSpec() == SPEC_WARLOCK_DESTRUCTION) and UnitPowerDisplayMod(soulsConfig.powerType) or 1
frame.comboPointType = soulsConfig.key

frame:RegisterUnitEvent("UNIT_POWER_FREQUENT", self, "Update")
Expand All @@ -28,8 +31,8 @@ end
function Souls:SpecChanged(frame)
-- update shard count on spec swap
if frame and frame.soulShards then
frame.soulShards.cpConfig.max = (GetSpecialization() == SPEC_WARLOCK_DESTRUCTION) and 50 or 5
frame.soulShards.cpConfig.grouping = (GetSpecialization() == SPEC_WARLOCK_DESTRUCTION) and UnitPowerDisplayMod(soulsConfig.powerType) or 1
frame.soulShards.cpConfig.max = (GetSpec() == SPEC_WARLOCK_DESTRUCTION) and 50 or 5
frame.soulShards.cpConfig.grouping = (GetSpec() == SPEC_WARLOCK_DESTRUCTION) and UnitPowerDisplayMod(soulsConfig.powerType) or 1
end
self:UpdateBarBlocks(frame)
end
Expand All @@ -39,9 +42,9 @@ function Souls:GetComboPointType()
end

function Souls:GetPoints(unit)
return UnitPower("player", soulsConfig.powerType, (GetSpecialization() == SPEC_WARLOCK_DESTRUCTION))
return UnitPower("player", soulsConfig.powerType, (GetSpec() == SPEC_WARLOCK_DESTRUCTION))
end

function Souls:GetMaxPoints(unit)
return UnitPowerMax("player", soulsConfig.powerType, (GetSpecialization() == SPEC_WARLOCK_DESTRUCTION))
return UnitPowerMax("player", soulsConfig.powerType, (GetSpec() == SPEC_WARLOCK_DESTRUCTION))
end
13 changes: 8 additions & 5 deletions modules/units.lua
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ end
local function SetVisibility(self)
local layoutUpdate
local instanceType = select(2, IsInInstance()) or "none"
local playerSpec = GetSpecialization()
local playerSpec = GetSpecialization and GetSpecialization() or 1
if( instanceType == "scenario" ) then instanceType = "party" end
if( instanceType == "interior" ) then instanceType = "neighborhood" end

Expand Down Expand Up @@ -688,8 +688,8 @@ local function ClassToken(self)
end

local function ArenaClassToken(self)
local specID = GetArenaOpponentSpec(self.unitID)
return specID and select(6, GetSpecializationInfoByID(specID))
local specID = GetArenaOpponentSpec and GetArenaOpponentSpec(self.unitID)
return specID and GetSpecializationInfoByID and select(6, GetSpecializationInfoByID(specID))
end

function Units:CreateUnit(...)
Expand Down Expand Up @@ -1486,7 +1486,10 @@ end
-- Handle figuring out what auras players can cure
local curableSpells = {
["DRUID"] = {[88423] = {"Magic", "Curse", "Poison"}, [2782] = {"Curse", "Poison"}},
["PRIEST"] = {[527] = {"Magic", "Disease"}, [32375] = {"Magic"}, [213634] = {"Disease"}},
-- Mass Dispel (32375) is omitted on purpose: in MoP it's baseline for all priest specs (incl. Shadow),
-- but most raid debuffs are flagged immune to it, so highlighting Magic debuffs as curable for Shadow
-- is a false positive. Single-target Magic dispel is Purify (527, Holy/Disc only).
["PRIEST"] = {[527] = {"Magic", "Disease"}, [213634] = {"Disease"}},
["PALADIN"] = {[4987] = {"Poison", "Disease", "Magic"}, [213644] = {"Poison", "Disease"}},
["SHAMAN"] = {[77130] = {"Curse", "Magic"}, [51886] = {"Curse"}, [383013] = {"Poison"}},
["MONK"] = {[115450] = {"Poison", "Disease", "Magic"}, [218164] = {"Poison", "Disease"}},
Expand All @@ -1503,7 +1506,7 @@ local function checkCurableSpells()
table.wipe(Units.canCure)

for spellID, cures in pairs(curableSpells) do
if( IsPlayerSpell(spellID) or IsSpellKnown(spellID, true) ) then
if( IsSpellKnown(spellID) ) then
for _, auraType in pairs(cures) do
Units.canCure[auraType] = true
end
Expand Down
Loading