Quantcast
--[[ LDB Addon
StarterLDB.lua
This is a simplistic example of a LDB (LibDataBroker) Addon.
It is assumed that you understand the Blizzard addon basics.
It is based loosely on the Titan Bag plugin but is not Titan specific.

It is not required that a display addon exist for your addon to run; Such as Titan :-)
However your addon will need to enable command line commands or the user will not be able to see or do anything.

If running this example, it shows up in the Titan right click menu under : General > LDBStarter

NOTE: Before running this addon, the folder and file prefix must be the same to be considered for loading into WoW!
For example to just run this as is, remove the 'Example' from the folder name then start or reload WoW.
This is explained in more detail below in 'Folder Structure'.

Enjoy!
By: The Titan Development Team
--]]

--[[ Folder Structure
Inside this folder you will notice :
- three .toc files
- one .lua file
- one .tga file
- Artwork folder containg the icon used by the addon
- libs folder containing the LDB lib file

NOTE: Before running this addon, the folder and file prefix must be the same to be considered for loading into WoW!
For example, to just run this as is, remove the 'Example' from the files ending in tocExample then start or reload WoW.
This is explained in more detail below.

There are sites (wowhead or wow wiki as examples) that have deeper explainations on addon development.
Please use these sites for more addon information.

=== .toc or TOC
The folder and the .toc files MUST have the same name!
Sort of... the name prior to the underscore(_) must be the same. The name after that (postfix) has meaning to the WoW addon loader.
WoW accepts three TOC versions represented by the three postix values :
_Mainline : current retail version
_Wrath : Wrath of the Lich King version.
_Vanilla : Classic Era version
These values may change as the versions evolve, say Cata is added to Wrath.
Or they may not :). Years from now we may wonder why Wrath represents Dragonflight!

If your plugin is only for Classic Era then delete or leave the 'mainline' and 'wrath' .toc files as they are.
Changing the filename will prevent WoW from loading the addon into that version of the game.

NOTE: The ## Interface value should match the current interface value of the cooresponding WoW version.
In BattleNet this typcially shown below the 'Play' button.
DragonFlight 10.02.05 is represented without dots - 100205 - in the .toc.
If the interface value is higher or lower WoW will complain that you are running 'out of date' addons.

=== .lua
This is the code for the plugin.

=== /Artwork
The .tga file is the icon used by the plugin.
The icon is specified in the .obj created for the LDB init routine.
WoW can use several different types of icons. This discussion is outside the scope of this example.

=== libs
The file implementing the LDB functions.
See https://github.com/tekkub/libdatabroker-1-1/wiki/ for an API description.
LibDataBroker-1.1.lua at https://github.com/tekkub/libdatabroker-1-1/
It *should* be included in the LDB compliant display addon.
It must be included in the display addon that shows LDB addons.


Anyone can extract the code and art from WoW. This can be handy to get code examples.
And to grab icons to use for a plugin. My understanding is any icon can be used within WoW without violating the WoW ToS.
WoW icons tend to be .blp files. These files are NOT easy to look at or manipulate!!
Wowhead has an icon lookup that is useful which also shows the name of the icon file.
You will need to research third party tools to manipulate .blp files.
--]]

--[[ Saved Variables
Saved variables are not part of this addon and outside the scope of this example.

However, if using saved variables consider not referencing them until Player Entering World event or
registering for the event fired once saved variables are loaded.
See the referenced web sites above for more detail.
--]]