Merge branch 'release/v2.11-Release' into main

This commit is contained in:
Sumsebrum 2022-03-27 21:05:07 +02:00
commit 1cf5f3df25
13 changed files with 292 additions and 138 deletions

View File

@ -107,6 +107,7 @@ local specBuffs = {
-- WARLOCK
[GetSpellInfo(19028)] = L["Demonology"], -- Soul Link
[GetSpellInfo(23759)] = L["Demonology"], -- Master Demonologist
[GetSpellInfo(35696)] = L["Demonology"], -- Demonic Knowledge
[GetSpellInfo(30302)] = L["Destruction"], -- Nether Protection
[GetSpellInfo(34935)] = L["Destruction"], -- Backlash
@ -125,7 +126,7 @@ local specSpells = {
[GetSpellInfo(33983)] = L["Feral"], -- Mangle (Cat)
[GetSpellInfo(33987)] = L["Feral"], -- Mangle (Bear)
[GetSpellInfo(18562)] = L["Restoration"], -- Swiftmend
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
[GetSpellInfo(17116)] = L["Restoration"], -- Nature's Swiftness
[GetSpellInfo(33891)] = L["Restoration"], -- Tree of Life
-- HUNTER
@ -182,7 +183,7 @@ local specSpells = {
[GetSpellInfo(17364)] = L["Enhancement"], -- Stormstrike
[GetSpellInfo(16190)] = L["Restoration"], -- Mana Tide Totem
[GetSpellInfo(32594)] = L["Restoration"], -- Earth Shield
--[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
-- WARLOCK
[GetSpellInfo(30405)] = L["Affliction"], -- Unstable Affliction
@ -190,6 +191,7 @@ local specSpells = {
--[GetSpellInfo(30911)] = L["Affliction"], -- Siphon Life
[GetSpellInfo(30414)] = L["Destruction"], -- Shadowfury
[GetSpellInfo(30912)] = L["Destruction"], -- Conflagrate
[GetSpellInfo(18708)] = L["Demonology"], -- Fel Domination
-- WARRIOR
[GetSpellInfo(30330)] = L["Arms"], -- Mortal Strike
@ -995,7 +997,7 @@ local cooldownList = {
[18499] = 30, -- Berserker Rage
--[2565] = 60, -- Shield Block
[12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish
[20252] = { cd = 30, [L["Arms"]] = 20 }, -- Intercept
[20252] = { cd = 25, [L["Arms"]] = 15 }, -- Intercept
[12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand
[12809] = { cd = 30, spec = L["Protection"], }, -- Concussion Blow
@ -1330,8 +1332,8 @@ local totemData = {
[string_lower("Frost Resistance Totem")] = {id = 8181,texture = select(3, GetSpellInfo(8181)), color = {r = 0, g = 0, b = 0, a = 1}},
-- Water
[string_lower("Fire Resistance Totem")] = {id = 8184,texture = select(3, GetSpellInfo(8184)), color = {r = 0, g = 0, b = 0, a = 1}},
[string_lower("Poison Cleansing Totem")] = {id = 8166,texture = select(3, GetSpellInfo(8166)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 4},
[string_lower("Disease Cleansing Totem")] = {id = 8170,texture = select(3, GetSpellInfo(8170)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 4},
[string_lower("Poison Cleansing Totem")] = {id = 8166,texture = select(3, GetSpellInfo(8166)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 5},
[string_lower("Disease Cleansing Totem")] = {id = 8170,texture = select(3, GetSpellInfo(8170)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 5},
[string_lower("Healing Stream Totem")] = {id = 5394,texture = select(3, GetSpellInfo(5394)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 2},
[string_lower("Mana Tide Totem")] = {id = 16190,texture = select(3, GetSpellInfo(16190)), color = {r = 0.078, g = 0.9, b = 0.16, a = 1}},
[string_lower("Mana Spring Totem")] = {id = 5675,texture = select(3, GetSpellInfo(5675)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 2},

View File

@ -57,13 +57,15 @@ function Gladdy:SpotEnemy(unit, auraScan)
if not unit or not button then
return
end
button.raceLoc = UnitRace(unit)
button.race = select(2, UnitRace(unit))
button.classLoc = select(1, UnitClass(unit))
button.class = select(2, UnitClass(unit))
button.name = UnitName(unit)
button.stealthed = false
Gladdy.guids[UnitGUID(unit)] = unit
if UnitExists(unit) then
button.raceLoc = UnitRace(unit)
button.race = select(2, UnitRace(unit))
button.classLoc = select(1, UnitClass(unit))
button.class = select(2, UnitClass(unit))
button.name = UnitName(unit)
Gladdy.guids[UnitGUID(unit)] = unit
end
if button.class and button.race then
Gladdy:SendMessage("ENEMY_SPOTTED", unit)
end
@ -73,6 +75,12 @@ function Gladdy:SpotEnemy(unit, auraScan)
if ( not spellName ) then
break
end
if Gladdy.specBuffs[spellName] and unitCaster then -- Check for auras that detect a spec
local unitPet = string_gsub(unit, "%d$", "pet%1")
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
EventListener:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that detect used CDs (like Fear Ward)
for arenaUnit,v in pairs(self.buttons) do
if (UnitIsUnit(arenaUnit, unitCaster)) then
@ -84,12 +92,6 @@ function Gladdy:SpotEnemy(unit, auraScan)
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
end
if Gladdy.specBuffs[spellName] and unitCaster then -- Check for auras that detect a spec
local unitPet = string_gsub(unit, "%d$", "pet%1")
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
EventListener:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
end
end
end
@ -126,20 +128,31 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
if (not UnitExists(srcUnit)) then
return
end
if not Gladdy.buttons[srcUnit].class or not Gladdy.buttons[srcUnit].race then
Gladdy:SpotEnemy(srcUnit, true)
end
if not Gladdy.buttons[srcUnit].spec then
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
end
if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED") then
local unitRace = Gladdy.buttons[srcUnit].race
-- cooldown tracker
if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then
local unitClass
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
if spellID == 16188 or spellID == 17116 then -- Nature's Swiftness (same name for druid and shaman)
spellId = spellID
end
if Gladdy.db.cooldownCooldowns[tostring(spellId)] then
if (Gladdy:GetCooldownList()[Gladdy.buttons[srcUnit].class][spellId]) then
unitClass = Gladdy.buttons[srcUnit].class
else
unitClass = Gladdy.buttons[srcUnit].race
end
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId)
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
if spellID ~= 16188 and spellID ~= 17116 then -- Nature's Swiftness CD starts when buff fades
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId)
end
end
end
@ -147,12 +160,8 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
Gladdy:SendMessage("RACIAL_USED", srcUnit)
end
end
if not Gladdy.buttons[srcUnit].class or not Gladdy.buttons[srcUnit].race then
Gladdy:SpotEnemy(srcUnit, true)
end
if not Gladdy.buttons[srcUnit].spec then
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
if (eventType == "SPELL_AURA_REMOVED" and (spellID == 16188 or spellID == 17116) and Gladdy.buttons[srcUnit].class) then
Cooldowns:CooldownUsed(srcUnit, Gladdy.buttons[srcUnit].class, spellID)
end
end
end
@ -217,11 +226,14 @@ Gladdy.cooldownBuffs = {
return expTime
end, spellId = 6346 }, -- Fear Ward
[GetSpellInfo(11305)] = { cd = function(expTime) -- 15s uptime
return 180 - (15 - expTime)
return 300 - (15 - expTime)
end, spellId = 11305 }, -- Sprint
[GetSpellInfo(36554)] = { cd = function(expTime) -- 3s uptime
[36554] = { cd = function(expTime) -- 3s uptime
return 30 - (3 - expTime)
end, spellId = 36554 }, -- Shadowstep
end, spellId = 36554 }, -- Shadowstep speed buff
[36563] = { cd = function(expTime) -- 10s uptime
return 30 - (10 - expTime)
end, spellId = 36554 }, -- Shadowstep dmg buff
[GetSpellInfo(26889)] = { cd = function(expTime) -- 3s uptime
return 180 - (10 - expTime)
end, spellId = 26889 }, -- Vanish
@ -250,22 +262,23 @@ function EventListener:UNIT_AURA(unit)
Gladdy:SendMessage("AURA_GAIN_LIMIT", unit, auraType, n - 1)
break
end
if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that hint used CDs (like Fear Ward)
for arenaUnit,v in pairs(Gladdy.buttons) do
if (UnitIsUnit(arenaUnit, unitCaster)) then
Cooldowns:CooldownUsed(arenaUnit, v.class, Gladdy.cooldownBuffs[spellName].spellId, Gladdy.cooldownBuffs[spellName].cd(expirationTime - GetTime()))
end
end
end
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
end
if not button.spec and Gladdy.specBuffs[spellName] and unitCaster then
local unitPet = string_gsub(unit, "%d$", "pet%1")
if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
self:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
if (Gladdy.cooldownBuffs[spellName] or Gladdy.cooldownBuffs[spellID]) and unitCaster then -- Check for auras that hint used CDs (like Fear Ward)
local cooldownBuff = Gladdy.cooldownBuffs[spellID] or Gladdy.cooldownBuffs[spellName]
for arenaUnit,v in pairs(Gladdy.buttons) do
if (UnitIsUnit(arenaUnit, unitCaster)) then
Cooldowns:CooldownUsed(arenaUnit, v.class, cooldownBuff.spellId, cooldownBuff.cd(expirationTime - GetTime()))
end
end
end
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
end
if Gladdy.exceptionNames[spellID] then
spellName = Gladdy.exceptionNames[spellID]
end
@ -334,8 +347,9 @@ end
function EventListener:Test(unit)
local button = Gladdy.buttons[unit]
if (Gladdy.testData[unit].testSpec) then
if (button and Gladdy.testData[unit].testSpec) then
button.spec = nil
Gladdy:SpotEnemy(unit, false)
self:DetectSpec(unit, button.testSpec)
end
end

View File

@ -27,11 +27,11 @@ local LibStub = LibStub
---------------------------
local MAJOR, MINOR = "Gladdy", 6
local MAJOR, MINOR = "Gladdy", 7
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
local L
Gladdy.version_major_num = 2
Gladdy.version_minor_num = 0.10
Gladdy.version_minor_num = 0.11
Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
Gladdy.version_releaseType = RELEASE_TYPES.release
Gladdy.version = PREFIX .. string.format("%.2f", Gladdy.version_num) .. "-" .. Gladdy.version_releaseType
@ -289,11 +289,11 @@ function Gladdy:OnInitialize()
L = self.L
self.testData = {
["arena1"] = { name = "Swift", raceLoc = L["NightElf"], classLoc = L["Hunter"], class = "HUNTER", health = 67, healthMax = 100, power = 76, powerMax = 100, powerType = 1, testSpec = L["Marksmanship"], race = "NightElf" },
["arena1"] = { name = "Swift", raceLoc = L["NightElf"], classLoc = L["Druid"], class = "DRUID", health = 67, healthMax = 100, power = 76, powerMax = 100, powerType = 1, testSpec = L["Restoration"], race = "NightElf" },
["arena2"] = { name = "Vilden", raceLoc = L["Undead"], classLoc = L["Mage"], class = "MAGE", health = 99, healthMax = 100, power = 7833, powerMax = 10460, powerType = 0, testSpec = L["Frost"], race = "Scourge" },
["arena3"] = { name = "Krymu", raceLoc = L["Human"], classLoc = L["Rogue"], class = "ROGUE", health = 13, healthMax = 100, power = 45, powerMax = 110, powerType = 3, testSpec = L["Subtlety"], race = "Human" },
["arena4"] = { name = "Talmon", raceLoc = L["Human"], classLoc = L["Warlock"], class = "WARLOCK", health = 68, healthMax = 100, power = 9855, powerMax = 9855, powerType = 0, testSpec = L["Demonology"], race = "Human" },
["arena5"] = { name = "Hydra", raceLoc = L["Undead"], classLoc = L["Priest"], class = "PRIEST", health = 100, healthMax = 100, power = 2515, powerMax = 10240, powerType = 0, testSpec = L["Discipline"], race = "Human" },
["arena3"] = { name = "Krymu", raceLoc = L["Human"], classLoc = L["Rogue"], class = "ROGUE", health = 10, healthMax = 100, power = 45, powerMax = 110, powerType = 3, testSpec = L["Subtlety"], race = "Human" },
["arena4"] = { name = "Talmon", raceLoc = L["Human"], classLoc = L["Warlock"], class = "WARLOCK", health = 40, healthMax = 100, power = 9855, powerMax = 9855, powerType = 0, testSpec = L["Demonology"], race = "Human" },
["arena5"] = { name = "Hydra", raceLoc = L["Undead"], classLoc = L["Priest"], class = "PRIEST", health = 70, healthMax = 100, power = 2515, powerMax = 10240, powerType = 0, testSpec = L["Discipline"], race = "Human" },
}
self.cooldownSpellIds = {}

View File

@ -1,11 +1,11 @@
## Interface: 20504
## Title: Gladdy - TBC
## Version: 2.10-Release
## Version: 2.11-Release
## Notes: The most powerful arena AddOn for WoW 2.5.4
## Author: XiconQoo, DnB_Junkee, Knall
## X-Email: contact me on discord Knall#1751
## SavedVariables: GladdyXZ
## OptionalDeps: SharedMedia, Blizzard_CombatLog, Blizzard_ArenaUI, Blizzard_CombatText
## OptionalDeps: SharedMedia, Blizzard_CombatLog, Blizzard_ArenaUI, Blizzard_CombatText, Plater, Kui_Nameplates, NeatPlates, TidyPlates_ThreatPlates, Tukui, ElvUI
embeds.xml

View File

@ -191,10 +191,6 @@ function Classicon:UNIT_SPEC(unit, spec)
classIcon.texture:SetTexture(specIcons[Gladdy.buttons[unit].class][spec])
end
function Classicon:Test(unit)
self:ENEMY_SPOTTED(unit)
end
function Classicon:ResetUnit(unit)
local classIcon = self.frames[unit]
if (not classIcon) then

View File

@ -91,7 +91,7 @@ function Cooldowns:Initialize()
end
end
self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("SPEC_DETECTED")
self:RegisterMessage("UNIT_SPEC")
self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("UNIT_DESTROYED")
end
@ -299,21 +299,14 @@ end
function Cooldowns:Test(unit)
if Gladdy.frame.testing then
local button = Gladdy.buttons[unit]
if Gladdy.db.cooldown then
button.spellCooldownFrame:Show()
else
button.spellCooldownFrame:Hide()
end
self:UpdateTestCooldowns(unit)
end
end
function Cooldowns:UpdateTestCooldowns(unit)
local button = Gladdy.buttons[unit]
self:UpdateCooldowns(button)
local orderedIcons = {}
for _,icon in pairs(button.spellCooldownFrame.icons) do
tinsert(orderedIcons, icon)
end
@ -337,7 +330,7 @@ function Cooldowns:ENEMY_SPOTTED(unit)
self:UpdateCooldowns(Gladdy.buttons[unit])
end
function Cooldowns:SPEC_DETECTED(unit)
function Cooldowns:UNIT_SPEC(unit)
if (not Gladdy.buttons[unit]) then
return
end
@ -854,6 +847,7 @@ function Cooldowns:GetCooldownOptions()
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
for unit in pairs(Gladdy.buttons) do
Cooldowns:ResetUnit(unit)
Cooldowns:UpdateCooldowns(Gladdy.buttons[unit])
Cooldowns:Test(unit)
end
Gladdy:UpdateFrame()

View File

@ -1,5 +1,6 @@
local select = select
local pairs,ipairs,tbl_sort,tinsert,format,rand = pairs,ipairs,table.sort,tinsert,format,math.random
local str_gsub = string.gsub
local GetSpellInfo = GetSpellInfo
local CreateFrame = CreateFrame
@ -55,6 +56,8 @@ local Diminishings = Gladdy:NewModule("Diminishings", nil, {
drDuration = 18,
drFrameStrata = "MEDIUM",
drFrameLevel = 3,
drGroup = false,
drGroupDirection = "DOWN"
})
local function getDiminishColor(dr)
@ -187,6 +190,22 @@ function Diminishings:UpdateFrame(unit)
Gladdy:SetPosition(drFrame, unit, "drXOffset", "drYOffset", Diminishings:LegacySetPosition(drFrame, unit), Diminishings)
if (Gladdy.db.drGroup) then
if (unit ~= "arena1") then
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
self.frames[unit]:ClearAllPoints()
if Gladdy.db.classIconGroupDirection == "RIGHT" then
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
elseif Gladdy.db.classIconGroupDirection == "LEFT" then
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
elseif Gladdy.db.classIconGroupDirection == "UP" then
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
elseif Gladdy.db.classIconGroupDirection == "DOWN" then
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
end
end
end
if (unit == "arena1") then
Gladdy:CreateMover(drFrame,"drXOffset", "drYOffset", L["Diminishings"],
Gladdy.db.drGrowDirection == "RIGHT" and {"TOPLEFT", "TOPLEFT"} or {"TOPRIGHT", "TOPRIGHT"},
@ -439,6 +458,26 @@ function Diminishings:GetOptions()
max = 20,
step = .1,
}),
drGroup = Gladdy:option({
type = "toggle",
name = L["Group"] .. " " .. L["Class Icon"],
order = 5,
disabled = function() return not Gladdy.db.drEnabled end,
}),
drGroupDirection = Gladdy:option({
type = "select",
name = L["Group direction"],
order = 6,
values = {
["RIGHT"] = L["Right"],
["LEFT"] = L["Left"],
["UP"] = L["Up"],
["DOWN"] = L["Down"],
},
disabled = function()
return not Gladdy.db.drGroup or not Gladdy.db.drEnabled
end,
}),
group = {
type = "group",
childGroups = "tree",

View File

@ -1,5 +1,5 @@
local pairs, ipairs = pairs, ipairs
local floor = math.floor
local floor, abs = math.floor, math.abs
local str_find, str_gsub, str_sub, tinsert = string.find, string.gsub, string.sub, table.insert
local UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost = UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost
@ -17,6 +17,15 @@ local Healthbar = Gladdy:NewModule("Health Bar", 100, {
healthBarBorderSize = 9,
healthBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
healthBarBgColor = { r = 0, g = 0, b = 0, a = 0.4 },
healthBarClassColored = true,
healthBarColoredByCurrentHp = false,
healthBarStatusBarColorMax = { r = 0, g = 1, b = 0, a = 1 },
healthBarStatusBarColorMid = { r = 1, g = 1, b = 0, a = 1 },
healthBarStatusBarColorMin = { r = 1, g = 0, b = 0, a = 1 },
healthFrameStrata = "MEDIUM",
healthFrameLevel = 1,
healthBarStealthColor = { r = 0.66, g = 0.66, b = 0.66, a = 1 },
--font
healthBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
healthBarNameFontSize = 12,
healthBarHealthFontSize = 12,
@ -25,8 +34,6 @@ local Healthbar = Gladdy:NewModule("Health Bar", 100, {
healthActual = false,
healthMax = true,
healthPercentage = true,
healthFrameStrata = "MEDIUM",
healthFrameLevel = 1,
healthCustomTagsEnabled = false,
healthTextLeft = "[name]",
healthTextRight = "[percent|status]",
@ -42,6 +49,7 @@ function Healthbar:Initialize()
self.frames = {}
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("ENEMY_STEALTH")
self:RegisterMessage("UNIT_SPEC")
self:RegisterMessage("UNIT_DESTROYED")
self:RegisterMessage("UNIT_DEATH")
@ -123,7 +131,7 @@ function Healthbar.OnEvent(self, event, unit)
self.hp.current = health
self.hp.max = healthMax
Healthbar:SetText(unit, health, healthMax)
--Healthbar:SetHealthText(self, health, healthMax)
Healthbar:SetHealthStatusBarColor(unit, self.hp.current, self.hp.max)
elseif event == "UNIT_NAME_UPDATE" then
local name = UnitName(unit)
Gladdy.buttons[unit].name = name
@ -134,6 +142,67 @@ function Healthbar.OnEvent(self, event, unit)
end
end
local function getGradient(start, ending, percentage, factor)
return start * abs(-2 * percentage + 1) + ending * factor
end
-- /run LibStub("Gladdy").modules["Health Bar"]:SetHealthStatusBarColor("arena1", 51, 100)
local rMax, gMax, bMax, rMid, gMid, bMid, rMin, gMin, bMin, rNow, gNow, bNow, percentage, factor, stealthAlpha
function Healthbar:SetHealthStatusBarColor(unit, health, healthMax)
local button = Gladdy.buttons[unit]
if not button or not health or not healthMax then
return
end
local healthBar = Gladdy.buttons[unit].healthBar
if not healthBar.hp.oorFactor then
healthBar.hp.oorFactor = 1
end
healthBar.hp:SetMinMaxValues(0, healthMax)
healthBar.hp:SetValue(health)
if healthBar.hp.stealth then
stealthAlpha = Gladdy.db.healthBarStealthColor.a < Gladdy.db.healthBarBgColor.a and Gladdy.db.healthBarStealthColor.a or Gladdy.db.healthBarBgColor.a
healthBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.healthBarBgColor, nil, stealthAlpha))
healthBar.hp:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.healthBarStealthColor))
return
else
healthBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.healthBarBgColor))
end
if not Gladdy.db.healthBarClassColored then
if Gladdy.db.healthBarColoredByCurrentHp then
rMax, gMax, bMax = Gladdy:SetColor(Gladdy.db.healthBarStatusBarColorMax)
rMid, gMid, bMid = Gladdy:SetColor(Gladdy.db.healthBarStatusBarColorMid)
rMin, gMin, bMin = Gladdy:SetColor(Gladdy.db.healthBarStatusBarColorMin)
percentage = health / healthMax
if percentage == 0.5 then
rNow, gNow, bNow = Gladdy:SetColor(Gladdy.db.healthBarStatusBarColorMid, healthBar.hp.oorFactor)
elseif percentage < 0.5 then
factor = percentage * 2
rNow = getGradient(rMin, rMid, percentage, factor)
gNow = getGradient(gMin, gMid, percentage, factor)
bNow = getGradient(bMin, bMid, percentage, factor)
elseif percentage > 0.5 then
factor = ((healthMax - health) / healthMax) * 2
rNow = getGradient(rMax, rMid, percentage, factor)
gNow = getGradient(gMax, gMid, percentage, factor)
bNow = getGradient(bMax, bMid, percentage, factor)
end
healthBar.hp:SetStatusBarColor(rNow / healthBar.hp.oorFactor, gNow / healthBar.hp.oorFactor, bNow / healthBar.hp.oorFactor, 1)
else
healthBar.hp:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.healthBarStatusBarColorMax, healthBar.hp.oorFactor))
end
end
if button.class and Gladdy.db.healthBarClassColored then
healthBar.hp:SetStatusBarColor(
RAID_CLASS_COLORS[button.class].r / healthBar.hp.oorFactor,
RAID_CLASS_COLORS[button.class].g / healthBar.hp.oorFactor,
RAID_CLASS_COLORS[button.class].b / healthBar.hp.oorFactor, 1)
end
end
function Healthbar:SetHealthText(healthBar, health, healthMax)
local healthText = ""
local healthPercentage = health and healthMax and floor(health * 100 / healthMax)
@ -210,7 +279,7 @@ function Healthbar:UpdateFrame(unit)
healthBar.nameText:Hide()
else
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarNameFontSize, Gladdy.db.healthTextLeftOutline and "OUTLINE")
if Gladdy.db.healthName then
if Gladdy.db.healthName or Gladdy.db.healthCustomTagsEnabled then
healthBar.nameText:Show()
else
healthBar.nameText:Hide()
@ -220,6 +289,8 @@ function Healthbar:UpdateFrame(unit)
healthBar.healthText:SetTextColor(Gladdy:SetColor(Gladdy.db.healthBarFontColor))
healthBar.nameText:SetPoint("LEFT", Gladdy.db.healthTextLeftHOffset, Gladdy.db.healthTextLeftVOffset)
healthBar.healthText:SetPoint("RIGHT", Gladdy.db.healthTextRightHOffset, Gladdy.db.healthTextRightVOffset)
Healthbar:SetHealthStatusBarColor(unit, healthBar.hp.current, healthBar.hp.max)
end
function Healthbar:ResetUnit(unit)
@ -232,7 +303,8 @@ function Healthbar:ResetUnit(unit)
healthBar.nameText:SetText("")
healthBar.healthText:SetText("")
healthBar.hp:SetValue(0)
healthBar.hp.current = 0
healthBar.hp.current = nil
healthBar.hp.max = nil
end
function Healthbar:Test(unit)
@ -242,7 +314,6 @@ function Healthbar:Test(unit)
return
end
--self:JOINED_ARENA()
Gladdy:SendMessage("UNIT_HEALTH", unit, button.health, button.healthMax)
healthBar.hp.current = button.health
healthBar.hp.max = button.healthMax
@ -251,7 +322,6 @@ function Healthbar:Test(unit)
healthBar.hp:SetValue(button.health)
if unit == "arena1" then
self:UNIT_DEATH(unit)
--self:SetText(unit, button.health, button.healthMax, L["DEAD"])
end
end
@ -266,7 +336,8 @@ end
function Healthbar:JOINED_ARENA()
for i=1,Gladdy.curBracket do
self:SetText("arena" .. i, nil, nil)
local unit = "arena" .. i
self:SetText(unit, self.frames[unit].hp.current, self.frames[unit].hp.max)
end
end
@ -284,13 +355,21 @@ function Healthbar:ENEMY_SPOTTED(unit)
healthBar.hp:SetValue(health)
healthBar.hp.current = health
healthBar.hp.max = healthMax
Healthbar:SetText(unit, health, healthMax)
--Healthbar:SetHealthText(healthBar, health, healthMax)
end
Healthbar:SetText(unit, healthBar.hp.current, healthBar.hp.max)
Healthbar:SetHealthStatusBarColor(unit, healthBar.hp.current, healthBar.hp.max)
end
function Healthbar:ENEMY_STEALTH(unit, stealth)
local healthBar = self.frames[unit]
local button = Gladdy.buttons[unit]
if (not healthBar or not button) then
return
end
if button.class then
healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
end
healthBar.hp.stealth = stealth
Healthbar:SetHealthStatusBarColor(unit, healthBar.hp.current, healthBar.hp.max)
end
function Healthbar:UNIT_DEATH(unit)
@ -385,19 +464,76 @@ function Healthbar:GetOptions()
dialogControl = "LSM30_Statusbar",
values = AceGUIWidgetLSMlists.statusbar,
}),
},
},
barColor = {
type = "group",
name = L["Bar Color"],
order = 2,
args = {
headerAuras = {
type = "header",
name = L["Color"],
order = 1,
},
healthBarClassColored = Gladdy:option({
type = "toggle",
name = L["Class colored"] .. " " .. L["Health Bar"],
order = 2,
width = "full",
}),
healthBarStealthColor = Gladdy:colorOption({
type = "color",
name = L["Stealth Color"],
order = 3,
hasAlpha = true,
}),
healthBarBgColor = Gladdy:colorOption({
type = "color",
name = L["Background color"],
desc = L["Color of the status bar background"],
order = 5,
order = 4,
hasAlpha = true,
}),
headerAuras = {
type = "header",
name = L["Custom Colors"],
order = 10,
},
healthBarColoredByCurrentHp = Gladdy:option({
type = "toggle",
name = L["Enable Custom Colors"],
order = 11,
width = "full",
disabled = function() return Gladdy.db.healthBarClassColored end,
}),
healthBarStatusBarColorMax = Gladdy:colorOption({
type = "color",
name = L["100%"],
order = 12,
hasAlpha = false,
disabled = function() return Gladdy.db.healthBarClassColored end,
}),
healthBarStatusBarColorMid = Gladdy:colorOption({
type = "color",
name = L["50%"],
order = 13,
hasAlpha = false,
disabled = function() return Gladdy.db.healthBarClassColored end,
}),
healthBarStatusBarColorMin = Gladdy:colorOption({
type = "color",
name = L["0%"],
order = 14,
hasAlpha = false,
disabled = function() return Gladdy.db.healthBarClassColored end,
}),
},
},
font = {
type = "group",
name = L["Font"],
order = 2,
order = 3,
args = {
header = {
type = "header",
@ -502,7 +638,7 @@ function Healthbar:GetOptions()
border = {
type = "group",
name = L["Border"],
order = 3,
order = 4,
args = {
header = {
type = "header",
@ -538,7 +674,7 @@ function Healthbar:GetOptions()
frameStrata = {
type = "group",
name = L["Frame Strata and Level"],
order = 4,
order = 5,
args = {
headerAuraLevel = {
type = "header",
@ -567,7 +703,7 @@ function Healthbar:GetOptions()
healthValues = {
type = "group",
name = L["Health Bar Text"],
order = 5,
order = 6,
args = {
header = {
type = "header",

View File

@ -161,13 +161,9 @@ function Powerbar:UpdateFrame(unit)
end
function Powerbar.OnEvent(powerBar, event, unit)
if event == "UNIT_POWER_UPDATE" then
Powerbar:SetPower(powerBar, unit, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
elseif event == "UNIT_MAXPOWER" then
Powerbar:SetPower(powerBar, unit, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
elseif event == "UNIT_DISPLAYPOWER" then
Powerbar:SetPower(powerBar, unit, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
end
powerBar.energy.powerType = select(1, UnitPowerType(unit))
powerBar.energy.current, powerBar.energy.max = UnitPower(unit, powerBar.energy.powerType, true), UnitPowerMax(unit, powerBar.energy.powerType, true)
Powerbar:SetPower(powerBar, unit, powerBar.energy.current, powerBar.energy.max, powerBar.energy.powerType)
end
function Powerbar:SetText(unit, power, powerMax, status)
@ -276,7 +272,9 @@ function Powerbar:ENEMY_SPOTTED(unit)
end
if UnitExists(unit) then
Powerbar:SetPower(powerBar, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
powerBar.energy.powerType = select(1, UnitPowerType(unit))
powerBar.energy.current, powerBar.energy.max = UnitPower(unit, powerBar.energy.powerType, true), UnitPowerMax(unit, powerBar.energy.powerType, true)
Powerbar:SetPower(powerBar, unit, powerBar.energy.current, powerBar.energy.max, powerBar.energy.powerType)
end
end

View File

@ -17,6 +17,7 @@ local LibStub = LibStub
local Gladdy = LibStub("Gladdy")
local LSR = LibStub("SpellRange-1.0")
local L = Gladdy.L
local HealthBar = Gladdy.modules["Health Bar"]
local classSpells = {
["MAGE"] = 118,
@ -54,8 +55,6 @@ local RangeCheck = Gladdy:NewModule("Range Check", nil, {
function RangeCheck:Initialize()
if Gladdy.db.rangeCheckEnabled then
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_STEALTH")
self:RegisterMessage("ENEMY_SPOTTED")
end
self.playerClass = select(2, UnitClass("player"))
end
@ -63,8 +62,6 @@ end
function RangeCheck:UpdateFrameOnce()
if Gladdy.db.rangeCheckEnabled then
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_STEALTH")
self:RegisterMessage("ENEMY_SPOTTED")
else
self:UnregisterAllMessages()
end
@ -78,7 +75,6 @@ function RangeCheck:ResetUnit(unit)
local button = Gladdy.buttons[unit]
self:CancelTimer(button)
self:SetColor(button, 1)
button.classColors = {}
end
function RangeCheck:Test(unit)
@ -86,11 +82,10 @@ function RangeCheck:Test(unit)
if not button then
return
end
self:ENEMY_SPOTTED(unit)
self.test = true
button.lastState = 0
if Gladdy.db.rangeCheckEnabled then
if unit == "arena1" then
if unit == "arena2" or unit == "arena4" then
--button.unit = "target"
--self:CreateTimer(button)
self:SetRangeAlpha(button, nil)
@ -113,18 +108,12 @@ function RangeCheck:SetColor(button, oorFac)
return
end
if not button.classColors.r then
if button.class then
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
else
button.classColors = { r = 0.66, g = 0.66, b = 0.66 }
end
end
if Gladdy.db.rangeCheckHealthBar then
button.healthBar.hp:SetStatusBarColor(button.classColors.r/oorFac, button.classColors.g/oorFac, button.classColors.b/oorFac, 1)
button.healthBar.hp.oorFactor = oorFac
HealthBar:SetHealthStatusBarColor(button.unit, button.healthBar.hp.current, button.healthBar.hp.max)
else
button.healthBar.hp:SetStatusBarColor(button.classColors.r, button.classColors.g, button.classColors.b, 1)
button.healthBar.hp.oorFactor = 1
HealthBar:SetHealthStatusBarColor(button.unit, button.healthBar.hp.current, button.healthBar.hp.max)
end
if Gladdy.db.rangeCheckHealthBarText then
@ -189,35 +178,6 @@ function RangeCheck:JOINED_ARENA()
end
end
function RangeCheck:ENEMY_STEALTH(unit, stealth)
local button = Gladdy.buttons[unit]
if not button then
return
end
button.lastState = 0
if stealth then
button.classColors = { r = 0.66, g = 0.66, b = 0.66 }
if not Gladdy.db.rangeCheckEnabled then
button.healthBar.hp:SetStatusBarColor(0.66, 0.66, 0.66, 1)
end
else
if button.class then
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
if not Gladdy.db.rangeCheckEnabled then
button.healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
end
end
end
end
function RangeCheck:ENEMY_SPOTTED(unit)
local button = Gladdy.buttons[unit]
if (not button) then
return
end
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
end
function RangeCheck.CheckRange(self)
local button = self.parent

View File

@ -313,7 +313,7 @@ function TotemPulse:CreateCooldownFrame(style)
totemTick.spark.position = 0
totemTick.spark:SetRotation(style == "Vertical" and ninetyDegreeInRad or 0)
totemTick.bg = totemTick.bar:CreateTexture(nil, "BACKGROUND")
totemTick.bg = totemTick:CreateTexture(nil, "ARTWORK")
totemTick.bg:SetTexture(Gladdy:SMFetch("statusbar", "totemPulseBarTexture"))
totemTick.bg:SetAllPoints(totemTick.bar)
totemTick.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.totemPulseBarBgColor))
@ -461,7 +461,6 @@ function TotemPulse:UpdateBar(bar)
bar.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "totemPulseBarTexture"))
bar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.totemPulseBarColor))
bar.bar:SetAllPoints(bar)
bar.bg:SetTexture(Gladdy:SMFetch("statusbar", "totemPulseBarTexture"))
bar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.totemPulseBarBgColor))

View File

@ -105,8 +105,11 @@ function Gladdy:option(params)
return defaults
end
function Gladdy:SetColor(option)
return option.r, option.g, option.b, option.a
function Gladdy:SetColor(option, factor, altAlpha)
if not factor then
factor = 1
end
return option.r / factor, option.g / factor, option.b / factor, altAlpha or option.a
end
function Gladdy:colorOption(params)

View File

@ -4,7 +4,7 @@
---
## [v2.10-Release Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v2.10-Release/Gladdy_TBC-Classic_v2.10-Release.zip)
## [v2.11-Release Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v2.11-Release/Gladdy_TBC-Classic_v2.11-Release.zip)
###### <a target="_blank" rel="noopener noreferrer" href="https://www.paypal.me/xiconqoo/10"><img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/Paypal-Donate.png" height="30" style="margin-top:-30px;position:relative;top:20px;"></a> Please consider donating if you like my work
@ -79,6 +79,19 @@ Thank you!
### Changes
### v2.11-Release
- **Cooldowns**
- fixed cooldowns not showing properly for detected spec
- Nature's Swiftness (Druid/Shaman) now properly tracked
- improved cd out of stealth detection
- **HealthBar**
- added options class colored or custom colors
- custom colors for 100%, 50% 0% hp values added
- custom stealth color added
- add group option for DRs
- intercept cd adjusted (-5s for 4pc set bonus)
- totempulse minor adjustments
### v2.10-Release
- **Totems**: