refactoring
This commit is contained in:
+1
-1
@@ -52,7 +52,7 @@ do
|
||||
function public.modifier(f)
|
||||
local function apply(_, value) return f(value) end
|
||||
return setmetatable(t, {
|
||||
__call=apply, __sub=apply, __newindex=function(_, _, value) return f(value) end,
|
||||
__call=apply, __sub=apply, __pow=apply, __newindex=function(_, _, value) return f(value) end,
|
||||
})
|
||||
end
|
||||
local temp, perm = modifier(function(t) transient[t] = true end), modifier(function(t) transient[t] = nil; return t end)
|
||||
|
||||
+10
-10
@@ -165,16 +165,16 @@ function scan_wdb(item_id)
|
||||
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
||||
if name and not _g.aux_item_ids[strlower(name)] then
|
||||
_g.aux_item_ids[strlower(name)] = item_id
|
||||
_g.aux_items[item_id] = persistence.write(items_schema, {
|
||||
name = name,
|
||||
quality = quality,
|
||||
level = level,
|
||||
class = class,
|
||||
subclass = subclass,
|
||||
slot = slot,
|
||||
max_stack = max_stack,
|
||||
texture = texture,
|
||||
})
|
||||
_g.aux_items[item_id] = persistence.write(items_schema, -object(
|
||||
'name', name,
|
||||
'quality', quality,
|
||||
'level', level,
|
||||
'class', class,
|
||||
'subclass', subclass,
|
||||
'slot', slot,
|
||||
'max_stack', max_stack,
|
||||
'texture', texture
|
||||
))
|
||||
local tooltip = info.tooltip(function(tooltip) tooltip:SetHyperlink(itemstring) end)
|
||||
if info.auctionable(tooltip, quality) then
|
||||
tinsert(_g.aux_auctionable_items, strlower(name))
|
||||
|
||||
@@ -72,14 +72,14 @@ function update_form()
|
||||
end
|
||||
|
||||
if blizzard_query.exact then
|
||||
for key in temp-set('class', 'subclass', 'slot', 'quality') do
|
||||
for key in -temp^set('class', 'subclass', 'slot', 'quality') do
|
||||
_m[key..'_dropdown'].button:Disable()
|
||||
end
|
||||
else
|
||||
class_dropdown.button:Enable()
|
||||
quality_dropdown.button:Enable()
|
||||
end
|
||||
for key in temp-set('min_level', 'max_level') do
|
||||
for key in -temp^set('min_level', 'max_level') do
|
||||
if blizzard_query.exact then
|
||||
_m[key..'_input']:Disable()
|
||||
else
|
||||
@@ -134,7 +134,7 @@ function get_filter_builder_query()
|
||||
add(strlower(_g['ITEM_QUALITY'..quality..'_DESC']))
|
||||
end
|
||||
|
||||
local post_filter_string = filter_util.query_string(temp-object('blizzard', tt, 'post', post_filter))
|
||||
local post_filter_string = filter_util.query_string(-temp^object('blizzard', tt, 'post', post_filter))
|
||||
add(post_filter_string ~= '' and post_filter_string)
|
||||
|
||||
return query_string or ''
|
||||
@@ -313,7 +313,7 @@ function set_filter_display_offset(x_offset, y_offset)
|
||||
end
|
||||
|
||||
function initialize_filter_dropdown()
|
||||
for _, filter in temp-list('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
|
||||
for _, filter in -temp^list('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(-object(
|
||||
'text', filter,
|
||||
'value', filter,
|
||||
|
||||
+1
-1
@@ -517,7 +517,7 @@ function blizzard_query(components)
|
||||
query.slot = slot_index
|
||||
query.quality = item_info.quality
|
||||
else
|
||||
for key in temp-set('min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality') do
|
||||
for key in -temp^set('min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality') do
|
||||
query[key] = index(filters[key], 2)
|
||||
end
|
||||
end
|
||||
|
||||
+2
-2
@@ -190,7 +190,7 @@ function public.set_shopping_tooltip(slot)
|
||||
end
|
||||
|
||||
if tooltips[1] then
|
||||
tinsert(tooltips[1], 1, temp-object('left_text', 'Currently Equipped', 'left_color', temp-list(.5, .5, .5)))
|
||||
tinsert(tooltips[1], 1, -temp^object('left_text', 'Currently Equipped', 'left_color', -temp^list(.5, .5, .5)))
|
||||
ShoppingTooltip1:SetOwner(GameTooltip, 'ANCHOR_BOTTOMRIGHT')
|
||||
load_tooltip(ShoppingTooltip1, tooltips[1])
|
||||
ShoppingTooltip1:Show()
|
||||
@@ -198,7 +198,7 @@ function public.set_shopping_tooltip(slot)
|
||||
end
|
||||
|
||||
if tooltips[2] then
|
||||
tinsert(tooltips[2], 1, temp-object('left_text', 'Currently Equipped', 'left_color', temp-list(.5, .5, .5)))
|
||||
tinsert(tooltips[2], 1, -temp^object('left_text', 'Currently Equipped', 'left_color', -temp^list(.5, .5, .5)))
|
||||
ShoppingTooltip2:SetOwner(ShoppingTooltip1, 'ANCHOR_BOTTOMRIGHT')
|
||||
load_tooltip(ShoppingTooltip2, tooltips[2])
|
||||
ShoppingTooltip2:Show()
|
||||
|
||||
Reference in New Issue
Block a user