added the last missing ui elements to the tsm style: dropdown and checkbox. also many other style changes and lots of things made larger
This commit is contained in:
+10
-12
@@ -3,8 +3,8 @@ local m, public, private = aux.module'cache'
|
||||
private.MIN_ITEM_ID = 1
|
||||
private.MAX_ITEM_ID = 30000
|
||||
|
||||
local items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
|
||||
local merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} }
|
||||
private.items_schema = {'record', '#', {name='string'}, {quality='number'}, {level='number'}, {class='string'}, {subclass='string'}, {slot='string'}, {max_stack='number'}, {texture='string'}}
|
||||
private.merchant_buy_schema = {'record', '#', {unit_price='number'}, {limited='boolean'} }
|
||||
|
||||
aux_items = {}
|
||||
aux_item_ids = {}
|
||||
@@ -24,10 +24,8 @@ function m.LOAD()
|
||||
CreateFrame('Frame', nil, MerchantFrame):SetScript('OnUpdate', m.merchant_on_update)
|
||||
|
||||
aux.control.event_listener('NEW_AUCTION_UPDATE', function()
|
||||
local info = aux.info.auction_sell_item()
|
||||
if info then
|
||||
local item_id = aux.cache.item_id(info.name)
|
||||
if item_id then
|
||||
for _, info in {aux.info.auction_sell_item()} do
|
||||
for _, item_id in {aux.cache.item_id(info.name)} do
|
||||
aux_merchant_sell[aux.cache.item_id(info.name)] = info.vendor_price / (aux.info.max_item_charges(item_id) or info.count)
|
||||
end
|
||||
end
|
||||
@@ -81,7 +79,7 @@ end
|
||||
function public.merchant_info(item_id)
|
||||
local buy_info
|
||||
if aux_merchant_buy[item_id] then
|
||||
buy_info = aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
|
||||
buy_info = aux.persistence.read(m.merchant_buy_schema, aux_merchant_buy[item_id])
|
||||
end
|
||||
|
||||
return aux_merchant_sell[item_id], buy_info and buy_info.unit_price, buy_info and buy_info.limited
|
||||
@@ -90,7 +88,7 @@ end
|
||||
function public.item_info(item_id)
|
||||
local data_string = aux_items[item_id]
|
||||
if data_string then
|
||||
local cached_data = aux.persistence.read(items_schema, data_string)
|
||||
local cached_data = aux.persistence.read(m.items_schema, data_string)
|
||||
return {
|
||||
name = cached_data.name,
|
||||
itemstring = 'item:'..item_id..':0:0:0',
|
||||
@@ -119,7 +117,7 @@ function private.merchant_buy_scan()
|
||||
local item_id = aux.info.parse_hyperlink(link)
|
||||
local new_unit_price, new_limited = price / count, stock >= 0
|
||||
if aux_merchant_buy[item_id] then
|
||||
local buy_info = aux.persistence.read(merchant_buy_schema, aux_merchant_buy[item_id])
|
||||
local buy_info = aux.persistence.read(m.merchant_buy_schema, aux_merchant_buy[item_id])
|
||||
|
||||
local unit_price
|
||||
if buy_info.limited and not new_limited then
|
||||
@@ -130,12 +128,12 @@ function private.merchant_buy_scan()
|
||||
unit_price = min(buy_info.unit_price, new_unit_price)
|
||||
end
|
||||
|
||||
aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, {
|
||||
aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
|
||||
unit_price = unit_price,
|
||||
limited = buy_info.limited and new_limited,
|
||||
})
|
||||
else
|
||||
aux_merchant_buy[item_id] = aux.persistence.write(merchant_buy_schema, {
|
||||
aux_merchant_buy[item_id] = aux.persistence.write(m.merchant_buy_schema, {
|
||||
unit_price = new_unit_price,
|
||||
limited = new_limited,
|
||||
})
|
||||
@@ -166,7 +164,7 @@ function private.scan_wdb(item_id)
|
||||
local name, _, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
||||
if name and not aux_item_ids[strlower(name)] then
|
||||
aux_item_ids[strlower(name)] = item_id
|
||||
aux_items[item_id] = aux.persistence.write(items_schema, {
|
||||
aux_items[item_id] = aux.persistence.write(m.items_schema, {
|
||||
name = name,
|
||||
quality = quality,
|
||||
level = level,
|
||||
|
||||
Reference in New Issue
Block a user