added price labels to the craft/tradeskill frames, changed some colors

This commit is contained in:
Manuel Simon Hirsig
2016-03-19 15:09:57 +01:00
parent 4eb4538a3f
commit 99ee2dac6c
4 changed files with 107 additions and 42 deletions
+62 -1
View File
@@ -74,9 +74,70 @@ function Aux.on_event()
end
function Aux.on_addon_loaded()
if string.lower(arg1) == 'blizzard_auctionui' then
if arg1 == 'Blizzard_AuctionUI' then
Aux.setup_hooks()
end
do
local function cost_label(cost)
local label = LIGHTYELLOW_FONT_COLOR_CODE..'(Total cost: '..FONT_COLOR_CODE_CLOSE
label = label..(cost and Aux.util.format_money(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
label = label..LIGHTYELLOW_FONT_COLOR_CODE..')'..FONT_COLOR_CODE_CLOSE
return label
end
if arg1 == 'Blizzard_CraftUI' then
Aux.hook('CraftFrame_SetSelection', function(...)
local results = {Aux.orig.CraftFrame_SetSelection(unpack(arg)) }
local id = GetCraftSelectionIndex()
local reagent_count = GetCraftNumReagents(id)
local total_cost = 0
for i=1,reagent_count do
local item_id, suffix_id = Aux.info.parse_hyperlink(GetCraftReagentItemLink(id, i))
local count = ({GetCraftReagentInfo(id, i)})[3]
local value = Aux.history.value(item_id..':'..suffix_id)
if not value then
total_cost = nil
break
else
total_cost = total_cost + value * count
end
end
CraftReagentLabel:SetText(SPELL_REAGENTS..' '..cost_label(total_cost))
return unpack(results)
end)
end
if arg1 == 'Blizzard_TradeSkillUI' then
Aux.hook('TradeSkillFrame_SetSelection', function(...)
local results = {Aux.orig.TradeSkillFrame_SetSelection(unpack(arg)) }
local id = GetTradeSkillSelectionIndex()
local reagent_count = GetTradeSkillNumReagents(id)
local total_cost = 0
for i=1,reagent_count do
local item_id, suffix_id = Aux.info.parse_hyperlink(GetTradeSkillReagentItemLink(id, i))
local count = ({GetTradeSkillReagentInfo(id, i)})[3]
local value = Aux.history.value(item_id..':'..suffix_id)
if not value then
total_cost = nil
break
else
total_cost = total_cost + value * count
end
end
TradeSkillReagentLabel:SetText(SPELL_REAGENTS..' '..cost_label(total_cost))
return unpack(results)
end)
end
end
end
do