Merge branch 'release/v1.13-Beta' into main

This commit is contained in:
Sumsebrum 2021-06-20 02:57:40 +02:00
commit 88b769c12d
41 changed files with 3046 additions and 1210 deletions

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>

View File

@ -1,13 +1,18 @@
local tbl_sort, select = table.sort, select local tbl_sort, select = table.sort, select
local GetSpellInfo = GetSpellInfo local GetSpellInfo = GetSpellInfo
local GetLocale = GetLocale
local Gladdy = LibStub("Gladdy") local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF
function Gladdy:GetSpecBuffs() Gladdy.CLASSES = {"MAGE", "PRIEST", "DRUID", "SHAMAN", "PALADIN", "WARLOCK", "WARRIOR", "HUNTER", "ROGUE"}
return { tbl_sort(Gladdy.CLASSES)
Gladdy.RACES = {"Scourge", "BloodElf", "Tauren", "Orc", "Troll", "NightElf", "Draenei", "Human", "Gnome", "Dwarf"}
tbl_sort(Gladdy.RACES)
local specBuffs = {
-- DRUID -- DRUID
[GetSpellInfo(45283)] = L["Restoration"], -- Natural Perfection [GetSpellInfo(45283)] = L["Restoration"], -- Natural Perfection
[GetSpellInfo(16880)] = L["Restoration"], -- Nature's Grace; Dreamstate spec in TBC equals Restoration [GetSpellInfo(16880)] = L["Restoration"], -- Nature's Grace; Dreamstate spec in TBC equals Restoration
@ -70,10 +75,11 @@ function Gladdy:GetSpecBuffs()
[GetSpellInfo(12292)] = L["Arms"], -- Death Wish [GetSpellInfo(12292)] = L["Arms"], -- Death Wish
} }
function Gladdy:GetSpecBuffs()
return specBuffs
end end
function Gladdy:GetSpecSpells() local specSpells = {
return {
-- DRUID -- DRUID
[GetSpellInfo(33831)] = L["Balance"], -- Force of Nature [GetSpellInfo(33831)] = L["Balance"], -- Force of Nature
[GetSpellInfo(33983)] = L["Feral"], -- Mangle (Cat) [GetSpellInfo(33983)] = L["Feral"], -- Mangle (Cat)
@ -146,10 +152,11 @@ function Gladdy:GetSpecSpells()
[GetSpellInfo(12809)] = L["Protection"], -- Concussion Blow [GetSpellInfo(12809)] = L["Protection"], -- Concussion Blow
[GetSpellInfo(30022)] = L["Protection"], -- Devastation [GetSpellInfo(30022)] = L["Protection"], -- Devastation
} }
function Gladdy:GetSpecSpells()
return specSpells
end end
function Gladdy:GetImportantAuras() local importantAuras = {
return {
-- Cyclone -- Cyclone
[GetSpellInfo(33786)] = { [GetSpellInfo(33786)] = {
track = AURA_TYPE_DEBUFF, track = AURA_TYPE_DEBUFF,
@ -408,6 +415,14 @@ function Gladdy:GetImportantAuras()
magic = true, magic = true,
spellID = 605, spellID = 605,
}, },
--Blackout Stun 15269
[GetSpellInfo(15269)] = {
track = AURA_TYPE_DEBUFF,
duration = 3,
priority = 40,
spellSchool = "magic",
spellID = 15269,
},
-- Silence -- Silence
[GetSpellInfo(15487)] = { [GetSpellInfo(15487)] = {
track = AURA_TYPE_DEBUFF, track = AURA_TYPE_DEBUFF,
@ -545,6 +560,7 @@ function Gladdy:GetImportantAuras()
-- Unstable Affliction Silence -- Unstable Affliction Silence
["Unstable Affliction Silence"] = { -- GetSpellInfo returns "Unstable Affliction" ["Unstable Affliction Silence"] = { -- GetSpellInfo returns "Unstable Affliction"
track = AURA_TYPE_DEBUFF, track = AURA_TYPE_DEBUFF,
altName = select(1, GetSpellInfo(31117)) .. " Silence",
duration = 5, duration = 5,
priority = 15, priority = 15,
magic = true, magic = true,
@ -574,6 +590,15 @@ function Gladdy:GetImportantAuras()
duration = 3, duration = 3,
priority = 40, priority = 40,
spellID = 25274, spellID = 25274,
texture = select(3, GetSpellInfo(25272))
},
-- Charge Stun
[GetSpellInfo(7922)] = {
track = AURA_TYPE_DEBUFF,
duration = 1,
priority = 40,
spellID = 7922,
texture = select(3, GetSpellInfo(100))
}, },
-- Spell Reflection -- Spell Reflection
[GetSpellInfo(23920)] = { [GetSpellInfo(23920)] = {
@ -614,7 +639,33 @@ function Gladdy:GetImportantAuras()
spellSchool = "physical", spellSchool = "physical",
spellID = 3411, spellID = 3411,
}, },
--Improved Hamstring
[GetSpellInfo(23694)] = {
track = AURA_TYPE_DEBUFF,
duration = 5,
priority = 40,
spellSchool = "physical",
spellID = 23694,
},
-- Mace Stun Effect
[GetSpellInfo(5530)] = {
track = AURA_TYPE_DEBUFF,
duration = 3,
priority = 40,
spellSchool = "physical",
texture = select(3, GetSpellInfo(12284)),
spellID = 5530,
},
-- Storm Herald Stun effect
[GetSpellInfo(34510)] = {
track = AURA_TYPE_DEBUFF,
duration = 4,
priority = 40,
spellSchool = "physical",
spellID = 34510,
},
-- War Stomp -- War Stomp
[GetSpellInfo(20549)] = { [GetSpellInfo(20549)] = {
@ -631,16 +682,63 @@ function Gladdy:GetImportantAuras()
magic = true, magic = true,
spellID = 28730, spellID = 28730,
}, },
-- Shadowsight Buff
[GetSpellInfo(34709)] = {
track = AURA_TYPE_BUFF,
duration = 15,
priority = 15,
magic = true,
spellID = 34709,
},
} }
function Gladdy:GetImportantAuras()
return importantAuras
end end
Gladdy.CLASSES = {"MAGE", "PRIEST", "DRUID", "SHAMAN", "PALADIN", "WARLOCK", "WARRIOR", "HUNTER", "ROGUE"} local interrupts = {
tbl_sort(Gladdy.CLASSES) [GetSpellInfo(19675)] = {duration = 4, spellID = 19675, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(19675)), priority = 15}, -- Feral Charge Effect (Druid)
Gladdy.RACES = {"Scourge", "BloodElf", "Tauren", "Orc", "Troll", "NightElf", "Draenei", "Human", "Gnome", "Dwarf"} [GetSpellInfo(2139)] = {duration = 8, spellID = 2139, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(2139)), priority = 15}, -- Counterspell (Mage)
tbl_sort(Gladdy.RACES) [GetSpellInfo(1766)] = {duration = 5, spellID = 1766, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(1766)), priority = 15}, -- Kick (Rogue)
[GetSpellInfo(6552)] = {duration = 4, spellID = 6552, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(6552)), priority = 15}, -- Pummel (Warrior)
[GetSpellInfo(72)] = {duration = 6, spellID = 72, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(72)), priority = 15}, -- Shield Bash (Warrior)
[GetSpellInfo(8042)] = {duration = 2, spellID = 8042, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(8042)), priority = 15}, -- Earth Shock (Shaman)
[GetSpellInfo(19244)] = {duration = 5, spellID = 19244, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(19244)), priority = 15}, -- Spell Lock (Warlock
[GetSpellInfo(32747)] = {duration = 3, spellID = 32747, track = AURA_TYPE_DEBUFF, texture = select(3, GetSpellInfo(32747)), priority = 15}, -- Deadly Throw Interrupt
}
function Gladdy:GetInterrupts()
return interrupts
end
function Gladdy:GetCooldownList() local auraTypeColor = {}
return { 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"]
function Gladdy:GetAuraTypeColor()
return auraTypeColor
end
local spellSchoolColors = {}
spellSchoolColors[1] = {r = 1, g = 1, b = 0, a = 1, type = "Physical"} --- "physical" 255, 255, 0
spellSchoolColors[2] = {r = 1, g = 0.901, b = 0.501, a = 1, type = "Holy"} ---"holy" -- 255, 230, 128
spellSchoolColors[4] = {r = 1, g = 0.501, b = 0, a = 1, type = "Fire"} ---"fire" -- 255, 128, 0
spellSchoolColors[8] = {r = 0.302, g = 1, b = 0.302, a = 1, type = "Nature"} ---"nature" -- 77, 255, 77
spellSchoolColors[16] = {r = 0.501, g = 1, b = 1, a = 1, type = "Frost"} ---"frost" -- 128, 255, 255
spellSchoolColors[32] = {r = 0.501, g = 0.501, b = 1, a = 1, type = "Shadow"} ---"shadow" --128, 128, 255
spellSchoolColors[64] = {r = 1, g = 0.501, b = 1, a = 1, type = "Arcane"} ---"arcane" -- 255, 128, 255
spellSchoolColors["unknown"] = {r = 0, g = 0, b = 0, a = 1, type = "Unknown"} ---"unknown spell school"
function Gladdy:GetSpellSchoolColors()
return spellSchoolColors
end
local cooldownList = {
-- Spell Name Cooldown[, Spec] -- Spell Name Cooldown[, Spec]
-- Mage -- Mage
["MAGE"] = { ["MAGE"] = {
@ -686,6 +784,7 @@ function Gladdy:GetCooldownList()
[29166] = 360, -- Innervate [29166] = 360, -- Innervate
[8983] = 60, -- Bash [8983] = 60, -- Bash
[16689] = 60, -- Natures Grasp [16689] = 60, -- Natures Grasp
[18562] = { cd = 15, spec = L["Restoration"], }, -- Swiftmend
[17116] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness [17116] = { cd = 180, spec = L["Restoration"], }, -- Natures Swiftness
[33831] = { cd = 180, spec = L["Balance"], }, -- Force of Nature [33831] = { cd = 180, spec = L["Balance"], }, -- Force of Nature
}, },
@ -753,6 +852,7 @@ function Gladdy:GetCooldownList()
[3411] = 30, -- Intervene [3411] = 30, -- Intervene
[676] = 60, -- Disarm [676] = 60, -- Disarm
[5246] = 180, -- Intimidating Shout [5246] = 180, -- Intimidating Shout
[18499] = 30, -- Berserker Rage
--[2565] = 60, -- Shield Block --[2565] = 60, -- Shield Block
[12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish [12292] = { cd = 180, spec = L["Arms"], }, -- Death Wish
[12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand [12975] = { cd = 180, spec = L["Protection"], }, -- Last Stand
@ -842,10 +942,11 @@ function Gladdy:GetCooldownList()
[13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer [13908] = { cd = 600, spec = L["Discipline"], }, -- Desperate Prayer
}, },
} }
function Gladdy:GetCooldownList()
return cooldownList
end end
function Gladdy:Racials() local racials = {
return {
["Scourge"] = { ["Scourge"] = {
[7744] = true, -- Will of the Forsaken [7744] = true, -- Will of the Forsaken
duration = 120, duration = 120,
@ -911,4 +1012,77 @@ function Gladdy:Racials()
texture = select(3, GetSpellInfo(20594)) texture = select(3, GetSpellInfo(20594))
}, },
} }
function Gladdy:Racials()
return racials
end end
local arenaTimer = {
["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] = "競技場戰鬥開始了!",
},
}
arenaTimer["esMX"] = arenaTimer["esES"]
arenaTimer["ptPT"] = arenaTimer["ptBR"]
function Gladdy:GetArenaTimer()
if arenaTimer[GetLocale()] then
return arenaTimer[GetLocale()]
else
return arenaTimer["default"]
end
end

View File

@ -1,7 +1,6 @@
local select, string_gsub, tostring = select, string.gsub, tostring local select, string_gsub, tostring = select, string.gsub, tostring
local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo local CombatLogGetCurrentEventInfo = CombatLogGetCurrentEventInfo
local RAID_CLASS_COLORS = RAID_CLASS_COLORS
local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF local AURA_TYPE_DEBUFF = AURA_TYPE_DEBUFF
local AURA_TYPE_BUFF = AURA_TYPE_BUFF local AURA_TYPE_BUFF = AURA_TYPE_BUFF
@ -34,7 +33,6 @@ function EventListener:JOINED_ARENA()
self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START") self:RegisterEvent("UNIT_SPELLCAST_CHANNEL_START")
self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED") self:RegisterEvent("UNIT_SPELLCAST_SUCCEEDED")
self:SetScript("OnEvent", EventListener.OnEvent) self:SetScript("OnEvent", EventListener.OnEvent)
Gladdy:SendCommMessage("GladdyVCheck", tostring(Gladdy.version_num), "RAID", UnitName("player"))
end end
function EventListener:Reset() function EventListener:Reset()
@ -76,21 +74,10 @@ end
function EventListener:COMBAT_LOG_EVENT_UNFILTERED() function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
-- timestamp,eventType,hideCaster,sourceGUID,sourceName,sourceFlags,sourceRaidFlags,destGUID,destName,destFlags,destRaidFlags,spellId,spellName,spellSchool -- timestamp,eventType,hideCaster,sourceGUID,sourceName,sourceFlags,sourceRaidFlags,destGUID,destName,destFlags,destRaidFlags,spellId,spellName,spellSchool
local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName = CombatLogGetCurrentEventInfo() local _,eventType,_,sourceGUID,_,_,_,destGUID,_,_,_,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool = CombatLogGetCurrentEventInfo()
local srcUnit = Gladdy.guids[sourceGUID] local srcUnit = Gladdy.guids[sourceGUID]
local destUnit = Gladdy.guids[destGUID] 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 if destUnit then
-- diminish tracker -- diminish tracker
if (Gladdy.db.drEnabled and (eventType == "SPELL_AURA_REMOVED" or eventType == "SPELL_AURA_REFRESH")) then if (Gladdy.db.drEnabled and (eventType == "SPELL_AURA_REMOVED" or eventType == "SPELL_AURA_REFRESH")) then
@ -104,8 +91,13 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
if not Gladdy.buttons[destUnit].class then if not Gladdy.buttons[destUnit].class then
Gladdy:SpotEnemy(destUnit, true) Gladdy:SpotEnemy(destUnit, true)
end end
--interrupt detection
if eventType == "SPELL_INTERRUPT" then
Gladdy:SendMessage("SPELL_INTERRUPT", destUnit,spellID,spellName,spellSchool,extraSpellId,extraSpellName,extraSpellSchool)
end
end end
if srcUnit then if srcUnit then
if (eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_AURA_APPLIED") then
local unitRace = Gladdy.buttons[srcUnit].race local unitRace = Gladdy.buttons[srcUnit].race
-- cooldown tracker -- cooldown tracker
if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then if Gladdy.db.cooldown and Cooldowns.cooldownSpellIds[spellName] then
@ -125,6 +117,7 @@ function EventListener:COMBAT_LOG_EVENT_UNFILTERED()
if Gladdy.db.racialEnabled and Gladdy:Racials()[unitRace].spellName == spellName and Gladdy:Racials()[unitRace][spellID] then if Gladdy.db.racialEnabled and Gladdy:Racials()[unitRace].spellName == spellName and Gladdy:Racials()[unitRace][spellID] then
Gladdy:SendMessage("RACIAL_USED", srcUnit) Gladdy:SendMessage("RACIAL_USED", srcUnit)
end end
end
if not Gladdy.buttons[srcUnit].class then if not Gladdy.buttons[srcUnit].class then
Gladdy:SpotEnemy(srcUnit, true) Gladdy:SpotEnemy(srcUnit, true)
@ -143,12 +136,11 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
if button or pet then if button or pet then
if updateReason == "seen" then if updateReason == "seen" then
-- ENEMY_SPOTTED -- ENEMY_SPOTTED
if button and not button.class then if button then
Gladdy:SendMessage("ENEMY_STEALTH", unit, false)
if not button.class then
Gladdy:SpotEnemy(unit, true) Gladdy:SpotEnemy(unit, true)
end 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)
end end
if pet then if pet then
Gladdy:SendMessage("PET_SPOTTED", unit) Gladdy:SendMessage("PET_SPOTTED", unit)
@ -156,9 +148,7 @@ function EventListener:ARENA_OPPONENT_UPDATE(unit, updateReason)
elseif updateReason == "unseen" then elseif updateReason == "unseen" then
-- STEALTH -- STEALTH
if button then if button then
Gladdy:SendMessage("ENEMY_STEALTH", unit) Gladdy:SendMessage("ENEMY_STEALTH", unit, true)
button.healthBar.hp:SetStatusBarColor(0.66, 0.66, 0.66, 1)
button.stealthed = true
end end
if pet then if pet then
Gladdy:SendMessage("PET_STEALTH", unit) Gladdy:SendMessage("PET_STEALTH", unit)
@ -213,7 +203,7 @@ function EventListener:UNIT_AURA(unit)
end end
if not button.spec and Gladdy.specBuffs[spellName] then if not button.spec and Gladdy.specBuffs[spellName] then
local unitPet = string_gsub(unit, "%d$", "pet%1") local unitPet = string_gsub(unit, "%d$", "pet%1")
if UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster) then if unitCaster and (UnitIsUnit(unit, unitCaster) or UnitIsUnit(unitPet, unitCaster)) then
Gladdy:DetectSpec(unit, Gladdy.specBuffs[spellName]) Gladdy:DetectSpec(unit, Gladdy.specBuffs[spellName])
end end
end end
@ -252,7 +242,3 @@ function EventListener:UNIT_SPELLCAST_SUCCEEDED(unit)
end end
end end
end end
function EventListener:GetOptions()
return nil
end

