Compare commits

...

58 Commits

Author SHA1 Message Date
084fad0074 Merge branch 'release/v1.08-Beta' into main 2021-05-22 14:24:51 +02:00
2b9e219839 - added blizzard profile
- bump version
2021-05-22 14:24:20 +02:00
ba8ea87863 klimp profile aura border colors reset to default 2021-05-22 13:52:59 +02:00
f498a0dde1 TODO 2021-05-22 13:42:55 +02:00
673dc72b3b minor bugfixes 2021-05-22 13:42:47 +02:00
6da33b6c68 grow direction added 2021-05-22 13:41:42 +02:00
0c6cae0b04 highlight inset option added 2021-05-22 13:41:31 +02:00
ded321e772 fix AuraModule not showing Buffs 2021-05-22 13:29:48 +02:00
7015bb989e Announcement default options changed 2021-05-22 13:28:46 +02:00
eaeccf5595 CombatIndicator set border properly 2021-05-22 13:28:27 +02:00
c7d07c62ee Merge tag 'v1.07-Beta' into develop
v1.07-Beta
2021-05-20 01:32:45 +02:00
cf804546c2 Merge branch 'release/v1.07-Beta' into main 2021-05-20 01:32:35 +02:00
467b459898 bump version and update readme 2021-05-20 01:32:08 +02:00
0d9cbc8f45 DRData cleanup 2021-05-20 01:24:20 +02:00
2c858e1c84 XiconProfile image update 2021-05-20 01:23:55 +02:00
ffc5d32b80 delete Bindings.xml 2021-05-20 01:11:03 +02:00
1956b3a568 BuffDebuff options width for icons updated 2021-05-20 01:07:20 +02:00
84f542b3b8 add a couple buffs to LibClassAuras 2021-05-20 01:06:42 +02:00
ccf7d08832 add blessing of sacrifice and intervene to auras 2021-05-20 01:06:03 +02:00
2e093950e2 cleanup 2021-05-20 00:16:18 +02:00
2f9356f8de classicon warrior slight change 2021-05-20 00:16:09 +02:00
8c4a70fd04 general options updated to apply font/borders/etc for all frames 2021-05-20 00:15:50 +02:00
cac0124f1a XiconProfiles updated 2021-05-20 00:15:06 +02:00
cef9de3819 cleanup 2021-05-19 19:33:22 +02:00
a84178edbf /gladdy test1-5 now possible 2021-05-19 19:33:13 +02:00
c05fab9454 spec icon option added to Classicon module 2021-05-19 19:32:31 +02:00
be54619576 arena1-5 for name option added 2021-05-19 19:31:13 +02:00
c70560e66a Highlight remove framestrata 2021-05-19 19:30:54 +02:00
de4adaec16 fix PowerBar text updates 2021-05-19 19:30:46 +02:00
01d748f37e combat indicator fix anchoring 2021-05-19 19:30:40 +02:00
ad130af188 click through frames health/power bar 2021-05-19 19:30:32 +02:00
67edecf8d1 arena countdown refactor 2021-05-19 19:29:59 +02:00
e01b86e1e6 cleanup Totemplates 2021-05-19 16:35:45 +02:00
8b69f5ef93 CombatIndicator module added 2021-05-19 16:35:26 +02:00
4f774b1ddb mask applied to icons 2021-05-19 14:57:29 +02:00
3a846add3b totem icons removed and mask applied 2021-05-19 14:56:38 +02:00
9dfec29f16 add mask texture for icons 2021-05-19 13:55:55 +02:00
28d33d2f9a Merge tag 'aura-fix' into develop
v1.06-Beta hotfix
2021-05-18 18:31:33 +02:00
2d53df2b5f Merge branch 'hotfix/aura-fix' into main 2021-05-18 18:31:22 +02:00
cddea2e094 v1.06-Beta hotfix BuffDebuff module 2021-05-18 18:31:03 +02:00
ee1a78000e Merge tag 'v1.05-Beta' into develop
v1.05-Beta
2021-05-18 16:47:54 +02:00
57036a77c1 Merge branch 'release/v1.05-Beta' into main 2021-05-18 16:47:45 +02:00
fb46b97e73 toc v1.0.5-Beta 2021-05-18 16:45:54 +02:00
35d49b61ee toc added ImportStrings and Racial 2021-05-18 16:42:04 +02:00
f2bfbe3211 Racial module added to Eventlistener and Version check updated 2021-05-18 16:41:25 +02:00
8a27f88014 constants for auras/cooldowns/racials updated 2021-05-18 16:40:54 +02:00
2db3db21ec anchoring for modules rewritten 2021-05-18 16:39:43 +02:00
eaf8129143 fix Aura module options (localization independent for profile export) 2021-05-18 16:39:07 +02:00
1fb3fce980 Power-/HealthBar customize texts added and UNIT_DESTROYED added 2021-05-18 16:38:17 +02:00
a152cb6045 Racial module added and trinket modified 2021-05-18 16:37:22 +02:00
267d37b32e XiconProfiles import strings 2021-05-18 16:35:20 +02:00
7bdc417b30 Pets position extended 2021-05-18 16:35:02 +02:00
af6eb61c56 delete unused saved variables 2021-05-18 16:34:45 +02:00
fd5183cf5d ExportImport, VersionCheck & XiconProfiles fix 2021-05-18 16:34:10 +02:00
edb5608a38 fixed auras 2021-05-18 16:14:11 +02:00
f640f6fa6a TotemPlates add option to show friendly/enemy icons 2021-05-17 23:22:07 +02:00
cf8b961a1b Merge tag 'profiles' into develop
xiconprofiles fix
2021-05-17 18:23:08 +02:00
ea44a9d5f2 Merge tag 'readme-v-fix' into develop
v1.0.3-Beta-readme-fix
2021-05-17 17:11:46 +02:00
42 changed files with 2403 additions and 1099 deletions

View File

@ -1,38 +0,0 @@
<Bindings>
<Binding name="GLADDYBUTTON1_LEFT" header="GLADDY" category="ADDONS"/>
<Binding name="GLADDYBUTTON2_LEFT" category="ADDONS"/>
<Binding name="GLADDYBUTTON3_LEFT" category="ADDONS"/>
<Binding name="GLADDYBUTTON4_LEFT" category="ADDONS"/>
<Binding name="GLADDYBUTTON5_LEFT" category="ADDONS"/>
<Binding name="GLADDYBUTTON1_RIGHT" category="ADDONS"/>
<Binding name="GLADDYBUTTON2_RIGHT" category="ADDONS"/>
<Binding name="GLADDYBUTTON3_RIGHT" category="ADDONS"/>
<Binding name="GLADDYBUTTON4_RIGHT" category="ADDONS"/>
<Binding name="GLADDYBUTTON5_RIGHT" category="ADDONS"/>
<Binding name="GLADDYBUTTON1_MIDDLE" category="ADDONS"/>
<Binding name="GLADDYBUTTON2_MIDDLE" category="ADDONS"/>
<Binding name="GLADDYBUTTON3_MIDDLE" category="ADDONS"/>
<Binding name="GLADDYBUTTON4_MIDDLE" category="ADDONS"/>
<Binding name="GLADDYBUTTON5_MIDDLE" category="ADDONS"/>
<Binding name="GLADDYBUTTON1_BUTTON4" category="ADDONS"/>
<Binding name="GLADDYBUTTON2_BUTTON4" category="ADDONS"/>
<Binding name="GLADDYBUTTON3_BUTTON4" category="ADDONS"/>
<Binding name="GLADDYBUTTON4_BUTTON4" category="ADDONS"/>
<Binding name="GLADDYBUTTON5_BUTTON4" category="ADDONS"/>
<Binding name="GLADDYBUTTON1_BUTTON5" category="ADDONS"/>
<Binding name="GLADDYBUTTON2_BUTTON5" category="ADDONS"/>
<Binding name="GLADDYBUTTON3_BUTTON5" category="ADDONS"/>
<Binding name="GLADDYBUTTON4_BUTTON5" category="ADDONS"/>
<Binding name="GLADDYBUTTON5_BUTTON5" category="ADDONS"/>
<Binding header="GLADDYTRINKET" name="GLADDYTRINKET1" category="ADDONS"/>
<Binding name="GLADDYTRINKET2" category="ADDONS"/>
<Binding name="GLADDYTRINKET3" category="ADDONS"/>
<Binding name="GLADDYTRINKET4" category="ADDONS"/>
<Binding name="GLADDYTRINKET5" category="ADDONS"/>
</Bindings>

View File

@ -1,3 +1,5 @@
local tbl_sort, select = table.sort, select
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
@ -155,7 +157,7 @@ function Gladdy:GetImportantAuras()
priority = 40, priority = 40,
spellID = 33786, spellID = 33786,
}, },
-- Hibername -- Hibernate
[GetSpellInfo(18658)] = { [GetSpellInfo(18658)] = {
track = AURA_TYPE_DEBUFF, track = AURA_TYPE_DEBUFF,
duration = 10, duration = 10,
@ -364,6 +366,13 @@ function Gladdy:GetImportantAuras()
priority = 10, priority = 10,
spellID = 1044, spellID = 1044,
}, },
-- Blessing of Sacrifice
[GetSpellInfo(6940)] = {
track = AURA_TYPE_BUFF,
duration = 30,
priority = 12,
spellID = 6940,
},
-- Divine Shield -- Divine Shield
[GetSpellInfo(642)] = { [GetSpellInfo(642)] = {
track = AURA_TYPE_BUFF, track = AURA_TYPE_BUFF,
@ -581,6 +590,14 @@ function Gladdy:GetImportantAuras()
spellSchool = "magic", spellSchool = "magic",
spellID = 18498, spellID = 18498,
}, },
-- Death Wish
[GetSpellInfo(12292)] = {
track = AURA_TYPE_BUFF,
duration = 3,
priority = 15,
spellSchool = "magic",
spellID = 12292,
},
-- Grounding Totem Effect -- Grounding Totem Effect
[GetSpellInfo(8178)] = { [GetSpellInfo(8178)] = {
@ -589,6 +606,14 @@ function Gladdy:GetImportantAuras()
priority = 20, priority = 20,
spellID = 8178 spellID = 8178
}, },
--Intervene
[GetSpellInfo(3411)] = {
track = AURA_TYPE_BUFF,
duration = 10,
priority = 10,
spellSchool = "physical",
spellID = 3411,
},
-- War Stomp -- War Stomp
@ -607,4 +632,283 @@ function Gladdy:GetImportantAuras()
spellID = 28730, spellID = 28730,
}, },
} }
end
Gladdy.CLASSES = {"MAGE", "PRIEST", "DRUID", "SHAMAN", "PALADIN", "WARLOCK", "WARRIOR", "HUNTER", "ROGUE"}
tbl_sort(Gladdy.CLASSES)
Gladdy.RACES = {"Scourge", "BloodElf", "Tauren", "Orc", "Troll", "NightElf", "Draenei", "Human", "Gnome", "Dwarf"}
tbl_sort(Gladdy.RACES)
function Gladdy:GetCooldownList()
return {
-- Spell Name Cooldown[, Spec]
-- Mage
["MAGE"] = {
[1953] = 15, -- Blink
--[122] = 22, -- Frost Nova
--[12051] = 480, --Evocation
[2139] = 24, -- Counterspell
[45438] = { cd = 300, [L["Frost"]] = 240, }, -- Ice Block
[12472] = { cd = 180, spec = L["Frost"], }, -- Icy Veins
[31687] = { cd = 180, spec = L["Frost"], }, -- Summon Water Elemental
[12043] = { cd = 180, spec = L["Arcane"], }, -- Presence of Mind
[11129] = { cd = 180, spec = L["Fire"] }, -- Combustion
[120] = { cd = 10,
sharedCD = {
[31661] = true, -- Cone of Cold
}, spec = L["Fire"] }, -- Dragon's Breath
[31661] = { cd = 20,
sharedCD = {
[120] = true, -- Cone of Cold
}, spec = L["Fire"] }, -- Dragon's Breath
[12042] = { cd = 180, spec = L["Arcane"], }, -- Arcane Power
[11958] = { cd = 384, spec = L["Frost"], -- Coldsnap
resetCD = {
[12472] = true,
[45438] = true,
[31687] = true,
},
},
},
-- Priest
["PRIEST"] = {
[10890] = { cd = 27, [L["Shadow"]] = 23, }, -- Psychic Scream
[15487] = { cd = 45, spec = L["Shadow"], }, -- Silence
[10060] = { cd = 180, spec = L["Discipline"], }, -- Power Infusion
[33206] = { cd = 120, spec = L["Discipline"], }, -- Pain Suppression
[34433] = 300, -- Shadowfiend
},
-- Druid
["DRUID"] = {
[22812] = 60, -- Barkskin
[29166] = 360, -- Innervate
[8983] = 60, -- Bash
[16689] = 60, -- Natures Grasp
[17116] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
[33831] = { cd = 180, spec = L["Balance"], }, -- Force of Nature
},
-- Shaman
["SHAMAN"] = {
[8042] = { cd = 6, -- Earth Shock
sharedCD = {
[8056] = true, -- Frost Shock
[8050] = true, -- Flame Shock
},
},
[30823] = { cd = 120, spec = L["Enhancement"], }, -- Shamanistic Rage
[16166] = { cd = 180, spec = L["Elemental"], }, -- Elemental Mastery
[16188] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
[16190] = { cd = 300, spec = L["Restoration"], }, -- Mana Tide Totem
},
-- Paladin
["PALADIN"] = {
[10278] = 180, -- Blessing of Protection
[1044] = 25, -- Blessing of Freedom
[10308] = { cd = 60, [L["Retribution"]] = 40, }, -- Hammer of Justice
[642] = { cd = 300, -- Divine Shield
sharedCD = {
cd = 60, -- no actual shared CD but debuff
[31884] = true,
},
},
[31884] = { cd = 180, spec = L["Retribution"], -- Avenging Wrath
sharedCD = {
cd = 60,
[642] = true,
},
},
[20066] = { cd = 60, spec = L["Retribution"], }, -- Repentance
[31842] = { cd = 180, spec = L["Holy"], }, -- Divine Illumination
[31935] = { cd = 30, spec = L["Protection"], }, -- Avengers Shield
},
-- Warlock
["WARLOCK"] = {
[17928] = 40, -- Howl of Terror
[27223] = 120, -- Death Coil
--[19647] = { cd = 24 }, -- Spell Lock; how will I handle pet spells?
[30414] = { cd = 20, spec = L["Destruction"], }, -- Shadowfury
[17877] = { cd = 15, spec = L["Destruction"], }, -- Shadowburn
[18708] = { cd = 900, spec = L["Demonology"], }, -- Feldom
},
-- Warrior
["WARRIOR"] = {
--[[6552] = { cd = 10, -- Pummel
sharedCD = {
[72] = true,
},
},
[72] = { cd = 12, -- Shield Bash
sharedCD = {
[6552] = true,
},
}, ]]
--[23920] = 10, -- Spell Reflection
[3411] = 30, -- Intervene
[676] = 60, -- Disarm
[5246] = 180, -- Intimidating Shout
--[2565] = 60, -- Shield Block
[12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish
[12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand
[12809] = { cd = 30, spec = L["Protection"], }, -- Concussion Blow
},
-- Hunter
["HUNTER"] = {
[19503] = 30, -- Scatter Shot
[19263] = 300, -- Deterrence; not on BM but can't do 2 specs
[14311] = { cd = 30, -- Freezing Trap
sharedCD = {
[13809] = true, -- Frost Trap
[34600] = true, -- Snake Trap
},
},
[13809] = { cd = 30, -- Frost Trap
sharedCD = {
[14311] = true, -- Freezing Trap
[34600] = true, -- Snake Trap
},
},
[34600] = { cd = 30, -- Snake Trap
sharedCD = {
[14311] = true, -- Freezing Trap
[13809] = true, -- Frost Trap
},
},
[34490] = { cd = 20, spec = L["Marksmanship"], }, -- Silencing Shot
[19386] = { cd = 60, spec = L["Survival"], }, -- Wyvern Sting
[19577] = { cd = 60, spec = L["Beast Mastery"], }, -- Intimidation
[38373] = { cd = 120, spec = L["Beast Mastery"], }, -- The Beast Within
},
-- Rogue
["ROGUE"] = {
[1766] = 10, -- Kick
[8643] = 20, -- Kidney Shot
[31224] = 60, -- Cloak of Shadow
[26889] = { cd = 300, [L["Subtlety"]] = 180, }, -- Vanish
[2094] = { cd = 180, [L["Subtlety"]] = 90, }, -- Blind
[11305] = { cd = 300, [L["Combat"]] = 180, }, -- Sprint
[26669] = { cd = 300, [L["Combat"]] = 180, }, -- Evasion
[14177] = { cd = 180, spec = L["Assassination"], }, -- Cold Blood
[13750] = { cd = 300, spec = L["Combat"], }, -- Adrenaline Rush
[13877] = { cd = 120, spec = L["Combat"], }, -- Blade Flurry
[36554] = { cd = 30, spec = L["Subtlety"], }, -- Shadowstep
[14185] = { cd = 600, spec = L["Subtlety"], -- Preparation
resetCD = {
[26669] = true,
[11305] = true,
[26889] = true,
[14177] = true,
[36554] = true,
},
},
},
["Scourge"] = {
},
["BloodElf"] = {
},
["Tauren"] = {
},
["Orc"] = {
},
["Troll"] = {
},
["NightElf"] = {
[2651] = { cd = 180, spec = L["Discipline"], }, -- Elune's Grace
[10797] = { cd = 30, spec = L["Discipline"], }, -- Star Shards
},
["Draenei"] = {
[32548] = { cd = 300, spec = L["Discipline"], }, -- Hymn of Hope
},
["Human"] = {
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
},
["Gnome"] = {
},
["Dwarf"] = {
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
},
}
end
function Gladdy:Racials()
return {
["Scourge"] = {
[7744] = true, -- Will of the Forsaken
duration = 120,
spellName = select(1, GetSpellInfo(7744)),
texture = select(3, GetSpellInfo(7744))
},
["BloodElf"] = {
[28730] = true, -- Arcane Torrent
duration = 120,
spellName = select(1, GetSpellInfo(28730)),
texture = select(3, GetSpellInfo(28730))
},
["Tauren"] = {
[20549] = true, -- War Stomp
duration = 120,
spellName = select(1, GetSpellInfo(20549)),
texture = select(3, GetSpellInfo(20549))
},
["Orc"] = {
[20572] = true,
[33697] = true,
[33702] = true,
duration = 120,
spellName = select(1, GetSpellInfo(20572)),
texture = select(3, GetSpellInfo(20572))
},
["Troll"] = {
[20554] = true,
[26296] = true,
[26297] = true,
duration = 180,
spellName = select(1, GetSpellInfo(20554)),
texture = select(3, GetSpellInfo(20554))
},
["NightElf"] = {
[20580] = true,
duration = 10,
spellName = select(1, GetSpellInfo(20580)),
texture = select(3, GetSpellInfo(20580))
},
["Draenei"] = {
[28880] = true,
duration = 180,
spellName = select(1, GetSpellInfo(28880)),
texture = select(3, GetSpellInfo(28880))
},
["Human"] = {
[20600] = true, -- Perception
duration = 180,
spellName = select(1, GetSpellInfo(20600)),
texture = select(3, GetSpellInfo(20600))
},
["Gnome"] = {
[20589] = true, -- Escape Artist
duration = 105,
spellName = select(1, GetSpellInfo(20589)),
texture = select(3, GetSpellInfo(20589))
},
["Dwarf"] = {
[20594] = true, -- Stoneform
duration = 180,
spellName = select(1, GetSpellInfo(20594)),
texture = select(3, GetSpellInfo(20594))
},
}
end end

View File

@ -1,4 +1,4 @@
local select, string_gsub = select, string.gsub local select, string_gsub, tostring = select, string.gsub, tostring
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
local RAID_CLASS_COLORS = RAID_CLASS_COLORS local RAID_CLASS_COLORS = RAID_CLASS_COLORS
@ -34,7 +34,7 @@ function EventListener:JOINED_ARENA()
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
self:SetScript("OnEvent", EventListener.OnEvent) self:SetScript("OnEvent", EventListener.OnEvent)
Gladdy:SendCommMessage("GladdyVCheck", Gladdy.version, "RAID", UnitName("player")) Gladdy:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "RAID", UnitName("player"))
end end
function EventListener:Reset() function EventListener:Reset()
@ -106,17 +106,24 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
end end
end end
if srcUnit then if srcUnit then
local unitRace = Gladdy.buttons[srcUnit].race
-- cooldown tracker -- cooldown tracker
if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then
local unitClass local unitClass
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
if (Cooldowns.cooldownSpells[Gladdy.buttons[srcUnit].class][spellId]) then if Gladdy.db.cooldownCooldowns[tostring(spellId)] then
unitClass = Gladdy.buttons[srcUnit].class if (Gladdy:GetCooldownList()[Gladdy.buttons[srcUnit].class][spellId]) then
else unitClass = Gladdy.buttons[srcUnit].class
unitClass = Gladdy.buttons[srcUnit].race else
unitClass = Gladdy.buttons[srcUnit].race
end
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId, spellName)
Gladdy:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
end end
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId, spellName) end
Gladdy:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
if Gladdy.db.racialEnabled and Gladdy:Racials()[unitRace].spellName == spellName and Gladdy:Racials()[unitRace][spellID] then
Gladdy:SendMessage("RACIAL_USED", srcUnit)
end end
if not Gladdy.buttons[srcUnit].class then if not Gladdy.buttons[srcUnit].class then
@ -170,7 +177,7 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
end end
end end
local exceptionNames = { local exceptionNames = { -- TODO MOVE ME TO CLASSBUFFS LIB
[31117] = GetSpellInfo(30405) .. " Silence", -- Unstable Affliction Silence [31117] = GetSpellInfo(30405) .. " Silence", -- Unstable Affliction Silence
[43523] = GetSpellInfo(30405) .. " Silence", [43523] = GetSpellInfo(30405) .. " Silence",
[24131] = select(1, GetSpellInfo(19386)) .. " Dot", -- Wyvern Sting Dot [24131] = select(1, GetSpellInfo(19386)) .. " Dot", -- Wyvern Sting Dot

155
Frame.lua
View File

@ -30,9 +30,12 @@ Gladdy.BUTTON_DEFAULTS = {
function Gladdy:CreateFrame() function Gladdy:CreateFrame()
self.frame = CreateFrame("Frame", "GladdyFrame", UIParent) self.frame = CreateFrame("Frame", "GladdyFrame", UIParent)
--self.frame.texture = self.frame:CreateTexture(nil, "OVERLAY")
--self.frame.texture:SetAllPoints(self.frame)
--self.frame.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
self.frame:SetClampedToScreen(true) self.frame:SetClampedToScreen(true)
self.frame:EnableMouse(true) self.frame:EnableMouse(false)
self.frame:SetMovable(true) self.frame:SetMovable(true)
self.frame:RegisterForDrag("LeftButton") self.frame:RegisterForDrag("LeftButton")
@ -109,48 +112,69 @@ function Gladdy:UpdateFrame()
end end
local teamSize = self.curBracket or 0 local teamSize = self.curBracket or 0
local iconSize = self.db.healthBarHeight local highlightBorderSize = (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2)
local margin = 0 local leftSize = 0
local width = self.db.barWidth + self.db.padding * 2 + 5 local rightSize = 0
local height = self.db.healthBarHeight * teamSize + margin * (teamSize - 1) + self.db.padding * 2 + 5 --Trinket + Racial
local extraBarWidth = 0 if self.db.trinketEnabled and self.db.trinketPos == "LEFT" then
local extraBarHeight = 0 leftSize = leftSize + self.db.trinketSize * self.db.trinketWidthFactor + self.db.padding
if self.db.racialEnabled and self.db.racialAnchor == "trinket" and self.db.racialPos == "LEFT" then
leftSize = leftSize + self.db.racialSize * self.db.racialWidthFactor + self.db.padding
end
end
if self.db.trinketEnabled and self.db.trinketPos == "RIGHT" then
rightSize = rightSize + self.db.trinketSize * self.db.trinketWidthFactor + self.db.padding
if self.db.racialEnabled and self.db.racialAnchor == "trinket" and self.db.racialPos == "RIGHT" then
rightSize = rightSize + self.db.racialSize * self.db.racialWidthFactor + self.db.padding
end
end
--ClassIcon
if self.db.classIconPos == "LEFT" then
leftSize = leftSize + self.db.classIconSize * self.db.classIconWidthFactor + self.db.padding
else
rightSize = rightSize + self.db.classIconSize * self.db.classIconWidthFactor + self.db.padding
end
--Highlight
if not self.db.highlightInset then
leftSize = leftSize + self.db.highlightBorderSize
rightSize = rightSize + self.db.highlightBorderSize
end
-- Powerbar local margin = self.db.powerBarHeight + 1
iconSize = iconSize + self.db.powerBarHeight local width = self.db.barWidth + leftSize + rightSize
margin = margin + self.db.powerBarHeight local height = (self.db.healthBarHeight + self.db.powerBarHeight + 1) * teamSize
height = height + self.db.powerBarHeight * teamSize + (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize)
extraBarHeight = extraBarHeight + self.db.powerBarHeight + self.db.bottomMargin * (teamSize - 1)
-- Cooldown -- Highlight
margin = margin + 1 + self.db.highlightBorderSize * 2 + 1 -- + 1 space between health and power bar margin = margin + highlightBorderSize
height = height + self.db.highlightBorderSize * teamSize
if (self.db.cooldownYPos == "TOP" or self.db.cooldownYPos == "BOTTOM") and self.db.cooldown then if (self.db.cooldownYPos == "TOP" or self.db.cooldownYPos == "BOTTOM") and self.db.cooldown then
margin = margin + self.db.cooldownSize margin = margin + self.db.cooldownSize
height = height + self.db.cooldownSize * teamSize height = height + self.db.cooldownSize * (teamSize - 1)
end end
if (self.db.buffsCooldownPos == "TOP" or self.db.buffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then if (self.db.buffsCooldownPos == "TOP" or self.db.buffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
margin = margin + self.db.buffsIconSize margin = margin + self.db.buffsIconSize
height = height + self.db.buffsIconSize * teamSize height = height + self.db.buffsIconSize * (teamSize - 1)
end end
if (self.db.buffsBuffsCooldownPos == "TOP" or self.db.buffsBuffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then if (self.db.buffsBuffsCooldownPos == "TOP" or self.db.buffsBuffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
margin = margin + self.db.buffsBuffsIconSize margin = margin + self.db.buffsBuffsIconSize
height = height + self.db.buffsBuffsIconSize * teamSize height = height + self.db.buffsBuffsIconSize * (teamSize - 1)
end end
if self.db.buffsCooldownPos == "TOP" and self.db.cooldownYPos == "TOP" and self.db.cooldown and self.db.buffsEnabled then if self.db.buffsCooldownPos == "TOP" and self.db.cooldownYPos == "TOP" and self.db.cooldown and self.db.buffsEnabled then
margin = margin + 1 margin = margin + 1
height = height + (teamSize - 1)
end end
if self.db.buffsCooldownPos == "BOTTOM" and self.db.cooldownYPos == "BOTTOM" and self.db.cooldown and self.db.buffsEnabled then if self.db.buffsCooldownPos == "BOTTOM" and self.db.cooldownYPos == "BOTTOM" and self.db.cooldown and self.db.buffsEnabled then
margin = margin + 1 margin = margin + 1
height = height + (teamSize - 1)
end end
-- Classicon -- GrowDirection
width = width + iconSize if (self.db.growDirection == "LEFT" or self.db.growDirection == "RIGHT") then
extraBarWidth = extraBarWidth + iconSize width = self.db.barWidth * teamSize + (leftSize + rightSize) * teamSize + self.db.bottomMargin * (teamSize - 1)
height = self.db.healthBarHeight + self.db.powerBarHeight + 1
-- Trinket end
width = width + iconSize
self.frame:SetScale(self.db.frameScale) self.frame:SetScale(self.db.frameScale)
self.frame:SetWidth(width) self.frame:SetWidth(width)
@ -161,61 +185,79 @@ function Gladdy:UpdateFrame()
self.frame:SetPoint("CENTER") self.frame:SetPoint("CENTER")
else else
local scale = self.frame:GetEffectiveScale() local scale = self.frame:GetEffectiveScale()
if (self.db.growUp) then if (self.db.growDirection == "TOP") then
self.frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale) self.frame:SetPoint("BOTTOMLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale)
else else
self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale) self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, self.db.y / scale)
end end
end end
--Anchor
self.anchor:SetWidth(width) self.anchor:SetWidth(width)
self.anchor:ClearAllPoints() self.anchor:ClearAllPoints()
if (self.db.growUp) then if (self.db.growDirection == "TOP") then
self.anchor:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT") self.anchor:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
else elseif self.growDirection == "BOTTOM" or self.growDirection == "RIGHT" then
self.anchor:SetPoint("BOTTOMLEFT", self.frame, "TOPLEFT") self.anchor:SetPoint("BOTTOMLEFT", self.frame, "TOPLEFT")
else
self.anchor:SetPoint("BOTTOMRIGHT", self.frame, "TOPRIGHT")
end end
if (self.db.locked) then if (self.db.locked) then
self.anchor:Hide() self.anchor:Hide()
self.anchor:Hide()
else else
self.anchor:Show() self.anchor:Show()
end end
for i = 1, teamSize do for i = 1, teamSize do
local button = self.buttons["arena" .. i] local button = self.buttons["arena" .. i]
button:SetWidth(self.db.barWidth + extraBarWidth) button:SetWidth(self.db.barWidth)
button:SetHeight(self.db.healthBarHeight) button:SetHeight(self.db.healthBarHeight)
button.secure:SetWidth(self.db.barWidth + extraBarWidth) button.secure:SetWidth(self.db.barWidth)
button.secure:SetHeight(self.db.healthBarHeight + extraBarHeight) button.secure:SetHeight(self.db.healthBarHeight + self.db.powerBarHeight + 1)
button:ClearAllPoints() button:ClearAllPoints()
button.secure:ClearAllPoints() button.secure:ClearAllPoints()
if (self.db.growUp) then if (self.db.growDirection == "TOP") then
if (i == 1) then if (i == 1) then
button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", self.db.padding + 2, 0) button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, self.db.powerBarHeight + 1)
button.secure:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", self.db.padding + 2, 0) button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT")
else else
button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin) button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin)
button.secure:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin) button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT")
end end
else elseif (self.db.growDirection == "BOTTOM") then
if (i == 1) then if (i == 1) then
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", self.db.padding + 2, 0) button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0)
button.secure:SetPoint("TOPLEFT", self.frame, "TOPLEFT", self.db.padding + 2, 0) button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
else else
button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "BOTTOMLEFT", 0, -margin - self.db.bottomMargin) button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "BOTTOMLEFT", 0, -margin - self.db.bottomMargin)
button.secure:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "BOTTOMLEFT", 0, -margin - self.db.bottomMargin) button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
end
elseif (self.db.growDirection == "LEFT") then
if (i == 1) then
button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -rightSize, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
else
button:SetPoint("TOPRIGHT", self.buttons["arena" .. (i - 1)], "TOPLEFT", -rightSize - leftSize - self.db.bottomMargin, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
end
elseif (self.db.growDirection == "RIGHT") then
if (i == 1) then
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
else
button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "TOPRIGHT", leftSize + rightSize + self.db.bottomMargin, 0)
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
end end
end end
for k, v in self:IterModules() do for _, v in self:IterModules() do
self:Call(v, "UpdateFrame", button.unit) self:Call(v, "UpdateFrame", button.unit)
end end
end end
for k, v in self:IterModules() do for _, v in self:IterModules() do
self:Call(v, "UpdateFrameOnce") self:Call(v, "UpdateFrameOnce")
end end
end end
@ -257,7 +299,11 @@ function Gladdy:CreateButton(i)
end end
local button = CreateFrame("Frame", "GladdyButtonFrame" .. i, self.frame) local button = CreateFrame("Frame", "GladdyButtonFrame" .. i, self.frame)
button:SetAlpha(0) button:EnableMouse(false)
--button:SetAlpha(0)
--button.texture = button:CreateTexture(nil, "OVERLAY")
--button.texture:SetAllPoints(button)
--button.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate") local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate")
secure:RegisterForClicks("AnyUp") secure:RegisterForClicks("AnyUp")
@ -265,12 +311,9 @@ function Gladdy:CreateButton(i)
secure:SetAttribute("*type1", "target") secure:SetAttribute("*type1", "target")
secure:SetAttribute("*type2", "focus") secure:SetAttribute("*type2", "focus")
secure:SetAttribute("unit", "arena" .. i) secure:SetAttribute("unit", "arena" .. i)
--secure.texture = secure:CreateTexture(nil, "OVERLAY")
button:RegisterEvent("UNIT_NAME_UPDATE") --secure.texture:SetAllPoints(secure)
button:RegisterEvent("ARENA_OPPONENT_UPDATE") --secure.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
button:RegisterEvent("ARENA_COOLDOWNS_UPDATE")
button:RegisterEvent("ARENA_CROWD_CONTROL_SPELL_UPDATE")
button:RegisterUnitEvent("UNIT_CONNECTION", "arena" .. i)
button.id = i button.id = i
button.unit = "arena" .. i button.unit = "arena" .. i
@ -281,7 +324,21 @@ function Gladdy:CreateButton(i)
self.buttons[button.unit] = button self.buttons[button.unit] = button
for k, v in self:IterModules() do for _, v in self:IterModules() do
self:Call(v, "CreateFrame", button.unit) self:Call(v, "CreateFrame", button.unit)
end end
end
function Gladdy:GetAnchor(unit, position)
local anchor = "healthBar"
if Gladdy.db.classIconPos == position then
anchor = "classIcon"
end
if Gladdy.db.trinketPos == position then
anchor = "trinket"
end
if anchor == Gladdy.db.racialAnchor and Gladdy.db.racialPos == position then
anchor = "racial"
end
return Gladdy.buttons[unit][anchor]
end end

