I know I am probably missing something obvious but cant work it out. Below is the code I am working with. The function is being called (highlighted below) but it just keeps returning nill.
(I'm not that good at lua and still learning so please simplify as much as possible thanks.)
Code:
NuttyWarAnnounce = LibStub("AceAddon-3.0"):NewAddon("NuttyWarAnnounce", "AceConsole-3.0", "AceEvent-3.0")
function NuttyWarAnnounce:OnInitialize()
-- Called when the addon is loaded
end
function NuttyWarAnnounce:OnEnable()
self:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
end
function NuttyWarAnnounce:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, subevent, srcGUID, srcName, srcflags, dstGUID, dstname, dstflags, spellID)
if UnitGUID("player") == srcGUID then
if subevent == "SPELL_AURA_APPLIED" then
if NuttyWarAnnounce.spellids.shouts[spellID] then
NuttyWarAnnounce:sendmessage()
else if NuttyWarAnnounce.spellids.alerts[spellID] then
NuttyWarAnnounce:spellcastcheck()
end
end
end
if subevent == "SPELL_AURA_REMOVED" then
if NuttyWarAnnounce.spellids.shouts[spellID] then
NuttyWarAnnounce:sendmessage()
end
end
end
end
function NuttyWarAnnounce:spellcastcheck()
print(spellid) --not working
end
function NuttyWarAnnounce:sendmessage()
print ("test")
end
NuttyWarAnnounce.spellids = {
shouts= {
[43308] = "find fish", --used for testing purposes--
[6673] = "Battle Shout",
[5242] = "Battle Shout",
[6192] = "Battle Shout",
[11549] = "Battle Shout",
[11550] = "Battle Shout",
[11551] = "Battle Shout",
[25289] = "Battle Shout",
[2048] = "Battle Shout",
[47436] = "Battle Shout",
[47440] = "Commanding Shout",
[469] = "Commanding Shout",
[47439] = "Commanding Shout",
},
alerts = {
[1161] = "Challenging Shout",
[871] = "Shied Wall",
[64382] = "Shattering Throw",
[12976] = "Last Stand",
[676] = "Disarm",
},
taunts = {
[355] = "Taunt",
[694] = "Mocking Blow",
},
}