View File

@ -26,6 +26,8 @@ Gladdy.BUTTON_DEFAULTS = {
damaged = 0, damaged = 0,
click = false, click = false,
stealthed = false, stealthed = false,
classColors = {},
lastState = 0,
} }
function Gladdy:CreateFrame() function Gladdy:CreateFrame()
@ -107,12 +109,17 @@ end
function Gladdy:UpdateFrame() function Gladdy:UpdateFrame()
if (InCombatLockdown()) then
return
end
if (not self.frame) then if (not self.frame) then
self:CreateFrame() self:CreateFrame()
end end
local teamSize = self.curBracket or 0 local teamSize = self.curBracket or 0
local highlightBorderSize = (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2) local highlightBorderSize = (self.db.highlightInset and 0 or self.db.highlightBorderSize * 2)
local powerBarHeight = self.db.powerBarEnabled and (self.db.powerBarHeight + 1) or 0
local leftSize = 0 local leftSize = 0
local rightSize = 0 local rightSize = 0
--Trinket + Racial --Trinket + Racial
@ -140,9 +147,9 @@ function Gladdy:UpdateFrame()
rightSize = rightSize + self.db.highlightBorderSize rightSize = rightSize + self.db.highlightBorderSize
end end
local margin = self.db.powerBarHeight + 1 local margin = powerBarHeight
local width = self.db.barWidth + leftSize + rightSize 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.highlightInset and 0 or self.db.highlightBorderSize * 2 * teamSize)
+ self.db.bottomMargin * (teamSize - 1) + self.db.bottomMargin * (teamSize - 1)
@ -173,7 +180,7 @@ function Gladdy:UpdateFrame()
-- GrowDirection -- GrowDirection
if (self.db.growDirection == "LEFT" or self.db.growDirection == "RIGHT") then if (self.db.growDirection == "LEFT" or self.db.growDirection == "RIGHT") then
width = self.db.barWidth * teamSize + (leftSize + rightSize) * teamSize + self.db.bottomMargin * (teamSize - 1) 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 end
self.frame:SetScale(self.db.frameScale) self.frame:SetScale(self.db.frameScale)
@ -214,13 +221,13 @@ function Gladdy:UpdateFrame()
button:SetWidth(self.db.barWidth) button:SetWidth(self.db.barWidth)
button:SetHeight(self.db.healthBarHeight) button:SetHeight(self.db.healthBarHeight)
button.secure:SetWidth(self.db.barWidth) 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:ClearAllPoints()
button.secure:ClearAllPoints() button.secure:ClearAllPoints()
if (self.db.growDirection == "TOP") then if (self.db.growDirection == "TOP") then
if (i == 1) then if (i == 1) then
button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, self.db.powerBarHeight + 1) button:SetPoint("BOTTOMLEFT", self.frame, "BOTTOMLEFT", leftSize, powerBarHeight)
button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT") button.secure:SetPoint("TOPLEFT", button.powerBar, "TOPLEFT")
else else
button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin) button:SetPoint("BOTTOMLEFT", self.buttons["arena" .. (i - 1)], "TOPLEFT", 0, margin + self.db.bottomMargin)
@ -254,7 +261,7 @@ function Gladdy:UpdateFrame()
for _, v in self:IterModules() do for _, v in self:IterModules() do
self:Call(v, "UpdateFrame", button.unit) self:Call(v, "UpdateFrame", "arena" .. i)
end end
end end
for _, v in self:IterModules() do for _, v in self:IterModules() do
@ -271,7 +278,6 @@ end
function Gladdy:ToggleFrame(i) function Gladdy:ToggleFrame(i)
self:Reset() self:Reset()
if (self.frame and self.frame:IsShown() and i == self.curBracket) then if (self.frame and self.frame:IsShown() and i == self.curBracket) then
self:HideFrame() self:HideFrame()
else else
@ -287,6 +293,8 @@ function Gladdy:ToggleFrame(i)
self:CreateButton(o) self:CreateButton(o)
end end
end end
self:Reset()
self.curBracket = i
self:UpdateFrame() self:UpdateFrame()
self:Test() self:Test()
self.frame:Show() self.frame:Show()
@ -305,28 +313,38 @@ function Gladdy:CreateButton(i)
--button.texture:SetAllPoints(button) --button.texture:SetAllPoints(button)
--button.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp") --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:RegisterForClicks("AnyUp") secure:RegisterForClicks("AnyDown")
secure:SetAttribute("*type1", "target")
secure:SetAttribute("*type2", "focus") secure:SetAttribute("target", "arena" .. i)
secure:SetAttribute("focus", "arena" .. i)
secure:SetAttribute("unit", "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 = secure:CreateTexture(nil, "OVERLAY")
--secure.texture:SetAllPoints(secure) --secure.texture:SetAllPoints(secure)
--secure.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp") --secure.texture:SetTexture("Interface\\AddOns\\Gladdy\\Images\\Border_rounded_blp")
button.id = i button.id = i
--button.unit = i == 1 and "player" or "focus"
button.unit = "arena" .. i button.unit = "arena" .. i
button.secure = secure 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 for _, v in self:IterModules() do
self:Call(v, "CreateFrame", button.unit) self:Call(v, "CreateFrame", "arena" .. i)
end end
self:ResetButton("arena" .. i)
end end
function Gladdy:GetAnchor(unit, position) function Gladdy:GetAnchor(unit, position)

View File

@ -25,7 +25,7 @@ local MAJOR, MINOR = "Gladdy", 4
local Gladdy = LibStub:NewLibrary(MAJOR, MINOR) local Gladdy = LibStub:NewLibrary(MAJOR, MINOR)
local L local L
Gladdy.version_major_num = 1 Gladdy.version_major_num = 1
Gladdy.version_minor_num = 0.12 Gladdy.version_minor_num = 0.13
Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num Gladdy.version_num = Gladdy.version_major_num + Gladdy.version_minor_num
Gladdy.version_releaseType = RELEASE_TYPES.beta Gladdy.version_releaseType = RELEASE_TYPES.beta
Gladdy.version = PREFIX .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType Gladdy.version = PREFIX .. Gladdy.version_num .. "-" .. Gladdy.version_releaseType
@ -200,6 +200,7 @@ 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 round", "Interface\\AddOns\\Gladdy\\Images\\UI-Tooltip-Border_round_selfmade")
self.LSM:Register("border", "Gladdy Tooltip squared", "Interface\\AddOns\\Gladdy\\Images\\UI-Tooltip-Border_square_selfmade") self.LSM:Register("border", "Gladdy Tooltip squared", "Interface\\AddOns\\Gladdy\\Images\\UI-Tooltip-Border_square_selfmade")
self.LSM:Register("font", "DorisPP", "Interface\\AddOns\\Gladdy\\Images\\DorisPP.TTF") self.LSM:Register("font", "DorisPP", "Interface\\AddOns\\Gladdy\\Images\\DorisPP.TTF")
self.LSM:Register("border", "Square Full White", "Interface\\AddOns\\Gladdy\\Images\\Square_FullWhite.tga")
L = self.L L = self.L
@ -227,6 +228,9 @@ function Gladdy:OnInitialize()
self:Call(v, "Initialize") -- B.E > A.E :D self:Call(v, "Initialize") -- B.E > A.E :D
end end
self:DeleteUnknownOptions(self.db, self.defaults.profile) self:DeleteUnknownOptions(self.db, self.defaults.profile)
if Gladdy.db.hideBlizzard == "always" then
SetCVar("showArenaEnemyFrames", 0)
end
end end
function Gladdy:OnProfileChanged() function Gladdy:OnProfileChanged()
@ -266,6 +270,7 @@ function Gladdy:OnEnable()
self:HideFrame() self:HideFrame()
self:ToggleFrame(3) self:ToggleFrame(3)
self.showConfig = true
end end
end end
@ -285,7 +290,7 @@ end
--------------------------- ---------------------------
function Gladdy:Test() function Gladdy:Test()
Gladdy.frame.testing = true self.frame.testing = true
for i = 1, self.curBracket do for i = 1, self.curBracket do
local unit = "arena" .. i local unit = "arena" .. i
if (not self.buttons[unit]) then if (not self.buttons[unit]) then
@ -312,6 +317,10 @@ end
--------------------------- ---------------------------
function Gladdy:PLAYER_ENTERING_WORLD() 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()) local instance = select(2, IsInInstance())
if (instance ~= "arena" and self.frame and self.frame:IsVisible() and not self.frame.testing) then if (instance ~= "arena" and self.frame and self.frame:IsVisible() and not self.frame.testing) then
self:Reset() self:Reset()
@ -355,6 +364,9 @@ function Gladdy:Reset()
for unit in pairs(self.buttons) do for unit in pairs(self.buttons) do
self:ResetUnit(unit) self:ResetUnit(unit)
end end
if Gladdy.db.hideBlizzard == "never" or Gladdy.db.hideBlizzard == "arena" then
SetCVar("showArenaEnemyFrames", 1)
end
end end
function Gladdy:ResetUnit(unit) function Gladdy:ResetUnit(unit)
@ -381,7 +393,7 @@ function Gladdy:ResetButton(unit)
button[k1] = nil button[k1] = nil
elseif (type(v1) == "number") then elseif (type(v1) == "number") then
button[k1] = 0 button[k1] = 0
elseif (type(v1) == "array") then elseif (type(v1) == "table") then
button[k1] = {} button[k1] = {}
elseif (type(v1) == "boolean") then elseif (type(v1) == "boolean") then
button[k1] = false button[k1] = false
@ -412,4 +424,7 @@ function Gladdy:JoinedArena()
for i=1, self.curBracket do for i=1, self.curBracket do
self.buttons["arena" .. i]:SetAlpha(1) self.buttons["arena" .. i]:SetAlpha(1)
end end
if Gladdy.db.hideBlizzard == "arena" or Gladdy.db.hideBlizzard == "always" then
SetCVar("showArenaEnemyFrames", 0)
end
end end