View File

@ -11,6 +11,9 @@ local IsAddOnLoaded = IsAddOnLoaded
local IsInInstance = IsInInstance local IsInInstance = IsInInstance
local GetBattlefieldStatus = GetBattlefieldStatus local GetBattlefieldStatus = GetBattlefieldStatus
local IsActiveBattlefieldArena = IsActiveBattlefieldArena local IsActiveBattlefieldArena = IsActiveBattlefieldArena
local RELEASE_TYPES = { alpha = "Alpha", beta = "Beta", release = "Release"}
local PREFIX = "TBC-Classic_v"
local VERSION_REGEX = PREFIX .. "(%d+%.%d+)%-(%a)"
--------------------------- ---------------------------
@ -21,9 +24,12 @@ local IsActiveBattlefieldArena = IsActiveBattlefieldArena
local MAJOR, MINOR = "Gladdy", 4 local MAJOR, MINOR = "Gladdy", 4
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR) local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
local L local L
Gladdy.version_major = "TBC-Classic_v1" Gladdy.version_major_num = 1
Gladdy.version_minor = "0.4-Beta" Gladdy.version_minor_num = 0.08
Gladdy.version = Gladdy.version_major .. "." .. Gladdy.version_minor Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
Gladdy.version_releaseType = RELEASE_TYPES.beta
Gladdy.version = PREFIX .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType
Gladdy.VERSION_REGEX = VERSION_REGEX
LibStub("AceTimer-3.0"):Embed(Gladdy) LibStub("AceTimer-3.0"):Embed(Gladdy)
LibStub("AceComm-3.0"):Embed(Gladdy) LibStub("AceComm-3.0"):Embed(Gladdy)
@ -160,6 +166,25 @@ end
--------------------------- ---------------------------
function Gladdy:DeleteUnknownOptions(tbl, refTbl, str)
if str == nil then
str = "Gladdy.db"
end
for k,v in pairs(tbl) do
if refTbl[k] == nil then
--Gladdy:Print("SavedVariable deleted:", str .. "." .. k, "not found!")
tbl[k] = nil
else
if type(v) ~= type(refTbl[k]) then
--Gladdy:Print("SavedVariable deleted:", str .. "." .. k, "type error!", "Expected", type(refTbl[k]), "but found", type(v))
tbl[k] = nil
elseif type(v) == "table" then
Gladdy:DeleteUnknownOptions(v, refTbl[k], str .. "." .. k)
end
end
end
end
function Gladdy:OnInitialize() function Gladdy:OnInitialize()
self.dbi = LibStub("AceDB-3.0"):New("GladdyXZ", self.defaults) self.dbi = LibStub("AceDB-3.0"):New("GladdyXZ", self.defaults)
self.dbi.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged") self.dbi.RegisterCallback(self, "OnProfileChanged", "OnProfileChanged")
@ -201,10 +226,12 @@ function Gladdy:OnInitialize()
for k, v in self:IterModules() do for k, v in self:IterModules() do
self:Call(v, "Initialize") -- B.E > A.E :D self:Call(v, "Initialize") -- B.E > A.E :D
end end
self:DeleteUnknownOptions(self.db, self.defaults.profile)
end end
function Gladdy:OnProfileChanged() function Gladdy:OnProfileChanged()
self.db = self.dbi.profile self.db = self.dbi.profile
self:DeleteUnknownOptions(self.db, self.defaults.profile)
self:HideFrame() self:HideFrame()
self:ToggleFrame(3) self:ToggleFrame(3)

View File

@ -1,6 +1,6 @@
## Interface: 20501 ## Interface: 20501
## Title: Gladdy - TBC ## Title: Gladdy - TBC
## Version: 1.0.4-Beta ## Version: 1.08-Beta
## Notes: The most powerful arena AddOn for WoW 2.5.1 ## Notes: The most powerful arena AddOn for WoW 2.5.1
## Author: XiconQoo, DnB_Junkee, Knall ## Author: XiconQoo, DnB_Junkee, Knall
## X-Email: contact me on discord Knall#1751 ## X-Email: contact me on discord Knall#1751
@ -14,6 +14,7 @@ Lang.lua
Frame.lua Frame.lua
Options.lua Options.lua
Constants.lua Constants.lua
ImportStrings.lua
Modules\Announcements.lua Modules\Announcements.lua
Modules\Healthbar.lua Modules\Healthbar.lua
@ -25,6 +26,7 @@ Modules\Diminishings.lua
Modules\Highlight.lua Modules\Highlight.lua
Modules\TotemPlates.lua Modules\TotemPlates.lua
Modules\Trinket.lua Modules\Trinket.lua
Modules\Racial.lua
Modules\Cooldowns.lua Modules\Cooldowns.lua
Modules\ArenaCountDown.lua Modules\ArenaCountDown.lua
Modules\BuffsDebuffs.lua Modules\BuffsDebuffs.lua
@ -32,4 +34,5 @@ Modules\VersionCheck.lua
Modules\XiconProfiles.lua Modules\XiconProfiles.lua
Modules\Pets.lua Modules\Pets.lua
Modules\ExportImport.lua Modules\ExportImport.lua
Modules\CombatIndicator.lua
EventListener.lua EventListener.lua

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Images/mask.blp Normal file

Binary file not shown.

17
ImportStrings.lua Normal file

File diff suppressed because one or more lines are too long

View File

