premium banner
Initializes the Profession Data by opening the Professions Frame

Description

Professions Data Initializer: A library to initialize the professions data by opening the hardware event protected Professions Frame. It took me some time to find a way to open the frame without any taint errors (sometimes even closing it would cause taint). This file steals a single keypress(and release) to open and close the frame. It also posts a warning about what it is doing and how to skip the opening as well. It does wait until the character is not in combat to do this so it shouldn't kill anyone.

 

This lua file is NOT an ADDON in and of itself. It should be put into YOUR addon to function and YOUR toc file to work.

This is needed so C_TradeSkillUI.GetProfessionInfoBySkillLineID(skillLine) can return the actual data for known professions or you get no current level / max level data when you call it.

The data remains up to date once the panel has been opened for the rest of the session (That I have found) so the panel only needs to be opened once.

 

It does only 2 things when normally running... It tries to toggle the new hardware event protected ProfessionsFrame and lets you know if it was able to open it. That is it. If it finds that you don't know any professions it will register itself to be re-ran once you learn one.

 

The many steps and delays (that nobody will notice anyways) are actually required to prevent taint and allow the file to work properly. It has been tried faster and with muting the sounds differently and the what not... it didn't work right. It does work like this so...

This script opens the new Professions Frame if you know any professions (Either primary or secondary) once the World is displayed.  If you don't know any professions then there is nothing this script can do, however it will stop running if it can't do anything and it will let your addon know that it failed (see below). By using this file instead of rolling your own solution you will prevent multiple addons from doing the same thing by all opening and closing the spell book and Professions Frame.

This file will set a global named ProfessionsDataInitialized once the data is available.
It will also call: (depending if it worked)
     EventRegistry:TriggerEvent("ProfessionDataInitializer.success")
or
     EventRegistry:TriggerEvent("ProfessionDataInitializer.failed", reason)

Just put this script into your *.toc file (preferably) as the first loaded file and it will take care of the work by itself and also prevent other addons that use this script from opening  and closing the frames by detecting that this script has already been loaded

Supported Profession Addon Frames:

It does directly support Skillet however it should work with most without issue. 

Let me know about any errors when controlling other trade skill addon frames and I will try to fix any issues closing them too