Compare commits

...

140 Commits

Author SHA1 Message Date
2c845547a4 Merge branch 'release/v1.20-Release' into main 2021-09-15 00:55:29 +02:00
b861091d44 added 1.20 changelist 2021-09-15 00:55:06 +02:00
c3a1555932 bump version 2021-09-15 00:42:49 +02:00
f36883df31 add version in options 2021-09-15 00:42:36 +02:00
f9b1ac9c51 possible localization on DR-Categories 2021-09-15 00:29:12 +02:00
b6d243b8c0 fix GetItemInfo item not loaded from server yet... fallback to constant 2021-09-15 00:24:36 +02:00
ce5c8fc5a0 added zhTW locale 2021-09-14 23:55:27 +02:00
60c823fa07 LSM replace 2021-09-14 23:55:17 +02:00
f1e1ee4e0b added Mir's profile 2021-09-14 23:53:12 +02:00
d2884e777a - Repentance, Freezing Trap & Wyvern Sting are now disorients
- import string now ignores errors on deleted options
2021-09-14 23:52:13 +02:00
b651eb39ce add reload ui button 2021-09-03 02:01:17 +02:00
73b01c28d7 add duration for grounding effect (still needs testing) 2021-09-03 01:57:04 +02:00
dd75f267f4 add Test & Hide Button 2021-09-03 01:56:38 +02:00
7108598603 update Klimp profile 2021-09-03 01:56:10 +02:00
6b4c35c66b error handling for font/statusbar/border not found added 2021-09-03 01:42:35 +02:00
75d4dfe9fe adjust countdown numbers 2021-09-03 01:39:21 +02:00
776464f551 add Aura Flee - Skull of Impending Doom 2021-09-03 01:38:46 +02:00
dd8a35857d shadowsight register AURA_GAIN 2021-09-01 08:16:37 +02:00
1c93e4ce4d cleanup 2021-08-19 18:58:17 +02:00
e2d0af1e2b fix paladin spec detect to discipline 2021-08-19 18:58:05 +02:00
9e81455ec5 fix SpotEnemy 2021-08-19 18:57:27 +02:00
fad4321bf6 add mangle 2021-08-19 18:56:52 +02:00
9c8c78bb83 DRData update add Nature's Grasp and Pyroclasm 2021-08-10 13:19:52 +02:00
bb7b820cbb add Net-o-Matic, Nigh Invulnerablility Shield & Nigh Invulnerablility Backfire to Auras 2021-08-10 13:19:17 +02:00
890cf80531 LibClassAuras update 2021-08-10 13:18:25 +02:00
f7f703d33a Auras description 2021-08-10 13:18:02 +02:00
a7cdacb55d ArenaCountDown update 2021-08-10 13:17:46 +02:00
237130e3ce announcement show MSBT option only when MSBT is loaded 2021-07-29 17:27:37 +02:00
2c73188e15 cleanup 2021-07-29 17:24:33 +02:00
5da6d1d7c9 added (un)checkAll button in DR-Categories in Diminishing Module 2021-07-29 17:23:09 +02:00
8a17592842 optimize and randomize DR and Aura test mode 2021-07-29 17:11:54 +02:00
51cd2b7311 clean up 2021-07-29 15:53:34 +02:00
720e5b63ec totemplates fix option to alter all colors/alphas 2021-07-29 15:53:13 +02:00
74753e327c testmode random Auras + Interrupts only with enabled Auras + Interrupts 2021-07-29 15:13:19 +02:00
0d5b5644a9 testmode DR only with enabled DRs 2021-07-29 14:19:13 +02:00
d53f89c6d4 hide blizzard arena pets as well 2021-07-29 14:06:15 +02:00
79371b72b0 fix shadowsight timer showing when not in arena or testmode 2021-07-29 14:05:37 +02:00
b73bc33630 scale in 0.01 percent steps 2021-07-29 13:34:10 +02:00
4c239cd599 configurable DR duration 2021-07-29 13:33:43 +02:00
6de5a60309 Merge tag 'v1.19-hotfix' into develop
v1.19-hotfix
2021-07-27 16:55:37 +02:00
31360bf695 Merge branch 'hotfix/v1.19-hotfix' into main 2021-07-27 16:55:27 +02:00
599fde6581 minor fix healthbar 2021-07-27 16:55:00 +02:00
382e5c3948 Merge tag 'v1.19' into develop
v1.19
2021-07-27 16:36:02 +02:00
582ca88b59 Merge branch 'release/v1.19' into main 2021-07-27 16:35:55 +02:00
aa53bfc241 bump version + readme 2021-07-27 16:35:23 +02:00
bd2c15088d fix range check Warrior intercept 2021-07-27 16:33:04 +02:00
d2da0a22ae Revert "fix entering arena in combat bug"
This reverts commit 755a3e52b5.
2021-07-27 16:32:37 +02:00
915c213eb5 Merge tag 'v1.18' into develop
v1.18-Beta
2021-07-26 18:20:04 +02:00
0cfba040f1 Merge branch 'hotfix/v1.18' into main 2021-07-26 18:19:56 +02:00
2a5a0fa394 bump version + readme 2021-07-26 18:19:29 +02:00
a1387f8ecd castbarfont hotfix 2021-07-26 18:17:37 +02:00
e7a83d61f3 Merge tag 'v1.17' into develop
v1.17-Beta
2021-07-26 17:47:31 +02:00
90b146e433 Merge branch 'release/v1.17' into main 2021-07-26 17:47:22 +02:00
61f79adda2 bump version and update readme 2021-07-26 17:46:32 +02:00
9b8c6a1426 allow import of values not in db... will be ignored anyways 2021-07-26 17:34:36 +02:00
d44ac29f43 cleanup 2021-07-26 17:32:25 +02:00
751e84c61d added single background for all frames 2021-07-26 17:30:46 +02:00
f92b3a4964 fix taint (Gladdy show in combat) 2021-07-26 17:01:04 +02:00
c2fec39202 update Klimp BLP 2021-07-26 14:55:38 +02:00
9f1bda3e80 ArenaX to X 2021-07-26 14:55:23 +02:00
fdeea258be Rukk1 profile added to XiconProfiles 2021-07-26 14:35:46 +02:00
960a98d244 Rukk1 profile added to XiconProfiles 2021-07-26 14:35:37 +02:00
82ec1460f8 fix feign death 2021-07-26 14:35:20 +02:00
23b9e2dfae buffs debuffs updated testmode - only show auras that are enabled 2021-07-26 14:35:01 +02:00
755a3e52b5 fix entering arena in combat bug 2021-07-26 12:58:40 +02:00
5767bc7ae3 updated klimp profile + added rukk1 profile 2021-07-26 12:51:23 +02:00
b1070d070a added banish to auras 2021-07-26 12:50:52 +02:00
5f4ab71a5a enhanced totemplates functionality 2021-07-26 11:46:30 +02:00
c43228f0b9 hide blizzard frames 2021-07-26 11:30:24 +02:00
b54ed1cda1 add evasion to auras 2021-07-26 11:28:57 +02:00
19d0460501 add all modifier to clicks module 2021-07-26 11:28:41 +02:00
cb6e519afe add MSBT to Announcements 2021-07-26 11:28:04 +02:00
d9f0c1491a option show seconds or milliseconds added 2021-07-26 11:27:32 +02:00
17a983fad6 Shadowshight timer lockable 2021-07-26 11:20:54 +02:00
4e0ea70bfa Merge tag 'ci-disable' into develop
ci-disable hotfix
2021-06-22 12:19:19 +02:00
da54c659bc Merge branch 'hotfix/ci-disable' into main 2021-06-22 12:19:11 +02:00
6be94215b9 CI disable hotfix 2021-06-22 12:18:45 +02:00
964a4b4f88 Merge tag 'v1.16' into develop
v1.16
2021-06-22 12:08:00 +02:00
03a55395b8 Merge branch 'release/v1.16' into main 2021-06-22 12:07:50 +02:00
8409ac1b96 bump version + readme 2021-06-22 12:07:15 +02:00
d653c76e37 stealth unit when rangecheck disabled 2021-06-22 12:04:59 +02:00
984c22a861 Merge tag 'entangling-roots-ng' into develop
v1.15-Beta hotfix nature's grasp
2021-06-20 14:03:06 +02:00
ede4b93ad8 Merge branch 'hotfix/entangling-roots-ng' into main 2021-06-20 14:02:49 +02:00
ca211e047f bump version and readme 2021-06-20 14:02:26 +02:00
8121cf3c6c nature's grasp added to auras 2021-06-20 14:01:03 +02:00
5b348b760c Merge tag 'button-fix-up' into develop
v1.14-Beta hotfix
2021-06-20 13:16:05 +02:00
6a66bcb0ca Merge branch 'hotfix/button-fix-up' into main 2021-06-20 13:15:51 +02:00
50716f3f63 fix button secure grow direction up 2021-06-20 13:15:27 +02:00
9dab6b7299 Merge tag 'miraage-mention' into develop
miraage readme
2021-06-20 11:12:43 +02:00
43bd5af2cc Merge branch 'hotfix/miraage-mention' into main 2021-06-20 11:12:32 +02:00
9780922fec readme - miraage 2021-06-20 11:12:06 +02:00
2c21a6e770 Merge tag 'v1.13-Beta' into develop
v1.13-Beta
2021-06-20 02:57:50 +02:00
88b769c12d Merge branch 'release/v1.13-Beta' into main 2021-06-20 02:57:40 +02:00
4ff3ed487b bump version and edit readme 2021-06-20 02:57:04 +02:00
92dc847909 show xiconprofiles on first login 2021-06-20 02:46:52 +02:00
fa01d38989 add interrupts to auras 2021-06-20 02:30:28 +02:00
326af8e796 fix cooldowns trigger 2021-06-20 02:30:03 +02:00
af17c7e1b9 fix clicks 2021-06-20 02:27:27 +02:00
4148e775a9 shadowsight announce option added 2021-06-20 01:00:55 +02:00
0d7bd3c688 clicks fix 2021-06-20 00:55:06 +02:00
2988177128 adding cooldowns Swiftmend & Berserker Rage 2021-06-20 00:54:31 +02:00
b17e58f558 pets mouseover macros enabled 2021-06-20 00:50:06 +02:00
9edb632efc compressed blps 2021-06-17 19:15:24 +02:00
56de506ef1 buffs debuffs force test auras 2021-06-17 16:59:22 +02:00
6c471a0fad RangeCheck added ENEMY_SPOTTED 2021-06-17 16:43:28 +02:00
6f5cb0498b DR bigger icons possible 2021-06-17 16:40:19 +02:00
df2ff4c9e7 castbar arena4-5 2021-06-17 16:40:02 +02:00
b03b05b2bb classic profile no pet added 2021-06-17 16:39:40 +02:00
09a07c7201 safe unit death on UNIT_HEALTH events 2021-06-16 14:34:17 +02:00
152573124f reset powerType on Gladdy:Reset 2021-06-16 14:33:48 +02:00
3378cfcd0b import string classic profile updated 2021-06-16 14:12:49 +02:00
53228a0e39 leader highlight commented out 2021-06-16 14:12:11 +02:00
cbf8c1a13b totem plates fix UpdateFrameOnce 2021-06-16 14:11:34 +02:00
993de572cd range check fix class colors 2021-06-16 14:10:49 +02:00
f0c0286708 cooldowns enable/disable in testmode 2021-06-16 14:10:09 +02:00
20a654c810 Merge tag 'classic-profile' into develop
v1.12-Beta
2021-06-16 10:07:15 +02:00
c5f2ee1eff Merge branch 'hotfix/classic-profile' into main 2021-06-16 10:07:06 +02:00
4eda8cea8f bump version 2021-06-16 10:06:33 +02:00
fb953530b6 fix classic profile 2021-06-16 10:05:33 +02:00
bc1a617b6e Clicks description example for macro 2021-06-16 02:08:00 +02:00
505154e699 adding Clicks module again 2021-06-16 01:14:11 +02:00
5776dde270 fix aura UpdateFrame 2021-06-16 00:14:18 +02:00
0b9c33b867 mouseover macros now possible 2021-06-15 17:10:31 +02:00
d7f31dbdab Merge branch 'feature/totemplates-compatibility' into develop 2021-06-15 17:09:51 +02:00
b363df73a3 TotemPlates compatible with:
- Plater
- KUI Nameplates
- NeatPlates
- TidyPlates ThreatPlates
- TukUI
- ElvUI
2021-06-15 17:09:25 +02:00
54e0aa4a47 Auras sorting by name and alt textures 2021-06-15 12:20:33 +02:00
c970fe576f Auras add altName, altTexture and
- Blackout Stun
- Charge Stun
- Intercept Stun
- Improved Hamstring
- Mace Stun
- Storm Herald Stun
- Shadowsight Buff
2021-06-15 12:19:55 +02:00
2be103fb88 readme 2021-06-15 11:01:15 +02:00
4cd4ff982c Merge tag 'totemplates-fix' into develop
v1.11-Beta
2021-06-15 09:11:04 +02:00
5cad55e91a honorable mentions 2021-06-15 09:07:23 +02:00
5972ef8c05 cleanup 2021-06-15 09:06:50 +02:00
779e81727c performance tweaks 2021-06-15 09:06:40 +02:00
0c4409fe16 hide blizzard 2021-06-15 09:06:32 +02:00
85f63e590b fix aura border hide in testmode 2021-06-15 09:06:21 +02:00
da5a8ea67d powerbar enable/disable 2021-06-15 09:06:05 +02:00
4f370f4e63 send version check by group type 2021-06-15 09:05:50 +02:00
06884ae043 shadowsight timer added 2021-06-15 09:05:32 +02:00
7b0bf921c4 Range Check added 2021-06-15 09:05:20 +02:00
a83c1ad0c2 castbar enable/disable 2021-06-15 09:05:07 +02:00
8ba1f84047 Merge tag 'v1.10-Beta' into develop
v1.10-Beta
2021-05-24 13:12:19 +02:00
60 changed files with 4491 additions and 1660 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@ BuffLib
Ace-Libs
Images_Raw
Gladdy_old
Gladdy_TW

31
Bindings.xml Normal file
View File

@ -0,0 +1,31 @@
<Bindings>
<Binding name="GLADDYBUTTON1_LEFT" header="GLADDY" Category="Gladdy"/>
<Binding name="GLADDYBUTTON2_LEFT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON3_LEFT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON4_LEFT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON5_LEFT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON1_RIGHT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON2_RIGHT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON3_RIGHT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON4_RIGHT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON5_RIGHT" Category="Gladdy"/>
<Binding name="GLADDYBUTTON1_MIDDLE" Category="Gladdy"/>
<Binding name="GLADDYBUTTON2_MIDDLE" Category="Gladdy"/>
<Binding name="GLADDYBUTTON3_MIDDLE" Category="Gladdy"/>
<Binding name="GLADDYBUTTON4_MIDDLE" Category="Gladdy"/>
<Binding name="GLADDYBUTTON5_MIDDLE" Category="Gladdy"/>
<Binding name="GLADDYBUTTON1_BUTTON4" Category="Gladdy"/>
<Binding name="GLADDYBUTTON2_BUTTON4" Category="Gladdy"/>
<Binding name="GLADDYBUTTON3_BUTTON4" Category="Gladdy"/>
<Binding name="GLADDYBUTTON4_BUTTON4" Category="Gladdy"/>
<Binding name="GLADDYBUTTON5_BUTTON4" Category="Gladdy"/>
<Binding name="GLADDYBUTTON1_BUTTON5" Category="Gladdy"/>
<Binding name="GLADDYBUTTON2_BUTTON5" Category="Gladdy"/>
<Binding name="GLADDYBUTTON3_BUTTON5" Category="Gladdy"/>
<Binding name="GLADDYBUTTON4_BUTTON5" Category="Gladdy"/>
<Binding name="GLADDYBUTTON5_BUTTON5" Category="Gladdy"/>
</Bindings>

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,6 @@
local select, string_gsub, tostring = select, string.gsub, tostring
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF
local AURA_TYPE_BUFF = AURA_TYPE_BUFF
@ -34,7 +33,6 @@ function EventListener:JOINED_ARENA()
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
self:SetScript("OnEvent", EventListener.OnEvent)
Gladdy:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "RAID", UnitName("player"))
end
function EventListener:Reset()
@ -50,6 +48,9 @@ end
function Gladdy:SpotEnemy(unit, auraScan)
local button = self.buttons[unit]
if not unit or not button then
return
end
button.raceLoc = UnitRace(unit)
button.race = select(2, UnitRace(unit))
button.classLoc = select(1, UnitClass(unit))
@ -57,7 +58,9 @@ function Gladdy:SpotEnemy(unit, auraScan)
button.name = UnitName(unit)
button.stealthed = false
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
for n = 1, 30 do
local spellName,_,_,_,_,_,unitCaster = UnitAura(unit, n, "HELPFUL")
@ -76,21 +79,10 @@ end
function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
-- timestamp,eventType,hideCaster,sourceGUID,sourceName,sourceFlags,sourceRaidFlags,destGUID,destName,destFlags,destRaidFlags,spellId,spellName,spellSchool
local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName = CombatLogGetCurrentEventInfo()
local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool = CombatLogGetCurrentEventInfo()
local srcUnit = Gladdy.guids[sourceGUID]
local destUnit = Gladdy.guids[destGUID]
if Gladdy.specSpells[spellName] and srcUnit then
--Gladdy:Print(eventType, spellName, Gladdy.specSpells[spellName], srcUnit)
end
if (eventType == "UNIT_DIED" or eventType == "PARTY_KILL" or eventType == "SPELL_INSTAKILL") then
if destUnit then
--Gladdy:Print(eventType, "destUnit", destUnit)
elseif srcUnit then
--Gladdy:Print(eventType, "srcUnit", srcUnit)
end
end
if destUnit then
-- diminish tracker
if (Gladdy.db.drEnabled and (eventType == "SPELL_AURA_REMOVED" or eventType == "SPELL_AURA_REFRESH")) then
@ -101,32 +93,38 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
Gladdy:SendMessage("UNIT_DEATH", destUnit)
end
-- spec detection
if not Gladdy.buttons[destUnit].class then
if not Gladdy.buttons[destUnit].class or not Gladdy.buttons[destUnit].race then
Gladdy:SpotEnemy(destUnit, true)
end
--interrupt detection
if eventType == "SPELL_INTERRUPT" then
Gladdy:SendMessage("SPELL_INTERRUPT", destUnit,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool)
end
end
if srcUnit then
local unitRace = Gladdy.buttons[srcUnit].race
-- cooldown tracker
if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then
local unitClass
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
if Gladdy.db.cooldownCooldowns[tostring(spellId)] then
if (Gladdy:GetCooldownList()[Gladdy.buttons[srcUnit].class][spellId]) then
unitClass = Gladdy.buttons[srcUnit].class
else
unitClass = Gladdy.buttons[srcUnit].race
if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED") then
local unitRace = Gladdy.buttons[srcUnit].race
-- cooldown tracker
if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then
local unitClass
local spellId = Cooldowns.cooldownSpellIds[spellName] -- don't use spellId from combatlog, in case of different spellrank
if Gladdy.db.cooldownCooldowns[tostring(spellId)] then
if (Gladdy:GetCooldownList()[Gladdy.buttons[srcUnit].class][spellId]) then
unitClass = Gladdy.buttons[srcUnit].class
else
unitClass = Gladdy.buttons[srcUnit].race
end
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId, spellName)
Gladdy:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
end
Cooldowns:CooldownUsed(srcUnit, unitClass, spellId, spellName)
Gladdy:DetectSpec(srcUnit, Gladdy.specSpells[spellName])
end
if Gladdy.db.racialEnabled and Gladdy:Racials()[unitRace].spellName == spellName and Gladdy:Racials()[unitRace][spellID] then
Gladdy:SendMessage("RACIAL_USED", srcUnit)
end
end
if Gladdy.db.racialEnabled and Gladdy:Racials()[unitRace].spellName == spellName and Gladdy:Racials()[unitRace][spellID] then
Gladdy:SendMessage("RACIAL_USED", srcUnit)
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)
end
if not Gladdy.buttons[srcUnit].spec then
@ -143,12 +141,11 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
if button or pet then
if updateReason == "seen" then
-- ENEMY_SPOTTED
if button and not button.class then
Gladdy:SpotEnemy(unit, true)
end
if button and button.stealthed then
local class = Gladdy.buttons[unit].class
button.healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[class].r, RAID_CLASS_COLORS[class].g, RAID_CLASS_COLORS[class].b, 1)
if button then
Gladdy:SendMessage("ENEMY_STEALTH", unit, false)
if not button.class or not button.race then
Gladdy:SpotEnemy(unit, true)
end
end
if pet then
Gladdy:SendMessage("PET_SPOTTED", unit)
@ -156,9 +153,7 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
elseif updateReason == "unseen" then
-- STEALTH
if button then
Gladdy:SendMessage("ENEMY_STEALTH", unit)
button.healthBar.hp:SetStatusBarColor(0.66, 0.66, 0.66, 1)
button.stealthed = true
Gladdy:SendMessage("ENEMY_STEALTH", unit, true)
end
if pet then
Gladdy:SendMessage("PET_STEALTH", unit)
@ -177,7 +172,7 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
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
[43523] = GetSpellInfo(30405) .. " Silence",
[24131] = select(1, GetSpellInfo(19386)) .. " Dot", -- Wyvern Sting Dot
@ -199,7 +194,7 @@ function EventListener:UNIT_AURA(unit)
return
end
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)
end
local filter = (i == 1 and "HELPFUL" or "HARMFUL")
@ -213,12 +208,12 @@ function EventListener:UNIT_AURA(unit)
end
if not button.spec and Gladdy.specBuffs[spellName] then
local unitPet = string_gsub(unit, "%d$", "pet%1")
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then
if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
Gladdy:DetectSpec(unit, Gladdy.specBuffs[spellName])
end
end
if exceptionNames[spellID] then
spellName = exceptionNames[spellID]
if Gladdy.exceptionNames[spellID] then
spellName = Gladdy.exceptionNames[spellID]
end
Gladdy:SendMessage("AURA_GAIN", unit, auraType, spellID, spellName, texture, duration, expirationTime, count, debuffType, i)
Gladdy:Call("Announcements", "CheckDrink", unit, spellName)
@ -252,7 +247,3 @@ function EventListener:UNIT_SPELLCAST_SUCCEEDED(unit)
end
end
end
function EventListener:GetOptions()
return nil
end

View File

@ -26,10 +26,18 @@ Gladdy.BUTTON_DEFAULTS = {
damaged = 0,
click = false,
stealthed = false,
classColors = {},
lastState = 0,
}
function Gladdy:CreateFrame()
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(self.db.backgroundColor.r, self.db.backgroundColor.g, self.db.backgroundColor.b, self.db.backgroundColor.a)
self.frame.background:SetAllPoints(self.frame)
--self.frame.texture = self.frame:CreateTexture(nil, "OVERLAY")
--self.frame.texture:SetAllPoints(self.frame)
--self.frame.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
@ -107,12 +115,17 @@ end
function Gladdy:UpdateFrame()
if (InCombatLockdown()) then
return
end
if (not self.frame) then
self:CreateFrame()
end
local teamSize = self.curBracket or 0
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 leftSize = 0
local rightSize = 0
--Trinket + Racial
@ -140,9 +153,9 @@ function Gladdy:UpdateFrame()
rightSize = rightSize + self.db.highlightBorderSize
end
local margin = self.db.powerBarHeight + 1
local margin = powerBarHeight
local width = self.db.barWidth + leftSize + rightSize
local height = (self.db.healthBarHeight + self.db.powerBarHeight + 1) * teamSize
local height = (self.db.healthBarHeight + powerBarHeight) * teamSize
+ (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize)
+ self.db.bottomMargin * (teamSize - 1)
@ -173,12 +186,14 @@ function Gladdy:UpdateFrame()
-- GrowDirection
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 + self.db.powerBarHeight + 1
height = self.db.healthBarHeight + powerBarHeight
end
self.frame:SetScale(self.db.frameScale)
self.frame:SetWidth(width)
self.frame:SetHeight(height)
self.frame:ClearAllPoints()
self.frame.background:SetBackdropColor(self.db.backgroundColor.r, self.db.backgroundColor.g, self.db.backgroundColor.b, self.db.backgroundColor.a)
--self.frame:SetBackdropColor(self.db.frameColor.r, self.db.frameColor.g, self.db.frameColor.b, self.db.frameColor.a)
self.frame:ClearAllPoints()
if (self.db.x == 0 and self.db.y == 0) then
@ -214,17 +229,17 @@ function Gladdy:UpdateFrame()
button:SetWidth(self.db.barWidth)
button:SetHeight(self.db.healthBarHeight)
button.secure:SetWidth(self.db.barWidth)
button.secure:SetHeight(self.db.healthBarHeight + self.db.powerBarHeight + 1)
button.secure:SetHeight(self.db.healthBarHeight + powerBarHeight)
button:ClearAllPoints()
button.secure:ClearAllPoints()
if (self.db.growDirection == "TOP") then
if (i == 1) then
button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, self.db.powerBarHeight + 1)
button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT")
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.powerBar, "TOPLEFT")
button.secure:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT")
end
elseif (self.db.growDirection == "BOTTOM") then
if (i == 1) then
@ -254,24 +269,40 @@ function Gladdy:UpdateFrame()
for _, v in self:IterModules() do
self:Call(v, "UpdateFrame", button.unit)
self:Call(v, "UpdateFrame", "arena" .. i)
end
end
for _, v in self:IterModules() do
self:Call(v, "UpdateFrameOnce")
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
end
function Gladdy:HideFrame()
if (self.frame) then
self.frame:Hide()
if InCombatLockdown() then
self.startTest = nil
self.hideFrame = true
else
self.frame:Hide()
end
self.frame.testing = nil
end
end
function Gladdy:ToggleFrame(i)
self:Reset()
if (self.frame and self.frame:IsShown() and i == self.curBracket) then
self:HideFrame()
else
@ -287,9 +318,17 @@ function Gladdy:ToggleFrame(i)
self:CreateButton(o)
end
end
self:Reset()
self.curBracket = i
self:UpdateFrame()
self:Test()
self.frame:Show()
if InCombatLockdown() then
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
@ -305,28 +344,38 @@ function Gladdy:CreateButton(i)
--button.texture:SetAllPoints(button)
--button.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate")
local secure = CreateFrame("Button", "GladdyButton" .. i, button, "SecureActionButtonTemplate, SecureHandlerEnterLeaveTemplate")
secure:RegisterForClicks("AnyUp")
secure:RegisterForClicks("AnyUp")
secure:SetAttribute("*type1", "target")
secure:SetAttribute("*type2", "focus")
secure:RegisterForClicks("AnyDown")
secure:SetAttribute("target", "arena" .. i)
secure:SetAttribute("focus", "arena" .. i)
secure:SetAttribute("unit", "arena" .. i)
--[[
secure:SetAttribute("target", i == 1 and "player" or "focus")
secure:SetAttribute("focus", i == 1 and "player" or "focus")
secure:SetAttribute("unit", i == 1 and "player" or "focus")
--]]
--secure.texture = secure:CreateTexture(nil, "OVERLAY")
--secure.texture:SetAllPoints(secure)
--secure.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
button.id = i
--button.unit = i == 1 and "player" or "focus"
button.unit = "arena" .. i
button.secure = secure
self:ResetButton(button.unit)
self:ResetButton("arena" .. i)
self.buttons[button.unit] = button
self.buttons["arena" .. i] = button
for _, v in self:IterModules() do
self:Call(v, "CreateFrame", button.unit)
self:Call(v, "CreateFrame", "arena" .. i)
end
self:ResetButton("arena" .. i)
end
function Gladdy:GetAnchor(unit, position)

View File

