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