diff --git a/components/cache.lua b/components/cache.lua index 82330fa..8b9c773 100644 --- a/components/cache.lua +++ b/components/cache.lua @@ -1,10 +1,10 @@ aux.module 'cache' -private.MIN_ITEM_ID = 1 -private.MAX_ITEM_ID = 30000 +MIN_ITEM_ID = 1 +MAX_ITEM_ID = 30000 -private.items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}} -private.merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} } +items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}} +merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} } _G.aux_items = {} _G.aux_item_ids = {} @@ -35,29 +35,29 @@ end do local sell_scan_countdown, incomplete_buy_data - function private.on_merchant_show() + function on_merchant_show() m.merchant_sell_scan() incomplete_buy_data = not m.merchant_buy_scan() end - function private.on_merchant_closed() + function on_merchant_closed() sell_scan_countdown = nil incomplete_buy_data = false end - function private.on_merchant_update() + function on_merchant_update() if incomplete_buy_data then incomplete_buy_data = not m.merchant_buy_scan() end end - function private.on_bag_update() + function on_bag_update() if MerchantFrame:IsVisible() then sell_scan_countdown = 10 end end - function private.merchant_on_update() + function merchant_on_update() if sell_scan_countdown == 0 then sell_scan_countdown = nil m.merchant_sell_scan() @@ -67,7 +67,7 @@ do end end -function private.merchant_loaded() +function merchant_loaded() for i=1,GetMerchantNumItems() do if not GetMerchantItemLink(i) then return false @@ -107,7 +107,7 @@ function public.item_id(item_name) return _G.aux_item_ids[strlower(item_name)] end -function private.merchant_buy_scan() +function merchant_buy_scan() local incomplete_data for i=1,GetMerchantNumItems() do @@ -146,7 +146,7 @@ function private.merchant_buy_scan() return not incomplete_data end -function private.merchant_sell_scan() +function merchant_sell_scan() for slot in aux.util.inventory() do local item_info = aux.info.container_item(unpack(slot)) if item_info then @@ -155,7 +155,7 @@ function private.merchant_sell_scan() end end -function private.scan_wdb(item_id) +function scan_wdb(item_id) item_id = item_id or m.MIN_ITEM_ID local processed = 0 diff --git a/components/disenchant.lua b/components/disenchant.lua index b5ab2d2..7baf581 100644 --- a/components/disenchant.lua +++ b/components/disenchant.lua @@ -1,8 +1,8 @@ aux.module 'disenchant' -private.UNCOMMON = 2 -private.RARE = 3 -private.EPIC = 4 +UNCOMMON = 2 +RARE = 3 +EPIC = 4 do local data = { @@ -41,7 +41,7 @@ do end function m.LOAD() - private.armor = aux.util.set( + armor = aux.util.set( 'INVTYPE_HEAD', 'INVTYPE_NECK', 'INVTYPE_SHOULDER', @@ -59,7 +59,7 @@ function m.LOAD() 'INVTYPE_HOLDABLE' ) - private.weapon = aux.util.set( + weapon = aux.util.set( 'INVTYPE_2HWEAPON' , 'INVTYPE_WEAPONMAINHAND', 'INVTYPE_WEAPON', diff --git a/components/history.lua b/components/history.lua index c312d63..076d7b0 100644 --- a/components/history.lua +++ b/components/history.lua @@ -1,25 +1,25 @@ aux.module 'history' local history_schema = {'record', '#', {next_push='number'}, {daily_min_buyout='number'}, {daily_max_price='number'}, {data_points={'list', ';', {'record', '@', {market_value='number'}, {time='number'}}}}} -private.value_cache = {} +value_cache = {} -function private.next_push() +function next_push() local date = date('*t') date.hour, date.min, date.sec = 24, 0, 0 return time(date) end -function private.new_record() +function new_record() return { next_push = m.next_push(), data_points = {} } end -function private.load_data() +function load_data() local dataset = aux.persistence.load_dataset() dataset.history = dataset.history or {} return dataset.history end -function private.read_record(item_key) +function read_record(item_key) local data = m.load_data() local record @@ -37,7 +37,7 @@ function private.read_record(item_key) return record end -function private.write_record(item_key, record) +function write_record(item_key, record) m.value_cache[item_key] = nil local data = m.load_data() data[item_key] = aux.persistence.write(history_schema, record) @@ -96,11 +96,11 @@ function public.market_value(item_key) return m.calculate_market_value(item_record) end -function private.calculate_market_value(item_record) +function calculate_market_value(item_record) return item_record.daily_min_buyout and min(ceil(item_record.daily_min_buyout * 1.15), item_record.daily_max_price) end -function private.weighted_median(list) +function weighted_median(list) local sorted_list = {} for _, e in list do tinsert(sorted_list, e) @@ -116,7 +116,7 @@ function private.weighted_median(list) end end -function private.push_record(item_record) +function push_record(item_record) local market_value = m.calculate_market_value(item_record) if market_value then diff --git a/components/post.lua b/components/post.lua index 5775124..d7f6d9e 100644 --- a/components/post.lua +++ b/components/post.lua @@ -1,8 +1,8 @@ aux.module 'post' -private.state = nil +state = nil -function private.process() +function process() if m.state.posted < m.state.count then local stacking_complete @@ -23,7 +23,7 @@ function private.process() return m.stop() end -function private.post_auction(slot, k) +function post_auction(slot, k) local item_info = aux.info.container_item(unpack(slot)) if item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and item_info.aux_quantity == m.state.stack_size then diff --git a/components/scan.lua b/components/scan.lua index 3811b24..8b591f1 100644 --- a/components/scan.lua +++ b/components/scan.lua @@ -1,6 +1,6 @@ aux.module 'scan' -private.PAGE_SIZE = 50 +PAGE_SIZE = 50 do local scan_states = {} @@ -31,23 +31,23 @@ do end end - function private.complete() + function complete() local on_complete = m.state.params.on_complete scan_states[m.state.params.type] = nil aux.call(on_complete) end - private.state = aux.dynamic_table(scan_states, function(self) + state = aux.dynamic_table(scan_states, function(self) local _, state = next(aux.util.filter(self.private, function(state) return state.id == aux.control.thread_id end)) return state end) end -private.query = aux.dynamic_table(nil, function() +query = aux.dynamic_table(nil, function() return m.state.params.queries[m.state.query_index] end) -function private.wait_for_callback(...) +function wait_for_callback(...) local send_signal, signal_received = aux.util.signal() local suspended local ret @@ -69,17 +69,17 @@ function private.wait_for_callback(...) return aux.control.when(signal_received, function() return k(unpack(signal_received())) end) end -function private.total_pages(total_auctions) +function total_pages(total_auctions) return ceil(total_auctions / m.PAGE_SIZE) end -function private.last_page(total_auctions) +function last_page(total_auctions) local last_page = max(m.total_pages(total_auctions) - 1, 0) local last_page_limit = m.query.blizzard_query and m.query.blizzard_query.last_page or last_page return min(last_page_limit, last_page) end -function private.scan() +function scan() m.state.query_index = m.state.query_index and m.state.query_index + 1 or 1 if m.query() and (aux.index(m.query.blizzard_query, 'first_page') or 0) <= (aux.index(m.query.blizzard_query, 'last_page') or aux.huge) then if m.query.blizzard_query then @@ -93,7 +93,7 @@ function private.scan() end end -function private.process_query() +function process_query() if m.query.blizzard_query then return m.submit_query() else @@ -101,7 +101,7 @@ function private.process_query() end end -function private.submit_query() +function submit_query() aux.control.when(function() return m.state.params.type ~= 'list' or CanSendAuctionQuery() end, function() aux.call(m.state.params.on_submit_query) m.state.last_query_time = GetTime() @@ -127,7 +127,7 @@ function private.submit_query() end) end -function private.scan_page(i) +function scan_page(i) i = i or 1 local recurse = function(retry) if i >= m.PAGE_SIZE then @@ -172,7 +172,7 @@ function private.scan_page(i) return recurse() end -function private.wait_for_results() +function wait_for_results() local timeout = aux.util.later(m.state.last_query_time, 10) local send_signal, signal_received = aux.util.signal() aux.control.when(signal_received, function() @@ -201,7 +201,7 @@ function private.wait_for_results() end end -function private.wait_for_owner_results(send_signal) +function wait_for_owner_results(send_signal) if m.state.page == aux.current_owner_page then return send_signal() else @@ -209,7 +209,7 @@ function private.wait_for_owner_results(send_signal) end end -function private.wait_for_list_results(send_signal, signal_received) +function wait_for_list_results(send_signal, signal_received) local updated, last_update aux.control.event_listener('AUCTION_ITEM_LIST_UPDATE', function(kill) kill(signal_received()) @@ -225,7 +225,7 @@ function private.wait_for_list_results(send_signal, signal_received) end, send_signal) end -function private.owner_data_complete(type) +function owner_data_complete(type) for i=1,m.PAGE_SIZE do local auction_info = aux.info.auction(i, type) if auction_info and not auction_info.owner then diff --git a/components/stack.lua b/components/stack.lua index f318e46..c5b5734 100644 --- a/components/stack.lua +++ b/components/stack.lua @@ -1,28 +1,28 @@ aux.module 'stack' -private.state = nil +state = nil -function private.stack_size(slot) +function stack_size(slot) local container_item_info = aux.info.container_item(unpack(slot)) return container_item_info and container_item_info.count or 0 end -function private.charges(slot) +function charges(slot) local container_item_info = aux.info.container_item(unpack(slot)) return container_item_info and container_item_info.charges end -function private.max_stack(slot) +function max_stack(slot) local container_item_info = aux.info.container_item(unpack(slot)) return container_item_info and container_item_info.max_stack end -function private.locked(slot) +function locked(slot) local container_item_info = aux.info.container_item(unpack(slot)) return container_item_info and container_item_info.locked end -function private.find_item_slot(partial) +function find_item_slot(partial) for slot in aux.util.inventory() do if m.matching_item(slot, partial) and not aux.util.eq(slot, m.state.target_slot) then return slot @@ -30,12 +30,12 @@ function private.find_item_slot(partial) end end -function private.matching_item(slot, partial) +function matching_item(slot, partial) local item_info = aux.info.container_item(unpack(slot)) return item_info and item_info.item_key == m.state.item_key and aux.info.auctionable(item_info.tooltip) and (not partial or item_info.count < item_info.max_stack) end -function private.find_empty_slot() +function find_empty_slot() for slot, type in aux.util.inventory() do if type == 1 and not GetContainerItemInfo(unpack(slot)) then return slot @@ -43,7 +43,7 @@ function private.find_empty_slot() end end -function private.find_charge_item_slot() +function find_charge_item_slot() for slot in aux.util.inventory() do if m.matching_item(slot) and m.charges(slot) == m.state.target_size then return slot @@ -51,7 +51,7 @@ function private.find_charge_item_slot() end end -function private.move_item(from_slot, to_slot, amount, k) +function move_item(from_slot, to_slot, amount, k) if m.locked(from_slot) or m.locked(to_slot) then return aux.control.wait(k) end @@ -66,7 +66,7 @@ function private.move_item(from_slot, to_slot, amount, k) return aux.control.when(function() return m.stack_size(to_slot) == expected_size end, k) end -function private.process() +function process() if not m.state.target_slot or not m.matching_item(m.state.target_slot) then m.state.target_slot = m.find_item_slot() diff --git a/components/tooltip.lua b/components/tooltip.lua index 811afc6..bdabd64 100644 --- a/components/tooltip.lua +++ b/components/tooltip.lua @@ -2,9 +2,9 @@ aux.module 'tooltip' _G.aux_tooltip_value = true -private.game_tooltip_hooks = {} -private.hooked_setter = nil -private.game_tooltip_money = nil +game_tooltip_hooks = {} +hooked_setter = nil +game_tooltip_money = nil function m.LOAD() for func, hook in m.game_tooltip_hooks do @@ -43,7 +43,7 @@ function m.LOAD() end) end -function private.extend_tooltip(tooltip, link, quantity) +function extend_tooltip(tooltip, link, quantity) local item_id, suffix_id = aux.info.parse_link(link) quantity = IsShiftKeyDown() and quantity or 1 diff --git a/control.lua b/control.lua index 568b914..80d34e5 100644 --- a/control.lua +++ b/control.lua @@ -1,8 +1,8 @@ aux.module 'control' -private.event_frame = CreateFrame('Frame') -private.listeners = {} -private.threads = {} +event_frame = CreateFrame('Frame') +listeners = {} +threads = {} public.thread_id = nil function m.LOAD() @@ -10,7 +10,7 @@ function m.LOAD() m.event_frame:SetScript('OnEvent', m.EVENT) end -function private.EVENT() +function EVENT() for _, listener in m.listeners do if event == listener.event and not listener.killed then listener.cb(listener.kill) @@ -18,7 +18,7 @@ function private.EVENT() end end -function private.UPDATE() +function UPDATE() for _, listener in m.listeners do if not aux.util.any(m.listeners, function(l) return not l.killed and l.event == listener.event end) then m.event_frame:UnregisterEvent(listener.event) @@ -44,7 +44,7 @@ end do local id = 0 - function private.id() + function id() id = id + 1 return id end diff --git a/core.lua b/core.lua index 80cd198..15de7ab 100644 --- a/core.lua +++ b/core.lua @@ -45,7 +45,7 @@ function public.L(body_string) return loadstring 'function()' end -private.tabs = {} +tabs = {} function public.tab(index, name) local module_env = getfenv(2) local tab = {name=name, env=module_env} @@ -53,16 +53,16 @@ function public.tab(index, name) return tab == m.active_tab() end for _, handler in {'OPEN', 'CLOSE', 'CLICK_LINK', 'USE_ITEM'} do - module_env.private[handler] = nil + module_env.mutable[handler] = nil end m.tabs[index] = tab end do local active_tab_index - private.active_tab = m.dynamic_table(nil, function() + active_tab = m.dynamic_table(nil, function() return m.tabs[active_tab_index] end) - function private.on_tab_click(index) + function on_tab_click(index) if active_tab_index then m.call(m.active_tab.env.m.CLOSE) end @@ -140,13 +140,13 @@ function public.VARIABLES_LOADED() end end -function private.AUCTION_HOUSE_SHOW() +function AUCTION_HOUSE_SHOW() AuctionFrame:Hide() m.frame:Show() m.set_tab(1) end -function private.AUCTION_HOUSE_CLOSED() +function AUCTION_HOUSE_CLOSED() m.bids_loaded = false m.current_owner_page = nil m.post.stop() @@ -156,11 +156,11 @@ function private.AUCTION_HOUSE_CLOSED() m.frame:Hide() end -function private.AUCTION_BIDDER_LIST_UPDATE() +function AUCTION_BIDDER_LIST_UPDATE() m.bids_loaded = true end -function private.AUCTION_OWNED_LIST_UPDATE() +function AUCTION_OWNED_LIST_UPDATE() m.current_owner_page = m.last_owner_page_requested or 0 end @@ -271,19 +271,19 @@ function public.hook(name, handler, object) object[name] = handler end -function private.GetOwnerAuctionItems(...) +function GetOwnerAuctionItems(...) local page = arg[1] m.last_owner_page_requested = page return m.orig.GetOwnerAuctionItems(unpack(arg)) end -function private.AuctionFrameAuctions_OnEvent(...) +function AuctionFrameAuctions_OnEvent(...) if AuctionFrameAuctions:IsVisible() then return m.orig.AuctionFrameAuctions_OnEvent(unpack(arg)) end end -function private.SetItemRef(...) +function SetItemRef(...) if arg[3] ~= 'RightButton' or not m.index(m.active_tab(), 'env', 'CLICK_LINK') or not strfind(arg[1], '^item:%d+') then return m.orig.SetItemRef(unpack(arg)) end @@ -292,7 +292,7 @@ function private.SetItemRef(...) end end -function private.UseContainerItem(...) +function UseContainerItem(...) if m.modified() or not m.index(m.active_tab(), 'env', 'USE_ITEM') then return m.orig.UseContainerItem(unpack(arg)) end diff --git a/gui.lua b/gui.lua index 3660d28..d86c9ba 100644 --- a/gui.lua +++ b/gui.lua @@ -1,7 +1,7 @@ aux.module 'gui' public.config = { - color = { + colors = { text = {enabled = {255, 254, 250, 1}, disabled = {147, 151, 139, 1}}, label = {enabled = {216, 225, 211, 1}, disabled = {150, 148, 140, 1}}, link = {153, 255, 255, 1}, @@ -31,17 +31,22 @@ public.config = { huge_font_size = 23, } -function private.color_accessor(callback) - return aux.index_function({callback=callback, table=m.config.color}, function(self, key) +do + local function index_handler(self, key) self.private.table = self.private.table[key] if getn(self.private.table) == 0 then return self.public else local color = aux.util.copy(self.private.table) - self.private.table = m.config.color - return callback(color) + self.private.table = config.colors + return self.private.callback(color) end - end) + end + function color_accessor(callback) + return function() + return aux.index_function({callback=callback, table=config.colors}, index_handler) + end + end end do @@ -55,13 +60,13 @@ do end end } - public.color = m.color_accessor(function(color) + public.accessor.color = m.color_accessor(function(color) local r, g, b, a = unpack(color) return setmetatable({r/255, g/255, b/255, a}, mt) end) end -public.inline_color = m.color_accessor(function(color) +public.accessor.inline_color = m.color_accessor(function(color) local r, g, b, a = unpack(color) return format('|c%02X%02X%02X%02X', a, r, g, b) end) @@ -70,7 +75,7 @@ do local id = 0 function public.name() id = id + 1 - return '_G.aux_frame'..id + return 'aux_frame'..id end end @@ -83,7 +88,7 @@ do menu:Show() end - function private.initialize_menu() + function initialize_menu() menu = CreateFrame('Frame', m.name(), UIParent, 'UIMenuTemplate') local orig = menu:GetScript('OnShow') menu:SetScript('OnShow', function() @@ -108,7 +113,7 @@ end do local blizzard_backdrop, aux_background, aux_border - function private.initialize_dropdown() + function initialize_dropdown() aux_border = DropDownList1:CreateTexture() aux_border:SetTexture(1, 1, 1, .02) aux_border:SetPoint('TOPLEFT', DropDownList1Backdrop, 'TOPLEFT', -2, 2) @@ -130,7 +135,7 @@ do end) end - function private.set_aux_dropdown_style(dropdown) + function set_aux_dropdown_style(dropdown) DropDownList1Backdrop:SetBackdrop{} aux_border:Show() aux_background:Show() @@ -159,7 +164,7 @@ do end end - function private.set_blizzard_dropdown_style() + function set_blizzard_dropdown_style() DropDownList1Backdrop:SetBackdrop(blizzard_backdrop) aux_border:Hide() aux_background:Hide() diff --git a/init.lua b/init.lua index c003b55..44e5f1c 100644 --- a/init.lua +++ b/init.lua @@ -2,7 +2,7 @@ setglobal('aux', aux_module()) public.version = '4.0.0' -private.module_envs = {} +module_envs = {} function public.module(path) local env if path == '' then @@ -16,7 +16,7 @@ function public.module(path) env = m.module_envs[qualified_name] if not env then (prefix and m.module_envs[prefix].public or public)[name], env = (function() return aux_module(), getfenv() end)() - env.private.LOAD = nil + env.LOAD = nil m.module_envs[qualified_name] = env end prefix = qualified_name @@ -29,7 +29,7 @@ local event_frame = CreateFrame 'Frame' for _, event in {'VARIABLES_LOADED', 'ADDON_LOADED', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE'} do event_frame:RegisterEvent(event) end -private.ADDON_LOADED = {} +ADDON_LOADED = {} event_frame:SetScript('OnEvent', function() if event == 'ADDON_LOADED' then if m.ADDON_LOADED[arg1] then diff --git a/module.lua b/module.lua index 57893c2..51e7b4a 100644 --- a/module.lua +++ b/module.lua @@ -33,7 +33,7 @@ local interface_mt = { if mask(ACCESSOR+PUBLIC, properties) == PUBLIC then return value elseif mask(PUBLIC, properties) == PUBLIC then - return value() + return value(key) else error('No key "'..key..'".', 2) end diff --git a/tables/auction_listing.lua b/tables/auction_listing.lua index 01989be..407dadd 100644 --- a/tables/auction_listing.lua +++ b/tables/auction_listing.lua @@ -21,7 +21,7 @@ local TIME_LEFT_STRINGS = { aux.gui.color.blue '24h', -- Very Long } -function private.item_column_init(rt, cell) +function item_column_init(rt, cell) local spacer = CreateFrame('Frame', nil, cell) spacer:SetPoint('TOPLEFT', 0, 0) spacer:SetHeight(rt.ROW_HEIGHT) @@ -518,7 +518,7 @@ public.bids_config = { }, } -function private.record_percentage(record) +function record_percentage(record) if not record then return end local historical_value = aux.history.value(record.item_key) or 0 @@ -530,7 +530,7 @@ function private.record_percentage(record) end end -function private.percentage_color(pct) +function percentage_color(pct) for i=1,getn(AUCTION_PCT_COLORS) do if pct < AUCTION_PCT_COLORS[i].value then return AUCTION_PCT_COLORS[i].color diff --git a/tabs/auctions/core.lua b/tabs/auctions/core.lua index 9da7e43..ef5c874 100644 --- a/tabs/auctions/core.lua +++ b/tabs/auctions/core.lua @@ -1,7 +1,7 @@ aux.module 'auctions_tab' aux.tab(3, 'Auctions') -private.auction_records = nil +auction_records = nil function m.LOAD() m.create_frames() @@ -16,7 +16,7 @@ function m.CLOSE() m.frame:Hide() end -function private.update_listing() +function update_listing() if not m:ACTIVE() then return end @@ -53,7 +53,7 @@ function public.scan_auctions() } end -function private.test(record) +function test(record) return function(index) local auction_info = aux.info.auction(index, 'owner') return auction_info and auction_info.search_signature == record.search_signature @@ -66,7 +66,7 @@ do local state = IDLE local found_index - function private.find_auction(record) + function find_auction(record) if not m.listing:ContainsRecord(record) then return end @@ -97,7 +97,7 @@ do ) end - function private.on_update() + function on_update() if state == IDLE or state == SEARCHING then m.cancel_button:Disable() end diff --git a/tabs/auctions/frames.lua b/tabs/auctions/frames.lua index 250eff1..f52c3ad 100644 --- a/tabs/auctions/frames.lua +++ b/tabs/auctions/frames.lua @@ -1,7 +1,7 @@ aux.module 'auctions_tab' -function private.create_frames() - private.frame = CreateFrame('Frame', nil, aux.frame) +function create_frames() + frame = CreateFrame('Frame', nil, aux.frame) m.frame:SetAllPoints() m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() @@ -11,7 +11,7 @@ function private.create_frames() m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) - private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.auctions_config) + 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) @@ -31,7 +31,7 @@ function private.create_frames() status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) status_bar:update_status(100, 100) status_bar:set_text('') - private.status_bar = status_bar + status_bar = status_bar end do local btn = aux.gui.button(m.frame, 16) @@ -40,7 +40,7 @@ function private.create_frames() btn:SetHeight(24) btn:SetText('Cancel') btn:Disable() - private.cancel_button = btn + cancel_button = btn end do local btn = aux.gui.button(m.frame, 16) diff --git a/tabs/bids/core.lua b/tabs/bids/core.lua index 5063110..9b6c6c4 100644 --- a/tabs/bids/core.lua +++ b/tabs/bids/core.lua @@ -1,7 +1,7 @@ aux.module 'bids_tab' aux.tab(4, 'Bids') -private.auction_records = nil +auction_records = nil function m.LOAD() m.create_frames() @@ -16,7 +16,7 @@ function m.CLOSE() m.frame:Hide() end -function private.update_listing() +function update_listing() if not m:ACTIVE() then return end @@ -53,7 +53,7 @@ function public.scan_bids() } end -function private.test(record) +function test(record) return function(index) local auction_info = aux.info.auction(index, 'bidder') return auction_info and auction_info.search_signature == record.search_signature @@ -66,7 +66,7 @@ do local state = IDLE local found_index - function private.find_auction(record) + function find_auction(record) if not m.listing:ContainsRecord(record) then return end @@ -111,7 +111,7 @@ do ) end - function private.on_update() + function on_update() if state == IDLE or state == SEARCHING then m.buyout_button:Disable() m.bid_button:Disable() diff --git a/tabs/bids/frames.lua b/tabs/bids/frames.lua index 73f7e02..0df2230 100644 --- a/tabs/bids/frames.lua +++ b/tabs/bids/frames.lua @@ -1,7 +1,7 @@ aux.module 'bids_tab' -function private.create_frames() - private.frame = CreateFrame('Frame', nil, aux.frame) +function create_frames() + frame = CreateFrame('Frame', nil, aux.frame) m.frame:SetAllPoints() m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() @@ -11,7 +11,7 @@ function private.create_frames() m.frame.listing:SetPoint('BOTTOMLEFT', aux.frame.content, 'BOTTOMLEFT', 0, 0) m.frame.listing:SetPoint('BOTTOMRIGHT', aux.frame.content, 'BOTTOMRIGHT', 0, 0) - private.listing = aux.auction_listing.CreateAuctionResultsTable(m.frame.listing, aux.auction_listing.bids_config) + 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) @@ -35,7 +35,7 @@ function private.create_frames() status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) status_bar:update_status(100, 0) status_bar:set_text('') - private.status_bar = status_bar + status_bar = status_bar end do local btn = aux.gui.button(m.frame, 16) @@ -44,7 +44,7 @@ function private.create_frames() btn:SetHeight(24) btn:SetText('Bid') btn:Disable() - private.bid_button = btn + bid_button = btn end do local btn = aux.gui.button(m.frame, 16) @@ -53,7 +53,7 @@ function private.create_frames() btn:SetHeight(24) btn:SetText('Buyout') btn:Disable() - private.buyout_button = btn + buyout_button = btn end do local btn = aux.gui.button(m.frame, 16) diff --git a/tabs/post/core.lua b/tabs/post/core.lua index 60eb9a0..da9cdfb 100644 --- a/tabs/post/core.lua +++ b/tabs/post/core.lua @@ -4,11 +4,11 @@ aux.tab(2, 'Post') 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'}} -private.existing_auctions = {} -private.inventory_records = nil -private.scan_id = 0 -private.selected_item = nil -private.refresh = nil +existing_auctions = {} +inventory_records = nil +scan_id = 0 +selected_item = nil +refresh = nil function m.LOAD() m.create_frames() @@ -36,7 +36,7 @@ function m.USE_ITEM(item_info) m.select_item(item_info.item_key) end -function private.default_settings() +function default_settings() return { duration = DURATION_8, stack_size = 1, @@ -46,7 +46,7 @@ function private.default_settings() } end -function private.read_settings(item_key) +function read_settings(item_key) item_key = item_key or m.selected_item.key local dataset = aux.persistence.load_dataset() dataset.post = dataset.post or {} @@ -60,7 +60,7 @@ function private.read_settings(item_key) return settings end -function private.write_settings(settings, item_key) +function write_settings(settings, item_key) item_key = item_key or m.selected_item.key local dataset = aux.persistence.load_dataset() @@ -69,25 +69,25 @@ function private.write_settings(settings, item_key) dataset.post[item_key] = aux.persistence.write(settings_schema, settings) end -function private.get_unit_start_price() +function get_unit_start_price() local money_text = m.unit_start_price:GetText() return aux.money.from_string(money_text) or 0 end -function private.set_unit_start_price(amount) +function set_unit_start_price(amount) m.unit_start_price:SetText(aux.money.to_string(amount, true, nil, 3)) end -function private.get_unit_buyout_price() +function get_unit_buyout_price() local money_text = m.unit_buyout_price:GetText() return aux.money.from_string(money_text) or 0 end -function private.set_unit_buyout_price(amount) +function set_unit_buyout_price(amount) m.unit_buyout_price:SetText(aux.money.to_string(amount, true, nil, 3)) end -function private.update_inventory_listing() +function update_inventory_listing() if not m.ACTIVE() then return end @@ -98,7 +98,7 @@ function private.update_inventory_listing() end))) end -function private.update_auction_listing() +function update_auction_listing() if not m.ACTIVE() then return end @@ -183,7 +183,7 @@ function public.select_item(item_key) end end -function private.price_update() +function price_update() if m.selected_item then local settings = m.read_settings() @@ -201,7 +201,7 @@ function private.price_update() end end -function private.post_auctions() +function post_auctions() if m.selected_item then local unit_start_price = m.get_unit_start_price() local unit_buyout_price = m.get_unit_buyout_price() @@ -247,7 +247,7 @@ function private.post_auctions() end end -function private.validate_parameters() +function validate_parameters() if not m.selected_item then m.post_button:Disable() @@ -272,7 +272,7 @@ function private.validate_parameters() m.post_button:Enable() end -function private.update_item_configuration() +function update_item_configuration() if not m.selected_item then m.refresh_button:Disable() @@ -327,7 +327,7 @@ function private.update_item_configuration() end end -function private.undercut(record, stack_size, stack) +function undercut(record, stack_size, stack) local start_price = aux.util.round(record.unit_blizzard_bid * (stack and record.stack_size or stack_size)) local buyout_price = aux.util.round(record.unit_buyout_price * (stack and record.stack_size or stack_size)) @@ -339,7 +339,7 @@ function private.undercut(record, stack_size, stack) return start_price / stack_size, buyout_price / stack_size end -function private.quantity_update(max_count) +function quantity_update(max_count) if m.selected_item then local max_stack_count = m.selected_item.max_charges and m.selected_item.availability[m.stack_size_slider:GetValue()] or floor(m.selected_item.availability[0] / m.stack_size_slider:GetValue()) m.stack_count_slider:SetMinMaxValues(1, max_stack_count) @@ -350,7 +350,7 @@ function private.quantity_update(max_count) m.refresh = true end -function private.unit_vendor_price(item_key) +function unit_vendor_price(item_key) for slot in aux.util.inventory() do @@ -374,7 +374,7 @@ function private.unit_vendor_price(item_key) end end -function private.update_historical_value_button() +function update_historical_value_button() if m.selected_item then local historical_value = aux.history.value(m.selected_item.key) m.historical_value_button.amount = historical_value @@ -382,7 +382,7 @@ function private.update_historical_value_button() end end -function private.set_item(item) +function set_item(item) local settings = m.read_settings(item.key) item.unit_vendor_price = m.unit_vendor_price(item.key) @@ -417,7 +417,7 @@ function private.set_item(item) m.refresh = true end -function private.update_inventory_records() +function update_inventory_records() m.inventory_records = {} m.refresh = true @@ -470,7 +470,7 @@ function private.update_inventory_records() m.refresh = true end -function private.refresh_entries() +function refresh_entries() if m.selected_item then local item_id, suffix_id = m.selected_item.item_id, m.selected_item.suffix_id local item_key = item_id..':'..suffix_id @@ -518,7 +518,7 @@ function private.refresh_entries() end end -function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price, duration, owner) +function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price, duration, owner) m.existing_auctions[key] = m.existing_auctions[key] or {} local entry for _, existing_entry in m.existing_auctions[key] do @@ -544,7 +544,7 @@ function private.record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyou return entry end -function private.on_update() +function on_update() if m.refresh then m.refresh = false m.price_update() @@ -557,7 +557,7 @@ function private.on_update() m.validate_parameters() end -function private.initialize_duration_dropdown() +function initialize_duration_dropdown() local function on_click() UIDropDownMenu_SetSelectedValue(m.duration_dropdown, this.value) diff --git a/tabs/post/frames.lua b/tabs/post/frames.lua index 202b2a9..f1d97ca 100644 --- a/tabs/post/frames.lua +++ b/tabs/post/frames.lua @@ -1,7 +1,7 @@ aux.module 'post_tab' -function private.create_frames() - private.frame = CreateFrame('Frame', nil, aux.frame) +function create_frames() + frame = CreateFrame('Frame', nil, aux.frame) m.frame:SetAllPoints() m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() @@ -35,12 +35,12 @@ function private.create_frames() 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 + show_hidden_checkbox = checkbox end aux.gui.horizontal_line(m.frame.inventory, -48) - private.item_listing = aux.item_listing.create( + item_listing = aux.item_listing.create( m.frame.inventory, function() if arg1 == 'LeftButton' then @@ -56,7 +56,7 @@ function private.create_frames() end ) - private.auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions) + auction_listing = aux.listing.CreateScrollingTable(m.frame.auctions) m.auction_listing:SetColInfo({ { name='Auctions', width=.12, align='CENTER' }, { name='Left', width=.1, align='CENTER' }, @@ -87,7 +87,7 @@ function private.create_frames() status_bar:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) status_bar:update_status(100, 100) status_bar:set_text('') - private.status_bar = status_bar + status_bar = status_bar end do local btn = aux.gui.button(m.frame.parameters, 16) @@ -96,7 +96,7 @@ function private.create_frames() btn:SetHeight(24) btn:SetText('Post') btn:SetScript('OnClick', m.post_auctions) - private.post_button = btn + post_button = btn end do local btn = aux.gui.button(m.frame.parameters, 16) @@ -109,7 +109,7 @@ function private.create_frames() m.refresh_entries() m.refresh = true end) - private.refresh_button = btn + refresh_button = btn end do local item = aux.gui.item(m.frame.parameters) @@ -122,7 +122,7 @@ function private.create_frames() item.button:SetScript('OnLeave', function() GameTooltip:Hide() end) - private.item = item + item = item end do local slider = aux.gui.slider(m.frame.parameters) @@ -153,7 +153,7 @@ function private.create_frames() slider.editbox:SetNumeric(true) slider.editbox:SetMaxLetters(3) slider.label:SetText('Stack Size') - private.stack_size_slider = slider + stack_size_slider = slider end do local slider = aux.gui.slider(m.frame.parameters) @@ -176,7 +176,7 @@ function private.create_frames() end) slider.editbox:SetNumeric(true) slider.label:SetText('Stack Count') - private.stack_count_slider = slider + stack_count_slider = slider end do local dropdown = aux.gui.dropdown(m.frame.parameters) @@ -189,12 +189,12 @@ function private.create_frames() dropdown:SetScript('OnShow', function() UIDropDownMenu_Initialize(this, m.initialize_duration_dropdown) end) - private.duration_dropdown = dropdown + duration_dropdown = dropdown end do local label = aux.gui.label(m.frame.parameters, aux.gui.config.medium_font_size) label:SetPoint('LEFT', m.duration_dropdown, 'RIGHT', 25, 0) - private.deposit = label + deposit = label end do local checkbox = aux.gui.checkbox(m.frame.parameters) @@ -208,11 +208,11 @@ function private.create_frames() 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 + hide_checkbox = checkbox end do local frame = CreateFrame('Frame', nil, m.frame.parameters) - private.start_price_frame = frame + start_price_frame = frame aux.gui.set_content_style(frame) frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60) frame:SetWidth(180) @@ -260,13 +260,13 @@ function private.create_frames() label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) label:SetWidth(50) label:SetJustifyH('CENTER') - private.start_price_percentage = label + start_price_percentage = label end - private.unit_start_price = editbox + unit_start_price = editbox end do local frame = CreateFrame('Frame', nil, m.frame.parameters) - private.buyout_price_frame = frame + buyout_price_frame = frame aux.gui.set_content_style(frame) frame:SetPoint('TOPRIGHT', m.unit_start_price, 'BOTTOMRIGHT', 0, -19) frame:SetWidth(180) @@ -315,9 +315,9 @@ function private.create_frames() label:SetPoint('LEFT', frame, 'RIGHT', 8, 0) label:SetWidth(50) label:SetJustifyH('CENTER') - private.buyout_price_percentage = label + buyout_price_percentage = label end - private.unit_buyout_price = editbox + unit_buyout_price = editbox end do local btn = aux.gui.button(m.frame.parameters, 14) @@ -335,6 +335,6 @@ function private.create_frames() 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 + historical_value_button = btn end end \ No newline at end of file diff --git a/tabs/search/core.lua b/tabs/search/core.lua index 1ad7026..65c9fc8 100644 --- a/tabs/search/core.lua +++ b/tabs/search/core.lua @@ -48,7 +48,7 @@ do } end -private.RESULTS, private.SAVED, private.FILTER = 1, 2, 3 +RESULTS, SAVED, FILTER = 1, 2, 3 function m.LOAD() m.create_frames() @@ -79,7 +79,7 @@ function m.USE_ITEM(item_info) m.execute(nil, false) end -function private.update_tab(tab) +function update_tab(tab) m.search_results_button:UnlockHighlight() m.saved_searches_button:UnlockHighlight() @@ -115,7 +115,7 @@ function public.add_filter(filter_string) m.search_box:SetText(old_filter_string..filter_string) end -function private.blizzard_page_index(str) +function blizzard_page_index(str) if tonumber(str) then return max(0, tonumber(str) - 1) end diff --git a/tabs/search/filter.lua b/tabs/search/filter.lua index 05b1115..08bd9ef 100644 --- a/tabs/search/filter.lua +++ b/tabs/search/filter.lua @@ -1,11 +1,11 @@ aux.module 'search_tab' -function private.valid_level(str) +function valid_level(str) local level = tonumber(str) return level and aux.util.bound(1, 60, level) end -private.blizzard_query = setmetatable({}, { +blizzard_query = setmetatable({}, { __newindex = function(_, key, value) if key == 'name' then m.name_input:SetText(value) @@ -58,7 +58,7 @@ private.blizzard_query = setmetatable({}, { end, }) -function private.update_form() +function update_form() if m.blizzard_query.class and GetAuctionItemSubClasses(m.blizzard_query.class) then m.subclass_dropdown.button:Enable() else @@ -99,7 +99,7 @@ function private.update_form() end end -function private.get_filter_builder_query() +function get_filter_builder_query() local query_string local function add(part) @@ -140,7 +140,7 @@ function private.get_filter_builder_query() return query_string or '' end -function private.set_form(components) +function set_form(components) m.clear_form() for key, filter in components.blizzard do m.blizzard_query[key] = filter[2] @@ -151,7 +151,7 @@ function private.set_form(components) m.update_filter_display() end -function private.clear_form() +function clear_form() m.blizzard_query.name = '' m.name_input:ClearFocus() m.blizzard_query.exact = false @@ -170,7 +170,7 @@ function private.clear_form() m.update_filter_display() end -function private.import_query_string() +function import_query_string() local components, error = aux.filter.parse_query_string(aux.util.select(3, strfind(m.search_box:GetText(), '^([^;]*)'))) if components then m.set_form(components) @@ -179,7 +179,7 @@ function private.import_query_string() end end -function private.export_query_string() +function export_query_string() m.search_box:SetText(m.get_filter_builder_query()) m.filter_parameter_input:ClearFocus() end @@ -228,14 +228,14 @@ function public.formatted_post_filter(components) return '

'..str..'

' end -function private.data_link(id, str) +function data_link(id, str) return '|H'..id..'|h'..str..'|h' end -private.post_filter = {} -private.filter_builder_state = {selected = 0} +post_filter = {} +filter_builder_state = {selected = 0} -function private.data_link_click() +function data_link_click() local button = arg3 local index = tonumber(arg1) if button == 'LeftButton' then @@ -246,7 +246,7 @@ function private.data_link_click() m.update_filter_display() end -function private.remove_component(index) +function remove_component(index) index = index or m.filter_builder_state.selected if m.filter_builder_state.selected >= index then m.filter_builder_state.selected = max(m.filter_builder_state.selected - 1, min(1, getn(m.post_filter))) @@ -255,12 +255,12 @@ function private.remove_component(index) tremove(m.post_filter, index) end -function private.add_component(component) +function add_component(component) m.filter_builder_state.selected = m.filter_builder_state.selected + 1 tinsert(m.post_filter, m.filter_builder_state.selected, component) end -function private.add_post_filter() +function add_post_filter() for str in aux.util.present(m.filter_input:GetText()) do for filter in aux.util.present(aux.filter.filters[str]) do if filter.input_type ~= '' then @@ -285,14 +285,14 @@ end do local text = '' - function private.update_filter_display() + function update_filter_display() text = m.formatted_post_filter(m.post_filter) m.filter_display:SetWidth(m.filter_display_size()) m.set_filter_display_offset() m.filter_display:SetText(text) end - function private.filter_display_size() + function filter_display_size() local font, font_size = m.filter_display:GetFont() m.filter_display.measure:SetFont(font, font_size) local lines = 0 @@ -306,7 +306,7 @@ do end end -function private.set_filter_display_offset(x_offset, y_offset) +function set_filter_display_offset(x_offset, y_offset) local scroll_frame = m.filter_display:GetParent() x_offset, y_offset = x_offset or scroll_frame:GetHorizontalScroll(), y_offset or scroll_frame:GetVerticalScroll() local width, height = m.filter_display_size() @@ -318,7 +318,7 @@ function private.set_filter_display_offset(x_offset, y_offset) scroll_frame:SetVerticalScroll(aux.util.bound(y_lower_bound, y_upper_bound, y_offset)) end -function private.initialize_filter_dropdown() +function initialize_filter_dropdown() for _, filter in {'and', 'or', 'not', 'min-unit-bid', 'min-unit-buy', 'max-unit-bid', 'max-unit-buy', 'bid-profit', 'buy-profit', 'bid-vend-profit', 'buy-vend-profit', 'bid-dis-profit', 'buy-dis-profit', 'bid-pct', 'buy-pct', 'item', 'tooltip', 'min-lvl', 'max-lvl', 'rarity', 'left', 'utilizable', 'discard'} do UIDropDownMenu_AddButton{ text = filter, @@ -338,7 +338,7 @@ function private.initialize_filter_dropdown() end end -function private.initialize_class_dropdown() +function initialize_class_dropdown() local function on_click() if this.value ~= m.blizzard_query.class then UIDropDownMenu_SetSelectedValue(m.class_dropdown, this.value) @@ -365,7 +365,7 @@ function private.initialize_class_dropdown() end end -function private.initialize_subclass_dropdown() +function initialize_subclass_dropdown() local function on_click() if this.value ~= m.blizzard_query.subclass then UIDropDownMenu_SetSelectedValue(m.subclass_dropdown, this.value) @@ -394,7 +394,7 @@ function private.initialize_subclass_dropdown() end end -function private.initialize_slot_dropdown() +function initialize_slot_dropdown() local function on_click() UIDropDownMenu_SetSelectedValue(m.slot_dropdown, this.value) m.update_form() @@ -420,7 +420,7 @@ function private.initialize_slot_dropdown() end end -function private.initialize_quality_dropdown() +function initialize_quality_dropdown() local function on_click() UIDropDownMenu_SetSelectedValue(m.quality_dropdown, this.value) m.update_form() diff --git a/tabs/search/frames.lua b/tabs/search/frames.lua index 099abc2..0b9526f 100644 --- a/tabs/search/frames.lua +++ b/tabs/search/frames.lua @@ -1,9 +1,9 @@ aux.module 'search_tab' -private.FILTER_SPACING = 28.5 +FILTER_SPACING = 28.5 -function private.create_frames() - private.frame = CreateFrame('Frame', nil, aux.frame) +function create_frames() + frame = CreateFrame('Frame', nil, aux.frame) m.frame:SetAllPoints() m.frame:SetScript('OnUpdate', m.on_update) m.frame:Hide() @@ -49,7 +49,7 @@ function private.create_frames() fake_icon_part:SetText('_') end - private.settings_button = btn + settings_button = btn end do local panel = CreateFrame('Frame', nil, m.frame) @@ -59,14 +59,14 @@ function private.create_frames() panel:SetPoint('RIGHT', 0, 0) panel:SetHeight(42) panel:Hide() - private.settings = panel + settings = panel end do local panel = CreateFrame('Frame', nil, m.frame) panel:SetPoint('LEFT', m.settings_button, 'RIGHT', 0, 0) panel:SetPoint('RIGHT', 0, 1) panel:SetHeight(40) - private.controls = panel + controls = panel end do local editbox = aux.gui.editbox(m.settings) @@ -97,7 +97,7 @@ function private.create_frames() label:SetPoint('RIGHT', editbox, 'LEFT', -6, 0) label:SetText('Pages') label:SetTextColor(unpack(aux.gui.color.text.enabled)) - private.first_page_input = editbox + first_page_input = editbox end do local editbox = aux.gui.editbox(m.settings) @@ -128,7 +128,7 @@ function private.create_frames() label:SetPoint('RIGHT', editbox, 'LEFT', -3.5, 0) label:SetText('-') label:SetTextColor(unpack(aux.gui.color.text.enabled)) - private.last_page_input = editbox + last_page_input = editbox end do local btn = aux.gui.checkbutton(m.settings) @@ -158,7 +158,7 @@ function private.create_frames() StaticPopup_Show('AUX_SEARCH_AUTO_BUY') end end) - private.auto_buy_button = btn + auto_buy_button = btn end do local btn = aux.gui.checkbutton(m.settings) @@ -186,7 +186,7 @@ function private.create_frames() btn:SetScript('OnLeave', function() GameTooltip:Hide() end) - private.auto_buy_filter_button = btn + auto_buy_filter_button = btn end do local btn = aux.gui.button(m.controls, 25) @@ -195,7 +195,7 @@ function private.create_frames() btn:SetHeight(25) btn:SetText('<') btn:SetScript('OnClick', m.previous_search) - private.previous_button = btn + previous_button = btn end do local btn = aux.gui.button(m.controls, 25) @@ -204,7 +204,7 @@ function private.create_frames() btn:SetHeight(25) btn:SetText('>') btn:SetScript('OnClick', m.next_search) - private.next_button = btn + next_button = btn end do local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) @@ -219,7 +219,7 @@ function private.create_frames() end m.execute() end) - private.start_button = btn + start_button = btn end do local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) @@ -230,7 +230,7 @@ function private.create_frames() btn:SetScript('OnClick', function() aux.scan.abort(m.search_scan_id) end) - private.stop_button = btn + stop_button = btn end do local btn = aux.gui.button(m.controls, aux.gui.config.huge_font_size) @@ -241,7 +241,7 @@ function private.create_frames() btn:SetScript('OnClick', function() m.execute(true) end) - private.resume_button = btn + resume_button = btn end do local editbox = aux.gui.editbox(m.controls) @@ -257,7 +257,7 @@ function private.create_frames() this:HighlightText(0, 0) end) editbox:SetScript('OnEnterPressed', m.execute) - private.search_box = editbox + search_box = editbox end do aux.gui.horizontal_line(m.frame, -40) @@ -269,7 +269,7 @@ function private.create_frames() btn:SetHeight(22) btn:SetText('Search Results') btn:SetScript('OnClick', function() m.update_tab(m.RESULTS) end) - private.search_results_button = btn + search_results_button = btn end do local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) @@ -278,7 +278,7 @@ function private.create_frames() btn:SetHeight(22) btn:SetText('Saved Searches') btn:SetScript('OnClick', function() m.update_tab(m.SAVED) end) - private.saved_searches_button = btn + saved_searches_button = btn end do local btn = aux.gui.button(m.frame, aux.gui.config.large_font_size2) @@ -287,14 +287,14 @@ function private.create_frames() btn:SetHeight(22) btn:SetText('Filter Builder') btn:SetScript('OnClick', function() m.update_tab(m.FILTER) end) - private.new_filter_button = btn + new_filter_button = btn end do local frame = CreateFrame('Frame', nil, m.frame) frame:SetWidth(265) frame:SetHeight(25) frame:SetPoint('TOPLEFT', aux.frame.content, 'BOTTOMLEFT', 0, -6) - private.status_bar_frame = frame + status_bar_frame = frame end do local btn = aux.gui.button(m.frame.results, 16) @@ -303,7 +303,7 @@ function private.create_frames() btn:SetHeight(24) btn:SetText('Bid') btn:Disable() - private.bid_button = btn + bid_button = btn end do local btn = aux.gui.button(m.frame.results, 16) @@ -312,7 +312,7 @@ function private.create_frames() btn:SetHeight(24) btn:SetText('Buyout') btn:Disable() - private.buyout_button = btn + buyout_button = btn end do local btn = aux.gui.button(m.frame.results, 16) @@ -392,7 +392,7 @@ function private.create_frames() local label = aux.gui.label(editbox, aux.gui.config.small_font_size) label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetText('Name') - private.name_input = editbox + name_input = editbox end do local checkbox = aux.gui.checkbox(m.frame.filter) @@ -401,7 +401,7 @@ function private.create_frames() local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) label:SetText('Exact') - private.exact_checkbox = checkbox + exact_checkbox = checkbox end do local editbox = aux.gui.editbox(m.frame.filter) @@ -426,7 +426,7 @@ function private.create_frames() local label = aux.gui.label(editbox, aux.gui.config.small_font_size) label:SetPoint('BOTTOMLEFT', editbox, 'TOPLEFT', -2, 1) label:SetText('Level Range') - private.min_level_input = editbox + min_level_input = editbox end do local editbox = aux.gui.editbox(m.frame.filter) @@ -451,7 +451,7 @@ function private.create_frames() local label = aux.gui.label(editbox, aux.gui.config.medium_font_size) label:SetPoint('RIGHT', editbox, 'LEFT', -3, 0) label:SetText('-') - private.max_level_input = editbox + max_level_input = editbox end do local checkbox = aux.gui.checkbox(m.frame.filter) @@ -460,11 +460,11 @@ function private.create_frames() local label = aux.gui.label(checkbox, aux.gui.config.small_font_size) label:SetPoint('BOTTOMLEFT', checkbox, 'TOPLEFT', -2, 1) label:SetText('Usable') - private.usable_checkbox = checkbox + usable_checkbox = checkbox end do local dropdown = aux.gui.dropdown(m.frame.filter) - private.class_dropdown = dropdown + class_dropdown = dropdown dropdown:SetPoint('TOPLEFT', m.min_level_input, 'BOTTOMLEFT', 0, 5 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) @@ -477,7 +477,7 @@ function private.create_frames() end do local dropdown = aux.gui.dropdown(m.frame.filter) - private.subclass_dropdown = dropdown + subclass_dropdown = dropdown dropdown:SetPoint('TOPLEFT', m.class_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) @@ -490,7 +490,7 @@ function private.create_frames() end do local dropdown = aux.gui.dropdown(m.frame.filter) - private.slot_dropdown = dropdown + slot_dropdown = dropdown dropdown:SetPoint('TOPLEFT', m.subclass_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) @@ -503,7 +503,7 @@ function private.create_frames() end do local dropdown = aux.gui.dropdown(m.frame.filter) - private.quality_dropdown = dropdown + quality_dropdown = dropdown dropdown:SetPoint('TOPLEFT', m.slot_dropdown, 'BOTTOMLEFT', 0, 10 - m.FILTER_SPACING) dropdown:SetWidth(300) local label = aux.gui.label(dropdown, aux.gui.config.small_font_size) @@ -527,7 +527,7 @@ function private.create_frames() local label = aux.gui.label(dropdown, aux.gui.config.medium_font_size) label:SetPoint('RIGHT', dropdown, 'LEFT', -15, 0) label:SetText('Post Filter') - private.filter_dropdown = dropdown + filter_dropdown = dropdown end do local input = aux.gui.editbox(m.frame.filter) @@ -558,7 +558,7 @@ function private.create_frames() m.add_post_filter() end end) - private.filter_input = input + filter_input = input end do local input = aux.gui.editbox(m.frame.filter) @@ -572,7 +572,7 @@ function private.create_frames() end) input:SetScript('OnEnterPressed', m.add_post_filter) input:Hide() - private.filter_parameter_input = input + filter_parameter_input = input end do local scroll_frame = CreateFrame('ScrollFrame', nil, m.frame.filter) @@ -615,11 +615,11 @@ function private.create_frames() scroll_child:SetScript('OnHyperlinkClick', m.data_link_click) -- scroll_child:SetHyperlinkFormat("format") scroll_child.measure = scroll_child:CreateFontString() - private.filter_display = scroll_child + filter_display = scroll_child end - private.status_bars = {} - private.tables = {} + status_bars = {} + tables = {} for _=1,5 do local status_bar = aux.gui.status_bar(m.frame) status_bar:SetAllPoints(m.status_bar_frame) @@ -689,7 +689,7 @@ function private.create_frames() end } - private.recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent) + recent_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.recent) m.recent_searches_listing:SetColInfo{{name='Recent Searches', width=1}} m.recent_searches_listing:EnableSorting(false) m.recent_searches_listing:DisableSelection(true) @@ -697,7 +697,7 @@ function private.create_frames() m.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter) m.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave) - private.favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite) + favorite_searches_listing = aux.listing.CreateScrollingTable(m.frame.saved.favorite) m.favorite_searches_listing:SetColInfo{{name='Favorite Searches', width=1}} m.favorite_searches_listing:EnableSorting(false) m.favorite_searches_listing:DisableSelection(true) diff --git a/tabs/search/results.lua b/tabs/search/results.lua index 47e2986..526fc91 100644 --- a/tabs/search/results.lua +++ b/tabs/search/results.lua @@ -2,18 +2,18 @@ aux.module 'search_tab' _G.aux_auto_buy_filter = '' -private.search_scan_id = 0 -private.auto_buy_validator = nil +search_scan_id = 0 +auto_buy_validator = nil do local searches = {} local search_index = 1 - function private.current_search() + function current_search() return searches[search_index] end - function private.update_search(index) + function update_search(index) searches[search_index].status_bar:Hide() searches[search_index].table:Hide() searches[search_index].table:SetSelectedRecord() @@ -40,7 +40,7 @@ do m.update_continuation() end - function private.new_search(filter_string) + function new_search(filter_string) while getn(searches) > search_index do tremove(searches) end @@ -68,26 +68,26 @@ do m.update_search(getn(searches)) end - function private.previous_search() + function previous_search() m.search_box:ClearFocus() m.update_search(search_index - 1) m.update_tab(m.RESULTS) end - function private.next_search() + function next_search() m.search_box:ClearFocus() m.update_search(search_index + 1) m.update_tab(m.RESULTS) end end -function private.close_settings() +function close_settings() if m.settings_button.open then m.settings_button:Click() end end -function private.update_continuation() +function update_continuation() if m.current_search().continuation then m.resume_button:Show() m.search_box:SetPoint('RIGHT', m.resume_button, 'LEFT', -4, 0) @@ -97,7 +97,7 @@ function private.update_continuation() end end -function private.discard_continuation() +function discard_continuation() aux.scan.abort(m.search_scan_id) m.current_search().continuation = nil m.update_continuation() @@ -113,7 +113,7 @@ function private:update_start_stop() end end -function private.update_auto_buy_filter() +function update_auto_buy_filter() if _G.aux_auto_buy_filter ~= '' then local queries = aux.filter.queries(_G.aux_auto_buy_filter) if queries then @@ -132,7 +132,7 @@ function private.update_auto_buy_filter() _G.aux_auto_buy_filter = '' end -function private.start_real_time_scan(query, search, continuation) +function start_real_time_scan(query, search, continuation) local ignore_page if not search then @@ -209,7 +209,7 @@ function private.start_real_time_scan(query, search, continuation) } end -function private.start_search(queries, continuation) +function start_search(queries, continuation) local current_query, current_page, total_queries, start_query, start_page local search = m.current_search() @@ -365,7 +365,7 @@ function public.execute(resume, real_time) end end -function private.test(record) +function test(record) return function(index) local auction_info = aux.info.auction(index) return auction_info and auction_info.search_signature == record.search_signature @@ -378,7 +378,7 @@ do local state = IDLE local found_index - function private.find_auction(record) + function find_auction(record) local search = m.current_search() if not search.table:ContainsRecord(record) or aux.is_player(record.owner) then @@ -429,7 +429,7 @@ do ) end - function private.on_update() + function on_update() if state == IDLE or state == SEARCHING then m.buyout_button:Disable() m.bid_button:Disable() diff --git a/tabs/search/saved.lua b/tabs/search/saved.lua index ac5383e..bd512d8 100644 --- a/tabs/search/saved.lua +++ b/tabs/search/saved.lua @@ -3,7 +3,7 @@ aux.module 'search_tab' _G.aux_favorite_searches = {} _G.aux_recent_searches = {} -function private.update_search_listings() +function update_search_listings() local favorite_search_rows = {} for i, favorite_search in _G.aux_favorite_searches do local name = strsub(favorite_search.prettified, 1, 250) @@ -27,7 +27,7 @@ function private.update_search_listings() m.recent_searches_listing:SetData(recent_search_rows) end -function private.new_recent_search(filter_string, prettified) +function new_recent_search(filter_string, prettified) tinsert(_G.aux_recent_searches, 1, { filter_string = filter_string, prettified = prettified, diff --git a/util/filter.lua b/util/filter.lua index 8c87619..d922a36 100644 --- a/util/filter.lua +++ b/util/filter.lua @@ -1,6 +1,6 @@ aux.module 'filter' -function private.default_filter(str) +function default_filter(str) return { input_type = '', validator = function() @@ -202,7 +202,7 @@ public.filters = { }, } -function private.operator(str) +function operator(str) local operator = str == 'not' and {'operator', 'not', 1} for _, name in {'and', 'or'} do for arity in aux.util.present(aux.util.select(3, strfind(str, '^'..name..'(%d*)$'))) do @@ -259,12 +259,12 @@ do end, } - function private.blizzard_filter_parser() + function blizzard_filter_parser() return setmetatable({}, mt) end end -function private.parse_parameter(input_type, str) +function parse_parameter(input_type, str) if input_type == 'money' then local money = aux.money.from_string(str) return money and money > 0 and money or nil @@ -372,7 +372,7 @@ function public.queries(query_string) return queries end -function private.suggestions(components) +function suggestions(components) local suggestions = {} if components.blizzard.name and aux.util.size(components.blizzard) == 1 then @@ -455,7 +455,7 @@ function public.query_string(components) return query_builder.get() end -function private.prettified_query_string(components) +function prettified_query_string(components) local prettified = m.query_builder() for key, filter in components.blizzard do @@ -505,7 +505,7 @@ function public.unquote(name) return aux.util.select(3, strfind(name, '^<(.*)>$')) or name end -function private.blizzard_query(components) +function blizzard_query(components) local filters = components.blizzard local query = {name=filters.name and filters.name[2]} @@ -534,7 +534,7 @@ function private.blizzard_query(components) return query end -function private.validator(components) +function validator(components) local validators = {} for i, component in components.post do diff --git a/util/info.lua b/util/info.lua index 31538fc..e992ad5 100644 --- a/util/info.lua +++ b/util/info.lua @@ -287,7 +287,7 @@ function public.tooltip(setter) return tooltip, AuxTooltip.money end -function private.item_charges(tooltip) +function item_charges(tooltip) for _, line in tooltip do local pattern = '^'..gsub(gsub(ITEM_SPELL_CHARGES_P1, '%%d', '(%%d+)'), '%%%d+%$d', '(%%d+)')..'$' diff --git a/util/money.lua b/util/money.lua index 1e83aeb..11af61b 100644 --- a/util/money.lua +++ b/util/money.lua @@ -1,11 +1,11 @@ aux.module 'money' -private.GOLD_TEXT = '|cffffd70ag|r' -private.SILVER_TEXT = '|cffc7c7cfs|r' -private.COPPER_TEXT = '|cffeda55fc|r' +GOLD_TEXT = '|cffffd70ag|r' +SILVER_TEXT = '|cffc7c7cfs|r' +COPPER_TEXT = '|cffeda55fc|r' -private.COPPER_PER_SILVER = 100 -private.COPPER_PER_GOLD = 10000 +COPPER_PER_SILVER = 100 +COPPER_PER_GOLD = 10000 function public.gsc(money) local gold = floor(money / m.COPPER_PER_GOLD) diff --git a/util/persistence.lua b/util/persistence.lua index cfd877e..77cbb83 100644 --- a/util/persistence.lua +++ b/util/persistence.lua @@ -10,7 +10,7 @@ do realm = GetCVar('realmName') end - function private.get_dataset_key() + function get_dataset_key() return realm..'|'..faction end end