Lore archive · Warcraft Wiki, 2023 dump
Porting addons to Classic
Last wiki revision 2020-03-31
Addons for Retail will in most cases work on Classic with removal of any non-Classic API.
If you don't have an error handling addon, get BugSack or Swatter or enable CVar.
See also Patch 1.13.2/API changes.
Globe can tell you which API functions/events in an addon have been removed in Classic, if the TOC is set to the Retail version and with
For example: https://www.townlong-yak.com/globe/#h:2a8385bff94e98a6bad8f5f09b45a148-reads
- 1) Interface:
- 2) Globe: check-classic
There is a list of Classic-specific API and a complete list of Classic API. The TOC version is
You can use the WOW_PROJECT_ID global (defined in BNet.lua) to check for Classic or Retail. local isClassic = (WOW_PROJECT_ID == WOW_PROJECT_CLASSIC)
old: PlaySound("igMainMenuOptionCheckBoxOn") new: PlaySound(SOUNDKIT.IG_MAINMENU_OPTION_CHECKBOX_ON) old: PlaySoundFile("Sound/Spells/LevelUp.ogg") new: PlaySoundFile(569593)
- Texture:SetTexture can no longer set color textures in Patch 7.0.3, use Texture:SetColorTexture(r, g, b [, a]) instead.
- only accepts SoundKitIDs in Patch 7.0.3
- only accepts FileDataIDs for game sounds in Patch 8.2.0
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 and to get the current zone UI map, instead use ("player")
The combat log was reworked in Patch 2.4.0
- The event payload is returned from since Patch 8.0.1
- See COMBAT_LOG_EVENT for details.
Most Vanilla addons still define their frames in XML, since was only added in Patch 1.10
- Parameters like are no longer globals for the script handler. This was changed in Patch 4.0.1 They are now passed like so or
- The parameter was unique to WoW frame scripts. It can generally be replaced with
There are multiple ways to handle frame scripts in XML. For simplicity's sake we will only describe a quick fix in blue text.
function SomeAddon_OnLoad(<font color="#4169E1">self ) <font color="#4169E1">self :RegisterEvent("ADDON_LOADED") end function SomeAddon_OnEvent(<font color="#4169E1">self, event, addon ) print(self, event, addon) end
- Lua
<Frame name="SomeAddon"> <Scripts> <OnLoad> SomeAddon_OnLoad(<font color="#4169E1">self ) </OnLoad> <OnEvent> SomeAddon_OnEvent(<font color="#4169E1">self, event, ... ) </OnEvent> </Scripts> </Frame>
- XML
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. local function OnEvent(self, event, addon) print(self, event, addon) end local f = CreateFrame("Frame") f:RegisterEvent("ADDON_LOADED") f:SetScript("OnEvent", OnEvent)
Source
https://warcraft.wiki.gg/wiki/Porting_addons_to_Classic · retrieved 2023-11-13 · CC BY-SA 4.0
Converted from wikitext with templates, tables and images removed, so some sentences may be missing values.
This archive predates WoW: Forever. For collected gameplay facts see the Forever database. Search the archive.