-
Notifications
You must be signed in to change notification settings - Fork 104
/
Spells.lua
37 lines (33 loc) · 1.57 KB
/
Spells.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
local T, C, L, _ = unpack(select(2, ...))
if C.announcements.spells ~= true then return end
----------------------------------------------------------------------------------------
-- Announce some spells
----------------------------------------------------------------------------------------
local frame = CreateFrame("Frame")
frame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
frame:SetScript("OnEvent", function()
local _, event, _, sourceGUID, sourceName, _, _, _, destName, _, _, spellID = CombatLogGetCurrentEventInfo()
local _, _, difficultyID = GetInstanceInfo()
if difficultyID == 0 or event ~= "SPELL_CAST_SUCCESS" then return end
if sourceName then sourceName = sourceName:gsub("%-[^|]+", "") end
if destName then destName = destName:gsub("%-[^|]+", "") end
if C.announcements.spells_from_all == true and not (sourceGUID == UnitGUID("player") and sourceName == T.name) then
if not sourceName then return end
if T.AnnounceSpells[spellID] then
if destName == nil then
SendChatMessage(string.format(L_ANNOUNCE_FP_USE, sourceName, GetSpellLink(spellID)), T.CheckChat())
else
SendChatMessage(string.format(L_ANNOUNCE_FP_USE, sourceName, GetSpellLink(spellID).." -> "..destName), T.CheckChat())
end
end
else
if not (sourceGUID == UnitGUID("player") and sourceName == T.name) then return end
if T.AnnounceSpells[spellID] then
if destName == nil then
SendChatMessage(string.format(L_ANNOUNCE_FP_USE, sourceName, GetSpellLink(spellID)), T.CheckChat())
else
SendChatMessage(GetSpellLink(spellID).." -> "..destName, T.CheckChat())
end
end
end
end)