Mercurial > wow > itemauditor
comparison Modules/QuickAuctions.lua @ 20:ff9a698caebc
Added options for the crafting threshold and auction threshold. I also fixed the queue to use the item cost to determine if there is enough profit instead of the auction (QA) threshold which already has profit built in.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Sun, 04 Jul 2010 09:33:25 -0700 |
| parents | 67f4151d535c |
| children | d7f02c84994c |
comparison
equal
deleted
inserted
replaced
| 19:67f4151d535c | 20:ff9a698caebc |
|---|---|
| 34 | 34 |
| 35 self:UpdateQAGroup(QAAPI:GetItemGroup(link)) | 35 self:UpdateQAGroup(QAAPI:GetItemGroup(link)) |
| 36 end | 36 end |
| 37 | 37 |
| 38 addon.profit_margin = 1.15 | 38 addon.profit_margin = 1.15 |
| 39 addon.minimum_profit = 50000 | |
| 40 | 39 |
| 41 local function calculateQAThreshold(copper) | 40 local function calculateQAThreshold(copper) |
| 42 if copper == 0 then | 41 if copper == 0 then |
| 43 copper = 1 | 42 copper = 1 |
| 44 end | 43 end |
| 45 | 44 |
| 46 -- add my minimum profit margin | 45 -- add my minimum profit margin |
| 47 copper = copper * addon.profit_margin | 46 -- GetAuctionThreshold returns a percent as a whole number. This will convert 25 to 1.25 |
| 47 copper = copper * (1+addon:GetAuctionThreshold()) | |
| 48 | 48 |
| 49 -- Adding the cost of mailing every item once. | 49 -- Adding the cost of mailing every item once. |
| 50 copper = copper + 30 | 50 copper = copper + 30 |
| 51 | 51 |
| 52 -- add AH Cut | 52 -- add AH Cut |
| 83 end | 83 end |
| 84 if LSW == nil then | 84 if LSW == nil then |
| 85 self:Print("This feature requires LilSparky's Workshop.") | 85 self:Print("This feature requires LilSparky's Workshop.") |
| 86 return | 86 return |
| 87 end | 87 end |
| 88 self:Debug(format("Auction Threshold: %d%%", self:GetAuctionThreshold()*100 )) | |
| 89 self:Debug(format("Crafting Threshold: %s", self:FormatMoney(self:GetCraftingThreshold()))) | |
| 88 | 90 |
| 89 for i = 1, GetNumTradeSkills() do | 91 for i = 1, GetNumTradeSkills() do |
| 90 local itemLink = GetTradeSkillItemLink(i) | 92 local itemLink = GetTradeSkillItemLink(i) |
| 91 local itemId = Skillet:GetItemIDFromLink(itemLink) | 93 local itemId = Skillet:GetItemIDFromLink(itemLink) |
| 92 | 94 |
| 133 local currentPrice = GetAuctionBuyout(itemLink) or 0 | 135 local currentPrice = GetAuctionBuyout(itemLink) or 0 |
| 134 | 136 |
| 135 | 137 |
| 136 -- bonus? | 138 -- bonus? |
| 137 | 139 |
| 138 if newThreshold < currentPrice and (currentPrice - newThreshold) > addon.minimum_profit then | 140 if newThreshold < currentPrice and (currentPrice - newCost) > self:GetCraftingThreshold() then |
| 139 self:Debug(format("Adding %s x%s to skillet queue. Profit: %s", | 141 self:Debug(format("Adding %s x%s to skillet queue. Profit: %s", |
| 140 itemLink, | 142 itemLink, |
| 141 toQueue, | 143 toQueue, |
| 142 addon:FormatMoney(currentPrice - newThreshold) | 144 addon:FormatMoney(currentPrice - newThreshold) |
| 143 )) | 145 )) |
| 144 self:AddToQueue(skillId,i, toQueue) | 146 self:AddToQueue(skillId,i, toQueue) |
| 145 else | 147 elseif ItemAuditor.db.profile.messages.queue_skip then |
| 146 self:Debug(format("Skipping %s x%s. Would lose %s ", itemLink, toQueue, addon:FormatMoney(currentPrice - newThreshold))) | 148 self:Debug(format("Skipping %s x%s. Profit: %s ", itemLink, toQueue, addon:FormatMoney(currentPrice - newCost))) |
| 147 end | 149 end |
| 148 end | 150 end |
| 149 end | 151 end |
| 150 end | 152 end |
| 151 | 153 |
