enhtooltip dependency removed

This commit is contained in:
Manuel Simon Hirsig
2016-03-16 22:33:40 +01:00
parent 338fa49bb1
commit 9e272210c6
3 changed files with 21 additions and 45 deletions
+1
View File
@@ -8,6 +8,7 @@ core.xml
gui.lua
control.xml
persistence.lua
tooltip.lua
util.lua
sort.lua
money.lua
+2 -39
View File
@@ -1,5 +1,5 @@
Aux = {
version = '2.6.17',
version = '2.6.18',
blizzard_ui_shown = false,
orig = {},
}
@@ -7,44 +7,6 @@ Aux = {
function Aux.on_load()
Aux.log('Aux v'..Aux.version..' loaded.')
tinsert(UISpecialFrames, 'AuxFrame')
LoadAddOn('EnhTooltip')
if IsAddOnLoaded('EnhTooltip') then
Stubby.RegisterFunctionHook('EnhTooltip.AddTooltip', 100, function(_ ,_ ,_ ,_ , link, _, count)
if EnhTooltip.LinkType(link) ~= 'item' then return end
local item_id, suffix_id = EnhTooltip.BreakLink(link)
if not Aux.static.item_info(item_id) then
return
end
local item_key = (item_id or 0)..':'..(suffix_id or 0)
local value = Aux.history.value(item_key)
local value_line = 'Value: '
value_line = value_line..(value and EnhTooltip.GetTextGSC(value) or '---')
local _, _, _, market_values = Aux.history.price_data(item_key)
if value and getn(market_values) < 5 then
value_line = value_line..' (?)'
end
EnhTooltip.AddLine(value_line, nil, true)
EnhTooltip.LineColor(0.1, 0.8, 0.5)
if aux_tooltip_daily then
local market_value = Aux.history.market_value(item_key)
local market_value_line = 'Today: '
market_value_line = market_value_line..(market_value and EnhTooltip.GetTextGSC(market_value)..' ('..Aux.auction_listing.percentage_historical(Aux.round(market_value / value * 100))..')' or '---')
EnhTooltip.AddLine(market_value_line, nil, true)
EnhTooltip.LineColor(0.1, 0.8, 0.5)
end
end)
end
do
local tab_group = Aux.gui.tab_group(AuxFrame, 'BOTTOM')
@@ -86,6 +48,7 @@ function Aux.on_load()
end
Aux.persistence.on_load()
Aux.tooltip.on_load()
Aux.search_frame.on_load()
Aux.post_frame.on_load()
Aux.auctions_frame.on_load()
+18 -6
View File
@@ -4,16 +4,28 @@ Aux.money = m
local GOLD_TEXT = '|cffffd70ag|r'
local SILVER_TEXT = '|cffc7c7cfs|r'
local COPPER_TEXT = '|cffeda55fc|r'
local COPPER_PER_SILVER = 100
local COPPER_PER_GOLD = 10000
do
local COPPER_PER_SILVER = 100
local COPPER_PER_GOLD = 10000
function m.to_GSC(money)
local gold = floor(money / COPPER_PER_GOLD)
local silver = floor(mod(money, COPPER_PER_GOLD) / COPPER_PER_SILVER)
local copper = mod(money, COPPER_PER_SILVER)
return gold, silver, copper
end
function m.from_GSC(gold, silver, copper)
return gold * COPPER_PER_GOLD + silver * COPPER_PER_SILVER + copper
end
end
function m.to_string(money, pad, trim, decimal_points, color, no_color)
local is_negative = money < 0
money = abs(money)
local gold = floor(money / COPPER_PER_GOLD)
local silver = floor(mod(money, COPPER_PER_GOLD) / COPPER_PER_SILVER)
local copper = mod(money, COPPER_PER_SILVER)
local gold, silver, copper = m.to_GSC(money)
-- rounding
if decimal_points then
@@ -79,7 +91,7 @@ function m.from_string(value)
value = gsub(value, '%d*%.?%d+c', '', 1)
if strfind(value, '%S') then return 0 end
return ((gold or 0) * COPPER_PER_GOLD) + ((silver or 0) * COPPER_PER_SILVER) + (copper or 0)
return m.from_GSC(gold or 0, silver or 0, copper or 0)
end
function m.format_number(num, pad, decimal_padding, color)