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