#1 - Oct. 4, 2016, 4:58 p.m.
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:
UnitPosition (note: when in the restricted state, the mapID return is still valid)
There are new ways to access units on the map:
"FinalizeUnits", It's illegal to call AddUnit after a call to Finalize in the same frame that this was finalized.
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">
<OnShow function="ExampleIntrinsic_OnPostShow" intrinsicOrder="postcall" />
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:
<OnShow function="ExampleIntrinsic_OnShow" />
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.
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:
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: