Mercurial > wow > itemauditor
comparison Modules/Tooltip.lua @ 63:e7d287cc3b02
Replaced all instances of addon with ItemAuditor and I moved ItemAuditor out of the global namespace. The conversion was mostly a search/replace offering no new functionality. That will come in a later commit.
| author | Asa Ayers <Asa.Ayers@Gmail.com> |
|---|---|
| date | Tue, 27 Jul 2010 17:58:33 -0700 |
| parents | 70dc84df13b3 |
| children | 574c154d24ab |
comparison
equal
deleted
inserted
replaced
| 62:70dc84df13b3 | 63:e7d287cc3b02 |
|---|---|
| 1 local addonName, addonTable = ...; | 1 local ItemAuditor = select(2, ...) |
| 2 local addon = _G[addonName] | 2 local Tooltip = ItemAuditor:NewModule("Tooltip") |
| 3 | 3 |
| 4 local function ShowTipWithPricing(tip, link, num) | 4 local function ShowTipWithPricing(tip, link, num) |
| 5 if (link == nil) then | 5 if (link == nil) then |
| 6 return; | 6 return; |
| 7 end | 7 end |
| 9 -- local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, _, _, _, _, itemVendorPrice = GetItemInfo (link); | 9 -- local itemName, itemLink, itemRarity, itemLevel, itemMinLevel, itemType, _, _, _, _, itemVendorPrice = GetItemInfo (link); |
| 10 -- local _, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") | 10 -- local _, _, Color, Ltype, Id, Enchant, Gem1, Gem2, Gem3, Gem4, Suffix, Unique, LinkLvl, Name = string.find(link, "|?c?f?f?(%x*)|?H?([^:]*):?(%d+):?(%d*):?(%d*):?(%d*):?(%d*):?(%d*):?(%-?%d*):?(%-?%d*):?(%d*)|?h?%[?([^%[%]]*)%]?|?h?|?r?") |
| 11 | 11 |
| 12 local investedTotal, investedPerItem, count = ItemAuditor:GetItemCost(link) | 12 local investedTotal, investedPerItem, count = ItemAuditor:GetItemCost(link) |
| 13 | 13 |
| 14 local keep = 1 - addon:GetAHCut() | 14 local keep = 1 - ItemAuditor:GetAHCut() |
| 15 local show = false | 15 local show = false |
| 16 | 16 |
| 17 if investedTotal > 0 then | 17 if investedTotal > 0 then |
| 18 local suggestColor | 18 local suggestColor |
| 19 local ap = addon:GetAuctionPrice(link) | 19 local ap = ItemAuditor:GetAuctionPrice(link) |
| 20 if ap == nil then | 20 if ap == nil then |
| 21 suggestColor = nil | 21 suggestColor = nil |
| 22 elseif ap > ceil(investedPerItem/keep) then | 22 elseif ap > ceil(investedPerItem/keep) then |
| 23 suggestColor = "|cFF00FF00" -- green | 23 suggestColor = "|cFF00FF00" -- green |
| 24 else | 24 else |
| 25 suggestColor = "|cFFFF0000" -- red | 25 suggestColor = "|cFFFF0000" -- red |
| 26 end | 26 end |
| 27 | 27 |
| 28 | 28 |
| 29 tip:AddDoubleLine("\124cffffffffIA: Total Invested", addon:FormatMoney(investedTotal)); | 29 tip:AddDoubleLine("\124cffffffffIA: Total Invested", ItemAuditor:FormatMoney(investedTotal)); |
| 30 tip:AddDoubleLine("\124cffffffffIA: Invested per Item (own: " .. count .. ")", addon:FormatMoney(ceil(investedPerItem))); | 30 tip:AddDoubleLine("\124cffffffffIA: Invested per Item (own: " .. count .. ")", ItemAuditor:FormatMoney(ceil(investedPerItem))); |
| 31 tip:AddDoubleLine("\124cffffffffIA: Minimum " .. addon:GetAHFaction() .. " AH Price: ", addon:FormatMoney(ceil(investedPerItem/keep), suggestColor)) | 31 tip:AddDoubleLine("\124cffffffffIA: Minimum " .. ItemAuditor:GetAHFaction() .. " AH Price: ", ItemAuditor:FormatMoney(ceil(investedPerItem/keep), suggestColor)) |
| 32 show = true | 32 show = true |
| 33 | 33 |
| 34 end | 34 end |
| 35 | 35 |
| 36 if addon:IsQAEnabled() then | 36 if ItemAuditor:IsQAEnabled() then |
| 37 local groupName = QAAPI:GetItemGroup(link) | 37 local groupName = QAAPI:GetItemGroup(link) |
| 38 if groupName then | 38 if groupName then |
| 39 local threshold = QAAPI:GetGroupConfig(groupName) | 39 local threshold = QAAPI:GetGroupConfig(groupName) |
| 40 tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", addon:FormatMoney(threshold)) | 40 tip:AddDoubleLine("\124cffffffffIA: QA Threshold: ", ItemAuditor:FormatMoney(threshold)) |
| 41 show = true | 41 show = true |
| 42 end | 42 end |
| 43 end | 43 end |
| 44 | 44 |
| 45 if show then | 45 if show then |