@ -5,6 +5,7 @@ local select = select
local pairs = pairs
local tinsert = table.insert
local tsort = table.sort
local GetTime = GetTime
local CreateFrame = CreateFrame
local DEFAULT_CHAT_FRAME = DEFAULT_CHAT_FRAME
local IsAddOnLoaded = IsAddOnLoaded
@ -25,9 +26,9 @@ local MAJOR, MINOR = "Gladdy", 4
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
local L
Gladdy.version_major_num = 1
Gladdy.version_minor_num = 0.11
Gladdy.version_minor_num = 0.20
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_REGEX = VERSION_REGEX
@ -131,8 +132,8 @@ function Gladdy:Call(module, func, ...)
end
end
function Gladdy:SendMessage(message, ...)
for k, v in self:IterModules() do
self:Call(v, v.messages[message], ...)
for _, module in self:IterModules() do
self:Call(module, module.messages[message], ...)
end
end
@ -200,11 +201,12 @@ function Gladdy:OnInitialize()
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("font", "DorisPP", "Interface\\AddOns\\Gladdy\\Images\\DorisPP.TTF")
self.LSM:Register("border", "Square Full White", "Interface\\AddOns\\Gladdy\\Images\\Square_FullWhite.tga")
L = self.L
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["Warrior"], class = "WARRIOR", health = 9635, healthMax = 14207, power = 76, powerMax = 100, powerType = 1, testSpec = L["Arms"], 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" },
["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" },
["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" },
@ -223,10 +225,13 @@ function Gladdy:OnInitialize()
self:SetupOptions()
for k, v in self:IterModules() do
self:Call(v, "Initialize") -- B.E > A.E :D
for _, module in self:IterModules() do
self:Call(module, "Initialize") -- B.E > A.E :D
end
self:DeleteUnknownOptions(self.db, self.defaults.profile)
if Gladdy.db.hideBlizzard == "always" then
Gladdy:BlizzArenaSetAlpha(0)
end
end
function Gladdy:OnProfileChanged()
@ -240,6 +245,7 @@ end
function Gladdy:OnEnable()
self:RegisterEvent("UPDATE_BATTLEFIELD_STATUS")
self:RegisterEvent("PLAYER_ENTERING_WORLD")
self:RegisterEvent("PLAYER_REGEN_ENABLED")
if (IsAddOnLoaded("Clique")) then
for i = 1, 5 do
@ -266,6 +272,7 @@ function Gladdy:OnEnable()
self:HideFrame()
self:ToggleFrame(3)
self.showConfig = true
end
end
@ -285,23 +292,25 @@ end
---------------------------
function Gladdy:Test()
Gladdy.frame.testing = true
for i = 1, self.curBracket do
local unit = "arena" .. i
if (not self.buttons[unit]) then
self:CreateButton(i)
end
local button = self.buttons[unit]
self.frame.testing = true
if self.curBracket then
for i = 1, self.curBracket do
local unit = "arena" .. i
if (not self.buttons[unit]) then
self:CreateButton(i)
end
local button = self.buttons[unit]
for k, v in pairs(self.testData[unit]) do
button[k] = v
end
for k, v in pairs(self.testData[unit]) do
button[k] = v
end
for k, v in self:IterModules() do
self:Call(v, "Test", unit)
end
for _, module in self:IterModules() do
self:Call(module, "Test", unit)
end
button:SetAlpha(1)
button:SetAlpha(1)
end
end
end
@ -312,6 +321,10 @@ end
---------------------------
function Gladdy:PLAYER_ENTERING_WORLD()
if self.showConfig then
LibStub("AceConfigDialog-3.0"):Open("Gladdy", nil, LibStub("AceConfigDialog-3.0"):SelectGroup("Gladdy", "XiconProfiles"))
self.showConfig = nil
end
local instance = select(2, IsInInstance())
if (instance ~= "arena" and self.frame and self.frame:IsVisible() and not self.frame.testing) then
self:Reset()
@ -332,6 +345,23 @@ function Gladdy:UPDATE_BATTLEFIELD_STATUS(_, index)
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.showFrame = nil
end
if self.hideFrame then
self:Reset()
self.frame:Hide()
self.hideFrame = nil
end
end
---------------------------
-- RESET FUNCTIONS (ARENA LEAVE)
@ -340,7 +370,7 @@ end
function Gladdy:Reset()
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
end
end
@ -348,13 +378,16 @@ function Gladdy:Reset()
self.curBracket = nil
self.curUnit = 1
for k1, v1 in self:IterModules() do
self:Call(v1, "Reset")
for _, module in self:IterModules() do
self:Call(module, "Reset")
end
for unit in pairs(self.buttons) do
self:ResetUnit(unit)
end
if Gladdy.db.hideBlizzard == "never" or Gladdy.db.hideBlizzard == "arena" then
Gladdy:BlizzArenaSetAlpha(1)
end
end
function Gladdy:ResetUnit(unit)
@ -366,8 +399,8 @@ function Gladdy:ResetUnit(unit)
button:SetAlpha(0)
self:ResetButton(unit)
for k2, v2 in self:IterModules() do
self:Call(v2, "ResetUnit", unit)
for _, module in self:IterModules() do
self:Call(module, "ResetUnit", unit)
end
end
@ -381,7 +414,7 @@ function Gladdy:ResetButton(unit)
button[k1] = nil
elseif (type(v1) == "number") then
button[k1] = 0
elseif (type(v1) == "array") then
elseif (type(v1) == "table") then
button[k1] = {}
elseif (type(v1) == "boolean") then
button[k1] = false
@ -407,9 +440,60 @@ function Gladdy:JoinedArena()
end
self:SendMessage("JOINED_ARENA")
self:UpdateFrame()
self.frame:Show()
if InCombatLockdown() then
Gladdy:Print("Gladdy frames show as soon as you leave combat")
self.showFrame = true
else
self:UpdateFrame()
self.frame:Show()
end
for i=1, self.curBracket do
self.buttons["arena" .. i]:SetAlpha(1)
end
if Gladdy.db.hideBlizzard == "arena" or Gladdy.db.hideBlizzard == "always" then
Gladdy:BlizzArenaSetAlpha(0)
end
end
---------------------------
-- BLIZZARD FRAMES
---------------------------
function Gladdy:BlizzArenaSetAlpha(alpha)
if IsAddOnLoaded("Blizzard_ArenaUI") then
ArenaEnemyFrames:SetAlpha(alpha)
ArenaEnemyFrame1:SetAlpha(alpha)
ArenaEnemyFrame1PetFrame:SetAlpha(alpha)
ArenaEnemyFrame2:SetAlpha(alpha)
ArenaEnemyFrame2PetFrame:SetAlpha(alpha)
ArenaEnemyFrame3:SetAlpha(alpha)
ArenaEnemyFrame3PetFrame:SetAlpha(alpha)
ArenaEnemyFrame4:SetAlpha(alpha)
ArenaEnemyFrame4PetFrame:SetAlpha(alpha)
ArenaEnemyFrame5:SetAlpha(alpha)
ArenaEnemyFrame5PetFrame:SetAlpha(alpha)
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

View File

@ -1,6 +1,6 @@
## Interface: 20501
## Interface: 20502
## Title: Gladdy - TBC
## Version: 1.11-Beta
## Version: 1.20-Release
## Notes: The most powerful arena AddOn for WoW 2.5.1
## Author: XiconQoo, DnB_Junkee, Knall
## X-Email: contact me on discord Knall#1751
@ -22,6 +22,7 @@ Modules\Powerbar.lua
Modules\Auras.lua
Modules\Castbar.lua
Modules\Classicon.lua
Modules\Clicks.lua
Modules\Diminishings.lua
Modules\Highlight.lua
Modules\TotemPlates.lua
@ -35,4 +36,6 @@ Modules\XiconProfiles.lua
Modules\Pets.lua
Modules\ExportImport.lua
Modules\CombatIndicator.lua
Modules\RangeCheck.lua
Modules\ShadowsightTimer.lua
EventListener.lua

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.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Images/Countdown/Horde.blp Normal file

Binary file not shown.

BIN
Images/Square_FullWhite.tga Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

432
Lang.lua
View File

@ -406,6 +406,8 @@ elseif GetLocale() == "deDE" then
L["Categories"] = "Kategorien"
L["Force Icon"] = "Erzwinge Symbol"
L["Icon of the DR"] = "Symbol des DR"
L["DR Duration"] = "DR Dauer"
L["Change the DR Duration in seconds (DR is dynamic between 15-20s)"] = "Verändere die DR Dauer in Sekunden (DR ist dynamisch zwischen 15-20s)"
-- ExportImport.lua
L["Export Import"] = "Exportieren Importieren"
@ -427,7 +429,7 @@ elseif GetLocale() == "deDE" then
L["Show name text"] = "Namen zeigen"
L["Show the units name"] = "Zeige den Namen des Gegners"
L["Show ArenaX"] = "ArenaX zeigen"
L["Show Arena1-5 as name instead"] = "Zeigt Arena1-5 anstatt des Namens"
L["Show 1-5 as name instead"] = "Zeigt 1-5 anstatt des Namens"
L["Show the actual health"] = "Zeige die momentane Gesundheit"
L["Show the actual health on the health bar"] = "Zeigt die momentane Gesundheit"
L["Show max health"] = "Zeige maximale Gesundheit"
@ -555,6 +557,434 @@ elseif GetLocale() == "deDE" then
L["Offset of border to statusbar (in case statusbar shows beyond the border)"] = "Offset des Rahmens zur Statusbar (falls der Balken hinter dem Rahmen erscheint)"
L["Statusbar border color"] = "Balken Rahmenfarbe"
L["This changes the border color of all statusbar frames"] = "Dies ändert die Rahmenfarbe aller Balken"
elseif GetLocale() == "zhTW" then
-- Announcements.lua
L["Announcements"] = "通報"
L["RESURRECTING: %s (%s)"] = "復活: %s (%s) "
L["SPEC DETECTED: %s - %s (%s)"] = "敵方天賦: %s - %s (%s)"
L["LOW HEALTH: %s (%s)"] = "低生命值: %s (%s)"
L["TRINKET USED: %s (%s)"] = "飾品已使用: %s (%s)"
L["TRINKET READY: %s (%s)"] = "飾品就緒: %s (%s)"
L["DRINKING: %s (%s)"] = "正在喝水: %s (%s)"
L["Self"] = "玩家"
L["Party"] = "隊伍"
L["Raid Warning"] = "團隊警告"
L["Blizzard's Floating Combat Text"] = "Blizzard 戰鬥浮動文字"
L["Trinket used"] = "飾品已使用"
L["Announce when an enemy's trinket is used"] = "當敵方使用飾品時發出通知"
L["Trinket ready"] = "飾品就緒"
L["Announce when an enemy's trinket is ready again"] = "當敵方飾品就緒時發出通報"
L["Drinking"] = "正在喝水"
L["Announces when enemies sit down to drink"] = "當敵方喝水時發出通報"
L["Resurrection"] = "復活"
L["Announces when an enemy tries to resurrect a teammate"] = "當敵方嘗試復活隊友時發出通報"
L["New enemies"] = "新的敵人"
L["Announces when new enemies are discovered"] = "當發現新的敵人時發出通報"
L["Spec Detection"] = "天賦偵測"
L["Announces when the spec of an enemy was detected"] = "當偵測到敵方天賦時發出通報"
L["Low health"] = "低生命值"
L["Announces when an enemy drops below a certain health threshold"] = "當敵方生命值低於一定條件時發出通報"
L["Low health threshold"] = "低生命值門檻"
L["Choose how low an enemy must be before low health is announced"] = "設定低生命值通報門檻"
L["Destination"] = "發送通報至"
L["Choose how your announcements are displayed"] = "選擇通報發送至哪個頻道"
-- ArenaCountDown.lua
L["Arena Countdown"] = "競技場計時"
L["Turns countdown before the start of an arena match on/off."] = "在競技場開始前倒數剩餘秒數"
L["Size"] = "大小"
-- Auras.lua
L["Auras"] = "光環"
L["Frame"] = "框架"
L["Cooldown"] = "冷卻時間"
L["No Cooldown Circle"] = "取消圖示冷卻倒數陰影"
L["Cooldown circle alpha"] = "冷卻倒數陰影alpha值"
L["Font"] = "字型"
L["Font of the cooldown"] = "設定冷卻時間字型"
L["Font scale"] = "字體大小"
L["Scale of the text"] = "設定字體大小"
L["Font color"] = "字體顏色"
L["Color of the text"] = "設定字體顏色"
L["Border"] = "邊框"
L["Border style"] = "邊框樣式"
L["Buff color"] = "增益顏色"
L["Debuff color"] = "減益顏色"
L["Check All"] = "全選"
L["Uncheck All"] = "取消全選"
L["Enabled"] = "啟用"
L["Priority"] = "優先"
L["Interrupt Spells School Colors"] = "打斷法術分類顏色"
L["Enable Interrupt Spell School Colors"] = "啟用"
L["Will use Debuff Color if disabled"] = "若未啟用則使用一般減益顏色"
L["Buffs"] = "增益" --Line 573
L["Debuffs"] = "減益" --Line 566
L["Interrupts"] = "斷法" --Line 580
-- BuffsDebuffs.lua
L["Buffs and Debuffs"] = "增益與減益"
L["Enabled Buffs and Debuffs module"] = "啟用增益與減益模組"
L["Show CC"] = "顯示控場"
L["Shows all debuffs, which are displayed on the ClassIcon as well"] = "顯示所有減益效果,這些減益效果也顯示在職業圖示上"
L["Buffs"] = "增益"
L["Size & Padding"] = "大小與內距"
L["Icon Size"] = "圖示大小"
L["Size of the DR Icons"] = "遞減圖示大小"
L["Icon Width Factor"] = "圖示寬度比例"
L["Stretches the icon"] = "圖示寬度"
L["Icon Padding"] = "圖示內距"
L["Space between Icons"] = "圖示間距"
L["Position"] = "位置"
L["Aura Position"] = "光環位置"
L["Position of the aura icons"] = "光環圖示位置"
L["Top"] = "頂部"
L["Bottom"] = "底部"
L["Left"] = ""
L["Right"] = ""
--L["Grow Direction"] = ""
L["Grow Direction of the aura icons"] = "光環圖示的延伸方向"
L["Horizontal offset"] = "水平位移"
L["Vertical offset"] = "垂直位移"
L["Alpha"] = "Alpha值"
L["Debuffs"] = "減益"
L["Dynamic Timer Color"] = "動態計時條顏色"
L["Show dynamic color on cooldown numbers"] = "冷卻時間數字以動態顏色顯示"
L["Color of the cooldown timer and stacks"] = "Farbe der Abklingzeit und Stapel"
L["Spell School Colors"] = "法術種類顏色"
L["Spell School Colors Enabled"] = "啟用"
L["Show border colors by spell school"] = "根據不同法術種類顯示不同邊框顏色"
L["Curse"] = "詛咒"
L["Color of the border"] = "邊框顏色"
L["Magic"] = "魔法"
L["Poison"] = "中毒"
L["Physical"] = "物理"
L["Immune"] = "免疫"
L["Disease"] = "疾病"
L["Aura"] = "光環"
L["Form"] = "形態"
L["Font"] = "字型" --Line 906
L["Border"] = "邊框" --Line 949
L["Debuff Lists"] = "減益列表" --Line 1036
L["Buff Lists"] = "增益列表" --Line 1051
-- Castbar.lua
L["Cast Bar"] = "施法條"
L["Bar"] = "施法條"
L["Bar Size"] = "施法條大小"
L["Bar height"] = "高度"
L["Height of the bar"] = "計量條高度"
L["Bar width"] = "寬度"
L["Width of the bars"] = "計量條寬度"
L["Texture"] = "材質"
L["Bar texture"] = "施法條材質"
L["Texture of the bar"] = "計量條材質"
L["Bar color"] = "施法條顏色"
L["Color of the cast bar"] = "計量條顏色"
L["Background color"] = "背景顏色"
L["Color of the cast bar background"] = "施法條背景顏色"
L["Border size"] = "邊框大小"
L["Status Bar border"] = "狀態列邊框"
L["Status Bar border color"] = "狀態列邊框顏色"
L["Icon"] = "圖示"
L["Icon size"] = "圖示大小"
L["Icon border"] = "圖示邊框"
L["Icon border color"] = "圖示邊框顏色"
L["If test is running, type \"/gladdy test\" again"] = "如果測試已經開始,調整此選項後請輸入/gladdy test以重新開始測試"
L["Spark"] = "尾端發亮"
L["Spark enabled"] = "啟用"
L["Spark color"] = "顏色"
L["Color of the cast bar spark"] = "計時條進度的尾端顏色"
L["Font of the castbar"] = "施法條字型"
L["Font size"] = "字體大小"
L["Size of the text"] = "施法條字體大小"
L["Format"] = "格式"
L["Timer Format"] = "時間格式"
L["Remaining"] = "剩餘時間"
L["Total"] = "總時間"
L["Both"] = "兩者"
L["Castbar position"] = "施法條位置"
L["Icon position"] = "圖示位置"
L["Offsets"] = "位移"
-- Classicon.lua
L["Class Icon"] = "職業圖示"
L["Balance"] = "平衡"
L["Feral"] = "野性"
L["Restoration"] = "恢復"
L["Beast Mastery"] = "獸王"
L["Marksmanship"] = "射擊"
L["Survival"] = "生存"
L["Arcane"] = "奧術"
L["Fire"] = "火焰"
L["Frost"] = "冰霜"
L["Holy"] = "神聖"
L["Protection"] = "防護"
L["Retribution"] = "懲戒"
L["Discipline"] = "戒律"
L["Shadow"] = "暗影"
L["Assassination"] = "刺殺"
L["Combat"] = "戰鬥"
L["Subtlety"] = "敏銳"
L["Elemental"] = "元素"
L["Enhancement"] = "增強"
L["Affliction"] = "痛苦"
L["Demonology"] = "惡魔"
L["Destruction"] = "毀滅"
L["Arms"] = "武器"
L["Fury"] = "狂怒"
L["Show Spec Icon"] = "顯示天賦圖示"
L["Shows Spec Icon once spec is detected"] = "若偵測到天賦則顯示天賦圖示"
L["Icon width factor"] = "圖示寬度比例"
L["This changes positions with trinket"] = "調整職業圖示位置"
L["Border color"] = "邊框顏色"
--CombatIndicator.lua
L["Combat Indicator"] = "戰鬥指示器"
L["Enable Combat Indicator icon"] = "顯示是否進入戰鬥"
L["Anchor"] = "定位"
L["This changes the anchor of the ci icon"] = "調整戰鬥指示器圖示定位點"
L["This changes position relative to its anchor of the ci icon"] = "調整戰鬥指示器位置"
-- Constants.lua
L["Physical"] = "物理" --Line 749
L["Holy"] = "神聖" --Line 750
L["Fire"] = "火焰" --Line 751
L["Nature"] = "自然" --Line 752
L["Frost"] = "冰霜" --Line 753
L["Shadow"] = "暗影" --Line 754
L["Arcane"] = "奧術" --Line 755
L["Unknown"] = "未知" --Line 756
-- Cooldowns.lua
L["Cooldowns"] = "技能冷卻監控"
L["Enabled cooldown module"] = "啟用冷卻時間監控模組"
L["Cooldown size"] = "大小"
L["Size of each cd icon"] = "冷卻時間圖示大小"
L["Icon Width Factor"] = "寬度"
L["Max Icons per row"] = "每行圖示數量"
L["Scale of the font"] = "字體大小"
L["Anchor of the cooldown icons"] = "冷卻圖示定位"
L["Grow Direction of the cooldown icons"] = "冷卻圖示延伸方向"
L["Offset"] = "位移"
L["BloodElf"] = "血精靈"
L["NightElf"] = "夜精靈"
L["Scourge"] = "不死族"
-- Diminishings.lua
L["Diminishings"] = "控場遞減"
L["Enabled DR module"] = "啟用遞減模組"
L["DR Cooldown position"] = "遞減冷卻時間位置"
L["Position of the cooldown icons"] = "遞減冷卻時間圖示位置"
L["DR Border Colors"] = "DR邊框顏色"
L["Dr Border Colors Enabled"] = "啟用"
L["Colors borders of DRs in respective DR-color below"] = "邊框顏色依遞減設定為以下顏色"
L["Half"] = "二分之一"
L["Quarter"] = "四分之一"
L["Categories"] = "法術列表"
L["Force Icon"] = "使用自訂圖示"
L["Icon of the DR"] = "選擇此區圖示取代原始技能圖示"
-- ExportImport.lua
L["Export Import"] = "匯出/匯入"
L["Profile Export Import"] = "設定檔匯出/匯入"
L["Export"] = "匯出" --Line 138
L["Export your current profile to share with others or your various accounts."] = "匯出您目前的設定檔" --Line 139
L["Import"] = "匯入" --Line 162
L["This will overwrite your current profile!"] = "這將會覆蓋您目前的設定檔" --Line 163
-- Healthbar.lua
L["Health Bar"] = "血量條"
L["DEAD"] = "死亡"
L["LEAVE"] = "暫離"
L["General"] = "一般"
L["Color of the status bar background"] = "狀態列背景顏色"
L["Font of the bar"] = "字型"
L["Name font size"] = "名稱字體大小"
L["Size of the name text"] = "設定名稱字體大小"
L["Health font size"] = "生命值字體大小"
L["Size of the health text"] = "設定生命值字體大小"
L["Size of the border"] = "邊框大小"
L["Health Bar Text"] = "血量條文字"
L["Show name text"] = "顯示名稱"
L["Show the units name"] = "顯示單位名稱"
L["Show ArenaX"] = "顯示編號"
L["Show 1-5 as name instead"] = "使用編號1-5代替角色名稱"
L["Show the actual health"] = "顯示目前生命值"
L["Show the actual health on the health bar"] = "在血量條上顯示目前生命值"
L["Show max health"] = "顯示最大生命值"
L["Show max health on the health bar"] = "在血量條上顯示最大生命值"
L["Show health percentage"] = "顯示百分比"
L["Show health percentage on the health bar"] = "在血量條上顯示生命值百分比"
-- Highlight.lua
L["Highlight"] = "高亮提示"
L["Show Inside"] = "顯示在框架內"
L["Show Highlight border inside of frame"] = "將高亮邊框顯示於框架內側"
L["Colors"] = "邊框顏色"
L["Target border color"] = "目標"
L["Color of the selected targets border"] = "目標的邊框顏色"
L["Focus border color"] = "專注"
L["Color of the focus border"] = "專注目標邊框顏色"
L["Highlight target"] = "高亮目標"
L["Toggle if the selected target should be highlighted"] = "是否高亮當前目標"
L["Show border around target"] = "顯示目標邊框"
L["Toggle if a border should be shown around the selected target"] = "是否顯示當前目標的邊框"
L["Show border around focus"] = "顯示專注邊框"
L["Toggle of a border should be shown around the current focus"] = "是否顯示當前專注目標的邊框"
-- Pets.lua
L["Pets"] = "寵物"
L["Enables Pets module"] = "啟用寵物模組"
L["Width of the bar"] = "寵物列寬度"
L["Health color"] = "生命值顏色"
L["Color of the status bar"] = "狀態列顏色"
L["Portrait"] = "頭像"
L["Health Values"] = "生命值"
-- Powerbar.lua
L["Power Bar"] = "法力/能量條"
L["Power Bar Text"] = "法力/能量條文字"
L["Power Texts"] = "法力/能量條文字"
L["Show race"] = "顯示種族"
L["Show spec"] = "顯示天賦"
L["Show the actual power"] = "顯示目前法力/能量"
L["Show the actual power on the power bar"] = "在計量條中顯示目前法力/能量值"
L["Show max power"] = "顯示最大法力/能量值"
L["Show max power on the power bar"] = "在計量條中顯示最大法力/能量值"
L["Show power percentage"] = "顯示法力/能量百分比"
L["Show power percentage on the power bar"] = "在計量條中顯示目前法力/能量百分比"
-- Racial.lua
L["Racial"] = "種族"
L["Enable racial icon"] = "啟用種族圖示"
L["This changes the anchor of the racial icon"] = "調整種族圖示定位點"
L["This changes position relative to its anchor of the racial icon"] = "調整種族圖示位置"
-- TotemPlates.lua
L["Totem Plates"] = "圖騰名條"
L["Customize Totems"] = "自訂圖騰"
L["Custom totem name"] = "自訂圖騰名稱"
L["Totem General"] = "圖騰通用設定"
L["Turns totem icons instead of nameplates on or off. (Requires reload)"] = "是否顯示圖騰名條(需重新載入)"
L["Show friendly"] = "顯示友方圖騰"
L["Show enemy"] = "顯示敵方圖騰"
L["Totem size"] = "圖騰大小"
L["Size of totem icons"] = "圖騰圖示大小"
L["Font of the custom totem name"] = "自訂圖騰字型"
L["Apply alpha when no target"] = "圖騰非目標時套用alpha值"
L["Always applies alpha, even when you don't have a target. Else it is 1."] = "若圖騰未被選為目標其圖示套用alpha值設定"
L["Apply alpha when targeted"] = "圖騰為目標時套用alpha值"
L["Always applies alpha, even when you target the totem. Else it is 1."] = "圖騰被選為目標時其圖示套用alpha值設定"
L["All totem border alphas (configurable per totem)"] = "圖騰 Alpha值 "
L["Totem icon border style"] = "圖騰邊框樣式"
L["All totem border color"] = "圖騰邊框顏色"
-- Trinket.lua
L["Trinket"] = "飾品"
L["Enable trinket icon"] = "啟用飾品圖示"
L["This changes positions of the trinket"] = "調整飾品圖示位置"
-- XiconProfiles.lua
L["Profile"] = "樣式"
L["XiconProfiles"] = "框架外觀" --Line 4
L[" No Pet"] = "(無寵物)" --Line 109, 119
-- Frame.lua
L["Gladdy - drag to move"] = "Gladdy - 拖曳移動"
-- Gladdy.lua
L["Welcome to Gladdy!"] = "歡迎使用 Gladdy!"
L["First run has been detected, displaying test frame."] = "第一次使用時,顯示此測試框架。"
L["Valid slash commands are:"] = "可用的指令為:"
L["If this is not your first run please lock or move the frame to prevent this from happening."] = "若非第一次使用,請移動或鎖定框架以避免此提示再次出現。"
-- Clicks.lua
L["Action #%d"] = "動作 #%d"
L["Target"] = "目標" --Line 15
L["Focus"] = "專注" --Line 16
L["Clicks"] = "點擊動作"
L["Left button"] = "左鍵"
L["Right button"] = "右鍵"
L["Middle button"] = "中鍵"
L["Button 4"] = "滑鼠按鍵4"
L["Button 5"] = "滑鼠按鍵5"
L["Select what action this mouse button does"] = "設定輸入按鍵後的欲執行的動作"
L["Modifier"] = "修飾鍵"
L["Select which modifier to use"] = "設定欲使用的修飾鍵"
L["Button"] = "按鍵"
L["Select which mouse button to use"] = "設定欲使用的滑鼠按鍵"
L["Name"] = "名稱"
L["Select the name of the click option"] = "設定動作名稱"
L["Action"] = "動作"
L["Cast Spell / Macro"] = "施放法術/巨集"
--RangeCheck.lua
L["Range Check"] = "距離檢查"
L["Spells"] = "法術"
L["Fade"] = "變暗"
L["Out of Range Darkening Level"] = "超出距離時變暗程度"
L["Higher is darker"] = "數值越高越暗"
L["yds"] = "" --Line 366, 388
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."] = "對應您的職業修改欲用於監控距離的技能。\n\n範例:若您為聖騎士且想以懺悔技能用於距離監控請將聖騎士的法術ID改為20066。" --Line 352
--ShadowsightTimer.lua
L["Shadowsight Timer"] = "暗影視界計時"
L["Locked"] = "鎖定"
L["Announce"] = "通報"
L["Scale"] = "大小"
L["Shadowsight up in %ds"] = "暗影視界於%d秒後就緒"
L["Shadowsight up!"] = "暗影視界已就緒"
-- Options.lua
L["settings"] = "設定"
L["Reset module"] = "重設模組"
L["Reset module to defaults"] = "將模組重設為預設值"
L["No settings"] = "無設定"
L["Module has no settings"] = "模組沒有設定"
L["General settings"] = "通用設定"
L["Lock frame"] = "鎖定框架"
L["Toggle if frame can be moved"] = "調整框架是否可移動"
L["Grow frame upwards"] = "框架向上延伸"
L["If enabled the frame will grow upwards instead of downwards"] = "開啟此選項時框架向上延伸"
L["Down"] = ""
L["Up"] = ""
L["Frame General"] = "框架"
L["Frame scale"] = "框架大小"
L["Scale of the frame"] = "框架的尺寸"
L["Frame padding"] = "框架內距"
L["Padding of the frame"] = "框架的內距"
L["Frame width"] = "框架寬度"
L["Margin"] = "框架間距"
L["Margin between each button"] = "框架的間距"
L["Cooldown General"] = "冷卻"
L["Font General"] = "字型"
L["General Font"] = "Allgemeine Schriftart"
L["Font color text"] = "文字顏色"
L["Font color timer"] = "計時器文字顏色"
L["Color of the timers"] = "計時器顏色"
L["Icons General"] = "圖示"
L["Icon border style"] = "圖示邊框樣式"
L["This changes the border style of all icons"] = "調整所有圖示的邊框樣式"
L["This changes the border color of all icons"] = "調整所有圖示的邊框顏色"
L["Statusbar General"] = "狀態列"
L["Statusbar texture"] = "狀態列材質"
L["This changes the texture of all statusbar frames"] = "調整所有狀態列的材質"
L["Statusbar border style"] = "狀態列邊框樣式"
L["This changes the border style of all statusbar frames"] = "調整所有狀態列的邊框樣式"
L["Statusbar border offset divider (smaller is higher offset)"] = "狀態列邊框距離"
L["Offset of border to statusbar (in case statusbar shows beyond the border)"] = "調整狀態列邊框距離"
L["Statusbar border color"] = "狀態列邊框顏色"
L["This changes the border color of all statusbar frames"] = "調整所有狀態列的邊框顏色"
L["Hide Blizzard"] = "隱藏暴雪框架"
L["Grow Direction"] = "框架延伸方向"
L["Arena only"] = "只在競技場中"
L["Never"] = "從不"
L["Always"] = "永遠"
L["Load configuration"] = "設定選項" --Line 713
L["Load configuration options"] = "載入設定選項" --Line 714
L["Background Color of the frame"] = "框架的背景顏色"
L["Gladdy"] = "Gladdy目標框架" --Line 210, 709, 727
end

