m (→Combat Log) |
(Globe) |
||
Line 3: | Line 3: | ||
Addons for Retail will in most cases work on Classic with removal of any [[Patch_1.13.2/API_changes#Global_API|non-Classic API]]. For Vanilla there is a bit more work involved however. |
Addons for Retail will in most cases work on Classic with removal of any [[Patch_1.13.2/API_changes#Global_API|non-Classic API]]. For Vanilla there is a bit more work involved however. |
||
+ | |||
+ | ==Globe== |
||
+ | [https://www.townlong-yak.com/globe/ Globe] can tell you which API functions/events in an addon have been removed in Classic. It only requires using <code>##Interface: 11302</code> or adding <code>## Globe: check-classic</code> to the [[TOC_format|TOC]]. |
||
+ | * Example: https://www.townlong-yak.com/globe/#h:2a8385bff94e98a6bad8f5f09b45a148-reads |
||
==Maps== |
==Maps== |
Revision as of 17:23, 21 June 2019
Addons for Retail will in most cases work on Classic with removal of any non-Classic API. For Vanilla there is a bit more work involved however.
Globe
Globe can tell you which API functions/events in an addon have been removed in Classic. It only requires using ##Interface: 11302
or adding ## Globe: check-classic
to the TOC.
Maps
Maps were reworked in Patch 8.0.1 and the stateful API was changed to be stateless.
- WorldMapAreaIDs were replaced with UiMapIDs.
- It's no longer needed to call SetMapToCurrentZone() and GetCurrentMapAreaID() to get the current zone UI map, instead use C_Map.GetBestMapForUnit()
Combat Log
The combat log was reworked in Patch 2.4.0
- The event payload is returned from CombatLogGetCurrentEventInfo() since Patch 8.0.1
- See COMBAT_LOG_EVENT for details.
Frame Scripts
Most Vanilla addons still define their frames in XML, since CreateFrame() was only added in Patch 1.10
- Parameters like
this
,event
andargN
are no longer globals for the script handler. This was changed in Patch 4.0.1 - The
this
parameter was unique to WoW frame scripts. It can generally be replaced withself
even though they are separate concepts. arg1
,arg2
,arg3
, etc were replaced with the...
vararg forOnEvent(self, event, ...)
Quick fix
There are multiple ways to handle frame scripts in XML. For simplicity's sake we will only describe a quick fix in highlighted blue text and a Lua only example.
- Lua
function SomeAddon_OnLoad(frame) frame:RegisterEvent("ADDON_LOADED") end function SomeAddon_OnEvent(frame, event, addon) print(frame, event, addon) end
- XML
<Frame name="SomeAddon"> <Scripts> <OnLoad> SomeAddon_OnLoad(self) </OnLoad> <OnEvent> SomeAddon_OnEvent(self, event, ...) </OnEvent> </Scripts> </Frame>
Lua only
It's also possible to create a frame and handle the scripts in Lua without use of XML, depending on how simple the addon is.
function f:OnEvent(event, addon) print(self, event, addon) end local f = CreateFrame("Frame") f:RegisterEvent("ADDON_LOADED") f:SetScript("OnEvent", f.OnEvent)