From e99d09e8ce2ca41f11ddf6bd2636650a40721990 Mon Sep 17 00:00:00 2001 From: Simon Hirsig Date: Wed, 30 Sep 2015 11:07:40 +0200 Subject: [PATCH] scan api refactoring --- buy.lua | 22 +++++++++------------- scan.lua | 37 ++++++++----------------------------- sell.lua | 4 ++-- 3 files changed, 19 insertions(+), 44 deletions(-) diff --git a/buy.lua b/buy.lua index 29fdc5a..837a83f 100644 --- a/buy.lua +++ b/buy.lua @@ -28,9 +28,9 @@ function AuxBuySearchButton_OnClick() search_query = Aux.scan.create_query{ name = AuxBuySearchBox:GetText(), - invTypeIndex = category and category.type, - classIndex = category and category.class, - subclassIndex = category and category.subclass, + slot = category and category.slot, + class = category and category.class, + subclass = category and category.subclass, } set_message('Scanning auctions ...') @@ -136,10 +136,6 @@ function AuxBuyBuySelectedButton_OnClick() else order[key] = nil end - else - if auction_item.name == search_query.name then - record_auction(auction_item.name, auction_item.tooltip, stack_size, auction_item.buyout_price, auction_item.quality, auction_item.owner, auction_item.hyperlink, auction_item.itemstring) - end end end, on_complete = function() @@ -364,13 +360,13 @@ function AuxBuyCategoryDropDown_Initialize(arg1) if level == 3 then local menu_value = UIDROPDOWNMENU_MENU_VALUE - for i, type in pairs({ GetAuctionInvTypes(menu_value.class, menu_value.subclass) }) do - local type_name = getglobal(type) - local value = { class = menu_value.class, subclass = menu_value.subclass, type = i } + for i, slot in pairs({ GetAuctionInvTypes(menu_value.class, menu_value.subclass) }) do + local slot_name = getglobal(slot) + local value = { class = menu_value.class, subclass = menu_value.subclass, slot = i } UIDropDownMenu_AddButton({ - text = type_name, + text = slot_name, value = value, - func = AuxBuyCategoryDropDown_OnClick(type_name, value), + func = AuxBuyCategoryDropDown_OnClick(slot_name, value), }, 3) end end @@ -443,4 +439,4 @@ end function Aux.buy.toggle_tooltip_dropdown() ToggleDropDownMenu(1, nil, AuxBuyTooltipDropDown, AuxBuyTooltipEdit, -12, 4) -end \ No newline at end of file +end diff --git a/scan.lua b/scan.lua index 5048853..3f94807 100644 --- a/scan.lua +++ b/scan.lua @@ -101,37 +101,16 @@ end ----------------------------------------- -function Aux.scan.create_query(parameterMap) - local query = { - name = nil, - minLevel = "", - maxLevel = "", - invTypeIndex = nil, - classIndex = nil, - subclassIndex = nil, - isUsable = nil, - qualityIndex = nil - } - - for k,v in pairs(parameterMap) do - query[k] = v - end - - return query -end - ------------------------------------------ - function submit_query() QueryAuctionItems( current_job.query.name, - current_job.query.minLevel, - current_job.query.maxLevel, - current_job.query.invTypeIndex, - current_job.query.classIndex, - current_job.query.subclassIndex, + current_job.query.min_level, + current_job.query.max_level, + current_job.query.slot, + current_job.query.class, + current_job.query.subclass, current_page, - current_job.query.isUsable, - current_job.query.qualityIndex + current_job.query.usable, + current_job.query.quality ) -end \ No newline at end of file +end diff --git a/sell.lua b/sell.lua index c36f0a9..5b73414 100644 --- a/sell.lua +++ b/sell.lua @@ -302,8 +302,8 @@ function Aux_RefreshEntries() Aux.scan.start{ query = Aux.scan.create_query{ name = name, - classIndex = class_index, - subclassIndex = subclass_index, + class = class_index, + subclass = subclass_index, }, on_start_page = function(i) set_message('Scanning auctions: page ' .. i + 1 .. ' ...')