refactoring

This commit is contained in:
Manuel Simon Hirsig
2017-11-07 22:28:23 +01:00
parent 3dbeb1e679
commit 828d5f38d7
20 changed files with 102 additions and 88 deletions
+5 -5
View File
@@ -24,7 +24,7 @@ local current_owner_page
function M.current_owner_page() return current_owner_page end
local event_frame = CreateFrame'Frame'
for event in pairs(T.temp-T.set('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE')) do
for event in T.temp-T.set('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE') do
event_frame:RegisterEvent(event)
end
@@ -45,9 +45,9 @@ do
auction_ui_loaded()
end
elseif event == 'VARIABLES_LOADED' then
for _, f in pairs(handlers) do f() end
for _, f in handlers do f() end
elseif event == 'PLAYER_LOGIN' then
for _, f in pairs(handlers2) do f() end
for _, f in handlers2 do f() end
print('loaded - /aux')
else
_M[event]()
@@ -77,12 +77,12 @@ do
cache.faction = aux.faction[key]
end
end
for scope in pairs(T.temp-T.set('character', 'faction', 'realm', 'account')) do
for scope in T.temp-T.set('character', 'faction', 'realm', 'account') do
local scope = scope
M[scope .. '_data'] = function(key, init)
if not cache[scope] then error('Cache for ' .. scope .. ' data not ready.', 2) end
cache[scope][key] = cache[scope][key] or {}
for k, v in pairs(init or T.empty) do
for k, v in init or T.empty do
if cache[scope][key][k] == nil then
cache[scope][key][k] = v
end
+4 -4
View File
@@ -15,7 +15,7 @@ function handle.LOAD()
end
function EVENT()
for id, listener in pairs(listeners) do
for id, listener in listeners do
if listener.killed then
listeners[id] = nil
elseif event == listener.event then
@@ -26,9 +26,9 @@ end
do
function UPDATE()
for _, listener in pairs(listeners) do
for _, listener in listeners do
local event, needed = listener.event, false
for _, listener in pairs(listeners) do
for _, listener in listeners do
needed = needed or listener.event == event and not listener.killed
end
if not needed then
@@ -36,7 +36,7 @@ do
end
end
for id, thread in pairs(threads) do
for id, thread in threads do
if thread.killed or not thread.k then
threads[id] = nil
else
+1 -1
View File
@@ -46,7 +46,7 @@ do
end
function handle.LOAD2()
characters = realm_data'characters'
for k, v in pairs(characters) do
for k, v in characters do
if GetTime() > v + 60 * 60 * 24 * 30 then
characters[k] = nil
end
+1 -1
View File
@@ -38,7 +38,7 @@ local WEAPON = T.set(
function M.value(slot, quality, level)
local expectation
for _, event in pairs(distribution(slot, quality, level)) do
for _, event in distribution(slot, quality, level) do
local value = history.value(event.item_id .. ':' .. 0)
if not value then
return
+2 -2
View File
@@ -66,12 +66,12 @@ function M.value(item_key)
item_record = read_record(item_key)
if getn(item_record.data_points) > 0 then
local total_weight, weighted_values = 0, T.temp-T.acquire()
for _, data_point in pairs(item_record.data_points) do
for _, data_point in item_record.data_points do
local weight = .99 ^ round((item_record.data_points[1].time - data_point.time) / (60 * 60 * 24))
total_weight = total_weight + weight
tinsert(weighted_values, T.map('value', data_point.value, 'weight', weight))
end
for _, weighted_value in pairs(weighted_values) do
for _, weighted_value in weighted_values do
weighted_value.weight = weighted_value.weight / total_weight
end
value = weighted_median(weighted_values)
+3 -3
View File
@@ -32,14 +32,14 @@ do
function M.abort(scan_id)
local aborted = T.acquire()
for type, state in pairs(scan_states) do
for type, state in scan_states do
if not scan_id or state.id == scan_id then
kill_thread(state.id)
scan_states[type] = nil
tinsert(aborted, state)
end
end
for _, state in pairs(aborted) do
for _, state in aborted do
do (state.params.on_abort or nop)() end
end
end
@@ -55,7 +55,7 @@ do
end
function get_state()
for _, state in pairs(scan_states) do
for _, state in scan_states do
if state.id == thread_id() then
return state
end
+1 -1
View File
@@ -18,7 +18,7 @@ function handle.LOAD()
settings = character_data('tooltip', {value=true})
do
local inside_hook = false
for name, f in pairs(game_tooltip_hooks) do
for name, f in game_tooltip_hooks do
local name, f = name, f
hook(name, GameTooltip, T.vararg-function(arg)
game_tooltip_money = 0
+16 -16
View File
@@ -530,14 +530,14 @@ local methods = {
ResizeColumns = function(self)
local weight = 0
for _, cell in pairs(self.headCells) do
for _, cell in self.headCells do
weight = weight + cell.info.width
end
weight = (self.contentFrame:GetRight() - self.contentFrame:GetLeft()) / weight
for i, cell in pairs(self.headCells) do
for i, cell in self.headCells do
local width = cell.info.width * weight
cell:SetWidth(width)
for _, row in pairs(self.rows) do
for _, row in self.rows do
row.cells[i]:SetWidth(width)
end
end
@@ -549,7 +549,7 @@ local methods = {
if button == 'RightButton' and rt.headCells[this.columnIndex].info.isPrice then
price_per_unit = not price_per_unit
for _, cell in pairs(rt.headCells) do
for _, cell in rt.headCells do
if cell.info.isPrice then
cell:SetText(cell.info.title[price_per_unit and 1 or 2])
end
@@ -637,7 +637,7 @@ local methods = {
UpdateRowInfo = function(self)
for _, v in ipairs(self.rowInfo) do
if type(v) == 'table' then
for _, child in pairs(v.children) do
for _, child in v.children do
T.release(child)
end
T.release(v.children)
@@ -676,7 +676,7 @@ local methods = {
for _, v in ipairs(self.rowInfo) do
local totalAuctions, totalPlayerAuctions = 0, 0
for _, childInfo in pairs(v.children) do
for _, childInfo in v.children do
totalAuctions = totalAuctions + childInfo.count
if info.is_player(childInfo.record.owner) then
totalPlayerAuctions = totalPlayerAuctions + childInfo.count
@@ -702,7 +702,7 @@ local methods = {
FauxScrollFrame_SetOffset(self.scrollFrame, maxOffset)
end
for _, cell in pairs(self.headCells) do
for _, cell in self.headCells do
local tex = cell:GetNormalTexture()
tex:SetTexture[[Interface\AddOns\aux-AddOn\WorldStateFinalScore-Highlight]]
tex:SetTexCoord(.017, 1, .083, .909)
@@ -730,7 +730,7 @@ local methods = {
record_b = b.record
end
for _, sort in pairs(self.sorts) do
for _, sort in self.sorts do
local ordering = self.columns[sort.index].cmp and self.columns[sort.index].cmp(record_a, record_b, sort.descending) or sort_util.EQ
if ordering == sort_util.LT then
@@ -750,7 +750,7 @@ local methods = {
self.isSorted = true
end
for _, row in pairs(self.rows) do
for _, row in self.rows do
row:Hide()
end
local rowIndex = 1 - FauxScrollFrame_GetOffset(self.scrollFrame)
@@ -782,7 +782,7 @@ local methods = {
row.indented = indented
row.expandKey = expandKey
for i, column in pairs(self.columns) do
for i, column in self.columns do
column.fill(row.cells[i], record, totalAuctions, totalPlayerAuctions, expandable, indented)
end
end,
@@ -792,7 +792,7 @@ local methods = {
local selectedData = self:GetSelection()
self.selected = selectedData and self.selected or nil
for _, row in pairs(self.rows) do
for _, row in self.rows do
if self.selected and row.record and row.record.search_signature == self.selected.search_signature then
row.highlight:Show()
else
@@ -819,7 +819,7 @@ local methods = {
local prevSelectedIndex
if self.selected then
for i, row in pairs(self.rows) do
for i, row in self.rows do
if row:IsVisible() and row.record == self.selected then
prevSelectedIndex = i
end
@@ -862,7 +862,7 @@ local methods = {
SetSort = T.vararg-function(arg)
local self = tremove(arg, 1)
for _, v in ipairs(arg) do
for i, sort in pairs(self.sorts) do
for i, sort in self.sorts do
if sort.index == abs(v) then
tremove(self.sorts, i)
break
@@ -883,7 +883,7 @@ local methods = {
if not self.selected then return end
local selectedData
for _, v in ipairs(self.rowInfo) do
for _, childInfo in pairs(v.children) do
for _, childInfo in v.children do
if childInfo.record.search_signature == self.selected.search_signature then
selectedData = childInfo
break
@@ -904,12 +904,12 @@ function M.new(parent, rows, columns)
rt.records = {}
rt.rowInfo = {numDisplayRows=0}
for name, func in pairs(methods) do
for name, func in methods do
rt[name] = func
end
rt:SetScript('OnShow', function()
for _, cell in pairs(this.headCells) do
for _, cell in this.headCells do
if cell.info.isPrice then
cell:SetText(cell.info.title[price_per_unit and 1 or 2])
end
+1 -1
View File
@@ -256,7 +256,7 @@ do
do (self._on_select or nop)(id) end
end
function mt.__index:update()
for _, tab in pairs(self._tabs) do
for _, tab in self._tabs do
if tab.group._selected == tab.id then
tab.text:SetTextColor(color.label.enabled())
tab:Disable()
+1 -1
View File
@@ -22,7 +22,7 @@ function M:render()
local rows = self.rows
for i, row in pairs(rows) do
for i, row in rows do
local item_record = self.item_records[i + offset]
if item_record then
+9 -9
View File
@@ -77,7 +77,7 @@ local methods = {
self:AddColumn()
end
for i, col in pairs(self.headCols) do
for i, col in self.headCols do
if self.colInfo[i] then
col:Show()
col:SetWidth(self.colInfo[i].width * width)
@@ -93,7 +93,7 @@ local methods = {
self:AddRow()
end
for i, row in pairs(self.rows) do
for i, row in self.rows do
if i > self.numRows then
row.data = nil
row:Hide()
@@ -102,7 +102,7 @@ local methods = {
while getn(row.cols) < getn(self.colInfo) do
self:AddCell(i)
end
for j, col in pairs(row.cols) do
for j, col in row.cols do
if self.headCols[j] and self.colInfo[j] then
col:Show()
col:SetWidth(self.colInfo[j].width * width)
@@ -136,7 +136,7 @@ local methods = {
row.highlight:Hide()
end
for j, col in pairs(row.cols) do
for j, col in row.cols do
if self.colInfo[j] then
local colData = data.cols[j]
if type(colData.value) == 'function' then
@@ -151,8 +151,8 @@ local methods = {
end,
SetData = function(self, rowData)
for _, row in pairs(self.rowData or T.empty) do
for _, col in pairs(row.cols) do T.release(col) end
for _, row in self.rowData or T.empty do
for _, col in row.cols do T.release(col) end
T.release(row.cols)
T.release(row)
end
@@ -186,7 +186,7 @@ local methods = {
tinsert(self.headCols, col)
for i, row in pairs(self.rows) do
for i, row in self.rows do
while getn(row.cols) < getn(self.headCols) do
self:AddCell(i)
end
@@ -218,7 +218,7 @@ local methods = {
local row = CreateFrame('Button', nil, self.contentFrame)
row:SetHeight(ROW_HEIGHT)
row:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
for name, func in pairs(handlers) do
for name, func in handlers do
row:SetScript(name, func)
end
local rowNum = getn(self.rows) + 1
@@ -289,7 +289,7 @@ function M.new(parent)
_G[scroll_bar:GetName() .. 'ScrollUpButton']:Hide()
_G[scroll_bar:GetName() .. 'ScrollDownButton']:Hide()
for name, func in pairs(methods) do
for name, func in methods do
st[name] = func
end
+20 -6
View File
@@ -7,7 +7,7 @@ local pool, pool_size, overflow_pool, auto_release = {}, 0, setmetatable({}, {__
function wipe(t)
setmetatable(t, nil)
for k, v in pairs(t) do
for k in t do
t[k] = nil
end
t.reset, t.reset = nil, 1
@@ -16,7 +16,9 @@ end
M.wipe = wipe
CreateFrame'Frame':SetScript('OnUpdate', function()
for t in pairs(auto_release) do release(t) end
for t in auto_release do
release(t)
end
wipe(auto_release)
end)
@@ -47,11 +49,21 @@ end
M.release = release
do
local function f(_, v) if v then auto_release[v] = true; return v end end
local function f(_, v)
if v then
auto_release[v] = true
return v
end
end
M.temp = setmetatable({}, {__metatable=false, __newindex=nop, __call=f, __sub=f})
end
do
local function f(_, v) if v then auto_release[v] = nil; return v end end
local function f(_, v)
if v then
auto_release[v] = nil
return v
end
end
M.static = setmetatable({}, {__metatable=false, __newindex=nop, __call=f, __sub=f})
end
@@ -111,7 +123,9 @@ do
end
M.vararg = setmetatable({}, {
__metatable = false,
__sub = function(_, v) return vararg(v) end,
__sub = function(_, v)
return vararg(v)
end,
})
end
@@ -121,7 +135,7 @@ M.list = vararg(function(arg)
end)
M.set = vararg(function(arg)
local t = acquire()
for _, v in pairs(arg) do
for _, v in arg do
t[v] = true
end
return t
+5 -5
View File
@@ -115,7 +115,7 @@ function update_auction_listing(listing, records, reference)
if selected_item then
local historical_value = history.value(selected_item.key)
local stack_size = stack_size_slider:GetValue()
for _, record in pairs(records[selected_item.key] or T.empty) do
for _, record in records[selected_item.key] or T.empty do
local price_color = undercut(record, stack_size_slider:GetValue(), listing == 'bid') < reference and color.red
local price = record.unit_price * (listing == 'bid' and record.stack_size / stack_size_slider:GetValue() or 1)
tinsert(rows, T.map(
@@ -173,7 +173,7 @@ function update_auction_listings()
end
function M.select_item(item_key)
for _, inventory_record in pairs(filter(copy(inventory_records), function(record) return record.aux_quantity > 0 end)) do
for _, inventory_record in filter(copy(inventory_records), function(record) return record.aux_quantity > 0 end) do
if inventory_record.key == item_key then
update_item(inventory_record)
return
@@ -229,7 +229,7 @@ function post_auctions()
end
update_inventory_records()
local same
for _, record in pairs(inventory_records) do
for _, record in inventory_records do
if record.key == key then
same = record
break
@@ -493,7 +493,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
bid_records[key] = bid_records[key] or T.acquire()
do
local entry
for _, record in pairs(bid_records[key]) do
for _, record in bid_records[key] do
if unit_blizzard_bid == record.unit_price and aux_quantity == record.stack_size and duration == record.duration and info.is_player(owner) == record.own then
entry = record
end
@@ -508,7 +508,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
if unit_buyout_price == 0 then return end
do
local entry
for _, record in pairs(buyout_records[key]) do
for _, record in buyout_records[key] do
if unit_buyout_price == record.unit_price and aux_quantity == record.stack_size and duration == record.duration and info.is_player(owner) == record.own then
entry = record
end
+3 -3
View File
@@ -82,17 +82,17 @@ function update_form()
if blizzard_query.exact then
usable_checkbox:Disable()
for key in pairs(T.temp-T.set('min_level', 'max_level')) do
for key in T.temp-T.set('min_level', 'max_level') do
_M[key .. '_input']:EnableMouse(false)
_M[key .. '_input']:ClearFocus()
end
for key in pairs(T.temp-T.set('class', 'subclass', 'slot', 'quality')) do
for key in T.temp-T.set('class', 'subclass', 'slot', 'quality') do
_M[key .. '_dropdown'].button:Disable()
end
CloseDropDownMenus()
else
usable_checkbox:Enable()
for key in pairs(T.temp-T.set('min_level', 'max_level')) do
for key in T.temp-T.set('min_level', 'max_level') do
_M[key .. '_input']:EnableMouse(true)
end
class_dropdown.button:Enable()
+2 -2
View File
@@ -543,8 +543,8 @@ favorite_searches_listing:SetColInfo{{name='Auto Buy', width=.07, align='CENTER'
recent_searches_listing = listing.new(frame.saved.recent)
recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}}
for listing in pairs(T.temp-T.set(favorite_searches_listing, recent_searches_listing)) do
for k, v in pairs(handlers) do
for listing in T.temp-T.set(favorite_searches_listing, recent_searches_listing) do
for k, v in handlers do
listing:SetHandler(k, v)
end
end
+3 -3
View File
@@ -168,10 +168,10 @@ function start_real_time_scan(query, search, continuation)
end,
on_complete = function()
local map = T.temp-T.acquire()
for _, record in pairs(search.records) do
for _, record in search.records do
map[record.sniping_signature] = record
end
for _, record in pairs(new_records) do
for _, record in new_records do
map[record.sniping_signature] = record
end
T.release(new_records)
@@ -347,7 +347,7 @@ function M.execute(resume, real_time)
if real_time then
start_real_time_scan(queries[1], nil, continuation)
else
for _, query in pairs(queries) do
for _, query in queries do
query.blizzard_query.first_page = get_current_search().first_page
query.blizzard_query.last_page = get_current_search().last_page
end
+1 -1
View File
@@ -86,7 +86,7 @@ handlers = {
function get_auto_buy_validator()
local validators = T.acquire()
for _, search in pairs(favorite_searches) do
for _, search in favorite_searches do
if search.auto_buy then
local queries, error = filter_util.queries(search.filter_string)
if queries then
+11 -11
View File
@@ -48,7 +48,7 @@ end
function M.copy(t)
local copy = T.acquire()
for k, v in pairs(t) do
for k, v in t do
copy[k] = v
end
table.setn(copy, getn(t))
@@ -57,14 +57,14 @@ end
function M.size(t)
local size = 0
for _ in pairs(t) do
for _ in t do
size = size + 1
end
return size
end
function M.key(t, value)
for k, v in pairs(t) do
for k, v in t do
if v == value then
return k
end
@@ -73,7 +73,7 @@ end
function M.keys(t)
local keys = T.acquire()
for k in pairs(t) do
for k in t do
tinsert(keys, k)
end
return keys
@@ -81,7 +81,7 @@ end
function M.values(t)
local values = T.acquire()
for _, v in pairs(t) do
for _, v in t do
tinsert(values, v)
end
return values
@@ -89,17 +89,17 @@ end
function M.eq(t1, t2)
if not t1 or not t2 then return false end
for key, value in pairs(t1) do
for key, value in t1 do
if t2[key] ~= value then return false end
end
for key, value in pairs(t2) do
for key, value in t2 do
if t1[key] ~= value then return false end
end
return true
end
function M.any(t, predicate)
for _, v in pairs(t) do
for _, v in t do
if predicate then
if predicate(v) then return true end
elseif v then
@@ -110,7 +110,7 @@ function M.any(t, predicate)
end
function M.all(t, predicate)
for _, v in pairs(t) do
for _, v in t do
if predicate then
if not predicate(v) then return false end
elseif not v then
@@ -121,14 +121,14 @@ function M.all(t, predicate)
end
function M.filter(t, predicate)
for k, v in pairs(t) do
for k, v in t do
if not predicate(v, k) then t[k] = nil end
end
return t
end
function M.map(t, f)
for k, v in pairs(t) do
for k, v in t do
t[k] = f(v, k)
end
return t
+7 -7
View File
@@ -185,7 +185,7 @@ M.filters = {
function operator(str)
local operator = str == 'not' and T.list('operator', 'not', 1)
for name in pairs(T.temp-T.set('and', 'or')) do
for name in T.temp-T.set('and', 'or') do
local arity = select(3, strfind(str, '^' .. name .. '(%d*)$'))
if arity then
arity = tonumber(arity)
@@ -214,12 +214,12 @@ do
end
end
end
for _, parser in pairs(T.temp-T.list(
for _, parser in T.temp-T.list(
T.temp-T.list('class', info.item_class_index),
T.temp-T.list('subclass', T.vararg-function(arg) return info.item_subclass_index(index(self.class, 2) or 0, unpack(arg)) end),
T.temp-T.list('slot', T.vararg-function(arg) return info.item_slot_index(index(self.class, 2) == 2 and 2 or 0, index(self.subclass, 2) or 0, unpack(arg)) end),
T.temp-T.list('quality', info.item_quality_index)
)) do
) do
if not self[parser[1]] then
tinsert(parser, str)
local index, label = parser[2](select(3, unpack(parser)))
@@ -324,7 +324,7 @@ function M.query(filter_string)
if polish_notation_counter > 0 then
local suggestions = T.acquire()
for key in pairs(filters) do
for key in filters do
tinsert(suggestions, strlower(key))
end
tinsert(suggestions, 'and')
@@ -361,7 +361,7 @@ function suggestions(filter)
tinsert(suggestions, 'and'); tinsert(suggestions, 'or'); tinsert(suggestions, 'not'); tinsert(suggestions, 'tooltip')
for key in pairs(filters) do tinsert(suggestions, key) end
for key in filters do tinsert(suggestions, key) end
-- classes
if not filter.blizzard.class then
@@ -489,7 +489,7 @@ function blizzard_query(filter)
query.slot = slot_index
query.quality = item_info.quality
else
for key in pairs(T.temp-T.set('min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality')) do
for key in T.temp-T.set('min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality') do
query[key] = index(filters[key], 2)
end
end
@@ -498,7 +498,7 @@ end
function validator(filter)
local validators = T.acquire()
for i, component in pairs(filter.post) do
for i, component in filter.post do
local type, name, param = unpack(component)
if type == 'filter' then
validators[i] = filters[name].validator(parse_parameter(filters[name].input_type, param))
+6 -6
View File
@@ -219,7 +219,7 @@ end
function M.tooltip_find(pattern, tooltip)
local count = 0
for _, line in pairs(tooltip) do
for _, line in tooltip do
if line.left_text and strfind(line.left_text, pattern) then
count = count + 1
end
@@ -296,7 +296,7 @@ function M.tooltip(setter, arg1, arg2)
end
function item_charges(tooltip)
for _, line in pairs(tooltip) do
for _, line in tooltip do
local pattern = '^' .. gsub(gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)') .. '$'
local _, _, left_charges_string = strfind(line.left_text or '', pattern)
@@ -342,7 +342,7 @@ do
end
function M.durability(tooltip)
for _, line in pairs(tooltip) do
for _, line in tooltip do
local pattern = '^' .. gsub(gsub(DURABILITY_TEMPLATE, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)') .. '$'
local _, _, left_durability_string, left_max_durability_string = strfind(line.left_text or '', pattern)
local _, _, right_durability_string, right_max_durability_string = strfind(line.right_text or '', pattern)
@@ -385,7 +385,7 @@ function M.item(item_id, suffix_id)
end
function M.item_class_index(item_class)
for i, class in pairs(T.temp-T.list(GetAuctionItemClasses())) do
for i, class in T.temp-T.list(GetAuctionItemClasses()) do
if strupper(class) == strupper(item_class) then
return i, class
end
@@ -393,7 +393,7 @@ function M.item_class_index(item_class)
end
function M.item_subclass_index(class_index, item_subclass)
for i, subclass in pairs(T.temp-T.list(GetAuctionItemSubClasses(class_index))) do
for i, subclass in T.temp-T.list(GetAuctionItemSubClasses(class_index)) do
if strupper(subclass) == strupper(item_subclass) then
return i, subclass
end
@@ -401,7 +401,7 @@ function M.item_subclass_index(class_index, item_subclass)
end
function M.item_slot_index(class_index, subclass_index, slot_name)
for i, slot in pairs(T.temp-T.list(GetAuctionInvTypes(class_index, subclass_index))) do
for i, slot in T.temp-T.list(GetAuctionInvTypes(class_index, subclass_index)) do
if strupper(_G[slot]) == strupper(slot_name) then
return i, _G[slot]
end