@ -6,8 +6,6 @@ assert(LibStub, string.format("%s requires LibStub.", major))
local Data = LibStub:NewLibrary(major, minor) local Data = LibStub:NewLibrary(major, minor)
if( not Data ) then return end if( not Data ) then return end
if( IS_WRATH_BUILD == nil ) then IS_WRATH_BUILD = (select(4, GetBuildInfo()) >= 30000) end
-- How long before DR resets -- How long before DR resets
Data.RESET_TIME = 18 Data.RESET_TIME = 18
@ -234,42 +232,6 @@ Data.spells = {
[10912] = "charm", [10912] = "charm",
} }
-- Add WoTLK spells
if( IS_WRATH_BUILD ) then
-- Death Coil
Data.spells[47859] = "dc"
Data.spells[47860] = "dc"
-- Wyvern Sting
Data.spells[49011] = "sleep"
Data.spells[49012] = "sleep"
-- Entangling Roots
Data.spells[53308] = "root"
-- Frost Nova
Data.spells[42917] = "root"
-- Intercept (Remove all except this one come WoTLK)
Data.spells[20252] = "ctrlstun"
-- Pounce
Data.spells[49803] = "ctrlstun"
-- Polymorph
Data.spells[61305] = "disorient"
Data.spells[61025] = "disorient"
-- Sap
Data.spells[51724] = "disorient"
-- Maim
Data.spells[49802] = "disorient"
-- Hex (Guessing)
Data.spells[51514] = "disorient"
end
-- DR Category names -- DR Category names
Data.typeNames = { Data.typeNames = {
["disorient"] = "Disorients", ["disorient"] = "Disorients",

View File

@ -59,41 +59,107 @@ Buff({ 33891 }, { buffType = "form"}, "DRUID") -- Tree of Life
Buff({ 16864 }, { buffType = "magic"}, "DRUID") -- Omen of Clarity Buff({ 16864 }, { buffType = "magic"}, "DRUID") -- Omen of Clarity
Buff({ 16689, 16810, 16811, 16812, 16813, 17329, 27009 }, { buffType = "magic"}, "DRUID") -- Nature's Grasp Buff({ 16689, 16810, 16811, 16812, 16813, 17329, 27009 }, { buffType = "magic"}, "DRUID") -- Nature's Grasp
Buff({ 45281, 45282, 45283 }, { buffType = "magic"}, "DRUID") -- Natural Perfection Buff({ 45281, 45282, 45283 }, { buffType = "magic"}, "DRUID") -- Natural Perfection
Buff({ 16188 }, { buffType = "magic"}, "DRUID") -- Nature's Swiftness Buff({ 17116 }, { buffType = "magic"}, "DRUID") -- Nature's Swiftness
Buff({ 17007 }, { buffType = "aura"}, "DRUID") -- Leader of the Pack Buff({ 17007 }, { buffType = "aura"}, "DRUID") -- Leader of the Pack
------------- -------------
-- WARRIOR -- WARRIOR -- TODO
------------- -------------
--Buff({ 29703 }, { buffType = "physical"}, "WARRIOR") -- Dazed Buff({ 29838 }, { buffType = "physical"}, "WARRIOR") -- Second Wind
Buff({ 12292 }, { buffType = "physical"}, "WARRIOR") -- Death Wish
Buff({ 6673 }, { buffType = "physical"}, "WARRIOR") -- Battle Shout
Buff({ 469 }, { buffType = "physical"}, "WARRIOR") -- Commanding Shout
Buff({ 12328 }, { buffType = "physical"}, "WARRIOR") -- Sweeping Strikes
Buff({ 30032 }, { buffType = "physical"}, "WARRIOR") -- Rampage
Buff({ 2687 }, { buffType = "physical"}, "WARRIOR") -- Blood Rage
Buff({ 20230 }, { buffType = "physical"}, "WARRIOR") -- Retaliation
Buff({ 871 }, { buffType = "physical"}, "WARRIOR") -- Shield Wall
Buff({ 18499 }, { buffType = "physical"}, "WARRIOR") -- Berserker Rage
Buff({ 23885 }, { buffType = "physical"}, "WARRIOR") -- Bloodthirst
Buff({ 3411 }, { buffType = "physical"}, "WARRIOR") -- Intervene
-------------- --------------
-- ROGUE -- ROGUE -- TODO
-------------- --------------
Buff({ 2983 }, { buffType = "physical" }, "ROGUE") -- Sprint Buff({ 2983 }, { buffType = "physical" }, "ROGUE") -- Sprint
Buff({ 5277 }, { buffType = "physical" }, "ROGUE") -- Evasion Buff({ 5277 }, { buffType = "physical" }, "ROGUE") -- Evasion
Buff({ 31224 }, { buffType = "physical" }, "ROGUE") -- Cloak of Shadows
Buff({ 14278 }, { buffType = "physical" }, "ROGUE") -- Ghostly Strike
------------ ------------
-- WARLOCK -- WARLOCK --TODO
------------ ------------
Buff({ 19028 }, { buffType = "immune"}, "WARLOCK") -- Soul Link Buff({ 19028 }, { buffType = "aura"}, "WARLOCK") -- Soul Link
Buff({ 23759 }, { buffType = "immune"}, "WARLOCK") -- Master Demonologist Buff({ 696 }, { buffType = "aura"}, "WARLOCK") -- Demon Skin
Buff({ 706 }, { buffType = "aura"}, "WARLOCK") -- Demon Armor
Buff({ 28176 }, { buffType = "aura"}, "WARLOCK") -- Fel Armor
Buff({ 23759 }, { buffType = "aura"}, "WARLOCK") -- Master Demonologist
Buff({ 34936 }, { buffType = "magic"}, "WARLOCK") -- Backlash
Buff({ 5697 }, { buffType = "magic"}, "WARLOCK") -- Unending Breath
Buff({ 132 }, { buffType = "magic"}, "WARLOCK") -- Detect Invisibility
Buff({ 1949 }, { buffType = "aura"}, "WARLOCK") -- Hellfire
Buff({ 6229 }, { buffType = "magic"}, "WARLOCK") -- Shadow Ward
Buff({ 19480 }, { buffType = "magic"}, "WARLOCK") -- Paranoia
Buff({ 7812 }, { buffType = "magic"}, "WARLOCK") -- Sacrifice
Buff({ 2947 }, { buffType = "magic"}, "WARLOCK") -- Fire Shield
--------------- ---------------
-- SHAMAN -- SHAMAN
--------------- ---------------
Buff({ 8178 } ,{ buffType = "magic" }, "SHAMAN") -- Grounding Totem Effect Buff({ 8178 } ,{ buffType = "magic" }, "SHAMAN") -- Grounding Totem Effect
Buff({ 30823 } ,{ buffType = "magic" }, "SHAMAN") -- Shamanistic Rage
Buff({ 32182 } ,{ buffType = "magic" }, "SHAMAN") -- Heroism
Buff({ 2825 } ,{ buffType = "magic" }, "SHAMAN") -- Bloodlust
Buff({ 974 } ,{ buffType = "magic" }, "SHAMAN") -- Earth Shield
Buff({ 24398 } ,{ buffType = "magic" }, "SHAMAN") -- Water Shield
Buff({ 324 } ,{ buffType = "magic" }, "SHAMAN") -- Lightning Shield
Buff({ 16188 } ,{ buffType = "magic" }, "SHAMAN") -- Nature's Swiftness
Buff({ 16166 } ,{ buffType = "magic" }, "SHAMAN") -- Elemental Mastery
-------------- --------------
-- PALADIN -- PALADIN --TODO
-------------- --------------
--Blessings
--Buff( { 25771 }, { buffType = "immune"}, "PALADIN") -- Forbearance Buff( { 1022, 5599, 10278 }, { buffType = "magic"}, "PALADIN") -- Blessing of Protection
Buff( { 6940 }, { buffType = "magic"}, "PALADIN") -- Blessing of Sacrifice
Buff( { 1044 }, { buffType = "magic"}, "PALADIN") -- Blessing of Freedom
Buff( { 19740, 19834, 19835, 19836, 19837, 19838, 25291, 27140 }, { buffType = "magic"}, "PALADIN") -- Blessing of Might
Buff( { 19742 }, { buffType = "magic"}, "PALADIN") -- Blessing of Wisdom
Buff( { 20217 }, { buffType = "magic"}, "PALADIN") -- Blessing of Kings
Buff( { 19977 }, { buffType = "magic"}, "PALADIN") -- Blessing of Light
Buff( { 1038 }, { buffType = "magic"}, "PALADIN") -- Blessing of Salvation
Buff( { 20911 }, { buffType = "magic"}, "PALADIN") -- Blessing of Sanctuary
Buff( { 25898 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Kings
Buff( { 25890 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Light
Buff( { 25782 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Might
Buff( { 25895 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Salvation
Buff( { 25899 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Sanctuary
Buff( { 25894 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Wisdom
Buff( { 642 }, { buffType = "magic"}, "PALADIN") -- Divine Shield
--Auras
Buff( { 465, 10290, 643, 10291, 1032, 10292, 10293, 27149 }, { buffType = "aura"}, "PALADIN") -- Devotion Aura
Buff( { 7294 }, { buffType = "aura"}, "PALADIN") -- Retribution Aura
Buff( { 19746 }, { buffType = "aura"}, "PALADIN") -- Concentration Aura
Buff( { 19876 }, { buffType = "aura"}, "PALADIN") -- Shadow Resistance Aura
Buff( { 20218 }, { buffType = "aura"}, "PALADIN") -- Sanctity Aura
Buff( { 19888 }, { buffType = "aura"}, "PALADIN") -- Frost Resistance Aura
Buff( { 19891 }, { buffType = "aura"}, "PALADIN") -- Fire Resistance Aura
Buff( { 32223 }, { buffType = "aura"}, "PALADIN") -- Crusader Aura
--Seals
Buff( { 20154, 20287, 20288, 20289, 20290, 20291, 20292, 20293, 27155 }, { buffType = "magic"}, "PALADIN") -- Seal of Righteousness
Buff( { 31892 }, { buffType = "magic"}, "PALADIN") -- Seal of Blood
Buff( { 20375 }, { buffType = "magic"}, "PALADIN") -- Seal of Command
Buff( { 20164 }, { buffType = "magic"}, "PALADIN") -- Seal of Justice
Buff( { 20165 }, { buffType = "magic"}, "PALADIN") -- Seal of Light
Buff( { 15277 }, { buffType = "magic"}, "PALADIN") -- Seal of Reckoning
Buff( { 31801 }, { buffType = "magic"}, "PALADIN") -- Seal of Vengeance
Buff( { 20166 }, { buffType = "magic"}, "PALADIN") -- Seal of Wisdom
Buff( { 21082 }, { buffType = "magic"}, "PALADIN") -- Seal of the Crusade
------------- -------------

View File

@ -1,5 +1,6 @@
local type, ipairs, pairs, tinsert = type, ipairs, pairs, tinsert local type, ipairs, pairs, tinsert = type, ipairs, pairs, tinsert
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF
local LibClassAuras = LibStub:NewLibrary("LibClassAuras-1.0", 1) local LibClassAuras = LibStub:NewLibrary("LibClassAuras-1.0", 1)
LibClassAuras.debuffs = {} LibClassAuras.debuffs = {}
@ -71,4 +72,14 @@ local function getClassBuffs(class)
end end
return classSpells return classSpells
end end
LibClassAuras.GetClassBuffs = getClassBuffs LibClassAuras.GetClassBuffs = getClassBuffs
local function getSpellNameToId(auraType)
if auraType == AURA_TYPE_DEBUFF then
return LibClassAuras.debuffToId
else
return LibClassAuras.buffToId
end
end
LibClassAuras.GetSpellNameToId = getSpellNameToId

View File

@ -21,12 +21,12 @@ local Announcements = Gladdy:NewModule("Announcements", nil, {
drinks = true, drinks = true,
resurrections = true, resurrections = true,
enemy = false, enemy = false,
spec = false, spec = true,
health = false, health = false,
healthThreshold = 20, healthThreshold = 20,
trinketUsed = true, trinketUsed = true,
trinketReady = false, trinketReady = false,
dest = "self", dest = "party",
}, },
}) })

View File

@ -1,5 +1,5 @@
local select, floor, str_len, tostring, str_sub, str_find = select, math.floor, string.len, tostring, string.sub, string.find local floor, str_len, tostring, str_sub, str_find = math.floor, string.len, tostring, string.sub, string.find
local IsInInstance = IsInInstance local CreateFrame = CreateFrame
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
@ -8,87 +8,88 @@ local ACDFrame = Gladdy:NewModule("Countdown", nil, {
arenaCountdownSize = 256 arenaCountdownSize = 256
}) })
function ACDFrame:OnEvent(event, ...)
self[event](self, ...)
end
function ACDFrame:Initialize() function ACDFrame:Initialize()
self.hidden = false self.hidden = false
self.countdown = -1 self.countdown = -1
self.texturePath = "Interface\\AddOns\\Gladdy\\Images\\Countdown\\"; self.texturePath = "Interface\\AddOns\\Gladdy\\Images\\Countdown\\";
ACDFrame:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
ACDFrame:RegisterEvent("PLAYER_ENTERING_WORLD") local ACDNumFrame = CreateFrame("Frame", "ACDNumFrame", UIParent)
ACDNumFrame:EnableMouse(false)
ACDNumFrame:SetHeight(256)
ACDNumFrame:SetWidth(256)
ACDNumFrame:SetPoint("CENTER", 0, 128)
ACDNumFrame:Show()
self.ACDNumFrame = ACDNumFrame
local ACDNumTens = ACDNumFrame:CreateTexture("ACDNumTens", "HIGH")
ACDNumTens:SetWidth(256)
ACDNumTens:SetHeight(128)
ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -48, 0)
self.ACDNumTens = ACDNumTens
local ACDNumOnes = ACDNumFrame:CreateTexture("ACDNumOnes", "HIGH")
ACDNumOnes:SetWidth(256)
ACDNumOnes:SetHeight(128)
ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", 48, 0)
self.ACDNumOnes = ACDNumOnes
local ACDNumOne = ACDNumFrame:CreateTexture("ACDNumOne", "HIGH")
ACDNumOne:SetWidth(256)
ACDNumOne:SetHeight(128)
ACDNumOne:SetPoint("CENTER", ACDNumFrame, "CENTER", 0, 0)
self.ACDNumOne = ACDNumOne
self:RegisterMessage("JOINED_ARENA")
end end
function ACDFrame:OnEvent(event, ...) function ACDFrame.OnUpdate(self, elapse)
-- functions created in "object:method"-style have an implicit first parameter of "self", which points to object if (self.countdown > 0 and Gladdy.db.countdown) then
self[event](self, ...) -- route event parameters to LoseControl:event methods self.hidden = false;
end
ACDFrame:SetScript("OnEvent", ACDFrame.OnEvent)
if ((floor(self.countdown) ~= floor(self.countdown - elapse)) and (floor(self.countdown - elapse) >= 0)) then
local str = tostring(floor(self.countdown - elapse));
local ACDNumFrame = CreateFrame("Frame", "ACDNumFrame", UIParent) if (floor(self.countdown - elapse) == 0) then
ACDNumFrame:SetHeight(256) self.ACDNumTens:Hide();
ACDNumFrame:SetWidth(256) self.ACDNumOnes:Hide();
ACDNumFrame:SetPoint("CENTER", 0, 128) self.ACDNumOne:Hide();
ACDNumFrame:Show() elseif (str_len(str) == 2) then
-- Display has 2 digits
self.ACDNumOne:Hide();
self.ACDNumTens:Show();
self.ACDNumOnes:Show();
local ACDNumTens = ACDNumFrame:CreateTexture("ACDNumTens", "HIGH") self.ACDNumTens:SetTexture(self.texturePath .. str_sub(str, 0, 1));
ACDNumTens:SetWidth(256) self.ACDNumOnes:SetTexture(self.texturePath .. str_sub(str, 2, 2));
ACDNumTens:SetHeight(128) self.ACDNumFrame:SetScale(0.7)
ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -48, 0) elseif (str_len(str) == 1) then
-- Display has 1 digit
local ACDNumOnes = ACDNumFrame:CreateTexture("ACDNumOnes", "HIGH") self.ACDNumOne:Show();
ACDNumOnes:SetWidth(256) self.ACDNumOne:SetTexture(self.texturePath .. str_sub(str, 0, 1));
ACDNumOnes:SetHeight(128) self.ACDNumOnes:Hide();
ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", 48, 0) self.ACDNumTens:Hide();
self.ACDNumFrame:SetScale(1.0)
local ACDNumOne = ACDNumFrame:CreateTexture("ACDNumOne", "HIGH")
ACDNumOne:SetWidth(256)
ACDNumOne:SetHeight(128)
ACDNumOne:SetPoint("CENTER", ACDNumFrame, "CENTER", 0, 0)
function ACDFrame:PLAYER_ENTERING_WORLD()
local instanceType = select(2, IsInInstance())
if (( instanceType == "arena" )) then
ACDFrame:SetScript("OnUpdate", function(self, elapse)
if (self.countdown > 0 and Gladdy.db.countdown) then
self.hidden = false;
if ((floor(self.countdown) ~= floor(self.countdown - elapse)) and (floor(self.countdown - elapse) >= 0)) then
local str = tostring(floor(self.countdown - elapse));
if (floor(self.countdown - elapse) == 0) then
ACDNumTens:Hide();
ACDNumOnes:Hide();
ACDNumOne:Hide();
elseif (str_len(str) == 2) then
-- Display has 2 digits
ACDNumOne:Hide();
ACDNumTens:Show();
ACDNumOnes:Show();
ACDNumTens:SetTexture(self.texturePath .. str_sub(str, 0, 1));
ACDNumOnes:SetTexture(self.texturePath .. str_sub(str, 2, 2));
ACDNumFrame:SetScale(0.7)
elseif (str_len(str) == 1) then
-- Display has 1 digit
ACDNumOne:Show();
ACDNumOne:SetTexture(self.texturePath .. str_sub(str, 0, 1));
ACDNumOnes:Hide();
ACDNumTens:Hide();
ACDNumFrame:SetScale(1.0)
end
end
self.countdown = self.countdown - elapse;
else
self.hidden = true;
ACDNumTens:Hide();
ACDNumOnes:Hide();
ACDNumOne:Hide();
end end
end
end) self.countdown = self.countdown - elapse;
else
self.hidden = true;
self.ACDNumTens:Hide();
self.ACDNumOnes:Hide();
self.ACDNumOne:Hide();
end end
end end
function ACDFrame:JOINED_ARENA()
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
self:SetScript("OnEvent", ACDFrame.OnEvent)
self:SetScript("OnUpdate", ACDFrame.OnUpdate)
end
function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg) function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
if (str_find(msg, "L'ar\195\168ne ouvre ses portes dans 60 secondes !")) then if (str_find(msg, "L'ar\195\168ne ouvre ses portes dans 60 secondes !")) then
self.countdown = 61 self.countdown = 61
@ -129,29 +130,36 @@ function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
end end
function ACDFrame:UpdateFrame() function ACDFrame:UpdateFrame()
ACDNumFrame:SetHeight(Gladdy.db.arenaCountdownSize) self.ACDNumFrame:SetHeight(Gladdy.db.arenaCountdownSize)
ACDNumFrame:SetWidth(Gladdy.db.arenaCountdownSize) self.ACDNumFrame:SetWidth(Gladdy.db.arenaCountdownSize)
ACDNumFrame:SetPoint("CENTER", 0, 128) self.ACDNumFrame:SetPoint("CENTER", 0, 128)
ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize) self.ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize)
ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize/2) self.ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize/2)
ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -(Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0) self.ACDNumTens:SetPoint("CENTER", self.ACDNumFrame, "CENTER", -(Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
ACDNumOnes:SetWidth(Gladdy.db.arenaCountdownSize) self.ACDNumOnes:SetWidth(Gladdy.db.arenaCountdownSize)
ACDNumOnes:SetHeight(Gladdy.db.arenaCountdownSize/2) self.ACDNumOnes:SetHeight(Gladdy.db.arenaCountdownSize/2)
ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", (Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0) self.ACDNumOnes:SetPoint("CENTER", self.ACDNumFrame, "CENTER", (Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
ACDNumOne:SetWidth(Gladdy.db.arenaCountdownSize) self.ACDNumOne:SetWidth(Gladdy.db.arenaCountdownSize)
ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize/2) self.ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize/2)
ACDNumOne:SetPoint("CENTER", ACDNumFrame, "CENTER", 0, 0) self.ACDNumOne:SetPoint("CENTER", self.ACDNumFrame, "CENTER", 0, 0)
end end
function ACDFrame:Test() function ACDFrame:Test()
self.countdown = 30 self.countdown = 30
self:JOINED_ARENA()
end end
function ACDFrame:Reset() function ACDFrame:Reset()
self.countdown = 0 self.countdown = 0
self:UnregisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
self:SetScript("OnUpdate", nil)
self.hidden = true;
self.ACDNumTens:Hide();
self.ACDNumOnes:Hide();
self.ACDNumOne:Hide();
end end
function ACDFrame:GetOptions() function ACDFrame:GetOptions()

View File

@ -1,4 +1,4 @@
local pairs, ipairs, select, tinsert, tbl_sort = pairs, ipairs, select, tinsert, table.sort local pairs, ipairs, select, tinsert, tbl_sort, tostring = pairs, ipairs, select, tinsert, table.sort, tostring
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local CreateFrame, GetTime = CreateFrame, GetTime local CreateFrame, GetTime = CreateFrame, GetTime
@ -10,9 +10,10 @@ local function defaultSpells(auraType)
local spells = {} local spells = {}
for k,v in pairs(Gladdy:GetImportantAuras()) do for k,v in pairs(Gladdy:GetImportantAuras()) do
if not auraType or auraType == v.track then if not auraType or auraType == v.track then
spells[k] = {} spells[tostring(v.spellID)] = {}
spells[k].enabled = true spells[tostring(v.spellID)].enabled = true
spells[k].priority = v.priority spells[tostring(v.spellID)].priority = v.priority
spells[tostring(v.spellID)].track = v.track
end end
end end
return spells return spells
@ -42,6 +43,7 @@ end
function Auras:CreateFrame(unit) function Auras:CreateFrame(unit)
local auraFrame = CreateFrame("Frame", nil, Gladdy.modules.Classicon.frames[unit]) local auraFrame = CreateFrame("Frame", nil, Gladdy.modules.Classicon.frames[unit])
auraFrame:EnableMouse(false)
auraFrame:SetFrameStrata("MEDIUM") auraFrame:SetFrameStrata("MEDIUM")
auraFrame:SetFrameLevel(3) auraFrame:SetFrameLevel(3)
@ -59,6 +61,7 @@ function Auras:CreateFrame(unit)
auraFrame.cooldownFrame:SetFrameLevel(5) auraFrame.cooldownFrame:SetFrameLevel(5)
auraFrame.icon = auraFrame:CreateTexture(nil, "BACKGROUND") auraFrame.icon = auraFrame:CreateTexture(nil, "BACKGROUND")
auraFrame.icon:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
auraFrame.icon:SetAllPoints(auraFrame) auraFrame.icon:SetAllPoints(auraFrame)
auraFrame.icon.overlay = auraFrame.cooldownFrame:CreateTexture(nil, "OVERLAY") auraFrame.icon.overlay = auraFrame.cooldownFrame:CreateTexture(nil, "OVERLAY")
@ -68,16 +71,6 @@ function Auras:CreateFrame(unit)
local classIcon = Gladdy.modules.Classicon.frames[unit] local classIcon = Gladdy.modules.Classicon.frames[unit]
auraFrame:ClearAllPoints() auraFrame:ClearAllPoints()
auraFrame:SetAllPoints(classIcon) auraFrame:SetAllPoints(classIcon)
auraFrame:SetScript("OnUpdate", function(self, elapsed)
if (self.active) then
if (self.timeLeft <= 0) then
Auras:AURA_FADE(unit)
else
self.timeLeft = self.timeLeft - elapsed
self.text:SetFormattedText("%.1f", self.timeLeft)
end
end
end)
auraFrame.text = auraFrame.cooldownFrame:CreateFontString(nil, "OVERLAY") auraFrame.text = auraFrame.cooldownFrame:CreateFontString(nil, "OVERLAY")
auraFrame.text:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), 10, "OUTLINE") auraFrame.text:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), 10, "OUTLINE")
@ -88,6 +81,17 @@ function Auras:CreateFrame(unit)
auraFrame.text:SetPoint("CENTER") auraFrame.text:SetPoint("CENTER")
auraFrame.unit = unit auraFrame.unit = unit
auraFrame:SetScript("OnUpdate", function(self, elapsed)
if (self.active) then
if (self.timeLeft <= 0) then
Auras:AURA_FADE(self.unit, self.track)
else
self.timeLeft = self.timeLeft - elapsed
self.text:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
end
end
end)
self.frames[unit] = auraFrame self.frames[unit] = auraFrame
self:ResetUnit(unit) self:ResetUnit(unit)
end end
@ -121,6 +125,7 @@ function Auras:UpdateFrame(unit)
else else
auraFrame.icon.overlay:SetVertexColor(0, 0, 0, 1) auraFrame.icon.overlay:SetVertexColor(0, 0, 0, 1)
end end
auraFrame.icon.overlay:Hide()
if Gladdy.db.auraDisableCircle then if Gladdy.db.auraDisableCircle then
auraFrame.cooldown:SetAlpha(0) auraFrame.cooldown:SetAlpha(0)
end end
@ -128,24 +133,30 @@ end
function Auras:ResetUnit(unit) function Auras:ResetUnit(unit)
self.frames[unit]:UnregisterAllEvents() self.frames[unit]:UnregisterAllEvents()
self:AURA_FADE(unit) self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AURA_FADE(unit, AURA_TYPE_BUFF)
end end
function Auras:Test(unit) function Auras:Test(unit)
local aura, _, icon local spellName, _, icon
if (unit == "arena1") then if (unit == "arena1") then
aura, _, icon = GetSpellInfo(12826) spellName, _, icon = GetSpellInfo(12826)
elseif (unit == "arena4") then self:AURA_FADE(unit, AURA_TYPE_BUFF)
aura, _, icon = GetSpellInfo(6770) self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 12826, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
elseif (unit == "arena2") then
spellName, _, icon = GetSpellInfo(6770)
self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_FADE(unit,AURA_TYPE_DEBUFF)
self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 6770, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
elseif (unit == "arena3") then elseif (unit == "arena3") then
aura, _, icon = GetSpellInfo(31224) spellName, _, icon = GetSpellInfo(31224)
end self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_GAIN(unit,AURA_TYPE_BUFF, 31224, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
if (aura) then spellName, _, icon = GetSpellInfo(18425)
--(unit, auraType, spellID, aura, icon, duration, expirationTime, count, debuffType) self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AURA_GAIN(unit,nil, nil, aura, icon, self.auras[aura].duration, GetTime() + self.auras[aura].duration) self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 18425, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
--self:AURA_FADE(unit)
end end
end end
@ -156,31 +167,36 @@ function Auras:JOINED_ARENA()
end end
end end
function Auras:AURA_GAIN(unit, auraType, spellID, aura, icon, duration, expirationTime, count, debuffType) function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, expirationTime, count, debuffType)
if not Gladdy.db.auraListDefault[aura] or not Gladdy.db.auraListDefault[aura].enabled then
return
end
local auraFrame = self.frames[unit] local auraFrame = self.frames[unit]
if (not auraFrame) then if (not auraFrame) then
return return
end end
if (auraFrame.priority and auraFrame.priority > Gladdy.db.auraListDefault[aura].priority) then if not self.auras[spellName] then
return
end
-- don't use spellId from combatlog, in case of different spellrank
if not Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)] or not Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)].enabled then
return
end
if (auraFrame.priority and auraFrame.priority > Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)].priority) then
return return
end end
auraFrame.startTime = expirationTime - duration auraFrame.startTime = expirationTime - duration
auraFrame.endTime = expirationTime auraFrame.endTime = expirationTime
auraFrame.name = aura auraFrame.name = spellName
auraFrame.timeLeft = expirationTime - GetTime() auraFrame.timeLeft = expirationTime - GetTime()
auraFrame.priority = Gladdy.db.auraListDefault[aura].priority auraFrame.priority = Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)].priority
auraFrame.icon:SetTexture(icon) auraFrame.icon:SetTexture(icon)
auraFrame.track = self.auras[aura].track auraFrame.track = auraType
auraFrame.active = true auraFrame.active = true
auraFrame.icon.overlay:SetTexture(Gladdy.db.auraBorderStyle) auraFrame.icon.overlay:Show()
auraFrame.cooldownFrame:Show() auraFrame.cooldownFrame:Show()
if auraFrame.track and auraFrame.track == AURA_TYPE_DEBUFF then if auraType == AURA_TYPE_DEBUFF then
auraFrame.icon.overlay:SetVertexColor(Gladdy.db.auraDebuffBorderColor.r, Gladdy.db.auraDebuffBorderColor.g, Gladdy.db.auraDebuffBorderColor.b, Gladdy.db.auraDebuffBorderColor.a) auraFrame.icon.overlay:SetVertexColor(Gladdy.db.auraDebuffBorderColor.r, Gladdy.db.auraDebuffBorderColor.g, Gladdy.db.auraDebuffBorderColor.b, Gladdy.db.auraDebuffBorderColor.a)
elseif auraFrame.track and auraFrame.track == AURA_TYPE_BUFF then elseif auraType == AURA_TYPE_BUFF then
auraFrame.icon.overlay:SetVertexColor(Gladdy.db.auraBuffBorderColor.r, Gladdy.db.auraBuffBorderColor.g, Gladdy.db.auraBuffBorderColor.b, Gladdy.db.auraBuffBorderColor.a) auraFrame.icon.overlay:SetVertexColor(Gladdy.db.auraBuffBorderColor.r, Gladdy.db.auraBuffBorderColor.g, Gladdy.db.auraBuffBorderColor.b, Gladdy.db.auraBuffBorderColor.a)
else else
auraFrame.icon.overlay:SetVertexColor(Gladdy.db.frameBorderColor.r, Gladdy.db.frameBorderColor.g, Gladdy.db.frameBorderColor.b, Gladdy.db.frameBorderColor.a) auraFrame.icon.overlay:SetVertexColor(Gladdy.db.frameBorderColor.r, Gladdy.db.frameBorderColor.g, Gladdy.db.frameBorderColor.b, Gladdy.db.frameBorderColor.a)
@ -191,9 +207,9 @@ function Auras:AURA_GAIN(unit, auraType, spellID, aura, icon, duration, expirati
end end
end end
function Auras:AURA_FADE(unit) function Auras:AURA_FADE(unit, auraType)
local auraFrame = self.frames[unit] local auraFrame = self.frames[unit]
if (not auraFrame) then if (not auraFrame or auraFrame.track ~= auraType) then
return return
end end
if auraFrame.active then if auraFrame.active then
@ -208,7 +224,7 @@ function Auras:AURA_FADE(unit)
auraFrame.endTime = nil auraFrame.endTime = nil
auraFrame.icon:SetTexture("") auraFrame.icon:SetTexture("")
auraFrame.text:SetText("") auraFrame.text:SetText("")
auraFrame.icon.overlay:SetTexture("") auraFrame.icon.overlay:Hide()
auraFrame.cooldownFrame:Hide() auraFrame.cooldownFrame:Hide()
end end
@ -249,6 +265,13 @@ function Auras:GetOptions()
step = 0.1, step = 0.1,
order = 4, order = 4,
}), }),
}
},
font = {
type = "group",
name = L["Font"],
order = 2,
args = {
auraFont = Gladdy:option({ auraFont = Gladdy:option({
type = "select", type = "select",
name = L["Font"], name = L["Font"],
@ -273,12 +296,12 @@ function Auras:GetOptions()
order = 7, order = 7,
hasAlpha = true, hasAlpha = true,
}), }),
} },
}, },
border = { border = {
type = "group", type = "group",
name = "Border", name = "Border",
order = 2, order = 3,
args = { args = {
headerAuras = { headerAuras = {
type = "header", type = "header",
@ -356,28 +379,28 @@ function Auras:GetAuraOptions(auraType)
local auras = {} local auras = {}
for k,v in pairs(Gladdy:GetImportantAuras()) do for k,v in pairs(Gladdy:GetImportantAuras()) do
if v.track == auraType then if v.track == auraType then
tinsert(auras, k) tinsert(auras, v.spellID)
end end
end end
tbl_sort(auras) tbl_sort(auras)
for i,k in ipairs(auras) do for i,k in ipairs(auras) do
options[k] = { options[tostring(k)] = {
type = "group", type = "group",
name = k, name = GetSpellInfo(k),
order = i+2, order = i+2,
icon = select(3, GetSpellInfo(Gladdy:GetImportantAuras()[k].spellID)), icon = select(3, GetSpellInfo(k)),
args = { args = {
enabled = { enabled = {
order = 1, order = 1,
name = L["Enabled"], name = L["Enabled"],
type = "toggle", type = "toggle",
image = select(3, GetSpellInfo(Gladdy:GetImportantAuras()[k].spellID)), image = select(3, GetSpellInfo(k)),
width = "2", width = "2",
set = function(info, value) set = function(info, value)
Gladdy.db.auraListDefault[k].enabled = value Gladdy.db.auraListDefault[tostring(k)].enabled = value
end, end,
get = function(info) get = function(info)
return Gladdy.db.auraListDefault[k].enabled return Gladdy.db.auraListDefault[tostring(k)].enabled
end end
}, },
priority = { priority = {
@ -389,10 +412,10 @@ function Auras:GetAuraOptions(auraType)
width = "2", width = "2",
step = 1, step = 1,
get = function(info) get = function(info)
return Gladdy.db.auraListDefault[k].priority return Gladdy.db.auraListDefault[tostring(k)].priority
end, end,
set = function(info, value) set = function(info, value)
Gladdy.db.auraListDefault[k].priority = value Gladdy.db.auraListDefault[tostring(k)].priority = value
end, end,
} }
} }

View File

@ -1,7 +1,7 @@
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local GetTime = GetTime local GetTime = GetTime
local select, lower, ceil, tremove, tinsert, pairs, ipairs = select, string.lower, ceil, tremove, tinsert, pairs, ipairs local select, lower, ceil, tremove, tinsert, pairs, ipairs, tostring = select, string.lower, ceil, tremove, tinsert, pairs, ipairs, tostring
local auraTypeColor = { } local auraTypeColor = { }
local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF
local auraTypes = {AURA_TYPE_BUFF, AURA_TYPE_DEBUFF} local auraTypes = {AURA_TYPE_BUFF, AURA_TYPE_DEBUFF}
@ -21,9 +21,10 @@ auraTypeColor[""] = auraTypeColor["none"]
--------------------------- ---------------------------
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local LibClassAuras = LibStub("LibClassAuras-1.0")
local L = Gladdy.L local L = Gladdy.L
local defaultTrackedDebuffs = select(2, Gladdy:GetAuras("debuff")) local defaultTrackedDebuffs = select(2, Gladdy:GetAuras(AURA_TYPE_DEBUFF))
local defaultTrackedBuffs = select(2, Gladdy:GetAuras("buff")) local defaultTrackedBuffs = select(2, Gladdy:GetAuras(AURA_TYPE_BUFF))
local BuffsDebuffs = Gladdy:NewModule("BuffsDebuffs", nil, { local BuffsDebuffs = Gladdy:NewModule("BuffsDebuffs", nil, {
buffsEnabled = true, buffsEnabled = true,
buffsShowAuraDebuffs = false, buffsShowAuraDebuffs = false,
@ -87,6 +88,8 @@ function BuffsDebuffs:Initialize()
self.trackedCC = {} self.trackedCC = {}
self.framePool = {} self.framePool = {}
self:RegisterMessage("JOINED_ARENA") self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("UNIT_DESTROYED")
self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("AURA_FADE") self:RegisterMessage("AURA_FADE")
self:RegisterMessage("AURA_GAIN") self:RegisterMessage("AURA_GAIN")
self:RegisterMessage("AURA_GAIN_LIMIT") self:RegisterMessage("AURA_GAIN_LIMIT")
@ -126,6 +129,14 @@ function BuffsDebuffs:ResetUnit(unit)
end end
end end
function BuffsDebuffs:UNIT_DESTROYED(unit)
BuffsDebuffs:ResetUnit(unit)
end
function BuffsDebuffs:UNIT_DEATH(unit)
BuffsDebuffs:ResetUnit(unit)
end
function BuffsDebuffs:Reset() function BuffsDebuffs:Reset()
for i=1,#self.framePool do for i=1,#self.framePool do
self.framePool[i]:Hide() self.framePool[i]:Hide()
@ -135,18 +146,23 @@ end
function BuffsDebuffs:Test(unit) function BuffsDebuffs:Test(unit)
if Gladdy.db.buffsEnabled then if Gladdy.db.buffsEnabled then
if unit == "arena1" or unit == "arena3" then if unit == "arena1" or unit == "arena3" then
self:AddOrRefreshAura(unit, 1943, AURA_TYPE_DEBUFF, 10, 10, 1,"physical", select(3, GetSpellInfo(1943)), 1) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AddOrRefreshAura(unit, 18647, AURA_TYPE_DEBUFF, 10, 10,1, "immune", select(3, GetSpellInfo(18647)), 2) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AddOrRefreshAura(unit, 27218, AURA_TYPE_DEBUFF, 24, 20,1, "curse", select(3, GetSpellInfo(27218)), 3) BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1943, select(1, GetSpellInfo(1943)), select(3, GetSpellInfo(1943)), 10, GetTime() + 10, 1, "physical")
self:AddOrRefreshAura(unit, 27216, AURA_TYPE_DEBUFF, 18, 18,1, "magic", select(3, GetSpellInfo(27216)), 4) BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 18647, select(1, GetSpellInfo(18647)), select(3, GetSpellInfo(18647)), 10, GetTime() + 10, 1, "immune")
self:AddOrRefreshAura(unit, 27189, AURA_TYPE_DEBUFF, 12, 12,5, "poison", select(3, GetSpellInfo(27189)), 5) BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27218, select(1, GetSpellInfo(27218)), select(3, GetSpellInfo(27218)), 24, GetTime() + 20, 1, "curse")
self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(32999)), 1) BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27216, select(1, GetSpellInfo(27216)), select(3, GetSpellInfo(27216)), 18, GetTime() + 18, 1, "magic")
self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(25389)), 2) BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27189, select(1, GetSpellInfo(27189)), select(3, GetSpellInfo(27189)), 12, GetTime() + 12, 5, "poison")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 33076, select(1, GetSpellInfo(33076)), select(3, GetSpellInfo(33076)), 20, GetTime() + 20, 1, "magic")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 26980, select(1, GetSpellInfo(26980)), select(3, GetSpellInfo(26980)), 20, GetTime() + 20, 5, "magic")
elseif unit == "arena2" then elseif unit == "arena2" then
self:AddOrRefreshAura(unit, 1943, AURA_TYPE_DEBUFF, 10, 10, 1, "physical", select(3, GetSpellInfo(1943)), 1) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AddOrRefreshAura(unit, 1, AURA_TYPE_DEBUFF, 20, 20,5, "poison", select(3, GetSpellInfo(1)), 2) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(32999)), 1) BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1943, select(1, GetSpellInfo(1943)), select(3, GetSpellInfo(1943)), 10, GetTime() + 10, 1, "physical")
self:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 20, 20,5, "magic", select(3, GetSpellInfo(25389)), 2) BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1, select(1, GetSpellInfo(1)), select(3, GetSpellInfo(1)), 20, GetTime() + 20, 5, "poison")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 27009, select(1, GetSpellInfo(27009)), select(3, GetSpellInfo(27009)), 20, GetTime() + 15, 1, "magic")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 11426, select(1, GetSpellInfo(11426)), select(3, GetSpellInfo(11426)), 10, GetTime() + 10, 1, "magic")
end end
end end
end end
@ -186,11 +202,13 @@ function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, dur
return return
end end
local auraFrame = self.frames[unit] local auraFrame = self.frames[unit]
local aura = Gladdy.db.auraListDefault[spellName] and Gladdy.db.auraListDefault[spellName].enabled local aura = Gladdy:GetImportantAuras()[spellName] and Gladdy.db.auraListDefault[tostring(Gladdy:GetImportantAuras()[spellName].spellID)].enabled
if aura and Gladdy.db.buffsShowAuraDebuffs then if aura and Gladdy.db.buffsShowAuraDebuffs then
aura = false aura = false
end end
if not aura and spellID and expirationTime and (Gladdy.db.trackedBuffs[spellName] or Gladdy.db.trackedDebuffs[spellName]) then local auraNames = LibClassAuras.GetSpellNameToId(auraType)
local spellId = auraNames[spellName] and auraNames[spellName].id[1]
if not aura and spellID and spellId and expirationTime and (Gladdy.db.trackedBuffs[tostring(spellId)] or Gladdy.db.trackedDebuffs[tostring(spellId)]) then
local index local index
if auraType == AURA_TYPE_DEBUFF then if auraType == AURA_TYPE_DEBUFF then
auraFrame.numDebuffs = auraFrame.numDebuffs + 1 auraFrame.numDebuffs = auraFrame.numDebuffs + 1
@ -208,15 +226,16 @@ end
--------------------------- ---------------------------
function BuffsDebuffs:CreateFrame(unit) function BuffsDebuffs:CreateFrame(unit)
local verticalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local debuffFrame = CreateFrame("Frame", "GladdyDebuffs" .. unit, Gladdy.buttons[unit]) local debuffFrame = CreateFrame("Frame", "GladdyDebuffs" .. unit, Gladdy.buttons[unit])
debuffFrame:SetHeight(Gladdy.db.buffsIconSize) debuffFrame:SetHeight(Gladdy.db.buffsIconSize)
debuffFrame:SetWidth(1) debuffFrame:SetWidth(1)
debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, Gladdy.db.highlightBorderSize + Gladdy.db.padding) debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, verticalMargin)
debuffFrame.unit = unit debuffFrame.unit = unit
local buffFrame = CreateFrame("Frame", "GladdyBuffs" .. unit, Gladdy.buttons[unit]) local buffFrame = CreateFrame("Frame", "GladdyBuffs" .. unit, Gladdy.buttons[unit])
buffFrame:SetHeight(Gladdy.db.buffsIconSize) buffFrame:SetHeight(Gladdy.db.buffsIconSize)
buffFrame:SetWidth(1) buffFrame:SetWidth(1)
buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, Gladdy.db.highlightBorderSize + Gladdy.db.padding) buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPLEFT", 0, verticalMargin)
buffFrame.unit = unit buffFrame.unit = unit
self.frames[unit] = {} self.frames[unit] = {}
self.frames[unit].buffFrame = buffFrame self.frames[unit].buffFrame = buffFrame
@ -259,7 +278,9 @@ end
function BuffsDebuffs:UpdateFrame(unit) function BuffsDebuffs:UpdateFrame(unit)
self.frames[unit].debuffFrame:SetHeight(Gladdy.db.buffsIconSize) self.frames[unit].debuffFrame:SetHeight(Gladdy.db.buffsIconSize)
self.frames[unit].debuffFrame:ClearAllPoints() self.frames[unit].debuffFrame:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize
--DEBUFFS
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
local verticalMargin = -(Gladdy.db.powerBarHeight)/2 local verticalMargin = -(Gladdy.db.powerBarHeight)/2
if Gladdy.db.buffsCooldownPos == "TOP" then if Gladdy.db.buffsCooldownPos == "TOP" then
verticalMargin = horizontalMargin + 1 verticalMargin = horizontalMargin + 1
@ -283,59 +304,27 @@ function BuffsDebuffs:UpdateFrame(unit)
end end
elseif Gladdy.db.buffsCooldownPos == "LEFT" then elseif Gladdy.db.buffsCooldownPos == "LEFT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "LEFT") then self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "LEFT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "LEFT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
self.frames[unit].debuffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset + verticalMargin)
elseif Gladdy.db.buffsCooldownPos == "RIGHT" then elseif Gladdy.db.buffsCooldownPos == "RIGHT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "RIGHT") then self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "RIGHT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "RIGHT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
self.frames[unit].debuffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset + verticalMargin)
end end
--BUFFS
self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize) self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize)
self.frames[unit].buffFrame:ClearAllPoints() self.frames[unit].buffFrame:ClearAllPoints()
horizontalMargin = Gladdy.db.highlightBorderSize horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
verticalMargin = -(Gladdy.db.powerBarHeight)/2 verticalMargin = -(Gladdy.db.powerBarHeight)/2
if Gladdy.db.buffsBuffsCooldownPos == "TOP" then if Gladdy.db.buffsBuffsCooldownPos == "TOP" then
verticalMargin = horizontalMargin + 1 verticalMargin = horizontalMargin + 1
@ -381,7 +370,16 @@ function BuffsDebuffs:UpdateFrame(unit)
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2) verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
end end
self.frames[unit].buffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) --self.frames[unit].buffFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) - 1 + Gladdy.db.padding
if anchor == Gladdy.buttons[unit].healthBar then
self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
else
self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
end
elseif Gladdy.db.buffsBuffsCooldownPos == "RIGHT" then elseif Gladdy.db.buffsBuffsCooldownPos == "RIGHT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
@ -406,7 +404,15 @@ function BuffsDebuffs:UpdateFrame(unit)
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2) verticalMargin = verticalMargin + (Gladdy.db.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
end end
self.frames[unit].buffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin) --self.frames[unit].buffFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) - 1 + Gladdy.db.padding
if anchor == Gladdy.buttons[unit].healthBar then
self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
else
self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset)
end
end end
for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do
styleIcon(self.frames[unit].auras[AURA_TYPE_BUFF][i], AURA_TYPE_BUFF) styleIcon(self.frames[unit].auras[AURA_TYPE_BUFF][i], AURA_TYPE_BUFF)
@ -465,10 +471,6 @@ function BuffsDebuffs:UpdateAurasOnUnit(unit)
end end
end end
function BuffsDebuffs:UNIT_DEATH(destUnit)
self:RemoveAuras(destUnit)
end
local function iconTimer(auraFrame, elapsed) local function iconTimer(auraFrame, elapsed)
if auraFrame.endtime ~= "undefined" then if auraFrame.endtime ~= "undefined" then
local timeLeftMilliSec = auraFrame.endtime - GetTime() local timeLeftMilliSec = auraFrame.endtime - GetTime()
@ -490,7 +492,7 @@ local function iconTimer(auraFrame, elapsed)
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec) auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
elseif timeLeftMilliSec <= 3 and timeLeftMilliSec > 0 then elseif timeLeftMilliSec <= 3 and timeLeftMilliSec > 0 then
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0, 0) end if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0, 0) end
auraFrame.cooldown:SetFormattedText("%.1f", timeLeftMilliSec) auraFrame.cooldown:SetFormattedText("%.1f", timeLeftMilliSec >= 0.0 and timeLeftMilliSec or 0.0)
elseif timeLeftMilliSec <= 0 and timeLeftMilliSec > -0.05 then -- 50ms ping max wait for SPELL_AURA_REMOVED event elseif timeLeftMilliSec <= 0 and timeLeftMilliSec > -0.05 then -- 50ms ping max wait for SPELL_AURA_REMOVED event
auraFrame.cooldown:SetText("") auraFrame.cooldown:SetText("")
else -- fallback in case SPELL_AURA_REMOVED is not fired else -- fallback in case SPELL_AURA_REMOVED is not fired
@ -508,8 +510,10 @@ function BuffsDebuffs:AddAura(unit, spellID, auraType, duration, timeLeft, stack
aura = tremove(self.framePool, #self.framePool) aura = tremove(self.framePool, #self.framePool)
else else
aura = CreateFrame("Frame") aura = CreateFrame("Frame")
aura:EnableMouse(false)
aura:SetFrameLevel(3) aura:SetFrameLevel(3)
aura.texture = aura:CreateTexture(nil, "BACKGROUND") aura.texture = aura:CreateTexture(nil, "BACKGROUND")
aura.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
aura.texture:SetAllPoints(aura) aura.texture:SetAllPoints(aura)
aura.cooldowncircle = CreateFrame("Cooldown", nil, aura, "CooldownFrameTemplate") aura.cooldowncircle = CreateFrame("Cooldown", nil, aura, "CooldownFrameTemplate")
aura.cooldowncircle:SetFrameLevel(4) aura.cooldowncircle:SetFrameLevel(4)
@ -1027,7 +1031,7 @@ function BuffsDebuffs:GetOptions()
type = "group", type = "group",
order = 11, order = 11,
childGroups = "tree", childGroups = "tree",
args = select(1, Gladdy:GetAuras("debuff")), args = select(1, Gladdy:GetAuras(AURA_TYPE_DEBUFF)),
set = function(info, state) set = function(info, state)
local optionKey = info[#info] local optionKey = info[#info]
Gladdy.dbi.profile.trackedDebuffs[optionKey] = state Gladdy.dbi.profile.trackedDebuffs[optionKey] = state
@ -1042,7 +1046,7 @@ function BuffsDebuffs:GetOptions()
type = "group", type = "group",
order = 12, order = 12,
childGroups = "tree", childGroups = "tree",
args = select(1, Gladdy:GetAuras("buffs")), args = select(1, Gladdy:GetAuras(AURA_TYPE_BUFF)),
set = function(info, state) set = function(info, state)
local optionKey = info[#info] local optionKey = info[#info]
Gladdy.dbi.profile.trackedBuffs[optionKey] = state Gladdy.dbi.profile.trackedBuffs[optionKey] = state

View File

@ -57,6 +57,7 @@ end
function Castbar:CreateFrame(unit) function Castbar:CreateFrame(unit)
local castBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate") local castBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate")
castBar:EnableMouse(false)
castBar.unit = unit castBar.unit = unit
castBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.castBarBorderStyle), castBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.castBarBorderStyle),
@ -85,6 +86,7 @@ function Castbar:CreateFrame(unit)
castBar.icon = CreateFrame("Frame", nil, castBar) castBar.icon = CreateFrame("Frame", nil, castBar)
castBar.icon.texture = castBar.icon:CreateTexture(nil, "BACKGROUND") castBar.icon.texture = castBar.icon:CreateTexture(nil, "BACKGROUND")
castBar.icon.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
castBar.icon.texture:SetAllPoints(castBar.icon) castBar.icon.texture:SetAllPoints(castBar.icon)
castBar.icon.texture.overlay = castBar.icon:CreateTexture(nil, "BORDER") castBar.icon.texture.overlay = castBar.icon:CreateTexture(nil, "BORDER")
castBar.icon.texture.overlay:SetAllPoints(castBar.icon.texture) castBar.icon.texture.overlay:SetAllPoints(castBar.icon.texture)
@ -163,53 +165,22 @@ function Castbar:UpdateFrame(unit)
end end
castBar:ClearAllPoints() castBar:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
if (Gladdy.db.castBarPos == "LEFT") then if (Gladdy.db.castBarPos == "LEFT") then
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "LEFT") then castBar:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end castBar:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.drCooldownPos == "LEFT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + (Gladdy.db.drIconSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "LEFT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin + Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2
end
castBar:SetPoint("RIGHT", button.healthBar, "LEFT", -horizontalMargin - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset + verticalMargin)
end end
if (Gladdy.db.castBarPos == "RIGHT") then if (Gladdy.db.castBarPos == "RIGHT") then
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "RIGHT") then castBar:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end castBar:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin + (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.drCooldownPos == "RIGHT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + (Gladdy.db.drIconSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "RIGHT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin + Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2
end
castBar:SetPoint("LEFT", button.healthBar, "RIGHT", horizontalMargin + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset + verticalMargin)
end end
castBar.spellText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize) castBar.spellText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize)
@ -515,7 +486,7 @@ function Castbar:Test(unit)
if (unit == "arena2") then if (unit == "arena2") then
spell, _, icon = GetSpellInfo(27072) spell, _, icon = GetSpellInfo(27072)
value, maxValue, event = 0, 2, "cast" value, maxValue, event = 0, 40, "cast"
elseif (unit == "arena1") then elseif (unit == "arena1") then
spell, _, icon = GetSpellInfo(27220) spell, _, icon = GetSpellInfo(27220)
endTime = GetTime() * 1000 + 60*1000 endTime = GetTime() * 1000 + 60*1000

