color and module refactoring
This commit is contained in:
+13
-21
@@ -10,14 +10,6 @@ local disenchant = require 'aux.core.disenchant'
|
||||
local history = require 'aux.core.history'
|
||||
local auction_listing = require 'aux.gui.auction_listing'
|
||||
|
||||
local color = {
|
||||
value = {1, 1, .6},
|
||||
merchant = {.8, .5, .1},
|
||||
disenchant_source = {.7, .7, .7},
|
||||
disenchant_distribution = {.8, .8, .2},
|
||||
disenchant_value = {.1, .6, .6},
|
||||
}
|
||||
|
||||
_G.aux_tooltip_value = true
|
||||
|
||||
local game_tooltip_hooks, game_tooltip_money = T, 0
|
||||
@@ -62,16 +54,16 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
local item_id, suffix_id = info.parse_link(link)
|
||||
quantity = IsShiftKeyDown() and quantity or 1
|
||||
if aux_tooltip_disenchant_source then
|
||||
local color = color.disenchant_source
|
||||
local r, g, b = color.tooltip.disenchant.source()
|
||||
local type, range = disenchant.source(item_id)
|
||||
if type == 'CRYSTAL' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), color[1], color[2], color[3], true)
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), r, g, b, true)
|
||||
elseif type == 'SHARD' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff0070ddRare|r and |cff1eff00Uncommon|r items.', range), color[1], color[2], color[3], true)
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff0070ddRare|r and |cff1eff00Uncommon|r items.', range), r, g, b, true)
|
||||
elseif type == 'ESSENCE' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), color[1], color[2], color[3], true)
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), r, g, b, true)
|
||||
elseif type == 'DUST' then
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), color[1], color[2], color[3], true)
|
||||
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), r, g, b, true)
|
||||
end
|
||||
end
|
||||
local item_info = temp-info.item(item_id)
|
||||
@@ -79,28 +71,28 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
local distribution = temp-disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
|
||||
if getn(distribution) > 0 then
|
||||
if aux_tooltip_disenchant_distribution then
|
||||
tooltip:AddLine('Disenchants into:', unpack(color.disenchant_distribution))
|
||||
tooltip:AddLine('Disenchants into:', color.tooltip.disenchant.distribution())
|
||||
sort(distribution, function(a,b) return a.probability > b.probability end)
|
||||
for _, event in distribution do
|
||||
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:' .. event.item_id, event.min_quantity, event.max_quantity), unpack(color.disenchant_distribution))
|
||||
for _, event in ipairs(distribution) do
|
||||
tooltip:AddLine(format(' %s%% %s (%s-%s)', event.probability * 100, info.display_name(event.item_id, true) or 'item:' .. event.item_id, event.min_quantity, event.max_quantity), color.tooltip.disenchant.distribution())
|
||||
end
|
||||
end
|
||||
if aux_tooltip_disenchant_value then
|
||||
local disenchant_value = disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||
tooltip:AddLine('Disenchant Value: ' .. (disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), unpack(color.disenchant_value))
|
||||
tooltip:AddLine('Disenchant Value: ' .. (disenchant_value and money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.tooltip.disenchant.value())
|
||||
end
|
||||
end
|
||||
end
|
||||
if aux_tooltip_vendor_buy then
|
||||
local _, price, limited = cache.merchant_info(item_id)
|
||||
if price then
|
||||
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), unpack(color.merchant))
|
||||
tooltip:AddLine('Vendor Buy ' .. (limited and '(limited): ' or ': ') .. money.to_string2(price * quantity), color.tooltip.merchant())
|
||||
end
|
||||
end
|
||||
if aux_tooltip_vendor_sell then
|
||||
local price = cache.merchant_info(item_id)
|
||||
if price ~= 0 then
|
||||
tooltip:AddLine('Vendor Sell: ' .. (price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), unpack(color.merchant))
|
||||
tooltip:AddLine('Vendor Sell: ' .. (price and money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.tooltip.merchant())
|
||||
end
|
||||
end
|
||||
local auctionable = not item_info or info.auctionable(temp-info.tooltip('link', item_info.itemstring), item_info.quality)
|
||||
@@ -108,11 +100,11 @@ function extend_tooltip(tooltip, link, quantity)
|
||||
local value = history.value(item_key)
|
||||
if auctionable then
|
||||
if aux_tooltip_value then
|
||||
tooltip:AddLine('Value: ' .. (value and money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), unpack(color.value))
|
||||
tooltip:AddLine('Value: ' .. (value and money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.tooltip.value())
|
||||
end
|
||||
if aux_tooltip_daily then
|
||||
local market_value = history.market_value(item_key)
|
||||
tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. auction_listing.percentage_historical(round(market_value / value * 100)) .. ')' or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), unpack(color.value))
|
||||
tooltip:AddLine('Today: ' .. (market_value and money.to_string2(market_value * quantity) .. ' (' .. auction_listing.percentage_historical(round(market_value / value * 100)) .. ')' or GRAY_FONT_COLOR_CODE .. '---' .. FONT_COLOR_CODE_CLOSE), color.tooltip.value())
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user