bugfix and refactoring
This commit is contained in:
+2
-1
@@ -4,11 +4,12 @@
|
||||
## SavedVariables: aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_ignore_owner, aux_price_per_unit
|
||||
|
||||
module.lua
|
||||
init.lua
|
||||
core.xml
|
||||
core.lua
|
||||
control.lua
|
||||
gui.lua
|
||||
|
||||
|
||||
util\core.lua
|
||||
util\completion.lua
|
||||
util\persistence.lua
|
||||
|
||||
@@ -1,6 +1,48 @@
|
||||
local addon = aux_module()
|
||||
aux = tremove(addon, 1)
|
||||
local m, public, private = unpack(addon)
|
||||
local m, public, private = aux.module'aux'
|
||||
|
||||
public.version = '3.8.0'
|
||||
|
||||
public.bids_loaded = false
|
||||
public.current_owner_page = nil
|
||||
public.last_owner_page_requested = nil
|
||||
|
||||
do
|
||||
local mt = {
|
||||
__newindex = function(self, name, method)
|
||||
if strsub(name, 1, 2) == '__' then
|
||||
self._metatable[name] = method
|
||||
else
|
||||
self._methods[name] = method
|
||||
end
|
||||
end,
|
||||
__call = function(self, ...)
|
||||
if self._metatable.__index then
|
||||
setmetatable(self._methods, {__index=self._metatable.__index})
|
||||
self._metatable.__index = self._methods
|
||||
end
|
||||
|
||||
local object = setmetatable({}, self._metatable)
|
||||
self._constructor(object, unpack(arg))
|
||||
return object
|
||||
end,
|
||||
}
|
||||
function public.class(constructor)
|
||||
return setmetatable({_constructor=constructor, _methods={}, _metatable={}}, mt)
|
||||
end
|
||||
end
|
||||
|
||||
--public.dynamic_table = m.class(function(self, f)
|
||||
-- self._f = f
|
||||
--end)
|
||||
--function m.dynamic_table:__newindex(key, value)
|
||||
-- self._f()[key] = value
|
||||
--end
|
||||
--function m.dynamic_table:__index(key)
|
||||
-- return self._f()[key]
|
||||
--end
|
||||
--function m.dynamic_table:__call()
|
||||
-- return self._f()
|
||||
--end
|
||||
|
||||
do
|
||||
local mt = {
|
||||
@@ -33,77 +75,305 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
private.modules = {}
|
||||
function private.initialize_module(public_declarator)
|
||||
public_declarator.LOAD = nil
|
||||
end
|
||||
m.initialize_module(public)
|
||||
function public.module(name)
|
||||
local public_interface, private_interface, public_declarator, private_declarator = unpack(aux_module())
|
||||
m.initialize_module(public_declarator)
|
||||
tinsert(m.modules, public_interface)
|
||||
public[name] = public_interface
|
||||
return private_interface, public_declarator, private_declarator
|
||||
end
|
||||
|
||||
private.tabs = {}
|
||||
function public.tab(index, name)
|
||||
local tab = {m.module(name)}
|
||||
tab[2].ACTIVE = function()
|
||||
return m[name] == m.active_tab()
|
||||
end
|
||||
for _, handler in {'OPEN', 'CLOSE', 'CLICK_LINK', 'PICKUP_ITEM', 'USE_ITEM'} do
|
||||
tab[2][handler] = nil
|
||||
end
|
||||
m.tabs[index] = m[name]
|
||||
return unpack(tab)
|
||||
function public.tab(index, title, name)
|
||||
local tab = {title=title, name=name, module={m.module(name)}}
|
||||
tab.module[2].ACTIVE = function()
|
||||
return tab == m.active_tab()
|
||||
end
|
||||
for _, handler in {'OPEN', 'CLOSE', 'CLICK_LINK', 'PICKUP_ITEM', 'USE_ITEM'} do
|
||||
tab.module[3][handler] = nil
|
||||
end
|
||||
m.tabs[index] = tab
|
||||
return unpack(tab.module)
|
||||
end
|
||||
do
|
||||
local active_tab_index
|
||||
private.active_tab = m.dynamic_table(function()
|
||||
return m.tabs[active_tab_index]
|
||||
end)
|
||||
function private.on_tab_click(index)
|
||||
if m.active_tab() then
|
||||
m.active_tab().CLOSE()
|
||||
end
|
||||
active_tab_index = index
|
||||
if m.active_tab() then
|
||||
m.active_tab().OPEN()
|
||||
end
|
||||
local active_tab_index
|
||||
private.active_tab = m.dynamic_table(function()
|
||||
return m.tabs[active_tab_index]
|
||||
end)
|
||||
function private.on_tab_click(index)
|
||||
if active_tab_index then
|
||||
aux.call(m.active_tab.module[1].CLOSE)
|
||||
end
|
||||
active_tab_index = index
|
||||
if active_tab_index then
|
||||
aux.call(m.active_tab.module[1].OPEN)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function public.VARIABLES_LOADED()
|
||||
m.log('v'..m.version..' loaded.')
|
||||
|
||||
aux.gui.set_window_style(AuxFrame)
|
||||
tinsert(UISpecialFrames, 'AuxFrame')
|
||||
|
||||
do
|
||||
local tab_group = m.gui.tab_group(AuxFrame, 'DOWN')
|
||||
for _, tab in m.tabs do
|
||||
tab_group:create_tab(tab.title)
|
||||
end
|
||||
tab_group.on_select = m.on_tab_click
|
||||
public.tab_group = tab_group
|
||||
end
|
||||
|
||||
do
|
||||
local btn = m.gui.button(AuxFrame, 16)
|
||||
btn:SetPoint('BOTTOMRIGHT', -6, 6)
|
||||
btn:SetWidth(65)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Close')
|
||||
btn:SetScript('OnClick', m._(HideUIPanel, AuxFrame))
|
||||
public.close_button = btn
|
||||
end
|
||||
|
||||
do
|
||||
local btn = m.gui.button(AuxFrame, 16)
|
||||
btn:SetPoint('RIGHT', m.close_button, 'LEFT' , -5, 0)
|
||||
btn:SetWidth(65)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Default UI')
|
||||
btn:SetScript('OnClick',function()
|
||||
if AuctionFrame:IsVisible() then
|
||||
HideUIPanel(AuctionFrame)
|
||||
else
|
||||
ShowUIPanel(AuctionFrame)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
function private.AUCTION_HOUSE_SHOW()
|
||||
if AuctionFrame:IsVisible() then
|
||||
AuctionFrame:Hide()
|
||||
end
|
||||
AuxFrame:Show()
|
||||
m.tab_group:set_tab(1)
|
||||
end
|
||||
|
||||
function private.AUCTION_HOUSE_CLOSED()
|
||||
m.bids_loaded = false
|
||||
m.current_owner_page = nil
|
||||
m.post.stop()
|
||||
m.stack.stop()
|
||||
m.scan.abort()
|
||||
m.tab_group:set_tab()
|
||||
AuxFrame:Hide()
|
||||
end
|
||||
|
||||
function private.AUCTION_BIDDER_LIST_UPDATE()
|
||||
m.bids_loaded = true
|
||||
end
|
||||
|
||||
function private.AUCTION_OWNED_LIST_UPDATE()
|
||||
m.current_owner_page = m.last_owner_page_requested or 0
|
||||
end
|
||||
|
||||
function m.ADDON_LOADED.Blizzard_AuctionUI()
|
||||
AuctionFrame:UnregisterEvent('AUCTION_HOUSE_SHOW')
|
||||
AuctionFrame:SetScript('OnHide', nil)
|
||||
|
||||
m.hook('ShowUIPanel', function(...)
|
||||
if arg[1] == AuctionFrame then
|
||||
return AuctionFrame:Show()
|
||||
end
|
||||
return m.orig.ShowUIPanel(unpack(arg))
|
||||
end)
|
||||
|
||||
m.hook('GetOwnerAuctionItems', m.GetOwnerAuctionItems)
|
||||
m.hook('PickupContainerItem', m.PickupContainerItem)
|
||||
m.hook('SetItemRef', m.SetItemRef)
|
||||
m.hook('UseContainerItem', m.UseContainerItem)
|
||||
m.hook('AuctionFrameAuctions_OnEvent', m.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 m.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
|
||||
|
||||
function m.ADDON_LOADED.Blizzard_CraftUI()
|
||||
m.hook('CraftFrame_SetSelection', function(...)
|
||||
local results = {m.orig.CraftFrame_SetSelection(unpack(arg)) }
|
||||
|
||||
local id = GetCraftSelectionIndex()
|
||||
local reagent_count = GetCraftNumReagents(id)
|
||||
|
||||
local total_cost = 0
|
||||
for i=1,reagent_count do
|
||||
local link = GetCraftReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = m.info.parse_hyperlink(link)
|
||||
local count = ({GetCraftReagentInfo(id, i)})[3]
|
||||
local _, price, limited = m.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or m.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
|
||||
|
||||
function m.ADDON_LOADED.Blizzard_TradeSkillUI()
|
||||
m.hook('TradeSkillFrame_SetSelection', function(...)
|
||||
local results = {m.orig.TradeSkillFrame_SetSelection(unpack(arg)) }
|
||||
|
||||
local id = GetTradeSkillSelectionIndex()
|
||||
local reagent_count = GetTradeSkillNumReagents(id)
|
||||
|
||||
local total_cost = 0
|
||||
for i=1,reagent_count do
|
||||
local link = GetTradeSkillReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = m.info.parse_hyperlink(link)
|
||||
local count = ({GetTradeSkillReagentInfo(id, i)})[3]
|
||||
local _, price, limited = m.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or m.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
|
||||
|
||||
public.orig = {}
|
||||
function public.hook(name, handler, object)
|
||||
local orig
|
||||
if object then
|
||||
m.orig[object] = m.orig[object] or {}
|
||||
orig = m.orig[object]
|
||||
else
|
||||
object = object or getfenv(0)
|
||||
orig = m.orig
|
||||
end
|
||||
|
||||
if orig[name] then
|
||||
error('"'..name..'" is already hooked.')
|
||||
end
|
||||
|
||||
orig[name] = object[name]
|
||||
object[name] = handler
|
||||
end
|
||||
|
||||
function private.GetOwnerAuctionItems(...)
|
||||
local page = arg[1]
|
||||
m.last_owner_page_requested = page
|
||||
return m.orig.GetOwnerAuctionItems(unpack(arg))
|
||||
end
|
||||
|
||||
function private.AuctionFrameAuctions_OnEvent(...)
|
||||
if AuctionFrameAuctions:IsVisible() then
|
||||
return m.orig.AuctionFrameAuctions_OnEvent(unpack(arg))
|
||||
end
|
||||
end
|
||||
|
||||
function private.SetItemRef(...)
|
||||
if arg[3] ~= 'RightButton' or not m.index(m.active_tab.module[1], 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then
|
||||
return m.orig.SetItemRef(unpack(arg))
|
||||
end
|
||||
local item_info = m.info.item(tonumber(({strfind(arg[1], '^item:(%d+)')})[3]))
|
||||
if item_info then
|
||||
return m.active_tab.module[1].CLICK_LINK(item_info)
|
||||
end
|
||||
end
|
||||
|
||||
function private.PickupContainerItem(...)
|
||||
if m.modified() or not m.index(m.active_tab.module[1], 'PICKUP_ITEM') then
|
||||
return m.orig.PickupContainerItem(unpack(arg))
|
||||
end
|
||||
local item_info = m.info.container_item(arg[1], arg[2])
|
||||
if item_info then
|
||||
return m.active_tab.module[1].PICKUP_ITEM(item_info)
|
||||
end
|
||||
end
|
||||
|
||||
function private.UseContainerItem(...)
|
||||
if m.modified() or not m.index(m.active_tab.module[1], 'USE_ITEM') then
|
||||
return m.orig.UseContainerItem(unpack(arg))
|
||||
end
|
||||
local item_info = m.info.container_item(arg[1], arg[2])
|
||||
if item_info then
|
||||
return m.active_tab.module[1].USE_ITEM(item_info)
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local x = 0
|
||||
function public.id()
|
||||
x = x + 1
|
||||
return x
|
||||
local locked
|
||||
|
||||
function public.bid_in_progress()
|
||||
return locked
|
||||
end
|
||||
|
||||
function public.place_bid(type, index, amount, on_success)
|
||||
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
|
||||
local money = GetMoney()
|
||||
PlaceAuctionBid(type, index, amount)
|
||||
if money >= amount then
|
||||
locked = true
|
||||
|
||||
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_BID_PLACED then
|
||||
aux.call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local mt = {
|
||||
__newindex = function(self, name, method)
|
||||
if strsub(name, 1, 2) == '__' then
|
||||
self._metatable[name] = method
|
||||
else
|
||||
self._methods[name] = method
|
||||
local locked
|
||||
|
||||
function public.cancel_in_progress()
|
||||
return locked
|
||||
end
|
||||
|
||||
function public.cancel_auction(index, on_success)
|
||||
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
|
||||
locked = true
|
||||
|
||||
CancelAuction(index)
|
||||
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_REMOVED then
|
||||
aux.call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end,
|
||||
__call = function(self, ...)
|
||||
setmetatable(self._methods, self._metatable.__index)
|
||||
self._metatable.__index =self._methods
|
||||
local object = setmetatable({}, self._metatable)
|
||||
for name, method in self._methods do
|
||||
object[name] = method
|
||||
end
|
||||
self._constructor(object, unpack(arg))
|
||||
return object
|
||||
end,
|
||||
}
|
||||
function public.class(constructor)
|
||||
return setmetatable({_constructor=constructor, _methods={}, _metatable={}}, mt)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -137,9 +407,9 @@ do
|
||||
end
|
||||
|
||||
function public.call(f, ...)
|
||||
if f then
|
||||
return f(unpack(arg))
|
||||
end
|
||||
if f then
|
||||
return f(unpack(arg))
|
||||
end
|
||||
end
|
||||
|
||||
function public.index(t, ...)
|
||||
@@ -151,309 +421,22 @@ function public.index(t, ...)
|
||||
return t
|
||||
end
|
||||
|
||||
function public.on_load()
|
||||
public.version = '3.8.0'
|
||||
public.bids_loaded = false
|
||||
public.current_owner_page = nil
|
||||
public.last_owner_page_requested = nil
|
||||
private.auction_frame_loaded = nil
|
||||
|
||||
m.log('aux v'..m.version..' loaded.')
|
||||
|
||||
aux.gui.set_window_style(AuxFrame)
|
||||
tinsert(UISpecialFrames, 'AuxFrame')
|
||||
|
||||
do
|
||||
local tab_group = m.gui.tab_group(AuxFrame, 'DOWN')
|
||||
tab_group:create_tab('Search')
|
||||
tab_group:create_tab('Post')
|
||||
tab_group:create_tab('Auctions')
|
||||
tab_group:create_tab('Bids')
|
||||
tab_group.on_select = m.on_tab_click
|
||||
public.tab_group = tab_group
|
||||
end
|
||||
|
||||
do
|
||||
local btn = m.gui.button(AuxFrame, 16)
|
||||
btn:SetPoint('BOTTOMRIGHT', -6, 6)
|
||||
btn:SetWidth(65)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Close')
|
||||
btn:SetScript('OnClick', m._(HideUIPanel, AuxFrame))
|
||||
public.close_button = btn
|
||||
end
|
||||
|
||||
do
|
||||
local btn = m.gui.button(AuxFrame, 16)
|
||||
btn:SetPoint('RIGHT', m.close_button, 'LEFT' , -5, 0)
|
||||
btn:SetWidth(65)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Default UI')
|
||||
btn:SetScript('OnClick',function()
|
||||
if AuctionFrame:IsVisible() then
|
||||
HideUIPanel(AuctionFrame)
|
||||
else
|
||||
ShowUIPanel(AuctionFrame)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
for _, module in m.modules do
|
||||
m.call(module.LOAD)
|
||||
end
|
||||
end
|
||||
|
||||
function public.on_event()
|
||||
if event == 'VARIABLES_LOADED' then
|
||||
m.on_load()
|
||||
elseif event == 'ADDON_LOADED' then
|
||||
m.call(m.on_addon_load[arg1])
|
||||
elseif event == 'AUCTION_HOUSE_SHOW' then
|
||||
m.on_auction_house_show()
|
||||
elseif event == 'AUCTION_HOUSE_CLOSED' then
|
||||
m.on_auction_house_closed()
|
||||
m.bids_loaded = false
|
||||
m.current_owner_page = nil
|
||||
elseif event == 'AUCTION_BIDDER_LIST_UPDATE' then
|
||||
m.bids_loaded = true
|
||||
elseif event == 'AUCTION_OWNED_LIST_UPDATE' then
|
||||
m.current_owner_page = m.last_owner_page_requested or 0
|
||||
end
|
||||
end
|
||||
|
||||
private.on_addon_load = {}
|
||||
function m.on_addon_load.Blizzard_AuctionUI()
|
||||
|
||||
AuctionFrame:UnregisterEvent('AUCTION_HOUSE_SHOW')
|
||||
AuctionFrame:SetScript('OnHide', nil)
|
||||
|
||||
m.hook('ShowUIPanel', function(...)
|
||||
if arg[1] == AuctionFrame then
|
||||
return AuctionFrame:Show()
|
||||
end
|
||||
return m.orig.ShowUIPanel(unpack(arg))
|
||||
end)
|
||||
|
||||
m.hook('GetOwnerAuctionItems', m.GetOwnerAuctionItems)
|
||||
m.hook('PickupContainerItem', m.PickupContainerItem)
|
||||
m.hook('SetItemRef', m.SetItemRef)
|
||||
m.hook('UseContainerItem', m.UseContainerItem)
|
||||
m.hook('AuctionFrameAuctions_OnEvent', m.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 m.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
|
||||
|
||||
function m.on_addon_load.Blizzard_CraftUI()
|
||||
m.hook('CraftFrame_SetSelection', function(...)
|
||||
local results = {m.orig.CraftFrame_SetSelection(unpack(arg)) }
|
||||
|
||||
local id = GetCraftSelectionIndex()
|
||||
local reagent_count = GetCraftNumReagents(id)
|
||||
|
||||
local total_cost = 0
|
||||
for i=1,reagent_count do
|
||||
local link = GetCraftReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = m.info.parse_hyperlink(link)
|
||||
local count = ({GetCraftReagentInfo(id, i)})[3]
|
||||
local _, price, limited = m.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or m.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
|
||||
|
||||
function m.on_addon_load.Blizzard_TradeSkillUI()
|
||||
m.hook('TradeSkillFrame_SetSelection', function(...)
|
||||
local results = {m.orig.TradeSkillFrame_SetSelection(unpack(arg)) }
|
||||
|
||||
local id = GetTradeSkillSelectionIndex()
|
||||
local reagent_count = GetTradeSkillNumReagents(id)
|
||||
|
||||
local total_cost = 0
|
||||
for i=1,reagent_count do
|
||||
local link = GetTradeSkillReagentItemLink(id, i)
|
||||
if not link then
|
||||
total_cost = nil
|
||||
break
|
||||
end
|
||||
local item_id, suffix_id = m.info.parse_hyperlink(link)
|
||||
local count = ({GetTradeSkillReagentInfo(id, i)})[3]
|
||||
local _, price, limited = m.cache.merchant_info(item_id)
|
||||
local value = price and not limited and price or m.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
|
||||
public.huge = 2^100000
|
||||
|
||||
do
|
||||
local locked
|
||||
|
||||
function public.bid_in_progress()
|
||||
return locked
|
||||
end
|
||||
|
||||
function public.place_bid(type, index, amount, on_success)
|
||||
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
|
||||
local money = GetMoney()
|
||||
PlaceAuctionBid(type, index, amount)
|
||||
if money >= amount then
|
||||
locked = true
|
||||
|
||||
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_BID_PLACED then
|
||||
aux.call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
do
|
||||
local locked
|
||||
|
||||
function public.cancel_in_progress()
|
||||
return locked
|
||||
end
|
||||
|
||||
function public.cancel_auction(index, on_success)
|
||||
|
||||
if locked then
|
||||
return
|
||||
end
|
||||
|
||||
locked = true
|
||||
|
||||
CancelAuction(index)
|
||||
m.control.event_listener('CHAT_MSG_SYSTEM', function(kill)
|
||||
if arg1 == ERR_AUCTION_REMOVED then
|
||||
aux.call(on_success)
|
||||
locked = false
|
||||
kill()
|
||||
end
|
||||
end)
|
||||
end
|
||||
local x = 0
|
||||
function public.id()
|
||||
x = x + 1
|
||||
return x
|
||||
end
|
||||
end
|
||||
|
||||
function public.log(...)
|
||||
local msg = '[aux]'
|
||||
for i=1,arg.n do
|
||||
msg = msg..' '..tostring(arg[i])
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(msg, 1, 1, 0)
|
||||
end
|
||||
|
||||
function private.GetOwnerAuctionItems(...)
|
||||
local page = arg[1]
|
||||
m.last_owner_page_requested = page
|
||||
return m.orig.GetOwnerAuctionItems(unpack(arg))
|
||||
end
|
||||
|
||||
function private.AuctionFrameAuctions_OnEvent(...)
|
||||
if AuctionFrameAuctions:IsVisible() then
|
||||
return m.orig.AuctionFrameAuctions_OnEvent(unpack(arg))
|
||||
end
|
||||
end
|
||||
|
||||
function public.neutral_faction()
|
||||
return not UnitFactionGroup('npc')
|
||||
end
|
||||
|
||||
function private.on_auction_house_show()
|
||||
if AuctionFrame:IsVisible() then
|
||||
AuctionFrame:Hide()
|
||||
end
|
||||
AuxFrame:Show()
|
||||
m.tab_group:set_tab(1)
|
||||
end
|
||||
|
||||
function private.on_auction_house_closed()
|
||||
m.post.stop()
|
||||
m.stack.stop()
|
||||
m.scan.abort()
|
||||
m.tab_group:set_tab()
|
||||
AuxFrame:Hide()
|
||||
end
|
||||
|
||||
function public.min_bid_increment(current_bid)
|
||||
return max(1, floor(current_bid / 100) * 5)
|
||||
end
|
||||
|
||||
function public.price_level_color(pct)
|
||||
if pct > 135 then
|
||||
return 1.0,0.0,0.0 -- red
|
||||
elseif pct > 110 then
|
||||
return 1.0,0.6,0.1 -- orange
|
||||
elseif pct > 80 then
|
||||
return 1.0,1.0,0.0 -- yellow
|
||||
elseif pct > 50 then
|
||||
return 0.1,1.0,0.1 -- green
|
||||
else
|
||||
return 0.2,0.6,1.0 -- blue
|
||||
end
|
||||
end
|
||||
|
||||
function private.SetItemRef(...)
|
||||
if not arg[3] == 'RightButton' or not m.active_tab.CLICK_LINK or not m.active_tab() or not strfind(arg[1], '^item:%d+') then
|
||||
return m.orig.SetItemRef(unpack(arg))
|
||||
local msg = '[aux]'
|
||||
for i=1,arg.n do
|
||||
msg = msg..' '..tostring(arg[i])
|
||||
end
|
||||
local item_info = m.info.item(tonumber(({strfind(arg[1], '^item:(%d+)')})[3]))
|
||||
if item_info then
|
||||
return m.active_tab.CLICK_LINK(item_info)
|
||||
end
|
||||
end
|
||||
|
||||
function private.PickupContainerItem(...)
|
||||
if IsShiftKeyDown() or IsControlKeyDown() or IsAltKeyDown() or not m.active_tab() or not m.active_tab.PICKUP_ITEM then
|
||||
return m.orig.PickupContainerItem(unpack(arg))
|
||||
end
|
||||
local item_info = m.info.container_item(arg[1], arg[2])
|
||||
if item_info then
|
||||
return m.active_tab.PICKUP_ITEM(item_info)
|
||||
end
|
||||
end
|
||||
|
||||
function private.UseContainerItem(...)
|
||||
if IsShiftKeyDown() or IsControlKeyDown() or IsAltKeyDown() or not m.active_tab() or not m.active_tab.USE_ITEM then
|
||||
return m.orig.UseContainerItem(unpack(arg))
|
||||
end
|
||||
local item_info = m.info.container_item(arg[1], arg[2])
|
||||
if item_info then
|
||||
return m.active_tab.USE_ITEM(item_info)
|
||||
end
|
||||
DEFAULT_CHAT_FRAME:AddMessage(LIGHTYELLOW_FONT_COLOR_CODE..msg)
|
||||
end
|
||||
|
||||
function public.is_player(name, current)
|
||||
@@ -461,29 +444,28 @@ function public.is_player(name, current)
|
||||
return not current and aux.index(aux_characters, realm, name) or UnitName('player') == name
|
||||
end
|
||||
|
||||
function public.unmodified()
|
||||
return not IsShiftKeyDown() and not IsControlKeyDown() and not IsAltKeyDown()
|
||||
function public.modified()
|
||||
return IsShiftKeyDown() or IsControlKeyDown() or IsAltKeyDown()
|
||||
end
|
||||
|
||||
public.orig = {}
|
||||
function public.hook(name, handler, object)
|
||||
local orig
|
||||
if object then
|
||||
m.orig[object] = m.orig[object] or {}
|
||||
orig = m.orig[object]
|
||||
else
|
||||
object = object or getfenv(0)
|
||||
orig = m.orig
|
||||
end
|
||||
|
||||
if orig[name] then
|
||||
error('"'..name..'" is already hooked.')
|
||||
end
|
||||
|
||||
orig[name] = object[name]
|
||||
object[name] = handler
|
||||
function public.neutral_faction()
|
||||
return not UnitFactionGroup('npc')
|
||||
end
|
||||
|
||||
public.huge = 2^100000
|
||||
function public.min_bid_increment(current_bid)
|
||||
return max(1, floor(current_bid / 100) * 5)
|
||||
end
|
||||
|
||||
public.null = {}
|
||||
function public.price_level_color(pct)
|
||||
if pct > 135 then
|
||||
return 1.0,0.0,0.0 -- red
|
||||
elseif pct > 110 then
|
||||
return 1.0,0.6,0.1 -- orange
|
||||
elseif pct > 80 then
|
||||
return 1.0,1.0,0.0 -- yellow
|
||||
elseif pct > 50 then
|
||||
return 0.1,1.0,0.1 -- green
|
||||
else
|
||||
return 0.2,0.6,1.0 -- blue
|
||||
end
|
||||
end
|
||||
@@ -1,23 +1,4 @@
|
||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||
|
||||
<Script file="core.lua"/>
|
||||
|
||||
<Frame>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
this:RegisterEvent('VARIABLES_LOADED')
|
||||
this:RegisterEvent('ADDON_LOADED')
|
||||
this:RegisterEvent('AUCTION_HOUSE_SHOW')
|
||||
this:RegisterEvent('AUCTION_HOUSE_CLOSED')
|
||||
this:RegisterEvent('AUCTION_BIDDER_LIST_UPDATE')
|
||||
this:RegisterEvent('AUCTION_OWNED_LIST_UPDATE')
|
||||
</OnLoad>
|
||||
<OnEvent>
|
||||
aux:on_event()
|
||||
</OnEvent>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
|
||||
<Frame name="AuxFrame" toplevel="true" movable="true" enableMouse="true" hidden="true" parent="UIParent" clampedToScreen="true">
|
||||
<Size><AbsDimension x="768" y="447"/></Size>
|
||||
<Anchors>
|
||||
|
||||
@@ -652,7 +652,7 @@ local methods = {
|
||||
DressUpItemLink(this.row.data.record.hyperlink)
|
||||
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
||||
elseif aux.unmodified() and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
elseif not aux.modified() and button == 'RightButton' then -- TODO not when alt (how?)
|
||||
aux.tab_group:set_tab(1)
|
||||
aux.search_tab.set_filter(strlower(aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||
aux.search_tab.execute(nil, false)
|
||||
|
||||
@@ -1,15 +1,7 @@
|
||||
local m, public, private = aux.tab(3, 'auctions_tab')
|
||||
local m, public, private = aux.tab(3, 'Auctions', 'auctions_tab')
|
||||
|
||||
private.auction_records = nil
|
||||
|
||||
function public.FRAMES(f)
|
||||
private.create_frames = f
|
||||
end
|
||||
|
||||
function m.LOAD()
|
||||
m.create_frames(m, public, private)
|
||||
end
|
||||
|
||||
function m.OPEN()
|
||||
m.frame:Show()
|
||||
m.scan_auctions()
|
||||
|
||||
+50
-50
@@ -1,53 +1,53 @@
|
||||
aux.auctions_tab.FRAMES(function(m, public, private)
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
m.frame:SetAllPoints()
|
||||
m.frame:SetScript('OnUpdate', m.on_update)
|
||||
m.frame:Hide()
|
||||
local m, public, private = aux.module'auctions_tab'
|
||||
|
||||
m.frame.listing = aux.gui.panel(m.frame)
|
||||
m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
|
||||
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
|
||||
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config)
|
||||
m.listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
m.listing:Reset()
|
||||
m.listing:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record and m.cancel_button:IsEnabled() then
|
||||
m.cancel_button:Click()
|
||||
end
|
||||
end)
|
||||
m.listing:SetHandler('OnSelectionChanged', function(rt, datum)
|
||||
if not datum then return end
|
||||
m.find_auction(datum.record)
|
||||
end)
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
m.frame:SetAllPoints()
|
||||
m.frame:SetScript('OnUpdate', m.on_update)
|
||||
m.frame:Hide()
|
||||
|
||||
do
|
||||
local status_bar = aux.gui.status_bar(m.frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
m.frame.listing = aux.gui.panel(m.frame)
|
||||
m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
|
||||
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
|
||||
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config)
|
||||
m.listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
m.listing:Reset()
|
||||
m.listing:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record and m.cancel_button:IsEnabled() then
|
||||
m.cancel_button:Click()
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Cancel')
|
||||
btn:Disable()
|
||||
private.cancel_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
m.scan_auctions()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
m.listing:SetHandler('OnSelectionChanged', function(rt, datum)
|
||||
if not datum then return end
|
||||
m.find_auction(datum.record)
|
||||
end)
|
||||
|
||||
do
|
||||
local status_bar = aux.gui.status_bar(m.frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Cancel')
|
||||
btn:Disable()
|
||||
private.cancel_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
m.scan_auctions()
|
||||
end)
|
||||
end
|
||||
+1
-9
@@ -1,15 +1,7 @@
|
||||
local m, public, private = aux.tab(4, 'bids_tab')
|
||||
local m, public, private = aux.tab(4, 'Bids', 'bids_tab')
|
||||
|
||||
private.auction_records = nil
|
||||
|
||||
function public.FRAMES(f)
|
||||
private.create_frames = f
|
||||
end
|
||||
|
||||
function m.LOAD()
|
||||
m.create_frames(m, public, private)
|
||||
end
|
||||
|
||||
function m.OPEN()
|
||||
m.frame:Show()
|
||||
m.scan_bids()
|
||||
|
||||
+62
-62
@@ -1,66 +1,66 @@
|
||||
aux.bids_tab.FRAMES(function(m, public, private)
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
m.frame:SetAllPoints()
|
||||
m.frame:SetScript('OnUpdate', m.on_update)
|
||||
m.frame:Hide()
|
||||
local m, public, private = aux.module'bids_tab'
|
||||
|
||||
m.frame.listing = aux.gui.panel(m.frame)
|
||||
m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
|
||||
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
|
||||
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
m.frame:SetAllPoints()
|
||||
m.frame:SetScript('OnUpdate', m.on_update)
|
||||
m.frame:Hide()
|
||||
|
||||
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config)
|
||||
m.listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
m.listing:Reset()
|
||||
m.listing:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record then
|
||||
if button == 'LeftButton' and m.buyout_button:IsEnabled() then
|
||||
m.buyout_button:Click()
|
||||
elseif button == 'RightButton' and m.bid_button:IsEnabled() then
|
||||
m.bid_button:Click()
|
||||
end
|
||||
m.frame.listing = aux.gui.panel(m.frame)
|
||||
m.frame.listing:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
|
||||
m.frame.listing:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
|
||||
m.frame.listing:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config)
|
||||
m.listing:SetSort(1,2,3,4,5,6,7,8)
|
||||
m.listing:Reset()
|
||||
m.listing:SetHandler('OnCellClick', function(cell, button)
|
||||
if IsAltKeyDown() and m.listing:GetSelection().record == cell.row.data.record then
|
||||
if button == 'LeftButton' and m.buyout_button:IsEnabled() then
|
||||
m.buyout_button:Click()
|
||||
elseif button == 'RightButton' and m.bid_button:IsEnabled() then
|
||||
m.bid_button:Click()
|
||||
end
|
||||
end)
|
||||
m.listing:SetHandler('OnSelectionChanged', function(rt, datum)
|
||||
if not datum then return end
|
||||
m.find_auction(datum.record)
|
||||
end)
|
||||
end
|
||||
end)
|
||||
m.listing:SetHandler('OnSelectionChanged', function(rt, datum)
|
||||
if not datum then return end
|
||||
m.find_auction(datum.record)
|
||||
end)
|
||||
|
||||
do
|
||||
local status_bar = aux.gui.status_bar(m.frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 0)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Bid')
|
||||
btn:Disable()
|
||||
private.bid_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Buyout')
|
||||
btn:Disable()
|
||||
private.buyout_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
m.scan_bids()
|
||||
end)
|
||||
end
|
||||
end)
|
||||
do
|
||||
local status_bar = aux.gui.status_bar(m.frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 0)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Bid')
|
||||
btn:Disable()
|
||||
private.bid_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.bid_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Buyout')
|
||||
btn:Disable()
|
||||
private.buyout_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.buyout_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
m.scan_bids()
|
||||
end)
|
||||
end
|
||||
+2
-10
@@ -1,4 +1,4 @@
|
||||
local m, public, private = aux.tab(2, 'post_tab')
|
||||
local m, public, private = aux.tab(2, 'Post', 'post_tab')
|
||||
|
||||
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
@@ -9,14 +9,6 @@ private.scan_id = 0
|
||||
private.selected_item = nil
|
||||
private.refresh = nil
|
||||
|
||||
function public.FRAMES(f)
|
||||
private.create_frames = f
|
||||
end
|
||||
|
||||
function m.LOAD()
|
||||
m.create_frames(m, public, private)
|
||||
end
|
||||
|
||||
function m.OPEN()
|
||||
m.frame:Show()
|
||||
|
||||
@@ -236,7 +228,7 @@ function private.post_auctions()
|
||||
stack_count,
|
||||
function(posted)
|
||||
local new_auction_record
|
||||
for i = 1, posted do
|
||||
for i=1,posted do
|
||||
new_auction_record = m.record_auction(key, stack_size, unit_start_price, unit_buyout_price, duration_code, UnitName('player'))
|
||||
end
|
||||
|
||||
|
||||
+322
-322
@@ -1,341 +1,341 @@
|
||||
aux.post_tab.FRAMES(function(m, public, private)
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
m.frame:SetAllPoints()
|
||||
m.frame:SetScript('OnUpdate', m.on_update)
|
||||
m.frame:Hide()
|
||||
local m, public, private = aux.module'post_tab'
|
||||
|
||||
m.frame.content = CreateFrame('Frame', nil, m.frame)
|
||||
m.frame.content:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
|
||||
m.frame.content:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
|
||||
m.frame.content:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
|
||||
private.frame = CreateFrame('Frame', nil, AuxFrame)
|
||||
m.frame:SetAllPoints()
|
||||
m.frame:SetScript('OnUpdate', m.on_update)
|
||||
m.frame:Hide()
|
||||
|
||||
m.frame.inventory = aux.gui.panel(m.frame.content)
|
||||
m.frame.inventory:SetWidth(212)
|
||||
m.frame.inventory:SetPoint('TOPLEFT', 0, 0)
|
||||
m.frame.inventory:SetPoint('BOTTOMLEFT', 0, 0)
|
||||
m.frame.content = CreateFrame('Frame', nil, m.frame)
|
||||
m.frame.content:SetPoint('TOP', AuxFrame, 'TOP', 0, -8)
|
||||
m.frame.content:SetPoint('BOTTOMLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, 0)
|
||||
m.frame.content:SetPoint('BOTTOMRIGHT', AuxFrameContent, 'BOTTOMRIGHT', 0, 0)
|
||||
|
||||
m.frame.parameters = aux.gui.panel(m.frame.content)
|
||||
m.frame.parameters:SetHeight(173)
|
||||
m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0)
|
||||
m.frame.parameters:SetPoint('TOPRIGHT', 0, 0)
|
||||
m.frame.inventory = aux.gui.panel(m.frame.content)
|
||||
m.frame.inventory:SetWidth(212)
|
||||
m.frame.inventory:SetPoint('TOPLEFT', 0, 0)
|
||||
m.frame.inventory:SetPoint('BOTTOMLEFT', 0, 0)
|
||||
|
||||
m.frame.auctions = aux.gui.panel(m.frame.content)
|
||||
m.frame.auctions:SetHeight(228)
|
||||
m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
|
||||
m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||
m.frame.parameters = aux.gui.panel(m.frame.content)
|
||||
m.frame.parameters:SetHeight(173)
|
||||
m.frame.parameters:SetPoint('TOPLEFT', m.frame.inventory, 'TOPRIGHT', 2.5, 0)
|
||||
m.frame.parameters:SetPoint('TOPRIGHT', 0, 0)
|
||||
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(m.frame.inventory)
|
||||
checkbox:SetPoint('TOPLEFT', 49, -16)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
m.refresh = true
|
||||
end)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText('Show hidden items')
|
||||
private.show_hidden_checkbox = checkbox
|
||||
end
|
||||
m.frame.auctions = aux.gui.panel(m.frame.content)
|
||||
m.frame.auctions:SetHeight(228)
|
||||
m.frame.auctions:SetPoint('BOTTOMLEFT', m.frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
|
||||
m.frame.auctions:SetPoint('BOTTOMRIGHT', 0, 0)
|
||||
|
||||
aux.gui.horizontal_line(m.frame.inventory, -48)
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(m.frame.inventory)
|
||||
checkbox:SetPoint('TOPLEFT', 49, -16)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
m.refresh = true
|
||||
end)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText('Show hidden items')
|
||||
private.show_hidden_checkbox = checkbox
|
||||
end
|
||||
|
||||
private.item_listing = aux.item_listing.create(
|
||||
m.frame.inventory,
|
||||
function()
|
||||
if arg1 == 'LeftButton' then
|
||||
m.set_item(this.item_record)
|
||||
elseif arg1 == 'RightButton' then
|
||||
aux.tab_group:set_tab(1)
|
||||
aux.search_tab.set_filter(strlower(aux.info.item(this.item_record.item_id).name)..'/exact')
|
||||
aux.search_tab.execute(nil, false)
|
||||
end
|
||||
end,
|
||||
function()
|
||||
aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT')
|
||||
end,
|
||||
function()
|
||||
GameTooltip:Hide()
|
||||
end,
|
||||
function(item_record)
|
||||
return item_record == m.selected_item
|
||||
aux.gui.horizontal_line(m.frame.inventory, -48)
|
||||
|
||||
private.item_listing = aux.item_listing.create(
|
||||
m.frame.inventory,
|
||||
function()
|
||||
if arg1 == 'LeftButton' then
|
||||
m.set_item(this.item_record)
|
||||
elseif arg1 == 'RightButton' then
|
||||
aux.tab_group:set_tab(1)
|
||||
aux.search_tab.set_filter(strlower(aux.info.item(this.item_record.item_id).name)..'/exact')
|
||||
aux.search_tab.execute(nil, false)
|
||||
end
|
||||
)
|
||||
end,
|
||||
function()
|
||||
aux.info.set_tooltip(this.item_record.itemstring, this, 'ANCHOR_RIGHT')
|
||||
end,
|
||||
function()
|
||||
GameTooltip:Hide()
|
||||
end,
|
||||
function(item_record)
|
||||
return item_record == m.selected_item
|
||||
end
|
||||
)
|
||||
|
||||
private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions)
|
||||
m.auction_listing:SetColInfo({
|
||||
{ name='Auctions', width=.12, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
{ name='Qty', width=.08, align='CENTER' },
|
||||
{ name='Bid/ea', width=.22, align='RIGHT' },
|
||||
{ name='Bid Pct', width=.13, align='CENTER' },
|
||||
{ name='Buy/ea', width=.22, align='RIGHT' },
|
||||
{ name='Buy Pct', width=.13, align='CENTER' }
|
||||
})
|
||||
m.auction_listing:EnableSorting(false)
|
||||
m.auction_listing:DisableSelection(true)
|
||||
m.auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||
local column_index = aux.util.key(column, column.row.cols)
|
||||
local unit_start_price, unit_buyout_price = m.undercut(row_data.record, m.stack_size_slider:GetValue(), button == 'RightButton')
|
||||
if column_index == 3 then
|
||||
m.stack_size_slider:SetValue(row_data.record.stack_size)
|
||||
elseif column_index == 4 then
|
||||
m.set_unit_start_price(unit_start_price)
|
||||
elseif column_index == 6 then
|
||||
m.set_unit_buyout_price(unit_buyout_price)
|
||||
private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions)
|
||||
m.auction_listing:SetColInfo({
|
||||
{ name='Auctions', width=.12, align='CENTER' },
|
||||
{ name='Left', width=.1, align='CENTER' },
|
||||
{ name='Qty', width=.08, align='CENTER' },
|
||||
{ name='Bid/ea', width=.22, align='RIGHT' },
|
||||
{ name='Bid Pct', width=.13, align='CENTER' },
|
||||
{ name='Buy/ea', width=.22, align='RIGHT' },
|
||||
{ name='Buy Pct', width=.13, align='CENTER' }
|
||||
})
|
||||
m.auction_listing:EnableSorting(false)
|
||||
m.auction_listing:DisableSelection(true)
|
||||
m.auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
|
||||
local column_index = aux.util.key(column, column.row.cols)
|
||||
local unit_start_price, unit_buyout_price = m.undercut(row_data.record, m.stack_size_slider:GetValue(), button == 'RightButton')
|
||||
if column_index == 3 then
|
||||
m.stack_size_slider:SetValue(row_data.record.stack_size)
|
||||
elseif column_index == 4 then
|
||||
m.set_unit_start_price(unit_start_price)
|
||||
elseif column_index == 6 then
|
||||
m.set_unit_buyout_price(unit_buyout_price)
|
||||
end
|
||||
end)
|
||||
|
||||
do
|
||||
local status_bar = aux.gui.status_bar(m.frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame.parameters, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Post')
|
||||
btn:SetScript('OnClick', m.post_auctions)
|
||||
private.post_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame.parameters, 16)
|
||||
btn:SetPoint('TOPLEFT', m.post_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
aux.scan.abort(m.scan_id)
|
||||
m.refresh_entries()
|
||||
m.refresh = true
|
||||
end)
|
||||
private.refresh_button = btn
|
||||
end
|
||||
do
|
||||
local item = aux.gui.item(m.frame.parameters)
|
||||
item:SetPoint('TOPLEFT', 6, -6)
|
||||
item.button:EnableMouse(true)
|
||||
item.button:SetScript('OnEnter', function()
|
||||
if m.selected_item then
|
||||
aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT')
|
||||
end
|
||||
end)
|
||||
|
||||
do
|
||||
local status_bar = aux.gui.status_bar(m.frame)
|
||||
status_bar:SetWidth(265)
|
||||
status_bar:SetHeight(25)
|
||||
status_bar:SetPoint('TOPLEFT', AuxFrameContent, 'BOTTOMLEFT', 0, -6)
|
||||
status_bar:update_status(100, 100)
|
||||
status_bar:set_text('')
|
||||
private.status_bar = status_bar
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame.parameters, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Post')
|
||||
btn:SetScript('OnClick', m.post_auctions)
|
||||
private.post_button = btn
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame.parameters, 16)
|
||||
btn:SetPoint('TOPLEFT', m.post_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
aux.scan.abort(m.scan_id)
|
||||
m.refresh_entries()
|
||||
m.refresh = true
|
||||
end)
|
||||
private.refresh_button = btn
|
||||
end
|
||||
do
|
||||
local item = aux.gui.item(m.frame.parameters)
|
||||
item:SetPoint('TOPLEFT', 6, -6)
|
||||
item.button:EnableMouse(true)
|
||||
item.button:SetScript('OnEnter', function()
|
||||
if m.selected_item then
|
||||
aux.info.set_tooltip(m.selected_item.itemstring, this, 'ANCHOR_RIGHT')
|
||||
end
|
||||
end)
|
||||
item.button:SetScript('OnLeave', function()
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
private.item = item
|
||||
end
|
||||
do
|
||||
local slider = aux.gui.slider(m.frame.parameters)
|
||||
slider:SetValueStep(1)
|
||||
slider:SetPoint('TOPLEFT', 13, -73)
|
||||
slider:SetWidth(190)
|
||||
slider:SetScript('OnValueChanged', function()
|
||||
m.quantity_update(true)
|
||||
end)
|
||||
slider.editbox:SetScript('OnTextChanged', function()
|
||||
slider:SetValue(this:GetNumber())
|
||||
m.quantity_update(true)
|
||||
if m.selected_item then
|
||||
local settings = m.read_settings()
|
||||
settings.stack_size = this:GetNumber()
|
||||
m.write_settings(settings)
|
||||
end
|
||||
end)
|
||||
slider.editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.unit_buyout_price:SetFocus()
|
||||
elseif m.stack_count_slider.editbox:IsVisible() then
|
||||
m.stack_count_slider.editbox:SetFocus()
|
||||
else
|
||||
m.unit_start_price:SetFocus()
|
||||
end
|
||||
end)
|
||||
slider.editbox:SetNumeric(true)
|
||||
slider.editbox:SetMaxLetters(3)
|
||||
slider.label:SetText('Stack Size')
|
||||
private.stack_size_slider = slider
|
||||
end
|
||||
do
|
||||
local slider = aux.gui.slider(m.frame.parameters)
|
||||
slider:SetValueStep(1)
|
||||
slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30)
|
||||
slider:SetWidth(190)
|
||||
slider:SetScript('OnValueChanged', function()
|
||||
m.quantity_update()
|
||||
end)
|
||||
slider.editbox:SetScript('OnTextChanged', function()
|
||||
slider:SetValue(this:GetNumber())
|
||||
m.quantity_update()
|
||||
end)
|
||||
slider.editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.stack_size_slider.editbox:SetFocus()
|
||||
else
|
||||
m.unit_start_price:SetFocus()
|
||||
end
|
||||
end)
|
||||
slider.editbox:SetNumeric(true)
|
||||
slider.label:SetText('Stack Count')
|
||||
private.stack_count_slider = slider
|
||||
end
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(m.frame.parameters)
|
||||
dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21)
|
||||
dropdown:SetWidth(90)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
|
||||
label:SetText('Duration')
|
||||
UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown)
|
||||
dropdown:SetScript('OnShow', function()
|
||||
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown)
|
||||
end)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size)
|
||||
label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0)
|
||||
private.deposit = label
|
||||
private.duration_dropdown = dropdown
|
||||
end
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(m.frame.parameters)
|
||||
checkbox:SetPoint('TOPRIGHT', -83, -6)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
item.button:SetScript('OnLeave', function()
|
||||
GameTooltip:Hide()
|
||||
end)
|
||||
private.item = item
|
||||
end
|
||||
do
|
||||
local slider = aux.gui.slider(m.frame.parameters)
|
||||
slider:SetValueStep(1)
|
||||
slider:SetPoint('TOPLEFT', 13, -73)
|
||||
slider:SetWidth(190)
|
||||
slider:SetScript('OnValueChanged', function()
|
||||
m.quantity_update(true)
|
||||
end)
|
||||
slider.editbox:SetScript('OnTextChanged', function()
|
||||
slider:SetValue(this:GetNumber())
|
||||
m.quantity_update(true)
|
||||
if m.selected_item then
|
||||
local settings = m.read_settings()
|
||||
settings.hidden = this:GetChecked()
|
||||
settings.stack_size = this:GetNumber()
|
||||
m.write_settings(settings)
|
||||
m.refresh = true
|
||||
end)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText('Hide this item')
|
||||
private.hide_checkbox = checkbox
|
||||
end
|
||||
end)
|
||||
slider.editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.unit_buyout_price:SetFocus()
|
||||
elseif m.stack_count_slider.editbox:IsVisible() then
|
||||
m.stack_count_slider.editbox:SetFocus()
|
||||
else
|
||||
m.unit_start_price:SetFocus()
|
||||
end
|
||||
end)
|
||||
slider.editbox:SetNumeric(true)
|
||||
slider.editbox:SetMaxLetters(3)
|
||||
slider.label:SetText('Stack Size')
|
||||
private.stack_size_slider = slider
|
||||
end
|
||||
do
|
||||
local slider = aux.gui.slider(m.frame.parameters)
|
||||
slider:SetValueStep(1)
|
||||
slider:SetPoint('TOPLEFT', m.stack_size_slider, 'BOTTOMLEFT', 0, -30)
|
||||
slider:SetWidth(190)
|
||||
slider:SetScript('OnValueChanged', function()
|
||||
m.quantity_update()
|
||||
end)
|
||||
slider.editbox:SetScript('OnTextChanged', function()
|
||||
slider:SetValue(this:GetNumber())
|
||||
m.quantity_update()
|
||||
end)
|
||||
slider.editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.stack_size_slider.editbox:SetFocus()
|
||||
else
|
||||
m.unit_start_price:SetFocus()
|
||||
end
|
||||
end)
|
||||
slider.editbox:SetNumeric(true)
|
||||
slider.label:SetText('Stack Count')
|
||||
private.stack_count_slider = slider
|
||||
end
|
||||
do
|
||||
local dropdown = aux.gui.dropdown(m.frame.parameters)
|
||||
dropdown:SetPoint('TOPLEFT', m.stack_count_slider, 'BOTTOMLEFT', 0, -21)
|
||||
dropdown:SetWidth(90)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', dropdown, 'TOPLEFT', -2, -1)
|
||||
label:SetText('Duration')
|
||||
UIDropDownMenu_Initialize(dropdown, m.initialize_duration_dropdown)
|
||||
dropdown:SetScript('OnShow', function()
|
||||
UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown)
|
||||
end)
|
||||
local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size)
|
||||
label:SetPoint('LEFT', dropdown, 'RIGHT', 25, 0)
|
||||
private.deposit = label
|
||||
private.duration_dropdown = dropdown
|
||||
end
|
||||
do
|
||||
local checkbox = aux.gui.checkbox(m.frame.parameters)
|
||||
checkbox:SetPoint('TOPRIGHT', -83, -6)
|
||||
checkbox:SetScript('OnClick', function()
|
||||
local settings = m.read_settings()
|
||||
settings.hidden = this:GetChecked()
|
||||
m.write_settings(settings)
|
||||
m.refresh = true
|
||||
end)
|
||||
local label = aux.gui.label(checkbox, aux.gui.config.small_font_size)
|
||||
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
|
||||
label:SetText('Hide this item')
|
||||
private.hide_checkbox = checkbox
|
||||
end
|
||||
do
|
||||
local frame = CreateFrame('Frame', nil, m.frame.parameters)
|
||||
private.start_price_frame = frame
|
||||
aux.gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', -71, -50)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = aux.gui.editbox(frame)
|
||||
editbox:SetAllPoints()
|
||||
editbox:SetJustifyH('RIGHT')
|
||||
editbox:SetFont(aux.gui.config.font, 17)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3))
|
||||
m.refresh = true
|
||||
end)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() and m.stack_count_slider.editbox:IsVisible() then
|
||||
m.stack_count_slider.editbox:SetFocus()
|
||||
elseif IsShiftKeyDown() then
|
||||
m.stack_size_slider.editbox:SetFocus()
|
||||
else
|
||||
m.unit_buyout_price:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusGained', function()
|
||||
this:HighlightText()
|
||||
this.pretty:Hide()
|
||||
this:SetAlpha(1)
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end)
|
||||
editbox:SetAlpha(0)
|
||||
editbox.pretty = aux.gui.label(frame, 17)
|
||||
editbox.pretty:SetPoint('LEFT', 1, 0)
|
||||
editbox.pretty:SetPoint('RIGHT', -2, 0)
|
||||
editbox.pretty:SetJustifyH('RIGHT')
|
||||
do
|
||||
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Unit Starting Price')
|
||||
end
|
||||
do
|
||||
local frame = CreateFrame('Frame', nil, m.frame.parameters)
|
||||
private.start_price_frame = frame
|
||||
aux.gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', -71, -50)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = aux.gui.editbox(frame)
|
||||
editbox:SetAllPoints()
|
||||
editbox:SetJustifyH('RIGHT')
|
||||
editbox:SetFont(aux.gui.config.font, 17)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
this.pretty:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3))
|
||||
m.refresh = true
|
||||
end)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() and m.stack_count_slider.editbox:IsVisible() then
|
||||
m.stack_count_slider.editbox:SetFocus()
|
||||
elseif IsShiftKeyDown() then
|
||||
m.stack_size_slider.editbox:SetFocus()
|
||||
else
|
||||
m.unit_buyout_price:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusGained', function()
|
||||
this:HighlightText()
|
||||
this.pretty:Hide()
|
||||
this:SetAlpha(1)
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(aux.money.to_string(m.get_unit_start_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end)
|
||||
editbox:SetAlpha(0)
|
||||
editbox.pretty = aux.gui.label(frame, 17)
|
||||
editbox.pretty:SetPoint('LEFT', 1, 0)
|
||||
editbox.pretty:SetPoint('RIGHT', -2, 0)
|
||||
editbox.pretty:SetJustifyH('RIGHT')
|
||||
do
|
||||
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Unit Starting Price')
|
||||
local label = aux.gui.label(frame, 14)
|
||||
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH('CENTER')
|
||||
private.start_price_percentage = label
|
||||
end
|
||||
private.unit_start_price = editbox
|
||||
end
|
||||
do
|
||||
local frame = CreateFrame('Frame', nil, m.frame.parameters)
|
||||
private.buyout_price_frame = frame
|
||||
aux.gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = aux.gui.editbox(frame)
|
||||
editbox:SetAllPoints()
|
||||
editbox:SetJustifyH('RIGHT')
|
||||
editbox:SetFont(aux.gui.config.font, 17)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3))
|
||||
m.refresh = true
|
||||
end)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.unit_start_price:SetFocus()
|
||||
else
|
||||
m.stack_size_slider.editbox:SetFocus()
|
||||
end
|
||||
do
|
||||
local label = aux.gui.label(frame, 14)
|
||||
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH('CENTER')
|
||||
private.start_price_percentage = label
|
||||
end
|
||||
private.unit_start_price = editbox
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusGained', function()
|
||||
this:HighlightText()
|
||||
this.pretty:Hide()
|
||||
this:SetAlpha(1)
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end)
|
||||
editbox:SetAlpha(0)
|
||||
editbox.pretty = aux.gui.label(frame, 17)
|
||||
editbox.pretty:SetPoint('LEFT', 1, 0)
|
||||
editbox.pretty:SetPoint('RIGHT', -2, 0)
|
||||
editbox.pretty:SetJustifyH('RIGHT')
|
||||
do
|
||||
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Unit Buyout Price')
|
||||
end
|
||||
do
|
||||
local frame = CreateFrame('Frame', nil, m.frame.parameters)
|
||||
private.buyout_price_frame = frame
|
||||
aux.gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = aux.gui.editbox(frame)
|
||||
editbox:SetAllPoints()
|
||||
editbox:SetJustifyH('RIGHT')
|
||||
editbox:SetFont(aux.gui.config.font, 17)
|
||||
editbox:SetScript('OnTextChanged', function()
|
||||
this.pretty:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3))
|
||||
m.refresh = true
|
||||
end)
|
||||
editbox:SetScript('OnTabPressed', function()
|
||||
if IsShiftKeyDown() then
|
||||
m.unit_start_price:SetFocus()
|
||||
else
|
||||
m.stack_size_slider.editbox:SetFocus()
|
||||
end
|
||||
end)
|
||||
editbox:SetScript('OnEnterPressed', function()
|
||||
this:ClearFocus()
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusGained', function()
|
||||
this:HighlightText()
|
||||
this.pretty:Hide()
|
||||
this:SetAlpha(1)
|
||||
end)
|
||||
editbox:SetScript('OnEditFocusLost', function()
|
||||
this:SetText(aux.money.to_string(m.get_unit_buyout_price(), true, nil, 3, nil, true))
|
||||
this.pretty:Show()
|
||||
this:SetAlpha(0)
|
||||
end)
|
||||
editbox:SetAlpha(0)
|
||||
editbox.pretty = aux.gui.label(frame, 17)
|
||||
editbox.pretty:SetPoint('LEFT', 1, 0)
|
||||
editbox.pretty:SetPoint('RIGHT', -2, 0)
|
||||
editbox.pretty:SetJustifyH('RIGHT')
|
||||
do
|
||||
local label = aux.gui.label(frame, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', frame, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Unit Buyout Price')
|
||||
end
|
||||
do
|
||||
local label = aux.gui.label(frame, 14)
|
||||
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH('CENTER')
|
||||
private.buyout_price_percentage = label
|
||||
end
|
||||
private.unit_buyout_price = editbox
|
||||
local label = aux.gui.label(frame, 14)
|
||||
label:SetPoint('LEFT', frame, 'RIGHT', 8, 0)
|
||||
label:SetWidth(50)
|
||||
label:SetJustifyH('CENTER')
|
||||
private.buyout_price_percentage = label
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame.parameters, 14)
|
||||
btn:SetPoint('TOPRIGHT', -14, -146)
|
||||
btn:SetWidth(150)
|
||||
btn:SetHeight(20)
|
||||
btn:GetFontString():SetJustifyH('RIGHT')
|
||||
btn:GetFontString():SetPoint('RIGHT', -2, 0)
|
||||
btn:SetScript('OnClick', function()
|
||||
if this.amount then
|
||||
m.set_unit_start_price(this.amount)
|
||||
m.set_unit_buyout_price(this.amount)
|
||||
end
|
||||
end)
|
||||
local label = aux.gui.label(btn, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Historical Value')
|
||||
private.historical_value_button = btn
|
||||
end
|
||||
end)
|
||||
private.unit_buyout_price = editbox
|
||||
end
|
||||
do
|
||||
local btn = aux.gui.button(m.frame.parameters, 14)
|
||||
btn:SetPoint('TOPRIGHT', -14, -146)
|
||||
btn:SetWidth(150)
|
||||
btn:SetHeight(20)
|
||||
btn:GetFontString():SetJustifyH('RIGHT')
|
||||
btn:GetFontString():SetPoint('RIGHT', -2, 0)
|
||||
btn:SetScript('OnClick', function()
|
||||
if this.amount then
|
||||
m.set_unit_start_price(this.amount)
|
||||
m.set_unit_buyout_price(this.amount)
|
||||
end
|
||||
end)
|
||||
local label = aux.gui.label(btn, aux.gui.config.small_font_size)
|
||||
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
|
||||
label:SetText('Historical Value')
|
||||
private.historical_value_button = btn
|
||||
end
|
||||
+2
-11
@@ -1,4 +1,4 @@
|
||||
local m, public, private = aux.tab(1, 'search_tab')
|
||||
local m, public, private = aux.tab(1, 'Search', 'search_tab')
|
||||
|
||||
aux_favorite_searches = {}
|
||||
aux_recent_searches = {}
|
||||
@@ -132,12 +132,7 @@ do
|
||||
end
|
||||
end
|
||||
|
||||
function public.FRAMES(f)
|
||||
private.create_frames = f
|
||||
end
|
||||
|
||||
function m.LOAD()
|
||||
m.create_frames(m, public, private)
|
||||
m.update_tab(m.SAVED)
|
||||
m.update_auto_buy_filter()
|
||||
m.new_search('')
|
||||
@@ -712,7 +707,7 @@ function private.initialize_slot_dropdown()
|
||||
func = on_click,
|
||||
}
|
||||
|
||||
for i, slot in { GetAuctionInvTypes(class_index, subclass_index) } do
|
||||
for _, slot in { GetAuctionInvTypes(class_index, subclass_index) } do
|
||||
local slot_name = getglobal(slot)
|
||||
UIDropDownMenu_AddButton{
|
||||
text = slot_name,
|
||||
@@ -916,10 +911,6 @@ function private.remove_post_filter()
|
||||
end
|
||||
|
||||
function private.update_filter_display()
|
||||
local lines = aux.util.size(aux.util.filter(m.post_components, function(component) return not (component[1] == 'operator' and component[2] == 'not') end))
|
||||
local width_scale = 250/m.filter_display:GetStringWidth()
|
||||
local height_scale = (180 / lines) / 18
|
||||
m.filter_display.scale_frame:SetScale(min(1, width_scale, height_scale))
|
||||
m.filter_display:SetText(aux.filter.indented_post_query_string(m.post_components))
|
||||
end
|
||||
|
||||
|
||||
+634
-611
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user