View File

@ -1,5 +1,8 @@
local select = select
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local GetSpellInfo = GetSpellInfo
local L = Gladdy.L local L = Gladdy.L
local Classicon = Gladdy:NewModule("Classicon", 80, { local Classicon = Gladdy:NewModule("Classicon", 80, {
classIconPos = "LEFT", classIconPos = "LEFT",
@ -7,21 +10,87 @@ local Classicon = Gladdy:NewModule("Classicon", 80, {
classIconWidthFactor = 0.9, classIconWidthFactor = 0.9,
classIconBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp", classIconBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
classIconBorderColor = { r = 0, g = 0, b = 0, a = 1 }, classIconBorderColor = { r = 0, g = 0, b = 0, a = 1 },
classIconSpecIcon = false,
}) })
local classIconPath = "Interface\\Addons\\Gladdy\\Images\\Classes\\"
local classIcons = {
["DRUID"] = classIconPath .. "inv_misc_monsterclaw_04",
["HUNTER"] = classIconPath .. "inv_weapon_bow_07",
["MAGE"] = classIconPath .. "inv_staff_13",
["PALADIN"] = classIconPath .. "inv_hammer_01",
["PRIEST"] = classIconPath .. "inv_staff_30",
["ROGUE"] = classIconPath .. "inv_throwingknife_04",
["SHAMAN"] = classIconPath .. "inv_jewelry_talisman_04",
["WARLOCK"] = classIconPath .. "spell_nature_drowsy",
["WARRIOR"] = classIconPath .. "inv_sword_27",
}
local specIcons = {
--DRUID
["DRUID"] = {
[L["Balance"]] = select(3, GetSpellInfo(8921)), -- Moonfire
[L["Feral"]] = select(3, GetSpellInfo(27545)), -- Cat Form
[L["Restoration"]] = select(3, GetSpellInfo(5185)), -- Healing Touch
},
["HUNTER"] = {
[L["Beast Mastery"]] = select(3, GetSpellInfo(1515)), -- Tame Beast
[L["Marksmanship"]] = select(3, GetSpellInfo(42243)), -- Volley
[L["Survival"]] = select(3, GetSpellInfo(1495)), -- Mongoose Bite
},
["MAGE"] = {
[L["Arcane"]] = select(3, GetSpellInfo(1459)), -- Arcane Intellect
[L["Fire"]] = select(3, GetSpellInfo(133)), -- Fireball
[L["Frost"]] = select(3, GetSpellInfo(116)), -- Frostbolt
},
["PALADIN"] = {
[L["Holy"]] = select(3, GetSpellInfo(635)), -- Holy Light
[L["Retribution"]] = select(3, GetSpellInfo(7294)), -- Retribution Aura
[L["Protection"]] = select(3, GetSpellInfo(32828)), -- Protection Aura
},
["PRIEST"] = {
[L["Discipline"]] = select(3, GetSpellInfo(1243)), -- Power Word: Fortitude
[L["Shadow"]] = select(3, GetSpellInfo(589)), -- Shadow Word: Pain
[L["Holy"]] = select(3, GetSpellInfo(635)), -- Holy Light
},
["ROGUE"] = {
[L["Assassination"]] = select(3, GetSpellInfo(1329)), -- Mutilate (Eviscerate? 2098)
[L["Combat"]] = select(3, GetSpellInfo(53)), -- Backstab
[L["Subtlety"]] = select(3, GetSpellInfo(1784)), -- Stealth
},
["SHAMAN"] = {
[L["Elemental"]] = select(3, GetSpellInfo(403)), -- Lightning Bolt
[L["Enhancement"]] = select(3, GetSpellInfo(324)), -- Lightning Shield
[L["Restoration"]] = select(3, GetSpellInfo(331)), -- Healing Wave
},
["WARLOCK"] = {
[L["Affliction"]] = select(3, GetSpellInfo(6789)), -- Affliction
[L["Demonology"]] = select(3, GetSpellInfo(5500)), -- Sense Demons
[L["Destruction"]] = select(3, GetSpellInfo(5740)), -- Rain of Fire
},
["WARRIOR"] = {
[L["Arms"]] = select(3, GetSpellInfo(12294)), -- Mortal Strike
[L["Fury"]] = select(3, GetSpellInfo(12325)), -- Inner Rage
[L["Protection"]] = select(3, GetSpellInfo(71)), -- Defensive Stance
},
}
function Classicon:Initialize() function Classicon:Initialize()
self.frames = {} self.frames = {}
self:RegisterMessage("ENEMY_SPOTTED") self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("UNIT_DEATH") self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("UNIT_SPEC")
end end
function Classicon:CreateFrame(unit) function Classicon:CreateFrame(unit)
local classIcon = CreateFrame("Frame", nil, Gladdy.buttons[unit]) local classIcon = CreateFrame("Frame", nil, Gladdy.buttons[unit])
classIcon:EnableMouse(false)
classIcon:SetFrameStrata("MEDIUM") classIcon:SetFrameStrata("MEDIUM")
classIcon:SetFrameLevel(1) classIcon:SetFrameLevel(1)
classIcon.texture = classIcon:CreateTexture(nil, "BACKGROUND") classIcon.texture = classIcon:CreateTexture(nil, "BACKGROUND")
classIcon.texture:SetAllPoints(classIcon) classIcon.texture:SetAllPoints(classIcon)
classIcon.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
classIcon.texture.overlay = classIcon:CreateTexture(nil, "BORDER") classIcon.texture.overlay = classIcon:CreateTexture(nil, "BORDER")
classIcon.texture.overlay:SetAllPoints(classIcon) classIcon.texture.overlay:SetAllPoints(classIcon)
@ -51,7 +120,7 @@ function Classicon:UpdateFrame(unit)
classIcon:SetHeight(Gladdy.db.classIconSize) classIcon:SetHeight(Gladdy.db.classIconSize)
classIcon:ClearAllPoints() classIcon:ClearAllPoints()
local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
if (Gladdy.db.classIconPos == "LEFT") then if (Gladdy.db.classIconPos == "LEFT") then
classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0) classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0)
else else
@ -65,6 +134,25 @@ function Classicon:UpdateFrame(unit)
classIcon.texture.overlay:SetVertexColor(Gladdy.db.classIconBorderColor.r, Gladdy.db.classIconBorderColor.g, Gladdy.db.classIconBorderColor.b, Gladdy.db.classIconBorderColor.a) classIcon.texture.overlay:SetVertexColor(Gladdy.db.classIconBorderColor.r, Gladdy.db.classIconBorderColor.g, Gladdy.db.classIconBorderColor.b, Gladdy.db.classIconBorderColor.a)
end end
function Classicon:ENEMY_SPOTTED(unit)
local classIcon = self.frames[unit]
if (not classIcon) then
return
end
classIcon.texture:SetTexture(classIcons[Gladdy.buttons[unit].class])
--classIcon.texture:SetTexCoord(unpack(CLASS_BUTTONS[Gladdy.buttons[unit].class]))
classIcon.texture:SetAllPoints(classIcon)
end
function Classicon:UNIT_SPEC(unit, spec)
local classIcon = self.frames[unit]
if (not Gladdy.db.classIconSpecIcon or not classIcon) then
return
end
classIcon.texture:SetTexture(specIcons[Gladdy.buttons[unit].class][spec])
end
function Classicon:Test(unit) function Classicon:Test(unit)
self:ENEMY_SPOTTED(unit) self:ENEMY_SPOTTED(unit)
end end
@ -85,17 +173,41 @@ function Classicon:GetOptions()
name = L["Class Icon"], name = L["Class Icon"],
order = 2, order = 2,
}, },
classIconSpecIcon = {
type = "toggle",
name = L["Show Spec Icon"],
desc = L["Shows Spec Icon once spec is detected"],
order = 3,
get = function(info) return Gladdy.db.classIconSpecIcon end,
set = function(info, value)
Gladdy.db.classIconSpecIcon = value
if Gladdy.curBracket and Gladdy.curBracket > 0 then
for i=1,Gladdy.curBracket do
local unit = "arena" .. i
if (Gladdy.buttons[unit] and Gladdy.buttons[unit].spec) then
self:ENEMY_SPOTTED(unit)
self:UNIT_SPEC(unit, Gladdy.buttons[unit].spec)
end
end
end
end
},
group = { group = {
type = "group", type = "group",
childGroups = "tree", childGroups = "tree",
name = "Frame", name = "Frame",
order = 3, order = 4,
args = { args = {
size = { size = {
type = "group", type = "group",
name = L["Icon size"], name = L["Icon size"],
order = 1, order = 1,
args = { args = {
header = {
type = "header",
name = L["Icon size"],
order = 1,
},
classIconSize = Gladdy:option({ classIconSize = Gladdy:option({
type = "range", type = "range",
name = L["Icon size"], name = L["Icon size"],
@ -164,39 +276,4 @@ function Classicon:GetOptions()
}, },
}, },
} }
end
local function getClassIcon(class)
-- see https://wow.gamepedia.com/Class_icon
local classIcon = "Interface\\Addons\\Gladdy\\Images\\Classes\\"
if class == "DRUID" then
return classIcon .. "inv_misc_monsterclaw_04"
elseif class == "HUNTER" then
return classIcon .. "inv_weapon_bow_07"
elseif class == "MAGE" then
return classIcon .. "inv_staff_13"
elseif class == "PALADIN" then
return classIcon .. "inv_hammer_01"
elseif class == "PRIEST" then
return classIcon .. "inv_staff_30"
elseif class == "ROGUE" then
return classIcon .. "inv_throwingknife_04"
elseif class == "SHAMAN" then
return classIcon .. "inv_jewelry_talisman_04"
elseif class == "WARLOCK" then
return classIcon .. "spell_nature_drowsy"
elseif class == "WARRIOR" then
return classIcon .. "inv_sword_27"
end
end
function Classicon:ENEMY_SPOTTED(unit)
local classIcon = self.frames[unit]
if (not classIcon) then
return
end
classIcon.texture:SetTexture(getClassIcon(Gladdy.buttons[unit].class))
--classIcon.texture:SetTexCoord(unpack(CLASS_BUTTONS[Gladdy.buttons[unit].class]))
classIcon.texture:SetAllPoints(classIcon)
end end

243
Modules/CombatIndicator.lua Normal file
View File

@ -0,0 +1,243 @@
local select = select
local UnitExists, UnitAffectingCombat, GetSpellInfo = UnitExists, UnitAffectingCombat, GetSpellInfo
local CreateFrame = CreateFrame
local ANCHORS = { ["LEFT"] = "RIGHT", ["RIGHT"] = "LEFT", ["BOTTOM"] = "TOP", ["TOP"] = "BOTTOM"}
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local CombatIndicator = Gladdy:NewModule("CombatIndicator", nil, {
ciEnabled = true,
ciSize = 20,
ciAlpha = 1,
ciWidthFactor = 1,
ciAnchor = "healthBar",
ciPos = "TOP",
ciXOffset = 0,
ciYOffset = -31,
ciBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
ciBorderColor = { r = 0, g = 0, b = 0, a = 1 },
})
function CombatIndicator:Initialize()
self.frames = {}
self:RegisterMessage("JOINED_ARENA")
self.updateInterval = 0.05
self.combatIndicatorIcon = select(3, GetSpellInfo(674))
end
function CombatIndicator:JOINED_ARENA()
self:SetScript("OnUpdate", CombatIndicator.OnEvent)
self.lastTimeUpdated = 0
end
function CombatIndicator:CreateFrame(unit)
local button = Gladdy.buttons[unit]
if not button then
return
end
local ciFrame = CreateFrame("Frame", "GladdyCombatindicator" .. unit, button)
ciFrame:EnableMouse(false)
ciFrame:SetFrameStrata("HIGH")
ciFrame:SetHeight(Gladdy.db.ciSize)
ciFrame:SetWidth(Gladdy.db.ciSize * Gladdy.db.ciWidthFactor)
ciFrame.texture = ciFrame:CreateTexture(nil, "OVERLAY")
ciFrame.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
ciFrame.texture:SetTexture(self.combatIndicatorIcon)
ciFrame.texture:SetAllPoints(ciFrame)
ciFrame.border = ciFrame:CreateTexture(nil, "OVERLAY")
ciFrame.border:SetAllPoints(ciFrame)
ciFrame.border:SetTexture(Gladdy.db.ciBorderStyle)
ciFrame.border:SetVertexColor(Gladdy.db.ciBorderColor.r, Gladdy.db.ciBorderColor.g, Gladdy.db.ciBorderColor.b, Gladdy.db.ciBorderColor.a)
self.frames[unit] = ciFrame
button.ciFrame = ciFrame
end
function CombatIndicator:UpdateFrame(unit)
local button = Gladdy.buttons[unit]
local ciFrame = self.frames[unit]
if (not button or not ciFrame) then
return
end
ciFrame:SetHeight(Gladdy.db.ciSize)
ciFrame:SetWidth(Gladdy.db.ciSize * Gladdy.db.ciWidthFactor)
ciFrame.border:SetTexture(Gladdy.db.ciBorderStyle)
ciFrame.border:SetVertexColor(Gladdy.db.ciBorderColor.r, Gladdy.db.ciBorderColor.g, Gladdy.db.ciBorderColor.b, Gladdy.db.ciBorderColor.a)
ciFrame:ClearAllPoints()
ciFrame:SetPoint(ANCHORS[Gladdy.db.ciPos], Gladdy.buttons[unit][Gladdy.db.ciAnchor], Gladdy.db.ciPos, Gladdy.db.ciXOffset, Gladdy.db.ciYOffset)
ciFrame:SetAlpha(Gladdy.db.ciAlpha)
if (Gladdy.db.ciEnabled == false) then
ciFrame:Hide()
else
ciFrame:Show()
end
end
function CombatIndicator:Test()
self.test = true
self:JOINED_ARENA()
end
function CombatIndicator:Reset()
self:SetScript("OnUpdate", nil)
self.test = false
end
function CombatIndicator.OnEvent(self, elapsed)
self.lastTimeUpdated = self.lastTimeUpdated + elapsed
if (self.lastTimeUpdated > self.updateInterval) then
for i=1,Gladdy.curBracket do
local unit = "arena" .. i
if CombatIndicator.test or (UnitExists(unit) and UnitAffectingCombat(unit)) then
CombatIndicator.frames[unit]:Show()
else
CombatIndicator.frames[unit]:Hide()
end
end
self.lastTimeUpdated = 0
end
end
function CombatIndicator:GetOptions()
return {
headerTrinket = {
type = "header",
name = L["Racial"],
order = 2,
},
ciEnabled = Gladdy:option({
type = "toggle",
name = L["Enabled"],
desc = L["Enable ci icon"],
order = 3,
}),
group = {
type = "group",
childGroups = "tree",
name = "Frame",
order = 4,
args = {
general = {
type = "group",
name = L["Frame"],
order = 1,
args = {
header = {
type = "header",
name = L["Frame"],
order = 1,
},
ciSize = Gladdy:option({
type = "range",
name = L["Icon size"],
min = 5,
max = 100,
step = 1,
order = 2,
}),
ciWidthFactor = Gladdy:option({
type = "range",
name = L["Icon width factor"],
min = 0.5,
max = 2,
step = 0.05,
order = 3,
}),
ciAlpha = Gladdy:option({
type = "range",
name = L["Alpha"],
min = 0,
max = 1,
step = 0.05,
order = 4,
}),
},
},
position = {
type = "group",
name = L["Position"],
order = 4,
args = {
header = {
type = "header",
name = L["Position"],
order = 4,
},
ciAnchor = Gladdy:option({
type = "select",
name = L["Anchor"],
desc = L["This changes the anchor of the ci icon"],
order = 20,
values = {
["trinket"] = L["Trinket"],
["classIcon"] = L["Class Icon"],
["healthBar"] = L["Health Bar"],
["powerBar"] = L["Power Bar"],
},
}),
ciPos = Gladdy:option({
type = "select",
name = L["Position"],
desc = L["This changes position relative to its anchor of the ci icon"],
order = 21,
values = {
["LEFT"] = L["Left"],
["RIGHT"] = L["Right"],
["TOP"] = L["Top"],
["BOTTOM"] = L["Bottom"],
},
}),
ciXOffset = Gladdy:option({
type = "range",
name = L["Horizontal offset"],
order = 23,
min = -400,
max = 400,
step = 0.1,
}),
ciYOffset = Gladdy:option({
type = "range",
name = L["Vertical offset"],
order = 24,
min = -400,
max = 400,
step = 0.1,
}),
},
},
border = {
type = "group",
name = L["Border"],
order = 4,
args = {
header = {
type = "header",
name = L["Border"],
order = 4,
},
ciBorderStyle = Gladdy:option({
type = "select",
name = L["Border style"],
order = 31,
values = Gladdy:GetIconStyles()
}),
ciBorderColor = Gladdy:colorOption({
type = "color",
name = L["Border color"],
desc = L["Color of the border"],
order = 32,
hasAlpha = true,
}),
},
},
},
},
}
end

View File

@ -1,12 +1,54 @@
local type, pairs, ceil, tonumber, mod = type, pairs, ceil, tonumber, mod local type, pairs, ceil, tonumber, mod, tostring, upper, select = type, pairs, ceil, tonumber, mod, tostring, string.upper, select
local GetTime = GetTime local GetTime = GetTime
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local RACE_ICON_TCOORDS = {
["HUMAN_MALE"] = {0, 0.125, 0, 0.25},
["DWARF_MALE"] = {0.125, 0.25, 0, 0.25},
["GNOME_MALE"] = {0.25, 0.375, 0, 0.25},
["NIGHTELF_MALE"] = {0.375, 0.5, 0, 0.25},
["TAUREN_MALE"] = {0, 0.125, 0.25, 0.5},
["SCOURGE_MALE"] = {0.125, 0.25, 0.25, 0.5},
["TROLL_MALE"] = {0.25, 0.375, 0.25, 0.5},
["ORC_MALE"] = {0.375, 0.5, 0.25, 0.5},
["HUMAN_FEMALE"] = {0, 0.125, 0.5, 0.75},
["DWARF_FEMALE"] = {0.125, 0.25, 0.5, 0.75},
["GNOME_FEMALE"] = {0.25, 0.375, 0.5, 0.75},
["NIGHTELF_FEMALE"] = {0.375, 0.5, 0.5, 0.75},
["TAUREN_FEMALE"] = {0, 0.125, 0.75, 1.0},
["SCOURGE_FEMALE"] = {0.125, 0.25, 0.75, 1.0},
["TROLL_FEMALE"] = {0.25, 0.375, 0.75, 1.0},
["ORC_FEMALE"] = {0.375, 0.5, 0.75, 1.0},
["BLOODELF_MALE"] = {0.5, 0.625, 0.25, 0.5},
["BLOODELF_FEMALE"] = {0.5, 0.625, 0.75, 1.0},
["DRAENEI_MALE"] = {0.5, 0.625, 0, 0.25},
["DRAENEI_FEMALE"] = {0.5, 0.625, 0.5, 0.75},
}
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
local function getDefaultCooldown()
local cooldowns = {}
for class, t in pairs(Gladdy:GetCooldownList()) do
for spellId, v in pairs(t) do
local spellName, _, texture = GetSpellInfo(spellId)
if spellName then
cooldowns[tostring(spellId)] = true
else
Gladdy:Print("spellid does not exist " .. spellId)
end
end
end
return cooldowns
end
local Cooldowns = Gladdy:NewModule("Cooldowns", nil, { local Cooldowns = Gladdy:NewModule("Cooldowns", nil, {
cooldownFont = "DorisPP", cooldownFont = "DorisPP",
cooldownFontScale = 1, cooldownFontScale = 1,
@ -23,13 +65,14 @@ local Cooldowns = Gladdy:NewModule("Cooldowns", nil, {
cooldownBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_Gloss", cooldownBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_Gloss",
cooldownBorderColor = { r = 1, g = 1, b = 1, a = 1 }, cooldownBorderColor = { r = 1, g = 1, b = 1, a = 1 },
cooldownDisableCircle = false, cooldownDisableCircle = false,
cooldownCooldownAlpha = 1 cooldownCooldownAlpha = 1,
cooldownCooldowns = getDefaultCooldown()
}) })
function Cooldowns:Initialize() function Cooldowns:Initialize()
self.cooldownSpellIds = {} self.cooldownSpellIds = {}
self.spellTextures = {} self.spellTextures = {}
for class, t in pairs(self.cooldownSpells) do for class, t in pairs(Gladdy:GetCooldownList()) do
for k, v in pairs(t) do for k, v in pairs(t) do
local spellName, _, texture = GetSpellInfo(k) local spellName, _, texture = GetSpellInfo(k)
if spellName then if spellName then
@ -43,17 +86,20 @@ function Cooldowns:Initialize()
self:RegisterMessage("ENEMY_SPOTTED") self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("SPEC_DETECTED") self:RegisterMessage("SPEC_DETECTED")
self:RegisterMessage("UNIT_DEATH") self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("UNIT_DESTROYED")
end end
function Cooldowns:CreateFrame(unit) function Cooldowns:CreateFrame(unit)
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
-- Cooldown frame -- Cooldown frame
local spellCooldownFrame = CreateFrame("Frame", nil, button) local spellCooldownFrame = CreateFrame("Frame", nil, button)
spellCooldownFrame:EnableMouse(false)
for x = 1, 14 do for x = 1, 14 do
local icon = CreateFrame("Frame", nil, spellCooldownFrame) local icon = CreateFrame("Frame", nil, spellCooldownFrame)
icon:EnableMouse(false) icon:EnableMouse(false)
icon:SetFrameLevel(3) icon:SetFrameLevel(3)
icon.texture = icon:CreateTexture(nil, "BACKGROUND") icon.texture = icon:CreateTexture(nil, "BACKGROUND")
icon.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
icon.texture:SetAllPoints(icon) icon.texture:SetAllPoints(icon)
icon.cooldown = CreateFrame("Cooldown", nil, icon, "CooldownFrameTemplate") icon.cooldown = CreateFrame("Cooldown", nil, icon, "CooldownFrameTemplate")
@ -89,69 +135,33 @@ function Cooldowns:UpdateFrame(unit)
if (Gladdy.db.cooldown) then if (Gladdy.db.cooldown) then
button.spellCooldownFrame:ClearAllPoints() button.spellCooldownFrame:ClearAllPoints()
local verticalMargin = -(Gladdy.db.powerBarHeight)/2 local verticalMargin = -(Gladdy.db.powerBarHeight)/2
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
if Gladdy.db.cooldownYPos == "TOP" then if Gladdy.db.cooldownYPos == "TOP" then
if Gladdy.db.cooldownXPos == "RIGHT" then if Gladdy.db.cooldownXPos == "RIGHT" then
button.spellCooldownFrame:SetPoint("BOTTOMRIGHT", button.healthBar, "TOPRIGHT", Gladdy.db.cooldownXOffset, Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) -- needs to be properly anchored after trinket button.spellCooldownFrame:SetPoint("BOTTOMRIGHT", button.healthBar, "TOPRIGHT", Gladdy.db.cooldownXOffset, horizontalMargin + Gladdy.db.cooldownYOffset)
else else
button.spellCooldownFrame:SetPoint("BOTTOMLEFT", button.healthBar, "TOPLEFT", Gladdy.db.cooldownXOffset, Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("BOTTOMLEFT", button.healthBar, "TOPLEFT", Gladdy.db.cooldownXOffset, horizontalMargin + Gladdy.db.cooldownYOffset)
end end
elseif Gladdy.db.cooldownYPos == "BOTTOM" then elseif Gladdy.db.cooldownYPos == "BOTTOM" then
if Gladdy.db.cooldownXPos == "RIGHT" then if Gladdy.db.cooldownXPos == "RIGHT" then
button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) -- needs to be properly anchored after trinket button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset)
else else
button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -Gladdy.db.highlightBorderSize + Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset)
end end
elseif Gladdy.db.cooldownYPos == "LEFT" then elseif Gladdy.db.cooldownYPos == "LEFT" then
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local anchor = Gladdy:GetAnchor(unit, "LEFT")
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then if anchor == Gladdy.buttons[unit].healthBar then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -(horizontalMargin + Gladdy.db.padding) + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
if (Gladdy.db.classIconPos == "LEFT") then else
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding button.spellCooldownFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
end
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "LEFT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "LEFT") then
verticalMargin = verticalMargin -
((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2
end
if (Gladdy.db.buffsCooldownPos == "LEFT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
button.spellCooldownFrame:SetPoint("RIGHT", button.healthBar, "LEFT", -horizontalMargin + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset + verticalMargin)
elseif Gladdy.db.cooldownYPos == "RIGHT" then elseif Gladdy.db.cooldownYPos == "RIGHT" then
verticalMargin = -(Gladdy.db.powerBarHeight)/2 local anchor = Gladdy:GetAnchor(unit, "RIGHT")
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding else
if (Gladdy.db.classIconPos == "RIGHT") then button.spellCooldownFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
end
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.drCooldownPos == "RIGHT" and Gladdy.db.drEnabled) then
verticalMargin = verticalMargin + Gladdy.db.drIconSize/2 + Gladdy.db.padding/2
end
if (Gladdy.db.castBarPos == "RIGHT") then
verticalMargin = verticalMargin -
((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2
end
if (Gladdy.db.buffsCooldownPos == "RIGHT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
button.spellCooldownFrame:SetPoint("LEFT", button.healthBar, "RIGHT", horizontalMargin + Gladdy.db.cooldownXOffset, Gladdy.db.cooldownYOffset + verticalMargin)
end end
button.spellCooldownFrame:SetHeight(Gladdy.db.cooldownSize) button.spellCooldownFrame:SetHeight(Gladdy.db.cooldownSize)
button.spellCooldownFrame:SetWidth(1) button.spellCooldownFrame:SetWidth(1)
@ -227,12 +237,10 @@ function Cooldowns:UpdateFrame(unit)
end end
function Cooldowns:Test(unit) function Cooldowns:Test(unit)
if Gladdy.db.cooldown then local button = Gladdy.buttons[unit]
local button = Gladdy.buttons[unit] button.spellCooldownFrame:Show()
button.spellCooldownFrame:Show() button.lastCooldownSpell = 1
button.lastCooldownSpell = 1 self:UpdateTestCooldowns(unit)
self:UpdateTestCooldowns(unit)
end
end end
function Cooldowns:UpdateTestCooldowns(unit) function Cooldowns:UpdateTestCooldowns(unit)
@ -246,12 +254,12 @@ function Cooldowns:UpdateTestCooldowns(unit)
button.test = true button.test = true
-- use class spells -- use class spells
for k, v in pairs(self.cooldownSpells[button.class]) do for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId --k is spellId
self:CooldownUsed(unit, button.class, k, nil) self:CooldownUsed(unit, button.class, k, nil)
end end
-- use race spells -- use race spells
for k, v in pairs(self.cooldownSpells[button.race]) do for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
self:CooldownUsed(unit, button.race, k, nil) self:CooldownUsed(unit, button.race, k, nil)
end end
end end
@ -345,30 +353,32 @@ function Cooldowns:DetectSpec(unit, spec)
if (Gladdy.db.cooldown) then if (Gladdy.db.cooldown) then
local class = Gladdy.buttons[unit].class local class = Gladdy.buttons[unit].class
local race = Gladdy.buttons[unit].race local race = Gladdy.buttons[unit].race
for k, v in pairs(self.cooldownSpells[class]) do for k, v in pairs(Gladdy:GetCooldownList()[class]) do
--if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then --if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then
local sharedCD = false if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then
if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then local sharedCD = false
for spellId, _ in pairs(v.sharedCD) do if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then
for i = 1, button.lastCooldownSpell do for spellId, _ in pairs(v.sharedCD) do
local icon = button.spellCooldownFrame["icon" .. i] for i = 1, button.lastCooldownSpell do
if (icon.spellId == spellId) then local icon = button.spellCooldownFrame["icon" .. i]
sharedCD = true if (icon.spellId == spellId) then
sharedCD = true
end
end end
end end
end end
end if sharedCD then
if sharedCD then return
return end
end
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon:Show() icon:Show()
icon.texture:SetTexture(self.spellTextures[k]) icon.texture:SetTexture(self.spellTextures[k])
icon.spellId = k icon.spellId = k
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
--end --end
@ -377,31 +387,33 @@ function Cooldowns:DetectSpec(unit, spec)
--- RACE FUNCTIONALITY --- RACE FUNCTIONALITY
---------------------- ----------------------
local race = Gladdy.buttons[unit].race local race = Gladdy.buttons[unit].race
if self.cooldownSpells[race] then if Gladdy:GetCooldownList()[race] then
for k, v in pairs(self.cooldownSpells[race]) do for k, v in pairs(Gladdy:GetCooldownList()[race]) do
--if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then --if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then
local sharedCD = false if (type(v) == "table" and ((v.spec ~= nil and v.spec == spec) or (v.notSpec ~= nil and v.notSpec ~= spec))) then
if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then local sharedCD = false
for spellId, _ in pairs(v.sharedCD) do if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then
for i = 1, button.lastCooldownSpell do for spellId, _ in pairs(v.sharedCD) do
local icon = button.spellCooldownFrame["icon" .. i] for i = 1, button.lastCooldownSpell do
if (icon.spellId == spellId) then local icon = button.spellCooldownFrame["icon" .. i]
sharedCD = true if (icon.spellId == spellId) then
sharedCD = true
end
end end
end end
end end
end if sharedCD then
if sharedCD then return
return end
end
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon:Show() icon:Show()
icon.texture:SetTexture(self.spellTextures[k]) icon.texture:SetTexture(self.spellTextures[k])
icon.spellId = k icon.spellId = k
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
end end
@ -412,6 +424,10 @@ function Cooldowns:ResetUnit(unit)
Gladdy.buttons[unit].test = nil Gladdy.buttons[unit].test = nil
end end
function Cooldowns:UNIT_DESTROYED(unit)
end
function Cooldowns:UpdateCooldowns(button) function Cooldowns:UpdateCooldowns(button)
local class = button.class local class = button.class
local race = button.race local race = button.race
@ -420,29 +436,31 @@ function Cooldowns:UpdateCooldowns(button)
end end
if (Gladdy.db.cooldown) then if (Gladdy.db.cooldown) then
for k, v in pairs(self.cooldownSpells[class]) do for k, v in pairs(Gladdy:GetCooldownList()[class]) do
if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
-- see if we have shared cooldowns without a cooldown defined if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then
-- e.g. hunter traps have shared cooldowns, so only display one trap instead all of them -- see if we have shared cooldowns without a cooldown defined
local sharedCD = false -- e.g. hunter traps have shared cooldowns, so only display one trap instead all of them
if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then local sharedCD = false
for spellId, _ in pairs(v.sharedCD) do if (type(v) == "table" and v.sharedCD ~= nil and v.sharedCD.cd == nil) then
for i = 1, button.lastCooldownSpell do for spellId, _ in pairs(v.sharedCD) do
local icon = button.spellCooldownFrame["icon" .. i] for i = 1, button.lastCooldownSpell do
if (icon.spellId == spellId) then local icon = button.spellCooldownFrame["icon" .. i]
sharedCD = true if (icon.spellId == spellId) then
sharedCD = true
end
end end
end end
end end
end
if (not sharedCD) then if (not sharedCD) then
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon:Show() icon:Show()
icon.spellId = k icon.spellId = k
icon.texture:SetTexture(self.spellTextures[k]) icon.texture:SetTexture(self.spellTextures[k])
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
end end
@ -450,14 +468,16 @@ function Cooldowns:UpdateCooldowns(button)
-- RACE FUNCTIONALITY -- RACE FUNCTIONALITY
---- ----
for k, v in pairs(self.cooldownSpells[race]) do for k, v in pairs(Gladdy:GetCooldownList()[race]) do
if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then if Gladdy.db.cooldownCooldowns[tostring(k)] then
local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell] if (type(v) ~= "table" or (type(v) == "table" and v.spec == nil and v.notSpec == nil)) then
icon:Show() local icon = button.spellCooldownFrame["icon" .. button.lastCooldownSpell]
icon.spellId = k icon:Show()
icon.texture:SetTexture(self.spellTextures[k]) icon.spellId = k
button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon icon.texture:SetTexture(self.spellTextures[k])
button.lastCooldownSpell = button.lastCooldownSpell + 1 button.spellCooldownFrame["icon" .. button.lastCooldownSpell] = icon
button.lastCooldownSpell = button.lastCooldownSpell + 1
end
end end
end end
end end
@ -470,7 +490,7 @@ function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
end end
-- if (self.db.cooldownList[spellId] == false) then return end -- if (self.db.cooldownList[spellId] == false) then return end
local cooldown = self.cooldownSpells[unitClass][spellId] local cooldown = Gladdy:GetCooldownList()[unitClass][spellId]
local cd = cooldown local cd = cooldown
if (type(cooldown) == "table") then if (type(cooldown) == "table") then
-- return if the spec doesn't have a cooldown for this spell -- return if the spec doesn't have a cooldown for this spell
@ -582,7 +602,7 @@ function Cooldowns:GetOptions()
desc = L["Size of each cd icon"], desc = L["Size of each cd icon"],
order = 4, order = 4,
min = 5, min = 5,
max = (Gladdy.db.healthBarHeight + Gladdy.db.castBarHeight + Gladdy.db.powerBarHeight + Gladdy.db.bottomMargin) / 2, max = 50,
}), }),
cooldownWidthFactor = Gladdy:option({ cooldownWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -755,9 +775,80 @@ function Cooldowns:GetOptions()
}, },
}, },
}, },
cooldowns = {
type = "group",
childGroups = "tree",
name = "Cooldowns",
order = 4,
args = Cooldowns:GetCooldownOptions(),
},
} }
end end
function Cooldowns:GetCooldownOptions()
local group = {}
local p = 1
for i,class in ipairs(Gladdy.CLASSES) do
group[class] = {
type = "group",
name = LOCALIZED_CLASS_NAMES_MALE[class],
order = i,
icon = "Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes",
iconCoords = CLASS_ICON_TCOORDS[class],
args = {}
}
local o = 1
for spellId,cooldown in pairs(Gladdy:GetCooldownList()[class]) do
group[class].args[tostring(spellId)] = {
type = "toggle",
name = select(1, GetSpellInfo(spellId)) .. (type(cooldown) == "table" and cooldown.spec and (" - " .. cooldown.spec) or ""),
order = o,
width = "full",
image = select(3, GetSpellInfo(spellId)),
get = function(info)
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
end
}
o = o + 1
end
p = p + i
end
for i,race in ipairs(Gladdy.RACES) do
group[race] = {
type = "group",
name = L[race],
order = i + p,
icon = "Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Races",
iconCoords = RACE_ICON_TCOORDS[upper(race) .. "_FEMALE"],
args = {}
}
local o = 1
for spellId,cooldown in pairs(Gladdy:GetCooldownList()[race]) do
group[race].args[tostring(spellId)] = {
type = "toggle",
name = select(1, GetSpellInfo(spellId)) .. (type(cooldown) == "table" and cooldown.spec and (" - " .. cooldown.spec) or ""),
order = o,
width = "full",
image = select(3, GetSpellInfo(spellId)),
get = function(info)
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
end
}
o = o + 1
end
end
return group
end
function Gladdy:UpdateTestCooldowns(i) function Gladdy:UpdateTestCooldowns(i)
local unit = "arena" .. i local unit = "arena" .. i
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
@ -769,219 +860,13 @@ function Gladdy:UpdateTestCooldowns(i)
Cooldowns:DetectSpec(unit, button.testSpec) Cooldowns:DetectSpec(unit, button.testSpec)
-- use class spells -- use class spells
for k, v in pairs(Cooldowns.cooldownSpells[button.class]) do for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId --k is spellId
Cooldowns:CooldownUsed(unit, button.class, k, nil) Cooldowns:CooldownUsed(unit, button.class, k, nil)
end end
-- use race spells -- use race spells
for k, v in pairs(Cooldowns.cooldownSpells[button.race]) do for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
Cooldowns:CooldownUsed(unit, button.race, k, nil) Cooldowns:CooldownUsed(unit, button.race, k, nil)
end end
end end
end end
Cooldowns.cooldownSpells = {
-- Spell Name Cooldown[, Spec]
-- Mage
["MAGE"] = {
[1953] = 15, -- Blink
--[122] = 22, -- Frost Nova
--[12051] = 480, --Evocation
[2139] = 24, -- Counterspell
[45438] = { cd = 300, [L["Frost"]] = 240, }, -- Ice Block
[12472] = { cd = 180, spec = L["Frost"], }, -- Icy Veins
[31687] = { cd = 180, spec = L["Frost"], }, -- Summon Water Elemental
[12043] = { cd = 180, spec = L["Arcane"], }, -- Presence of Mind
[11129] = { cd = 180, spec = L["Fire"] }, -- Combustion
[120] = { cd = 10,
sharedCD = {
[31661] = true, -- Cone of Cold
}, spec = L["Fire"] }, -- Dragon's Breath
[31661] = { cd = 20,
sharedCD = {
[120] = true, -- Cone of Cold
}, spec = L["Fire"] }, -- Dragon's Breath
[12042] = { cd = 180, spec = L["Arcane"], }, -- Arcane Power
[11958] = { cd = 384, spec = L["Frost"], -- Coldsnap
resetCD = {
[12472] = true,
[45438] = true,
[31687] = true,
},
},
},
-- Priest
["PRIEST"] = {
[10890] = { cd = 27, [L["Shadow"]] = 23, }, -- Psychic Scream
[15487] = { cd = 45, spec = L["Shadow"], }, -- Silence
[10060] = { cd = 180, spec = L["Discipline"], }, -- Power Infusion
[33206] = { cd = 120, spec = L["Discipline"], }, -- Pain Suppression
[34433] = 300, -- Shadowfiend
},
-- Druid
["DRUID"] = {
[22812] = 60, -- Barkskin
[29166] = 360, -- Innervate
[8983] = 60, -- Bash
[16689] = 60, -- Natures Grasp
[17116] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
[33831] = { cd = 180, spec = L["Balance"], }, -- Force of Nature
},
-- Shaman
["SHAMAN"] = {
[8042] = { cd = 6, -- Earth Shock
sharedCD = {
[8056] = true, -- Frost Shock
[8050] = true, -- Flame Shock
},
},
[30823] = { cd = 120, spec = L["Enhancement"], }, -- Shamanistic Rage
[16166] = { cd = 180, spec = L["Elemental"], }, -- Elemental Mastery
[16188] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
[16190] = { cd = 300, spec = L["Restoration"], }, -- Mana Tide Totem
},
-- Paladin
["PALADIN"] = {
[10278] = 180, -- Blessing of Protection
[1044] = 25, -- Blessing of Freedom
[10308] = { cd = 60, [L["Retribution"]] = 40, }, -- Hammer of Justice
[642] = { cd = 300, -- Divine Shield
sharedCD = {
cd = 60, -- no actual shared CD but debuff
[31884] = true,
},
},
[31884] = { cd = 180, spec = L["Retribution"], -- Avenging Wrath
sharedCD = {
cd = 60,
[642] = true,
},
},
[20066] = { cd = 60, spec = L["Retribution"], }, -- Repentance
[31842] = { cd = 180, spec = L["Holy"], }, -- Divine Illumination
[31935] = { cd = 30, spec = L["Protection"], }, -- Avengers Shield
},
-- Warlock
["WARLOCK"] = {
[17928] = 40, -- Howl of Terror
[27223] = 120, -- Death Coil
--[19647] = { cd = 24 }, -- Spell Lock; how will I handle pet spells?
[30414] = { cd = 20, spec = L["Destruction"], }, -- Shadowfury
[17877] = { cd = 15, spec = L["Destruction"], }, -- Shadowburn
[18708] = { cd = 900, spec = L["Demonology"], }, -- Feldom
},
-- Warrior
["WARRIOR"] = {
--[[6552] = { cd = 10, -- Pummel
sharedCD = {
[72] = true,
},
},
[72] = { cd = 12, -- Shield Bash
sharedCD = {
[6552] = true,
},
}, ]]
--[23920] = 10, -- Spell Reflection
[3411] = 30, -- Intervene
[676] = 60, -- Disarm
[5246] = 180, -- Intimidating Shout
--[2565] = 60, -- Shield Block
[12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish
[12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand
[12809] = { cd = 30, spec = L["Protection"], }, -- Concussion Blow
},
-- Hunter
["HUNTER"] = {
[19503] = 30, -- Scatter Shot
[19263] = 300, -- Deterrence; not on BM but can't do 2 specs
[14311] = { cd = 30, -- Freezing Trap
sharedCD = {
[13809] = true, -- Frost Trap
[34600] = true, -- Snake Trap
},
},
[13809] = { cd = 30, -- Frost Trap
sharedCD = {
[14311] = true, -- Freezing Trap
[34600] = true, -- Snake Trap
},
},
[34600] = { cd = 30, -- Snake Trap
sharedCD = {
[14311] = true, -- Freezing Trap
[13809] = true, -- Frost Trap
},
},
[34490] = { cd = 20, spec = L["Marksmanship"], }, -- Silencing Shot
[19386] = { cd = 60, spec = L["Survival"], }, -- Wyvern Sting
[19577] = { cd = 60, spec = L["Beast Mastery"], }, -- Intimidation
[38373] = { cd = 120, spec = L["Beast Mastery"], }, -- The Beast Within
},
-- Rogue
["ROGUE"] = {
[1766] = 10, -- Kick
[8643] = 20, -- Kidney Shot
[31224] = 60, -- Cloak of Shadow
[26889] = { cd = 300, [L["Subtlety"]] = 180, }, -- Vanish
[2094] = { cd = 180, [L["Subtlety"]] = 90, }, -- Blind
[11305] = { cd = 300, [L["Combat"]] = 180, }, -- Sprint
[26669] = { cd = 300, [L["Combat"]] = 180, }, -- Evasion
[14177] = { cd = 180, spec = L["Assassination"], }, -- Cold Blood
[13750] = { cd = 300, spec = L["Combat"], }, -- Adrenaline Rush
[13877] = { cd = 120, spec = L["Combat"], }, -- Blade Flurry
[36554] = { cd = 30, spec = L["Subtlety"], }, -- Shadowstep
[14185] = { cd = 600, spec = L["Subtlety"], -- Preparation
resetCD = {
[26669] = true,
[11305] = true,
[26889] = true,
[14177] = true,
[36554] = true,
},
},
},
["Scourge"] = {
[7744] = 120, -- Will of the Forsaken
},
["BloodElf"] = {
[28730] = 120, -- Arcane Torrent
},
["Tauren"] = {
[20549] = 120, -- War Stomp
},
["Orc"] = {
},
["Troll"] = {
},
["NightElf"] = {
[2651] = { cd = 180, spec = L["Discipline"], }, -- Elune's Grace
[10797] = { cd = 30, spec = L["Discipline"], }, -- Star Shards
},
["Draenei"] = {
[32548] = { cd = 300, spec = L["Discipline"], }, -- Hymn of Hope
},
["Human"] = {
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
[20600] = 180, -- Perception
},
["Gnome"] = {
[20589] = 105, -- Escape Artist
},
["Dwarf"] = {
[20594] = 180, -- Stoneform
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
},
}

View File

@ -62,11 +62,12 @@ end
function Diminishings:Initialize() function Diminishings:Initialize()
self.frames = {} self.frames = {}
self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE") self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE", "UNIT_DESTROYED")
end end
function Diminishings:CreateFrame(unit) function Diminishings:CreateFrame(unit)
local drFrame = CreateFrame("Frame", nil, Gladdy.buttons[unit]) local drFrame = CreateFrame("Frame", nil, Gladdy.buttons[unit])
drFrame:EnableMouse(false)
for i = 1, 16 do for i = 1, 16 do
local icon = CreateFrame("Frame", "GladdyDr" .. unit .. "Icon" .. i, drFrame) local icon = CreateFrame("Frame", "GladdyDr" .. unit .. "Icon" .. i, drFrame)
@ -74,6 +75,7 @@ function Diminishings:CreateFrame(unit)
icon:EnableMouse(false) icon:EnableMouse(false)
icon:SetFrameLevel(3) icon:SetFrameLevel(3)
icon.texture = icon:CreateTexture(nil, "BACKGROUND") icon.texture = icon:CreateTexture(nil, "BACKGROUND")
icon.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
icon.texture:SetAllPoints(icon) icon.texture:SetAllPoints(icon)
icon:SetScript("OnUpdate", function(self, elapsed) icon:SetScript("OnUpdate", function(self, elapsed)
if (self.active) then if (self.active) then
@ -94,7 +96,7 @@ function Diminishings:CreateFrame(unit)
if self.timeLeft >=5 then if self.timeLeft >=5 then
self.timeText:SetFormattedText("%d", self.timeLeft) self.timeText:SetFormattedText("%d", self.timeLeft)
else else
self.timeText:SetFormattedText("%.1f", self.timeLeft) self.timeText:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
end end
end end
end end
@ -160,57 +162,22 @@ function Diminishings:UpdateFrame(unit)
end end
drFrame:ClearAllPoints() drFrame:ClearAllPoints()
local horizontalMargin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
if (Gladdy.db.drCooldownPos == "LEFT") then if (Gladdy.db.drCooldownPos == "LEFT") then
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "LEFT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "LEFT") then drFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end drFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
elseif (Gladdy.db.classIconPos == "LEFT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.castBarPos == "LEFT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "LEFT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin - (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "LEFT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
drFrame:SetPoint("RIGHT", Gladdy.buttons[unit].healthBar, "LEFT", -horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset + verticalMargin)
end end
if (Gladdy.db.drCooldownPos == "RIGHT") then if (Gladdy.db.drCooldownPos == "RIGHT") then
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then local anchor = Gladdy:GetAnchor(unit, "RIGHT")
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding if anchor == Gladdy.buttons[unit].healthBar then
if (Gladdy.db.classIconPos == "RIGHT") then drFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding else
end drFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
elseif (Gladdy.db.classIconPos == "RIGHT") then
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
end
end end
if (Gladdy.db.castBarPos == "RIGHT") then
verticalMargin = verticalMargin -
(((Gladdy.db.castBarHeight < Gladdy.db.castBarIconSize) and Gladdy.db.castBarIconSize
or Gladdy.db.castBarHeight)/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.cooldownYPos == "RIGHT" and Gladdy.db.cooldown) then
verticalMargin = verticalMargin - (Gladdy.db.cooldownSize/2 + Gladdy.db.padding/2)
end
if (Gladdy.db.buffsCooldownPos == "RIGHT" and Gladdy.db.buffsEnabled) then
verticalMargin = verticalMargin - (Gladdy.db.buffsIconSize/2 + Gladdy.db.padding/2)
end
drFrame:SetPoint("LEFT", Gladdy.buttons[unit].healthBar, "RIGHT", horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset + verticalMargin)
end end
drFrame:SetWidth(Gladdy.db.drIconSize * 16) drFrame:SetWidth(Gladdy.db.drIconSize * 16)
@ -264,9 +231,9 @@ function Diminishings:UpdateFrame(unit)
icon.border:SetTexture(Gladdy.db.drBorderStyle) icon.border:SetTexture(Gladdy.db.drBorderStyle)
end end
icon.texture:SetTexCoord(.1, .9, .1, .9) --icon.texture:SetTexCoord(.1, .9, .1, .9)
icon.texture:SetPoint("TOPLEFT", icon, "TOPLEFT", 2, -2) --icon.texture:SetPoint("TOPLEFT", icon, "TOPLEFT", 2, -2)
icon.texture:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -2, 2) --icon.texture:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT", -2, 2)
end end
end end
@ -289,6 +256,10 @@ function Diminishings:ResetUnit(unit)
end end
end end
function Diminishings:UNIT_DESTROYED(unit)
Diminishings:ResetUnit(unit)
end
function Diminishings:Test(unit) function Diminishings:Test(unit)
if Gladdy.db.drEnabled then if Gladdy.db.drEnabled then
local spells = { 33786, 118, 8643, 8983 } local spells = { 33786, 118, 8643, 8983 }

View File

@ -64,9 +64,11 @@ importButton:SetText("Import\n(this will overwrite your current profile!)")
importButton:SetWidth(200) importButton:SetWidth(200)
importButton:SetHeight(50) importButton:SetHeight(50)
importButton:SetCallback("OnClick", function(widget) importButton:SetCallback("OnClick", function(widget)
ExportImport:ApplyImport(import.deserializedTable) ExportImport:ApplyImport(import.deserializedTable, Gladdy.db)
Gladdy:UpdateFrame()
import:Hide() import:Hide()
Gladdy:Reset()
Gladdy:HideFrame()
Gladdy:ToggleFrame(3)
end) end)
import:AddChild(importButton) import:AddChild(importButton)
import.button = importButton import.button = importButton
@ -83,26 +85,29 @@ end)
import:AddChild(importClearButton) import:AddChild(importClearButton)
import.clearButton = importClearButton import.clearButton = importClearButton
local deletedOptions = { --TODO backward compatibility Imports on deleted options
growUp = true
}
function ExportImport:CheckDeserializedOptions(tbl, refTbl, str) function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
if str == nil and not tbl.version_major then if str == nil and not tbl.version_major_num then
return false, "Version conflict: version_major not seen" return false, "Version conflict: version_major_num not seen"
end end
if str == nil and tbl.version_major ~= Gladdy.version_major then if str == nil and tbl.version_major_num ~= Gladdy.version_major_num then
return false, "Version conflict: " .. tbl.version_major .. " ~= " .. Gladdy.version_major return false, "Version conflict: " .. tbl.version_major_num .. " ~= " .. Gladdy.version_major_num
end end
if str == nil then if str == nil then
str = "Gladdy.db" str = "Gladdy.db"
tbl.version_major = nil tbl.version_major_num = nil
end end
if type(tbl) == "table" then for k,v in pairs(tbl) do
for k,v in pairs(tbl) do if refTbl[k] == nil then
if refTbl[k] ~= nil then return false, str .. "." .. k .. " does not exist"
if type(v) ~= type(refTbl[k]) then else
return false, str .. "." .. k .. " type error. Expected " .. type(refTbl[k]) .. " found " .. type(v) if type(v) ~= type(refTbl[k]) then
end return false, str .. "." .. k .. " type error. Expected " .. type(refTbl[k]) .. " found " .. type(v)
elseif type(v) == "table" then
ExportImport:CheckDeserializedOptions(v, refTbl[k], str .. "." .. k) ExportImport:CheckDeserializedOptions(v, refTbl[k], str .. "." .. k)
else
return false, str .. "." .. k .. " does not exist"
end end
end end
end end
@ -122,7 +127,7 @@ function ExportImport:GetOptions()
type = "execute", type = "execute",
func = function() func = function()
local db = table_copy(Gladdy.db) local db = table_copy(Gladdy.db)
db.version_major = Gladdy.version_major db.version_major_num = Gladdy.version_major_num
dump = AceSerializer:Serialize(db) dump = AceSerializer:Serialize(db)
local compress_deflate = LibDeflate:CompressZlib(dump) local compress_deflate = LibDeflate:CompressZlib(dump)
printable_compressed = LibDeflate:EncodeForPrint(compress_deflate) printable_compressed = LibDeflate:EncodeForPrint(compress_deflate)
@ -164,14 +169,11 @@ function ExportImport:GetOptions()
end end
function ExportImport:ApplyImport(t, table) function ExportImport:ApplyImport(t, table)
if table == nil then
table = Gladdy.dbi.profile
end
for k,v in pairs(t) do for k,v in pairs(t) do
if type(v) == "table" then if type(v) == "table" then
ExportImport:ApplyImport(v, table[k]) ExportImport:ApplyImport(v, table[k])
else else
table[k] = v; table[k] = v
end end
end end
end end
@ -204,7 +206,7 @@ function ExportImport:Decode(str, showError)
end end
return nil return nil
end end
local statusOption, error = ExportImport:CheckDeserializedOptions(deserialized, Gladdy.db) local statusOption, error = ExportImport:CheckDeserializedOptions(deserialized, Gladdy.defaults.profile)
if not statusOption then if not statusOption then
if showError then if showError then
import.statustext:SetTextColor(1,0,0) import.statustext:SetTextColor(1,0,0)

View File

@ -17,7 +17,10 @@ local Healthbar = Gladdy:NewModule("Healthbar", 100, {
healthBarBorderColor = { r = 0, g = 0, b = 0, a = 1 }, healthBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
healthBarBgColor = { r = 0, g = 0, b = 0, a = 0.4 }, healthBarBgColor = { r = 0, g = 0, b = 0, a = 0.4 },
healthBarFontColor = { r = 1, g = 1, b = 1, a = 1 }, healthBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
healthBarFontSize = 12, healthBarNameFontSize = 12,
healthBarHealthFontSize = 12,
healthNameToArenaId = false,
healthName = true,
healthActual = false, healthActual = false,
healthMax = true, healthMax = true,
healthPercentage = true, healthPercentage = true,
@ -25,7 +28,9 @@ local Healthbar = Gladdy:NewModule("Healthbar", 100, {
function Healthbar:Initialize() function Healthbar:Initialize()
self.frames = {} self.frames = {}
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_SPOTTED") self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("UNIT_DESTROYED")
self:RegisterMessage("UNIT_DEATH") self:RegisterMessage("UNIT_DEATH")
end end
@ -33,6 +38,7 @@ function Healthbar:CreateFrame(unit)
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
local healthBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate") local healthBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate")
healthBar:EnableMouse(false)
healthBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.healthBarBorderStyle), healthBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.healthBarBorderStyle),
edgeSize = Gladdy.db.healthBarBorderSize }) edgeSize = Gladdy.db.healthBarBorderSize })
healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a) healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a)
@ -51,11 +57,11 @@ function Healthbar:CreateFrame(unit)
healthBar.bg:SetVertexColor(Gladdy.db.healthBarBgColor.r, Gladdy.db.healthBarBgColor.g, Gladdy.db.healthBarBgColor.b, Gladdy.db.healthBarBgColor.a) healthBar.bg:SetVertexColor(Gladdy.db.healthBarBgColor.r, Gladdy.db.healthBarBgColor.g, Gladdy.db.healthBarBgColor.b, Gladdy.db.healthBarBgColor.a)
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall") healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
if (Gladdy.db.healthBarFontSize < 1) then if (Gladdy.db.healthBarNameFontSize < 1) then
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1) healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarNameFont), 1)
healthBar.nameText:Hide() healthBar.nameText:Hide()
else else
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize) healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
healthBar.nameText:Show() healthBar.nameText:Show()
end end
healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a) healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
@ -65,11 +71,11 @@ function Healthbar:CreateFrame(unit)
healthBar.nameText:SetPoint("LEFT", 5, 0) healthBar.nameText:SetPoint("LEFT", 5, 0)
healthBar.healthText = healthBar:CreateFontString(nil, "LOW") healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
if (Gladdy.db.healthBarFontSize < 1) then if (Gladdy.db.healthBarHealthFontSize < 1) then
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1) healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
healthBar.healthText:Hide() healthBar.healthText:Hide()
else else
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize) healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
healthBar.healthText:Hide() healthBar.healthText:Hide()
end end
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a) healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
@ -158,7 +164,7 @@ function Healthbar:UpdateFrame(unit)
edgeSize = Gladdy.db.healthBarBorderSize }) edgeSize = Gladdy.db.healthBarBorderSize })
healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a) healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a)
healthBar:ClearAllPoints() healthBar:ClearAllPoints()
healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", iconSize, 0) healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", 0, 0)
healthBar:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit], "BOTTOMRIGHT") healthBar:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit], "BOTTOMRIGHT")
healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture)) healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture))
@ -166,17 +172,24 @@ function Healthbar:UpdateFrame(unit)
healthBar.hp:SetPoint("TOPLEFT", healthBar, "TOPLEFT", (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset)) healthBar.hp:SetPoint("TOPLEFT", healthBar, "TOPLEFT", (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset))
healthBar.hp:SetPoint("BOTTOMRIGHT", healthBar, "BOTTOMRIGHT", -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset)) healthBar.hp:SetPoint("BOTTOMRIGHT", healthBar, "BOTTOMRIGHT", -(Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.healthBarBorderSize/Gladdy.db.statusbarBorderOffset))
if (Gladdy.db.healthBarFontSize < 1) then if (Gladdy.db.healthBarHealthFontSize < 1) then
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1) healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
healthBar.nameText:Hide()
healthBar.healthText:Hide() healthBar.healthText:Hide()
else else
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize) healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
healthBar.nameText:Show()
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarFontSize)
healthBar.healthText:Show() healthBar.healthText:Show()
end end
if (Gladdy.db.healthBarNameFontSize < 1) then
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarNameFont), 1)
healthBar.nameText:Hide()
else
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
if Gladdy.db.healthName then
healthBar.nameText:Show()
else
healthBar.nameText:Hide()
end
end
healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a) healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a) healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
end end
@ -200,10 +213,20 @@ function Healthbar:Test(unit)
return return
end end
self:JOINED_ARENA()
self:ENEMY_SPOTTED(unit) self:ENEMY_SPOTTED(unit)
self:UNIT_HEALTH(unit, button.health, button.healthMax) self:UNIT_HEALTH(unit, button.health, button.healthMax)
end end
function Healthbar:JOINED_ARENA()
if Gladdy.db.healthNameToArenaId and Gladdy.db.healthName then
for i=1,Gladdy.curBracket do
local healthBar = self.frames["arena" .. i]
healthBar.nameText:SetText("Arena" .. i)
end
end
end
function Healthbar:ENEMY_SPOTTED(unit) function Healthbar:ENEMY_SPOTTED(unit)
local healthBar = self.frames[unit] local healthBar = self.frames[unit]
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
@ -218,7 +241,10 @@ function Healthbar:ENEMY_SPOTTED(unit)
healthBar.hp:SetValue(health) healthBar.hp:SetValue(health)
Healthbar:SetHealthText(healthBar, health, healthMax) Healthbar:SetHealthText(healthBar, health, healthMax)
end end
healthBar.nameText:SetText(button.name) if Gladdy.db.healthName and not Gladdy.db.healthNameToArenaId then
healthBar.nameText:SetText(button.name)
end
healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1) healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
end end
@ -270,6 +296,17 @@ function Healthbar:UNIT_DEATH(unit)
healthBar.healthText:SetText(L["DEAD"]) healthBar.healthText:SetText(L["DEAD"])
end end
function Healthbar:UNIT_DESTROYED(unit)
local healthBar = self.frames[unit]
if (not healthBar) then
return
end
healthBar.hp:SetValue(0)
healthBar.healthText:SetText(L["LEAVE"])
healthBar.nameText:SetText("")
end
local function option(params) local function option(params)
local defaults = { local defaults = {
get = function(info) get = function(info)
@ -283,6 +320,9 @@ local function option(params)
if Gladdy.db.healthBarBorderSize > Gladdy.db.healthBarHeight/2 then if Gladdy.db.healthBarBorderSize > Gladdy.db.healthBarHeight/2 then
Gladdy.db.healthBarBorderSize = Gladdy.db.healthBarHeight/2 Gladdy.db.healthBarBorderSize = Gladdy.db.healthBarHeight/2
end end
for i=1,Gladdy.curBracket do
Healthbar:Test("arena" .. i)
end
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
} }
@ -368,11 +408,21 @@ function Healthbar:GetOptions()
order = 12, order = 12,
hasAlpha = true, hasAlpha = true,
}), }),
healthBarFontSize = option({ healthBarNameFontSize = option({
type = "range", type = "range",
name = L["Font size"], name = L["Name font size"],
desc = L["Size of the text"], desc = L["Size of the name text"],
order = 13, order = 13,
step = 0.1,
min = 0,
max = 20,
}),
healthBarHealthFontSize = option({
type = "range",
name = L["Health font size"],
desc = L["Size of the health text"],
order = 14,
step = 0.1,
min = 0, min = 0,
max = 20, max = 20,
}), }),
@ -415,31 +465,44 @@ function Healthbar:GetOptions()
}, },
healthValues = { healthValues = {
type = "group", type = "group",
name = L["Health Values"], name = L["Health Bar Text"],
order = 4, order = 4,
args = { args = {
header = { header = {
type = "header", type = "header",
name = L["Health Values"], name = L["Health Bar Text"],
order = 1, order = 1,
}, },
healthName = option({
type = "toggle",
name = L["Show name text"],
desc = L["Show the units name"],
order = 2,
}),
healthNameToArenaId = option({
type = "toggle",
name = L["Show ArenaX"],
desc = L["Show Arena1-5 as name instead"],
order = 3,
disabled = function() return not Gladdy.db.healthName end
}),
healthActual = option({ healthActual = option({
type = "toggle", type = "toggle",
name = L["Show the actual health"], name = L["Show the actual health"],
desc = L["Show the actual health on the health bar"], desc = L["Show the actual health on the health bar"],
order = 31, order = 4,
}), }),
healthMax = option({ healthMax = option({
type = "toggle", type = "toggle",
name = L["Show max health"], name = L["Show max health"],
desc = L["Show max health on the health bar"], desc = L["Show max health on the health bar"],
order = 32, order = 5,
}), }),
healthPercentage = option({ healthPercentage = option({
type = "toggle", type = "toggle",
name = L["Show health percentage"], name = L["Show health percentage"],
desc = L["Show health percentage on the health bar"], desc = L["Show health percentage on the health bar"],
order = 33, order = 6,
}), }),
}, },
}, },