View File

@ -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)
assert(LibStub, string.format("%s requires LibStub.", major))
@ -140,6 +140,9 @@ Data.spells = {
-- Revenge Stun
[12798] = "rndstun",
-- Pyroclasm
[18093] = "rndstun",
--[[ CYCLONE ]]--
-- Blind
[2094] = "cyclone",
@ -167,6 +170,15 @@ Data.spells = {
[9853] = "root",
[26989] = "root",
-- Nature's Grasp
[19975] = "root",
[19974] = "root",
[19973] = "root",
[19972] = "root",
[19971] = "root",
[19970] = "root",
[27010] = "root",
--[[ RANDOM ROOTS ]]--
-- Improved Hamstring
[23694] = "rndroot",
@ -181,10 +193,10 @@ Data.spells = {
[18658] = "sleep",
-- Wyvern Sting
[19386] = "sleep",
[24132] = "sleep",
[24133] = "sleep",
[27068] = "sleep",
[19386] = "disorient",
[24132] = "disorient",
[24133] = "disorient",
[27068] = "disorient",
--[[ MISC ]]--
-- Chastise (Maybe this shares DR with Imp HS?)
@ -201,15 +213,15 @@ Data.spells = {
[33042] = "dragonsbreath", -- Dragon's Breath
[33043] = "dragonsbreath", -- Dragon's Breath
-- Repentance
[20066] = "repentance",
[20066] = "disorient",
-- Scatter Shot
[19503] = "scatters",
-- Freezing Trap
[3355] = "freezetrap",
[14308] = "freezetrap",
[14309] = "freezetrap",
[3355] = "disorient",
[14308] = "disorient",
[14309] = "disorient",
-- Improved Conc Shot
[19410] = "impconc",

View File

@ -140,7 +140,8 @@ Buff( { 25782 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Might
Buff( { 25895 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Salvation
Buff( { 25899 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Sanctuary
Buff( { 25894 }, { buffType = "magic"}, "PALADIN") -- Greater Blessing of Wisdom
Buff( { 642 }, { buffType = "magic"}, "PALADIN") -- Divine Shield
Buff( { 642 }, { buffType = "immune"}, "PALADIN") -- Divine Shield
Buff( { 31884 }, { buffType = "magic"}, "PALADIN") -- Avenging Wrath
--Auras
Buff( { 465, 10290, 643, 10291, 1032, 10292, 10293, 27149 }, { buffType = "aura"}, "PALADIN") -- Devotion 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( { 19263 }, { buffType = "physical"}, "HUNTER") -- Deterrence
Buff( { 3045 }, { buffType = "physical"}, "HUNTER") -- Rapid Fire
--local FEIGN_DEATH = GetSpellInfo(5384) -- Localized name for Feign Death

View File

@ -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({ 605, 10911, 10912 }, { buffType = "magic" }, "PRIEST") -- Mind Control
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
@ -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({ 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({ 33878, 33986, 33987 }, { buffType = "physical" }, "DRUID") -- Mangle (Bear)
Debuff({ 33876, 33982, 33983 }, { buffType = "physical" }, "DRUID") -- Mangle (Cat)
-------------
-- WARRIOR

View File

@ -0,0 +1,232 @@
--- = Background =
-- Blizzard's IsSpellInRange API has always been very limited - you either must have the name of the spell, or its spell book ID. Checking directly by spellID is simply not possible.
-- Now, in Mists of Pandaria, Blizzard changed the way that many talents and specialization spells work - instead of giving you a new spell when leaned, they replace existing spells. These replacement spells do not work with Blizzard's IsSpellInRange function whatsoever; this limitation is what prompted the creation of this lib.
-- = Usage =
-- **LibSpellRange-1.0** exposes an enhanced version of IsSpellInRange that:
-- * Allows ranged checking based on both spell name and spellID.
-- * Works correctly with replacement spells that will not work using Blizzard's IsSpellInRange method alone.
--
-- @class file
-- @name LibSpellRange-1.0.lua
local major = "SpellRange-1.0"
local minor = 15
assert(LibStub, format("%s requires LibStub.", major))
local Lib = LibStub:NewLibrary(major, minor)
if not Lib then return end
local tonumber = _G.tonumber
local strlower = _G.strlower
local wipe = _G.wipe
local type = _G.type
local GetSpellTabInfo = _G.GetSpellTabInfo
local GetNumSpellTabs = _G.GetNumSpellTabs
local GetSpellBookItemInfo = _G.GetSpellBookItemInfo
local GetSpellBookItemName = _G.GetSpellBookItemName
local GetSpellLink = _G.GetSpellLink
local GetSpellInfo = _G.GetSpellInfo
local IsSpellInRange = _G.IsSpellInRange
local SpellHasRange = _G.SpellHasRange
-- isNumber is basically a tonumber cache for maximum efficiency
Lib.isNumber = Lib.isNumber or setmetatable({}, {
__mode = "kv",
__index = function(t, i)
local o = tonumber(i) or false
t[i] = o
return o
end})
local isNumber = Lib.isNumber
-- strlower cache for maximum efficiency
Lib.strlowerCache = Lib.strlowerCache or setmetatable(
{}, {
__index = function(t, i)
if not i then return end
local o
if type(i) == "number" then
o = i
else
o = strlower(i)
end
t[i] = o
return o
end,
}) local strlowerCache = Lib.strlowerCache
-- Matches lowercase player spell names to their spellBookID
Lib.spellsByName_spell = Lib.spellsByName_spell or {}
local spellsByName_spell = Lib.spellsByName_spell
-- Matches player spellIDs to their spellBookID
Lib.spellsByID_spell = Lib.spellsByID_spell or {}
local spellsByID_spell = Lib.spellsByID_spell
-- Matches lowercase pet spell names to their spellBookID
Lib.spellsByName_pet = Lib.spellsByName_pet or {}
local spellsByName_pet = Lib.spellsByName_pet
-- Matches pet spellIDs to their spellBookID
Lib.spellsByID_pet = Lib.spellsByID_pet or {}
local spellsByID_pet = Lib.spellsByID_pet
-- Updates spellsByName and spellsByID
local function UpdateBook(bookType)
local max = 0
for i = 1, GetNumSpellTabs() do
local _, _, offs, numspells, _, specId = GetSpellTabInfo(i)
if specId == 0 then
max = offs + numspells
end
end
local spellsByName = Lib["spellsByName_" .. bookType]
local spellsByID = Lib["spellsByID_" .. bookType]
wipe(spellsByName)
wipe(spellsByID)
for spellBookID = 1, max do
local type, baseSpellID = GetSpellBookItemInfo(spellBookID, bookType)
if type == "SPELL" or type == "PETACTION" then
local currentSpellName = GetSpellBookItemName(spellBookID, bookType)
local link = GetSpellLink(currentSpellName)
local currentSpellID = tonumber(link and link:gsub("|", "||"):match("spell:(%d+)"))
-- For each entry we add to a table,
-- only add it if there isn't anything there already.
-- This prevents weird passives from overwriting real, legit spells.
-- For example, in WoW 7.3.5 the ret paladin mastery
-- was coming back with a base spell named "Judgement",
-- which was overwriting the real "Judgement".
-- Passives usually come last in the spellbook,
-- so this should work just fine as a workaround.
-- This issue with "Judgement" is gone in BFA because the mastery changed.
if currentSpellName and not spellsByName[strlower(currentSpellName)] then
spellsByName[strlower(currentSpellName)] = spellBookID
end
if currentSpellID and not spellsByID[currentSpellID] then
spellsByID[currentSpellID] = spellBookID
end
if type == "SPELL" then
-- PETACTION (pet abilities) don't return a spellID for baseSpellID,
-- so base spells only work for proper player spells.
local baseSpellName = GetSpellInfo(baseSpellID)
if baseSpellName and not spellsByName[strlower(baseSpellName)] then
spellsByName[strlower(baseSpellName)] = spellBookID
end
if baseSpellID and not spellsByID[baseSpellID] then
spellsByID[baseSpellID] = spellBookID
end
end
end
end
end
-- Handles updating spellsByName and spellsByID
if not Lib.updaterFrame then
Lib.updaterFrame = CreateFrame("Frame")
end
Lib.updaterFrame:UnregisterAllEvents()
Lib.updaterFrame:RegisterEvent("SPELLS_CHANGED")
local function UpdateSpells()
UpdateBook("spell")
UpdateBook("pet")
end
Lib.updaterFrame:SetScript("OnEvent", UpdateSpells)
UpdateSpells()
--- Improved spell range checking function.
-- @name SpellRange.IsSpellInRange
-- @paramsig spell, unit
-- @param spell Name or spellID of a spell that you wish to check the range of. The spell must be a spell that you have in your spellbook or your pet's spellbook.
-- @param unit UnitID of the spell that you wish to check the range on.
-- @return Exact same returns as http://wowprogramming.com/docs/api/IsSpellInRange
-- @usage
-- -- Check spell range by spell name on unit "target"
-- local SpellRange = LibStub("SpellRange-1.0")
-- local inRange = SpellRange.IsSpellInRange("Stormstrike", "target")
--
-- -- Check spell range by spellID on unit "mouseover"
-- local SpellRange = LibStub("SpellRange-1.0")
-- local inRange = SpellRange.IsSpellInRange(17364, "mouseover")
function Lib.IsSpellInRange(spellInput, unit)
if isNumber[spellInput] then
local spell = spellsByID_spell[spellInput]
if spell then
return IsSpellInRange(spell, "spell", unit)
else
local spell = spellsByID_pet[spellInput]
if spell then
return IsSpellInRange(spell, "pet", unit)
end
end
else
local spellInput = strlowerCache[spellInput]
local spell = spellsByName_spell[spellInput]
if spell then
return IsSpellInRange(spell, "spell", unit)
else
local spell = spellsByName_pet[spellInput]
if spell then
return IsSpellInRange(spell, "pet", unit)
end
end
return IsSpellInRange(spellInput, unit)
end
end
--- Improved SpellHasRange.
-- @name SpellRange.SpellHasRange
-- @paramsig spell
-- @param spell Name or spellID of a spell that you wish to check for a range. The spell must be a spell that you have in your spellbook or your pet's spellbook.
-- @return Exact same returns as http://wowprogramming.com/docs/api/SpellHasRange
-- @usage
-- -- Check if a spell has a range by spell name
-- local SpellRange = LibStub("SpellRange-1.0")
-- local hasRange = SpellRange.SpellHasRange("Stormstrike")
--
-- -- Check if a spell has a range by spellID
-- local SpellRange = LibStub("SpellRange-1.0")
-- local hasRange = SpellRange.SpellHasRange(17364)
function Lib.SpellHasRange(spellInput)
if isNumber[spellInput] then
local spell = spellsByID_spell[spellInput]
if spell then
return SpellHasRange(spell, "spell")
else
local spell = spellsByID_pet[spellInput]
if spell then
return SpellHasRange(spell, "pet")
end
end
else
local spellInput = strlowerCache[spellInput]
local spell = spellsByName_spell[spellInput]
if spell then
return SpellHasRange(spell, "spell")
else
local spell = spellsByName_pet[spellInput]
if spell then
return SpellHasRange(spell, "pet")
end
end
return SpellHasRange(spellInput)
end
end

View File

@ -0,0 +1,61 @@
# LibSpellRange-1.0
## Background
Blizzard's `IsSpellInRange` API has always been very limited - you either must have the name of the spell,
or its spell book ID. Checking directly by spellID is simply not possible.
Now, since Mists of Pandaria, Blizzard changed the way that many talents and specialization spells work -
instead of giving you a new spell when leaned, they replace existing spells. These replacement spells do
not work with Blizzard's IsSpellInRange function whatsoever; this limitation is what prompted the creation of this lib.
## Usage
**LibSpellRange-1.0** exposes an enhanced version of IsSpellInRange that:
* Allows ranged checking based on both spell name and spellID.
* Works correctly with replacement spells that will not work using Blizzard's IsSpellInRange method alone.
### `SpellRange.IsSpellInRange(spell, unit)` - Improved `IsSpellInRange`
#### Parameters
- `spell` - Name or spellID of a spell that you wish to check the range of. The spell must be a spell that you have in your spellbook or your pet's spellbook.
- `unit` - UnitID of the spell that you wish to check the range on.
#### Return value
Exact same returns as [the built-in `IsSpellInRange`](http://wowprogramming.com/docs/api/IsSpellInRange.html)
#### Usage
``` lua
-- Check spell range by spell name on unit "target"
local SpellRange = LibStub("SpellRange-1.0")
local inRange = SpellRange.IsSpellInRange("Stormstrike", "target")
-- Check spell range by spellID on unit "mouseover"
local SpellRange = LibStub("SpellRange-1.0")
local inRange = SpellRange.IsSpellInRange(17364, "mouseover")
```
### `SpellRange.SpellHasRange(spell)` - Improved `SpellHasRange`
#### Parameters
- `spell` - Name or spellID of a spell that you wish to check for a range. The spell must be a spell that you have in your spellbook or your pet's spellbook.
#### Return value
Exact same returns as [the built-in `SpellHasRange`](http://wowprogramming.com/docs/api/SpellHasRange.html)
#### Usage
``` lua
-- Check if a spell has a range by spell name
local SpellRange = LibStub("SpellRange-1.0")
local hasRange = SpellRange.SpellHasRange("Stormstrike")
-- Check if a spell has a range by spellID
local SpellRange = LibStub("SpellRange-1.0")
local hasRange = SpellRange.SpellHasRange(17364)
```

View File

@ -0,0 +1,3 @@
<Ui>
<Script file="LibSpellRange-1.0.lua"/>
</Ui>

View File

@ -47,6 +47,7 @@ function Announcements:Initialize()
self:RegisterMessage("UNIT_HEALTH")
self:RegisterMessage("TRINKET_USED")
self:RegisterMessage("TRINKET_READY")
self:RegisterMessage("SHADOWSIGHT")
end
function Announcements:Reset()
@ -148,6 +149,10 @@ function Announcements:CheckDrink(unit, aura)
end
end
function Announcements:SHADOWSIGHT(msg)
self:Send(msg, 2)
end
function Announcements:Send(msg, throttle, color)
if (throttle and throttle > 0) then
if (not self.throttled[msg]) then
@ -172,9 +177,9 @@ function Announcements:Send(msg, throttle, color)
RaidNotice_AddMessage(RaidBossEmoteFrame, msg, color)
elseif (dest == "fct" and IsAddOnLoaded("Blizzard_CombatText")) then
CombatText_AddMessage(msg, nil, color.r, color.g, color.b, "crit", 1)
--[[elseif (dest == "msbt" and IsAddOnLoaded("MikScrollingBattleText")) then
MikSBT.DisplayMessage(msg, MikSBT.DISPLAYTYPE_NOTIFICATION, true, color.r * 255, color.g * 255, color.b * 255)
elseif (dest == "sct" and IsAddOnLoaded("sct")) then
elseif (dest == "msbt" and IsAddOnLoaded("MikScrollingBattleText")) then
MikSBT.Animations.DisplayMessage(msg, MikSBT.DISPLAYTYPE_NOTIFICATION, true, color.r * 255, color.g * 255, color.b * 255)
--[[elseif (dest == "sct" and IsAddOnLoaded("sct")) then
SCT:DisplayText(msg, color, true, "event", 1)
elseif (dest == "parrot" and IsAddOnLoaded("parrot")) then
Parrot:ShowMessage(msg, "Notification", true, color.r, color.g, color.b)--]]
@ -205,9 +210,15 @@ function Announcements:GetOptions()
["self"] = L["Self"],
["party"] = L["Party"],
["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 {
headerAnnouncements = {
type = "header",

View File

@ -1,6 +1,5 @@
local floor, str_len, tostring, str_sub, str_find, pairs = math.floor, string.len, tostring, string.sub, string.find, pairs
local CreateFrame = CreateFrame
local GetLocale = GetLocale
local GetTime = GetTime
local Gladdy = LibStub("Gladdy")
@ -15,44 +14,41 @@ function ACDFrame:OnEvent(event, ...)
end
function ACDFrame:Initialize()
if ACDFrame.locales[GetLocale()] then
self.locale = ACDFrame.locales[GetLocale()]
else
self.locale = ACDFrame.locales["default"]
end
self.locale = Gladdy:GetArenaTimer()
self.hidden = false
self.countdown = -1
self.texturePath = "Interface\\AddOns\\Gladdy\\Images\\Countdown\\";
local ACDNumFrame = CreateFrame("Frame", "ACDNumFrame", UIParent)
ACDNumFrame:EnableMouse(false)
ACDNumFrame:SetHeight(256)
ACDNumFrame:SetWidth(256)
ACDNumFrame:SetPoint("CENTER", 0, 128)
ACDNumFrame:SetHeight(512)
ACDNumFrame:SetWidth(512)
ACDNumFrame:SetPoint("CENTER", 0, 256)
ACDNumFrame:Show()
self.ACDNumFrame = ACDNumFrame
local ACDNumTens = ACDNumFrame:CreateTexture("ACDNumTens", "HIGH")
ACDNumTens:SetWidth(256)
ACDNumTens:SetHeight(128)
ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -48, 0)
ACDNumTens:SetHeight(256)
ACDNumTens:SetPoint("CENTER", ACDNumFrame, "CENTER", -50, 0)
self.ACDNumTens = ACDNumTens
local ACDNumOnes = ACDNumFrame:CreateTexture("ACDNumOnes", "HIGH")
ACDNumOnes:SetWidth(256)
ACDNumOnes:SetHeight(128)
ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", 48, 0)
ACDNumOnes:SetHeight(256)
ACDNumOnes:SetPoint("CENTER", ACDNumFrame, "CENTER", 50, 0)
self.ACDNumOnes = ACDNumOnes
local ACDNumOne = ACDNumFrame:CreateTexture("ACDNumOne", "HIGH")
ACDNumOne:SetWidth(256)
ACDNumOne:SetHeight(128)
ACDNumOne:SetHeight(256)
ACDNumOne:SetPoint("CENTER", ACDNumFrame, "CENTER", 0, 0)
self.ACDNumOne = ACDNumOne
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_SPOTTED")
self:RegisterMessage("UNIT_SPEC")
self.faction = UnitFactionGroup("player")
end
function ACDFrame.OnUpdate(self, elapse)
@ -62,11 +58,7 @@ function ACDFrame.OnUpdate(self, elapse)
if ((floor(self.countdown) ~= floor(self.countdown - elapse)) and (floor(self.countdown - elapse) >= 0)) then
local str = tostring(floor(self.countdown - elapse));
if (floor(self.countdown - elapse) == 0) then
self.ACDNumTens:Hide();
self.ACDNumOnes:Hide();
self.ACDNumOne:Hide();
elseif (str_len(str) == 2) then
if (str_len(str) == 2) then
-- Display has 2 digits
self.ACDNumOne:Hide();
self.ACDNumTens:Show();
@ -77,8 +69,10 @@ function ACDFrame.OnUpdate(self, elapse)
self.ACDNumFrame:SetScale(0.7)
elseif (str_len(str) == 1) then
-- 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:SetTexture(self.texturePath .. str_sub(str, 0, 1));
self.ACDNumOne:SetTexture(self.texturePath .. path);
self.ACDNumOnes:Hide();
self.ACDNumTens:Hide();
self.ACDNumFrame:SetScale(1.0)
@ -97,18 +91,24 @@ function ACDFrame.OnUpdate(self, elapse)
end
function ACDFrame:JOINED_ARENA()
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
self:SetScript("OnEvent", ACDFrame.OnEvent)
self.endTime = GetTime() + 70
self:SetScript("OnUpdate", ACDFrame.OnUpdate)
if Gladdy.db.countdown then
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
self:SetScript("OnEvent", ACDFrame.OnEvent)
self.endTime = GetTime() + 70
self:SetScript("OnUpdate", ACDFrame.OnUpdate)
end
end
function ACDFrame:ENEMY_SPOTTED()
ACDFrame:Reset()
if not Gladdy.frame.testing then
ACDFrame:Reset()
end
end
function ACDFrame:UNIT_SPEC()
ACDFrame:Reset()
if not Gladdy.frame.testing then
ACDFrame:Reset()
end
end
function ACDFrame:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
@ -129,15 +129,15 @@ function ACDFrame:UpdateFrame()
self.ACDNumFrame:SetPoint("CENTER", 0, 128)
self.ACDNumTens:SetWidth(Gladdy.db.arenaCountdownSize)
self.ACDNumTens:SetHeight(Gladdy.db.arenaCountdownSize/2)
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/2)
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/2)
self.ACDNumOne:SetHeight(Gladdy.db.arenaCountdownSize)
self.ACDNumOne:SetPoint("CENTER", self.ACDNumFrame, "CENTER", 0, 0)
end
@ -178,69 +178,7 @@ function ACDFrame:GetOptions()
min = 64,
max = 512,
step = 16,
width = "full",
}),
}
end
ACDFrame.locales = {
["default"] = {
[61] = "One minute until the Arena battle begins!",
[31] = "Thirty seconds until the Arena battle begins!",
[16] = "Fifteen seconds until the Arena battle begins!",
[0] = "The Arena battle has begun!",
},
["esES"] = {
[61] = "¡Un minuto hasta que dé comienzo la batalla en arena!",
[31] = "¡Treinta segundos hasta que comience la batalla en arena!",
[16] = "¡Quince segundos hasta que comience la batalla en arena!",
[0] = "¡La batalla en arena ha comenzado!",
},
["ptBR"] = {
[61] = "Um minuto até a batalha na Arena começar!",
[31] = "Trinta segundos até a batalha na Arena começar!",
[16] = "Quinze segundos até a batalha na Arena começar!",
[0] = "A batalha na Arena começou!",
},
["deDE"] = {
[61] = "Noch eine Minute bis der Arenakampf beginnt!",
[31] = "Noch dreißig Sekunden bis der Arenakampf beginnt!",
[16] = "Noch fünfzehn Sekunden bis der Arenakampf beginnt!",
[0] = "Der Arenakampf hat begonnen!",
},
["frFR"] = {
[60] = "Le combat d'arène commence dans une minute\194\160!",
[30] = "Le combat d'arène commence dans trente secondes\194\160!",
[15] = "Le combat d'arène commence dans quinze secondes\194\160!",
[0] = "Le combat d'arène commence\194\160!",
},
["ruRU"] = {
[61] = "Одна минута до начала боя на арене!",
[31] = "Тридцать секунд до начала боя на арене!",
[16] = "До начала боя на арене осталось 15 секунд.",
[0] = "Бой начался!",
},
["itIT"] = { -- TODO
-- Beta has no itIT version available?
},
["koKR"] = {
[61] = "투기장 전투 시작 1분 전입니다!",
[31] = "투기장 전투 시작 30초 전입니다!",
[16] = "투기장 전투 시작 15초 전입니다!",
[0] = "투기장 전투가 시작되었습니다!",
},
["zhCN"] = {
[61] = "竞技场战斗将在一分钟后开始!",
[31] = "竞技场战斗将在三十秒后开始!",
[16] = "竞技场战斗将在十五秒后开始!",
[0] = "竞技场的战斗开始了!",
},
["zhTW"] = {
[61] = "1分鐘後競技場戰鬥開始!",
[31] = "30秒後競技場戰鬥開始!",
[16] = "15秒後競技場戰鬥開始!",
[0] = "競技場戰鬥開始了!",
},
}
ACDFrame.locales["esMX"] = ACDFrame.locales["esES"]
ACDFrame.locales["ptPT"] = ACDFrame.locales["ptBR"]

View File

@ -1,6 +1,7 @@
local pairs, ipairs, select, tinsert, tbl_sort, tostring = pairs, ipairs, select, tinsert, table.sort, tostring
local pairs, ipairs, select, tinsert, tbl_sort, tostring, tonumber, rand = pairs, ipairs, select, tinsert, table.sort, tostring, tonumber, math.random
local GetSpellInfo = GetSpellInfo
local GetSpellDescription = GetSpellDescription
local CreateFrame, GetTime = CreateFrame, GetTime
local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF
@ -8,7 +9,7 @@ local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local function defaultSpells(auraType)
local spells = {}
for k,v in pairs(Gladdy:GetImportantAuras()) do
for _,v in pairs(Gladdy:GetImportantAuras()) do
if not auraType or auraType == v.track then
spells[tostring(v.spellID)] = {}
spells[tostring(v.spellID)].enabled = true
@ -18,6 +19,16 @@ local function defaultSpells(auraType)
end
return spells
end
local function defaultInterrupts()
local spells = {}
for _,v in pairs(Gladdy:GetInterrupts()) do
spells[tostring(v.spellID)] = {}
spells[tostring(v.spellID)].enabled = true
spells[tostring(v.spellID)].priority = v.priority
end
return spells
end
local Auras = Gladdy:NewModule("Auras", nil, {
auraFont = "DorisPP",
auraFontSizeScale = 1,
@ -27,7 +38,10 @@ local Auras = Gladdy:NewModule("Auras", nil, {
auraDebuffBorderColor = { r = 0, g = 1, b = 0, a = 1 },
auraDisableCircle = false,
auraCooldownAlpha = 1,
auraListDefault = defaultSpells()
auraListDefault = defaultSpells(),
auraListInterrupts = defaultInterrupts(),
auraInterruptColorsEnabled = true,
auraInterruptColors = Gladdy:GetSpellSchoolColors()
})
function Auras:Initialize()
@ -39,6 +53,7 @@ function Auras:Initialize()
self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("AURA_GAIN")
self:RegisterMessage("AURA_FADE")
self:RegisterMessage("SPELL_INTERRUPT")
end
function Auras:CreateFrame(unit)
@ -73,7 +88,7 @@ function Auras:CreateFrame(unit)
auraFrame:SetAllPoints(classIcon)
auraFrame.text = auraFrame.cooldownFrame:CreateFontString(nil, "OVERLAY")
auraFrame.text:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), 10, "OUTLINE")
auraFrame.text:SetFont(Gladdy:SMFetch("font", "auraFont"), 10, "OUTLINE")
auraFrame.text:SetTextColor(Gladdy.db.auraFontColor.r, Gladdy.db.auraFontColor.g, Gladdy.db.auraFontColor.b, Gladdy.db.auraFontColor.a)
--auraFrame.text:SetShadowOffset(1, -1)
--auraFrame.text:SetShadowColor(0, 0, 0, 1)
@ -83,16 +98,92 @@ function Auras:CreateFrame(unit)
auraFrame:SetScript("OnUpdate", function(self, elapsed)
if (self.active) then
if (self.interruptFrame.priority and self.priority < self.interruptFrame.priority) then
self:SetAlpha(0.01)
else
self:SetAlpha(1)
end
if (self.timeLeft <= 0) then
Auras:AURA_FADE(self.unit, self.track)
else
self.timeLeft = self.timeLeft - elapsed
self.text:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
Gladdy:FormatTimer(self.text, self.timeLeft, self.timeLeft < 10)
end
else
self:SetAlpha(0.01)
end
end)
Gladdy.buttons[unit].aura = auraFrame
self.frames[unit] = auraFrame
self:CreateInterrupt(unit)
self:ResetUnit(unit)
end
function Auras:CreateInterrupt(unit)
local interruptFrame = CreateFrame("Frame", nil, Gladdy.modules["Class Icon"].frames[unit])
interruptFrame:EnableMouse(false)
interruptFrame:SetFrameStrata("MEDIUM")
interruptFrame:SetFrameLevel(3)
interruptFrame.cooldown = CreateFrame("Cooldown", nil, interruptFrame, "CooldownFrameTemplate")
interruptFrame.cooldown.noCooldownCount = true
interruptFrame.cooldown:SetFrameStrata("MEDIUM")
interruptFrame.cooldown:SetFrameLevel(4)
interruptFrame.cooldown:SetReverse(true)
interruptFrame.cooldown:SetHideCountdownNumbers(true)
interruptFrame.cooldownFrame = CreateFrame("Frame", nil, interruptFrame)
interruptFrame.cooldownFrame:ClearAllPoints()
interruptFrame.cooldownFrame:SetAllPoints(interruptFrame)
interruptFrame.cooldownFrame:SetFrameStrata("MEDIUM")
interruptFrame.cooldownFrame:SetFrameLevel(5)
interruptFrame.icon = interruptFrame:CreateTexture(nil, "BACKGROUND")
interruptFrame.icon:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
interruptFrame.icon:SetAllPoints(interruptFrame)
interruptFrame.icon.overlay = interruptFrame.cooldownFrame:CreateTexture(nil, "OVERLAY")
interruptFrame.icon.overlay:SetAllPoints(interruptFrame)
interruptFrame.icon.overlay:SetTexture(Gladdy.db.buttonBorderStyle)
local classIcon = Gladdy.modules["Class Icon"].frames[unit]
interruptFrame:ClearAllPoints()
interruptFrame:SetAllPoints(classIcon)
interruptFrame.text = interruptFrame.cooldownFrame:CreateFontString(nil, "OVERLAY")
interruptFrame.text:SetFont(Gladdy:SMFetch("font", "auraFont"), 10, "OUTLINE")
interruptFrame.text:SetTextColor(Gladdy.db.auraFontColor.r, Gladdy.db.auraFontColor.g, Gladdy.db.auraFontColor.b, Gladdy.db.auraFontColor.a)
--auraFrame.text:SetShadowOffset(1, -1)
--auraFrame.text:SetShadowColor(0, 0, 0, 1)
interruptFrame.text:SetJustifyH("CENTER")
interruptFrame.text:SetPoint("CENTER")
interruptFrame.unit = unit
interruptFrame:SetScript("OnUpdate", function(self, elapsed)
if (self.active) then
if (Auras.frames[self.unit].priority and self.priority <= Auras.frames[self.unit].priority) then
self:SetAlpha(0.01)
else
self:SetAlpha(1)
end
if (self.timeLeft <= 0) then
self.active = false
self.priority = nil
self.spellSchool = nil
self.cooldown:Clear()
self:SetAlpha(0.01)
else
self.timeLeft = self.timeLeft - elapsed
Gladdy:FormatTimer(self.text, self.timeLeft, self.timeLeft < 10)
end
else
self:SetAlpha(0.01)
end
end)
Gladdy.buttons[unit].interruptFrame = interruptFrame
self.frames[unit].interruptFrame = interruptFrame
self:ResetUnit(unit)
end
@ -114,7 +205,7 @@ function Auras:UpdateFrame(unit)
auraFrame.cooldown:SetPoint("CENTER", auraFrame, "CENTER")
auraFrame.cooldown:SetAlpha(Gladdy.db.auraCooldownAlpha)
auraFrame.text:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), (width/2 - 1) * Gladdy.db.auraFontSizeScale, "OUTLINE")
auraFrame.text:SetFont(Gladdy:SMFetch("font", "auraFont"), (width/2 - 1) * Gladdy.db.auraFontSizeScale, "OUTLINE")
auraFrame.text:SetTextColor(Gladdy.db.auraFontColor.r, Gladdy.db.auraFontColor.g, Gladdy.db.auraFontColor.b, Gladdy.db.auraFontColor.a)
auraFrame.icon.overlay:SetTexture(Gladdy.db.auraBorderStyle)
@ -125,10 +216,48 @@ function Auras:UpdateFrame(unit)
else
auraFrame.icon.overlay:SetVertexColor(0, 0, 0, 1)
end
auraFrame.icon.overlay:Hide()
if not auraFrame.active then
auraFrame.icon.overlay:Hide()
end
if Gladdy.db.auraDisableCircle then
auraFrame.cooldown:SetAlpha(0)
end
self:UpdateInterruptFrame(unit)
end
function Auras:UpdateInterruptFrame(unit)
local interruptFrame = self.frames[unit] and self.frames[unit].interruptFrame
if (not interruptFrame) then
return
end
local width, height = Gladdy.db.classIconSize * Gladdy.db.classIconWidthFactor, Gladdy.db.classIconSize
interruptFrame:SetWidth(width)
interruptFrame:SetHeight(height)
interruptFrame:SetAllPoints(Gladdy.modules["Class Icon"].frames[unit])
interruptFrame.cooldown:SetWidth(width - width/16)
interruptFrame.cooldown:SetHeight(height - height/16)
interruptFrame.cooldown:ClearAllPoints()
interruptFrame.cooldown:SetPoint("CENTER", interruptFrame, "CENTER")
interruptFrame.cooldown:SetAlpha(Gladdy.db.auraCooldownAlpha)
interruptFrame.text:SetFont(Gladdy:SMFetch("font", "auraFont"), (width/2 - 1) * Gladdy.db.auraFontSizeScale, "OUTLINE")
interruptFrame.text:SetTextColor(Gladdy.db.auraFontColor.r, Gladdy.db.auraFontColor.g, Gladdy.db.auraFontColor.b, Gladdy.db.auraFontColor.a)
interruptFrame.icon.overlay:SetTexture(Gladdy.db.auraBorderStyle)
if interruptFrame.spellSchool then
interruptFrame.icon.overlay:SetVertexColor(self:GetInterruptColor(interruptFrame.spellSchool))
else
interruptFrame.icon.overlay:SetVertexColor(0, 0, 0, 1)
end
if not interruptFrame.active then
interruptFrame.icon.overlay:Hide()
end
if Gladdy.db.auraDisableCircle then
interruptFrame.cooldown:SetAlpha(0)
end
end
function Auras:ResetUnit(unit)
@ -138,33 +267,72 @@ function Auras:ResetUnit(unit)
end
function Auras:Test(unit)
local spellName, _, icon
local spellName, spellid, icon, limit
if (unit == "arena1") then
spellName, _, icon = GetSpellInfo(12826)
self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 12826, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
elseif (unit == "arena2") then
spellName, _, icon = GetSpellInfo(6770)
self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_FADE(unit,AURA_TYPE_DEBUFF)
self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 6770, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
elseif (unit == "arena3") then
spellName, _, icon = GetSpellInfo(31224)
self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_GAIN(unit,AURA_TYPE_BUFF, 31224, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
spellName, _, icon = GetSpellInfo(18425)
self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 18425, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_FADE(unit, AURA_TYPE_DEBUFF)
--Auras
local enabledDebuffs, enabledBuffs, testauras = {}, {}
for spellIdStr,value in pairs(Gladdy.db.auraListDefault) do
if value.enabled then
if value.track == AURA_TYPE_BUFF then
tinsert(enabledBuffs, {value = value, spellIdStr = spellIdStr})
else
tinsert(enabledDebuffs, {value = value, spellIdStr = spellIdStr})
end
end
end
if unit == "arena2" then
testauras = enabledBuffs
else
testauras = enabledDebuffs
end
if #testauras > 0 then
limit = rand(1, #testauras)
local v = testauras[rand(1, #testauras)]
spellid = tonumber(v.spellIdStr)
spellName = select(1, GetSpellInfo(tonumber(v.spellIdStr)))
icon = select(3, GetSpellInfo(tonumber(v.spellIdStr)))
if Gladdy.exceptionNames[spellid] then
spellName = Gladdy.exceptionNames[spellid]
end
if (unit == "arena2") then
if (v.value.track == AURA_TYPE_BUFF) then
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
end
else
self:AURA_GAIN(unit,v.value.track, spellid, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
end
end
--Interrupts
if (unit == "arena1" or unit == "arena3") then
local enabledInterrupts = {}
local spellSchools = {}
for k,_ in pairs(Gladdy:GetSpellSchoolColors()) do
tinsert(spellSchools, k)
end
for spellIdStr, value in pairs(Gladdy.db.auraListInterrupts) do
if value.enabled then
tinsert(enabledInterrupts, spellIdStr)
end
end
if #enabledInterrupts > 0 then
local extraSpellSchool = spellSchools[rand(1, #spellSchools)]
spellid = tonumber(enabledInterrupts[rand(1, #enabledInterrupts)])
spellName = select(1, GetSpellInfo(spellid))
self:SPELL_INTERRUPT(unit,spellid, spellName, "physical", spellid, spellName, extraSpellSchool)
end
end
end
function Auras:JOINED_ARENA()
for i=1, Gladdy.curBracket do
--self.frames["arena" .. i]:RegisterUnitEvent("UNIT_AURA", "arena" .. i)
--self.frames["arena" .. i]:SetScript("OnEvent", Auras.OnEvent)
end
--[[for i=1, Gladdy.curBracket do
self.frames["arena" .. i]:RegisterUnitEvent("UNIT_AURA", "arena" .. i)
self.frames["arena" .. i]:SetScript("OnEvent", Auras.OnEvent)
end--]]
end
function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, expirationTime, count, debuffType)
@ -173,6 +341,10 @@ function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, exp
return
end
if spellID == 31117 then
spellName = "Unstable Affliction Silence"
end
if not self.auras[spellName] then
return
end
@ -189,7 +361,7 @@ function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, exp
auraFrame.name = spellName
auraFrame.timeLeft = expirationTime - GetTime()
auraFrame.priority = Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)].priority
auraFrame.icon:SetTexture(icon)
auraFrame.icon:SetTexture(Gladdy:GetImportantAuras()[GetSpellInfo(self.auras[spellName].spellID)] and Gladdy:GetImportantAuras()[GetSpellInfo(self.auras[spellName].spellID)].texture or icon)
auraFrame.track = auraType
auraFrame.active = true
auraFrame.icon.overlay:Show()
@ -213,9 +385,9 @@ function Auras:AURA_FADE(unit, auraType)
return
end
if auraFrame.active then
auraFrame.cooldown:SetCooldown(GetTime(), 0)
auraFrame.cooldown:Clear()
end
auraFrame.cooldown:Hide()
--auraFrame.cooldown:Hide()
auraFrame.active = false
auraFrame.name = nil
auraFrame.timeLeft = 0
@ -224,11 +396,123 @@ function Auras:AURA_FADE(unit, auraType)
auraFrame.endTime = nil
auraFrame.icon:SetTexture("")
auraFrame.text:SetText("")
auraFrame.icon.overlay:Hide()
auraFrame.cooldownFrame:Hide()
--auraFrame.icon.overlay:Hide()
--auraFrame.cooldownFrame:Hide()
end
function Auras:GetInterruptColor(extraSpellSchool)
if not Gladdy.db.auraInterruptColorsEnabled then
return Gladdy.db.auraDebuffBorderColor.r, Gladdy.db.auraDebuffBorderColor.g, Gladdy.db.auraDebuffBorderColor.b, Gladdy.db.auraDebuffBorderColor.a
else
local color = Gladdy.db.auraInterruptColors[extraSpellSchool] or Gladdy.db.auraInterruptColors["unknown"]
return color.r, color.g, color.b, color.a
end
end
function Auras:SPELL_INTERRUPT(unit,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool)
local auraFrame = self.frames[unit]
local interruptFrame = auraFrame and auraFrame.interruptFrame
local button = Gladdy.buttons[unit]
if (not interruptFrame) then
return
end
if not Gladdy.db.auraListInterrupts[tostring(Gladdy:GetInterrupts()[spellName].spellID)] or not Gladdy.db.auraListInterrupts[tostring(Gladdy:GetInterrupts()[spellName].spellID)].enabled then
return
end
if (interruptFrame.priority and interruptFrame.priority > Gladdy.db.auraListInterrupts[tostring(Gladdy:GetInterrupts()[spellName].spellID)].priority) then
return
end
local multiplier = ((button.spec == L["Restoration"] and button.class == "SHAMAN") or (button.spec == L["Holy"] and button.class == "PALADIN")) and 0.7 or 1
local duration = Gladdy:GetInterrupts()[spellName].duration * multiplier
interruptFrame.startTime = GetTime()
interruptFrame.endTime = GetTime() + duration
interruptFrame.name = spellName
interruptFrame.timeLeft = duration
interruptFrame.priority = Gladdy.db.auraListInterrupts[tostring(Gladdy:GetInterrupts()[spellName].spellID)].priority
interruptFrame.icon:SetTexture(Gladdy:GetInterrupts()[spellName].texture)
interruptFrame.spellSchool = extraSpellSchool
interruptFrame.active = true
interruptFrame.icon.overlay:Show()
interruptFrame.cooldownFrame:Show()
interruptFrame.icon.overlay:SetVertexColor(self:GetInterruptColor(extraSpellSchool))
if not Gladdy.db.auraDisableCircle then
interruptFrame.cooldown:Show()
interruptFrame.cooldown:SetCooldown(interruptFrame.startTime, duration)
end
--interruptFrame:SetAlpha(1)
end
function Auras:GetOptions()
local borderArgs = {
headerAuras = {
type = "header",
name = L["Border"],
order = 2,
},
auraBorderStyle = Gladdy:option({
type = "select",
name = L["Border style"],
order = 9,
values = Gladdy:GetIconStyles(),
}),
auraBuffBorderColor = Gladdy:colorOption({
type = "color",
name = L["Buff color"],
desc = L["Color of the text"],
order = 10,
hasAlpha = true,
width = "0.8",
}),
auraDebuffBorderColor = Gladdy:colorOption({
type = "color",
name = L["Debuff color"],
desc = L["Color of the text"],
order = 11,
hasAlpha = true,
width = "0.8",
}),
headerColors = {
type = "header",
name = L["Interrupt Spells School Colors"],
order = 12,
},
auraInterruptColorsEnabled = Gladdy:option({
type = "toggle",
name = L["Enable Interrupt Spell School Colors"],
width = "full",
desc = L["Will use Debuff Color if disabled"],
order = 13,
}),
}
local list = {}
for k,v in pairs(Gladdy:GetSpellSchoolColors()) do
tinsert(list, { key = k, val = v})
end
tbl_sort(list, function(a, b) return a.val.type < b.val.type end)
for i,v in ipairs(list) do
borderArgs["auraSpellSchool" .. v.key] = {
type = "color",
name = L[v.val.type],
order = i + 13,
hasAlpha = true,
width = "0.8",
set = function(_, r, g, b, a)
Gladdy.db.auraInterruptColors[v.key].r = r
Gladdy.db.auraInterruptColors[v.key].g = g
Gladdy.db.auraInterruptColors[v.key].b = b
Gladdy.db.auraInterruptColors[v.key].a = a
end,
get = function()
local color = Gladdy.db.auraInterruptColors[v.key]
return color.r, color.g, color.b, color.a
end
}
end
return {
header = {
type = "header",
@ -264,6 +548,7 @@ function Auras:GetOptions()
max = 1,
step = 0.1,
order = 4,
width = "full",
}),
}
},
@ -293,6 +578,7 @@ function Auras:GetOptions()
min = 0.1,
max = 2,
step = 0.1,
width = "full",
}),
auraFontColor = Gladdy:colorOption({
type = "color",
@ -307,51 +593,30 @@ function Auras:GetOptions()
type = "group",
name = L["Border"],
order = 3,
args = {
headerAuras = {
type = "header",
name = L["Border"],
order = 2,
},
auraBorderStyle = Gladdy:option({
type = "select",
name = L["Border style"],
order = 9,
values = Gladdy:GetIconStyles(),
}),
auraBuffBorderColor = Gladdy:colorOption({
type = "color",
name = L["Buff color"],
desc = L["Color of the text"],
order = 10,
hasAlpha = true,
width = "0.8",
}),
auraDebuffBorderColor = Gladdy:colorOption({
type = "color",
name = L["Debuff color"],
desc = L["Color of the text"],
order = 11,
hasAlpha = true,
width = "0.8",
}),
}
args = borderArgs
}
}
},
debuffList = {
type = "group",
childGroups = "tree",
name = "Debuffs",
name = L["Debuffs"],
order = 4,
args = Auras:GetAuraOptions(AURA_TYPE_DEBUFF)
},
buffList = {
type = "group",
childGroups = "tree",
name = "Buffs",
name = L["Buffs"],
order = 5,
args = Auras:GetAuraOptions(AURA_TYPE_BUFF)
},
interruptList = {
type = "group",
childGroups = "tree",
name = L["Interrupts"],
order = 6,
args = Auras:GetInterruptOptions()
}
}
end
@ -363,8 +628,8 @@ function Auras:GetAuraOptions(auraType)
width = "0.7",
name = L["Check All"],
type = "execute",
func = function(info)
for k,v in pairs(defaultSpells(auraType)) do
func = function()
for k,_ in pairs(defaultSpells(auraType)) do
Gladdy.db.auraListDefault[k].enabled = true
end
end,
@ -374,37 +639,45 @@ function Auras:GetAuraOptions(auraType)
width = "0.7",
name = L["Uncheck All"],
type = "execute",
func = function(info)
for k,v in pairs(defaultSpells(auraType)) do
func = function()
for k,_ in pairs(defaultSpells(auraType)) do
Gladdy.db.auraListDefault[k].enabled = false
end
end,
},
}
local auras = {}
for k,v in pairs(Gladdy:GetImportantAuras()) do
for _,v in pairs(Gladdy:GetImportantAuras()) do
if v.track == auraType then
tinsert(auras, v.spellID)
end
end
tbl_sort(auras)
tbl_sort(auras, function(a, b) return GetSpellInfo(a) < GetSpellInfo(b) end)
for i,k in ipairs(auras) do
options[tostring(k)] = {
type = "group",
name = GetSpellInfo(k),
name = (Gladdy:GetImportantAuras()["Unstable Affliction Silence"]
and Gladdy:GetImportantAuras()["Unstable Affliction Silence"].spellID == k
and Gladdy:GetImportantAuras()["Unstable Affliction Silence"].altName)
or (Gladdy:GetImportantAuras()[select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689))]
and Gladdy:GetImportantAuras()[select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689))].spellID == k
and Gladdy:GetImportantAuras()[select(1, GetSpellInfo(27010)) .. " " .. select(1, GetSpellInfo(16689))].altName)
or Gladdy:GetImportantAuras()[GetSpellInfo(k)].altName
or GetSpellInfo(k),
order = i+2,
icon = select(3, GetSpellInfo(k)),
icon = Gladdy:GetImportantAuras()[GetSpellInfo(k)] and Gladdy:GetImportantAuras()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
args = {
enabled = {
order = 1,
name = L["Enabled"],
desc = GetSpellDescription(k),
type = "toggle",
image = select(3, GetSpellInfo(k)),
image = Gladdy:GetImportantAuras()[GetSpellInfo(k)] and Gladdy:GetImportantAuras()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
width = "2",
set = function(info, value)
set = function(_, value)
Gladdy.db.auraListDefault[tostring(k)].enabled = value
end,
get = function(info)
get = function()
return Gladdy.db.auraListDefault[tostring(k)].enabled
end
},
@ -416,12 +689,88 @@ function Auras:GetAuraOptions(auraType)
max = 50,
width = "2",
step = 1,
get = function(info)
get = function()
return Gladdy.db.auraListDefault[tostring(k)].priority
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.auraListDefault[tostring(k)].priority = value
end,
width = "full",
}
}
}
end
return options
end
function Auras:GetInterruptOptions()
local options = {
checkAll = {
order = 1,
width = "0.7",
name = L["Check All"],
type = "execute",
func = function()
for k,_ in pairs(defaultInterrupts()) do
Gladdy.db.auraListInterrupts[k].enabled = true
end
end,
},
uncheckAll = {
order = 2,
width = "0.7",
name = L["Uncheck All"],
type = "execute",
func = function()
for k,_ in pairs(defaultInterrupts()) do
Gladdy.db.auraListInterrupts[k].enabled = false
end
end,
},
}
local auras = {}
for _,v in pairs(Gladdy:GetInterrupts()) do
tinsert(auras, v.spellID)
end
tbl_sort(auras, function(a, b) return GetSpellInfo(a) < GetSpellInfo(b) end)
for i,k in ipairs(auras) do
options[tostring(k)] = {
type = "group",
name = Gladdy:GetInterrupts()["Unstable Affliction Silence"]
and Gladdy:GetInterrupts()["Unstable Affliction Silence"].spellID == k
and Gladdy:GetInterrupts()["Unstable Affliction Silence"].altName
or GetSpellInfo(k),
order = i+2,
icon = Gladdy:GetInterrupts()[GetSpellInfo(k)] and Gladdy:GetInterrupts()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
args = {
enabled = {
order = 1,
name = L["Enabled"],
type = "toggle",
image = Gladdy:GetInterrupts()[GetSpellInfo(k)] and Gladdy:GetInterrupts()[GetSpellInfo(k)].texture or select(3, GetSpellInfo(k)),
width = "2",
set = function(_, value)
Gladdy.db.auraListInterrupts[tostring(k)].enabled = value
end,
get = function()
return Gladdy.db.auraListInterrupts[tostring(k)].enabled
end
},
priority = {
order = 2,
name = L["Priority"],
type = "range",
min = 0,
max = 50,
width = "2",
step = 1,
get = function()
return Gladdy.db.auraListInterrupts[tostring(k)].priority
end,
set = function(_, value)
Gladdy.db.auraListInterrupts[tostring(k)].priority = value
end,
width = "full",
}
}
}

View File

@ -1,21 +1,10 @@
local GetSpellInfo = GetSpellInfo
local CreateFrame = CreateFrame
local GetTime = GetTime
local select, lower, ceil, tremove, tinsert, pairs, ipairs, tostring = select, string.lower, ceil, tremove, tinsert, pairs, ipairs, tostring
local auraTypeColor = { }
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 auraTypes = {AURA_TYPE_BUFF, AURA_TYPE_DEBUFF}
auraTypeColor["none"] = { r = 0.80, g = 0, b = 0 , a = 1}
auraTypeColor["magic"] = { r = 0.20, g = 0.60, b = 1.00, a = 1}
auraTypeColor["curse"] = { r = 0.60, g = 0.00, b = 1.00, a = 1 }
auraTypeColor["disease"] = { r = 0.60, g = 0.40, b = 0, a = 1 }
auraTypeColor["poison"] = { r = 0.00, g = 0.60, b = 0, a = 1 }
auraTypeColor["immune"] = { r = 1.00, g = 0.02, b = 0.99, a = 1 }
auraTypeColor["form"] = auraTypeColor["none"]
auraTypeColor["aura"] = auraTypeColor["none"]
auraTypeColor[""] = auraTypeColor["none"]
---------------------------
-- Module init
---------------------------
@ -55,14 +44,14 @@ local BuffsDebuffs = Gladdy:NewModule("Buffs and Debuffs", nil, {
buffsBorderColorsEnabled = true,
trackedDebuffs = defaultTrackedDebuffs,
trackedBuffs = defaultTrackedBuffs,
buffsBorderColorCurse = auraTypeColor["curse"],
buffsBorderColorMagic = auraTypeColor["magic"],
buffsBorderColorPoison = auraTypeColor["poison"],
buffsBorderColorPhysical = auraTypeColor["none"],
buffsBorderColorImmune = auraTypeColor["immune"],
buffsBorderColorDisease = auraTypeColor["disease"],
buffsBorderColorForm = auraTypeColor["form"],
buffsBorderColorAura = auraTypeColor["aura"]
buffsBorderColorCurse = Gladdy:GetAuraTypeColor()["curse"],
buffsBorderColorMagic = Gladdy:GetAuraTypeColor()["magic"],
buffsBorderColorPoison = Gladdy:GetAuraTypeColor()["poison"],
buffsBorderColorPhysical = Gladdy:GetAuraTypeColor()["none"],
buffsBorderColorImmune = Gladdy:GetAuraTypeColor()["immune"],
buffsBorderColorDisease = Gladdy:GetAuraTypeColor()["disease"],
buffsBorderColorForm = Gladdy:GetAuraTypeColor()["form"],
buffsBorderColorAura = Gladdy:GetAuraTypeColor()["aura"]
})
local spellSchoolToOptionValueTable
@ -145,24 +134,30 @@ end
function BuffsDebuffs:Test(unit)
if Gladdy.db.buffsEnabled then
if unit == "arena1" or unit == "arena3" then
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1943, select(1, GetSpellInfo(1943)), select(3, GetSpellInfo(1943)), 10, GetTime() + 10, 1, "physical")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 18647, select(1, GetSpellInfo(18647)), select(3, GetSpellInfo(18647)), 10, GetTime() + 10, 1, "immune")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27218, select(1, GetSpellInfo(27218)), select(3, GetSpellInfo(27218)), 24, GetTime() + 20, 1, "curse")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27216, select(1, GetSpellInfo(27216)), select(3, GetSpellInfo(27216)), 18, GetTime() + 18, 1, "magic")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27189, select(1, GetSpellInfo(27189)), select(3, GetSpellInfo(27189)), 12, GetTime() + 12, 5, "poison")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 33076, select(1, GetSpellInfo(33076)), select(3, GetSpellInfo(33076)), 20, GetTime() + 20, 1, "magic")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 26980, select(1, GetSpellInfo(26980)), select(3, GetSpellInfo(26980)), 20, GetTime() + 20, 5, "magic")
elseif unit == "arena2" then
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1943, select(1, GetSpellInfo(1943)), select(3, GetSpellInfo(1943)), 10, GetTime() + 10, 1, "physical")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 1, select(1, GetSpellInfo(1)), select(3, GetSpellInfo(1)), 20, GetTime() + 20, 5, "poison")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 27009, select(1, GetSpellInfo(27009)), select(3, GetSpellInfo(27009)), 20, GetTime() + 15, 1, "magic")
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 11426, select(1, GetSpellInfo(11426)), select(3, GetSpellInfo(11426)), 10, GetTime() + 10, 1, "magic")
local spellSchools = { "physical", "magic", "curse", "poison", "disease", "immune" }
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF)
local i = 1
for spellID, enabled in pairs(Gladdy.db.trackedDebuffs) do
if i > 4 then
break
end
if enabled then
BuffsDebuffs:AddOrRefreshAura(unit, spellID, AURA_TYPE_DEBUFF, 15, 15, random(1,5), spellSchools[random(1,6)], select(3, GetSpellInfo(spellID)), i)
i = i + 1
end
end
i = 1
for spellID, enabled in pairs(Gladdy.db.trackedBuffs) do
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
@ -269,9 +264,9 @@ local function styleIcon(aura, auraType)
aura.border:SetTexture(Gladdy.db.buffsBorderStyle)
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.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)
end
@ -280,6 +275,7 @@ function BuffsDebuffs:UpdateFrame(unit)
self.frames[unit].debuffFrame:ClearAllPoints()
--DEBUFFS
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
if Gladdy.db.buffsCooldownPos == "TOP" then
@ -298,9 +294,9 @@ function BuffsDebuffs:UpdateFrame(unit)
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
end
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then
self.frames[unit].debuffFrame:SetPoint("TOPLEFT", Gladdy.buttons[unit].powerBar, "BOTTOMRIGHT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin)
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].powerBar, "BOTTOMLEFT", Gladdy.db.buffsXOffset, Gladdy.db.buffsYOffset -verticalMargin)
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
@ -342,9 +338,9 @@ function BuffsDebuffs:UpdateFrame(unit)
verticalMargin = verticalMargin + Gladdy.db.cooldownSize
end
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then
self.frames[unit].buffFrame:SetPoint("TOPLEFT", Gladdy.buttons[unit].powerBar, "BOTTOMRIGHT", Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset -verticalMargin)
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].powerBar, "BOTTOMLEFT", Gladdy.db.buffsBuffsXOffset, Gladdy.db.buffsBuffsYOffset -verticalMargin)
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
@ -476,28 +472,23 @@ local function iconTimer(auraFrame, elapsed)
local timeLeftMilliSec = auraFrame.endtime - GetTime()
local timeLeftSec = ceil(timeLeftMilliSec)
auraFrame.timeLeft = timeLeftMilliSec
--auraFrame.cooldowncircle:SetCooldown(auraFrame.startTime, auraFrame.endtime)
if timeLeftSec >= 60 then
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(0.7, 1, 0) end
auraFrame.cooldown:SetFormattedText("%dm", ceil(timeLeftSec / 60))
elseif timeLeftSec < 60 and timeLeftSec >= 11 then
--if it's less than 60s
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(0.7, 1, 0) end
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
elseif timeLeftSec <= 10 and timeLeftSec >= 5 then
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0.7, 0) end
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
elseif timeLeftSec <= 4 and timeLeftSec >= 3 then
if Gladdy.db.buffsDynamicColor then auraFrame.cooldown:SetTextColor(1, 0, 0) end
auraFrame.cooldown:SetFormattedText("%d", timeLeftSec)
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
if Gladdy.db.buffsDynamicColor then
if timeLeftSec >= 60 then
auraFrame.cooldown:SetTextColor(0.7, 1, 0)
elseif timeLeftSec < 60 and timeLeftSec >= 11 then
auraFrame.cooldown:SetTextColor(0.7, 1, 0)
elseif timeLeftSec <= 10 and timeLeftSec >= 5 then
auraFrame.cooldown:SetTextColor(1, 0.7, 0)
elseif timeLeftSec <= 4 and timeLeftSec >= 3 then
auraFrame.cooldown:SetTextColor(1, 0, 0)
elseif timeLeftMilliSec <= 3 and timeLeftMilliSec > 0 then
auraFrame.cooldown:SetTextColor(1, 0, 0)
end
end
if timeLeftMilliSec < 0 then
auraFrame:Hide()
end
Gladdy:FormatTimer(auraFrame.cooldown, timeLeftMilliSec, timeLeftMilliSec <= 3)
else
auraFrame.cooldown:SetText("")
end
@ -662,6 +653,7 @@ function BuffsDebuffs:GetOptions()
min = 5,
max = 50,
step = 1,
width = "full",
}),
buffsBuffsWidthFactor = Gladdy:option({
type = "range",
@ -671,6 +663,7 @@ function BuffsDebuffs:GetOptions()
min = 0.5,
max = 2,
step = 0.05,
width = "full",
}),
buffsBuffsIconPadding = Gladdy:option({
type = "range",
@ -680,6 +673,7 @@ function BuffsDebuffs:GetOptions()
min = 0,
max = 10,
step = 0.1,
width = "full",
}),
},
},
@ -722,6 +716,7 @@ function BuffsDebuffs:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
buffsBuffsYOffset = Gladdy:option({
type = "range",
@ -730,6 +725,7 @@ function BuffsDebuffs:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
},
},
@ -750,6 +746,7 @@ function BuffsDebuffs:GetOptions()
min = 0,
max = 1,
step = 0.05,
width = "full",
}),
}
}
@ -778,6 +775,7 @@ function BuffsDebuffs:GetOptions()
min = 5,
max = 50,
step = 1,
width = "full",
}),
buffsWidthFactor = Gladdy:option({
type = "range",
@ -787,6 +785,7 @@ function BuffsDebuffs:GetOptions()
min = 0.5,
max = 2,
step = 0.05,
width = "full",
}),
buffsIconPadding = Gladdy:option({
type = "range",
@ -796,6 +795,7 @@ function BuffsDebuffs:GetOptions()
min = 0,
max = 10,
step = 0.1,
width = "full",
}),
},
},
@ -838,6 +838,7 @@ function BuffsDebuffs:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
buffsYOffset = Gladdy:option({
type = "range",
@ -846,6 +847,7 @@ function BuffsDebuffs:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
},
},
@ -866,6 +868,7 @@ function BuffsDebuffs:GetOptions()
min = 0,
max = 1,
step = 0.05,
width = "full",
}),
}
}
@ -894,12 +897,13 @@ function BuffsDebuffs:GetOptions()
max = 1,
step = 0.1,
order = 10,
width = "full",
}),
},
},
font = {
type = "group",
name = "Font",
name = L["Font"],
order = 4,
args = {
header = {
@ -923,6 +927,7 @@ function BuffsDebuffs:GetOptions()
min = 0.1,
max = 2,
step = 0.1,
width = "full",
}),
buffsDynamicColor = Gladdy:option({
type = "toggle",
@ -941,7 +946,7 @@ function BuffsDebuffs:GetOptions()
},
border = {
type = "group",
name = "Border",
name = L["Border"],
order = 5,
args = {
header = {
@ -1028,7 +1033,7 @@ function BuffsDebuffs:GetOptions()
},
},
debuffList = {
name = "Debuff Lists",
name = L["Debuff Lists"],
type = "group",
order = 11,
childGroups = "tree",
@ -1043,7 +1048,7 @@ function BuffsDebuffs:GetOptions()
end,
},
buffList = {
name = "Buff Lists",
name = L["Buff Lists"],
type = "group",
order = 12,
childGroups = "tree",

View File

@ -19,6 +19,7 @@ local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists
local Castbar = Gladdy:NewModule("Cast Bar", 70, {
castBarEnabled = true,
castBarHeight = 20,
castBarWidth = 160,
castBarIconSize = 22,
@ -60,13 +61,13 @@ function Castbar:CreateFrame(unit)
castBar:EnableMouse(false)
castBar.unit = unit
castBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.castBarBorderStyle),
castBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "castBarBorderStyle"),
edgeSize = Gladdy.db.castBarBorderSize })
castBar:SetBackdropBorderColor(Gladdy.db.castBarBorderColor.r, Gladdy.db.castBarBorderColor.g, Gladdy.db.castBarBorderColor.b, Gladdy.db.castBarBorderColor.a)
castBar:SetFrameLevel(1)
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:SetMinMaxValues(0, 100)
castBar.bar:SetFrameLevel(0)
@ -80,7 +81,7 @@ function Castbar:CreateFrame(unit)
castBar.bg = castBar.bar:CreateTexture(nil, "BACKGROUND")
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:SetAllPoints(castBar.bar)
@ -100,7 +101,7 @@ function Castbar:CreateFrame(unit)
end
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)
castBar.spellText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
castBar.spellText:SetShadowOffset(1, -1)
castBar.spellText:SetShadowColor(0, 0, 0, 1)
@ -108,7 +109,7 @@ function Castbar:CreateFrame(unit)
castBar.spellText:SetPoint("LEFT", 7, 0) -- Text of the spell
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)
castBar.timeText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
castBar.timeText:SetShadowOffset(1, -1)
castBar.timeText:SetShadowColor(0, 0, 0, 1)
@ -121,7 +122,6 @@ function Castbar:CreateFrame(unit)
end
function Castbar:UpdateFrame(unit)
local button = Gladdy.buttons[unit]
local castBar = self.frames[unit]
if (not castBar) then
return
@ -129,17 +129,17 @@ function Castbar:UpdateFrame(unit)
castBar:SetWidth(Gladdy.db.castBarWidth)
castBar:SetHeight(Gladdy.db.castBarHeight)
castBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.castBarBorderStyle),
castBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "castBarBorderStyle"),
edgeSize = Gladdy.db.castBarBorderSize })
castBar:SetBackdropBorderColor(Gladdy.db.castBarBorderColor.r, Gladdy.db.castBarBorderColor.g, Gladdy.db.castBarBorderColor.b, Gladdy.db.castBarBorderColor.a)
castBar.bar:SetStatusBarTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.castBarTexture))
castBar.bar:SetStatusBarTexture(Gladdy:SMFetch("statusbar", "castBarTexture"))
castBar.bar:ClearAllPoints()
castBar.bar:SetStatusBarColor(Gladdy.db.castBarColor.r, Gladdy.db.castBarColor.g, Gladdy.db.castBarColor.b, Gladdy.db.castBarColor.a)
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.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)
if Gladdy.db.castBarSparkEnabled then
@ -183,10 +183,10 @@ function Castbar:UpdateFrame(unit)
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)
castBar.spellText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
castBar.timeText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.auraFont), Gladdy.db.castBarFontSize)
castBar.timeText:SetFont(Gladdy:SMFetch("font", "castBarFont"), Gladdy.db.castBarFontSize)
castBar.timeText:SetTextColor(Gladdy.db.castBarFontColor.r, Gladdy.db.castBarFontColor.g, Gladdy.db.castBarFontColor.b, Gladdy.db.castBarFontColor.a)
castBar.icon.texture.overlay:SetTexture(Gladdy.db.castBarIconStyle)
@ -439,42 +439,41 @@ end
---------------------------
function Castbar:JOINED_ARENA()
for i=1, Gladdy.curBracket do
local unit = "arena" .. i
local castBar = self.frames[unit]
castBar:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
castBar:RegisterEvent("UNIT_SPELLCAST_DELAYED")
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
castBar:RegisterUnitEvent("UNIT_SPELLCAST_START", unit)
castBar:RegisterUnitEvent("UNIT_SPELLCAST_STOP", unit)
castBar:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", unit)
castBar:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", unit)
castBar:SetScript("OnEvent", Castbar.OnEvent)
castBar:SetScript("OnUpdate", Castbar.OnUpdate)
castBar.fadeOut = nil
self:CAST_STOP(unit)
--Castbar.OnEvent(castBar, "PLAYER_ENTERING_WORLD")
if Gladdy.db.castBarEnabled then
for i=1, Gladdy.curBracket do
local unit = "arena" .. i
local castBar = self.frames[unit]
castBar:RegisterEvent("UNIT_SPELLCAST_INTERRUPTED")
castBar:RegisterEvent("UNIT_SPELLCAST_DELAYED")
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
castBar:RegisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
castBar:RegisterUnitEvent("UNIT_SPELLCAST_START", unit)
castBar:RegisterUnitEvent("UNIT_SPELLCAST_STOP", unit)
castBar:RegisterUnitEvent("UNIT_SPELLCAST_FAILED", unit)
castBar:RegisterUnitEvent("UNIT_SPELLCAST_SUCCEEDED", unit)
castBar:SetScript("OnEvent", Castbar.OnEvent)
castBar:SetScript("OnUpdate", Castbar.OnUpdate)
castBar.fadeOut = nil
self:CAST_STOP(unit)
--Castbar.OnEvent(castBar, "PLAYER_ENTERING_WORLD")
end
end
end
function Castbar:ResetUnit(unit)
local castBar = self.frames[unit]
castBar:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED")
castBar:UnregisterEvent("UNIT_SPELLCAST_DELAYED")
castBar:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_START")
castBar:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_UPDATE")
castBar:UnregisterEvent("UNIT_SPELLCAST_CHANNEL_STOP")
castBar:UnregisterEvent("UNIT_SPELLCAST_START")
castBar:UnregisterEvent("UNIT_SPELLCAST_STOP")
castBar:UnregisterEvent("UNIT_SPELLCAST_FAILED")
castBar:UnregisterAllEvents()
castBar:SetScript("OnEvent", nil)
castBar:SetScript("OnUpdate", nil)
castBar.fadeOut = nil
self:CAST_STOP(unit)
end
function Castbar:Reset()
self.test = nil
end
---------------------------
-- TEST
@ -482,25 +481,30 @@ end
---------------------------
function Castbar:Test(unit)
local spell, _, icon, value, maxValue, event, endTime, startTime
self.test = true
if Gladdy.db.castBarEnabled then
local spell, _, icon, value, maxValue, event, endTime, startTime
if (unit == "arena2") then
spell, _, icon = GetSpellInfo(27072)
value, maxValue, event = 0, 40, "cast"
elseif (unit == "arena1") then
spell, _, icon = GetSpellInfo(27220)
endTime = GetTime() * 1000 + 60*1000
startTime = GetTime() * 1000
value = (endTime / 1000) - GetTime()
maxValue = (endTime - startTime) / 1000
event = "channel"
elseif (unit == "arena3") then
spell, _, icon = GetSpellInfo(20770)
value, maxValue, event = 0, 60, "cast"
end
if (unit == "arena2") then
spell, _, icon = GetSpellInfo(27072)
value, maxValue, event = 0, 40, "cast"
elseif (unit == "arena1") then
spell, _, icon = GetSpellInfo(27220)
endTime = GetTime() * 1000 + 60*1000
startTime = GetTime() * 1000
value = (endTime / 1000) - GetTime()
maxValue = (endTime - startTime) / 1000
event = "channel"
else
spell, _, icon = GetSpellInfo(20770)
value, maxValue, event = 0, 60, "cast"
end
if (spell) then
self:CAST_START(unit, spell, icon, value, maxValue, event)
if (spell) then
self:CAST_START(unit, spell, icon, value, maxValue, event)
end
else
self:CAST_STOP(unit)
end
end
@ -541,11 +545,17 @@ function Castbar:GetOptions()
name = L["Cast Bar"],
order = 2,
},
castBarEnabled = option({
type = "toggle",
name = L["Enabled"],
desc = L["If test is running, type \"/gladdy test\" again"],
order = 3,
}),
group = {
type = "group",
childGroups = "tree",
name = L["Frame"],
order = 3,
order = 4,
args = {
barFrame = {
type = "group",
@ -565,6 +575,7 @@ function Castbar:GetOptions()
min = 0,
max = 50,
step = 1,
width = "full",
}),
castBarWidth = option({
type = "range",
@ -574,6 +585,7 @@ function Castbar:GetOptions()
min = 0,
max = 300,
step = 1,
width = "full",
}),
headerTexture = {
type = "header",
@ -614,6 +626,7 @@ function Castbar:GetOptions()
min = 0.5,
max = Gladdy.db.castBarHeight/2,
step = 0.5,
width = "full",
}),
castBarBorderStyle = option({
type = "select",
@ -647,6 +660,7 @@ function Castbar:GetOptions()
min = 0,
max = 100,
step = 1,
width = "full",
}),
headerBorder = {
type = "header",
@ -723,6 +737,7 @@ function Castbar:GetOptions()
order = 4,
min = 1,
max = 20,
width = "full",
}),
headerFormat = {
type = "header",
@ -781,6 +796,7 @@ function Castbar:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
castBarYOffset = option({
type = "range",
@ -789,6 +805,7 @@ function Castbar:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
}
},

View File

@ -178,8 +178,8 @@ function Classicon:GetOptions()
name = L["Show Spec Icon"],
desc = L["Shows Spec Icon once spec is detected"],
order = 3,
get = function(info) return Gladdy.db.classIconSpecIcon end,
set = function(info, value)
get = function() return Gladdy.db.classIconSpecIcon end,
set = function(_, value)
Gladdy.db.classIconSpecIcon = value
if Gladdy.curBracket and Gladdy.curBracket > 0 then
for i=1,Gladdy.curBracket do
@ -215,6 +215,7 @@ function Classicon:GetOptions()
max = 100,
step = 1,
order = 3,
width = "full",
}),
classIconWidthFactor = Gladdy:option({
type = "range",
@ -223,6 +224,7 @@ function Classicon:GetOptions()
max = 2,
step = 0.05,
order = 4,
width = "full",
}),
},
},

