This event is not always firing when crafting research finishes.
Sometimes it does, sometimes it doesn't.
I am trying to monitor it to get more information.
I log on to a character that I know has finished researching a trait, and sometimes the event fires but not everytime. I am always seeing xp gain show from the lootdrop addon, it seems when the event is not firing then no text appears in to the top right of the screen telling you which item was researched.
This is the code I have right now.
Is this the best way to use the event?
Has anyone else had a problem like this?
Lua Code:
local ADDON_NAME = "something"
local player_activated = false
local function OnResearchCompleted(eventCode, craftingSkillType, researchLineIndex, traitIndex)
LogMe:add("Function OnResearchCompleted("..tostring(eventCode)..", "..craftingSkillType..", "..researchLineIndex..", "..traitIndex..")")
end
local function OnPlayerActivated()
if player_activated then return end --Only the first time
player_activated = true
EVENT_MANAGER:UnregisterForEvent(ADDON_NAME, EVENT_PLAYER_ACTIVATED)
LogMe:add("Event OnPlayerActivated")
end
local function OnLoaded(eventType, addonName)
if addonName ~= ADDON_NAME then return end
EVENT_MANAGER:UnregisterForEvent(ADDON_NAME, EVENT_ADD_ON_LOADED)
LogMe:add("Event OnLoaded")
EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_SMITHING_TRAIT_RESEARCH_COMPLETED, OnResearchCompleted)
EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_PLAYER_ACTIVATED, OnPlayerActivated)
end
EVENT_MANAGER:RegisterForEvent(ADDON_NAME, EVENT_ADD_ON_LOADED, OnLoaded)