We have updated our Terms of Service and Privacy Policy.
Dismiss
Regional FlagNotable UI Changes Coming in 7.1Source
avatar
Community Manager
Target Source
#1 - 2016/10/04 04:58:00 PM
Patch 7.1 includes several changes to WoW UI functions, and we wanted to call extra attention to a few of them, as they may break some functionality provided by addons. This is not a comprehensive list of all of 7.1’s UI API changes, just the ones we thought addon authors would be most interested in. If you’re not an addon author, feel free to ignore this post, as it’s only covering technical changes to how addons interact with the game.

Unit Position changes

Several unit positioning/facing/range APIs have been restricted so that they will only return valid values when the following criteria are met:
• Unit is the active player or in the party
• Unit is not in any kind of instance PvE or PvP.

The following functions have been affected:
GetPlayerMapPosition
UnitCameraFacing
UnitDistanceSquared
UnitFacing
UnitPosition (note: when in the restricted state, the mapID return is still valid)

There are new ways to access units on the map:
"AddUnit",
"AddUnitFileID",
"AddUnitAtlas",
"ClearUnits",
"FinalizeUnits", It's illegal to call AddUnit after a call to Finalize in the same frame that this was finalized.
"SetPlayerPingTexture",
"StartPlayerPing",
"StopPlayerPing",
"GetMouseOverUnits",
"SetOverrideMapID",
"GetOverrideMapID",

Intrinsics

It’s now possible to create an “intrinsic” frame template. Intrinsics are similar to virtual XML templates but have a few special behaviors.

As an example, here is a simple intrinsic definition.

<Frame name="ExampleIntrinsic" intrinsic="true">
<Scripts>
<OnShow function="ExampleIntrinsic_OnPostShow" intrinsicOrder="postcall" />
</Scripts>
</Frame>


These can be created through CreateFrame like built-in widgets. Using the example above, you’d create a new ExampleIntrinsic by calling CreateFrame(“ExampleIntrinsic”).

These can also be created through XML elements anywhere a frame type could. For example:

<Frame name="ExampleParentFrame">
<Frames>
<ExampleIntrinsic parentKey="Example">
<Scripts>
<OnShow function="ExampleIntrinsic_OnShow" />
</Scripts>
</ExampleIntrinsic>
</Frames>
</Frame>


Lastly, and perhaps most importantly, intrinsics can apply special ordering to their frame scripts. Additionally, once an intrinsic frame script is bound to the frame, it cannot be rebound. However, it can be hooked and inspected. For example, in the definition above the global function “ExampleIntrinsic_OnPostShow” is bound to an instantiation of ExampleIntrinsic. It’s intrinsicOrder is “postcall” which means that this OnShow handler is called after the normal OnShow handler.

The ExampleIntrinsic_OnPostShow cannot be replaced. However, it can be hooked via HookScript or inspected by GetScript by passing in an additional optional argument with either LE_SCRIPT_BINDING_TYPE_INTRINSIC_POSTCALL or LE_SCRIPT_BINDING_TYPE_INTRINSIC_PRECALL. Specifying “precall” for the intrinsicOrder means that the handler is called before the normal OnShow handler. An intrinsic can have both a precall and a postcall.

For an example of usage, see the new ScrollingMessageFrame.xml and the corresponding ScrollingMessageFrame.lua files.

Nameplates

In patch 7.1, addons have been restricted from acting on nameplate. Addons can still gather information, target, and customize nameplates, but can no longer use their unit tokens for spell casts. This is similar to how nameplates worked in Warlords of Draenor.

Functions were added to help addons:

Added:
SetNamePlateFriendlySize,
GetNamePlateFriendlySize,
SetNamePlateEnemySize,
GetNamePlateEnemySize,
SetNamePlateSelfClickThrough,
GetNamePlateSelfClickThrough,
SetNameplateFriendlyClickThrough,
GetNameplateFriendlyClickThrough,
SetNamePlateEnemyClickThrough,
GetNamePlateEnemyClickThrough

These functions allow a specific area on the nameplate to be marked as a preferred click area such that if the nameplate position query results in two overlapping nameplates, the nameplate with the position inside its preferred area will be returned:

SetNamePlateSelfPreferredClickInsets,
GetNamePlateSelfPreferredClickInsets,
SetNamePlateFriendlyPreferredClickInsets,
GetNamePlateFriendlyPreferredClickInsets,
SetNamePlateEnemyPreferredClickInsets,
GetNamePlateEnemyPreferredClickInsets,

Removed:
SetNamePlateOtherSize
GetNamePlateOtherSize