WoWInterface SVN NinjaYell

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /trunk/NinjaYell
    from Rev 7 to Rev 6
    Reverse comparison

Rev 7 → Rev 6

core.lua
1,6 → 1,6
local addon = CreateFrame("Frame", "NinjaYell", UIParent)
local addon = {}
addon.frame = CreateFrame("Frame", "NinjaYell", UIParent)
addon.color = { r = 1, g = 1, b = 1 }
addon.ids = {}
 
local _G = getfenv(0)
 
42,6 → 42,7
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"] = {},
49,6 → 50,17
["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
57,21 → 69,21
if ( not(addon.spells[spellName]) ) then return end
 
if ( eventType == "SPELL_CAST_SUCCESS" or eventType == "SPELL_CAST_START" ) then
--print(eventType)
--printf("%s", eventType)
if ( isMe(srcFlags) ) then
--printf("%s isMe", eventType)
self:Scoop(spellName)
end
--[[
elseif ( eventType == "SPELL_CAST_FAILED" ) then
print(eventType)
printf("%s", eventType)
if ( failSafe == spellName ) then
printf("%s failSafe passed, dumping", eventType)
self:Dump()
end
--]]
elseif ( eventType == "SPELL_AURA_APPLIED" ) then
--print(eventType)
--printf("%s", 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)
82,7 → 94,7
--printf("%s %s", failSafe, tostring(addon.ids[destName] == destGUID))
end
elseif ( eventType == "SPELL_INTERRUPT" ) then
--print(eventType)
--printf("%s", 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)
91,7 → 103,7
--printf("%s %s %s", tostring(isMe(srcFlags)), failSafe, tostring(addon.ids[destName] == destGUID))
end
elseif ( eventType == "SPELL_MISSED" ) then
--print(eventType)
--printf("%s", eventType)
if ( isMe(srcFlags) ) then
--printf("%s isMe", eventType)
self:Announce(spellName, destName, 3, missType)
99,7 → 111,7
--printf("%s", tostring(isMe(srcFlags)))
end
elseif ( eventType == "SPELL_AURA_REMOVED" ) then
--print(eventType)
--printf("%s", 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)
109,14 → 121,14
--printf("%s %s", tostring(addon.spells[spellName].Active), tostring(addon.spells[spellName].GUID == destGUID))
end
elseif ( eventType == "UNIT_DIED" ) then
--print(eventType)
--printf("%s", eventType)
if ( addon.ids[destName] ) then
self:Dump()
end
end
end
 
function addon:Scoop(spellName)
function addon.frame:Scoop(spellName)
failSafe = spellName
for i, v in ipairs({"target", "focus", "mouseover"}) do
if ( UnitExists(v) ) then
125,14 → 137,14
end
end
 
function addon:Dump()
function addon.frame:Dump()
failSafe = nil
for k, v in pairs(addon.ids) do
addon.ids[k] = nil
end
end
 
function addon:Announce(spellName, destName, index, ...)
function addon.frame:Announce(spellName, destName, index, ...)
message = nil
if ( index == 1 ) then
if ( addon.spells[spellName].Applied ) then
216,27 → 228,27
SendChatMessage(message, channel or "SAY")
end
 
function addon:Enable()
function addon.frame:Enable()
self:SetScript("OnEvent", CLEU)
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
print("Enabled")
end
 
function addon:Disable()
function addon.frame:Disable()
self:SetScript("OnEvent", nil)
self:UnregisterAllEvents()
print("Disabled")
end
 
local function Toggle()
if ( addon:IsEventRegistered("COMBAT_LOG_EVENT_UNFILTERED") ) then
addon:Disable()
local function Toggle(arg)
if ( addon.frame:IsEventRegistered("COMBAT_LOG_EVENT_UNFILTERED") ) then
addon.frame:Disable()
else
addon:Enable()
addon.frame:Enable()
end
end
 
SLASH_NYELL1 = "/nyell"
SlashCmdList["NYELL"] = Toggle
 
addon:Enable()
\ No newline at end of file +addon.frame:Enable() \ No newline at end of file