View File

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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
Images/Square_FullWhite.tga Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

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("UNIT_HEALTH")
self:RegisterMessage("TRINKET_USED") self:RegisterMessage("TRINKET_USED")
self:RegisterMessage("TRINKET_READY") self:RegisterMessage("TRINKET_READY")
self:RegisterMessage("SHADOWSIGHT")
end end
function Announcements:Reset() function Announcements:Reset()
@ -148,6 +149,10 @@ function Announcements:CheckDrink(unit, aura)
end end
end end
function Announcements:SHADOWSIGHT(msg)
self:Send(msg, 2)
end
function Announcements:Send(msg, throttle, color) function Announcements:Send(msg, throttle, color)
if (throttle and throttle > 0) then if (throttle and throttle > 0) then
if (not self.throttled[msg]) then if (not self.throttled[msg]) then

View File

@ -15,11 +15,7 @@ function ACDFrame:OnEvent(event, ...)
end end
function ACDFrame:Initialize() function ACDFrame:Initialize()
if ACDFrame.locales[GetLocale()] then self.locale = Gladdy:GetArenaTimer()
self.locale = ACDFrame.locales[GetLocale()]
else
self.locale = ACDFrame.locales["default"]
end
self.hidden = false self.hidden = false
self.countdown = -1 self.countdown = -1
self.texturePath = "Interface\\AddOns\\Gladdy\\Images\\Countdown\\"; self.texturePath = "Interface\\AddOns\\Gladdy\\Images\\Countdown\\";
@ -178,69 +174,7 @@ function ACDFrame:GetOptions()
min = 64, min = 64,
max = 512, max = 512,
step = 16, step = 16,
width = "full",
}), }),
} }
end 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

@ -18,6 +18,16 @@ local function defaultSpells(auraType)
end end
return spells return spells
end end
local function defaultInterrupts()
local spells = {}
for k,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, { local Auras = Gladdy:NewModule("Auras", nil, {
auraFont = "DorisPP", auraFont = "DorisPP",
auraFontSizeScale = 1, auraFontSizeScale = 1,
@ -27,7 +37,10 @@ local Auras = Gladdy:NewModule("Auras", nil, {
auraDebuffBorderColor = { r = 0, g = 1, b = 0, a = 1 }, auraDebuffBorderColor = { r = 0, g = 1, b = 0, a = 1 },
auraDisableCircle = false, auraDisableCircle = false,
auraCooldownAlpha = 1, auraCooldownAlpha = 1,
auraListDefault = defaultSpells() auraListDefault = defaultSpells(),
auraListInterrupts = defaultInterrupts(),
auraInterruptColorsEnabled = true,
auraInterruptColors = Gladdy:GetSpellSchoolColors()
}) })
function Auras:Initialize() function Auras:Initialize()
@ -39,6 +52,7 @@ function Auras:Initialize()
self:RegisterMessage("UNIT_DEATH") self:RegisterMessage("UNIT_DEATH")
self:RegisterMessage("AURA_GAIN") self:RegisterMessage("AURA_GAIN")
self:RegisterMessage("AURA_FADE") self:RegisterMessage("AURA_FADE")
self:RegisterMessage("SPELL_INTERRUPT")
end end
function Auras:CreateFrame(unit) function Auras:CreateFrame(unit)
@ -83,16 +97,92 @@ function Auras:CreateFrame(unit)
auraFrame:SetScript("OnUpdate", function(self, elapsed) auraFrame:SetScript("OnUpdate", function(self, elapsed)
if (self.active) then 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 if (self.timeLeft <= 0) then
Auras:AURA_FADE(self.unit, self.track) Auras:AURA_FADE(self.unit, self.track)
else else
self.timeLeft = self.timeLeft - elapsed self.timeLeft = self.timeLeft - elapsed
self.text:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0) self.text:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
end end
else
self:SetAlpha(0.01)
end end
end) end)
Gladdy.buttons[unit].aura = auraFrame
self.frames[unit] = 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.LSM:Fetch("font", Gladdy.db.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:SetCooldown(GetTime(), 0)
self:SetAlpha(0.01)
else
self.timeLeft = self.timeLeft - elapsed
self.text:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
end
else
self:SetAlpha(0.01)
end
end)
Gladdy.buttons[unit].interruptFrame = interruptFrame
self.frames[unit].interruptFrame = interruptFrame
self:ResetUnit(unit) self:ResetUnit(unit)
end end
@ -125,10 +215,48 @@ function Auras:UpdateFrame(unit)
else else
auraFrame.icon.overlay:SetVertexColor(0, 0, 0, 1) auraFrame.icon.overlay:SetVertexColor(0, 0, 0, 1)
end end
if not auraFrame.active then
auraFrame.icon.overlay:Hide() auraFrame.icon.overlay:Hide()
end
if Gladdy.db.auraDisableCircle then if Gladdy.db.auraDisableCircle then
auraFrame.cooldown:SetAlpha(0) auraFrame.cooldown:SetAlpha(0)
end 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.LSM:Fetch("font", Gladdy.db.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 end
function Auras:ResetUnit(unit) function Auras:ResetUnit(unit)
@ -141,15 +269,17 @@ function Auras:Test(unit)
local spellName, _, icon local spellName, _, icon
if (unit == "arena1") then if (unit == "arena1") then
spellName, _, icon = GetSpellInfo(12826) spellName, _, icon = GetSpellInfo(7922)
self:AURA_FADE(unit, AURA_TYPE_BUFF) self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_FADE(unit, AURA_TYPE_DEBUFF) 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) self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 7922, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
self:SPELL_INTERRUPT(unit,19244, select(1, GetSpellInfo(19244)), "physical", 25396, select(1, GetSpellInfo(25396)), 64)
elseif (unit == "arena2") then elseif (unit == "arena2") then
spellName, _, icon = GetSpellInfo(6770) spellName, _, icon = GetSpellInfo(6770)
self:AURA_FADE(unit, AURA_TYPE_BUFF) self:AURA_FADE(unit, AURA_TYPE_BUFF)
self:AURA_FADE(unit,AURA_TYPE_DEBUFF) 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) self:AURA_GAIN(unit,AURA_TYPE_DEBUFF, 6770, spellName, icon, self.auras[spellName].duration, GetTime() + self.auras[spellName].duration)
self:SPELL_INTERRUPT(unit,19244, select(1, GetSpellInfo(19244)), "physical", 25396, select(1, GetSpellInfo(25396)), 64)
elseif (unit == "arena3") then elseif (unit == "arena3") then
spellName, _, icon = GetSpellInfo(31224) spellName, _, icon = GetSpellInfo(31224)
self:AURA_FADE(unit, AURA_TYPE_BUFF) self:AURA_FADE(unit, AURA_TYPE_BUFF)
@ -173,6 +303,10 @@ function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, exp
return return
end end
if spellID == 31117 then
spellName = "Unstable Affliction Silence"
end
if not self.auras[spellName] then if not self.auras[spellName] then
return return
end end
@ -189,7 +323,7 @@ function Auras:AURA_GAIN(unit, auraType, spellID, spellName, icon, duration, exp
auraFrame.name = spellName auraFrame.name = spellName
auraFrame.timeLeft = expirationTime - GetTime() auraFrame.timeLeft = expirationTime - GetTime()
auraFrame.priority = Gladdy.db.auraListDefault[tostring(self.auras[spellName].spellID)].priority 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.track = auraType
auraFrame.active = true auraFrame.active = true
auraFrame.icon.overlay:Show() auraFrame.icon.overlay:Show()
@ -215,7 +349,7 @@ function Auras:AURA_FADE(unit, auraType)
if auraFrame.active then if auraFrame.active then
auraFrame.cooldown:SetCooldown(GetTime(), 0) auraFrame.cooldown:SetCooldown(GetTime(), 0)
end end
auraFrame.cooldown:Hide() --auraFrame.cooldown:Hide()
auraFrame.active = false auraFrame.active = false
auraFrame.name = nil auraFrame.name = nil
auraFrame.timeLeft = 0 auraFrame.timeLeft = 0
@ -224,11 +358,123 @@ function Auras:AURA_FADE(unit, auraType)
auraFrame.endTime = nil auraFrame.endTime = nil
auraFrame.icon:SetTexture("") auraFrame.icon:SetTexture("")
auraFrame.text:SetText("") auraFrame.text:SetText("")
auraFrame.icon.overlay:Hide() --auraFrame.icon.overlay:Hide()
auraFrame.cooldownFrame: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 end
function Auras:GetOptions() 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 = v.val.type,
order = i + 13,
hasAlpha = true,
width = "0.8",
set = function(info, 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 { return {
header = { header = {
type = "header", type = "header",
@ -264,6 +510,7 @@ function Auras:GetOptions()
max = 1, max = 1,
step = 0.1, step = 0.1,
order = 4, order = 4,
width = "full",
}), }),
} }
}, },
@ -293,6 +540,7 @@ function Auras:GetOptions()
min = 0.1, min = 0.1,
max = 2, max = 2,
step = 0.1, step = 0.1,
width = "full",
}), }),
auraFontColor = Gladdy:colorOption({ auraFontColor = Gladdy:colorOption({
type = "color", type = "color",
@ -307,35 +555,7 @@ function Auras:GetOptions()
type = "group", type = "group",
name = L["Border"], name = L["Border"],
order = 3, order = 3,
args = { args = 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",
}),
}
} }
} }
}, },
@ -352,6 +572,13 @@ function Auras:GetOptions()
name = "Buffs", name = "Buffs",
order = 5, order = 5,
args = Auras:GetAuraOptions(AURA_TYPE_BUFF) args = Auras:GetAuraOptions(AURA_TYPE_BUFF)
},
interruptList = {
type = "group",
childGroups = "tree",
name = "Interrupts",
order = 6,
args = Auras:GetInterruptOptions()
} }
} }
end end
@ -387,19 +614,22 @@ function Auras:GetAuraOptions(auraType)
tinsert(auras, v.spellID) tinsert(auras, v.spellID)
end end
end end
tbl_sort(auras) tbl_sort(auras, function(a, b) return GetSpellInfo(a) < GetSpellInfo(b) end)
for i,k in ipairs(auras) do for i,k in ipairs(auras) do
options[tostring(k)] = { options[tostring(k)] = {
type = "group", 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 GetSpellInfo(k),
order = i+2, 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 = { args = {
enabled = { enabled = {
order = 1, order = 1,
name = L["Enabled"], name = L["Enabled"],
type = "toggle", 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", width = "2",
set = function(info, value) set = function(info, value)
Gladdy.db.auraListDefault[tostring(k)].enabled = value Gladdy.db.auraListDefault[tostring(k)].enabled = value
@ -422,6 +652,82 @@ function Auras:GetAuraOptions(auraType)
set = function(info, value) set = function(info, value)
Gladdy.db.auraListDefault[tostring(k)].priority = value Gladdy.db.auraListDefault[tostring(k)].priority = value
end, end,
width = "full",
}
}
}
end
return options
end
function Auras:GetInterruptOptions()
local options = {
ckeckAll = {
order = 1,
width = "0.7",
name = L["Check All"],
type = "execute",
func = function(info)
for k,v 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(info)
for k,v in pairs(defaultInterrupts()) do
Gladdy.db.auraListInterrupts[k].enabled = false
end
end,
},
}
local auras = {}
for k,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(info, value)
Gladdy.db.auraListInterrupts[tostring(k)].enabled = value
end,
get = function(info)
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(info)
return Gladdy.db.auraListInterrupts[tostring(k)].priority
end,
set = function(info, value)
Gladdy.db.auraListInterrupts[tostring(k)].priority = value
end,
width = "full",
} }
} }
} }