217
Modules/Clicks.lua Normal file
View File

@ -0,0 +1,217 @@
local tinsert = table.insert
local pairs = pairs
local tonumber = tonumber
local tostring = tostring
local GetBindingKey = GetBindingKey
local ClearOverrideBindings = ClearOverrideBindings
local SetOverrideBindingClick = SetOverrideBindingClick
local MACRO, TARGET, FOCUS, ADDON_DISABLED = MACRO, TARGET, FOCUS, ADDON_DISABLED
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local attributes = {
{ name = L["Target"], button = "1", modifier = "", action = "target", spell = "" },
{ name = L["Focus"], button = "2", modifier = "", action = "focus", spell = "" },
}
for i = 3, 10 do
tinsert(attributes, { name = L["Action #%d"]:format(i), button = "", modifier = "", action = "disabled", spell = "" })
end
local Clicks = Gladdy:NewModule("Clicks", nil, {
attributes = attributes,
})
BINDING_HEADER_GLADDY = "Gladdy"
BINDING_NAME_GLADDYBUTTON1_LEFT = L["Left Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_LEFT = L["Left Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_LEFT = L["Left Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_LEFT = L["Left Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_LEFT = L["Left Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_RIGHT = L["Right Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_RIGHT = L["Right Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_RIGHT = L["Right Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_RIGHT = L["Right Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_RIGHT = L["Right Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_MIDDLE = L["Middle Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_MIDDLE = L["Middle Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_MIDDLE = L["Middle Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_MIDDLE = L["Middle Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_MIDDLE = L["Middle Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_BUTTON4 = L["Button4 Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_BUTTON4 = L["Button4 Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_BUTTON4 = L["Button4 Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_BUTTON4 = L["Button4 Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_BUTTON4 = L["Button4 Click Enemy 5"]
BINDING_NAME_GLADDYBUTTON1_BUTTON5 = L["Button5 Click Enemy 1"]
BINDING_NAME_GLADDYBUTTON2_BUTTON5 = L["Button5 Click Enemy 2"]
BINDING_NAME_GLADDYBUTTON3_BUTTON5 = L["Button5 Click Enemy 3"]
BINDING_NAME_GLADDYBUTTON4_BUTTON5 = L["Button5 Click Enemy 4"]
BINDING_NAME_GLADDYBUTTON5_BUTTON5 = L["Button5 Click Enemy 5"]
function Clicks:Initialize()
--
end
function Clicks:Reset()
--
end
function Clicks:ResetUnit(unit)
--
end
function Clicks:UpdateFrame(unit)
self:SetupAttributes(unit)
end
function Clicks:UpdateFrameOnce()
for _, v in pairs(Gladdy.buttons) do
local left = GetBindingKey(("GLADDYBUTTON%d_LEFT"):format(v.id))
local right = GetBindingKey(("GLADDYBUTTON%d_RIGHT"):format(v.id))
local middle = GetBindingKey(("GLADDYBUTTON%d_MIDDLE"):format(v.id))
local button4 = GetBindingKey(("GLADDYBUTTON%d_BUTTON4"):format(v.id))
local button5 = GetBindingKey(("GLADDYBUTTON%d_BUTTON5"):format(v.id))
ClearOverrideBindings(v.secure)
if (left) then
SetOverrideBindingClick(v.secure, false, left, v.secure:GetName(), "LeftButton")
end
if (right) then
SetOverrideBindingClick(v.secure, false, right, v.secure:GetName(), "RightButton")
end
if (middle) then
SetOverrideBindingClick(v.secure, false, middle, v.secure:GetName(), "MiddleButton")
end
if (button4) then
SetOverrideBindingClick(v.secure, false, button4, v.secure:GetName(), "Button4")
end
if (button5) then
SetOverrideBindingClick(v.secure, false, button5, v.secure:GetName(), "Button5")
end
end
end
function Clicks:SetupAttributes(unit)
local button = Gladdy.buttons[unit]
if (not button) then
return
end
for _, v in pairs(Gladdy.db.attributes) do
self:SetupAttribute(button, v.button, v.modifier, v.action, v.spell)
end
end
function Clicks:SetupAttribute(button, key, mod, action, spell)
local attr = ""
local text = ""
if (action == "macro") then
attr = mod .. "macrotext" .. key
text = spell:gsub("%*arena%*", button.unit)
button.secure:SetAttribute(mod .. "type" .. key, "macro")
elseif (action ~= "disabled") then
if (action == "target") then
attr = mod .. "type" .. key
text = "target"
elseif (action == "focus") then
attr = mod .. "type" .. key
text = "focus"
elseif (action == "spell") then
attr = mod .. "type" .. key
text = "spell"
button.secure:SetAttribute(mod .. "spell" .. key, spell)
end
end
button.secure:SetAttribute(attr, text)
end
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"], ["*"] = 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 function SetupAttributeOption(i)
return {
type = "group",
name = Gladdy.dbi.profile.attributes[i].name,
desc = Gladdy.dbi.profile.attributes[i].name,
order = i + 1,
get = function(info)
return Gladdy.dbi.profile.attributes[tonumber(info[#info - 1])][info[#info]]
end,
set = function(info, value)
Gladdy.dbi.profile.attributes[tonumber(info[#info - 1])][info[#info]] = value
if (info[#info] == "name") then
Gladdy.options.args.Clicks.args[info[#info - 1]].name = value
end
Gladdy:UpdateFrame()
end,
args = {
name = {
type = "input",
name = L["Name"],
desc = L["Select the name of the click option"],
order = 1,
},
button = {
type = "select",
name = L["Button"],
desc = L["Select which mouse button to use"],
order = 2,
values = buttons,
},
modifier = {
type = "select",
name = L["Modifier"],
desc = L["Select which modifier to use"],
order = 3,
values = modifiers,
},
action = {
type = "select",
name = L["Action"],
desc = L["Select what action this mouse button does"],
order = 4,
values = clickValues,
},
spell = {
type = "input",
name = L["Cast Spell / Macro"],
desc = L["\n|cff1ac742Cast Spell:|r\n" ..
"Type in the spell name.\n" ..
"For example:\n" ..
"|cff17d1c8Polymorph|r\n" ..
"\n" ..
"|cff1ac742Macro:|r\n" ..
"Use *arena* as placeholder.\n" ..
"For example:\n" ..
"|cff17d1c8/cast [@*arena*] Blind\n" ..
"/run SendChatMessage(\"Blinding \" .. UnitName(\"*arena*\"), \"PARTY\")|r"],
order = 5,
width = "full",
multiline = 10,
},
},
}
end
function Clicks:GetOptions()
local options = {}
for i = 1, 10 do
options[tostring(i)] = SetupAttributeOption(i)
end
return options
end

View File

@ -95,7 +95,7 @@ function CombatIndicator.OnEvent(self, elapsed)
if (self.lastTimeUpdated > self.updateInterval) then
for i=1,Gladdy.curBracket do
local unit = "arena" .. i
if CombatIndicator.test or (UnitExists(unit) and UnitAffectingCombat(unit)) then
if Gladdy.db.ciEnabled and (CombatIndicator.test or (UnitExists(unit) and UnitAffectingCombat(unit))) then
CombatIndicator.frames[unit]:Show()
else
CombatIndicator.frames[unit]:Hide()
@ -141,6 +141,7 @@ function CombatIndicator:GetOptions()
max = 100,
step = 1,
order = 2,
width = "full",
}),
ciWidthFactor = Gladdy:option({
type = "range",
@ -149,6 +150,7 @@ function CombatIndicator:GetOptions()
max = 2,
step = 0.05,
order = 3,
width = "full",
}),
ciAlpha = Gladdy:option({
type = "range",
@ -157,6 +159,7 @@ function CombatIndicator:GetOptions()
max = 1,
step = 0.05,
order = 4,
width = "full",
}),
},
},
@ -201,6 +204,7 @@ function CombatIndicator:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
ciYOffset = Gladdy:option({
type = "range",
@ -209,6 +213,7 @@ function CombatIndicator:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
},
},

View File

@ -36,9 +36,9 @@ local L = Gladdy.L
local function getDefaultCooldown()
local cooldowns = {}
for class, t in pairs(Gladdy:GetCooldownList()) do
for spellId, v in pairs(t) do
local spellName, _, texture = GetSpellInfo(spellId)
for _,spellTable in pairs(Gladdy:GetCooldownList()) do
for spellId,_ in pairs(spellTable) do
local spellName = GetSpellInfo(spellId)
if spellName then
cooldowns[tostring(spellId)] = true
else
@ -72,14 +72,14 @@ local Cooldowns = Gladdy:NewModule("Cooldowns", nil, {
function Cooldowns:Initialize()
self.cooldownSpellIds = {}
self.spellTextures = {}
for class, t in pairs(Gladdy:GetCooldownList()) do
for k, v in pairs(t) do
local spellName, _, texture = GetSpellInfo(k)
for _,spellTable in pairs(Gladdy:GetCooldownList()) do
for spellId,_ in pairs(spellTable) do
local spellName, _, texture = GetSpellInfo(spellId)
if spellName then
self.cooldownSpellIds[spellName] = k
self.spellTextures[k] = texture
self.cooldownSpellIds[spellName] = spellId
self.spellTextures[spellId] = texture
else
Gladdy:Print("spellid does not exist " .. k)
Gladdy:Print("spellid does not exist " .. spellId)
end
end
end
@ -120,7 +120,7 @@ function Cooldowns:CreateFrame(unit)
icon.border:SetVertexColor(Gladdy.db.cooldownBorderColor.r, Gladdy.db.cooldownBorderColor.g, Gladdy.db.cooldownBorderColor.b, Gladdy.db.cooldownBorderColor.a)
icon.cooldownFont = icon.cooldownFrame:CreateFontString(nil, "OVERLAY")
icon.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.cooldownFont), Gladdy.db.cooldownSize / 2 * Gladdy.db.cooldownFontScale, "OUTLINE")
icon.cooldownFont:SetFont(Gladdy:SMFetch("font", "cooldownFont"), Gladdy.db.cooldownSize / 2 * Gladdy.db.cooldownFontScale, "OUTLINE")
icon.cooldownFont:SetTextColor(Gladdy.db.cooldownFontColor.r, Gladdy.db.cooldownFontColor.g, Gladdy.db.cooldownFontColor.b, Gladdy.db.cooldownFontColor.a)
icon.cooldownFont:SetAllPoints(icon)
@ -134,7 +134,7 @@ function Cooldowns:UpdateFrame(unit)
-- Cooldown frame
if (Gladdy.db.cooldown) then
button.spellCooldownFrame:ClearAllPoints()
local verticalMargin = -(Gladdy.db.powerBarHeight)/2
local powerBarHeight = Gladdy.db.powerBarEnabled and (Gladdy.db.powerBarHeight + 1) or 0
local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
if Gladdy.db.cooldownYPos == "TOP" then
if Gladdy.db.cooldownXPos == "RIGHT" then
@ -144,9 +144,9 @@ function Cooldowns:UpdateFrame(unit)
end
elseif Gladdy.db.cooldownYPos == "BOTTOM" then
if Gladdy.db.cooldownXPos == "RIGHT" then
button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset)
button.spellCooldownFrame:SetPoint("TOPRIGHT", button.healthBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset - powerBarHeight)
else
button.spellCooldownFrame:SetPoint("TOPLEFT", button.powerBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset)
button.spellCooldownFrame:SetPoint("TOPLEFT", button.healthBar, "BOTTOMLEFT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset - powerBarHeight)
end
elseif Gladdy.db.cooldownYPos == "LEFT" then
local anchor = Gladdy:GetAnchor(unit, "LEFT")
@ -172,7 +172,7 @@ function Cooldowns:UpdateFrame(unit)
local icon = button.spellCooldownFrame["icon" .. j]
icon:SetHeight(Gladdy.db.cooldownSize)
icon:SetWidth(Gladdy.db.cooldownSize * Gladdy.db.cooldownWidthFactor)
icon.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.cooldownFont), Gladdy.db.cooldownSize / 2 * Gladdy.db.cooldownFontScale, "OUTLINE")
icon.cooldownFont:SetFont(Gladdy:SMFetch("font", "cooldownFont"), Gladdy.db.cooldownSize / 2 * Gladdy.db.cooldownFontScale, "OUTLINE")
icon.cooldownFont:SetTextColor(Gladdy.db.cooldownFontColor.r, Gladdy.db.cooldownFontColor.g, Gladdy.db.cooldownFontColor.b, Gladdy.db.cooldownFontColor.a)
icon:ClearAllPoints()
if (Gladdy.db.cooldownXPos == "RIGHT") then
@ -220,7 +220,7 @@ function Cooldowns:UpdateFrame(unit)
icon.cooldown:SetPoint("CENTER", icon, "CENTER")
icon.cooldown:SetAlpha(Gladdy.db.cooldownCooldownAlpha)
icon.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.cooldownFont), (icon:GetWidth()/2 - 1) * Gladdy.db.cooldownFontScale, "OUTLINE")
icon.cooldownFont:SetFont(Gladdy:SMFetch("font", "cooldownFont"), (icon:GetWidth()/2 - 1) * Gladdy.db.cooldownFontScale, "OUTLINE")
icon.cooldownFont:SetTextColor(Gladdy.db.cooldownFontColor.r, Gladdy.db.cooldownFontColor.g, Gladdy.db.cooldownFontColor.b, Gladdy.db.cooldownFontColor.a)
icon.border:SetTexture(Gladdy.db.cooldownBorderStyle)
@ -238,9 +238,16 @@ end
function Cooldowns:Test(unit)
local button = Gladdy.buttons[unit]
button.spellCooldownFrame:Show()
button.lastCooldownSpell = 1
self:UpdateTestCooldowns(unit)
if Gladdy.db.cooldown then
button.spellCooldownFrame:Show()
button.lastCooldownSpell = 1
self:UpdateTestCooldowns(unit)
else
button.spellCooldownFrame:Hide()
button.lastCooldownSpell = 1
self:UpdateTestCooldowns(unit)
end
end
function Cooldowns:UpdateTestCooldowns(unit)
@ -254,13 +261,12 @@ function Cooldowns:UpdateTestCooldowns(unit)
button.test = true
-- use class spells
for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId
self:CooldownUsed(unit, button.class, k, nil)
for spellId,_ in pairs(Gladdy:GetCooldownList()[button.class]) do
self:CooldownUsed(unit, button.class, spellId)
end
-- use race spells
for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
self:CooldownUsed(unit, button.race, k, nil)
for spellId,_ in pairs(Gladdy:GetCooldownList()[button.race]) do
self:CooldownUsed(unit, button.race, spellId)
end
end
end
@ -288,19 +294,13 @@ function Cooldowns:CooldownStart(button, spellId, duration)
self.timeLeft = self.timeLeft - elapsed
local timeLeft = ceil(self.timeLeft)
if timeLeft >= 540 then
self.cooldownFont:SetText(ceil(timeLeft / 60) .. "m")
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.cooldownFont), Gladdy.db.cooldownSize / 3.1 * Gladdy.db.cooldownFontScale, "OUTLINE")
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "cooldownFont"), Gladdy.db.cooldownSize / 3.1 * Gladdy.db.cooldownFontScale, "OUTLINE")
elseif timeLeft < 540 and timeLeft >= 60 then
-- more than 1 minute
self.cooldownFont:SetText(ceil(timeLeft / 60) .. "m")
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.cooldownFont), Gladdy.db.cooldownSize / 2.15 * Gladdy.db.cooldownFontScale, "OUTLINE")
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "cooldownFont"), Gladdy.db.cooldownSize / 2.15 * Gladdy.db.cooldownFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft > 0 then
-- between 60s and 21s (green)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.cooldownFont), Gladdy.db.cooldownSize / 2.15 * Gladdy.db.cooldownFontScale, "OUTLINE")
self.cooldownFont:SetText(timeLeft)
else
self.cooldownFont:SetText("")
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "cooldownFont"), Gladdy.db.cooldownSize / 2.15 * Gladdy.db.cooldownFontScale, "OUTLINE")
end
Gladdy:FormatTimer(self.cooldownFont, self.timeLeft, self.timeLeft < 0)
if (self.timeLeft <= 0) then
Cooldowns:CooldownReady(button, spellId, frame)
end
@ -338,6 +338,9 @@ function Cooldowns:DetectSpec(unit, spec)
if (not button or not spec or button.spec) then
return
end
if button.class == "PALADIN" and (spec ~= L["Holy"] or spec ~= L["Retribution"]) then
return
end
button.spec = spec
if not button.test then
@ -352,7 +355,6 @@ function Cooldowns:DetectSpec(unit, spec)
]]
if (Gladdy.db.cooldown) then
local class = Gladdy.buttons[unit].class
local race = Gladdy.buttons[unit].race
for k, v in pairs(Gladdy:GetCooldownList()[class]) do
if Gladdy.db.cooldownCooldowns[tostring(k)] then
--if (self.db.cooldownList[k] ~= false and self.db.cooldownList[class] ~= false) then
@ -483,7 +485,7 @@ function Cooldowns:UpdateCooldowns(button)
end
end
function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
function Cooldowns:CooldownUsed(unit, unitClass, spellId)
local button = Gladdy.buttons[unit]
if not button then
return
@ -501,8 +503,8 @@ function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
-- check if we need to reset other cooldowns because of this spell
if (cooldown.resetCD ~= nil) then
for k, v in pairs(cooldown.resetCD) do
self:CooldownReady(button, k, false)
for spellID,_ in pairs(cooldown.resetCD) do
self:CooldownReady(button, spellID, false)
end
end
@ -518,9 +520,9 @@ function Cooldowns:CooldownUsed(unit, unitClass, spellId, spellName)
if (cooldown.sharedCD ~= nil) then
local sharedCD = cooldown.sharedCD.cd and cooldown.sharedCD.cd or cd
for k, v in pairs(cooldown.sharedCD) do
if (k ~= "cd") then
self:CooldownStart(button, k, sharedCD)
for spellID,_ in pairs(cooldown.sharedCD) do
if (spellID ~= "cd") then
self:CooldownStart(button, spellID, sharedCD)
end
end
end
@ -603,6 +605,7 @@ function Cooldowns:GetOptions()
order = 4,
min = 5,
max = 50,
width = "full",
}),
cooldownWidthFactor = Gladdy:option({
type = "range",
@ -612,6 +615,7 @@ function Cooldowns:GetOptions()
min = 0.5,
max = 2,
step = 0.05,
width = "full",
}),
cooldownIconPadding = Gladdy:option({
type = "range",
@ -621,6 +625,7 @@ function Cooldowns:GetOptions()
min = 0,
max = 10,
step = 0.1,
width = "full",
}),
cooldownMaxIconsPerLine = Gladdy:option({
type = "range",
@ -629,6 +634,7 @@ function Cooldowns:GetOptions()
min = 3,
max = 14,
step = 1,
width = "full",
}),
},
},
@ -655,6 +661,7 @@ function Cooldowns:GetOptions()
max = 1,
step = 0.1,
order = 9,
width = "full",
}),
},
},
@ -684,6 +691,7 @@ function Cooldowns:GetOptions()
min = 0.1,
max = 2,
step = 0.1,
width = "full",
}),
cooldownFontColor = Gladdy:colorOption({
type = "color",
@ -738,6 +746,7 @@ function Cooldowns:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
cooldownYOffset = Gladdy:option({
type = "range",
@ -746,6 +755,7 @@ function Cooldowns:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
},
},
@ -807,10 +817,10 @@ function Cooldowns:GetCooldownOptions()
order = o,
width = "full",
image = select(3, GetSpellInfo(spellId)),
get = function(info)
get = function()
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
end
@ -836,10 +846,10 @@ function Cooldowns:GetCooldownOptions()
order = o,
width = "full",
image = select(3, GetSpellInfo(spellId)),
get = function(info)
get = function()
return Gladdy.db.cooldownCooldowns[tostring(spellId)]
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.cooldownCooldowns[tostring(spellId)] = value
Gladdy:UpdateFrame()
end
@ -861,13 +871,13 @@ function Gladdy:UpdateTestCooldowns(i)
Cooldowns:DetectSpec(unit, button.testSpec)
-- use class spells
for k, v in pairs(Gladdy:GetCooldownList()[button.class]) do
for spellID,_ in pairs(Gladdy:GetCooldownList()[button.class]) do
--k is spellId
Cooldowns:CooldownUsed(unit, button.class, k, nil)
Cooldowns:CooldownUsed(unit, button.class, spellID)
end
-- use race spells
for k, v in pairs(Gladdy:GetCooldownList()[button.race]) do
Cooldowns:CooldownUsed(unit, button.race, k, nil)
for spellID,_ in pairs(Gladdy:GetCooldownList()[button.race]) do
Cooldowns:CooldownUsed(unit, button.race, spellID)
end
end
end

View File

@ -1,14 +1,12 @@
local select = select
local pairs,ipairs,tbl_sort,tinsert,format = pairs,ipairs,table.sort,tinsert,format
local drDuration = 18
local pairs,ipairs,tbl_sort,tinsert,format,rand = pairs,ipairs,table.sort,tinsert,format,math.random
local GetSpellInfo = GetSpellInfo
local CreateFrame = CreateFrame
local GetTime = GetTime
local Gladdy = LibStub("Gladdy")
local DRData = LibStub("DRData-1.0")
local DRData = LibStub("DRData-1.0-BCC")
local L = Gladdy.L
local function defaultCategories()
local categories = {}
@ -17,7 +15,7 @@ local function defaultCategories()
tinsert(indexList, {spellID = k, category = v})
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
categories[v.category] = {
enabled = true,
@ -47,7 +45,8 @@ local Diminishings = Gladdy:NewModule("Diminishings", nil, {
drQuarterColor = {r = 1, g = 0.7, b = 0, a = 1 },
drNullColor = {r = 1, g = 0, b = 0, a = 1 },
drWidthFactor = 1,
drCategories = defaultCategories()
drCategories = defaultCategories(),
drDuration = 18
})
local function getDiminishColor(dr)
@ -93,11 +92,7 @@ function Diminishings:CreateFrame(unit)
Diminishings:Positionate(unit)
else
self.timeLeft = self.timeLeft - elapsed
if self.timeLeft >=5 then
self.timeText:SetFormattedText("%d", self.timeLeft)
else
self.timeText:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
end
Gladdy:FormatTimer(self.text, self.timeLeft, self.timeLeft < 5)
end
end
end)
@ -121,7 +116,7 @@ function Diminishings:CreateFrame(unit)
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:SetFont(Gladdy:SMFetch("font", "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)
@ -130,7 +125,7 @@ function Diminishings:CreateFrame(unit)
icon.timeText = icon.cooldownFrame:CreateFontString(nil, "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:SetShadowOffset(1, -1)
icon.timeText:SetShadowColor(0, 0, 0, 1)
@ -189,9 +184,9 @@ function Diminishings:UpdateFrame(unit)
icon:SetWidth(Gladdy.db.drIconSize * Gladdy.db.drWidthFactor)
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.text:SetFont(Gladdy:SMFetch("font", "drFont"), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drFontScale, "OUTLINE")
icon.text:SetTextColor(Gladdy.db.drFontColor.r, Gladdy.db.drFontColor.g, Gladdy.db.drFontColor.b, Gladdy.db.drFontColor.a)
icon.timeText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.drFont), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drFontScale, "OUTLINE")
icon.timeText:SetFont(Gladdy:SMFetch("font", "drFont"), (Gladdy.db.drIconSize/2 - 1) * Gladdy.db.drFontScale, "OUTLINE")
icon.timeText:SetTextColor(Gladdy.db.drFontColor.r, Gladdy.db.drFontColor.g, Gladdy.db.drFontColor.b, Gladdy.db.drFontColor.a)
icon.cooldown:SetWidth(icon:GetWidth() - icon:GetWidth()/16)
@ -262,17 +257,32 @@ end
function Diminishings:Test(unit)
if Gladdy.db.drEnabled then
local spells = { 33786, 118, 8643, 8983 }
for i = 1, 4 do
if i == 1 then
self:AuraFade(unit, spells[i])
elseif i == 2 then
self:AuraFade(unit, spells[i])
self:AuraFade(unit, spells[i])
else
self:AuraFade(unit, spells[i])
self:AuraFade(unit, spells[i])
self:AuraFade(unit, spells[i])
local enabledCategories = {}
for cat,val in pairs(Gladdy.db.drCategories) do
if (val.enabled) then
tinsert(enabledCategories, {cat = cat , spellIDs = {}})
enabledCategories[cat] = #enabledCategories
end
end
for spellId,cat in pairs(DRData:GetSpells()) do
if enabledCategories[cat] then
tinsert(enabledCategories[enabledCategories[cat]].spellIDs, spellId)
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
@ -299,15 +309,16 @@ function Diminishings:AuraFade(unit, spellID)
lastIcon.diminishing = 1.0
end
end
if not lastIcon then return end
lastIcon.dr = drCat
lastIcon.timeLeft = drDuration
lastIcon.timeLeft = Gladdy.db.drDuration
lastIcon.diminishing = DRData:NextDR(lastIcon.diminishing)
if Gladdy.db.drBorderColorsEnabled then
lastIcon.border:SetVertexColor(getDiminishColor(lastIcon.diminishing))
else
lastIcon.border:SetVertexColor(Gladdy.db.drBorderColor.r, Gladdy.db.drBorderColor.g, Gladdy.db.drBorderColor.b, Gladdy.db.drBorderColor.a)
end
lastIcon.cooldown:SetCooldown(GetTime(), drDuration)
lastIcon.cooldown:SetCooldown(GetTime(), Gladdy.db.drDuration)
if Gladdy.db.drCategories[drCat].forceIcon then
lastIcon.texture:SetTexture(Gladdy.db.drCategories[drCat].icon)
else
@ -363,11 +374,20 @@ function Diminishings:GetOptions()
desc = L["Enabled DR module"],
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,
min = 15,
max = 20,
step = .1,
}),
group = {
type = "group",
childGroups = "tree",
name = L["Frame"],
order = 4,
order = 5,
args = {
icon = {
type = "group",
@ -385,8 +405,9 @@ function Diminishings:GetOptions()
desc = L["Size of the DR Icons"],
order = 5,
min = 5,
max = 50,
max = 80,
step = 1,
width = "full",
}),
drWidthFactor = Gladdy:option({
type = "range",
@ -396,6 +417,7 @@ function Diminishings:GetOptions()
min = 0.5,
max = 2,
step = 0.05,
width = "full",
}),
drIconPadding = Gladdy:option({
type = "range",
@ -405,6 +427,7 @@ function Diminishings:GetOptions()
min = 0,
max = 10,
step = 0.1,
width = "full",
}),
},
},
@ -431,6 +454,7 @@ function Diminishings:GetOptions()
max = 1,
step = 0.1,
order = 9,
width = "full",
}),
},
},
@ -467,6 +491,7 @@ function Diminishings:GetOptions()
min = 0.1,
max = 2,
step = 0.1,
width = "full",
}),
}
},
@ -502,6 +527,7 @@ function Diminishings:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
drYOffset = Gladdy:option({
type = "range",
@ -510,6 +536,7 @@ function Diminishings:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
},
},
@ -583,16 +610,39 @@ function Diminishings:GetOptions()
end
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 = {}
for k,v in pairs(DRData:GetCategories()) do
for k,_ in pairs(DRData:GetCategories()) do
tinsert(indexList, k)
end
tbl_sort(indexList)
for i, k in ipairs(indexList) do
for i,k in ipairs(indexList) do
categories[k] = {
type = "group",
name = DRData:GetCategoryName(k),
name = L[DRData:GetCategoryName(k)],
order = i,
icon = Gladdy.db.drCategories[k].icon,
args = {
@ -600,10 +650,10 @@ function Diminishings:CategoryOptions()
type = "toggle",
name = L["Enabled"],
order = 1,
get = function(info)
get = function()
return Gladdy.db.drCategories[k].enabled
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.drCategories[k].enabled = value
end,
},
@ -611,10 +661,10 @@ function Diminishings:CategoryOptions()
type = "toggle",
name = L["Force Icon"],
order = 2,
get = function(info)
get = function()
return Gladdy.db.drCategories[k].forceIcon
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.drCategories[k].forceIcon = value
end,
},
@ -624,10 +674,10 @@ function Diminishings:CategoryOptions()
desc = L["Icon of the DR"],
order = 4,
values = Diminishings:GetDRIcons(k),
get = function(info)
get = function()
return Gladdy.db.drCategories[k].icon
end,
set = function(info, value)
set = function(_, value)
Gladdy.db.drCategories[k].icon = value
Gladdy.options.args.Diminishings.args.categories.args[k].icon = value
end,

