bugfix
This commit is contained in:
+1
-88
@@ -3,12 +3,6 @@ module 'aux'
|
||||
local T = require 'T'
|
||||
|
||||
local info = require 'aux.util.info'
|
||||
local money = require 'aux.util.money'
|
||||
local history = require 'aux.core.history'
|
||||
local stack = require 'aux.core.stack'
|
||||
local post = require 'aux.core.post'
|
||||
local scan = require 'aux.core.scan'
|
||||
local search_tab = require 'aux.tabs.search'
|
||||
|
||||
_G.aux_scale = 1
|
||||
|
||||
@@ -49,10 +43,6 @@ do
|
||||
if event == 'ADDON_LOADED' then
|
||||
if arg1 == 'Blizzard_AuctionUI' then
|
||||
Blizzard_AuctionUI()
|
||||
elseif arg1 == 'Blizzard_CraftUI' then
|
||||
Blizzard_CraftUI()
|
||||
elseif arg1 == 'Blizzard_TradeSkillUI' then
|
||||
Blizzard_TradeSkillUI()
|
||||
end
|
||||
elseif event == 'VARIABLES_LOADED' then
|
||||
for _, f in pairs(handlers) do f() end
|
||||
@@ -117,7 +107,7 @@ end
|
||||
|
||||
do
|
||||
local index
|
||||
function get_active_tab() return tab_info[index] end
|
||||
function M.get_active_tab() return tab_info[index] end
|
||||
function on_tab_click(i)
|
||||
CloseDropDownMenus()
|
||||
do (index and get_active_tab().CLOSE or nop)() end
|
||||
@@ -260,83 +250,6 @@ function Blizzard_AuctionUI()
|
||||
hook 'GetOwnerAuctionItems' 'SetItemRef' 'UseContainerItem' 'AuctionFrameAuctions_OnEvent'
|
||||
end
|
||||
|
||||
do
|
||||
local function cost_label(cost)
|
||||
local label = LIGHTYELLOW_FONT_COLOR_CODE .. '(Total Cost: ' .. FONT_COLOR_CODE_CLOSE
|
||||
label = label .. (cost and money.to_string2(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
|
||||
local function hook_quest_item(f)
|
||||
f:SetScript('OnMouseUp', function()
|
||||
if arg1 == 'RightButton' then
|
||||
if get_active_tab() then
|
||||
set_tab(1)
|
||||
search_tab.set_filter(_G[this:GetName() .. 'Name']:GetText() .. '/exact')
|
||||
search_tab.execute(nil, false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
function Blizzard_CraftUI()
|
||||
hook('CraftFrame_SetSelection', T.vararg-function(arg)
|
||||
local ret = T.temp-T.list(orig.CraftFrame_SetSelection(unpack(arg)))
|
||||
local id = GetCraftSelectionIndex()
|
||||
local total_cost = 0
|
||||
for i = 1, GetCraftNumReagents(id) do
|
||||
local link = GetCraftReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = info.parse_link(link)
|
||||
local count = select(3, GetCraftReagentInfo(id, i))
|
||||
local _, price, limited = info.merchant_info(item_id)
|
||||
local value = price and not limited and price or 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(ret)
|
||||
end)
|
||||
for i = 1, 8 do
|
||||
hook_quest_item(_G['CraftReagent' .. i])
|
||||
end
|
||||
end
|
||||
function Blizzard_TradeSkillUI()
|
||||
hook('TradeSkillFrame_SetSelection', T.vararg-function(arg)
|
||||
local ret = T.temp-T.list(orig.TradeSkillFrame_SetSelection(unpack(arg)))
|
||||
local id = GetTradeSkillSelectionIndex()
|
||||
local total_cost = 0
|
||||
for i = 1, GetTradeSkillNumReagents(id) do
|
||||
local link = GetTradeSkillReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = info.parse_link(link)
|
||||
local count = select(3, GetTradeSkillReagentInfo(id, i))
|
||||
local _, price, limited = info.merchant_info(item_id)
|
||||
local value = price and not limited and price or 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(ret)
|
||||
end)
|
||||
for i = 1, 8 do
|
||||
hook_quest_item(_G['TradeSkillReagent' .. i])
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
AuctionFrameAuctions_OnEvent = T.vararg-function(arg)
|
||||
if AuctionFrameAuctions:IsVisible() then
|
||||
|
||||
@@ -28,6 +28,7 @@ util\scan.lua
|
||||
core\stack.lua
|
||||
core\post.lua
|
||||
core\tooltip.lua
|
||||
core\crafting.lua
|
||||
|
||||
gui\listing.lua
|
||||
gui\auction_listing.lua
|
||||
|
||||
@@ -0,0 +1,94 @@
|
||||
module 'aux.core.crafting'
|
||||
|
||||
include 'aux'
|
||||
|
||||
local T = require 'T'
|
||||
|
||||
local info = require 'aux.util.info'
|
||||
local money = require 'aux.util.money'
|
||||
local history = require 'aux.core.history'
|
||||
local search_tab = require 'aux.tabs.search'
|
||||
|
||||
function handle.LOAD()
|
||||
event_listener('ADDON_LOADED', function()
|
||||
(_M[arg1] or nop)()
|
||||
end)
|
||||
end
|
||||
|
||||
do
|
||||
local function cost_label(cost)
|
||||
local label = LIGHTYELLOW_FONT_COLOR_CODE .. '(Total Cost: ' .. FONT_COLOR_CODE_CLOSE
|
||||
label = label .. (cost and money.to_string2(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
|
||||
local function hook_quest_item(f)
|
||||
f:SetScript('OnMouseUp', function()
|
||||
if arg1 == 'RightButton' then
|
||||
if get_active_tab() then
|
||||
set_tab(1)
|
||||
search_tab.set_filter(_G[this:GetName() .. 'Name']:GetText() .. '/exact')
|
||||
search_tab.execute(nil, false)
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
function Blizzard_CraftUI()
|
||||
hook('CraftFrame_SetSelection', T.vararg-function(arg)
|
||||
local ret = T.temp-T.list(orig.CraftFrame_SetSelection(unpack(arg)))
|
||||
local id = GetCraftSelectionIndex()
|
||||
local total_cost = 0
|
||||
for i = 1, GetCraftNumReagents(id) do
|
||||
local link = GetCraftReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = info.parse_link(link)
|
||||
local count = select(3, GetCraftReagentInfo(id, i))
|
||||
local _, price, limited = info.merchant_info(item_id)
|
||||
local value = price and not limited and price or 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(ret)
|
||||
end)
|
||||
for i = 1, 8 do
|
||||
hook_quest_item(_G['CraftReagent' .. i])
|
||||
end
|
||||
end
|
||||
function Blizzard_TradeSkillUI()
|
||||
hook('TradeSkillFrame_SetSelection', T.vararg-function(arg)
|
||||
local ret = T.temp-T.list(orig.TradeSkillFrame_SetSelection(unpack(arg)))
|
||||
local id = GetTradeSkillSelectionIndex()
|
||||
local total_cost = 0
|
||||
for i = 1, GetTradeSkillNumReagents(id) do
|
||||
local link = GetTradeSkillReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = info.parse_link(link)
|
||||
local count = select(3, GetTradeSkillReagentInfo(id, i))
|
||||
local _, price, limited = info.merchant_info(item_id)
|
||||
local value = price and not limited and price or 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(ret)
|
||||
end)
|
||||
for i = 1, 8 do
|
||||
hook_quest_item(_G['TradeSkillReagent' .. i])
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user