refactoring, removed tooltip source

This commit is contained in:
Manuel Simon Hirsig
2017-03-05 02:48:29 +01:00
parent bf613cfa79
commit bf4078afae
16 changed files with 27 additions and 83 deletions
+1 -2
View File
@@ -46,9 +46,8 @@ The most advanced auction house addOn for the 1.12 client with some features mor
### Tooltip
**/aux tooltip value**<br/>
**/aux tooltip daily**<br/>
**/aux tooltip disenchant distribution**<br/>
**/aux tooltip disenchant value**<br/>
**/aux tooltip disenchant source**<br/>
**/aux tooltip disenchant distribution**<br/>
**/aux tooltip vendor buy**<br/>
**/aux tooltip vendor sell**<br/>
+5 -5
View File
@@ -12,11 +12,11 @@ local MAX_ITEM_ID = 30000
local items_schema = {'tuple', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
local merchant_buy_schema = {'tuple', '#', {unit_price='number'}, {limited='boolean'}}
_G.aux_items = T
_G.aux_item_ids = T
_G.aux_auctionable_items = T
_G.aux_merchant_buy = T
_G.aux_merchant_sell = T
_G.aux_items = {}
_G.aux_item_ids = {}
_G.aux_auctionable_items = {}
_G.aux_merchant_buy = {}
_G.aux_merchant_sell = {}
function LOAD()
scan_wdb()
-36
View File
@@ -7,42 +7,6 @@ local history = require 'aux.core.history'
local UNCOMMON, RARE, EPIC = 2, 3, 4
do
local data = O(
10940, A('DUST', '1-20'),
11083, A('DUST', '21-30'),
11137, A('DUST', '31-40'),
11176, A('DUST', '41-50'),
16204, A('DUST', '51-60'),
10938, A('ESSENCE', '1-10'),
10939, A('ESSENCE', '11-15'),
10998, A('ESSENCE', '16-20'),
11082, A('ESSENCE', '21-25'),
11134, A('ESSENCE', '26-30'),
11135, A('ESSENCE', '31-35'),
11174, A('ESSENCE', '36-40'),
11175, A('ESSENCE', '41-45'),
16202, A('ESSENCE', '46-50'),
16203, A('ESSENCE', '51-60'),
10978, A('SHARD', '1-20'),
11084, A('SHARD', '21-25'),
11138, A('SHARD', '26-30'),
11139, A('SHARD', '31-35'),
11177, A('SHARD', '36-40'),
11178, A('SHARD', '41-45'),
14343, A('SHARD', '46-50'),
14344, A('SHARD', '51-60'),
20725, A('CRYSTAL', '51+')
)
function M.source(item_id)
return unpack(data[item_id] or empty)
end
end
local ARMOR = S(
'INVTYPE_HEAD',
'INVTYPE_NECK',
+1 -1
View File
@@ -7,7 +7,7 @@ local persistence = require 'aux.util.persistence'
local history_schema = {'tuple', '#', {next_push='number'}, {daily_min_buyout='number'}, {data_points={'list', ';', {'tuple', '@', {value='number'}, {time='number'}}}}}
local value_cache = T
local value_cache = {}
do
local cache
+1 -1
View File
@@ -9,7 +9,7 @@ local history = require 'aux.core.history'
local PAGE_SIZE = 50
do
local scan_states = T
local scan_states = {}
function M.start(params)
local old_state = scan_states[params.type]
+3 -8
View File
@@ -1,6 +1,5 @@
module 'aux.core.slash'
include 'T'
include 'aux'
local cache = require 'aux.core.cache'
@@ -44,13 +43,10 @@ function SlashCmdList.AUX(command)
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'distribution' then
_G.aux_tooltip_disenchant_distribution = not aux_tooltip_disenchant_distribution
print('tooltip disenchant distribution ' .. status(aux_tooltip_disenchant_distribution))
elseif arguments[1] == 'tooltip' and arguments[2] == 'disenchant' and arguments[3] == 'source' then
_G.aux_tooltip_disenchant_source = not aux_tooltip_disenchant_source
print('tooltip disenchant source ' .. status(aux_tooltip_disenchant_source))
elseif arguments[1] == 'clear' and arguments[2] == 'item' and arguments[3] == 'cache' then
_G.aux_items = T
_G.aux_item_ids = T
_G.aux_auctionable_items = T
_G.aux_items = {}
_G.aux_item_ids = {}
_G.aux_auctionable_items = {}
print('Item cache cleared.')
elseif arguments[1] == 'populate' and arguments[2] == 'wdb' then
cache.populate_wdb()
@@ -65,7 +61,6 @@ function SlashCmdList.AUX(command)
print('- tooltip vendor sell [' .. status(aux_tooltip_merchant_sell) .. ']')
print('- tooltip disenchant value [' .. status(aux_tooltip_disenchant_value) .. ']')
print('- tooltip disenchant distribution [' .. status(aux_tooltip_disenchant_distribution) .. ']')
print('- tooltip disenchant source [' .. status(aux_tooltip_disenchant_source) .. ']')
print('- clear item cache')
print('- populate wdb')
end
+1 -14
View File
@@ -14,7 +14,7 @@ local UNKNOWN = GRAY_FONT_COLOR_CODE .. '?' .. FONT_COLOR_CODE_CLOSE
_G.aux_tooltip_value = true
local game_tooltip_hooks, game_tooltip_money = T, 0
local game_tooltip_hooks, game_tooltip_money = {}, 0
function LOAD()
do
@@ -55,19 +55,6 @@ end
function M.extend_tooltip(tooltip, link, quantity)
local item_id, suffix_id = info.parse_link(link)
quantity = IsShiftKeyDown() and quantity or 1
if aux_tooltip_disenchant_source then
local r, g, b = color.tooltip.disenchant.source()
local type, range = disenchant.source(item_id)
if type == 'CRYSTAL' then
tooltip:AddLine(format('Can disenchant from level %s |cffa335eeEpic|r and |cff0070ddRare|r items.', range), r, g, b, true)
elseif type == 'SHARD' then
tooltip:AddLine(format('Can disenchant from level %s |cff0070ddRare|r and |cff1eff00Uncommon|r items.', range), r, g, b, true)
elseif type == 'ESSENCE' then
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), r, g, b, true)
elseif type == 'DUST' then
tooltip:AddLine(format('Can disenchant from level %s |cff1eff00Uncommon|r items.', range), r, g, b, true)
end
end
local item_info = temp-info.item(item_id)
if item_info then
local distribution = disenchant.distribution(item_info.slot, item_info.quality, item_info.level)
+1 -1
View File
@@ -315,7 +315,7 @@ function M.editbox(parent)
do (this.focus_loss or nop)() end
end)
editbox:SetScript('OnTextChanged', function()
this.overlay:SetText((this.formatter or id)(this:GetText()))
this.overlay:SetText(this.formatter and this.formatter(this:GetText()) or this:GetText())
do (this.change or nop)() end
end)
editbox:SetScript('OnChar', function() (this.char or nop)() end)
+1 -1
View File
@@ -84,7 +84,7 @@ do
end
code = code .. [[
overflow)
if overflow ~= nil then error("Vararg overflow.") end
if overflow ~= nil then error("T-vararg overflow.", 2) end
local n = 0
repeat
]]
+4 -5
View File
@@ -1,12 +1,11 @@
if module then return end
local strfind, type, setmetatable, setfenv, _G = strfind, type, setmetatable, setfenv, getfenv(0)
local error, nop, id, define, include, create_module, nop_default_mt, public_modifier_mt, proxy_mt
local error, nop, define, include, create_module, nop_default_mt, public_modifier_mt, proxy_mt
local loaded, defined, interfaces, environments = {}, {}, {}, {}
function nop() end
function error(msg, ...) return _G.error(format(msg or '', unpack(arg)) .. '\n' .. debugstack(), 0) end
nop, id = function() end, function(v) return v end
function define(self, k, v, private)
if type(k) ~= 'string' or not strfind(k, '^[_%a][_%w]*') then error('Invalid identifier "%s".', k) end
local _, _, prefix, suffix = strfind(k, '^(.?.?.?.?)([_%a].*)')
@@ -43,7 +42,7 @@ function create_module(name)
accessors = {M=function() return public_modifier end}
mutators = setmetatable({_=nop}, {__index=function(_, k) return function(v) define(name, k, v, true) end end})
fields = setmetatable(
{_M=environment, _G=_G, include=function(interface) include(name, interface) end, error=error, nop=nop, id=id},
{_M=environment, _G=_G, include=function(interface) include(name, interface) end, nop=nop},
{__index=function(_, k) local accessor = accessors[k]; if accessor then return accessor() else return _G[k] end end}
)
public_accessors = setmetatable({}, nop_default_mt)
@@ -52,7 +51,7 @@ function create_module(name)
setmetatable(environment, proxy_mt(fields, mutators))
setmetatable(interface, proxy_mt(public_fields, public_mutators))
P = {
defined = {['-_M']=true, ['-_G']=true, ['-include']=true, ['-error']=true, ['-nop']=true, ['-id']=true, ['-M']=true, ['-set__']=true, ['-require']=true},
defined = {['-_M']=true, ['-_G']=true, ['-include']=true, ['-nop']=true, ['-M']=true, ['-set__']=true, ['-require']=true},
fields = fields, accessors = accessors, mutators = mutators,
public_fields = public_fields, public_accessors = public_accessors, public_mutators = public_mutators,
}
+1 -1
View File
@@ -9,7 +9,7 @@ local scan = require 'aux.core.scan'
TAB 'Bids'
auction_records = T
auction_records = {}
function OPEN()
frame:Show()
+1 -1
View File
@@ -5,7 +5,7 @@ local money = require 'aux.util.money'
local cache = require 'aux.core.cache'
local filter_util = require 'aux.util.filter'
local post_filter = T
local post_filter = {}
local post_filter_index = 0
function valid_level(str)
+2 -2
View File
@@ -509,8 +509,8 @@ do
filter_display = scroll_child
end
status_bars = T
tables = T
status_bars = {}
tables = {}
for _ = 1, 5 do
local status_bar = gui.status_bar(frame)
status_bar:SetAllPoints(status_bar_frame)
+2 -2
View File
@@ -32,7 +32,7 @@ function update_real_time(enable)
end
do
local searches = T
local searches = {}
local search_index = 1
function get_current_search()
@@ -361,7 +361,7 @@ end
do
local scan_id = 0
local IDLE, SEARCHING, FOUND = T, T, T
local IDLE, SEARCHING, FOUND = 1, 2, 3
local state = IDLE
local found_index
+2 -2
View File
@@ -3,8 +3,8 @@ module 'aux.tabs.search'
local filter_util = require 'aux.util.filter'
local gui = require 'aux.gui'
_G.aux_favorite_searches = T
_G.aux_recent_searches = T
_G.aux_favorite_searches = {}
_G.aux_recent_searches = {}
function update_search_listings()
local favorite_search_rows = T
+1 -1
View File
@@ -3,7 +3,7 @@ module 'aux.util.persistence'
include 'T'
include 'aux'
_G.aux_datasets = T
_G.aux_datasets = {}
do
local dataset