Compare commits
209 Commits
v1.16-Beta
...
v2.1-Relea
Author | SHA1 | Date | |
---|---|---|---|
45eacbde7f | |||
80eee574a9 | |||
cb6de72b93 | |||
2720e25cea | |||
7d77054a7b | |||
3d4479cc06 | |||
d43d8e9284 | |||
a8a6002f47 | |||
f283ea994a | |||
15fb697258 | |||
eddd7588f4 | |||
5b32b8c793 | |||
10caa05e31 | |||
c6c3d23074 | |||
1a8cd81f7a | |||
d348b87ddf | |||
2f20d305b6 | |||
24bb84663f | |||
d6351dbe88 | |||
26241d73d6 | |||
8fa481affe | |||
3c82edc441 | |||
d23d749f1e | |||
34b0a18d9a | |||
ad4ba087f5 | |||
b14406f75f | |||
907c64a864 | |||
27573b7530 | |||
051571f4ef | |||
3e59a03ce9 | |||
86337919b8 | |||
5212479dae | |||
09bfb99681 | |||
803abd6f07 | |||
41b299e0b1 | |||
d8391b0f66 | |||
ce3812d234 | |||
23729f5960 | |||
0b512af2b7 | |||
5ceedb53de | |||
66931e18f9 | |||
27eeade507 | |||
37902e37e7 | |||
9266274c16 | |||
19eba81faa | |||
2d58d3fb77 | |||
016327c659 | |||
4885e11b10 | |||
4583cbdf24 | |||
35e119160a | |||
ddccf7a62e | |||
89a5511fb9 | |||
874d8471e8 | |||
7c145752f7 | |||
47a15bd2a1 | |||
cd64e8b481 | |||
7ce6cdd5e0 | |||
5f94e971f0 | |||
fd37f588ac | |||
038688bd5b | |||
cf485a91a1 | |||
9dbab9939f | |||
0d9e9735da | |||
83763aa016 | |||
b22756b6ab | |||
5f4bf034e5 | |||
042a8f7812 | |||
ea10481c13 | |||
99fa6c0664 | |||
61c50b3e32 | |||
e5151f1605 | |||
d24b330411 | |||
298ce642fc | |||
061bc5859c | |||
12abedfd0f | |||
22526c0386 | |||
1e926024ce | |||
1dd411fed7 | |||
242c45b8c4 | |||
2edca9b11e | |||
55860fc157 | |||
6954fb05d0 | |||
114a7b14e4 | |||
978ba56f85 | |||
61e49ffb8c | |||
b351bd9c23 | |||
2c4308712d | |||
91f7fcb998 | |||
5766484f92 | |||
035942abbe | |||
2e3fb06269 | |||
b5f67d066f | |||
c3a7c6cbc8 | |||
65daef4cd4 | |||
6b94fdc32f | |||
2571df3052 | |||
1c42523a2f | |||
114c0ac96d | |||
59da6f34c6 | |||
adb06d0c7f | |||
be292401cc | |||
8df7aae3b6 | |||
1b2311fea2 | |||
0a5176aaed | |||
f923f471d8 | |||
2dcdc9c978 | |||
7db32cceef | |||
e2a78c717b | |||
b2c8ed9c44 | |||
fed5d1c341 | |||
92322a4d9b | |||
91c25edcfe | |||
41f74f5896 | |||
69c1eca49b | |||
09a47e81f1 | |||
ebb56c4127 | |||
fabd9ae048 | |||
3f28947b05 | |||
1010d59bd3 | |||
069ca47210 | |||
d2f307fca0 | |||
033aa260f4 | |||
4925195de6 | |||
ff4799ceef | |||
548234aaaa | |||
df2721f1cf | |||
01f907f71c | |||
94efa7a112 | |||
e93f7c54c6 | |||
7a7c50e283 | |||
f29e8eff3b | |||
a0ed3be791 | |||
95106eab1e | |||
2c845547a4 | |||
b861091d44 | |||
c3a1555932 | |||
f36883df31 | |||
f9b1ac9c51 | |||
b6d243b8c0 | |||
ce5c8fc5a0 | |||
60c823fa07 | |||
f1e1ee4e0b | |||
d2884e777a | |||
b651eb39ce | |||
73b01c28d7 | |||
dd75f267f4 | |||
7108598603 | |||
6b4c35c66b | |||
75d4dfe9fe | |||
776464f551 | |||
dd8a35857d | |||
1c93e4ce4d | |||
e2d0af1e2b | |||
9e81455ec5 | |||
fad4321bf6 | |||
9c8c78bb83 | |||
bb7b820cbb | |||
890cf80531 | |||
f7f703d33a | |||
a7cdacb55d | |||
237130e3ce | |||
2c73188e15 | |||
5da6d1d7c9 | |||
8a17592842 | |||
51cd2b7311 | |||
720e5b63ec | |||
74753e327c | |||
0d5b5644a9 | |||
d53f89c6d4 | |||
79371b72b0 | |||
b73bc33630 | |||
4c239cd599 | |||
6de5a60309 | |||
31360bf695 | |||
599fde6581 | |||
382e5c3948 | |||
582ca88b59 | |||
aa53bfc241 | |||
bd2c15088d | |||
d2da0a22ae | |||
915c213eb5 | |||
0cfba040f1 | |||
2a5a0fa394 | |||
a1387f8ecd | |||
e7a83d61f3 | |||
90b146e433 | |||
61f79adda2 | |||
9b8c6a1426 | |||
d44ac29f43 | |||
751e84c61d | |||
f92b3a4964 | |||
c2fec39202 | |||
9f1bda3e80 | |||
fdeea258be | |||
960a98d244 | |||
82ec1460f8 | |||
23b9e2dfae | |||
755a3e52b5 | |||
5767bc7ae3 | |||
b1070d070a | |||
5f4ab71a5a | |||
c43228f0b9 | |||
b54ed1cda1 | |||
19d0460501 | |||
cb6e519afe | |||
d9f0c1491a | |||
17a983fad6 | |||
4e0ea70bfa | |||
964a4b4f88 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -5,4 +5,5 @@ BuffLib
|
|||||||
*.psd
|
*.psd
|
||||||
Ace-Libs
|
Ace-Libs
|
||||||
Images_Raw
|
Images_Raw
|
||||||
Gladdy_old
|
Gladdy_old
|
||||||
|
Gladdy_TW
|
600
Constants.lua
600
Constants.lua
@ -1,6 +1,7 @@
|
|||||||
local tbl_sort, select = table.sort, select
|
local tbl_sort, select, string_lower = table.sort, select, string.lower
|
||||||
|
|
||||||
local GetSpellInfo = GetSpellInfo
|
local GetSpellInfo = GetSpellInfo
|
||||||
|
local GetItemInfo = GetItemInfo
|
||||||
local GetLocale = GetLocale
|
local GetLocale = GetLocale
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
@ -12,6 +13,34 @@ tbl_sort(Gladdy.CLASSES)
|
|||||||
Gladdy.RACES = {"Scourge", "BloodElf", "Tauren", "Orc", "Troll", "NightElf", "Draenei", "Human", "Gnome", "Dwarf"}
|
Gladdy.RACES = {"Scourge", "BloodElf", "Tauren", "Orc", "Troll", "NightElf", "Draenei", "Human", "Gnome", "Dwarf"}
|
||||||
tbl_sort(Gladdy.RACES)
|
tbl_sort(Gladdy.RACES)
|
||||||
|
|
||||||
|
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 specBuffs = {
|
local specBuffs = {
|
||||||
-- DRUID
|
-- DRUID
|
||||||
[GetSpellInfo(45283)] = L["Restoration"], -- Natural Perfection
|
[GetSpellInfo(45283)] = L["Restoration"], -- Natural Perfection
|
||||||
@ -19,19 +48,23 @@ local specBuffs = {
|
|||||||
[GetSpellInfo(24858)] = L["Restoration"], -- Moonkin Form; Dreamstate spec in TBC equals Restoration
|
[GetSpellInfo(24858)] = L["Restoration"], -- Moonkin Form; Dreamstate spec in TBC equals Restoration
|
||||||
[GetSpellInfo(17007)] = L["Feral"], -- Leader of the Pack
|
[GetSpellInfo(17007)] = L["Feral"], -- Leader of the Pack
|
||||||
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
|
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
|
||||||
|
[GetSpellInfo(33891)] = L["Restoration"], -- Tree of Life
|
||||||
|
|
||||||
-- HUNTER
|
-- HUNTER
|
||||||
[GetSpellInfo(34692)] = L["Beast Mastery"], -- The Beast Within
|
[GetSpellInfo(34692)] = L["Beast Mastery"], -- The Beast Within
|
||||||
[GetSpellInfo(20895)] = L["Beast Mastery"], -- Spirit Bond
|
[GetSpellInfo(20895)] = L["Beast Mastery"], -- Spirit Bond
|
||||||
[GetSpellInfo(34455)] = L["Beast Mastery"], -- Ferocious Inspiration
|
[GetSpellInfo(34455)] = L["Beast Mastery"], -- Ferocious Inspiration
|
||||||
[GetSpellInfo(27066)] = L["Marksmanship"], -- Trueshot Aura
|
[GetSpellInfo(27066)] = L["Marksmanship"], -- Trueshot Aura
|
||||||
|
[GetSpellInfo(34501)] = L["Survival"], -- Expose Weakness
|
||||||
|
|
||||||
-- MAGE
|
-- MAGE
|
||||||
[GetSpellInfo(33405)] = L["Frost"], -- Ice Barrier
|
[GetSpellInfo(33405)] = L["Frost"], -- Ice Barrier
|
||||||
[GetSpellInfo(11129)] = L["Fire"], -- Combustion
|
[GetSpellInfo(11129)] = L["Fire"], -- Combustion
|
||||||
[GetSpellInfo(12042)] = L["Arcane"], -- Arcane Power
|
[GetSpellInfo(12042)] = L["Arcane"], -- Arcane Power
|
||||||
[GetSpellInfo(12043)] = L["Arcane"], -- Presence of Mind
|
[GetSpellInfo(12043)] = L["Arcane"], -- Presence of Mind
|
||||||
|
[GetSpellInfo(31589)] = L["Arcane"], -- Slow
|
||||||
[GetSpellInfo(12472)] = L["Frost"], -- Icy Veins
|
[GetSpellInfo(12472)] = L["Frost"], -- Icy Veins
|
||||||
|
[GetSpellInfo(46989)] = L["Arcane"], -- Improved Blink
|
||||||
|
|
||||||
-- PALADIN
|
-- PALADIN
|
||||||
[GetSpellInfo(31836)] = L["Holy"], -- Light's Grace
|
[GetSpellInfo(31836)] = L["Holy"], -- Light's Grace
|
||||||
@ -40,9 +73,12 @@ local specBuffs = {
|
|||||||
[GetSpellInfo(20375)] = L["Retribution"], -- Seal of Command
|
[GetSpellInfo(20375)] = L["Retribution"], -- Seal of Command
|
||||||
[GetSpellInfo(20049)] = L["Retribution"], -- Vengeance
|
[GetSpellInfo(20049)] = L["Retribution"], -- Vengeance
|
||||||
[GetSpellInfo(20218)] = L["Retribution"], -- Sanctity Aura
|
[GetSpellInfo(20218)] = L["Retribution"], -- Sanctity Aura
|
||||||
|
[GetSpellInfo(26018)] = L["Retribution"], -- Vindication
|
||||||
|
[GetSpellInfo(27179)] = L["Protection"], -- Holy Shield
|
||||||
|
|
||||||
-- PRIEST
|
-- PRIEST
|
||||||
[GetSpellInfo(15473)] = L["Shadow"], -- Shadowform
|
[GetSpellInfo(15473)] = L["Shadow"], -- Shadowform
|
||||||
|
[GetSpellInfo(15286)] = L["Shadow"], -- Vampiric Embrace
|
||||||
[GetSpellInfo(45234)] = L["Discipline"], -- Focused Will
|
[GetSpellInfo(45234)] = L["Discipline"], -- Focused Will
|
||||||
[GetSpellInfo(27811)] = L["Discipline"], -- Blessed Recovery
|
[GetSpellInfo(27811)] = L["Discipline"], -- Blessed Recovery
|
||||||
[GetSpellInfo(33142)] = L["Holy"], -- Blessed Resilience
|
[GetSpellInfo(33142)] = L["Holy"], -- Blessed Resilience
|
||||||
@ -58,11 +94,15 @@ local specBuffs = {
|
|||||||
[GetSpellInfo(36563)] = L["Subtlety"], -- Shadowstep DMG
|
[GetSpellInfo(36563)] = L["Subtlety"], -- Shadowstep DMG
|
||||||
[GetSpellInfo(14278)] = L["Subtlety"], -- Ghostly Strike
|
[GetSpellInfo(14278)] = L["Subtlety"], -- Ghostly Strike
|
||||||
[GetSpellInfo(31233)] = L["Assassination"], -- Find Weakness
|
[GetSpellInfo(31233)] = L["Assassination"], -- Find Weakness
|
||||||
|
[GetSpellInfo(13877)] = L["Combat"], -- Blade Flurry
|
||||||
|
|
||||||
--Shaman
|
--Shaman
|
||||||
|
[GetSpellInfo(30807)] = L["Enhancement"], -- Unleashed Rage
|
||||||
|
[GetSpellInfo(16280)] = L["Enhancement"], -- Flurry
|
||||||
|
[GetSpellInfo(30823)] = L["Enhancement"], -- Shamanistic Rage
|
||||||
[GetSpellInfo(16190)] = L["Restoration"], -- Mana Tide Totem
|
[GetSpellInfo(16190)] = L["Restoration"], -- Mana Tide Totem
|
||||||
[GetSpellInfo(32594)] = L["Restoration"], -- Earth Shield
|
[GetSpellInfo(32594)] = L["Restoration"], -- Earth Shield
|
||||||
[GetSpellInfo(30823)] = L["Enhancement"], -- Shamanistic Rage
|
[GetSpellInfo(29202)] = L["Restoration"], -- Healing Way
|
||||||
|
|
||||||
-- WARLOCK
|
-- WARLOCK
|
||||||
[GetSpellInfo(19028)] = L["Demonology"], -- Soul Link
|
[GetSpellInfo(19028)] = L["Demonology"], -- Soul Link
|
||||||
@ -86,6 +126,7 @@ local specSpells = {
|
|||||||
[GetSpellInfo(33987)] = L["Feral"], -- Mangle (Bear)
|
[GetSpellInfo(33987)] = L["Feral"], -- Mangle (Bear)
|
||||||
[GetSpellInfo(18562)] = L["Restoration"], -- Swiftmend
|
[GetSpellInfo(18562)] = L["Restoration"], -- Swiftmend
|
||||||
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
|
[GetSpellInfo(16188)] = L["Restoration"], -- Nature's Swiftness
|
||||||
|
[GetSpellInfo(33891)] = L["Restoration"], -- Tree of Life
|
||||||
|
|
||||||
-- HUNTER
|
-- HUNTER
|
||||||
[GetSpellInfo(19577)] = L["Beast Mastery"], -- Intimidation
|
[GetSpellInfo(19577)] = L["Beast Mastery"], -- Intimidation
|
||||||
@ -121,11 +162,13 @@ local specSpells = {
|
|||||||
[GetSpellInfo(34861)] = L["Holy"], -- Circle of Healing
|
[GetSpellInfo(34861)] = L["Holy"], -- Circle of Healing
|
||||||
[GetSpellInfo(15473)] = L["Shadow"], -- Shadowform
|
[GetSpellInfo(15473)] = L["Shadow"], -- Shadowform
|
||||||
[GetSpellInfo(34917)] = L["Shadow"], -- Vampiric Touch
|
[GetSpellInfo(34917)] = L["Shadow"], -- Vampiric Touch
|
||||||
|
[GetSpellInfo(15286)] = L["Shadow"], -- Vampiric Embrace
|
||||||
|
|
||||||
-- ROGUE
|
-- ROGUE
|
||||||
[GetSpellInfo(34413)] = L["Assassination"], -- Mutilate
|
[GetSpellInfo(34413)] = L["Assassination"], -- Mutilate
|
||||||
[GetSpellInfo(14177)] = L["Assassination"], -- Cold Blood
|
[GetSpellInfo(14177)] = L["Assassination"], -- Cold Blood
|
||||||
[GetSpellInfo(13750)] = L["Combat"], -- Adrenaline Rush
|
[GetSpellInfo(13750)] = L["Combat"], -- Adrenaline Rush
|
||||||
|
[GetSpellInfo(13877)] = L["Combat"], -- Blade Flurry
|
||||||
[GetSpellInfo(14185)] = L["Subtlety"], -- Preparation
|
[GetSpellInfo(14185)] = L["Subtlety"], -- Preparation
|
||||||
[GetSpellInfo(16511)] = L["Subtlety"], -- Hemorrhage
|
[GetSpellInfo(16511)] = L["Subtlety"], -- Hemorrhage
|
||||||
[GetSpellInfo(36554)] = L["Subtlety"], -- Shadowstep
|
[GetSpellInfo(36554)] = L["Subtlety"], -- Shadowstep
|
||||||
@ -134,6 +177,7 @@ local specSpells = {
|
|||||||
|
|
||||||
-- SHAMAN
|
-- SHAMAN
|
||||||
[GetSpellInfo(16166)] = L["Elemental"], -- Elemental Mastery
|
[GetSpellInfo(16166)] = L["Elemental"], -- Elemental Mastery
|
||||||
|
[GetSpellInfo(30706)] = L["Elemental"], -- Totem of Wrath
|
||||||
[GetSpellInfo(30823)] = L["Enhancement"], -- Shamanistic Rage
|
[GetSpellInfo(30823)] = L["Enhancement"], -- Shamanistic Rage
|
||||||
[GetSpellInfo(17364)] = L["Enhancement"], -- Stormstrike
|
[GetSpellInfo(17364)] = L["Enhancement"], -- Stormstrike
|
||||||
[GetSpellInfo(16190)] = L["Restoration"], -- Mana Tide Totem
|
[GetSpellInfo(16190)] = L["Restoration"], -- Mana Tide Totem
|
||||||
@ -142,8 +186,10 @@ local specSpells = {
|
|||||||
|
|
||||||
-- WARLOCK
|
-- WARLOCK
|
||||||
[GetSpellInfo(30405)] = L["Affliction"], -- Unstable Affliction
|
[GetSpellInfo(30405)] = L["Affliction"], -- Unstable Affliction
|
||||||
|
[GetSpellInfo(18220)] = L["Affliction"], -- Dark Pact
|
||||||
--[GetSpellInfo(30911)] = L["Affliction"], -- Siphon Life
|
--[GetSpellInfo(30911)] = L["Affliction"], -- Siphon Life
|
||||||
[GetSpellInfo(30414)] = L["Destruction"], -- Shadowfury
|
[GetSpellInfo(30414)] = L["Destruction"], -- Shadowfury
|
||||||
|
[GetSpellInfo(30912)] = L["Destruction"], -- Conflagrate
|
||||||
|
|
||||||
-- WARRIOR
|
-- WARRIOR
|
||||||
[GetSpellInfo(30330)] = L["Arms"], -- Mortal Strike
|
[GetSpellInfo(30330)] = L["Arms"], -- Mortal Strike
|
||||||
@ -151,6 +197,7 @@ local specSpells = {
|
|||||||
[GetSpellInfo(30335)] = L["Fury"], -- Bloodthirst
|
[GetSpellInfo(30335)] = L["Fury"], -- Bloodthirst
|
||||||
[GetSpellInfo(12809)] = L["Protection"], -- Concussion Blow
|
[GetSpellInfo(12809)] = L["Protection"], -- Concussion Blow
|
||||||
[GetSpellInfo(30022)] = L["Protection"], -- Devastation
|
[GetSpellInfo(30022)] = L["Protection"], -- Devastation
|
||||||
|
[GetSpellInfo(30356)] = L["Protection"], -- Shield Slam
|
||||||
}
|
}
|
||||||
function Gladdy:GetSpecSpells()
|
function Gladdy:GetSpecSpells()
|
||||||
return specSpells
|
return specSpells
|
||||||
@ -263,6 +310,16 @@ local importantAuras = {
|
|||||||
onDamage = true,
|
onDamage = true,
|
||||||
spellID = 19503,
|
spellID = 19503,
|
||||||
},
|
},
|
||||||
|
-- Scare Beast
|
||||||
|
[GetSpellInfo(14327)] = {
|
||||||
|
track = AURA_TYPE_DEBUFF,
|
||||||
|
duration = 8,
|
||||||
|
priority = 40,
|
||||||
|
onDamage = true,
|
||||||
|
fear = true,
|
||||||
|
magic = true,
|
||||||
|
spellID = 14327,
|
||||||
|
},
|
||||||
-- Silencing Shot
|
-- Silencing Shot
|
||||||
[GetSpellInfo(34490)] = {
|
[GetSpellInfo(34490)] = {
|
||||||
track = AURA_TYPE_DEBUFF,
|
track = AURA_TYPE_DEBUFF,
|
||||||
@ -445,6 +502,13 @@ local importantAuras = {
|
|||||||
priority = 10,
|
priority = 10,
|
||||||
spellID = 33206,
|
spellID = 33206,
|
||||||
},
|
},
|
||||||
|
-- Fear Ward
|
||||||
|
[GetSpellInfo(6346)] = {
|
||||||
|
track = AURA_TYPE_BUFF,
|
||||||
|
duration = 180,
|
||||||
|
priority = 9,
|
||||||
|
spellID = 6346,
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
-- Sap
|
-- Sap
|
||||||
@ -508,7 +572,20 @@ local importantAuras = {
|
|||||||
priority = 20,
|
priority = 20,
|
||||||
spellID = 31224,
|
spellID = 31224,
|
||||||
},
|
},
|
||||||
|
-- Evasion
|
||||||
|
[GetSpellInfo(26669)] = {
|
||||||
|
track = AURA_TYPE_BUFF,
|
||||||
|
duration = 15,
|
||||||
|
priority = 10,
|
||||||
|
spellID = 26669,
|
||||||
|
},
|
||||||
|
-- Riposte
|
||||||
|
[GetSpellInfo(14251)] = {
|
||||||
|
track = AURA_TYPE_DEBUFF,
|
||||||
|
duration = 6,
|
||||||
|
priority = 20,
|
||||||
|
spellID = 14251,
|
||||||
|
},
|
||||||
|
|
||||||
-- Fear
|
-- Fear
|
||||||
[GetSpellInfo(5782)] = {
|
[GetSpellInfo(5782)] = {
|
||||||
@ -527,6 +604,13 @@ local importantAuras = {
|
|||||||
priority = 40,
|
priority = 40,
|
||||||
spellID = 27223,
|
spellID = 27223,
|
||||||
},
|
},
|
||||||
|
--Banish
|
||||||
|
[GetSpellInfo(710)] = {
|
||||||
|
track = AURA_TYPE_DEBUFF,
|
||||||
|
duration = 10,
|
||||||
|
priority = 40,
|
||||||
|
spellID = 710,
|
||||||
|
},
|
||||||
-- Shadowfury
|
-- Shadowfury
|
||||||
[GetSpellInfo(30283)] = {
|
[GetSpellInfo(30283)] = {
|
||||||
track = AURA_TYPE_DEBUFF,
|
track = AURA_TYPE_DEBUFF,
|
||||||
@ -630,6 +714,13 @@ local importantAuras = {
|
|||||||
spellSchool = "magic",
|
spellSchool = "magic",
|
||||||
spellID = 12292,
|
spellID = 12292,
|
||||||
},
|
},
|
||||||
|
--Disarm
|
||||||
|
[GetSpellInfo(676)] = {
|
||||||
|
track = AURA_TYPE_DEBUFF,
|
||||||
|
duration = 10,
|
||||||
|
priority = 20,
|
||||||
|
spellID = 676,
|
||||||
|
},
|
||||||
|
|
||||||
-- Grounding Totem Effect
|
-- Grounding Totem Effect
|
||||||
[GetSpellInfo(8178)] = {
|
[GetSpellInfo(8178)] = {
|
||||||
@ -697,6 +788,43 @@ local importantAuras = {
|
|||||||
magic = true,
|
magic = true,
|
||||||
spellID = 34709,
|
spellID = 34709,
|
||||||
},
|
},
|
||||||
|
-- Net-o-Matic
|
||||||
|
[GetSpellInfo(13120)] = {
|
||||||
|
track = AURA_TYPE_DEBUFF,
|
||||||
|
duration = 10,
|
||||||
|
priority = 30,
|
||||||
|
spellID = 13120,
|
||||||
|
},
|
||||||
|
-- Nigh Invulnerability Shield
|
||||||
|
[GetSpellInfo(30458)] = {
|
||||||
|
track = AURA_TYPE_BUFF,
|
||||||
|
duration = 8,
|
||||||
|
priority = 15,
|
||||||
|
spellID = 30458,
|
||||||
|
texture = select(10, GetItemInfo(23825))
|
||||||
|
},
|
||||||
|
-- Nigh Invulnerability Belt Backfire
|
||||||
|
[GetSpellInfo(30457)] = {
|
||||||
|
track = AURA_TYPE_DEBUFF,
|
||||||
|
duration = 8,
|
||||||
|
priority = 15,
|
||||||
|
spellID = 30457,
|
||||||
|
},
|
||||||
|
-- Flee (Skull of impending Doom) -- 5024
|
||||||
|
[GetSpellInfo(5024)] = {
|
||||||
|
track = AURA_TYPE_BUFF,
|
||||||
|
duration = 8,
|
||||||
|
priority = 15,
|
||||||
|
spellID = 5024,
|
||||||
|
altName = select(1, GetSpellInfo(5024)) .. " - " .. (select(1, GetItemInfo(4984)) or "Skull of Impending Doom"),
|
||||||
|
},
|
||||||
|
-- Will of the Forsaken
|
||||||
|
[GetSpellInfo(7744)] = {
|
||||||
|
track = AURA_TYPE_BUFF,
|
||||||
|
duration = 5,
|
||||||
|
priority = 15,
|
||||||
|
spellID = 7744,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
function Gladdy:GetImportantAuras()
|
function Gladdy:GetImportantAuras()
|
||||||
return importantAuras
|
return importantAuras
|
||||||
@ -751,7 +879,7 @@ local cooldownList = {
|
|||||||
["MAGE"] = {
|
["MAGE"] = {
|
||||||
[1953] = 15, -- Blink
|
[1953] = 15, -- Blink
|
||||||
--[122] = 22, -- Frost Nova
|
--[122] = 22, -- Frost Nova
|
||||||
--[12051] = 480, --Evocation
|
[12051] = 480, --Evocation
|
||||||
[2139] = 24, -- Counterspell
|
[2139] = 24, -- Counterspell
|
||||||
[45438] = { cd = 300, [L["Frost"]] = 240, }, -- Ice Block
|
[45438] = { cd = 300, [L["Frost"]] = 240, }, -- Ice Block
|
||||||
[12472] = { cd = 180, spec = L["Frost"], }, -- Icy Veins
|
[12472] = { cd = 180, spec = L["Frost"], }, -- Icy Veins
|
||||||
@ -783,6 +911,8 @@ local cooldownList = {
|
|||||||
[10060] = { cd = 180, spec = L["Discipline"], }, -- Power Infusion
|
[10060] = { cd = 180, spec = L["Discipline"], }, -- Power Infusion
|
||||||
[33206] = { cd = 120, spec = L["Discipline"], }, -- Pain Suppression
|
[33206] = { cd = 120, spec = L["Discipline"], }, -- Pain Suppression
|
||||||
[34433] = 300, -- Shadowfiend
|
[34433] = 300, -- Shadowfiend
|
||||||
|
[32379] = 12, -- Shadow Word: Death
|
||||||
|
[6346] = 180, -- Fear Ward
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Druid
|
-- Druid
|
||||||
@ -808,6 +938,7 @@ local cooldownList = {
|
|||||||
[16166] = { cd = 180, spec = L["Elemental"], }, -- Elemental Mastery
|
[16166] = { cd = 180, spec = L["Elemental"], }, -- Elemental Mastery
|
||||||
[16188] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
|
[16188] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
|
||||||
[16190] = { cd = 300, spec = L["Restoration"], }, -- Mana Tide Totem
|
[16190] = { cd = 300, spec = L["Restoration"], }, -- Mana Tide Totem
|
||||||
|
[8177] = 15, -- Grounding Totem
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Paladin
|
-- Paladin
|
||||||
@ -837,20 +968,22 @@ local cooldownList = {
|
|||||||
["WARLOCK"] = {
|
["WARLOCK"] = {
|
||||||
[17928] = 40, -- Howl of Terror
|
[17928] = 40, -- Howl of Terror
|
||||||
[27223] = 120, -- Death Coil
|
[27223] = 120, -- Death Coil
|
||||||
--[19647] = { cd = 24 }, -- Spell Lock; how will I handle pet spells?
|
[19647] = 24, -- Spell Lock
|
||||||
|
[27277] = 8, -- Devour Magic
|
||||||
[30414] = { cd = 20, spec = L["Destruction"], }, -- Shadowfury
|
[30414] = { cd = 20, spec = L["Destruction"], }, -- Shadowfury
|
||||||
[17877] = { cd = 15, spec = L["Destruction"], }, -- Shadowburn
|
[17877] = { cd = 15, spec = L["Destruction"], }, -- Shadowburn
|
||||||
|
[30912] = { cd = 10, spec = L["Destruction"], }, -- Conflagrate
|
||||||
[18708] = { cd = 900, spec = L["Demonology"], }, -- Feldom
|
[18708] = { cd = 900, spec = L["Demonology"], }, -- Feldom
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Warrior
|
-- Warrior
|
||||||
["WARRIOR"] = {
|
["WARRIOR"] = {
|
||||||
--[[6552] = { cd = 10, -- Pummel
|
[6552] = { cd = 10, -- Pummel
|
||||||
sharedCD = {
|
sharedCD = {
|
||||||
[72] = true,
|
[72] = true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
[72] = { cd = 12, -- Shield Bash
|
--[[72] = { cd = 12, -- Shield Bash
|
||||||
sharedCD = {
|
sharedCD = {
|
||||||
[6552] = true,
|
[6552] = true,
|
||||||
},
|
},
|
||||||
@ -862,6 +995,7 @@ local cooldownList = {
|
|||||||
[18499] = 30, -- Berserker Rage
|
[18499] = 30, -- Berserker Rage
|
||||||
--[2565] = 60, -- Shield Block
|
--[2565] = 60, -- Shield Block
|
||||||
[12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish
|
[12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish
|
||||||
|
[20252] = { cd = 30, [L["Arms"]] = 20 }, -- Intercept
|
||||||
[12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand
|
[12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand
|
||||||
[12809] = { cd = 30, spec = L["Protection"], }, -- Concussion Blow
|
[12809] = { cd = 30, spec = L["Protection"], }, -- Concussion Blow
|
||||||
|
|
||||||
@ -870,29 +1004,38 @@ local cooldownList = {
|
|||||||
-- Hunter
|
-- Hunter
|
||||||
["HUNTER"] = {
|
["HUNTER"] = {
|
||||||
[19503] = 30, -- Scatter Shot
|
[19503] = 30, -- Scatter Shot
|
||||||
|
[14327] = 30, -- Scare Beast
|
||||||
[19263] = 300, -- Deterrence; not on BM but can't do 2 specs
|
[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
|
[13809] = { cd = 30, -- Frost Trap
|
||||||
sharedCD = {
|
sharedCD = {
|
||||||
[14311] = true, -- Freezing Trap
|
[14311] = true, -- Freezing Trap
|
||||||
[34600] = true, -- Snake Trap
|
[34600] = true, -- Snake Trap
|
||||||
},
|
},
|
||||||
|
icon = select(3, GetSpellInfo(14311)),
|
||||||
|
},
|
||||||
|
[14311] = { cd = 30, -- Freezing Trap
|
||||||
|
sharedCD = {
|
||||||
|
[13809] = true, -- Frost Trap
|
||||||
|
[34600] = true, -- Snake Trap
|
||||||
|
},
|
||||||
|
icon = select(3, GetSpellInfo(14311)),
|
||||||
},
|
},
|
||||||
[34600] = { cd = 30, -- Snake Trap
|
[34600] = { cd = 30, -- Snake Trap
|
||||||
sharedCD = {
|
sharedCD = {
|
||||||
[14311] = true, -- Freezing Trap
|
[14311] = true, -- Freezing Trap
|
||||||
[13809] = true, -- Frost Trap
|
[13809] = true, -- Frost Trap
|
||||||
},
|
},
|
||||||
|
icon = select(3, GetSpellInfo(14311)),
|
||||||
},
|
},
|
||||||
[34490] = { cd = 20, spec = L["Marksmanship"], }, -- Silencing Shot
|
[34490] = { cd = 20, spec = L["Marksmanship"], }, -- Silencing Shot
|
||||||
[19386] = { cd = 60, spec = L["Survival"], }, -- Wyvern Sting
|
[19386] = { cd = 60, spec = L["Survival"], }, -- Wyvern Sting
|
||||||
[19577] = { cd = 60, spec = L["Beast Mastery"], }, -- Intimidation
|
[19577] = { cd = 60, spec = L["Beast Mastery"], }, -- Intimidation
|
||||||
[38373] = { cd = 120, spec = L["Beast Mastery"], }, -- The Beast Within
|
[38373] = { cd = 120, spec = L["Beast Mastery"], }, -- The Beast Within
|
||||||
|
[5384] = 30, -- Feign Death
|
||||||
|
[3034] = 15, -- Viper Sting
|
||||||
|
[1543] = 20, -- Flare
|
||||||
},
|
},
|
||||||
|
|
||||||
-- Rogue
|
-- Rogue
|
||||||
@ -934,19 +1077,19 @@ local cooldownList = {
|
|||||||
|
|
||||||
},
|
},
|
||||||
["NightElf"] = {
|
["NightElf"] = {
|
||||||
[2651] = { cd = 180, spec = L["Discipline"], }, -- Elune's Grace
|
[2651] = { cd = 180, spec = L["Discipline"], class = "PRIEST"}, -- Elune's Grace
|
||||||
[10797] = { cd = 30, spec = L["Discipline"], }, -- Star Shards
|
[10797] = { cd = 30, spec = L["Discipline"], class = "PRIEST"}, -- Star Shards
|
||||||
},
|
},
|
||||||
["Draenei"] = {
|
["Draenei"] = {
|
||||||
[32548] = { cd = 300, spec = L["Discipline"], }, -- Hymn of Hope
|
[32548] = { cd = 300, spec = L["Discipline"], class = "PRIEST"}, -- Hymn of Hope
|
||||||
},
|
},
|
||||||
["Human"] = {
|
["Human"] = {
|
||||||
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
|
[13908] = { cd = 600, spec = L["Discipline"], class = "PRIEST"}, -- Desperate Prayer
|
||||||
},
|
},
|
||||||
["Gnome"] = {
|
["Gnome"] = {
|
||||||
},
|
},
|
||||||
["Dwarf"] = {
|
["Dwarf"] = {
|
||||||
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
|
[13908] = { cd = 600, spec = L["Discipline"], class = "PRIEST"}, -- Desperate Prayer
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
function Gladdy:GetCooldownList()
|
function Gladdy:GetCooldownList()
|
||||||
@ -1049,9 +1192,9 @@ local arenaTimer = {
|
|||||||
[0] = "Der Arenakampf hat begonnen!",
|
[0] = "Der Arenakampf hat begonnen!",
|
||||||
},
|
},
|
||||||
["frFR"] = {
|
["frFR"] = {
|
||||||
[60] = "Le combat d'arène commence dans une minute\194\160!",
|
[61] = "Le combat d'arène commence dans une minute\194\160!",
|
||||||
[30] = "Le combat d'arène commence dans trente secondes\194\160!",
|
[31] = "Le combat d'arène commence dans trente secondes\194\160!",
|
||||||
[15] = "Le combat d'arène commence dans quinze secondes\194\160!",
|
[16] = "Le combat d'arène commence dans quinze secondes\194\160!",
|
||||||
[0] = "Le combat d'arène commence\194\160!",
|
[0] = "Le combat d'arène commence\194\160!",
|
||||||
},
|
},
|
||||||
["ruRU"] = {
|
["ruRU"] = {
|
||||||
@ -1093,3 +1236,418 @@ function Gladdy:GetArenaTimer()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Gladdy.legacy = {
|
||||||
|
castBarPos = "LEFT",
|
||||||
|
buffsCooldownPos = "TOP",
|
||||||
|
buffsBuffsCooldownPos = "BOTTOM",
|
||||||
|
classIconPos = "LEFT",
|
||||||
|
ciAnchor = "healthBar",
|
||||||
|
ciPos = "TOP",
|
||||||
|
cooldownYPos = "TOP",
|
||||||
|
cooldownXPos = "LEFT",
|
||||||
|
drCooldownPos = "RIGHT",
|
||||||
|
racialAnchor = "trinket",
|
||||||
|
racialPos = "RIGHT",
|
||||||
|
trinketPos = "RIGHT",
|
||||||
|
padding = 1,
|
||||||
|
growUp = false,
|
||||||
|
}
|
||||||
|
|
||||||
|
Gladdy.newDefaults = {
|
||||||
|
["bottomMargin"] = 94.99996948242188,
|
||||||
|
["newLayout"] = true,
|
||||||
|
Pets = {
|
||||||
|
["petYOffset"] = -81.99993896484375,
|
||||||
|
["petXOffset"] = 181,
|
||||||
|
},
|
||||||
|
ClassIcon = {
|
||||||
|
["classIconXOffset"] = -74.90008544921875,
|
||||||
|
},
|
||||||
|
Racial = {
|
||||||
|
["racialXOffset"] = 255.9000244140625,
|
||||||
|
},
|
||||||
|
Trinket = {
|
||||||
|
["trinketXOffset"] = 182,
|
||||||
|
},
|
||||||
|
["Combat Indicator"] = {
|
||||||
|
["ciXOffset"] = 79.99993896484375,
|
||||||
|
["ciYOffset"] = -10.99993896484375,
|
||||||
|
},
|
||||||
|
Cooldowns = {
|
||||||
|
["cooldownYOffset"] = 31,
|
||||||
|
},
|
||||||
|
["Buffs and Debuffs"] = {
|
||||||
|
["buffsBuffsXOffset"] = 29,
|
||||||
|
["buffsBuffsYOffset"] = -82.99993896484375,
|
||||||
|
["buffsXOffset"] = 29,
|
||||||
|
["buffsYOffset"] = 62.00006103515625,
|
||||||
|
},
|
||||||
|
Diminishings = {
|
||||||
|
["drXOffset"] = 329.7999877929688,
|
||||||
|
["drYOffset"] = -22.5,
|
||||||
|
},
|
||||||
|
["Cast Bar"] = {
|
||||||
|
["castBarXOffset"] = -235.900146484375,
|
||||||
|
["castBarYOffset"] = -30.5,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
Gladdy.frameStrata = {
|
||||||
|
BACKGROUND = L["Background"] .. "(0)",
|
||||||
|
LOW = L["Low"] .. "(1)",
|
||||||
|
MEDIUM = L["Medium"] .. "(2)",
|
||||||
|
HIGH = L["High"] .. "(3)",
|
||||||
|
DIALOG = L["Dialog"] .. "(4)",
|
||||||
|
FULLSCREEN = L["Fullscreen"] .. "(5)",
|
||||||
|
FULLSCREEN_DIALOG = L["Fullscreen Dialog"] .. "(6)",
|
||||||
|
TOOLTIP = L["Tooltip"] .. "(7)",
|
||||||
|
}
|
||||||
|
|
||||||
|
Gladdy.frameStrataSorting = {
|
||||||
|
[1] = "BACKGROUND",
|
||||||
|
[2] = "LOW",
|
||||||
|
[3] = "MEDIUM",
|
||||||
|
[4] = "HIGH",
|
||||||
|
[5] = "DIALOG",
|
||||||
|
[6] = "FULLSCREEN",
|
||||||
|
[7] = "FULLSCREEN_DIALOG",
|
||||||
|
[8] = "TOOLTIP",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
---------------------
|
||||||
|
-- TOTEM STUFF
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
local totemData = {
|
||||||
|
-- Fire
|
||||||
|
[string_lower("Searing Totem")] = {id = 3599,texture = select(3, GetSpellInfo(3599)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Flametongue Totem")] = {id = 8227,texture = select(3, GetSpellInfo(8227)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Magma Totem")] = {id = 8190,texture = select(3, GetSpellInfo(8190)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 2},
|
||||||
|
[string_lower("Fire Nova Totem")] = {id = 1535,texture = select(3, GetSpellInfo(1535)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = { cd = 4, once = true }},
|
||||||
|
[string_lower("Totem of Wrath")] = {id = 30706,texture = select(3, GetSpellInfo(30706)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Fire Elemental Totem")] = {id = 32982,texture = select(3, GetSpellInfo(32982)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Frost Resistance Totem")] = {id = 8181,texture = select(3, GetSpellInfo(8181)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
-- Water
|
||||||
|
[string_lower("Fire Resistance Totem")] = {id = 8184,texture = select(3, GetSpellInfo(8184)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Poison Cleansing Totem")] = {id = 8166,texture = select(3, GetSpellInfo(8166)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 4},
|
||||||
|
[string_lower("Disease Cleansing Totem")] = {id = 8170,texture = select(3, GetSpellInfo(8170)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 4},
|
||||||
|
[string_lower("Healing Stream Totem")] = {id = 5394,texture = select(3, GetSpellInfo(5394)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 2},
|
||||||
|
[string_lower("Mana Tide Totem")] = {id = 16190,texture = select(3, GetSpellInfo(16190)), color = {r = 0.078, g = 0.9, b = 0.16, a = 1}},
|
||||||
|
[string_lower("Mana Spring Totem")] = {id = 5675,texture = select(3, GetSpellInfo(5675)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 2},
|
||||||
|
-- Earth
|
||||||
|
[string_lower("Earthbind Totem")] = {id = 2484,texture = select(3, GetSpellInfo(2484)), color = {r = 0.5, g = 0.5, b = 0.5, a = 1}, pulse = 3},
|
||||||
|
[string_lower("Stoneclaw Totem")] = {id = 5730,texture = select(3, GetSpellInfo(5730)), color = {r = 0, g = 0, b = 0, a = 1}, pulse = 2},
|
||||||
|
[string_lower("Stoneskin Totem")] = {id = 8071,texture = select(3, GetSpellInfo(8071)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Strength of Earth Totem")] = {id = 8075,texture = select(3, GetSpellInfo(8075)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Earth Elemental Totem")] = {id = 33663,texture = select(3, GetSpellInfo(33663)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Tremor Totem")] = {id = 8143,texture = select(3, GetSpellInfo(8143)), color = {r = 1, g = 0.9, b = 0.1, a = 1}, pulse = 3},
|
||||||
|
-- Air
|
||||||
|
[string_lower("Grounding Totem")] = {id = 8177,texture = select(3, GetSpellInfo(8177)), color = {r = 0, g = 0.53, b = 0.92, a = 1}},
|
||||||
|
[string_lower("Grace of Air Totem")] = {id = 8835,texture = select(3, GetSpellInfo(8835)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Nature Resistance Totem")] = {id = 10595,texture = select(3, GetSpellInfo(10595)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Windfury Totem")] = {id = 8512,texture = select(3, GetSpellInfo(8512)), color = {r = 0.96, g = 0, b = 0.07, a = 1}},
|
||||||
|
[string_lower("Sentry Totem")] = {id = 6495, texture = select(3, GetSpellInfo(6495)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Windwall Totem")] = {id = 15107,texture = select(3, GetSpellInfo(15107)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Wrath of Air Totem")] = {id = 3738,texture = select(3, GetSpellInfo(3738)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
[string_lower("Tranquil Air Totem")] = {id = 25908,texture = select(3, GetSpellInfo(25908)), color = {r = 0, g = 0, b = 0, a = 1}},
|
||||||
|
}
|
||||||
|
|
||||||
|
local totemSpellIdToPulse = {
|
||||||
|
[GetSpellInfo(totemData[string_lower("Earthbind Totem")].id)] = totemData[string_lower("Earthbind Totem")].pulse,
|
||||||
|
[2484] = totemData[string_lower("Earthbind Totem")].pulse,
|
||||||
|
[GetSpellInfo(totemData[string_lower("Tremor Totem")].id)] = totemData[string_lower("Tremor Totem")].pulse,
|
||||||
|
[8143] = totemData[string_lower("Tremor Totem")].pulse,
|
||||||
|
[GetSpellInfo(totemData[string_lower("Poison Cleansing Totem")].id)] = totemData[string_lower("Poison Cleansing Totem")].pulse,
|
||||||
|
[8166] = totemData[string_lower("Poison Cleansing Totem")].pulse,
|
||||||
|
[GetSpellInfo(totemData[string_lower("Disease Cleansing Totem")].id)] = totemData[string_lower("Disease Cleansing Totem")].pulse,
|
||||||
|
[8170] = totemData[string_lower("Disease Cleansing Totem")].pulse,
|
||||||
|
[GetSpellInfo(totemData[string_lower("Fire Nova Totem")].id)] = totemData[string_lower("Fire Nova Totem")].pulse,
|
||||||
|
[1535] = totemData[string_lower("Fire Nova Totem")].pulse, -- Rank 1
|
||||||
|
[8498] = totemData[string_lower("Fire Nova Totem")].pulse, -- Rank 2
|
||||||
|
[8499] = totemData[string_lower("Fire Nova Totem")].pulse, -- Rank 3
|
||||||
|
[11314] = totemData[string_lower("Fire Nova Totem")].pulse, -- Rank 4
|
||||||
|
[11315] = totemData[string_lower("Fire Nova Totem")].pulse, -- Rank 5
|
||||||
|
[25546] = totemData[string_lower("Fire Nova Totem")].pulse, -- Rank 6
|
||||||
|
[25547] = totemData[string_lower("Fire Nova Totem")].pulse, -- Rank 7
|
||||||
|
[GetSpellInfo(totemData[string_lower("Magma Totem")].id)] = totemData[string_lower("Magma Totem")].pulse,
|
||||||
|
[8190] = totemData[string_lower("Magma Totem")].pulse, -- Rank 1
|
||||||
|
[10585] = totemData[string_lower("Magma Totem")].pulse, -- Rank 2
|
||||||
|
[10586] = totemData[string_lower("Magma Totem")].pulse, -- Rank 3
|
||||||
|
[10587] = totemData[string_lower("Magma Totem")].pulse, -- Rank 4
|
||||||
|
[25552] = totemData[string_lower("Magma Totem")].pulse, -- Rank 5
|
||||||
|
[GetSpellInfo(totemData[string_lower("Healing Stream Totem")].id)] = totemData[string_lower("Healing Stream Totem")].pulse,
|
||||||
|
[5394] = totemData[string_lower("Healing Stream Totem")].pulse, -- Rank 1
|
||||||
|
[6375] = totemData[string_lower("Healing Stream Totem")].pulse, -- Rank 2
|
||||||
|
[6377] = totemData[string_lower("Healing Stream Totem")].pulse, -- Rank 3
|
||||||
|
[10462] = totemData[string_lower("Healing Stream Totem")].pulse, -- Rank 4
|
||||||
|
[10463] = totemData[string_lower("Healing Stream Totem")].pulse, -- Rank 5
|
||||||
|
[25567] = totemData[string_lower("Healing Stream Totem")].pulse, -- Rank 6
|
||||||
|
[GetSpellInfo(totemData[string_lower("Mana Spring Totem")].id)] = totemData[string_lower("Mana Spring Totem")].pulse,
|
||||||
|
[5675] = totemData[string_lower("Mana Spring Totem")].pulse, -- Rank 1
|
||||||
|
[10495] = totemData[string_lower("Mana Spring Totem")].pulse, -- Rank 2
|
||||||
|
[10496] = totemData[string_lower("Mana Spring Totem")].pulse, -- Rank 3
|
||||||
|
[10497] = totemData[string_lower("Mana Spring Totem")].pulse, -- Rank 4
|
||||||
|
[25570] = totemData[string_lower("Mana Spring Totem")].pulse, -- Rank 5
|
||||||
|
[GetSpellInfo(totemData[string_lower("Stoneclaw Totem")].id)] = totemData[string_lower("Stoneclaw Totem")].pulse,
|
||||||
|
[5730] = totemData[string_lower("Stoneclaw Totem")].pulse, -- Rank 1
|
||||||
|
[6390] = totemData[string_lower("Stoneclaw Totem")].pulse, -- Rank 2
|
||||||
|
[6391] = totemData[string_lower("Stoneclaw Totem")].pulse, -- Rank 3
|
||||||
|
[6392] = totemData[string_lower("Stoneclaw Totem")].pulse, -- Rank 4
|
||||||
|
[10427] = totemData[string_lower("Stoneclaw Totem")].pulse, -- Rank 5
|
||||||
|
[10428] = totemData[string_lower("Stoneclaw Totem")].pulse, -- Rank 6
|
||||||
|
[25525] = totemData[string_lower("Stoneclaw Totem")].pulse, -- Rank 7
|
||||||
|
}
|
||||||
|
|
||||||
|
local totemNpcIdsToTotemData = {
|
||||||
|
--fire
|
||||||
|
[2523] = totemData[string_lower("Searing Totem")],
|
||||||
|
[3902] = totemData[string_lower("Searing Totem")],
|
||||||
|
[3903] = totemData[string_lower("Searing Totem")],
|
||||||
|
[3904] = totemData[string_lower("Searing Totem")],
|
||||||
|
[7400] = totemData[string_lower("Searing Totem")],
|
||||||
|
[7402] = totemData[string_lower("Searing Totem")],
|
||||||
|
[15480] = totemData[string_lower("Searing Totem")],
|
||||||
|
[31162] = totemData[string_lower("Searing Totem")],
|
||||||
|
[31164] = totemData[string_lower("Searing Totem")],
|
||||||
|
[31165] = totemData[string_lower("Searing Totem")],
|
||||||
|
[21995] = totemData[string_lower("Searing Totem")],
|
||||||
|
[22209] = totemData[string_lower("Searing Totem")],
|
||||||
|
[22895] = totemData[string_lower("Searing Totem")],
|
||||||
|
[22896] = totemData[string_lower("Searing Totem")],
|
||||||
|
[34687] = totemData[string_lower("Searing Totem")],
|
||||||
|
[36532] = totemData[string_lower("Searing Totem")],
|
||||||
|
[43423] = totemData[string_lower("Searing Totem")],
|
||||||
|
[67380] = totemData[string_lower("Searing Totem")],
|
||||||
|
[73477] = totemData[string_lower("Searing Totem")],
|
||||||
|
[79238] = totemData[string_lower("Searing Totem")],
|
||||||
|
[22896] = totemData[string_lower("Searing Totem")],
|
||||||
|
[84519] = totemData[string_lower("Searing Totem")],
|
||||||
|
[110730] = totemData[string_lower("Searing Totem")],
|
||||||
|
[132178] = totemData[string_lower("Searing Totem")],
|
||||||
|
|
||||||
|
[5950] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[6012] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[7423] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[10557] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[15485] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[31132] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[31133] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[31158] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
[42605] = totemData[string_lower("Flametongue Totem")],
|
||||||
|
|
||||||
|
[5929] = totemData[string_lower("Magma Totem")],
|
||||||
|
[7464] = totemData[string_lower("Magma Totem")],
|
||||||
|
[7465] = totemData[string_lower("Magma Totem")],
|
||||||
|
[7466] = totemData[string_lower("Magma Totem")],
|
||||||
|
[15484] = totemData[string_lower("Magma Totem")],
|
||||||
|
[31166] = totemData[string_lower("Magma Totem")],
|
||||||
|
[31167] = totemData[string_lower("Magma Totem")],
|
||||||
|
[32887] = totemData[string_lower("Magma Totem")],
|
||||||
|
[42211] = totemData[string_lower("Magma Totem")],
|
||||||
|
[71335] = totemData[string_lower("Magma Totem")],
|
||||||
|
[71925] = totemData[string_lower("Magma Totem")],
|
||||||
|
[73085] = totemData[string_lower("Magma Totem")],
|
||||||
|
[73093] = totemData[string_lower("Magma Totem")],
|
||||||
|
[73268] = totemData[string_lower("Magma Totem")],
|
||||||
|
[88971] = totemData[string_lower("Magma Totem")],
|
||||||
|
[97369] = totemData[string_lower("Magma Totem")],
|
||||||
|
[98676] = totemData[string_lower("Magma Totem")],
|
||||||
|
|
||||||
|
[5879] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[6110] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[6111] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[7844] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[7845] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[14662] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[15482] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[15483] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[24320] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[32775] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
[32776] = totemData[string_lower("Fire Nova Totem")],
|
||||||
|
|
||||||
|
[17539] = totemData[string_lower("Totem of Wrath")],
|
||||||
|
[22970] = totemData[string_lower("Totem of Wrath")],
|
||||||
|
[22971] = totemData[string_lower("Totem of Wrath")],
|
||||||
|
[30652] = totemData[string_lower("Totem of Wrath")],
|
||||||
|
[30653] = totemData[string_lower("Totem of Wrath")],
|
||||||
|
[30654] = totemData[string_lower("Totem of Wrath")],
|
||||||
|
|
||||||
|
[15439] = totemData[string_lower("Fire Elemental Totem")],
|
||||||
|
[40830] = totemData[string_lower("Fire Elemental Totem")],
|
||||||
|
[41337] = totemData[string_lower("Fire Elemental Totem")],
|
||||||
|
[41346] = totemData[string_lower("Fire Elemental Totem")],
|
||||||
|
[72301] = totemData[string_lower("Fire Elemental Totem")],
|
||||||
|
|
||||||
|
[5926] = totemData[string_lower("Frost Resistance Totem")],
|
||||||
|
[7412] = totemData[string_lower("Frost Resistance Totem")],
|
||||||
|
[7413] = totemData[string_lower("Frost Resistance Totem")],
|
||||||
|
[15486] = totemData[string_lower("Frost Resistance Totem")],
|
||||||
|
[31171] = totemData[string_lower("Frost Resistance Totem")],
|
||||||
|
[31172] = totemData[string_lower("Frost Resistance Totem")],
|
||||||
|
|
||||||
|
-- Water
|
||||||
|
[5927] = totemData[string_lower("Fire Resistance Totem")],
|
||||||
|
[7424] = totemData[string_lower("Fire Resistance Totem")],
|
||||||
|
[7425] = totemData[string_lower("Fire Resistance Totem")],
|
||||||
|
[15487] = totemData[string_lower("Fire Resistance Totem")],
|
||||||
|
[31169] = totemData[string_lower("Fire Resistance Totem")],
|
||||||
|
[31170] = totemData[string_lower("Fire Resistance Totem")],
|
||||||
|
|
||||||
|
[5923] = totemData[string_lower("Poison Cleansing Totem")],
|
||||||
|
[22487] = totemData[string_lower("Poison Cleansing Totem")],
|
||||||
|
|
||||||
|
[5924] = totemData[string_lower("Disease Cleansing Totem")],
|
||||||
|
|
||||||
|
[3527] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[3906] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[3907] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[3908] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[3909] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[14664] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[15488] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[18235] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[31181] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[31182] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[31185] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[34686] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[36542] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[37810] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[38428] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[47077] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[72309] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[72457] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[73890] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[74433] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[97508] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[112567] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[120357] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[128539] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
[132049] = totemData[string_lower("Healing Stream Totem")],
|
||||||
|
|
||||||
|
[10467] = totemData[string_lower("Mana Tide Totem")],
|
||||||
|
[11100] = totemData[string_lower("Mana Tide Totem")],
|
||||||
|
[11101] = totemData[string_lower("Mana Tide Totem")],
|
||||||
|
[17061] = totemData[string_lower("Mana Tide Totem")],
|
||||||
|
|
||||||
|
[3573] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[7414] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[7415] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[7416] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[15304] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[15489] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[31186] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[31189] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
[31190] = totemData[string_lower("Mana Spring Totem")],
|
||||||
|
|
||||||
|
-- Earth
|
||||||
|
[2630] = totemData[string_lower("Earthbind Totem")],
|
||||||
|
[22486] = totemData[string_lower("Earthbind Totem")],
|
||||||
|
[40233] = totemData[string_lower("Earthbind Totem")],
|
||||||
|
[74737] = totemData[string_lower("Earthbind Totem")],
|
||||||
|
[79155] = totemData[string_lower("Earthbind Totem")],
|
||||||
|
|
||||||
|
[3579] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[3911] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[3912] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[3913] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[7398] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[7399] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[14870] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[15478] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[31120] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[31121] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[31122] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[40258] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
[102402] = totemData[string_lower("Stoneclaw Totem")],
|
||||||
|
|
||||||
|
[5873] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[5919] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[5920] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[7366] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[7367] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[7368] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[14663] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[15470] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[15474] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[18177] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[21994] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[31175] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[31176] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[36550] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[40267] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
[41967] = totemData[string_lower("Stoneskin Totem")],
|
||||||
|
|
||||||
|
[5874] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[5921] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[5922] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[7403] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[15464] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[15479] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[21992] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[30647] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[31129] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
[40266] = totemData[string_lower("Strength of Earth Totem")],
|
||||||
|
|
||||||
|
[15430] = totemData[string_lower("Earth Elemental Totem")],
|
||||||
|
[24649] = totemData[string_lower("Earth Elemental Totem")],
|
||||||
|
[39387] = totemData[string_lower("Earth Elemental Totem")],
|
||||||
|
[40247] = totemData[string_lower("Earth Elemental Totem")],
|
||||||
|
[72307] = totemData[string_lower("Earth Elemental Totem")],
|
||||||
|
|
||||||
|
[5913] = totemData[string_lower("Tremor Totem")],
|
||||||
|
[41938] = totemData[string_lower("Tremor Totem")],
|
||||||
|
[41939] = totemData[string_lower("Tremor Totem")],
|
||||||
|
|
||||||
|
-- Air
|
||||||
|
[5925] = totemData[string_lower("Grounding Totem")],
|
||||||
|
[128537] = totemData[string_lower("Grounding Totem")],
|
||||||
|
[136251] = totemData[string_lower("Grounding Totem")],
|
||||||
|
|
||||||
|
[7486] = totemData[string_lower("Grace of Air Totem")],
|
||||||
|
[7487] = totemData[string_lower("Grace of Air Totem")],
|
||||||
|
[15463] = totemData[string_lower("Grace of Air Totem")],
|
||||||
|
|
||||||
|
[7467] = totemData[string_lower("Nature Resistance Totem")],
|
||||||
|
[7468] = totemData[string_lower("Nature Resistance Totem")],
|
||||||
|
[7469] = totemData[string_lower("Nature Resistance Totem")],
|
||||||
|
[15490] = totemData[string_lower("Nature Resistance Totem")],
|
||||||
|
[31173] = totemData[string_lower("Nature Resistance Totem")],
|
||||||
|
[31174] = totemData[string_lower("Nature Resistance Totem")],
|
||||||
|
|
||||||
|
[6112] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[7483] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[7484] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[14666] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[15496] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[15497] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[22897] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[41940] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[41941] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[80703] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[105690] = totemData[string_lower("Windfury Totem")],
|
||||||
|
[133684] = totemData[string_lower("Windfury Totem")],
|
||||||
|
|
||||||
|
[3968] = totemData[string_lower("Sentry Totem")],
|
||||||
|
[28938] = totemData[string_lower("Sentry Totem")],
|
||||||
|
[40187] = totemData[string_lower("Sentry Totem")],
|
||||||
|
[69505] = totemData[string_lower("Sentry Totem")],
|
||||||
|
[70413] = totemData[string_lower("Sentry Totem")],
|
||||||
|
[71145] = totemData[string_lower("Sentry Totem")],
|
||||||
|
[147410] = totemData[string_lower("Sentry Totem")],
|
||||||
|
|
||||||
|
[9687] = totemData[string_lower("Windwall Totem")],
|
||||||
|
[9688] = totemData[string_lower("Windwall Totem")],
|
||||||
|
[9689] = totemData[string_lower("Windwall Totem")],
|
||||||
|
[15492] = totemData[string_lower("Windwall Totem")],
|
||||||
|
|
||||||
|
[15447] = totemData[string_lower("Wrath of Air Totem")],
|
||||||
|
[36556] = totemData[string_lower("Wrath of Air Totem")],
|
||||||
|
|
||||||
|
[15803] = totemData[string_lower("Tranquil Air Totem")],
|
||||||
|
}
|
||||||
|
|
||||||
|
function Gladdy:GetTotemData()
|
||||||
|
return totemData, totemNpcIdsToTotemData, totemSpellIdToPulse
|
||||||
|
end
|
||||||
|
|
||||||
|
@ -1,19 +1,21 @@
|
|||||||
local select, string_gsub, tostring = select, string.gsub, tostring
|
local select, string_gsub, tostring, pairs, ipairs = select, string.gsub, tostring, pairs, ipairs
|
||||||
|
|
||||||
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
|
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
|
||||||
local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF
|
local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF
|
||||||
local AURA_TYPE_BUFF = AURA_TYPE_BUFF
|
local AURA_TYPE_BUFF = AURA_TYPE_BUFF
|
||||||
|
|
||||||
local UnitName, UnitAura, UnitRace, UnitClass, UnitGUID, UnitIsUnit = UnitName, UnitAura, UnitRace, UnitClass, UnitGUID, UnitIsUnit
|
local UnitName, UnitAura, UnitRace, UnitClass, UnitGUID, UnitIsUnit, UnitExists = UnitName, UnitAura, UnitRace, UnitClass, UnitGUID, UnitIsUnit, UnitExists
|
||||||
local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo
|
local UnitCastingInfo, UnitChannelInfo = UnitCastingInfo, UnitChannelInfo
|
||||||
local GetSpellInfo = GetSpellInfo
|
local GetSpellInfo = GetSpellInfo
|
||||||
local FindAuraByName = AuraUtil.FindAuraByName
|
local FindAuraByName = AuraUtil.FindAuraByName
|
||||||
|
local GetTime = GetTime
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
|
local L = Gladdy.L
|
||||||
local Cooldowns = Gladdy.modules["Cooldowns"]
|
local Cooldowns = Gladdy.modules["Cooldowns"]
|
||||||
local Diminishings = Gladdy.modules["Diminishings"]
|
local Diminishings = Gladdy.modules["Diminishings"]
|
||||||
|
|
||||||
local EventListener = Gladdy:NewModule("EventListener", nil, {
|
local EventListener = Gladdy:NewModule("EventListener", 101, {
|
||||||
test = true,
|
test = true,
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -33,6 +35,16 @@ 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)
|
||||||
|
|
||||||
|
-- in case arena has started already we check for units
|
||||||
|
for i=1,Gladdy.curBracket do
|
||||||
|
if UnitExists("arena" .. i) then
|
||||||
|
Gladdy:SpotEnemy("arena" .. i, true)
|
||||||
|
end
|
||||||
|
if UnitExists("arenapet" .. i) then
|
||||||
|
Gladdy:SendMessage("PET_SPOTTED", "arenapet" .. i)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function EventListener:Reset()
|
function EventListener:Reset()
|
||||||
@ -40,14 +52,11 @@ function EventListener:Reset()
|
|||||||
self:SetScript("OnEvent", nil)
|
self:SetScript("OnEvent", nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Gladdy:DetectSpec(unit, specSpell)
|
|
||||||
if specSpell then
|
|
||||||
self.modules["Cooldowns"]:DetectSpec(unit, specSpell)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function Gladdy:SpotEnemy(unit, auraScan)
|
function Gladdy:SpotEnemy(unit, auraScan)
|
||||||
local button = self.buttons[unit]
|
local button = self.buttons[unit]
|
||||||
|
if not unit or not button then
|
||||||
|
return
|
||||||
|
end
|
||||||
button.raceLoc = UnitRace(unit)
|
button.raceLoc = UnitRace(unit)
|
||||||
button.race = select(2, UnitRace(unit))
|
button.race = select(2, UnitRace(unit))
|
||||||
button.classLoc = select(1, UnitClass(unit))
|
button.classLoc = select(1, UnitClass(unit))
|
||||||
@ -55,17 +64,30 @@ function Gladdy:SpotEnemy(unit, auraScan)
|
|||||||
button.name = UnitName(unit)
|
button.name = UnitName(unit)
|
||||||
button.stealthed = false
|
button.stealthed = false
|
||||||
Gladdy.guids[UnitGUID(unit)] = unit
|
Gladdy.guids[UnitGUID(unit)] = unit
|
||||||
Gladdy:SendMessage("ENEMY_SPOTTED", unit)
|
if button.class and button.race then
|
||||||
|
Gladdy:SendMessage("ENEMY_SPOTTED", unit)
|
||||||
|
end
|
||||||
if auraScan and not button.spec then
|
if auraScan and not button.spec then
|
||||||
for n = 1, 30 do
|
for n = 1, 30 do
|
||||||
local spellName,_,_,_,_,_,unitCaster = UnitAura(unit, n, "HELPFUL")
|
local spellName,_,_,_,_,expirationTime,unitCaster = UnitAura(unit, n, "HELPFUL")
|
||||||
if ( not spellName ) then
|
if ( not spellName ) then
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if Gladdy.specBuffs[spellName] then
|
if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that detect used CDs (like Fear Ward)
|
||||||
|
for arenaUnit,v in pairs(self.buttons) do
|
||||||
|
if (UnitIsUnit(arenaUnit, unitCaster)) then
|
||||||
|
Cooldowns:CooldownUsed(arenaUnit, v.class, Gladdy.cooldownBuffs[spellName].spellId, Gladdy.cooldownBuffs[spellName].cd(expirationTime - GetTime()))
|
||||||
|
-- /run LibStub("Gladdy").modules["Cooldowns"]:CooldownUsed("arena5", "PRIEST", 6346, 10)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
|
||||||
|
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
|
||||||
|
end
|
||||||
|
if Gladdy.specBuffs[spellName] and unitCaster then -- Check for auras that detect a spec
|
||||||
local unitPet = string_gsub(unit, "%d$", "pet%1")
|
local unitPet = string_gsub(unit, "%d$", "pet%1")
|
||||||
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
|
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
|
||||||
Gladdy:DetectSpec(unit, Gladdy.specBuffs[spellName])
|
EventListener:DetectSpec(unit, Gladdy.specBuffs[spellName])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -75,28 +97,35 @@ end
|
|||||||
function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
|
function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
|
||||||
-- timestamp,eventType,hideCaster,sourceGUID,sourceName,sourceFlags,sourceRaidFlags,destGUID,destName,destFlags,destRaidFlags,spellId,spellName,spellSchool
|
-- timestamp,eventType,hideCaster,sourceGUID,sourceName,sourceFlags,sourceRaidFlags,destGUID,destName,destFlags,destRaidFlags,spellId,spellName,spellSchool
|
||||||
local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool = CombatLogGetCurrentEventInfo()
|
local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool = CombatLogGetCurrentEventInfo()
|
||||||
local srcUnit = Gladdy.guids[sourceGUID]
|
local srcUnit = Gladdy.guids[sourceGUID] -- can be a PET
|
||||||
local destUnit = Gladdy.guids[destGUID]
|
local destUnit = Gladdy.guids[destGUID] -- can be a PET
|
||||||
|
if (Gladdy.db.shadowsightTimerEnabled and eventType == "SPELL_AURA_APPLIED" and spellID == 34709) then
|
||||||
|
Gladdy.modules["Shadowsight Timer"]:AURA_GAIN(nil, nil, 34709)
|
||||||
|
end
|
||||||
|
|
||||||
if destUnit then
|
if destUnit then
|
||||||
-- diminish tracker
|
-- diminish tracker
|
||||||
if (Gladdy.db.drEnabled and (eventType == "SPELL_AURA_REMOVED" or eventType == "SPELL_AURA_REFRESH")) then
|
if Gladdy.buttons[destUnit] and (Gladdy.db.drEnabled and (eventType == "SPELL_AURA_REMOVED" or eventType == "SPELL_AURA_REFRESH")) then
|
||||||
Diminishings:AuraFade(destUnit, spellID)
|
Diminishings:AuraFade(destUnit, spellID)
|
||||||
end
|
end
|
||||||
-- death detection
|
-- death detection
|
||||||
if (eventType == "UNIT_DIED" or eventType == "PARTY_KILL" or eventType == "SPELL_INSTAKILL") then
|
if (Gladdy.buttons[destUnit] and eventType == "UNIT_DIED" or eventType == "PARTY_KILL" or eventType == "SPELL_INSTAKILL") then
|
||||||
Gladdy:SendMessage("UNIT_DEATH", destUnit)
|
Gladdy:SendMessage("UNIT_DEATH", destUnit)
|
||||||
end
|
end
|
||||||
-- spec detection
|
-- spec detection
|
||||||
if not Gladdy.buttons[destUnit].class then
|
if Gladdy.buttons[destUnit] and (not Gladdy.buttons[destUnit].class or not Gladdy.buttons[destUnit].race) then
|
||||||
Gladdy:SpotEnemy(destUnit, true)
|
Gladdy:SpotEnemy(destUnit, true)
|
||||||
end
|
end
|
||||||
--interrupt detection
|
--interrupt detection
|
||||||
if eventType == "SPELL_INTERRUPT" then
|
if Gladdy.buttons[destUnit] and eventType == "SPELL_INTERRUPT" then
|
||||||
Gladdy:SendMessage("SPELL_INTERRUPT", destUnit,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool)
|
Gladdy:SendMessage("SPELL_INTERRUPT", destUnit,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if srcUnit then
|
if srcUnit then
|
||||||
|
srcUnit = string_gsub(srcUnit, "pet", "")
|
||||||
|
if (not UnitExists(srcUnit)) then
|
||||||
|
return
|
||||||
|
end
|
||||||
if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED") then
|
if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED") then
|
||||||
local unitRace = Gladdy.buttons[srcUnit].race
|
local unitRace = Gladdy.buttons[srcUnit].race
|
||||||
-- cooldown tracker
|
-- cooldown tracker
|
||||||
@ -109,8 +138,8 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
|
|||||||
else
|
else
|
||||||
unitClass = Gladdy.buttons[srcUnit].race
|
unitClass = Gladdy.buttons[srcUnit].race
|
||||||
end
|
end
|
||||||
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId, spellName)
|
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId)
|
||||||
Gladdy:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
|
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -119,11 +148,11 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if not Gladdy.buttons[srcUnit].class then
|
if not Gladdy.buttons[srcUnit].class or not Gladdy.buttons[srcUnit].race then
|
||||||
Gladdy:SpotEnemy(srcUnit, true)
|
Gladdy:SpotEnemy(srcUnit, true)
|
||||||
end
|
end
|
||||||
if not Gladdy.buttons[srcUnit].spec then
|
if not Gladdy.buttons[srcUnit].spec then
|
||||||
Gladdy:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
|
self:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -138,7 +167,7 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
|
|||||||
-- ENEMY_SPOTTED
|
-- ENEMY_SPOTTED
|
||||||
if button then
|
if button then
|
||||||
Gladdy:SendMessage("ENEMY_STEALTH", unit, false)
|
Gladdy:SendMessage("ENEMY_STEALTH", unit, false)
|
||||||
if not button.class then
|
if not button.class or not button.race then
|
||||||
Gladdy:SpotEnemy(unit, true)
|
Gladdy:SpotEnemy(unit, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -167,7 +196,7 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local exceptionNames = { -- TODO MOVE ME TO CLASSBUFFS LIB
|
Gladdy.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
|
||||||
@ -183,13 +212,33 @@ local exceptionNames = { -- TODO MOVE ME TO CLASSBUFFS LIB
|
|||||||
[27010] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
[27010] = select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Gladdy.cooldownBuffs = {
|
||||||
|
[GetSpellInfo(6346)] = { cd = function(expTime) -- 180s uptime == cd
|
||||||
|
return expTime
|
||||||
|
end, spellId = 6346 }, -- Fear Ward
|
||||||
|
[GetSpellInfo(11305)] = { cd = function(expTime) -- 15s uptime
|
||||||
|
return 180 - (15 - expTime)
|
||||||
|
end, spellId = 11305 }, -- Sprint
|
||||||
|
[GetSpellInfo(36554)] = { cd = function(expTime) -- 3s uptime
|
||||||
|
return 30 - (3 - expTime)
|
||||||
|
end, spellId = 36554 }, -- Shadowstep
|
||||||
|
[GetSpellInfo(26889)] = { cd = function(expTime) -- 3s uptime
|
||||||
|
return 180 - (10 - expTime)
|
||||||
|
end, spellId = 26889 }, -- Vanish
|
||||||
|
racials = {
|
||||||
|
[GetSpellInfo(20600)] = { cd = function(expTime) -- 20s uptime
|
||||||
|
return GetTime() - (20 - expTime)
|
||||||
|
end, spellId = 20600 }, -- Perception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function EventListener:UNIT_AURA(unit)
|
function EventListener:UNIT_AURA(unit)
|
||||||
local button = Gladdy.buttons[unit]
|
local button = Gladdy.buttons[unit]
|
||||||
if not button then
|
if not button then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i = 1, 2 do
|
for i = 1, 2 do
|
||||||
if not Gladdy.buttons[unit].class then
|
if not Gladdy.buttons[unit].class or not Gladdy.buttons[unit].race then
|
||||||
Gladdy:SpotEnemy(unit, false)
|
Gladdy:SpotEnemy(unit, false)
|
||||||
end
|
end
|
||||||
local filter = (i == 1 and "HELPFUL" or "HARMFUL")
|
local filter = (i == 1 and "HELPFUL" or "HARMFUL")
|
||||||
@ -201,17 +250,26 @@ function EventListener:UNIT_AURA(unit)
|
|||||||
Gladdy:SendMessage("AURA_GAIN_LIMIT", unit, auraType, n - 1)
|
Gladdy:SendMessage("AURA_GAIN_LIMIT", unit, auraType, n - 1)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
if not button.spec and Gladdy.specBuffs[spellName] then
|
if Gladdy.cooldownBuffs[spellName] and unitCaster then -- Check for auras that hint used CDs (like Fear Ward)
|
||||||
local unitPet = string_gsub(unit, "%d$", "pet%1")
|
for arenaUnit,v in pairs(Gladdy.buttons) do
|
||||||
if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
|
if (UnitIsUnit(arenaUnit, unitCaster)) then
|
||||||
Gladdy:DetectSpec(unit, Gladdy.specBuffs[spellName])
|
Cooldowns:CooldownUsed(arenaUnit, v.class, Gladdy.cooldownBuffs[spellName].spellId, Gladdy.cooldownBuffs[spellName].cd(expirationTime - GetTime()))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if exceptionNames[spellID] then
|
if Gladdy.cooldownBuffs.racials[spellName] and Gladdy.cooldownBuffs.racials[spellName] then
|
||||||
spellName = exceptionNames[spellID]
|
Gladdy:SendMessage("RACIAL_USED", unit, spellName, Gladdy.cooldownBuffs.racials[spellName].cd(expirationTime - GetTime()), spellName)
|
||||||
|
end
|
||||||
|
if not button.spec and Gladdy.specBuffs[spellName] and unitCaster then
|
||||||
|
local unitPet = string_gsub(unit, "%d$", "pet%1")
|
||||||
|
if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
|
||||||
|
self:DetectSpec(unit, Gladdy.specBuffs[spellName])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Gladdy.exceptionNames[spellID] then
|
||||||
|
spellName = Gladdy.exceptionNames[spellID]
|
||||||
end
|
end
|
||||||
Gladdy:SendMessage("AURA_GAIN", unit, auraType, spellID, spellName, texture, duration, expirationTime, count, debuffType, i)
|
Gladdy:SendMessage("AURA_GAIN", unit, auraType, spellID, spellName, texture, duration, expirationTime, count, debuffType, i)
|
||||||
Gladdy:Call("Announcements", "CheckDrink", unit, spellName)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -220,7 +278,7 @@ function EventListener:UNIT_SPELLCAST_START(unit)
|
|||||||
if Gladdy.buttons[unit] then
|
if Gladdy.buttons[unit] then
|
||||||
local spellName = UnitCastingInfo(unit)
|
local spellName = UnitCastingInfo(unit)
|
||||||
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
||||||
Gladdy:DetectSpec(unit, Gladdy.specSpells[spellName])
|
self:DetectSpec(unit, Gladdy.specSpells[spellName])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -229,7 +287,7 @@ function EventListener:UNIT_SPELLCAST_CHANNEL_START(unit)
|
|||||||
if Gladdy.buttons[unit] then
|
if Gladdy.buttons[unit] then
|
||||||
local spellName = UnitChannelInfo(unit)
|
local spellName = UnitChannelInfo(unit)
|
||||||
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
||||||
Gladdy:DetectSpec(unit, Gladdy.specSpells[spellName])
|
self:DetectSpec(unit, Gladdy.specSpells[spellName])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -238,7 +296,46 @@ function EventListener:UNIT_SPELLCAST_SUCCEEDED(unit)
|
|||||||
if Gladdy.buttons[unit] then
|
if Gladdy.buttons[unit] then
|
||||||
local spellName = UnitCastingInfo(unit)
|
local spellName = UnitCastingInfo(unit)
|
||||||
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
if Gladdy.specSpells[spellName] and not Gladdy.buttons[unit].spec then
|
||||||
Gladdy:DetectSpec(unit, Gladdy.specSpells[spellName])
|
self:DetectSpec(unit, Gladdy.specSpells[spellName])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function notIn(spec, list)
|
||||||
|
for _,v in ipairs(list) do
|
||||||
|
if spec == v then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
function EventListener:DetectSpec(unit, spec)
|
||||||
|
local button = Gladdy.buttons[unit]
|
||||||
|
if (not button or not spec or button.spec) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if button.class == "PALADIN" and notIn(spec, {L["Holy"], L["Retribution"], L["Protection"]})
|
||||||
|
or button.class == "SHAMAN" and notIn(spec, {L["Restoration"], L["Enhancement"], L["Elemental"]})
|
||||||
|
or button.class == "ROGUE" and notIn(spec, {L["Subtlety"], L["Assassination"], L["Combat"]})
|
||||||
|
or button.class == "WARLOCK" and notIn(spec, {L["Demonology"], L["Destruction"], L["Affliction"]})
|
||||||
|
or button.class == "PRIEST" and notIn(spec, {L["Shadow"], L["Discipline"], L["Holy"]})
|
||||||
|
or button.class == "MAGE" and notIn(spec, {L["Frost"], L["Fire"], L["Arcane"]})
|
||||||
|
or button.class == "DRUID" and notIn(spec, {L["Restoration"], L["Feral"], L["Balance"]})
|
||||||
|
or button.class == "HUNTER" and notIn(spec, {L["Beast Mastery"], L["Marksmanship"], L["Survival"]})
|
||||||
|
or button.class == "WARRIOR" and notIn(spec, {L["Arms"], L["Protection"], L["Fury"]}) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not button.spec then
|
||||||
|
button.spec = spec
|
||||||
|
Gladdy:SendMessage("UNIT_SPEC", unit, spec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function EventListener:Test(unit)
|
||||||
|
local button = Gladdy.buttons[unit]
|
||||||
|
if (Gladdy.testData[unit].testSpec) then
|
||||||
|
button.spec = nil
|
||||||
|
self:DetectSpec(unit, button.testSpec)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
335
Frame.lua
335
Frame.lua
@ -1,6 +1,9 @@
|
|||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local UIParent = UIParent
|
local UIParent = UIParent
|
||||||
local InCombatLockdown = InCombatLockdown
|
local InCombatLockdown = InCombatLockdown
|
||||||
|
local math_abs = math.abs
|
||||||
|
local pairs = pairs
|
||||||
|
local LibStub = LibStub
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
@ -32,6 +35,12 @@ Gladdy.BUTTON_DEFAULTS = {
|
|||||||
|
|
||||||
function Gladdy:CreateFrame()
|
function Gladdy:CreateFrame()
|
||||||
self.frame = CreateFrame("Frame", "GladdyFrame", UIParent)
|
self.frame = CreateFrame("Frame", "GladdyFrame", UIParent)
|
||||||
|
|
||||||
|
self.frame.background = CreateFrame("Frame", nil, self.frame, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
|
self.frame.background:SetBackdrop({bgFile = "Interface\\Tooltips\\UI-Tooltip-Background", tile = false, tileSize = 16})
|
||||||
|
self.frame.background:SetFrameStrata("BACKGROUND")
|
||||||
|
self.frame.background:SetBackdropColor(Gladdy:SetColor(self.db.backgroundColor))
|
||||||
|
self.frame.background:SetAllPoints(self.frame)
|
||||||
--self.frame.texture = self.frame:CreateTexture(nil, "OVERLAY")
|
--self.frame.texture = self.frame:CreateTexture(nil, "OVERLAY")
|
||||||
--self.frame.texture:SetAllPoints(self.frame)
|
--self.frame.texture:SetAllPoints(self.frame)
|
||||||
--self.frame.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
|
--self.frame.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
|
||||||
@ -39,7 +48,7 @@ function Gladdy:CreateFrame()
|
|||||||
self.frame:SetClampedToScreen(true)
|
self.frame:SetClampedToScreen(true)
|
||||||
self.frame:EnableMouse(false)
|
self.frame:EnableMouse(false)
|
||||||
self.frame:SetMovable(true)
|
self.frame:SetMovable(true)
|
||||||
self.frame:RegisterForDrag("LeftButton")
|
--self.frame:RegisterForDrag("LeftButton")
|
||||||
|
|
||||||
self.frame:SetScript("OnDragStart", function(f)
|
self.frame:SetScript("OnDragStart", function(f)
|
||||||
if (not InCombatLockdown() and not self.db.locked) then
|
if (not InCombatLockdown() and not self.db.locked) then
|
||||||
@ -52,7 +61,7 @@ function Gladdy:CreateFrame()
|
|||||||
|
|
||||||
local scale = f:GetEffectiveScale()
|
local scale = f:GetEffectiveScale()
|
||||||
self.db.x = f:GetLeft() * scale
|
self.db.x = f:GetLeft() * scale
|
||||||
self.db.y = (self.db.growUp and f:GetBottom() or f:GetTop()) * scale
|
self.db.y = (self.db.growDirection == "TOP" and f:GetBottom() or f:GetTop()) * scale
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@ -76,7 +85,7 @@ function Gladdy:CreateFrame()
|
|||||||
|
|
||||||
local scale = self.frame:GetEffectiveScale()
|
local scale = self.frame:GetEffectiveScale()
|
||||||
self.db.x = self.frame:GetLeft() * scale
|
self.db.x = self.frame:GetLeft() * scale
|
||||||
self.db.y = (self.db.growUp and self.frame:GetBottom() or self.frame:GetTop()) * scale
|
self.db.y = (self.db.growDirection == "TOP" and self.frame:GetBottom() or self.frame:GetTop()) * scale
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
self.anchor:SetScript("OnClick", function()
|
self.anchor:SetScript("OnClick", function()
|
||||||
@ -120,94 +129,53 @@ function Gladdy:UpdateFrame()
|
|||||||
|
|
||||||
local highlightBorderSize = (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2)
|
local highlightBorderSize = (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2)
|
||||||
local powerBarHeight = self.db.powerBarEnabled and (self.db.powerBarHeight + 1) or 0
|
local powerBarHeight = self.db.powerBarEnabled and (self.db.powerBarHeight + 1) or 0
|
||||||
local leftSize = 0
|
|
||||||
local rightSize = 0
|
|
||||||
--Trinket + Racial
|
|
||||||
if self.db.trinketEnabled and self.db.trinketPos == "LEFT" then
|
|
||||||
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
|
|
||||||
|
|
||||||
local margin = powerBarHeight
|
local margin = powerBarHeight
|
||||||
local width = self.db.barWidth + leftSize + rightSize
|
|
||||||
local height = (self.db.healthBarHeight + powerBarHeight) * teamSize
|
local height = (self.db.healthBarHeight + powerBarHeight) * teamSize
|
||||||
+ (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize)
|
+ (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize)
|
||||||
+ self.db.bottomMargin * (teamSize - 1)
|
+ self.db.bottomMargin * (teamSize - 1)
|
||||||
|
local singleFrameHeight = self.db.healthBarHeight + powerBarHeight +
|
||||||
|
(self.db.highlightInset and 0 or self.db.highlightBorderSize * 2) + self.db.bottomMargin
|
||||||
|
|
||||||
-- Highlight
|
-- Highlight
|
||||||
margin = margin + highlightBorderSize
|
margin = margin + highlightBorderSize
|
||||||
|
margin, height = Gladdy:LegacyPositioning(margin, height, teamSize)
|
||||||
if (self.db.cooldownYPos == "TOP" or self.db.cooldownYPos == "BOTTOM") and self.db.cooldown then
|
|
||||||
margin = margin + self.db.cooldownSize
|
|
||||||
height = height + self.db.cooldownSize * (teamSize - 1)
|
|
||||||
end
|
|
||||||
if (self.db.buffsCooldownPos == "TOP" or self.db.buffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
|
|
||||||
margin = margin + self.db.buffsIconSize
|
|
||||||
height = height + self.db.buffsIconSize * (teamSize - 1)
|
|
||||||
end
|
|
||||||
if (self.db.buffsBuffsCooldownPos == "TOP" or self.db.buffsBuffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
|
|
||||||
margin = margin + self.db.buffsBuffsIconSize
|
|
||||||
height = height + self.db.buffsBuffsIconSize * (teamSize - 1)
|
|
||||||
end
|
|
||||||
if self.db.buffsCooldownPos == "TOP" and self.db.cooldownYPos == "TOP" and self.db.cooldown and self.db.buffsEnabled then
|
|
||||||
margin = margin + 1
|
|
||||||
height = height + (teamSize - 1)
|
|
||||||
end
|
|
||||||
if self.db.buffsCooldownPos == "BOTTOM" and self.db.cooldownYPos == "BOTTOM" and self.db.cooldown and self.db.buffsEnabled then
|
|
||||||
margin = margin + 1
|
|
||||||
height = height + (teamSize - 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- GrowDirection
|
-- GrowDirection
|
||||||
if (self.db.growDirection == "LEFT" or self.db.growDirection == "RIGHT") then
|
if (self.db.growDirection == "LEFT" or self.db.growDirection == "RIGHT") then
|
||||||
width = self.db.barWidth * teamSize + (leftSize + rightSize) * teamSize + self.db.bottomMargin * (teamSize - 1)
|
|
||||||
height = self.db.healthBarHeight + powerBarHeight
|
height = self.db.healthBarHeight + powerBarHeight
|
||||||
end
|
end
|
||||||
|
|
||||||
self.frame:SetScale(self.db.frameScale)
|
self.frame:SetScale(self.db.frameScale)
|
||||||
self.frame:SetWidth(width)
|
self:PixelPerfectScale(false)
|
||||||
|
self.frame:SetWidth(self.db.barWidth + highlightBorderSize)
|
||||||
self.frame:SetHeight(height)
|
self.frame:SetHeight(height)
|
||||||
--self.frame:SetBackdropColor(self.db.frameColor.r, self.db.frameColor.g, self.db.frameColor.b, self.db.frameColor.a)
|
self.frame:ClearAllPoints()
|
||||||
|
self.frame.background:SetBackdropColor(Gladdy:SetColor(self.db.backgroundColor))
|
||||||
self.frame:ClearAllPoints()
|
self.frame:ClearAllPoints()
|
||||||
if (self.db.x == 0 and self.db.y == 0) then
|
if (self.db.x == 0 and self.db.y == 0) then
|
||||||
self.frame:SetPoint("CENTER")
|
self.frame:SetPoint("CENTER")
|
||||||
else
|
else
|
||||||
local scale = self.frame:GetEffectiveScale()
|
local scale = self.frame:GetEffectiveScale()
|
||||||
|
local growMiddle = self.db.growMiddle and teamSize > 0 and teamSize / 2 >= 1 and (teamSize - 1) * (singleFrameHeight / 2) or 0
|
||||||
if (self.db.growDirection == "TOP") 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) - growMiddle)
|
||||||
|
elseif self.db.growDirection == "BOTTOM" then
|
||||||
|
self.frame:SetPoint("TOPLEFT", UIParent, "BOTTOMLEFT", self.db.x / scale, (self.db.y / scale) + growMiddle)
|
||||||
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
|
--Anchor
|
||||||
self.anchor:SetWidth(width)
|
self.anchor:SetWidth(self.db.barWidth * 2 + highlightBorderSize)
|
||||||
self.anchor:ClearAllPoints()
|
self.anchor:ClearAllPoints()
|
||||||
if (self.db.growDirection == "TOP") then
|
if (self.db.growDirection == "TOP") then
|
||||||
self.anchor:SetPoint("TOPLEFT", self.frame, "BOTTOMLEFT")
|
self.anchor:SetPoint("TOP", self.frame, "BOTTOM")
|
||||||
elseif self.growDirection == "BOTTOM" or self.growDirection == "RIGHT" then
|
elseif self.growDirection == "BOTTOM" or self.growDirection == "RIGHT" then
|
||||||
self.anchor:SetPoint("BOTTOMLEFT", self.frame, "TOPLEFT")
|
self.anchor:SetPoint("BOTTOM", self.frame, "TOP")
|
||||||
else
|
else
|
||||||
self.anchor:SetPoint("BOTTOMRIGHT", self.frame, "TOPRIGHT")
|
self.anchor:SetPoint("BOTTOM", self.frame, "TOP")
|
||||||
end
|
end
|
||||||
|
|
||||||
if (self.db.locked) then
|
if (self.db.locked) then
|
||||||
@ -227,7 +195,7 @@ function Gladdy:UpdateFrame()
|
|||||||
button.secure:ClearAllPoints()
|
button.secure:ClearAllPoints()
|
||||||
if (self.db.growDirection == "TOP") then
|
if (self.db.growDirection == "TOP") then
|
||||||
if (i == 1) then
|
if (i == 1) then
|
||||||
button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, powerBarHeight)
|
button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", 0, powerBarHeight)
|
||||||
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
button.secure:SetPoint("TOPLEFT", button.healthBar, "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)
|
||||||
@ -235,7 +203,7 @@ function Gladdy:UpdateFrame()
|
|||||||
end
|
end
|
||||||
elseif (self.db.growDirection == "BOTTOM") then
|
elseif (self.db.growDirection == "BOTTOM") then
|
||||||
if (i == 1) then
|
if (i == 1) then
|
||||||
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0)
|
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, 0)
|
||||||
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
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)
|
||||||
@ -243,18 +211,18 @@ function Gladdy:UpdateFrame()
|
|||||||
end
|
end
|
||||||
elseif (self.db.growDirection == "LEFT") then
|
elseif (self.db.growDirection == "LEFT") then
|
||||||
if (i == 1) then
|
if (i == 1) then
|
||||||
button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -rightSize, 0)
|
button:SetPoint("TOPRIGHT", self.frame, "TOPRIGHT", -0, 0)
|
||||||
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
||||||
else
|
else
|
||||||
button:SetPoint("TOPRIGHT", self.buttons["arena" .. (i - 1)], "TOPLEFT", -rightSize - leftSize - self.db.bottomMargin, 0)
|
button:SetPoint("TOPRIGHT", self.buttons["arena" .. (i - 1)], "TOPLEFT", - self.db.bottomMargin, 0)
|
||||||
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
||||||
end
|
end
|
||||||
elseif (self.db.growDirection == "RIGHT") then
|
elseif (self.db.growDirection == "RIGHT") then
|
||||||
if (i == 1) then
|
if (i == 1) then
|
||||||
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", leftSize, 0)
|
button:SetPoint("TOPLEFT", self.frame, "TOPLEFT", 0, 0)
|
||||||
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
||||||
else
|
else
|
||||||
button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "TOPRIGHT", leftSize + rightSize + self.db.bottomMargin, 0)
|
button:SetPoint("TOPLEFT", self.buttons["arena" .. (i - 1)], "TOPRIGHT", self.db.bottomMargin, 0)
|
||||||
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -267,11 +235,50 @@ function Gladdy:UpdateFrame()
|
|||||||
for _, v in self:IterModules() do
|
for _, v in self:IterModules() do
|
||||||
self:Call(v, "UpdateFrameOnce")
|
self:Call(v, "UpdateFrameOnce")
|
||||||
end
|
end
|
||||||
|
if Gladdy.db.hideBlizzard == "always" then
|
||||||
|
Gladdy:BlizzArenaSetAlpha(0)
|
||||||
|
elseif Gladdy.db.hideBlizzard == "arena" then
|
||||||
|
if Gladdy.curBracket then
|
||||||
|
Gladdy:BlizzArenaSetAlpha(0)
|
||||||
|
else
|
||||||
|
Gladdy:BlizzArenaSetAlpha(1)
|
||||||
|
end
|
||||||
|
elseif Gladdy.db.hideBlizzard == "never" then
|
||||||
|
Gladdy:BlizzArenaSetAlpha(1)
|
||||||
|
end
|
||||||
|
if (not Gladdy.db.newLayout) then
|
||||||
|
Gladdy.db.newLayout = true
|
||||||
|
--get margin
|
||||||
|
local arena1Bottom
|
||||||
|
local arena2Top
|
||||||
|
if (self.db.growDirection == "BOTTOM") then
|
||||||
|
arena1Bottom = self.buttons["arena1"].secure:GetBottom()
|
||||||
|
arena2Top = self.buttons["arena2"].secure:GetTop()
|
||||||
|
elseif (self.db.growDirection == "TOP") then
|
||||||
|
arena1Bottom = self.buttons["arena1"].secure:GetTop()
|
||||||
|
arena2Top = self.buttons["arena2"].secure:GetBottom()
|
||||||
|
elseif (self.db.growDirection == "LEFT") then
|
||||||
|
arena1Bottom = self.buttons["arena1"].secure:GetLeft()
|
||||||
|
arena2Top = self.buttons["arena2"].secure:GetRight()
|
||||||
|
elseif (self.db.growDirection == "RIGHT") then
|
||||||
|
arena1Bottom = self.buttons["arena1"].secure:GetRight()
|
||||||
|
arena2Top = self.buttons["arena2"].secure:GetLeft()
|
||||||
|
end
|
||||||
|
Gladdy.db.bottomMargin = math_abs(arena1Bottom - arena2Top)
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Gladdy:HideFrame()
|
function Gladdy:HideFrame()
|
||||||
if (self.frame) then
|
if (self.frame) then
|
||||||
self.frame:Hide()
|
if InCombatLockdown() then
|
||||||
|
self.startTest = nil
|
||||||
|
self.hideFrame = true
|
||||||
|
else
|
||||||
|
self:Reset()
|
||||||
|
self.frame:Hide()
|
||||||
|
end
|
||||||
|
|
||||||
self.frame.testing = nil
|
self.frame.testing = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -279,6 +286,7 @@ end
|
|||||||
function Gladdy:ToggleFrame(i)
|
function Gladdy:ToggleFrame(i)
|
||||||
self:Reset()
|
self:Reset()
|
||||||
if (self.frame and self.frame:IsShown() and i == self.curBracket) then
|
if (self.frame and self.frame:IsShown() and i == self.curBracket) then
|
||||||
|
self.frame.testing = nil
|
||||||
self:HideFrame()
|
self:HideFrame()
|
||||||
else
|
else
|
||||||
self.curBracket = i
|
self.curBracket = i
|
||||||
@ -286,6 +294,7 @@ function Gladdy:ToggleFrame(i)
|
|||||||
if (not self.frame) then
|
if (not self.frame) then
|
||||||
self:CreateFrame()
|
self:CreateFrame()
|
||||||
end
|
end
|
||||||
|
self.frame.testing = true
|
||||||
|
|
||||||
for o = 1, self.curBracket do
|
for o = 1, self.curBracket do
|
||||||
local unit = "arena" .. o
|
local unit = "arena" .. o
|
||||||
@ -296,8 +305,14 @@ function Gladdy:ToggleFrame(i)
|
|||||||
self:Reset()
|
self:Reset()
|
||||||
self.curBracket = i
|
self.curBracket = i
|
||||||
self:UpdateFrame()
|
self:UpdateFrame()
|
||||||
self:Test()
|
if InCombatLockdown() then
|
||||||
self.frame:Show()
|
Gladdy:Print("Gladdy frames show as soon as you leave combat")
|
||||||
|
self.showFrame = true
|
||||||
|
self.startTest = true
|
||||||
|
else
|
||||||
|
self:Test()
|
||||||
|
self.frame:Show()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -347,6 +362,188 @@ function Gladdy:CreateButton(i)
|
|||||||
self:ResetButton("arena" .. i)
|
self:ResetButton("arena" .. i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function Gladdy:SetPosition(frame, unit, xOffsetDB, yOffsetDB, newLayout, module)
|
||||||
|
local button = self.buttons[unit]
|
||||||
|
if not button or not frame or not xOffsetDB or not yOffsetDB then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not newLayout) then
|
||||||
|
--Gladdy:Debug("INFO", name, "old X/Y:", frame:GetCenter())
|
||||||
|
local xOffset, yOffset = frame:GetLeft(), frame:GetTop()
|
||||||
|
if not xOffset or not yOffset then
|
||||||
|
xOffset = frame:GetCenter()-- - frame:GetWidth()/2
|
||||||
|
yOffset = select(2, frame:GetCenter())-- + frame:GetHeight()/2
|
||||||
|
end
|
||||||
|
local x,y = button.healthBar:GetLeft(), button.healthBar:GetTop()
|
||||||
|
local newXOffset = math_abs(x - xOffset) * (x > xOffset and -1 or 1)
|
||||||
|
local newYOffset = math_abs(y - yOffset) * (y > yOffset and -1 or 1)
|
||||||
|
frame:ClearAllPoints()
|
||||||
|
frame:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", newXOffset, newYOffset)
|
||||||
|
--Gladdy:Debug("INFO", name, "new X/Y:", frame:GetCenter())
|
||||||
|
if unit == "arena1" then
|
||||||
|
Gladdy.db[xOffsetDB] = newXOffset
|
||||||
|
Gladdy.db[yOffsetDB] = newYOffset
|
||||||
|
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
frame:ClearAllPoints()
|
||||||
|
frame:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", Gladdy.db[xOffsetDB], Gladdy.db[yOffsetDB])
|
||||||
|
end
|
||||||
|
if (self.newDefaults[module.name]) then
|
||||||
|
for k,v in pairs(self.newDefaults[module.name]) do
|
||||||
|
module.defaults[k] = v
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Gladdy:CreateMover(frame, xConfig, yConfig, name, points, width, height, xOffset, yOffset, activated)
|
||||||
|
if not frame.mover then
|
||||||
|
frame:EnableMouse(false)
|
||||||
|
frame:SetMovable(true)
|
||||||
|
frame.mover = CreateFrame("Frame", nil, frame, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
|
frame.mover:SetFrameStrata("TOOLTIP")
|
||||||
|
frame.mover:SetPoint(points[1], frame, points[2], xOffset or 0, yOffset or 0)
|
||||||
|
frame.mover:SetHeight(height or frame:GetHeight())
|
||||||
|
frame.mover:SetWidth(width or frame:GetWidth())
|
||||||
|
|
||||||
|
local backdrop = {
|
||||||
|
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
||||||
|
edgeFile = "",
|
||||||
|
tile = true, tileSize = 16, edgeSize = 10,
|
||||||
|
insets = {left = 0, right = 0, top = 0, bottom = 0}
|
||||||
|
}
|
||||||
|
frame.mover:SetBackdrop(backdrop)
|
||||||
|
frame.mover:SetBackdropColor(0,1,0,0.5)
|
||||||
|
frame.mover.border = CreateFrame("Frame", nil, frame.mover, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
|
frame.mover.border:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "highlightBorderStyle"), edgeSize = 2 })
|
||||||
|
frame.mover.border:SetAllPoints(frame.mover)
|
||||||
|
frame.mover.border:SetBackdropBorderColor(0,1,0,1)
|
||||||
|
frame.mover.border:SetFrameStrata("TOOLTIP")
|
||||||
|
|
||||||
|
frame.mover.text = frame.mover.border:CreateFontString(nil, "ARTWORK", "GameFontHighlightSmall")
|
||||||
|
frame.mover.text:SetText(name)
|
||||||
|
frame.mover.text:SetPoint("CENTER")
|
||||||
|
|
||||||
|
frame.mover:SetMovable(true)
|
||||||
|
frame.mover:EnableMouse(true)
|
||||||
|
|
||||||
|
frame.mover:SetScript("OnMouseDown", function(self)
|
||||||
|
self.point = { frame:GetPoint() }
|
||||||
|
self.start = { frame:GetCenter() }
|
||||||
|
frame:StartMoving()
|
||||||
|
self:StartMoving()
|
||||||
|
end)
|
||||||
|
frame.mover:SetScript("OnMouseUp", function(self)
|
||||||
|
frame:StopMovingOrSizing()
|
||||||
|
self:StopMovingOrSizing()
|
||||||
|
self.stop = { frame:GetCenter() }
|
||||||
|
local diffX = math_abs(self.start[1] - self.stop[1])
|
||||||
|
diffX = self.start[1] > self.stop[1] and -diffX or diffX
|
||||||
|
local diffY = math_abs(self.start[2] - self.stop[2])
|
||||||
|
diffY = self.start[2] > self.stop[2] and -diffY or diffY
|
||||||
|
frame:ClearAllPoints()
|
||||||
|
frame:SetPoint(self.point[1], self.point[2], self.point[3], self.point[4] + diffX, self.point[5] + diffY)
|
||||||
|
Gladdy.db[xConfig] = self.point[4] + diffX
|
||||||
|
Gladdy.db[yConfig] = self.point[5] + diffY
|
||||||
|
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
frame.mover:ClearAllPoints()
|
||||||
|
frame.mover:SetPoint(points[1], frame, points[2], xOffset or 0, yOffset or 0)
|
||||||
|
frame.mover:SetHeight(height or frame:GetHeight())
|
||||||
|
frame.mover:SetWidth(width or frame:GetWidth())
|
||||||
|
end
|
||||||
|
if self.frame and self.frame.testing and self.db.showMover then
|
||||||
|
if (activated ~= nil and not Gladdy.db[activated]) then
|
||||||
|
frame.mover:Hide()
|
||||||
|
else
|
||||||
|
frame.mover:Show()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
frame.mover:Hide()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY SUPPORT
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Gladdy:LegacyPositioning(margin, height, teamSize)
|
||||||
|
if not Gladdy.db.newLayout then
|
||||||
|
for k,v in pairs(Gladdy.legacy) do
|
||||||
|
if Gladdy.db[k] == nil then
|
||||||
|
Gladdy:Debug("INFO", "Gladdy:LegacyPositioning write", k,v)
|
||||||
|
Gladdy.db[k] = v
|
||||||
|
else
|
||||||
|
Gladdy:Debug("INFO", "Gladdy:LegacyPositioning found", k,v)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (self.db.cooldownYPos == "TOP" or self.db.cooldownYPos == "BOTTOM") and self.db.cooldown then
|
||||||
|
margin = margin + self.db.cooldownSize
|
||||||
|
height = height + self.db.cooldownSize * (teamSize - 1)
|
||||||
|
end
|
||||||
|
if (self.db.buffsCooldownPos == "TOP" or self.db.buffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
|
||||||
|
margin = margin + self.db.buffsIconSize
|
||||||
|
height = height + self.db.buffsIconSize * (teamSize - 1)
|
||||||
|
end
|
||||||
|
if (self.db.buffsBuffsCooldownPos == "TOP" or self.db.buffsBuffsCooldownPos == "BOTTOM") and self.db.buffsEnabled then
|
||||||
|
margin = margin + self.db.buffsBuffsIconSize
|
||||||
|
height = height + self.db.buffsBuffsIconSize * (teamSize - 1)
|
||||||
|
end
|
||||||
|
if self.db.buffsCooldownPos == "TOP" and self.db.cooldownYPos == "TOP" and self.db.cooldown and self.db.buffsEnabled then
|
||||||
|
margin = margin + 1
|
||||||
|
height = height + (teamSize - 1)
|
||||||
|
end
|
||||||
|
if self.db.buffsCooldownPos == "BOTTOM" and self.db.cooldownYPos == "BOTTOM" and self.db.cooldown and self.db.buffsEnabled then
|
||||||
|
margin = margin + 1
|
||||||
|
height = height + (teamSize - 1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return margin, height
|
||||||
|
end
|
||||||
|
|
||||||
|
function Gladdy:PositionButton(button, i, leftSize, rightSize, powerBarHeight, margin)
|
||||||
|
if (self.db.growDirection == "TOP") then
|
||||||
|
if (i == 1) then
|
||||||
|
button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, powerBarHeight)
|
||||||
|
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
||||||
|
else
|
||||||
|
button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin)
|
||||||
|
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
|
||||||
|
end
|
||||||
|
elseif (self.db.growDirection == "BOTTOM") 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)], "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
|
||||||
|
|
||||||
function Gladdy:GetAnchor(unit, position)
|
function Gladdy:GetAnchor(unit, position)
|
||||||
local anchor = "healthBar"
|
local anchor = "healthBar"
|
||||||
if Gladdy.db.classIconPos == position then
|
if Gladdy.db.classIconPos == position then
|
||||||
|
297
Gladdy.lua
297
Gladdy.lua
@ -5,15 +5,21 @@ local select = select
|
|||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local tinsert = table.insert
|
local tinsert = table.insert
|
||||||
local tsort = table.sort
|
local tsort = table.sort
|
||||||
|
local str_lower = string.lower
|
||||||
|
local GetTime = GetTime
|
||||||
|
local GetPhysicalScreenSize = GetPhysicalScreenSize
|
||||||
|
local InCombatLockdown = InCombatLockdown
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
|
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
|
||||||
local IsAddOnLoaded = IsAddOnLoaded
|
local IsAddOnLoaded = IsAddOnLoaded
|
||||||
local IsInInstance = IsInInstance
|
|
||||||
local GetBattlefieldStatus = GetBattlefieldStatus
|
local GetBattlefieldStatus = GetBattlefieldStatus
|
||||||
local IsActiveBattlefieldArena = IsActiveBattlefieldArena
|
local IsActiveBattlefieldArena = IsActiveBattlefieldArena
|
||||||
|
local IsInInstance = IsInInstance
|
||||||
|
local GetNumArenaOpponents = GetNumArenaOpponents
|
||||||
local RELEASE_TYPES = { alpha = "Alpha", beta = "Beta", release = "Release"}
|
local RELEASE_TYPES = { alpha = "Alpha", beta = "Beta", release = "Release"}
|
||||||
local PREFIX = "TBC-Classic_v"
|
local PREFIX = "Gladdy v"
|
||||||
local VERSION_REGEX = PREFIX .. "(%d+%.%d+)%-(%a)"
|
local VERSION_REGEX = PREFIX .. "(%d+%.%d+)%-(%a)"
|
||||||
|
local LibStub = LibStub
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
@ -21,16 +27,18 @@ local VERSION_REGEX = PREFIX .. "(%d+%.%d+)%-(%a)"
|
|||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
local MAJOR, MINOR = "Gladdy", 4
|
local MAJOR, MINOR = "Gladdy", 6
|
||||||
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
|
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
|
||||||
local L
|
local L
|
||||||
Gladdy.version_major_num = 1
|
Gladdy.version_major_num = 2
|
||||||
Gladdy.version_minor_num = 0.16
|
Gladdy.version_minor_num = 0.10
|
||||||
Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
|
Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
|
||||||
Gladdy.version_releaseType = RELEASE_TYPES.beta
|
Gladdy.version_releaseType = RELEASE_TYPES.release
|
||||||
Gladdy.version = PREFIX .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType
|
Gladdy.version = PREFIX .. string.format("%.2f", Gladdy.version_num) .. "-" .. Gladdy.version_releaseType
|
||||||
Gladdy.VERSION_REGEX = VERSION_REGEX
|
Gladdy.VERSION_REGEX = VERSION_REGEX
|
||||||
|
|
||||||
|
Gladdy.debug = false
|
||||||
|
|
||||||
LibStub("AceTimer-3.0"):Embed(Gladdy)
|
LibStub("AceTimer-3.0"):Embed(Gladdy)
|
||||||
LibStub("AceComm-3.0"):Embed(Gladdy)
|
LibStub("AceComm-3.0"):Embed(Gladdy)
|
||||||
Gladdy.modules = {}
|
Gladdy.modules = {}
|
||||||
@ -52,6 +60,17 @@ function Gladdy:Print(...)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Gladdy:Warn(...)
|
function Gladdy:Warn(...)
|
||||||
|
local text = "|cfff29f05Gladdy|r:"
|
||||||
|
local val
|
||||||
|
for i = 1, select("#", ...) do
|
||||||
|
val = select(i, ...)
|
||||||
|
if (type(val) == 'boolean') then val = val and "true" or false end
|
||||||
|
text = text .. " " .. tostring(val)
|
||||||
|
end
|
||||||
|
DEFAULT_CHAT_FRAME:AddMessage(text)
|
||||||
|
end
|
||||||
|
|
||||||
|
function Gladdy:Error(...)
|
||||||
local text = "|cfffc0303Gladdy|r:"
|
local text = "|cfffc0303Gladdy|r:"
|
||||||
local val
|
local val
|
||||||
for i = 1, select("#", ...) do
|
for i = 1, select("#", ...) do
|
||||||
@ -62,13 +81,38 @@ function Gladdy:Warn(...)
|
|||||||
DEFAULT_CHAT_FRAME:AddMessage(text)
|
DEFAULT_CHAT_FRAME:AddMessage(text)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Gladdy:Debug(lvl, ...)
|
||||||
|
if Gladdy.debug then
|
||||||
|
if lvl == "INFO" then
|
||||||
|
Gladdy:Print(...)
|
||||||
|
elseif lvl == "WARN" then
|
||||||
|
Gladdy:Warn(...)
|
||||||
|
elseif lvl == "ERROR" then
|
||||||
|
Gladdy:Error(...)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Gladdy.events = CreateFrame("Frame")
|
Gladdy.events = CreateFrame("Frame")
|
||||||
Gladdy.events.registered = {}
|
Gladdy.events.registered = {}
|
||||||
Gladdy.events:RegisterEvent("PLAYER_LOGIN")
|
Gladdy.events:RegisterEvent("PLAYER_LOGIN")
|
||||||
|
Gladdy.events:RegisterEvent("PLAYER_LOGOUT")
|
||||||
|
Gladdy.events:RegisterEvent("CVAR_UPDATE")
|
||||||
|
hooksecurefunc("VideoOptionsFrameOkay_OnClick", function(self, button, down, apply)
|
||||||
|
if (self:GetName() == "VideoOptionsFrameApply") then
|
||||||
|
Gladdy:PixelPerfectScale(true)
|
||||||
|
end
|
||||||
|
end)
|
||||||
Gladdy.events:SetScript("OnEvent", function(self, event, ...)
|
Gladdy.events:SetScript("OnEvent", function(self, event, ...)
|
||||||
if (event == "PLAYER_LOGIN") then
|
if (event == "PLAYER_LOGIN") then
|
||||||
Gladdy:OnInitialize()
|
Gladdy:OnInitialize()
|
||||||
Gladdy:OnEnable()
|
Gladdy:OnEnable()
|
||||||
|
elseif (event == "CVAR_UPDATE") then
|
||||||
|
if (str_lower(select(1, ...)) == "uiscale") then
|
||||||
|
Gladdy:PixelPerfectScale(true)
|
||||||
|
end
|
||||||
|
elseif (event == "PLAYER_LOGOUT") then
|
||||||
|
Gladdy:DeleteUnknownOptions(Gladdy.db, Gladdy.defaults.profile)
|
||||||
else
|
else
|
||||||
local func = self.registered[event]
|
local func = self.registered[event]
|
||||||
|
|
||||||
@ -131,8 +175,8 @@ function Gladdy:Call(module, func, ...)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Gladdy:SendMessage(message, ...)
|
function Gladdy:SendMessage(message, ...)
|
||||||
for k, v in self:IterModules() do
|
for _, module in self:IterModules() do
|
||||||
self:Call(v, v.messages[message], ...)
|
self:Call(module, module.messages[message], ...)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -143,10 +187,32 @@ function Gladdy:NewModule(name, priority, defaults)
|
|||||||
module.defaults = defaults or {}
|
module.defaults = defaults or {}
|
||||||
module.messages = {}
|
module.messages = {}
|
||||||
|
|
||||||
|
module.RegisterMessages = function(self, ...)
|
||||||
|
for _,message in pairs({...}) do
|
||||||
|
self.messages[message] = message
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module.RegisterMessage = function(self, message, func)
|
module.RegisterMessage = function(self, message, func)
|
||||||
self.messages[message] = func or message
|
self.messages[message] = func or message
|
||||||
end
|
end
|
||||||
|
|
||||||
|
module.UnregisterMessage = function(self, message)
|
||||||
|
self.messages[message] = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
module.UnregisterMessages = function(self, ...)
|
||||||
|
for _,message in pairs({...}) do
|
||||||
|
self.messages[message] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
module.UnregisterAllMessages = function(self)
|
||||||
|
for msg,_ in pairs(self.messages) do
|
||||||
|
self.messages[msg] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
module.GetOptions = function()
|
module.GetOptions = function()
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
@ -172,11 +238,11 @@ function Gladdy:DeleteUnknownOptions(tbl, refTbl, str)
|
|||||||
end
|
end
|
||||||
for k,v in pairs(tbl) do
|
for k,v in pairs(tbl) do
|
||||||
if refTbl[k] == nil then
|
if refTbl[k] == nil then
|
||||||
--Gladdy:Print("SavedVariable deleted:", str .. "." .. k, "not found!")
|
Gladdy:Debug("INFO", "SavedVariable deleted:", str .. "." .. k, "not found!")
|
||||||
tbl[k] = nil
|
tbl[k] = nil
|
||||||
else
|
else
|
||||||
if type(v) ~= type(refTbl[k]) then
|
if type(v) ~= type(refTbl[k]) then
|
||||||
--Gladdy:Print("SavedVariable deleted:", str .. "." .. k, "type error!", "Expected", type(refTbl[k]), "but found", type(v))
|
Gladdy:Debug("INFO", "SavedVariable deleted:", str .. "." .. k, "type error!", "Expected", type(refTbl[k]), "but found", type(v))
|
||||||
tbl[k] = nil
|
tbl[k] = nil
|
||||||
elseif type(v) == "table" then
|
elseif type(v) == "table" then
|
||||||
Gladdy:DeleteUnknownOptions(v, refTbl[k], str .. "." .. k)
|
Gladdy:DeleteUnknownOptions(v, refTbl[k], str .. "." .. k)
|
||||||
@ -185,11 +251,28 @@ function Gladdy:DeleteUnknownOptions(tbl, refTbl, str)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Gladdy:PixelPerfectScale(update)
|
||||||
|
local physicalWidth, physicalHeight = GetPhysicalScreenSize()
|
||||||
|
local perfectUIScale = 768.0/physicalHeight--768/select(2, strsplit("x",({ GetScreenResolutions()})[GetCurrentResolution()]))
|
||||||
|
if self.db and self.db.pixelPerfect and self.frame then
|
||||||
|
self.frame:SetIgnoreParentScale(true)
|
||||||
|
self.frame:SetScale(perfectUIScale)
|
||||||
|
--local adaptiveScale = (GetCVar("useUiScale") == "1" and 1.0 + perfectUIScale - GetCVar("UIScale") or perfectUIScale)
|
||||||
|
--self.frame:SetScale(adaptiveScale)
|
||||||
|
if update then
|
||||||
|
self:UpdateFrame()
|
||||||
|
end
|
||||||
|
elseif self.frame then
|
||||||
|
self.frame:SetScale(self.db.frameScale)
|
||||||
|
self.frame:SetIgnoreParentScale(false)
|
||||||
|
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")
|
||||||
self.dbi.RegisterCallback(self, "OnProfileCopied", "OnProfileChanged")
|
self.dbi.RegisterCallback(self, "OnProfileCopied", "OnProfileChanged")
|
||||||
self.dbi.RegisterCallback(self, "OnProfileReset", "OnProfileChanged")
|
self.dbi.RegisterCallback(self, "OnProfileReset", "OnProfileReset")
|
||||||
self.db = self.dbi.profile
|
self.db = self.dbi.profile
|
||||||
|
|
||||||
self.LSM = LibStub("LibSharedMedia-3.0")
|
self.LSM = LibStub("LibSharedMedia-3.0")
|
||||||
@ -197,6 +280,7 @@ function Gladdy:OnInitialize()
|
|||||||
self.LSM:Register("statusbar", "Smooth", "Interface\\AddOns\\Gladdy\\Images\\Smooth")
|
self.LSM:Register("statusbar", "Smooth", "Interface\\AddOns\\Gladdy\\Images\\Smooth")
|
||||||
self.LSM:Register("statusbar", "Minimalist", "Interface\\AddOns\\Gladdy\\Images\\Minimalist")
|
self.LSM:Register("statusbar", "Minimalist", "Interface\\AddOns\\Gladdy\\Images\\Minimalist")
|
||||||
self.LSM:Register("statusbar", "LiteStep", "Interface\\AddOns\\Gladdy\\Images\\LiteStep.tga")
|
self.LSM:Register("statusbar", "LiteStep", "Interface\\AddOns\\Gladdy\\Images\\LiteStep.tga")
|
||||||
|
self.LSM:Register("statusbar", "Flat", "Interface\\AddOns\\Gladdy\\Images\\UI-StatusBar")
|
||||||
self.LSM:Register("border", "Gladdy Tooltip round", "Interface\\AddOns\\Gladdy\\Images\\UI-Tooltip-Border_round_selfmade")
|
self.LSM:Register("border", "Gladdy Tooltip round", "Interface\\AddOns\\Gladdy\\Images\\UI-Tooltip-Border_round_selfmade")
|
||||||
self.LSM:Register("border", "Gladdy Tooltip squared", "Interface\\AddOns\\Gladdy\\Images\\UI-Tooltip-Border_square_selfmade")
|
self.LSM:Register("border", "Gladdy Tooltip squared", "Interface\\AddOns\\Gladdy\\Images\\UI-Tooltip-Border_square_selfmade")
|
||||||
self.LSM:Register("font", "DorisPP", "Interface\\AddOns\\Gladdy\\Images\\DorisPP.TTF")
|
self.LSM:Register("font", "DorisPP", "Interface\\AddOns\\Gladdy\\Images\\DorisPP.TTF")
|
||||||
@ -205,11 +289,11 @@ function Gladdy:OnInitialize()
|
|||||||
L = self.L
|
L = self.L
|
||||||
|
|
||||||
self.testData = {
|
self.testData = {
|
||||||
["arena1"] = { name = "Swift", raceLoc = L["Tauren"], classLoc = L["Warrior"], class = "WARRIOR", health = 9635, healthMax = 14207, power = 76, powerMax = 100, powerType = 1, testSpec = L["Arms"], race = "Tauren" },
|
["arena1"] = { name = "Swift", raceLoc = L["NightElf"], classLoc = L["Hunter"], class = "HUNTER", health = 67, healthMax = 100, power = 76, powerMax = 100, powerType = 1, testSpec = L["Marksmanship"], race = "NightElf" },
|
||||||
["arena2"] = { name = "Vilden", raceLoc = L["Undead"], classLoc = L["Mage"], class = "MAGE", health = 10969, healthMax = 11023, power = 7833, powerMax = 10460, powerType = 0, testSpec = L["Frost"], race = "Scourge" },
|
["arena2"] = { name = "Vilden", raceLoc = L["Undead"], classLoc = L["Mage"], class = "MAGE", health = 99, healthMax = 100, power = 7833, powerMax = 10460, powerType = 0, testSpec = L["Frost"], race = "Scourge" },
|
||||||
["arena3"] = { name = "Krymu", raceLoc = L["Human"], classLoc = L["Rogue"], class = "ROGUE", health = 1592, healthMax = 11740, power = 45, powerMax = 110, powerType = 3, testSpec = L["Subtlety"], race = "Human" },
|
["arena3"] = { name = "Krymu", raceLoc = L["Human"], classLoc = L["Rogue"], class = "ROGUE", health = 13, healthMax = 100, power = 45, powerMax = 110, powerType = 3, testSpec = L["Subtlety"], race = "Human" },
|
||||||
["arena4"] = { name = "Talmon", raceLoc = L["Human"], classLoc = L["Warlock"], class = "WARLOCK", health = 10221, healthMax = 14960, power = 9855, powerMax = 9855, powerType = 0, testSpec = L["Demonology"], race = "Human" },
|
["arena4"] = { name = "Talmon", raceLoc = L["Human"], classLoc = L["Warlock"], class = "WARLOCK", health = 68, healthMax = 100, power = 9855, powerMax = 9855, powerType = 0, testSpec = L["Demonology"], race = "Human" },
|
||||||
["arena5"] = { name = "Hydra", raceLoc = L["Undead"], classLoc = L["Priest"], class = "PRIEST", health = 11960, healthMax = 11960, power = 2515, powerMax = 10240, powerType = 0, testSpec = L["Discipline"], race = "Human" },
|
["arena5"] = { name = "Hydra", raceLoc = L["Undead"], classLoc = L["Priest"], class = "PRIEST", health = 100, healthMax = 100, power = 2515, powerMax = 10240, powerType = 0, testSpec = L["Discipline"], race = "Human" },
|
||||||
}
|
}
|
||||||
|
|
||||||
self.cooldownSpellIds = {}
|
self.cooldownSpellIds = {}
|
||||||
@ -220,30 +304,44 @@ function Gladdy:OnInitialize()
|
|||||||
self.guids = {}
|
self.guids = {}
|
||||||
self.curBracket = nil
|
self.curBracket = nil
|
||||||
self.curUnit = 1
|
self.curUnit = 1
|
||||||
self.lastInstance = nil
|
|
||||||
|
|
||||||
self:SetupOptions()
|
self:SetupOptions()
|
||||||
|
|
||||||
for k, v in self:IterModules() do
|
for _, module in self:IterModules() do
|
||||||
self:Call(v, "Initialize") -- B.E > A.E :D
|
self:Call(module, "Initialize") -- B.E > A.E :D
|
||||||
end
|
end
|
||||||
self:DeleteUnknownOptions(self.db, self.defaults.profile)
|
|
||||||
if Gladdy.db.hideBlizzard == "always" then
|
if Gladdy.db.hideBlizzard == "always" then
|
||||||
SetCVar("showArenaEnemyFrames", 0)
|
Gladdy:BlizzArenaSetAlpha(0)
|
||||||
end
|
end
|
||||||
|
if not self.db.newLayout then
|
||||||
|
self:ToggleFrame(3)
|
||||||
|
self:HideFrame()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Gladdy:OnProfileReset()
|
||||||
|
self.db = self.dbi.profile
|
||||||
|
Gladdy:Debug("INFO", "OnProfileReset")
|
||||||
|
self:HideFrame()
|
||||||
|
self:ToggleFrame(3)
|
||||||
|
Gladdy.options.args.lock.name = Gladdy.db.locked and L["Unlock frame"] or L["Lock frame"]
|
||||||
|
Gladdy.options.args.showMover.name = Gladdy.db.showMover and L["Hide Mover"] or L["Show Mover"]
|
||||||
|
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
|
||||||
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)
|
||||||
|
Gladdy.options.args.lock.name = Gladdy.db.locked and L["Unlock frame"] or L["Lock frame"]
|
||||||
|
Gladdy.options.args.showMover.name = Gladdy.db.showMover and L["Hide Mover"] or L["Show Mover"]
|
||||||
|
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
|
||||||
end
|
end
|
||||||
|
|
||||||
function Gladdy:OnEnable()
|
function Gladdy:OnEnable()
|
||||||
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
|
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
|
||||||
self:RegisterEvent("PLAYER_ENTERING_WORLD")
|
self:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
|
self:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||||
|
|
||||||
if (IsAddOnLoaded("Clique")) then
|
if (IsAddOnLoaded("Clique")) then
|
||||||
for i = 1, 5 do
|
for i = 1, 5 do
|
||||||
@ -291,22 +389,27 @@ end
|
|||||||
|
|
||||||
function Gladdy:Test()
|
function Gladdy:Test()
|
||||||
self.frame.testing = true
|
self.frame.testing = true
|
||||||
for i = 1, self.curBracket do
|
if self.curBracket then
|
||||||
local unit = "arena" .. i
|
for i = 1, self.curBracket do
|
||||||
if (not self.buttons[unit]) then
|
local unit = "arena" .. i
|
||||||
self:CreateButton(i)
|
if (not self.buttons[unit]) then
|
||||||
end
|
self:CreateButton(i)
|
||||||
local button = self.buttons[unit]
|
end
|
||||||
|
local button = self.buttons[unit]
|
||||||
|
|
||||||
for k, v in pairs(self.testData[unit]) do
|
for k, v in pairs(self.testData[unit]) do
|
||||||
button[k] = v
|
button[k] = v
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in self:IterModules() do
|
for _, module in self:IterModules() do
|
||||||
self:Call(v, "Test", unit)
|
self:Call(module, "Test", unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
button:SetAlpha(1)
|
button:SetAlpha(1)
|
||||||
|
end
|
||||||
|
for _, module in self:IterModules() do
|
||||||
|
self:Call(module, "TestOnce")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -321,26 +424,40 @@ function Gladdy:PLAYER_ENTERING_WORLD()
|
|||||||
LibStub("AceConfigDialog-3.0"):Open("Gladdy", nil, LibStub("AceConfigDialog-3.0"):SelectGroup("Gladdy", "XiconProfiles"))
|
LibStub("AceConfigDialog-3.0"):Open("Gladdy", nil, LibStub("AceConfigDialog-3.0"):SelectGroup("Gladdy", "XiconProfiles"))
|
||||||
self.showConfig = nil
|
self.showConfig = nil
|
||||||
end
|
end
|
||||||
local instance = select(2, IsInInstance())
|
if (self.frame and self.frame:IsVisible()) then
|
||||||
if (instance ~= "arena" and self.frame and self.frame:IsVisible() and not self.frame.testing) then
|
|
||||||
self:Reset()
|
self:Reset()
|
||||||
self:HideFrame()
|
self:HideFrame()
|
||||||
end
|
end
|
||||||
if (instance == "arena") then
|
|
||||||
self:Reset()
|
|
||||||
self:HideFrame()
|
|
||||||
end
|
|
||||||
self.lastInstance = instance
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Gladdy:UPDATE_BATTLEFIELD_STATUS(_, index)
|
function Gladdy:UPDATE_BATTLEFIELD_STATUS(_, index)
|
||||||
local status, mapName, instanceID, levelRangeMin, levelRangeMax, teamSize, isRankedArena, suspendedQueue, bool, queueType = GetBattlefieldStatus(index)
|
local status, mapName, instanceID, levelRangeMin, levelRangeMax, teamSize, isRankedArena, suspendedQueue, bool, queueType = GetBattlefieldStatus(index)
|
||||||
if (status == "active" and teamSize > 0 and IsActiveBattlefieldArena()) then
|
local instanceType = select(2, IsInInstance())
|
||||||
|
Gladdy:Debug("INFO", "UPDATE_BATTLEFIELD_STATUS", instanceType, status, teamSize)
|
||||||
|
if ((instanceType == "arena" or GetNumArenaOpponents() > 0) and status == "active" and teamSize > 0) then
|
||||||
self.curBracket = teamSize
|
self.curBracket = teamSize
|
||||||
self:JoinedArena()
|
self:JoinedArena()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Gladdy:PLAYER_REGEN_ENABLED()
|
||||||
|
if self.showFrame then
|
||||||
|
self:UpdateFrame()
|
||||||
|
if self.startTest then
|
||||||
|
self:Test()
|
||||||
|
self.startTest = nil
|
||||||
|
end
|
||||||
|
self.frame:Show()
|
||||||
|
self:SendMessage("JOINED_ARENA")
|
||||||
|
self.showFrame = nil
|
||||||
|
end
|
||||||
|
if self.hideFrame then
|
||||||
|
self:Reset()
|
||||||
|
self.frame:Hide()
|
||||||
|
self.hideFrame = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
|
|
||||||
-- RESET FUNCTIONS (ARENA LEAVE)
|
-- RESET FUNCTIONS (ARENA LEAVE)
|
||||||
@ -349,7 +466,7 @@ end
|
|||||||
|
|
||||||
function Gladdy:Reset()
|
function Gladdy:Reset()
|
||||||
if type(self.guids) == "table" then
|
if type(self.guids) == "table" then
|
||||||
for k, v in pairs(self.guids) do
|
for k,_ in pairs(self.guids) do
|
||||||
self.guids[k] = nil
|
self.guids[k] = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -357,15 +474,15 @@ function Gladdy:Reset()
|
|||||||
self.curBracket = nil
|
self.curBracket = nil
|
||||||
self.curUnit = 1
|
self.curUnit = 1
|
||||||
|
|
||||||
for k1, v1 in self:IterModules() do
|
for _, module in self:IterModules() do
|
||||||
self:Call(v1, "Reset")
|
self:Call(module, "Reset")
|
||||||
end
|
end
|
||||||
|
|
||||||
for unit in pairs(self.buttons) do
|
for unit in pairs(self.buttons) do
|
||||||
self:ResetUnit(unit)
|
self:ResetUnit(unit)
|
||||||
end
|
end
|
||||||
if Gladdy.db.hideBlizzard == "never" or Gladdy.db.hideBlizzard == "arena" then
|
if Gladdy.db.hideBlizzard == "never" or Gladdy.db.hideBlizzard == "arena" then
|
||||||
SetCVar("showArenaEnemyFrames", 1)
|
Gladdy:BlizzArenaSetAlpha(1)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -378,8 +495,8 @@ function Gladdy:ResetUnit(unit)
|
|||||||
button:SetAlpha(0)
|
button:SetAlpha(0)
|
||||||
self:ResetButton(unit)
|
self:ResetButton(unit)
|
||||||
|
|
||||||
for k2, v2 in self:IterModules() do
|
for _, module in self:IterModules() do
|
||||||
self:Call(v2, "ResetUnit", unit)
|
self:Call(module, "ResetUnit", unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -418,13 +535,83 @@ function Gladdy:JoinedArena()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
self:SendMessage("JOINED_ARENA")
|
if InCombatLockdown() then
|
||||||
self:UpdateFrame()
|
Gladdy:Print("Gladdy frames show as soon as you leave combat")
|
||||||
self.frame:Show()
|
self.showFrame = true
|
||||||
|
else
|
||||||
|
self:UpdateFrame()
|
||||||
|
self.frame:Show()
|
||||||
|
self:SendMessage("JOINED_ARENA")
|
||||||
|
end
|
||||||
for i=1, self.curBracket do
|
for i=1, self.curBracket do
|
||||||
self.buttons["arena" .. i]:SetAlpha(1)
|
self.buttons["arena" .. i]:SetAlpha(1)
|
||||||
end
|
end
|
||||||
if Gladdy.db.hideBlizzard == "arena" or Gladdy.db.hideBlizzard == "always" then
|
if Gladdy.db.hideBlizzard == "arena" or Gladdy.db.hideBlizzard == "always" then
|
||||||
SetCVar("showArenaEnemyFrames", 0)
|
Gladdy:BlizzArenaSetAlpha(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- BLIZZARD FRAMES
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Gladdy:BlizzArenaSetAlpha(alpha)
|
||||||
|
if IsAddOnLoaded("Blizzard_ArenaUI") then
|
||||||
|
if (ArenaEnemyFrames) then
|
||||||
|
ArenaEnemyFrames:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame1 then
|
||||||
|
ArenaEnemyFrame1:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame1PetFrame then
|
||||||
|
ArenaEnemyFrame1PetFrame:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame2 then
|
||||||
|
ArenaEnemyFrame2:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame2PetFrame then
|
||||||
|
ArenaEnemyFrame2PetFrame:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame3 then
|
||||||
|
ArenaEnemyFrame3:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame3PetFrame then
|
||||||
|
ArenaEnemyFrame3PetFrame:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame4 then
|
||||||
|
ArenaEnemyFrame4:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame4PetFrame then
|
||||||
|
ArenaEnemyFrame4PetFrame:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame5 then
|
||||||
|
ArenaEnemyFrame5:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
if ArenaEnemyFrame5PetFrame then
|
||||||
|
ArenaEnemyFrame5PetFrame:SetAlpha(alpha)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- FONT/STATUSBAR/BORDER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
local defaults = {["statusbar"] = "Smooth", ["border"] = "Gladdy Tooltip round", ["font"] = "DorisPP"}
|
||||||
|
|
||||||
|
local lastWarning = {}
|
||||||
|
function Gladdy:SMFetch(lsmType, key)
|
||||||
|
local smMediaType = self.LSM:Fetch(lsmType, Gladdy.db[key])
|
||||||
|
if (smMediaType == nil and Gladdy.db[key] ~= "None") then
|
||||||
|
if not lastWarning[key] or GetTime() - lastWarning[key] > 120 then
|
||||||
|
lastWarning[key] = GetTime()
|
||||||
|
Gladdy:Warn("Could not find", "\"" .. lsmType .. "\" \"", Gladdy.db[key], " \" for", "\"" .. key .. "\"", "- setting it to", "\"" .. defaults[lsmType] .. "\"")
|
||||||
|
end
|
||||||
|
return self.LSM:Fetch(lsmType, defaults[lsmType])
|
||||||
|
end
|
||||||
|
return smMediaType
|
||||||
|
end
|
@ -1,7 +1,7 @@
|
|||||||
## Interface: 20501
|
## Interface: 20504
|
||||||
## Title: Gladdy - TBC
|
## Title: Gladdy - TBC
|
||||||
## Version: 1.16-Beta
|
## Version: 2.10-Release
|
||||||
## Notes: The most powerful arena AddOn for WoW 2.5.1
|
## Notes: The most powerful arena AddOn for WoW 2.5.4
|
||||||
## 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
|
||||||
## SavedVariables: GladdyXZ
|
## SavedVariables: GladdyXZ
|
||||||
@ -15,6 +15,7 @@ Frame.lua
|
|||||||
Options.lua
|
Options.lua
|
||||||
Constants.lua
|
Constants.lua
|
||||||
ImportStrings.lua
|
ImportStrings.lua
|
||||||
|
Util.lua
|
||||||
|
|
||||||
Modules\Announcements.lua
|
Modules\Announcements.lua
|
||||||
Modules\Healthbar.lua
|
Modules\Healthbar.lua
|
||||||
@ -26,6 +27,7 @@ Modules\Clicks.lua
|
|||||||
Modules\Diminishings.lua
|
Modules\Diminishings.lua
|
||||||
Modules\Highlight.lua
|
Modules\Highlight.lua
|
||||||
Modules\TotemPlates.lua
|
Modules\TotemPlates.lua
|
||||||
|
Modules\TotemPulse.lua
|
||||||
Modules\Trinket.lua
|
Modules\Trinket.lua
|
||||||
Modules\Racial.lua
|
Modules\Racial.lua
|
||||||
Modules\Cooldowns.lua
|
Modules\Cooldowns.lua
|
||||||
|
Binary file not shown.
BIN
Images/BasicProfiles/Mir1.blp
Normal file
BIN
Images/BasicProfiles/Mir1.blp
Normal file
Binary file not shown.
BIN
Images/BasicProfiles/Mir1_edited.blp
Normal file
BIN
Images/BasicProfiles/Mir1_edited.blp
Normal file
Binary file not shown.
BIN
Images/BasicProfiles/Rukk1.blp
Normal file
BIN
Images/BasicProfiles/Rukk1.blp
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Images/Countdown/Alliance.blp
Normal file
BIN
Images/Countdown/Alliance.blp
Normal file
Binary file not shown.
BIN
Images/Countdown/Horde.blp
Normal file
BIN
Images/Countdown/Horde.blp
Normal file
Binary file not shown.
BIN
Images/UI-StatusBar.blp
Normal file
BIN
Images/UI-StatusBar.blp
Normal file
Binary file not shown.
BIN
Images/downarrow.blp
Normal file
BIN
Images/downarrow.blp
Normal file
Binary file not shown.
BIN
Images/trinket.blp
Normal file
BIN
Images/trinket.blp
Normal file
Binary file not shown.
BIN
Images/uparrow.blp
Normal file
BIN
Images/uparrow.blp
Normal file
Binary file not shown.
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
local major = "DRData-1.0"
|
local major = "DRData-1.0-BCC"
|
||||||
local minor = tonumber(string.match("$Revision: 793$", "(%d+)") or 1)
|
local minor = tonumber(string.match("$Revision: 793$", "(%d+)") or 1)
|
||||||
|
|
||||||
assert(LibStub, string.format("%s requires LibStub.", major))
|
assert(LibStub, string.format("%s requires LibStub.", major))
|
||||||
@ -139,6 +139,9 @@ Data.spells = {
|
|||||||
|
|
||||||
-- Revenge Stun
|
-- Revenge Stun
|
||||||
[12798] = "rndstun",
|
[12798] = "rndstun",
|
||||||
|
|
||||||
|
-- Pyroclasm
|
||||||
|
[18093] = "rndstun",
|
||||||
|
|
||||||
--[[ CYCLONE ]]--
|
--[[ CYCLONE ]]--
|
||||||
-- Blind
|
-- Blind
|
||||||
@ -167,54 +170,69 @@ Data.spells = {
|
|||||||
[9853] = "root",
|
[9853] = "root",
|
||||||
[26989] = "root",
|
[26989] = "root",
|
||||||
|
|
||||||
|
-- Nature's Grasp
|
||||||
|
[19975] = "root",
|
||||||
|
[19974] = "root",
|
||||||
|
[19973] = "root",
|
||||||
|
[19972] = "root",
|
||||||
|
[19971] = "root",
|
||||||
|
[19970] = "root",
|
||||||
|
[27010] = "root",
|
||||||
|
|
||||||
--[[ RANDOM ROOTS ]]--
|
--[[ RANDOM ROOTS ]]--
|
||||||
-- Improved Hamstring
|
-- Improved Hamstring
|
||||||
[23694] = "rndroot",
|
[23694] = "rndroot",
|
||||||
|
|
||||||
|
-- Entrapment (Hunter Talent)
|
||||||
|
[19185] = "rndroot",
|
||||||
|
|
||||||
|
-- Improved Wingclip
|
||||||
|
[19229] = "rndroot",
|
||||||
|
|
||||||
-- Frostbite
|
-- Frostbite
|
||||||
[12494] = "rndroot",
|
[12494] = "rndroot",
|
||||||
|
|
||||||
--[[ SLEEPS ]]--
|
--[[ SLEEPS ]]--
|
||||||
-- Hibernate
|
-- Hibernate
|
||||||
[2637] = "sleep",
|
[2637] = "disorient",
|
||||||
[18657] = "sleep",
|
[18657] = "disorient",
|
||||||
[18658] = "sleep",
|
[18658] = "disorient",
|
||||||
|
|
||||||
-- Wyvern Sting
|
-- Wyvern Sting
|
||||||
[19386] = "sleep",
|
[19386] = "disorient",
|
||||||
[24132] = "sleep",
|
[24132] = "disorient",
|
||||||
[24133] = "sleep",
|
[24133] = "disorient",
|
||||||
[27068] = "sleep",
|
[27068] = "disorient",
|
||||||
|
|
||||||
--[[ MISC ]]--
|
--[[ MISC ]]--
|
||||||
-- Chastise (Maybe this shares DR with Imp HS?)
|
-- Chastise
|
||||||
[44041] = "root",
|
[44041] = "chastise",
|
||||||
[44043] = "root",
|
[44043] = "chastise",
|
||||||
[44044] = "root",
|
[44044] = "chastise",
|
||||||
[44045] = "root",
|
[44045] = "chastise",
|
||||||
[44046] = "root",
|
[44046] = "chastise",
|
||||||
[44047] = "root",
|
[44047] = "chastise",
|
||||||
|
|
||||||
-- Dragon's Breath
|
-- Dragon's Breath
|
||||||
[31661] = "dragonsbreath", -- Dragon's Breath
|
[31661] = "scatters", -- Dragon's Breath
|
||||||
[33041] = "dragonsbreath", -- Dragon's Breath
|
[33041] = "scatters", -- Dragon's Breath
|
||||||
[33042] = "dragonsbreath", -- Dragon's Breath
|
[33042] = "scatters", -- Dragon's Breath
|
||||||
[33043] = "dragonsbreath", -- Dragon's Breath
|
[33043] = "scatters", -- Dragon's Breath
|
||||||
-- Repentance
|
-- Repentance
|
||||||
[20066] = "repentance",
|
[20066] = "disorient",
|
||||||
|
|
||||||
-- Scatter Shot
|
-- Scatter Shot
|
||||||
[19503] = "scatters",
|
[19503] = "scatters",
|
||||||
|
|
||||||
-- Freezing Trap
|
-- Freezing Trap
|
||||||
[3355] = "freezetrap",
|
[3355] = "disorient",
|
||||||
[14308] = "freezetrap",
|
[14308] = "disorient",
|
||||||
[14309] = "freezetrap",
|
[14309] = "disorient",
|
||||||
|
|
||||||
-- Improved Conc Shot
|
-- Improved Conc Shot
|
||||||
[19410] = "impconc",
|
[19410] = "rndstun",
|
||||||
[22915] = "impconc",
|
[22915] = "rndstun",
|
||||||
[28445] = "impconc",
|
[28445] = "rndstun",
|
||||||
|
|
||||||
-- Death Coil
|
-- Death Coil
|
||||||
[6789] = "dc",
|
[6789] = "dc",
|
||||||
@ -230,6 +248,13 @@ Data.spells = {
|
|||||||
[605] = "charm",
|
[605] = "charm",
|
||||||
[10911] = "charm",
|
[10911] = "charm",
|
||||||
[10912] = "charm",
|
[10912] = "charm",
|
||||||
|
|
||||||
|
-- Counterattack
|
||||||
|
[19306] = "counterattack",
|
||||||
|
|
||||||
|
-- Disarm
|
||||||
|
[676] = "disarm",
|
||||||
|
[14251] = "disarm",
|
||||||
}
|
}
|
||||||
|
|
||||||
-- DR Category names
|
-- DR Category names
|
||||||
@ -252,6 +277,8 @@ Data.typeNames = {
|
|||||||
["repentance"] = "Repentance",
|
["repentance"] = "Repentance",
|
||||||
["dragonsbreath"] = "Dragon's Breath",
|
["dragonsbreath"] = "Dragon's Breath",
|
||||||
["ua"] = "Unstable Affliction Silence",
|
["ua"] = "Unstable Affliction Silence",
|
||||||
|
["counterattack"] = "Counterattack Immobilize",
|
||||||
|
["disarm"] = "Disarm"
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Categories that have DR in PvE as well as PvP
|
-- Categories that have DR in PvE as well as PvP
|
||||||
|
@ -140,7 +140,8 @@ Buff( { 25782 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Might
|
|||||||
Buff( { 25895 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Salvation
|
Buff( { 25895 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Salvation
|
||||||
Buff( { 25899 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Sanctuary
|
Buff( { 25899 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Sanctuary
|
||||||
Buff( { 25894 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Wisdom
|
Buff( { 25894 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Wisdom
|
||||||
Buff( { 642 }, { buffType = "magic"}, "PALADIN") -- Divine Shield
|
Buff( { 642 }, { buffType = "immune"}, "PALADIN") -- Divine Shield
|
||||||
|
Buff( { 31884 }, { buffType = "magic"}, "PALADIN") -- Avenging Wrath
|
||||||
--Auras
|
--Auras
|
||||||
Buff( { 465, 10290, 643, 10291, 1032, 10292, 10293, 27149 }, { buffType = "aura"}, "PALADIN") -- Devotion Aura
|
Buff( { 465, 10290, 643, 10291, 1032, 10292, 10293, 27149 }, { buffType = "aura"}, "PALADIN") -- Devotion Aura
|
||||||
Buff( { 7294 }, { buffType = "aura"}, "PALADIN") -- Retribution Aura
|
Buff( { 7294 }, { buffType = "aura"}, "PALADIN") -- Retribution Aura
|
||||||
@ -167,6 +168,8 @@ Buff( { 21082 }, { buffType = "magic"}, "PALADIN") -- Seal of the Crusade
|
|||||||
-------------
|
-------------
|
||||||
|
|
||||||
Buff( { 5384 }, { buffType = "physical"}, "HUNTER") -- Feign Death
|
Buff( { 5384 }, { buffType = "physical"}, "HUNTER") -- Feign Death
|
||||||
|
Buff( { 19263 }, { buffType = "physical"}, "HUNTER") -- Deterrence
|
||||||
|
Buff( { 3045 }, { buffType = "physical"}, "HUNTER") -- Rapid Fire
|
||||||
--local FEIGN_DEATH = GetSpellInfo(5384) -- Localized name for Feign Death
|
--local FEIGN_DEATH = GetSpellInfo(5384) -- Localized name for Feign Death
|
||||||
|
|
||||||
|
|
||||||
|
@ -20,7 +20,8 @@ Debuff({ 15286 } ,{ buffType = "magic" }, "PRIEST") -- Vampiric Embrace
|
|||||||
Debuff({ 15407, 17311, 17312, 17313, 17314, 18807, 25387 }, { buffType = "magic" }, "PRIEST") -- Mind Flay
|
Debuff({ 15407, 17311, 17312, 17313, 17314, 18807, 25387 }, { buffType = "magic" }, "PRIEST") -- Mind Flay
|
||||||
Debuff({ 605, 10911, 10912 }, { buffType = "magic" }, "PRIEST") -- Mind Control
|
Debuff({ 605, 10911, 10912 }, { buffType = "magic" }, "PRIEST") -- Mind Control
|
||||||
Debuff({ 8122, 8124, 10888, 10890 }, { buffType = "magic", }, "PRIEST") -- Psychic Scream
|
Debuff({ 8122, 8124, 10888, 10890 }, { buffType = "magic", }, "PRIEST") -- Psychic Scream
|
||||||
Debuff({ 15269 }, { buffType = "magic"}, "PRIEST")
|
Debuff({ 15269 }, { buffType = "magic"}, "PRIEST") -- Blackout
|
||||||
|
Debuff({ 44041, 44043, 44044, 44045, 44046, 44047 }, { buffType = "magic"}, "PRIEST") -- Chastise
|
||||||
|
|
||||||
---------------
|
---------------
|
||||||
-- DRUID
|
-- DRUID
|
||||||
@ -44,6 +45,8 @@ Debuff({ 1822, 1823, 1824, 9904, 27003 }, { stacking = true, buffType = "physica
|
|||||||
Debuff({ 1079, 9492, 9493, 9752, 9894, 9896, 27008 }, { stacking = true, buffType = "physical", preEvent = "SPELL_CAST_SUCCESS" }, "DRUID") -- Rip
|
Debuff({ 1079, 9492, 9493, 9752, 9894, 9896, 27008 }, { stacking = true, buffType = "physical", preEvent = "SPELL_CAST_SUCCESS" }, "DRUID") -- Rip
|
||||||
Debuff({ 5570, 24974, 24975, 24976, 24977, 27013 }, { stacking = true, buffType = "magic", preEvent = "SPELL_CAST_SUCCESS" }, "DRUID") -- Insect Swarm
|
Debuff({ 5570, 24974, 24975, 24976, 24977, 27013 }, { stacking = true, buffType = "magic", preEvent = "SPELL_CAST_SUCCESS" }, "DRUID") -- Insect Swarm
|
||||||
Debuff({ 33745 }, { stacking = true, buffType = "physical", preEvent = "SPELL_CAST_SUCCESS" }, "DRUID") -- Lacerate
|
Debuff({ 33745 }, { stacking = true, buffType = "physical", preEvent = "SPELL_CAST_SUCCESS" }, "DRUID") -- Lacerate
|
||||||
|
Debuff({ 33878, 33986, 33987 }, { buffType = "physical" }, "DRUID") -- Mangle (Bear)
|
||||||
|
Debuff({ 33876, 33982, 33983 }, { buffType = "physical" }, "DRUID") -- Mangle (Cat)
|
||||||
|
|
||||||
-------------
|
-------------
|
||||||
-- WARRIOR
|
-- WARRIOR
|
||||||
|
@ -7,6 +7,7 @@ LibClassAuras.debuffs = {}
|
|||||||
LibClassAuras.debuffToId = {}
|
LibClassAuras.debuffToId = {}
|
||||||
LibClassAuras.buffs = {}
|
LibClassAuras.buffs = {}
|
||||||
LibClassAuras.buffToId = {}
|
LibClassAuras.buffToId = {}
|
||||||
|
LibClassAuras.altNames = {}
|
||||||
|
|
||||||
local function Spell(id, opts, class, spellTable, idTable)
|
local function Spell(id, opts, class, spellTable, idTable)
|
||||||
if not opts or not class then
|
if not opts or not class then
|
||||||
@ -26,9 +27,20 @@ local function Spell(id, opts, class, spellTable, idTable)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if opts.altName then
|
if opts.altName then
|
||||||
idTable[opts.altName] = {id = id , class = class}
|
for _,v in ipairs(id) do
|
||||||
|
LibClassAuras.altNames[v] = opts.altName
|
||||||
|
end
|
||||||
|
if idTable[opts.altName] then
|
||||||
|
tinsert(idTable[opts.altName], {id = id , class = class})
|
||||||
|
else
|
||||||
|
idTable[opts.altName] = {[1] = {id = id , class = class}}
|
||||||
|
end
|
||||||
else
|
else
|
||||||
idTable[spellName] = {id = id , class = class}
|
if idTable[spellName] then
|
||||||
|
tinsert(idTable[spellName], {id = id , class = class})
|
||||||
|
else
|
||||||
|
idTable[spellName] = {[1] = {id = id , class = class}}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if type(id) == "table" then
|
if type(id) == "table" then
|
||||||
@ -54,9 +66,11 @@ LibClassAuras.Buff = Buff
|
|||||||
|
|
||||||
local function getClassDebuffs(class)
|
local function getClassDebuffs(class)
|
||||||
local classSpells = {}
|
local classSpells = {}
|
||||||
for k,v in pairs(LibClassAuras.debuffToId) do
|
for name, spells in pairs(LibClassAuras.debuffToId) do
|
||||||
if v.class == class then
|
for _, spellInfo in ipairs(spells) do
|
||||||
tinsert(classSpells, {name = k, id = v.id})
|
if spellInfo.class == class then
|
||||||
|
tinsert(classSpells, {name = name, id = spellInfo.id})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return classSpells
|
return classSpells
|
||||||
@ -65,9 +79,11 @@ LibClassAuras.GetClassDebuffs = getClassDebuffs
|
|||||||
|
|
||||||
local function getClassBuffs(class)
|
local function getClassBuffs(class)
|
||||||
local classSpells = {}
|
local classSpells = {}
|
||||||
for k,v in pairs(LibClassAuras.buffToId) do
|
for name, spells in pairs(LibClassAuras.buffToId) do
|
||||||
if v.class == class then
|
for _, spellInfo in ipairs(spells) do
|
||||||
tinsert(classSpells, {name = k, id = v.id})
|
if spellInfo.class == class then
|
||||||
|
tinsert(classSpells, {name = name, id = spellInfo.id})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return classSpells
|
return classSpells
|
||||||
@ -82,4 +98,9 @@ local function getSpellNameToId(auraType)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
LibClassAuras.GetSpellNameToId = getSpellNameToId
|
LibClassAuras.GetSpellNameToId = getSpellNameToId
|
||||||
|
|
||||||
|
local function getAltName(spellID)
|
||||||
|
return LibClassAuras.altNames[spellID]
|
||||||
|
end
|
||||||
|
LibClassAuras.GetAltName = getAltName
|
@ -16,7 +16,7 @@ local UnitName = UnitName
|
|||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local Announcements = Gladdy:NewModule("Announcements", nil, {
|
local Announcements = Gladdy:NewModule("Announcements", 101, {
|
||||||
announcements = {
|
announcements = {
|
||||||
drinks = true,
|
drinks = true,
|
||||||
resurrections = true,
|
resurrections = true,
|
||||||
@ -26,6 +26,7 @@ local Announcements = Gladdy:NewModule("Announcements", nil, {
|
|||||||
healthThreshold = 20,
|
healthThreshold = 20,
|
||||||
trinketUsed = true,
|
trinketUsed = true,
|
||||||
trinketReady = false,
|
trinketReady = false,
|
||||||
|
spellInterrupt = true,
|
||||||
dest = "party",
|
dest = "party",
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@ -41,16 +42,20 @@ function Announcements:Initialize()
|
|||||||
[GetSpellInfo(20777)] = true,
|
[GetSpellInfo(20777)] = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
self:RegisterMessage("CAST_START")
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
|
||||||
self:RegisterMessage("UNIT_SPEC")
|
|
||||||
self:RegisterMessage("UNIT_HEALTH")
|
|
||||||
self:RegisterMessage("TRINKET_USED")
|
|
||||||
self:RegisterMessage("TRINKET_READY")
|
|
||||||
self:RegisterMessage("SHADOWSIGHT")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Announcements:Reset()
|
function Announcements:Reset()
|
||||||
|
self:UnregisterMessages(
|
||||||
|
"CAST_START",
|
||||||
|
"ENEMY_SPOTTED",
|
||||||
|
"UNIT_SPEC",
|
||||||
|
"AURA_GAIN",
|
||||||
|
"UNIT_HEALTH",
|
||||||
|
"TRINKET_USED",
|
||||||
|
"TRINKET_READY",
|
||||||
|
"SHADOWSIGHT",
|
||||||
|
"SPELL_INTERRUPT")
|
||||||
self.enemy = {}
|
self.enemy = {}
|
||||||
self.throttled = {}
|
self.throttled = {}
|
||||||
end
|
end
|
||||||
@ -60,17 +65,25 @@ function Announcements:Test(unit)
|
|||||||
if (not button) then
|
if (not button) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
self:JOINED_ARENA()
|
||||||
if (unit == "arena1") then
|
if unit == "arena1" then
|
||||||
self:UNIT_SPEC(unit, button.testSpec)
|
self:AURA_GAIN(unit, nil, nil, self.DRINK_AURA)
|
||||||
elseif (unit == "arena2") then
|
|
||||||
self:CheckDrink(unit, self.DRINK_AURA)
|
|
||||||
elseif (unit == "arena3") then
|
|
||||||
self:UNIT_HEALTH(unit, button.health, button.healthMax)
|
|
||||||
self:ENEMY_SPOTTED(unit)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Announcements:JOINED_ARENA()
|
||||||
|
self:RegisterMessages(
|
||||||
|
"CAST_START",
|
||||||
|
"ENEMY_SPOTTED",
|
||||||
|
"UNIT_SPEC",
|
||||||
|
"AURA_GAIN",
|
||||||
|
"UNIT_HEALTH",
|
||||||
|
"TRINKET_USED",
|
||||||
|
"TRINKET_READY",
|
||||||
|
"SHADOWSIGHT",
|
||||||
|
"SPELL_INTERRUPT")
|
||||||
|
end
|
||||||
|
|
||||||
function Announcements:CAST_START(unit, spell)
|
function Announcements:CAST_START(unit, spell)
|
||||||
local button = Gladdy.buttons[unit]
|
local button = Gladdy.buttons[unit]
|
||||||
if (not button or not Gladdy.db.announcements.resurrections) then
|
if (not button or not Gladdy.db.announcements.resurrections) then
|
||||||
@ -138,13 +151,21 @@ function Announcements:TRINKET_READY(unit)
|
|||||||
self:Send(L["TRINKET READY: %s (%s)"]:format(button.name, button.classLoc), 3, RAID_CLASS_COLORS[button.class])
|
self:Send(L["TRINKET READY: %s (%s)"]:format(button.name, button.classLoc), 3, RAID_CLASS_COLORS[button.class])
|
||||||
end
|
end
|
||||||
|
|
||||||
function Announcements:CheckDrink(unit, aura)
|
function Announcements:SPELL_INTERRUPT(destUnit,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool)
|
||||||
|
local button = Gladdy.buttons[destUnit]
|
||||||
|
if (not button or not Gladdy.db.announcements.spellInterrupt) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:Send(L["INTERRUPTED: %s (%s)"]:format(extraSpellName, button.name or ""), nil, RAID_CLASS_COLORS[button.class])
|
||||||
|
end
|
||||||
|
|
||||||
|
function Announcements:AURA_GAIN(unit, auraType, spellID, spellName)
|
||||||
local button = Gladdy.buttons[unit]
|
local button = Gladdy.buttons[unit]
|
||||||
if (not button or not Gladdy.db.announcements.drinks) then
|
if (not button or not Gladdy.db.announcements.drinks) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if (aura == self.DRINK_AURA) then
|
if (spellName == self.DRINK_AURA) then
|
||||||
self:Send(L["DRINKING: %s (%s)"]:format(button.name, button.classLoc), 3, RAID_CLASS_COLORS[button.class])
|
self:Send(L["DRINKING: %s (%s)"]:format(button.name, button.classLoc), 3, RAID_CLASS_COLORS[button.class])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -157,9 +178,12 @@ function Announcements:Send(msg, throttle, color)
|
|||||||
if (throttle and throttle > 0) then
|
if (throttle and throttle > 0) then
|
||||||
if (not self.throttled[msg]) then
|
if (not self.throttled[msg]) then
|
||||||
self.throttled[msg] = GetTime() + throttle
|
self.throttled[msg] = GetTime() + throttle
|
||||||
|
Gladdy:Debug("INFO", msg, "- NOT THROTTLED -", self.throttled[msg])
|
||||||
elseif (self.throttled[msg] < GetTime()) then
|
elseif (self.throttled[msg] < GetTime()) then
|
||||||
self.throttled[msg] = nil
|
Gladdy:Debug("INFO", msg, "- THROTTLED OVER -", self.throttled[msg])
|
||||||
|
self.throttled[msg] = GetTime() + throttle
|
||||||
else
|
else
|
||||||
|
Gladdy:Debug("INFO", msg, "- THROTTLED -", self.throttled[msg])
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -177,9 +201,9 @@ function Announcements:Send(msg, throttle, color)
|
|||||||
RaidNotice_AddMessage(RaidBossEmoteFrame, msg, color)
|
RaidNotice_AddMessage(RaidBossEmoteFrame, msg, color)
|
||||||
elseif (dest == "fct" and IsAddOnLoaded("Blizzard_CombatText")) then
|
elseif (dest == "fct" and IsAddOnLoaded("Blizzard_CombatText")) then
|
||||||
CombatText_AddMessage(msg, nil, color.r, color.g, color.b, "crit", 1)
|
CombatText_AddMessage(msg, nil, color.r, color.g, color.b, "crit", 1)
|
||||||
--[[elseif (dest == "msbt" and IsAddOnLoaded("MikScrollingBattleText")) then
|
elseif (dest == "msbt" and IsAddOnLoaded("MikScrollingBattleText")) then
|
||||||
MikSBT.DisplayMessage(msg, MikSBT.DISPLAYTYPE_NOTIFICATION, true, color.r * 255, color.g * 255, color.b * 255)
|
MikSBT.Animations.DisplayMessage(msg, MikSBT.DISPLAYTYPE_NOTIFICATION, true, color.r * 255, color.g * 255, color.b * 255)
|
||||||
elseif (dest == "sct" and IsAddOnLoaded("sct")) then
|
--[[elseif (dest == "sct" and IsAddOnLoaded("sct")) then
|
||||||
SCT:DisplayText(msg, color, true, "event", 1)
|
SCT:DisplayText(msg, color, true, "event", 1)
|
||||||
elseif (dest == "parrot" and IsAddOnLoaded("parrot")) then
|
elseif (dest == "parrot" and IsAddOnLoaded("parrot")) then
|
||||||
Parrot:ShowMessage(msg, "Notification", true, color.r, color.g, color.b)--]]
|
Parrot:ShowMessage(msg, "Notification", true, color.r, color.g, color.b)--]]
|
||||||
@ -210,9 +234,15 @@ function Announcements:GetOptions()
|
|||||||
["self"] = L["Self"],
|
["self"] = L["Self"],
|
||||||
["party"] = L["Party"],
|
["party"] = L["Party"],
|
||||||
["rw"] = L["Raid Warning"],
|
["rw"] = L["Raid Warning"],
|
||||||
["fct"] = L["Blizzard's Floating Combat Text"],
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if IsAddOnLoaded("Blizzard_CombatText") then
|
||||||
|
destValues["fct"] = L["Blizzard's Floating Combat Text"]
|
||||||
|
end
|
||||||
|
if IsAddOnLoaded("MikScrollingBattleText") then
|
||||||
|
destValues["msbt"] = L["MikScrollingBattleText"]
|
||||||
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
headerAnnouncements = {
|
headerAnnouncements = {
|
||||||
type = "header",
|
type = "header",
|
||||||
@ -231,41 +261,47 @@ function Announcements:GetOptions()
|
|||||||
desc = L["Announce when an enemy's trinket is ready again"],
|
desc = L["Announce when an enemy's trinket is ready again"],
|
||||||
order = 4,
|
order = 4,
|
||||||
}),
|
}),
|
||||||
|
spellInterrupt = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Interrupts"],
|
||||||
|
desc = L["Announces when enemies' spells are interrupted"],
|
||||||
|
order = 5,
|
||||||
|
}),
|
||||||
drinks = option({
|
drinks = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Drinking"],
|
name = L["Drinking"],
|
||||||
desc = L["Announces when enemies sit down to drink"],
|
desc = L["Announces when enemies sit down to drink"],
|
||||||
order = 5,
|
order = 6,
|
||||||
}),
|
}),
|
||||||
resurrections = option({
|
resurrections = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Resurrection"],
|
name = L["Resurrection"],
|
||||||
desc = L["Announces when an enemy tries to resurrect a teammate"],
|
desc = L["Announces when an enemy tries to resurrect a teammate"],
|
||||||
order = 6,
|
order = 7,
|
||||||
}),
|
}),
|
||||||
enemy = option({
|
enemy = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["New enemies"],
|
name = L["New enemies"],
|
||||||
desc = L["Announces when new enemies are discovered"],
|
desc = L["Announces when new enemies are discovered"],
|
||||||
order = 7,
|
order = 8,
|
||||||
}),
|
}),
|
||||||
spec = option({
|
spec = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Spec Detection"],
|
name = L["Spec Detection"],
|
||||||
desc = L["Announces when the spec of an enemy was detected"],
|
desc = L["Announces when the spec of an enemy was detected"],
|
||||||
order = 8,
|
order = 9,
|
||||||
}),
|
}),
|
||||||
health = option({
|
health = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Low health"],
|
name = L["Low health"],
|
||||||
desc = L["Announces when an enemy drops below a certain health threshold"],
|
desc = L["Announces when an enemy drops below a certain health threshold"],
|
||||||
order = 9,
|
order = 10,
|
||||||
}),
|
}),
|
||||||
healthThreshold = option({
|
healthThreshold = option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Low health threshold"],
|
name = L["Low health threshold"],
|
||||||
desc = L["Choose how low an enemy must be before low health is announced"],
|
desc = L["Choose how low an enemy must be before low health is announced"],
|
||||||
order = 10,
|
order = 11,
|
||||||
min = 1,
|
min = 1,
|
||||||
max = 100,
|
max = 100,
|
||||||
step = 1,
|
step = 1,
|
||||||
@ -277,7 +313,7 @@ function Announcements:GetOptions()
|
|||||||
type = "select",
|
type = "select",
|
||||||
name = L["Destination"],
|
name = L["Destination"],
|
||||||
desc = L["Choose how your announcements are displayed"],
|
desc = L["Choose how your announcements are displayed"],
|
||||||
order = 11,
|
order = 12,
|
||||||
values = destValues,
|
values = destValues,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
local floor, str_len, tostring, str_sub, str_find, pairs = math.floor, string.len, tostring, string.sub, string.find, pairs
|
local floor, str_len, tostring, str_sub, str_find, pairs = math.floor, string.len, tostring, string.sub, string.find, pairs
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local GetLocale = GetLocale
|
|
||||||
local GetTime = GetTime
|
local GetTime = GetTime
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local ACDFrame = Gladdy:NewModule("Arena Countdown", nil, {
|
local ACDFrame = Gladdy:NewModule("Arena Countdown", nil, {
|
||||||
countdown = true,
|
countdown = true,
|
||||||
arenaCountdownSize = 256
|
arenaCountdownSize = 256,
|
||||||
|
arenaCountdownFrameStrata = "HIGH",
|
||||||
|
arenaCountdownFrameLevel = 50,
|
||||||
})
|
})
|
||||||
|
|
||||||
function ACDFrame:OnEvent(event, ...)
|
function ACDFrame:OnEvent(event, ...)
|
||||||
@ -21,48 +22,75 @@ function ACDFrame:Initialize()
|
|||||||
self.texturePath = "Interface\\AddOns\\Gladdy\\Images\\Countdown\\";
|
self.texturePath = "Interface\\AddOns\\Gladdy\\Images\\Countdown\\";
|
||||||
|
|
||||||
local ACDNumFrame = CreateFrame("Frame", "ACDNumFrame", UIParent)
|
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
|
self.ACDNumFrame = ACDNumFrame
|
||||||
|
self.ACDNumFrame:EnableMouse(false)
|
||||||
|
self.ACDNumFrame:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumFrame:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumFrame:SetPoint("CENTER", 0, 128)
|
||||||
|
self.ACDNumFrame:Hide()
|
||||||
|
|
||||||
local ACDNumTens = ACDNumFrame:CreateTexture("ACDNumTens", "HIGH")
|
local ACDNumTens = ACDNumFrame:CreateTexture("ACDNumTens", "HIGH")
|
||||||
ACDNumTens:SetWidth(256)
|
|
||||||
ACDNumTens:SetHeight(128)
|
|
||||||
ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -48, 0)
|
|
||||||
self.ACDNumTens = ACDNumTens
|
self.ACDNumTens = ACDNumTens
|
||||||
|
self.ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumTens:SetPoint("CENTER", self.ACDNumFrame, "CENTER", -(Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
|
||||||
|
|
||||||
local ACDNumOnes = ACDNumFrame:CreateTexture("ACDNumOnes", "HIGH")
|
local ACDNumOnes = ACDNumFrame:CreateTexture("ACDNumOnes", "HIGH")
|
||||||
ACDNumOnes:SetWidth(256)
|
|
||||||
ACDNumOnes:SetHeight(128)
|
|
||||||
ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", 48, 0)
|
|
||||||
self.ACDNumOnes = ACDNumOnes
|
self.ACDNumOnes = ACDNumOnes
|
||||||
|
self.ACDNumOnes:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOnes:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOnes:SetPoint("CENTER", self.ACDNumFrame, "CENTER", (Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
|
||||||
|
|
||||||
local ACDNumOne = ACDNumFrame:CreateTexture("ACDNumOne", "HIGH")
|
local ACDNumOne = ACDNumFrame:CreateTexture("ACDNumOne", "HIGH")
|
||||||
ACDNumOne:SetWidth(256)
|
|
||||||
ACDNumOne:SetHeight(128)
|
|
||||||
ACDNumOne:SetPoint("CENTER", ACDNumFrame, "CENTER", 0, 0)
|
|
||||||
self.ACDNumOne = ACDNumOne
|
self.ACDNumOne = ACDNumOne
|
||||||
|
self.ACDNumOne:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOne:SetPoint("CENTER", self.ACDNumFrame, "CENTER", 0, 0)
|
||||||
|
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
if Gladdy.db.countdown then
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self:RegisterMessage("UNIT_SPEC")
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
|
end
|
||||||
|
self.faction = UnitFactionGroup("player")
|
||||||
|
end
|
||||||
|
|
||||||
|
function ACDFrame:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.countdown then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
|
self.ACDNumFrame:SetFrameStrata(Gladdy.db.arenaCountdownFrameStrata)
|
||||||
|
self.ACDNumFrame:SetFrameLevel(Gladdy.db.arenaCountdownFrameLevel)
|
||||||
|
|
||||||
|
self.ACDNumFrame:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumFrame:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumFrame:SetPoint("CENTER", 0, 128)
|
||||||
|
|
||||||
|
self.ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumTens:SetPoint("CENTER", self.ACDNumFrame, "CENTER", -(Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
|
||||||
|
|
||||||
|
self.ACDNumOnes:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOnes:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOnes:SetPoint("CENTER", self.ACDNumFrame, "CENTER", (Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
|
||||||
|
|
||||||
|
self.ACDNumOne:SetWidth(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize)
|
||||||
|
self.ACDNumOne:SetPoint("CENTER", self.ACDNumFrame, "CENTER", 0, 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ACDFrame.OnUpdate(self, elapse)
|
function ACDFrame.OnUpdate(self, elapse)
|
||||||
if (self.countdown > 0 and Gladdy.db.countdown) then
|
if (self.countdown > 0 and Gladdy.db.countdown) then
|
||||||
self.hidden = false;
|
self.hidden = false;
|
||||||
|
self.ACDNumFrame:Show()
|
||||||
if ((floor(self.countdown) ~= floor(self.countdown - elapse)) and (floor(self.countdown - elapse) >= 0)) then
|
if ((floor(self.countdown) ~= floor(self.countdown - elapse)) and (floor(self.countdown - elapse) >= 0)) then
|
||||||
local str = tostring(floor(self.countdown - elapse));
|
local str = tostring(floor(self.countdown - elapse));
|
||||||
|
|
||||||
if (floor(self.countdown - elapse) == 0) then
|
if (str_len(str) == 2) then
|
||||||
self.ACDNumTens:Hide();
|
|
||||||
self.ACDNumOnes:Hide();
|
|
||||||
self.ACDNumOne:Hide();
|
|
||||||
elseif (str_len(str) == 2) then
|
|
||||||
-- Display has 2 digits
|
-- Display has 2 digits
|
||||||
self.ACDNumOne:Hide();
|
self.ACDNumOne:Hide();
|
||||||
self.ACDNumTens:Show();
|
self.ACDNumTens:Show();
|
||||||
@ -73,8 +101,10 @@ function ACDFrame.OnUpdate(self, elapse)
|
|||||||
self.ACDNumFrame:SetScale(0.7)
|
self.ACDNumFrame:SetScale(0.7)
|
||||||
elseif (str_len(str) == 1) then
|
elseif (str_len(str) == 1) then
|
||||||
-- Display has 1 digit
|
-- Display has 1 digit
|
||||||
|
local numStr = str_sub(str, 0, 1)
|
||||||
|
local path = numStr == "0" and self.faction or numStr
|
||||||
self.ACDNumOne:Show();
|
self.ACDNumOne:Show();
|
||||||
self.ACDNumOne:SetTexture(self.texturePath .. str_sub(str, 0, 1));
|
self.ACDNumOne:SetTexture(self.texturePath .. path);
|
||||||
self.ACDNumOnes:Hide();
|
self.ACDNumOnes:Hide();
|
||||||
self.ACDNumTens:Hide();
|
self.ACDNumTens:Hide();
|
||||||
self.ACDNumFrame:SetScale(1.0)
|
self.ACDNumFrame:SetScale(1.0)
|
||||||
@ -83,6 +113,7 @@ function ACDFrame.OnUpdate(self, elapse)
|
|||||||
self.countdown = self.countdown - elapse;
|
self.countdown = self.countdown - elapse;
|
||||||
else
|
else
|
||||||
self.hidden = true;
|
self.hidden = true;
|
||||||
|
self.ACDNumFrame:Hide()
|
||||||
self.ACDNumTens:Hide();
|
self.ACDNumTens:Hide();
|
||||||
self.ACDNumOnes:Hide();
|
self.ACDNumOnes:Hide();
|
||||||
self.ACDNumOne:Hide();
|
self.ACDNumOne:Hide();
|
||||||
@ -93,18 +124,24 @@ function ACDFrame.OnUpdate(self, elapse)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function ACDFrame:JOINED_ARENA()
|
function ACDFrame:JOINED_ARENA()
|
||||||
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
|
if Gladdy.db.countdown then
|
||||||
self:SetScript("OnEvent", ACDFrame.OnEvent)
|
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
|
||||||
self.endTime = GetTime() + 70
|
self:SetScript("OnEvent", ACDFrame.OnEvent)
|
||||||
self:SetScript("OnUpdate", ACDFrame.OnUpdate)
|
self.endTime = GetTime() + 70
|
||||||
|
self:SetScript("OnUpdate", ACDFrame.OnUpdate)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ACDFrame:ENEMY_SPOTTED()
|
function ACDFrame:ENEMY_SPOTTED()
|
||||||
ACDFrame:Reset()
|
if not Gladdy.frame.testing then
|
||||||
|
ACDFrame:Reset()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ACDFrame:UNIT_SPEC()
|
function ACDFrame:UNIT_SPEC()
|
||||||
ACDFrame:Reset()
|
if not Gladdy.frame.testing then
|
||||||
|
ACDFrame:Reset()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
|
function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
|
||||||
@ -119,25 +156,7 @@ function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ACDFrame:UpdateFrame()
|
function ACDFrame:TestOnce()
|
||||||
self.ACDNumFrame:SetHeight(Gladdy.db.arenaCountdownSize)
|
|
||||||
self.ACDNumFrame:SetWidth(Gladdy.db.arenaCountdownSize)
|
|
||||||
self.ACDNumFrame:SetPoint("CENTER", 0, 128)
|
|
||||||
|
|
||||||
self.ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize)
|
|
||||||
self.ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize/2)
|
|
||||||
self.ACDNumTens:SetPoint("CENTER", self.ACDNumFrame, "CENTER", -(Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
|
|
||||||
|
|
||||||
self.ACDNumOnes:SetWidth(Gladdy.db.arenaCountdownSize)
|
|
||||||
self.ACDNumOnes:SetHeight(Gladdy.db.arenaCountdownSize/2)
|
|
||||||
self.ACDNumOnes:SetPoint("CENTER", self.ACDNumFrame, "CENTER", (Gladdy.db.arenaCountdownSize/8 + Gladdy.db.arenaCountdownSize/8/2), 0)
|
|
||||||
|
|
||||||
self.ACDNumOne:SetWidth(Gladdy.db.arenaCountdownSize)
|
|
||||||
self.ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize/2)
|
|
||||||
self.ACDNumOne:SetPoint("CENTER", self.ACDNumFrame, "CENTER", 0, 0)
|
|
||||||
end
|
|
||||||
|
|
||||||
function ACDFrame:Test()
|
|
||||||
self.countdown = 30
|
self.countdown = 30
|
||||||
self:JOINED_ARENA()
|
self:JOINED_ARENA()
|
||||||
end
|
end
|
||||||
@ -148,6 +167,7 @@ function ACDFrame:Reset()
|
|||||||
self:UnregisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
|
self:UnregisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
|
||||||
self:SetScript("OnUpdate", nil)
|
self:SetScript("OnUpdate", nil)
|
||||||
self.hidden = true;
|
self.hidden = true;
|
||||||
|
self.ACDNumFrame:Hide()
|
||||||
self.ACDNumTens:Hide();
|
self.ACDNumTens:Hide();
|
||||||
self.ACDNumOnes:Hide();
|
self.ACDNumOnes:Hide();
|
||||||
self.ACDNumOne:Hide();
|
self.ACDNumOne:Hide();
|
||||||
@ -175,6 +195,30 @@ function ACDFrame:GetOptions()
|
|||||||
max = 512,
|
max = 512,
|
||||||
step = 16,
|
step = 16,
|
||||||
width = "full",
|
width = "full",
|
||||||
|
disabled = function() return not Gladdy.db.countdown end,
|
||||||
|
}),
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 5,
|
||||||
|
},
|
||||||
|
arenaCountdownFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 6,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
disabled = function() return not Gladdy.db.countdown end,
|
||||||
|
}),
|
||||||
|
arenaCountdownFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 7,
|
||||||
|
width = "full",
|
||||||
|
disabled = function() return not Gladdy.db.countdown end,
|
||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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, tostring = select, string.lower, ceil, tremove, tinsert, pairs, ipairs, tostring
|
local select, lower, ceil, tremove, tinsert, pairs, ipairs, tostring, random = select, string.lower, ceil, tremove, tinsert, pairs, ipairs, tostring, math.random
|
||||||
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}
|
||||||
|
|
||||||
@ -31,11 +31,9 @@ local BuffsDebuffs = Gladdy:NewModule("Buffs and Debuffs", nil, {
|
|||||||
buffsFontScale = 1,
|
buffsFontScale = 1,
|
||||||
buffsFontColor = {r = 1, g = 1, b = 0, a = 1},
|
buffsFontColor = {r = 1, g = 1, b = 0, a = 1},
|
||||||
buffsDynamicColor = true,
|
buffsDynamicColor = true,
|
||||||
buffsCooldownPos = "TOP",
|
|
||||||
buffsCooldownGrowDirection = "RIGHT",
|
buffsCooldownGrowDirection = "RIGHT",
|
||||||
buffsXOffset = 0,
|
buffsXOffset = 0,
|
||||||
buffsYOffset = 0,
|
buffsYOffset = 0,
|
||||||
buffsBuffsCooldownPos = "BOTTOM",
|
|
||||||
buffsBuffsCooldownGrowDirection = "RIGHT",
|
buffsBuffsCooldownGrowDirection = "RIGHT",
|
||||||
buffsBuffsXOffset = 0,
|
buffsBuffsXOffset = 0,
|
||||||
buffsBuffsYOffset = 0,
|
buffsBuffsYOffset = 0,
|
||||||
@ -51,7 +49,9 @@ local BuffsDebuffs = Gladdy:NewModule("Buffs and Debuffs", nil, {
|
|||||||
buffsBorderColorImmune = Gladdy:GetAuraTypeColor()["immune"],
|
buffsBorderColorImmune = Gladdy:GetAuraTypeColor()["immune"],
|
||||||
buffsBorderColorDisease = Gladdy:GetAuraTypeColor()["disease"],
|
buffsBorderColorDisease = Gladdy:GetAuraTypeColor()["disease"],
|
||||||
buffsBorderColorForm = Gladdy:GetAuraTypeColor()["form"],
|
buffsBorderColorForm = Gladdy:GetAuraTypeColor()["form"],
|
||||||
buffsBorderColorAura = Gladdy:GetAuraTypeColor()["aura"]
|
buffsBorderColorAura = Gladdy:GetAuraTypeColor()["aura"],
|
||||||
|
buffFrameStrata = "MEDIUM",
|
||||||
|
buffsFrameLevel = 9,
|
||||||
})
|
})
|
||||||
|
|
||||||
local spellSchoolToOptionValueTable
|
local spellSchoolToOptionValueTable
|
||||||
@ -62,7 +62,7 @@ local function spellSchoolToOptionValue(spellSchool)
|
|||||||
spellSchoolToOptionValueTable[spellSchool].b,
|
spellSchoolToOptionValueTable[spellSchool].b,
|
||||||
spellSchoolToOptionValueTable[spellSchool].a
|
spellSchoolToOptionValueTable[spellSchool].a
|
||||||
else
|
else
|
||||||
return Gladdy.db.buffsBorderColor.r,Gladdy.db.buffsBorderColor.g,Gladdy.db.buffsBorderColor.b,Gladdy.db.buffsBorderColor.a
|
return Gladdy:SetColor(Gladdy.db.buffsBorderColor)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -76,13 +76,16 @@ function BuffsDebuffs:Initialize()
|
|||||||
self.icons = {}
|
self.icons = {}
|
||||||
self.trackedCC = {}
|
self.trackedCC = {}
|
||||||
self.framePool = {}
|
self.framePool = {}
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
if Gladdy.db.buffsEnabled then
|
||||||
self:RegisterMessage("UNIT_DESTROYED")
|
self:RegisterMessages(
|
||||||
self:RegisterMessage("UNIT_DEATH")
|
"JOINED_ARENA",
|
||||||
self:RegisterMessage("AURA_FADE")
|
"UNIT_DESTROYED",
|
||||||
self:RegisterMessage("AURA_GAIN")
|
"UNIT_DEATH",
|
||||||
self:RegisterMessage("AURA_GAIN_LIMIT")
|
"AURA_FADE",
|
||||||
self:SetScript("OnEvent", BuffsDebuffs.OnEvent)
|
"AURA_GAIN",
|
||||||
|
"AURA_GAIN_LIMIT")
|
||||||
|
self:SetScript("OnEvent", BuffsDebuffs.OnEvent)
|
||||||
|
end
|
||||||
spellSchoolToOptionValueTable = {
|
spellSchoolToOptionValueTable = {
|
||||||
curse = Gladdy.db.buffsBorderColorCurse,
|
curse = Gladdy.db.buffsBorderColorCurse,
|
||||||
magic = Gladdy.db.buffsBorderColorMagic,
|
magic = Gladdy.db.buffsBorderColorMagic,
|
||||||
@ -134,27 +137,31 @@ 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
|
local spellSchools = { "physical", "magic", "curse", "poison", "disease", "immune" }
|
||||||
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
|
|
||||||
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
|
|
||||||
|
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 1943, AURA_TYPE_DEBUFF, 12, 12, 1, "physical", select(3, GetSpellInfo(1943)), 1)
|
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 18647, AURA_TYPE_DEBUFF, 10, 10, 1, "immune", select(3, GetSpellInfo(18647)), 2)
|
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 27218, AURA_TYPE_DEBUFF, 9, 9, 1, "curse", select(3, GetSpellInfo(27218)), 3)
|
--BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 1243, select(1, GetSpellInfo(1243)), select(3, GetSpellInfo(1243)), 10, GetTime() + 10, 1, "physical")
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 27216, AURA_TYPE_DEBUFF, 9, 9, 1, "magic", select(3, GetSpellInfo(27216)), 4)
|
--self:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 31117, select(1, GetSpellInfo(31117)), select(3, GetSpellInfo(31117)), 10, GetTime() + 10, 1, "physical")
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 27189, AURA_TYPE_DEBUFF, 9, 9, 5, "poison", select(3, GetSpellInfo(27189)), 5)
|
local i = 1
|
||||||
|
for spellID, enabled in pairs(Gladdy.db.trackedDebuffs) do
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 33076, AURA_TYPE_BUFF, 15, 15, 1, "magic", select(3, GetSpellInfo(33076)), 1)
|
if i > 4 then
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 26980, AURA_TYPE_BUFF, 12, 12, 5, "magic", select(3, GetSpellInfo(26980)), 2)
|
break
|
||||||
else
|
end
|
||||||
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
|
if enabled then
|
||||||
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
|
BuffsDebuffs:AddOrRefreshAura(unit, spellID, AURA_TYPE_DEBUFF, 15, 15, random(1,5), spellSchools[random(1,6)], select(3, GetSpellInfo(spellID)), i)
|
||||||
|
i = i + 1
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 12, 12, 1, "poison", select(3, GetSpellInfo(1943)), 1)
|
end
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 10, 10, 2, "magic", select(3, GetSpellInfo(1)), 2)
|
end
|
||||||
|
i = 1
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 5, AURA_TYPE_DEBUFF, 12, 12, 3, "physical", select(3, GetSpellInfo(27009)), 1)
|
for spellID, enabled in pairs(Gladdy.db.trackedBuffs) do
|
||||||
BuffsDebuffs:AddOrRefreshAura(unit, 5, AURA_TYPE_DEBUFF, 11, 11, 4, "disease", select(3, GetSpellInfo(11426)), 2)
|
if i > 4 then
|
||||||
|
break
|
||||||
|
end
|
||||||
|
if enabled then
|
||||||
|
BuffsDebuffs:AddOrRefreshAura(unit, spellID, AURA_TYPE_BUFF, 15, 15, random(1,5), spellSchools[random(1,6)], select(3, GetSpellInfo(spellID)), i)
|
||||||
|
i = i + 1
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -194,13 +201,24 @@ function BuffsDebuffs:AURA_GAIN(unit, auraType, spellID, spellName, texture, dur
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local auraFrame = self.frames[unit]
|
local auraFrame = self.frames[unit]
|
||||||
|
spellName = LibClassAuras.GetAltName(spellID) or spellName
|
||||||
local aura = Gladdy:GetImportantAuras()[spellName] and Gladdy.db.auraListDefault[tostring(Gladdy:GetImportantAuras()[spellName].spellID)].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
|
||||||
local auraNames = LibClassAuras.GetSpellNameToId(auraType)
|
local auraNames = LibClassAuras.GetSpellNameToId(auraType)
|
||||||
local spellId = auraNames[spellName] and auraNames[spellName].id[1]
|
local spellId
|
||||||
if not aura and spellID and spellId and expirationTime and (Gladdy.db.trackedBuffs[tostring(spellId)] or Gladdy.db.trackedDebuffs[tostring(spellId)]) then
|
local isTracked = false
|
||||||
|
if auraNames[spellName] then
|
||||||
|
for _, spellInfo in ipairs(auraNames[spellName]) do
|
||||||
|
spellId = spellInfo.id[1]
|
||||||
|
if (Gladdy.db.trackedBuffs[tostring(spellId)] or Gladdy.db.trackedDebuffs[tostring(spellId)]) then
|
||||||
|
isTracked = true
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if not aura and spellID and expirationTime and isTracked 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
|
||||||
@ -218,16 +236,19 @@ 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:SetFrameStrata(Gladdy.db.buffFrameStrata)
|
||||||
|
debuffFrame:SetFrameLevel(Gladdy.db.buffsFrameLevel)
|
||||||
|
debuffFrame:SetMovable(true)
|
||||||
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, 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:SetFrameStrata(Gladdy.db.buffFrameStrata)
|
||||||
|
buffFrame:SetFrameLevel(Gladdy.db.buffsFrameLevel)
|
||||||
|
buffFrame:SetMovable(true)
|
||||||
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, verticalMargin)
|
|
||||||
buffFrame.unit = unit
|
buffFrame.unit = unit
|
||||||
self.frames[unit] = {}
|
self.frames[unit] = {}
|
||||||
self.frames[unit].buffFrame = buffFrame
|
self.frames[unit].buffFrame = buffFrame
|
||||||
@ -259,154 +280,56 @@ local function styleIcon(aura, auraType)
|
|||||||
aura.cooldowncircle:SetAlpha(Gladdy.db.buffsCooldownAlpha)
|
aura.cooldowncircle:SetAlpha(Gladdy.db.buffsCooldownAlpha)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
aura:SetFrameStrata(Gladdy.db.buffFrameStrata)
|
||||||
|
aura:SetFrameLevel(Gladdy.db.buffsFrameLevel)
|
||||||
|
aura.cooldowncircle:SetFrameLevel(Gladdy.db.buffsFrameLevel + 1)
|
||||||
|
aura.overlay:SetFrameLevel(Gladdy.db.buffsFrameLevel + 2)
|
||||||
|
|
||||||
aura.border:SetTexture(Gladdy.db.buffsBorderStyle)
|
aura.border:SetTexture(Gladdy.db.buffsBorderStyle)
|
||||||
aura.border:SetVertexColor(spellSchoolToOptionValue(aura.spellSchool))
|
aura.border:SetVertexColor(spellSchoolToOptionValue(aura.spellSchool))
|
||||||
aura.cooldown:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.buffsFont), (Gladdy.db.buffsIconSize/2 - 1) * Gladdy.db.buffsFontScale, "OUTLINE")
|
aura.cooldown:SetFont(Gladdy:SMFetch("font", "buffsFont"), (Gladdy.db.buffsIconSize/2 - 1) * Gladdy.db.buffsFontScale, "OUTLINE")
|
||||||
aura.cooldown:SetTextColor(Gladdy.db.buffsFontColor.r, Gladdy.db.buffsFontColor.g, Gladdy.db.buffsFontColor.b, Gladdy.db.buffsFontColor.a)
|
aura.cooldown:SetTextColor(Gladdy.db.buffsFontColor.r, Gladdy.db.buffsFontColor.g, Gladdy.db.buffsFontColor.b, Gladdy.db.buffsFontColor.a)
|
||||||
aura.stacks:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.buffsFont), (Gladdy.db.buffsIconSize/3 - 1) * Gladdy.db.buffsFontScale, "OUTLINE")
|
aura.stacks:SetFont(Gladdy:SMFetch("font", "buffsFont"), (Gladdy.db.buffsIconSize/3 - 1) * Gladdy.db.buffsFontScale, "OUTLINE")
|
||||||
aura.stacks:SetTextColor(Gladdy.db.buffsFontColor.r, Gladdy.db.buffsFontColor.g, Gladdy.db.buffsFontColor.b, Gladdy.db.buffsFontColor.a)
|
aura.stacks:SetTextColor(Gladdy.db.buffsFontColor.r, Gladdy.db.buffsFontColor.g, Gladdy.db.buffsFontColor.b, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuffsDebuffs:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.buffsEnabled then
|
||||||
|
self:RegisterMessages(
|
||||||
|
"JOINED_ARENA",
|
||||||
|
"UNIT_DESTROYED",
|
||||||
|
"UNIT_DEATH",
|
||||||
|
"AURA_FADE",
|
||||||
|
"AURA_GAIN",
|
||||||
|
"AURA_GAIN_LIMIT")
|
||||||
|
self:SetScript("OnEvent", BuffsDebuffs.OnEvent)
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
self:SetScript("OnEvent", nil)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function BuffsDebuffs:UpdateFrame(unit)
|
function BuffsDebuffs:UpdateFrame(unit)
|
||||||
self.frames[unit].debuffFrame:SetHeight(Gladdy.db.buffsIconSize)
|
|
||||||
self.frames[unit].debuffFrame:ClearAllPoints()
|
|
||||||
|
|
||||||
--DEBUFFS
|
--DEBUFFS
|
||||||
local powerBarHeight = Gladdy.db.powerBarEnabled and (Gladdy.db.powerBarHeight + 1) or 0
|
self.frames[unit].debuffFrame:SetHeight(Gladdy.db.buffsIconSize)
|
||||||
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
|
Gladdy:SetPosition(self.frames[unit].debuffFrame, unit, "buffsXOffset", "buffsYOffset", BuffsDebuffs:LegacySetPositionDebuffs(unit), BuffsDebuffs)
|
||||||
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
|
if (unit == "arena1") then
|
||||||
if Gladdy.db.buffsCooldownPos == "TOP" then
|
Gladdy:CreateMover(self.frames[unit].debuffFrame, "buffsXOffset", "buffsYOffset", L["Debuffs"],
|
||||||
verticalMargin = horizontalMargin + 1
|
{"TOPRIGHT", "TOPRIGHT"},
|
||||||
if Gladdy.db.cooldownYPos == "TOP" and Gladdy.db.cooldown then
|
Gladdy.db.buffsIconSize * Gladdy.db.buffsWidthFactor, Gladdy.db.buffsIconSize,
|
||||||
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
0, 0, "buffsEnabled")
|
||||||
end
|
|
||||||
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset + verticalMargin)
|
|
||||||
else
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset + verticalMargin)
|
|
||||||
end
|
|
||||||
elseif Gladdy.db.buffsCooldownPos == "BOTTOM" then
|
|
||||||
verticalMargin = horizontalMargin + 1
|
|
||||||
if Gladdy.db.cooldownYPos == "BOTTOM" and Gladdy.db.cooldown then
|
|
||||||
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
|
||||||
end
|
|
||||||
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "BOTTOMRIGHT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin - powerBarHeight)
|
|
||||||
else
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin - powerBarHeight)
|
|
||||||
end
|
|
||||||
elseif Gladdy.db.buffsCooldownPos == "LEFT" then
|
|
||||||
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
|
||||||
local anchor = Gladdy:GetAnchor(unit, "LEFT")
|
|
||||||
if anchor == Gladdy.buttons[unit].healthBar then
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
|
|
||||||
else
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
|
|
||||||
end
|
|
||||||
|
|
||||||
elseif Gladdy.db.buffsCooldownPos == "RIGHT" then
|
|
||||||
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
|
||||||
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
|
|
||||||
if anchor == Gladdy.buttons[unit].healthBar then
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
|
|
||||||
else
|
|
||||||
self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--BUFFS
|
--BUFFS
|
||||||
self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize)
|
self.frames[unit].buffFrame:SetHeight(Gladdy.db.buffsBuffsIconSize)
|
||||||
self.frames[unit].buffFrame:ClearAllPoints()
|
Gladdy:SetPosition(self.frames[unit].buffFrame, unit, "buffsBuffsXOffset", "buffsBuffsYOffset", BuffsDebuffs:LegacySetPositionBuffs(unit), BuffsDebuffs)
|
||||||
horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
|
if (unit == "arena1") then
|
||||||
verticalMargin = -(Gladdy.db.powerBarHeight)/2
|
Gladdy:CreateMover(self.frames[unit].buffFrame, "buffsBuffsXOffset", "buffsBuffsYOffset", L["Buffs"],
|
||||||
if Gladdy.db.buffsBuffsCooldownPos == "TOP" then
|
{"TOPRIGHT", "TOPRIGHT"},
|
||||||
verticalMargin = horizontalMargin + 1
|
Gladdy.db.buffsBuffsIconSize * Gladdy.db.buffsBuffsWidthFactor, Gladdy.db.buffsBuffsIconSize,
|
||||||
if Gladdy.db.cooldownYPos == "TOP" and Gladdy.db.cooldown then
|
0, 0, "buffsEnabled")
|
||||||
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
|
||||||
end
|
|
||||||
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
|
|
||||||
self.frames[unit].buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", Gladdy.db.buffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
|
|
||||||
else
|
|
||||||
self.frames[unit].buffFrame:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
|
|
||||||
end
|
|
||||||
elseif Gladdy.db.buffsBuffsCooldownPos == "BOTTOM" then
|
|
||||||
verticalMargin = horizontalMargin + 1
|
|
||||||
if Gladdy.db.cooldownYPos == "BOTTOM" and Gladdy.db.cooldown then
|
|
||||||
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
|
||||||
end
|
|
||||||
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
|
|
||||||
self.frames[unit].buffFrame:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "BOTTOMRIGHT", Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset -verticalMargin - powerBarHeight)
|
|
||||||
else
|
|
||||||
self.frames[unit].buffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "BOTTOMLEFT", Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset -verticalMargin - powerBarHeight)
|
|
||||||
end
|
|
||||||
elseif Gladdy.db.buffsBuffsCooldownPos == "LEFT" then
|
|
||||||
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
|
|
||||||
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.classIconPos == "LEFT") then
|
|
||||||
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
|
|
||||||
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
|
|
||||||
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.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
|
|
||||||
end
|
|
||||||
--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
|
|
||||||
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
|
|
||||||
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.classIconPos == "RIGHT") then
|
|
||||||
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
|
|
||||||
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.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
|
|
||||||
end
|
|
||||||
--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)
|
||||||
end
|
end
|
||||||
@ -426,13 +349,8 @@ end
|
|||||||
function BuffsDebuffs:UpdateAurasOnUnit(unit)
|
function BuffsDebuffs:UpdateAurasOnUnit(unit)
|
||||||
for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do
|
for i=1, #self.frames[unit].auras[AURA_TYPE_BUFF] do
|
||||||
if i == 1 then
|
if i == 1 then
|
||||||
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
|
self.frames[unit].auras[AURA_TYPE_BUFF][i]:ClearAllPoints()
|
||||||
self.frames[unit].auras[AURA_TYPE_BUFF][i]:ClearAllPoints()
|
self.frames[unit].auras[AURA_TYPE_BUFF][i]:SetPoint("RIGHT", self.frames[unit].buffFrame, "LEFT")
|
||||||
self.frames[unit].auras[AURA_TYPE_BUFF][i]:SetPoint("RIGHT", self.frames[unit].buffFrame, "LEFT")
|
|
||||||
else
|
|
||||||
self.frames[unit].auras[AURA_TYPE_BUFF][i]:ClearAllPoints()
|
|
||||||
self.frames[unit].auras[AURA_TYPE_BUFF][i]:SetPoint("LEFT", self.frames[unit].buffFrame, "RIGHT")
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
|
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
|
||||||
self.frames[unit].auras[AURA_TYPE_BUFF][i]:ClearAllPoints()
|
self.frames[unit].auras[AURA_TYPE_BUFF][i]:ClearAllPoints()
|
||||||
@ -445,13 +363,8 @@ function BuffsDebuffs:UpdateAurasOnUnit(unit)
|
|||||||
end
|
end
|
||||||
for i=1, #self.frames[unit].auras[AURA_TYPE_DEBUFF] do
|
for i=1, #self.frames[unit].auras[AURA_TYPE_DEBUFF] do
|
||||||
if i == 1 then
|
if i == 1 then
|
||||||
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
|
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:ClearAllPoints()
|
||||||
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:ClearAllPoints()
|
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:SetPoint("RIGHT", self.frames[unit].debuffFrame, "LEFT")
|
||||||
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:SetPoint("RIGHT", self.frames[unit].debuffFrame, "LEFT")
|
|
||||||
else
|
|
||||||
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:ClearAllPoints()
|
|
||||||
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:SetPoint("LEFT", self.frames[unit].debuffFrame, "RIGHT")
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
|
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
|
||||||
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:ClearAllPoints()
|
self.frames[unit].auras[AURA_TYPE_DEBUFF][i]:ClearAllPoints()
|
||||||
@ -469,28 +382,23 @@ local function iconTimer(auraFrame, elapsed)
|
|||||||
local timeLeftMilliSec = auraFrame.endtime - GetTime()
|
local timeLeftMilliSec = auraFrame.endtime - GetTime()
|
||||||
local timeLeftSec = ceil(timeLeftMilliSec)
|
local timeLeftSec = ceil(timeLeftMilliSec)
|
||||||
auraFrame.timeLeft = timeLeftMilliSec
|
auraFrame.timeLeft = timeLeftMilliSec
|
||||||
--auraFrame.cooldowncircle:SetCooldown(auraFrame.startTime, auraFrame.endtime)
|
if Gladdy.db.buffsDynamicColor then
|
||||||
if timeLeftSec >= 60 then
|
if timeLeftSec >= 60 then
|
||||||
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(0.7, 1, 0) end
|
auraFrame.cooldown:SetTextColor(0.7, 1, 0, Gladdy.db.buffsFontColor.a)
|
||||||
auraFrame.cooldown:SetFormattedText("%dm", ceil(timeLeftSec / 60))
|
elseif timeLeftSec < 60 and timeLeftSec >= 11 then
|
||||||
elseif timeLeftSec < 60 and timeLeftSec >= 11 then
|
auraFrame.cooldown:SetTextColor(0.7, 1, 0, Gladdy.db.buffsFontColor.a)
|
||||||
--if it's less than 60s
|
elseif timeLeftSec <= 10 and timeLeftSec >= 5 then
|
||||||
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(0.7, 1, 0) end
|
auraFrame.cooldown:SetTextColor(1, 0.7, 0, Gladdy.db.buffsFontColor.a)
|
||||||
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
|
elseif timeLeftSec <= 4 and timeLeftSec >= 3 then
|
||||||
elseif timeLeftSec <= 10 and timeLeftSec >= 5 then
|
auraFrame.cooldown:SetTextColor(1, 0, 0, Gladdy.db.buffsFontColor.a)
|
||||||
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0.7, 0) end
|
elseif timeLeftMilliSec <= 3 and timeLeftMilliSec > 0 then
|
||||||
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
|
auraFrame.cooldown:SetTextColor(1, 0, 0, Gladdy.db.buffsFontColor.a)
|
||||||
elseif timeLeftSec <= 4 and timeLeftSec >= 3 then
|
end
|
||||||
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0, 0) end
|
end
|
||||||
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
|
if timeLeftMilliSec < 0 then
|
||||||
elseif timeLeftMilliSec <= 3 and timeLeftMilliSec > 0 then
|
|
||||||
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0, 0) end
|
|
||||||
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
|
|
||||||
auraFrame.cooldown:SetText("")
|
|
||||||
else -- fallback in case SPELL_AURA_REMOVED is not fired
|
|
||||||
auraFrame:Hide()
|
auraFrame:Hide()
|
||||||
end
|
end
|
||||||
|
Gladdy:FormatTimer(auraFrame.cooldown, timeLeftMilliSec, timeLeftMilliSec <= 3)
|
||||||
else
|
else
|
||||||
auraFrame.cooldown:SetText("")
|
auraFrame.cooldown:SetText("")
|
||||||
end
|
end
|
||||||
@ -504,18 +412,19 @@ function BuffsDebuffs:AddAura(unit, spellID, auraType, duration, timeLeft, stack
|
|||||||
else
|
else
|
||||||
aura = CreateFrame("Frame")
|
aura = CreateFrame("Frame")
|
||||||
aura:EnableMouse(false)
|
aura:EnableMouse(false)
|
||||||
aura:SetFrameLevel(3)
|
aura:SetFrameStrata(Gladdy.db.buffFrameStrata)
|
||||||
|
aura:SetFrameLevel(Gladdy.db.buffsFrameLevel)
|
||||||
aura.texture = aura:CreateTexture(nil, "BACKGROUND")
|
aura.texture = aura:CreateTexture(nil, "BACKGROUND")
|
||||||
aura.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
|
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(Gladdy.db.buffsFrameLevel + 1)
|
||||||
aura.cooldowncircle.noCooldownCount = true -- disable OmniCC
|
aura.cooldowncircle.noCooldownCount = true -- disable OmniCC
|
||||||
aura.cooldowncircle:SetAllPoints(aura)
|
aura.cooldowncircle:SetAllPoints(aura)
|
||||||
aura.cooldowncircle:SetReverse(true)
|
aura.cooldowncircle:SetReverse(true)
|
||||||
aura.cooldowncircle:SetHideCountdownNumbers(true)
|
aura.cooldowncircle:SetHideCountdownNumbers(true)
|
||||||
aura.overlay = CreateFrame("Frame", nil, aura)
|
aura.overlay = CreateFrame("Frame", nil, aura)
|
||||||
aura.overlay:SetFrameLevel(5)
|
aura.overlay:SetFrameLevel(Gladdy.db.buffsFrameLevel + 2)
|
||||||
aura.overlay:SetAllPoints(aura)
|
aura.overlay:SetAllPoints(aura)
|
||||||
aura.border = aura.overlay:CreateTexture(nil, "OVERLAY")
|
aura.border = aura.overlay:CreateTexture(nil, "OVERLAY")
|
||||||
aura.border:SetAllPoints(aura)
|
aura.border:SetAllPoints(aura)
|
||||||
@ -577,36 +486,6 @@ end
|
|||||||
-- OPTIONS
|
-- OPTIONS
|
||||||
------------
|
------------
|
||||||
|
|
||||||
local function option(params)
|
|
||||||
local defaults = {
|
|
||||||
get = function(info)
|
|
||||||
local key = info.arg or info[#info]
|
|
||||||
return Gladdy.dbi.profile[key]
|
|
||||||
end,
|
|
||||||
set = function(info, value)
|
|
||||||
local key = info.arg or info[#info]
|
|
||||||
Gladdy.dbi.profile[key] = value
|
|
||||||
if Gladdy.db.buffsCooldownPos == "LEFT" then
|
|
||||||
Gladdy.db.buffsCooldownGrowDirection = "LEFT"
|
|
||||||
elseif Gladdy.db.buffsCooldownPos == "RIGHT" then
|
|
||||||
Gladdy.db.buffsCooldownGrowDirection = "RIGHT"
|
|
||||||
end
|
|
||||||
if Gladdy.db.buffsBuffsCooldownPos == "LEFT" then
|
|
||||||
Gladdy.db.buffsBuffsCooldownGrowDirection = "LEFT"
|
|
||||||
elseif Gladdy.db.buffsBuffsCooldownPos == "RIGHT" then
|
|
||||||
Gladdy.db.buffsBuffsCooldownGrowDirection = "RIGHT"
|
|
||||||
end
|
|
||||||
Gladdy:UpdateFrame()
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
for k, v in pairs(params) do
|
|
||||||
defaults[k] = v
|
|
||||||
end
|
|
||||||
|
|
||||||
return defaults
|
|
||||||
end
|
|
||||||
|
|
||||||
function BuffsDebuffs:GetOptions()
|
function BuffsDebuffs:GetOptions()
|
||||||
return {
|
return {
|
||||||
headerBuffs = {
|
headerBuffs = {
|
||||||
@ -625,12 +504,14 @@ function BuffsDebuffs:GetOptions()
|
|||||||
name = L["Show CC"],
|
name = L["Show CC"],
|
||||||
desc = L["Shows all debuffs, which are displayed on the ClassIcon as well"],
|
desc = L["Shows all debuffs, which are displayed on the ClassIcon as well"],
|
||||||
order = 4,
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.buffsEnabled end,
|
||||||
}),
|
}),
|
||||||
group = {
|
group = {
|
||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 5,
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.db.buffsEnabled end,
|
||||||
args = {
|
args = {
|
||||||
buffs = {
|
buffs = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -689,18 +570,6 @@ function BuffsDebuffs:GetOptions()
|
|||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 5,
|
order = 5,
|
||||||
},
|
},
|
||||||
buffsBuffsCooldownPos = option({
|
|
||||||
type = "select",
|
|
||||||
name = L["Aura Position"],
|
|
||||||
desc = L["Position of the aura icons"],
|
|
||||||
order = 21,
|
|
||||||
values = {
|
|
||||||
["TOP"] = L["Top"],
|
|
||||||
["BOTTOM"] = L["Bottom"],
|
|
||||||
["LEFT"] = L["Left"],
|
|
||||||
["RIGHT"] = L["Right"],
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
buffsBuffsCooldownGrowDirection = Gladdy:option({
|
buffsBuffsCooldownGrowDirection = Gladdy:option({
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Grow Direction"],
|
name = L["Grow Direction"],
|
||||||
@ -811,18 +680,6 @@ function BuffsDebuffs:GetOptions()
|
|||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 5,
|
order = 5,
|
||||||
},
|
},
|
||||||
buffsCooldownPos = option({
|
|
||||||
type = "select",
|
|
||||||
name = L["Aura Position"],
|
|
||||||
desc = L["Position of the aura icons"],
|
|
||||||
order = 21,
|
|
||||||
values = {
|
|
||||||
["TOP"] = L["Top"],
|
|
||||||
["BOTTOM"] = L["Bottom"],
|
|
||||||
["LEFT"] = L["Left"],
|
|
||||||
["RIGHT"] = L["Right"],
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
buffsCooldownGrowDirection = Gladdy:option({
|
buffsCooldownGrowDirection = Gladdy:option({
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Grow Direction"],
|
name = L["Grow Direction"],
|
||||||
@ -901,11 +758,27 @@ function BuffsDebuffs:GetOptions()
|
|||||||
order = 10,
|
order = 10,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
buffsCooldownNumberAlpha = {
|
||||||
|
type = "range",
|
||||||
|
name = L["Cooldown number alpha"],
|
||||||
|
min = 0,
|
||||||
|
max = 1,
|
||||||
|
step = 0.1,
|
||||||
|
order = 11,
|
||||||
|
width = "full",
|
||||||
|
set = function(info, value)
|
||||||
|
Gladdy.db.buffsFontColor.a = value
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end,
|
||||||
|
get = function(info)
|
||||||
|
return Gladdy.db.buffsFontColor.a
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
font = {
|
font = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = "Font",
|
name = L["Font"],
|
||||||
order = 4,
|
order = 4,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
@ -948,7 +821,7 @@ function BuffsDebuffs:GetOptions()
|
|||||||
},
|
},
|
||||||
border = {
|
border = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = "Border",
|
name = L["Border"],
|
||||||
order = 5,
|
order = 5,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
@ -1032,12 +905,42 @@ function BuffsDebuffs:GetOptions()
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 6,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
buffFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
buffsFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
debuffList = {
|
debuffList = {
|
||||||
name = "Debuff Lists",
|
name = L["Debuff Lists"],
|
||||||
type = "group",
|
type = "group",
|
||||||
order = 11,
|
order = 11,
|
||||||
|
disabled = function() return not Gladdy.db.buffsEnabled end,
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
args = select(1, Gladdy:GetAuras(AURA_TYPE_DEBUFF)),
|
args = select(1, Gladdy:GetAuras(AURA_TYPE_DEBUFF)),
|
||||||
set = function(info, state)
|
set = function(info, state)
|
||||||
@ -1050,9 +953,10 @@ function BuffsDebuffs:GetOptions()
|
|||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
buffList = {
|
buffList = {
|
||||||
name = "Buff Lists",
|
name = L["Buff Lists"],
|
||||||
type = "group",
|
type = "group",
|
||||||
order = 12,
|
order = 12,
|
||||||
|
disabled = function() return not Gladdy.db.buffsEnabled end,
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
args = select(1, Gladdy:GetAuras(AURA_TYPE_BUFF)),
|
args = select(1, Gladdy:GetAuras(AURA_TYPE_BUFF)),
|
||||||
set = function(info, state)
|
set = function(info, state)
|
||||||
@ -1067,3 +971,168 @@ function BuffsDebuffs:GetOptions()
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function BuffsDebuffs:LegacySetPositionDebuffs(unit)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
self.frames[unit].debuffFrame:ClearAllPoints()
|
||||||
|
local powerBarHeight = Gladdy.db.powerBarEnabled and (Gladdy.db.powerBarHeight + 1) or 0
|
||||||
|
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
|
||||||
|
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
|
||||||
|
local offset = 0
|
||||||
|
if (Gladdy.db.buffsCooldownGrowDirection == "RIGHT") then
|
||||||
|
offset = Gladdy.db.buffsIconSize * Gladdy.db.buffsWidthFactor
|
||||||
|
end
|
||||||
|
local pos = Gladdy.db.buffsCooldownPos
|
||||||
|
|
||||||
|
if pos == "TOP" then
|
||||||
|
verticalMargin = horizontalMargin + 1
|
||||||
|
if Gladdy.db.cooldownYPos == "TOP" and Gladdy.db.cooldown then
|
||||||
|
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
||||||
|
end
|
||||||
|
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset + verticalMargin)
|
||||||
|
else
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset + verticalMargin)
|
||||||
|
end
|
||||||
|
elseif pos == "BOTTOM" then
|
||||||
|
verticalMargin = horizontalMargin + 1
|
||||||
|
if Gladdy.db.cooldownYPos == "BOTTOM" and Gladdy.db.cooldown then
|
||||||
|
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
||||||
|
end
|
||||||
|
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "BOTTOMRIGHT", Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset -verticalMargin - powerBarHeight)
|
||||||
|
else
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset -verticalMargin - powerBarHeight)
|
||||||
|
end
|
||||||
|
elseif pos == "LEFT" then
|
||||||
|
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
||||||
|
local anchor = Gladdy:GetAnchor(unit, "LEFT")
|
||||||
|
if anchor == Gladdy.buttons[unit].healthBar then
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset)
|
||||||
|
else
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset)
|
||||||
|
end
|
||||||
|
elseif pos == "RIGHT" then
|
||||||
|
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
||||||
|
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
|
||||||
|
if anchor == Gladdy.buttons[unit].healthBar then
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset)
|
||||||
|
else
|
||||||
|
self.frames[unit].debuffFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsYOffset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
|
||||||
|
function BuffsDebuffs:LegacySetPositionBuffs(unit)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
self.frames[unit].buffFrame:ClearAllPoints()
|
||||||
|
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
|
||||||
|
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
|
||||||
|
local powerBarHeight = Gladdy.db.powerBarEnabled and (Gladdy.db.powerBarHeight + 1) or 0
|
||||||
|
local offset = 0
|
||||||
|
if (Gladdy.db.buffsBuffsCooldownGrowDirection == "RIGHT") then
|
||||||
|
offset = Gladdy.db.buffsBuffsIconSize * Gladdy.db.buffsBuffsWidthFactor
|
||||||
|
end
|
||||||
|
|
||||||
|
local pos = Gladdy.db.buffsBuffsCooldownPos
|
||||||
|
|
||||||
|
if pos == "TOP" then
|
||||||
|
verticalMargin = horizontalMargin + 1
|
||||||
|
if Gladdy.db.cooldownYPos == "TOP" and Gladdy.db.cooldown then
|
||||||
|
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
||||||
|
end
|
||||||
|
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
|
||||||
|
self.frames[unit].buffFrame:SetPoint("BOTTOMLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
|
||||||
|
else
|
||||||
|
self.frames[unit].buffFrame:SetPoint("BOTTOMRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", Gladdy.db.buffsXOffset + offset, Gladdy.db.buffsBuffsYOffset + verticalMargin)
|
||||||
|
end
|
||||||
|
elseif pos == "BOTTOM" then
|
||||||
|
verticalMargin = horizontalMargin + 1
|
||||||
|
if Gladdy.db.cooldownYPos == "BOTTOM" and Gladdy.db.cooldown then
|
||||||
|
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
|
||||||
|
end
|
||||||
|
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
|
||||||
|
self.frames[unit].buffFrame:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "BOTTOMRIGHT", Gladdy.db.buffsBuffsXOffset + offset, Gladdy.db.buffsBuffsYOffset -verticalMargin - powerBarHeight)
|
||||||
|
else
|
||||||
|
self.frames[unit].buffFrame:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "BOTTOMLEFT", Gladdy.db.buffsBuffsXOffset + offset, Gladdy.db.buffsBuffsYOffset -verticalMargin - powerBarHeight)
|
||||||
|
end
|
||||||
|
elseif pos == "LEFT" then
|
||||||
|
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.trinketPos == "LEFT" and Gladdy.db.trinketEnabled) then
|
||||||
|
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.classIconPos == "LEFT") then
|
||||||
|
horizontalMargin = horizontalMargin + (Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor) + Gladdy.db.padding
|
||||||
|
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
|
||||||
|
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.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
|
||||||
|
end
|
||||||
|
--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 + offset, Gladdy.db.buffsBuffsYOffset)
|
||||||
|
else
|
||||||
|
self.frames[unit].buffFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.buffsBuffsXOffset + offset, Gladdy.db.buffsBuffsYOffset)
|
||||||
|
end
|
||||||
|
|
||||||
|
elseif pos == "RIGHT" then
|
||||||
|
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.trinketPos == "RIGHT" and Gladdy.db.trinketEnabled) then
|
||||||
|
horizontalMargin = horizontalMargin + (Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor) + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.classIconPos == "RIGHT") then
|
||||||
|
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
|
||||||
|
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.buffsBuffsIconSize/2 + Gladdy.db.padding/2)
|
||||||
|
end
|
||||||
|
--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 + offset, Gladdy.db.buffsBuffsYOffset)
|
||||||
|
else
|
||||||
|
self.frames[unit].buffFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.buffsBuffsXOffset + offset, Gladdy.db.buffsBuffsYOffset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
@ -25,6 +25,7 @@ local Castbar = Gladdy:NewModule("Cast Bar", 70, {
|
|||||||
castBarIconSize = 22,
|
castBarIconSize = 22,
|
||||||
castBarBorderSize = 8,
|
castBarBorderSize = 8,
|
||||||
castBarFontSize = 12,
|
castBarFontSize = 12,
|
||||||
|
castBarFontOutline = false,
|
||||||
castBarTexture = "Smooth",
|
castBarTexture = "Smooth",
|
||||||
castBarIconStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
castBarIconStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
||||||
castBarBorderStyle = "Gladdy Tooltip round",
|
castBarBorderStyle = "Gladdy Tooltip round",
|
||||||
@ -33,8 +34,8 @@ local Castbar = Gladdy:NewModule("Cast Bar", 70, {
|
|||||||
castBarIconColor = { r = 0, g = 0, b = 0, a = 1 },
|
castBarIconColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
castBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
castBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
castBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
|
castBarFontColor = { r = 1, g = 1, b = 1, a = 1 },
|
||||||
|
castBarIconEnabled = true,
|
||||||
castBarGuesses = true,
|
castBarGuesses = true,
|
||||||
castBarPos = "LEFT",
|
|
||||||
castBarXOffset = 0,
|
castBarXOffset = 0,
|
||||||
castBarYOffset = 0,
|
castBarYOffset = 0,
|
||||||
castBarIconPos = "LEFT",
|
castBarIconPos = "LEFT",
|
||||||
@ -42,12 +43,16 @@ local Castbar = Gladdy:NewModule("Cast Bar", 70, {
|
|||||||
castBarTimerFormat = "LEFT",
|
castBarTimerFormat = "LEFT",
|
||||||
castBarSparkEnabled = true,
|
castBarSparkEnabled = true,
|
||||||
castBarSparkColor = { r = 1, g = 1, b = 1, a = 1 },
|
castBarSparkColor = { r = 1, g = 1, b = 1, a = 1 },
|
||||||
|
castBarFrameStrata = "MEDIUM",
|
||||||
|
castBarFrameLevel = 5,
|
||||||
})
|
})
|
||||||
|
|
||||||
function Castbar:Initialize()
|
function Castbar:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
self:RegisterMessage("UNIT_DEATH")
|
if Gladdy.db.castBarEnabled then
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
@ -57,20 +62,28 @@ 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])
|
||||||
castBar:EnableMouse(false)
|
castBar:EnableMouse(false)
|
||||||
|
castBar:SetMovable(true)
|
||||||
castBar.unit = unit
|
castBar.unit = unit
|
||||||
|
castBar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
||||||
|
|
||||||
castBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.castBarBorderStyle),
|
castBar.backdrop = CreateFrame("Frame", nil, castBar, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
|
castBar.backdrop:SetAllPoints(castBar)
|
||||||
|
castBar.backdrop:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "castBarBorderStyle"),
|
||||||
edgeSize = Gladdy.db.castBarBorderSize })
|
edgeSize = Gladdy.db.castBarBorderSize })
|
||||||
castBar:SetBackdropBorderColor(Gladdy.db.castBarBorderColor.r, Gladdy.db.castBarBorderColor.g, Gladdy.db.castBarBorderColor.b, Gladdy.db.castBarBorderColor.a)
|
castBar.backdrop:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.castBarBorderColor))
|
||||||
castBar:SetFrameLevel(1)
|
castBar.backdrop:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar.backdrop:SetFrameLevel(Gladdy.db.castBarFrameLevel - 1)
|
||||||
|
|
||||||
castBar.bar = CreateFrame("StatusBar", nil, castBar)
|
castBar.bar = CreateFrame("StatusBar", nil, castBar)
|
||||||
castBar.bar:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.castBarTexture))
|
castBar.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
||||||
castBar.bar:SetStatusBarColor(Gladdy.db.castBarColor.r, Gladdy.db.castBarColor.g, Gladdy.db.castBarColor.b, Gladdy.db.castBarColor.a)
|
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
|
||||||
castBar.bar:SetMinMaxValues(0, 100)
|
castBar.bar:SetMinMaxValues(0, 100)
|
||||||
castBar.bar:SetFrameLevel(0)
|
castBar.bar:SetFrameLevel(0)
|
||||||
|
castBar.bar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar.bar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
||||||
|
|
||||||
castBar.spark = castBar:CreateTexture(nil, "OVERLAY")
|
castBar.spark = castBar:CreateTexture(nil, "OVERLAY")
|
||||||
castBar.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
|
castBar.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
|
||||||
@ -81,11 +94,13 @@ function Castbar:CreateFrame(unit)
|
|||||||
|
|
||||||
castBar.bg = castBar.bar:CreateTexture(nil, "BACKGROUND")
|
castBar.bg = castBar.bar:CreateTexture(nil, "BACKGROUND")
|
||||||
castBar.bg:SetAlpha(1)
|
castBar.bg:SetAlpha(1)
|
||||||
castBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.castBarTexture))
|
castBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
||||||
castBar.bg:SetVertexColor(Gladdy.db.castBarBgColor.r, Gladdy.db.castBarBgColor.g, Gladdy.db.castBarBgColor.b, Gladdy.db.castBarBgColor.a)
|
castBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarBgColor))
|
||||||
castBar.bg:SetAllPoints(castBar.bar)
|
castBar.bg:SetAllPoints(castBar.bar)
|
||||||
|
|
||||||
castBar.icon = CreateFrame("Frame", nil, castBar)
|
castBar.icon = CreateFrame("Frame", nil, castBar)
|
||||||
|
castBar.icon:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar.icon:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
||||||
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:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
|
||||||
castBar.icon.texture:SetAllPoints(castBar.icon)
|
castBar.icon.texture:SetAllPoints(castBar.icon)
|
||||||
@ -101,16 +116,16 @@ function Castbar:CreateFrame(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
castBar.spellText = castBar:CreateFontString(nil, "LOW")
|
castBar.spellText = castBar:CreateFontString(nil, "LOW")
|
||||||
castBar.spellText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize)
|
castBar.spellText:SetFont(Gladdy:SMFetch("font", "auraFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
||||||
castBar.spellText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
|
castBar.spellText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
||||||
castBar.spellText:SetShadowOffset(1, -1)
|
castBar.spellText:SetShadowOffset(1, -1)
|
||||||
castBar.spellText:SetShadowColor(0, 0, 0, 1)
|
castBar.spellText:SetShadowColor(0, 0, 0, 1)
|
||||||
castBar.spellText:SetJustifyH("CENTER")
|
castBar.spellText:SetJustifyH("CENTER")
|
||||||
castBar.spellText:SetPoint("LEFT", 7, 0) -- Text of the spell
|
castBar.spellText:SetPoint("LEFT", 7, 0) -- Text of the spell
|
||||||
|
|
||||||
castBar.timeText = castBar:CreateFontString(nil, "LOW")
|
castBar.timeText = castBar:CreateFontString(nil, "LOW")
|
||||||
castBar.timeText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize)
|
castBar.timeText:SetFont(Gladdy:SMFetch("font", "auraFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
||||||
castBar.timeText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
|
castBar.timeText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
||||||
castBar.timeText:SetShadowOffset(1, -1)
|
castBar.timeText:SetShadowOffset(1, -1)
|
||||||
castBar.timeText:SetShadowColor(0, 0, 0, 1)
|
castBar.timeText:SetShadowColor(0, 0, 0, 1)
|
||||||
castBar.timeText:SetJustifyH("CENTER")
|
castBar.timeText:SetJustifyH("CENTER")
|
||||||
@ -121,31 +136,48 @@ function Castbar:CreateFrame(unit)
|
|||||||
self:ResetUnit(unit)
|
self:ResetUnit(unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Castbar:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.castBarEnabled then
|
||||||
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Castbar:UpdateFrame(unit)
|
function Castbar:UpdateFrame(unit)
|
||||||
local button = Gladdy.buttons[unit]
|
|
||||||
local castBar = self.frames[unit]
|
local castBar = self.frames[unit]
|
||||||
if (not castBar) then
|
if (not castBar) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
castBar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
||||||
|
castBar.backdrop:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar.backdrop:SetFrameLevel(Gladdy.db.castBarFrameLevel - 1)
|
||||||
|
castBar.bar:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar.bar:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
||||||
|
castBar.icon:SetFrameStrata(Gladdy.db.castBarFrameStrata)
|
||||||
|
castBar.icon:SetFrameLevel(Gladdy.db.castBarFrameLevel)
|
||||||
|
|
||||||
castBar:SetWidth(Gladdy.db.castBarWidth)
|
castBar:SetWidth(Gladdy.db.castBarWidth)
|
||||||
castBar:SetHeight(Gladdy.db.castBarHeight)
|
castBar:SetHeight(Gladdy.db.castBarHeight)
|
||||||
castBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.castBarBorderStyle),
|
castBar.backdrop:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "castBarBorderStyle"),
|
||||||
edgeSize = Gladdy.db.castBarBorderSize })
|
edgeSize = Gladdy.db.castBarBorderSize })
|
||||||
castBar:SetBackdropBorderColor(Gladdy.db.castBarBorderColor.r, Gladdy.db.castBarBorderColor.g, Gladdy.db.castBarBorderColor.b, Gladdy.db.castBarBorderColor.a)
|
castBar.backdrop:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.castBarBorderColor))
|
||||||
|
|
||||||
castBar.bar:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.castBarTexture))
|
castBar.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
||||||
castBar.bar:ClearAllPoints()
|
castBar.bar:ClearAllPoints()
|
||||||
castBar.bar:SetStatusBarColor(Gladdy.db.castBarColor.r, Gladdy.db.castBarColor.g, Gladdy.db.castBarColor.b, Gladdy.db.castBarColor.a)
|
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
|
||||||
castBar.bar:SetPoint("TOPLEFT", castBar, "TOPLEFT", (Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
castBar.bar:SetPoint("TOPLEFT", castBar, "TOPLEFT", (Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
castBar.bar:SetPoint("BOTTOMRIGHT", castBar, "BOTTOMRIGHT", -(Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
castBar.bar:SetPoint("BOTTOMRIGHT", castBar, "BOTTOMRIGHT", -(Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.castBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
|
|
||||||
castBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.castBarTexture))
|
castBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
|
||||||
castBar.bg:SetVertexColor(Gladdy.db.castBarBgColor.r, Gladdy.db.castBarBgColor.g, Gladdy.db.castBarBgColor.b, Gladdy.db.castBarBgColor.a)
|
castBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarBgColor))
|
||||||
|
|
||||||
if Gladdy.db.castBarSparkEnabled then
|
if Gladdy.db.castBarSparkEnabled then
|
||||||
castBar.spark:SetHeight(Gladdy.db.castBarHeight * 1.8)
|
castBar.spark:SetHeight(Gladdy.db.castBarHeight * 1.8)
|
||||||
castBar.spark:SetVertexColor(Gladdy.db.castBarSparkColor.r, Gladdy.db.castBarSparkColor.g, Gladdy.db.castBarSparkColor.b, Gladdy.db.castBarSparkColor.a)
|
castBar.spark:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarSparkColor))
|
||||||
else
|
else
|
||||||
castBar.spark:SetAlpha(0)
|
castBar.spark:SetAlpha(0)
|
||||||
end
|
end
|
||||||
@ -154,6 +186,11 @@ function Castbar:UpdateFrame(unit)
|
|||||||
castBar.icon:SetHeight(Gladdy.db.castBarIconSize)
|
castBar.icon:SetHeight(Gladdy.db.castBarIconSize)
|
||||||
castBar.icon.texture:SetAllPoints(castBar.icon)
|
castBar.icon.texture:SetAllPoints(castBar.icon)
|
||||||
castBar.icon:ClearAllPoints()
|
castBar.icon:ClearAllPoints()
|
||||||
|
if Gladdy.db.castBarIconEnabled then
|
||||||
|
castBar.icon:Show()
|
||||||
|
else
|
||||||
|
castBar.icon:Hide()
|
||||||
|
end
|
||||||
|
|
||||||
local rightMargin = 0
|
local rightMargin = 0
|
||||||
local leftMargin = 0
|
local leftMargin = 0
|
||||||
@ -165,33 +202,25 @@ function Castbar:UpdateFrame(unit)
|
|||||||
leftMargin = Gladdy.db.castBarIconSize + 1
|
leftMargin = Gladdy.db.castBarIconSize + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
castBar:ClearAllPoints()
|
Gladdy:SetPosition(castBar, unit, "castBarXOffset", "castBarYOffset", Castbar:LegacySetPosition(castBar, unit, leftMargin, rightMargin), Castbar)
|
||||||
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.castBarPos == "LEFT") then
|
|
||||||
local anchor = Gladdy:GetAnchor(unit, "LEFT")
|
|
||||||
if anchor == Gladdy.buttons[unit].healthBar then
|
|
||||||
castBar:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
||||||
else
|
|
||||||
castBar:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if (Gladdy.db.castBarPos == "RIGHT") then
|
|
||||||
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
|
|
||||||
if anchor == Gladdy.buttons[unit].healthBar then
|
|
||||||
castBar:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
||||||
else
|
|
||||||
castBar:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
castBar.spellText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize)
|
castBar.spellText:SetFont(Gladdy:SMFetch("font", "castBarFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
||||||
castBar.spellText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
|
castBar.spellText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
||||||
|
|
||||||
castBar.timeText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize)
|
castBar.timeText:SetFont(Gladdy:SMFetch("font", "castBarFont"), Gladdy.db.castBarFontSize, Gladdy.db.castBarFontOutline and "OUTLINE")
|
||||||
castBar.timeText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
|
castBar.timeText:SetTextColor(Gladdy:SetColor(Gladdy.db.castBarFontColor))
|
||||||
|
|
||||||
castBar.icon.texture.overlay:SetTexture(Gladdy.db.castBarIconStyle)
|
castBar.icon.texture.overlay:SetTexture(Gladdy.db.castBarIconStyle)
|
||||||
castBar.icon.texture.overlay:SetVertexColor(Gladdy.db.castBarIconColor.r, Gladdy.db.castBarIconColor.g, Gladdy.db.castBarIconColor.b, Gladdy.db.castBarIconColor.a)
|
castBar.icon.texture.overlay:SetVertexColor(Gladdy:SetColor(Gladdy.db.castBarIconColor))
|
||||||
|
|
||||||
|
if (unit == "arena1") then
|
||||||
|
Gladdy:CreateMover(castBar, "castBarXOffset", "castBarYOffset", L["Cast Bar"],
|
||||||
|
{"TOPLEFT", "TOPLEFT"}, Gladdy.db.castBarWidth, Gladdy.db.castBarHeight,
|
||||||
|
0, 0, "castBarEnabled")
|
||||||
|
end
|
||||||
|
if not Gladdy.db.castBarEnabled then
|
||||||
|
self:CAST_STOP(unit)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
@ -232,7 +261,7 @@ function Castbar.OnUpdate(castBar, elapsed)
|
|||||||
castBar.spark:SetPoint("CENTER", castBar.bar, "LEFT", castBar.spark.position, 0)
|
castBar.spark:SetPoint("CENTER", castBar.bar, "LEFT", castBar.spark.position, 0)
|
||||||
castBar.spark:Show()
|
castBar.spark:Show()
|
||||||
end
|
end
|
||||||
elseif ( GetTime() < castBar.holdTime ) then
|
elseif ( castBar.holdTime and GetTime() < castBar.holdTime ) then
|
||||||
castBar.timeText:Hide()
|
castBar.timeText:Hide()
|
||||||
castBar.spark:Hide()
|
castBar.spark:Hide()
|
||||||
return
|
return
|
||||||
@ -244,7 +273,7 @@ function Castbar.OnUpdate(castBar, elapsed)
|
|||||||
castBar.fadeOut = nil;
|
castBar.fadeOut = nil;
|
||||||
castBar.timeText:Show()
|
castBar.timeText:Show()
|
||||||
castBar.spark:Show()
|
castBar.spark:Show()
|
||||||
castBar:Hide();
|
castBar:SetAlpha(0)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -253,7 +282,7 @@ Castbar.CastEventsFunc = {}
|
|||||||
Castbar.CastEventsFunc["UNIT_SPELLCAST_START"] = function(castBar, event, ...)
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_START"] = function(castBar, event, ...)
|
||||||
local name, text, texture, startTime, endTime, isTradeSkill, castID = UnitCastingInfo(castBar.unit)
|
local name, text, texture, startTime, endTime, isTradeSkill, castID = UnitCastingInfo(castBar.unit)
|
||||||
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
||||||
castBar:Hide()
|
castBar:SetAlpha(0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -284,7 +313,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_SUCCEEDED"] = function(castBar, event, ..
|
|||||||
end
|
end
|
||||||
Castbar.CastEventsFunc["UNIT_SPELLCAST_STOP"] = function(castBar, event, ...)
|
Castbar.CastEventsFunc["UNIT_SPELLCAST_STOP"] = function(castBar, event, ...)
|
||||||
if ( not castBar:IsVisible() ) then
|
if ( not castBar:IsVisible() ) then
|
||||||
castBar:Hide()
|
castBar:SetAlpha(0)
|
||||||
end
|
end
|
||||||
if ( (castBar.casting and event == "UNIT_SPELLCAST_STOP" and select(2, ...) == castBar.castID) or
|
if ( (castBar.casting and event == "UNIT_SPELLCAST_STOP" and select(2, ...) == castBar.castID) or
|
||||||
(castBar.channeling and event == "UNIT_SPELLCAST_CHANNEL_STOP") ) then
|
(castBar.channeling and event == "UNIT_SPELLCAST_CHANNEL_STOP") ) then
|
||||||
@ -332,7 +361,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_DELAYED"] = function(castBar, event, ...)
|
|||||||
|
|
||||||
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
||||||
-- if there is no name, there is no bar
|
-- if there is no name, there is no bar
|
||||||
castBar:Hide()
|
castBar:SetAlpha(0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
castBar.value = (GetTime() - (startTime / 1000))
|
castBar.value = (GetTime() - (startTime / 1000))
|
||||||
@ -350,7 +379,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_CHANNEL_START"] = function(castBar, event
|
|||||||
local name, text, texture, startTime, endTime, isTradeSkill, spellID = UnitChannelInfo(castBar.unit)
|
local name, text, texture, startTime, endTime, isTradeSkill, spellID = UnitChannelInfo(castBar.unit)
|
||||||
|
|
||||||
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
||||||
castBar:Hide()
|
castBar:SetAlpha(0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if ( castBar.spark ) then
|
if ( castBar.spark ) then
|
||||||
@ -368,7 +397,7 @@ Castbar.CastEventsFunc["UNIT_SPELLCAST_CHANNEL_UPDATE"] = function(castBar, even
|
|||||||
if ( castBar:IsShown() ) then
|
if ( castBar:IsShown() ) then
|
||||||
local name, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(castBar.unit)
|
local name, text, texture, startTime, endTime, isTradeSkill = UnitChannelInfo(castBar.unit)
|
||||||
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
if ( not name or (not castBar.showTradeSkills and isTradeSkill)) then
|
||||||
castBar:Hide()
|
castBar:SetAlpha(0)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
castBar.value = ((endTime / 1000) - GetTime())
|
castBar.value = ((endTime / 1000) - GetTime())
|
||||||
@ -397,18 +426,26 @@ function Castbar:CAST_START(unit, spell, icon, value, maxValue, test)
|
|||||||
castBar.channeling = test == "channel"
|
castBar.channeling = test == "channel"
|
||||||
end
|
end
|
||||||
|
|
||||||
castBar.bar:SetStatusBarColor(Gladdy.db.castBarColor.r, Gladdy.db.castBarColor.g, Gladdy.db.castBarColor.b, Gladdy.db.castBarColor.a)
|
castBar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.castBarColor))
|
||||||
castBar.value = value
|
castBar.value = value
|
||||||
castBar.maxValue = maxValue
|
castBar.maxValue = maxValue
|
||||||
castBar.bar:SetMinMaxValues(0, maxValue)
|
castBar.bar:SetMinMaxValues(0, maxValue)
|
||||||
castBar.bar:SetValue(value)
|
castBar.bar:SetValue(value)
|
||||||
|
castBar.icon:SetAlpha(1)
|
||||||
castBar.icon.texture:SetTexture(icon)
|
castBar.icon.texture:SetTexture(icon)
|
||||||
castBar.spellText:SetText(spell)
|
castBar.spellText:SetText(spell)
|
||||||
castBar.timeText:SetText(maxValue)
|
castBar.timeText:SetText(maxValue)
|
||||||
castBar.bg:Show()
|
castBar.bg:Show()
|
||||||
castBar:Show()
|
castBar.backdrop:Show()
|
||||||
|
if Gladdy.db.castBarSparkEnabled then
|
||||||
|
castBar.spark:Show()
|
||||||
|
end
|
||||||
castBar:SetAlpha(1)
|
castBar:SetAlpha(1)
|
||||||
castBar.icon:Show()
|
if Gladdy.db.castBarIconEnabled then
|
||||||
|
castBar.icon:Show()
|
||||||
|
else
|
||||||
|
castBar.icon:Hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Castbar:CAST_STOP(unit, ...)
|
function Castbar:CAST_STOP(unit, ...)
|
||||||
@ -421,12 +458,14 @@ function Castbar:CAST_STOP(unit, ...)
|
|||||||
castBar.channeling = nil
|
castBar.channeling = nil
|
||||||
castBar.value = 0
|
castBar.value = 0
|
||||||
castBar.maxValue = 0
|
castBar.maxValue = 0
|
||||||
|
castBar.icon:SetAlpha(0)
|
||||||
castBar.icon.texture:SetTexture("")
|
castBar.icon.texture:SetTexture("")
|
||||||
castBar.spellText:SetText("")
|
castBar.spellText:SetText("")
|
||||||
castBar.timeText:SetText("")
|
castBar.timeText:SetText("")
|
||||||
castBar.bar:SetValue(0)
|
castBar.bar:SetValue(0)
|
||||||
castBar.bg:Hide()
|
castBar.bg:Hide()
|
||||||
castBar:Hide()
|
castBar.backdrop:Hide()
|
||||||
|
castBar.spark:Hide()
|
||||||
castBar.icon:Hide()
|
castBar.icon:Hide()
|
||||||
else
|
else
|
||||||
castBar.bar:SetStatusBarColor(...)
|
castBar.bar:SetStatusBarColor(...)
|
||||||
@ -557,6 +596,7 @@ function Castbar:GetOptions()
|
|||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.castBarEnabled end,
|
||||||
args = {
|
args = {
|
||||||
barFrame = {
|
barFrame = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -574,7 +614,7 @@ function Castbar:GetOptions()
|
|||||||
desc = L["Height of the bar"],
|
desc = L["Height of the bar"],
|
||||||
order = 3,
|
order = 3,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 50,
|
max = 200,
|
||||||
step = 1,
|
step = 1,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
@ -584,7 +624,7 @@ function Castbar:GetOptions()
|
|||||||
desc = L["Width of the bars"],
|
desc = L["Width of the bars"],
|
||||||
order = 4,
|
order = 4,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 300,
|
max = 600,
|
||||||
step = 1,
|
step = 1,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
@ -654,6 +694,12 @@ function Castbar:GetOptions()
|
|||||||
name = L["Icon Size"],
|
name = L["Icon Size"],
|
||||||
order = 1,
|
order = 1,
|
||||||
},
|
},
|
||||||
|
castBarIconEnabled = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Icon Enabled"],
|
||||||
|
order = 2,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
castBarIconSize = option({
|
castBarIconSize = option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Icon size"],
|
name = L["Icon size"],
|
||||||
@ -740,6 +786,12 @@ function Castbar:GetOptions()
|
|||||||
max = 20,
|
max = 20,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
castBarFontOutline = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Outline"],
|
||||||
|
order = 5,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
headerFormat = {
|
headerFormat = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Format"],
|
name = L["Format"],
|
||||||
@ -767,15 +819,6 @@ function Castbar:GetOptions()
|
|||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 1,
|
order = 1,
|
||||||
},
|
},
|
||||||
castBarPos = option({
|
|
||||||
type = "select",
|
|
||||||
name = L["Castbar position"],
|
|
||||||
order = 2,
|
|
||||||
values = {
|
|
||||||
["LEFT"] = L["Left"],
|
|
||||||
["RIGHT"] = L["Right"],
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
castBarIconPos = option( {
|
castBarIconPos = option( {
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Icon position"],
|
name = L["Icon position"],
|
||||||
@ -810,7 +853,73 @@ function Castbar:GetOptions()
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 6,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
castBarFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
castBarFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 1,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Castbar:LegacySetPosition(castBar, unit, leftMargin, rightMargin)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
castBar:ClearAllPoints()
|
||||||
|
if Gladdy.db.castBarWidth <= 0 then
|
||||||
|
castBar:SetWidth(0.1)
|
||||||
|
end
|
||||||
|
if Gladdy.db.castBarHeight <= 0 then
|
||||||
|
castBar:SetHeight(0.1)
|
||||||
|
end
|
||||||
|
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.castBarPos == "LEFT") then
|
||||||
|
local anchor = Gladdy:GetAnchor(unit, "LEFT")
|
||||||
|
if anchor == Gladdy.buttons[unit].healthBar then
|
||||||
|
castBar:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
||||||
|
else
|
||||||
|
castBar:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding - leftMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (Gladdy.db.castBarPos == "RIGHT") then
|
||||||
|
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
|
||||||
|
if anchor == Gladdy.buttons[unit].healthBar then
|
||||||
|
castBar:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
||||||
|
else
|
||||||
|
castBar:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + rightMargin + Gladdy.db.castBarXOffset, Gladdy.db.castBarYOffset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Gladdy.db.newLayout
|
||||||
end
|
end
|
@ -1,16 +1,22 @@
|
|||||||
local select = select
|
local select, str_gsub = select, string.gsub
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local GetSpellInfo = GetSpellInfo
|
local GetSpellInfo = GetSpellInfo
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local Classicon = Gladdy:NewModule("Class Icon", 80, {
|
local Classicon = Gladdy:NewModule("Class Icon", 81, {
|
||||||
classIconPos = "LEFT",
|
classIconEnabled = true,
|
||||||
classIconSize = 60 + 20 + 1,
|
classIconSize = 60 + 20 + 1,
|
||||||
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,
|
classIconSpecIcon = false,
|
||||||
|
classIconXOffset = 0,
|
||||||
|
classIconYOffset = 0,
|
||||||
|
classIconFrameStrata = "MEDIUM",
|
||||||
|
classIconFrameLevel = 5,
|
||||||
|
classIconGroup = false,
|
||||||
|
classIconGroupDirection = "DOWN"
|
||||||
})
|
})
|
||||||
|
|
||||||
local classIconPath = "Interface\\Addons\\Gladdy\\Images\\Classes\\"
|
local classIconPath = "Interface\\Addons\\Gladdy\\Images\\Classes\\"
|
||||||
@ -78,9 +84,21 @@ local specIcons = {
|
|||||||
function Classicon:Initialize()
|
function Classicon:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
|
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
if Gladdy.db.classIconEnabled then
|
||||||
self:RegisterMessage("UNIT_DEATH")
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
self:RegisterMessage("UNIT_SPEC")
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Classicon:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.classIconEnabled then
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Classicon:CreateFrame(unit)
|
function Classicon:CreateFrame(unit)
|
||||||
@ -99,13 +117,6 @@ function Classicon:CreateFrame(unit)
|
|||||||
classIcon:SetFrameStrata("MEDIUM")
|
classIcon:SetFrameStrata("MEDIUM")
|
||||||
classIcon:SetFrameLevel(2)
|
classIcon:SetFrameLevel(2)
|
||||||
|
|
||||||
classIcon:ClearAllPoints()
|
|
||||||
if (Gladdy.db.classIconPos == "RIGHT") then
|
|
||||||
classIcon:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", 2, 2)
|
|
||||||
else
|
|
||||||
classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -2, 2)
|
|
||||||
end
|
|
||||||
|
|
||||||
Gladdy.buttons[unit].classIcon = classIcon
|
Gladdy.buttons[unit].classIcon = classIcon
|
||||||
self.frames[unit] = classIcon
|
self.frames[unit] = classIcon
|
||||||
end
|
end
|
||||||
@ -116,22 +127,49 @@ function Classicon:UpdateFrame(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
classIcon:SetFrameStrata(Gladdy.db.classIconFrameStrata)
|
||||||
|
classIcon:SetFrameLevel(Gladdy.db.classIconFrameLevel)
|
||||||
|
|
||||||
classIcon:SetWidth(Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor)
|
classIcon:SetWidth(Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor)
|
||||||
classIcon:SetHeight(Gladdy.db.classIconSize)
|
classIcon:SetHeight(Gladdy.db.classIconSize)
|
||||||
|
|
||||||
classIcon:ClearAllPoints()
|
Gladdy:SetPosition(classIcon, unit, "classIconXOffset", "classIconYOffset", Classicon:LegacySetPosition(classIcon, unit), Classicon)
|
||||||
local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.classIconPos == "LEFT") then
|
if (Gladdy.db.classIconGroup) then
|
||||||
classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0)
|
if (unit ~= "arena1") then
|
||||||
else
|
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
|
||||||
classIcon:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPRIGHT", margin, 0)
|
self.frames[unit]:ClearAllPoints()
|
||||||
|
if Gladdy.db.classIconGroupDirection == "RIGHT" then
|
||||||
|
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
|
||||||
|
elseif Gladdy.db.classIconGroupDirection == "LEFT" then
|
||||||
|
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
|
||||||
|
elseif Gladdy.db.classIconGroupDirection == "UP" then
|
||||||
|
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
|
||||||
|
elseif Gladdy.db.classIconGroupDirection == "DOWN" then
|
||||||
|
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (unit == "arena1") then
|
||||||
|
Gladdy:CreateMover(classIcon, "classIconXOffset", "classIconYOffset", L["Class Icon"],
|
||||||
|
{"TOPLEFT", "TOPLEFT"},
|
||||||
|
Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor,
|
||||||
|
Gladdy.db.classIconSize,
|
||||||
|
0,
|
||||||
|
0, "classIconEnabled")
|
||||||
end
|
end
|
||||||
|
|
||||||
classIcon.texture:ClearAllPoints()
|
classIcon.texture:ClearAllPoints()
|
||||||
classIcon.texture:SetAllPoints(classIcon)
|
classIcon.texture:SetAllPoints(classIcon)
|
||||||
|
|
||||||
classIcon.texture.overlay:SetTexture(Gladdy.db.classIconBorderStyle)
|
classIcon.texture.overlay:SetTexture(Gladdy.db.classIconBorderStyle)
|
||||||
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:SetColor(Gladdy.db.classIconBorderColor))
|
||||||
|
if Gladdy.db.classIconEnabled then
|
||||||
|
classIcon:Show()
|
||||||
|
else
|
||||||
|
classIcon:Hide()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Classicon:ENEMY_SPOTTED(unit)
|
function Classicon:ENEMY_SPOTTED(unit)
|
||||||
@ -173,13 +211,19 @@ function Classicon:GetOptions()
|
|||||||
name = L["Class Icon"],
|
name = L["Class Icon"],
|
||||||
order = 2,
|
order = 2,
|
||||||
},
|
},
|
||||||
|
classIconEnabled = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Class Icon Enabled"],
|
||||||
|
order = 3,
|
||||||
|
}),
|
||||||
classIconSpecIcon = {
|
classIconSpecIcon = {
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show Spec Icon"],
|
name = L["Show Spec Icon"],
|
||||||
desc = L["Shows Spec Icon once spec is detected"],
|
desc = L["Shows Spec Icon once spec is detected"],
|
||||||
order = 3,
|
order = 4,
|
||||||
get = function(info) return Gladdy.db.classIconSpecIcon end,
|
disabled = function() return not Gladdy.db.classIconEnabled end,
|
||||||
set = function(info, value)
|
get = function() return Gladdy.db.classIconSpecIcon end,
|
||||||
|
set = function(_, value)
|
||||||
Gladdy.db.classIconSpecIcon = value
|
Gladdy.db.classIconSpecIcon = value
|
||||||
if Gladdy.curBracket and Gladdy.curBracket > 0 then
|
if Gladdy.curBracket and Gladdy.curBracket > 0 then
|
||||||
for i=1,Gladdy.curBracket do
|
for i=1,Gladdy.curBracket do
|
||||||
@ -192,11 +236,32 @@ function Classicon:GetOptions()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
classIconGroup = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Group"] .. " " .. L["Class Icon"],
|
||||||
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.db.classIconEnabled end,
|
||||||
|
}),
|
||||||
|
classIconGroupDirection = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Group direction"],
|
||||||
|
order = 6,
|
||||||
|
values = {
|
||||||
|
["RIGHT"] = L["Right"],
|
||||||
|
["LEFT"] = L["Left"],
|
||||||
|
["UP"] = L["Up"],
|
||||||
|
["DOWN"] = L["Down"],
|
||||||
|
},
|
||||||
|
disabled = function()
|
||||||
|
return not Gladdy.db.classIconGroup or not Gladdy.db.classIconEnabled
|
||||||
|
end,
|
||||||
|
}),
|
||||||
group = {
|
group = {
|
||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 7,
|
||||||
|
disabled = function() return not Gladdy.db.classIconEnabled end,
|
||||||
args = {
|
args = {
|
||||||
size = {
|
size = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -211,9 +276,9 @@ function Classicon:GetOptions()
|
|||||||
classIconSize = Gladdy:option({
|
classIconSize = Gladdy:option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Icon size"],
|
name = L["Icon size"],
|
||||||
min = 1,
|
min = 3,
|
||||||
max = 100,
|
max = 100,
|
||||||
step = 1,
|
step = .1,
|
||||||
order = 3,
|
order = 3,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
@ -231,29 +296,37 @@ function Classicon:GetOptions()
|
|||||||
position = {
|
position = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 1,
|
order = 3,
|
||||||
args = {
|
args = {
|
||||||
headerPosition = {
|
headerPosition = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 5,
|
order = 5,
|
||||||
},
|
},
|
||||||
classIconPos = Gladdy:option({
|
classIconXOffset = Gladdy:option({
|
||||||
type = "select",
|
type = "range",
|
||||||
name = L["Icon position"],
|
name = L["Horizontal offset"],
|
||||||
desc = L["This changes positions with trinket"],
|
order = 11,
|
||||||
order = 6,
|
min = -800,
|
||||||
values = {
|
max = 800,
|
||||||
["LEFT"] = L["Left"],
|
step = 0.1,
|
||||||
["RIGHT"] = L["Right"],
|
width = "full",
|
||||||
},
|
}),
|
||||||
|
classIconYOffset = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Vertical offset"],
|
||||||
|
order = 12,
|
||||||
|
min = -800,
|
||||||
|
max = 800,
|
||||||
|
step = 0.1,
|
||||||
|
width = "full",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
border = {
|
border = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Border"],
|
name = L["Border"],
|
||||||
order = 1,
|
order = 2,
|
||||||
args = {
|
args = {
|
||||||
headerBorder = {
|
headerBorder = {
|
||||||
type = "header",
|
type = "header",
|
||||||
@ -275,7 +348,55 @@ function Classicon:GetOptions()
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 4,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
classIconFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
classIconFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Classicon:LegacySetPosition(classIcon, unit)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
classIcon:ClearAllPoints()
|
||||||
|
local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.classIconPos == "LEFT") then
|
||||||
|
classIcon:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0)
|
||||||
|
else
|
||||||
|
classIcon:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPRIGHT", margin, 0)
|
||||||
|
end
|
||||||
end
|
end
|
@ -12,8 +12,8 @@ local Gladdy = LibStub("Gladdy")
|
|||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
|
|
||||||
local attributes = {
|
local attributes = {
|
||||||
{ name = "Target", button = "1", modifier = "", action = "target", spell = "" },
|
{ name = L["Target"], button = "1", modifier = "", action = "target", spell = "" },
|
||||||
{ name = "Focus", button = "2", modifier = "", action = "focus", spell = "" },
|
{ name = L["Focus"], button = "2", modifier = "", action = "focus", spell = "" },
|
||||||
}
|
}
|
||||||
for i = 3, 10 do
|
for i = 3, 10 do
|
||||||
tinsert(attributes, { name = L["Action #%d"]:format(i), button = "", modifier = "", action = "disabled", spell = "" })
|
tinsert(attributes, { name = L["Action #%d"]:format(i), button = "", modifier = "", action = "disabled", spell = "" })
|
||||||
@ -53,8 +53,8 @@ BINDING_NAME_GLADDYBUTTON3_BUTTON5 = L["Button5 Click Enemy 3"]
|
|||||||
BINDING_NAME_GLADDYBUTTON4_BUTTON5 = L["Button5 Click Enemy 4"]
|
BINDING_NAME_GLADDYBUTTON4_BUTTON5 = L["Button5 Click Enemy 4"]
|
||||||
BINDING_NAME_GLADDYBUTTON5_BUTTON5 = L["Button5 Click Enemy 5"]
|
BINDING_NAME_GLADDYBUTTON5_BUTTON5 = L["Button5 Click Enemy 5"]
|
||||||
|
|
||||||
function Clicks:Initialise()
|
function Clicks:Initialize()
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
--
|
||||||
end
|
end
|
||||||
|
|
||||||
function Clicks:Reset()
|
function Clicks:Reset()
|
||||||
@ -62,22 +62,15 @@ function Clicks:Reset()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Clicks:ResetUnit(unit)
|
function Clicks:ResetUnit(unit)
|
||||||
local button = Gladdy.buttons[unit]
|
--
|
||||||
if (not button) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
for k, v in pairs(Gladdy.db.attributes) do
|
|
||||||
button.secure:SetAttribute(v.modifier .. "macrotext" .. v.button, "")
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Clicks:Test()
|
function Clicks:UpdateFrame(unit)
|
||||||
Clicks:JOINED_ARENA()
|
self:SetupAttributes(unit)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Clicks:JOINED_ARENA()
|
function Clicks:UpdateFrameOnce()
|
||||||
for k, v in pairs(Gladdy.buttons) do
|
for _, v in pairs(Gladdy.buttons) do
|
||||||
local left = GetBindingKey(("GLADDYBUTTON%d_LEFT"):format(v.id))
|
local left = GetBindingKey(("GLADDYBUTTON%d_LEFT"):format(v.id))
|
||||||
local right = GetBindingKey(("GLADDYBUTTON%d_RIGHT"):format(v.id))
|
local right = GetBindingKey(("GLADDYBUTTON%d_RIGHT"):format(v.id))
|
||||||
local middle = GetBindingKey(("GLADDYBUTTON%d_MIDDLE"):format(v.id))
|
local middle = GetBindingKey(("GLADDYBUTTON%d_MIDDLE"):format(v.id))
|
||||||
@ -114,7 +107,7 @@ function Clicks:SetupAttributes(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
for k, v in pairs(Gladdy.db.attributes) do
|
for _, v in pairs(Gladdy.db.attributes) do
|
||||||
self:SetupAttribute(button, v.button, v.modifier, v.action, v.spell)
|
self:SetupAttribute(button, v.button, v.modifier, v.action, v.spell)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -145,7 +138,7 @@ function Clicks:SetupAttribute(button, key, mod, action, spell)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local buttons = { ["1"] = L["Left button"], ["2"] = L["Right button"], ["3"] = L["Middle button"], ["4"] = L["Button 4"], ["5"] = L["Button 5"] }
|
local buttons = { ["1"] = L["Left button"], ["2"] = L["Right button"], ["3"] = L["Middle button"], ["4"] = L["Button 4"], ["5"] = L["Button 5"] }
|
||||||
local modifiers = { [""] = L["None"], ["ctrl-"] = L["CTRL"], ["shift-"] = L["SHIFT"], ["alt-"] = L["ALT"] }
|
local modifiers = { [""] = L["None"], ["*"] = L["All"], ["ctrl-"] = L["CTRL"], ["shift-"] = L["SHIFT"], ["alt-"] = L["ALT"] }
|
||||||
local clickValues = { ["macro"] = MACRO, ["target"] = TARGET, ["focus"] = FOCUS, ["spell"] = L["Cast Spell"], ["disabled"] = ADDON_DISABLED }
|
local clickValues = { ["macro"] = MACRO, ["target"] = TARGET, ["focus"] = FOCUS, ["spell"] = L["Cast Spell"], ["disabled"] = ADDON_DISABLED }
|
||||||
|
|
||||||
local function SetupAttributeOption(i)
|
local function SetupAttributeOption(i)
|
||||||
@ -221,9 +214,4 @@ function Clicks:GetOptions()
|
|||||||
options[tostring(i)] = SetupAttributeOption(i)
|
options[tostring(i)] = SetupAttributeOption(i)
|
||||||
end
|
end
|
||||||
return options
|
return options
|
||||||
end
|
|
||||||
|
|
||||||
function Clicks:UpdateFrame(unit)
|
|
||||||
self:SetupAttributes(unit)
|
|
||||||
self:JOINED_ARENA()
|
|
||||||
end
|
end
|
@ -1,7 +1,6 @@
|
|||||||
local select = select
|
local select = select
|
||||||
local UnitExists, UnitAffectingCombat, GetSpellInfo = UnitExists, UnitAffectingCombat, GetSpellInfo
|
local UnitExists, UnitAffectingCombat, GetSpellInfo = UnitExists, UnitAffectingCombat, GetSpellInfo
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local ANCHORS = { ["LEFT"] = "RIGHT", ["RIGHT"] = "LEFT", ["BOTTOM"] = "TOP", ["TOP"] = "BOTTOM"}
|
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
@ -11,17 +10,19 @@ local CombatIndicator = Gladdy:NewModule("Combat Indicator", nil, {
|
|||||||
ciSize = 20,
|
ciSize = 20,
|
||||||
ciAlpha = 1,
|
ciAlpha = 1,
|
||||||
ciWidthFactor = 1,
|
ciWidthFactor = 1,
|
||||||
ciAnchor = "healthBar",
|
|
||||||
ciPos = "TOP",
|
|
||||||
ciXOffset = 0,
|
ciXOffset = 0,
|
||||||
ciYOffset = -31,
|
ciYOffset = -31,
|
||||||
ciBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
ciBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
||||||
ciBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
ciBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
|
ciFrameStrata = "HIGH",
|
||||||
|
ciFrameLevel = 5,
|
||||||
})
|
})
|
||||||
|
|
||||||
function CombatIndicator:Initialize()
|
function CombatIndicator:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
if Gladdy.db.ciEnabled then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
end
|
||||||
self.updateInterval = 0.05
|
self.updateInterval = 0.05
|
||||||
self.combatIndicatorIcon = select(3, GetSpellInfo(674))
|
self.combatIndicatorIcon = select(3, GetSpellInfo(674))
|
||||||
end
|
end
|
||||||
@ -38,7 +39,9 @@ function CombatIndicator:CreateFrame(unit)
|
|||||||
end
|
end
|
||||||
local ciFrame = CreateFrame("Frame", "GladdyCombatindicator" .. unit, button)
|
local ciFrame = CreateFrame("Frame", "GladdyCombatindicator" .. unit, button)
|
||||||
ciFrame:EnableMouse(false)
|
ciFrame:EnableMouse(false)
|
||||||
ciFrame:SetFrameStrata("HIGH")
|
ciFrame:SetMovable(true)
|
||||||
|
ciFrame:SetFrameStrata(Gladdy.db.ciFrameStrata)
|
||||||
|
ciFrame:SetFrameLevel(Gladdy.db.ciFrameLevel)
|
||||||
ciFrame:SetHeight(Gladdy.db.ciSize)
|
ciFrame:SetHeight(Gladdy.db.ciSize)
|
||||||
ciFrame:SetWidth(Gladdy.db.ciSize * Gladdy.db.ciWidthFactor)
|
ciFrame:SetWidth(Gladdy.db.ciSize * Gladdy.db.ciWidthFactor)
|
||||||
|
|
||||||
@ -50,25 +53,36 @@ function CombatIndicator:CreateFrame(unit)
|
|||||||
ciFrame.border = ciFrame:CreateTexture(nil, "OVERLAY")
|
ciFrame.border = ciFrame:CreateTexture(nil, "OVERLAY")
|
||||||
ciFrame.border:SetAllPoints(ciFrame)
|
ciFrame.border:SetAllPoints(ciFrame)
|
||||||
ciFrame.border:SetTexture(Gladdy.db.ciBorderStyle)
|
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.border:SetVertexColor(Gladdy:SetColor(Gladdy.db.ciBorderColor))
|
||||||
|
|
||||||
self.frames[unit] = ciFrame
|
self.frames[unit] = ciFrame
|
||||||
button.ciFrame = ciFrame
|
button.ciFrame = ciFrame
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function CombatIndicator:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.ciEnabled then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function CombatIndicator:UpdateFrame(unit)
|
function CombatIndicator:UpdateFrame(unit)
|
||||||
local button = Gladdy.buttons[unit]
|
local button = Gladdy.buttons[unit]
|
||||||
local ciFrame = self.frames[unit]
|
local ciFrame = self.frames[unit]
|
||||||
if (not button or not ciFrame) then
|
if (not button or not ciFrame) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ciFrame:SetFrameStrata(Gladdy.db.ciFrameStrata)
|
||||||
|
ciFrame:SetFrameLevel(Gladdy.db.ciFrameLevel)
|
||||||
|
|
||||||
ciFrame:SetHeight(Gladdy.db.ciSize)
|
ciFrame:SetHeight(Gladdy.db.ciSize)
|
||||||
ciFrame:SetWidth(Gladdy.db.ciSize * Gladdy.db.ciWidthFactor)
|
ciFrame:SetWidth(Gladdy.db.ciSize * Gladdy.db.ciWidthFactor)
|
||||||
ciFrame.border:SetTexture(Gladdy.db.ciBorderStyle)
|
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.border:SetVertexColor(Gladdy:SetColor(Gladdy.db.ciBorderColor))
|
||||||
|
|
||||||
ciFrame:ClearAllPoints()
|
Gladdy:SetPosition(ciFrame, unit, "ciXOffset", "ciYOffset", CombatIndicator:LegacySetPosition(ciFrame, unit), CombatIndicator)
|
||||||
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)
|
ciFrame:SetAlpha(Gladdy.db.ciAlpha)
|
||||||
|
|
||||||
@ -77,6 +91,12 @@ function CombatIndicator:UpdateFrame(unit)
|
|||||||
else
|
else
|
||||||
ciFrame:Show()
|
ciFrame:Show()
|
||||||
end
|
end
|
||||||
|
if (unit == "arena1") then
|
||||||
|
Gladdy:CreateMover(ciFrame, "ciXOffset", "ciYOffset", L["Combat Indicator"],
|
||||||
|
{"TOPLEFT", "TOPLEFT"},
|
||||||
|
Gladdy.db.ciSize * Gladdy.db.ciWidthFactor, Gladdy.db.ciSize,
|
||||||
|
0, 0, "ciEnabled")
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function CombatIndicator:Test()
|
function CombatIndicator:Test()
|
||||||
@ -123,6 +143,7 @@ function CombatIndicator:GetOptions()
|
|||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.ciEnabled end,
|
||||||
args = {
|
args = {
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -166,37 +187,13 @@ function CombatIndicator:GetOptions()
|
|||||||
position = {
|
position = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 4,
|
order = 3,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 4,
|
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({
|
ciXOffset = Gladdy:option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Horizontal offset"],
|
name = L["Horizontal offset"],
|
||||||
@ -220,7 +217,7 @@ function CombatIndicator:GetOptions()
|
|||||||
border = {
|
border = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Border"],
|
name = L["Border"],
|
||||||
order = 4,
|
order = 2,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
@ -242,7 +239,56 @@ function CombatIndicator:GetOptions()
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 5,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
ciFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
ciFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function CombatIndicator:LegacySetPosition(ciFrame, unit)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
-- LEGACY options
|
||||||
|
local ANCHORS = { ["LEFT"] = "RIGHT", ["RIGHT"] = "LEFT", ["BOTTOM"] = "TOP", ["TOP"] = "BOTTOM"}
|
||||||
|
local ciAnchor = Gladdy.db.ciAnchor or Gladdy.legacy.ciAnchor
|
||||||
|
local ciPos = Gladdy.db.ciPos
|
||||||
|
|
||||||
|
ciFrame:ClearAllPoints()
|
||||||
|
ciFrame:SetPoint(ANCHORS[ciPos], Gladdy.buttons[unit][ciAnchor], ciPos, Gladdy.db.ciXOffset, Gladdy.db.ciYOffset)
|
||||||
|
return Gladdy.db.newLayout
|
||||||
end
|
end
|
File diff suppressed because it is too large
Load Diff
@ -1,14 +1,12 @@
|
|||||||
local select = select
|
local select = select
|
||||||
local pairs,ipairs,tbl_sort,tinsert,format = pairs,ipairs,table.sort,tinsert,format
|
local pairs,ipairs,tbl_sort,tinsert,format,rand = pairs,ipairs,table.sort,tinsert,format,math.random
|
||||||
|
|
||||||
local drDuration = 18
|
|
||||||
|
|
||||||
local GetSpellInfo = GetSpellInfo
|
local GetSpellInfo = GetSpellInfo
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local GetTime = GetTime
|
local GetTime = GetTime
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local DRData = LibStub("DRData-1.0")
|
local DRData = LibStub("DRData-1.0-BCC")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local function defaultCategories()
|
local function defaultCategories()
|
||||||
local categories = {}
|
local categories = {}
|
||||||
@ -17,7 +15,7 @@ local function defaultCategories()
|
|||||||
tinsert(indexList, {spellID = k, category = v})
|
tinsert(indexList, {spellID = k, category = v})
|
||||||
end
|
end
|
||||||
tbl_sort(indexList, function(a, b) return a.spellID < b.spellID end)
|
tbl_sort(indexList, function(a, b) return a.spellID < b.spellID end)
|
||||||
for i,v in ipairs(indexList) do
|
for _,v in ipairs(indexList) do
|
||||||
if not categories[v.category] then
|
if not categories[v.category] then
|
||||||
categories[v.category] = {
|
categories[v.category] = {
|
||||||
enabled = true,
|
enabled = true,
|
||||||
@ -30,9 +28,10 @@ local function defaultCategories()
|
|||||||
end
|
end
|
||||||
local Diminishings = Gladdy:NewModule("Diminishings", nil, {
|
local Diminishings = Gladdy:NewModule("Diminishings", nil, {
|
||||||
drFont = "DorisPP",
|
drFont = "DorisPP",
|
||||||
|
drFontColorsEnabled = false,
|
||||||
drFontColor = { r = 1, g = 1, b = 0, a = 1 },
|
drFontColor = { r = 1, g = 1, b = 0, a = 1 },
|
||||||
drFontScale = 1,
|
drFontScale = 1,
|
||||||
drCooldownPos = "RIGHT",
|
drGrowDirection = "RIGHT",
|
||||||
drXOffset = 0,
|
drXOffset = 0,
|
||||||
drYOffset = 0,
|
drYOffset = 0,
|
||||||
drIconSize = 36,
|
drIconSize = 36,
|
||||||
@ -46,34 +45,56 @@ local Diminishings = Gladdy:NewModule("Diminishings", nil, {
|
|||||||
drHalfColor = {r = 1, g = 1, b = 0, a = 1 },
|
drHalfColor = {r = 1, g = 1, b = 0, a = 1 },
|
||||||
drQuarterColor = {r = 1, g = 0.7, b = 0, a = 1 },
|
drQuarterColor = {r = 1, g = 0.7, b = 0, a = 1 },
|
||||||
drNullColor = {r = 1, g = 0, b = 0, a = 1 },
|
drNullColor = {r = 1, g = 0, b = 0, a = 1 },
|
||||||
|
drLevelTextEnabled = true,
|
||||||
|
drLevelTextFont = "DorisPP",
|
||||||
|
drLevelTextScale = 0.8,
|
||||||
|
drLevelTextColor = { r = 1, g = 1, b = 0, a = 1 },
|
||||||
|
drLevelTextColorsEnabled = true,
|
||||||
drWidthFactor = 1,
|
drWidthFactor = 1,
|
||||||
drCategories = defaultCategories()
|
drCategories = defaultCategories(),
|
||||||
|
drDuration = 18,
|
||||||
|
drFrameStrata = "MEDIUM",
|
||||||
|
drFrameLevel = 3,
|
||||||
})
|
})
|
||||||
|
|
||||||
local function getDiminishColor(dr)
|
local function getDiminishColor(dr)
|
||||||
if dr == 0.5 then
|
if dr == 0.5 then
|
||||||
return Gladdy.db.drHalfColor.r, Gladdy.db.drHalfColor.g, Gladdy.db.drHalfColor.b, Gladdy.db.drHalfColor.a
|
return Gladdy:SetColor(Gladdy.db.drHalfColor)
|
||||||
elseif dr == 0.25 then
|
elseif dr == 0.25 then
|
||||||
return Gladdy.db.drQuarterColor.r, Gladdy.db.drQuarterColor.g, Gladdy.db.drQuarterColor.b, Gladdy.db.drQuarterColor.a
|
return Gladdy:SetColor(Gladdy.db.drQuarterColor)
|
||||||
else
|
else
|
||||||
return Gladdy.db.drNullColor.r, Gladdy.db.drNullColor.g, Gladdy.db.drNullColor.b, Gladdy.db.drNullColor.a
|
return Gladdy:SetColor(Gladdy.db.drNullColor)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function getDiminishText(dr)
|
||||||
|
if dr == 0.5 then
|
||||||
|
return "½"
|
||||||
|
elseif dr == 0.25 then
|
||||||
|
return "¼"
|
||||||
|
else
|
||||||
|
return "ø"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Diminishings:Initialize()
|
function Diminishings:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
self:RegisterMessage("UNIT_DEATH", "ResetUnit", "AURA_FADE", "UNIT_DESTROYED")
|
self:RegisterMessage("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)
|
drFrame:EnableMouse(false)
|
||||||
|
drFrame:SetMovable(true)
|
||||||
|
drFrame:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
|
drFrame:SetFrameLevel(Gladdy.db.drFrameLevel)
|
||||||
|
|
||||||
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)
|
||||||
icon:Hide()
|
icon:Hide()
|
||||||
icon:EnableMouse(false)
|
icon:EnableMouse(false)
|
||||||
icon:SetFrameLevel(3)
|
icon:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
|
icon:SetFrameLevel(Gladdy.db.drFrameLevel)
|
||||||
icon.texture = icon:CreateTexture(nil, "BACKGROUND")
|
icon.texture = icon:CreateTexture(nil, "BACKGROUND")
|
||||||
icon.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
|
icon.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
|
||||||
icon.texture:SetAllPoints(icon)
|
icon.texture:SetAllPoints(icon)
|
||||||
@ -88,16 +109,12 @@ function Diminishings:CreateFrame(unit)
|
|||||||
self.dr = nil
|
self.dr = nil
|
||||||
self.diminishing = 1.0
|
self.diminishing = 1.0
|
||||||
self.texture:SetTexture("")
|
self.texture:SetTexture("")
|
||||||
self.text:SetText("")
|
self.timeText:SetText("")
|
||||||
self:Hide()
|
self:Hide()
|
||||||
Diminishings:Positionate(unit)
|
Diminishings:Positionate(unit)
|
||||||
else
|
else
|
||||||
self.timeLeft = self.timeLeft - elapsed
|
self.timeLeft = self.timeLeft - elapsed
|
||||||
if self.timeLeft >=5 then
|
Gladdy:FormatTimer(self.timeText, self.timeLeft, self.timeLeft < 5)
|
||||||
self.timeText:SetFormattedText("%d", self.timeLeft)
|
|
||||||
else
|
|
||||||
self.timeText:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@ -105,13 +122,15 @@ function Diminishings:CreateFrame(unit)
|
|||||||
icon.cooldown = CreateFrame("Cooldown", nil, icon, "CooldownFrameTemplate")
|
icon.cooldown = CreateFrame("Cooldown", nil, icon, "CooldownFrameTemplate")
|
||||||
icon.cooldown.noCooldownCount = true --Gladdy.db.trinketDisableOmniCC
|
icon.cooldown.noCooldownCount = true --Gladdy.db.trinketDisableOmniCC
|
||||||
icon.cooldown:SetHideCountdownNumbers(true)
|
icon.cooldown:SetHideCountdownNumbers(true)
|
||||||
icon.cooldown:SetFrameLevel(4)
|
icon.cooldown:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
|
icon.cooldown:SetFrameLevel(Gladdy.db.drFrameLevel + 1)
|
||||||
|
|
||||||
icon.cooldownFrame = CreateFrame("Frame", nil, icon)
|
icon.cooldownFrame = CreateFrame("Frame", nil, icon)
|
||||||
icon.cooldownFrame:ClearAllPoints()
|
icon.cooldownFrame:ClearAllPoints()
|
||||||
icon.cooldownFrame:SetPoint("TOPLEFT", icon, "TOPLEFT")
|
icon.cooldownFrame:SetPoint("TOPLEFT", icon, "TOPLEFT")
|
||||||
icon.cooldownFrame:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT")
|
icon.cooldownFrame:SetPoint("BOTTOMRIGHT", icon, "BOTTOMRIGHT")
|
||||||
icon.cooldownFrame:SetFrameLevel(5)
|
icon.cooldownFrame:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
|
icon.cooldownFrame:SetFrameLevel(Gladdy.db.drFrameLevel + 2)
|
||||||
|
|
||||||
--icon.overlay = CreateFrame("Frame", nil, icon)
|
--icon.overlay = CreateFrame("Frame", nil, icon)
|
||||||
--icon.overlay:SetAllPoints(icon)
|
--icon.overlay:SetAllPoints(icon)
|
||||||
@ -119,24 +138,24 @@ function Diminishings:CreateFrame(unit)
|
|||||||
icon.border:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
|
icon.border:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
|
||||||
icon.border:SetAllPoints(icon)
|
icon.border:SetAllPoints(icon)
|
||||||
|
|
||||||
icon.text = icon.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
|
||||||
icon.text:SetDrawLayer("OVERLAY")
|
|
||||||
icon.text:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.drFont), 10, "OUTLINE")
|
|
||||||
icon.text:SetTextColor(Gladdy.db.drFontColor.r, Gladdy.db.drFontColor.g, Gladdy.db.drFontColor.b, Gladdy.db.drFontColor.a)
|
|
||||||
icon.text:SetShadowOffset(1, -1)
|
|
||||||
icon.text:SetShadowColor(0, 0, 0, 1)
|
|
||||||
icon.text:SetJustifyH("CENTER")
|
|
||||||
icon.text:SetPoint("CENTER")
|
|
||||||
|
|
||||||
icon.timeText = icon.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
icon.timeText = icon.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
||||||
icon.timeText:SetDrawLayer("OVERLAY")
|
icon.timeText:SetDrawLayer("OVERLAY")
|
||||||
icon.timeText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.drFont), 10, "OUTLINE")
|
icon.timeText:SetFont(Gladdy:SMFetch("font", "drFont"), 10, "OUTLINE")
|
||||||
icon.timeText:SetTextColor(Gladdy.db.drFontColor.r, Gladdy.db.drFontColor.g, Gladdy.db.drFontColor.b, Gladdy.db.drFontColor.a)
|
icon.timeText:SetTextColor(Gladdy:SetColor(Gladdy.db.drFontColor))
|
||||||
icon.timeText:SetShadowOffset(1, -1)
|
icon.timeText:SetShadowOffset(1, -1)
|
||||||
icon.timeText:SetShadowColor(0, 0, 0, 1)
|
icon.timeText:SetShadowColor(0, 0, 0, 1)
|
||||||
icon.timeText:SetJustifyH("CENTER")
|
icon.timeText:SetJustifyH("CENTER")
|
||||||
icon.timeText:SetPoint("CENTER", icon, "CENTER", 0, 1)
|
icon.timeText:SetPoint("CENTER", icon, "CENTER", 0, 1)
|
||||||
|
|
||||||
|
icon.drLevelText = icon.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
||||||
|
icon.drLevelText:SetDrawLayer("OVERLAY")
|
||||||
|
icon.drLevelText:SetFont(Gladdy:SMFetch("font", "drLevelTextFont"), 10, "OUTLINE")
|
||||||
|
icon.drLevelText:SetTextColor(getDiminishColor(1))
|
||||||
|
icon.drLevelText:SetShadowOffset(1, -1)
|
||||||
|
icon.drLevelText:SetShadowColor(0, 0, 0, 1)
|
||||||
|
icon.drLevelText:SetJustifyH("CENTER")
|
||||||
|
icon.drLevelText:SetPoint("BOTTOM", icon, "BOTTOM", 0, 0)
|
||||||
|
|
||||||
icon.diminishing = 1
|
icon.diminishing = 1
|
||||||
|
|
||||||
drFrame["icon" .. i] = icon
|
drFrame["icon" .. i] = icon
|
||||||
@ -161,27 +180,21 @@ function Diminishings:UpdateFrame(unit)
|
|||||||
drFrame:Show()
|
drFrame:Show()
|
||||||
end
|
end
|
||||||
|
|
||||||
drFrame:ClearAllPoints()
|
drFrame:SetWidth(Gladdy.db.drIconSize)
|
||||||
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.drCooldownPos == "LEFT") then
|
|
||||||
local anchor = Gladdy:GetAnchor(unit, "LEFT")
|
|
||||||
if anchor == Gladdy.buttons[unit].healthBar then
|
|
||||||
drFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
|
||||||
else
|
|
||||||
drFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if (Gladdy.db.drCooldownPos == "RIGHT") then
|
|
||||||
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
|
|
||||||
if anchor == Gladdy.buttons[unit].healthBar then
|
|
||||||
drFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
|
||||||
else
|
|
||||||
drFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
drFrame:SetWidth(Gladdy.db.drIconSize * 16)
|
|
||||||
drFrame:SetHeight(Gladdy.db.drIconSize)
|
drFrame:SetHeight(Gladdy.db.drIconSize)
|
||||||
|
drFrame:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
|
drFrame:SetFrameLevel(Gladdy.db.drFrameLevel)
|
||||||
|
|
||||||
|
Gladdy:SetPosition(drFrame, unit, "drXOffset", "drYOffset", Diminishings:LegacySetPosition(drFrame, unit), Diminishings)
|
||||||
|
|
||||||
|
if (unit == "arena1") then
|
||||||
|
Gladdy:CreateMover(drFrame,"drXOffset", "drYOffset", L["Diminishings"],
|
||||||
|
Gladdy.db.drGrowDirection == "RIGHT" and {"TOPLEFT", "TOPLEFT"} or {"TOPRIGHT", "TOPRIGHT"},
|
||||||
|
Gladdy.db.drIconSize * Gladdy.db.drWidthFactor,
|
||||||
|
Gladdy.db.drIconSize,
|
||||||
|
0,
|
||||||
|
0, "drEnabled")
|
||||||
|
end
|
||||||
|
|
||||||
for i = 1, 16 do
|
for i = 1, 16 do
|
||||||
local icon = drFrame["icon" .. i]
|
local icon = drFrame["icon" .. i]
|
||||||
@ -189,10 +202,26 @@ function Diminishings:UpdateFrame(unit)
|
|||||||
icon:SetWidth(Gladdy.db.drIconSize * Gladdy.db.drWidthFactor)
|
icon:SetWidth(Gladdy.db.drIconSize * Gladdy.db.drWidthFactor)
|
||||||
icon:SetHeight(Gladdy.db.drIconSize)
|
icon:SetHeight(Gladdy.db.drIconSize)
|
||||||
|
|
||||||
icon.text:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.drFont), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drFontScale, "OUTLINE")
|
icon:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
icon.text:SetTextColor(Gladdy.db.drFontColor.r, Gladdy.db.drFontColor.g, Gladdy.db.drFontColor.b, Gladdy.db.drFontColor.a)
|
icon:SetFrameLevel(Gladdy.db.drFrameLevel)
|
||||||
icon.timeText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.drFont), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drFontScale, "OUTLINE")
|
icon.cooldown:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
icon.timeText:SetTextColor(Gladdy.db.drFontColor.r, Gladdy.db.drFontColor.g, Gladdy.db.drFontColor.b, Gladdy.db.drFontColor.a)
|
icon.cooldown:SetFrameLevel(Gladdy.db.drFrameLevel + 1)
|
||||||
|
icon.cooldownFrame:SetFrameStrata(Gladdy.db.drFrameStrata)
|
||||||
|
icon.cooldownFrame:SetFrameLevel(Gladdy.db.drFrameLevel + 2)
|
||||||
|
|
||||||
|
icon.timeText:SetFont(Gladdy:SMFetch("font", "drFont"), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drFontScale, "OUTLINE")
|
||||||
|
if Gladdy.db.drFontColorsEnabled then
|
||||||
|
icon.timeText:SetTextColor(getDiminishColor(icon.diminishing))
|
||||||
|
else
|
||||||
|
icon.timeText:SetTextColor(Gladdy:SetColor(Gladdy.db.drFontColor))
|
||||||
|
end
|
||||||
|
|
||||||
|
icon.drLevelText:SetFont(Gladdy:SMFetch("font", "drLevelTextFont"), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drLevelTextScale, "OUTLINE")
|
||||||
|
if Gladdy.db.drLevelTextColorsEnabled then
|
||||||
|
icon.drLevelText:SetTextColor(getDiminishColor(icon.diminishing))
|
||||||
|
else
|
||||||
|
icon.drLevelText:SetTextColor(Gladdy:SetColor(Gladdy.db.drLevelTextColor))
|
||||||
|
end
|
||||||
|
|
||||||
icon.cooldown:SetWidth(icon:GetWidth() - icon:GetWidth()/16)
|
icon.cooldown:SetWidth(icon:GetWidth() - icon:GetWidth()/16)
|
||||||
icon.cooldown:SetHeight(icon:GetHeight() - icon:GetHeight()/16)
|
icon.cooldown:SetHeight(icon:GetHeight() - icon:GetHeight()/16)
|
||||||
@ -207,19 +236,25 @@ function Diminishings:UpdateFrame(unit)
|
|||||||
if Gladdy.db.drBorderColorsEnabled then
|
if Gladdy.db.drBorderColorsEnabled then
|
||||||
icon.border:SetVertexColor(getDiminishColor(icon.diminishing))
|
icon.border:SetVertexColor(getDiminishColor(icon.diminishing))
|
||||||
else
|
else
|
||||||
icon.border:SetVertexColor(Gladdy.db.drBorderColor.r, Gladdy.db.drBorderColor.g, Gladdy.db.drBorderColor.b, Gladdy.db.drBorderColor.a)
|
icon.border:SetVertexColor(Gladdy:SetColor(Gladdy.db.drBorderColor))
|
||||||
|
end
|
||||||
|
|
||||||
|
if Gladdy.db.drLevelTextEnabled then
|
||||||
|
icon.drLevelText:Show()
|
||||||
|
else
|
||||||
|
icon.drLevelText:Hide()
|
||||||
end
|
end
|
||||||
|
|
||||||
icon:ClearAllPoints()
|
icon:ClearAllPoints()
|
||||||
if (Gladdy.db.drCooldownPos == "LEFT") then
|
if (Gladdy.db.drGrowDirection == "LEFT") then
|
||||||
if (i == 1) then
|
if (i == 1) then
|
||||||
icon:SetPoint("TOPRIGHT")
|
icon:SetPoint("TOPRIGHT", drFrame, "TOPRIGHT")
|
||||||
else
|
else
|
||||||
icon:SetPoint("RIGHT", drFrame["icon" .. (i - 1)], "LEFT", -Gladdy.db.drIconPadding, 0)
|
icon:SetPoint("RIGHT", drFrame["icon" .. (i - 1)], "LEFT", -Gladdy.db.drIconPadding, 0)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (i == 1) then
|
if (i == 1) then
|
||||||
icon:SetPoint("TOPLEFT")
|
icon:SetPoint("TOPLEFT", drFrame, "TOPLEFT")
|
||||||
else
|
else
|
||||||
icon:SetPoint("LEFT", drFrame["icon" .. (i - 1)], "RIGHT", Gladdy.db.drIconPadding, 0)
|
icon:SetPoint("LEFT", drFrame["icon" .. (i - 1)], "RIGHT", Gladdy.db.drIconPadding, 0)
|
||||||
end
|
end
|
||||||
@ -250,7 +285,6 @@ function Diminishings:ResetUnit(unit)
|
|||||||
icon.active = false
|
icon.active = false
|
||||||
icon.timeLeft = 0
|
icon.timeLeft = 0
|
||||||
icon.texture:SetTexture("")
|
icon.texture:SetTexture("")
|
||||||
icon.text:SetText("")
|
|
||||||
icon.timeText:SetText("")
|
icon.timeText:SetText("")
|
||||||
icon:Hide()
|
icon:Hide()
|
||||||
end
|
end
|
||||||
@ -262,17 +296,32 @@ 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 enabledCategories = {}
|
||||||
for i = 1, 4 do
|
for cat,val in pairs(Gladdy.db.drCategories) do
|
||||||
if i == 1 then
|
if (val.enabled) then
|
||||||
self:AuraFade(unit, spells[i])
|
tinsert(enabledCategories, {cat = cat , spellIDs = {}})
|
||||||
elseif i == 2 then
|
enabledCategories[cat] = #enabledCategories
|
||||||
self:AuraFade(unit, spells[i])
|
end
|
||||||
self:AuraFade(unit, spells[i])
|
end
|
||||||
else
|
for spellId,cat in pairs(DRData:GetSpells()) do
|
||||||
self:AuraFade(unit, spells[i])
|
if enabledCategories[cat] then
|
||||||
self:AuraFade(unit, spells[i])
|
tinsert(enabledCategories[enabledCategories[cat]].spellIDs, spellId)
|
||||||
self:AuraFade(unit, spells[i])
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--shuffle
|
||||||
|
for i = #enabledCategories, 2, -1 do
|
||||||
|
local j = rand(i)
|
||||||
|
enabledCategories[i], enabledCategories[j] = enabledCategories[j], enabledCategories[i]
|
||||||
|
end
|
||||||
|
|
||||||
|
--execute test
|
||||||
|
local index, amount = 0,0
|
||||||
|
for i=1, (#enabledCategories < 4 and #enabledCategories) or 4 do
|
||||||
|
amount = rand(1,3)
|
||||||
|
index = rand(1, #enabledCategories[i].spellIDs)
|
||||||
|
for _=1, amount do
|
||||||
|
self:AuraFade(unit, enabledCategories[i].spellIDs[index])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -299,20 +348,35 @@ function Diminishings:AuraFade(unit, spellID)
|
|||||||
lastIcon.diminishing = 1.0
|
lastIcon.diminishing = 1.0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if not lastIcon then return end
|
||||||
lastIcon.dr = drCat
|
lastIcon.dr = drCat
|
||||||
lastIcon.timeLeft = drDuration
|
lastIcon.timeLeft = Gladdy.db.drDuration
|
||||||
lastIcon.diminishing = DRData:NextDR(lastIcon.diminishing)
|
lastIcon.diminishing = DRData:NextDR(lastIcon.diminishing)
|
||||||
if Gladdy.db.drBorderColorsEnabled then
|
if Gladdy.db.drBorderColorsEnabled then
|
||||||
lastIcon.border:SetVertexColor(getDiminishColor(lastIcon.diminishing))
|
lastIcon.border:SetVertexColor(getDiminishColor(lastIcon.diminishing))
|
||||||
else
|
else
|
||||||
lastIcon.border:SetVertexColor(Gladdy.db.drBorderColor.r, Gladdy.db.drBorderColor.g, Gladdy.db.drBorderColor.b, Gladdy.db.drBorderColor.a)
|
lastIcon.border:SetVertexColor(Gladdy:SetColor(Gladdy.db.drBorderColor))
|
||||||
end
|
end
|
||||||
lastIcon.cooldown:SetCooldown(GetTime(), drDuration)
|
lastIcon.cooldown:SetCooldown(GetTime(), Gladdy.db.drDuration)
|
||||||
if Gladdy.db.drCategories[drCat].forceIcon then
|
if Gladdy.db.drCategories[drCat].forceIcon then
|
||||||
lastIcon.texture:SetTexture(Gladdy.db.drCategories[drCat].icon)
|
lastIcon.texture:SetTexture(Gladdy.db.drCategories[drCat].icon)
|
||||||
else
|
else
|
||||||
lastIcon.texture:SetTexture(select(3, GetSpellInfo(spellID)))
|
lastIcon.texture:SetTexture(select(3, GetSpellInfo(spellID)))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Gladdy.db.drFontColorsEnabled then
|
||||||
|
lastIcon.timeText:SetTextColor(getDiminishColor(lastIcon.diminishing))
|
||||||
|
else
|
||||||
|
lastIcon.timeText:SetTextColor(Gladdy:SetColor(Gladdy.db.drFontColor))
|
||||||
|
end
|
||||||
|
|
||||||
|
lastIcon.drLevelText:SetText(getDiminishText(lastIcon.diminishing))
|
||||||
|
if Gladdy.db.drLevelTextColorsEnabled then
|
||||||
|
lastIcon.drLevelText:SetTextColor(getDiminishColor(lastIcon.diminishing))
|
||||||
|
else
|
||||||
|
lastIcon.drLevelText:SetTextColor(Gladdy:SetColor(Gladdy.db.drLevelTextColor))
|
||||||
|
end
|
||||||
|
|
||||||
lastIcon.active = true
|
lastIcon.active = true
|
||||||
self:Positionate(unit)
|
self:Positionate(unit)
|
||||||
lastIcon:Show()
|
lastIcon:Show()
|
||||||
@ -331,13 +395,15 @@ function Diminishings:Positionate(unit)
|
|||||||
|
|
||||||
if (icon.active) then
|
if (icon.active) then
|
||||||
icon:ClearAllPoints()
|
icon:ClearAllPoints()
|
||||||
if (Gladdy.db.drCooldownPos == "LEFT") then
|
if (Gladdy.db.newLayout and Gladdy.db.drGrowDirection == "LEFT"
|
||||||
|
or not Gladdy.db.newLayout and Gladdy.db.drCooldownPos == "LEFT") then
|
||||||
if (not lastIcon) then
|
if (not lastIcon) then
|
||||||
icon:SetPoint("TOPRIGHT")
|
icon:SetPoint("TOPRIGHT")
|
||||||
else
|
else
|
||||||
icon:SetPoint("RIGHT", lastIcon, "LEFT", -Gladdy.db.drIconPadding, 0)
|
icon:SetPoint("RIGHT", lastIcon, "LEFT", -Gladdy.db.drIconPadding, 0)
|
||||||
end
|
end
|
||||||
else
|
elseif (Gladdy.db.newLayout and Gladdy.db.drGrowDirection == "RIGHT"
|
||||||
|
or not Gladdy.db.newLayout and Gladdy.db.drCooldownPos == "RIGHT") then
|
||||||
if (not lastIcon) then
|
if (not lastIcon) then
|
||||||
icon:SetPoint("TOPLEFT")
|
icon:SetPoint("TOPLEFT")
|
||||||
else
|
else
|
||||||
@ -363,11 +429,22 @@ function Diminishings:GetOptions()
|
|||||||
desc = L["Enabled DR module"],
|
desc = L["Enabled DR module"],
|
||||||
order = 3,
|
order = 3,
|
||||||
}),
|
}),
|
||||||
|
drDuration = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["DR Duration"],
|
||||||
|
desc = L["Change the DR Duration in seconds (DR is dynamic between 15-20s)"],
|
||||||
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.drEnabled end,
|
||||||
|
min = 15,
|
||||||
|
max = 20,
|
||||||
|
step = .1,
|
||||||
|
}),
|
||||||
group = {
|
group = {
|
||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.db.drEnabled end,
|
||||||
args = {
|
args = {
|
||||||
icon = {
|
icon = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -436,38 +513,62 @@ function Diminishings:GetOptions()
|
|||||||
order = 9,
|
order = 9,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
drCooldownNumberAlpha = {
|
||||||
|
type = "range",
|
||||||
|
name = L["Cooldown number alpha"],
|
||||||
|
min = 0,
|
||||||
|
max = 1,
|
||||||
|
step = 0.1,
|
||||||
|
order = 10,
|
||||||
|
width = "full",
|
||||||
|
set = function(info, value)
|
||||||
|
Gladdy.db.drFontColor.a = value
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end,
|
||||||
|
get = function(info)
|
||||||
|
return Gladdy.db.drFontColor.a
|
||||||
|
end,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
font = {
|
font = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Font"],
|
name = L["Cooldown Font"],
|
||||||
order = 3,
|
order = 3,
|
||||||
args = {
|
args = {
|
||||||
headerFont = {
|
headerFont = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Font"],
|
name = L["Cooldown Font"],
|
||||||
order = 10,
|
order = 1,
|
||||||
},
|
},
|
||||||
drFont = Gladdy:option({
|
drFontColorsEnabled = Gladdy:option({
|
||||||
type = "select",
|
type = "toggle",
|
||||||
name = L["Font"],
|
name = L["Enable DR Colors as Font Color"],
|
||||||
desc = L["Font of the cooldown"],
|
desc = L["Shows the current DR Level on the DR icon."],
|
||||||
order = 11,
|
order = 2,
|
||||||
dialogControl = "LSM30_Font",
|
width = "full",
|
||||||
values = AceGUIWidgetLSMlists.font,
|
|
||||||
}),
|
}),
|
||||||
drFontColor = Gladdy:colorOption({
|
drFontColor = Gladdy:colorOption({
|
||||||
type = "color",
|
type = "color",
|
||||||
name = L["Font color"],
|
name = L["Font color"],
|
||||||
desc = L["Color of the text"],
|
desc = L["Color of the text"],
|
||||||
order = 13,
|
order = 3,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
drFont = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Font"],
|
||||||
|
desc = L["Font of the cooldown"],
|
||||||
|
order = 4,
|
||||||
|
dialogControl = "LSM30_Font",
|
||||||
|
values = AceGUIWidgetLSMlists.font,
|
||||||
}),
|
}),
|
||||||
drFontScale = Gladdy:option({
|
drFontScale = Gladdy:option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Font scale"],
|
name = L["Font scale"],
|
||||||
desc = L["Scale of the text"],
|
desc = L["Scale of the text"],
|
||||||
order = 12,
|
order = 5,
|
||||||
min = 0.1,
|
min = 0.1,
|
||||||
max = 2,
|
max = 2,
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
@ -475,48 +576,67 @@ function Diminishings:GetOptions()
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
position = {
|
levelText = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Position"],
|
name = L["DR Font"],
|
||||||
order = 4,
|
order = 4,
|
||||||
args = {
|
args = {
|
||||||
headerPosition = {
|
headerBorder = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Position"],
|
name = L["DR Font"],
|
||||||
order = 20,
|
order = 1,
|
||||||
},
|
},
|
||||||
drCooldownPos = Gladdy:option({
|
drLevelTextEnabled = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Enable DR Font"],
|
||||||
|
desc = L["Shows the current DR Level on the DR icon."],
|
||||||
|
order = 2,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
drLevelTextColorsEnabled = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Enable DR Colors as Font Color"],
|
||||||
|
desc = L["Shows the current DR Level on the DR icon."],
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
disabled = function()
|
||||||
|
return not Gladdy.db.drLevelTextEnabled
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
drLevelTextColor = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["DR Font color"],
|
||||||
|
desc = L["Color of the font"],
|
||||||
|
order = 4,
|
||||||
|
hasAlpha = true,
|
||||||
|
disabled = function()
|
||||||
|
return not Gladdy.db.drLevelTextEnabled
|
||||||
|
end,
|
||||||
|
}),
|
||||||
|
drLevelTextFont = Gladdy:option({
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["DR Cooldown position"],
|
name = L["Font"],
|
||||||
desc = L["Position of the cooldown icons"],
|
desc = L["Font of the DR Font"],
|
||||||
order = 21,
|
order = 5,
|
||||||
values = {
|
dialogControl = "LSM30_Font",
|
||||||
["LEFT"] = L["Left"],
|
values = AceGUIWidgetLSMlists.font,
|
||||||
["RIGHT"] = L["Right"],
|
width = "full",
|
||||||
},
|
disabled = function()
|
||||||
|
return not Gladdy.db.drLevelTextEnabled
|
||||||
|
end,
|
||||||
}),
|
}),
|
||||||
headerOffset = {
|
drLevelTextScale = Gladdy:option({
|
||||||
type = "header",
|
|
||||||
name = L["Offset"],
|
|
||||||
order = 22,
|
|
||||||
},
|
|
||||||
drXOffset = Gladdy:option({
|
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Horizontal offset"],
|
name = L["Font scale"],
|
||||||
order = 23,
|
desc = L["Scale of the text"],
|
||||||
min = -400,
|
order = 6,
|
||||||
max = 400,
|
min = 0.1,
|
||||||
step = 0.1,
|
max = 2,
|
||||||
width = "full",
|
|
||||||
}),
|
|
||||||
drYOffset = Gladdy:option({
|
|
||||||
type = "range",
|
|
||||||
name = L["Vertical offset"],
|
|
||||||
order = 24,
|
|
||||||
min = -400,
|
|
||||||
max = 400,
|
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
width = "full",
|
width = "full",
|
||||||
|
disabled = function()
|
||||||
|
return not Gladdy.db.drLevelTextEnabled
|
||||||
|
end,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -528,33 +648,43 @@ function Diminishings:GetOptions()
|
|||||||
headerBorder = {
|
headerBorder = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Border"],
|
name = L["Border"],
|
||||||
order = 30,
|
order = 1,
|
||||||
},
|
},
|
||||||
drBorderStyle = Gladdy:option({
|
drBorderColorsEnabled = Gladdy:option({
|
||||||
type = "select",
|
type = "toggle",
|
||||||
name = L["Border style"],
|
name = L["Enable DR Colors as Border Color"],
|
||||||
order = 31,
|
desc = L["Colors borders of DRs in respective DR Colors"],
|
||||||
values = Gladdy:GetIconStyles()
|
order = 2,
|
||||||
|
width = "full",
|
||||||
}),
|
}),
|
||||||
drBorderColor = Gladdy:colorOption({
|
drBorderColor = Gladdy:colorOption({
|
||||||
type = "color",
|
type = "color",
|
||||||
name = L["Border color"],
|
name = L["Border color"],
|
||||||
desc = L["Color of the border"],
|
desc = L["Color of the border"],
|
||||||
order = 32,
|
order = 3,
|
||||||
|
disabled = function()
|
||||||
|
return Gladdy.db.drBorderColorsEnabled
|
||||||
|
end,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
}),
|
}),
|
||||||
headerBorderColors = {
|
drBorderStyle = Gladdy:option({
|
||||||
type = "header",
|
type = "select",
|
||||||
name = L["DR Border Colors"],
|
name = L["Border style"],
|
||||||
order = 40,
|
order = 4,
|
||||||
},
|
values = Gladdy:GetIconStyles()
|
||||||
drBorderColorsEnabled = Gladdy:option({
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Dr Border Colors Enabled"],
|
|
||||||
desc = L["Colors borders of DRs in respective DR-color below"],
|
|
||||||
order = 41,
|
|
||||||
width = "full",
|
|
||||||
}),
|
}),
|
||||||
|
}
|
||||||
|
},
|
||||||
|
levelColors = {
|
||||||
|
type = "group",
|
||||||
|
name = L["DR Colors"],
|
||||||
|
order = 6,
|
||||||
|
args = {
|
||||||
|
headerColors = {
|
||||||
|
type = "header",
|
||||||
|
name = L["DR Colors"],
|
||||||
|
order = 10,
|
||||||
|
},
|
||||||
drHalfColor = Gladdy:colorOption({
|
drHalfColor = Gladdy:colorOption({
|
||||||
type = "color",
|
type = "color",
|
||||||
name = L["Half"],
|
name = L["Half"],
|
||||||
@ -576,7 +706,76 @@ function Diminishings:GetOptions()
|
|||||||
order = 44,
|
order = 44,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
}),
|
}),
|
||||||
}
|
},
|
||||||
|
},
|
||||||
|
position = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Position"],
|
||||||
|
order = 7,
|
||||||
|
args = {
|
||||||
|
headerPosition = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Position"],
|
||||||
|
order = 20,
|
||||||
|
},
|
||||||
|
drGrowDirection = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["DR Grow Direction"],
|
||||||
|
desc = L["Grow Direction of the dr icons"],
|
||||||
|
order = 21,
|
||||||
|
values = {
|
||||||
|
["LEFT"] = L["Left"],
|
||||||
|
["RIGHT"] = L["Right"],
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
drXOffset = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Horizontal offset"],
|
||||||
|
order = 23,
|
||||||
|
min = -400,
|
||||||
|
max = 400,
|
||||||
|
step = 0.1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
drYOffset = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Vertical offset"],
|
||||||
|
order = 24,
|
||||||
|
min = -400,
|
||||||
|
max = 400,
|
||||||
|
step = 0.1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 8,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
drFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
drFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -584,22 +783,46 @@ function Diminishings:GetOptions()
|
|||||||
type = "group",
|
type = "group",
|
||||||
name = L["Categories"],
|
name = L["Categories"],
|
||||||
order = 6,
|
order = 6,
|
||||||
|
disabled = function() return not Gladdy.db.drEnabled end,
|
||||||
args = Diminishings:CategoryOptions(),
|
args = Diminishings:CategoryOptions(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function Diminishings:CategoryOptions()
|
function Diminishings:CategoryOptions()
|
||||||
local categories = {}
|
local categories = {
|
||||||
|
checkAll = {
|
||||||
|
order = 1,
|
||||||
|
width = "0.7",
|
||||||
|
name = L["Check All"],
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
for k,_ in pairs(defaultCategories()) do
|
||||||
|
Gladdy.db.drCategories[k].enabled = true
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
uncheckAll = {
|
||||||
|
order = 2,
|
||||||
|
width = "0.7",
|
||||||
|
name = L["Uncheck All"],
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
for k,_ in pairs(defaultCategories()) do
|
||||||
|
Gladdy.db.drCategories[k].enabled = false
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
}
|
||||||
local indexList = {}
|
local indexList = {}
|
||||||
for k,v in pairs(DRData:GetCategories()) do
|
for k,_ in pairs(DRData:GetCategories()) do
|
||||||
tinsert(indexList, k)
|
tinsert(indexList, k)
|
||||||
end
|
end
|
||||||
tbl_sort(indexList)
|
tbl_sort(indexList)
|
||||||
for i, k in ipairs(indexList) do
|
for i,k in ipairs(indexList) do
|
||||||
categories[k] = {
|
categories[k] = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = DRData:GetCategoryName(k),
|
name = L[DRData:GetCategoryName(k)],
|
||||||
order = i,
|
order = i,
|
||||||
icon = Gladdy.db.drCategories[k].icon,
|
icon = Gladdy.db.drCategories[k].icon,
|
||||||
args = {
|
args = {
|
||||||
@ -607,10 +830,10 @@ function Diminishings:CategoryOptions()
|
|||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Enabled"],
|
name = L["Enabled"],
|
||||||
order = 1,
|
order = 1,
|
||||||
get = function(info)
|
get = function()
|
||||||
return Gladdy.db.drCategories[k].enabled
|
return Gladdy.db.drCategories[k].enabled
|
||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
Gladdy.db.drCategories[k].enabled = value
|
Gladdy.db.drCategories[k].enabled = value
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@ -618,10 +841,10 @@ function Diminishings:CategoryOptions()
|
|||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Force Icon"],
|
name = L["Force Icon"],
|
||||||
order = 2,
|
order = 2,
|
||||||
get = function(info)
|
get = function()
|
||||||
return Gladdy.db.drCategories[k].forceIcon
|
return Gladdy.db.drCategories[k].forceIcon
|
||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
Gladdy.db.drCategories[k].forceIcon = value
|
Gladdy.db.drCategories[k].forceIcon = value
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
@ -631,10 +854,10 @@ function Diminishings:CategoryOptions()
|
|||||||
desc = L["Icon of the DR"],
|
desc = L["Icon of the DR"],
|
||||||
order = 4,
|
order = 4,
|
||||||
values = Diminishings:GetDRIcons(k),
|
values = Diminishings:GetDRIcons(k),
|
||||||
get = function(info)
|
get = function()
|
||||||
return Gladdy.db.drCategories[k].icon
|
return Gladdy.db.drCategories[k].icon
|
||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
Gladdy.db.drCategories[k].icon = value
|
Gladdy.db.drCategories[k].icon = value
|
||||||
Gladdy.options.args.Diminishings.args.categories.args[k].icon = value
|
Gladdy.options.args.Diminishings.args.categories.args[k].icon = value
|
||||||
end,
|
end,
|
||||||
@ -654,3 +877,36 @@ function Diminishings:GetDRIcons(category)
|
|||||||
end
|
end
|
||||||
return icons
|
return icons
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Diminishings:LegacySetPosition(drFrame, unit)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
drFrame:ClearAllPoints()
|
||||||
|
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.drCooldownPos == "LEFT") then
|
||||||
|
Gladdy.db.drGrowDirection = "LEFT"
|
||||||
|
local anchor = Gladdy:GetAnchor(unit, "LEFT")
|
||||||
|
if anchor == Gladdy.buttons[unit].healthBar then
|
||||||
|
drFrame:SetPoint("RIGHT", anchor, "LEFT", -horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
||||||
|
else
|
||||||
|
drFrame:SetPoint("RIGHT", anchor, "LEFT", -Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (Gladdy.db.drCooldownPos == "RIGHT") then
|
||||||
|
Gladdy.db.drGrowDirection = "RIGHT"
|
||||||
|
local anchor = Gladdy:GetAnchor(unit, "RIGHT")
|
||||||
|
if anchor == Gladdy.buttons[unit].healthBar then
|
||||||
|
drFrame:SetPoint("LEFT", anchor, "RIGHT", horizontalMargin + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
||||||
|
else
|
||||||
|
drFrame:SetPoint("LEFT", anchor, "RIGHT", Gladdy.db.padding + Gladdy.db.drXOffset, Gladdy.db.drYOffset)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
local type, pairs = type, pairs
|
local type, pairs, str_match = type, pairs, string.match
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local AceSerializer = LibStub("AceSerializer-3.0")
|
local AceSerializer = LibStub("AceSerializer-3.0")
|
||||||
@ -6,12 +6,17 @@ local L = Gladdy.L
|
|||||||
local AceGUI = LibStub("AceGUI-3.0")
|
local AceGUI = LibStub("AceGUI-3.0")
|
||||||
local LibDeflate = LibStub:GetLibrary("LibDeflate")
|
local LibDeflate = LibStub:GetLibrary("LibDeflate")
|
||||||
|
|
||||||
local function table_copy(t)
|
|
||||||
|
local function table_copy(t, str)
|
||||||
local t2 = {};
|
local t2 = {};
|
||||||
|
if str == nil then
|
||||||
|
str = "Gladdy.db"
|
||||||
|
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
|
||||||
t2[k] = table_copy(v);
|
t2[k] = table_copy(v, str .. "." .. k);
|
||||||
else
|
else
|
||||||
|
|
||||||
t2[k] = v;
|
t2[k] = v;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -67,6 +72,7 @@ importButton:SetCallback("OnClick", function(widget)
|
|||||||
Gladdy:Reset()
|
Gladdy:Reset()
|
||||||
Gladdy:HideFrame()
|
Gladdy:HideFrame()
|
||||||
Gladdy:ToggleFrame(3)
|
Gladdy:ToggleFrame(3)
|
||||||
|
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
|
||||||
end)
|
end)
|
||||||
import:AddChild(importButton)
|
import:AddChild(importButton)
|
||||||
import.button = importButton
|
import.button = importButton
|
||||||
@ -83,32 +89,81 @@ end)
|
|||||||
import:AddChild(importClearButton)
|
import:AddChild(importClearButton)
|
||||||
import.clearButton = importClearButton
|
import.clearButton = importClearButton
|
||||||
|
|
||||||
local deletedOptions = { --TODO backward compatibility Imports on deleted options
|
local deletedOptions = { -- backwards compatibility
|
||||||
growUp = true
|
--deleted DR-categories
|
||||||
|
repentance = true,
|
||||||
|
sleep = true,
|
||||||
|
impconc = true,
|
||||||
|
dragonsbreath = true,
|
||||||
|
freezetrap = true,
|
||||||
|
--deleted db options
|
||||||
|
castBarPos = true,
|
||||||
|
buffsCooldownPos = true,
|
||||||
|
buffsBuffsCooldownPos = true,
|
||||||
|
classIconPos = true,
|
||||||
|
ciAnchor = true,
|
||||||
|
ciPos = true,
|
||||||
|
cooldownYPos = true,
|
||||||
|
cooldownXPos = true,
|
||||||
|
drCooldownPos = true,
|
||||||
|
racialAnchor = true,
|
||||||
|
racialPos = true,
|
||||||
|
trinketPos = true,
|
||||||
|
padding = true,
|
||||||
|
growUp = true,
|
||||||
|
powerBarFontSize = true,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local function checkIsDeletedOption(k, str, msg, errorFound, errorMsg)
|
||||||
|
local isDeleted
|
||||||
|
for key, _ in pairs(deletedOptions) do
|
||||||
|
if str_match(k, key) then
|
||||||
|
isDeleted = true
|
||||||
|
Gladdy:Debug("WARN", "found deleted option =", str .. "." .. k)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if errorFound then
|
||||||
|
return errorFound, errorMsg
|
||||||
|
end
|
||||||
|
if not isDeleted then
|
||||||
|
return true, msg or str .. "." .. k .. " does not exist"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
|
function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
|
||||||
if str == nil and not tbl.version_major_num then
|
if str == nil and not tbl.version_major_num then
|
||||||
return false, "Version conflict: version_major_num not seen"
|
return false, "Version conflict: version_major_num not seen"
|
||||||
end
|
end
|
||||||
if str == nil and tbl.version_major_num ~= Gladdy.version_major_num then
|
if str == nil and tbl.version_major_num > Gladdy.version_major_num then
|
||||||
return false, "Version conflict: " .. tbl.version_major_num .. " ~= " .. Gladdy.version_major_num
|
return false, "Version conflict: Major v" .. tbl.version_major_num .. " ~= v" .. Gladdy.version_major_num
|
||||||
end
|
end
|
||||||
if str == nil then
|
if str == nil then
|
||||||
str = "Gladdy.db"
|
str = "Gladdy.db"
|
||||||
tbl.version_major_num = nil
|
tbl.version_major_num = nil
|
||||||
end
|
end
|
||||||
for k,v in pairs(tbl) do
|
local res, msg
|
||||||
if refTbl[k] == nil then
|
local errorFound, errorMsg
|
||||||
return false, str .. "." .. k .. " does not exist"
|
if refTbl == nil then
|
||||||
else
|
return false, str .. "does not exist"
|
||||||
if type(v) ~= type(refTbl[k]) then
|
else
|
||||||
return false, str .. "." .. k .. " type error. Expected " .. type(refTbl[k]) .. " found " .. type(v)
|
for k,v in pairs(tbl) do
|
||||||
|
if refTbl[k] == nil then
|
||||||
|
errorFound, errorMsg = checkIsDeletedOption(k, str, nil, errorFound, errorMsg)
|
||||||
|
elseif type(v) ~= type(refTbl[k]) then
|
||||||
|
errorFound = true
|
||||||
|
errorMsg = str .. "." .. k .. " type error. Expected " .. type(refTbl[k]) .. " found " .. type(v)
|
||||||
elseif type(v) == "table" then
|
elseif type(v) == "table" then
|
||||||
ExportImport:CheckDeserializedOptions(v, refTbl[k], str .. "." .. k)
|
res, msg = ExportImport:CheckDeserializedOptions(v, refTbl[k], str .. "." .. k)
|
||||||
|
if not res then
|
||||||
|
errorFound, errorMsg = checkIsDeletedOption(msg, str, msg, errorFound, errorMsg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if errorFound then
|
||||||
|
return false, errorMsg
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -135,8 +190,8 @@ function ExportImport:GetOptions()
|
|||||||
export.eb:HighlightText(0, export.eb.editBox:GetNumLetters())
|
export.eb:HighlightText(0, export.eb.editBox:GetNumLetters())
|
||||||
export:SetStatusText("Copy this string to share your configuration with others.")
|
export:SetStatusText("Copy this string to share your configuration with others.")
|
||||||
end,
|
end,
|
||||||
name = "Export",
|
name = L["Export"],
|
||||||
desc = "Export your current profile to share with others or your various accounts.",
|
desc = L["Export your current profile to share with others or your various accounts."],
|
||||||
order = 3,
|
order = 3,
|
||||||
},
|
},
|
||||||
import = {
|
import = {
|
||||||
@ -159,17 +214,28 @@ function ExportImport:GetOptions()
|
|||||||
import.deserializedTable = deserialized
|
import.deserializedTable = deserialized
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
name = "Import",
|
name = L["Import"],
|
||||||
desc = "This will overwrite your current profile!",
|
desc = L["This will overwrite your current profile!"],
|
||||||
order = 4,
|
order = 4,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function ExportImport:ApplyImport(t, table)
|
function ExportImport:ApplyImport(t, table, str)
|
||||||
|
if str == nil then
|
||||||
|
str = "Gladdy.db"
|
||||||
|
if (not t.newLayout) then
|
||||||
|
table.newLayout = false
|
||||||
|
end
|
||||||
|
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])
|
if (table[k] ~= nil) then
|
||||||
|
ExportImport:ApplyImport(v, table[k], str .. "." .. k)
|
||||||
|
else
|
||||||
|
Gladdy:Debug("ERROR", "ApplyImport failed for", str .. "." .. k)
|
||||||
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
table[k] = v
|
table[k] = v
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
local pairs = pairs
|
local pairs, ipairs = pairs, ipairs
|
||||||
local floor = math.floor
|
local floor = math.floor
|
||||||
|
local str_find, str_gsub, str_sub, tinsert = string.find, string.gsub, string.sub, table.insert
|
||||||
local UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost = UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost
|
local UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost = UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost
|
||||||
|
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
@ -24,12 +25,24 @@ local Healthbar = Gladdy:NewModule("Health Bar", 100, {
|
|||||||
healthActual = false,
|
healthActual = false,
|
||||||
healthMax = true,
|
healthMax = true,
|
||||||
healthPercentage = true,
|
healthPercentage = true,
|
||||||
|
healthFrameStrata = "MEDIUM",
|
||||||
|
healthFrameLevel = 1,
|
||||||
|
healthCustomTagsEnabled = false,
|
||||||
|
healthTextLeft = "[name]",
|
||||||
|
healthTextRight = "[percent|status]",
|
||||||
|
healthTextLeftOutline = false,
|
||||||
|
healthTextRightOutline = false,
|
||||||
|
healthTextLeftVOffset = 0,
|
||||||
|
healthTextLeftHOffset = 5,
|
||||||
|
healthTextRightVOffset = 0,
|
||||||
|
healthTextRightHOffset = -5,
|
||||||
})
|
})
|
||||||
|
|
||||||
function Healthbar:Initialize()
|
function Healthbar:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
self:RegisterMessage("UNIT_DESTROYED")
|
self:RegisterMessage("UNIT_DESTROYED")
|
||||||
self:RegisterMessage("UNIT_DEATH")
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
end
|
end
|
||||||
@ -39,56 +52,58 @@ function Healthbar:CreateFrame(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:EnableMouse(false)
|
||||||
healthBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.healthBarBorderStyle),
|
healthBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "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:SetColor(Gladdy.db.healthBarBorderColor))
|
||||||
healthBar:SetFrameLevel(1)
|
healthBar:SetFrameStrata(Gladdy.db.healthFrameStrata)
|
||||||
|
healthBar:SetFrameLevel(Gladdy.db.healthFrameLevel)
|
||||||
|
|
||||||
healthBar.hp = CreateFrame("StatusBar", nil, healthBar)
|
healthBar.hp = CreateFrame("StatusBar", nil, healthBar)
|
||||||
healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture))
|
healthBar.hp:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "healthBarTexture"))
|
||||||
healthBar.hp:SetMinMaxValues(0, 100)
|
healthBar.hp:SetMinMaxValues(0, 100)
|
||||||
healthBar.hp:SetFrameLevel(0)
|
healthBar.hp:SetFrameStrata(Gladdy.db.healthFrameStrata)
|
||||||
|
healthBar.hp:SetFrameLevel(Gladdy.db.healthFrameLevel - 1)
|
||||||
|
|
||||||
healthBar.bg = healthBar.hp:CreateTexture(nil, "BACKGROUND")
|
healthBar.bg = healthBar.hp:CreateTexture(nil, "BACKGROUND")
|
||||||
healthBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture))
|
healthBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "healthBarTexture"))
|
||||||
healthBar.bg:ClearAllPoints()
|
healthBar.bg:ClearAllPoints()
|
||||||
healthBar.bg:SetAllPoints(healthBar.hp)
|
healthBar.bg:SetAllPoints(healthBar.hp)
|
||||||
healthBar.bg:SetAlpha(1)
|
healthBar.bg:SetAlpha(1)
|
||||||
healthBar.bg:SetVertexColor(Gladdy.db.healthBarBgColor.r, Gladdy.db.healthBarBgColor.g, Gladdy.db.healthBarBgColor.b, Gladdy.db.healthBarBgColor.a)
|
healthBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.healthBarBgColor))
|
||||||
|
|
||||||
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
|
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
|
||||||
if (Gladdy.db.healthBarNameFontSize < 1) then
|
if (Gladdy.db.healthBarNameFontSize < 1) then
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarNameFont), 1)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "healthBarNameFont"), 1)
|
||||||
healthBar.nameText:Hide()
|
healthBar.nameText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarNameFontSize, Gladdy.db.healthTextLeftOutline and "OUTLINE")
|
||||||
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:SetColor(Gladdy.db.healthBarFontColor))
|
||||||
healthBar.nameText:SetShadowOffset(1, -1)
|
healthBar.nameText:SetShadowOffset(1, -1)
|
||||||
healthBar.nameText:SetShadowColor(0, 0, 0, 1)
|
healthBar.nameText:SetShadowColor(0, 0, 0, 1)
|
||||||
healthBar.nameText:SetJustifyH("CENTER")
|
healthBar.nameText:SetJustifyH("CENTER")
|
||||||
healthBar.nameText:SetPoint("LEFT", 5, 0)
|
healthBar.nameText:SetPoint("LEFT", Gladdy.db.healthTextLeftHOffset, Gladdy.db.healthTextLeftVOffset)
|
||||||
|
|
||||||
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
|
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
|
||||||
if (Gladdy.db.healthBarHealthFontSize < 1) then
|
if (Gladdy.db.healthBarHealthFontSize < 1) then
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), 1)
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarHealthFontSize, Gladdy.db.healthTextRightOutline and "OUTLINE")
|
||||||
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:SetColor(Gladdy.db.healthBarFontColor))
|
||||||
healthBar.healthText:SetShadowOffset(1, -1)
|
healthBar.healthText:SetShadowOffset(1, -1)
|
||||||
healthBar.healthText:SetShadowColor(0, 0, 0, 1)
|
healthBar.healthText:SetShadowColor(0, 0, 0, 1)
|
||||||
healthBar.healthText:SetJustifyH("CENTER")
|
healthBar.healthText:SetJustifyH("CENTER")
|
||||||
healthBar.healthText:SetPoint("RIGHT", -5, 0)
|
healthBar.healthText:SetPoint("RIGHT", Gladdy.db.healthTextRightHOffset, Gladdy.db.healthTextRightVOffset)
|
||||||
|
|
||||||
healthBar.unit = unit
|
healthBar.unit = unit
|
||||||
self.frames[unit] = healthBar
|
self.frames[unit] = healthBar
|
||||||
button.healthBar = healthBar
|
button.healthBar = healthBar
|
||||||
self:ResetUnit(unit)
|
self:ResetUnit(unit)
|
||||||
healthBar:RegisterUnitEvent("UNIT_HEALTH", unit)
|
healthBar:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", unit)
|
||||||
healthBar:RegisterUnitEvent("UNIT_MAXHEALTH", unit)
|
healthBar:RegisterUnitEvent("UNIT_MAXHEALTH", unit)
|
||||||
healthBar:RegisterUnitEvent("UNIT_NAME_UPDATE", unit)
|
healthBar:RegisterUnitEvent("UNIT_NAME_UPDATE", unit)
|
||||||
healthBar:SetScript("OnEvent", Healthbar.OnEvent)
|
healthBar:SetScript("OnEvent", Healthbar.OnEvent)
|
||||||
@ -96,17 +111,7 @@ end
|
|||||||
|
|
||||||
function Healthbar.OnEvent(self, event, unit)
|
function Healthbar.OnEvent(self, event, unit)
|
||||||
local isDead = UnitExists(unit) and UnitIsDeadOrGhost(unit)
|
local isDead = UnitExists(unit) and UnitIsDeadOrGhost(unit)
|
||||||
if event == "UNIT_HEALTH" then
|
if event == "UNIT_HEALTH_FREQUENT" or event == "UNIT_MAXHEALTH" then
|
||||||
if isDead then
|
|
||||||
Gladdy:SendMessage("UNIT_DEATH", unit)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
local health = UnitHealth(unit)
|
|
||||||
local healthMax = UnitHealthMax(unit)
|
|
||||||
self.hp:SetMinMaxValues(0, healthMax)
|
|
||||||
self.hp:SetValue(UnitHealth(unit))
|
|
||||||
Healthbar:SetHealthText(self, health, healthMax)
|
|
||||||
elseif event == "UNIT_MAXHEALTH" then
|
|
||||||
if isDead then
|
if isDead then
|
||||||
Gladdy:SendMessage("UNIT_DEATH", unit)
|
Gladdy:SendMessage("UNIT_DEATH", unit)
|
||||||
return
|
return
|
||||||
@ -115,13 +120,14 @@ function Healthbar.OnEvent(self, event, unit)
|
|||||||
local healthMax = UnitHealthMax(unit)
|
local healthMax = UnitHealthMax(unit)
|
||||||
self.hp:SetMinMaxValues(0, healthMax)
|
self.hp:SetMinMaxValues(0, healthMax)
|
||||||
self.hp:SetValue(health)
|
self.hp:SetValue(health)
|
||||||
Healthbar:SetHealthText(self, health, healthMax)
|
self.hp.current = health
|
||||||
|
self.hp.max = healthMax
|
||||||
|
Healthbar:SetText(unit, health, healthMax)
|
||||||
|
--Healthbar:SetHealthText(self, health, healthMax)
|
||||||
elseif event == "UNIT_NAME_UPDATE" then
|
elseif event == "UNIT_NAME_UPDATE" then
|
||||||
local name = UnitName(unit)
|
local name = UnitName(unit)
|
||||||
Gladdy.buttons[unit].name = name
|
Gladdy.buttons[unit].name = name
|
||||||
if Gladdy.db.healthName and not Gladdy.db.healthNameToArenaId then
|
Healthbar:SetText(unit, self.hp.current, self.hp.max)
|
||||||
self.nameText:SetText(name)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if not Gladdy.buttons[unit].class then
|
if not Gladdy.buttons[unit].class then
|
||||||
Gladdy:SpotEnemy(unit, true)
|
Gladdy:SpotEnemy(unit, true)
|
||||||
@ -129,81 +135,91 @@ function Healthbar.OnEvent(self, event, unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar:SetHealthText(healthBar, health, healthMax)
|
function Healthbar:SetHealthText(healthBar, health, healthMax)
|
||||||
local healthText
|
local healthText = ""
|
||||||
local healthPercentage = floor(health * 100 / healthMax)
|
local healthPercentage = health and healthMax and floor(health * 100 / healthMax)
|
||||||
|
|
||||||
if health == 0 then
|
if health == 0 and UnitExists(healthBar.unit) and UnitIsDeadOrGhost(healthBar.unit) then
|
||||||
self:UNIT_DEATH(healthBar.unit)
|
self:UNIT_DEATH(healthBar.unit)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if (Gladdy.db.healthPercentage and healthPercentage) then
|
||||||
if (Gladdy.db.healthActual) then
|
healthText = ("%d%%"):format(healthPercentage)
|
||||||
healthText = healthMax > 999 and ("%.1fk"):format(health / 1000) or health
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if (Gladdy.db.healthMax) then
|
|
||||||
local text = healthMax > 999 and ("%.1fk"):format(healthMax / 1000) or healthMax
|
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s/%s"):format(healthText, text)
|
|
||||||
else
|
|
||||||
healthText = text
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.healthPercentage) then
|
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s (%d%%)"):format(healthText, healthPercentage)
|
|
||||||
else
|
|
||||||
healthText = ("%d%%"):format(healthPercentage)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
healthBar.healthText:SetText(healthText)
|
healthBar.healthText:SetText(healthText)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Healthbar:SetText(unit, health, healthMax, status)
|
||||||
|
local button = Gladdy.buttons[unit]
|
||||||
|
if not Gladdy.buttons[unit] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if Gladdy.db.healthCustomTagsEnabled then
|
||||||
|
button.healthBar.nameText:SetText(Gladdy:SetTag(unit, Gladdy.db.healthTextLeft, health, healthMax, status))
|
||||||
|
button.healthBar.healthText:SetText(Gladdy:SetTag(unit, Gladdy.db.healthTextRight, health, healthMax, status))
|
||||||
|
else
|
||||||
|
if Gladdy.db.healthName then
|
||||||
|
if Gladdy.db.healthNameToArenaId then
|
||||||
|
button.healthBar.nameText:SetText(str_gsub(unit, "arena", ""))
|
||||||
|
else
|
||||||
|
button.healthBar.nameText:SetText(Gladdy.buttons[unit].name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if status then
|
||||||
|
button.healthBar.healthText:SetText(status)
|
||||||
|
else
|
||||||
|
Healthbar:SetHealthText(button.healthBar, health, healthMax)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function Healthbar:UpdateFrame(unit)
|
function Healthbar:UpdateFrame(unit)
|
||||||
local healthBar = self.frames[unit]
|
local healthBar = self.frames[unit]
|
||||||
if (not healthBar) then
|
if (not healthBar) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight
|
healthBar:SetFrameStrata(Gladdy.db.healthFrameStrata)
|
||||||
|
healthBar:SetFrameLevel(Gladdy.db.healthFrameLevel)
|
||||||
|
healthBar.hp:SetFrameStrata(Gladdy.db.healthFrameStrata)
|
||||||
|
healthBar.hp:SetFrameLevel(Gladdy.db.healthFrameLevel - 1)
|
||||||
|
|
||||||
healthBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.healthBarTexture))
|
healthBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "healthBarTexture"))
|
||||||
healthBar.bg:SetVertexColor(Gladdy.db.healthBarBgColor.r, Gladdy.db.healthBarBgColor.g, Gladdy.db.healthBarBgColor.b, Gladdy.db.healthBarBgColor.a)
|
healthBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.healthBarBgColor))
|
||||||
|
|
||||||
healthBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.healthBarBorderStyle),
|
healthBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "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:SetColor(Gladdy.db.healthBarBorderColor))
|
||||||
healthBar:ClearAllPoints()
|
healthBar:ClearAllPoints()
|
||||||
healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", 0, 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:SMFetch("statusbar", "healthBarTexture"))
|
||||||
healthBar.hp:ClearAllPoints()
|
healthBar.hp:ClearAllPoints()
|
||||||
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.healthBarHealthFontSize < 1) then
|
if (Gladdy.db.healthBarHealthFontSize < 1) then
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), 1)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), 1)
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarHealthFontSize, Gladdy.db.healthTextRightOutline and "OUTLINE")
|
||||||
healthBar.healthText:Show()
|
healthBar.healthText:Show()
|
||||||
end
|
end
|
||||||
if (Gladdy.db.healthBarNameFontSize < 1) then
|
if (Gladdy.db.healthBarNameFontSize < 1) then
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarNameFont), 1)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "healthBarNameFont"), 1)
|
||||||
healthBar.nameText:Hide()
|
healthBar.nameText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarNameFontSize, Gladdy.db.healthTextLeftOutline and "OUTLINE")
|
||||||
if Gladdy.db.healthName then
|
if Gladdy.db.healthName then
|
||||||
healthBar.nameText:Show()
|
healthBar.nameText:Show()
|
||||||
else
|
else
|
||||||
healthBar.nameText:Hide()
|
healthBar.nameText:Hide()
|
||||||
end
|
end
|
||||||
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:SetColor(Gladdy.db.healthBarFontColor))
|
||||||
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
|
healthBar.healthText:SetTextColor(Gladdy:SetColor(Gladdy.db.healthBarFontColor))
|
||||||
|
healthBar.nameText:SetPoint("LEFT", Gladdy.db.healthTextLeftHOffset, Gladdy.db.healthTextLeftVOffset)
|
||||||
|
healthBar.healthText:SetPoint("RIGHT", Gladdy.db.healthTextRightHOffset, Gladdy.db.healthTextRightVOffset)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar:ResetUnit(unit)
|
function Healthbar:ResetUnit(unit)
|
||||||
@ -216,6 +232,7 @@ function Healthbar:ResetUnit(unit)
|
|||||||
healthBar.nameText:SetText("")
|
healthBar.nameText:SetText("")
|
||||||
healthBar.healthText:SetText("")
|
healthBar.healthText:SetText("")
|
||||||
healthBar.hp:SetValue(0)
|
healthBar.hp:SetValue(0)
|
||||||
|
healthBar.hp.current = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar:Test(unit)
|
function Healthbar:Test(unit)
|
||||||
@ -225,17 +242,31 @@ function Healthbar:Test(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
self:JOINED_ARENA()
|
--self:JOINED_ARENA()
|
||||||
|
Gladdy:SendMessage("UNIT_HEALTH", unit, button.health, button.healthMax)
|
||||||
|
healthBar.hp.current = button.health
|
||||||
|
healthBar.hp.max = button.healthMax
|
||||||
self:ENEMY_SPOTTED(unit)
|
self:ENEMY_SPOTTED(unit)
|
||||||
self:UNIT_HEALTH(unit, button.health, button.healthMax)
|
self:SetText(unit, button.health, button.healthMax)
|
||||||
|
healthBar.hp:SetValue(button.health)
|
||||||
|
if unit == "arena1" then
|
||||||
|
self:UNIT_DEATH(unit)
|
||||||
|
--self:SetText(unit, button.health, button.healthMax, L["DEAD"])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Healthbar:UNIT_SPEC(unit)
|
||||||
|
local button = Gladdy.buttons[unit]
|
||||||
|
if not button then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
self:SetText(unit, button.healthBar.hp.current, button.healthBar.hp.max)
|
||||||
|
--button.healthBar.nameText:SetText(Gladdy:SetTag(unit, Gladdy.db.healthTextLeft, button.health, button.healthMax))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar:JOINED_ARENA()
|
function Healthbar:JOINED_ARENA()
|
||||||
if Gladdy.db.healthNameToArenaId and Gladdy.db.healthName then
|
for i=1,Gladdy.curBracket do
|
||||||
for i=1,Gladdy.curBracket do
|
self:SetText("arena" .. i, nil, nil)
|
||||||
local healthBar = self.frames["arena" .. i]
|
|
||||||
healthBar.nameText:SetText("Arena" .. i)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -251,51 +282,15 @@ function Healthbar:ENEMY_SPOTTED(unit)
|
|||||||
local healthMax = UnitHealthMax(unit)
|
local healthMax = UnitHealthMax(unit)
|
||||||
healthBar.hp:SetMinMaxValues(0, healthMax)
|
healthBar.hp:SetMinMaxValues(0, healthMax)
|
||||||
healthBar.hp:SetValue(health)
|
healthBar.hp:SetValue(health)
|
||||||
Healthbar:SetHealthText(healthBar, health, healthMax)
|
healthBar.hp.current = health
|
||||||
end
|
healthBar.hp.max = healthMax
|
||||||
if Gladdy.db.healthName and not Gladdy.db.healthNameToArenaId then
|
Healthbar:SetText(unit, health, healthMax)
|
||||||
healthBar.nameText:SetText(button.name)
|
--Healthbar:SetHealthText(healthBar, health, healthMax)
|
||||||
end
|
end
|
||||||
|
|
||||||
healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
|
if button.class then
|
||||||
end
|
healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
|
||||||
|
|
||||||
function Healthbar:UNIT_HEALTH(unit, health, healthMax)
|
|
||||||
local healthBar = self.frames[unit]
|
|
||||||
if (not healthBar) then
|
|
||||||
return
|
|
||||||
end
|
end
|
||||||
if not Gladdy.buttons[unit].class then
|
|
||||||
Gladdy:SpotEnemy(unit, true)
|
|
||||||
end
|
|
||||||
Gladdy:SendMessage("UNIT_HEALTH", unit, health, healthMax)
|
|
||||||
|
|
||||||
local healthPercentage = floor(health * 100 / healthMax)
|
|
||||||
local healthText
|
|
||||||
|
|
||||||
if (Gladdy.db.healthActual) then
|
|
||||||
healthText = healthMax > 999 and ("%.1fk"):format(health / 1000) or health
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.healthMax) then
|
|
||||||
local text = healthMax > 999 and ("%.1fk"):format(healthMax / 1000) or healthMax
|
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s/%s"):format(healthText, text)
|
|
||||||
else
|
|
||||||
healthText = text
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.healthPercentage) then
|
|
||||||
if (healthText) then
|
|
||||||
healthText = ("%s (%d%%)"):format(healthText, healthPercentage)
|
|
||||||
else
|
|
||||||
healthText = ("%d%%"):format(healthPercentage)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
healthBar.healthText:SetText(healthText)
|
|
||||||
healthBar.hp:SetValue(healthPercentage)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar:UNIT_DEATH(unit)
|
function Healthbar:UNIT_DEATH(unit)
|
||||||
@ -305,7 +300,8 @@ function Healthbar:UNIT_DEATH(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
healthBar.hp:SetValue(0)
|
healthBar.hp:SetValue(0)
|
||||||
healthBar.healthText:SetText(L["DEAD"])
|
healthBar.hp.current = 0
|
||||||
|
Healthbar:SetText(unit, 0, 100, L["DEAD"])
|
||||||
end
|
end
|
||||||
|
|
||||||
function Healthbar:UNIT_DESTROYED(unit)
|
function Healthbar:UNIT_DESTROYED(unit)
|
||||||
@ -315,8 +311,8 @@ function Healthbar:UNIT_DESTROYED(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
healthBar.hp:SetValue(0)
|
healthBar.hp:SetValue(0)
|
||||||
healthBar.healthText:SetText(L["LEAVE"])
|
healthBar.hp.current = 0
|
||||||
healthBar.nameText:SetText("")
|
Healthbar:SetText(unit, 0, 100, L["LEAVE"])
|
||||||
end
|
end
|
||||||
|
|
||||||
local function option(params)
|
local function option(params)
|
||||||
@ -332,8 +328,10 @@ 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
|
if Gladdy.frame.testing then
|
||||||
Healthbar:Test("arena" .. i)
|
for i=1,Gladdy.curBracket do
|
||||||
|
Healthbar:Test("arena" .. i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
@ -421,11 +419,28 @@ function Healthbar:GetOptions()
|
|||||||
order = 12,
|
order = 12,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
}),
|
}),
|
||||||
|
healthTextLeftOutline = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Left Font Outline"],
|
||||||
|
order = 13,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
healthTextRightOutline = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Right Font Outline"],
|
||||||
|
order = 14,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
headerSize = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Size"],
|
||||||
|
order = 20,
|
||||||
|
},
|
||||||
healthBarNameFontSize = option({
|
healthBarNameFontSize = option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Name font size"],
|
name = L["Name font size"],
|
||||||
desc = L["Size of the name text"],
|
desc = L["Size of the name text"],
|
||||||
order = 13,
|
order = 21,
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 20,
|
max = 20,
|
||||||
@ -435,12 +450,53 @@ function Healthbar:GetOptions()
|
|||||||
type = "range",
|
type = "range",
|
||||||
name = L["Health font size"],
|
name = L["Health font size"],
|
||||||
desc = L["Size of the health text"],
|
desc = L["Size of the health text"],
|
||||||
order = 14,
|
order = 22,
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
min = 0,
|
min = 0,
|
||||||
max = 20,
|
max = 20,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
headerOffsets = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Offsets"],
|
||||||
|
order = 30,
|
||||||
|
},
|
||||||
|
healthTextLeftVOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Left Text Vertical Offset"],
|
||||||
|
order = 31,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
healthTextLeftHOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Left Text Horizontal Offset"],
|
||||||
|
order = 32,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
healthTextRightVOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Right Text Vertical Offset"],
|
||||||
|
order = 33,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
healthTextRightHOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Right Text Horizontal Offset"],
|
||||||
|
order = 34,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
border = {
|
border = {
|
||||||
@ -479,10 +535,39 @@ function Healthbar:GetOptions()
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 4,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
healthFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
healthFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 1,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
healthValues = {
|
healthValues = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Health Bar Text"],
|
name = L["Health Bar Text"],
|
||||||
order = 4,
|
order = 5,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
@ -495,28 +580,15 @@ function Healthbar:GetOptions()
|
|||||||
desc = L["Show the units name"],
|
desc = L["Show the units name"],
|
||||||
order = 2,
|
order = 2,
|
||||||
width = "full",
|
width = "full",
|
||||||
|
disabled = function() return Gladdy.db.healthCustomTagsEnabled end,
|
||||||
}),
|
}),
|
||||||
healthNameToArenaId = option({
|
healthNameToArenaId = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show ArenaX"],
|
name = L["Show ArenaX"],
|
||||||
desc = L["Show Arena1-5 as name instead"],
|
desc = L["Show 1-5 as name instead"],
|
||||||
order = 3,
|
order = 3,
|
||||||
width = "full",
|
width = "full",
|
||||||
disabled = function() return not Gladdy.db.healthName end
|
disabled = function() return not Gladdy.db.healthName or Gladdy.db.healthCustomTagsEnabled end,
|
||||||
}),
|
|
||||||
healthActual = option({
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Show the actual health"],
|
|
||||||
desc = L["Show the actual health on the health bar"],
|
|
||||||
order = 4,
|
|
||||||
width = "full",
|
|
||||||
}),
|
|
||||||
healthMax = option({
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Show max health"],
|
|
||||||
desc = L["Show max health on the health bar"],
|
|
||||||
order = 5,
|
|
||||||
width = "full",
|
|
||||||
}),
|
}),
|
||||||
healthPercentage = option({
|
healthPercentage = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
@ -524,7 +596,16 @@ function Healthbar:GetOptions()
|
|||||||
desc = L["Show health percentage on the health bar"],
|
desc = L["Show health percentage on the health bar"],
|
||||||
order = 6,
|
order = 6,
|
||||||
width = "full",
|
width = "full",
|
||||||
|
disabled = function() return Gladdy.db.healthCustomTagsEnabled end,
|
||||||
}),
|
}),
|
||||||
|
header = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Custom Tags"],
|
||||||
|
order = 10,
|
||||||
|
},
|
||||||
|
healthCustomTagsEnabled = Gladdy:GetTagOption(L["Custom Tags Enabled"], 11, nil, option, true),
|
||||||
|
healthTextLeft = Gladdy:GetTagOption(L["Left Text"], 12, "healthCustomTagsEnabled", option),
|
||||||
|
healthTextRight = Gladdy:GetTagOption(L["Right Text"], 13, "healthCustomTagsEnabled", option),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -13,6 +13,8 @@ local Highlight = Gladdy:NewModule("Highlight", nil, {
|
|||||||
targetBorder = true,
|
targetBorder = true,
|
||||||
focusBorder = true,
|
focusBorder = true,
|
||||||
leaderBorder = true,
|
leaderBorder = true,
|
||||||
|
highlightFrameStrata = "MEDIUM",
|
||||||
|
highlightFrameLevel = 20,
|
||||||
})
|
})
|
||||||
|
|
||||||
function Highlight:Initialize()
|
function Highlight:Initialize()
|
||||||
@ -55,18 +57,21 @@ function Highlight:CreateFrame(unit)
|
|||||||
local healthBar = Gladdy.modules["Health Bar"].frames[unit]
|
local healthBar = Gladdy.modules["Health Bar"].frames[unit]
|
||||||
|
|
||||||
local targetBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
|
local targetBorder = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
|
targetBorder:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "highlightBorderStyle"), edgeSize = Gladdy.db.highlightBorderSize })
|
||||||
--targetBorder:SetFrameStrata("MEDIUM")
|
targetBorder:SetFrameStrata(Gladdy.db.highlightFrameStrata)
|
||||||
|
targetBorder:SetFrameLevel(Gladdy.db.highlightFrameLevel)
|
||||||
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 = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
|
focusBorder:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "highlightBorderStyle"), edgeSize = Gladdy.db.highlightBorderSize })
|
||||||
--focusBorder:SetFrameStrata("MEDIUM")
|
focusBorder:SetFrameStrata(Gladdy.db.highlightFrameStrata)
|
||||||
|
focusBorder:SetFrameLevel(Gladdy.db.highlightFrameLevel)
|
||||||
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 = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = Gladdy.db.highlightBorderSize })
|
leaderBorder:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "highlightBorderStyle"), edgeSize = Gladdy.db.highlightBorderSize })
|
||||||
--leaderBorder:SetFrameStrata("MEDIUM")
|
leaderBorder:SetFrameStrata(Gladdy.db.highlightFrameStrata)
|
||||||
|
leaderBorder:SetFrameLevel(Gladdy.db.highlightFrameLevel)
|
||||||
leaderBorder:Hide()
|
leaderBorder:Hide()
|
||||||
|
|
||||||
local highlight = healthBar:CreateTexture(nil, "OVERLAY")
|
local highlight = healthBar:CreateTexture(nil, "OVERLAY")
|
||||||
@ -96,6 +101,13 @@ function Highlight:UpdateFrame(unit)
|
|||||||
local width = Gladdy.db.barWidth + (Gladdy.db.highlightInset and 0 or borderSize * 2)
|
local width = Gladdy.db.barWidth + (Gladdy.db.highlightInset and 0 or borderSize * 2)
|
||||||
local height = hpAndPowerHeight + (Gladdy.db.highlightInset and 0 or borderSize * 2)
|
local height = hpAndPowerHeight + (Gladdy.db.highlightInset and 0 or borderSize * 2)
|
||||||
|
|
||||||
|
button.targetBorder:SetFrameStrata(Gladdy.db.highlightFrameStrata)
|
||||||
|
button.targetBorder:SetFrameLevel(Gladdy.db.highlightFrameLevel)
|
||||||
|
button.focusBorder:SetFrameStrata(Gladdy.db.highlightFrameStrata)
|
||||||
|
button.focusBorder:SetFrameLevel(Gladdy.db.highlightFrameLevel)
|
||||||
|
button.leaderBorder:SetFrameStrata(Gladdy.db.highlightFrameStrata)
|
||||||
|
button.leaderBorder:SetFrameLevel(Gladdy.db.highlightFrameLevel)
|
||||||
|
|
||||||
button.targetBorder:SetWidth(width)
|
button.targetBorder:SetWidth(width)
|
||||||
button.targetBorder:SetHeight(height)
|
button.targetBorder:SetHeight(height)
|
||||||
button.targetBorder:ClearAllPoints()
|
button.targetBorder:ClearAllPoints()
|
||||||
@ -106,8 +118,8 @@ function Highlight:UpdateFrame(unit)
|
|||||||
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
|
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
|
||||||
end
|
end
|
||||||
|
|
||||||
button.targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
|
button.targetBorder:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "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:SetColor(Gladdy.db.targetBorderColor))
|
||||||
|
|
||||||
button.focusBorder:SetWidth(width)
|
button.focusBorder:SetWidth(width)
|
||||||
button.focusBorder:SetHeight(height)
|
button.focusBorder:SetHeight(height)
|
||||||
@ -119,8 +131,8 @@ function Highlight:UpdateFrame(unit)
|
|||||||
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
|
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
|
||||||
end
|
end
|
||||||
|
|
||||||
button.focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
|
button.focusBorder:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "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:SetColor(Gladdy.db.focusBorderColor))
|
||||||
|
|
||||||
button.leaderBorder:SetWidth(width)
|
button.leaderBorder:SetWidth(width)
|
||||||
button.leaderBorder:SetHeight(height)
|
button.leaderBorder:SetHeight(height)
|
||||||
@ -132,8 +144,8 @@ function Highlight:UpdateFrame(unit)
|
|||||||
button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
|
button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
|
||||||
end
|
end
|
||||||
|
|
||||||
button.leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
|
button.leaderBorder:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "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:SetColor(Gladdy.db.leaderBorderColor))
|
||||||
if Gladdy.frame.testing then
|
if Gladdy.frame.testing then
|
||||||
Highlight:Test(unit)
|
Highlight:Test(unit)
|
||||||
end
|
end
|
||||||
@ -207,67 +219,130 @@ function Highlight:GetOptions()
|
|||||||
desc = L["Show Highlight border inside of frame"],
|
desc = L["Show Highlight border inside of frame"],
|
||||||
order = 3,
|
order = 3,
|
||||||
}),
|
}),
|
||||||
highlightBorderSize = Gladdy:option({
|
group = {
|
||||||
type = "range",
|
type = "group",
|
||||||
name = L["Border size"],
|
childGroups = "tree",
|
||||||
desc = L["Border size"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 3,
|
||||||
min = 1,
|
args = {
|
||||||
max = 20,
|
enabled = {
|
||||||
step = 1,
|
type = "group",
|
||||||
width = "full",
|
name = L["Enabled"],
|
||||||
}),
|
order = 1,
|
||||||
highlightBorderStyle = Gladdy:option({
|
args = {
|
||||||
type = "select",
|
headerEnable = {
|
||||||
name = L["Border style"],
|
type = "header",
|
||||||
order = 5,
|
name = L["Enabled"],
|
||||||
dialogControl = "LSM30_Border",
|
order = 10,
|
||||||
values = AceGUIWidgetLSMlists.border,
|
},
|
||||||
}),
|
highlight = Gladdy:option({
|
||||||
headerColor = {
|
type = "toggle",
|
||||||
type = "header",
|
name = L["Highlight target"],
|
||||||
name = L["Colors"],
|
desc = L["Toggle if the selected target should be highlighted"],
|
||||||
order = 6,
|
order = 11,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
targetBorder = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Show border around target"],
|
||||||
|
desc = L["Toggle if a border should be shown around the selected target"],
|
||||||
|
order = 12,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
focusBorder = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Show border around focus"],
|
||||||
|
desc = L["Toggle of a border should be shown around the current focus"],
|
||||||
|
order = 13,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
border = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Border"],
|
||||||
|
order = 2,
|
||||||
|
args = {
|
||||||
|
headerHighlight = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Border"],
|
||||||
|
order = 2,
|
||||||
|
},
|
||||||
|
highlightBorderSize = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Border size"],
|
||||||
|
desc = L["Border size"],
|
||||||
|
order = 4,
|
||||||
|
min = 1,
|
||||||
|
max = 20,
|
||||||
|
step = 1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
highlightBorderStyle = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Border style"],
|
||||||
|
order = 5,
|
||||||
|
dialogControl = "LSM30_Border",
|
||||||
|
values = AceGUIWidgetLSMlists.border,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
color = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Color"],
|
||||||
|
order = 3,
|
||||||
|
args = {
|
||||||
|
headerColor = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Colors"],
|
||||||
|
order = 6,
|
||||||
|
},
|
||||||
|
targetBorderColor = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Target border color"],
|
||||||
|
desc = L["Color of the selected targets border"],
|
||||||
|
order = 7,
|
||||||
|
hasAlpha = true,
|
||||||
|
}),
|
||||||
|
focusBorderColor = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Focus border color"],
|
||||||
|
desc = L["Color of the focus border"],
|
||||||
|
order = 8,
|
||||||
|
hasAlpha = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 4,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
highlightFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
highlightFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 1,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
targetBorderColor = Gladdy:colorOption({
|
|
||||||
type = "color",
|
|
||||||
name = L["Target border color"],
|
|
||||||
desc = L["Color of the selected targets border"],
|
|
||||||
order = 7,
|
|
||||||
hasAlpha = true,
|
|
||||||
}),
|
|
||||||
focusBorderColor = Gladdy:colorOption({
|
|
||||||
type = "color",
|
|
||||||
name = L["Focus border color"],
|
|
||||||
desc = L["Color of the focus border"],
|
|
||||||
order = 8,
|
|
||||||
hasAlpha = true,
|
|
||||||
}),
|
|
||||||
headerEnable = {
|
|
||||||
type = "header",
|
|
||||||
name = L["Enabled"],
|
|
||||||
order = 10,
|
|
||||||
},
|
|
||||||
highlight = Gladdy:option({
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Highlight target"],
|
|
||||||
desc = L["Toggle if the selected target should be highlighted"],
|
|
||||||
order = 11,
|
|
||||||
width = "full",
|
|
||||||
}),
|
|
||||||
targetBorder = Gladdy:option({
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Show border around target"],
|
|
||||||
desc = L["Toggle if a border should be shown around the selected target"],
|
|
||||||
order = 12,
|
|
||||||
width = "full",
|
|
||||||
}),
|
|
||||||
focusBorder = Gladdy:option({
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Show border around focus"],
|
|
||||||
desc = L["Toggle of a border should be shown around the current focus"],
|
|
||||||
order = 13,
|
|
||||||
width = "full",
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
end
|
end
|
203
Modules/Pets.lua
203
Modules/Pets.lua
@ -23,24 +23,42 @@ local Pets = Gladdy:NewModule("Pets", nil, {
|
|||||||
petHealthPercentage = true,
|
petHealthPercentage = true,
|
||||||
petXOffset = 1,
|
petXOffset = 1,
|
||||||
petYOffset = -62,
|
petYOffset = -62,
|
||||||
|
petGroup = false,
|
||||||
|
petMargin = 1,
|
||||||
|
petFrameStrata = "MEDIUM",
|
||||||
|
petFrameLevel = 5,
|
||||||
})
|
})
|
||||||
|
|
||||||
function Pets:Initialize()
|
function Pets:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
if Gladdy.db.petEnabled then
|
||||||
self:RegisterMessage("PET_SPOTTED")
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self:RegisterMessage("PET_DESTROYED")
|
self:RegisterMessage("PET_SPOTTED")
|
||||||
self:RegisterMessage("PET_STEALTH")
|
self:RegisterMessage("PET_DESTROYED")
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
self:RegisterMessage("PET_STEALTH")
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Pets:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.petEnabled then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
self:RegisterMessage("PET_SPOTTED")
|
||||||
|
self:RegisterMessage("PET_DESTROYED")
|
||||||
|
self:RegisterMessage("PET_STEALTH")
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pets:JOINED_ARENA()
|
function Pets:JOINED_ARENA()
|
||||||
for k,v in pairs(self.frames) do
|
for _,v in pairs(self.frames) do
|
||||||
v.healthBar:SetAlpha(0)
|
v.healthBar:SetAlpha(0)
|
||||||
end
|
end
|
||||||
if Gladdy.db.petEnabled then
|
if Gladdy.db.petEnabled then
|
||||||
self:RegisterEvent("UNIT_PET")
|
self:RegisterEvent("UNIT_PET")
|
||||||
self:SetScript("OnEvent", function(self, event, unitId)
|
self:SetScript("OnEvent", function(_, event, unitId)
|
||||||
if event == "UNIT_PET" then
|
if event == "UNIT_PET" then
|
||||||
local unit = Gladdy.guids[UnitGUID(unitId)]
|
local unit = Gladdy.guids[UnitGUID(unitId)]
|
||||||
if unit then
|
if unit then
|
||||||
@ -63,9 +81,10 @@ function Pets:ResetUnit(unitId)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Pets:PET_SPOTTED(unit)
|
function Pets:PET_SPOTTED(unit)
|
||||||
|
Gladdy.guids[UnitGUID(unit)] = unit
|
||||||
if Gladdy.db.petEnabled then
|
if Gladdy.db.petEnabled then
|
||||||
self.frames[unit].healthBar:SetAlpha(1)
|
self.frames[unit].healthBar:SetAlpha(1)
|
||||||
self.frames[unit].healthBar.hp:SetStatusBarColor(Gladdy.db.petHealthBarColor.r, Gladdy.db.petHealthBarColor.g, Gladdy.db.petHealthBarColor.b, Gladdy.db.petHealthBarColor.a)
|
self.frames[unit].healthBar.hp:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.petHealthBarColor))
|
||||||
self.frames[unit].healthBar:SetScript("OnUpdate", function(self)
|
self.frames[unit].healthBar:SetScript("OnUpdate", function(self)
|
||||||
self.hp:SetValue(UnitHealth(self.unit))
|
self.hp:SetValue(UnitHealth(self.unit))
|
||||||
Pets:SetHealthText(self, UnitHealth(unit), UnitHealthMax(unit))
|
Pets:SetHealthText(self, UnitHealth(unit), UnitHealthMax(unit))
|
||||||
@ -134,6 +153,7 @@ function Pets:CreateFrame(unitId)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
local button = CreateFrame("Frame", "GladdyButtonFramePet" .. unit, Gladdy.frame)
|
local button = CreateFrame("Frame", "GladdyButtonFramePet" .. unit, Gladdy.frame)
|
||||||
|
button:SetMovable(true)
|
||||||
--button:SetAlpha(0)
|
--button:SetAlpha(0)
|
||||||
button:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
button:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
||||||
|
|
||||||
@ -149,10 +169,11 @@ function Pets:CreateFrame(unitId)
|
|||||||
button.secure = secure
|
button.secure = secure
|
||||||
|
|
||||||
local healthBar = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
|
local healthBar = CreateFrame("Frame", nil, button, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
healthBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.petHealthBarBorderStyle),
|
healthBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "petHealthBarBorderStyle"),
|
||||||
edgeSize = Gladdy.db.petHealthBarBorderSize })
|
edgeSize = Gladdy.db.petHealthBarBorderSize })
|
||||||
healthBar:SetBackdropBorderColor(Gladdy.db.petHealthBarBorderColor.r, Gladdy.db.petHealthBarBorderColor.g, Gladdy.db.petHealthBarBorderColor.b, Gladdy.db.petHealthBarBorderColor.a)
|
healthBar:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.petHealthBarBorderColor))
|
||||||
healthBar:SetFrameLevel(1)
|
healthBar:SetFrameStrata(Gladdy.db.petFrameStrata)
|
||||||
|
healthBar:SetFrameLevel(Gladdy.db.petFrameLevel)
|
||||||
healthBar:SetAllPoints(button)
|
healthBar:SetAllPoints(button)
|
||||||
healthBar:SetAlpha(0)
|
healthBar:SetAlpha(0)
|
||||||
|
|
||||||
@ -163,32 +184,33 @@ function Pets:CreateFrame(unitId)
|
|||||||
healthBar.portrait.border = healthBar:CreateTexture(nil, "OVERLAY")
|
healthBar.portrait.border = healthBar:CreateTexture(nil, "OVERLAY")
|
||||||
healthBar.portrait.border:SetAllPoints(healthBar.portrait)
|
healthBar.portrait.border:SetAllPoints(healthBar.portrait)
|
||||||
healthBar.portrait.border:SetTexture(Gladdy.db.classIconBorderStyle)
|
healthBar.portrait.border:SetTexture(Gladdy.db.classIconBorderStyle)
|
||||||
healthBar.portrait.border:SetVertexColor(Gladdy.db.petHealthBarBorderColor.r, Gladdy.db.petHealthBarBorderColor.g, Gladdy.db.petHealthBarBorderColor.b, Gladdy.db.petHealthBarBorderColor.a)
|
healthBar.portrait.border:SetVertexColor(Gladdy:SetColor(Gladdy.db.petHealthBarBorderColor))
|
||||||
|
|
||||||
|
|
||||||
healthBar.hp = CreateFrame("StatusBar", nil, healthBar)
|
healthBar.hp = CreateFrame("StatusBar", nil, healthBar)
|
||||||
healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.petHealthBarTexture))
|
healthBar.hp:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "petHealthBarTexture"))
|
||||||
healthBar.hp:SetStatusBarColor(Gladdy.db.petHealthBarColor.r, Gladdy.db.petHealthBarColor.g, Gladdy.db.petHealthBarColor.b, Gladdy.db.petHealthBarColor.a)
|
healthBar.hp:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.petHealthBarColor))
|
||||||
healthBar.hp:SetMinMaxValues(0, 100)
|
healthBar.hp:SetMinMaxValues(0, 100)
|
||||||
healthBar.hp:SetFrameLevel(0)
|
healthBar.hp:SetFrameStrata(Gladdy.db.petFrameStrata)
|
||||||
|
healthBar.hp:SetFrameLevel(Gladdy.db.petFrameLevel - 1)
|
||||||
healthBar.hp:SetAllPoints(healthBar)
|
healthBar.hp:SetAllPoints(healthBar)
|
||||||
|
|
||||||
healthBar.bg = healthBar.hp:CreateTexture(nil, "BACKGROUND")
|
healthBar.bg = healthBar.hp:CreateTexture(nil, "BACKGROUND")
|
||||||
healthBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.petHealthBarTexture))
|
healthBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "petHealthBarTexture"))
|
||||||
healthBar.bg:ClearAllPoints()
|
healthBar.bg:ClearAllPoints()
|
||||||
healthBar.bg:SetAllPoints(healthBar.hp)
|
healthBar.bg:SetAllPoints(healthBar.hp)
|
||||||
healthBar.bg:SetAlpha(1)
|
healthBar.bg:SetAlpha(1)
|
||||||
healthBar.bg:SetVertexColor(Gladdy.db.petHealthBarBgColor.r, Gladdy.db.petHealthBarBgColor.g, Gladdy.db.petHealthBarBgColor.b, Gladdy.db.petHealthBarBgColor.a)
|
healthBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.petHealthBarBgColor))
|
||||||
|
|
||||||
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
|
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
|
||||||
if (Gladdy.db.petHealthBarFontSize < 1) then
|
if (Gladdy.db.petHealthBarFontSize < 1) then
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), 1)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), 1)
|
||||||
healthBar.nameText:Hide()
|
healthBar.nameText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), Gladdy.db.petHealthBarFontSize)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), Gladdy.db.petHealthBarFontSize)
|
||||||
healthBar.nameText:Show()
|
healthBar.nameText:Show()
|
||||||
end
|
end
|
||||||
healthBar.nameText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
|
healthBar.nameText:SetTextColor(Gladdy:SetColor(Gladdy.db.petHealthBarFontColor))
|
||||||
healthBar.nameText:SetShadowOffset(1, -1)
|
healthBar.nameText:SetShadowOffset(1, -1)
|
||||||
healthBar.nameText:SetShadowColor(0, 0, 0, 1)
|
healthBar.nameText:SetShadowColor(0, 0, 0, 1)
|
||||||
healthBar.nameText:SetJustifyH("CENTER")
|
healthBar.nameText:SetJustifyH("CENTER")
|
||||||
@ -196,13 +218,13 @@ function Pets:CreateFrame(unitId)
|
|||||||
|
|
||||||
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
|
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
|
||||||
if (Gladdy.db.petHealthBarFontSize < 1) then
|
if (Gladdy.db.petHealthBarFontSize < 1) then
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), 1)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), 1)
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), Gladdy.db.petHealthBarFontSize)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), Gladdy.db.petHealthBarFontSize)
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
end
|
end
|
||||||
healthBar.healthText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
|
healthBar.healthText:SetTextColor(Gladdy:SetColor(Gladdy.db.petHealthBarFontColor))
|
||||||
healthBar.healthText:SetShadowOffset(1, -1)
|
healthBar.healthText:SetShadowOffset(1, -1)
|
||||||
healthBar.healthText:SetShadowColor(0, 0, 0, 1)
|
healthBar.healthText:SetShadowColor(0, 0, 0, 1)
|
||||||
healthBar.healthText:SetJustifyH("CENTER")
|
healthBar.healthText:SetJustifyH("CENTER")
|
||||||
@ -211,7 +233,7 @@ function Pets:CreateFrame(unitId)
|
|||||||
healthBar.unit = unit
|
healthBar.unit = unit
|
||||||
button.healthBar = healthBar
|
button.healthBar = healthBar
|
||||||
|
|
||||||
healthBar:RegisterUnitEvent("UNIT_HEALTH", unit)
|
healthBar:RegisterUnitEvent("UNIT_HEALTH_FREQUENT", unit)
|
||||||
healthBar:RegisterUnitEvent("UNIT_MAXHEALTH", unit)
|
healthBar:RegisterUnitEvent("UNIT_MAXHEALTH", unit)
|
||||||
healthBar:RegisterUnitEvent("UNIT_PORTRAIT_UPDATE", unit)
|
healthBar:RegisterUnitEvent("UNIT_PORTRAIT_UPDATE", unit)
|
||||||
healthBar:RegisterUnitEvent("UNIT_NAME_UPDATE", unit)
|
healthBar:RegisterUnitEvent("UNIT_NAME_UPDATE", unit)
|
||||||
@ -241,6 +263,11 @@ function Pets:UpdateFrame(unitId)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
healthBar:SetFrameStrata(Gladdy.db.petFrameStrata)
|
||||||
|
healthBar:SetFrameLevel(Gladdy.db.petFrameLevel)
|
||||||
|
healthBar.hp:SetFrameStrata(Gladdy.db.petFrameStrata)
|
||||||
|
healthBar.hp:SetFrameLevel(Gladdy.db.petFrameLevel - 1)
|
||||||
|
|
||||||
if not Gladdy.db.petEnabled then
|
if not Gladdy.db.petEnabled then
|
||||||
self.frames[unit]:Hide()
|
self.frames[unit]:Hide()
|
||||||
else
|
else
|
||||||
@ -249,7 +276,22 @@ function Pets:UpdateFrame(unitId)
|
|||||||
|
|
||||||
self.frames[unit]:SetWidth(Gladdy.db.petWidth)
|
self.frames[unit]:SetWidth(Gladdy.db.petWidth)
|
||||||
self.frames[unit]:SetHeight(Gladdy.db.petHeight)
|
self.frames[unit]:SetHeight(Gladdy.db.petHeight)
|
||||||
self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
|
||||||
|
Gladdy:SetPosition(self.frames[unit], unitId, "petXOffset", "petYOffset", Pets:LegacySetPosition(unit, unitId), Pets)
|
||||||
|
|
||||||
|
if (Gladdy.db.petGroup) then
|
||||||
|
if (unit == "arenapet1") then
|
||||||
|
self.frames[unit]:ClearAllPoints()
|
||||||
|
self.frames[unit]:SetPoint("TOPLEFT", Gladdy.buttons[unitId].healthBar, "TOPLEFT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
||||||
|
else
|
||||||
|
local previousPet = "arenapet" .. string_gsub(unit, "arenapet", "") - 1
|
||||||
|
self.frames[unit]:ClearAllPoints()
|
||||||
|
self.frames[unit]:SetPoint("TOPLEFT", self.frames[previousPet], "BOTTOMLEFT", 0, - Gladdy.db.petMargin)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.frames[unit]:ClearAllPoints()
|
||||||
|
self.frames[unit]:SetPoint("TOPLEFT", Gladdy.buttons[unitId].healthBar, "TOPLEFT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
||||||
|
end
|
||||||
|
|
||||||
healthBar.portrait:SetHeight(Gladdy.db.petHeight)
|
healthBar.portrait:SetHeight(Gladdy.db.petHeight)
|
||||||
healthBar.portrait:SetWidth(Gladdy.db.petHeight)
|
healthBar.portrait:SetWidth(Gladdy.db.petHeight)
|
||||||
@ -261,34 +303,37 @@ function Pets:UpdateFrame(unitId)
|
|||||||
healthBar.portrait.border:Show()
|
healthBar.portrait.border:Show()
|
||||||
end
|
end
|
||||||
healthBar.portrait.border:SetTexture(Gladdy.db.petPortraitBorderStyle)
|
healthBar.portrait.border:SetTexture(Gladdy.db.petPortraitBorderStyle)
|
||||||
healthBar.portrait.border:SetVertexColor(Gladdy.db.petHealthBarBorderColor.r, Gladdy.db.petHealthBarBorderColor.g, Gladdy.db.petHealthBarBorderColor.b, Gladdy.db.petHealthBarBorderColor.a)
|
healthBar.portrait.border:SetVertexColor(Gladdy:SetColor(Gladdy.db.petHealthBarBorderColor))
|
||||||
|
|
||||||
healthBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.petHealthBarTexture))
|
healthBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "petHealthBarTexture"))
|
||||||
healthBar.bg:SetVertexColor(Gladdy.db.petHealthBarBgColor.r, Gladdy.db.petHealthBarBgColor.g, Gladdy.db.petHealthBarBgColor.b, Gladdy.db.petHealthBarBgColor.a)
|
healthBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.petHealthBarBgColor))
|
||||||
|
|
||||||
healthBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.petHealthBarBorderStyle),
|
healthBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "petHealthBarBorderStyle"),
|
||||||
edgeSize = Gladdy.db.petHealthBarBorderSize })
|
edgeSize = Gladdy.db.petHealthBarBorderSize })
|
||||||
healthBar:SetBackdropBorderColor(Gladdy.db.petHealthBarBorderColor.r, Gladdy.db.petHealthBarBorderColor.g, Gladdy.db.petHealthBarBorderColor.b, Gladdy.db.petHealthBarBorderColor.a)
|
healthBar:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.petHealthBarBorderColor))
|
||||||
|
|
||||||
healthBar.hp:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.petHealthBarTexture))
|
healthBar.hp:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "petHealthBarTexture"))
|
||||||
healthBar.hp:SetStatusBarColor(Gladdy.db.petHealthBarColor.r, Gladdy.db.petHealthBarColor.g, Gladdy.db.petHealthBarColor.b, Gladdy.db.petHealthBarColor.a)
|
healthBar.hp:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.petHealthBarColor))
|
||||||
healthBar.hp:ClearAllPoints()
|
healthBar.hp:ClearAllPoints()
|
||||||
healthBar.hp:SetPoint("TOPLEFT", healthBar, "TOPLEFT", (Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
healthBar.hp:SetPoint("TOPLEFT", healthBar, "TOPLEFT", (Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
healthBar.hp:SetPoint("BOTTOMRIGHT", healthBar, "BOTTOMRIGHT", -(Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
healthBar.hp:SetPoint("BOTTOMRIGHT", healthBar, "BOTTOMRIGHT", -(Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.petHealthBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
|
|
||||||
if (Gladdy.db.petHealthBarFontSize < 1) then
|
if (Gladdy.db.petHealthBarFontSize < 1) then
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), 1)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), 1)
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), 1)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), 1)
|
||||||
healthBar.nameText:Hide()
|
healthBar.nameText:Hide()
|
||||||
healthBar.healthText:Hide()
|
healthBar.healthText:Hide()
|
||||||
else
|
else
|
||||||
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), Gladdy.db.petHealthBarFontSize)
|
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), Gladdy.db.petHealthBarFontSize)
|
||||||
healthBar.nameText:Show()
|
healthBar.nameText:Show()
|
||||||
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), Gladdy.db.petHealthBarFontSize)
|
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), Gladdy.db.petHealthBarFontSize)
|
||||||
healthBar.healthText:Show()
|
healthBar.healthText:Show()
|
||||||
end
|
end
|
||||||
healthBar.nameText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
|
healthBar.nameText:SetTextColor(Gladdy:SetColor(Gladdy.db.petHealthBarFontColor))
|
||||||
healthBar.healthText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
|
healthBar.healthText:SetTextColor(Gladdy:SetColor(Gladdy.db.petHealthBarFontColor))
|
||||||
|
if (unit == "arenapet1") then
|
||||||
|
Gladdy:CreateMover(self.frames[unit], "petXOffset", "petYOffset", L["Pets"], {"TOPLEFT", "TOPLEFT"})
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Pets:SetHealthText(healthBar, health, healthMax)
|
function Pets:SetHealthText(healthBar, health, healthMax)
|
||||||
@ -344,11 +389,17 @@ function Pets:GetOptions()
|
|||||||
desc = L["Enables Pets module"],
|
desc = L["Enables Pets module"],
|
||||||
order = 3,
|
order = 3,
|
||||||
}),
|
}),
|
||||||
|
petGroup = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Group Pets"],
|
||||||
|
order = 4,
|
||||||
|
}),
|
||||||
group = {
|
group = {
|
||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 3,
|
order = 3,
|
||||||
|
disabled = function() return not Gladdy.db.petEnabled end,
|
||||||
args = {
|
args = {
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -380,11 +431,23 @@ function Pets:GetOptions()
|
|||||||
step = 1,
|
step = 1,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
petMargin = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Margin"],
|
||||||
|
desc = L["Height of the bar"],
|
||||||
|
order = 6,
|
||||||
|
disabled = function()
|
||||||
|
return not Gladdy.db.petGroup
|
||||||
|
end,
|
||||||
|
min = 0,
|
||||||
|
max = 50,
|
||||||
|
step = .1,
|
||||||
|
}),
|
||||||
petHealthBarTexture = option({
|
petHealthBarTexture = option({
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Bar texture"],
|
name = L["Bar texture"],
|
||||||
desc = L["Texture of the bar"],
|
desc = L["Texture of the bar"],
|
||||||
order = 5,
|
order = 7,
|
||||||
dialogControl = "LSM30_Statusbar",
|
dialogControl = "LSM30_Statusbar",
|
||||||
values = AceGUIWidgetLSMlists.statusbar,
|
values = AceGUIWidgetLSMlists.statusbar,
|
||||||
}),
|
}),
|
||||||
@ -392,14 +455,14 @@ function Pets:GetOptions()
|
|||||||
type = "color",
|
type = "color",
|
||||||
name = L["Health color"],
|
name = L["Health color"],
|
||||||
desc = L["Color of the status bar"],
|
desc = L["Color of the status bar"],
|
||||||
order = 6,
|
order = 8,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
}),
|
}),
|
||||||
petHealthBarBgColor = Gladdy:colorOption({
|
petHealthBarBgColor = Gladdy:colorOption({
|
||||||
type = "color",
|
type = "color",
|
||||||
name = L["Background color"],
|
name = L["Background color"],
|
||||||
desc = L["Color of the status bar background"],
|
desc = L["Color of the status bar background"],
|
||||||
order = 7,
|
order = 9,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
@ -530,10 +593,39 @@ function Pets:GetOptions()
|
|||||||
}),
|
}),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 6,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
petFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
petFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 1,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
healthValues = {
|
healthValues = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Health Values"],
|
name = L["Health Values"],
|
||||||
order = 6,
|
order = 7,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
@ -551,4 +643,31 @@ function Pets:GetOptions()
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Pets:LegacySetPosition(unit, unitId)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
self.frames[unit]:ClearAllPoints()
|
||||||
|
self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
||||||
|
if (Gladdy.db.petGroup) then
|
||||||
|
if (unit == "arenapet1") then
|
||||||
|
self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
||||||
|
else
|
||||||
|
local previousPet = "arenapet" .. string_gsub(unit, "arenapet", "") - 1
|
||||||
|
self.frames[unit]:ClearAllPoints()
|
||||||
|
self.frames[unit]:SetPoint("TOPLEFT", self.frames[previousPet], "BOTTOMLEFT", 0, - Gladdy.db.petMargin)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.frames[unit]:ClearAllPoints()
|
||||||
|
self.frames[unit]:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
|
||||||
|
end
|
||||||
|
return Gladdy.db.newLayout
|
||||||
end
|
end
|
@ -16,21 +16,46 @@ local Powerbar = Gladdy:NewModule("Power Bar", 90, {
|
|||||||
powerBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
powerBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
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,
|
powerBarRaceFontSize = 10,
|
||||||
|
powerBarPowerFontSize = 10,
|
||||||
powerShowSpec = true,
|
powerShowSpec = true,
|
||||||
powerShowRace = true,
|
powerShowRace = true,
|
||||||
powerActual = true,
|
powerActual = true,
|
||||||
powerMax = true,
|
powerMax = true,
|
||||||
powerPercentage = false,
|
powerPercentage = false,
|
||||||
|
powerFrameStrata = "MEDIUM",
|
||||||
|
powerFrameLevel = 1,
|
||||||
|
powerCustomTagsEnabled = false,
|
||||||
|
powerTextLeft = "[spec] [race]",
|
||||||
|
powerTextRight = "[current]/[max]",
|
||||||
|
powerTextLeftOutline = false,
|
||||||
|
powerTextRightOutline = false,
|
||||||
|
powerTextLeftVOffset = 1,
|
||||||
|
powerTextLeftHOffset = 5,
|
||||||
|
powerTextRightVOffset = 1,
|
||||||
|
powerTextRightHOffset = -5,
|
||||||
})
|
})
|
||||||
|
|
||||||
function Powerbar:Initialize()
|
function Powerbar:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
|
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
if Gladdy.db.powerBarEnabled then
|
||||||
self:RegisterMessage("UNIT_SPEC")
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
self:RegisterMessage("UNIT_DEATH")
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
self:RegisterMessage("UNIT_DESTROYED")
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
|
self:RegisterMessage("UNIT_DESTROYED")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Powerbar:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.powerBarEnabled then
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("UNIT_SPEC")
|
||||||
|
self:RegisterMessage("UNIT_DEATH")
|
||||||
|
self:RegisterMessage("UNIT_DESTROYED")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:CreateFrame(unit)
|
function Powerbar:CreateFrame(unit)
|
||||||
@ -38,81 +63,160 @@ function Powerbar:CreateFrame(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:EnableMouse(false)
|
||||||
powerBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.powerBarBorderStyle),
|
powerBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "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:SetColor(Gladdy.db.powerBarBorderColor))
|
||||||
powerBar:SetFrameLevel(1)
|
powerBar:SetFrameStrata(Gladdy.db.powerFrameStrata)
|
||||||
|
powerBar:SetFrameLevel(Gladdy.db.powerFrameLevel)
|
||||||
|
|
||||||
powerBar.energy = CreateFrame("StatusBar", nil, powerBar)
|
powerBar.energy = CreateFrame("StatusBar", nil, powerBar)
|
||||||
powerBar.energy:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.powerBarTexture))
|
powerBar.energy:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "powerBarTexture"))
|
||||||
powerBar.energy:SetMinMaxValues(0, 100)
|
powerBar.energy:SetMinMaxValues(0, 100)
|
||||||
powerBar.energy:SetFrameLevel(0)
|
powerBar.energy:SetFrameStrata(Gladdy.db.powerFrameStrata)
|
||||||
|
powerBar.energy:SetFrameLevel(Gladdy.db.powerFrameLevel - 1)
|
||||||
|
|
||||||
powerBar.bg = powerBar.energy:CreateTexture(nil, "BACKGROUND")
|
powerBar.bg = powerBar.energy:CreateTexture(nil, "BACKGROUND")
|
||||||
powerBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.powerBarTexture))
|
powerBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "powerBarTexture"))
|
||||||
powerBar.bg:ClearAllPoints()
|
powerBar.bg:ClearAllPoints()
|
||||||
powerBar.bg:SetAllPoints(powerBar.energy)
|
powerBar.bg:SetAllPoints(powerBar.energy)
|
||||||
powerBar.bg:SetVertexColor(Gladdy.db.powerBarBgColor.r, Gladdy.db.powerBarBgColor.g, Gladdy.db.powerBarBgColor.b, Gladdy.db.powerBarBgColor.a)
|
powerBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.powerBarBgColor))
|
||||||
|
|
||||||
powerBar.raceText = powerBar:CreateFontString(nil, "LOW")
|
powerBar.raceText = powerBar:CreateFontString(nil, "LOW")
|
||||||
powerBar.raceText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.powerBarFont), Gladdy.db.powerBarFontSize)
|
powerBar.raceText:SetFont(Gladdy:SMFetch("font", "powerBarFont"), Gladdy.db.powerBarRaceFontSize, Gladdy.db.powerTextLeftOutline and "OUTLINE")
|
||||||
powerBar.raceText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
|
powerBar.raceText:SetTextColor(Gladdy:SetColor(Gladdy.db.powerBarFontColor))
|
||||||
powerBar.raceText:SetShadowOffset(1, -1)
|
powerBar.raceText:SetShadowOffset(1, -1)
|
||||||
powerBar.raceText:SetShadowColor(0, 0, 0, 1)
|
powerBar.raceText:SetShadowColor(0, 0, 0, 1)
|
||||||
powerBar.raceText:SetJustifyH("CENTER")
|
powerBar.raceText:SetJustifyH("CENTER")
|
||||||
powerBar.raceText:SetPoint("LEFT", 5, 1)
|
powerBar.raceText:SetPoint("LEFT", Gladdy.db.powerTextLeftHOffset, Gladdy.db.powerTextLeftVOffset)
|
||||||
|
|
||||||
powerBar.powerText = powerBar:CreateFontString(nil, "LOW")
|
powerBar.powerText = powerBar:CreateFontString(nil, "LOW")
|
||||||
powerBar.powerText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.powerBarFont), Gladdy.db.powerBarFontSize)
|
powerBar.powerText:SetFont(Gladdy:SMFetch("font", "powerBarFont"), Gladdy.db.powerBarPowerFontSize, Gladdy.db.powerTextRightOutline and "OUTLINE")
|
||||||
powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
|
powerBar.powerText:SetTextColor(Gladdy:SetColor(Gladdy.db.powerBarFontColor))
|
||||||
powerBar.powerText:SetShadowOffset(1, -1)
|
powerBar.powerText:SetShadowOffset(1, -1)
|
||||||
powerBar.powerText:SetShadowColor(0, 0, 0, 1)
|
powerBar.powerText:SetShadowColor(0, 0, 0, 1)
|
||||||
powerBar.powerText:SetJustifyH("CENTER")
|
powerBar.powerText:SetJustifyH("CENTER")
|
||||||
powerBar.powerText:SetPoint("RIGHT", -5, 1)
|
powerBar.powerText:SetPoint("RIGHT", Gladdy.db.powerTextRightHOffset, Gladdy.db.powerTextRightVOffset)
|
||||||
|
|
||||||
button.powerBar = powerBar
|
button.powerBar = powerBar
|
||||||
self.frames[unit] = powerBar
|
self.frames[unit] = powerBar
|
||||||
self:ResetUnit(unit)
|
self:ResetUnit(unit)
|
||||||
|
powerBar.unit = unit
|
||||||
powerBar:RegisterUnitEvent("UNIT_POWER_UPDATE", unit)
|
powerBar:RegisterUnitEvent("UNIT_POWER_UPDATE", unit)
|
||||||
powerBar:RegisterUnitEvent("UNIT_MAXPOWER", unit)
|
powerBar:RegisterUnitEvent("UNIT_MAXPOWER", unit)
|
||||||
powerBar:RegisterUnitEvent("UNIT_DISPLAYPOWER", unit)
|
powerBar:RegisterUnitEvent("UNIT_DISPLAYPOWER", unit)
|
||||||
powerBar:SetScript("OnEvent", Powerbar.OnEvent)
|
powerBar:SetScript("OnEvent", Powerbar.OnEvent)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Powerbar:UpdateFrame(unit)
|
||||||
|
local powerBar = self.frames[unit]
|
||||||
|
if (not powerBar) then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local healthBar = Gladdy.modules["Health Bar"].frames[unit]
|
||||||
|
|
||||||
|
if not Gladdy.db.powerBarEnabled then
|
||||||
|
powerBar:Hide()
|
||||||
|
powerBar:UnregisterEvent("UNIT_POWER_UPDATE")
|
||||||
|
powerBar:UnregisterEvent("UNIT_MAXPOWER")
|
||||||
|
powerBar:UnregisterEvent("UNIT_DISPLAYPOWER")
|
||||||
|
powerBar:SetScript("OnEvent", nil)
|
||||||
|
return
|
||||||
|
else
|
||||||
|
powerBar:RegisterUnitEvent("UNIT_POWER_UPDATE", unit)
|
||||||
|
powerBar:RegisterUnitEvent("UNIT_MAXPOWER", unit)
|
||||||
|
powerBar:RegisterUnitEvent("UNIT_DISPLAYPOWER", unit)
|
||||||
|
powerBar:SetScript("OnEvent", Powerbar.OnEvent)
|
||||||
|
powerBar:Show()
|
||||||
|
end
|
||||||
|
powerBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "powerBarTexture"))
|
||||||
|
powerBar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.powerBarBgColor))
|
||||||
|
|
||||||
|
powerBar:SetWidth(healthBar:GetWidth())
|
||||||
|
powerBar:SetHeight(Gladdy.db.powerBarHeight)
|
||||||
|
|
||||||
|
powerBar:ClearAllPoints()
|
||||||
|
powerBar:SetPoint("TOPLEFT", healthBar, "BOTTOMLEFT", 0, -1)
|
||||||
|
|
||||||
|
powerBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "powerBarBorderStyle"),
|
||||||
|
edgeSize = Gladdy.db.powerBarBorderSize })
|
||||||
|
powerBar:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.powerBarBorderColor))
|
||||||
|
|
||||||
|
powerBar.energy:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "powerBarTexture"))
|
||||||
|
powerBar.energy:ClearAllPoints()
|
||||||
|
powerBar.energy:SetPoint("TOPLEFT", powerBar, "TOPLEFT", (Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
|
powerBar.energy:SetPoint("BOTTOMRIGHT", powerBar, "BOTTOMRIGHT", -(Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
||||||
|
|
||||||
|
powerBar.raceText:SetFont(Gladdy:SMFetch("font", "powerBarFont"), Gladdy.db.powerBarRaceFontSize, Gladdy.db.powerTextLeftOutline and "OUTLINE")
|
||||||
|
powerBar.raceText:SetTextColor(Gladdy:SetColor(Gladdy.db.powerBarFontColor))
|
||||||
|
powerBar.raceText:SetPoint("LEFT", Gladdy.db.powerTextLeftHOffset, Gladdy.db.powerTextLeftVOffset)
|
||||||
|
|
||||||
|
powerBar.powerText:SetFont(Gladdy:SMFetch("font", "powerBarFont"), Gladdy.db.powerBarPowerFontSize, Gladdy.db.powerTextRightOutline and "OUTLINE")
|
||||||
|
powerBar.powerText:SetTextColor(Gladdy:SetColor(Gladdy.db.powerBarFontColor))
|
||||||
|
powerBar.powerText:SetPoint("RIGHT", Gladdy.db.powerTextRightHOffset, Gladdy.db.powerTextRightVOffset)
|
||||||
|
|
||||||
|
powerBar:SetFrameStrata(Gladdy.db.powerFrameStrata)
|
||||||
|
powerBar:SetFrameLevel(Gladdy.db.powerFrameLevel)
|
||||||
|
powerBar.energy:SetFrameStrata(Gladdy.db.powerFrameStrata)
|
||||||
|
powerBar.energy:SetFrameLevel(Gladdy.db.powerFrameLevel - 1)
|
||||||
|
end
|
||||||
|
|
||||||
function Powerbar.OnEvent(powerBar, event, unit)
|
function Powerbar.OnEvent(powerBar, event, unit)
|
||||||
if event == "UNIT_POWER_UPDATE" then
|
if event == "UNIT_POWER_UPDATE" then
|
||||||
Powerbar:SetPower(powerBar, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
Powerbar:SetPower(powerBar, unit, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
||||||
elseif event == "UNIT_MAXPOWER" then
|
elseif event == "UNIT_MAXPOWER" then
|
||||||
Powerbar:SetPower(powerBar, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
Powerbar:SetPower(powerBar, unit, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
||||||
elseif event == "UNIT_DISPLAYPOWER" then
|
elseif event == "UNIT_DISPLAYPOWER" then
|
||||||
Powerbar:SetPower(powerBar, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
Powerbar:SetPower(powerBar, unit, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:SetPower(powerBar, power, powerMax, powerType)
|
function Powerbar:SetText(unit, power, powerMax, status)
|
||||||
local powerPercentage = floor(power * 100 / powerMax)
|
local button = Gladdy.buttons[unit]
|
||||||
local powerText
|
if not Gladdy.buttons[unit] then
|
||||||
|
return
|
||||||
if (Gladdy.db.powerActual) then
|
|
||||||
powerText = powerMax > 999 and ("%.1fk"):format(power / 1000) or power
|
|
||||||
end
|
end
|
||||||
|
local powerBar = button.powerBar
|
||||||
if (Gladdy.db.powerMax) then
|
if Gladdy.db.powerCustomTagsEnabled then
|
||||||
local text = powerMax > 999 and ("%.1fk"):format(powerMax / 1000) or powerMax
|
powerBar.powerText:SetText(Gladdy:SetTag(unit, Gladdy.db.powerTextRight, power, powerMax, status))
|
||||||
if (powerText) then
|
powerBar.raceText:SetText(Gladdy:SetTag(unit, Gladdy.db.powerTextLeft, power, powerMax, status))
|
||||||
powerText = ("%s/%s"):format(powerText, text)
|
else
|
||||||
else
|
if power then
|
||||||
powerText = text
|
local powerPercentage = floor(power * 100 / powerMax)
|
||||||
|
local powerText
|
||||||
|
if (Gladdy.db.powerActual) then
|
||||||
|
powerText = powerMax > 999 and ("%.1fk"):format(power / 1000) or power
|
||||||
|
end
|
||||||
|
if (Gladdy.db.powerMax) then
|
||||||
|
local text = powerMax > 999 and ("%.1fk"):format(powerMax / 1000) or powerMax
|
||||||
|
if (powerText) then
|
||||||
|
powerText = ("%s/%s"):format(powerText, text)
|
||||||
|
else
|
||||||
|
powerText = text
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if (Gladdy.db.powerPercentage) then
|
||||||
|
if (powerText) then
|
||||||
|
powerText = ("%s (%d%%)"):format(powerText, powerPercentage)
|
||||||
|
else
|
||||||
|
powerText = ("%d%%"):format(powerPercentage)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
powerBar.powerText:SetText(powerText)
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.powerPercentage) then
|
local raceText = Gladdy.db.powerShowRace and button.raceLoc or ""
|
||||||
if (powerText) then
|
if (button.spec and Gladdy.db.powerShowSpec) then
|
||||||
powerText = ("%s (%d%%)"):format(powerText, powerPercentage)
|
raceText = button.spec .. " " .. raceText
|
||||||
else
|
|
||||||
powerText = ("%d%%"):format(powerPercentage)
|
|
||||||
end
|
end
|
||||||
|
powerBar.raceText:SetText(raceText)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Powerbar:SetPower(powerBar, unit, power, powerMax, powerType, status)
|
||||||
|
Powerbar:SetText(unit, power, powerMax, status)
|
||||||
|
powerBar.energy.current = power
|
||||||
|
powerBar.energy.max = powerMax
|
||||||
|
powerBar.energy.powerType = powerType
|
||||||
|
|
||||||
if (powerType == 1 and powerBar.powerType ~= powerType) then
|
if (powerType == 1 and powerBar.powerType ~= powerType) then
|
||||||
powerBar.energy:SetStatusBarColor(1, 0, 0, 1)
|
powerBar.energy:SetStatusBarColor(1, 0, 0, 1)
|
||||||
@ -128,51 +232,11 @@ function Powerbar:SetPower(powerBar, power, powerMax, powerType)
|
|||||||
powerBar.powerType = powerType
|
powerBar.powerType = powerType
|
||||||
end
|
end
|
||||||
|
|
||||||
powerBar.powerText:SetText(powerText)
|
|
||||||
powerBar.energy:SetMinMaxValues(0, powerMax)
|
powerBar.energy:SetMinMaxValues(0, powerMax)
|
||||||
powerBar.energy:SetValue(power)
|
powerBar.energy:SetValue(power)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:UpdateFrame(unit)
|
|
||||||
local powerBar = self.frames[unit]
|
|
||||||
if (not powerBar) then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
local healthBar = Gladdy.modules["Health Bar"].frames[unit]
|
|
||||||
|
|
||||||
|
|
||||||
if not Gladdy.db.powerBarEnabled then
|
|
||||||
powerBar:Hide()
|
|
||||||
return
|
|
||||||
else
|
|
||||||
powerBar:Show()
|
|
||||||
end
|
|
||||||
powerBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.powerBarTexture))
|
|
||||||
powerBar.bg:SetVertexColor(Gladdy.db.powerBarBgColor.r, Gladdy.db.powerBarBgColor.g, Gladdy.db.powerBarBgColor.b, Gladdy.db.powerBarBgColor.a)
|
|
||||||
|
|
||||||
powerBar:SetWidth(healthBar:GetWidth())
|
|
||||||
powerBar:SetHeight(Gladdy.db.powerBarHeight)
|
|
||||||
|
|
||||||
powerBar:ClearAllPoints()
|
|
||||||
powerBar:SetPoint("TOPLEFT", healthBar, "BOTTOMLEFT", 0, -1)
|
|
||||||
|
|
||||||
powerBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.powerBarBorderStyle),
|
|
||||||
edgeSize = Gladdy.db.powerBarBorderSize })
|
|
||||||
powerBar:SetBackdropBorderColor(Gladdy.db.powerBarBorderColor.r, Gladdy.db.powerBarBorderColor.g, Gladdy.db.powerBarBorderColor.b, Gladdy.db.powerBarBorderColor.a)
|
|
||||||
|
|
||||||
powerBar.energy:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.powerBarTexture))
|
|
||||||
powerBar.energy:ClearAllPoints()
|
|
||||||
powerBar.energy:SetPoint("TOPLEFT", powerBar, "TOPLEFT", (Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset), -(Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
|
||||||
powerBar.energy:SetPoint("BOTTOMRIGHT", powerBar, "BOTTOMRIGHT", -(Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset), (Gladdy.db.powerBarBorderSize/Gladdy.db.statusbarBorderOffset))
|
|
||||||
|
|
||||||
powerBar.raceText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.powerBarFont), Gladdy.db.powerBarFontSize)
|
|
||||||
powerBar.raceText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
|
|
||||||
powerBar.powerText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.powerBarFont), Gladdy.db.powerBarFontSize)
|
|
||||||
powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
|
|
||||||
end
|
|
||||||
|
|
||||||
function Powerbar:ResetUnit(unit)
|
function Powerbar:ResetUnit(unit)
|
||||||
local powerBar = self.frames[unit]
|
local powerBar = self.frames[unit]
|
||||||
if (not powerBar) then
|
if (not powerBar) then
|
||||||
@ -194,8 +258,14 @@ function Powerbar:Test(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
powerBar.energy.current = button.power
|
||||||
|
powerBar.energy.max = button.powerMax
|
||||||
|
powerBar.energy.powerType = button.powerType
|
||||||
self:ENEMY_SPOTTED(unit)
|
self:ENEMY_SPOTTED(unit)
|
||||||
self:UNIT_POWER(unit, button.power, button.powerMax, button.powerType)
|
self:UNIT_POWER(unit, button.power, button.powerMax, button.powerType)
|
||||||
|
if unit == "arena1" then
|
||||||
|
self:UNIT_DEATH(unit)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:ENEMY_SPOTTED(unit)
|
function Powerbar:ENEMY_SPOTTED(unit)
|
||||||
@ -205,13 +275,6 @@ function Powerbar:ENEMY_SPOTTED(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local raceText = Gladdy.db.powerShowRace and button.raceLoc or ""
|
|
||||||
|
|
||||||
if (button.spec and Gladdy.db.powerShowSpec) then
|
|
||||||
raceText = button.spec .. " " .. raceText
|
|
||||||
end
|
|
||||||
|
|
||||||
powerBar.raceText:SetText(raceText)
|
|
||||||
if UnitExists(unit) then
|
if UnitExists(unit) then
|
||||||
Powerbar:SetPower(powerBar, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
Powerbar:SetPower(powerBar, UnitPower(unit, UnitPowerType(unit), true), UnitPowerMax(unit, UnitPowerType(unit), true), UnitPowerType(unit))
|
||||||
end
|
end
|
||||||
@ -223,13 +286,10 @@ 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 ""
|
|
||||||
|
|
||||||
if (button.spec and Gladdy.db.powerShowSpec) then
|
if UnitExists(unit) then
|
||||||
raceText = spec .. " " .. raceText
|
Powerbar:SetPower(powerBar, unit, powerBar.energy.current, powerBar.energy.max, powerBar.energy.powerType)
|
||||||
end
|
end
|
||||||
|
|
||||||
powerBar.raceText:SetText(raceText)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:UNIT_POWER(unit, power, powerMax, powerType)
|
function Powerbar:UNIT_POWER(unit, power, powerMax, powerType)
|
||||||
@ -241,44 +301,7 @@ function Powerbar:UNIT_POWER(unit, power, powerMax, powerType)
|
|||||||
if not Gladdy.buttons[unit].class then
|
if not Gladdy.buttons[unit].class then
|
||||||
Gladdy:SpotEnemy(unit, true)
|
Gladdy:SpotEnemy(unit, true)
|
||||||
end
|
end
|
||||||
|
Powerbar:SetPower(powerBar, unit, power, powerMax, powerType)
|
||||||
local powerPercentage = floor(power * 100 / powerMax)
|
|
||||||
local powerText
|
|
||||||
|
|
||||||
if (Gladdy.db.powerActual) then
|
|
||||||
powerText = powerMax > 999 and ("%.1fk"):format(power / 1000) or power
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.powerMax) then
|
|
||||||
local text = powerMax > 999 and ("%.1fk"):format(powerMax / 1000) or powerMax
|
|
||||||
if (powerText) then
|
|
||||||
powerText = ("%s/%s"):format(powerText, text)
|
|
||||||
else
|
|
||||||
powerText = text
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (Gladdy.db.powerPercentage) then
|
|
||||||
if (powerText) then
|
|
||||||
powerText = ("%s (%d%%)"):format(powerText, powerPercentage)
|
|
||||||
else
|
|
||||||
powerText = ("%d%%"):format(powerPercentage)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if (powerType == 1) then
|
|
||||||
powerBar.energy:SetStatusBarColor(1, 0, 0, 1)
|
|
||||||
powerBar.powerColor = {r = 1, g = 0, b = 0}
|
|
||||||
elseif (powerType == 3) then
|
|
||||||
powerBar.energy:SetStatusBarColor(1, 1, 0, 1)
|
|
||||||
powerBar.powerColor = {r = 1, g = 1, b = 0}
|
|
||||||
else
|
|
||||||
powerBar.energy:SetStatusBarColor(.18, .44, .75, 1)
|
|
||||||
powerBar.powerColor = {r = .18, g = .44, b = .75}
|
|
||||||
end
|
|
||||||
|
|
||||||
powerBar.powerText:SetText(powerText)
|
|
||||||
powerBar.energy:SetValue(powerPercentage)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:UNIT_DEATH(unit)
|
function Powerbar:UNIT_DEATH(unit)
|
||||||
@ -286,9 +309,7 @@ function Powerbar:UNIT_DEATH(unit)
|
|||||||
if (not powerBar) then
|
if (not powerBar) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Powerbar:SetPower(powerBar, unit, 0, powerBar.energy.max, powerBar.energy.powerType, L["DEAD"])
|
||||||
powerBar.energy:SetValue(0)
|
|
||||||
powerBar.powerText:SetText("0%")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Powerbar:UNIT_DESTROYED(unit)
|
function Powerbar:UNIT_DESTROYED(unit)
|
||||||
@ -296,8 +317,7 @@ function Powerbar:UNIT_DESTROYED(unit)
|
|||||||
if (not powerBar) then
|
if (not powerBar) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
powerBar.energy:SetValue(0)
|
Powerbar:SetPower(powerBar, unit, 0, powerBar.energy.max, powerBar.energy.powerType, L["LEAVE"])
|
||||||
powerBar.powerText:SetText("0%")
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function option(params)
|
local function option(params)
|
||||||
@ -313,8 +333,10 @@ local function option(params)
|
|||||||
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
|
if Gladdy.frame.testing then
|
||||||
Powerbar:Test("arena" .. i)
|
for i=1,Gladdy.curBracket do
|
||||||
|
Powerbar:Test("arena" .. i)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
@ -344,6 +366,7 @@ function Powerbar:GetOptions()
|
|||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.powerBarEnabled end,
|
||||||
args = {
|
args = {
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -407,16 +430,84 @@ function Powerbar:GetOptions()
|
|||||||
order = 12,
|
order = 12,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
}),
|
}),
|
||||||
powerBarFontSize = option({
|
powerTextLeftOutline = option({
|
||||||
type = "range",
|
type = "toggle",
|
||||||
name = L["Font size"],
|
name = L["Left Font Outline"],
|
||||||
desc = L["Size of the text"],
|
|
||||||
order = 13,
|
order = 13,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
powerTextRightOutline = option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Right Font Outline"],
|
||||||
|
order = 14,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
headerSize = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Size"],
|
||||||
|
order = 20,
|
||||||
|
},
|
||||||
|
powerBarRaceFontSize = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Race font size"],
|
||||||
|
desc = L["Size of the race text"],
|
||||||
|
order = 21,
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
min = 1,
|
min = 0,
|
||||||
max = 20,
|
max = 20,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
powerBarPowerFontSize = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Power font size"],
|
||||||
|
desc = L["Size of the power text"],
|
||||||
|
order = 22,
|
||||||
|
step = 0.1,
|
||||||
|
min = 0,
|
||||||
|
max = 20,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
headerOffsets = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Offsets"],
|
||||||
|
order = 30,
|
||||||
|
},
|
||||||
|
powerTextLeftVOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Left Text Vertical Offset"],
|
||||||
|
order = 31,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
powerTextLeftHOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Left Text Horizontal Offset"],
|
||||||
|
order = 32,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
powerTextRightVOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Right Text Vertical Offset"],
|
||||||
|
order = 33,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
powerTextRightHOffset = option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Right Text Horizontal Offset"],
|
||||||
|
order = 34,
|
||||||
|
step = 0.1,
|
||||||
|
min = -200,
|
||||||
|
max = 200,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
border = {
|
border = {
|
||||||
@ -455,10 +546,39 @@ function Powerbar:GetOptions()
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 4,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
powerFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
powerFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 1,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
powerValues = {
|
powerValues = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Power Bar Text"],
|
name = L["Power Bar Text"],
|
||||||
order = 4,
|
order = 5,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
@ -470,31 +590,44 @@ function Powerbar:GetOptions()
|
|||||||
name = L["Show race"],
|
name = L["Show race"],
|
||||||
desc = L["Show race"],
|
desc = L["Show race"],
|
||||||
order = 2,
|
order = 2,
|
||||||
|
disabled = function() return Gladdy.db.powerCustomTagsEnabled end,
|
||||||
}),
|
}),
|
||||||
powerShowSpec= option({
|
powerShowSpec= option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show spec"],
|
name = L["Show spec"],
|
||||||
desc = L["Show spec"],
|
desc = L["Show spec"],
|
||||||
order = 3,
|
order = 3,
|
||||||
|
disabled = function() return Gladdy.db.powerCustomTagsEnabled end,
|
||||||
}),
|
}),
|
||||||
powerActual = option({
|
powerActual = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show the actual power"],
|
name = L["Show the actual power"],
|
||||||
desc = L["Show the actual power on the power bar"],
|
desc = L["Show the actual power on the power bar"],
|
||||||
order = 31,
|
order = 4,
|
||||||
|
disabled = function() return Gladdy.db.powerCustomTagsEnabled end,
|
||||||
}),
|
}),
|
||||||
powerMax = option({
|
powerMax = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show max power"],
|
name = L["Show max power"],
|
||||||
desc = L["Show max power on the power bar"],
|
desc = L["Show max power on the power bar"],
|
||||||
order = 32,
|
order = 5,
|
||||||
|
disabled = function() return Gladdy.db.powerCustomTagsEnabled end,
|
||||||
}),
|
}),
|
||||||
powerPercentage = option({
|
powerPercentage = option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show power percentage"],
|
name = L["Show power percentage"],
|
||||||
desc = L["Show power percentage on the power bar"],
|
desc = L["Show power percentage on the power bar"],
|
||||||
order = 33,
|
order = 6,
|
||||||
|
disabled = function() return Gladdy.db.powerCustomTagsEnabled end,
|
||||||
}),
|
}),
|
||||||
|
header = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Custom Tags"],
|
||||||
|
order = 10,
|
||||||
|
},
|
||||||
|
powerCustomTagsEnabled = Gladdy:GetTagOption(L["Custom Tags Enabled"], 11, nil, option, true),
|
||||||
|
powerTextLeft = Gladdy:GetTagOption(L["Left Text"], 12, "powerCustomTagsEnabled", option),
|
||||||
|
powerTextRight = Gladdy:GetTagOption(L["Right Text"], 13, "powerCustomTagsEnabled", option),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -1,36 +1,48 @@
|
|||||||
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
|
local ceil, str_gsub = ceil, string.gsub
|
||||||
|
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
local GetTime = GetTime
|
local GetTime = GetTime
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local Racial = Gladdy:NewModule("Racial", nil, {
|
local Racial = Gladdy:NewModule("Racial", 79, {
|
||||||
racialFont = "DorisPP",
|
racialFont = "DorisPP",
|
||||||
racialFontScale = 1,
|
racialFontScale = 1,
|
||||||
racialEnabled = true,
|
racialEnabled = true,
|
||||||
racialSize = 60 + 20 + 1,
|
racialSize = 60 + 20 + 1,
|
||||||
racialWidthFactor = 0.9,
|
racialWidthFactor = 0.9,
|
||||||
racialAnchor = "trinket",
|
|
||||||
racialPos = "RIGHT",
|
|
||||||
racialXOffset = 0,
|
racialXOffset = 0,
|
||||||
racialYOffset = 0,
|
racialYOffset = 0,
|
||||||
racialBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
racialBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
||||||
racialBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
racialBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
racialDisableCircle = false,
|
racialDisableCircle = false,
|
||||||
racialCooldownAlpha = 1,
|
racialCooldownAlpha = 1,
|
||||||
|
racialCooldownNumberAlpha = 1,
|
||||||
|
racialFrameStrata = "MEDIUM",
|
||||||
|
racialFrameLevel = 5,
|
||||||
|
racialGroup = false,
|
||||||
|
racialGroupDirection = "DOWN",
|
||||||
})
|
})
|
||||||
|
|
||||||
local ANCHORS = { ["LEFT"] = "RIGHT", ["RIGHT"] = "LEFT", ["BOTTOM"] = "TOP", ["TOP"] = "BOTTOM"}
|
|
||||||
|
|
||||||
function Racial:Initialize()
|
function Racial:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
|
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
if Gladdy.db.racialEnabled then
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self:RegisterMessage("RACIAL_USED")
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("RACIAL_USED")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Racial:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.racialEnabled then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
self:RegisterMessage("RACIAL_USED")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function iconTimer(self,elapsed)
|
local function iconTimer(self,elapsed)
|
||||||
@ -45,39 +57,31 @@ local function iconTimer(self,elapsed)
|
|||||||
local timeLeft = ceil(self.timeLeft)
|
local timeLeft = ceil(self.timeLeft)
|
||||||
|
|
||||||
if timeLeft >= 60 then
|
if timeLeft >= 60 then
|
||||||
-- more than 1 minute
|
self.cooldownFont:SetTextColor(1, 1, 0, Gladdy.db.racialCooldownNumberAlpha)
|
||||||
self.cooldownFont:SetTextColor(1, 1, 0)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 0.15* self:GetWidth()) * Gladdy.db.racialFontScale, "OUTLINE")
|
||||||
self.cooldownFont:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
|
elseif timeLeft < 60 and timeLeft >= 30 then
|
||||||
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 0.15* self:GetWidth()) * Gladdy.db.racialFontScale, "OUTLINE")
|
self.cooldownFont:SetTextColor(1, 1, 0, Gladdy.db.racialCooldownNumberAlpha)
|
||||||
elseif timeLeft < 60 and timeLeft >= 21 then
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
|
||||||
-- between 60s and 21s (green)
|
elseif timeLeft < 30 and timeLeft >= 11 then
|
||||||
self.cooldownFont:SetTextColor(0.7, 1, 0)
|
self.cooldownFont:SetTextColor(1, 0.7, 0, Gladdy.db.racialCooldownNumberAlpha)
|
||||||
self.cooldownFont:SetText(timeLeft)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
|
||||||
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
|
||||||
elseif timeLeft < 20.9 and timeLeft >= 11 then
|
self.cooldownFont:SetTextColor(1, 0.7, 0, Gladdy.db.racialCooldownNumberAlpha)
|
||||||
-- between 20s and 11s (green)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
|
||||||
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", self.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
|
elseif timeLeft < 5 and timeLeft > 0 then
|
||||||
-- between 5s and 1s (red)
|
self.cooldownFont:SetTextColor(1, 0, 0, Gladdy.db.racialCooldownNumberAlpha)
|
||||||
self.cooldownFont:SetTextColor(1, 0, 0)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
|
||||||
self.cooldownFont:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.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
|
||||||
|
Gladdy:FormatTimer(self.cooldownFont, self.timeLeft, self.timeLeft < 10, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Racial:CreateFrame(unit)
|
function Racial:CreateFrame(unit)
|
||||||
local racial = CreateFrame("Button", "GladdyTrinketButton" .. unit, Gladdy.buttons[unit])
|
local racial = CreateFrame("Button", "GladdyTrinketButton" .. unit, Gladdy.buttons[unit])
|
||||||
racial:EnableMouse(false)
|
racial:EnableMouse(false)
|
||||||
|
racial:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial:SetFrameLevel(Gladdy.db.racialFrameLevel)
|
||||||
|
|
||||||
racial.texture = racial:CreateTexture(nil, "BACKGROUND")
|
racial.texture = racial:CreateTexture(nil, "BACKGROUND")
|
||||||
racial.texture:SetAllPoints(racial)
|
racial.texture:SetAllPoints(racial)
|
||||||
racial.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
|
racial.texture:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
|
||||||
@ -86,20 +90,27 @@ function Racial:CreateFrame(unit)
|
|||||||
racial.cooldown = CreateFrame("Cooldown", nil, racial, "CooldownFrameTemplate")
|
racial.cooldown = CreateFrame("Cooldown", nil, racial, "CooldownFrameTemplate")
|
||||||
racial.cooldown.noCooldownCount = true --Gladdy.db.racialDisableOmniCC
|
racial.cooldown.noCooldownCount = true --Gladdy.db.racialDisableOmniCC
|
||||||
racial.cooldown:SetHideCountdownNumbers(true)
|
racial.cooldown:SetHideCountdownNumbers(true)
|
||||||
|
racial.cooldown:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial.cooldown:SetFrameLevel(Gladdy.db.racialFrameLevel + 1)
|
||||||
|
|
||||||
racial.cooldownFrame = CreateFrame("Frame", nil, racial)
|
racial.cooldownFrame = CreateFrame("Frame", nil, racial)
|
||||||
racial.cooldownFrame:ClearAllPoints()
|
racial.cooldownFrame:ClearAllPoints()
|
||||||
racial.cooldownFrame:SetPoint("TOPLEFT", racial, "TOPLEFT")
|
racial.cooldownFrame:SetPoint("TOPLEFT", racial, "TOPLEFT")
|
||||||
racial.cooldownFrame:SetPoint("BOTTOMRIGHT", racial, "BOTTOMRIGHT")
|
racial.cooldownFrame:SetPoint("BOTTOMRIGHT", racial, "BOTTOMRIGHT")
|
||||||
|
racial.cooldownFrame:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial.cooldownFrame:SetFrameLevel(Gladdy.db.racialFrameLevel + 2)
|
||||||
|
|
||||||
racial.cooldownFont = racial.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
racial.cooldownFont = racial.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
||||||
racial.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), 20, "OUTLINE")
|
racial.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), 20, "OUTLINE")
|
||||||
--trinket.cooldownFont:SetAllPoints(trinket.cooldown)
|
--trinket.cooldownFont:SetAllPoints(trinket.cooldown)
|
||||||
racial.cooldownFont:SetJustifyH("CENTER")
|
racial.cooldownFont:SetJustifyH("CENTER")
|
||||||
racial.cooldownFont:SetPoint("CENTER")
|
racial.cooldownFont:SetPoint("CENTER")
|
||||||
|
|
||||||
racial.borderFrame = CreateFrame("Frame", nil, racial)
|
racial.borderFrame = CreateFrame("Frame", nil, racial)
|
||||||
racial.borderFrame:SetAllPoints(racial)
|
racial.borderFrame:SetAllPoints(racial)
|
||||||
|
racial.borderFrame:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial.borderFrame:SetFrameLevel(Gladdy.db.racialFrameLevel + 3)
|
||||||
|
|
||||||
racial.texture.overlay = racial.borderFrame:CreateTexture(nil, "OVERLAY")
|
racial.texture.overlay = racial.borderFrame:CreateTexture(nil, "OVERLAY")
|
||||||
racial.texture.overlay:SetAllPoints(racial)
|
racial.texture.overlay:SetAllPoints(racial)
|
||||||
racial.texture.overlay:SetTexture(Gladdy.db.racialBorderStyle)
|
racial.texture.overlay:SetTexture(Gladdy.db.racialBorderStyle)
|
||||||
@ -118,6 +129,15 @@ function Racial:UpdateFrame(unit)
|
|||||||
|
|
||||||
local width, height = Gladdy.db.racialSize * Gladdy.db.racialWidthFactor, Gladdy.db.racialSize
|
local width, height = Gladdy.db.racialSize * Gladdy.db.racialWidthFactor, Gladdy.db.racialSize
|
||||||
|
|
||||||
|
racial:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial:SetFrameLevel(Gladdy.db.racialFrameLevel)
|
||||||
|
racial.cooldown:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial.cooldown:SetFrameLevel(Gladdy.db.racialFrameLevel + 1)
|
||||||
|
racial.cooldownFrame:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial.cooldownFrame:SetFrameLevel(Gladdy.db.racialFrameLevel + 2)
|
||||||
|
racial.borderFrame:SetFrameStrata(Gladdy.db.racialFrameStrata)
|
||||||
|
racial.borderFrame:SetFrameLevel(Gladdy.db.racialFrameLevel + 3)
|
||||||
|
|
||||||
racial:SetWidth(width)
|
racial:SetWidth(width)
|
||||||
racial:SetHeight(height)
|
racial:SetHeight(height)
|
||||||
racial.cooldown:SetWidth(width - width/16)
|
racial.cooldown:SetWidth(width - width/16)
|
||||||
@ -131,19 +151,32 @@ function Racial:UpdateFrame(unit)
|
|||||||
racial.texture:SetAllPoints(racial)
|
racial.texture:SetAllPoints(racial)
|
||||||
|
|
||||||
racial.texture.overlay:SetTexture(Gladdy.db.racialBorderStyle)
|
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.texture.overlay:SetVertexColor(Gladdy:SetColor(Gladdy.db.racialBorderColor))
|
||||||
|
|
||||||
racial:ClearAllPoints()
|
Gladdy:SetPosition(racial, unit, "racialXOffset", "racialYOffset", Racial:LegacySetPosition(racial, unit), Racial)
|
||||||
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.racialGroup) then
|
||||||
if (Gladdy.db.racialPos == "RIGHT") then
|
if (unit ~= "arena1") then
|
||||||
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset)
|
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
|
||||||
elseif (Gladdy.db.racialPos == "LEFT") then
|
self.frames[unit]:ClearAllPoints()
|
||||||
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, -Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset)
|
if Gladdy.db.racialGroupDirection == "RIGHT" then
|
||||||
elseif (Gladdy.db.racialPos == "TOP") then
|
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
|
||||||
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.racialXOffset, Gladdy.db.padding + Gladdy.db.racialYOffset)
|
elseif Gladdy.db.racialGroupDirection == "LEFT" then
|
||||||
elseif (Gladdy.db.racialPos == "BOTTOM") then
|
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
|
||||||
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.racialXOffset, -Gladdy.db.padding + Gladdy.db.racialYOffset)
|
elseif Gladdy.db.racialGroupDirection == "UP" then
|
||||||
|
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
|
||||||
|
elseif Gladdy.db.racialGroupDirection == "DOWN" then
|
||||||
|
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
if (unit == "arena1") then
|
||||||
|
Gladdy:CreateMover(racial,"racialXOffset", "racialYOffset", L["Racial"],
|
||||||
|
{"TOPLEFT", "TOPLEFT"},
|
||||||
|
Gladdy.db.racialSize * Gladdy.db.racialWidthFactor,
|
||||||
|
Gladdy.db.racialSize,
|
||||||
|
0, 0, "racialEnabled")
|
||||||
end
|
end
|
||||||
|
|
||||||
if (Gladdy.db.racialEnabled == false) then
|
if (Gladdy.db.racialEnabled == false) then
|
||||||
@ -154,7 +187,6 @@ function Racial:UpdateFrame(unit)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Racial:JOINED_ARENA()
|
function Racial:JOINED_ARENA()
|
||||||
self:RegisterEvent("ARENA_COOLDOWNS_UPDATE")
|
|
||||||
self:SetScript("OnEvent", function(self, event, ...)
|
self:SetScript("OnEvent", function(self, event, ...)
|
||||||
if self[event] then
|
if self[event] then
|
||||||
self[event](self, ...)
|
self[event](self, ...)
|
||||||
@ -162,13 +194,17 @@ function Racial:JOINED_ARENA()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Racial:RACIAL_USED(unit)
|
function Racial:RACIAL_USED(unit, expirationTime, spellName)
|
||||||
local racial = self.frames[unit]
|
local racial = self.frames[unit]
|
||||||
local button = Gladdy.buttons[unit]
|
local button = Gladdy.buttons[unit]
|
||||||
if (not racial or not button or not button.race) then
|
if (not racial or not button or not button.race) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
Racial:Used(unit, GetTime(), Gladdy:Racials()[button.race].duration)
|
if expirationTime and Gladdy:Racials()[button.race].spellName ~= spellName then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local startTime = expirationTime or GetTime()
|
||||||
|
Racial:Used(unit, startTime, Gladdy:Racials()[button.race].duration)
|
||||||
end
|
end
|
||||||
|
|
||||||
function Racial:Used(unit, startTime, duration)
|
function Racial:Used(unit, startTime, duration)
|
||||||
@ -178,14 +214,14 @@ function Racial:Used(unit, startTime, duration)
|
|||||||
end
|
end
|
||||||
if not racial.active then
|
if not racial.active then
|
||||||
racial.timeLeft = duration
|
racial.timeLeft = duration
|
||||||
if not Gladdy.db.trinketDisableCircle then racial.cooldown:SetCooldown(startTime, duration) end
|
if not Gladdy.db.racialDisableCircle then racial.cooldown:SetCooldown(startTime, duration) end
|
||||||
racial.active = true
|
racial.active = true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Racial:ENEMY_SPOTTED(unit)
|
function Racial:ENEMY_SPOTTED(unit)
|
||||||
local racial = self.frames[unit]
|
local racial = self.frames[unit]
|
||||||
if (not racial) then
|
if (not racial or not Gladdy.buttons[unit].race) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
racial.texture:SetTexture(Gladdy:Racials()[Gladdy.buttons[unit].race].texture)
|
racial.texture:SetTexture(Gladdy:Racials()[Gladdy.buttons[unit].race].texture)
|
||||||
@ -223,11 +259,32 @@ function Racial:GetOptions()
|
|||||||
desc = L["Enable racial icon"],
|
desc = L["Enable racial icon"],
|
||||||
order = 3,
|
order = 3,
|
||||||
}),
|
}),
|
||||||
|
racialGroup = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Group"] .. " " .. L["Racial"],
|
||||||
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.racialEnabled end,
|
||||||
|
}),
|
||||||
|
racialGroupDirection = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Group direction"],
|
||||||
|
order = 5,
|
||||||
|
values = {
|
||||||
|
["RIGHT"] = L["Right"],
|
||||||
|
["LEFT"] = L["Left"],
|
||||||
|
["UP"] = L["Up"],
|
||||||
|
["DOWN"] = L["Down"],
|
||||||
|
},
|
||||||
|
disabled = function()
|
||||||
|
return not Gladdy.db.racialGroup or not Gladdy.db.racialEnabled
|
||||||
|
end,
|
||||||
|
}),
|
||||||
group = {
|
group = {
|
||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 6,
|
||||||
|
disabled = function() return not Gladdy.db.racialEnabled end,
|
||||||
args = {
|
args = {
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -284,6 +341,15 @@ function Racial:GetOptions()
|
|||||||
order = 8,
|
order = 8,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
racialCooldownNumberAlpha = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Cooldown number alpha"],
|
||||||
|
min = 0,
|
||||||
|
max = 1,
|
||||||
|
step = 0.1,
|
||||||
|
order = 9,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
font = {
|
font = {
|
||||||
@ -319,37 +385,13 @@ function Racial:GetOptions()
|
|||||||
position = {
|
position = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 4,
|
order = 5,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Icon position"],
|
name = L["Icon position"],
|
||||||
order = 4,
|
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["Icon 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({
|
racialXOffset = Gladdy:option({
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Horizontal offset"],
|
name = L["Horizontal offset"],
|
||||||
@ -395,7 +437,62 @@ function Racial:GetOptions()
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 6,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
racialFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
racialFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Racial:LegacySetPosition(racial, unit)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
|
||||||
|
local ANCHORS = { ["LEFT"] = "RIGHT", ["RIGHT"] = "LEFT", ["BOTTOM"] = "TOP", ["TOP"] = "BOTTOM"}
|
||||||
|
racial:ClearAllPoints()
|
||||||
|
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
|
||||||
|
return Gladdy.db.newLayout
|
||||||
end
|
end
|
@ -25,7 +25,7 @@ local classSpells = {
|
|||||||
["SHAMAN"] = 10414,
|
["SHAMAN"] = 10414,
|
||||||
["PALADIN"] = 10308,
|
["PALADIN"] = 10308,
|
||||||
["WARLOCK"] = 5782,
|
["WARLOCK"] = 5782,
|
||||||
["WARRIOR"] = 20252,
|
["WARRIOR"] = 25275,
|
||||||
["HUNTER"] = 27018,
|
["HUNTER"] = 27018,
|
||||||
["ROGUE"] = 36554,
|
["ROGUE"] = 36554,
|
||||||
}
|
}
|
||||||
@ -52,12 +52,24 @@ local RangeCheck = Gladdy:NewModule("Range Check", nil, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
function RangeCheck:Initialize()
|
function RangeCheck:Initialize()
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
if Gladdy.db.rangeCheckEnabled then
|
||||||
self:RegisterMessage("ENEMY_STEALTH")
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self:RegisterMessage("ENEMY_SPOTTED")
|
self:RegisterMessage("ENEMY_STEALTH")
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
end
|
||||||
self.playerClass = select(2, UnitClass("player"))
|
self.playerClass = select(2, UnitClass("player"))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function RangeCheck:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.rangeCheckEnabled then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
self:RegisterMessage("ENEMY_STEALTH")
|
||||||
|
self:RegisterMessage("ENEMY_SPOTTED")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function RangeCheck:Reset()
|
function RangeCheck:Reset()
|
||||||
self.test = nil
|
self.test = nil
|
||||||
end
|
end
|
||||||
@ -211,12 +223,12 @@ function RangeCheck.CheckRange(self)
|
|||||||
|
|
||||||
local spell = Gladdy.db.rangeCheckDefaultSpells[RangeCheck.playerClass].min
|
local spell = Gladdy.db.rangeCheckDefaultSpells[RangeCheck.playerClass].min
|
||||||
|
|
||||||
if( not UnitIsConnected(button.unit) or not UnitInPhase(button.unit) ) then
|
if (not UnitIsConnected(button.unit) or not UnitInPhase(button.unit)) then
|
||||||
RangeCheck:SetRangeAlpha(button, false)
|
RangeCheck:SetRangeAlpha(button, false)
|
||||||
elseif( spell ) then
|
elseif (spell) then
|
||||||
RangeCheck:SetRangeAlpha(button, LSR.IsSpellInRange(spell, button.unit) == 1)
|
RangeCheck:SetRangeAlpha(button, LSR.IsSpellInRange(spell, button.unit) == 1)
|
||||||
-- That didn't work, but they are grouped lets try the actual API for this, it's a bit flaky though and not that useful generally
|
-- That didn't work, but they are grouped lets try the actual API for this, it's a bit flaky though and not that useful generally
|
||||||
elseif( UnitInRaid(button.unit) or UnitInParty(button.unit) ) then
|
elseif (UnitInRaid(button.unit) or UnitInParty(button.unit)) then
|
||||||
RangeCheck:SetRangeAlpha(button, UnitInRange(button.unit, "player"))
|
RangeCheck:SetRangeAlpha(button, UnitInRange(button.unit, "player"))
|
||||||
-- Nope, fall back to interaction :(
|
-- Nope, fall back to interaction :(
|
||||||
else
|
else
|
||||||
@ -268,6 +280,7 @@ function RangeCheck:GetOptions()
|
|||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["General"],
|
name = L["General"],
|
||||||
order = 5,
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.db.rangeCheckEnabled end,
|
||||||
args = {
|
args = {
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -340,6 +353,7 @@ function RangeCheck:GetOptions()
|
|||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Spells"],
|
name = L["Spells"],
|
||||||
order = 5,
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.db.rangeCheckEnabled end,
|
||||||
args = RangeCheck:GetSpells(),
|
args = RangeCheck:GetSpells(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -349,7 +363,7 @@ function RangeCheck:GetSpells()
|
|||||||
local group = {
|
local group = {
|
||||||
description = {
|
description = {
|
||||||
type = "description",
|
type = "description",
|
||||||
name = "Changing the spellID only applies to your player class!\n\nExample: If you are a Paladin and wish to change your range check spell to Repentance, edit the Paladin spellID to 20066.",
|
name = L["Changing the spellID only applies to your player class!\n\nExample: If you are a Paladin and wish to change your range check spell to Repentance, edit the Paladin spellID to 20066."],
|
||||||
order = 1,
|
order = 1,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -363,7 +377,7 @@ function RangeCheck:GetSpells()
|
|||||||
args = {
|
args = {
|
||||||
headerMin = {
|
headerMin = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s - %dyds", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
|
name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s - %d" .. L["yds"], select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
|
||||||
or "nil",
|
or "nil",
|
||||||
order = 1,
|
order = 1,
|
||||||
},
|
},
|
||||||
@ -385,7 +399,7 @@ function RangeCheck:GetSpells()
|
|||||||
Gladdy.db.rangeCheckDefaultSpells[class].min = tonumber(value)
|
Gladdy.db.rangeCheckDefaultSpells[class].min = tonumber(value)
|
||||||
--Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.min.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
|
--Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.min.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
|
||||||
-- or "nil"
|
-- or "nil"
|
||||||
Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.headerMin.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s - %dyds", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
|
Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.headerMin.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min) and format("|T%s:20|t %s - %d" .. L["yds"], select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
|
||||||
or "nil"
|
or "nil"
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
@ -1,127 +1,229 @@
|
|||||||
local floor, str_len, tostring, str_sub, str_find, pairs = math.floor, string.len, tostring, string.sub, string.find, pairs
|
local floor, str_find, pairs = math.floor, string.find, pairs
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- CORE
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local ShadowsightTimer = Gladdy:NewModule("Shadowsight Timer", nil, {
|
local ShadowsightTimer = Gladdy:NewModule("Shadowsight Timer", nil, {
|
||||||
shadowsightTimerEnabled = true,
|
shadowsightTimerEnabled = true,
|
||||||
|
shadowsightTimerLocked = false,
|
||||||
shadowsightTimerScale = 1,
|
shadowsightTimerScale = 1,
|
||||||
shadowsightTimerRelPoint1 = "CENTER",
|
shadowsightTimerRelPoint1 = "CENTER",
|
||||||
shadowsightTimerRelPoint2 = "CENTER",
|
shadowsightTimerRelPoint2 = "CENTER",
|
||||||
shadowsightTimerX = 0,
|
shadowsightTimerX = 0,
|
||||||
shadowsightTimerY = 0,
|
shadowsightTimerY = 0,
|
||||||
shadowsightAnnounce = true,
|
shadowsightAnnounce = true,
|
||||||
|
shadowsightTimerStartTime = 91,
|
||||||
|
shadowsightTimerResetTime = 120,
|
||||||
|
shadowsightTimerShowTwoTimer = false,
|
||||||
|
shadowsightTimerFrameStrata = "HIGH",
|
||||||
|
shadowsightTimerFrameLevel = 20,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- /run LibStub("Gladdy").modules["Shadowsight Timer"]:AURA_GAIN(nil, nil, 34709)
|
||||||
|
-- /run LibStub("Gladdy").modules["Shadowsight Timer"].timerFrame1:SetAlpha(0)
|
||||||
|
|
||||||
function ShadowsightTimer:OnEvent(event, ...)
|
function ShadowsightTimer:OnEvent(event, ...)
|
||||||
self[event](self, ...)
|
self[event](self, ...)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShadowsightTimer:Initialize()
|
function ShadowsightTimer:Initialize()
|
||||||
self.locale = Gladdy:GetArenaTimer()
|
self.locale = Gladdy:GetArenaTimer()
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
self:CreateAnchor()
|
||||||
self:CreateTimerFrame()
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShadowsightTimer:JOINED_ARENA()
|
|
||||||
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
|
|
||||||
self:SetScript("OnEvent", ShadowsightTimer.OnEvent)
|
|
||||||
self.timerFrame.font:SetText("1:30")
|
|
||||||
self.timerFrame.font:SetTextColor(1, 0.8, 0)
|
|
||||||
self.timerFrame:Show()
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShadowsightTimer:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
|
|
||||||
for k,v in pairs(self.locale) do
|
|
||||||
if str_find(msg, v) then
|
|
||||||
if k == 0 then
|
|
||||||
self:Start()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
function ShadowsightTimer:Test()
|
|
||||||
if Gladdy.db.shadowsightTimerEnabled then
|
if Gladdy.db.shadowsightTimerEnabled then
|
||||||
self.timerFrame:Show()
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self:Start()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShadowsightTimer:Reset()
|
function ShadowsightTimer:Reset()
|
||||||
self.timerFrame:Hide()
|
self.anchor:Hide()
|
||||||
self.timerFrame:SetScript("OnUpdate", nil)
|
for i=1,2 do
|
||||||
self.timerFrame.font:SetTextColor(1, 0.8, 0)
|
self["timerFrame" .. i].active = false
|
||||||
|
self["timerFrame" .. i]:SetScript("OnUpdate", nil)
|
||||||
|
self["timerFrame" .. i].font:SetTextColor(1, 0.8, 0)
|
||||||
|
end
|
||||||
|
self:UnregisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
|
||||||
|
self:SetScript("OnEvent", nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShadowsightTimer:CreateTimerFrame()
|
---------------------------
|
||||||
self.timerFrame = CreateFrame("Frame", nil, UIParent, BackdropTemplateMixin and "BackdropTemplate")
|
|
||||||
self.timerFrame:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
|
|
||||||
|
|
||||||
|
-- FRAME SETUP
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function ShadowsightTimer:CreateTimerFrame(anchor, name, points)
|
||||||
local backdrop = {
|
local backdrop = {
|
||||||
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
|
||||||
edgeFile = "",
|
edgeFile = "",
|
||||||
tile = true, tileSize = 16, edgeSize = 10,
|
tile = true, tileSize = 16, edgeSize = 10,
|
||||||
insets = {left = 0, right = 0, top = 0, bottom = 0}
|
insets = {left = 0, right = 0, top = 0, bottom = 0}
|
||||||
}
|
}
|
||||||
|
self[name] = CreateFrame("Frame", nil, anchor, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
|
self[name]:SetPoint(points[1], anchor, points[2])
|
||||||
|
self[name]:SetBackdrop(backdrop)
|
||||||
|
self[name]:SetBackdropColor(0,0,0,0.8)
|
||||||
|
self[name]:SetHeight(17)
|
||||||
|
self[name]:SetWidth(35)
|
||||||
|
|
||||||
self.timerFrame:SetBackdrop(backdrop)
|
self[name].texture = self[name]:CreateTexture(nil,"OVERLAY")
|
||||||
self.timerFrame:SetBackdropColor(0,0,0,0.8)
|
self[name].texture:SetWidth(16)
|
||||||
self.timerFrame:SetHeight(17)
|
self[name].texture:SetHeight(16)
|
||||||
self.timerFrame:SetWidth(35)
|
self[name].texture:SetTexture("Interface\\Icons\\Spell_Shadow_EvilEye")
|
||||||
|
self[name].texture:SetTexCoord(0.125,0.875,0.125,0.875)
|
||||||
|
self[name].texture:SetPoint("RIGHT", self[name], "LEFT")
|
||||||
|
|
||||||
self.timerFrame:SetMovable(true)
|
self[name].font = self[name]:CreateFontString(nil,"OVERLAY","GameFontNormal")
|
||||||
self.timerFrame:EnableMouse(true)
|
self[name].font:SetPoint("LEFT", 5, 0)
|
||||||
|
self[name].font:SetJustifyH("LEFT")
|
||||||
|
self[name].font:SetTextColor(1, 0.8, 0)
|
||||||
|
|
||||||
self.timerFrame.texture = self.timerFrame:CreateTexture(nil,"OVERLAY")
|
self[name]:SetFrameStrata(Gladdy.db.shadowsightTimerFrameStrata)
|
||||||
self.timerFrame.texture:SetWidth(16)
|
self[name]:SetFrameLevel(Gladdy.db.shadowsightTimerFrameLevel)
|
||||||
self.timerFrame.texture:SetHeight(16)
|
end
|
||||||
self.timerFrame.texture:SetTexture("Interface\\Icons\\Spell_Shadow_EvilEye")
|
|
||||||
self.timerFrame.texture:SetTexCoord(0.125,0.875,0.125,0.875)
|
|
||||||
self.timerFrame.texture:SetPoint("RIGHT", self.timerFrame, "LEFT")
|
|
||||||
|
|
||||||
self.timerFrame.font = self.timerFrame:CreateFontString(nil,"OVERLAY","GameFontNormal")
|
function ShadowsightTimer:CreateAnchor()
|
||||||
self.timerFrame.font:SetPoint("LEFT", 5, 0)
|
self.anchor = CreateFrame("Frame")
|
||||||
self.timerFrame.font:SetJustifyH("LEFT")
|
self.anchor:SetMovable(true)
|
||||||
self.timerFrame.font:SetTextColor(1, 0.8, 0)
|
self.anchor:EnableMouse(true)
|
||||||
|
self.anchor:SetWidth(35)
|
||||||
self.timerFrame:SetScript("OnMouseDown",function(self) self:StartMoving() end)
|
self.anchor:SetHeight(17)
|
||||||
self.timerFrame:SetScript("OnMouseUp",function(self)
|
self.anchor:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
|
||||||
|
self.anchor:SetScript("OnMouseDown",function(self) self:StartMoving() end)
|
||||||
|
self.anchor:SetScript("OnMouseUp",function(self)
|
||||||
self:StopMovingOrSizing()
|
self:StopMovingOrSizing()
|
||||||
Gladdy.db.shadowsightTimerRelPoint1,_,Gladdy.db.shadowsightTimerRelPoint2,Gladdy.db.shadowsightTimerX,Gladdy.db.shadowsightTimerY = self:GetPoint()
|
Gladdy.db.shadowsightTimerRelPoint1,_,Gladdy.db.shadowsightTimerRelPoint2,Gladdy.db.shadowsightTimerX,Gladdy.db.shadowsightTimerY = self:GetPoint()
|
||||||
end)
|
end)
|
||||||
self.timerFrame:SetScale(Gladdy.db.shadowsightTimerScale)
|
self.anchor:SetScale(Gladdy.db.shadowsightTimerScale)
|
||||||
self.timerFrame:Hide()
|
self.anchor:Hide()
|
||||||
|
|
||||||
|
self:CreateTimerFrame(self.anchor, "timerFrame1", {"TOP", "TOP"})
|
||||||
|
local show = Gladdy.db.shadowsightTimerShowTwoTimer
|
||||||
|
self:CreateTimerFrame(show and self.timerFrame1 or self.anchor, "timerFrame2", show and {"TOP", "BOTTOM"} or {"TOP", "TOP"})
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShadowsightTimer:UpdateFrame()
|
function ShadowsightTimer:UpdateFrameOnce()
|
||||||
if Gladdy.db.shadowsightTimerEnabled then
|
if Gladdy.db.shadowsightTimerEnabled then
|
||||||
self.timerFrame:SetScale(Gladdy.db.shadowsightTimerScale)
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
self.timerFrame:ClearAllPoints()
|
|
||||||
self.timerFrame:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint2, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
|
|
||||||
self.timerFrame:Show()
|
|
||||||
else
|
else
|
||||||
self.timerFrame:SetScale(Gladdy.db.shadowsightTimerScale)
|
self:UnregisterAllMessages()
|
||||||
self.timerFrame:ClearAllPoints()
|
end
|
||||||
self.timerFrame:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint2, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
|
|
||||||
self.timerFrame:Hide()
|
self.anchor:EnableMouse(not Gladdy.db.shadowsightTimerLocked)
|
||||||
|
|
||||||
|
self.anchor:SetFrameStrata(Gladdy.db.shadowsightTimerFrameStrata)
|
||||||
|
self.anchor:SetFrameLevel(Gladdy.db.shadowsightTimerFrameLevel)
|
||||||
|
self.timerFrame1:SetFrameStrata(Gladdy.db.shadowsightTimerFrameStrata)
|
||||||
|
self.timerFrame1:SetFrameLevel(Gladdy.db.shadowsightTimerFrameLevel)
|
||||||
|
self.timerFrame2:SetFrameStrata(Gladdy.db.shadowsightTimerFrameStrata)
|
||||||
|
self.timerFrame2:SetFrameLevel(Gladdy.db.shadowsightTimerFrameLevel)
|
||||||
|
|
||||||
|
if Gladdy.db.shadowsightTimerEnabled then
|
||||||
|
self.anchor:SetScale(Gladdy.db.shadowsightTimerScale)
|
||||||
|
self.anchor:ClearAllPoints()
|
||||||
|
self.anchor:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint2, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
|
||||||
|
if Gladdy.frame.testing or Gladdy.curBracket then
|
||||||
|
self.anchor:Show()
|
||||||
|
end
|
||||||
|
if Gladdy.db.shadowsightTimerShowTwoTimer then
|
||||||
|
self.anchor:SetHeight(34)
|
||||||
|
self.timerFrame2:ClearAllPoints()
|
||||||
|
self.timerFrame2:SetPoint("TOP", self.timerFrame1, "BOTTOM")
|
||||||
|
ShadowsightTimer:NotifyStart()
|
||||||
|
else
|
||||||
|
self.anchor:SetHeight(17)
|
||||||
|
self.timerFrame2:ClearAllPoints()
|
||||||
|
self.timerFrame2:SetPoint("TOP", self.anchor, "TOP")
|
||||||
|
ShadowsightTimer:NotifyStart()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
self.anchor:SetScale(Gladdy.db.shadowsightTimerScale)
|
||||||
|
self.anchor:ClearAllPoints()
|
||||||
|
self.anchor:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint2, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
|
||||||
|
self.anchor:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShadowsightTimer:Start()
|
---------------------------
|
||||||
self.timerFrame.endTime = 92
|
|
||||||
self.timerFrame.timeSinceLastUpdate = 0
|
-- EVENT HANDLING
|
||||||
self.timerFrame:SetScript("OnUpdate", ShadowsightTimer.OnUpdate)
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function ShadowsightTimer:JOINED_ARENA()
|
||||||
|
if Gladdy.db.shadowsightTimerEnabled then
|
||||||
|
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
|
||||||
|
self:SetScript("OnEvent", ShadowsightTimer.OnEvent)
|
||||||
|
for i=1,2 do
|
||||||
|
self["timerFrame" .. i].font:SetText("1:30")
|
||||||
|
self["timerFrame" .. i].font:SetTextColor(1, 0.8, 0)
|
||||||
|
end
|
||||||
|
self.anchor:Show()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShadowsightTimer:AURA_GAIN(unit, auraType, spellID)
|
||||||
|
if (spellID == 34709 and Gladdy.db.shadowsightTimerEnabled) then
|
||||||
|
self:Start(Gladdy.db.shadowsightTimerResetTime, self:GetHiddenTimer())
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function ShadowsightTimer:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
|
||||||
|
for k,v in pairs(self.locale) do
|
||||||
|
if str_find(msg, v) then
|
||||||
|
if k == 0 then
|
||||||
|
self:Start(nil, self.timerFrame1)
|
||||||
|
self:Start(nil, self.timerFrame2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- TEST
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function ShadowsightTimer:Test()
|
||||||
|
if Gladdy.db.shadowsightTimerEnabled then
|
||||||
|
self.anchor:Show()
|
||||||
|
ShadowsightTimer:JOINED_ARENA()
|
||||||
|
self:Start(20, self.timerFrame1)
|
||||||
|
self:Start(25, self.timerFrame2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- TIMER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function ShadowsightTimer:Start(time, frame)
|
||||||
|
frame.endTime = time or Gladdy.db.shadowsightTimerStartTime
|
||||||
|
frame.active = true
|
||||||
|
ShadowsightTimer:NotifyStart()
|
||||||
|
frame.announced = nil
|
||||||
|
frame.timeSinceLastUpdate = 0
|
||||||
|
frame.font:SetTextColor(1, 0.8, 0)
|
||||||
|
frame:SetScript("OnUpdate", ShadowsightTimer.OnUpdate)
|
||||||
end
|
end
|
||||||
|
|
||||||
function ShadowsightTimer.OnUpdate(self, elapsed)
|
function ShadowsightTimer.OnUpdate(self, elapsed)
|
||||||
self.timeSinceLastUpdate = self.timeSinceLastUpdate + elapsed;
|
self.timeSinceLastUpdate = self.timeSinceLastUpdate + elapsed;
|
||||||
self.endTime = self.endTime - elapsed
|
self.endTime = self.endTime - elapsed
|
||||||
|
|
||||||
if (self.timeSinceLastUpdate > 0.1) then
|
if (self.timeSinceLastUpdate > 0.01) then
|
||||||
self.font:SetFormattedText(floor(self.endTime / 60) .. ":" .. "%02d", self.endTime - floor(self.endTime / 60) * 60)
|
self.font:SetFormattedText(floor(self.endTime / 60) .. ":" .. "%02d", self.endTime - floor(self.endTime / 60) * 60)
|
||||||
self.timeSinceLastUpdate = 0;
|
self.timeSinceLastUpdate = 0;
|
||||||
if floor(self.endTime) == 15 and Gladdy.db.shadowsightAnnounce then
|
if floor(self.endTime) == 15 and Gladdy.db.shadowsightAnnounce and not self.announced then
|
||||||
|
self.announced = true
|
||||||
Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up in %ds"]:format(15))
|
Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up in %ds"]:format(15))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -132,12 +234,64 @@ function ShadowsightTimer.OnUpdate(self, elapsed)
|
|||||||
self:SetScript("OnUpdate", nil)
|
self:SetScript("OnUpdate", nil)
|
||||||
self.font:SetText("0:00")
|
self.font:SetText("0:00")
|
||||||
self.font:SetTextColor(0, 1, 0)
|
self.font:SetTextColor(0, 1, 0)
|
||||||
|
self.active = false
|
||||||
|
ShadowsightTimer:NotifyEnd()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function ShadowsightTimer:NotifyStart()
|
||||||
|
local show = Gladdy.db.shadowsightTimerShowTwoTimer
|
||||||
|
if self.timerFrame1.active and self.timerFrame2.active then
|
||||||
|
if self.timerFrame1.endTime < self.timerFrame2.endTime then
|
||||||
|
self.timerFrame1:SetAlpha(1)
|
||||||
|
self.timerFrame2:SetAlpha(show and 1 or 0)
|
||||||
|
else
|
||||||
|
self.timerFrame1:SetAlpha(show and 1 or 0)
|
||||||
|
self.timerFrame2:SetAlpha(1)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if self.timerFrame1.active then
|
||||||
|
self.timerFrame1:SetAlpha(1)
|
||||||
|
self.timerFrame2:SetAlpha(show and 1 or 0)
|
||||||
|
elseif self.timerFrame2.active then
|
||||||
|
self.timerFrame1:SetAlpha(show and 1 or 0)
|
||||||
|
self.timerFrame2:SetAlpha(1)
|
||||||
|
else
|
||||||
|
self.timerFrame1:SetAlpha(1)
|
||||||
|
self.timerFrame2:SetAlpha(show and 1 or 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function ShadowsightTimer:NotifyEnd()
|
||||||
|
local show = Gladdy.db.shadowsightTimerShowTwoTimer
|
||||||
|
if self.timerFrame1.active then
|
||||||
|
self.timerFrame1:SetAlpha(1)
|
||||||
|
self.timerFrame2:SetAlpha(show and 1 or 0)
|
||||||
|
elseif self.timerFrame2.active then
|
||||||
|
self.timerFrame1:SetAlpha(show and 1 or 0)
|
||||||
|
self.timerFrame2:SetAlpha(1)
|
||||||
|
else
|
||||||
|
self.timerFrame1:SetAlpha(1)
|
||||||
|
self.timerFrame2:SetAlpha(show and 1 or 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
function ShadowsightTimer:GetHiddenTimer()
|
||||||
|
if self.timerFrame1.active and self.timerFrame2.active then
|
||||||
|
return self.timerFrame1.endTime < self.timerFrame2.endTime and self.timerFrame1 or self.timerFrame2
|
||||||
|
else
|
||||||
|
return self.timerFrame1.active and self.timerFrame2 or self.timerFrame1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- OPTIONS
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
function ShadowsightTimer:GetOptions()
|
function ShadowsightTimer:GetOptions()
|
||||||
return {
|
return {
|
||||||
headerArenaCountdown = {
|
headerShadowsight = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Shadowsight Timer"],
|
name = L["Shadowsight Timer"],
|
||||||
order = 2,
|
order = 2,
|
||||||
@ -147,23 +301,147 @@ function ShadowsightTimer:GetOptions()
|
|||||||
name = L["Enabled"],
|
name = L["Enabled"],
|
||||||
--desc = L["Turns countdown before the start of an arena match on/off."],
|
--desc = L["Turns countdown before the start of an arena match on/off."],
|
||||||
order = 3,
|
order = 3,
|
||||||
width = "full",
|
}),
|
||||||
|
shadowsightTimerLocked = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Locked"],
|
||||||
|
--desc = L["Turns countdown before the start of an arena match on/off."],
|
||||||
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.shadowsightTimerEnabled end,
|
||||||
|
}),
|
||||||
|
shadowsightTimerShowTwoTimer = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Show two timers"],
|
||||||
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.db.shadowsightTimerEnabled end,
|
||||||
}),
|
}),
|
||||||
shadowsightAnnounce = Gladdy:option({
|
shadowsightAnnounce = Gladdy:option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Announce"],
|
name = L["Announce"],
|
||||||
--desc = L["Turns countdown before the start of an arena match on/off."],
|
--desc = L["Turns countdown before the start of an arena match on/off."],
|
||||||
order = 4,
|
order = 6,
|
||||||
width = "full",
|
disabled = function() return not Gladdy.db.shadowsightTimerEnabled end,
|
||||||
}),
|
|
||||||
shadowsightTimerScale = Gladdy:option({
|
|
||||||
type = "range",
|
|
||||||
name = L["Scale"],
|
|
||||||
order = 5,
|
|
||||||
min = 0.1,
|
|
||||||
max = 5,
|
|
||||||
step = 0.1,
|
|
||||||
width = "full",
|
|
||||||
}),
|
}),
|
||||||
|
group = {
|
||||||
|
type = "group",
|
||||||
|
childGroups = "tree",
|
||||||
|
name = L["Frame"],
|
||||||
|
order = 7,
|
||||||
|
disabled = function() return not Gladdy.db.shadowsightTimerEnabled end,
|
||||||
|
args = {
|
||||||
|
general = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Scale"],
|
||||||
|
order = 1,
|
||||||
|
args = {
|
||||||
|
header = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Scale"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
shadowsightTimerScale = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Scale"],
|
||||||
|
order = 2,
|
||||||
|
min = 0.1,
|
||||||
|
max = 5,
|
||||||
|
step = 0.1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cooldown = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Cooldown"],
|
||||||
|
order = 2,
|
||||||
|
args = {
|
||||||
|
header = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Shadowsight CDs"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
shadowsightTimerStartTime = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Start Time"],
|
||||||
|
desc = L["Start time in seconds"],
|
||||||
|
min = 80,
|
||||||
|
max = 100,
|
||||||
|
order = 2,
|
||||||
|
step = 0.1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
shadowsightTimerResetTime = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Reset Time"],
|
||||||
|
desc = L["Reset time in seconds"],
|
||||||
|
min = 110,
|
||||||
|
max = 130,
|
||||||
|
order = 3,
|
||||||
|
step = 0.1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
--[[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,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},--]]
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 6,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
shadowsightTimerFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
shadowsightTimerFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
@ -1,103 +1,41 @@
|
|||||||
local select, pairs, string_lower, tremove, tinsert, format, string_gsub, ipairs = select, pairs, string.lower, tremove, tinsert, format, string.gsub, ipairs
|
local select, pairs, tremove, tinsert, format, strsplit, tonumber, ipairs = select, pairs, tremove, tinsert, format, strsplit, tonumber, ipairs
|
||||||
local UnitExists, UnitIsUnit, UnitName, UnitIsEnemy = UnitExists, UnitIsUnit, UnitName, UnitIsEnemy
|
local UnitExists, UnitIsUnit, UnitIsEnemy, UnitGUID = UnitExists, UnitIsUnit, UnitIsEnemy, UnitGUID
|
||||||
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
|
||||||
local GetSpellInfo, CreateFrame, GetCVar = GetSpellInfo, CreateFrame, GetCVar
|
local GetSpellInfo, CreateFrame = GetSpellInfo, CreateFrame
|
||||||
|
local totemData, npcIdToTotemData = Gladdy:GetTotemData()
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
-- Constants
|
-- Option Helpers
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
local totemData = {
|
|
||||||
-- Fire
|
|
||||||
[string_lower("Searing Totem")] = {id = 3599,texture = select(3, GetSpellInfo(3599)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Searing Totem
|
|
||||||
[string_lower("Flametongue Totem")] = {id = 8227,texture = select(3, GetSpellInfo(8227)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Flametongue Totem
|
|
||||||
[string_lower("Magma Totem")] = {id = 8190,texture = select(3, GetSpellInfo(8190)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Magma Totem
|
|
||||||
[string_lower("Fire Nova Totem")] = {id = 1535,texture = select(3, GetSpellInfo(1535)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Fire Nova Totem
|
|
||||||
[string_lower("Totem of Wrath")] = {id = 30706,texture = select(3, GetSpellInfo(30706)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 1}, -- Totem of Wrath
|
|
||||||
[string_lower("Fire Elemental Totem")] = {id = 32982,texture = select(3, GetSpellInfo(32982)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Fire Elemental Totem
|
|
||||||
[string_lower("Frost Resistance Totem")] = {id = 8181,texture = select(3, GetSpellInfo(8181)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Frost Resistance Totem
|
|
||||||
-- Water
|
|
||||||
[string_lower("Fire Resistance Totem")] = {id = 8184,texture = select(3, GetSpellInfo(8184)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Fire Resistance Totem
|
|
||||||
[string_lower("Poison Cleansing Totem")] = {id = 8166,texture = select(3, GetSpellInfo(8166)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Poison 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("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 = select(3, GetSpellInfo(5675)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 1}, -- Mana Spring Totem
|
|
||||||
-- 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("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("Stoneskin Totem")] = {id = 8071,texture = select(3, GetSpellInfo(8071)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Stoneskin Totem
|
|
||||||
[string_lower("Strength of Earth Totem")] = {id = 8075,texture = select(3, GetSpellInfo(8075)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Strength of Earth Totem
|
|
||||||
[string_lower("Earth Elemental Totem")] = {id = 33663,texture = select(3, GetSpellInfo(33663)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Earth Elemental 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
|
|
||||||
[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 = 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("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 = 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("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 = select(3, GetSpellInfo(25908)), color = {r = 0, g = 0, b = 0, a = 1}, enabled = true, priority = 0}, -- Tranquil Air Totem
|
|
||||||
}
|
|
||||||
local localizedTotemData = {
|
|
||||||
["default"] = {
|
|
||||||
[string_lower(select(1, GetSpellInfo(3599)))] = totemData[string_lower("Searing Totem")], -- Searing Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8227)))] = totemData[string_lower("Flametongue Totem")], -- Flametongue Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8190)))] = totemData[string_lower("Magma Totem")], -- Magma Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(1535)))] = totemData[string_lower("Fire Nova Totem")], -- Fire Nova Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(30706)))] = totemData[string_lower("Totem of Wrath")], -- Totem of Wrath
|
|
||||||
[string_lower(select(1, GetSpellInfo(32982)))] = totemData[string_lower("Fire Elemental Totem")], -- Fire Elemental Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8181)))] = totemData[string_lower("Frost Resistance Totem")], -- Frost Resistance Totem
|
|
||||||
-- Water
|
|
||||||
[string_lower(select(1, GetSpellInfo(8184)))] = totemData[string_lower("Fire Resistance Totem")], -- Fire Resistance Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8166)))] = totemData[string_lower("Poison Cleansing Totem")], -- Poison Cleansing Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8170)))] = totemData[string_lower("Disease Cleansing Totem")], -- Disease Cleansing Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(5394)))] = totemData[string_lower("Healing Stream Totem")], -- Healing Stream Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(16190)))] = totemData[string_lower("Mana Tide Totem")], -- Mana Tide Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(5675)))] = totemData[string_lower("Mana Spring Totem")], -- Mana Spring Totem
|
|
||||||
-- Earth
|
|
||||||
[string_lower(select(1, GetSpellInfo(2484)))] = totemData[string_lower("Earthbind Totem")], -- Earthbind Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(5730)))] = totemData[string_lower("Stoneclaw Totem")], -- Stoneclaw Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8071)))] = totemData[string_lower("Stoneskin Totem")], -- Stoneskin Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8075)))] = totemData[string_lower("Strength of Earth Totem")], -- Strength of Earth Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(33663)))] = totemData[string_lower("Earth Elemental Totem")], -- Earth Elemental Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8143)))] = totemData[string_lower("Tremor Totem")], -- Tremor Totem
|
|
||||||
-- Air
|
|
||||||
[string_lower(select(1, GetSpellInfo(8177)))] = totemData[string_lower("Grounding Totem")], -- Grounding Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8835)))] = totemData[string_lower("Grace of Air Totem")], -- Grace of Air Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(10595)))] = totemData[string_lower("Nature Resistance Totem")], -- Nature Resistance Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(8512)))] = totemData[string_lower("Windfury Totem")], -- Windfury Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(6495)))] = totemData[string_lower("Sentry Totem")], -- Sentry Totem
|
|
||||||
[string_lower(select(1, GetSpellInfo(15107)))] = totemData[string_lower("Windwall Totem")], -- Windwall 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
|
|
||||||
},
|
|
||||||
["frFR"] = {
|
|
||||||
[string_lower("Totem d'\195\169lementaire de terre")] = totemData[string_lower("Earth Elemental Totem")], -- Earth Elemental Totem
|
|
||||||
[string_lower("Totem d'\195\169lementaire de feu")] = totemData[string_lower("Fire Elemental Totem")], -- Fire Elemental Totem
|
|
||||||
},
|
|
||||||
["ruRU"] = {
|
|
||||||
[string_lower("")] = totemData[string_lower("Sentry Totem")], -- Sentry Totem
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
local function GetTotemColorDefaultOptions()
|
local function GetTotemColorDefaultOptions()
|
||||||
local defaultDB = {}
|
local defaultDB = {}
|
||||||
local options = {}
|
local options = {}
|
||||||
local indexedList = {}
|
local indexedList = {}
|
||||||
for k,v in pairs(totemData) do
|
for k,v in pairs(totemData) do
|
||||||
tinsert(indexedList, {name = k, id = v.id, color = v.color, texture = v.texture, enabled = v.enabled})
|
tinsert(indexedList, {name = k, id = v.id, color = v.color, texture = v.texture})
|
||||||
end
|
end
|
||||||
table.sort(indexedList, function (a, b)
|
table.sort(indexedList, function (a, b)
|
||||||
return a.name < b.name
|
return a.name < b.name
|
||||||
end)
|
end)
|
||||||
for i=1,#indexedList do
|
for i=1,#indexedList do
|
||||||
defaultDB["totem" .. indexedList[i].id] = {color = indexedList[i].color, enabled = indexedList[i].enabled, alpha = 0.6, customText = ""}
|
defaultDB["totem" .. indexedList[i].id] = {color = indexedList[i].color, enabled = true, alpha = 0.6, customText = ""}
|
||||||
|
options["npTotemsHideDisabledTotems"] = {
|
||||||
|
order = 1,
|
||||||
|
name = L["Hide Disabled Totem Plates"],
|
||||||
|
desc = L["Hide Disabled Totem Plates"],
|
||||||
|
type = "toggle",
|
||||||
|
width = "full",
|
||||||
|
get = function() return Gladdy.dbi.profile.npTotemsHideDisabledTotems end,
|
||||||
|
set = function(_, value)
|
||||||
|
Gladdy.dbi.profile.npTotemsHideDisabledTotems = value
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end
|
||||||
|
}
|
||||||
options["totem" .. indexedList[i].id] = {
|
options["totem" .. indexedList[i].id] = {
|
||||||
order = i+1,
|
order = i+1,
|
||||||
name = select(1, GetSpellInfo(indexedList[i].id)),
|
name = select(1, GetSpellInfo(indexedList[i].id)),
|
||||||
@ -117,8 +55,8 @@ local function GetTotemColorDefaultOptions()
|
|||||||
desc = "Enable " .. format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))),
|
desc = "Enable " .. format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))),
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info) return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled end,
|
get = function() return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled = value
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled = value
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end
|
end
|
||||||
@ -130,15 +68,13 @@ local function GetTotemColorDefaultOptions()
|
|||||||
order = 3,
|
order = 3,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info)
|
get = function()
|
||||||
local key = info.arg or info[#info]
|
|
||||||
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.a
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.a
|
||||||
end,
|
end,
|
||||||
set = function(info, r, g, b, a)
|
set = function(_, r, g, b, a)
|
||||||
local key = info.arg or info[#info]
|
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.r,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.g,
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.b,
|
||||||
@ -154,10 +90,10 @@ local function GetTotemColorDefaultOptions()
|
|||||||
max = 1,
|
max = 1,
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info)
|
get = function()
|
||||||
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha
|
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha
|
||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha = value
|
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha = value
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end
|
end
|
||||||
@ -167,8 +103,8 @@ local function GetTotemColorDefaultOptions()
|
|||||||
name = L["Custom totem name"],
|
name = L["Custom totem name"],
|
||||||
order = 5,
|
order = 5,
|
||||||
width = "full",
|
width = "full",
|
||||||
get = function(info) return Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText end,
|
get = function() return Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText end,
|
||||||
set = function(info, value) Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText = value Gladdy:UpdateFrame() end
|
set = function(_, value) Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText = value Gladdy:UpdateFrame() end
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -176,26 +112,13 @@ local function GetTotemColorDefaultOptions()
|
|||||||
return defaultDB, options, indexedList
|
return defaultDB, options, indexedList
|
||||||
end
|
end
|
||||||
|
|
||||||
local function GetTotemOptions()
|
|
||||||
local indexedList = select(3, GetTotemColorDefaultOptions())
|
|
||||||
local colorList = {}
|
|
||||||
for i=1, #indexedList do
|
|
||||||
tinsert(colorList, Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id])
|
|
||||||
end
|
|
||||||
return colorList
|
|
||||||
end
|
|
||||||
|
|
||||||
function Gladdy:GetTotemColors()
|
|
||||||
return GetTotemColorDefaultOptions()
|
|
||||||
end
|
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
-- Core
|
-- Core
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
local TotemPlates = Gladdy:NewModule("Totem Plates", nil, {
|
local TotemPlates = Gladdy:NewModule("Totem Plates", 2, {
|
||||||
npTotems = true,
|
npTotems = true,
|
||||||
npTotemsShowFriendly = true,
|
npTotemsShowFriendly = true,
|
||||||
npTotemsShowEnemy = true,
|
npTotemsShowEnemy = true,
|
||||||
@ -209,12 +132,10 @@ local TotemPlates = Gladdy:NewModule("Totem Plates", nil, {
|
|||||||
npTotemPlatesAlpha = 0.6,
|
npTotemPlatesAlpha = 0.6,
|
||||||
npTotemPlatesAlphaAlways = false,
|
npTotemPlatesAlphaAlways = false,
|
||||||
npTotemPlatesAlphaAlwaysTargeted = false,
|
npTotemPlatesAlphaAlwaysTargeted = false,
|
||||||
npTotemColors = select(1, GetTotemColorDefaultOptions())
|
npTotemColors = select(1, GetTotemColorDefaultOptions()),
|
||||||
|
npTotemsHideDisabledTotems = false,
|
||||||
})
|
})
|
||||||
|
|
||||||
LibStub("AceHook-3.0"):Embed(TotemPlates)
|
|
||||||
LibStub("AceTimer-3.0"):Embed(TotemPlates)
|
|
||||||
|
|
||||||
function TotemPlates.OnEvent(self, event, ...)
|
function TotemPlates.OnEvent(self, event, ...)
|
||||||
TotemPlates[event](self, ...)
|
TotemPlates[event](self, ...)
|
||||||
end
|
end
|
||||||
@ -223,18 +144,18 @@ function TotemPlates:Initialize()
|
|||||||
self.numChildren = 0
|
self.numChildren = 0
|
||||||
self.activeTotemNameplates = {}
|
self.activeTotemNameplates = {}
|
||||||
self.totemPlateCache = {}
|
self.totemPlateCache = {}
|
||||||
self:RegisterEvent("PLAYER_ENTERING_WORLD")
|
if Gladdy.db.npTotems then
|
||||||
self:RegisterEvent("NAME_PLATE_UNIT_ADDED")
|
self:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
self:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
|
self:RegisterEvent("NAME_PLATE_UNIT_ADDED")
|
||||||
self:RegisterEvent("PLAYER_TARGET_CHANGED")
|
self:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
|
||||||
self:SetScript("OnEvent", TotemPlates.OnEvent)
|
self:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||||
|
self:SetScript("OnEvent", TotemPlates.OnEvent)
|
||||||
|
end
|
||||||
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowEnemy then
|
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowEnemy then
|
||||||
--GetCVar("nameplateShowEnemyTotems")
|
SetCVar("nameplateShowEnemyTotems", true);
|
||||||
--SetCVar("nameplateShowEnemyTotems", true);
|
|
||||||
end
|
end
|
||||||
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowFriendly then
|
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowFriendly then
|
||||||
--GetCVar("nameplateShowFriendlyTotems")
|
SetCVar("nameplateShowFriendlyTotems", true);
|
||||||
--SetCVar("nameplateShowFriendlyTotems", true);
|
|
||||||
end
|
end
|
||||||
self.addon = "Blizzard"
|
self.addon = "Blizzard"
|
||||||
if (IsAddOnLoaded("Plater")) then
|
if (IsAddOnLoaded("Plater")) then
|
||||||
@ -258,17 +179,67 @@ function TotemPlates:Initialize()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- Events
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
function TotemPlates:PLAYER_ENTERING_WORLD()
|
function TotemPlates:PLAYER_ENTERING_WORLD()
|
||||||
self.numChildren = 0
|
self.numChildren = 0
|
||||||
self.activeTotemNameplates = {}
|
self.activeTotemNameplates = {}
|
||||||
end
|
end
|
||||||
|
|
||||||
function TotemPlates:Reset()
|
function TotemPlates:PLAYER_TARGET_CHANGED()
|
||||||
--self:CancelAllTimers()
|
for k,nameplate in pairs(self.activeTotemNameplates) do
|
||||||
--self:UnhookAll()
|
TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, k)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function TotemPlates:NAME_PLATE_UNIT_ADDED(unitID)
|
||||||
|
self:OnUnitEvent(unitID)
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPlates:NAME_PLATE_UNIT_REMOVED(unitID)
|
||||||
|
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
|
||||||
|
self.activeTotemNameplates[unitID] = nil
|
||||||
|
--self:ToggleAddon(nameplate, true)
|
||||||
|
if nameplate.gladdyTotemFrame then
|
||||||
|
nameplate.gladdyTotemFrame:Hide()
|
||||||
|
nameplate.gladdyTotemFrame:SetParent(nil)
|
||||||
|
tinsert(self.totemPlateCache, nameplate.gladdyTotemFrame)
|
||||||
|
nameplate.gladdyTotemFrame = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- Gladdy Call
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
function TotemPlates:UpdateFrameOnce()
|
function TotemPlates:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.npTotems then
|
||||||
|
self:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
|
self:RegisterEvent("NAME_PLATE_UNIT_ADDED")
|
||||||
|
self:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
|
||||||
|
self:RegisterEvent("PLAYER_TARGET_CHANGED")
|
||||||
|
self:SetScript("OnEvent", TotemPlates.OnEvent)
|
||||||
|
else
|
||||||
|
self:UnregisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
|
self:UnregisterEvent("NAME_PLATE_UNIT_ADDED")
|
||||||
|
self:UnregisterEvent("NAME_PLATE_UNIT_REMOVED")
|
||||||
|
self:UnregisterEvent("PLAYER_TARGET_CHANGED")
|
||||||
|
self:SetScript("OnEvent", nil)
|
||||||
|
end
|
||||||
|
|
||||||
|
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowEnemy then
|
||||||
|
SetCVar("nameplateShowEnemyTotems", true);
|
||||||
|
end
|
||||||
|
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowFriendly then
|
||||||
|
SetCVar("nameplateShowFriendlyTotems", true);
|
||||||
|
end
|
||||||
|
|
||||||
for k,nameplate in pairs(self.activeTotemNameplates) do
|
for k,nameplate in pairs(self.activeTotemNameplates) do
|
||||||
local totemDataEntry = nameplate.gladdyTotemFrame.totemDataEntry
|
local totemDataEntry = nameplate.gladdyTotemFrame.totemDataEntry
|
||||||
nameplate.gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
|
nameplate.gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
|
||||||
@ -279,16 +250,50 @@ function TotemPlates:UpdateFrameOnce()
|
|||||||
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.b,
|
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.b,
|
||||||
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.a)
|
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.a)
|
||||||
nameplate.gladdyTotemFrame.totemName:SetPoint("TOP", nameplate.gladdyTotemFrame, "BOTTOM", Gladdy.db.npTremorFontXOffset, Gladdy.db.npTremorFontYOffset)
|
nameplate.gladdyTotemFrame.totemName:SetPoint("TOP", nameplate.gladdyTotemFrame, "BOTTOM", Gladdy.db.npTremorFontXOffset, Gladdy.db.npTremorFontYOffset)
|
||||||
nameplate.gladdyTotemFrame.totemName:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.npTremorFont), Gladdy.db.npTremorFontSize, "OUTLINE")
|
nameplate.gladdyTotemFrame.totemName:SetFont(Gladdy:SMFetch("font", "npTremorFont"), Gladdy.db.npTremorFontSize, "OUTLINE")
|
||||||
nameplate.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "")
|
nameplate.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "")
|
||||||
self:SetTotemAlpha(nameplate.gladdyTotemFrame, k)
|
self:SetTotemAlpha(nameplate.gladdyTotemFrame, k)
|
||||||
self:ToggleAddon(nameplate)
|
|
||||||
|
if not Gladdy.db.npTotems then
|
||||||
|
nameplate.gladdyTotemFrame:Hide()
|
||||||
|
self:ToggleAddon(nameplate, true)
|
||||||
|
else
|
||||||
|
nameplate.gladdyTotemFrame:Show()
|
||||||
|
self:ToggleAddon(nameplate)
|
||||||
|
end
|
||||||
|
local isEnemy = UnitIsEnemy("player", nameplate.gladdyTotemFrame.unitID)
|
||||||
|
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowEnemy and isEnemy then
|
||||||
|
nameplate.gladdyTotemFrame:Show()
|
||||||
|
self:ToggleAddon(nameplate)
|
||||||
|
elseif Gladdy.db.npTotems and not Gladdy.db.npTotemsShowEnemy and isEnemy then
|
||||||
|
nameplate.gladdyTotemFrame:Hide()
|
||||||
|
self:ToggleAddon(nameplate, true)
|
||||||
|
end
|
||||||
|
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowFriendly and not isEnemy then
|
||||||
|
nameplate.gladdyTotemFrame:Show()
|
||||||
|
self:ToggleAddon(nameplate)
|
||||||
|
elseif not Gladdy.db.npTotemsShowFriendly and not isEnemy then
|
||||||
|
nameplate.gladdyTotemFrame:Hide()
|
||||||
|
self:ToggleAddon(nameplate, true)
|
||||||
|
end
|
||||||
|
if Gladdy.db.npTotems and Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled then
|
||||||
|
nameplate.gladdyTotemFrame:Show()
|
||||||
|
self:ToggleAddon(nameplate)
|
||||||
|
end
|
||||||
|
if Gladdy.db.npTotems and not Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled then
|
||||||
|
nameplate.gladdyTotemFrame:Hide()
|
||||||
|
self:ToggleAddon(nameplate, true)
|
||||||
|
end
|
||||||
|
if Gladdy.db.npTotems and not Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled and Gladdy.db.npTotemsHideDisabledTotems then
|
||||||
|
nameplate.gladdyTotemFrame:Hide()
|
||||||
|
self:ToggleAddon(nameplate)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
for i,gladdyTotemFrame in ipairs(self.totemPlateCache) do
|
for _,gladdyTotemFrame in ipairs(self.totemPlateCache) do
|
||||||
gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
|
gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
|
||||||
gladdyTotemFrame:SetHeight(Gladdy.db.npTotemPlatesSize)
|
gladdyTotemFrame:SetHeight(Gladdy.db.npTotemPlatesSize)
|
||||||
gladdyTotemFrame.totemBorder:SetTexture(Gladdy.db.npTotemPlatesBorderStyle)
|
gladdyTotemFrame.totemBorder:SetTexture(Gladdy.db.npTotemPlatesBorderStyle)
|
||||||
gladdyTotemFrame.totemName:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.npTremorFont), Gladdy.db.npTremorFontSize, "OUTLINE")
|
gladdyTotemFrame.totemName:SetFont(Gladdy:SMFetch("font", "npTremorFont"), Gladdy.db.npTremorFontSize, "OUTLINE")
|
||||||
gladdyTotemFrame.totemName:SetPoint("TOP", gladdyTotemFrame, "BOTTOM", Gladdy.db.npTremorFontXOffset, Gladdy.db.npTremorFontYOffset)
|
gladdyTotemFrame.totemName:SetPoint("TOP", gladdyTotemFrame, "BOTTOM", Gladdy.db.npTremorFontXOffset, Gladdy.db.npTremorFontYOffset)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -301,6 +306,7 @@ end
|
|||||||
|
|
||||||
function TotemPlates:CreateTotemFrame(nameplate)
|
function TotemPlates:CreateTotemFrame(nameplate)
|
||||||
nameplate.gladdyTotemFrame = CreateFrame("Frame")
|
nameplate.gladdyTotemFrame = CreateFrame("Frame")
|
||||||
|
nameplate.gladdyTotemFrame:SetFrameLevel(1)
|
||||||
nameplate.gladdyTotemFrame:SetIgnoreParentAlpha(true)
|
nameplate.gladdyTotemFrame:SetIgnoreParentAlpha(true)
|
||||||
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)
|
||||||
@ -315,7 +321,7 @@ function TotemPlates:CreateTotemFrame(nameplate)
|
|||||||
nameplate.gladdyTotemFrame.totemBorder:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT")
|
nameplate.gladdyTotemFrame.totemBorder:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT")
|
||||||
nameplate.gladdyTotemFrame.totemBorder:SetTexture(Gladdy.db.npTotemPlatesBorderStyle)
|
nameplate.gladdyTotemFrame.totemBorder:SetTexture(Gladdy.db.npTotemPlatesBorderStyle)
|
||||||
nameplate.gladdyTotemFrame.totemName = nameplate.gladdyTotemFrame:CreateFontString(nil, "OVERLAY")
|
nameplate.gladdyTotemFrame.totemName = nameplate.gladdyTotemFrame:CreateFontString(nil, "OVERLAY")
|
||||||
nameplate.gladdyTotemFrame.totemName:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.npTremorFont), Gladdy.db.npTremorFontSize, "OUTLINE")
|
nameplate.gladdyTotemFrame.totemName:SetFont(Gladdy:SMFetch("font", "npTremorFont"), Gladdy.db.npTremorFontSize, "OUTLINE")
|
||||||
nameplate.gladdyTotemFrame.totemName:SetPoint("TOP", nameplate.gladdyTotemFrame, "BOTTOM", Gladdy.db.npTremorFontXOffset, Gladdy.db.npTremorFontYOffset)
|
nameplate.gladdyTotemFrame.totemName:SetPoint("TOP", nameplate.gladdyTotemFrame, "BOTTOM", Gladdy.db.npTremorFontXOffset, Gladdy.db.npTremorFontYOffset)
|
||||||
nameplate.gladdyTotemFrame.selectionHighlight = nameplate.gladdyTotemFrame:CreateTexture(nil, "OVERLAY")
|
nameplate.gladdyTotemFrame.selectionHighlight = nameplate.gladdyTotemFrame:CreateTexture(nil, "OVERLAY")
|
||||||
nameplate.gladdyTotemFrame.selectionHighlight:SetTexture("Interface/TargetingFrame/UI-TargetingFrame-BarFill")
|
nameplate.gladdyTotemFrame.selectionHighlight:SetTexture("Interface/TargetingFrame/UI-TargetingFrame-BarFill")
|
||||||
@ -337,58 +343,84 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
function TotemPlates:PLAYER_TARGET_CHANGED()
|
function TotemPlates:GetAddonFrame(nameplate)
|
||||||
for k,nameplate in pairs(self.activeTotemNameplates) do
|
if self.addon == "Blizzard" then
|
||||||
TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, k)
|
if nameplate.UnitFrame then
|
||||||
|
return nameplate.UnitFrame
|
||||||
|
end
|
||||||
|
elseif self.addon == "Plater" or self.addon == "Tukui" or self.addon == "ElvUI" then
|
||||||
|
if nameplate.unitFrame then
|
||||||
|
return nameplate.unitFrame
|
||||||
|
end
|
||||||
|
elseif self.addon == "Kui_Nameplates" then
|
||||||
|
if nameplate.kui then
|
||||||
|
return nameplate.kui
|
||||||
|
end
|
||||||
|
elseif self.addon == "NeatPlates" then
|
||||||
|
if nameplate.extended or nameplate.carrier then
|
||||||
|
return nameplate.extended , nameplate.carrier
|
||||||
|
end
|
||||||
|
elseif self.addon == "TidyPlates_ThreatPlates" then
|
||||||
|
if nameplate.TPFrame then
|
||||||
|
return nameplate.TPFrame
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TotemPlates:ToggleAddon(nameplate)
|
|
||||||
if self.addon == "Blizzard" then
|
|
||||||
nameplate.UnitFrame:Hide()
|
function TotemPlates:ToggleAddon(nameplate, show)
|
||||||
elseif self.addon == "Plater" then
|
local addonFrames = { self:GetAddonFrame(nameplate) }
|
||||||
nameplate.unitFrame:Hide()
|
if addonFrames and #addonFrames > 0 then
|
||||||
elseif self.addon == "Kui_Nameplates" then
|
if show then
|
||||||
nameplate.kui:Hide()
|
for _,v in ipairs(addonFrames) do
|
||||||
elseif self.addon == "NeatPlates" then
|
v:Show()
|
||||||
nameplate.extended:Hide()
|
end
|
||||||
nameplate.carrier:Hide()
|
else
|
||||||
elseif self.addon == "TidyPlates_ThreatPlates" then
|
for _,v in ipairs(addonFrames) do
|
||||||
nameplate.TPFrame:Hide()
|
v:Hide()
|
||||||
elseif self.addon == "Tukui" or self.addon == "ElvUI" then
|
end
|
||||||
if nameplate.unitFrame then
|
|
||||||
nameplate.unitFrame:Hide()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TotemPlates.OnUpdate(self)
|
function TotemPlates.OnUpdate(self)
|
||||||
if (UnitIsUnit("mouseover", self.unitID) or UnitIsUnit("target", self.unitID)) then
|
if (UnitIsUnit("mouseover", self.unitID) or UnitIsUnit("target", self.unitID)) and Gladdy.db.npTotemColors["totem" .. self.totemDataEntry.id].alpha > 0 then
|
||||||
self.selectionHighlight:SetAlpha(.25)
|
self.selectionHighlight:SetAlpha(.25)
|
||||||
else
|
else
|
||||||
self.selectionHighlight:SetAlpha(0)
|
self.selectionHighlight:SetAlpha(0)
|
||||||
end
|
end
|
||||||
if (TotemPlates.addon == "Tukui" or TotemPlates.addon == "ElvUI") and self.parent and self.parent.unitFrame then
|
if (TotemPlates.addon == "Plater" or TotemPlates.addon == "Tukui" or TotemPlates.addon == "ElvUI") and self.parent and self.parent.unitFrame then
|
||||||
self.parent.unitFrame:Hide()
|
self.parent.unitFrame:Hide()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
|
function TotemPlates:OnUnitEvent(unitID)
|
||||||
local unitID = ...
|
|
||||||
local isEnemy = UnitIsEnemy("player", unitID)
|
local isEnemy = UnitIsEnemy("player", unitID)
|
||||||
|
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
|
||||||
|
if not nameplate then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not Gladdy.db.npTotems then
|
||||||
|
self:ToggleAddon(nameplate, true)
|
||||||
|
return
|
||||||
|
end
|
||||||
if not Gladdy.db.npTotemsShowEnemy and isEnemy then
|
if not Gladdy.db.npTotemsShowEnemy and isEnemy then
|
||||||
|
self:ToggleAddon(nameplate, true)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not Gladdy.db.npTotemsShowFriendly and not isEnemy then
|
if not Gladdy.db.npTotemsShowFriendly and not isEnemy then
|
||||||
|
self:ToggleAddon(nameplate, true)
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local npcType, _, _, _, _, npcId = strsplit("-", UnitGUID(unitID))
|
||||||
|
if npcType ~= "Creature" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local totemDataEntry = npcIdToTotemData[tonumber(npcId)]
|
||||||
|
if not totemDataEntry then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local nameplateName = UnitName(unitID)
|
|
||||||
local totemName = string_gsub(nameplateName, "^%s+", "") --trim
|
|
||||||
totemName = string_gsub(totemName, "%s+$", "") --trim
|
|
||||||
totemName = string_gsub(totemName, "%s+[I,V,X]+$", "") --trim rank
|
|
||||||
totemName = string_lower(totemName)
|
|
||||||
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
|
|
||||||
local totemDataEntry = localizedTotemData["default"][totemName] or localizedTotemData["frFR"][totemName] or localizedTotemData["ruRU"][totemName]
|
|
||||||
if totemDataEntry and Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled then-- modify this nameplates
|
if totemDataEntry and Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled then-- modify this nameplates
|
||||||
if #self.totemPlateCache > 0 then
|
if #self.totemPlateCache > 0 then
|
||||||
nameplate.gladdyTotemFrame = tremove(self.totemPlateCache, #self.totemPlateCache)
|
nameplate.gladdyTotemFrame = tremove(self.totemPlateCache, #self.totemPlateCache)
|
||||||
@ -412,18 +444,16 @@ function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
|
|||||||
TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, unitID)
|
TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, unitID)
|
||||||
self:ToggleAddon(nameplate)
|
self:ToggleAddon(nameplate)
|
||||||
self.activeTotemNameplates[unitID] = nameplate
|
self.activeTotemNameplates[unitID] = nameplate
|
||||||
end
|
elseif totemDataEntry and not Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled and Gladdy.db.npTotemsHideDisabledTotems then
|
||||||
end
|
if nameplate.gladdyTotemFrame then
|
||||||
|
nameplate.gladdyTotemFrame:Hide()
|
||||||
function TotemPlates:NAME_PLATE_UNIT_REMOVED(...)
|
nameplate.gladdyTotemFrame:SetParent(nil)
|
||||||
local unitID = ...
|
tinsert(self.totemPlateCache, nameplate.gladdyTotemFrame)
|
||||||
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
|
nameplate.gladdyTotemFrame = nil
|
||||||
self.activeTotemNameplates[unitID] = nil
|
end
|
||||||
if nameplate.gladdyTotemFrame then
|
self:ToggleAddon(nameplate)
|
||||||
nameplate.gladdyTotemFrame:Hide()
|
else
|
||||||
nameplate.gladdyTotemFrame:SetParent(nil)
|
self:ToggleAddon(nameplate, true)
|
||||||
tinsert(self.totemPlateCache, nameplate.gladdyTotemFrame)
|
|
||||||
nameplate.gladdyTotemFrame = nil
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -451,6 +481,65 @@ end
|
|||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- Test
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
function TotemPlates:TestOnce()
|
||||||
|
if not self.testFrame then
|
||||||
|
self.testFrame = CreateFrame("Frame", nil, UIParent)
|
||||||
|
self.testFrame:SetWidth(1)
|
||||||
|
self.testFrame:SetHeight(32)
|
||||||
|
self.testFrame:SetPoint("CENTER", UIParent, "CENTER", 0, -140)
|
||||||
|
self.testFrame:SetIgnoreParentScale(true)
|
||||||
|
end
|
||||||
|
local totemDataEntry = npcIdToTotemData[5913]
|
||||||
|
self.testFrame:Show()
|
||||||
|
if not self.testFrame.gladdyTotemFrame then
|
||||||
|
if #self.totemPlateCache > 0 then
|
||||||
|
self.testFrame.gladdyTotemFrame = tremove(self.totemPlateCache, #self.totemPlateCache)
|
||||||
|
else
|
||||||
|
self:CreateTotemFrame(self.testFrame)
|
||||||
|
self.testFrame.gladdyTotemFrame:SetScript("OnHide", nil)
|
||||||
|
self.testFrame.gladdyTotemFrame:SetScript("OnUpdate", nil)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if Gladdy.db.npTotems then
|
||||||
|
self.testFrame.gladdyTotemFrame.unitID = "player"
|
||||||
|
self.testFrame.gladdyTotemFrame.totemDataEntry = totemDataEntry
|
||||||
|
self.testFrame.gladdyTotemFrame.parent = self.testFrame
|
||||||
|
self.testFrame.gladdyTotemFrame:SetParent(self.testFrame)
|
||||||
|
self.testFrame.gladdyTotemFrame:ClearAllPoints()
|
||||||
|
self.testFrame.gladdyTotemFrame:SetPoint("CENTER", self.testFrame, "CENTER", 0, 0)
|
||||||
|
self.testFrame.gladdyTotemFrame.totemIcon:SetTexture(totemDataEntry.texture)
|
||||||
|
self.testFrame.gladdyTotemFrame.totemBorder:SetVertexColor(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.r,
|
||||||
|
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.g,
|
||||||
|
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.b,
|
||||||
|
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.a)
|
||||||
|
self.testFrame.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "")
|
||||||
|
self.testFrame.gladdyTotemFrame.parent = self.testFrame
|
||||||
|
self.testFrame.gladdyTotemFrame:Show()
|
||||||
|
self.activeTotemNameplates["player"] = self.testFrame
|
||||||
|
else
|
||||||
|
self.testFrame.gladdyTotemFrame:Hide()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPlates:Reset()
|
||||||
|
if self.testFrame then
|
||||||
|
if self.testFrame.gladdyTotemFrame then
|
||||||
|
self.testFrame.gladdyTotemFrame:Hide()
|
||||||
|
self.testFrame.gladdyTotemFrame:SetParent(nil)
|
||||||
|
tinsert(self.totemPlateCache, self.testFrame.gladdyTotemFrame)
|
||||||
|
self.testFrame.gladdyTotemFrame = nil
|
||||||
|
end
|
||||||
|
self.testFrame:Hide()
|
||||||
|
self.activeTotemNameplates["player"] = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
-- Interface options
|
-- Interface options
|
||||||
|
|
||||||
---------------------------------------------------
|
---------------------------------------------------
|
||||||
@ -465,21 +554,23 @@ function TotemPlates:GetOptions()
|
|||||||
npTotems = Gladdy:option({
|
npTotems = Gladdy:option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Enabled"],
|
name = L["Enabled"],
|
||||||
desc = L["Turns totem icons instead of nameplates on or off. (Requires reload)"],
|
desc = L["Turns totem icons instead of nameplates on or off."],
|
||||||
order = 3,
|
order = 3,
|
||||||
width = 0.9,
|
width = 0.9,
|
||||||
}),
|
}),
|
||||||
npTotemsShowFriendly = Gladdy:option({
|
npTotemsShowFriendly = Gladdy:option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show friendly"],
|
name = L["Show friendly"],
|
||||||
desc = L["Turns totem icons instead of nameplates on or off. (Requires reload)"],
|
desc = L["Turns totem icons instead of nameplates on or off."],
|
||||||
|
disabled = function() return not Gladdy.db.npTotems end,
|
||||||
order = 4,
|
order = 4,
|
||||||
width = 0.65,
|
width = 0.65,
|
||||||
}),
|
}),
|
||||||
npTotemsShowEnemy = Gladdy:option({
|
npTotemsShowEnemy = Gladdy:option({
|
||||||
type = "toggle",
|
type = "toggle",
|
||||||
name = L["Show enemy"],
|
name = L["Show enemy"],
|
||||||
desc = L["Turns totem icons instead of nameplates on or off. (Requires reload)"],
|
desc = L["Turns totem icons instead of nameplates on or off."],
|
||||||
|
disabled = function() return not Gladdy.db.npTotems end,
|
||||||
order = 5,
|
order = 5,
|
||||||
width = 0.6,
|
width = 0.6,
|
||||||
}),
|
}),
|
||||||
@ -487,6 +578,7 @@ function TotemPlates:GetOptions()
|
|||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
|
disabled = function() return not Gladdy.db.npTotems end,
|
||||||
order = 4,
|
order = 4,
|
||||||
args = {
|
args = {
|
||||||
icon = {
|
icon = {
|
||||||
@ -603,19 +695,23 @@ function TotemPlates:GetOptions()
|
|||||||
step = 0.1,
|
step = 0.1,
|
||||||
width = "full",
|
width = "full",
|
||||||
order = 23,
|
order = 23,
|
||||||
get = function(info)
|
get = function()
|
||||||
local alphas = GetTotemOptions()
|
local alpha, i = nil, 1
|
||||||
for i=2, #alphas do
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
if alphas[i].alpha ~= alphas[1].alpha then
|
if i == 1 then
|
||||||
return ""
|
alpha = v.alpha
|
||||||
|
i = i + 1
|
||||||
|
else
|
||||||
|
if v.alpha ~= alpha then
|
||||||
|
return ""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return alphas[1].alpha
|
return alpha
|
||||||
end,
|
end,
|
||||||
set = function(info, value)
|
set = function(_, value)
|
||||||
local alphas = GetTotemOptions()
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
for i=1, #alphas do
|
v.alpha = value
|
||||||
alphas[i].alpha = value
|
|
||||||
end
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
@ -643,23 +739,27 @@ function TotemPlates:GetOptions()
|
|||||||
name = L["All totem border color"],
|
name = L["All totem border color"],
|
||||||
order = 42,
|
order = 42,
|
||||||
hasAlpha = true,
|
hasAlpha = true,
|
||||||
get = function(info)
|
get = function()
|
||||||
local colors = GetTotemOptions()
|
local color
|
||||||
local color = colors[1].color
|
local i = 1
|
||||||
for i=2, #colors do
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
if colors[i].r ~= color.r or colors[i].color.r ~= color.r or colors[i].color.r ~= color.r or colors[i].color.r ~= color.r then
|
if i == 1 then
|
||||||
return 0, 0, 0, 0
|
color = v.color
|
||||||
|
i = i + 1
|
||||||
|
else
|
||||||
|
if v.color.r ~= color.r or v.color.g ~= color.g or v.color.b ~= color.b or v.color.a ~= color.a then
|
||||||
|
return 0, 0, 0, 0
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return color.r, color.g, color.b, color.a
|
return color.r, color.g, color.b, color.a
|
||||||
end,
|
end,
|
||||||
set = function(info, r, g, b, a)
|
set = function(_, r, g, b, a)
|
||||||
local colors = GetTotemOptions()
|
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
|
||||||
for i=1, #colors do
|
v.color.r = r
|
||||||
colors[i].color.r = r
|
v.color.g = g
|
||||||
colors[i].color.g = g
|
v.color.b = b
|
||||||
colors[i].color.b = b
|
v.color.a = a
|
||||||
colors[i].color.a = a
|
|
||||||
end
|
end
|
||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end,
|
end,
|
||||||
@ -673,7 +773,8 @@ function TotemPlates:GetOptions()
|
|||||||
name = L["Customize Totems"],
|
name = L["Customize Totems"],
|
||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
args = select(2, Gladdy:GetTotemColors())
|
disabled = function() return not Gladdy.db.npTotems end,
|
||||||
|
args = select(2, GetTotemColorDefaultOptions())
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
783
Modules/TotemPulse.lua
Normal file
783
Modules/TotemPulse.lua
Normal file
@ -0,0 +1,783 @@
|
|||||||
|
local select, pairs, tremove, tinsert, format, strsplit, tonumber = select, pairs, tremove, tinsert, format, strsplit, tonumber
|
||||||
|
local type = type
|
||||||
|
local C_NamePlate = C_NamePlate
|
||||||
|
local Gladdy = LibStub("Gladdy")
|
||||||
|
local L = Gladdy.L
|
||||||
|
local GetSpellInfo, CreateFrame = GetSpellInfo, CreateFrame
|
||||||
|
local GetTime, UnitIsEnemy, UnitGUID = GetTime, UnitIsEnemy, UnitGUID
|
||||||
|
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
|
||||||
|
local UIParent = UIParent
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- Helper
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
local totemData, npcIdToTotemData, cooldowns = Gladdy:GetTotemData()
|
||||||
|
local ninetyDegreeInRad = 90 * math.pi / 180
|
||||||
|
|
||||||
|
local function TotemOptions()
|
||||||
|
local defaultDB = {}
|
||||||
|
local options = {}
|
||||||
|
local indexedList = {}
|
||||||
|
for k,v in pairs(totemData) do
|
||||||
|
if v.pulse then
|
||||||
|
tinsert(indexedList, {name = k, id = v.id, color = v.color, texture = v.texture})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
table.sort(indexedList, function (a, b)
|
||||||
|
return a.name < b.name
|
||||||
|
end)
|
||||||
|
for i=1,#indexedList do
|
||||||
|
defaultDB["totem" .. indexedList[i].id] = {enabled = true, attachToGladdyTotemFrame = true, style = "COOLDOWN", reverse = false}
|
||||||
|
options["totem" .. indexedList[i].id] = {
|
||||||
|
order = i+1,
|
||||||
|
name = select(1, GetSpellInfo(indexedList[i].id)),
|
||||||
|
--inline = true,
|
||||||
|
width = "3.0",
|
||||||
|
type = "group",
|
||||||
|
icon = indexedList[i].texture,
|
||||||
|
args = {
|
||||||
|
headerTotemConfig = {
|
||||||
|
type = "header",
|
||||||
|
name = format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))),
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
enabled = {
|
||||||
|
order = 2,
|
||||||
|
name = L["Enabled"],
|
||||||
|
desc = "Enable " .. format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))),
|
||||||
|
type = "toggle",
|
||||||
|
width = "full",
|
||||||
|
get = function() return Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].enabled end,
|
||||||
|
set = function(_, value)
|
||||||
|
Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].enabled = value
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
attachToGladdyTotemFrame = {
|
||||||
|
order = 3,
|
||||||
|
disabled = function() return not Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].enabled end,
|
||||||
|
name = L["Attach To TotemPlate"],
|
||||||
|
desc = "Attach " .. format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))) .. " To TotemPlate",
|
||||||
|
type = "toggle",
|
||||||
|
width = "full",
|
||||||
|
get = function() return Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].attachToGladdyTotemFrame end,
|
||||||
|
set = function(_, value)
|
||||||
|
Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].attachToGladdyTotemFrame = value
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
style = {
|
||||||
|
type = "select",
|
||||||
|
name = L["Style"],
|
||||||
|
order = 4,
|
||||||
|
values = {
|
||||||
|
COOLDOWN = L["Cooldown"],
|
||||||
|
Vertical = L["Bar vertical"],
|
||||||
|
Horizontal = L["Bar horizontal"]
|
||||||
|
},
|
||||||
|
get = function() return Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].style end,
|
||||||
|
set = function(_, value)
|
||||||
|
Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].style = value
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
reverse = {
|
||||||
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].enabled end,
|
||||||
|
name = L["Reverse"],
|
||||||
|
type = "toggle",
|
||||||
|
width = "full",
|
||||||
|
get = function() return Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].reverse end,
|
||||||
|
set = function(_, value)
|
||||||
|
Gladdy.dbi.profile.totemPulseTotems["totem" .. indexedList[i].id].reverse = value
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
||||||
|
return options,defaultDB
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- Core
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
local TotemPulse = Gladdy:NewModule("Totem Pulse", 1, {
|
||||||
|
totemPulseEnabled = true,
|
||||||
|
totemPulseEnabledShowFriendly = true,
|
||||||
|
totemPulseEnabledShowEnemy = true,
|
||||||
|
totemPulseStyle = "", -- "COOLDOWN", "COOLDOWNREVERSE", "BARVERTICAL", "BARHORIZONTAL"
|
||||||
|
--text
|
||||||
|
totemPulseTextColor = { r = 1, g = 1, b = 1, a = 1 },
|
||||||
|
totemPulseTextSize = 14,
|
||||||
|
totemPulseTextFont = "DorisPP",
|
||||||
|
--bar
|
||||||
|
totemPulseBarWidth = 40,
|
||||||
|
totemPulseBarHeight = 20,
|
||||||
|
totemPulseBarColor = { r = 1, g = 0, b = 0, a = .5 },
|
||||||
|
totemPulseBarBgColor = { r = 0, g = 1, b = 0, a = .5 },
|
||||||
|
totemPulseBarBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
|
totemPulseBarBorderSize = 4,
|
||||||
|
totemPulseBarBorderStyle = "Gladdy Tooltip squared",
|
||||||
|
totemPulseBarTexture = "Flat",
|
||||||
|
totemPulseBarReverse = false,
|
||||||
|
--cooldown
|
||||||
|
totemPulseCooldownWidth = 40,
|
||||||
|
totemPulseCooldownHeight = 20,
|
||||||
|
totemPulseCooldownAlpha = 1,
|
||||||
|
totemPulseCooldownReverse = true,
|
||||||
|
--totems
|
||||||
|
totemPulseTotems = select(2, TotemOptions())
|
||||||
|
})
|
||||||
|
|
||||||
|
function TotemPulse.OnEvent(self, event, ...)
|
||||||
|
TotemPulse[event](self, ...)
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:Initialize()
|
||||||
|
self.timeStamps = {}
|
||||||
|
self.cooldownCache = {}
|
||||||
|
self.barCache = {}
|
||||||
|
self.activeFrames = { bars = {}, cooldowns = {} }
|
||||||
|
if Gladdy.db.totemPulseEnabled then
|
||||||
|
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
|
self:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
|
||||||
|
self:RegisterEvent("NAME_PLATE_UNIT_ADDED")
|
||||||
|
self:RegisterEvent("UNIT_NAME_UPDATE")
|
||||||
|
self:SetScript("OnEvent", self.OnEvent)
|
||||||
|
end
|
||||||
|
self:RegisterEvent("PLAYER_ENTERING_WORLD")
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- EVENTS
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
function TotemPulse:PLAYER_ENTERING_WORLD()
|
||||||
|
self.timeStamps = {}
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:COMBAT_LOG_EVENT_UNFILTERED()
|
||||||
|
local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName = CombatLogGetCurrentEventInfo()
|
||||||
|
local pulse = cooldowns[spellID] or cooldowns[spellName]
|
||||||
|
local npcId = tonumber(select(6, strsplit("-", destGUID)), 10)
|
||||||
|
if eventType == "UNIT_DESTROYED" and self.timeStamps[destGUID] then
|
||||||
|
self.timeStamps[destGUID] = nil
|
||||||
|
end
|
||||||
|
if (eventType == "SWING_DAMAGE" or eventType == "SPELL_DAMAGE") and self.timeStamps[destGUID] and npcIdToTotemData[npcId] then
|
||||||
|
self.timeStamps[destGUID] = nil
|
||||||
|
end
|
||||||
|
if not pulse then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if eventType == "SPELL_CAST_SUCCESS" then
|
||||||
|
self.timeStamps[sourceGUID] = { timeStamp = GetTime(), pulse = pulse }
|
||||||
|
end
|
||||||
|
if eventType == "SPELL_SUMMON" then
|
||||||
|
if not npcIdToTotemData[npcId] then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if not Gladdy.dbi.profile.totemPulseTotems["totem" .. npcIdToTotemData[npcId].id].enabled then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if self.timeStamps[sourceGUID] then
|
||||||
|
self.timeStamps[destGUID] = self.timeStamps[sourceGUID]
|
||||||
|
self.timeStamps[destGUID].id = npcIdToTotemData[npcId].id
|
||||||
|
self.timeStamps[sourceGUID] = nil
|
||||||
|
else
|
||||||
|
self.timeStamps[destGUID] = { timeStamp = GetTime(), pulse = pulse, id = npcIdToTotemData[npcId].id }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:NAME_PLATE_UNIT_REMOVED(unitId)
|
||||||
|
local nameplate = C_NamePlate.GetNamePlateForUnit(unitId)
|
||||||
|
if nameplate.totemTick then
|
||||||
|
nameplate.totemTick:SetScript("OnUpdate", nil)
|
||||||
|
nameplate.totemTick:Hide()
|
||||||
|
nameplate.totemTick:SetParent(nil)
|
||||||
|
tinsert(nameplate.totemTick.bar and self.barCache or self.cooldownCache, nameplate.totemTick)
|
||||||
|
self.activeFrames.bars[nameplate.totemTick] = nil
|
||||||
|
self.activeFrames.cooldowns[nameplate.totemTick] = nil
|
||||||
|
nameplate.totemTick = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:NAME_PLATE_UNIT_ADDED(unitId)
|
||||||
|
self:OnUnitAdded(unitId, "NAME_PLATE_UNIT_ADDED")
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:UNIT_NAME_UPDATE(unitId)
|
||||||
|
self:OnUnitAdded(unitId, "UNIT_NAME_UPDATE")
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:OnUnitAdded(unitId)
|
||||||
|
local isEnemy = UnitIsEnemy("player", unitId)
|
||||||
|
local guid = UnitGUID(unitId)
|
||||||
|
if strsplit("-", guid) ~= "Creature" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local nameplate = C_NamePlate.GetNamePlateForUnit(unitId)
|
||||||
|
|
||||||
|
if nameplate and (isEnemy and Gladdy.db.totemPulseEnabledShowEnemy or not isEnemy and Gladdy.db.totemPulseEnabledShowFriendly) then
|
||||||
|
if self.timeStamps[guid] and strsplit("-", guid) then
|
||||||
|
self:AddTimerFrame(nameplate, self.timeStamps[guid])
|
||||||
|
else
|
||||||
|
if nameplate.totemTick then
|
||||||
|
nameplate.totemTick:SetScript("OnUpdate", nil)
|
||||||
|
nameplate.totemTick:Hide()
|
||||||
|
nameplate.totemTick:SetParent(nil)
|
||||||
|
tinsert(nameplate.totemTick.bar and self.barCache or self.cooldownCache, nameplate.totemTick)
|
||||||
|
self.activeFrames.bars[nameplate.totemTick] = nil
|
||||||
|
self.activeFrames.cooldowns[nameplate.totemTick] = nil
|
||||||
|
nameplate.totemTick = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- FRAMES
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
function TotemPulse:CreateCooldownFrame(style)
|
||||||
|
local totemTick
|
||||||
|
|
||||||
|
if style == "COOLDOWN" then
|
||||||
|
if #self.cooldownCache > 0 then
|
||||||
|
totemTick = tremove(self.cooldownCache, #self.cooldownCache)
|
||||||
|
else
|
||||||
|
totemTick = CreateFrame("Frame")
|
||||||
|
totemTick:SetWidth(Gladdy.db.totemPulseCooldownWidth)
|
||||||
|
totemTick:SetHeight(Gladdy.db.totemPulseCooldownHeight)
|
||||||
|
totemTick.cd = CreateFrame("Cooldown", nil, totemTick, "CooldownFrameTemplate")
|
||||||
|
totemTick.cd:SetAllPoints(totemTick)
|
||||||
|
totemTick.cd.noCooldownCount = true
|
||||||
|
totemTick:SetFrameStrata("MEDIUM")
|
||||||
|
totemTick:SetFrameLevel(4)
|
||||||
|
totemTick.cd:SetReverse(Gladdy.db.totemPulseCooldownReverse)
|
||||||
|
totemTick.cd:SetHideCountdownNumbers(true)
|
||||||
|
totemTick.cd:SetAlpha(Gladdy.db.totemPulseCooldownAlpha)
|
||||||
|
|
||||||
|
totemTick.textFrame = CreateFrame("Frame", nil, totemTick)
|
||||||
|
totemTick.textFrame:SetAllPoints(totemTick)
|
||||||
|
totemTick.text = totemTick.textFrame:CreateFontString(nil, "OVERLAY")
|
||||||
|
totemTick.text:SetPoint("CENTER", totemTick.textFrame, "CENTER")
|
||||||
|
totemTick.text:SetFont(Gladdy:SMFetch("font", "totemPulseTextFont"), Gladdy.db.totemPulseTextSize, "OUTLINE")
|
||||||
|
totemTick.text:SetJustifyH("CENTER")
|
||||||
|
totemTick.text:SetShadowOffset(1, -1)
|
||||||
|
totemTick.text:SetTextColor(Gladdy:SetColor(Gladdy.db.totemPulseTextColor))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if #self.barCache > 0 then
|
||||||
|
totemTick = tremove(self.barCache, #self.barCache)
|
||||||
|
totemTick.bar:SetOrientation(style)
|
||||||
|
totemTick.spark:SetRotation(style == "Vertical" and ninetyDegreeInRad or 0)
|
||||||
|
totemTick.spark:SetHeight(style == "Vertical" and Gladdy.db.totemPulseBarWidth or Gladdy.db.totemPulseBarHeight)
|
||||||
|
else
|
||||||
|
totemTick = CreateFrame("Frame", nil)
|
||||||
|
|
||||||
|
totemTick:SetWidth(Gladdy.db.totemPulseBarWidth)
|
||||||
|
totemTick:SetHeight(Gladdy.db.totemPulseBarHeight)
|
||||||
|
|
||||||
|
totemTick.backdrop = CreateFrame("Frame", nil, totemTick, BackdropTemplateMixin and "BackdropTemplate")
|
||||||
|
totemTick.backdrop:SetAllPoints(totemTick)
|
||||||
|
totemTick.backdrop:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "totemPulseBarBorderStyle"),
|
||||||
|
edgeSize = Gladdy.db.totemPulseBarBorderSize })
|
||||||
|
totemTick.backdrop:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.totemPulseBarBorderColor))
|
||||||
|
totemTick.backdrop:SetFrameLevel(1)
|
||||||
|
|
||||||
|
totemTick.bar = CreateFrame("StatusBar", nil, totemTick)
|
||||||
|
totemTick.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "totemPulseBarTexture"))
|
||||||
|
totemTick.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.totemPulseBarColor))
|
||||||
|
totemTick.bar:SetOrientation(style)
|
||||||
|
totemTick.bar:SetFrameLevel(0)
|
||||||
|
totemTick.bar:SetAllPoints(totemTick)
|
||||||
|
|
||||||
|
totemTick.spark = totemTick.bar:CreateTexture(nil, "OVERLAY")
|
||||||
|
totemTick.spark:SetTexture("Interface\\CastingBar\\UI-CastingBar-Spark")
|
||||||
|
totemTick.spark:SetBlendMode("ADD")
|
||||||
|
totemTick.spark:SetWidth(8)
|
||||||
|
totemTick.spark:SetHeight(style == "Vertical" and Gladdy.db.totemPulseBarWidth or Gladdy.db.totemPulseBarHeight)
|
||||||
|
totemTick.spark.position = 0
|
||||||
|
totemTick.spark:SetRotation(style == "Vertical" and ninetyDegreeInRad or 0)
|
||||||
|
|
||||||
|
totemTick.bg = totemTick.bar:CreateTexture(nil, "BACKGROUND")
|
||||||
|
totemTick.bg:SetTexture(Gladdy:SMFetch("statusbar", "totemPulseBarTexture"))
|
||||||
|
totemTick.bg:SetAllPoints(totemTick.bar)
|
||||||
|
totemTick.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.totemPulseBarBgColor))
|
||||||
|
|
||||||
|
totemTick.text = totemTick.bar:CreateFontString(nil, "OVERLAY")
|
||||||
|
totemTick.text:SetPoint("CENTER", totemTick, "CENTER", 0, 0)
|
||||||
|
totemTick.text:SetFont(Gladdy:SMFetch("font", "totemPulseTextFont"), Gladdy.db.totemPulseTextSize, "OUTLINE")
|
||||||
|
totemTick.text:SetJustifyH("CENTER")
|
||||||
|
totemTick.text:SetShadowOffset(1, -1)
|
||||||
|
totemTick.text:SetTextColor(Gladdy:SetColor(Gladdy.db.totemPulseTextColor))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return totemTick
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:AddTimerFrame(nameplate, timestamp, test)
|
||||||
|
if (nameplate:IsShown() or test) and timestamp then
|
||||||
|
if not nameplate.totemTick then
|
||||||
|
nameplate.totemTick = TotemPulse:CreateCooldownFrame(Gladdy.db.totemPulseTotems["totem" .. timestamp.id].style)
|
||||||
|
end
|
||||||
|
nameplate.totemTick:SetParent(nameplate)
|
||||||
|
|
||||||
|
local cd = type(timestamp.pulse) == "table" and timestamp.pulse.cd or timestamp.pulse
|
||||||
|
local once = type(timestamp.pulse) == "table"
|
||||||
|
local cooldown = (timestamp.timeStamp - GetTime()) % cd
|
||||||
|
|
||||||
|
nameplate.totemTick.timestamp = timestamp.timeStamp
|
||||||
|
nameplate.totemTick.maxValue = cd
|
||||||
|
nameplate.totemTick.value = cooldown
|
||||||
|
nameplate.totemTick.once = once
|
||||||
|
nameplate.totemTick.id = timestamp.id
|
||||||
|
|
||||||
|
if nameplate.totemTick.bar then
|
||||||
|
self:UpdateBarPartial(nameplate.totemTick)
|
||||||
|
nameplate.totemTick.bar:SetMinMaxValues(0, cd)
|
||||||
|
nameplate.totemTick.bar:SetValue(cooldown)
|
||||||
|
self.activeFrames.bars[nameplate.totemTick] = nameplate.totemTick
|
||||||
|
else
|
||||||
|
self:UpdateCooldown(nameplate.totemTick)
|
||||||
|
self.activeFrames.cooldowns[nameplate.totemTick] = nameplate.totemTick
|
||||||
|
end
|
||||||
|
|
||||||
|
if once and GetTime() - timestamp.timeStamp > cd then
|
||||||
|
nameplate.totemTick:SetScript("OnUpdate", nil)
|
||||||
|
nameplate.totemTick:Hide()
|
||||||
|
else
|
||||||
|
nameplate.totemTick:SetScript("OnUpdate", TotemPulse.TotemPulseOnUpdate)
|
||||||
|
nameplate.totemTick:Show()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if nameplate.totemTick then
|
||||||
|
nameplate.totemTick:SetScript("OnUpdate", nil)
|
||||||
|
nameplate.totemTick:Hide()
|
||||||
|
nameplate.totemTick:SetParent(nil)
|
||||||
|
tinsert(nameplate.totemTick.bar and self.barCache or self.cooldownCache, nameplate.totemTick)
|
||||||
|
self.activeFrames.bars[nameplate.totemTick] = nil
|
||||||
|
self.activeFrames.cooldowns[nameplate.totemTick] = nil
|
||||||
|
nameplate.totemTick = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:SetSparkPosition(totemTick, referenceSize, vertical)
|
||||||
|
if not Gladdy.db.totemPulseTotems["totem" .. totemTick.id].reverse then
|
||||||
|
totemTick.bar:SetValue(totemTick.maxValue - totemTick.value)
|
||||||
|
totemTick.spark.position = referenceSize / 2 - (totemTick.value / totemTick.maxValue) * referenceSize
|
||||||
|
if ( totemTick.spark.position < -referenceSize / 2 ) then
|
||||||
|
totemTick.spark.position = -referenceSize / 2
|
||||||
|
end
|
||||||
|
else
|
||||||
|
totemTick.bar:SetValue(totemTick.value)
|
||||||
|
totemTick.spark.position = referenceSize / 2 - ((totemTick.maxValue - totemTick.value) / totemTick.maxValue) * referenceSize
|
||||||
|
if ( totemTick.spark.position > referenceSize / 2 ) then
|
||||||
|
totemTick.spark.position = referenceSize / 2
|
||||||
|
end
|
||||||
|
end
|
||||||
|
totemTick.spark:SetPoint("CENTER", totemTick.bar, "CENTER", vertical and 0 or totemTick.spark.position, vertical and totemTick.spark.position or 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse.TotemPulseOnUpdate(totemTick)
|
||||||
|
totemTick.now = GetTime()
|
||||||
|
totemTick.value = (totemTick.timestamp - totemTick.now) % totemTick.maxValue
|
||||||
|
if totemTick.once and totemTick.now - totemTick.timestamp >= totemTick.maxValue then
|
||||||
|
totemTick:SetScript("OnUpdate", nil)
|
||||||
|
totemTick:Hide()
|
||||||
|
end
|
||||||
|
if not totemTick.bar and not (totemTick.once and totemTick.now - totemTick.timestamp >= totemTick.maxValue) then
|
||||||
|
if Gladdy.db.totemPulseTotems["totem" .. totemTick.id].reverse then
|
||||||
|
totemTick.cd:SetCooldown(totemTick.now - totemTick.value, totemTick.maxValue)
|
||||||
|
else
|
||||||
|
totemTick.cd:SetCooldown(totemTick.now - (totemTick.maxValue - totemTick.value), totemTick.maxValue)
|
||||||
|
end
|
||||||
|
elseif totemTick.bar then
|
||||||
|
if Gladdy.db.totemPulseTotems["totem" .. totemTick.id].style == "Vertical" then
|
||||||
|
TotemPulse:SetSparkPosition(totemTick, totemTick.bar:GetHeight(), true)
|
||||||
|
else
|
||||||
|
TotemPulse:SetSparkPosition(totemTick, totemTick.bar:GetWidth(), false)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
totemTick.text:SetFormattedText("%.1f", totemTick.value)
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- Update Styles
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
function TotemPulse:UpdateBarPartial(bar)
|
||||||
|
local style = bar.id and Gladdy.db.totemPulseTotems["totem" .. bar.id].style
|
||||||
|
|
||||||
|
bar:SetWidth(Gladdy.db.totemPulseBarWidth)
|
||||||
|
bar:SetHeight(Gladdy.db.totemPulseBarHeight)
|
||||||
|
|
||||||
|
bar.spark:SetWidth(8)
|
||||||
|
bar.spark:SetHeight(style == "Vertical" and Gladdy.db.totemPulseBarWidth or Gladdy.db.totemPulseBarHeight)
|
||||||
|
bar.spark:SetRotation(style == "Vertical" and ninetyDegreeInRad or 0)
|
||||||
|
|
||||||
|
|
||||||
|
if bar:GetParent() and bar:GetParent() ~= UIParent then
|
||||||
|
local gladdyTotemFrame = bar:GetParent().gladdyTotemFrame and bar:GetParent().gladdyTotemFrame
|
||||||
|
local nameplate = bar:GetParent()
|
||||||
|
bar:ClearAllPoints()
|
||||||
|
if bar.id and gladdyTotemFrame and gladdyTotemFrame:IsShown() and Gladdy.db.totemPulseTotems["totem" .. bar.id].attachToGladdyTotemFrame then
|
||||||
|
bar:SetPoint("TOPLEFT", gladdyTotemFrame, "TOPLEFT", Gladdy.db.npTotemPlatesSize/16, -Gladdy.db.npTotemPlatesSize/16)
|
||||||
|
bar:SetPoint("BOTTOMRIGHT", gladdyTotemFrame, "BOTTOMRIGHT", -Gladdy.db.npTotemPlatesSize/16, Gladdy.db.npTotemPlatesSize/16)
|
||||||
|
if style then
|
||||||
|
bar.spark:SetHeight(style == "Vertical" and gladdyTotemFrame:GetWidth() or gladdyTotemFrame:GetHeight())
|
||||||
|
end
|
||||||
|
elseif bar.id and gladdyTotemFrame and gladdyTotemFrame:IsShown() and not Gladdy.db.totemPulseTotems["totem" .. bar.id].attachToGladdyTotemFrame then
|
||||||
|
bar:SetPoint("TOP", gladdyTotemFrame, "BOTTOM", 0, -0.5)
|
||||||
|
else
|
||||||
|
bar:SetPoint("TOP", nameplate, "BOTTOM", 0, -0.5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
bar.bar:SetOrientation(style ~= "COOLDOWN" and style or bar.bar:GetOrientation())
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:UpdateBar(bar)
|
||||||
|
self:UpdateBarPartial(bar)
|
||||||
|
|
||||||
|
bar.backdrop:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "totemPulseBarBorderStyle"),
|
||||||
|
edgeSize = Gladdy.db.totemPulseBarBorderSize })
|
||||||
|
bar.backdrop:SetBackdropBorderColor(Gladdy:SetColor(Gladdy.db.totemPulseBarBorderColor))
|
||||||
|
|
||||||
|
bar.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "totemPulseBarTexture"))
|
||||||
|
bar.bar:SetStatusBarColor(Gladdy:SetColor(Gladdy.db.totemPulseBarColor))
|
||||||
|
bar.bar:SetAllPoints(bar)
|
||||||
|
|
||||||
|
bar.bg:SetTexture(Gladdy:SMFetch("statusbar", "totemPulseBarTexture"))
|
||||||
|
bar.bg:SetVertexColor(Gladdy:SetColor(Gladdy.db.totemPulseBarBgColor))
|
||||||
|
|
||||||
|
bar.text:SetFont(Gladdy:SMFetch("font", "totemPulseTextFont"), Gladdy.db.totemPulseTextSize, "OUTLINE")
|
||||||
|
bar.text:SetTextColor(Gladdy:SetColor(Gladdy.db.totemPulseTextColor))
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:UpdateCooldown(cooldown)
|
||||||
|
cooldown:SetWidth(Gladdy.db.totemPulseCooldownWidth)
|
||||||
|
cooldown:SetHeight(Gladdy.db.totemPulseCooldownHeight)
|
||||||
|
|
||||||
|
cooldown.cd:SetCooldown(0,0)
|
||||||
|
cooldown.cd:SetReverse(Gladdy.db.totemPulseCooldownReverse)
|
||||||
|
cooldown.cd:SetAlpha(Gladdy.db.totemPulseCooldownAlpha)
|
||||||
|
|
||||||
|
cooldown.text:SetFont(Gladdy:SMFetch("font", "totemPulseTextFont"), Gladdy.db.totemPulseTextSize, "OUTLINE")
|
||||||
|
cooldown.text:SetTextColor(Gladdy:SetColor(Gladdy.db.totemPulseTextColor))
|
||||||
|
|
||||||
|
if cooldown:GetParent() and cooldown:GetParent() ~= UIParent then
|
||||||
|
local gladdyTotemFrame = cooldown:GetParent().gladdyTotemFrame and cooldown:GetParent().gladdyTotemFrame
|
||||||
|
local nameplate = cooldown:GetParent()
|
||||||
|
cooldown:ClearAllPoints()
|
||||||
|
if cooldown.id and gladdyTotemFrame and gladdyTotemFrame:IsShown() and Gladdy.db.totemPulseTotems["totem" .. cooldown.id].attachToGladdyTotemFrame then
|
||||||
|
cooldown:SetPoint("TOPLEFT", gladdyTotemFrame, "TOPLEFT", Gladdy.db.npTotemPlatesSize/16, -Gladdy.db.npTotemPlatesSize/16)
|
||||||
|
cooldown:SetPoint("BOTTOMRIGHT", gladdyTotemFrame, "BOTTOMRIGHT", -Gladdy.db.npTotemPlatesSize/16, Gladdy.db.npTotemPlatesSize/16)
|
||||||
|
elseif cooldown.id and gladdyTotemFrame and gladdyTotemFrame:IsShown() and not Gladdy.db.totemPulseTotems["totem" .. cooldown.id].attachToGladdyTotemFrame then
|
||||||
|
cooldown:SetPoint("TOP", gladdyTotemFrame, "BOTTOM", 0, -0.5)
|
||||||
|
else
|
||||||
|
cooldown:SetPoint("TOP", nameplate, "BOTTOM", 0, -0.5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:UpdateFrameOnce()
|
||||||
|
if Gladdy.frame.testing then
|
||||||
|
TotemPulse:TestOnce()
|
||||||
|
end
|
||||||
|
if Gladdy.db.totemPulseEnabled then
|
||||||
|
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
|
self:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
|
||||||
|
self:RegisterEvent("NAME_PLATE_UNIT_ADDED")
|
||||||
|
self:RegisterEvent("UNIT_NAME_UPDATE")
|
||||||
|
self:SetScript("OnEvent", self.OnEvent)
|
||||||
|
else
|
||||||
|
for _,bar in pairs(self.activeFrames.bars) do
|
||||||
|
bar:SetScript("OnUpdate", nil)
|
||||||
|
bar:Hide()
|
||||||
|
bar:SetParent(nil)
|
||||||
|
tinsert(self.barCache, bar)
|
||||||
|
self.activeFrames.bars[bar] = nil
|
||||||
|
end
|
||||||
|
for _,cooldown in pairs(self.activeFrames.cooldowns) do
|
||||||
|
cooldown:SetScript("OnUpdate", nil)
|
||||||
|
cooldown:Hide()
|
||||||
|
cooldown:SetParent(nil)
|
||||||
|
tinsert(self.cooldownCache, cooldown)
|
||||||
|
self.activeFrames.cooldowns[cooldown] = nil
|
||||||
|
end
|
||||||
|
self:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
|
self:UnregisterEvent("NAME_PLATE_UNIT_REMOVED")
|
||||||
|
self:UnregisterEvent("NAME_PLATE_UNIT_ADDED")
|
||||||
|
self:UnregisterEvent("UNIT_NAME_UPDATE")
|
||||||
|
self:SetScript("OnEvent", nil)
|
||||||
|
end
|
||||||
|
for _,bar in pairs(self.activeFrames.bars) do
|
||||||
|
self:UpdateBar(bar)
|
||||||
|
end
|
||||||
|
for _,cooldown in pairs(self.activeFrames.cooldowns) do
|
||||||
|
self:UpdateCooldown(cooldown)
|
||||||
|
end
|
||||||
|
for _,bar in pairs(self.barCache) do
|
||||||
|
self:UpdateBar(bar)
|
||||||
|
end
|
||||||
|
for _,cooldown in pairs(self.cooldownCache) do
|
||||||
|
self:UpdateCooldown(cooldown)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- TEST
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
function TotemPulse:TestOnce()
|
||||||
|
local totemPlatesTestFrame = Gladdy.modules["Totem Plates"].testFrame
|
||||||
|
if totemPlatesTestFrame then
|
||||||
|
if totemPlatesTestFrame.totemTick
|
||||||
|
and (Gladdy.db.totemPulseTotems["totem" .. npcIdToTotemData[5913].id].style == "COOLDOWN" and totemPlatesTestFrame.totemTick.bar
|
||||||
|
or Gladdy.db.totemPulseTotems["totem" .. npcIdToTotemData[5913].id].style ~= "COOLDOWN" and not totemPlatesTestFrame.totemTick.bar) then
|
||||||
|
totemPlatesTestFrame.totemTick:SetScript("OnUpdate", nil)
|
||||||
|
totemPlatesTestFrame.totemTick:Hide()
|
||||||
|
totemPlatesTestFrame.totemTick:SetParent(nil)
|
||||||
|
totemPlatesTestFrame.totemTick.id = nil
|
||||||
|
tinsert(totemPlatesTestFrame.totemTick.bar and self.barCache or self.cooldownCache, totemPlatesTestFrame.totemTick)
|
||||||
|
self.activeFrames.bars[totemPlatesTestFrame.totemTick] = nil
|
||||||
|
self.activeFrames.cooldowns[totemPlatesTestFrame.totemTick] = nil
|
||||||
|
totemPlatesTestFrame.totemTick = nil
|
||||||
|
end
|
||||||
|
|
||||||
|
local timestamp = { timeStamp = GetTime(), pulse = npcIdToTotemData[5913].pulse, id = npcIdToTotemData[5913].id }
|
||||||
|
TotemPulse:AddTimerFrame(totemPlatesTestFrame, timestamp, true)
|
||||||
|
self.testFrame = totemPlatesTestFrame.totemTick
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TotemPulse:Reset()
|
||||||
|
if self.testFrame then
|
||||||
|
self.testFrame:SetScript("OnUpdate", nil)
|
||||||
|
self.testFrame:Hide()
|
||||||
|
self.testFrame:SetParent(nil)
|
||||||
|
tinsert(self.testFrame.bar and self.barCache or self.cooldownCache, self.testFrame)
|
||||||
|
self.activeFrames.bars[self.testFrame] = nil
|
||||||
|
self.activeFrames.cooldowns[self.testFrame] = nil
|
||||||
|
self.testFrame = nil
|
||||||
|
Gladdy.modules["Totem Plates"].testFrame.totemTick = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
-- OPTIONS
|
||||||
|
|
||||||
|
---------------------------------------------------
|
||||||
|
|
||||||
|
function TotemPulse:GetOptions()
|
||||||
|
return {
|
||||||
|
headerClassicon = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Totem Pulse"],
|
||||||
|
order = 2,
|
||||||
|
},
|
||||||
|
totemPulseEnabled = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Totem Pulse Enabled"],
|
||||||
|
order = 3,
|
||||||
|
}),
|
||||||
|
group = {
|
||||||
|
type = "group",
|
||||||
|
childGroups = "tree",
|
||||||
|
name = L["Frame"],
|
||||||
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.totemPulseEnabled end,
|
||||||
|
args = {
|
||||||
|
barFrame = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Bar"],
|
||||||
|
order = 2,
|
||||||
|
args = {
|
||||||
|
headerSize = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Size"],
|
||||||
|
order = 10,
|
||||||
|
},
|
||||||
|
totemPulseBarHeight = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Bar height"],
|
||||||
|
desc = L["Height of the bar"],
|
||||||
|
order = 11,
|
||||||
|
min = 0.1,
|
||||||
|
max = 200,
|
||||||
|
step = .1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
totemPulseBarWidth = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Bar width"],
|
||||||
|
desc = L["Width of the bar"],
|
||||||
|
order = 12,
|
||||||
|
min = 0.1,
|
||||||
|
max = 600,
|
||||||
|
step = .1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
headerTexture = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Texture"],
|
||||||
|
order = 20,
|
||||||
|
},
|
||||||
|
totemPulseBarTexture = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Bar texture"],
|
||||||
|
desc = L["Texture of the bar"],
|
||||||
|
order = 21,
|
||||||
|
dialogControl = "LSM30_Statusbar",
|
||||||
|
values = AceGUIWidgetLSMlists.statusbar,
|
||||||
|
}),
|
||||||
|
totemPulseBarColor = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Bar color"],
|
||||||
|
desc = L["Color of the cast bar"],
|
||||||
|
order = 22,
|
||||||
|
hasAlpha = true,
|
||||||
|
}),
|
||||||
|
totemPulseBarBgColor = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Background color"],
|
||||||
|
desc = L["Color of the cast bar background"],
|
||||||
|
order = 23,
|
||||||
|
hasAlpha = true,
|
||||||
|
}),
|
||||||
|
headerBorder = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Border"],
|
||||||
|
order = 30,
|
||||||
|
},
|
||||||
|
totemPulseBarBorderSize = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Border size"],
|
||||||
|
order = 31,
|
||||||
|
min = 0.5,
|
||||||
|
max = Gladdy.db.castBarHeight/2,
|
||||||
|
step = 0.5,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
totemPulseBarBorderStyle = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Status Bar border"],
|
||||||
|
order = 32,
|
||||||
|
dialogControl = "LSM30_Border",
|
||||||
|
values = AceGUIWidgetLSMlists.border,
|
||||||
|
}),
|
||||||
|
totemPulseBarBorderColor = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Status Bar border color"],
|
||||||
|
order = 33,
|
||||||
|
hasAlpha = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
cooldownFrame = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Cooldown"],
|
||||||
|
order = 3,
|
||||||
|
args = {
|
||||||
|
headerSize = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame"],
|
||||||
|
order = 10,
|
||||||
|
},
|
||||||
|
totemPulseCooldownHeight = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Height"],
|
||||||
|
order = 11,
|
||||||
|
min = 0.1,
|
||||||
|
max = 200,
|
||||||
|
step = .1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
totemPulseCooldownWidth = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Width"],
|
||||||
|
order = 12,
|
||||||
|
min = 0.1,
|
||||||
|
max = 600,
|
||||||
|
step = .1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
totemPulseCooldownAlpha = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Alpha"],
|
||||||
|
order = 21,
|
||||||
|
min = 0.1,
|
||||||
|
max = 1,
|
||||||
|
step = .1,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
|
||||||
|
},
|
||||||
|
},
|
||||||
|
text = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Text"],
|
||||||
|
order = 4,
|
||||||
|
args = {
|
||||||
|
headerSize = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Text"],
|
||||||
|
order = 10,
|
||||||
|
},
|
||||||
|
totemPulseTextSize = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Size"],
|
||||||
|
order = 11,
|
||||||
|
min = 0.5,
|
||||||
|
max = 30,
|
||||||
|
step = 0.5,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
totemPulseTextFont = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Font"],
|
||||||
|
desc = L["Font of the bar"],
|
||||||
|
order = 12,
|
||||||
|
dialogControl = "LSM30_Font",
|
||||||
|
values = AceGUIWidgetLSMlists.font,
|
||||||
|
}),
|
||||||
|
totemPulseTextColor = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Font color"],
|
||||||
|
desc = L["Color of the text"],
|
||||||
|
order = 13,
|
||||||
|
hasAlpha = true,
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
customizeTotems = {
|
||||||
|
order = 50,
|
||||||
|
name = L["Customize Totems"],
|
||||||
|
type = "group",
|
||||||
|
childGroups = "tree",
|
||||||
|
disabled = function() return not Gladdy.db.totemPulseEnabled end,
|
||||||
|
args = select(1, TotemOptions())
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end
|
@ -1,4 +1,4 @@
|
|||||||
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
|
local ceil, str_gsub = ceil, string.gsub
|
||||||
local C_PvP = C_PvP
|
local C_PvP = C_PvP
|
||||||
|
|
||||||
local CreateFrame = CreateFrame
|
local CreateFrame = CreateFrame
|
||||||
@ -6,24 +6,42 @@ local GetTime = GetTime
|
|||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
local Trinket = Gladdy:NewModule("Trinket", nil, {
|
local Trinket = Gladdy:NewModule("Trinket", 80, {
|
||||||
trinketFont = "DorisPP",
|
trinketFont = "DorisPP",
|
||||||
trinketFontScale = 1,
|
trinketFontScale = 1,
|
||||||
|
trinketFontEnabled = true,
|
||||||
trinketEnabled = true,
|
trinketEnabled = true,
|
||||||
trinketSize = 60 + 20 + 1,
|
trinketSize = 60 + 20 + 1,
|
||||||
trinketWidthFactor = 0.9,
|
trinketWidthFactor = 0.9,
|
||||||
trinketPos = "RIGHT",
|
|
||||||
trinketBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
trinketBorderStyle = "Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp",
|
||||||
trinketBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
trinketBorderColor = { r = 0, g = 0, b = 0, a = 1 },
|
||||||
trinketDisableCircle = false,
|
trinketDisableCircle = false,
|
||||||
trinketCooldownAlpha = 1,
|
trinketCooldownAlpha = 1,
|
||||||
|
trinketCooldownNumberAlpha = 1,
|
||||||
|
trinketXOffset = 0,
|
||||||
|
trinketYOffset = 0,
|
||||||
|
trinketFrameStrata = "MEDIUM",
|
||||||
|
trinketFrameLevel = 5,
|
||||||
|
trinketColored = false,
|
||||||
|
trinketColoredCd = { r = 1, g = 0, b = 0, a = 1 },
|
||||||
|
trinketColoredNoCd = { r = 0, g = 1, b = 0, a = 1 },
|
||||||
|
trinketGroup = false,
|
||||||
|
trinketGroupDirection = "DOWN",
|
||||||
})
|
})
|
||||||
LibStub("AceComm-3.0"):Embed(Trinket)
|
|
||||||
|
|
||||||
function Trinket:Initialize()
|
function Trinket:Initialize()
|
||||||
self.frames = {}
|
self.frames = {}
|
||||||
|
if Gladdy.db.trinketEnabled then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
self:RegisterMessage("JOINED_ARENA")
|
function Trinket:UpdateFrameOnce()
|
||||||
|
if Gladdy.db.trinketEnabled then
|
||||||
|
self:RegisterMessage("JOINED_ARENA")
|
||||||
|
else
|
||||||
|
self:UnregisterAllMessages()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function iconTimer(self, elapsed)
|
local function iconTimer(self, elapsed)
|
||||||
@ -32,6 +50,9 @@ local function iconTimer(self, elapsed)
|
|||||||
self.active = false
|
self.active = false
|
||||||
self.cooldown:Clear()
|
self.cooldown:Clear()
|
||||||
Gladdy:SendMessage("TRINKET_READY", self.unit)
|
Gladdy:SendMessage("TRINKET_READY", self.unit)
|
||||||
|
if Gladdy.db.trinketColored then
|
||||||
|
self:SetBackdropColor(Gladdy:SetColor(Gladdy.db.trinketColoredNoCd))
|
||||||
|
end
|
||||||
else
|
else
|
||||||
self.timeLeft = self.timeLeft - elapsed
|
self.timeLeft = self.timeLeft - elapsed
|
||||||
end
|
end
|
||||||
@ -39,30 +60,23 @@ local function iconTimer(self, elapsed)
|
|||||||
local timeLeft = ceil(self.timeLeft)
|
local timeLeft = ceil(self.timeLeft)
|
||||||
|
|
||||||
if timeLeft >= 60 then
|
if timeLeft >= 60 then
|
||||||
-- more than 1 minute
|
self.cooldownFont:SetTextColor(1, 1, 0, Gladdy.db.trinketCooldownNumberAlpha)
|
||||||
self.cooldownFont:SetTextColor(1, 1, 0)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 0.15*self:GetWidth()) * Gladdy.db.trinketFontScale, "OUTLINE")
|
||||||
self.cooldownFont:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
|
elseif timeLeft < 60 and timeLeft >= 30 then
|
||||||
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 0.15*self:GetWidth()) * Gladdy.db.trinketFontScale, "OUTLINE")
|
self.cooldownFont:SetTextColor(1, 1, 0, Gladdy.db.trinketCooldownNumberAlpha)
|
||||||
elseif timeLeft < 60 and timeLeft >= 21 then
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
|
||||||
-- between 60s and 21s (green)
|
elseif timeLeft < 30 and timeLeft >= 11 then
|
||||||
self.cooldownFont:SetTextColor(0.7, 1, 0)
|
self.cooldownFont:SetTextColor(1, 0.7, 0, Gladdy.db.trinketCooldownNumberAlpha)
|
||||||
self.cooldownFont:SetText(timeLeft)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
|
||||||
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
|
elseif timeLeft <= 10 and timeLeft >= 5 then
|
||||||
-- between 10s and 5s (orange)
|
self.cooldownFont:SetTextColor(1, 0.7, 0, Gladdy.db.trinketCooldownNumberAlpha)
|
||||||
self.cooldownFont:SetTextColor(1, 0.7, 0)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
|
||||||
self.cooldownFont:SetFormattedText("%.1f", self.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
|
elseif timeLeft < 5 and timeLeft > 0 then
|
||||||
-- between 5s and 1s (red)
|
self.cooldownFont:SetTextColor(1, 0, 0, Gladdy.db.trinketCooldownNumberAlpha)
|
||||||
self.cooldownFont:SetTextColor(1, 0, 0)
|
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
|
||||||
self.cooldownFont:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
|
end
|
||||||
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
|
if Gladdy.db.trinketFontEnabled then
|
||||||
|
Gladdy:FormatTimer(self.cooldownFont, self.timeLeft, self.timeLeft < 10, true)
|
||||||
else
|
else
|
||||||
self.cooldownFont:SetText("")
|
self.cooldownFont:SetText("")
|
||||||
end
|
end
|
||||||
@ -70,8 +84,12 @@ local function iconTimer(self, elapsed)
|
|||||||
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], BackdropTemplateMixin and "BackdropTemplate")
|
||||||
|
trinket:SetBackdrop({bgFile = "Interface\\AddOns\\Gladdy\\Images\\trinket" })
|
||||||
trinket:EnableMouse(false)
|
trinket:EnableMouse(false)
|
||||||
|
trinket:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket:SetFrameLevel(Gladdy.db.trinketFrameLevel)
|
||||||
|
|
||||||
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")
|
||||||
@ -80,20 +98,27 @@ function Trinket:CreateFrame(unit)
|
|||||||
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
|
||||||
trinket.cooldown:SetHideCountdownNumbers(true)
|
trinket.cooldown:SetHideCountdownNumbers(true)
|
||||||
|
trinket.cooldown:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket.cooldown:SetFrameLevel(Gladdy.db.trinketFrameLevel + 1)
|
||||||
|
|
||||||
trinket.cooldownFrame = CreateFrame("Frame", nil, trinket)
|
trinket.cooldownFrame = CreateFrame("Frame", nil, trinket)
|
||||||
trinket.cooldownFrame:ClearAllPoints()
|
trinket.cooldownFrame:ClearAllPoints()
|
||||||
trinket.cooldownFrame:SetPoint("TOPLEFT", trinket, "TOPLEFT")
|
trinket.cooldownFrame:SetPoint("TOPLEFT", trinket, "TOPLEFT")
|
||||||
trinket.cooldownFrame:SetPoint("BOTTOMRIGHT", trinket, "BOTTOMRIGHT")
|
trinket.cooldownFrame:SetPoint("BOTTOMRIGHT", trinket, "BOTTOMRIGHT")
|
||||||
|
trinket.cooldownFrame:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket.cooldownFrame:SetFrameLevel(Gladdy.db.trinketFrameLevel + 2)
|
||||||
|
|
||||||
trinket.cooldownFont = trinket.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
trinket.cooldownFont = trinket.cooldownFrame:CreateFontString(nil, "OVERLAY")
|
||||||
trinket.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), 20, "OUTLINE")
|
trinket.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), 20, "OUTLINE")
|
||||||
--trinket.cooldownFont:SetAllPoints(trinket.cooldown)
|
--trinket.cooldownFont:SetAllPoints(trinket.cooldown)
|
||||||
trinket.cooldownFont:SetJustifyH("CENTER")
|
trinket.cooldownFont:SetJustifyH("CENTER")
|
||||||
trinket.cooldownFont:SetPoint("CENTER")
|
trinket.cooldownFont:SetPoint("CENTER")
|
||||||
|
|
||||||
trinket.borderFrame = CreateFrame("Frame", nil, trinket)
|
trinket.borderFrame = CreateFrame("Frame", nil, trinket)
|
||||||
trinket.borderFrame:SetAllPoints(trinket)
|
trinket.borderFrame:SetAllPoints(trinket)
|
||||||
|
trinket.borderFrame:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket.borderFrame:SetFrameLevel(Gladdy.db.trinketFrameLevel + 3)
|
||||||
|
|
||||||
trinket.texture.overlay = trinket.borderFrame:CreateTexture(nil, "OVERLAY")
|
trinket.texture.overlay = trinket.borderFrame:CreateTexture(nil, "OVERLAY")
|
||||||
trinket.texture.overlay:SetAllPoints(trinket)
|
trinket.texture.overlay:SetAllPoints(trinket)
|
||||||
trinket.texture.overlay:SetTexture(Gladdy.db.trinketBorderStyle)
|
trinket.texture.overlay:SetTexture(Gladdy.db.trinketBorderStyle)
|
||||||
@ -112,8 +137,29 @@ function Trinket:UpdateFrame(unit)
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if Gladdy.db.trinketColored then
|
||||||
|
if trinket.active then
|
||||||
|
trinket:SetBackdropColor(Gladdy:SetColor(Gladdy.db.trinketColoredCd))
|
||||||
|
else
|
||||||
|
trinket:SetBackdropColor(Gladdy:SetColor(Gladdy.db.trinketColoredNoCd))
|
||||||
|
end
|
||||||
|
trinket.texture:SetTexture()
|
||||||
|
else
|
||||||
|
trinket:SetBackdropColor(0,0,0,0)
|
||||||
|
trinket.texture:SetTexture("Interface\\Icons\\INV_Jewelry_TrinketPVP_02")
|
||||||
|
end
|
||||||
|
|
||||||
local width, height = Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor, Gladdy.db.trinketSize
|
local width, height = Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor, Gladdy.db.trinketSize
|
||||||
|
|
||||||
|
trinket:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket:SetFrameLevel(Gladdy.db.trinketFrameLevel)
|
||||||
|
trinket.cooldown:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket.cooldown:SetFrameLevel(Gladdy.db.trinketFrameLevel + 1)
|
||||||
|
trinket.cooldownFrame:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket.cooldownFrame:SetFrameLevel(Gladdy.db.trinketFrameLevel + 2)
|
||||||
|
trinket.borderFrame:SetFrameStrata(Gladdy.db.trinketFrameStrata)
|
||||||
|
trinket.borderFrame:SetFrameLevel(Gladdy.db.trinketFrameLevel + 3)
|
||||||
|
|
||||||
trinket:SetWidth(width)
|
trinket:SetWidth(width)
|
||||||
trinket:SetHeight(height)
|
trinket:SetHeight(height)
|
||||||
trinket.cooldown:SetWidth(width - width/16)
|
trinket.cooldown:SetWidth(width - width/16)
|
||||||
@ -127,25 +173,44 @@ function Trinket:UpdateFrame(unit)
|
|||||||
trinket.texture:SetAllPoints(trinket)
|
trinket.texture:SetAllPoints(trinket)
|
||||||
|
|
||||||
trinket.texture.overlay:SetTexture(Gladdy.db.trinketBorderStyle)
|
trinket.texture.overlay:SetTexture(Gladdy.db.trinketBorderStyle)
|
||||||
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:SetColor(Gladdy.db.trinketBorderColor))
|
||||||
|
|
||||||
trinket:ClearAllPoints()
|
Gladdy:SetPosition(trinket, unit, "trinketXOffset", "trinketYOffset", Trinket:LegacySetPosition(trinket, unit), Trinket)
|
||||||
local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
|
||||||
if (Gladdy.db.classIconPos == "LEFT") then
|
if (Gladdy.db.trinketGroup) then
|
||||||
if (Gladdy.db.trinketPos == "RIGHT") then
|
if (unit ~= "arena1") then
|
||||||
trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", margin, 0)
|
local previousUnit = "arena" .. str_gsub(unit, "arena", "") - 1
|
||||||
else
|
self.frames[unit]:ClearAllPoints()
|
||||||
trinket:SetPoint("TOPRIGHT", Gladdy.buttons[unit].classIcon, "TOPLEFT", -Gladdy.db.padding, 0)
|
if Gladdy.db.trinketGroupDirection == "RIGHT" then
|
||||||
end
|
self.frames[unit]:SetPoint("LEFT", self.frames[previousUnit], "RIGHT", 0, 0)
|
||||||
else
|
elseif Gladdy.db.trinketGroupDirection == "LEFT" then
|
||||||
if (Gladdy.db.trinketPos == "RIGHT") then
|
self.frames[unit]:SetPoint("RIGHT", self.frames[previousUnit], "LEFT", 0, 0)
|
||||||
trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].classIcon, "TOPRIGHT", Gladdy.db.padding, 0)
|
elseif Gladdy.db.trinketGroupDirection == "UP" then
|
||||||
else
|
self.frames[unit]:SetPoint("BOTTOM", self.frames[previousUnit], "TOP", 0, 0)
|
||||||
trinket:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0)
|
elseif Gladdy.db.trinketGroupDirection == "DOWN" then
|
||||||
|
self.frames[unit]:SetPoint("TOP", self.frames[previousUnit], "BOTTOM", 0, 0)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if (Gladdy.db.trinketEnabled == false) then
|
if (unit == "arena1") then
|
||||||
|
Gladdy:CreateMover(trinket,"trinketXOffset", "trinketYOffset", L["Trinket"],
|
||||||
|
{"TOPLEFT", "TOPLEFT"},
|
||||||
|
Gladdy.db.trinketSize * Gladdy.db.trinketWidthFactor,
|
||||||
|
Gladdy.db.trinketSize,
|
||||||
|
0,
|
||||||
|
0, "trinketEnabled")
|
||||||
|
end
|
||||||
|
|
||||||
|
trinket.cooldown:SetAlpha(Gladdy.db.trinketCooldownAlpha)
|
||||||
|
|
||||||
|
if Gladdy.db.trinketDisableCircle then
|
||||||
|
trinket.cooldown:Hide()
|
||||||
|
else
|
||||||
|
trinket.cooldown:Show()
|
||||||
|
end
|
||||||
|
|
||||||
|
if (not Gladdy.db.trinketEnabled) then
|
||||||
trinket:Hide()
|
trinket:Hide()
|
||||||
else
|
else
|
||||||
trinket:Show()
|
trinket:Show()
|
||||||
@ -209,6 +274,9 @@ function Trinket:Used(unit, startTime, duration)
|
|||||||
trinket.timeLeft = (startTime/1000.0 + duration/1000.0) - GetTime()
|
trinket.timeLeft = (startTime/1000.0 + duration/1000.0) - GetTime()
|
||||||
if not Gladdy.db.trinketDisableCircle then trinket.cooldown:SetCooldown(startTime/1000.0, duration/1000.0) end
|
if not Gladdy.db.trinketDisableCircle then trinket.cooldown:SetCooldown(startTime/1000.0, duration/1000.0) end
|
||||||
trinket.active = true
|
trinket.active = true
|
||||||
|
if Gladdy.db.trinketColored then
|
||||||
|
trinket:SetBackdropColor(Gladdy:SetColor(Gladdy.db.trinketColoredCd))
|
||||||
|
end
|
||||||
Gladdy:SendMessage("TRINKET_USED", unit)
|
Gladdy:SendMessage("TRINKET_USED", unit)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -226,11 +294,55 @@ function Trinket:GetOptions()
|
|||||||
desc = L["Enable trinket icon"],
|
desc = L["Enable trinket icon"],
|
||||||
order = 3,
|
order = 3,
|
||||||
}),
|
}),
|
||||||
|
trinketColored = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Colored trinket"],
|
||||||
|
desc = L["Shows a solid colored icon when off/off CD."],
|
||||||
|
order = 4,
|
||||||
|
disabled = function() return not Gladdy.db.trinketEnabled end,
|
||||||
|
}),
|
||||||
|
trinketColoredCd = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Colored trinket CD"],
|
||||||
|
desc = L["Color of the border"],
|
||||||
|
order = 5,
|
||||||
|
hasAlpha = true,
|
||||||
|
disabled = function() return not Gladdy.db.trinketEnabled end,
|
||||||
|
}),
|
||||||
|
trinketColoredNoCd = Gladdy:colorOption({
|
||||||
|
type = "color",
|
||||||
|
name = L["Colored trinket No CD"],
|
||||||
|
desc = L["Color of the border"],
|
||||||
|
order = 6,
|
||||||
|
hasAlpha = true,
|
||||||
|
disabled = function() return not Gladdy.db.trinketEnabled end,
|
||||||
|
}),
|
||||||
|
trinketGroup = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Group Class Icons"],
|
||||||
|
order = 7,
|
||||||
|
disabled = function() return not Gladdy.db.trinketEnabled end,
|
||||||
|
}),
|
||||||
|
trinketGroupDirection = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Group direction"],
|
||||||
|
order = 8,
|
||||||
|
values = {
|
||||||
|
["RIGHT"] = L["Right"],
|
||||||
|
["LEFT"] = L["Left"],
|
||||||
|
["UP"] = L["Up"],
|
||||||
|
["DOWN"] = L["Down"],
|
||||||
|
},
|
||||||
|
disabled = function()
|
||||||
|
return not Gladdy.db.trinketGroup or not Gladdy.db.trinketEnabled
|
||||||
|
end,
|
||||||
|
}),
|
||||||
group = {
|
group = {
|
||||||
type = "group",
|
type = "group",
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
name = L["Frame"],
|
name = L["Frame"],
|
||||||
order = 4,
|
order = 5,
|
||||||
|
disabled = function() return not Gladdy.db.trinketEnabled end,
|
||||||
args = {
|
args = {
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
@ -287,6 +399,15 @@ function Trinket:GetOptions()
|
|||||||
order = 8,
|
order = 8,
|
||||||
width = "full",
|
width = "full",
|
||||||
}),
|
}),
|
||||||
|
trinketCooldownNumberAlpha = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Cooldown number alpha"],
|
||||||
|
min = 0,
|
||||||
|
max = 1,
|
||||||
|
step = 0.1,
|
||||||
|
order = 9,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
font = {
|
font = {
|
||||||
@ -297,13 +418,19 @@ function Trinket:GetOptions()
|
|||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Font"],
|
name = L["Font"],
|
||||||
order = 4,
|
order = 1,
|
||||||
},
|
},
|
||||||
|
trinketFontEnabled = Gladdy:option({
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Font Enabled"],
|
||||||
|
order = 2,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
trinketFont = Gladdy:option({
|
trinketFont = Gladdy:option({
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Font"],
|
name = L["Font"],
|
||||||
desc = L["Font of the cooldown"],
|
desc = L["Font of the cooldown"],
|
||||||
order = 11,
|
order = 3,
|
||||||
dialogControl = "LSM30_Font",
|
dialogControl = "LSM30_Font",
|
||||||
values = AceGUIWidgetLSMlists.font,
|
values = AceGUIWidgetLSMlists.font,
|
||||||
}),
|
}),
|
||||||
@ -311,7 +438,7 @@ function Trinket:GetOptions()
|
|||||||
type = "range",
|
type = "range",
|
||||||
name = L["Font scale"],
|
name = L["Font scale"],
|
||||||
desc = L["Scale of the font"],
|
desc = L["Scale of the font"],
|
||||||
order = 12,
|
order = 4,
|
||||||
min = 0.1,
|
min = 0.1,
|
||||||
max = 2,
|
max = 2,
|
||||||
step = 0.1,
|
step = 0.1,
|
||||||
@ -322,22 +449,30 @@ function Trinket:GetOptions()
|
|||||||
position = {
|
position = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["Position"],
|
name = L["Position"],
|
||||||
order = 4,
|
order = 5,
|
||||||
args = {
|
args = {
|
||||||
header = {
|
header = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Icon position"],
|
name = L["Icon position"],
|
||||||
order = 4,
|
order = 4,
|
||||||
},
|
},
|
||||||
trinketPos = Gladdy:option({
|
trinketXOffset = Gladdy:option({
|
||||||
type = "select",
|
type = "range",
|
||||||
name = L["Icon position"],
|
name = L["Horizontal offset"],
|
||||||
desc = L["This changes positions of the trinket"],
|
order = 23,
|
||||||
order = 21,
|
min = -800,
|
||||||
values = {
|
max = 800,
|
||||||
["LEFT"] = L["Left"],
|
step = 0.1,
|
||||||
["RIGHT"] = L["Right"],
|
width = "full",
|
||||||
},
|
}),
|
||||||
|
trinketYOffset = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Vertical offset"],
|
||||||
|
order = 24,
|
||||||
|
min = -800,
|
||||||
|
max = 800,
|
||||||
|
step = 0.1,
|
||||||
|
width = "full",
|
||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -366,7 +501,63 @@ function Trinket:GetOptions()
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
frameStrata = {
|
||||||
|
type = "group",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 6,
|
||||||
|
args = {
|
||||||
|
headerAuraLevel = {
|
||||||
|
type = "header",
|
||||||
|
name = L["Frame Strata and Level"],
|
||||||
|
order = 1,
|
||||||
|
},
|
||||||
|
trinketFrameStrata = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Frame Strata"],
|
||||||
|
order = 2,
|
||||||
|
values = Gladdy.frameStrata,
|
||||||
|
sorting = Gladdy.frameStrataSorting,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
trinketFrameLevel = Gladdy:option({
|
||||||
|
type = "range",
|
||||||
|
name = L["Frame Level"],
|
||||||
|
min = 0,
|
||||||
|
max = 500,
|
||||||
|
step = 1,
|
||||||
|
order = 3,
|
||||||
|
width = "full",
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- LAGACY HANDLER
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
function Trinket:LegacySetPosition(trinket, unit)
|
||||||
|
if Gladdy.db.newLayout then
|
||||||
|
return Gladdy.db.newLayout
|
||||||
|
end
|
||||||
|
trinket:ClearAllPoints()
|
||||||
|
local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
|
||||||
|
if (Gladdy.db.classIconPos == "LEFT") then
|
||||||
|
if (Gladdy.db.trinketPos == "RIGHT") then
|
||||||
|
trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].healthBar, "TOPRIGHT", margin, 0)
|
||||||
|
else
|
||||||
|
trinket:SetPoint("TOPRIGHT", Gladdy.buttons[unit].classIcon, "TOPLEFT", -Gladdy.db.padding, 0)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if (Gladdy.db.trinketPos == "RIGHT") then
|
||||||
|
trinket:SetPoint("TOPLEFT", Gladdy.buttons[unit].classIcon, "TOPRIGHT", Gladdy.db.padding, 0)
|
||||||
|
else
|
||||||
|
trinket:SetPoint("TOPRIGHT", Gladdy.buttons[unit].healthBar, "TOPLEFT", -margin, 0)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
@ -1,11 +1,11 @@
|
|||||||
local str_match, tonumber, tostring = string.match, tonumber, tostring
|
local tonumber, tostring, str_format = tonumber, tostring, string.format
|
||||||
|
|
||||||
local UnitName = UnitName
|
local UnitName = UnitName
|
||||||
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
|
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
|
||||||
local LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE
|
local LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE
|
||||||
|
|
||||||
local Gladdy = LibStub("Gladdy")
|
local Gladdy = LibStub("Gladdy")
|
||||||
local L = Gladdy.L
|
|
||||||
local VersionCheck = Gladdy:NewModule("VersionCheck", 1, {
|
local VersionCheck = Gladdy:NewModule("VersionCheck", 1, {
|
||||||
})
|
})
|
||||||
LibStub("AceComm-3.0"):Embed(VersionCheck)
|
LibStub("AceComm-3.0"):Embed(VersionCheck)
|
||||||
@ -24,11 +24,11 @@ end
|
|||||||
function VersionCheck:JOINED_ARENA()
|
function VersionCheck:JOINED_ARENA()
|
||||||
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
|
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
|
||||||
if IsInRaid(LE_PARTY_CATEGORY_HOME) then
|
if IsInRaid(LE_PARTY_CATEGORY_HOME) then
|
||||||
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "RAID", self.playerName)
|
self:SendCommMessage("GladdyVCheck", str_format("%.2f", Gladdy.version_num), "RAID", self.playerName)
|
||||||
elseif IsInGroup(LE_PARTY_CATEGORY_INSTANCE) or IsInRaid(LE_PARTY_CATEGORY_INSTANCE) then
|
elseif IsInGroup(LE_PARTY_CATEGORY_INSTANCE) or IsInRaid(LE_PARTY_CATEGORY_INSTANCE) then
|
||||||
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "INSTANCE_CHAT", self.playerName)
|
self:SendCommMessage("GladdyVCheck", str_format("%.2f", Gladdy.version_num), "INSTANCE_CHAT", self.playerName)
|
||||||
elseif IsInGroup(LE_PARTY_CATEGORY_HOME) then
|
elseif IsInGroup(LE_PARTY_CATEGORY_HOME) then
|
||||||
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "PARTY", self.playerName)
|
self:SendCommMessage("GladdyVCheck", str_format("%.2f", Gladdy.version_num), "PARTY", self.playerName)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -41,9 +41,9 @@ 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_num
|
local addonVersion = str_format("%.2f", Gladdy.version_num)
|
||||||
message = tonumber(message)
|
local message_num = tonumber(message) or 0
|
||||||
if message and message <= Gladdy.version_num then
|
if message and message_num <= 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.."\"")
|
||||||
|
@ -4,54 +4,17 @@ local L = Gladdy.L
|
|||||||
local XiconProfiles = Gladdy:NewModule("XiconProfiles", nil, {
|
local XiconProfiles = Gladdy:NewModule("XiconProfiles", nil, {
|
||||||
})
|
})
|
||||||
|
|
||||||
function XiconProfiles:ApplyKlimp()
|
local function applyProfile(profileString)
|
||||||
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetKlimpProfile())
|
local deserialized = Gladdy.modules["Export Import"]:Decode(profileString)
|
||||||
if deserialized then
|
|
||||||
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
|
|
||||||
end
|
|
||||||
Gladdy:Reset()
|
|
||||||
Gladdy:HideFrame()
|
|
||||||
Gladdy:ToggleFrame(3)
|
|
||||||
end
|
|
||||||
|
|
||||||
function XiconProfiles:ApplyKnall()
|
|
||||||
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetKnallProfile())
|
|
||||||
if deserialized then
|
|
||||||
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
|
|
||||||
end
|
|
||||||
Gladdy:Reset()
|
|
||||||
Gladdy:HideFrame()
|
|
||||||
Gladdy:ToggleFrame(3)
|
|
||||||
end
|
|
||||||
|
|
||||||
function XiconProfiles:ApplyClassic()
|
|
||||||
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetClassicProfile())
|
|
||||||
if deserialized then
|
|
||||||
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
|
|
||||||
end
|
|
||||||
Gladdy:Reset()
|
|
||||||
Gladdy:HideFrame()
|
|
||||||
Gladdy:ToggleFrame(3)
|
|
||||||
end
|
|
||||||
|
|
||||||
function XiconProfiles:ApplyClassicNoPet()
|
|
||||||
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetClassicProfileNoPet())
|
|
||||||
if deserialized then
|
|
||||||
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
|
|
||||||
end
|
|
||||||
Gladdy:Reset()
|
|
||||||
Gladdy:HideFrame()
|
|
||||||
Gladdy:ToggleFrame(3)
|
|
||||||
end
|
|
||||||
|
|
||||||
function XiconProfiles:ApplyBlizz()
|
|
||||||
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetBlizzardProfile())
|
|
||||||
if deserialized then
|
if deserialized then
|
||||||
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
|
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
|
||||||
end
|
end
|
||||||
Gladdy:Reset()
|
Gladdy:Reset()
|
||||||
Gladdy:HideFrame()
|
Gladdy:HideFrame()
|
||||||
Gladdy:ToggleFrame(3)
|
Gladdy:ToggleFrame(3)
|
||||||
|
Gladdy.options.args.lock.name = Gladdy.db.locked and L["Unlock frame"] or L["Lock frame"]
|
||||||
|
Gladdy.options.args.showMover.name = Gladdy.db.showMover and L["Hide Mover"] or L["Show Mover"]
|
||||||
|
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
|
||||||
end
|
end
|
||||||
|
|
||||||
function XiconProfiles:GetOptions()
|
function XiconProfiles:GetOptions()
|
||||||
@ -65,7 +28,7 @@ function XiconProfiles:GetOptions()
|
|||||||
type = "execute",
|
type = "execute",
|
||||||
func = function()
|
func = function()
|
||||||
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
XiconProfiles:ApplyBlizz()
|
applyProfile(Gladdy:GetBlizzardProfile())
|
||||||
end,
|
end,
|
||||||
name = " ",
|
name = " ",
|
||||||
desc = "Blizzard " .. L["Profile"],
|
desc = "Blizzard " .. L["Profile"],
|
||||||
@ -84,7 +47,7 @@ function XiconProfiles:GetOptions()
|
|||||||
type = "execute",
|
type = "execute",
|
||||||
func = function()
|
func = function()
|
||||||
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
XiconProfiles:ApplyClassic()
|
applyProfile(Gladdy:GetClassicProfile())
|
||||||
end,
|
end,
|
||||||
name = " ",
|
name = " ",
|
||||||
desc = "Classic " .. L["Profile"],
|
desc = "Classic " .. L["Profile"],
|
||||||
@ -96,17 +59,17 @@ function XiconProfiles:GetOptions()
|
|||||||
},
|
},
|
||||||
headerProfileClassicNoPet = {
|
headerProfileClassicNoPet = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = "Classic " .. L["Profile"] .. " No Pet",
|
name = "Classic " .. L["Profile"] .. L[" No Pet"],
|
||||||
order = 6,
|
order = 6,
|
||||||
},
|
},
|
||||||
classicProfileNoPet = {
|
classicProfileNoPet = {
|
||||||
type = "execute",
|
type = "execute",
|
||||||
func = function()
|
func = function()
|
||||||
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
XiconProfiles:ApplyClassicNoPet()
|
applyProfile(Gladdy:GetClassicProfileNoPet())
|
||||||
end,
|
end,
|
||||||
name = " ",
|
name = " ",
|
||||||
desc = "Classic " .. L["Profile"] .. " No Pet",
|
desc = "Classic " .. L["Profile"] .. L[" No Pet"],
|
||||||
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Classic2.blp",
|
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Classic2.blp",
|
||||||
imageWidth = 350,
|
imageWidth = 350,
|
||||||
imageHeight = 175,
|
imageHeight = 175,
|
||||||
@ -122,7 +85,7 @@ function XiconProfiles:GetOptions()
|
|||||||
type = "execute",
|
type = "execute",
|
||||||
func = function()
|
func = function()
|
||||||
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
XiconProfiles:ApplyKnall()
|
applyProfile(Gladdy:GetKnallProfile())
|
||||||
end,
|
end,
|
||||||
name = " ",
|
name = " ",
|
||||||
desc = "Knall's " .. L["Profile"],
|
desc = "Knall's " .. L["Profile"],
|
||||||
@ -141,7 +104,7 @@ function XiconProfiles:GetOptions()
|
|||||||
type = "execute",
|
type = "execute",
|
||||||
func = function()
|
func = function()
|
||||||
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
XiconProfiles:ApplyKlimp()
|
applyProfile(Gladdy:GetKlimpProfile())
|
||||||
end,
|
end,
|
||||||
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Klimp1.blp",
|
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Klimp1.blp",
|
||||||
imageWidth = 350,
|
imageWidth = 350,
|
||||||
@ -151,6 +114,62 @@ function XiconProfiles:GetOptions()
|
|||||||
width = "full",
|
width = "full",
|
||||||
order = 11,
|
order = 11,
|
||||||
},
|
},
|
||||||
|
headerProfileRukk = {
|
||||||
|
type = "header",
|
||||||
|
name = "Rukk1's " .. L["Profile"],
|
||||||
|
order = 12,
|
||||||
|
},
|
||||||
|
rukkProfile = {
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
|
applyProfile(Gladdy:GetRukkProfile())
|
||||||
|
end,
|
||||||
|
name = " ",
|
||||||
|
desc = "Rukk1's " .. L["Profile"],
|
||||||
|
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Rukk1.blp",
|
||||||
|
imageWidth = 350,
|
||||||
|
imageHeight = 175,
|
||||||
|
width = "full",
|
||||||
|
order = 13,
|
||||||
|
},
|
||||||
|
headerProfileMir = {
|
||||||
|
type = "header",
|
||||||
|
name = "Mir's " .. L["Profile"],
|
||||||
|
order = 14,
|
||||||
|
},
|
||||||
|
mirProfile = {
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
|
applyProfile(Gladdy:GetMirProfile())
|
||||||
|
end,
|
||||||
|
name = " ",
|
||||||
|
desc = "Mir's " .. L["Profile"],
|
||||||
|
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Mir1.blp",
|
||||||
|
imageWidth = 350,
|
||||||
|
imageHeight = 175,
|
||||||
|
width = "full",
|
||||||
|
order = 15,
|
||||||
|
},
|
||||||
|
headerProfileMirEdited = {
|
||||||
|
type = "header",
|
||||||
|
name = "Mir's " .. L["Profile"] .. " edited",
|
||||||
|
order = 16,
|
||||||
|
},
|
||||||
|
mirProfileEdited = {
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
|
||||||
|
applyProfile(Gladdy:GetMirEditedProfile())
|
||||||
|
end,
|
||||||
|
name = " ",
|
||||||
|
desc = "Mir's " .. L["Profile"],
|
||||||
|
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Mir1_edited.blp",
|
||||||
|
imageWidth = 350,
|
||||||
|
imageHeight = 175,
|
||||||
|
width = "full",
|
||||||
|
order = 17,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
181
Options.lua
181
Options.lua
@ -1,4 +1,7 @@
|
|||||||
local type, pairs, tinsert, tsort, tostring, str_match, tonumber = type, pairs, table.insert, table.sort, tostring, string.match, tonumber
|
local type, pairs, tinsert, tsort = type, pairs, table.insert, table.sort
|
||||||
|
local tostring, str_match, tonumber, str_format = tostring, string.match, tonumber, string.format
|
||||||
|
local ceil, floor = ceil, floor
|
||||||
|
local ReloadUI = ReloadUI
|
||||||
|
|
||||||
local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame
|
local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame
|
||||||
local GetSpellInfo = GetSpellInfo
|
local GetSpellInfo = GetSpellInfo
|
||||||
@ -6,23 +9,55 @@ 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 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")
|
||||||
local L = Gladdy.L
|
local L = Gladdy.L
|
||||||
|
|
||||||
|
Gladdy.TIMER_FORMAT = { tenths = "tenths", seconds = "seconds",
|
||||||
|
values = {
|
||||||
|
["tenths"] = "xx:xx Miliseconds",
|
||||||
|
["seconds"] = "xx Seconds"
|
||||||
|
}}
|
||||||
|
|
||||||
|
function Gladdy:FormatTimer(fontString, timeLeft, milibreakpoint, showSeconds)
|
||||||
|
if timeLeft < 0 then
|
||||||
|
fontString:SetText("")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local time = timeLeft >= 0.0 and timeLeft or 0.0
|
||||||
|
if Gladdy.db.timerFormat == Gladdy.TIMER_FORMAT.tenths and milibreakpoint then
|
||||||
|
fontString:SetFormattedText("%.1f", time)
|
||||||
|
else
|
||||||
|
if time >= 60 then
|
||||||
|
if showSeconds then
|
||||||
|
fontString:SetText(floor(timeLeft / 60) .. ":" .. str_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
|
||||||
|
else
|
||||||
|
fontString:SetText(ceil(ceil(time / 60)) .. "m")
|
||||||
|
end
|
||||||
|
else
|
||||||
|
fontString:SetFormattedText("%d", ceil(time))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
Gladdy.defaults = {
|
Gladdy.defaults = {
|
||||||
profile = {
|
profile = {
|
||||||
locked = false,
|
locked = false,
|
||||||
hideBlizzard = "arena",
|
hideBlizzard = "arena",
|
||||||
x = 0,
|
x = 0,
|
||||||
y = 0,
|
y = 0,
|
||||||
growUp = false,
|
|
||||||
growDirection = "BOTTOM",
|
growDirection = "BOTTOM",
|
||||||
|
growMiddle = false,
|
||||||
frameScale = 1,
|
frameScale = 1,
|
||||||
padding = 1,
|
pixelPerfect = false,
|
||||||
barWidth = 180,
|
barWidth = 180,
|
||||||
bottomMargin = 2,
|
bottomMargin = 2,
|
||||||
statusbarBorderOffset = 6,
|
statusbarBorderOffset = 6,
|
||||||
|
timerFormat = Gladdy.TIMER_FORMAT.tenths,
|
||||||
|
backgroundColor = {r = 0, g = 0, b = 0, a = 0},
|
||||||
|
newLayout = false,
|
||||||
|
showMover = true,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,6 +105,10 @@ function Gladdy:option(params)
|
|||||||
return defaults
|
return defaults
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function Gladdy:SetColor(option)
|
||||||
|
return option.r, option.g, option.b, option.a
|
||||||
|
end
|
||||||
|
|
||||||
function Gladdy:colorOption(params)
|
function Gladdy:colorOption(params)
|
||||||
local defaults = {
|
local defaults = {
|
||||||
get = function(info)
|
get = function(info)
|
||||||
@ -175,31 +214,80 @@ end
|
|||||||
function Gladdy:SetupOptions()
|
function Gladdy:SetupOptions()
|
||||||
self.options = {
|
self.options = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = "Gladdy",
|
name = L["Gladdy"],
|
||||||
plugins = {},
|
plugins = {},
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
get = getOpt,
|
get = getOpt,
|
||||||
set = setOpt,
|
set = setOpt,
|
||||||
args = {
|
args = {
|
||||||
|
lock = {
|
||||||
|
order = 1,
|
||||||
|
width = 0.7,
|
||||||
|
name = Gladdy.db.locked and L["Unlock frame"] or L["Lock frame"],
|
||||||
|
desc = L["Toggle if frame can be moved"],
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
Gladdy.db.locked = not Gladdy.db.locked
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
self.options.args.lock.name = Gladdy.db.locked and L["Unlock frame"] or L["Lock frame"]
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
showMover = {
|
||||||
|
order = 2,
|
||||||
|
width = 0.7,
|
||||||
|
name = Gladdy.db.showMover and L["Hide Mover"] or L["Show Mover"],
|
||||||
|
desc = L["Toggle to show Mover Frames"],
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
Gladdy.db.showMover = not Gladdy.db.showMover
|
||||||
|
Gladdy:UpdateFrame()
|
||||||
|
self.options.args.showMover.name = Gladdy.db.showMover and L["Hide Mover"] or L["Show Mover"]
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
test = {
|
||||||
|
order = 2,
|
||||||
|
width = 0.7,
|
||||||
|
name = L["Test"],
|
||||||
|
desc = L["Show Test frames"],
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
Gladdy:ToggleFrame(3)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
hide = {
|
||||||
|
order = 3,
|
||||||
|
width = 0.7,
|
||||||
|
name = L["Hide"],
|
||||||
|
desc = L["Hide frames"],
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
Gladdy:Reset()
|
||||||
|
Gladdy:HideFrame()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
reload = {
|
||||||
|
order = 4,
|
||||||
|
width = 0.7,
|
||||||
|
name = L["ReloadUI"],
|
||||||
|
desc = L["Reloads the UI"],
|
||||||
|
type = "execute",
|
||||||
|
func = function()
|
||||||
|
ReloadUI()
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
version = {
|
||||||
|
order = 5,
|
||||||
|
width = 1,
|
||||||
|
type = "description",
|
||||||
|
name = " " .. Gladdy.version
|
||||||
|
},
|
||||||
general = {
|
general = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["General"],
|
name = L["General"],
|
||||||
desc = L["General settings"],
|
desc = L["General settings"],
|
||||||
childGroups = "tab",
|
childGroups = "tab",
|
||||||
order = 1,
|
order = 5,
|
||||||
args = {
|
args = {
|
||||||
locked = {
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Lock frame"],
|
|
||||||
desc = L["Toggle if frame can be moved"],
|
|
||||||
order = 1,
|
|
||||||
},
|
|
||||||
growUp = {
|
|
||||||
type = "toggle",
|
|
||||||
name = L["Grow frame upwards"],
|
|
||||||
desc = L["If enabled the frame will grow upwards instead of downwards"],
|
|
||||||
order = 2,
|
|
||||||
},
|
|
||||||
growDirection = {
|
growDirection = {
|
||||||
type = "select",
|
type = "select",
|
||||||
name = L["Grow Direction"],
|
name = L["Grow Direction"],
|
||||||
@ -224,7 +312,7 @@ function Gladdy:SetupOptions()
|
|||||||
group = {
|
group = {
|
||||||
type = "group",
|
type = "group",
|
||||||
name = L["General"],
|
name = L["General"],
|
||||||
order = 5,
|
order = 6,
|
||||||
childGroups = "tree",
|
childGroups = "tree",
|
||||||
args = {
|
args = {
|
||||||
frameGeneral = {
|
frameGeneral = {
|
||||||
@ -235,31 +323,35 @@ function Gladdy:SetupOptions()
|
|||||||
headerFrame = {
|
headerFrame = {
|
||||||
type = "header",
|
type = "header",
|
||||||
name = L["Frame General"],
|
name = L["Frame General"],
|
||||||
|
order = 2,
|
||||||
|
},
|
||||||
|
growMiddle = {
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Grow Middle"],
|
||||||
|
desc = L["Frames expand along a centric anchor"],
|
||||||
order = 3,
|
order = 3,
|
||||||
},
|
},
|
||||||
|
pixelPerfect = {
|
||||||
|
type = "toggle",
|
||||||
|
name = L["Pixel Perfect Scale"],
|
||||||
|
desc = L["Enables Pixel Perfect Scale - disables manual "].. L["Frame scale"],
|
||||||
|
order = 4,
|
||||||
|
},
|
||||||
frameScale = {
|
frameScale = {
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Frame scale"],
|
name = L["Frame scale"],
|
||||||
desc = L["Scale of the frame"],
|
desc = L["Scale of the frame"],
|
||||||
order = 4,
|
disabled = function() return Gladdy.db.pixelPerfect end,
|
||||||
|
order = 5,
|
||||||
min = .1,
|
min = .1,
|
||||||
max = 2,
|
max = 2,
|
||||||
step = .1,
|
step = .01,
|
||||||
},
|
|
||||||
padding = {
|
|
||||||
type = "range",
|
|
||||||
name = L["Frame padding"],
|
|
||||||
desc = L["Padding of the frame"],
|
|
||||||
order = 5,
|
|
||||||
min = 0,
|
|
||||||
max = 20,
|
|
||||||
step = 1,
|
|
||||||
},
|
},
|
||||||
barWidth = {
|
barWidth = {
|
||||||
type = "range",
|
type = "range",
|
||||||
name = L["Frame width"],
|
name = L["Frame width"],
|
||||||
desc = L["Width of the bars"],
|
desc = L["Width of the bars"],
|
||||||
order = 6,
|
order = 7,
|
||||||
min = 10,
|
min = 10,
|
||||||
max = 500,
|
max = 500,
|
||||||
step = 5,
|
step = 5,
|
||||||
@ -268,11 +360,20 @@ function Gladdy:SetupOptions()
|
|||||||
type = "range",
|
type = "range",
|
||||||
name = L["Margin"],
|
name = L["Margin"],
|
||||||
desc = L["Margin between each button"],
|
desc = L["Margin between each button"],
|
||||||
order = 7,
|
order = 8,
|
||||||
min = -200,
|
min = -200,
|
||||||
max = 200,
|
max = 200,
|
||||||
step = 1,
|
step = 1,
|
||||||
},
|
},
|
||||||
|
backgroundColor = {
|
||||||
|
type = "color",
|
||||||
|
name = L["Background color"],
|
||||||
|
desc = L["Background Color of the frame"],
|
||||||
|
order = 9,
|
||||||
|
hasAlpha = true,
|
||||||
|
get = getColorOpt,
|
||||||
|
set = setColorOpt,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
cooldownGeneral = {
|
cooldownGeneral = {
|
||||||
@ -343,6 +444,12 @@ function Gladdy:SetupOptions()
|
|||||||
Gladdy:UpdateFrame()
|
Gladdy:UpdateFrame()
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
|
timerFormat = Gladdy:option({
|
||||||
|
type = "select",
|
||||||
|
name = L["Timer Format"],
|
||||||
|
order = 11,
|
||||||
|
values = Gladdy.TIMER_FORMAT.values
|
||||||
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
fontGeneral = {
|
fontGeneral = {
|
||||||
@ -658,19 +765,19 @@ function Gladdy:SetupOptions()
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
local order = 2
|
local order = 6
|
||||||
for k, v in pairsByKeys(self.modules) do
|
for k, v in pairsByKeys(self.modules) do
|
||||||
self:SetupModule(k, v, order)
|
self:SetupModule(k, v, order)
|
||||||
order = order + 1
|
order = order + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local options = {
|
local options = {
|
||||||
name = "Gladdy",
|
name = L["Gladdy"],
|
||||||
type = "group",
|
type = "group",
|
||||||
args = {
|
args = {
|
||||||
load = {
|
load = {
|
||||||
name = "Load configuration",
|
name = L["Load configuration"],
|
||||||
desc = "Load configuration options",
|
desc = L["Load configuration options"],
|
||||||
type = "execute",
|
type = "execute",
|
||||||
func = function()
|
func = function()
|
||||||
HideUIPanel(InterfaceOptionsFrame)
|
HideUIPanel(InterfaceOptionsFrame)
|
||||||
@ -697,7 +804,7 @@ function Gladdy:GetAuras(auraType)
|
|||||||
ckeckAll = {
|
ckeckAll = {
|
||||||
order = 1,
|
order = 1,
|
||||||
width = "0.7",
|
width = "0.7",
|
||||||
name = "Check All",
|
name = L["Check All"],
|
||||||
type = "execute",
|
type = "execute",
|
||||||
func = function(info)
|
func = function(info)
|
||||||
if auraType == AURA_TYPE_DEBUFF then
|
if auraType == AURA_TYPE_DEBUFF then
|
||||||
@ -714,7 +821,7 @@ function Gladdy:GetAuras(auraType)
|
|||||||
uncheckAll = {
|
uncheckAll = {
|
||||||
order = 2,
|
order = 2,
|
||||||
width = "0.7",
|
width = "0.7",
|
||||||
name = "Uncheck All",
|
name = L["Uncheck All"],
|
||||||
type = "execute",
|
type = "execute",
|
||||||
func = function(info)
|
func = function(info)
|
||||||
if auraType == AURA_TYPE_DEBUFF then
|
if auraType == AURA_TYPE_DEBUFF then
|
||||||
|
174
README.md
174
README.md
@ -1,7 +1,10 @@
|
|||||||
# 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.4
|
||||||
## [v1.16-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.16-Beta/Gladdy_TBC-Classic_v1.16-Beta.zip)
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## [v2.10-Release Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v2.10-Release/Gladdy_TBC-Classic_v2.10-Release.zip)
|
||||||
|
|
||||||
###### <a target="_blank" rel="noopener noreferrer" href="https://www.paypal.me/xiconqoo/10"><img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/Paypal-Donate.png" height="30" style="margin-top:-30px;position:relative;top:20px;"></a> Please consider donating if you like my work
|
###### <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
|
||||||
|
|
||||||
@ -31,6 +34,7 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
|
|||||||
- **Range Check** (checks the range to a unit by a configurable spell)
|
- **Range Check** (checks the range to a unit by a configurable spell)
|
||||||
- **Shadowsight Timer** (shows a little movable frame with time left until Shadow Eyes spawn)
|
- **Shadowsight Timer** (shows a little movable frame with time left until Shadow Eyes spawn)
|
||||||
- **TotemPlates** (show totem icons instead of normal nameplates, compatible with **Plater, NeatPlates, KUI, ThreatPlates, ElvUI, TukUI**)
|
- **TotemPlates** (show totem icons instead of normal nameplates, compatible with **Plater, NeatPlates, KUI, ThreatPlates, ElvUI, TukUI**)
|
||||||
|
- **TotemPulse** (shows pulse on TotemPlate icon or beneath nameplate)
|
||||||
- **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)
|
||||||
- **XiconProfiles** (predefined profiles to start your configuration from)
|
- **XiconProfiles** (predefined profiles to start your configuration from)
|
||||||
@ -49,6 +53,16 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
|
|||||||
<img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample2.jpg" align="right" width="48.5%">
|
<img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample2.jpg" align="right" width="48.5%">
|
||||||
<img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample3.png" width="48.5%">
|
<img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample3.png" width="48.5%">
|
||||||
|
|
||||||
|
## Contributors
|
||||||
|
|
||||||
|
- [ManneN1](https://github.com/ManneN1)
|
||||||
|
- [AlexFolland](https://github.com/AlexFolland)
|
||||||
|
- [dfherr](https://github.com/dfherr)
|
||||||
|
- [miraage](https://github.com/miraage)
|
||||||
|
- [veiz](https://github.com/veiz)
|
||||||
|
|
||||||
|
Thank you!
|
||||||
|
|
||||||
## Special Thanks
|
## Special Thanks
|
||||||
|
|
||||||
- **miraage** - the origininal author of Gladdy! Your work set the foundation for this edit. Thanks!
|
- **miraage** - the origininal author of Gladdy! Your work set the foundation for this edit. Thanks!
|
||||||
@ -59,9 +73,165 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
|
|||||||
- **Klimp** (thanks for all the suggestions and active feedback)
|
- **Klimp** (thanks for all the suggestions and active feedback)
|
||||||
- **the whole TBC addons 2.4.3 discord** (thanks for the support and great community, especially the MVPs)
|
- **the whole TBC addons 2.4.3 discord** (thanks for the support and great community, especially the MVPs)
|
||||||
- **Hydra** (thanks for constructive feedback and suggestions)
|
- **Hydra** (thanks for constructive feedback and suggestions)
|
||||||
|
- **Xyz** (thanks for suggestions)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
### Changes
|
### Changes
|
||||||
|
|
||||||
|
### v2.10-Release
|
||||||
|
|
||||||
|
- **Totems**:
|
||||||
|
- added new module **TotemPulse** (sorry Shamans)
|
||||||
|
- displays pulse ticks on all totems that have a pulse mechanic (e.g. tremor totem)
|
||||||
|
- either cooldown or bar style
|
||||||
|
- attaches to TotemPlates if enabled (con be configured individually by totem)
|
||||||
|
- completely hide totem nameplate option added
|
||||||
|
- added a dummy totemplate in config mode
|
||||||
|
- totem detection is completely localization independent now
|
||||||
|
- **Cooldowns**:
|
||||||
|
- completely refactored to fix general bugs
|
||||||
|
- can now be ordered individually
|
||||||
|
- some cooldown tracking improved for units coming out of stealth (e.g. perception, sprint, shadowstep)
|
||||||
|
- **Custom Text Tags**
|
||||||
|
- PowerBar and HealthBar can now have custom tags. Check it out
|
||||||
|
- also the texts can be moved to achieve a Blizzlike style with names above HealthBar
|
||||||
|
- general improvements to spec detection
|
||||||
|
- no more restoration warlocks :D
|
||||||
|
- tree of life spec detection should work now
|
||||||
|
- fix Announcements
|
||||||
|
- added grouping option for Auras (+ Interrupts) in detached mode, ClassIcon, Cooldowns, Trinket, Racial
|
||||||
|
- added a "Grow Middle" option, which aligns the gladdy frames on a centric point
|
||||||
|
- added frFR localization by Macumba
|
||||||
|
- added Flat statusbar texture
|
||||||
|
- added some auras (e.g. disarm)
|
||||||
|
- added disarm DRs
|
||||||
|
- improved some class icons
|
||||||
|
- added font OUTLINE option for Health-/Power-/CastBar texts
|
||||||
|
- fixed health bug since 2.5.4
|
||||||
|
- updated Mir Profile
|
||||||
|
|
||||||
|
### v2.00-Release
|
||||||
|
|
||||||
|
This is a packed release with new features and bugfixes. Most importantly, positioning of all elements has been redone with movable frames.
|
||||||
|
Thank you for the great feedback and active contribution.
|
||||||
|
|
||||||
|
***Attention: Once you install this version it will drastically change your current profile! You can't go back to an earlier version. Either back up your WTF or export your Profile before updating!***
|
||||||
|
|
||||||
|
**Here is a list of all changes:**
|
||||||
|
- **major release version set to v2**
|
||||||
|
- this will mean, that export strings will still be backwards compatible, but not forward (Gladdy v2.x String can't be imported into Gladdy v1.x but vice versa)
|
||||||
|
- **big overhaul of positioning elements added! All elements besides HP and PowerBar can be moved separately**
|
||||||
|
- added Mover Frames for Auras, Interrupts, (De)Buffs, CastBar, ClassIcon, CombatIndicator, Cooldowns, DRs, Pets, Racial, Trinket
|
||||||
|
- this will hopefully make configuration a lot easier
|
||||||
|
- all visible elements' FrameStrata and FrameLevel can be configured (overlap frames how you want it)
|
||||||
|
- **SpecDetection:**
|
||||||
|
- fixed spec detection for Paladins
|
||||||
|
- added following spells for better spec detection:
|
||||||
|
- Expose Weakness (Survival Hunter)
|
||||||
|
- Slow (Arcane Mage)
|
||||||
|
- Improved Blink (Arcane Mage)
|
||||||
|
- Vindication (Retribution Paladin)
|
||||||
|
- Holy Shield (Protection Paladin)
|
||||||
|
- Vampiric Embrace (Shadow Priest)
|
||||||
|
- Blade Flurry (Combat Rogue)
|
||||||
|
- Unleashed Rage (Enhancement Shaman)
|
||||||
|
- Flurry (Enhancement Shaman)
|
||||||
|
- Shamanistic Rage (Enhancement Shaman)
|
||||||
|
- Healing Way (Restoration Shaman)
|
||||||
|
- Totem of Wrath (Elemental Shaman)
|
||||||
|
- Dark Pact (Affliction Warlock)
|
||||||
|
- Conflagrate (Destruction Warlock)
|
||||||
|
- Shield Slam (Protection Warrior)
|
||||||
|
- **Cooldowns:**
|
||||||
|
- added Fear Ward and Fear Ward Cooldown Detection in case it was used before arena
|
||||||
|
- added following cooldowns:
|
||||||
|
- Scare Beast (Hunter)
|
||||||
|
- Feign Death (Hunter)
|
||||||
|
- Viper Sting (Hunter)
|
||||||
|
- Flare (Hunter)
|
||||||
|
- Fear Ward (Priest)
|
||||||
|
- Shadow Word: Death (Priest)
|
||||||
|
- Evocation (Mage)
|
||||||
|
- Grounding Totem (Shaman)
|
||||||
|
- Spell Lock (Warlock)
|
||||||
|
- Devour Magic (Warlock)
|
||||||
|
- Intercept (Warrior)
|
||||||
|
- **Auras/Interrupts:**
|
||||||
|
- can now be detached from ClassIcon and positioned/scaled anywhere separately
|
||||||
|
- added Auras:
|
||||||
|
- Scare Beast (Hunter)
|
||||||
|
- Fear Ward (Priest)
|
||||||
|
- **Shadowsight:**
|
||||||
|
- reset timer when buff was taken
|
||||||
|
- add a configurable 2nd timer or show one timer with the closest CD
|
||||||
|
- **CastBar Icon can be enabled/disabled**
|
||||||
|
- **Trinket solid color option added**
|
||||||
|
- color for Trinket on/off CD can be configured (red/green by default)
|
||||||
|
- **fixed some DR-categories** (Hibernate / Chastice / Dragonsbreath / ImpConcussiveShot / Counterattack)
|
||||||
|
- **Pixel Perfect option added** (makes your Gladdy Frames pixel perfect - no more weird scaling interferences)
|
||||||
|
- **Pets can be grouped** (not perfect yet, but a first step)
|
||||||
|
- **added DR-Level Text** (thanks https://github.com/ManneN1)
|
||||||
|
- **added zhCN Locale** (thanks https://github.com/veiz)
|
||||||
|
- **ClassIcon can be disabled**
|
||||||
|
- **add interrupt announcement**
|
||||||
|
- **detect SpellLock and Devour Magic cooldowns properly**
|
||||||
|
- **minor fixes:**
|
||||||
|
- fixed reloading during arena to properly show all frames
|
||||||
|
- fix grow up positioning
|
||||||
|
|
||||||
|
### v1.22-Release
|
||||||
|
- fixed import for some localizations not working
|
||||||
|
- added cooldown number alpha configurations for Auras, BuffsDebuffs, Cooldowns, Diminishings, Racial & Trinket
|
||||||
|
- grounding totem effect fix
|
||||||
|
- fixed some buffs/debuffs not being present in BuffsDebuffs
|
||||||
|
|
||||||
|
### v1.21-Release
|
||||||
|
- fixed error when hiding blizzard frames ArenaEnemyFrames related to ElvUI
|
||||||
|
- added Pummel cooldown
|
||||||
|
|
||||||
|
### v1.20-Release
|
||||||
|
- configurable DR duration
|
||||||
|
- scale in 0.01 percent steps
|
||||||
|
- added Net-o-Matic, Nigh Invulnerablility Shield, Nigh Invulnerablility Backfire & Flee (Skull of Impending Doom) to Auras
|
||||||
|
- added Mangle, Chastise, Avenging Wrath, Rapid Fire to BuffsDebuffs
|
||||||
|
- improved testmode to only activate Auras/Buffs/Debuffs/Dr's that are actually enabled
|
||||||
|
- added Mir's profile to XiconProfiles
|
||||||
|
- added zhTW localization
|
||||||
|
- added buttons for Test, Hide & Reload in the config
|
||||||
|
- added version in config
|
||||||
|
- ArenaCountdown upgrade
|
||||||
|
- Repentance, Freezing Trap & Wyvern Sting are now disorients
|
||||||
|
- import string now ignores errors on deleted options
|
||||||
|
- added (un)checkAll button in DR-Categories in Diminishing Module
|
||||||
|
- totemplates fix option to alter all colors/alphas
|
||||||
|
- hide blizzard arena pets as well
|
||||||
|
- fix shadowsight timer showing when not in arena or testmode
|
||||||
|
- some minor refactoring / optimization
|
||||||
|
|
||||||
|
### v1.19-Beta
|
||||||
|
- fix gladdy frames not showing v2
|
||||||
|
- minor bug fixes
|
||||||
|
|
||||||
|
### v1.18-Beta
|
||||||
|
- castbar font now working properly
|
||||||
|
|
||||||
|
### v1.17-Beta
|
||||||
|
- option TimerFormat added (seconds or seconds + milliseconds) (General > Cooldown General > Timer Format)
|
||||||
|
- hide blizzard arena frames without cvars
|
||||||
|
- fix Gladdy bugging out on arena join when in combat
|
||||||
|
- fix some TotemPlates issues
|
||||||
|
- fix Feign Death causing to reset DR and Aura tracking
|
||||||
|
- ArenaX option in Healthbar module now only shows the number
|
||||||
|
- add background for all frames (General > Frame General > Background Color)
|
||||||
|
- add evasion and banish to Aura
|
||||||
|
- add MSBT to Announcement module
|
||||||
|
- Shadowsight timer can be locked now
|
||||||
|
- add "All" modifier to Clicks module
|
||||||
|
- updated testmode for BuffsDebuffs (show only from enabled set)
|
||||||
|
- updated Klimp's profile
|
||||||
|
- added a new Profile in XiconProfiles -> Rukk1
|
||||||
|
|
||||||
### v1.16-Beta
|
### v1.16-Beta
|
||||||
- unit gray in stealth when rangecheck module disabled
|
- unit gray in stealth when rangecheck module disabled
|
||||||
|
|
||||||
|
144
Util.lua
Normal file
144
Util.lua
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
local pairs, ipairs = pairs, ipairs
|
||||||
|
local floor = math.floor
|
||||||
|
local str_find, str_gsub, str_sub, tinsert = string.find, string.gsub, string.sub, table.insert
|
||||||
|
local Gladdy = LibStub("Gladdy")
|
||||||
|
local L = Gladdy.L
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
-- TAGS
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
local tags = {
|
||||||
|
["current"] = true,
|
||||||
|
["max"] = true,
|
||||||
|
["percent"] = true,
|
||||||
|
["race"] = "race",
|
||||||
|
["class"] = "class",
|
||||||
|
["arena"] = true,
|
||||||
|
["name"] = "name",
|
||||||
|
["status"] = true,
|
||||||
|
["spec"] = "spec",
|
||||||
|
}
|
||||||
|
|
||||||
|
local function str_extract(s, pattern)
|
||||||
|
local t = {} -- table to store the indices
|
||||||
|
local i, j = 0,0
|
||||||
|
while true do
|
||||||
|
i, j = str_find(s, pattern, i+1) -- find 'next' occurrence
|
||||||
|
if i == nil then break end
|
||||||
|
tinsert(t, str_sub(s, i, j))
|
||||||
|
end
|
||||||
|
return t
|
||||||
|
end
|
||||||
|
|
||||||
|
--TODO optimize this function as it's being called often!
|
||||||
|
local function getTagText(unit, tag, current, max, status)
|
||||||
|
local button = Gladdy.buttons[unit]
|
||||||
|
if not button then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if str_find(tag, "percent") then
|
||||||
|
return current and max and floor(current * 100 / max) .. "%%" or ""
|
||||||
|
elseif str_find(tag, "current") then
|
||||||
|
return current and max > 999 and ("%.1fk"):format(current / 1000) or current or ""
|
||||||
|
elseif str_find(tag, "max") then
|
||||||
|
return max and max > 999 and ("%.1fk"):format(max / 1000) or max or ""
|
||||||
|
elseif str_find(tag, "status") then
|
||||||
|
if str_find(tag, "%|") and status == nil then
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
return status or ""
|
||||||
|
end
|
||||||
|
elseif str_find(tag, "name") then
|
||||||
|
return button.name or ""
|
||||||
|
elseif str_find(tag, "class") then
|
||||||
|
return button.classLoc or ""
|
||||||
|
elseif str_find(tag, "race") then
|
||||||
|
return button.raceLoc or ""
|
||||||
|
elseif str_find(tag, "arena") then
|
||||||
|
local str,found = str_gsub(unit, "arena", "")
|
||||||
|
return found == 1 and str or ""
|
||||||
|
elseif str_find(tag, "spec") then
|
||||||
|
if str_find(tag, "%|") and button.spec == nil then
|
||||||
|
return nil
|
||||||
|
else
|
||||||
|
return button.spec or ""
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Gladdy:SetTag(unit, tagOption, current, max, status)
|
||||||
|
local button = self.buttons[unit]
|
||||||
|
if not button then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local returnStr = tagOption
|
||||||
|
|
||||||
|
local t = str_extract(returnStr, "%[[^%[].-%]")
|
||||||
|
for _, tag in ipairs(t) do
|
||||||
|
local replace
|
||||||
|
if str_find(tag, "|") then -- or operator
|
||||||
|
local indicators = str_extract(tag, "[%[|%|]%a+[%||%]]")
|
||||||
|
local replaces = {}
|
||||||
|
for _, indicator in ipairs(indicators) do
|
||||||
|
tinsert(replaces, getTagText(unit, indicator, current, max, status))
|
||||||
|
end
|
||||||
|
replace = replaces[#replaces]
|
||||||
|
else
|
||||||
|
replace = getTagText(unit, tag, current, max, status)
|
||||||
|
end
|
||||||
|
|
||||||
|
if replace then
|
||||||
|
local find = str_gsub(tag, "%[", "%%[")
|
||||||
|
find = str_gsub(find, "%]", "%%]")
|
||||||
|
find = str_gsub(find, "%|", "%%|")
|
||||||
|
returnStr = str_gsub(returnStr, find, replace)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return returnStr
|
||||||
|
end
|
||||||
|
|
||||||
|
function Gladdy:GetTagOption(name, order, enabledOption, func, toggle)
|
||||||
|
if toggle then
|
||||||
|
return func({
|
||||||
|
type = "toggle",
|
||||||
|
name = name,
|
||||||
|
order = order,
|
||||||
|
width = "full",
|
||||||
|
desc = L["Custom Tags:\n"..
|
||||||
|
"\n|cff1ac742[current]|r - Shows current\n" ..
|
||||||
|
"\n|cff1ac742[max]|r - Shows max\n" ..
|
||||||
|
"\n|cff1ac742[percent]|r - Shows percent\n" ..
|
||||||
|
"\n|cff1ac742[name]|r - Shows name\n" ..
|
||||||
|
"\n|cff1ac742[arena]|r - Shows arena number\n" ..
|
||||||
|
"\n|cff1ac742[status]|r - Shows status (eg DEATH)\n" ..
|
||||||
|
"\n|cff1ac742[race]|r - Shows race\n" ..
|
||||||
|
"\n|cff1ac742[class]|r - Shows class\n" ..
|
||||||
|
"\n|cff1ac742[spec]|r - Shows spec\n\n" ..
|
||||||
|
"Can be combined with OR operator like |cff1ac742[percent|status]|r. The last valid option will be used.\n"],
|
||||||
|
})
|
||||||
|
else
|
||||||
|
return func({
|
||||||
|
type = "input",
|
||||||
|
name = name,
|
||||||
|
order = order,
|
||||||
|
width = "full",
|
||||||
|
disabled = function() return not Gladdy.db[enabledOption] end,
|
||||||
|
desc = L["Custom Tags:\n"..
|
||||||
|
"\n|cff1ac742[current]|r - Shows current\n" ..
|
||||||
|
"\n|cff1ac742[max]|r - Shows max\n" ..
|
||||||
|
"\n|cff1ac742[percent]|r - Shows percent\n" ..
|
||||||
|
"\n|cff1ac742[name]|r - Shows name\n" ..
|
||||||
|
"\n|cff1ac742[arena]|r - Shows arena number\n" ..
|
||||||
|
"\n|cff1ac742[status]|r - Shows status (eg DEATH)\n" ..
|
||||||
|
"\n|cff1ac742[race]|r - Shows race\n" ..
|
||||||
|
"\n|cff1ac742[class]|r - Shows class\n" ..
|
||||||
|
"\n|cff1ac742[spec]|r - Shows spec\n\n" ..
|
||||||
|
"Can be combined with OR operator like |cff1ac742[percent|status]|r. The last valid option will be used.\n"],
|
||||||
|
})
|
||||||
|
end
|
||||||
|
end
|
Reference in New Issue
Block a user