/
local addon = {} |
addon.frame = CreateFrame("Frame", "NinjaYell", UIParent) |
local addon = CreateFrame("Frame", "NinjaYell", UIParent) |
addon.color = { r = 1, g = 1, b = 1 } |
addon.ids = {} |
local _G = getfenv(0) |
Applied = "%t is sheeped. You break it, you tank it!", |
Faded = "%t's fleece is no longer as white as snow", |
}, |
-- Use Channel to provide a custom channel to be used, and use Target to provide a WHISPER target (if you choose to use WHISPER as your custom channel) |
["Distract"] = {}, |
["Cyclone"] = {}, |
["Fear"] = {}, |
["Freezing Trap"] = {}, |
} |
do |
local i = {} |
addon.ids = setmetatable({}, { |
__index = function(t, k) return i[k] end, |
__newindex = function(t, k, v) |
if ( not(v and k) ) then return end |
i[k] = v |
end, |
}) |
end |
local function isMe(flags) |
return bit_bor(flags, COMBATLOG_FILTER_ME) == COMBATLOG_FILTER_ME |
end |
if ( not(addon.spells[spellName]) ) then return end |
if ( eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_CAST_START" ) then |
--printf("%s", eventType) |
--print(eventType) |
if ( isMe(srcFlags) ) then |
--printf("%s isMe", eventType) |
self:Scoop(spellName) |
end |
--[[ |
elseif ( eventType == "SPELL_CAST_FAILED" ) then |
printf("%s", eventType) |
print(eventType) |
if ( failSafe == spellName ) then |
printf("%s failSafe passed, dumping", eventType) |
self:Dump() |
end |
--]] |
elseif ( eventType == "SPELL_AURA_APPLIED" ) then |
--printf("%s", eventType) |
--print(eventType) |
if ( failSafe == spellName and addon.ids[destName] == destGUID ) then |
--printf("%s failSafe and GUID match found, dumping & announcing", eventType) |
self:Announce(spellName, destName, 1) |
--printf("%s %s", failSafe, tostring(addon.ids[destName] == destGUID)) |
end |
elseif ( eventType == "SPELL_INTERRUPT" ) then |
--printf("%s", eventType) |
--print(eventType) |
if ( isMe(srcFlags) and failSafe == spellName and addon.ids[destName] == destGUID ) then |
--printf("%s isMe, failSafe and GUID match, announcing & dumping", eventType) |
self:Announce(spellName, destName, 4, extraSpellName) |
--printf("%s %s %s", tostring(isMe(srcFlags)), failSafe, tostring(addon.ids[destName] == destGUID)) |
end |
elseif ( eventType == "SPELL_MISSED" ) then |
--printf("%s", eventType) |
--print(eventType) |
if ( isMe(srcFlags) ) then |
--printf("%s isMe", eventType) |
self:Announce(spellName, destName, 3, missType) |
--printf("%s", tostring(isMe(srcFlags))) |
end |
elseif ( eventType == "SPELL_AURA_REMOVED" ) then |
--printf("%s", eventType) |
--print(eventType) |
if ( addon.spells[spellName].Active and addon.spells[spellName].GUID == destGUID ) then |
--printf("%s Active and GUID match", eventType) |
self:Announce(spellName, destName, 2) |
--printf("%s %s", tostring(addon.spells[spellName].Active), tostring(addon.spells[spellName].GUID == destGUID)) |
end |
elseif ( eventType == "UNIT_DIED" ) then |
--printf("%s", eventType) |
--print(eventType) |
if ( addon.ids[destName] ) then |
self:Dump() |
end |
end |
end |
function addon.frame:Scoop(spellName) |
function addon:Scoop(spellName) |
failSafe = spellName |
for i, v in ipairs({"target", "focus", "mouseover"}) do |
if ( UnitExists(v) ) then |
end |
end |
function addon.frame:Dump() |
function addon:Dump() |
failSafe = nil |
for k, v in pairs(addon.ids) do |
addon.ids[k] = nil |
end |
end |
function addon.frame:Announce(spellName, destName, index, ...) |
function addon:Announce(spellName, destName, index, ...) |
message = nil |
if ( index == 1 ) then |
if ( addon.spells[spellName].Applied ) then |
SendChatMessage(message, channel or "SAY") |
end |
function addon.frame:Enable() |
function addon:Enable() |
self:SetScript("OnEvent", CLEU) |
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED") |
print("Enabled") |
end |
function addon.frame:Disable() |
function addon:Disable() |
self:SetScript("OnEvent", nil) |
self:UnregisterAllEvents() |
print("Disabled") |
end |
local function Toggle(arg) |
if ( addon.frame:IsEventRegistered("COMBAT_LOG_EVENT_UNFILTERED") ) then |
addon.frame:Disable() |
local function Toggle() |
if ( addon:IsEventRegistered("COMBAT_LOG_EVENT_UNFILTERED") ) then |
addon:Disable() |
else |
addon.frame:Enable() |
addon:Enable() |
end |
end |
SLASH_NYELL1 = "/nyell" |
SlashCmdList["NYELL"] = Toggle |
addon.frame:Enable() |