View File

@ -2,20 +2,9 @@ local GetSpellInfo = GetSpellInfo
local CreateFrame = CreateFrame local CreateFrame = CreateFrame
local GetTime = GetTime local GetTime = GetTime
local select, lower, ceil, tremove, tinsert, pairs, ipairs, tostring = select, string.lower, ceil, tremove, tinsert, pairs, ipairs, tostring local select, lower, ceil, tremove, tinsert, pairs, ipairs, tostring = select, string.lower, ceil, tremove, tinsert, pairs, ipairs, tostring
local auraTypeColor = { }
local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF local AURA_TYPE_DEBUFF, AURA_TYPE_BUFF = AURA_TYPE_DEBUFF, AURA_TYPE_BUFF
local auraTypes = {AURA_TYPE_BUFF, AURA_TYPE_DEBUFF} local auraTypes = {AURA_TYPE_BUFF, AURA_TYPE_DEBUFF}
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 -- Module init
--------------------------- ---------------------------
@ -55,14 +44,14 @@ local BuffsDebuffs = Gladdy:NewModule("Buffs and Debuffs", nil, {
buffsBorderColorsEnabled = true, buffsBorderColorsEnabled = true,
trackedDebuffs = defaultTrackedDebuffs, trackedDebuffs = defaultTrackedDebuffs,
trackedBuffs = defaultTrackedBuffs, trackedBuffs = defaultTrackedBuffs,
buffsBorderColorCurse = auraTypeColor["curse"], buffsBorderColorCurse = Gladdy:GetAuraTypeColor()["curse"],
buffsBorderColorMagic = auraTypeColor["magic"], buffsBorderColorMagic = Gladdy:GetAuraTypeColor()["magic"],
buffsBorderColorPoison = auraTypeColor["poison"], buffsBorderColorPoison = Gladdy:GetAuraTypeColor()["poison"],
buffsBorderColorPhysical = auraTypeColor["none"], buffsBorderColorPhysical = Gladdy:GetAuraTypeColor()["none"],
buffsBorderColorImmune = auraTypeColor["immune"], buffsBorderColorImmune = Gladdy:GetAuraTypeColor()["immune"],
buffsBorderColorDisease = auraTypeColor["disease"], buffsBorderColorDisease = Gladdy:GetAuraTypeColor()["disease"],
buffsBorderColorForm = auraTypeColor["form"], buffsBorderColorForm = Gladdy:GetAuraTypeColor()["form"],
buffsBorderColorAura = auraTypeColor["aura"] buffsBorderColorAura = Gladdy:GetAuraTypeColor()["aura"]
}) })
local spellSchoolToOptionValueTable local spellSchoolToOptionValueTable
@ -148,21 +137,24 @@ function BuffsDebuffs:Test(unit)
if unit == "arena1" or unit == "arena3" then if unit == "arena1" or unit == "arena3" then
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF) 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:AddOrRefreshAura(unit, 1943, AURA_TYPE_DEBUFF, 12, 12, 1, "physical", select(3, GetSpellInfo(1943)), 1)
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27218, select(1, GetSpellInfo(27218)), select(3, GetSpellInfo(27218)), 24, GetTime() + 20, 1, "curse") BuffsDebuffs:AddOrRefreshAura(unit, 18647, AURA_TYPE_DEBUFF, 10, 10, 1, "immune", select(3, GetSpellInfo(18647)), 2)
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27216, select(1, GetSpellInfo(27216)), select(3, GetSpellInfo(27216)), 18, GetTime() + 18, 1, "magic") BuffsDebuffs:AddOrRefreshAura(unit, 27218, AURA_TYPE_DEBUFF, 9, 9, 1, "curse", select(3, GetSpellInfo(27218)), 3)
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_DEBUFF, 27189, select(1, GetSpellInfo(27189)), select(3, GetSpellInfo(27189)), 12, GetTime() + 12, 5, "poison") BuffsDebuffs:AddOrRefreshAura(unit, 27216, AURA_TYPE_DEBUFF, 9, 9, 1, "magic", select(3, GetSpellInfo(27216)), 4)
BuffsDebuffs:AURA_GAIN(unit, AURA_TYPE_BUFF, 33076, select(1, GetSpellInfo(33076)), select(3, GetSpellInfo(33076)), 20, GetTime() + 20, 1, "magic") BuffsDebuffs:AddOrRefreshAura(unit, 27189, AURA_TYPE_DEBUFF, 9, 9, 5, "poison", select(3, GetSpellInfo(27189)), 5)
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:AddOrRefreshAura(unit, 33076, AURA_TYPE_BUFF, 15, 15, 1, "magic", select(3, GetSpellInfo(33076)), 1)
BuffsDebuffs:AddOrRefreshAura(unit, 26980, AURA_TYPE_BUFF, 12, 12, 5, "magic", select(3, GetSpellInfo(26980)), 2)
else
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF) BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_DEBUFF)
BuffsDebuffs:AURA_FADE(unit, AURA_TYPE_BUFF) 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")
BuffsDebuffs:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 12, 12, 1, "poison", select(3, GetSpellInfo(1943)), 1)
BuffsDebuffs:AddOrRefreshAura(unit, 1, AURA_TYPE_BUFF, 10, 10, 2, "magic", select(3, GetSpellInfo(1)), 2)
BuffsDebuffs:AddOrRefreshAura(unit, 5, AURA_TYPE_DEBUFF, 12, 12, 3, "physical", select(3, GetSpellInfo(27009)), 1)
BuffsDebuffs:AddOrRefreshAura(unit, 5, AURA_TYPE_DEBUFF, 11, 11, 4, "disease", select(3, GetSpellInfo(11426)), 2)
end end
end end
end end
@ -280,6 +272,7 @@ function BuffsDebuffs:UpdateFrame(unit)
self.frames[unit].debuffFrame:ClearAllPoints() self.frames[unit].debuffFrame:ClearAllPoints()
--DEBUFFS --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 horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
local verticalMargin = -(Gladdy.db.powerBarHeight)/2 local verticalMargin = -(Gladdy.db.powerBarHeight)/2
if Gladdy.db.buffsCooldownPos == "TOP" then if Gladdy.db.buffsCooldownPos == "TOP" then
@ -298,9 +291,9 @@ function BuffsDebuffs:UpdateFrame(unit)
verticalMargin = verticalMargin + Gladdy.db.cooldownSize verticalMargin = verticalMargin + Gladdy.db.cooldownSize
end end
if Gladdy.db.buffsCooldownGrowDirection == "LEFT" then 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 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 end
elseif Gladdy.db.buffsCooldownPos == "LEFT" then elseif Gladdy.db.buffsCooldownPos == "LEFT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
@ -342,9 +335,9 @@ function BuffsDebuffs:UpdateFrame(unit)
verticalMargin = verticalMargin + Gladdy.db.cooldownSize verticalMargin = verticalMargin + Gladdy.db.cooldownSize
end end
if Gladdy.db.buffsBuffsCooldownGrowDirection == "LEFT" then 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 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 end
elseif Gladdy.db.buffsBuffsCooldownPos == "LEFT" then elseif Gladdy.db.buffsBuffsCooldownPos == "LEFT" then
horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding horizontalMargin = horizontalMargin - 1 + Gladdy.db.padding
@ -662,6 +655,7 @@ function BuffsDebuffs:GetOptions()
min = 5, min = 5,
max = 50, max = 50,
step = 1, step = 1,
width = "full",
}), }),
buffsBuffsWidthFactor = Gladdy:option({ buffsBuffsWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -671,6 +665,7 @@ function BuffsDebuffs:GetOptions()
min = 0.5, min = 0.5,
max = 2, max = 2,
step = 0.05, step = 0.05,
width = "full",
}), }),
buffsBuffsIconPadding = Gladdy:option({ buffsBuffsIconPadding = Gladdy:option({
type = "range", type = "range",
@ -680,6 +675,7 @@ function BuffsDebuffs:GetOptions()
min = 0, min = 0,
max = 10, max = 10,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },
@ -722,6 +718,7 @@ function BuffsDebuffs:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
buffsBuffsYOffset = Gladdy:option({ buffsBuffsYOffset = Gladdy:option({
type = "range", type = "range",
@ -730,6 +727,7 @@ function BuffsDebuffs:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },
@ -750,6 +748,7 @@ function BuffsDebuffs:GetOptions()
min = 0, min = 0,
max = 1, max = 1,
step = 0.05, step = 0.05,
width = "full",
}), }),
} }
} }
@ -778,6 +777,7 @@ function BuffsDebuffs:GetOptions()
min = 5, min = 5,
max = 50, max = 50,
step = 1, step = 1,
width = "full",
}), }),
buffsWidthFactor = Gladdy:option({ buffsWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -787,6 +787,7 @@ function BuffsDebuffs:GetOptions()
min = 0.5, min = 0.5,
max = 2, max = 2,
step = 0.05, step = 0.05,
width = "full",
}), }),
buffsIconPadding = Gladdy:option({ buffsIconPadding = Gladdy:option({
type = "range", type = "range",
@ -796,6 +797,7 @@ function BuffsDebuffs:GetOptions()
min = 0, min = 0,
max = 10, max = 10,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },
@ -838,6 +840,7 @@ function BuffsDebuffs:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
buffsYOffset = Gladdy:option({ buffsYOffset = Gladdy:option({
type = "range", type = "range",
@ -846,6 +849,7 @@ function BuffsDebuffs:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },
@ -866,6 +870,7 @@ function BuffsDebuffs:GetOptions()
min = 0, min = 0,
max = 1, max = 1,
step = 0.05, step = 0.05,
width = "full",
}), }),
} }
} }
@ -894,6 +899,7 @@ function BuffsDebuffs:GetOptions()
max = 1, max = 1,
step = 0.1, step = 0.1,
order = 10, order = 10,
width = "full",
}), }),
}, },
}, },
@ -923,6 +929,7 @@ function BuffsDebuffs:GetOptions()
min = 0.1, min = 0.1,
max = 2, max = 2,
step = 0.1, step = 0.1,
width = "full",
}), }),
buffsDynamicColor = Gladdy:option({ buffsDynamicColor = Gladdy:option({
type = "toggle", type = "toggle",

View File

@ -19,6 +19,7 @@ local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists
local Castbar = Gladdy:NewModule("Cast Bar", 70, { local Castbar = Gladdy:NewModule("Cast Bar", 70, {
castBarEnabled = true,
castBarHeight = 20, castBarHeight = 20,
castBarWidth = 160, castBarWidth = 160,
castBarIconSize = 22, castBarIconSize = 22,
@ -439,6 +440,7 @@ end
--------------------------- ---------------------------
function Castbar:JOINED_ARENA() function Castbar:JOINED_ARENA()
if Gladdy.db.castBarEnabled then
for i=1, Gladdy.curBracket do for i=1, Gladdy.curBracket do
local unit = "arena" .. i local unit = "arena" .. i
local castBar = self.frames[unit] local castBar = self.frames[unit]
@ -458,23 +460,21 @@ function Castbar:JOINED_ARENA()
--Castbar.OnEvent(castBar, "PLAYER_ENTERING_WORLD") --Castbar.OnEvent(castBar, "PLAYER_ENTERING_WORLD")
end end
end end
end
function Castbar:ResetUnit(unit) function Castbar:ResetUnit(unit)
local castBar = self.frames[unit] local castBar = self.frames[unit]
castBar:UnregisterEvent("UNIT_SPELLCAST_INTERRUPTED") castBar:UnregisterAllEvents()
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:SetScript("OnEvent", nil) castBar:SetScript("OnEvent", nil)
castBar:SetScript("OnUpdate", nil) castBar:SetScript("OnUpdate", nil)
castBar.fadeOut = nil castBar.fadeOut = nil
self:CAST_STOP(unit) self:CAST_STOP(unit)
end end
function Castbar:Reset()
self.test = nil
end
--------------------------- ---------------------------
-- TEST -- TEST
@ -482,6 +482,8 @@ end
--------------------------- ---------------------------
function Castbar:Test(unit) function Castbar:Test(unit)
self.test = true
if Gladdy.db.castBarEnabled then
local spell, _, icon, value, maxValue, event, endTime, startTime local spell, _, icon, value, maxValue, event, endTime, startTime
if (unit == "arena2") then if (unit == "arena2") then
@ -494,7 +496,7 @@ function Castbar:Test(unit)
value = (endTime / 1000) - GetTime() value = (endTime / 1000) - GetTime()
maxValue = (endTime - startTime) / 1000 maxValue = (endTime - startTime) / 1000
event = "channel" event = "channel"
elseif (unit == "arena3") then else
spell, _, icon = GetSpellInfo(20770) spell, _, icon = GetSpellInfo(20770)
value, maxValue, event = 0, 60, "cast" value, maxValue, event = 0, 60, "cast"
end end
@ -502,6 +504,9 @@ function Castbar:Test(unit)
if (spell) then if (spell) then
self:CAST_START(unit, spell, icon, value, maxValue, event) self:CAST_START(unit, spell, icon, value, maxValue, event)
end end
else
self:CAST_STOP(unit)
end
end end
--------------------------- ---------------------------
@ -541,11 +546,17 @@ function Castbar:GetOptions()
name = L["Cast Bar"], name = L["Cast Bar"],
order = 2, order = 2,
}, },
castBarEnabled = option({
type = "toggle",
name = L["Enabled"],
desc = L["If test is running, type \"/gladdy test\" again"],
order = 3,
}),
group = { group = {
type = "group", type = "group",
childGroups = "tree", childGroups = "tree",
name = L["Frame"], name = L["Frame"],
order = 3, order = 4,
args = { args = {
barFrame = { barFrame = {
type = "group", type = "group",
@ -565,6 +576,7 @@ function Castbar:GetOptions()
min = 0, min = 0,
max = 50, max = 50,
step = 1, step = 1,
width = "full",
}), }),
castBarWidth = option({ castBarWidth = option({
type = "range", type = "range",
@ -574,6 +586,7 @@ function Castbar:GetOptions()
min = 0, min = 0,
max = 300, max = 300,
step = 1, step = 1,
width = "full",
}), }),
headerTexture = { headerTexture = {
type = "header", type = "header",
@ -614,6 +627,7 @@ function Castbar:GetOptions()
min = 0.5, min = 0.5,
max = Gladdy.db.castBarHeight/2, max = Gladdy.db.castBarHeight/2,
step = 0.5, step = 0.5,
width = "full",
}), }),
castBarBorderStyle = option({ castBarBorderStyle = option({
type = "select", type = "select",
@ -647,6 +661,7 @@ function Castbar:GetOptions()
min = 0, min = 0,
max = 100, max = 100,
step = 1, step = 1,
width = "full",
}), }),
headerBorder = { headerBorder = {
type = "header", type = "header",
@ -723,6 +738,7 @@ function Castbar:GetOptions()
order = 4, order = 4,
min = 1, min = 1,
max = 20, max = 20,
width = "full",
}), }),
headerFormat = { headerFormat = {
type = "header", type = "header",
@ -781,6 +797,7 @@ function Castbar:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
castBarYOffset = option({ castBarYOffset = option({
type = "range", type = "range",
@ -789,6 +806,7 @@ function Castbar:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
} }
}, },

View File

@ -215,6 +215,7 @@ function Classicon:GetOptions()
max = 100, max = 100,
step = 1, step = 1,
order = 3, order = 3,
width = "full",
}), }),
classIconWidthFactor = Gladdy:option({ classIconWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -223,6 +224,7 @@ function Classicon:GetOptions()
max = 2, max = 2,
step = 0.05, step = 0.05,
order = 4, order = 4,
width = "full",
}), }),
}, },
}, },

