completely removed static database
This commit is contained in:
+4
-4
@@ -1,18 +1,21 @@
|
|||||||
## Interface: 11200
|
## Interface: 11200
|
||||||
## Title: Aux
|
## Title: Aux
|
||||||
## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches
|
## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches
|
||||||
## SavedVariables: aux_datasets, aux_post_mode, aux_price_per_unit, aux_tooltip_daily, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
## SavedVariables: aux_datasets, aux_items, aux_auctionable_items, aux_post_mode, aux_price_per_unit, aux_tooltip_daily, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
||||||
|
|
||||||
slash.lua
|
slash.lua
|
||||||
core.xml
|
core.xml
|
||||||
gui.lua
|
gui.lua
|
||||||
control.xml
|
control.xml
|
||||||
persistence.lua
|
persistence.lua
|
||||||
|
item_cache.lua
|
||||||
|
merchant.lua
|
||||||
disenchant.lua
|
disenchant.lua
|
||||||
tooltip.lua
|
tooltip.lua
|
||||||
util.lua
|
util.lua
|
||||||
sort.lua
|
sort.lua
|
||||||
money.lua
|
money.lua
|
||||||
|
info.lua
|
||||||
|
|
||||||
scan.lua
|
scan.lua
|
||||||
scan_util.lua
|
scan_util.lua
|
||||||
@@ -22,7 +25,6 @@ listing.lua
|
|||||||
auction_listing.lua
|
auction_listing.lua
|
||||||
item_listing.lua
|
item_listing.lua
|
||||||
history.lua
|
history.lua
|
||||||
info.xml
|
|
||||||
completion.xml
|
completion.xml
|
||||||
|
|
||||||
search_frame.xml
|
search_frame.xml
|
||||||
@@ -30,8 +32,6 @@ post_frame.xml
|
|||||||
auctions_frame.xml
|
auctions_frame.xml
|
||||||
bids_frame.xml
|
bids_frame.xml
|
||||||
|
|
||||||
static.xml
|
|
||||||
|
|
||||||
test.lua
|
test.lua
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ function Aux.on_load()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
Aux.static.on_load()
|
Aux.item_cache.on_load()
|
||||||
Aux.persistence.on_load()
|
Aux.persistence.on_load()
|
||||||
Aux.tooltip.on_load()
|
Aux.tooltip.on_load()
|
||||||
Aux.search_frame.on_load()
|
Aux.search_frame.on_load()
|
||||||
|
|||||||
@@ -18,6 +18,14 @@
|
|||||||
</Scripts>
|
</Scripts>
|
||||||
</Frame>
|
</Frame>
|
||||||
|
|
||||||
|
<GameTooltip name="AuxTooltip" inherits="GameTooltipTemplate">
|
||||||
|
<Scripts>
|
||||||
|
<OnTooltipAddMoney>
|
||||||
|
this.money = arg1
|
||||||
|
</OnTooltipAddMoney>
|
||||||
|
</Scripts>
|
||||||
|
</GameTooltip>
|
||||||
|
|
||||||
<CheckButton name="AuxRadioButtonTemplate" virtual="true">
|
<CheckButton name="AuxRadioButtonTemplate" virtual="true">
|
||||||
<Size><AbsDimension x="16" y="16"/></Size>
|
<Size><AbsDimension x="16" y="16"/></Size>
|
||||||
<Layers>
|
<Layers>
|
||||||
|
|||||||
@@ -275,23 +275,23 @@ end
|
|||||||
|
|
||||||
function public.tooltip(setter)
|
function public.tooltip(setter)
|
||||||
for i = 1, TOOLTIP_LENGTH do
|
for i = 1, TOOLTIP_LENGTH do
|
||||||
getglobal('AuxInfoTooltipTextLeft'..i):SetText()
|
getglobal('AuxTooltipTextLeft'..i):SetText()
|
||||||
getglobal('AuxInfoTooltipTextRight'..i):SetText()
|
getglobal('AuxTooltipTextRight'..i):SetText()
|
||||||
end
|
end
|
||||||
|
|
||||||
AuxInfoTooltip:SetOwner(UIParent, 'ANCHOR_NONE')
|
AuxTooltip:SetOwner(UIParent, 'ANCHOR_NONE')
|
||||||
AuxInfoTooltip.money = 0
|
AuxTooltip.money = 0
|
||||||
setter(AuxInfoTooltip)
|
setter(AuxTooltip)
|
||||||
AuxInfoTooltip:Show()
|
AuxTooltip:Show()
|
||||||
|
|
||||||
local tooltip = { money=AuxInfoTooltip.money }
|
local tooltip = { money=AuxTooltip.money }
|
||||||
for i = 1, TOOLTIP_LENGTH do
|
for i = 1, TOOLTIP_LENGTH do
|
||||||
|
|
||||||
local left_text = getglobal('AuxInfoTooltipTextLeft'..i):GetText()
|
local left_text = getglobal('AuxTooltipTextLeft'..i):GetText()
|
||||||
local left_color = { getglobal('AuxInfoTooltipTextLeft'..i):GetTextColor() }
|
local left_color = { getglobal('AuxTooltipTextLeft'..i):GetTextColor() }
|
||||||
|
|
||||||
local right_text = getglobal('AuxInfoTooltipTextRight'..i):GetText()
|
local right_text = getglobal('AuxTooltipTextRight'..i):GetText()
|
||||||
local right_color = { getglobal('AuxInfoTooltipTextRight'..i):GetTextColor() }
|
local right_color = { getglobal('AuxTooltipTextRight'..i):GetTextColor() }
|
||||||
|
|
||||||
if left_text or right_text then
|
if left_text or right_text then
|
||||||
tinsert(tooltip, {
|
tinsert(tooltip, {
|
||||||
@@ -304,8 +304,8 @@ function public.tooltip(setter)
|
|||||||
end
|
end
|
||||||
|
|
||||||
for i = 1, TOOLTIP_LENGTH do
|
for i = 1, TOOLTIP_LENGTH do
|
||||||
getglobal('AuxInfoTooltipTextLeft'..i):SetText()
|
getglobal('AuxTooltipTextLeft'..i):SetText()
|
||||||
getglobal('AuxInfoTooltipTextRight'..i):SetText()
|
getglobal('AuxTooltipTextRight'..i):SetText()
|
||||||
end
|
end
|
||||||
|
|
||||||
return tooltip
|
return tooltip
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
|
||||||
|
|
||||||
<Script file="info.lua"/>
|
|
||||||
|
|
||||||
<GameTooltip name="AuxInfoTooltip" inherits="GameTooltipTemplate"/>
|
|
||||||
<GameTooltip name="AuxTooltip" parent="UIParent" inherits="GameTooltipTemplate">
|
|
||||||
<Scripts>
|
|
||||||
<OnUpdate>
|
|
||||||
Aux.info.reanchor_tooltip()
|
|
||||||
</OnUpdate>
|
|
||||||
<OnTooltipAddMoney>
|
|
||||||
this.money = arg1
|
|
||||||
</OnTooltipAddMoney>
|
|
||||||
</Scripts>
|
|
||||||
</GameTooltip>
|
|
||||||
</Ui>
|
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
local private, public = {}, {}
|
||||||
|
Aux.item_cache = public
|
||||||
|
|
||||||
|
local MIN_ITEM_ID, MAX_ITEM_ID = 1, 30000
|
||||||
|
|
||||||
|
aux_items = {}
|
||||||
|
aux_auctionable_items = {}
|
||||||
|
|
||||||
|
function public.on_load()
|
||||||
|
private.find_auctionable_items()
|
||||||
|
end
|
||||||
|
|
||||||
|
function public.item_id(item_name)
|
||||||
|
return aux_items[strlower(item_name)]
|
||||||
|
end
|
||||||
|
|
||||||
|
function private.find_auctionable_items()
|
||||||
|
|
||||||
|
local function helper(item_id)
|
||||||
|
local processed = 0
|
||||||
|
while processed <= 100 and item_id <= MAX_ITEM_ID do
|
||||||
|
local itemstring = 'item:'..item_id
|
||||||
|
local name, _, quality = GetItemInfo(itemstring)
|
||||||
|
name = name and strlower(name)
|
||||||
|
if name and not aux_items[name] then
|
||||||
|
aux_items[name] = item_id
|
||||||
|
local tooltip = Aux.info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
|
||||||
|
if Aux.info.auctionable(tooltip, quality) then
|
||||||
|
tinsert(aux_auctionable_items, name)
|
||||||
|
end
|
||||||
|
processed = processed + 1
|
||||||
|
end
|
||||||
|
item_id = item_id + 1
|
||||||
|
end
|
||||||
|
|
||||||
|
if item_id <= MAX_ITEM_ID then
|
||||||
|
local t0 = GetTime()
|
||||||
|
Aux.control.as_soon_as(function() return GetTime() - t0 > 0.1 end, function()
|
||||||
|
return helper(item_id)
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
sort(aux_auctionable_items, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
helper(MIN_ITEM_ID)
|
||||||
|
end
|
||||||
|
|
||||||
|
function public.populate_wdb()
|
||||||
|
|
||||||
|
local function helper(item_id)
|
||||||
|
if item_id > MAX_ITEM_ID then
|
||||||
|
Aux.log('Cache populated.')
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
if not GetItemInfo('item:'..item_id) then
|
||||||
|
Aux.log('Fetching item '..item_id..'.')
|
||||||
|
AuxTooltip:SetHyperlink('item:'..item_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
local t0 = GetTime()
|
||||||
|
Aux.control.as_soon_as(function() return GetItemInfo('item:'..item_id) or GetTime() - t0 > 0.1 end, function()
|
||||||
|
return helper(item_id + 1)
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
helper(MIN_ITEM_ID)
|
||||||
|
end
|
||||||
+4
-4
@@ -40,7 +40,7 @@ m.filters = {
|
|||||||
arity = 1,
|
arity = 1,
|
||||||
test = function(name)
|
test = function(name)
|
||||||
if not name then
|
if not name then
|
||||||
return false, Aux.static.sorted_item_names(), 'Erroneous Item Modifier'
|
return false, aux_auctionable_items, 'Erroneous Item Modifier'
|
||||||
end
|
end
|
||||||
|
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
@@ -529,7 +529,7 @@ function m.filter_from_string(filter_term)
|
|||||||
then
|
then
|
||||||
return false, {}, 'Erroneous Exact Only Modifier'
|
return false, {}, 'Erroneous Exact Only Modifier'
|
||||||
else
|
else
|
||||||
prettified:prepend(Aux.info.display_name(Aux.static.item_id(blizzard_filter.name)) or '['..blizzard_filter.name..']')
|
prettified:prepend(Aux.info.display_name(Aux.item_cache.item_id(blizzard_filter.name)) or Aux.gui.inline_color({216, 225, 211, 1})..'['..blizzard_filter.name..']|r')
|
||||||
end
|
end
|
||||||
elseif blizzard_filter.name then
|
elseif blizzard_filter.name then
|
||||||
if blizzard_filter.name == '' then
|
if blizzard_filter.name == '' then
|
||||||
@@ -606,7 +606,7 @@ function m.suggestions(blizzard_filter, num_parts)
|
|||||||
|
|
||||||
-- item names
|
-- item names
|
||||||
if num_parts == 1 and blizzard_filter.name == '' then
|
if num_parts == 1 and blizzard_filter.name == '' then
|
||||||
for _, name in ipairs(Aux.static.sorted_item_names()) do
|
for _, name in ipairs(Aux.item_cache.sorted_auctionable_items()) do
|
||||||
tinsert(suggestions, name..'/exact')
|
tinsert(suggestions, name..'/exact')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -618,7 +618,7 @@ function m.blizzard_query(filter)
|
|||||||
|
|
||||||
local item_info, class_index, subclass_index, slot_index
|
local item_info, class_index, subclass_index, slot_index
|
||||||
if filter.exact then
|
if filter.exact then
|
||||||
local item_id = Aux.static.item_id(filter.name)
|
local item_id = Aux.item_cache.item_id(filter.name)
|
||||||
item_info = Aux.info.item(item_id)
|
item_info = Aux.info.item(item_id)
|
||||||
class_index = item_info and Aux.item_class_index(item_info.class)
|
class_index = item_info and Aux.item_class_index(item_info.class)
|
||||||
subclass_index = class_index and item_info.subclass and Aux.item_subclass_index(class_index, item_info.subclass)
|
subclass_index = class_index and item_info.subclass and Aux.item_subclass_index(class_index, item_info.subclass)
|
||||||
|
|||||||
+1
-1
@@ -351,7 +351,7 @@ function public.on_load()
|
|||||||
end
|
end
|
||||||
do
|
do
|
||||||
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentNameInputBox')
|
local editbox = Aux.gui.editbox(AuxSearchFrameFilter, '$parentNameInputBox')
|
||||||
editbox.complete_item = Aux.completion.completor(Aux.static.sorted_item_names)
|
editbox.complete_item = Aux.completion.completor(function() return aux_auctionable_items end)
|
||||||
editbox:SetPoint('TOPLEFT', 14, -20)
|
editbox:SetPoint('TOPLEFT', 14, -20)
|
||||||
editbox:SetWidth(260)
|
editbox:SetWidth(260)
|
||||||
editbox:SetScript('OnChar', function()
|
editbox:SetScript('OnChar', function()
|
||||||
|
|||||||
@@ -9,12 +9,12 @@ function SlashCmdList.AUX(parameter)
|
|||||||
elseif parameter == 'clear' then
|
elseif parameter == 'clear' then
|
||||||
aux_datasets = {}
|
aux_datasets = {}
|
||||||
Aux.log('Database cleared.')
|
Aux.log('Database cleared.')
|
||||||
elseif parameter == 'generate item cache' then
|
elseif parameter == 'clear item cache' then
|
||||||
Aux.static.generate_cache()
|
aux_items = {}
|
||||||
elseif parameter == 'delete item cache' then
|
aux_auctionable_items = {}
|
||||||
aux_auctionable_items = nil
|
Aux.log('Item cache cleared.')
|
||||||
aux_auctionable_item_ids = nil
|
elseif parameter == 'populate wdb' then
|
||||||
Aux.log('Item cache deleted; falling back to the default.')
|
Aux.item_cache.populate_wdb()
|
||||||
elseif parameter == 'tooltip daily' then
|
elseif parameter == 'tooltip daily' then
|
||||||
aux_tooltip_daily = not aux_tooltip_daily
|
aux_tooltip_daily = not aux_tooltip_daily
|
||||||
Aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
Aux.log('Market value in tooltip '..(aux_tooltip_daily and 'enabled' or 'disabled')..'.')
|
||||||
|
|||||||
-101
@@ -1,101 +0,0 @@
|
|||||||
local private, public = {}, {}
|
|
||||||
Aux.static = public
|
|
||||||
|
|
||||||
local auctionable_items = {}
|
|
||||||
local sorted_item_names
|
|
||||||
|
|
||||||
function public.on_load()
|
|
||||||
private.find_auctionable_items()
|
|
||||||
end
|
|
||||||
|
|
||||||
function public.sorted_item_names()
|
|
||||||
if not sorted_item_names then
|
|
||||||
sorted_item_names = {}
|
|
||||||
for name, _ in auctionable_items do
|
|
||||||
tinsert(sorted_item_names, name)
|
|
||||||
end
|
|
||||||
sort(sorted_item_names, function(a, b) return strlen(a) < strlen(b) or (strlen(a) == strlen(b) and a < b) end)
|
|
||||||
end
|
|
||||||
return sorted_item_names
|
|
||||||
end
|
|
||||||
|
|
||||||
function public.item_id(item_name)
|
|
||||||
return auctionable_items[strlower(item_name)]
|
|
||||||
end
|
|
||||||
|
|
||||||
function public.item_info(item_id)
|
|
||||||
local data_string
|
|
||||||
|
|
||||||
if aux_auctionable_items then
|
|
||||||
data_string = aux_auctionable_items[item_id]
|
|
||||||
else
|
|
||||||
data_string = private.auctionable_items[item_id]
|
|
||||||
end
|
|
||||||
|
|
||||||
return data_string and private.read_item_info(data_string)
|
|
||||||
end
|
|
||||||
|
|
||||||
--function public.generate_cache()
|
|
||||||
-- local ids = {}
|
|
||||||
-- for id, _ in pairs(private.auctionable_items) do
|
|
||||||
-- if type(id) == 'number' then
|
|
||||||
-- tinsert(ids, id)
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
-- local n = getn(ids)
|
|
||||||
--
|
|
||||||
-- local function helper(index)
|
|
||||||
-- if index > n then
|
|
||||||
-- Aux.log('Cache generated.')
|
|
||||||
-- return
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- local id = ids[index]
|
|
||||||
-- if not GetItemInfo(id) then
|
|
||||||
-- Aux.log('Fetching item '..id..' ...')
|
|
||||||
-- AuxStaticTooltip:SetHyperlink('item:'..id)
|
|
||||||
-- end
|
|
||||||
-- local t0 = time()
|
|
||||||
-- Aux.control.as_soon_as(function() return GetItemInfo(id) or time() > t0 + 3 end, function()
|
|
||||||
-- local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(id)
|
|
||||||
-- if name then
|
|
||||||
-- local class_index = Aux.item_class_index(class)
|
|
||||||
-- local subclass_index = class_index and Aux.item_subclass_index(class_index, subclass)
|
|
||||||
--
|
|
||||||
-- Aux.log('Adding item '..id..' ...')
|
|
||||||
--
|
|
||||||
-- aux_auctionable_item_ids[strupper(name)] = id
|
|
||||||
-- aux_auctionable_items[id] = Aux.util.join({id or '', name or '', quality or '', level or '', class_index or '', subclass_index or '', slot or '', max_stack or '', texture or ''}, '#')
|
|
||||||
-- end
|
|
||||||
-- return helper(index + 1)
|
|
||||||
-- end)
|
|
||||||
-- end
|
|
||||||
--
|
|
||||||
-- aux_auctionable_items = {}
|
|
||||||
-- aux_auctionable_item_ids = {}
|
|
||||||
-- helper(1)
|
|
||||||
--end
|
|
||||||
|
|
||||||
function private.find_auctionable_items() -- requires a full wdb item cache
|
|
||||||
local function helper(i)
|
|
||||||
for item_id=i,i+200 do
|
|
||||||
local name, _, quality = GetItemInfo('item:'..item_id)
|
|
||||||
if name then
|
|
||||||
local item_id = item_id
|
|
||||||
local tooltip = Aux.info.tooltip(function(tt) tt:SetHyperlink('item:'..item_id) end)
|
|
||||||
if Aux.info.auctionable(tooltip, quality) then
|
|
||||||
auctionable_items[strlower(name)] = item_id
|
|
||||||
sorted_item_names = nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if i+200 <= 30000 then
|
|
||||||
local t0 = GetTime()
|
|
||||||
Aux.control.as_soon_as(function() return GetTime() - t0 > 0.2 end, function()
|
|
||||||
return helper(i+200)
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
helper(1)
|
|
||||||
end
|
|
||||||
@@ -1,6 +0,0 @@
|
|||||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
|
||||||
|
|
||||||
<Script file="static.lua"/>
|
|
||||||
|
|
||||||
<GameTooltip name="AuxStaticTooltip" inherits="GameTooltipTemplate"/>
|
|
||||||
</Ui>
|
|
||||||
Reference in New Issue
Block a user