# HG changeset patch # User Asa Ayers # Date 1280278800 25200 # Node ID e92a5adf75bf951b6a97b68178fe632808a2f535 # Parent e7d287cc3b020d51ccad72ba24cbec134815992b Added first public API. diff -r e7d287cc3b02 -r e92a5adf75bf CHANGELOG.txt --- a/CHANGELOG.txt Tue Jul 27 17:58:33 2010 -0700 +++ b/CHANGELOG.txt Tue Jul 27 18:00:00 2010 -0700 @@ -2,6 +2,7 @@ - Fixed an infinite loop when when adding items to the Skillet queue from the crafting interface. - For Developers: Changed ItemAuditor to no longer be in the global namespace +- For Developers: Added IAapi to the public namespace so other addons can interact with ItemAuditor. 2010-07-25 Asa Ayers diff -r e7d287cc3b02 -r e92a5adf75bf ItemAuditor.toc --- a/ItemAuditor.toc Tue Jul 27 17:58:33 2010 -0700 +++ b/ItemAuditor.toc Tue Jul 27 18:00:00 2010 -0700 @@ -24,3 +24,5 @@ Modules\Crafting.lua Modules\QuickAuctions.lua + +Modules\Api.lua diff -r e7d287cc3b02 -r e92a5adf75bf Modules/Api.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Modules/Api.lua Tue Jul 27 18:00:00 2010 -0700 @@ -0,0 +1,30 @@ +local ItemAuditor = select(2, ...) + +local Crafting = ItemAuditor:GetModule("Crafting") + +IAapi = {} + +--[[ + You can register a callback here to influence which items will get crafted and how many. + The decider function needs to return the number of items the user should have in their + inventory. If the number owned is less than the highest decided number, that item will + be queued to be crafted unless any decider vetos the item. + + There is no way to unregister your decider but it can be overwritten with a function that simply returns 0. + + Please make sure your decider runs as fast as possible, It will be called at least once + for every tradeskill being considered. + + I find the (non) word "Decider" to be amusing, so I used it. + + ItemAuditor will veto any item that costs more to create than it will sell for, It will also + queue one of every item that is profitable. If you simply wanted to increase that to 5 of every + profitable item you could use this: + + IAapi.RegisterCraftingDecider('Five', function() return 5 end) +]] +function IAapi.RegisterCraftingDecider(name, decider) + Crafting.RegisterCraftingDecider(name, decider) +end + + diff -r e7d287cc3b02 -r e92a5adf75bf Modules/Crafting.lua --- a/Modules/Crafting.lua Tue Jul 27 17:58:33 2010 -0700 +++ b/Modules/Crafting.lua Tue Jul 27 18:00:00 2010 -0700 @@ -167,7 +167,7 @@ local craftingDeciders = {} -function ItemAuditor:RegisterCraftingDecider(name, decider) +function Crafting.RegisterCraftingDecider(name, decider) craftingDeciders[name] = decider end @@ -200,7 +200,7 @@ end return -1 end -ItemAuditor:RegisterCraftingDecider('Is Profitable', isProfitable) +Crafting.RegisterCraftingDecider('Is Profitable', isProfitable) local function tableFilter(self, row, ...) -- column 5 is how many should be crafted diff -r e7d287cc3b02 -r e92a5adf75bf Modules/DisplayInvested.lua --- a/Modules/DisplayInvested.lua Tue Jul 27 17:58:33 2010 -0700 +++ b/Modules/DisplayInvested.lua Tue Jul 27 18:00:00 2010 -0700 @@ -1,6 +1,7 @@ local ItemAuditor = select(2, ...) local DisplayInvested = ItemAuditor:NewModule("DisplayInvested") + local AceGUI = LibStub("AceGUI-3.0") local ScrollingTable = LibStub("ScrollingTable") diff -r e7d287cc3b02 -r e92a5adf75bf Modules/QuickAuctions.lua --- a/Modules/QuickAuctions.lua Tue Jul 27 17:58:33 2010 -0700 +++ b/Modules/QuickAuctions.lua Tue Jul 27 18:00:00 2010 -0700 @@ -1,5 +1,6 @@ local ItemAuditor = select(2, ...) local QuickAuctions= ItemAuditor:NewModule("QuickAuctions") +local Crafting = ItemAuditor:GetModule("Crafting") --[[ This is simply for compatibility while I change the QA API. Once @@ -113,7 +114,7 @@ end return 0 end -ItemAuditor:RegisterCraftingDecider('IA QuickAuctions', isProfitable) +Crafting.RegisterCraftingDecider('IA QuickAuctions', isProfitable) --[[ This is based on KTQ