View File

@ -1,4 +1,4 @@
local type, pairs = type, pairs
local type, pairs, str_match = type, pairs, string.match
local Gladdy = LibStub("Gladdy")
local AceSerializer = LibStub("AceSerializer-3.0")
@ -6,12 +6,23 @@ local L = Gladdy.L
local AceGUI = LibStub("AceGUI-3.0")
local LibDeflate = LibStub:GetLibrary("LibDeflate")
local function table_copy(t)
local function table_copy(t, str)
local t2 = {};
if str == nil then
str = "Gladdy.db"
end
for k,v in pairs(t) do
if type(v) == "table" then
t2[k] = table_copy(v);
if k == "drCategories" then
for key,val in pairs(v) do
--Gladdy:Print("TableCopy", str .. "." .. key)
end
end
t2[k] = table_copy(v, str .. "." .. k);
else
t2[k] = v;
end
end
@ -21,8 +32,6 @@ end
local ExportImport = Gladdy:NewModule("Export Import", nil, {
})
local export = AceGUI:Create("Frame")
export:SetWidth(550)
export.sizer_se:Hide()
@ -86,9 +95,27 @@ import:AddChild(importClearButton)
import.clearButton = importClearButton
local deletedOptions = { --TODO backward compatibility Imports on deleted options
growUp = true
growUp = true,
freezetrap = true,
repentance = 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: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)
if str == nil and not tbl.version_major_num then
return false, "Version conflict: version_major_num not seen"
@ -100,17 +127,29 @@ function ExportImport:CheckDeserializedOptions(tbl, refTbl, str)
str = "Gladdy.db"
tbl.version_major_num = nil
end
for k,v in pairs(tbl) do
if refTbl[k] == nil then
return false, str .. "." .. k .. " does not exist"
else
if type(v) ~= type(refTbl[k]) then
return false, str .. "." .. k .. " type error. Expected " .. type(refTbl[k]) .. " found " .. type(v)
local res, msg
local errorFound, errorMsg
if refTbl == nil then
return false, str .. "does not exist"
else
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
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
if errorFound then
return false, errorMsg
end
return true
end
@ -137,8 +176,8 @@ function ExportImport:GetOptions()
export.eb:HighlightText(0, export.eb.editBox:GetNumLetters())
export:SetStatusText("Copy this string to share your configuration with others.")
end,
name = "Export",
desc = "Export your current profile to share with others or your various accounts.",
name = L["Export"],
desc = L["Export your current profile to share with others or your various accounts."],
order = 3,
},
import = {
@ -161,17 +200,25 @@ function ExportImport:GetOptions()
import.deserializedTable = deserialized
end)
end,
name = "Import",
desc = "This will overwrite your current profile!",
name = L["Import"],
desc = L["This will overwrite your current profile!"],
order = 4,
},
}
end
function ExportImport:ApplyImport(t, table)
function ExportImport:ApplyImport(t, table, str)
if str == nil then
str = "Gladdy.db"
end
for k,v in pairs(t) do
if type(v) == "table" then
ExportImport:ApplyImport(v, table[k])
if (table[k] ~= nil) then
ExportImport:ApplyImport(v, table[k], str .. "." .. k)
else
Gladdy:Warn("ApplyImport failed for", str .. "." .. k)
end
else
table[k] = v
end

