From f0997eaaf4987176f4473cdb2de13d1cab18c77f Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Thu, 24 Mar 2016 16:29:54 +0100 Subject: [PATCH] bag type fix, status bar change --- core.lua | 2 +- scan.lua | 4 ++-- stack.lua | 4 ++-- util.lua | 19 ++++++++++++++++++- 4 files changed, 23 insertions(+), 6 deletions(-) diff --git a/core.lua b/core.lua index 6716c79..db2652a 100644 --- a/core.lua +++ b/core.lua @@ -1,5 +1,5 @@ Aux = { - version = '2.9.17', + version = '2.9.18', blizzard_ui_shown = false, orig = {}, } diff --git a/scan.lua b/scan.lua index c31f60e..392fbe6 100644 --- a/scan.lua +++ b/scan.lua @@ -231,8 +231,8 @@ function private.submit_query(k) private.wait_for_results(function() local _, total_count = GetNumAuctionItems(private.current_thread().params.type) private.current_thread().total_pages = math.ceil(total_count / PAGE_SIZE) - if private.current_thread().total_pages >= private.current_thread().page + 1 then - private.wait_for_callback(private.current_thread().params.on_page_loaded, private.current_thread().page, private.current_thread().total_pages, function() + if max(1, private.current_thread().total_pages) >= private.current_thread().page + 1 then + private.wait_for_callback(private.current_thread().params.on_page_loaded, private.current_thread().page, max(1, private.current_thread().total_pages), function() return k() end) else diff --git a/stack.lua b/stack.lua index ef23d42..505a9ab 100644 --- a/stack.lua +++ b/stack.lua @@ -37,8 +37,8 @@ function private.matching_item(slot, partial) end function private.find_empty_slot() - for slot in Aux.util.inventory() do - if not GetContainerItemInfo(unpack(slot)) then + for slot, type in Aux.util.inventory() do + if type == 1 and not GetContainerItemInfo(unpack(slot)) then return slot end end diff --git a/util.lua b/util.lua index c827d7a..c1f34b3 100644 --- a/util.lua +++ b/util.lua @@ -65,7 +65,24 @@ function public.inventory() end if bag <= 4 then - return { bag, slot } + return { bag, slot }, public.bag_type(bag) + end + end +end + +do + local bag_types = { GetAuctionItemSubClasses(3) } + + function public.bag_type(bag) + if bag == 0 then + return 1 + end + + local link = GetInventoryItemLink('player', ContainerIDToInventoryID(bag)) + if link then + local item_id = Aux.info.parse_hyperlink(GetInventoryItemLink('player', ContainerIDToInventoryID(bag))) + local item_info = Aux.info.item(item_id) + return Aux.item_subclass_index(3, item_info.subclass) end end end