done away with static database
This commit is contained in:
+1
-1
@@ -1,7 +1,7 @@
|
||||
## Interface: 11200
|
||||
## Title: Aux
|
||||
## 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
|
||||
core.xml
|
||||
|
||||
+1
-1
@@ -146,7 +146,7 @@ local methods = {
|
||||
if ChatFrameEditBox:IsVisible() then
|
||||
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
|
||||
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
|
||||
elseif IsAltKeyDown() then
|
||||
if this.rt.handlers.OnCellAltClick then
|
||||
|
||||
+1
-15
@@ -1,20 +1,6 @@
|
||||
local 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()
|
||||
if IsControlKeyDown() then -- TODO problem is ctrl-v, maybe find a better solution
|
||||
return
|
||||
@@ -45,7 +31,7 @@ function m.completor(options)
|
||||
|
||||
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
|
||||
self:SetText(strlower(item_name))
|
||||
self:HighlightText(strlen(text), -1)
|
||||
|
||||
@@ -47,6 +47,7 @@ function Aux.on_load()
|
||||
end)
|
||||
end
|
||||
|
||||
Aux.static.on_load()
|
||||
Aux.persistence.on_load()
|
||||
Aux.tooltip.on_load()
|
||||
Aux.search_frame.on_load()
|
||||
@@ -292,7 +293,7 @@ end
|
||||
function Aux.SetItemRef(...)
|
||||
local itemstring, text, button = unpack(arg)
|
||||
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
|
||||
Aux.search_frame.set_filter(item_info.name..'/exact')
|
||||
Aux.search_frame.start_search()
|
||||
@@ -310,7 +311,7 @@ function Aux.UseContainerItem(...)
|
||||
|
||||
if AuxSearchFrame:IsVisible() then
|
||||
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
|
||||
Aux.search_frame.start_search(strlower(item_info.name)..'/exact')
|
||||
end
|
||||
|
||||
@@ -255,6 +255,24 @@ function public.load_tooltip(frame, tooltip)
|
||||
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)
|
||||
for i = 1, TOOLTIP_LENGTH do
|
||||
getglobal('AuxInfoTooltipTextLeft'..i):SetText()
|
||||
|
||||
+2
-11
@@ -732,15 +732,6 @@ function private.quantity_update()
|
||||
refresh = true
|
||||
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)
|
||||
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)
|
||||
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()
|
||||
PickupContainerItem(slot.bag, slot.bag_slot)
|
||||
ClickAuctionSellItemButton()
|
||||
@@ -834,7 +825,7 @@ function private.update_inventory_records()
|
||||
if item_info then
|
||||
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
|
||||
|
||||
local availability = { [0]=0, [1]=0, [2]=0, [3]=0, [4]=0, [5]=0 }
|
||||
|
||||
+19
-27
@@ -40,16 +40,11 @@ m.filters = {
|
||||
arity = 1,
|
||||
test = function(name)
|
||||
if not name then
|
||||
return false, Aux.completion.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'
|
||||
return false, Aux.static.sorted_item_names(), 'Erroneous Item Modifier'
|
||||
end
|
||||
|
||||
return function(auction_record)
|
||||
return auction_record.item_id == item_id
|
||||
return strlower(Aux.info.item(auction_record.item_id)) == name
|
||||
end
|
||||
end
|
||||
},
|
||||
@@ -339,11 +334,6 @@ function m.find(auction_record, status_bar, on_abort, on_failure, on_success)
|
||||
}
|
||||
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()
|
||||
local filter = ''
|
||||
return {
|
||||
@@ -363,7 +353,7 @@ end
|
||||
|
||||
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
|
||||
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.usable
|
||||
or not blizzard_filter.name
|
||||
or not Aux.static.item_id(strupper(blizzard_filter.name))
|
||||
then
|
||||
return false, {}, 'Erroneous Exact Only Modifier'
|
||||
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
|
||||
elseif blizzard_filter.name then
|
||||
if blizzard_filter.name == '' then
|
||||
@@ -617,7 +606,7 @@ function m.suggestions(blizzard_filter, num_parts)
|
||||
|
||||
-- item names
|
||||
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')
|
||||
end
|
||||
end
|
||||
@@ -627,28 +616,31 @@ end
|
||||
|
||||
function m.blizzard_query(filter)
|
||||
|
||||
local item_info
|
||||
local item_info, class_index, subclass_index, slot_index
|
||||
if filter.exact then
|
||||
local item_id = Aux.static.item_id(strupper(filter.name))
|
||||
item_info = Aux.static.item_info(item_id)
|
||||
local item_id = Aux.static.item_id(filter.name)
|
||||
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
|
||||
|
||||
return {
|
||||
name = filter.name,
|
||||
min_level = filter.exact and item_info.level or filter.min_level,
|
||||
max_level = filter.exact and item_info.level or filter.max_level,
|
||||
class = filter.exact and item_info.class or filter.class,
|
||||
subclass = filter.exact and item_info.subclass 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,
|
||||
usable = filter.exact and item_info.usable or filter.usable and 1 or 0,
|
||||
quality = filter.exact and item_info.quality or filter.quality,
|
||||
min_level = item_info and item_info.level or filter.min_level,
|
||||
max_level = item_info and item_info.level or filter.max_level,
|
||||
class = item_info and class_index or filter.class,
|
||||
subclass = item_info and subclass_index or filter.subclass,
|
||||
slot = item_info and item_info.class and slot_index or filter.slot,
|
||||
usable = item_info and item_info.usable or filter.usable and 1 or 0,
|
||||
quality = item_info and item_info.quality or filter.quality,
|
||||
}
|
||||
end
|
||||
|
||||
function m.validator(blizzard_filter, post_filter)
|
||||
|
||||
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
|
||||
end
|
||||
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()
|
||||
end)
|
||||
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
|
||||
public.start_search(strlower(item_info.name)..'/exact')
|
||||
end
|
||||
@@ -351,7 +351,7 @@ function public.on_load()
|
||||
end
|
||||
do
|
||||
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:SetWidth(260)
|
||||
editbox:SetScript('OnChar', function()
|
||||
@@ -662,7 +662,7 @@ function public.on_load()
|
||||
btn.inputs = {}
|
||||
if filter.arity > 0 then
|
||||
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:SetWidth(100)
|
||||
-- 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 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)
|
||||
sort(distribution, function(a,b) return a.probability > b.probability end)
|
||||
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, ({GetItemQualityColor(reagent_info.quality)})[4]..reagent_info.name..'|r', event.quantity), color.r, color.g, color.b)
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
||||
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)
|
||||
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
|
||||
|
||||
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
|
||||
local market_value = Aux.history.market_value(item_key)
|
||||
if aux_tooltip_daily then
|
||||
local market_value = Aux.history.market_value(item_key)
|
||||
|
||||
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)
|
||||
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)
|
||||
|
||||
tooltip:AddLine(market_value_line, color.r, color.g, color.b)
|
||||
end
|
||||
tooltip:AddLine(market_value_line, color.r, color.g, color.b)
|
||||
end
|
||||
|
||||
if tooltip == GameTooltip and game_tooltip_money > 0 then
|
||||
|
||||
Reference in New Issue
Block a user