Blizzard

8.0 Release Notes for Wow Addon Developers



With the release of Battle for Azeroth Beta, the WoW User Interface team would like to highlight some upcoming changes that will affect addon developers. Many of these changes are already in place on the Beta realms, while some others will not be in place until the BFA pre-patch.



If you aren’t an addon developer, this list will probably not be of much interest to you:



Combat Log Event Changes

The COMBAT_LOG_EVENT & COMBAT_LOG_EVENT_UNFILTERED events no longer have any event payload. In order to get the information passed down previously with these events, please use the CombatLogGetCurrentEventInfo function.



Spell System API Changes

Due to a change we made on the backend, Spell System API & Events have several major changes. Please read the following if you are using Spell API or Events in your addons.



Spell text fields — such as its name’s subtext or description — are now loaded on demand, except for the spell’s name. This affects the following functions:

Function Name -- Return value affected

GetActiveArtifactByRace -- #5 (spell description)

GetArtifactInfoByRace -- #5 (spell description)

GetRecipeDescription -- #1(spell description)

GetSelectedArtifactInfo -- #5 (spell description)

GetSpellBookItemName -- #2 (spell name subtext)

GetSpellDescription -- #1 (spell description)

GetTrainerServiceAbilityReq -- #1(spell name subtext)

GetTrainerServiceDescription -- #1 (spell description)



If you call these functions, the listed return value may be nil or empty, since the data is not available at the time of the function call. We offer an interface in Lua —SpellMixin — that delays a call until the data is available. This interface lets you call functions from the previous list without the risk of returning empty data.



local spell = Spell:CreateFromSpellID(spellID);

