done away with static database
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
## 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_auctionable_items, aux_auctionable_item_ids, 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_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
|
||||||
|
|||||||
+1
-1
@@ -146,7 +146,7 @@ local methods = {
|
|||||||
if ChatFrameEditBox:IsVisible() then
|
if ChatFrameEditBox:IsVisible() then
|
||||||
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
||||||
else
|
else
|
||||||
Aux.search_frame.start_search(strlower(Aux.static.item_info(this.row.data.record.item_id).name)..'/exact')
|
Aux.search_frame.start_search(strlower(Aux.info.item(this.row.data.record.item_id).name)..'/exact')
|
||||||
end
|
end
|
||||||
elseif IsAltKeyDown() then
|
elseif IsAltKeyDown() then
|
||||||
if this.rt.handlers.OnCellAltClick then
|
if this.rt.handlers.OnCellAltClick then
|
||||||
|
|||||||
+1
-15
@@ -1,20 +1,6 @@
|
|||||||
local m = {}
|
local m = {}
|
||||||
Aux.completion = m
|
Aux.completion = m
|
||||||
|
|
||||||
do
|
|
||||||
local sorted_item_names
|
|
||||||
function m.sorted_item_names()
|
|
||||||
if not sorted_item_names then
|
|
||||||
sorted_item_names = {}
|
|
||||||
for _, item_info in ipairs(Aux.static.items()) do
|
|
||||||
tinsert(sorted_item_names, item_info.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
|
|
||||||
end
|
|
||||||
|
|
||||||
function m:complete()
|
function m:complete()
|
||||||
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
||||||
return
|
return
|
||||||
@@ -45,7 +31,7 @@ function m.completor(options)
|
|||||||
|
|
||||||
local text = self:GetText()
|
local text = self:GetText()
|
||||||
|
|
||||||
for _, item_name in ipairs(options) do
|
for _, item_name in ipairs(options()) do
|
||||||
if string.sub(strupper(item_name), 1, strlen(text)) == strupper(text) then
|
if string.sub(strupper(item_name), 1, strlen(text)) == strupper(text) then
|
||||||
self:SetText(strlower(item_name))
|
self:SetText(strlower(item_name))
|
||||||
self:HighlightText(strlen(text), -1)
|
self:HighlightText(strlen(text), -1)
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ function Aux.on_load()
|
|||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Aux.static.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()
|
||||||
@@ -292,7 +293,7 @@ end
|
|||||||
function Aux.SetItemRef(...)
|
function Aux.SetItemRef(...)
|
||||||
local itemstring, text, button = unpack(arg)
|
local itemstring, text, button = unpack(arg)
|
||||||
if IsAltKeyDown() and AuxSearchFrame:IsVisible() then
|
if IsAltKeyDown() and AuxSearchFrame:IsVisible() then
|
||||||
local item_info = Aux.static.item_info(tonumber(({strfind(itemstring, '^item:(%d+)')})[3]))
|
local item_info = Aux.info.item(tonumber(({strfind(itemstring, '^item:(%d+)')})[3]))
|
||||||
if item_info then
|
if item_info then
|
||||||
Aux.search_frame.set_filter(item_info.name..'/exact')
|
Aux.search_frame.set_filter(item_info.name..'/exact')
|
||||||
Aux.search_frame.start_search()
|
Aux.search_frame.start_search()
|
||||||
@@ -310,7 +311,7 @@ function Aux.UseContainerItem(...)
|
|||||||
|
|
||||||
if AuxSearchFrame:IsVisible() then
|
if AuxSearchFrame:IsVisible() then
|
||||||
local item_info = Aux.info.container_item(bag, slot)
|
local item_info = Aux.info.container_item(bag, slot)
|
||||||
item_info = item_info and Aux.static.item_info(item_info.item_id)
|
item_info = item_info and Aux.info.item(item_info.item_id)
|
||||||
if item_info then
|
if item_info then
|
||||||
Aux.search_frame.start_search(strlower(item_info.name)..'/exact')
|
Aux.search_frame.start_search(strlower(item_info.name)..'/exact')
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -255,6 +255,24 @@ function public.load_tooltip(frame, tooltip)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function public.display_name(item_id)
|
||||||
|
local item_info = Aux.info.item(item_id)
|
||||||
|
if item_info then
|
||||||
|
return ({GetItemQualityColor(item_info.quality)})[4]..'['..item_info.name..']'..'|r'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function public.auctionable(tooltip, quality, lootable)
|
||||||
|
local durability, max_durability = Aux.info.durability(tooltip)
|
||||||
|
return not lootable
|
||||||
|
and (not quality or quality < 6)
|
||||||
|
and not Aux.info.tooltip_match(ITEM_BIND_ON_PICKUP, tooltip)
|
||||||
|
and not Aux.info.tooltip_match(ITEM_BIND_QUEST, tooltip)
|
||||||
|
and not Aux.info.tooltip_match(ITEM_SOULBOUND, tooltip)
|
||||||
|
and not Aux.info.tooltip_match(ITEM_CONJURED, tooltip)
|
||||||
|
and not (durability and durability < max_durability)
|
||||||
|
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('AuxInfoTooltipTextLeft'..i):SetText()
|
||||||
|
|||||||
+2
-11
@@ -732,15 +732,6 @@ function private.quantity_update()
|
|||||||
refresh = true
|
refresh = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function private.auctionable(item_info)
|
|
||||||
local durability, max_durability = Aux.info.durability(item_info.tooltip)
|
|
||||||
return Aux.static.item_info(item_info.item_id)
|
|
||||||
and not Aux.info.tooltip_match(ITEM_SOULBOUND, item_info.tooltip)
|
|
||||||
and not Aux.info.tooltip_match(ITEM_CONJURED, item_info.tooltip)
|
|
||||||
and not item_info.lootable
|
|
||||||
and not (durability and durability < max_durability)
|
|
||||||
end
|
|
||||||
|
|
||||||
function private.unit_vendor_price(item_key)
|
function private.unit_vendor_price(item_key)
|
||||||
local inventory_iterator = Aux.util.inventory_iterator()
|
local inventory_iterator = Aux.util.inventory_iterator()
|
||||||
|
|
||||||
@@ -753,7 +744,7 @@ function private.unit_vendor_price(item_key)
|
|||||||
local item_info = Aux.info.container_item(slot.bag, slot.bag_slot)
|
local item_info = Aux.info.container_item(slot.bag, slot.bag_slot)
|
||||||
if item_info and item_info.item_key == item_key then
|
if item_info and item_info.item_key == item_key then
|
||||||
|
|
||||||
if private.auctionable(item_info) then
|
if Aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
|
||||||
ClearCursor()
|
ClearCursor()
|
||||||
PickupContainerItem(slot.bag, slot.bag_slot)
|
PickupContainerItem(slot.bag, slot.bag_slot)
|
||||||
ClickAuctionSellItemButton()
|
ClickAuctionSellItemButton()
|
||||||
@@ -834,7 +825,7 @@ function private.update_inventory_records()
|
|||||||
if item_info then
|
if item_info then
|
||||||
local charge_class = item_info.charges or 0
|
local charge_class = item_info.charges or 0
|
||||||
|
|
||||||
if private.auctionable(item_info) then
|
if Aux.info.auctionable(item_info.tooltip, nil, item_info.lootable) then
|
||||||
if not auction_candidate_map[item_info.item_key] then
|
if not auction_candidate_map[item_info.item_key] then
|
||||||
|
|
||||||
local availability = { [0]=0, [1]=0, [2]=0, [3]=0, [4]=0, [5]=0 }
|
local availability = { [0]=0, [1]=0, [2]=0, [3]=0, [4]=0, [5]=0 }
|
||||||
|
|||||||
+19
-27
@@ -40,16 +40,11 @@ m.filters = {
|
|||||||
arity = 1,
|
arity = 1,
|
||||||
test = function(name)
|
test = function(name)
|
||||||
if not name then
|
if not name then
|
||||||
return false, Aux.completion.sorted_item_names(), 'Erroneous Item Modifier'
|
return false, Aux.static.sorted_item_names(), 'Erroneous Item Modifier'
|
||||||
end
|
|
||||||
|
|
||||||
local item_id = Aux.static.item_id(strupper(name or ''))
|
|
||||||
if not item_id then
|
|
||||||
return false, {}, 'Erroneous Item Modifier'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return function(auction_record)
|
return function(auction_record)
|
||||||
return auction_record.item_id == item_id
|
return strlower(Aux.info.item(auction_record.item_id)) == name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
},
|
},
|
||||||
@@ -339,11 +334,6 @@ function m.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function m.display_name(item_id)
|
|
||||||
local item_info = Aux.static.item_info(item_id)
|
|
||||||
return ({GetItemQualityColor(item_info.quality)})[4]..'['..item_info.name..']'..'|r'
|
|
||||||
end
|
|
||||||
|
|
||||||
function m.filter_builder()
|
function m.filter_builder()
|
||||||
local filter = ''
|
local filter = ''
|
||||||
return {
|
return {
|
||||||
@@ -363,7 +353,7 @@ end
|
|||||||
|
|
||||||
function m.create_item_query(item_id)
|
function m.create_item_query(item_id)
|
||||||
|
|
||||||
local item_info = Aux.static.item_info(item_id)
|
local item_info = Aux.info.item(item_id)
|
||||||
|
|
||||||
if item_info then
|
if item_info then
|
||||||
local filter = m.filter_from_string(item_info.name..'/exact')
|
local filter = m.filter_from_string(item_info.name..'/exact')
|
||||||
@@ -536,11 +526,10 @@ function m.filter_from_string(filter_term)
|
|||||||
or blizzard_filter.quality
|
or blizzard_filter.quality
|
||||||
or blizzard_filter.usable
|
or blizzard_filter.usable
|
||||||
or not blizzard_filter.name
|
or not blizzard_filter.name
|
||||||
or not Aux.static.item_id(strupper(blizzard_filter.name))
|
|
||||||
then
|
then
|
||||||
return false, {}, 'Erroneous Exact Only Modifier'
|
return false, {}, 'Erroneous Exact Only Modifier'
|
||||||
else
|
else
|
||||||
prettified:prepend(m.display_name(Aux.static.item_id(strupper(blizzard_filter.name))))
|
prettified:prepend(Aux.info.display_name(Aux.static.item_id(blizzard_filter.name)) or '['..blizzard_filter.name..']')
|
||||||
end
|
end
|
||||||
elseif blizzard_filter.name then
|
elseif blizzard_filter.name then
|
||||||
if blizzard_filter.name == '' then
|
if blizzard_filter.name == '' then
|
||||||
@@ -617,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.completion.sorted_item_names()) do
|
for _, name in ipairs(Aux.static.sorted_item_names()) do
|
||||||
tinsert(suggestions, name..'/exact')
|
tinsert(suggestions, name..'/exact')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -627,28 +616,31 @@ end
|
|||||||
|
|
||||||
function m.blizzard_query(filter)
|
function m.blizzard_query(filter)
|
||||||
|
|
||||||
local item_info
|
local item_info, class_index, subclass_index, slot_index
|
||||||
if filter.exact then
|
if filter.exact then
|
||||||
local item_id = Aux.static.item_id(strupper(filter.name))
|
local item_id = Aux.static.item_id(filter.name)
|
||||||
item_info = Aux.static.item_info(item_id)
|
item_info = Aux.info.item(item_id)
|
||||||
|
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)
|
||||||
|
slot_index = subclass_index and item_info.slot and Aux.item_slot_index(class_index, subclass_index, item_info.slot)
|
||||||
end
|
end
|
||||||
|
|
||||||
return {
|
return {
|
||||||
name = filter.name,
|
name = filter.name,
|
||||||
min_level = filter.exact and item_info.level or filter.min_level,
|
min_level = item_info and item_info.level or filter.min_level,
|
||||||
max_level = filter.exact and item_info.level or filter.max_level,
|
max_level = item_info and item_info.level or filter.max_level,
|
||||||
class = filter.exact and item_info.class or filter.class,
|
class = item_info and class_index or filter.class,
|
||||||
subclass = filter.exact and item_info.subclass or filter.subclass,
|
subclass = item_info and subclass_index or filter.subclass,
|
||||||
slot = filter.exact and (item_info.class and item_info.subclass and Aux.item_slot_index(item_info.class, item_info.subclass, item_info.slot)) or filter.slot,
|
slot = item_info and item_info.class and slot_index or filter.slot,
|
||||||
usable = filter.exact and item_info.usable or filter.usable and 1 or 0,
|
usable = item_info and item_info.usable or filter.usable and 1 or 0,
|
||||||
quality = filter.exact and item_info.quality or filter.quality,
|
quality = item_info and item_info.quality or filter.quality,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
function m.validator(blizzard_filter, post_filter)
|
function m.validator(blizzard_filter, post_filter)
|
||||||
|
|
||||||
return function(record)
|
return function(record)
|
||||||
if blizzard_filter.exact and strlower(Aux.static.item_info(record.item_id).name) ~= blizzard_filter.name then
|
if blizzard_filter.exact and strlower(Aux.info.item(record.item_id).name) ~= blizzard_filter.name then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if blizzard_filter.min_level and record.level < blizzard_filter.min_level then
|
if blizzard_filter.min_level and record.level < blizzard_filter.min_level then
|
||||||
|
|||||||
+3
-3
@@ -240,7 +240,7 @@ function public.on_load()
|
|||||||
this:HighlightText()
|
this:HighlightText()
|
||||||
end)
|
end)
|
||||||
editbox:SetScript('OnReceiveDrag', function()
|
editbox:SetScript('OnReceiveDrag', function()
|
||||||
local item_info = Aux.cursor_item() and Aux.static.item_info(Aux.cursor_item().item_id)
|
local item_info = Aux.cursor_item() and Aux.info.item(Aux.cursor_item().item_id)
|
||||||
if item_info then
|
if item_info then
|
||||||
public.start_search(strlower(item_info.name)..'/exact')
|
public.start_search(strlower(item_info.name)..'/exact')
|
||||||
end
|
end
|
||||||
@@ -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.completion.sorted_item_names())
|
editbox.complete_item = Aux.completion.completor(Aux.static.sorted_item_names)
|
||||||
editbox:SetPoint('TOPLEFT', 14, -20)
|
editbox:SetPoint('TOPLEFT', 14, -20)
|
||||||
editbox:SetWidth(260)
|
editbox:SetWidth(260)
|
||||||
editbox:SetScript('OnChar', function()
|
editbox:SetScript('OnChar', function()
|
||||||
@@ -662,7 +662,7 @@ function public.on_load()
|
|||||||
btn.inputs = {}
|
btn.inputs = {}
|
||||||
if filter.arity > 0 then
|
if filter.arity > 0 then
|
||||||
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
|
local editbox = Aux.gui.editbox(AuxSearchFrameFilter)
|
||||||
editbox.complete = Aux.completion.completor(({filter.test()})[2])
|
editbox.complete = Aux.completion.completor(function() return ({filter.test()})[2] end)
|
||||||
editbox:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
|
editbox:SetPoint('LEFT', btn, 'RIGHT', 10, 0)
|
||||||
editbox:SetWidth(100)
|
editbox:SetWidth(100)
|
||||||
-- editbox:SetNumeric(true)
|
-- editbox:SetNumeric(true)
|
||||||
|
|||||||
+67
-14402
File diff suppressed because it is too large
Load Diff
+14
-17
@@ -69,18 +69,17 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
if getn(distribution) > 0 then
|
if getn(distribution) > 0 then
|
||||||
|
|
||||||
if aux_tooltip_disenchant_distribution then
|
if aux_tooltip_disenchant_distribution then
|
||||||
local color = {r=0.8, g=0.8, b=0.2 }
|
local color = {r=0.8, g=0.8, b=0.2}
|
||||||
|
|
||||||
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
|
tooltip:AddLine('Disenchants into:', color.r, color.g, color.b)
|
||||||
sort(distribution, function(a,b) return a.probability > b.probability end)
|
sort(distribution, function(a,b) return a.probability > b.probability end)
|
||||||
for _, event in distribution do
|
for _, event in distribution do
|
||||||
local reagent_info = Aux.static.item_info(event.item_id)
|
tooltip:AddLine(format(' %s%% %s x%s', event.probability * 100, Aux.info.display_name(event.item_id) or event.item_id, event.quantity), color.r, color.g, color.b)
|
||||||
tooltip:AddLine(format(' %s%% %s x%s', event.probability * 100, ({GetItemQualityColor(reagent_info.quality)})[4]..reagent_info.name..'|r', event.quantity), color.r, color.g, color.b)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if aux_tooltip_disenchant_value then
|
if aux_tooltip_disenchant_value then
|
||||||
local color = {r=0.1, g=0.6, b=0.6 }
|
local color = {r=0.1, g=0.6, b=0.6}
|
||||||
|
|
||||||
local disenchant_value = Aux.disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
local disenchant_value = Aux.disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and Aux.util.format_money(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
tooltip:AddLine('Disenchant Value: '..(disenchant_value and Aux.util.format_money(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||||
@@ -88,27 +87,25 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if Aux.static.item_info(item_id) then
|
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
||||||
local item_key = (item_id or 0)..':'..(suffix_id or 0)
|
|
||||||
|
|
||||||
local value = Aux.history.value(item_key)
|
local value = Aux.history.value(item_key)
|
||||||
|
|
||||||
local value_line = 'Value: '
|
local value_line = 'Value: '
|
||||||
|
|
||||||
value_line = value_line..(value and Aux.util.format_money(value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
value_line = value_line..(value and Aux.util.format_money(value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||||
|
|
||||||
local color = {r=1, g=1, b=0.6}
|
local color = {r=1, g=1, b=0.6}
|
||||||
|
|
||||||
tooltip:AddLine(value_line, color.r, color.g, color.b)
|
tooltip:AddLine(value_line, color.r, color.g, color.b)
|
||||||
|
|
||||||
if aux_tooltip_daily then
|
if aux_tooltip_daily then
|
||||||
local market_value = Aux.history.market_value(item_key)
|
local market_value = Aux.history.market_value(item_key)
|
||||||
|
|
||||||
local market_value_line = 'Today: '
|
local market_value_line = 'Today: '
|
||||||
market_value_line = market_value_line..(market_value and Aux.util.format_money(market_value)..' ('..Aux.auction_listing.percentage_historical(Aux.round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
market_value_line = market_value_line..(market_value and Aux.util.format_money(market_value)..' ('..Aux.auction_listing.percentage_historical(Aux.round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||||
|
|
||||||
tooltip:AddLine(market_value_line, color.r, color.g, color.b)
|
tooltip:AddLine(market_value_line, color.r, color.g, color.b)
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if tooltip == GameTooltip and game_tooltip_money > 0 then
|
if tooltip == GameTooltip and game_tooltip_money > 0 then
|
||||||
|
|||||||
Reference in New Issue
Block a user