View File

@ -3,10 +3,12 @@ local CreateFrame, UnitIsUnit = CreateFrame, UnitIsUnit
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
local Highlight = Gladdy:NewModule("Highlight", nil, { local Highlight = Gladdy:NewModule("Highlight", nil, {
highlightBorderSize = 2, highlightBorderSize = 1,
highlightInset = false,
targetBorderColor = { r = 1, g = 0.8, b = 0, a = 1 }, targetBorderColor = { r = 1, g = 0.8, b = 0, a = 1 },
focusBorderColor = { r = 1, g = 0, b = 0, a = 1 }, focusBorderColor = { r = 1, g = 0, b = 0, a = 1 },
leaderBorderColor = { r = 0, g = 1, b = 0, a = 1 }, leaderBorderColor = { r = 0, g = 1, b = 0, a = 1 },
highlightBorderStyle = "Square Full White",
highlight = true, highlight = true,
targetBorder = true, targetBorder = true,
focusBorder = true, focusBorder = true,
@ -53,18 +55,18 @@ function Highlight:CreateFrame(unit)
local healthBar = Gladdy.modules.Healthbar.frames[unit] local healthBar = Gladdy.modules.Healthbar.frames[unit]
local targetBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") local targetBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
targetBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
targetBorder:SetFrameStrata("HIGH") --targetBorder:SetFrameStrata("MEDIUM")
targetBorder:Hide() targetBorder:Hide()
local focusBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") local focusBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
focusBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
focusBorder:SetFrameStrata("LOW") --focusBorder:SetFrameStrata("MEDIUM")
focusBorder:Hide() focusBorder:Hide()
local leaderBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate") local leaderBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
leaderBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = Gladdy.db.highlightBorderSize }) leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
leaderBorder:SetFrameStrata("MEDIUM") --leaderBorder:SetFrameStrata("MEDIUM")
leaderBorder:Hide() leaderBorder:Hide()
local highlight = healthBar:CreateTexture(nil, "OVERLAY") local highlight = healthBar:CreateTexture(nil, "OVERLAY")
@ -88,29 +90,48 @@ function Highlight:UpdateFrame(unit)
end end
local borderSize = Gladdy.db.highlightBorderSize local borderSize = Gladdy.db.highlightBorderSize
local borderOffset = borderSize
local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight + 1 local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight + 1
local width = Gladdy.db.barWidth + borderSize * 2 local width = Gladdy.db.barWidth + (Gladdy.db.highlightInset and 0 or borderSize * 2)
local height = iconSize + borderSize * 2 local height = iconSize + (Gladdy.db.highlightInset and 0 or borderSize * 2)
button.targetBorder:SetWidth(width) button.targetBorder:SetWidth(width)
button.targetBorder:SetHeight(height) button.targetBorder:SetHeight(height)
button.targetBorder:ClearAllPoints() button.targetBorder:ClearAllPoints()
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) if Gladdy.db.highlightInset then
button.targetBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) button.targetBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.targetBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.targetBorder:SetBackdropBorderColor(Gladdy.db.targetBorderColor.r, Gladdy.db.targetBorderColor.g, Gladdy.db.targetBorderColor.b, Gladdy.db.targetBorderColor.a) button.targetBorder:SetBackdropBorderColor(Gladdy.db.targetBorderColor.r, Gladdy.db.targetBorderColor.g, Gladdy.db.targetBorderColor.b, Gladdy.db.targetBorderColor.a)
button.focusBorder:SetWidth(width) button.focusBorder:SetWidth(width)
button.focusBorder:SetHeight(height) button.focusBorder:SetHeight(height)
button.focusBorder:ClearAllPoints() button.focusBorder:ClearAllPoints()
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) if Gladdy.db.highlightInset then
button.focusBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) button.focusBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.focusBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.focusBorder:SetBackdropBorderColor(Gladdy.db.focusBorderColor.r, Gladdy.db.focusBorderColor.g, Gladdy.db.focusBorderColor.b, Gladdy.db.focusBorderColor.a) button.focusBorder:SetBackdropBorderColor(Gladdy.db.focusBorderColor.r, Gladdy.db.focusBorderColor.g, Gladdy.db.focusBorderColor.b, Gladdy.db.focusBorderColor.a)
button.leaderBorder:SetWidth(width) button.leaderBorder:SetWidth(width)
button.leaderBorder:SetHeight(height) button.leaderBorder:SetHeight(height)
button.leaderBorder:ClearAllPoints() button.leaderBorder:ClearAllPoints()
button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, borderSize) if Gladdy.db.highlightInset then
button.leaderBorder:SetBackdrop({ edgeFile = "Interface\\ChatFrame\\ChatFrameBackground", edgeSize = borderSize }) button.leaderBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.leaderBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.leaderBorder:SetBackdropBorderColor(Gladdy.db.leaderBorderColor.r, Gladdy.db.leaderBorderColor.g, Gladdy.db.leaderBorderColor.b, Gladdy.db.leaderBorderColor.a) button.leaderBorder:SetBackdropBorderColor(Gladdy.db.leaderBorderColor.r, Gladdy.db.leaderBorderColor.g, Gladdy.db.leaderBorderColor.b, Gladdy.db.leaderBorderColor.a)
if Gladdy.frame.testing then if Gladdy.frame.testing then
Highlight:Test(unit) Highlight:Test(unit)
@ -179,34 +200,52 @@ function Highlight:GetOptions()
name = L["Highlight"], name = L["Highlight"],
order = 2, order = 2,
}, },
highlightBorderSize = { highlightInset = Gladdy:option({
type = "toggle",
name = L["Show Inside"],
desc = L["Show Highlight border inside of frame"],
order = 3,
}),
highlightBorderSize = Gladdy:option({
type = "range", type = "range",
name = L["Border size"], name = L["Border size"],
desc = L["Border size"], desc = L["Border size"],
order = 3, order = 4,
min = 1, min = 1,
max = 10, max = 20,
step = 1, step = 1,
}),
highlightBorderStyle = Gladdy:option({
type = "select",
name = L["Border style"],
order = 5,
dialogControl = "LSM30_Border",
values = AceGUIWidgetLSMlists.border,
}),
headerColor = {
type = "header",
name = L["Colors"],
order = 6,
}, },
targetBorderColor = Gladdy:colorOption({ targetBorderColor = Gladdy:colorOption({
type = "color", type = "color",
name = L["Target border color"], name = L["Target border color"],
desc = L["Color of the selected targets border"], desc = L["Color of the selected targets border"],
order = 4, order = 7,
hasAlpha = true, hasAlpha = true,
}), }),
focusBorderColor = Gladdy:colorOption({ focusBorderColor = Gladdy:colorOption({
type = "color", type = "color",
name = L["Focus border color"], name = L["Focus border color"],
desc = L["Color of the focus border"], desc = L["Color of the focus border"],
order = 5, order = 8,
hasAlpha = true, hasAlpha = true,
}), }),
leaderBorderColor = Gladdy:colorOption({ leaderBorderColor = Gladdy:colorOption({
type = "color", type = "color",
name = L["Raid leader border color"], name = L["Raid leader border color"],
desc = L["Color of the raid leader border"], desc = L["Color of the raid leader border"],
order = 6, order = 9,
hasAlpha = true, hasAlpha = true,
}), }),
headerEnable = { headerEnable = {

View File

@ -1,12 +1,12 @@
local string_gsub, floor, pairs = string.gsub, math.floor, pairs local string_gsub, floor, pairs = string.gsub, math.floor, pairs
local CreateFrame = CreateFrame local CreateFrame, SetPortraitTexture = CreateFrame, SetPortraitTexture
local UnitHealthMax, UnitHealth, UnitGUID = UnitHealthMax, UnitHealth, UnitGUID local UnitHealthMax, UnitHealth, UnitGUID = UnitHealthMax, UnitHealth, UnitGUID
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
local Pets = Gladdy:NewModule("Pets", nil, { local Pets = Gladdy:NewModule("Pets", nil, {
petEnabled = true, petEnabled = true,
petWidth = 100, petWidth = 128,
petHeight = 20, petHeight = 20,
petPortraitEnabled = true, petPortraitEnabled = true,
petPortraitBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp", petPortraitBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
@ -21,8 +21,8 @@ local Pets = Gladdy:NewModule("Pets", nil, {
petHealthBarFontColor = { r = 1, g = 1, b = 1, a = 1 }, petHealthBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
petHealthBarFontSize = 12, petHealthBarFontSize = 12,
petHealthPercentage = true, petHealthPercentage = true,
petXOffset = 50, petXOffset = 1,
petYOffset = 0, petYOffset = -62,
}) })
function Pets:Initialize() function Pets:Initialize()
@ -124,6 +124,7 @@ function Pets:Test(unitId)
petFrame.healthBar.hp:SetMinMaxValues(0, 6200) petFrame.healthBar.hp:SetMinMaxValues(0, 6200)
petFrame.healthBar.hp:SetValue(2000) petFrame.healthBar.hp:SetValue(2000)
Pets:SetHealthText(petFrame.healthBar, 2000, 6200) Pets:SetHealthText(petFrame.healthBar, 2000, 6200)
SetPortraitTexture(petFrame.healthBar.portrait, "player")
end end
end end
@ -374,7 +375,7 @@ function Pets:GetOptions()
desc = L["Width of the bar"], desc = L["Width of the bar"],
order = 4, order = 4,
min = 10, min = 10,
max = 100, max = 300,
step = 1, step = 1,
}), }),
petHealthBarTexture = option({ petHealthBarTexture = option({
@ -500,20 +501,25 @@ function Pets:GetOptions()
name = L["Position"], name = L["Position"],
order = 5, order = 5,
args = { args = {
header = {
type = "header",
name = L["Position"],
order = 1,
},
petXOffset = Gladdy:option({ petXOffset = Gladdy:option({
type = "range", type = "range",
name = L["Horizontal offset"], name = L["Horizontal offset"],
order = 22, order = 22,
min = -400, min = -600,
max = 400, max = 600,
step = 0.1, step = 0.1,
}), }),
petYOffset = Gladdy:option({ petYOffset = Gladdy:option({
type = "range", type = "range",
name = L["Vertical offset"], name = L["Vertical offset"],
order = 23, order = 23,
min = -400, min = -600,
max = 400, max = 600,
step = 0.1, step = 0.1,
}), }),
} }

View File

@ -16,6 +16,8 @@ local Powerbar = Gladdy:NewModule("Powerbar", 90, {
powerBarFontColor = { r = 1, g = 1, b = 1, a = 1 }, powerBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
powerBarBgColor = { r = 0.3, g = 0.3, b = 0.3, a = 0.7 }, powerBarBgColor = { r = 0.3, g = 0.3, b = 0.3, a = 0.7 },
powerBarFontSize = 10, powerBarFontSize = 10,
powerShowSpec = true,
powerShowRace = true,
powerActual = true, powerActual = true,
powerMax = true, powerMax = true,
powerPercentage = false, powerPercentage = false,
@ -27,12 +29,14 @@ function Powerbar:Initialize()
self:RegisterMessage("ENEMY_SPOTTED") self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("UNIT_SPEC") self:RegisterMessage("UNIT_SPEC")
self:RegisterMessage("UNIT_DEATH") self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("UNIT_DESTROYED")
end end
function Powerbar:CreateFrame(unit) function Powerbar:CreateFrame(unit)
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
local powerBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate") local powerBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate")
powerBar:EnableMouse(false)
powerBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.powerBarBorderStyle), powerBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.powerBarBorderStyle),
edgeSize = Gladdy.db.powerBarBorderSize }) edgeSize = Gladdy.db.powerBarBorderSize })
powerBar:SetBackdropBorderColor(Gladdy.db.powerBarBorderColor.r, Gladdy.db.powerBarBorderColor.g, Gladdy.db.powerBarBorderColor.b, Gladdy.db.powerBarBorderColor.a) powerBar:SetBackdropBorderColor(Gladdy.db.powerBarBorderColor.r, Gladdy.db.powerBarBorderColor.g, Gladdy.db.powerBarBorderColor.b, Gladdy.db.powerBarBorderColor.a)
@ -185,9 +189,9 @@ function Powerbar:ENEMY_SPOTTED(unit)
return return
end end
local raceText = button.raceLoc local raceText = Gladdy.db.powerShowRace and button.raceLoc or ""
if (button.spec) then if (button.spec and Gladdy.db.powerShowSpec) then
raceText = button.spec .. " " .. raceText raceText = button.spec .. " " .. raceText
end end
@ -203,8 +207,13 @@ function Powerbar:UNIT_SPEC(unit, spec)
if (not powerBar or not button) then if (not powerBar or not button) then
return return
end end
local raceText = Gladdy.db.powerShowRace and button.raceLoc or ""
powerBar.raceText:SetText(spec .. " " .. button.raceLoc) if (button.spec and Gladdy.db.powerShowSpec) then
raceText = spec .. " " .. raceText
end
powerBar.raceText:SetText(raceText)
end end
function Powerbar:UNIT_POWER(unit, power, powerMax, powerType) function Powerbar:UNIT_POWER(unit, power, powerMax, powerType)
@ -263,6 +272,15 @@ function Powerbar:UNIT_DEATH(unit)
powerBar.powerText:SetText("0%") powerBar.powerText:SetText("0%")
end end
function Powerbar:UNIT_DESTROYED(unit)
local powerBar = self.frames[unit]
if (not powerBar) then
return
end
powerBar.energy:SetValue(0)
powerBar.powerText:SetText("0%")
end
local function option(params) local function option(params)
local defaults = { local defaults = {
get = function(info) get = function(info)
@ -272,10 +290,13 @@ local function option(params)
set = function(info, value) set = function(info, value)
local key = info.arg or info[#info] local key = info.arg or info[#info]
Gladdy.dbi.profile[key] = value Gladdy.dbi.profile[key] = value
Gladdy.options.args.Powerbar.args.group.args.border.arg.powerBarBorderSize.max = Gladdy.db.powerBarHeight/2 Gladdy.options.args.Powerbar.args.group.args.border.args.powerBarBorderSize.max = Gladdy.db.powerBarHeight/2
if Gladdy.db.powerBarBorderSize > Gladdy.db.powerBarHeight/2 then if Gladdy.db.powerBarBorderSize > Gladdy.db.powerBarHeight/2 then
Gladdy.db.powerBarBorderSize = Gladdy.db.powerBarHeight/2 Gladdy.db.powerBarBorderSize = Gladdy.db.powerBarHeight/2
end end
for i=1,Gladdy.curBracket do
Powerbar:Test("arena" .. i)
end
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
} }
@ -366,6 +387,7 @@ function Powerbar:GetOptions()
name = L["Font size"], name = L["Font size"],
desc = L["Size of the text"], desc = L["Size of the text"],
order = 13, order = 13,
step = 0.1,
min = 1, min = 1,
max = 20, max = 20,
}), }),
@ -408,14 +430,26 @@ function Powerbar:GetOptions()
}, },
powerValues = { powerValues = {
type = "group", type = "group",
name = L["Power Values"], name = L["Power Bar Text"],
order = 4, order = 4,
args = { args = {
header = { header = {
type = "header", type = "header",
name = L["Power Values"], name = L["Power Texts"],
order = 1, order = 1,
}, },
powerShowRace = option({
type = "toggle",
name = L["Show race"],
desc = L["Show race"],
order = 2,
}),
powerShowSpec= option({
type = "toggle",
name = L["Show spec"],
desc = L["Show spec"],
order = 3,
}),
powerActual = option({ powerActual = option({
type = "toggle", type = "toggle",
name = L["Show the actual power"], name = L["Show the actual power"],

394
Modules/Racial.lua Normal file
View File

@ -0,0 +1,394 @@
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
local CreateFrame = CreateFrame
local GetTime = GetTime
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local Racial = Gladdy:NewModule("Racial", nil, {
racialFont = "DorisPP",
racialFontScale = 1,
racialEnabled = true,
racialSize = 60 + 20 + 1,
racialWidthFactor = 0.9,
racialAnchor = "trinket",
racialPos = "RIGHT",
racialXOffset = 0,
racialYOffset = 0,
racialBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
racialBorderColor = { r = 0, g = 0, b = 0, a = 1 },
racialDisableCircle = false,
racialCooldownAlpha = 1,
})
local ANCHORS = { ["LEFT"] = "RIGHT", ["RIGHT"] = "LEFT", ["BOTTOM"] = "TOP", ["TOP"] = "BOTTOM"}
function Racial:Initialize()
self.frames = {}
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("RACIAL_USED")
end
local function iconTimer(self,elapsed)
if (self.active) then
if (self.timeLeft <= 0) then
self.active = false
self.cooldown:Clear()
else
self.timeLeft = self.timeLeft - elapsed
end
local timeLeft = ceil(self.timeLeft)
if timeLeft >= 60 then
-- more than 1 minute
self.cooldownFont:SetTextColor(1, 1, 0)
self.cooldownFont:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 0.15* self:GetWidth()) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft >= 21 then
-- between 60s and 21s (green)
self.cooldownFont:SetTextColor(0.7, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 20.9 and timeLeft >= 11 then
-- between 20s and 11s (green)
self.cooldownFont:SetTextColor(0, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft <= 10 and timeLeft >= 5 then
-- between 10s and 5s (orange)
self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 5 and timeLeft > 0 then
-- between 5s and 1s (red)
self.cooldownFont:SetTextColor(1, 0, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft >= 0.0 and timeLeft or 0.0)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
else
self.cooldownFont:SetText("")
end
end
end
function Racial:CreateFrame(unit)
local racial = CreateFrame("Button", "GladdyTrinketButton" .. unit, Gladdy.buttons[unit])
racial:EnableMouse(false)
racial.texture = racial:CreateTexture(nil, "BACKGROUND")
racial.texture:SetAllPoints(racial)
racial.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
--racial.texture:SetTexture("Interface\\Icons\\INV_Jewelry_TrinketPVP_02")
racial.cooldown = CreateFrame("Cooldown", nil, racial, "CooldownFrameTemplate")
racial.cooldown.noCooldownCount = true --Gladdy.db.racialDisableOmniCC
racial.cooldown:SetHideCountdownNumbers(true)
racial.cooldownFrame = CreateFrame("Frame", nil, racial)
racial.cooldownFrame:ClearAllPoints()
racial.cooldownFrame:SetPoint("TOPLEFT", racial, "TOPLEFT")
racial.cooldownFrame:SetPoint("BOTTOMRIGHT", racial, "BOTTOMRIGHT")
racial.cooldownFont = racial.cooldownFrame:CreateFontString(nil, "OVERLAY")
racial.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), 20, "OUTLINE")
--trinket.cooldownFont:SetAllPoints(trinket.cooldown)
racial.cooldownFont:SetJustifyH("CENTER")
racial.cooldownFont:SetPoint("CENTER")
racial.borderFrame = CreateFrame("Frame", nil, racial)
racial.borderFrame:SetAllPoints(racial)
racial.texture.overlay = racial.borderFrame:CreateTexture(nil, "OVERLAY")
racial.texture.overlay:SetAllPoints(racial)
racial.texture.overlay:SetTexture(Gladdy.db.racialBorderStyle)
racial:SetScript("OnUpdate", iconTimer)
Gladdy.buttons[unit].racial = racial
self.frames[unit] = racial
end
function Racial:UpdateFrame(unit)
local racial = self.frames[unit]
if (not racial) then
return
end
local width, height = Gladdy.db.racialSize * Gladdy.db.racialWidthFactor, Gladdy.db.racialSize
racial:SetWidth(width)
racial:SetHeight(height)
racial.cooldown:SetWidth(width - width/16)
racial.cooldown:SetHeight(height - height/16)
racial.cooldown:ClearAllPoints()
racial.cooldown:SetPoint("CENTER", racial, "CENTER")
racial.cooldown.noCooldownCount = true -- Gladdy.db.racialDisableOmniCC
racial.cooldown:SetAlpha(Gladdy.db.racialCooldownAlpha)
racial.texture:ClearAllPoints()
racial.texture:SetAllPoints(racial)
racial.texture.overlay:SetTexture(Gladdy.db.racialBorderStyle)
racial.texture.overlay:SetVertexColor(Gladdy.db.racialBorderColor.r, Gladdy.db.racialBorderColor.g, Gladdy.db.racialBorderColor.b, Gladdy.db.racialBorderColor.a)
racial:ClearAllPoints()
local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local parent = Gladdy.buttons[unit][Gladdy.db.racialAnchor]
if (Gladdy.db.racialPos == "RIGHT") then
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset)
elseif (Gladdy.db.racialPos == "LEFT") then
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, -Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset)
elseif (Gladdy.db.racialPos == "TOP") then
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.racialXOffset, Gladdy.db.padding + Gladdy.db.racialYOffset)
elseif (Gladdy.db.racialPos == "BOTTOM") then
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.racialXOffset, -Gladdy.db.padding + Gladdy.db.racialYOffset)
end
if (Gladdy.db.racialEnabled == false) then
racial:Hide()
else
racial:Show()
end
end
function Racial:JOINED_ARENA()
self:RegisterEvent("ARENA_COOLDOWNS_UPDATE")
self:SetScript("OnEvent", function(self, event, ...)
if self[event] then
self[event](self, ...)
end
end)
end
function Racial:RACIAL_USED(unit)
local racial = self.frames[unit]
local button = Gladdy.buttons[unit]
if (not racial or not button or not button.race) then
return
end
Racial:Used(unit, GetTime(), Gladdy:Racials()[button.race].duration)
end
function Racial:Used(unit, startTime, duration)
local racial = self.frames[unit]
if (not racial) then
return
end
if not racial.active then
racial.timeLeft = duration
if not Gladdy.db.trinketDisableCircle then racial.cooldown:SetCooldown(startTime, duration) end
racial.active = true
end
end
function Racial:ENEMY_SPOTTED(unit)
local racial = self.frames[unit]
if (not racial) then
return
end
racial.texture:SetTexture(Gladdy:Racials()[Gladdy.buttons[unit].race].texture)
end
function Racial:ResetUnit(unit)
local racial = self.frames[unit]
if (not racial) then
return
end
racial.texture:SetTexture(nil)
racial.timeLeft = nil
racial.active = false
racial.cooldown:Clear()
racial.cooldownFont:SetText("")
end
function Racial:Test(unit)
Racial:ENEMY_SPOTTED(unit)
if (unit == "arena1" or unit == "arena3") then
Racial:Used(unit, GetTime(), Gladdy:Racials()[Gladdy.buttons[unit].race].duration)
end
end
function Racial:GetOptions()
return {
headerTrinket = {
type = "header",
name = L["Racial"],
order = 2,
},
racialEnabled = Gladdy:option({
type = "toggle",
name = L["Enabled"],
desc = L["Enable racial icon"],
order = 3,
}),
group = {
type = "group",
childGroups = "tree",
name = "Frame",
order = 4,
args = {
general = {
type = "group",
name = L["Size"],
order = 1,
args = {
header = {
type = "header",
name = L["Size"],
order = 1,
},
racialSize = Gladdy:option({
type = "range",
name = L["Icon size"],
min = 5,
max = 100,
step = 1,
order = 2,
}),
racialWidthFactor = Gladdy:option({
type = "range",
name = L["Icon width factor"],
min = 0.5,
max = 2,
step = 0.05,
order = 3,
}),
},
},
cooldown = {
type = "group",
name = L["Cooldown"],
order = 2,
args = {
header = {
type = "header",
name = L["Cooldown"],
order = 4,
},
racialDisableCircle = Gladdy:option({
type = "toggle",
name = L["No Cooldown Circle"],
order = 7,
}),
racialCooldownAlpha = Gladdy:option({
type = "range",
name = L["Cooldown circle alpha"],
min = 0,
max = 1,
step = 0.1,
order = 8,
}),
},
},
font = {
type = "group",
name = L["Font"],
order = 3,
args = {
header = {
type = "header",
name = L["Font"],
order = 4,
},
racialFont = Gladdy:option({
type = "select",
name = L["Font"],
desc = L["Font of the cooldown"],
order = 11,
dialogControl = "LSM30_Font",
values = AceGUIWidgetLSMlists.font,
}),
racialFontScale = Gladdy:option({
type = "range",
name = L["Font scale"],
desc = L["Scale of the font"],
order = 12,
min = 0.1,
max = 2,
step = 0.1,
}),
},
},
position = {
type = "group",
name = L["Position"],
order = 4,
args = {
header = {
type = "header",
name = L["Position"],
order = 4,
},
racialAnchor = Gladdy:option({
type = "select",
name = L["Anchor"],
desc = L["This changes the anchor of the racial icon"],
order = 20,
values = {
["trinket"] = L["Trinket"],
["classIcon"] = L["Class Icon"],
["healthBar"] = L["Health Bar"],
["powerBar"] = L["Power Bar"],
},
}),
racialPos = Gladdy:option({
type = "select",
name = L["Position"],
desc = L["This changes position relative to its anchor of the racial icon"],
order = 21,
values = {
["LEFT"] = L["Left"],
["RIGHT"] = L["Right"],
["TOP"] = L["Top"],
["BOTTOM"] = L["Bottom"],
},
}),
racialXOffset = Gladdy:option({
type = "range",
name = L["Horizontal offset"],
order = 23,
min = -400,
max = 400,
step = 0.1,
}),
racialYOffset = Gladdy:option({
type = "range",
name = L["Vertical offset"],
order = 24,
min = -400,
max = 400,
step = 0.1,
}),
},
},
border = {
type = "group",
name = L["Border"],
order = 4,
args = {
header = {
type = "header",
name = L["Border"],
order = 4,
},
racialBorderStyle = Gladdy:option({
type = "select",
name = L["Border style"],
order = 31,
values = Gladdy:GetIconStyles()
}),
racialBorderColor = Gladdy:colorOption({
type = "color",
name = L["Border color"],
desc = L["Color of the border"],
order = 32,
hasAlpha = true,
}),
},
},
},
},
}
end

View File

@ -1,5 +1,5 @@
local select, pairs, string_lower, tremove, tinsert, format, string_gsub, ipairs = select, pairs, string.lower, tremove, tinsert, format, string.gsub, ipairs local select, pairs, string_lower, tremove, tinsert, format, string_gsub, ipairs = select, pairs, string.lower, tremove, tinsert, format, string.gsub, ipairs
local UnitExists, UnitIsUnit, UnitName = UnitExists, UnitIsUnit, UnitName local UnitExists, UnitIsUnit, UnitName, UnitIsEnemy = UnitExists, UnitIsUnit, UnitName, UnitIsEnemy
local C_NamePlate = C_NamePlate local C_NamePlate = C_NamePlate
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
@ -26,7 +26,7 @@ local totemData = {
[string_lower("Disease Cleansing Totem")] = {id = 8170,texture = select(3, GetSpellInfo(8170)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Disease Cleansing Totem [string_lower("Disease Cleansing Totem")] = {id = 8170,texture = select(3, GetSpellInfo(8170)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Disease Cleansing Totem
[string_lower("Healing Stream Totem")] = {id = 5394,texture = select(3, GetSpellInfo(5394)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Healing Stream Totem [string_lower("Healing Stream Totem")] = {id = 5394,texture = select(3, GetSpellInfo(5394)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Healing Stream Totem
[string_lower("Mana Tide Totem")] = {id = 16190,texture = select(3, GetSpellInfo(16190)), color = {r = 0.078, g = 0.9, b = 0.16, a = 1}, enabled = true, priority = 3}, -- Mana Tide Totem [string_lower("Mana Tide Totem")] = {id = 16190,texture = select(3, GetSpellInfo(16190)), color = {r = 0.078, g = 0.9, b = 0.16, a = 1}, enabled = true, priority = 3}, -- Mana Tide Totem
[string_lower("Mana Spring Totem")] = {id = 5675,texture = "Interface\\AddOns\\Gladdy\\Images\\Totems\\Spell_Nature_ManaRegenTotem_edit", color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 1}, -- Mana Spring Totem [string_lower("Mana Spring Totem")] = {id = 5675,texture = select(3, GetSpellInfo(5675)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 1}, -- Mana Spring Totem
-- Earth -- Earth
[string_lower("Earthbind Totem")] = {id = 2484,texture = select(3, GetSpellInfo(2484)), color = {r = 0.5, g = 0.5, b = 0.5, a = 1}, enabled = true, priority = 1}, -- Earthbind Totem [string_lower("Earthbind Totem")] = {id = 2484,texture = select(3, GetSpellInfo(2484)), color = {r = 0.5, g = 0.5, b = 0.5, a = 1}, enabled = true, priority = 1}, -- Earthbind Totem
[string_lower("Stoneclaw Totem")] = {id = 5730,texture = select(3, GetSpellInfo(5730)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Stoneclaw Totem [string_lower("Stoneclaw Totem")] = {id = 5730,texture = select(3, GetSpellInfo(5730)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Stoneclaw Totem
@ -36,13 +36,13 @@ local totemData = {
[string_lower("Tremor Totem")] = {id = 8143,texture = select(3, GetSpellInfo(8143)), color = {r = 1, g = 0.9, b = 0.1, a = 1}, enabled = true, priority = 3}, -- Tremor Totem [string_lower("Tremor Totem")] = {id = 8143,texture = select(3, GetSpellInfo(8143)), color = {r = 1, g = 0.9, b = 0.1, a = 1}, enabled = true, priority = 3}, -- Tremor Totem
-- Air -- Air
[string_lower("Grounding Totem")] = {id = 8177,texture = select(3, GetSpellInfo(8177)), color = {r = 0, g = 0.53, b = 0.92, a = 1}, enabled = true, priority = 3}, -- Grounding Totem [string_lower("Grounding Totem")] = {id = 8177,texture = select(3, GetSpellInfo(8177)), color = {r = 0, g = 0.53, b = 0.92, a = 1}, enabled = true, priority = 3}, -- Grounding Totem
[string_lower("Grace of Air Totem")] = {id = 8835,texture = "Interface\\AddOns\\Gladdy\\Images\\Totems\\Spell_Nature_InvisibilityTotem_edit", color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Grace of Air Totem [string_lower("Grace of Air Totem")] = {id = 8835,texture = select(3, GetSpellInfo(8835)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Grace of Air Totem
[string_lower("Nature Resistance Totem")] = {id = 10595,texture = select(3, GetSpellInfo(10595)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Nature Resistance Totem [string_lower("Nature Resistance Totem")] = {id = 10595,texture = select(3, GetSpellInfo(10595)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Nature Resistance Totem
[string_lower("Windfury Totem")] = {id = 8512,texture = "Interface\\AddOns\\Gladdy\\Images\\Totems\\Spell_Nature_Windfury_edit", color = {r = 0.96, g = 0, b = 0.07, a = 1}, enabled = true, priority = 2}, -- Windfury Totem [string_lower("Windfury Totem")] = {id = 8512,texture = select(3, GetSpellInfo(8512)), color = {r = 0.96, g = 0, b = 0.07, a = 1}, enabled = true, priority = 2}, -- Windfury Totem
[string_lower("Sentry Totem")] = {id = 6495, texture = "Interface\\AddOns\\Gladdy\\Images\\Totems\\Spell_Nature_RemoveCurse_edit", color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Sentry Totem [string_lower("Sentry Totem")] = {id = 6495, texture = select(3, GetSpellInfo(6495)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Sentry Totem
[string_lower("Windwall Totem")] = {id = 15107,texture = select(3, GetSpellInfo(15107)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Windwall Totem [string_lower("Windwall Totem")] = {id = 15107,texture = select(3, GetSpellInfo(15107)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Windwall Totem
[string_lower("Wrath of Air Totem")] = {id = 3738,texture = "Interface\\AddOns\\Gladdy\\Images\\Totems\\Spell_Nature_SlowingTotem_edit", color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Wrath of Air Totem [string_lower("Wrath of Air Totem")] = {id = 3738,texture = select(3, GetSpellInfo(3738)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Wrath of Air Totem
[string_lower("Tranquil Air Totem")] = {id = 25908,texture = "Interface\\Icons\\INV_Staff_07", color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Tranquil Air Totem [string_lower("Tranquil Air Totem")] = {id = 25908,texture = select(3, GetSpellInfo(25908)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Tranquil Air Totem
} }
local localizedTotemData = { local localizedTotemData = {
["default"] = { ["default"] = {
@ -77,38 +77,6 @@ local localizedTotemData = {
[string_lower(select(1, GetSpellInfo(3738)))] = totemData[string_lower("Wrath of Air Totem")], -- Wrath of Air Totem [string_lower(select(1, GetSpellInfo(3738)))] = totemData[string_lower("Wrath of Air Totem")], -- Wrath of Air Totem
[string_lower(select(1, GetSpellInfo(25908)))] = totemData[string_lower("Tranquil Air Totem")], -- Tranquil Air Totem [string_lower(select(1, GetSpellInfo(25908)))] = totemData[string_lower("Tranquil Air Totem")], -- Tranquil Air Totem
}, },
["frFR"] = {
[string_lower("Totem incendiaire")] = totemData[string_lower("Searing Totem")],
[string_lower("Totem Langue de feu")] = totemData[string_lower("Flametongue Totem")],
[string_lower("Totem de lien terrestre")] = totemData[string_lower("Earthbind Totem")],
[string_lower("Totem de Griffes de pierre")] = totemData[string_lower("Stoneclaw Totem")],
[string_lower("Totem Nova de feu")] = totemData[string_lower("Fire Nova Totem")],
[string_lower("Totem de Magma")] = totemData[string_lower("Magma Totem")],
[string_lower("Totem de courroux")] = totemData[string_lower("Totem of Wrath")],
[string_lower("Totem d'\195\169lementaire de feu")] = totemData[string_lower("Fire Elemental Totem")],
[string_lower("Totem d'\195\169l\195\169mentaire de feu")] = totemData[string_lower("Fire Elemental Totem")],
[string_lower("Totem de Peau de pierre")] = totemData[string_lower("Stoneskin Totem")],
[string_lower("Totem d'\195\169lementaire de terre")] = totemData[string_lower("Earth Elemental Totem")],
[string_lower("Totem d'\195\169l\195\169mentaire de terre")] = totemData[string_lower("Earth Elemental Totem")],
[string_lower("Totem de Force de la Terre")] = totemData[string_lower("Strength of Earth Totem")],
[string_lower("Totem de r\195\169sistance au Givre")] = totemData[string_lower("Frost Resistance Totem")],
[string_lower("Totem de r\195\169sistance au Feu")] = totemData[string_lower("Fire Resistance Totem")],
[string_lower("Totem de Gl\195\168be")] = totemData[string_lower("Grounding Totem")],
[string_lower("Totem de Gr\195\162ce a\195\169rienne")] = totemData[string_lower("Grace of Air Totem")],
[string_lower("Totem de R\195\169sistance \195\160 la Nature")] = totemData[string_lower("Nature Resistance Totem")],
[string_lower("Totem Furie-des-vents")] = totemData[string_lower("Windfury Totem")],
[string_lower("Totem Sentinelle")] = totemData[string_lower("Sentry Totem")],
[string_lower("Totem de Mur des vents")] = totemData[string_lower("Windwall Totem")],
[string_lower("Totem de courroux de l'air")] = totemData[string_lower("Wrath of Air Totem")],
[string_lower("Totem de S\195\169isme")] = totemData[string_lower("Tremor Totem")],
[string_lower("Totem gu\195\169risseur")] = totemData[string_lower("Healing Stream Totem")],
[string_lower("Totem de Purification du poison")] = totemData[string_lower("Poison Cleansing Totem")],
[string_lower("Totem Fontaine de mana")] = totemData[string_lower("Mana Spring Totem")],
[string_lower("Totem de Purification des maladies")] = totemData[string_lower("Disease Cleansing Totem")],
[string_lower("Totem de purification")] = totemData[string_lower("Disease Cleansing Totem")],
[string_lower("Totem de Vague de mana")] = totemData[string_lower("Mana Tide Totem")],
[string_lower("Totem de Tranquillit\195\169 de l'air")] = totemData[string_lower("Tranquil Air Totem")],
}
} }
local function GetTotemColorDefaultOptions() local function GetTotemColorDefaultOptions()
@ -222,6 +190,8 @@ end
local TotemPlates = Gladdy:NewModule("TotemPlates", nil, { local TotemPlates = Gladdy:NewModule("TotemPlates", nil, {
npTotems = true, npTotems = true,
npTotemsShowFriendly = true,
npTotemsShowEnemy = true,
npTotemPlatesBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp", npTotemPlatesBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
npTotemPlatesSize = 40, npTotemPlatesSize = 40,
npTotemPlatesWidthFactor = 1, npTotemPlatesWidthFactor = 1,
@ -303,6 +273,13 @@ end
function TotemPlates:NAME_PLATE_UNIT_ADDED(...) function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
local unitID = ... local unitID = ...
local isEnemy = UnitIsEnemy("player", unitID)
if not Gladdy.db.npTotemsShowEnemy and isEnemy then
return
end
if not Gladdy.db.npTotemsShowFriendly and not isEnemy then
return
end
local nameplateName = UnitName(unitID) local nameplateName = UnitName(unitID)
local totemName = string_gsub(nameplateName, "^%s+", "") --trim local totemName = string_gsub(nameplateName, "^%s+", "") --trim
totemName = string_gsub(totemName, "%s+$", "") --trim totemName = string_gsub(totemName, "%s+$", "") --trim
@ -320,6 +297,7 @@ function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
nameplate.gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor) nameplate.gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
nameplate.gladdyTotemFrame:SetHeight(Gladdy.db.npTotemPlatesSize) nameplate.gladdyTotemFrame:SetHeight(Gladdy.db.npTotemPlatesSize)
nameplate.gladdyTotemFrame.totemIcon = nameplate.gladdyTotemFrame:CreateTexture(nil, "BACKGROUND") nameplate.gladdyTotemFrame.totemIcon = nameplate.gladdyTotemFrame:CreateTexture(nil, "BACKGROUND")
nameplate.gladdyTotemFrame.totemIcon:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
nameplate.gladdyTotemFrame.totemIcon:ClearAllPoints() nameplate.gladdyTotemFrame.totemIcon:ClearAllPoints()
nameplate.gladdyTotemFrame.totemIcon:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT") nameplate.gladdyTotemFrame.totemIcon:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT")
nameplate.gladdyTotemFrame.totemIcon:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT") nameplate.gladdyTotemFrame.totemIcon:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT")
@ -414,6 +392,21 @@ function TotemPlates:GetOptions()
name = L["Totem icons on/off"], name = L["Totem icons on/off"],
desc = L["Turns totem icons instead of nameplates on or off. (Requires reload)"], desc = L["Turns totem icons instead of nameplates on or off. (Requires reload)"],
order = 3, order = 3,
width = 0.9,
}),
npTotemsShowFriendly = Gladdy:option({
type = "toggle",
name = L["Show friendly"],
desc = L["Turns totem icons instead of nameplates on or off. (Requires reload)"],
order = 4,
width = 0.65,
}),
npTotemsShowEnemy = Gladdy:option({
type = "toggle",
name = L["Show enemy"],
desc = L["Turns totem icons instead of nameplates on or off. (Requires reload)"],
order = 5,
width = 0.6,
}), }),
group = { group = {
type = "group", type = "group",
@ -458,7 +451,7 @@ function TotemPlates:GetOptions()
args = { args = {
header = { header = {
type = "header", type = "header",
name = L["Icon"], name = L["Font"],
order = 1, order = 1,
}, },
npTremorFont = Gladdy:option({ npTremorFont = Gladdy:option({

View File

@ -1,4 +1,5 @@
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
local C_PvP = C_PvP
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local GetTime = GetTime local GetTime = GetTime
@ -25,11 +26,56 @@ function Trinket:Initialize()
self:RegisterMessage("JOINED_ARENA") self:RegisterMessage("JOINED_ARENA")
end end
local function iconTimer(self, elapsed)
if (self.active) then
if (self.timeLeft <= 0) then
self.active = false
self.cooldown:Clear()
Gladdy:SendMessage("TRINKET_READY", self.unit)
else
self.timeLeft = self.timeLeft - elapsed
end
local timeLeft = ceil(self.timeLeft)
if timeLeft >= 60 then
-- more than 1 minute
self.cooldownFont:SetTextColor(1, 1, 0)
self.cooldownFont:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 0.15*self:GetWidth()) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft >= 21 then
-- between 60s and 21s (green)
self.cooldownFont:SetTextColor(0.7, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 20.9 and timeLeft >= 11 then
-- between 20s and 11s (green)
self.cooldownFont:SetTextColor(0, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft <= 10 and timeLeft >= 5 then
-- between 10s and 5s (orange)
self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 5 and timeLeft > 0 then
-- between 5s and 1s (red)
self.cooldownFont:SetTextColor(1, 0, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft >= 0.0 and timeLeft or 0.0)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
else
self.cooldownFont:SetText("")
end
end
end
function Trinket:CreateFrame(unit) function Trinket:CreateFrame(unit)
local trinket = CreateFrame("Button", "GladdyTrinketButton" .. unit, Gladdy.buttons[unit]) local trinket = CreateFrame("Button", "GladdyTrinketButton" .. unit, Gladdy.buttons[unit])
trinket:EnableMouse(false)
trinket.texture = trinket:CreateTexture(nil, "BACKGROUND") trinket.texture = trinket:CreateTexture(nil, "BACKGROUND")
trinket.texture:SetAllPoints(trinket) trinket.texture:SetAllPoints(trinket)
trinket.texture:SetTexture("Interface\\Icons\\INV_Jewelry_TrinketPVP_02") trinket.texture:SetTexture("Interface\\Icons\\INV_Jewelry_TrinketPVP_02")
trinket.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
trinket.cooldown = CreateFrame("Cooldown", nil, trinket, "CooldownFrameTemplate") trinket.cooldown = CreateFrame("Cooldown", nil, trinket, "CooldownFrameTemplate")
trinket.cooldown.noCooldownCount = true --Gladdy.db.trinketDisableOmniCC trinket.cooldown.noCooldownCount = true --Gladdy.db.trinketDisableOmniCC
@ -52,55 +98,12 @@ function Trinket:CreateFrame(unit)
trinket.texture.overlay:SetAllPoints(trinket) trinket.texture.overlay:SetAllPoints(trinket)
trinket.texture.overlay:SetTexture(Gladdy.db.trinketBorderStyle) trinket.texture.overlay:SetTexture(Gladdy.db.trinketBorderStyle)
local function formatTimer(num, numDecimalPlaces) trinket.unit = unit
return tonumber(string_format("%." .. (numDecimalPlaces or 0) .. "f", num))
end
trinket:SetScript("OnUpdate", function(self, elapsed) trinket:SetScript("OnUpdate", iconTimer)
if (self.active) then
if (self.timeLeft <= 0) then
self.active = false
self.cooldown:Clear()
Gladdy:SendMessage("TRINKET_READY", unit)
else
self.timeLeft = self.timeLeft - elapsed
end
local timeLeft = ceil(self.timeLeft)
local timeLeftMilliSec = formatTimer(self.timeLeft, 1)
if timeLeft >= 60 then
-- more than 1 minute
self.cooldownFont:SetTextColor(1, 1, 0)
self.cooldownFont:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (trinket:GetWidth()/2 - 0.15*trinket:GetWidth()) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft >= 21 then
-- between 60s and 21s (green)
self.cooldownFont:SetTextColor(0.7, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (trinket:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 20.9 and timeLeft >= 11 then
-- between 20s and 11s (green)
self.cooldownFont:SetTextColor(0, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (trinket:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeftMilliSec <= 10 and timeLeftMilliSec >= 5 then
-- between 10s and 5s (orange)
self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeftMilliSec)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (trinket:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeftMilliSec < 5 and timeLeftMilliSec > 0 then
-- between 5s and 1s (red)
self.cooldownFont:SetTextColor(1, 0, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeftMilliSec)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (trinket:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
else
self.cooldownFont:SetText("")
end
end
end)
self.frames[unit] = trinket self.frames[unit] = trinket
Gladdy.buttons[unit].trinket = trinket
end end
function Trinket:UpdateFrame(unit) function Trinket:UpdateFrame(unit)
@ -127,7 +130,7 @@ function Trinket:UpdateFrame(unit)
trinket.texture.overlay:SetVertexColor(Gladdy.db.trinketBorderColor.r, Gladdy.db.trinketBorderColor.g, Gladdy.db.trinketBorderColor.b, Gladdy.db.trinketBorderColor.a) trinket.texture.overlay:SetVertexColor(Gladdy.db.trinketBorderColor.r, Gladdy.db.trinketBorderColor.g, Gladdy.db.trinketBorderColor.b, Gladdy.db.trinketBorderColor.a)
trinket:ClearAllPoints() trinket:ClearAllPoints()
local margin = Gladdy.db.highlightBorderSize + Gladdy.db.padding local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
if (Gladdy.db.classIconPos == "LEFT") then if (Gladdy.db.classIconPos == "LEFT") then
if (Gladdy.db.trinketPos == "RIGHT") then if (Gladdy.db.trinketPos == "RIGHT") then
trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", margin, 0) trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", margin, 0)

View File

@ -1,3 +1,5 @@
local str_match, tonumber, tostring = string.match, tonumber, tostring
local UnitName = UnitName local UnitName = UnitName
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
@ -24,19 +26,20 @@ end
function VersionCheck:Test(unit) function VersionCheck:Test(unit)
if unit == "arena1" then if unit == "arena1" then
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived) self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
self:SendCommMessage("GladdyVCheck", Gladdy.version, "RAID", self.playerName) self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "RAID", self.playerName)
end end
end end
function VersionCheck.OnCommReceived(prefix, message, distribution, sender) function VersionCheck.OnCommReceived(prefix, message, distribution, sender)
if sender ~= VersionCheck.playerName then if sender ~= VersionCheck.playerName then
local addonVersion = Gladdy.version local addonVersion = Gladdy.version_num
if (message == addonVersion) then message = tonumber(message)
if message and message <= Gladdy.version_num then
--Gladdy:Print("Version", "\"".. addonVersion.."\"", "is up to date") --Gladdy:Print("Version", "\"".. addonVersion.."\"", "is up to date")
else else
Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"") Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"")
Gladdy:Warn("Please download the latest Gladdy version at:") Gladdy:Warn("Please download the latest Gladdy version at:")
Gladdy:Warn("https://github.com/XiconQoo/Gladdy") Gladdy:Warn("https://github.com/XiconQoo/Gladdy-TBC")
end end
end end
end end

File diff suppressed because one or more lines are too long

View File

@ -1,9 +1,10 @@
local type, pairs, tinsert, tsort = type, pairs, table.insert, table.sort local type, pairs, tinsert, tsort, tostring, str_match, tonumber = type, pairs, table.insert, table.sort, tostring, string.match, tonumber
local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS
local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local LibClassAuras = LibStub("LibClassAuras-1.0") local LibClassAuras = LibStub("LibClassAuras-1.0")
@ -15,25 +16,24 @@ Gladdy.defaults = {
x = 0, x = 0,
y = 0, y = 0,
growUp = false, growUp = false,
growDirection = "BOTTOM",
frameScale = 1, frameScale = 1,
padding = 3, padding = 1,
barWidth = 180, barWidth = 180,
bottomMargin = 10, bottomMargin = 2,
statusbarBorderOffset = 7, statusbarBorderOffset = 6,
}, },
} }
SLASH_GLADDY1 = "/gladdy" SLASH_GLADDY1 = "/gladdy"
SlashCmdList["GLADDY"] = function(msg) SlashCmdList["GLADDY"] = function(msg)
if (msg == "test2") then if (str_match(msg, "test[1-5]")) then
Gladdy:ToggleFrame(2) local _, num = str_match(msg, "(test)([1-5])")
elseif (msg == "test5") then Gladdy:ToggleFrame(tonumber(num))
Gladdy:ToggleFrame(5) elseif (msg == "test") then
elseif (msg:find("test")) then
Gladdy:ToggleFrame(3) Gladdy:ToggleFrame(3)
elseif (msg == "ui" or msg == "options" or msg == "config") then elseif (msg == "ui" or msg == "options" or msg == "config") then
LibStub("AceConfigDialog-3.0"):Open("Gladdy") LibStub("AceConfigDialog-3.0"):Open("Gladdy")
--Gladdy:ShowOptions()
elseif (msg == "reset") then elseif (msg == "reset") then
Gladdy.dbi:ResetProfile() Gladdy.dbi:ResetProfile()
elseif (msg == "hide") then elseif (msg == "hide") then
@ -42,7 +42,8 @@ SlashCmdList["GLADDY"] = function(msg)
else else
Gladdy:Print(L["Valid slash commands are:"]) Gladdy:Print(L["Valid slash commands are:"])
Gladdy:Print("/gladdy ui") Gladdy:Print("/gladdy ui")
Gladdy:Print("/gladdy test2-5") Gladdy:Print("/gladdy test")
Gladdy:Print("/gladdy test1-5")
Gladdy:Print("/gladdy hide") Gladdy:Print("/gladdy hide")
Gladdy:Print("/gladdy reset") Gladdy:Print("/gladdy reset")
end end
@ -193,10 +194,21 @@ function Gladdy:SetupOptions()
desc = L["If enabled the frame will grow upwards instead of downwards"], desc = L["If enabled the frame will grow upwards instead of downwards"],
order = 2, order = 2,
}, },
growDirection = {
type = "select",
name = L["Grow Direction"],
order = 3,
values = {
["BOTTOM"] = L["Down"],
["TOP"] = L["Up"],
["LEFT"] = L["Left"],
["RIGHT"] = L["Right"],
}
},
group = { group = {
type = "group", type = "group",
name = "General", name = "General",
order = 3, order = 4,
childGroups = "tree", childGroups = "tree",
args = { args = {
frameGeneral = { frameGeneral = {
@ -238,11 +250,11 @@ function Gladdy:SetupOptions()
}, },
bottomMargin = { bottomMargin = {
type = "range", type = "range",
name = L["Bottom margin"], name = L["Margin"],
desc = L["Margin between each button"], desc = L["Margin between each button"],
order = 7, order = 7,
min = -100, min = -200,
max = 100, max = 200,
step = 1, step = 1,
}, },
} }
@ -267,7 +279,8 @@ function Gladdy:SetupOptions()
local c = Gladdy.db.trinketDisableCircle local c = Gladdy.db.trinketDisableCircle
local d = Gladdy.db.drDisableCircle local d = Gladdy.db.drDisableCircle
local e = Gladdy.db.buffsDisableCircle local e = Gladdy.db.buffsDisableCircle
if (a == b and a == c and a == d and a == e) then local f = Gladdy.db.racialDisableCircle
if (a == b and a == c and a == d and a == e and a == f) then
return a return a
else else
return "" return ""
@ -279,6 +292,7 @@ function Gladdy:SetupOptions()
Gladdy.db.trinketDisableCircle = value Gladdy.db.trinketDisableCircle = value
Gladdy.db.drDisableCircle = value Gladdy.db.drDisableCircle = value
Gladdy.db.buffsDisableCircle = value Gladdy.db.buffsDisableCircle = value
Gladdy.db.racialDisableCircle = value
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
width= "full", width= "full",
@ -296,7 +310,8 @@ function Gladdy:SetupOptions()
local c = Gladdy.db.auraCooldownAlpha local c = Gladdy.db.auraCooldownAlpha
local d = Gladdy.db.trinketCooldownAlpha local d = Gladdy.db.trinketCooldownAlpha
local e = Gladdy.db.buffsCooldownAlpha local e = Gladdy.db.buffsCooldownAlpha
if (a == b and a == c and a == d and a == e) then local f = Gladdy.db.racialCooldownAlpha
if (a == b and a == c and a == d and a == e and a == f) then
return a return a
else else
return "" return ""
@ -308,6 +323,7 @@ function Gladdy:SetupOptions()
Gladdy.db.auraCooldownAlpha = value Gladdy.db.auraCooldownAlpha = value
Gladdy.db.trinketCooldownAlpha = value Gladdy.db.trinketCooldownAlpha = value
Gladdy.db.buffsCooldownAlpha = value Gladdy.db.buffsCooldownAlpha = value
Gladdy.db.racialCooldownAlpha = value
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end end
}, },
@ -331,33 +347,42 @@ function Gladdy:SetupOptions()
dialogControl = "LSM30_Font", dialogControl = "LSM30_Font",
values = AceGUIWidgetLSMlists.font, values = AceGUIWidgetLSMlists.font,
get = function(info) get = function(info)
local a = Gladdy.db.castBarFont local a = Gladdy.db.auraFont
local b = Gladdy.db.healthBarFont local b = Gladdy.db.buffsFont
local c = Gladdy.db.powerBarFont local c = Gladdy.db.castBarFont
local d = Gladdy.db.cooldownFont local d = Gladdy.db.cooldownFont
local e = Gladdy.db.drFont local e = Gladdy.db.drFont
local f = Gladdy.db.auraFont local f = Gladdy.db.healthBarFont
local g = Gladdy.db.buffsFont local g = Gladdy.db.petHealthBarFont
if (a == b and a == c and a == d and a == e and a == f and a == g) then local h = Gladdy.db.powerBarFont
local i = Gladdy.db.racialFont
local j = Gladdy.db.npTremorFont
local k = Gladdy.db.trinketFont
if (a == b and a == c and a == d and a == e and a == f
and a == g and a == h and a == i and a == j and a == k) then
return a return a
else else
return "" return ""
end end
end, end,
set = function(info, value) set = function(info, value)
Gladdy.db.castBarFont = value
Gladdy.db.healthBarFont = value
Gladdy.db.powerBarFont = value
Gladdy.db.cooldownFont = value
Gladdy.db.drFont = value
Gladdy.db.auraFont = value Gladdy.db.auraFont = value
Gladdy.db.buffsFont = value Gladdy.db.buffsFont = value
Gladdy.db.castBarFont = value
Gladdy.db.cooldownFont = value
Gladdy.db.drFont = value
Gladdy.db.healthBarFont = value
Gladdy.db.petHealthBarFont = value
Gladdy.db.powerBarFont = value
Gladdy.db.racialFont = value
Gladdy.db.npTremorFont = value
Gladdy.db.trinketFont = value
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
}, },
fontColor = { fontColor = {
type = "color", type = "color",
name = L["Font color"], name = L["Font color text"],
desc = L["Color of the text"], desc = L["Color of the text"],
order = 12, order = 12,
hasAlpha = true, hasAlpha = true,
@ -365,8 +390,10 @@ function Gladdy:SetupOptions()
local a = Gladdy.db.healthBarFontColor local a = Gladdy.db.healthBarFontColor
local b = Gladdy.db.powerBarFontColor local b = Gladdy.db.powerBarFontColor
local c = Gladdy.db.castBarFontColor local c = Gladdy.db.castBarFontColor
local d = Gladdy.db.petHealthBarFontColor
if (a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a if (a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a
and a.r == c.r and a.g == c.g and a.b == c.b and a.a == c.a) then and a.r == c.r and a.g == c.g and a.b == c.b and a.a == c.a
and a.r == d.r and a.g == d.g and a.b == d.b and a.a == d.a) then
return a.r, a.g, a.b, a.a return a.r, a.g, a.b, a.a
else else
return { r = 0, g = 0, b = 0, a = 0 } return { r = 0, g = 0, b = 0, a = 0 }
@ -377,6 +404,35 @@ function Gladdy:SetupOptions()
Gladdy.db.healthBarFontColor = rgb Gladdy.db.healthBarFontColor = rgb
Gladdy.db.powerBarFontColor = rgb Gladdy.db.powerBarFontColor = rgb
Gladdy.db.castBarFontColor = rgb Gladdy.db.castBarFontColor = rgb
Gladdy.db.petHealthBarFontColor = rgb
Gladdy:UpdateFrame()
end,
},
fontColorCD = {
type = "color",
name = L["Font color timer"],
desc = L["Color of the timers"],
order = 12,
hasAlpha = true,
get = function(info)
local a = Gladdy.db.auraFontColor
local b = Gladdy.db.buffsFontColor
local c = Gladdy.db.cooldownFontColor
local d = Gladdy.db.drFontColor
if (a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a
and a.r == c.r and a.g == c.g and a.b == c.b and a.a == c.a
and a.r == d.r and a.g == d.g and a.b == d.b and a.a == d.a) then
return a.r, a.g, a.b, a.a
else
return { r = 0, g = 0, b = 0, a = 0 }
end
end,
set = function(info, r, g, b, a)
local rgb = {r = r, g = g, b = b, a = a}
Gladdy.db.auraFontColor = rgb
Gladdy.db.buffsFontColor = rgb
Gladdy.db.cooldownFontColor = rgb
Gladdy.db.drFontColor = rgb
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
}, },
@ -399,27 +455,34 @@ function Gladdy:SetupOptions()
order = 14, order = 14,
values = Gladdy:GetIconStyles(), values = Gladdy:GetIconStyles(),
get = function(info) get = function(info)
if (Gladdy.db.classIconBorderStyle == Gladdy.db.trinketBorderStyle if (Gladdy.db.auraBorderStyle == Gladdy.db.buffsBorderStyle
and Gladdy.db.classIconBorderStyle == Gladdy.db.castBarIconStyle and Gladdy.db.auraBorderStyle == Gladdy.db.castBarIconStyle
and Gladdy.db.classIconBorderStyle == Gladdy.db.auraBorderStyle and Gladdy.db.auraBorderStyle == Gladdy.db.classIconBorderStyle
and Gladdy.db.classIconBorderStyle == Gladdy.db.cooldownBorderStyle and Gladdy.db.auraBorderStyle == Gladdy.db.cooldownBorderStyle
and Gladdy.db.classIconBorderStyle == Gladdy.db.buffsBorderStyle and Gladdy.db.auraBorderStyle == Gladdy.db.ciBorderStyle
and Gladdy.db.classIconBorderStyle == Gladdy.db.drBorderStyle and Gladdy.db.auraBorderStyle == Gladdy.db.cooldownBorderStyle
and Gladdy.db.classIconBorderStyle == Gladdy.db.npTotemPlatesBorderStyle) then and Gladdy.db.auraBorderStyle == Gladdy.db.drBorderStyle
return Gladdy.db.classIconBorderStyle and Gladdy.db.auraBorderStyle == Gladdy.db.racialBorderStyle
and Gladdy.db.auraBorderStyle == Gladdy.db.npTotemPlatesBorderStyle
and Gladdy.db.auraBorderStyle == Gladdy.db.petPortraitBorderStyle
and Gladdy.db.auraBorderStyle == Gladdy.db.trinketBorderStyle) then
return Gladdy.db.auraBorderStyle
else else
return "" return ""
end end
end, end,
set = function(info, value) set = function(info, value)
Gladdy.db.classIconBorderStyle = value
Gladdy.db.trinketBorderStyle = value
Gladdy.db.castBarIconStyle = value
Gladdy.db.auraBorderStyle = value Gladdy.db.auraBorderStyle = value
Gladdy.db.npTotemPlatesBorderStyle = value
Gladdy.db.cooldownBorderStyle = value
Gladdy.db.buffsBorderStyle = value Gladdy.db.buffsBorderStyle = value
Gladdy.db.castBarIconStyle = value
Gladdy.db.classIconBorderStyle = value
Gladdy.db.ciBorderStyle = value
Gladdy.db.cooldownBorderStyle = value
Gladdy.db.drBorderStyle = value Gladdy.db.drBorderStyle = value
Gladdy.db.racialBorderStyle = value
Gladdy.db.npTotemPlatesBorderStyle = value
Gladdy.db.petPortraitBorderStyle = value
Gladdy.db.trinketBorderStyle = value
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
}, },
@ -430,11 +493,25 @@ function Gladdy:SetupOptions()
order = 15, order = 15,
hasAlpha = true, hasAlpha = true,
get = function(info) get = function(info)
local a = Gladdy.db.classIconBorderColor local a = Gladdy.db.auraBuffBorderColor
local b = Gladdy.db.trinketBorderColor local b = Gladdy.db.auraDebuffBorderColor
local c = Gladdy.db.castBarIconColor local c = Gladdy.db.buffsBorderColor
local d = Gladdy.db.castBarIconColor
local e = Gladdy.db.classIconBorderColor
local f = Gladdy.db.ciBorderColor
local g = Gladdy.db.cooldownBorderColor
local h = Gladdy.db.drBorderColor
local i = Gladdy.db.trinketBorderColor
local j = Gladdy.db.racialBorderColor
if (a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a if (a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a
and a.r == c.r and a.g == c.g and a.b == c.b and a.a == c.a) then and a.r == c.r and a.g == c.g and a.b == c.b and a.a == c.a
and a.r == d.r and a.g == d.g and a.b == d.b and a.a == d.a
and a.r == e.r and a.g == e.g and a.b == e.b and a.a == e.a
and a.r == f.r and a.g == f.g and a.b == f.b and a.a == f.a
and a.r == g.r and a.g == g.g and a.b == g.b and a.a == g.a
and a.r == h.r and a.g == h.g and a.b == h.b and a.a == h.a
and a.r == i.r and a.g == i.g and a.b == i.b and a.a == i.a
and a.r == j.r and a.g == j.g and a.b == j.b and a.a == j.a) then
return a.r, a.g, a.b, a.a return a.r, a.g, a.b, a.a
else else
return { r = 0, g = 0, b = 0, a = 0 } return { r = 0, g = 0, b = 0, a = 0 }
@ -442,13 +519,16 @@ function Gladdy:SetupOptions()
end, end,
set = function(info, r, g, b, a) set = function(info, r, g, b, a)
local rgb = {r = r, g = g, b = b, a = a} local rgb = {r = r, g = g, b = b, a = a}
Gladdy.db.classIconBorderColor = rgb Gladdy.db.auraBuffBorderColor = rgb
Gladdy.db.trinketBorderColor = rgb Gladdy.db.auraDebuffBorderColor = rgb
Gladdy.db.castBarIconColor = rgb
Gladdy.db.npTotemPlatesBorderColor = rgb
Gladdy.db.drBorderColor = rgb
Gladdy.db.cooldownBorderColor = rgb
Gladdy.db.buffsBorderColor = rgb Gladdy.db.buffsBorderColor = rgb
Gladdy.db.castBarIconColor = rgb
Gladdy.db.classIconBorderColor = rgb
Gladdy.db.ciBorderColor = rgb
Gladdy.db.cooldownBorderColor = rgb
Gladdy.db.drBorderColor = rgb
Gladdy.db.trinketBorderColor = rgb
Gladdy.db.racialBorderColor = rgb
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
}, },
@ -475,7 +555,8 @@ function Gladdy:SetupOptions()
local a = Gladdy.db.healthBarTexture local a = Gladdy.db.healthBarTexture
local b = Gladdy.db.powerBarTexture local b = Gladdy.db.powerBarTexture
local c = Gladdy.db.castBarTexture local c = Gladdy.db.castBarTexture
if (a == b and a == c) then local d = Gladdy.db.petHealthBarTexture
if (a == b and a == c and a == d) then
return a return a
else else
return "" return ""
@ -485,6 +566,7 @@ function Gladdy:SetupOptions()
Gladdy.db.healthBarTexture = value Gladdy.db.healthBarTexture = value
Gladdy.db.powerBarTexture = value Gladdy.db.powerBarTexture = value
Gladdy.db.castBarTexture = value Gladdy.db.castBarTexture = value
Gladdy.db.petHealthBarTexture = value
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
width= "full", width= "full",
@ -500,7 +582,8 @@ function Gladdy:SetupOptions()
local a = Gladdy.db.healthBarBorderStyle local a = Gladdy.db.healthBarBorderStyle
local b = Gladdy.db.powerBarBorderStyle local b = Gladdy.db.powerBarBorderStyle
local c = Gladdy.db.castBarBorderStyle local c = Gladdy.db.castBarBorderStyle
if (a == b and a == c) then local d = Gladdy.db.petHealthBarBorderStyle
if (a == b and a == c and a == d) then
return a return a
else else
return "" return ""
@ -510,6 +593,7 @@ function Gladdy:SetupOptions()
Gladdy.db.healthBarBorderStyle = value Gladdy.db.healthBarBorderStyle = value
Gladdy.db.powerBarBorderStyle = value Gladdy.db.powerBarBorderStyle = value
Gladdy.db.castBarBorderStyle = value Gladdy.db.castBarBorderStyle = value
Gladdy.db.petHealthBarBorderStyle = value
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
}, },
@ -531,8 +615,10 @@ function Gladdy:SetupOptions()
local a = Gladdy.db.castBarBorderColor local a = Gladdy.db.castBarBorderColor
local b = Gladdy.db.healthBarBorderColor local b = Gladdy.db.healthBarBorderColor
local c = Gladdy.db.powerBarBorderColor local c = Gladdy.db.powerBarBorderColor
local d = Gladdy.db.petHealthBarBorderColor
if (a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a if (a.r == b.r and a.g == b.g and a.b == b.b and a.a == b.a
and a.r == c.r and a.g == c.g and a.b == c.b and a.a == c.a) then and a.r == c.r and a.g == c.g and a.b == c.b and a.a == c.a
and a.r == d.r and a.g == d.g and a.b == d.b and a.a == d.a) then
return a.r, a.g, a.b, a.a return a.r, a.g, a.b, a.a
else else
return { r = 0, g = 0, b = 0, a = 0 } return { r = 0, g = 0, b = 0, a = 0 }
@ -543,6 +629,7 @@ function Gladdy:SetupOptions()
Gladdy.db.castBarBorderColor = rgb Gladdy.db.castBarBorderColor = rgb
Gladdy.db.healthBarBorderColor = rgb Gladdy.db.healthBarBorderColor = rgb
Gladdy.db.powerBarBorderColor = rgb Gladdy.db.powerBarBorderColor = rgb
Gladdy.db.petHealthBarBorderColor = rgb
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
end, end,
}, },
@ -597,8 +684,14 @@ function Gladdy:GetAuras(auraType)
name = "Check All", name = "Check All",
type = "execute", type = "execute",
func = function(info) func = function(info)
for k,v in pairs(Gladdy.dbi.profile.trackedDebuffs) do if auraType == AURA_TYPE_DEBUFF then
Gladdy.dbi.profile.trackedDebuffs[k] = true for k,v in pairs(Gladdy.defaults.profile.trackedDebuffs) do
Gladdy.dbi.profile.trackedDebuffs[k] = true
end
else
for k,v in pairs(Gladdy.defaults.profile.trackedBuffs) do
Gladdy.dbi.profile.trackedBuffs[k] = true
end
end end
end, end,
}, },
@ -608,8 +701,14 @@ function Gladdy:GetAuras(auraType)
name = "Uncheck All", name = "Uncheck All",
type = "execute", type = "execute",
func = function(info) func = function(info)
for k,v in pairs(Gladdy.dbi.profile.trackedDebuffs) do if auraType == AURA_TYPE_DEBUFF then
Gladdy.dbi.profile.trackedDebuffs[k] = false for k,v in pairs(Gladdy.defaults.profile.trackedDebuffs) do
Gladdy.dbi.profile.trackedDebuffs[k] = false
end
else
for k,v in pairs(Gladdy.defaults.profile.trackedBuffs) do
Gladdy.dbi.profile.trackedBuffs[k] = false
end
end end
end, end,
}, },
@ -689,25 +788,24 @@ function Gladdy:GetAuras(auraType)
local defaultDebuffs = {} local defaultDebuffs = {}
local assignForClass = function(class) local assignForClass = function(class)
local args = {} local args = {}
local classSpells = auraType == "debuff" and LibClassAuras.GetClassDebuffs(class) or LibClassAuras.GetClassBuffs(class) local classSpells = auraType == AURA_TYPE_DEBUFF and LibClassAuras.GetClassDebuffs(class) or LibClassAuras.GetClassBuffs(class)
table.sort(classSpells, function(a, b) table.sort(classSpells, function(a, b)
return a.name:upper() < b.name:upper() return a.name:upper() < b.name:upper()
end) end)
for i=1, #classSpells do for i=1, #classSpells do
local spellName, _, texture = GetSpellInfo(classSpells[i].id[#classSpells[i].id]) local _, _, texture = GetSpellInfo(classSpells[i].id[#classSpells[i].id])
--spellName = (classSpells[i].id[#classSpells[i].id] == 31117 or classSpells[i].id[#classSpells[i].id] == 43523) and "Unstable Affliction Silence" or spellName
if classSpells[i].texture then if classSpells[i].texture then
texture = classSpells[i].texture texture = classSpells[i].texture
end end
args[classSpells[i].name] = { args[tostring(classSpells[i].id[1])] = {
order = i, order = i,
name = classSpells[i].name, name = classSpells[i].name,
type = "toggle", type = "toggle",
image = texture, image = texture,
width = "2", width = "full",
arg = classSpells[i].name arg = tostring(classSpells[i].id[1])
} }
defaultDebuffs[classSpells[i].name] = true defaultDebuffs[tostring(classSpells[i].id[1])] = true
end end
return args return args
end end

View File

@ -1,7 +1,7 @@
# Gladdy - TBC # Gladdy - TBC
### The most powerful arena addon for WoW TBC 2.5.1 ### The most powerful arena addon for WoW TBC 2.5.1
## [v1.0.4-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.0.4-Beta/Gladdy_TBC-Classic_v1.0.4-Beta.zip) ## [v1.08-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.08-Beta/Gladdy_TBC-Classic_v1.08-Beta.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 ###### <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
@ -17,11 +17,15 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
- Announcement (drink, trinket usage, spec detection ...) - Announcement (drink, trinket usage, spec detection ...)
- ArenaCountDown - ArenaCountDown
- Auras (show important (de)buffs in the class icon) - Auras (show important (de)buffs in the class icon)
- BuffsDebuffs (show buffs and debuffs on arena frames - can be filtered)
- ClassIcon (or specicon, once detected)
- CombatIndicator
- Cooldown (tracks important cooldowns) - Cooldown (tracks important cooldowns)
- Diminishing (tracks DRs) - Diminishing (tracks DRs)
- ExportImport (share your profile with your friends in the form of a string, which can be imported) - ExportImport (share your profile with your friends in the form of a string, which can be imported)
- Highlight (highlights focus and target) - Highlight (highlights focus and target)
- Pets (show arena pets) - Pets (show arena pets)
- Racial Spells
- TotemPlates (show totem icons instead of normal nameplates) - TotemPlates (show totem icons instead of normal nameplates)
- Trinket (tracks trinket usage) - Trinket (tracks trinket usage)
- VersionCheck (checks if you use an older version that your teammate) - VersionCheck (checks if you use an older version that your teammate)
@ -35,6 +39,46 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
### Changes ### Changes
#### v1.08-Beta
- fix Buffs not showing on class icon
- added option highlight to be inside
- added option to grow frames vertically
- added new profile to XiconProfile (Blizzard raid style)
- minor bugfixes
#### v1.07-Beta
- CombatIndicator module added
- spec icon option added to Classicon module
- arena1-5 for name option added
- add a couple buffs to LibClassAuras
- add blessing of sacrifice and intervene to auras
- general options updated to apply font/borders/etc for all frames
- XiconProfiles updated
- /gladdy test1-5 now possible
- fix PowerBar text updates
- click through frames exept health/power bar
- add mask texture for icons
#### v1.06-Beta
- fixed BuffsDebuff module
- fix racial texture reset
- minor bugfixes
#### v1.0.5-Beta
- fixed Aura-Module
- Racial module added to EventListener and Version check updated
- constants for auras/cooldowns/racials updated
- anchoring for modules rewritten
- fix Aura module options (localization independent for profile export)
- Power-/HealthBar customize texts added and UNIT_DESTROYED added
- Racial module added and trinket modified
- XiconProfiles import strings
- Pets position extended
- delete unused saved variables
- ExportImport, VersionCheck & XiconProfiles fix
- TotemPlates add option to show friendly/enemy icons
#### v1.0.4-Beta #### v1.0.4-Beta
- XiconProfiles fixed - XiconProfiles fixed