229
Modules/Clicks.lua Normal file
View File

@ -0,0 +1,229 @@
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 = "Target", button = "1", modifier = "", action = "target", spell = "" },
{ name = "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:Initialise()
self:RegisterMessage("JOINED_ARENA")
end
function Clicks:Reset()
--
end
function Clicks:ResetUnit(unit)
local button = Gladdy.buttons[unit]
if (not button) then
return
end
for k, v in pairs(Gladdy.db.attributes) do
button.secure:SetAttribute(v.modifier .. "macrotext" .. v.button, "")
end
end
function Clicks:Test()
Clicks:JOINED_ARENA()
end
function Clicks:JOINED_ARENA()
for k, 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 k, 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"], ["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
function Clicks:UpdateFrame(unit)
self:SetupAttributes(unit)
self:JOINED_ARENA()
end

View File

@ -141,6 +141,7 @@ function CombatIndicator:GetOptions()
max = 100, max = 100,
step = 1, step = 1,
order = 2, order = 2,
width = "full",
}), }),
ciWidthFactor = Gladdy:option({ ciWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -149,6 +150,7 @@ function CombatIndicator:GetOptions()
max = 2, max = 2,
step = 0.05, step = 0.05,
order = 3, order = 3,
width = "full",
}), }),
ciAlpha = Gladdy:option({ ciAlpha = Gladdy:option({
type = "range", type = "range",
@ -157,6 +159,7 @@ function CombatIndicator:GetOptions()
max = 1, max = 1,
step = 0.05, step = 0.05,
order = 4, order = 4,
width = "full",
}), }),
}, },
}, },
@ -201,6 +204,7 @@ function CombatIndicator:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
ciYOffset = Gladdy:option({ ciYOffset = Gladdy:option({
type = "range", type = "range",
@ -209,6 +213,7 @@ function CombatIndicator:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },

View File

@ -134,7 +134,7 @@ function Cooldowns:UpdateFrame(unit)
-- Cooldown frame -- Cooldown frame
if (Gladdy.db.cooldown) then if (Gladdy.db.cooldown) then
button.spellCooldownFrame:ClearAllPoints() 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) local horizontalMargin = (Gladdy.db.highlightInset and 0 or Gladdy.db.highlightBorderSize)
if Gladdy.db.cooldownYPos == "TOP" then if Gladdy.db.cooldownYPos == "TOP" then
if Gladdy.db.cooldownXPos == "RIGHT" then if Gladdy.db.cooldownXPos == "RIGHT" then
@ -144,9 +144,9 @@ function Cooldowns:UpdateFrame(unit)
end end
elseif Gladdy.db.cooldownYPos == "BOTTOM" then elseif Gladdy.db.cooldownYPos == "BOTTOM" then
if Gladdy.db.cooldownXPos == "RIGHT" then if Gladdy.db.cooldownXPos == "RIGHT" then
button.spellCooldownFrame:SetPoint("TOPRIGHT", button.powerBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset) button.spellCooldownFrame:SetPoint("TOPRIGHT", button.healthBar, "BOTTOMRIGHT", Gladdy.db.cooldownXOffset, -horizontalMargin + Gladdy.db.cooldownYOffset - powerBarHeight)
else 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 end
elseif Gladdy.db.cooldownYPos == "LEFT" then elseif Gladdy.db.cooldownYPos == "LEFT" then
local anchor = Gladdy:GetAnchor(unit, "LEFT") local anchor = Gladdy:GetAnchor(unit, "LEFT")
@ -238,9 +238,16 @@ end
function Cooldowns:Test(unit) function Cooldowns:Test(unit)
local button = Gladdy.buttons[unit] local button = Gladdy.buttons[unit]
if Gladdy.db.cooldown then
button.spellCooldownFrame:Show() button.spellCooldownFrame:Show()
button.lastCooldownSpell = 1 button.lastCooldownSpell = 1
self:UpdateTestCooldowns(unit) self:UpdateTestCooldowns(unit)
else
button.spellCooldownFrame:Hide()
button.lastCooldownSpell = 1
self:UpdateTestCooldowns(unit)
end
end end
function Cooldowns:UpdateTestCooldowns(unit) function Cooldowns:UpdateTestCooldowns(unit)
@ -603,6 +610,7 @@ function Cooldowns:GetOptions()
order = 4, order = 4,
min = 5, min = 5,
max = 50, max = 50,
width = "full",
}), }),
cooldownWidthFactor = Gladdy:option({ cooldownWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -612,6 +620,7 @@ function Cooldowns:GetOptions()
min = 0.5, min = 0.5,
max = 2, max = 2,
step = 0.05, step = 0.05,
width = "full",
}), }),
cooldownIconPadding = Gladdy:option({ cooldownIconPadding = Gladdy:option({
type = "range", type = "range",
@ -621,6 +630,7 @@ function Cooldowns:GetOptions()
min = 0, min = 0,
max = 10, max = 10,
step = 0.1, step = 0.1,
width = "full",
}), }),
cooldownMaxIconsPerLine = Gladdy:option({ cooldownMaxIconsPerLine = Gladdy:option({
type = "range", type = "range",
@ -629,6 +639,7 @@ function Cooldowns:GetOptions()
min = 3, min = 3,
max = 14, max = 14,
step = 1, step = 1,
width = "full",
}), }),
}, },
}, },
@ -655,6 +666,7 @@ function Cooldowns:GetOptions()
max = 1, max = 1,
step = 0.1, step = 0.1,
order = 9, order = 9,
width = "full",
}), }),
}, },
}, },
@ -684,6 +696,7 @@ function Cooldowns:GetOptions()
min = 0.1, min = 0.1,
max = 2, max = 2,
step = 0.1, step = 0.1,
width = "full",
}), }),
cooldownFontColor = Gladdy:colorOption({ cooldownFontColor = Gladdy:colorOption({
type = "color", type = "color",
@ -738,6 +751,7 @@ function Cooldowns:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
cooldownYOffset = Gladdy:option({ cooldownYOffset = Gladdy:option({
type = "range", type = "range",
@ -746,6 +760,7 @@ function Cooldowns:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },

View File

@ -385,8 +385,9 @@ function Diminishings:GetOptions()
desc = L["Size of the DR Icons"], desc = L["Size of the DR Icons"],
order = 5, order = 5,
min = 5, min = 5,
max = 50, max = 80,
step = 1, step = 1,
width = "full",
}), }),
drWidthFactor = Gladdy:option({ drWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -396,6 +397,7 @@ function Diminishings:GetOptions()
min = 0.5, min = 0.5,
max = 2, max = 2,
step = 0.05, step = 0.05,
width = "full",
}), }),
drIconPadding = Gladdy:option({ drIconPadding = Gladdy:option({
type = "range", type = "range",
@ -405,6 +407,7 @@ function Diminishings:GetOptions()
min = 0, min = 0,
max = 10, max = 10,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },
@ -431,6 +434,7 @@ function Diminishings:GetOptions()
max = 1, max = 1,
step = 0.1, step = 0.1,
order = 9, order = 9,
width = "full",
}), }),
}, },
}, },
@ -467,6 +471,7 @@ function Diminishings:GetOptions()
min = 0.1, min = 0.1,
max = 2, max = 2,
step = 0.1, step = 0.1,
width = "full",
}), }),
} }
}, },
@ -502,6 +507,7 @@ function Diminishings:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
drYOffset = Gladdy:option({ drYOffset = Gladdy:option({
type = "range", type = "range",
@ -510,6 +516,7 @@ function Diminishings:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },

View File

@ -21,8 +21,6 @@ end
local ExportImport = Gladdy:NewModule("Export Import", nil, { local ExportImport = Gladdy:NewModule("Export Import", nil, {
}) })
local export = AceGUI:Create("Frame") local export = AceGUI:Create("Frame")
export:SetWidth(550) export:SetWidth(550)
export.sizer_se:Hide() export.sizer_se:Hide()

View File

@ -1,6 +1,6 @@
local pairs = pairs local pairs = pairs
local floor = math.floor 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 CreateFrame = CreateFrame
local RAID_CLASS_COLORS = RAID_CLASS_COLORS local RAID_CLASS_COLORS = RAID_CLASS_COLORS
@ -95,13 +95,22 @@ function Healthbar:CreateFrame(unit)
end end
function Healthbar.OnEvent(self, event, unit) function Healthbar.OnEvent(self, event, unit)
local isDead = UnitExists(unit) and UnitIsDeadOrGhost(unit)
if event == "UNIT_HEALTH" then if event == "UNIT_HEALTH" then
if isDead then
Gladdy:SendMessage("UNIT_DEATH", unit)
return
end
local health = UnitHealth(unit) local health = UnitHealth(unit)
local healthMax = UnitHealthMax(unit) local healthMax = UnitHealthMax(unit)
self.hp:SetMinMaxValues(0, healthMax) self.hp:SetMinMaxValues(0, healthMax)
self.hp:SetValue(UnitHealth(unit)) self.hp:SetValue(UnitHealth(unit))
Healthbar:SetHealthText(self, health, healthMax) Healthbar:SetHealthText(self, health, healthMax)
elseif event == "UNIT_MAXHEALTH" then elseif event == "UNIT_MAXHEALTH" then
if isDead then
Gladdy:SendMessage("UNIT_DEATH", unit)
return
end
local health = UnitHealth(unit) local health = UnitHealth(unit)
local healthMax = UnitHealthMax(unit) local healthMax = UnitHealthMax(unit)
self.hp:SetMinMaxValues(0, healthMax) self.hp:SetMinMaxValues(0, healthMax)
@ -368,6 +377,7 @@ function Healthbar:GetOptions()
min = 10, min = 10,
max = 100, max = 100,
step = 1, step = 1,
width = "full",
}), }),
healthBarTexture = option({ healthBarTexture = option({
type = "select", type = "select",
@ -419,6 +429,7 @@ function Healthbar:GetOptions()
step = 0.1, step = 0.1,
min = 0, min = 0,
max = 20, max = 20,
width = "full",
}), }),
healthBarHealthFontSize = option({ healthBarHealthFontSize = option({
type = "range", type = "range",
@ -428,6 +439,7 @@ function Healthbar:GetOptions()
step = 0.1, step = 0.1,
min = 0, min = 0,
max = 20, max = 20,
width = "full",
}), }),
}, },
}, },
@ -456,6 +468,7 @@ function Healthbar:GetOptions()
min = 0.5, min = 0.5,
max = Gladdy.db.healthBarHeight/2, max = Gladdy.db.healthBarHeight/2,
step = 0.5, step = 0.5,
width = "full",
}), }),
healthBarBorderColor = Gladdy:colorOption({ healthBarBorderColor = Gladdy:colorOption({
type = "color", type = "color",

View File

@ -89,18 +89,19 @@ function Highlight:UpdateFrame(unit)
return return
end end
local powerBarHeight = Gladdy.db.powerBarEnabled and (Gladdy.db.powerBarHeight + 1) or 0
local borderSize = Gladdy.db.highlightBorderSize local borderSize = Gladdy.db.highlightBorderSize
local borderOffset = borderSize 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 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:SetWidth(width)
button.targetBorder:SetHeight(height) button.targetBorder:SetHeight(height)
button.targetBorder:ClearAllPoints() button.targetBorder:ClearAllPoints()
if Gladdy.db.highlightInset then if Gladdy.db.highlightInset then
button.targetBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset)) 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 else
button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize)) button.targetBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end end
@ -113,7 +114,7 @@ function Highlight:UpdateFrame(unit)
button.focusBorder:ClearAllPoints() button.focusBorder:ClearAllPoints()
if Gladdy.db.highlightInset then if Gladdy.db.highlightInset then
button.focusBorder:SetPoint("TOPLEFT", button.healthBar, "TOPLEFT", -(borderOffset/Gladdy.db.statusbarBorderOffset), (borderOffset/Gladdy.db.statusbarBorderOffset)) 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 else
button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize)) button.focusBorder:SetPoint("TOP", button.healthBar, "TOP", 0, (Gladdy.db.highlightInset and 0 or borderSize))
end end
@ -156,7 +157,7 @@ function Highlight:Test(unit)
elseif (unit == "arena2") then elseif (unit == "arena2") then
self:Toggle(unit, "target", true) self:Toggle(unit, "target", true)
elseif (unit == "arena3") then elseif (unit == "arena3") then
self:Toggle(unit, "leader", true) --self:Toggle(unit, "leader", true)
end end
end end
@ -214,6 +215,7 @@ function Highlight:GetOptions()
min = 1, min = 1,
max = 20, max = 20,
step = 1, step = 1,
width = "full",
}), }),
highlightBorderStyle = Gladdy:option({ highlightBorderStyle = Gladdy:option({
type = "select", type = "select",

View File

@ -137,9 +137,9 @@ function Pets:CreateFrame(unitId)
--button:SetAlpha(0) --button:SetAlpha(0)
button:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset) button:SetPoint("LEFT", Gladdy.buttons[unitId].healthBar, "RIGHT", Gladdy.db.petXOffset, Gladdy.db.petYOffset)
local secure = CreateFrame("Button", "GladdyButton" .. unit, button, "SecureActionButtonTemplate") local secure = CreateFrame("Button", "GladdyButton" .. unit, button, "SecureActionButtonTemplate, SecureHandlerEnterLeaveTemplate")
secure:RegisterForClicks("AnyUp")
secure:RegisterForClicks("AnyUp") secure:RegisterForClicks("AnyUp")
secure:RegisterForClicks("AnyDown")
secure:SetAttribute("*type1", "target") secure:SetAttribute("*type1", "target")
secure:SetAttribute("*type2", "focus") secure:SetAttribute("*type2", "focus")
secure:SetAttribute("unit", unit) secure:SetAttribute("unit", unit)
@ -156,7 +156,7 @@ function Pets:CreateFrame(unitId)
healthBar:SetAllPoints(button) healthBar:SetAllPoints(button)
healthBar:SetAlpha(0) healthBar:SetAlpha(0)
healthBar.portrait = healthBar:CreateTexture(nil, "OVERLAY") healthBar.portrait = healthBar:CreateTexture(nil, "BACKGROUND")
healthBar.portrait:SetPoint("LEFT", healthBar, "RIGHT") healthBar.portrait:SetPoint("LEFT", healthBar, "RIGHT")
healthBar.portrait:SetTexCoord(0.1, 0.9, 0.1, 0.9) healthBar.portrait:SetTexCoord(0.1, 0.9, 0.1, 0.9)
SetPortraitTexture(healthBar.portrait, "player") SetPortraitTexture(healthBar.portrait, "player")
@ -368,6 +368,7 @@ function Pets:GetOptions()
min = 10, min = 10,
max = 100, max = 100,
step = 1, step = 1,
width = "full",
}), }),
petWidth = option({ petWidth = option({
type = "range", type = "range",
@ -377,6 +378,7 @@ function Pets:GetOptions()
min = 10, min = 10,
max = 300, max = 300,
step = 1, step = 1,
width = "full",
}), }),
petHealthBarTexture = option({ petHealthBarTexture = option({
type = "select", type = "select",
@ -458,6 +460,7 @@ function Pets:GetOptions()
order = 13, order = 13,
min = 0, min = 0,
max = 20, max = 20,
width = "full",
}), }),
}, },
}, },
@ -486,6 +489,7 @@ function Pets:GetOptions()
min = 0.5, min = 0.5,
max = Gladdy.db.petHeight/2, max = Gladdy.db.petHeight/2,
step = 0.5, step = 0.5,
width = "full",
}), }),
petHealthBarBorderColor = Gladdy:colorOption({ petHealthBarBorderColor = Gladdy:colorOption({
type = "color", type = "color",
@ -513,6 +517,7 @@ function Pets:GetOptions()
min = -600, min = -600,
max = 600, max = 600,
step = 0.1, step = 0.1,
width = "full",
}), }),
petYOffset = Gladdy:option({ petYOffset = Gladdy:option({
type = "range", type = "range",
@ -521,6 +526,7 @@ function Pets:GetOptions()
min = -600, min = -600,
max = 600, max = 600,
step = 0.1, step = 0.1,
width = "full",
}), }),
} }
}, },

