comparison Modules/Api.lua @ 64:e92a5adf75bf

Added first public API.
author Asa Ayers <Asa.Ayers@Gmail.com>
date Tue, 27 Jul 2010 18:00:00 -0700
parents
children 3930518cb8d9
comparison
equal deleted inserted replaced
63:e7d287cc3b02 64:e92a5adf75bf
1 local ItemAuditor = select(2, ...)
2
3 local Crafting = ItemAuditor:GetModule("Crafting")
4
5 IAapi = {}
6
7 --[[
8 You can register a callback here to influence which items will get crafted and how many.
9 The decider function needs to return the number of items the user should have in their
10 inventory. If the number owned is less than the highest decided number, that item will
11 be queued to be crafted unless any decider vetos the item.
12
13 There is no way to unregister your decider but it can be overwritten with a function that simply returns 0.
14
15 Please make sure your decider runs as fast as possible, It will be called at least once
16 for every tradeskill being considered.
17
18 I find the (non) word "Decider" to be amusing, so I used it.
19
20 ItemAuditor will veto any item that costs more to create than it will sell for, It will also
21 queue one of every item that is profitable. If you simply wanted to increase that to 5 of every
22 profitable item you could use this:
23
24 IAapi.RegisterCraftingDecider('Five', function() return 5 end)
25 ]]
26 function IAapi.RegisterCraftingDecider(name, decider)
27 Crafting.RegisterCraftingDecider(name, decider)
28 end
29
30