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",
}
local auraTypeColor = {}
auraTypeColor["none"] = { r = 0.80, g = 0, b = 0, a = 1 }
auraTypeColor["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 }
auraTypeColor["disease"] = { r = 0.60, g = 0.40, b = 0, a = 1 }
auraTypeColor["poison"] = { r = 0.00, g = 0.60, b = 0, a = 1 }
auraTypeColor["immune"] = { r = 1.00, g = 0.02, b = 0.99, a = 1 }
auraTypeColor["form"] = auraTypeColor["none"]
auraTypeColor["aura"] = auraTypeColor["none"]
auraTypeColor[""] = auraTypeColor["none"]
local dispelTypeColors = {}
dispelTypeColors["none"] = { r = 0.80, g = 0, b = 0, a = 1 }
dispelTypeColors["magic"] = { r = 0.20, g = 0.60, b = 1.00, a = 1 }
dispelTypeColors["curse"] = { r = 0.60, g = 0.00, b = 1.00, a = 1 }
dispelTypeColors["disease"] = { r = 0.60, g = 0.40, b = 0, a = 1 }
dispelTypeColors["poison"] = { r = 0.00, g = 0.60, b = 0, a = 1 }
dispelTypeColors["immune"] = { r = 1.00, g = 0.02, b = 0.99, a = 1 }
dispelTypeColors["enrage"] = dispelTypeColors["none"]
dispelTypeColors["form"] = dispelTypeColors["none"]
dispelTypeColors["aura"] = dispelTypeColors["none"]
dispelTypeColors[""] = dispelTypeColors["none"]
function Gladdy:GetAuraTypeColor()
return auraTypeColor
function Gladdy:GetDispelTypeColors()
return dispelTypeColors
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 = {}
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[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[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[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[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[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[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[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"
function Gladdy:GetSpellSchoolColors()
return spellSchoolColors

View File

@ -42,25 +42,26 @@ local BuffsDebuffs = Gladdy:NewModule("Buffs and Debuffs", nil, {
buffsBorderColorsEnabled = true,
trackedDebuffs = defaultTrackedDebuffs,
trackedBuffs = defaultTrackedBuffs,
buffsBorderColorCurse = Gladdy:GetAuraTypeColor()["curse"],
buffsBorderColorMagic = Gladdy:GetAuraTypeColor()["magic"],
buffsBorderColorPoison = Gladdy:GetAuraTypeColor()["poison"],
buffsBorderColorPhysical = Gladdy:GetAuraTypeColor()["none"],
buffsBorderColorImmune = Gladdy:GetAuraTypeColor()["immune"],
buffsBorderColorDisease = Gladdy:GetAuraTypeColor()["disease"],
buffsBorderColorForm = Gladdy:GetAuraTypeColor()["form"],
buffsBorderColorAura = Gladdy:GetAuraTypeColor()["aura"],
buffsBorderColorEnrage = Gladdy:GetDispelTypeColors()["enrage"],
buffsBorderColorCurse = Gladdy:GetDispelTypeColors()["curse"],
buffsBorderColorMagic = Gladdy:GetDispelTypeColors()["magic"],
buffsBorderColorPoison = Gladdy:GetDispelTypeColors()["poison"],
buffsBorderColorPhysical = Gladdy:GetDispelTypeColors()["none"],
buffsBorderColorImmune = Gladdy:GetDispelTypeColors()["immune"],
buffsBorderColorDisease = Gladdy:GetDispelTypeColors()["disease"],
buffsBorderColorForm = Gladdy:GetDispelTypeColors()["form"],
buffsBorderColorAura = Gladdy:GetDispelTypeColors()["aura"],
buffFrameStrata = "MEDIUM",
buffsFrameLevel = 9,
})
local spellSchoolToOptionValueTable
local function spellSchoolToOptionValue(spellSchool)
if Gladdy.db.buffsBorderColorsEnabled and spellSchool then
return spellSchoolToOptionValueTable[spellSchool].r,
spellSchoolToOptionValueTable[spellSchool].g,
spellSchoolToOptionValueTable[spellSchool].b,
spellSchoolToOptionValueTable[spellSchool].a
local dispelTypeToOptionValueTable
local function dispelTypeToOptionValue(dispelType)
if Gladdy.db.buffsBorderColorsEnabled and dispelType then
return dispelTypeToOptionValueTable[dispelType].r,
dispelTypeToOptionValueTable[dispelType].g,
dispelTypeToOptionValueTable[dispelType].b,
dispelTypeToOptionValueTable[dispelType].a
else
return Gladdy:SetColor(Gladdy.db.buffsBorderColor)
end
@ -86,7 +87,8 @@ function BuffsDebuffs:Initialize()
"AURA_GAIN_LIMIT")
self:SetScript("OnEvent", BuffsDebuffs.OnEvent)
end
spellSchoolToOptionValueTable = {
dispelTypeToOptionValueTable = {
enrage = Gladdy.db.buffsBorderColorEnrage,
curse = Gladdy.db.buffsBorderColorCurse,
magic = Gladdy.db.buffsBorderColorMagic,
poison = Gladdy.db.buffsBorderColorPoison,
@ -137,7 +139,7 @@ end
function BuffsDebuffs:Test(unit)
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_BUFF)
@ -149,7 +151,7 @@ function BuffsDebuffs:Test(unit)
break
end
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
end
end
@ -159,7 +161,7 @@ function BuffsDebuffs:Test(unit)
break
end
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
end
end
@ -196,7 +198,7 @@ function BuffsDebuffs:AURA_GAIN_LIMIT(unit, auraType, limit)
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
return
end
@ -227,7 +229,7 @@ function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, dur
auraFrame.numBuffs = auraFrame.numBuffs + 1
index = auraFrame.numBuffs
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
@ -286,7 +288,7 @@ local function styleIcon(aura, auraType)
aura.overlay:SetFrameLevel(Gladdy.db.buffsFrameLevel + 2)
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: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")
@ -404,7 +406,7 @@ local function iconTimer(auraFrame, elapsed)
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
if not self.frames[unit].auras[auraType][index] then
if #self.framePool > 0 then
@ -457,12 +459,12 @@ function BuffsDebuffs:AddAura(unit, spellID, auraType, duration, timeLeft, stack
aura.spellID = spellID
aura.type = auraType
aura.unit = unit
aura.spellSchool = spellSchool
aura.border:SetVertexColor(spellSchoolToOptionValue(spellSchool))
aura.dispelType = dispelType
aura.border:SetVertexColor(dispelTypeToOptionValue(dispelType))
aura:Show()
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 duration == 0 then
self.frames[unit].auras[auraType][index].endtime = "undefined"
@ -478,7 +480,7 @@ function BuffsDebuffs:AddOrRefreshAura(unit, spellID, auraType, duration, timeLe
return
end
--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)
end
@ -903,6 +905,13 @@ function BuffsDebuffs:GetOptions()
order = 49,
hasAlpha = true,
}),
buffsBorderColorEnrage = Gladdy:colorOption({
type = "color",
name = L["Enrage"],
desc = L["Color of the border"],
order = 50,
hasAlpha = true,
}),
},
},
frameStrata = {