View File

@ -7,6 +7,7 @@ local Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists local AceGUIWidgetLSMlists = AceGUIWidgetLSMlists
local Powerbar = Gladdy:NewModule("Power Bar", 90, { local Powerbar = Gladdy:NewModule("Power Bar", 90, {
powerBarEnabled = true,
powerBarFont = "DorisPP", powerBarFont = "DorisPP",
powerBarHeight = 20, powerBarHeight = 20,
powerBarTexture = "Smooth", powerBarTexture = "Smooth",
@ -113,17 +114,24 @@ function Powerbar:SetPower(powerBar, power, powerMax, powerType)
end end
end end
if (powerType == 1) then if (powerType == 1 and powerBar.powerType ~= powerType) then
powerBar.energy:SetStatusBarColor(1, 0, 0, 1) 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) 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.energy:SetStatusBarColor(.18, .44, .75, 1)
powerBar.powerColor = {r = .18, g = .44, b = .75}
powerBar.powerType = powerType
end end
powerBar.powerText:SetText(powerText) powerBar.powerText:SetText(powerText)
powerBar.energy:SetMinMaxValues(0, powerMax) powerBar.energy:SetMinMaxValues(0, powerMax)
powerBar.energy:SetValue(power) powerBar.energy:SetValue(power)
end end
function Powerbar:UpdateFrame(unit) function Powerbar:UpdateFrame(unit)
@ -135,6 +143,12 @@ function Powerbar:UpdateFrame(unit)
local healthBar = Gladdy.modules["Health Bar"].frames[unit] local healthBar = Gladdy.modules["Health Bar"].frames[unit]
if not Gladdy.db.powerBarEnabled then
powerBar:Hide()
return
else
powerBar:Show()
end
powerBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.powerBarTexture)) powerBar.bg:SetTexture(Gladdy.LSM:Fetch("statusbar", Gladdy.db.powerBarTexture))
powerBar.bg:SetVertexColor(Gladdy.db.powerBarBgColor.r, Gladdy.db.powerBarBgColor.g, Gladdy.db.powerBarBgColor.b, Gladdy.db.powerBarBgColor.a) powerBar.bg:SetVertexColor(Gladdy.db.powerBarBgColor.r, Gladdy.db.powerBarBgColor.g, Gladdy.db.powerBarBgColor.b, Gladdy.db.powerBarBgColor.a)
@ -169,6 +183,8 @@ function Powerbar:ResetUnit(unit)
powerBar.raceText:SetText("") powerBar.raceText:SetText("")
powerBar.powerText:SetText("") powerBar.powerText:SetText("")
powerBar.energy:SetValue(0) powerBar.energy:SetValue(0)
powerBar.powerType = ""
powerBar.powerColor = {r = 1, g = 1, b = 1}
end end
function Powerbar:Test(unit) function Powerbar:Test(unit)
@ -252,10 +268,13 @@ function Powerbar:UNIT_POWER(unit, power, powerMax, powerType)
if (powerType == 1) then if (powerType == 1) then
powerBar.energy:SetStatusBarColor(1, 0, 0, 1) powerBar.energy:SetStatusBarColor(1, 0, 0, 1)
powerBar.powerColor = {r = 1, g = 0, b = 0}
elseif (powerType == 3) then elseif (powerType == 3) then
powerBar.energy:SetStatusBarColor(1, 1, 0, 1) powerBar.energy:SetStatusBarColor(1, 1, 0, 1)
powerBar.powerColor = {r = 1, g = 1, b = 0}
else else
powerBar.energy:SetStatusBarColor(.18, .44, .75, 1) powerBar.energy:SetStatusBarColor(.18, .44, .75, 1)
powerBar.powerColor = {r = .18, g = .44, b = .75}
end end
powerBar.powerText:SetText(powerText) powerBar.powerText:SetText(powerText)
@ -315,11 +334,16 @@ function Powerbar:GetOptions()
name = L["Power Bar"], name = L["Power Bar"],
order = 2, order = 2,
}, },
powerBarEnabled = Gladdy:option({
type = "toggle",
name = L["Enabled"],
order = 3,
}),
group = { group = {
type = "group", type = "group",
childGroups = "tree", childGroups = "tree",
name = L["Frame"], name = L["Frame"],
order = 3, order = 4,
args = { args = {
general = { general = {
type = "group", type = "group",
@ -339,6 +363,7 @@ function Powerbar:GetOptions()
min = 0, min = 0,
max = 50, max = 50,
step = 1, step = 1,
width = "full",
}), }),
powerBarTexture = option({ powerBarTexture = option({
type = "select", type = "select",
@ -390,6 +415,7 @@ function Powerbar:GetOptions()
step = 0.1, step = 0.1,
min = 1, min = 1,
max = 20, max = 20,
width = "full",
}), }),
}, },
}, },
@ -418,6 +444,7 @@ function Powerbar:GetOptions()
min = 0.5, min = 0.5,
max = Gladdy.db.powerBarHeight/2, max = Gladdy.db.powerBarHeight/2,
step = 0.5, step = 0.5,
width = "full",
}), }),
powerBarBorderColor = Gladdy:colorOption({ powerBarBorderColor = Gladdy:colorOption({
type = "color", type = "color",

View File

@ -62,12 +62,12 @@ local function iconTimer(self,elapsed)
elseif timeLeft <= 10 and timeLeft >= 5 then elseif timeLeft <= 10 and timeLeft >= 5 then
-- between 10s and 5s (orange) -- between 10s and 5s (orange)
self.cooldownFont:SetTextColor(1, 0.7, 0) self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft) self.cooldownFont:SetFormattedText("%.1f", self.timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE") self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
elseif timeLeft < 5 and timeLeft > 0 then elseif timeLeft < 5 and timeLeft > 0 then
-- between 5s and 1s (red) -- between 5s and 1s (red)
self.cooldownFont:SetTextColor(1, 0, 0) self.cooldownFont:SetTextColor(1, 0, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft >= 0.0 and timeLeft or 0.0) self.cooldownFont:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE") self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.racialFont), (self:GetWidth()/2 - 1) * Gladdy.db.racialFontScale, "OUTLINE")
else else
self.cooldownFont:SetText("") self.cooldownFont:SetText("")
@ -246,6 +246,7 @@ function Racial:GetOptions()
max = 100, max = 100,
step = 1, step = 1,
order = 2, order = 2,
width = "full",
}), }),
racialWidthFactor = Gladdy:option({ racialWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -254,6 +255,7 @@ function Racial:GetOptions()
max = 2, max = 2,
step = 0.05, step = 0.05,
order = 3, order = 3,
width = "full",
}), }),
}, },
}, },
@ -280,6 +282,7 @@ function Racial:GetOptions()
max = 1, max = 1,
step = 0.1, step = 0.1,
order = 8, order = 8,
width = "full",
}), }),
}, },
}, },
@ -309,6 +312,7 @@ function Racial:GetOptions()
min = 0.1, min = 0.1,
max = 2, max = 2,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },
@ -353,6 +357,7 @@ function Racial:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
racialYOffset = Gladdy:option({ racialYOffset = Gladdy:option({
type = "range", type = "range",
@ -361,6 +366,7 @@ function Racial:GetOptions()
min = -400, min = -400,
max = 400, max = 400,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },

415
Modules/RangeCheck.lua Normal file
View File

@ -0,0 +1,415 @@
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"] = 20252,
["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 }
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 }
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 = "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 - %dyds", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
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 - %dyds", select(3, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(1, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)), select(6, GetSpellInfo(Gladdy.db.rangeCheckDefaultSpells[class].min)))
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,169 @@
local floor, str_len, tostring, str_sub, str_find, pairs = math.floor, string.len, tostring, string.sub, string.find, pairs
local CreateFrame = CreateFrame
local Gladdy = LibStub("Gladdy")
local L = Gladdy.L
local ShadowsightTimer = Gladdy:NewModule("Shadowsight Timer", nil, {
shadowsightTimerEnabled = true,
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:CreateTimerFrame()
end
function ShadowsightTimer:JOINED_ARENA()
self:RegisterEvent("CHAT_MSG_BG_SYSTEM_NEUTRAL")
self:SetScript("OnEvent", ShadowsightTimer.OnEvent)
self.timerFrame.font:SetText("1:30")
self.timerFrame.font:SetTextColor(1, 0.8, 0)
self.timerFrame:Show()
end
function ShadowsightTimer:CHAT_MSG_BG_SYSTEM_NEUTRAL(msg)
for k,v in pairs(self.locale) do
if str_find(msg, v) then
if k == 0 then
self:Start()
end
end
end
end
function ShadowsightTimer:Test()
if Gladdy.db.shadowsightTimerEnabled then
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:UpdateFrame()
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)
self.timerFrame:Show()
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 = 92
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",
}),
shadowsightAnnounce = Gladdy:option({
type = "toggle",
name = L["Announce"],
--desc = L["Turns countdown before the start of an arena match on/off."],
order = 4,
width = "full",
}),
shadowsightTimerScale = Gladdy:option({
type = "range",
name = L["Scale"],
order = 5,
min = 0.1,
max = 5,
step = 0.1,
width = "full",
}),
}
end

View File

@ -236,12 +236,26 @@ function TotemPlates:Initialize()
--GetCVar("nameplateShowFriendlyTotems") --GetCVar("nameplateShowFriendlyTotems")
--SetCVar("nameplateShowFriendlyTotems", true); --SetCVar("nameplateShowFriendlyTotems", true);
end end
self.addon = "Blizzard"
--NeatPlates if (IsAddOnLoaded("Plater")) then
--ELVUI self.addon = "Plater"
--Plater elseif (IsAddOnLoaded("Kui_Nameplates")) then
--KUI self.addon = "Kui_Nameplates"
--threatplates 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 end
function TotemPlates:PLAYER_ENTERING_WORLD() function TotemPlates:PLAYER_ENTERING_WORLD()
@ -268,8 +282,7 @@ function TotemPlates:UpdateFrameOnce()
nameplate.gladdyTotemFrame.totemName:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.npTremorFont), Gladdy.db.npTremorFontSize, "OUTLINE") nameplate.gladdyTotemFrame.totemName:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.npTremorFont), Gladdy.db.npTremorFontSize, "OUTLINE")
nameplate.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "") nameplate.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "")
self:SetTotemAlpha(nameplate.gladdyTotemFrame, k) self:SetTotemAlpha(nameplate.gladdyTotemFrame, k)
nameplate.UnitFrame.selectionHighlight:SetPoint("TOPLEFT", nameplate.gladdyTotemFrame, "TOPLEFT", Gladdy.db.npTotemPlatesSize/16, -Gladdy.db.npTotemPlatesSize/16) self:ToggleAddon(nameplate)
nameplate.UnitFrame.selectionHighlight:SetPoint("BOTTOMRIGHT", nameplate.gladdyTotemFrame, "BOTTOMRIGHT", -Gladdy.db.npTotemPlatesSize/16, Gladdy.db.npTotemPlatesSize/16)
end end
for i,gladdyTotemFrame in ipairs(self.totemPlateCache) do for i,gladdyTotemFrame in ipairs(self.totemPlateCache) do
gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor) gladdyTotemFrame:SetWidth(Gladdy.db.npTotemPlatesSize * Gladdy.db.npTotemPlatesWidthFactor)
@ -282,6 +295,44 @@ 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.LSM:Fetch("font", Gladdy.db.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 -- Nameplate functions
--------------------------------------------------- ---------------------------------------------------
@ -292,6 +343,36 @@ function TotemPlates:PLAYER_TARGET_CHANGED()
end end
end end
function TotemPlates:ToggleAddon(nameplate)
if self.addon == "Blizzard" then
nameplate.UnitFrame:Hide()
elseif self.addon == "Plater" then
nameplate.unitFrame:Hide()
elseif self.addon == "Kui_Nameplates" then
nameplate.kui:Hide()
elseif self.addon == "NeatPlates" then
nameplate.extended:Hide()
nameplate.carrier:Hide()
elseif self.addon == "TidyPlates_ThreatPlates" then
nameplate.TPFrame:Hide()
elseif self.addon == "Tukui" or self.addon == "ElvUI" then
if nameplate.unitFrame then
nameplate.unitFrame:Hide()
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 == "Tukui" or TotemPlates.addon == "ElvUI") and self.parent and self.parent.unitFrame then
self.parent.unitFrame:Hide()
end
end
function TotemPlates:NAME_PLATE_UNIT_ADDED(...) function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
local unitID = ... local unitID = ...
local isEnemy = UnitIsEnemy("player", unitID) local isEnemy = UnitIsEnemy("player", unitID)
@ -309,28 +390,12 @@ function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
local nameplate = C_NamePlate.GetNamePlateForUnit(unitID) local nameplate = C_NamePlate.GetNamePlateForUnit(unitID)
local totemDataEntry = localizedTotemData["default"][totemName] or localizedTotemData["frFR"][totemName] or localizedTotemData["ruRU"][totemName] local totemDataEntry = localizedTotemData["default"][totemName] or localizedTotemData["frFR"][totemName] or localizedTotemData["ruRU"][totemName]
if totemDataEntry and Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled then-- modify this nameplates if totemDataEntry and Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].enabled then-- modify this nameplates
if #self.totemPlateCache > 0 then if #self.totemPlateCache > 0 then
nameplate.gladdyTotemFrame = tremove(self.totemPlateCache, #self.totemPlateCache) nameplate.gladdyTotemFrame = tremove(self.totemPlateCache, #self.totemPlateCache)
else else
nameplate.gladdyTotemFrame = CreateFrame("Frame", nil) self:CreateTotemFrame(nameplate)
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)
end end
nameplate.gladdyTotemFrame.unitID = unitID
nameplate.gladdyTotemFrame.totemDataEntry = totemDataEntry nameplate.gladdyTotemFrame.totemDataEntry = totemDataEntry
nameplate.gladdyTotemFrame.parent = nameplate nameplate.gladdyTotemFrame.parent = nameplate
nameplate.gladdyTotemFrame:SetParent(nameplate) nameplate.gladdyTotemFrame:SetParent(nameplate)
@ -342,20 +407,10 @@ function TotemPlates:NAME_PLATE_UNIT_ADDED(...)
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.b, Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.b,
Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.a) Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].color.a)
nameplate.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "") nameplate.gladdyTotemFrame.totemName:SetText(Gladdy.db.npTotemColors["totem" .. totemDataEntry.id].customText or "")
nameplate.gladdyTotemFrame.parent = nameplate
nameplate.gladdyTotemFrame:Show() nameplate.gladdyTotemFrame:Show()
TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, unitID) TotemPlates:SetTotemAlpha(nameplate.gladdyTotemFrame, unitID)
self:ToggleAddon(nameplate)
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.activeTotemNameplates[unitID] = nameplate self.activeTotemNameplates[unitID] = nameplate
end end
end end