View File

@ -1,6 +1,6 @@
local pairs = pairs
local floor = math.floor
local UnitHealth, UnitHealthMax, UnitName, UnitExists = UnitHealth, UnitHealthMax, UnitName, UnitExists
local UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost = UnitHealth, UnitHealthMax, UnitName, UnitExists, UnitIsDeadOrGhost
local CreateFrame = CreateFrame
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
@ -39,18 +39,18 @@ function Healthbar:CreateFrame(unit)
local healthBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate")
healthBar:EnableMouse(false)
healthBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.healthBarBorderStyle),
healthBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "healthBarBorderStyle"),
edgeSize = Gladdy.db.healthBarBorderSize })
healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a)
healthBar:SetFrameLevel(1)
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:SetFrameLevel(0)
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:SetAllPoints(healthBar.hp)
healthBar.bg:SetAlpha(1)
@ -58,10 +58,10 @@ function Healthbar:CreateFrame(unit)
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
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()
else
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarNameFontSize)
healthBar.nameText:Show()
end
healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
@ -72,10 +72,10 @@ function Healthbar:CreateFrame(unit)
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
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()
else
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarHealthFontSize)
healthBar.healthText:Hide()
end
healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
@ -95,13 +95,22 @@ function Healthbar:CreateFrame(unit)
end
function Healthbar.OnEvent(self, event, unit)
local isDead = UnitExists(unit) and UnitIsDeadOrGhost(unit)
if event == "UNIT_HEALTH" 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
Gladdy:SendMessage("UNIT_DEATH", unit)
return
end
local health = UnitHealth(unit)
local healthMax = UnitHealthMax(unit)
self.hp:SetMinMaxValues(0, healthMax)
@ -123,7 +132,7 @@ function Healthbar:SetHealthText(healthBar, health, healthMax)
local healthText
local healthPercentage = 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)
return
end
@ -158,35 +167,33 @@ function Healthbar:UpdateFrame(unit)
return
end
local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight
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:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.healthBarBorderStyle),
healthBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "healthBarBorderStyle"),
edgeSize = Gladdy.db.healthBarBorderSize })
healthBar:SetBackdropBorderColor(Gladdy.db.healthBarBorderColor.r, Gladdy.db.healthBarBorderColor.g, Gladdy.db.healthBarBorderColor.b, Gladdy.db.healthBarBorderColor.a)
healthBar:ClearAllPoints()
healthBar:SetPoint("TOPLEFT", Gladdy.buttons[unit], "TOPLEFT", 0, 0)
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: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))
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()
else
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarHealthFontSize)
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarHealthFontSize)
healthBar.healthText:Show()
end
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()
else
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.healthBarFont), Gladdy.db.healthBarNameFontSize)
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "healthBarFont"), Gladdy.db.healthBarNameFontSize)
if Gladdy.db.healthName then
healthBar.nameText:Show()
else
@ -225,7 +232,7 @@ function Healthbar:JOINED_ARENA()
if Gladdy.db.healthNameToArenaId and Gladdy.db.healthName then
for i=1,Gladdy.curBracket do
local healthBar = self.frames["arena" .. i]
healthBar.nameText:SetText("Arena" .. i)
healthBar.nameText:SetText(i)
end
end
end
@ -248,7 +255,9 @@ function Healthbar:ENEMY_SPOTTED(unit)
healthBar.nameText:SetText(button.name)
end
healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
if button.class then
healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
end
end
function Healthbar:UNIT_HEALTH(unit, health, healthMax)
@ -368,6 +377,7 @@ function Healthbar:GetOptions()
min = 10,
max = 100,
step = 1,
width = "full",
}),
healthBarTexture = option({
type = "select",
@ -419,6 +429,7 @@ function Healthbar:GetOptions()
step = 0.1,
min = 0,
max = 20,
width = "full",
}),
healthBarHealthFontSize = option({
type = "range",
@ -428,6 +439,7 @@ function Healthbar:GetOptions()
step = 0.1,
min = 0,
max = 20,
width = "full",
}),
},
},
@ -456,6 +468,7 @@ function Healthbar:GetOptions()
min = 0.5,
max = Gladdy.db.healthBarHeight/2,
step = 0.5,
width = "full",
}),
healthBarBorderColor = Gladdy:colorOption({
type = "color",
@ -486,7 +499,7 @@ function Healthbar:GetOptions()
healthNameToArenaId = option({
type = "toggle",
name = L["Show ArenaX"],
desc = L["Show Arena1-5 as name instead"],
desc = L["Show 1-5 as name instead"],
order = 3,
width = "full",
disabled = function() return not Gladdy.db.healthName end

View File

@ -55,17 +55,17 @@ function Highlight:CreateFrame(unit)
local healthBar = Gladdy.modules["Health Bar"].frames[unit]
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:Hide()
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:Hide()
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:Hide()
@ -89,23 +89,24 @@ function Highlight:UpdateFrame(unit)
return
end
local powerBarHeight = Gladdy.db.powerBarEnabled and (Gladdy.db.powerBarHeight + 1) or 0
local borderSize = Gladdy.db.highlightBorderSize
local borderOffset = borderSize
local iconSize = Gladdy.db.healthBarHeight + Gladdy.db.powerBarHeight + 1
local hpAndPowerHeight = Gladdy.db.healthBarHeight + powerBarHeight
local width = Gladdy.db.barWidth + (Gladdy.db.highlightInset and 0 or borderSize * 2)
local height = iconSize + (Gladdy.db.highlightInset and 0 or borderSize * 2)
local height = hpAndPowerHeight + (Gladdy.db.highlightInset and 0 or borderSize * 2)
button.targetBorder:SetWidth(width)
button.targetBorder:SetHeight(height)
button.targetBorder:ClearAllPoints()
if Gladdy.db.highlightInset then
button.targetBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.targetBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
button.targetBorder:SetPoint("BOTTOMRIGHT", Gladdy.db.powerBarEnabled and button.powerBar or button.healthBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.targetBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.targetBorder: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.focusBorder:SetWidth(width)
@ -113,12 +114,12 @@ function Highlight:UpdateFrame(unit)
button.focusBorder:ClearAllPoints()
if Gladdy.db.highlightInset then
button.focusBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset))
button.focusBorder:SetPoint("BOTTOMRIGHT", button.powerBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
button.focusBorder:SetPoint("BOTTOMRIGHT", Gladdy.db.powerBarEnabled and button.powerBar or button.healthBar, "BOTTOMRIGHT", (borderOffset/Gladdy.db.statusbarBorderOffset), -(borderOffset/Gladdy.db.statusbarBorderOffset))
else
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.focusBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.focusBorder: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.leaderBorder:SetWidth(width)
@ -131,7 +132,7 @@ function Highlight:UpdateFrame(unit)
button.leaderBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end
button.leaderBorder:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.highlightBorderStyle), edgeSize = borderSize })
button.leaderBorder: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)
if Gladdy.frame.testing then
Highlight:Test(unit)
@ -156,7 +157,7 @@ function Highlight:Test(unit)
elseif (unit == "arena2") then
self:Toggle(unit, "target", true)
elseif (unit == "arena3") then
self:Toggle(unit, "leader", true)
--self:Toggle(unit, "leader", true)
end
end
@ -214,6 +215,7 @@ function Highlight:GetOptions()
min = 1,
max = 20,
step = 1,
width = "full",
}),
highlightBorderStyle = Gladdy:option({
type = "select",

View File

@ -35,12 +35,12 @@ function Pets:Initialize()
end
function Pets:JOINED_ARENA()
for k,v in pairs(self.frames) do
for _,v in pairs(self.frames) do
v.healthBar:SetAlpha(0)
end
if Gladdy.db.petEnabled then
self:RegisterEvent("UNIT_PET")
self:SetScript("OnEvent", function(self, event, unitId)
self:SetScript("OnEvent", function(_, event, unitId)
if event == "UNIT_PET" then
local unit = Gladdy.guids[UnitGUID(unitId)]
if unit then
@ -137,9 +137,9 @@ function Pets:CreateFrame(unitId)
--button:SetAlpha(0)
button:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
local secure = CreateFrame("Button", "GladdyButton" .. unit, button, "SecureActionButtonTemplate")
secure:RegisterForClicks("AnyUp")
local secure = CreateFrame("Button", "GladdyButton" .. unit, button, "SecureActionButtonTemplate, SecureHandlerEnterLeaveTemplate")
secure:RegisterForClicks("AnyUp")
secure:RegisterForClicks("AnyDown")
secure:SetAttribute("*type1", "target")
secure:SetAttribute("*type2", "focus")
secure:SetAttribute("unit", unit)
@ -149,14 +149,14 @@ function Pets:CreateFrame(unitId)
button.secure = secure
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 })
healthBar:SetBackdropBorderColor(Gladdy.db.petHealthBarBorderColor.r, Gladdy.db.petHealthBarBorderColor.g, Gladdy.db.petHealthBarBorderColor.b, Gladdy.db.petHealthBarBorderColor.a)
healthBar:SetFrameLevel(1)
healthBar:SetAllPoints(button)
healthBar:SetAlpha(0)
healthBar.portrait = healthBar:CreateTexture(nil, "OVERLAY")
healthBar.portrait = healthBar:CreateTexture(nil, "BACKGROUND")
healthBar.portrait:SetPoint("LEFT", healthBar, "RIGHT")
healthBar.portrait:SetTexCoord(0.1, 0.9, 0.1, 0.9)
SetPortraitTexture(healthBar.portrait, "player")
@ -167,14 +167,14 @@ function Pets:CreateFrame(unitId)
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:SetMinMaxValues(0, 100)
healthBar.hp:SetFrameLevel(0)
healthBar.hp:SetAllPoints(healthBar)
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:SetAllPoints(healthBar.hp)
healthBar.bg:SetAlpha(1)
@ -182,10 +182,10 @@ function Pets:CreateFrame(unitId)
healthBar.nameText = healthBar:CreateFontString(nil, "LOW", "GameFontNormalSmall")
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()
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()
end
healthBar.nameText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
@ -196,10 +196,10 @@ function Pets:CreateFrame(unitId)
healthBar.healthText = healthBar:CreateFontString(nil, "LOW")
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()
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()
end
healthBar.healthText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
@ -263,28 +263,28 @@ function Pets:UpdateFrame(unitId)
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.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:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.petHealthBarBorderStyle),
healthBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "petHealthBarBorderStyle"),
edgeSize = Gladdy.db.petHealthBarBorderSize })
healthBar:SetBackdropBorderColor(Gladdy.db.petHealthBarBorderColor.r, Gladdy.db.petHealthBarBorderColor.g, Gladdy.db.petHealthBarBorderColor.b, Gladdy.db.petHealthBarBorderColor.a)
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:ClearAllPoints()
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))
if (Gladdy.db.petHealthBarFontSize < 1) then
healthBar.nameText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), 1)
healthBar.healthText:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.petHealthBarFont), 1)
healthBar.nameText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), 1)
healthBar.healthText:SetFont(Gladdy:SMFetch("font", "petHealthBarFont"), 1)
healthBar.nameText:Hide()
healthBar.healthText:Hide()
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.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()
end
healthBar.nameText:SetTextColor(Gladdy.db.petHealthBarFontColor.r, Gladdy.db.petHealthBarFontColor.g, Gladdy.db.petHealthBarFontColor.b, Gladdy.db.petHealthBarFontColor.a)
@ -368,6 +368,7 @@ function Pets:GetOptions()
min = 10,
max = 100,
step = 1,
width = "full",
}),
petWidth = option({
type = "range",
@ -377,6 +378,7 @@ function Pets:GetOptions()
min = 10,
max = 300,
step = 1,
width = "full",
}),
petHealthBarTexture = option({
type = "select",
@ -458,6 +460,7 @@ function Pets:GetOptions()
order = 13,
min = 0,
max = 20,
width = "full",
}),
},
},
@ -486,6 +489,7 @@ function Pets:GetOptions()
min = 0.5,
max = Gladdy.db.petHeight/2,
step = 0.5,
width = "full",
}),
petHealthBarBorderColor = Gladdy:colorOption({
type = "color",
@ -513,6 +517,7 @@ function Pets:GetOptions()
min = -600,
max = 600,
step = 0.1,
width = "full",
}),
petYOffset = Gladdy:option({
type = "range",
@ -521,6 +526,7 @@ function Pets:GetOptions()
min = -600,
max = 600,
step = 0.1,
width = "full",
}),
}
},

