# HG changeset patch # User Asa Ayers # Date 1281599640 25200 # Node ID 63823b6b5e288a9ccfc0a1b8337493efffee4647 # Parent 4ec8611d9466eb791b4f94c79a8ebee958e789fe API: Added a way for other addons to register with ItemAuditor once it loads if they were loaded first and updated the example at the end of Api.lua. diff -r 4ec8611d9466 -r 63823b6b5e28 CHANGELOG.txt --- a/CHANGELOG.txt Wed Aug 11 23:48:23 2010 -0700 +++ b/CHANGELOG.txt Thu Aug 12 00:54:00 2010 -0700 @@ -7,6 +7,7 @@ - Fixed Enchanting. I was not getting the ItemID correctly, so enchants could not be mapped to the scrolls they were to created - Changed snatch to only add each item once and to only add a snatch for items you don't have - API: Added haveMaterials to the item and need to the reagents that get passed to queue destinations. This is in preparation for building a shopping list module. +- API: Added a way for other addons to register with ItemAuditor once it loads if they were loaded first and updated the example at the end of Api.lua. 2010-08-10 Asa Ayers diff -r 4ec8611d9466 -r 63823b6b5e28 Modules/Api.lua --- a/Modules/Api.lua Wed Aug 11 23:48:23 2010 -0700 +++ b/Modules/Api.lua Thu Aug 12 00:54:00 2010 -0700 @@ -42,11 +42,38 @@ Crafting.UnRegisterQueueDestination(name) end +local function registerLoadedAddons() + return ItemAuditor_RegisterAPI and ItemAuditor_RegisterAPI() +end +registerLoadedAddons() + + +-- This is here so I have a second option in the menu and to serve as an example of +-- how to register your addon with ItemAuditor. --@debug@ --- This is here so I have a second option in the menu and to serve as an example. -local function testDestination(data) - ItemAuditor:Print('queue: '..data.recipeLink) +local function RegisterWithItemAuditor() + local function testDestination(data) + -- Replace this with a call to the methods you need in your addon + ItemAuditor:Print('queue: '..data.recipeLink) + end + -- Replace Echo with the name of your addon so it can be selected from /ia options + IAapi.RegisterQueueDestination('Echo', testDestination) end -IAapi.RegisterQueueDestination('Echo', testDestination) +if IAapi then + RegisterWithItemAuditor() +else + -- make sure to save any other addon's function + local original = ItemAuditor_RegisterAPI + -- this should not be local so it replaces (or creates) the global function + function ItemAuditor_RegisterAPI() + RegisterWithItemAuditor() + -- if original has a value (function), this will run it + return original and original() + end +end + + + + --@end-debug@ diff -r 4ec8611d9466 -r 63823b6b5e28 Modules/Crafting.lua --- a/Modules/Crafting.lua Wed Aug 11 23:48:23 2010 -0700 +++ b/Modules/Crafting.lua Thu Aug 12 00:54:00 2010 -0700 @@ -396,6 +396,7 @@ end local data = { recipeLink = recipeLink, + recipeID = Utils.GetItemID(recipeLink), link = itemLink, name = itemName, count = count,