View File

@ -56,12 +56,12 @@ local function iconTimer(self, elapsed)
elseif timeLeft <= 10 and timeLeft >= 5 then elseif timeLeft <= 10 and timeLeft >= 5 then
-- between 10s and 5s (orange) -- between 10s and 5s (orange)
self.cooldownFont:SetTextColor(1, 0.7, 0) self.cooldownFont:SetTextColor(1, 0.7, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft) self.cooldownFont:SetFormattedText("%.1f", self.timeLeft)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE") self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
elseif timeLeft < 5 and timeLeft > 0 then elseif timeLeft < 5 and timeLeft > 0 then
-- between 5s and 1s (red) -- between 5s and 1s (red)
self.cooldownFont:SetTextColor(1, 0, 0) self.cooldownFont:SetTextColor(1, 0, 0)
self.cooldownFont:SetFormattedText("%.1f", timeLeft >= 0.0 and timeLeft or 0.0) self.cooldownFont:SetFormattedText("%.1f", self.timeLeft >= 0.0 and self.timeLeft or 0.0)
self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE") self.cooldownFont:SetFont(Gladdy.LSM:Fetch("font", Gladdy.db.trinketFont), (self:GetWidth()/2 - 1) * Gladdy.db.trinketFontScale, "OUTLINE")
else else
self.cooldownFont:SetText("") self.cooldownFont:SetText("")
@ -249,6 +249,7 @@ function Trinket:GetOptions()
max = 100, max = 100,
step = 1, step = 1,
order = 4, order = 4,
width = "full",
}), }),
trinketWidthFactor = Gladdy:option({ trinketWidthFactor = Gladdy:option({
type = "range", type = "range",
@ -257,6 +258,7 @@ function Trinket:GetOptions()
max = 2, max = 2,
step = 0.05, step = 0.05,
order = 6, order = 6,
width = "full",
}), }),
}, },
}, },
@ -283,6 +285,7 @@ function Trinket:GetOptions()
max = 1, max = 1,
step = 0.1, step = 0.1,
order = 8, order = 8,
width = "full",
}), }),
}, },
}, },
@ -312,6 +315,7 @@ function Trinket:GetOptions()
min = 0.1, min = 0.1,
max = 2, max = 2,
step = 0.1, step = 0.1,
width = "full",
}), }),
}, },
}, },