View File

@ -7,6 +7,7 @@ local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists
local Powerbar = Gladdy:NewModule("Power Bar", 90, {
powerBarEnabled = true,
powerBarFont = "DorisPP",
powerBarHeight = 20,
powerBarTexture = "Smooth",
@ -37,24 +38,24 @@ function Powerbar:CreateFrame(unit)
local powerBar = CreateFrame("Frame", nil, Gladdy.buttons[unit], BackdropTemplateMixin and "BackdropTemplate")
powerBar:EnableMouse(false)
powerBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.powerBarBorderStyle),
powerBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "powerBarBorderStyle"),
edgeSize = Gladdy.db.powerBarBorderSize })
powerBar:SetBackdropBorderColor(Gladdy.db.powerBarBorderColor.r, Gladdy.db.powerBarBorderColor.g, Gladdy.db.powerBarBorderColor.b, Gladdy.db.powerBarBorderColor.a)
powerBar:SetFrameLevel(1)
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:SetFrameLevel(0)
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:SetAllPoints(powerBar.energy)
powerBar.bg:SetVertexColor(Gladdy.db.powerBarBgColor.r, Gladdy.db.powerBarBgColor.g, Gladdy.db.powerBarBgColor.b, Gladdy.db.powerBarBgColor.a)
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.powerBarFontSize)
powerBar.raceText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
powerBar.raceText:SetShadowOffset(1, -1)
powerBar.raceText:SetShadowColor(0, 0, 0, 1)
@ -62,7 +63,7 @@ function Powerbar:CreateFrame(unit)
powerBar.raceText:SetPoint("LEFT", 5, 1)
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.powerBarFontSize)
powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
powerBar.powerText:SetShadowOffset(1, -1)
powerBar.powerText:SetShadowColor(0, 0, 0, 1)
@ -113,17 +114,24 @@ function Powerbar:SetPower(powerBar, power, powerMax, powerType)
end
end
if (powerType == 1) then
if (powerType == 1 and powerBar.powerType ~= powerType) then
powerBar.energy:SetStatusBarColor(1, 0, 0, 1)
elseif (powerType == 3) then
powerBar.powerColor = {r = 1, g = 0, b = 0}
powerBar.powerType = powerType
elseif (powerType == 3 and powerBar.powerType ~= powerType) then
powerBar.energy:SetStatusBarColor(1, 1, 0, 1)
else
powerBar.powerColor = {r = 1, g = 1, b = 0}
powerBar.powerType = powerType
elseif powerBar.powerType ~= powerType then
powerBar.energy:SetStatusBarColor(.18, .44, .75, 1)
powerBar.powerColor = {r = .18, g = .44, b = .75}
powerBar.powerType = powerType
end
powerBar.powerText:SetText(powerText)
powerBar.energy:SetMinMaxValues(0, powerMax)
powerBar.energy:SetValue(power)
end
function Powerbar:UpdateFrame(unit)
@ -135,7 +143,13 @@ function Powerbar:UpdateFrame(unit)
local healthBar = Gladdy.modules["Health Bar"].frames[unit]
powerBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.powerBarTexture))
if not Gladdy.db.powerBarEnabled then
powerBar:Hide()
return
else
powerBar:Show()
end
powerBar.bg:SetTexture(Gladdy:SMFetch("statusbar", "powerBarTexture"))
powerBar.bg:SetVertexColor(Gladdy.db.powerBarBgColor.r, Gladdy.db.powerBarBgColor.g, Gladdy.db.powerBarBgColor.b, Gladdy.db.powerBarBgColor.a)
powerBar:SetWidth(healthBar:GetWidth())
@ -144,18 +158,18 @@ function Powerbar:UpdateFrame(unit)
powerBar:ClearAllPoints()
powerBar:SetPoint("TOPLEFT", healthBar, "BOTTOMLEFT", 0, -1)
powerBar:SetBackdrop({ edgeFile = Gladdy.LSM:Fetch("border", Gladdy.db.powerBarBorderStyle),
powerBar:SetBackdrop({ edgeFile = Gladdy:SMFetch("border", "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: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.LSM:Fetch("font", Gladdy.db.powerBarFont), Gladdy.db.powerBarFontSize)
powerBar.raceText:SetFont(Gladdy:SMFetch("font", "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:SetFont(Gladdy:SMFetch("font", "powerBarFont"), Gladdy.db.powerBarFontSize)
powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
end
@ -169,6 +183,8 @@ function Powerbar:ResetUnit(unit)
powerBar.raceText:SetText("")
powerBar.powerText:SetText("")
powerBar.energy:SetValue(0)
powerBar.powerType = ""
powerBar.powerColor = {r = 1, g = 1, b = 1}
end
function Powerbar:Test(unit)
@ -252,10 +268,13 @@ function Powerbar:UNIT_POWER(unit, power, powerMax, powerType)
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)
@ -315,11 +334,16 @@ function Powerbar:GetOptions()
name = L["Power Bar"],
order = 2,
},
powerBarEnabled = Gladdy:option({
type = "toggle",
name = L["Enabled"],
order = 3,
}),
group = {
type = "group",
childGroups = "tree",
name = L["Frame"],
order = 3,
order = 4,
args = {
general = {
type = "group",
@ -339,6 +363,7 @@ function Powerbar:GetOptions()
min = 0,
max = 50,
step = 1,
width = "full",
}),
powerBarTexture = option({
type = "select",
@ -390,6 +415,7 @@ function Powerbar:GetOptions()
step = 0.1,
min = 1,
max = 20,
width = "full",
}),
},
},
@ -418,6 +444,7 @@ function Powerbar:GetOptions()
min = 0.5,
max = Gladdy.db.powerBarHeight/2,
step = 0.5,
width = "full",
}),
powerBarBorderColor = Gladdy:colorOption({
type = "color",

View File

@ -1,10 +1,8 @@
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
local ceil = ceil
local CreateFrame = CreateFrame
local GetTime = GetTime
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local Racial = Gladdy:NewModule("Racial", nil, {
@ -45,33 +43,22 @@ local function iconTimer(self,elapsed)
local timeLeft = ceil(self.timeLeft)
if timeLeft >= 60 then
-- more than 1 minute
self.cooldownFont:SetTextColor(1, 1, 0)
self.cooldownFont:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 0.15* self:GetWidth()) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft >= 21 then
-- between 60s and 21s (green)
self.cooldownFont:SetTextColor(0.7, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 20.9 and timeLeft >= 11 then
-- between 20s and 11s (green)
self.cooldownFont:SetTextColor(0, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft <= 10 and timeLeft >= 5 then
-- between 10s and 5s (orange)
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 0.15* self:GetWidth()) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft >= 30 then
self.cooldownFont:SetTextColor(1, 1, 0)
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 30 and timeLeft >= 11 then
self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 10 and timeLeft >= 5 then
self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 5 and timeLeft > 0 then
-- between 5s and 1s (red)
self.cooldownFont:SetTextColor(1, 0, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft >= 0.0 and timeLeft or 0.0)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
else
self.cooldownFont:SetText("")
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
end
Gladdy:FormatTimer(self.cooldownFont, self.timeLeft, self.timeLeft < 10, true)
end
end
@ -93,7 +80,7 @@ function Racial:CreateFrame(unit)
racial.cooldownFrame:SetPoint("BOTTOMRIGHT", racial, "BOTTOMRIGHT")
racial.cooldownFont = racial.cooldownFrame:CreateFontString(nil, "OVERLAY")
racial.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), 20, "OUTLINE")
racial.cooldownFont:SetFont(Gladdy:SMFetch("font", "racialFont"), 20, "OUTLINE")
--trinket.cooldownFont:SetAllPoints(trinket.cooldown)
racial.cooldownFont:SetJustifyH("CENTER")
racial.cooldownFont:SetPoint("CENTER")
@ -134,7 +121,6 @@ function Racial:UpdateFrame(unit)
racial.texture.overlay:SetVertexColor(Gladdy.db.racialBorderColor.r, Gladdy.db.racialBorderColor.g, Gladdy.db.racialBorderColor.b, Gladdy.db.racialBorderColor.a)
racial:ClearAllPoints()
local margin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize) + Gladdy.db.padding
local parent = Gladdy.buttons[unit][Gladdy.db.racialAnchor]
if (Gladdy.db.racialPos == "RIGHT") then
racial:SetPoint(ANCHORS[Gladdy.db.racialPos], parent, Gladdy.db.racialPos, Gladdy.db.padding + Gladdy.db.racialXOffset, Gladdy.db.racialYOffset)
@ -185,7 +171,7 @@ end
function Racial:ENEMY_SPOTTED(unit)
local racial = self.frames[unit]
if (not racial) then
if (not racial or not Gladdy.buttons[unit].race) then
return
end
racial.texture:SetTexture(Gladdy:Racials()[Gladdy.buttons[unit].race].texture)
@ -246,6 +232,7 @@ function Racial:GetOptions()
max = 100,
step = 1,
order = 2,
width = "full",
}),
racialWidthFactor = Gladdy:option({
type = "range",
@ -254,6 +241,7 @@ function Racial:GetOptions()
max = 2,
step = 0.05,
order = 3,
width = "full",
}),
},
},
@ -280,6 +268,7 @@ function Racial:GetOptions()
max = 1,
step = 0.1,
order = 8,
width = "full",
}),
},
},
@ -309,6 +298,7 @@ function Racial:GetOptions()
min = 0.1,
max = 2,
step = 0.1,
width = "full",
}),
},
},
@ -353,6 +343,7 @@ function Racial:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
racialYOffset = Gladdy:option({
type = "range",
@ -361,6 +352,7 @@ function Racial:GetOptions()
min = -400,
max = 400,
step = 0.1,
width = "full",
}),
},
},

421
Modules/RangeCheck.lua Normal file
View File

@ -0,0 +1,421 @@
local UnitIsConnected = UnitIsConnected
local UnitInPhase = UnitInPhase
local UnitInRaid = UnitInRaid
local UnitInParty = UnitInParty
local UnitInRange = UnitInRange
local CheckInteractDistance = CheckInteractDistance
local C_Timer = C_Timer
local UnitIsUnit = UnitIsUnit
local UnitClass = UnitClass
local GetSpellInfo = GetSpellInfo
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS
local select, ipairs, type, tonumber, tostring, format = select, ipairs, type, tonumber, tostring, format
local LibStub = LibStub
local Gladdy = LibStub("Gladdy")
local LSR = LibStub("SpellRange-1.0")
local L = Gladdy.L
local classSpells = {
["MAGE"] = 118,
["PRIEST"] = 32379,
["DRUID"] = 33786,
["SHAMAN"] = 10414,
["PALADIN"] = 10308,
["WARLOCK"] = 5782,
["WARRIOR"] = 25275,
["HUNTER"] = 27018,
["ROGUE"] = 36554,
}
local function defaultSpells()
local defaults = {}
for _,class in ipairs(Gladdy.CLASSES) do
defaults[class] = { min = classSpells[class] }
end
return defaults
end
local RangeCheck = Gladdy:NewModule("Range Check", nil, {
rangeCheckEnabled = true,
rangeCheckDefaultSpells = defaultSpells(),
rangeCheckOorFactor = 1.5,
rangeCheckHealthBar = true,
rangeCheckHealthBarText = true,
rangeCheckPowerBar = true,
rangeCheckPowerBarText = true,
rangeCheckClassIcon = false,
rangeCheckTrinket = false,
rangeCheckRacial = false,
})
function RangeCheck:Initialize()
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("ENEMY_STEALTH")
self:RegisterMessage("ENEMY_SPOTTED")
self.playerClass = select(2, UnitClass("player"))
end
function RangeCheck:Reset()
self.test = nil
end
function RangeCheck:ResetUnit(unit)
local button = Gladdy.buttons[unit]
self:CancelTimer(button)
self:SetColor(button, 1)
button.classColors = {}
end
function RangeCheck:Test(unit)
local button = Gladdy.buttons[unit]
if not button then
return
end
self:ENEMY_SPOTTED(unit)
self.test = true
button.lastState = 0
if Gladdy.db.rangeCheckEnabled then
if unit == "arena1" then
--button.unit = "target"
--self:CreateTimer(button)
self:SetRangeAlpha(button, nil)
else
self:SetRangeAlpha(button, true)
end
else
self:SetRangeAlpha(button, true)
end
end
function RangeCheck:UpdateFrame(unit)
if self.test then
self:Test(unit)
end
end
function RangeCheck:SetColor(button, oorFac)
if button.lastState == oorFac then
return
end
if not button.classColors.r then
if button.class then
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
else
button.classColors = { r = 0.66, g = 0.66, b = 0.66 }
end
end
if Gladdy.db.rangeCheckHealthBar then
button.healthBar.hp:SetStatusBarColor(button.classColors.r/oorFac, button.classColors.g/oorFac, button.classColors.b/oorFac, 1)
else
button.healthBar.hp:SetStatusBarColor(button.classColors.r, button.classColors.g, button.classColors.b, 1)
end
if Gladdy.db.rangeCheckHealthBarText then
button.healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r/oorFac, Gladdy.db.healthBarFontColor.g/oorFac, Gladdy.db.healthBarFontColor.b/oorFac, Gladdy.db.healthBarFontColor.a)
button.healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r/oorFac, Gladdy.db.healthBarFontColor.g/oorFac, Gladdy.db.healthBarFontColor.b/oorFac, Gladdy.db.healthBarFontColor.a)
else
button.healthBar.nameText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
button.healthBar.healthText:SetTextColor(Gladdy.db.healthBarFontColor.r, Gladdy.db.healthBarFontColor.g, Gladdy.db.healthBarFontColor.b, Gladdy.db.healthBarFontColor.a)
end
if Gladdy.db.rangeCheckPowerBar then
button.powerBar.energy:SetStatusBarColor(button.powerBar.powerColor.r/oorFac, button.powerBar.powerColor.g/oorFac, button.powerBar.powerColor.b/oorFac, 1)
else
button.powerBar.energy:SetStatusBarColor(button.powerBar.powerColor.r, button.powerBar.powerColor.g, button.powerBar.powerColor.b, 1)
end
if Gladdy.db.rangeCheckPowerBarText then
button.powerBar.raceText:SetTextColor(Gladdy.db.powerBarFontColor.r/oorFac, Gladdy.db.powerBarFontColor.g/oorFac, Gladdy.db.powerBarFontColor.b/oorFac, Gladdy.db.powerBarFontColor.a)
button.powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r/oorFac, Gladdy.db.powerBarFontColor.g/oorFac, Gladdy.db.powerBarFontColor.b/oorFac, Gladdy.db.powerBarFontColor.a)
else
button.powerBar.raceText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
button.powerBar.powerText:SetTextColor(Gladdy.db.powerBarFontColor.r, Gladdy.db.powerBarFontColor.g, Gladdy.db.powerBarFontColor.b, Gladdy.db.powerBarFontColor.a)
end
if Gladdy.db.rangeCheckTrinket then
button.trinket.texture:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
else
button.trinket.texture:SetVertexColor(1, 1, 1)
end
if Gladdy.db.rangeCheckClassIcon then
button.classIcon.texture:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
button.aura.icon:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
else
button.classIcon.texture:SetVertexColor(1, 1, 1)
button.aura.icon:SetVertexColor(1, 1, 1)
end
if Gladdy.db.rangeCheckRacial then
button.racial.texture:SetVertexColor(1/oorFac, 1/oorFac, 1/oorFac)
else
button.racial.texture:SetVertexColor(1, 1, 1)
end
button.lastState = oorFac
end
function RangeCheck:SetRangeAlpha(button, inRange)
local oorFac = Gladdy.db.rangeCheckOorFactor
if inRange then
RangeCheck:SetColor(button, 1)
else
RangeCheck:SetColor(button, oorFac)
end
end
function RangeCheck:JOINED_ARENA()
self.test = nil
if Gladdy.db.rangeCheckEnabled then
for i = 1, Gladdy.curBracket do
local button = Gladdy.buttons["arena"..i]
--if i == 1 then button.unit = "focus" end
self:CreateTimer(button)
end
end
end
function RangeCheck:ENEMY_STEALTH(unit, stealth)
local button = Gladdy.buttons[unit]
if not button then
return
end
button.lastState = 0
if stealth then
button.classColors = { r = 0.66, g = 0.66, b = 0.66 }
if not Gladdy.db.rangeCheckEnabled then
button.healthBar.hp:SetStatusBarColor(0.66, 0.66, 0.66, 1)
end
else
if button.class then
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
if not Gladdy.db.rangeCheckEnabled then
button.healthBar.hp:SetStatusBarColor(RAID_CLASS_COLORS[button.class].r, RAID_CLASS_COLORS[button.class].g, RAID_CLASS_COLORS[button.class].b, 1)
end
end
end
end
function RangeCheck:ENEMY_SPOTTED(unit)
local button = Gladdy.buttons[unit]
if (not button) then
return
end
button.classColors = { r = RAID_CLASS_COLORS[button.class].r, g = RAID_CLASS_COLORS[button.class].g, b = RAID_CLASS_COLORS[button.class].b }
end
function RangeCheck.CheckRange(self)
local button = self.parent
local spell = Gladdy.db.rangeCheckDefaultSpells[RangeCheck.playerClass].min
if (not UnitIsConnected(button.unit) or not UnitInPhase(button.unit)) then
RangeCheck:SetRangeAlpha(button, false)
elseif (spell) then
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
elseif (UnitInRaid(button.unit) or UnitInParty(button.unit)) then
RangeCheck:SetRangeAlpha(button, UnitInRange(button.unit, "player"))
-- Nope, fall back to interaction :(
else
RangeCheck:SetRangeAlpha(button, CheckInteractDistance(button.unit, 4))
end
end
function RangeCheck:CreateTimer(frame)
if not frame.range then
frame.range = C_Timer.NewTicker(0.05, RangeCheck.CheckRange)
frame.range.parent = frame
end
end
function RangeCheck:CancelTimer(frame)
if frame.range then
frame.range:Cancel()
frame.range = nil
end
end
function RangeCheck:ForceUpdate(frame)
if( UnitIsUnit(frame.unit, "player") ) then
frame.healthBar:SetAlpha(1)
frame.powerBar:SetAlpha(1)
self:CancelTimer(frame)
else
self:CreateTimer(frame)
self.CheckRange(frame.parent)
end
end
function RangeCheck:GetOptions()
return {
header = {
type = "header",
name = L["Range Check"],
order = 2,
},
rangeCheckEnabled = Gladdy:option({
type = "toggle",
name = L["Enabled"],
desc = L["Enable racial icon"],
order = 3,
}),
group = {
type = "group",
childGroups = "tree",
name = L["General"],
order = 5,
args = {
general = {
type = "group",
name = L["General"],
order = 1,
args = {
header = {
type = "header",
name = L["General"],
order = 1,
},
rangeCheckOorFactor = Gladdy:option({
type = "range",
name = L["Out of Range Darkening Level"],
desc = L["Higher is darker"],
min = 1.1,
max = 5,
step = 0.1,
width = "full",
order = 2,
}),
rangeCheckHealthBar = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Health Bar"],
width = "full",
order = 3,
}),
rangeCheckHealthBarText = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Health Bar Text"],
width = "full",
order = 4,
}),
rangeCheckPowerBar = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Power Bar"],
width = "full",
order = 5,
}),
rangeCheckPowerBarText = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Power Bar Text"],
width = "full",
order = 6,
}),
rangeCheckClassIcon = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Class Icon"],
width = "full",
order = 7,
}),
rangeCheckTrinket = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Trinket"],
width = "full",
order = 8,
}),
rangeCheckRacial = Gladdy:option({
type = "toggle",
name = L["Fade"] .. " " .. L["Racial"],
width = "full",
order = 9,
}),
},
},
},
},
oorSpells = {
type = "group",
childGroups = "tree",
name = L["Spells"],
order = 5,
args = RangeCheck:GetSpells(),
},
}
end
function RangeCheck:GetSpells()
local group = {
description = {
type = "description",
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,
},
}
for i,class in ipairs(Gladdy.CLASSES) do
group[class] = {
type = "group",
name = LOCALIZED_CLASS_NAMES_MALE[class],
order = i + 1,
icon = "Interface\\Glues\\CharacterCreate\\UI-CharacterCreate-Classes",
iconCoords = CLASS_ICON_TCOORDS[class],
args = {
headerMin = {
type = "header",
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",
order = 1,
},
min = {
type = "input",
name = "Spell ID", --format("|T%s:20|t %s", select(3, GetSpellInfo(k)), select(1, GetSpellInfo(k)))
order = 2,
width = "full",
pattern = "%d+",
validate = function(_, value)
LibStub("AceConfigRegistry-3.0"):NotifyChange("Gladdy")
return type(tonumber(value)) == "number"
end,
--image = select(3, GetSpellInfo(defaultSpells()[class].min)),
get = function(_)
return tostring(Gladdy.db.rangeCheckDefaultSpells[class].min)
end,
set = function(_, 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)))
-- 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 - %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"
end
},
--[[headerMax = {
type = "header",
name = L["Max"],
order = 3,
},
max = {
type = "input",
name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max) and format("|T%s:20|t %s", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)))
or "nil",
order = 4,
width = "full",
pattern = "%d+",
validate = function(_, value)
return type(tonumber(value)) == "number"
end,
--image = select(3, GetSpellInfo(defaultSpells()[class].max)),
get = function(_)
return tostring(Gladdy.db.rangeCheckDefaultSpells[class].max)
end,
set = function(_, value)
Gladdy.db.rangeCheckDefaultSpells[class].max = tonumber(value)
Gladdy.options.args["Range Check"].args.oorSpells.args[class].args.max.name = GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max) and format("|T%s:20|t %s", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].max)))
or "nil"
end
}--]]
}
}
end
return group
end

View File

@ -0,0 +1,187 @@
local floor, str_find, pairs = math.floor, string.find, pairs
local CreateFrame = CreateFrame
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local ShadowsightTimer = Gladdy:NewModule("Shadowsight Timer", nil, {
shadowsightTimerEnabled = true,
shadowsightTimerLocked = false,
shadowsightTimerScale = 1,
shadowsightTimerRelPoint1 = "CENTER",
shadowsightTimerRelPoint2 = "CENTER",
shadowsightTimerX = 0,
shadowsightTimerY = 0,
shadowsightAnnounce = true,
})
function ShadowsightTimer:OnEvent(event, ...)
self[event](self, ...)
end
function ShadowsightTimer:Initialize()
self.locale = Gladdy:GetArenaTimer()
self:RegisterMessage("JOINED_ARENA")
self:RegisterMessage("AURA_GAIN")
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:AURA_GAIN(unit, auraType, spellID)
if (spellID == 34709) then
--TODO reset timer after 15s
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()
end
end
end
end
function ShadowsightTimer:Test()
if Gladdy.db.shadowsightTimerEnabled then
self.timerFrame:Show()
self:Start()
end
end
function ShadowsightTimer:Reset()
self.timerFrame:Hide()
self.timerFrame:SetScript("OnUpdate", nil)
self.timerFrame.font:SetTextColor(1, 0.8, 0)
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)
local backdrop = {
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "",
tile = true, tileSize = 16, edgeSize = 10,
insets = {left = 0, right = 0, top = 0, bottom = 0}
}
self.timerFrame:SetBackdrop(backdrop)
self.timerFrame:SetBackdropColor(0,0,0,0.8)
self.timerFrame:SetHeight(17)
self.timerFrame:SetWidth(35)
self.timerFrame:SetMovable(true)
self.timerFrame:EnableMouse(true)
self.timerFrame.texture = self.timerFrame:CreateTexture(nil,"OVERLAY")
self.timerFrame.texture:SetWidth(16)
self.timerFrame.texture:SetHeight(16)
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")
self.timerFrame.font:SetPoint("LEFT", 5, 0)
self.timerFrame.font:SetJustifyH("LEFT")
self.timerFrame.font:SetTextColor(1, 0.8, 0)
self.timerFrame:SetScript("OnMouseDown",function(self) self:StartMoving() end)
self.timerFrame:SetScript("OnMouseUp",function(self)
self:StopMovingOrSizing()
Gladdy.db.shadowsightTimerRelPoint1,_,Gladdy.db.shadowsightTimerRelPoint2,Gladdy.db.shadowsightTimerX,Gladdy.db.shadowsightTimerY = self:GetPoint()
end)
self.timerFrame:SetScale(Gladdy.db.shadowsightTimerScale)
self.timerFrame:Hide()
end
function ShadowsightTimer:UpdateFrameOnce()
self.timerFrame:EnableMouse(not Gladdy.db.shadowsightTimerLocked)
if Gladdy.db.shadowsightTimerEnabled then
self.timerFrame:SetScale(Gladdy.db.shadowsightTimerScale)
self.timerFrame:ClearAllPoints()
self.timerFrame:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint2, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
if Gladdy.frame.testing or Gladdy.curBracket then
self.timerFrame:Show()
end
else
self.timerFrame:SetScale(Gladdy.db.shadowsightTimerScale)
self.timerFrame:ClearAllPoints()
self.timerFrame:SetPoint(Gladdy.db.shadowsightTimerRelPoint1, nil, Gladdy.db.shadowsightTimerRelPoint2, Gladdy.db.shadowsightTimerX, Gladdy.db.shadowsightTimerY)
self.timerFrame:Hide()
end
end
function ShadowsightTimer:Start()
self.timerFrame.endTime = 91
self.timerFrame.timeSinceLastUpdate = 0
self.timerFrame:SetScript("OnUpdate", ShadowsightTimer.OnUpdate)
end
function ShadowsightTimer.OnUpdate(self, elapsed)
self.timeSinceLastUpdate = self.timeSinceLastUpdate + elapsed;
self.endTime = self.endTime - elapsed
if (self.timeSinceLastUpdate > 0.1) then
self.font:SetFormattedText(floor(self.endTime / 60) .. ":" .. "%02d", self.endTime - floor(self.endTime / 60) * 60)
self.timeSinceLastUpdate = 0;
if floor(self.endTime) == 15 and Gladdy.db.shadowsightAnnounce then
Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up in %ds"]:format(15))
end
end
if self.endTime <= 0 then
if Gladdy.db.shadowsightAnnounce then
Gladdy:SendMessage("SHADOWSIGHT", L["Shadowsight up!"])
end
self:SetScript("OnUpdate", nil)
self.font:SetText("0:00")
self.font:SetTextColor(0, 1, 0)
end
end
function ShadowsightTimer:GetOptions()
return {
headerArenaCountdown = {
type = "header",
name = L["Shadowsight Timer"],
order = 2,
},
shadowsightTimerEnabled = Gladdy:option({
type = "toggle",
name = L["Enabled"],
--desc = L["Turns countdown before the start of an arena match on/off."],
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,
width = "full",
}),
shadowsightAnnounce = Gladdy:option({
type = "toggle",
name = L["Announce"],
--desc = L["Turns countdown before the start of an arena match on/off."],
order = 5,
width = "full",
}),
shadowsightTimerScale = Gladdy:option({
type = "range",
name = L["Scale"],
order = 6,
min = 0.1,
max = 5,
step = 0.1,
width = "full",
}),
}
end

View File

