add enrage and rename auraType to dispelType

This commit is contained in:
Sumsebrum 2022-07-30 00:43:52 +02:00
parent 86bf851c64
commit 379040426c
2 changed files with 77 additions and 47 deletions

View File

@ -183,30 +183,51 @@ Gladdy.frameStrataSorting = {
[8] = "TOOLTIP", [8] = "TOOLTIP",
} }
local auraTypeColor = {} local dispelTypeColors = {}
auraTypeColor["none"] = { r = 0.80, g = 0, b = 0, a = 1 } dispelTypeColors["none"] = { r = 0.80, g = 0, b = 0, a = 1 }
auraTypeColor["magic"] = { r = 0.20, g = 0.60, b = 1.00, a = 1 } dispelTypeColors["magic"] = { r = 0.20, g = 0.60, b = 1.00, a = 1 }
auraTypeColor["curse"] = { r = 0.60, g = 0.00, b = 1.00, a = 1 } dispelTypeColors["curse"] = { r = 0.60, g = 0.00, b = 1.00, a = 1 }
auraTypeColor["disease"] = { r = 0.60, g = 0.40, b = 0, a = 1 } dispelTypeColors["disease"] = { r = 0.60, g = 0.40, b = 0, a = 1 }
auraTypeColor["poison"] = { r = 0.00, g = 0.60, b = 0, a = 1 } dispelTypeColors["poison"] = { r = 0.00, g = 0.60, b = 0, a = 1 }
auraTypeColor["immune"] = { r = 1.00, g = 0.02, b = 0.99, a = 1 } dispelTypeColors["immune"] = { r = 1.00, g = 0.02, b = 0.99, a = 1 }
auraTypeColor["form"] = auraTypeColor["none"] dispelTypeColors["enrage"] = dispelTypeColors["none"]
auraTypeColor["aura"] = auraTypeColor["none"] dispelTypeColors["form"] = dispelTypeColors["none"]
auraTypeColor[""] = auraTypeColor["none"] dispelTypeColors["aura"] = dispelTypeColors["none"]
dispelTypeColors[""] = dispelTypeColors["none"]
function Gladdy:GetAuraTypeColor() function Gladdy:GetDispelTypeColors()
return auraTypeColor return dispelTypeColors
end end
--[[schoolColoring = {
[SCHOOL_MASK_NONE] = {a=1.0,r=1.00,g=1.00,b=1.00};
[SCHOOL_MASK_PHYSICAL] = {a=1.0,r=1.00,g=1.00,b=0.00};
[SCHOOL_MASK_HOLY] = {a=1.0,r=1.00,g=0.90,b=0.50};
[SCHOOL_MASK_FIRE] = {a=1.0,r=1.00,g=0.50,b=0.00};
[SCHOOL_MASK_NATURE] = {a=1.0,r=0.30,g=1.00,b=0.30};
[SCHOOL_MASK_FROST] = {a=1.0,r=0.50,g=1.00,b=1.00};
[SCHOOL_MASK_SHADOW] = {a=1.0,r=0.50,g=0.50,b=1.00};
[SCHOOL_MASK_ARCANE] = {a=1.0,r=1.00,g=0.50,b=1.00};
SCHOOL_MASK_NONE = 0x00;
SCHOOL_MASK_PHYSICAL = 0x01;
SCHOOL_MASK_HOLY = 0x02;
SCHOOL_MASK_FIRE = 0x04;
SCHOOL_MASK_NATURE = 0x08;
SCHOOL_MASK_FROST = 0x10;
SCHOOL_MASK_SHADOW = 0x20;
SCHOOL_MASK_ARCANE = 0x40;
--]]
local spellSchoolColors = {} local spellSchoolColors = {}
spellSchoolColors[1] = { r = 1, g = 1, b = 0, a = 1, type = "Physical" } --- "physical" 255, 255, 0 spellSchoolColors[1] = { r = 1, g = 1, b = 0, a = 1, type = "Physical" } -- "physical" 255, 255, 0
spellSchoolColors[2] = { r = 1, g = 0.901, b = 0.501, a = 1, type = "Holy" } ---"holy" -- 255, 230, 128 spellSchoolColors[2] = { r = 1, g = 0.901, b = 0.501, a = 1, type = "Holy" } --"holy" -- 255, 230, 128
spellSchoolColors[4] = { r = 1, g = 0.501, b = 0, a = 1, type = "Fire" } ---"fire" -- 255, 128, 0 spellSchoolColors[4] = { r = 1, g = 0.501, b = 0, a = 1, type = "Fire" } --"fire" -- 255, 128, 0
spellSchoolColors[8] = { r = 0.302, g = 1, b = 0.302, a = 1, type = "Nature" } ---"nature" -- 77, 255, 77 spellSchoolColors[8] = { r = 0.302, g = 1, b = 0.302, a = 1, type = "Nature" } --"nature" -- 77, 255, 77
spellSchoolColors[16] = { r = 0.501, g = 1, b = 1, a = 1, type = "Frost" } ---"frost" -- 128, 255, 255 spellSchoolColors[16] = { r = 0.501, g = 1, b = 1, a = 1, type = "Frost" } --"frost" -- 128, 255, 255
spellSchoolColors[32] = { r = 0.501, g = 0.501, b = 1, a = 1, type = "Shadow" } ---"shadow" --128, 128, 255 spellSchoolColors[32] = { r = 0.501, g = 0.501, b = 1, a = 1, type = "Shadow" } --"shadow" --128, 128, 255
spellSchoolColors[64] = { r = 1, g = 0.501, b = 1, a = 1, type = "Arcane" } ---"arcane" -- 255, 128, 255 spellSchoolColors[64] = { r = 1, g = 0.501, b = 1, a = 1, type = "Arcane" } --"arcane" -- 255, 128, 255
spellSchoolColors["unknown"] = { r = 0, g = 0, b = 0, a = 1, type = "Unknown" } ---"unknown spell school" spellSchoolColors["unknown"] = { r = 0, g = 0, b = 0, a = 1, type = "Unknown" } --"unknown spell school"
function Gladdy:GetSpellSchoolColors() function Gladdy:GetSpellSchoolColors()
return spellSchoolColors return spellSchoolColors

View File

@ -42,25 +42,26 @@ local BuffsDebuffs = Gladdy:NewModule("Buffs and Debuffs", nil, {
buffsBorderColorsEnabled = true, buffsBorderColorsEnabled = true,
trackedDebuffs = defaultTrackedDebuffs, trackedDebuffs = defaultTrackedDebuffs,
trackedBuffs = defaultTrackedBuffs, trackedBuffs = defaultTrackedBuffs,
buffsBorderColorCurse = Gladdy:GetAuraTypeColor()["curse"], buffsBorderColorEnrage = Gladdy:GetDispelTypeColors()["enrage"],
buffsBorderColorMagic = Gladdy:GetAuraTypeColor()["magic"], buffsBorderColorCurse = Gladdy:GetDispelTypeColors()["curse"],
buffsBorderColorPoison = Gladdy:GetAuraTypeColor()["poison"], buffsBorderColorMagic = Gladdy:GetDispelTypeColors()["magic"],
buffsBorderColorPhysical = Gladdy:GetAuraTypeColor()["none"], buffsBorderColorPoison = Gladdy:GetDispelTypeColors()["poison"],
buffsBorderColorImmune = Gladdy:GetAuraTypeColor()["immune"], buffsBorderColorPhysical = Gladdy:GetDispelTypeColors()["none"],
buffsBorderColorDisease = Gladdy:GetAuraTypeColor()["disease"], buffsBorderColorImmune = Gladdy:GetDispelTypeColors()["immune"],
buffsBorderColorForm = Gladdy:GetAuraTypeColor()["form"], buffsBorderColorDisease = Gladdy:GetDispelTypeColors()["disease"],
buffsBorderColorAura = Gladdy:GetAuraTypeColor()["aura"], buffsBorderColorForm = Gladdy:GetDispelTypeColors()["form"],
buffsBorderColorAura = Gladdy:GetDispelTypeColors()["aura"],
buffFrameStrata = "MEDIUM", buffFrameStrata = "MEDIUM",
buffsFrameLevel = 9, buffsFrameLevel = 9,
}) })
local spellSchoolToOptionValueTable local dispelTypeToOptionValueTable
local function spellSchoolToOptionValue(spellSchool) local function dispelTypeToOptionValue(dispelType)
if Gladdy.db.buffsBorderColorsEnabled and spellSchool then if Gladdy.db.buffsBorderColorsEnabled and dispelType then
return spellSchoolToOptionValueTable[spellSchool].r, return dispelTypeToOptionValueTable[dispelType].r,
spellSchoolToOptionValueTable[spellSchool].g, dispelTypeToOptionValueTable[dispelType].g,
spellSchoolToOptionValueTable[spellSchool].b, dispelTypeToOptionValueTable[dispelType].b,
spellSchoolToOptionValueTable[spellSchool].a dispelTypeToOptionValueTable[dispelType].a
else else
return Gladdy:SetColor(Gladdy.db.buffsBorderColor) return Gladdy:SetColor(Gladdy.db.buffsBorderColor)
end end
@ -86,7 +87,8 @@ function BuffsDebuffs:Initialize()
"AURA_GAIN_LIMIT") "AURA_GAIN_LIMIT")
self:SetScript("OnEvent", BuffsDebuffs.OnEvent) self:SetScript("OnEvent", BuffsDebuffs.OnEvent)
end end
spellSchoolToOptionValueTable = { dispelTypeToOptionValueTable = {
enrage = Gladdy.db.buffsBorderColorEnrage,
curse = Gladdy.db.buffsBorderColorCurse, curse = Gladdy.db.buffsBorderColorCurse,
magic = Gladdy.db.buffsBorderColorMagic, magic = Gladdy.db.buffsBorderColorMagic,
poison = Gladdy.db.buffsBorderColorPoison, poison = Gladdy.db.buffsBorderColorPoison,
@ -137,7 +139,7 @@ end
function BuffsDebuffs:Test(unit) function BuffsDebuffs:Test(unit)
if Gladdy.db.buffsEnabled then if Gladdy.db.buffsEnabled then
local spellSchools = { "physical", "magic", "curse", "poison", "disease", "immune" } local dispelTypes = { "physical", "magic", "curse", "poison", "disease", "immune", "enrage"}
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
@ -149,7 +151,7 @@ function BuffsDebuffs:Test(unit)
break break
end end
if enabled then if enabled then
BuffsDebuffs:AddOrRefreshAura(unit, spellID, AURA_TYPE_DEBUFF, 15, 15, random(1,5), spellSchools[random(1,6)], select(3, GetSpellInfo(spellID)), i) BuffsDebuffs:AddOrRefreshAura(unit, spellID, AURA_TYPE_DEBUFF, 15, 15, random(1,5), dispelTypes[random(1,#dispelTypes)], select(3, GetSpellInfo(spellID)), i)
i = i + 1 i = i + 1
end end
end end
@ -159,7 +161,7 @@ function BuffsDebuffs:Test(unit)
break break
end end
if enabled then if enabled then
BuffsDebuffs:AddOrRefreshAura(unit, spellID, AURA_TYPE_BUFF, 15, 15, random(1,5), spellSchools[random(1,6)], select(3, GetSpellInfo(spellID)), i) BuffsDebuffs:AddOrRefreshAura(unit, spellID, AURA_TYPE_BUFF, 15, 15, random(1,5), dispelTypes[random(1,#dispelTypes)], select(3, GetSpellInfo(spellID)), i)
i = i + 1 i = i + 1
end end
end end
@ -196,7 +198,7 @@ function BuffsDebuffs:AURA_GAIN_LIMIT(unit, auraType, limit)
end end
end end
function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, duration, expirationTime, count, spellSchool) function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, duration, expirationTime, count, dispelType)
if (not self.frames[unit] or not Gladdy.db.buffsEnabled) then if (not self.frames[unit] or not Gladdy.db.buffsEnabled) then
return return
end end
@ -227,7 +229,7 @@ function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, dur
auraFrame.numBuffs = auraFrame.numBuffs + 1 auraFrame.numBuffs = auraFrame.numBuffs + 1
index = auraFrame.numBuffs index = auraFrame.numBuffs
end end
BuffsDebuffs:AddOrRefreshAura(unit,spellID, auraType, duration, expirationTime - GetTime(), count, spellSchool and lower(spellSchool) or "physical", texture, index) BuffsDebuffs:AddOrRefreshAura(unit,spellID, auraType, duration, expirationTime - GetTime(), count, dispelType and lower(dispelType) or "physical", texture, index)
end end
end end
@ -286,7 +288,7 @@ local function styleIcon(aura, auraType)
aura.overlay:SetFrameLevel(Gladdy.db.buffsFrameLevel + 2) aura.overlay:SetFrameLevel(Gladdy.db.buffsFrameLevel + 2)
aura.border:SetTexture(Gladdy.db.buffsBorderStyle) aura.border:SetTexture(Gladdy.db.buffsBorderStyle)
aura.border:SetVertexColor(spellSchoolToOptionValue(aura.spellSchool)) aura.border:SetVertexColor(dispelTypeToOptionValue(aura.dispelType))
aura.cooldown:SetFont(Gladdy:SMFetch("font", "buffsFont"), (Gladdy.db.buffsIconSize/2 - 1) * Gladdy.db.buffsFontScale, "OUTLINE") aura.cooldown:SetFont(Gladdy:SMFetch("font", "buffsFont"), (Gladdy.db.buffsIconSize/2 - 1) * Gladdy.db.buffsFontScale, "OUTLINE")
aura.cooldown:SetTextColor(Gladdy.db.buffsFontColor.r, Gladdy.db.buffsFontColor.g, Gladdy.db.buffsFontColor.b, Gladdy.db.buffsFontColor.a) aura.cooldown:SetTextColor(Gladdy.db.buffsFontColor.r, Gladdy.db.buffsFontColor.g, Gladdy.db.buffsFontColor.b, Gladdy.db.buffsFontColor.a)
aura.stacks:SetFont(Gladdy:SMFetch("font", "buffsFont"), (Gladdy.db.buffsIconSize/3 - 1) * Gladdy.db.buffsFontScale, "OUTLINE") aura.stacks:SetFont(Gladdy:SMFetch("font", "buffsFont"), (Gladdy.db.buffsIconSize/3 - 1) * Gladdy.db.buffsFontScale, "OUTLINE")
@ -404,7 +406,7 @@ local function iconTimer(auraFrame, elapsed)
end end
end end
function BuffsDebuffs:AddAura(unit, spellID, auraType, duration, timeLeft, stacks, spellSchool, icon, index) function BuffsDebuffs:AddAura(unit, spellID, auraType, duration, timeLeft, stacks, dispelType, icon, index)
local aura local aura
if not self.frames[unit].auras[auraType][index] then if not self.frames[unit].auras[auraType][index] then
if #self.framePool > 0 then if #self.framePool > 0 then
@ -457,12 +459,12 @@ function BuffsDebuffs:AddAura(unit, spellID, auraType, duration, timeLeft, stack
aura.spellID = spellID aura.spellID = spellID
aura.type = auraType aura.type = auraType
aura.unit = unit aura.unit = unit
aura.spellSchool = spellSchool aura.dispelType = dispelType
aura.border:SetVertexColor(spellSchoolToOptionValue(spellSchool)) aura.border:SetVertexColor(dispelTypeToOptionValue(dispelType))
aura:Show() aura:Show()
end end
function BuffsDebuffs:AddOrRefreshAura(unit, spellID, auraType, duration, timeLeft, stacks, spellSchool, icon, index) function BuffsDebuffs:AddOrRefreshAura(unit, spellID, auraType, duration, timeLeft, stacks, dispelType, icon, index)
if self.frames[unit].auras[auraType][index] and self.frames[unit].auras[auraType][index].spellID == spellID then -- refresh if self.frames[unit].auras[auraType][index] and self.frames[unit].auras[auraType][index].spellID == spellID then -- refresh
if duration == 0 then if duration == 0 then
self.frames[unit].auras[auraType][index].endtime = "undefined" self.frames[unit].auras[auraType][index].endtime = "undefined"
@ -478,7 +480,7 @@ function BuffsDebuffs:AddOrRefreshAura(unit, spellID, auraType, duration, timeLe
return return
end end
--add --add
self:AddAura(unit, spellID, auraType, duration, timeLeft, stacks, spellSchool, icon, index) self:AddAura(unit, spellID, auraType, duration, timeLeft, stacks, dispelType, icon, index)
self:UpdateAurasOnUnit(unit) self:UpdateAurasOnUnit(unit)
end end
@ -903,6 +905,13 @@ function BuffsDebuffs:GetOptions()
order = 49, order = 49,
hasAlpha = true, hasAlpha = true,
}), }),
buffsBorderColorEnrage = Gladdy:colorOption({
type = "color",
name = L["Enrage"],
desc = L["Color of the border"],
order = 50,
hasAlpha = true,
}),
}, },
}, },
frameStrata = { frameStrata = {