spell:ContinueOnSpellLoad(function()

spellButton:SetText(GetSpellDescription(spell:GetSpellID());

end);



The SetText call is immediate if the spell text is loaded and available. If not, it delays the call until the data loads.



If you need to cancel a request at any point, use this interface:



local spell = Spell:CreateFromSpellID(spellID);

local spellDataLoadedCancelFunc = spell:ContinueWithCancelOnSpellLoad(function()

button:SetText(GetSpellDescription(spell:GetSpellID());

end);



When you're ready to cancel the request, call the cancellation function:



if spellDataLoadedCancelFunc then

spellDataLoadedCancelFunc();

spellDataLoadedCancelFunc = nil; -- for safety!

end



In addition to the ContinueOnSpellLoad functions, SpellMixin offers the following member functions to query various spell text fields:

GetSpellID() The Spell ID associated with this SpellMixin.

GetSpellName() The spell’s name.

GetSpellSubtext() The spell’s name subtext (often the spell rank).

GetSpellDescription() The spell’s description.



You should call these functions from your captured function body, as in the previous examples. The following is the first example, simplified using these functions.



local spell = Spell:CreateFromSpellID(spellID);

spell:ContinueOnSpellLoad(function()

spellButton:SetText(spell:GetSpellDescription());

end);



Function changes:

• GetSpellInfo - second parameter used to return Spell.nameSubtext -- now returns nil.

• GetTrainerServiceInfo - dropped second parameter (nameSubtext).

• GetShapeshiftFormInfo - dropped second parameter (name).

• GetMacroSpell - dropped first two parameters (name, and nameSubtext).

• GetPetActionInfo - dropped second parameter (nameSubtext).

• GetPossessInfo - second parameter changed from spell name to spell ID.

• CancelUnitBuff - no longer supports canceling by spell name.

• UnitBuff - dropped second parameter (nameSubtext). Also, no longer supports querying by spell name.

• UnitDebuff - dropped second parameter (nameSubtext). Also, no longer supports querying by spell name.

• UnitAura - dropped second parameter (nameSubtext). Also, no longer supports querying by spell name.

• UnitCastingInfo - dropped second parameter (nameSubtext).

• UnitChannelInfo - dropped second parameter (nameSubtext).

• GameTooltip:GetSpell - dropped second parameter (nameSubtext).

• GetAuraInfo - no longer supports querying by spell name.

• GetItemSpell - dropped second parameter (nameSubtext).

• GetSpellLink - no longer returns trade skill link as second parameter (see GetSpellTradeSkillLink below).



Functions removed:

• FindSpellOverrideNameByName

• FindBaseSpellNameByName

• SearchGuildRecipes



Functions added:

• CancelPetPossess

• FindSpellOverrideByID

• FindBaseSpellByID

• DoesSpellExist

• GetSpellTradeSkillLink

• GetSpellSubtext



Event changes:

• UNIT_SPELLCAST_SUCCEEDED - no longer provide spell name and rank.

• UNIT_SPELLCAST_FAILED_QUIET - no longer provide spell name and rank.

• UNIT_SPELLCAST_INTERRUPTED - no longer provide spell name and rank.

• UNIT_SPELLCAST_START - no longer provide spell name and rank.

• UNIT_SPELLCAST_FAILED - no longer provide spell name and rank.

• UNIT_SPELLCAST_STOP - no longer provide spell name and rank.

• UNIT_SPELLCAST_DELAYED - no longer provide spell name and rank.

• UNIT_SPELLCAST_CHANNEL_START - no longer provide spell name and rank.

• UNIT_SPELLCAST_CHANNEL_UPDATE - no longer provide spell name and rank.

• UNIT_SPELLCAST_CHANNEL_STOP - no longer provide spell name and rank.



World Map Changes

The World Map has been almost entirely re-written, and all map API was removed. It’s being replaced but we are currently still transitioning. worldMapAreaID, dungeonMapID, dungeonFloor have all been removed and replaced with just uiMapID. We have included a mapping between the old and new data in AddOns/Blizzard_Deprecated/UIMapIDToWorldMapAreaID.lua to help you translate your data.



Event Documentation

In addition to function and table API documentation, all events and their payload are now documented. The documentation can be accessed in-game by using the /api command. You can find the raw documentation files in /AddOns/Blizzard_APIDocumentation. They are exported through the existing ‘ExportInterfaceFiles code’ command.



UI Widgets are replacing the World State Frame (and much more to come)

UI Widgets are a new system that we have put in place to handle a wide variety of UI tasks going forward. As a result, WorldStateFrame is no longer needed and will be going away entirely. World State events will still be sent down as before, so don’t worry if you were relying on those. There are new events and UI Widget system API functions … see UIWidgetManagerDocumentation.lua in the documentation folder. For further information, see the lua & xml files in the \AddOns\Blizzard_UIWidgets folder.



Voice Chat

The new Voice Chat system is now live! Documentation for the Voice Chat API is in the normal documentation folder as listed above.



VoiceActivityManager is a Lua-side system that lets you register for the creation of notification frames when a member in voice chat starts talking. You can use the RegisterFrameForVoiceActivityNotifications and UnregisterFrameForVoiceActivityNotifications methods for this purpose.



Pool Collections

PoolCollections are a new Lua-side system that allows you to register multiple pools for creating frames using different templates and/or frame types and not have to keep a Pool around for each one. It works in much the same way that Pools do, you just need to make sure that you call CreatePool before you attempt to create an object of a particular type. Here is an example of how you might use PoolCollections:



-- First create the PoolCollection and call CreatePool for every template type you will be creating

self.myPools = CreatePoolCollection();

self.myPools:CreatePool("FRAME", parent, "FrameTemplateA");

self.myPools:CreatePool("FRAME", parent, " FrameTemplateB");

self.myPools:CreatePool("BUTTON", parent, "ButtonTemplateA");

self.myPools:CreatePool("BUTTON ", parent, " ButtonTemplateB");



-- Then creating any of those templates is as easy as calling Acquire on the PoolCollection

local frame1 = self.myPools:Acquire("FrameTemplateA");

local frame2 = self.myPools:Acquire("FrameTemplateB");

local frame3 = self.myPools:Acquire("FrameTemplateB");

local button1 = self.myPools:Acquire("ButtonTemplateB");

local button2 = self.myPools:Acquire("ButtonTemplateA");



-- And when you are done with the frames, you can release them one by one or use ReleaseAll

self.myPools:Release(frame3);

self.myPools:ReleaseAll();



Changes to Texture object API

• The SetRotation(radians) function now rotates the textures vertices instead of modifying the texture cords

• Added a GetRotation function

• Setting the rotation will no longer destroy texture coords set by SetTexCoord

• Unlike the old API, rotations will persist across anchor changes

• Textures created in XML can be initialized rotated with the “rotation” attribute, specified in degrees



Other changes to Frame API

• Texture, FontString and Line can now be scaled directly using the newly added SetScale, GetScale and GetEffectiveScale functions

• The Model XML attribute “scale” is now called “modelScale”



Miscellaneous Changes

• Attempting to register or unregister for an unknown event will now generate a Lua error

• We made several improvements to the performance of anchor-processing

• Anchor processing is also less likely to fail to resolve a valid rect

• xpcall now accepts arguments like pcall does

• The alert system was overhauled, allowing for there to be multiple independent alert/toast areas in the UI. We also added a new intrinsic type called ContainedAlertFrame to be used for alerts.

• Context menus can now have a custom frame imbedded into them.

• GetItemInfo now respects player’s link level for sell price