@ -3,7 +3,7 @@ local UnitExists, UnitIsUnit, UnitName, UnitIsEnemy = UnitExists, UnitIsUnit, Un
local C_NamePlate = C_NamePlate
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local GetSpellInfo, CreateFrame, GetCVar = GetSpellInfo, CreateFrame, GetCVar
local GetSpellInfo, CreateFrame = GetSpellInfo, CreateFrame
---------------------------------------------------
@ -117,8 +117,8 @@ local function GetTotemColorDefaultOptions()
desc = "Enable " .. format("|T%s:20|t %s", indexedList[i].texture, select(1, GetSpellInfo(indexedList[i].id))),
type = "toggle",
width = "full",
get = function(info) return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled end,
set = function(info, value)
get = function() return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled end,
set = function(_, value)
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].enabled = value
Gladdy:UpdateFrame()
end
@ -130,15 +130,13 @@ local function GetTotemColorDefaultOptions()
order = 3,
hasAlpha = true,
width = "full",
get = function(info)
local key = info.arg or info[#info]
get = function()
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.b,
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].color.a
end,
set = function(info, r, g, b, a)
local key = info.arg or info[#info]
set = function(_, r, g, b, a)
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.b,
@ -154,10 +152,10 @@ local function GetTotemColorDefaultOptions()
max = 1,
step = 0.1,
width = "full",
get = function(info)
get = function()
return Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha
end,
set = function(info, value)
set = function(_, value)
Gladdy.dbi.profile.npTotemColors["totem" .. indexedList[i].id].alpha = value
Gladdy:UpdateFrame()
end
@ -167,8 +165,8 @@ local function GetTotemColorDefaultOptions()
name = L["Custom totem name"],
order = 5,
width = "full",
get = function(info) 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
get = function() return Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText end,
set = function(_, value) Gladdy.db.npTotemColors["totem" .. indexedList[i].id].customText = value Gladdy:UpdateFrame() end
},
}
}
@ -176,15 +174,6 @@ local function GetTotemColorDefaultOptions()
return defaultDB, options, indexedList
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
@ -227,6 +216,7 @@ function TotemPlates:Initialize()
self:RegisterEvent("NAME_PLATE_UNIT_ADDED")
self:RegisterEvent("NAME_PLATE_UNIT_REMOVED")
self:RegisterEvent("PLAYER_TARGET_CHANGED")
self:RegisterEvent("UNIT_NAME_UPDATE")
self:SetScript("OnEvent", TotemPlates.OnEvent)
if Gladdy.db.npTotems and Gladdy.db.npTotemsShowEnemy then
--GetCVar("nameplateShowEnemyTotems")
@ -236,12 +226,26 @@ function TotemPlates:Initialize()
--GetCVar("nameplateShowFriendlyTotems")
--SetCVar("nameplateShowFriendlyTotems", true);
end
--NeatPlates
--ELVUI
--Plater
--KUI
--threatplates
self.addon = "Blizzard"
if (IsAddOnLoaded("Plater")) then
self.addon = "Plater"
elseif (IsAddOnLoaded("Kui_Nameplates")) then
self.addon = "Kui_Nameplates"
elseif (IsAddOnLoaded("NeatPlates")) then
self.addon = "NeatPlates"
elseif (IsAddOnLoaded("TidyPlates_ThreatPlates")) then
self.addon = "TidyPlates_ThreatPlates"
elseif (IsAddOnLoaded("Tukui")) then
local _, C, _ = Tukui:unpack()
if C.NamePlates.Enable then
self.addon = "Tukui"
end
elseif (IsAddOnLoaded("ElvUI")) then
local E = unpack(ElvUI)
if E.private.nameplates.enable then
self.addon = "ElvUI"
end
end
end
function TotemPlates:PLAYER_ENTERING_WORLD()
@ -265,40 +269,158 @@ function TotemPlates:UpdateFrameOnce()
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.b,
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: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 "")
self:SetTotemAlpha(nameplate.gladdyTotemFrame, k)
nameplate.UnitFrame.selectionHighlight:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT", Gladdy.db.npTotemPlatesSize/16, -Gladdy.db.npTotemPlatesSize/16)
nameplate.UnitFrame.selectionHighlight:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT", -Gladdy.db.npTotemPlatesSize/16, Gladdy.db.npTotemPlatesSize/16)
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
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:SetHeight(Gladdy.db.npTotemPlatesSize)
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)
end
end
---------------------------------------------------
-- TotemPlates Frame
---------------------------------------------------
function TotemPlates:CreateTotemFrame(nameplate)
nameplate.gladdyTotemFrame = CreateFrame("Frame")
nameplate.gladdyTotemFrame:SetIgnoreParentAlpha(true)
nameplate.gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
nameplate.gladdyTotemFrame:SetHeight(Gladdy.db.npTotemPlatesSize)
nameplate.gladdyTotemFrame.totemIcon = nameplate.gladdyTotemFrame:CreateTexture(nil, "BACKGROUND")
nameplate.gladdyTotemFrame.totemIcon:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
nameplate.gladdyTotemFrame.totemIcon:ClearAllPoints()
nameplate.gladdyTotemFrame.totemIcon:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT")
nameplate.gladdyTotemFrame.totemIcon:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT")
nameplate.gladdyTotemFrame.totemBorder = nameplate.gladdyTotemFrame:CreateTexture(nil, "BORDER")
nameplate.gladdyTotemFrame.totemBorder:ClearAllPoints()
nameplate.gladdyTotemFrame.totemBorder:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT")
nameplate.gladdyTotemFrame.totemBorder:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT")
nameplate.gladdyTotemFrame.totemBorder:SetTexture(Gladdy.db.npTotemPlatesBorderStyle)
nameplate.gladdyTotemFrame.totemName = nameplate.gladdyTotemFrame:CreateFontString(nil, "OVERLAY")
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.selectionHighlight = nameplate.gladdyTotemFrame:CreateTexture(nil, "OVERLAY")
nameplate.gladdyTotemFrame.selectionHighlight:SetTexture("Interface/TargetingFrame/UI-TargetingFrame-BarFill")
nameplate.gladdyTotemFrame.selectionHighlight:SetAlpha(0)
nameplate.gladdyTotemFrame.selectionHighlight:SetBlendMode("ADD")
nameplate.gladdyTotemFrame.selectionHighlight:SetIgnoreParentAlpha(true)
nameplate.gladdyTotemFrame.selectionHighlight:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT", Gladdy.db.npTotemPlatesSize/16, -Gladdy.db.npTotemPlatesSize/16)
nameplate.gladdyTotemFrame.selectionHighlight:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT", -Gladdy.db.npTotemPlatesSize/16, Gladdy.db.npTotemPlatesSize/16)
nameplate.gladdyTotemFrame:SetScript('OnUpdate', TotemPlates.OnUpdate)
nameplate.gladdyTotemFrame:SetScript("OnHide", function(self)
self.parent = nil
self:SetParent(nil)
end)
end
---------------------------------------------------
-- Nameplate functions
---------------------------------------------------
function TotemPlates:GetAddonFrame(nameplate)
if self.addon == "Blizzard" then
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
function TotemPlates:PLAYER_TARGET_CHANGED()
for k,nameplate in pairs(self.activeTotemNameplates) do
TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, k)
end
end
function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
local unitID = ...
function TotemPlates:ToggleAddon(nameplate, show)
local addonFrames = { self:GetAddonFrame(nameplate) }
if addonFrames and #addonFrames > 0 then
if show then
for _,v in ipairs(addonFrames) do
v:Show()
end
else
for _,v in ipairs(addonFrames) do
v:Hide()
end
end
end
end
function TotemPlates.OnUpdate(self)
if (UnitIsUnit("mouseover", self.unitID) or UnitIsUnit("target", self.unitID)) then
self.selectionHighlight:SetAlpha(.25)
else
self.selectionHighlight:SetAlpha(0)
end
if (TotemPlates.addon == "Plater" or TotemPlates.addon == "Tukui" or TotemPlates.addon == "ElvUI") and self.parent and self.parent.unitFrame then
self.parent.unitFrame:Hide()
end
end
function TotemPlates:OnUnitEvent(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
self:ToggleAddon(nameplate, true)
return
end
if not Gladdy.db.npTotemsShowFriendly and not isEnemy then
self:ToggleAddon(nameplate, true)
return
end
local nameplateName = UnitName(unitID)
@ -306,31 +428,14 @@ function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
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 #self.totemPlateCache > 0 then
nameplate.gladdyTotemFrame = tremove(self.totemPlateCache, #self.totemPlateCache)
else
nameplate.gladdyTotemFrame = CreateFrame("Frame", nil)
nameplate.gladdyTotemFrame:SetIgnoreParentAlpha(true)
nameplate.gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
nameplate.gladdyTotemFrame:SetHeight(Gladdy.db.npTotemPlatesSize)
nameplate.gladdyTotemFrame.totemIcon = nameplate.gladdyTotemFrame:CreateTexture(nil, "BACKGROUND")
nameplate.gladdyTotemFrame.totemIcon:SetMask("Interface\\AddOns\\Gladdy\\Images\\mask")
nameplate.gladdyTotemFrame.totemIcon:ClearAllPoints()
nameplate.gladdyTotemFrame.totemIcon:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT")
nameplate.gladdyTotemFrame.totemIcon:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT")
nameplate.gladdyTotemFrame.totemBorder = nameplate.gladdyTotemFrame:CreateTexture(nil, "BORDER")
nameplate.gladdyTotemFrame.totemBorder:ClearAllPoints()
nameplate.gladdyTotemFrame.totemBorder:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT")
nameplate.gladdyTotemFrame.totemBorder:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT")
nameplate.gladdyTotemFrame.totemBorder:SetTexture(Gladdy.db.npTotemPlatesBorderStyle)
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:SetPoint("TOP", nameplate.gladdyTotemFrame, "BOTTOM", Gladdy.db.npTremorFontXOffset, Gladdy.db.npTremorFontYOffset)
self:CreateTotemFrame(nameplate)
end
nameplate.gladdyTotemFrame.unitID = unitID
nameplate.gladdyTotemFrame.totemDataEntry = totemDataEntry
nameplate.gladdyTotemFrame.parent = nameplate
nameplate.gladdyTotemFrame:SetParent(nameplate)
@ -342,28 +447,29 @@ function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.b,
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.a)
nameplate.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "")
nameplate.gladdyTotemFrame.parent = nameplate
nameplate.gladdyTotemFrame:Show()
TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, unitID)
nameplate.UnitFrame:SetAlpha(0)
nameplate.UnitFrame.selectionHighlight:ClearAllPoints()
nameplate.UnitFrame.selectionHighlight:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT", Gladdy.db.npTotemPlatesSize/16, -Gladdy.db.npTotemPlatesSize/16)
nameplate.UnitFrame.selectionHighlight:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT", -Gladdy.db.npTotemPlatesSize/16, Gladdy.db.npTotemPlatesSize/16)
nameplate.UnitFrame:SetScript("OnHide", function(unitFrame)
unitFrame:SetAlpha(1)
unitFrame.selectionHighlight:ClearAllPoints()
unitFrame.selectionHighlight:SetPoint("TOPLEFT", unitFrame.healthBar.barTexture, "TOPLEFT")
unitFrame.selectionHighlight:SetPoint("BOTTOMRIGHT", unitFrame.healthBar.barTexture, "BOTTOMRIGHT")
unitFrame:SetScript("OnHide", nil)
end)
self:ToggleAddon(nameplate)
self.activeTotemNameplates[unitID] = nameplate
else
self:ToggleAddon(nameplate, true)
end
end
function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
self:OnUnitEvent(...)
end
function TotemPlates:UNIT_NAME_UPDATE(...)
self:OnUnitEvent(...)
end
function TotemPlates:NAME_PLATE_UNIT_REMOVED(...)
local 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)
@ -548,19 +654,23 @@ function TotemPlates:GetOptions()
step = 0.1,
width = "full",
order = 23,
get = function(info)
local alphas = GetTotemOptions()
for i=2, #alphas do
if alphas[i].alpha ~= alphas[1].alpha then
return ""
get = function()
local alpha, i = nil, 1
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
if i == 1 then
alpha = v.alpha
i = i + 1
else
if v.alpha ~= alpha then
return ""
end
end
end
return alphas[1].alpha
return alpha
end,
set = function(info, value)
local alphas = GetTotemOptions()
for i=1, #alphas do
alphas[i].alpha = value
set = function(_, value)
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
v.alpha = value
end
Gladdy:UpdateFrame()
end,
@ -588,23 +698,27 @@ function TotemPlates:GetOptions()
name = L["All totem border color"],
order = 42,
hasAlpha = true,
get = function(info)
local colors = GetTotemOptions()
local color = colors[1].color
for i=2, #colors 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
return 0, 0, 0, 0
get = function()
local color
local i = 1
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
if i == 1 then
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
return color.r, color.g, color.b, color.a
end,
set = function(info, r, g, b, a)
local colors = GetTotemOptions()
for i=1, #colors do
colors[i].color.r = r
colors[i].color.g = g
colors[i].color.b = b
colors[i].color.a = a
set = function(_, r, g, b, a)
for _,v in pairs(Gladdy.dbi.profile.npTotemColors) do
v.color.r = r
v.color.g = g
v.color.b = b
v.color.a = a
end
Gladdy:UpdateFrame()
end,

View File

@ -1,4 +1,4 @@
local ceil, floor, string_format, tonumber = ceil, floor, string.format, tonumber
local ceil = ceil
local C_PvP = C_PvP
local CreateFrame = CreateFrame
@ -39,33 +39,22 @@ local function iconTimer(self, elapsed)
local timeLeft = ceil(self.timeLeft)
if timeLeft >= 60 then
-- more than 1 minute
self.cooldownFont:SetTextColor(1, 1, 0)
self.cooldownFont:SetText(floor(timeLeft / 60) .. ":" .. string_format("%02.f", floor(timeLeft - floor(timeLeft / 60) * 60)))
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 0.15*self:GetWidth()) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft >= 21 then
-- between 60s and 21s (green)
self.cooldownFont:SetTextColor(0.7, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 20.9 and timeLeft >= 11 then
-- between 20s and 11s (green)
self.cooldownFont:SetTextColor(0, 1, 0)
self.cooldownFont:SetText(timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft <= 10 and timeLeft >= 5 then
-- between 10s and 5s (orange)
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 0.15*self:GetWidth()) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 60 and timeLeft >= 30 then
self.cooldownFont:SetTextColor(1, 1, 0)
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 30 and timeLeft >= 11 then
self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft <= 10 and timeLeft >= 5 then
self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 5 and timeLeft > 0 then
-- between 5s and 1s (red)
self.cooldownFont:SetTextColor(1, 0, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft >= 0.0 and timeLeft or 0.0)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
else
self.cooldownFont:SetText("")
self.cooldownFont:SetFont(Gladdy:SMFetch("font", "trinketFont"), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
end
Gladdy:FormatTimer(self.cooldownFont, self.timeLeft, self.timeLeft < 10, true)
end
end
@ -87,7 +76,7 @@ function Trinket:CreateFrame(unit)
trinket.cooldownFrame:SetPoint("BOTTOMRIGHT", trinket, "BOTTOMRIGHT")
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:SetJustifyH("CENTER")
trinket.cooldownFont:SetPoint("CENTER")
@ -249,6 +238,7 @@ function Trinket:GetOptions()
max = 100,
step = 1,
order = 4,
width = "full",
}),
trinketWidthFactor = Gladdy:option({
type = "range",
@ -257,6 +247,7 @@ function Trinket:GetOptions()
max = 2,
step = 0.05,
order = 6,
width = "full",
}),
},
},
@ -283,6 +274,7 @@ function Trinket:GetOptions()
max = 1,
step = 0.1,
order = 8,
width = "full",
}),
},
},
@ -312,6 +304,7 @@ function Trinket:GetOptions()
min = 0.1,
max = 2,
step = 0.1,
width = "full",
}),
},
},

View File

@ -1,9 +1,11 @@
local str_match, tonumber, tostring = string.match, tonumber, tostring
local tonumber, tostring = tonumber, tostring
local UnitName = UnitName
local IsInGroup, IsInRaid = IsInGroup, IsInRaid
local LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE = LE_PARTY_CATEGORY_HOME, LE_PARTY_CATEGORY_INSTANCE
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local VersionCheck = Gladdy:NewModule("VersionCheck", 1, {
})
LibStub("AceComm-3.0"):Embed(VersionCheck)
@ -21,6 +23,13 @@ end
function VersionCheck:JOINED_ARENA()
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
if IsInRaid(LE_PARTY_CATEGORY_HOME) then
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "RAID", self.playerName)
elseif IsInGroup(LE_PARTY_CATEGORY_INSTANCE) or IsInRaid(LE_PARTY_CATEGORY_INSTANCE) then
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "INSTANCE_CHAT", self.playerName)
elseif IsInGroup(LE_PARTY_CATEGORY_HOME) then
self:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "PARTY", self.playerName)
end
end
function VersionCheck:Test(unit)
@ -39,7 +48,7 @@ function VersionCheck.OnCommReceived(prefix, message, distribution, sender)
else
Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"")
Gladdy:Warn("Please download the latest Gladdy version at:")
Gladdy:Warn("https://github.com/XiconQoo/Gladdy-TBC")
Gladdy:Warn("https://www.curseforge.com/wow/addons/gladdy-tbc or https://github.com/XiconQoo/Gladdy-TBC")
end
end
end

View File

@ -27,7 +27,17 @@ end
function XiconProfiles:ApplyClassic()
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetClassicProfile())
if deserialized then
Gladdy.modules["ExportImport"]:ApplyImport(deserialized, Gladdy.db)
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()
@ -44,6 +54,26 @@ function XiconProfiles:ApplyBlizz()
Gladdy:ToggleFrame(3)
end
function XiconProfiles:ApplyRukk()
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetRukkProfile())
if deserialized then
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
end
Gladdy:Reset()
Gladdy:HideFrame()
Gladdy:ToggleFrame(3)
end
function XiconProfiles:ApplyMir()
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetMirProfile())
if deserialized then
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
end
Gladdy:Reset()
Gladdy:HideFrame()
Gladdy:ToggleFrame(3)
end
function XiconProfiles:GetOptions()
return {
headerProfileBlizzard = {
@ -84,10 +114,29 @@ function XiconProfiles:GetOptions()
width = "full",
order = 5,
},
headerProfileClassicNoPet = {
type = "header",
name = "Classic " .. L["Profile"] .. L[" No Pet"],
order = 6,
},
classicProfileNoPet = {
type = "execute",
func = function()
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
XiconProfiles:ApplyClassicNoPet()
end,
name = " ",
desc = "Classic " .. L["Profile"] .. L[" No Pet"],
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Classic2.blp",
imageWidth = 350,
imageHeight = 175,
width = "full",
order = 7,
},
headerProfileKnall = {
type = "header",
name = "Knall's " .. L["Profile"],
order = 6,
order = 8,
},
knallProfile = {
type = "execute",
@ -101,12 +150,12 @@ function XiconProfiles:GetOptions()
imageWidth = 350,
imageHeight = 175,
width = "full",
order = 7,
order = 9,
},
headerProfileKlimp = {
type = "header",
name = "Klimp's " .. L["Profile"],
order = 8,
order = 10,
},
klimpProfiles = {
type = "execute",
@ -120,8 +169,45 @@ function XiconProfiles:GetOptions()
name = " ",
desc = "Klimp's " .. L["Profile"],
width = "full",
order = 9,
order = 11,
},
headerProfileRukk = {
type = "header",
name = "Rukk1's " .. L["Profile"],
order = 12,
},
rukkProfile = {
type = "execute",
func = function()
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
XiconProfiles:ApplyRukk()
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())
XiconProfiles:ApplyMir()
end,
name = " ",
desc = "Mir's " .. L["Profile"],
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Mir1.blp",
imageWidth = 350,
imageHeight = 175,
width = "full",
order = 15,
},
}
end

View File

@ -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, string_format = tostring, string.match, tonumber, string.format
local ceil, floor = ceil, floor
local ReloadUI = ReloadUI
local InterfaceOptionsFrame_OpenToFrame = InterfaceOptionsFrame_OpenToFrame
local GetSpellInfo = GetSpellInfo
@ -6,13 +9,42 @@ local LOCALIZED_CLASS_NAMES_MALE = LOCALIZED_CLASS_NAMES_MALE
local CLASS_ICON_TCOORDS = CLASS_ICON_TCOORDS
local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF
local Gladdy = LibStub("Gladdy")
local LibClassAuras = LibStub("LibClassAuras-1.0")
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) .. ":" .. string_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 = {
profile = {
locked = false,
hideBlizzard = "arena",
x = 0,
y = 0,
growUp = false,
@ -22,6 +54,8 @@ Gladdy.defaults = {
barWidth = 180,
bottomMargin = 2,
statusbarBorderOffset = 6,
timerFormat = Gladdy.TIMER_FORMAT.tenths,
backgroundColor = {r = 0, g = 0, b = 0, a = 0},
},
}
@ -97,6 +131,11 @@ local function setOpt(info, value)
local key = info.arg or info[#info]
Gladdy.dbi.profile[key] = value
Gladdy:UpdateFrame()
if Gladdy.db.hideBlizzard == "always" then
SetCVar("showArenaEnemyFrames", 0)
elseif Gladdy.db.hideBlizzard == "never" then
SetCVar("showArenaEnemyFrames", 1)
end
end
local function getColorOpt(info)
local key = info.arg or info[#info]
@ -169,18 +208,52 @@ end
function Gladdy:SetupOptions()
self.options = {
type = "group",
name = "Gladdy",
name = L["Gladdy"],
plugins = {},
childGroups = "tree",
get = getOpt,
set = setOpt,
args = {
test = {
order = 1,
width = 0.7,
name = L["Test"],
type = "execute",
func = function()
Gladdy:ToggleFrame(3)
end,
},
hide = {
order = 2,
width = 0.7,
name = L["Hide"],
type = "execute",
func = function()
Gladdy:Reset()
Gladdy:HideFrame()
end,
},
reload = {
order = 3,
width = 0.7,
name = L["ReloadUI"],
type = "execute",
func = function()
ReloadUI()
end,
},
version = {
order = 4,
width = 1,
type = "description",
name = " Gladdy v" .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType
},
general = {
type = "group",
name = L["General"],
desc = L["General settings"],
childGroups = "tab",
order = 1,
order = 5,
args = {
locked = {
type = "toggle",
@ -188,12 +261,6 @@ function Gladdy:SetupOptions()
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 = {
type = "select",
name = L["Grow Direction"],
@ -205,10 +272,20 @@ function Gladdy:SetupOptions()
["RIGHT"] = L["Right"],
}
},
hideBlizzard = {
type = "select",
name = L["Hide Blizzard"],
values = {
["arena"] = L["Arena only"],
["never"] = L["Never"],
["always"] = L["Always"],
},
order = 4,
},
group = {
type = "group",
name = L["General"],
order = 4,
order = 5,
childGroups = "tree",
args = {
frameGeneral = {
@ -228,7 +305,7 @@ function Gladdy:SetupOptions()
order = 4,
min = .1,
max = 2,
step = .1,
step = .01,
},
padding = {
type = "range",
@ -257,6 +334,15 @@ function Gladdy:SetupOptions()
max = 200,
step = 1,
},
backgroundColor = {
type = "color",
name = L["Background color"],
desc = L["Background Color of the frame"],
order = 8,
hasAlpha = true,
get = getColorOpt,
set = setColorOpt,
},
}
},
cooldownGeneral = {
@ -327,6 +413,12 @@ function Gladdy:SetupOptions()
Gladdy:UpdateFrame()
end
},
timerFormat = Gladdy:option({
type = "select",
name = L["Timer Format"],
order = 11,
values = Gladdy.TIMER_FORMAT.values
})
},
},
fontGeneral = {
@ -642,19 +734,19 @@ function Gladdy:SetupOptions()
},
}
local order = 2
local order = 6
for k, v in pairsByKeys(self.modules) do
self:SetupModule(k, v, order)
order = order + 1
end
local options = {
name = "Gladdy",
name = L["Gladdy"],
type = "group",
args = {
load = {
name = "Load configuration",
desc = "Load configuration options",
name = L["Load configuration"],
desc = L["Load configuration options"],
type = "execute",
func = function()
HideUIPanel(InterfaceOptionsFrame)
@ -681,7 +773,7 @@ function Gladdy:GetAuras(auraType)
ckeckAll = {
order = 1,
width = "0.7",
name = "Check All",
name = L["Check All"],
type = "execute",
func = function(info)
if auraType == AURA_TYPE_DEBUFF then
@ -698,7 +790,7 @@ function Gladdy:GetAuras(auraType)
uncheckAll = {
order = 2,
width = "0.7",
name = "Uncheck All",
name = L["Uncheck All"],
type = "execute",
func = function(info)
if auraType == AURA_TYPE_DEBUFF then

132
README.md
View File

@ -1,35 +1,47 @@
# Gladdy - TBC
### The most powerful arena addon for WoW TBC 2.5.1
## [v1.11-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.11-Beta/Gladdy_TBC-Classic_v1.11-Beta.zip)
## [v1.20-Release Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.20-Release/Gladdy_TBC-Classic_v1.20-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
### Origin
Based on https://github.com/Schaka/gladdy
Based on https://github.com/miraage/gladdy
### Motivation for this edit
The goal is to make Gladdy highly configurable in it's appearance. Everything can be arranged left or right independently. Also I gave Gladdy a new look with black borders. A lot can be configured.
### Modules:
- Announcement (drink, trinket usage, spec detection ...)
- ArenaCountDown
- Auras (show important (de)buffs in the class icon)
- BuffsDebuffs (show buffs and debuffs on arena frames - can be filtered)
- ClassIcon (or specicon, once detected)
- CombatIndicator
- Cooldown (tracks important cooldowns)
- Diminishing (tracks DRs)
- ExportImport (share your profile with your friends in the form of a string, which can be imported)
- Highlight (highlights focus and target)
- Pets (show arena pets)
- Racial Spells
- TotemPlates (show totem icons instead of normal nameplates)
- Trinket (tracks trinket usage)
- VersionCheck (checks if you use an older version that your teammate)
- XiconProfiles (predefined profiles to start your configuration from)
- **Announcement** (drink, trinket usage, spec detection ...)
- **ArenaCountDown**
- **Auras** (show important (de)buffs as well as interrupts on the class icon)
- **BuffsDebuffs** (show buffs and debuffs on arena frames - can be filtered)
- **CastBar** (shows a castbar, can be disabled)
- **ClassIcon** (or specicon, once detected)
- **Clicks** (bind spells or macros to click actions)
- **CombatIndicator** (shows a sword icon if unit is in combat)
- **Cooldown** (tracks important cooldowns)
- **Diminishing** (tracks DRs)
- **ExportImport** (share your profile with your friends in the form of a string, which can be imported)
- **Highlight** (highlights focus and target)
- **Pets** (show arena pets)
- **Racial** (show arena racial cooldowns)
- **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)
- **TotemPlates** (show totem icons instead of normal nameplates, compatible with **Plater, NeatPlates, KUI, ThreatPlates, ElvUI, TukUI**)
- **Trinket** (tracks trinket usage)
- **VersionCheck** (checks if you use an older version that your teammate)
- **XiconProfiles** (predefined profiles to start your configuration from)
### Valid Slash commands
- **/gladdy ui** (shows config)
- **/gladdy test** (standard 3v3 test mode)
- **/gladdy test1** to **/gladdy test5** (test mode with 1-5 frames active)
- **/gladdy hide** (hides the frames)
- **/gladdy reset** (resets current profile to default settings)
## Screenshots
@ -37,8 +49,92 @@ 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/sample3.png" width="48.5%">
## Special Thanks
- **miraage** - the origininal author of Gladdy! Your work set the foundation for this edit. Thanks!
- **Schaka** - the maintainer of Gladdy! (thanks for letting me continue Gladdy and all the work you put into the TBC community)
- **Macumba** (thanks for all the support, your feedback and your dedication for the TBC community)
- **RMO** (without you I would not have modified Gladdy at all and thanks for all the suggestions and active feedback)
- **Ur0b0r0s aka DrainTheLock** (thanks for testing, giving feedback and correcting/adding wrong CDs)
- **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)
- **Hydra** (thanks for constructive feedback and suggestions)
### Changes
### 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
- unit gray in stealth when rangecheck module disabled
### v1.15-Beta
- hotfix added entangling roots nature's grasp
### v1.14-Beta
- hotfix for secure button grow direction up
### v1.13-Beta
- frames behave now to mouseover macros
- added Range Check module (configurable which spell is used for range check)
- added Shadowsight Timer module (with announce)
- added Clicks module
- added Interrupt Tracker in Aura module (border color by spell school locked)
- TotemPlates compatible with Plater, NeatPlates, KUI, ThreatPlates, ElvUI, TukUI
- added a new Classic Profile in XiconProfiles
- hide blizzard arena frames option added in General
- castbar enable/disable
- powerbar enable/disable
- added some auras (Blackout, Improved Hamstring, Mace Stun, Stormherald Stun, Shadowsight Buff)
- added Swiftmend and Berserker Rage cooldowns
- changed textures for Mace Stun, Charge Stun and Intercept Stun
- reduced BLP size by 80%
- show XiconProfiles on first login
- DR bigger icons possible
- minor fixes
### v1.12-Beta
- fix classic profile
### v1.11-Beta
- TotemPlates fix after blizzard update

View File

@ -14,4 +14,5 @@
<Include file="libs\AceGUI-3.0-SharedMediaWidgets\widget.xml"/>
<Include file="libs\DRData-1.0\DRData-1.0.xml"/>
<Include file="libs\LibClassAuras-1.0\lib.xml"/>
<Include file="libs\LibSpellRange-1.0\lib.xml"/>
</Ui>