View File

@ -1,6 +1,8 @@
local str_match, tonumber, tostring = string.match, tonumber, tostring local str_match, tonumber, tostring = string.match, tonumber, tostring
local UnitName = UnitName 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 Gladdy = LibStub("Gladdy")
local L = Gladdy.L local L = Gladdy.L
@ -21,6 +23,13 @@ end
function VersionCheck:JOINED_ARENA() function VersionCheck:JOINED_ARENA()
self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived) self:RegisterComm("GladdyVCheck", VersionCheck.OnCommReceived)
if IsInRaid(LE_PARTY_CATEGORY_HOME) then
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 end
function VersionCheck:Test(unit) function VersionCheck:Test(unit)
@ -39,7 +48,7 @@ function VersionCheck.OnCommReceived(prefix, message, distribution, sender)
else else
Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"") Gladdy:Warn("Current version", "\"".. addonVersion.."\"", "is outdated. Most recent version is", "\"".. message.."\"")
Gladdy:Warn("Please download the latest Gladdy version at:") Gladdy:Warn("Please download the latest Gladdy version at:")
Gladdy:Warn("https://github.com/XiconQoo/Gladdy-TBC") Gladdy:Warn("https://www.curseforge.com/wow/addons/gladdy-tbc or https://github.com/XiconQoo/Gladdy-TBC")
end end
end end
end end

View File

@ -34,6 +34,16 @@ function XiconProfiles:ApplyClassic()
Gladdy:ToggleFrame(3) Gladdy:ToggleFrame(3)
end end
function XiconProfiles:ApplyClassicNoPet()
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetClassicProfileNoPet())
if deserialized then
Gladdy.modules["Export Import"]:ApplyImport(deserialized, Gladdy.db)
end
Gladdy:Reset()
Gladdy:HideFrame()
Gladdy:ToggleFrame(3)
end
function XiconProfiles:ApplyBlizz() function XiconProfiles:ApplyBlizz()
local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetBlizzardProfile()) local deserialized = Gladdy.modules["Export Import"]:Decode(Gladdy:GetBlizzardProfile())
if deserialized then if deserialized then
@ -84,10 +94,29 @@ function XiconProfiles:GetOptions()
width = "full", width = "full",
order = 5, order = 5,
}, },
headerProfileClassicNoPet = {
type = "header",
name = "Classic " .. L["Profile"] .. " No Pet",
order = 6,
},
classicProfileNoPet = {
type = "execute",
func = function()
Gladdy.dbi:ResetProfile(Gladdy.dbi:GetCurrentProfile())
XiconProfiles:ApplyClassicNoPet()
end,
name = " ",
desc = "Classic " .. L["Profile"] .. " No Pet",
image = "Interface\\AddOns\\Gladdy\\Images\\BasicProfiles\\Classic2.blp",
imageWidth = 350,
imageHeight = 175,
width = "full",
order = 7,
},
headerProfileKnall = { headerProfileKnall = {
type = "header", type = "header",
name = "Knall's " .. L["Profile"], name = "Knall's " .. L["Profile"],
order = 6, order = 8,
}, },
knallProfile = { knallProfile = {
type = "execute", type = "execute",
@ -101,12 +130,12 @@ function XiconProfiles:GetOptions()
imageWidth = 350, imageWidth = 350,
imageHeight = 175, imageHeight = 175,
width = "full", width = "full",
order = 7, order = 9,
}, },
headerProfileKlimp = { headerProfileKlimp = {
type = "header", type = "header",
name = "Klimp's " .. L["Profile"], name = "Klimp's " .. L["Profile"],
order = 8, order = 10,
}, },
klimpProfiles = { klimpProfiles = {
type = "execute", type = "execute",
@ -120,7 +149,7 @@ function XiconProfiles:GetOptions()
name = " ", name = " ",
desc = "Klimp's " .. L["Profile"], desc = "Klimp's " .. L["Profile"],
width = "full", width = "full",
order = 9, order = 11,
}, },
} }

View File

@ -13,6 +13,7 @@ local L = Gladdy.L
Gladdy.defaults = { Gladdy.defaults = {
profile = { profile = {
locked = false, locked = false,
hideBlizzard = "arena",
x = 0, x = 0,
y = 0, y = 0,
growUp = false, growUp = false,
@ -97,6 +98,11 @@ local function setOpt(info, value)
local key = info.arg or info[#info] local key = info.arg or info[#info]
Gladdy.dbi.profile[key] = value Gladdy.dbi.profile[key] = value
Gladdy:UpdateFrame() Gladdy:UpdateFrame()
if Gladdy.db.hideBlizzard == "always" then
SetCVar("showArenaEnemyFrames", 0)
elseif Gladdy.db.hideBlizzard == "never" then
SetCVar("showArenaEnemyFrames", 1)
end
end end
local function getColorOpt(info) local function getColorOpt(info)
local key = info.arg or info[#info] local key = info.arg or info[#info]
@ -205,10 +211,20 @@ function Gladdy:SetupOptions()
["RIGHT"] = L["Right"], ["RIGHT"] = L["Right"],
} }
}, },
hideBlizzard = {
type = "select",
name = L["Hide Blizzard"],
values = {
["arena"] = L["Arena only"],
["never"] = L["Never"],
["always"] = L["Always"],
},
order = 4,
},
group = { group = {
type = "group", type = "group",
name = L["General"], name = L["General"],
order = 4, order = 5,
childGroups = "tree", childGroups = "tree",
args = { args = {
frameGeneral = { frameGeneral = {

View File

@ -1,7 +1,7 @@
# Gladdy - TBC # Gladdy - TBC
### The most powerful arena addon for WoW TBC 2.5.1 ### The most powerful arena addon for WoW TBC 2.5.1
## [v1.12-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.12-Beta/Gladdy_TBC-Classic_v1.12-Beta.zip) ## [v1.13-Beta Download Here](https://github.com/XiconQoo/Gladdy-TBC/releases/download/v1.13-Beta/Gladdy_TBC-Classic_v1.13-Beta.zip)
###### <a target="_blank" rel="noopener noreferrer" href="https://www.paypal.me/xiconqoo/10"><img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/Paypal-Donate.png" height="30" style="margin-top:-30px;position:relative;top:20px;"></a> Please consider donating if you like my work ###### <a target="_blank" rel="noopener noreferrer" href="https://www.paypal.me/xiconqoo/10"><img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/Paypal-Donate.png" height="30" style="margin-top:-30px;position:relative;top:20px;"></a> Please consider donating if you like my work
@ -26,6 +26,8 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
- Highlight (highlights focus and target) - Highlight (highlights focus and target)
- Pets (show arena pets) - Pets (show arena pets)
- Racial Spells - Racial Spells
- Range Check
- Shadowsight Timer
- TotemPlates (show totem icons instead of normal nameplates) - TotemPlates (show totem icons instead of normal nameplates)
- Trinket (tracks trinket usage) - Trinket (tracks trinket usage)
- VersionCheck (checks if you use an older version that your teammate) - VersionCheck (checks if you use an older version that your teammate)
@ -37,8 +39,37 @@ The goal is to make Gladdy highly configurable in it's appearance. Everything ca
<img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample2.jpg" align="right" width="48.5%"> <img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample2.jpg" align="right" width="48.5%">
<img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample3.png" width="48.5%"> <img src="https://raw.githubusercontent.com/XiconQoo/Gladdy/readme-media/sample3.png" width="48.5%">
## Special Thanks
- **Schaka** - the original author 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 ### Changes
### 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 ### v1.12-Beta
- fix classic profile - fix classic profile

View File

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