big refactoring
This commit is contained in:
@@ -29,7 +29,7 @@ function LOAD()
|
||||
do
|
||||
local tabs = gui.tabs(frame, 'DOWN')
|
||||
tabs._on_select = on_tab_click
|
||||
for _, tab in m.tabs do tabs:create_tab(tab.name) end
|
||||
for _, tab in _m.tabs do tabs:create_tab(tab.name) end
|
||||
function public.set_tab(id) tabs:select(id) end
|
||||
end
|
||||
do
|
||||
@@ -188,7 +188,7 @@ end
|
||||
do
|
||||
local function cost_label(cost)
|
||||
local label = LIGHTYELLOW_FONT_COLOR_CODE..'(Total Cost: '..FONT_COLOR_CODE_CLOSE
|
||||
label = label..(cost and m.money.to_string2(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
label = label..(cost and money.to_string2(cost, nil, LIGHTYELLOW_FONT_COLOR_CODE) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE)
|
||||
label = label..LIGHTYELLOW_FONT_COLOR_CODE..')'..FONT_COLOR_CODE_CLOSE
|
||||
return label
|
||||
end
|
||||
|
||||
@@ -47,7 +47,7 @@ do
|
||||
if event == 'ADDON_LOADED' then
|
||||
if ADDON_LOADED[arg1] then ADDON_LOADED[arg1]() end
|
||||
else
|
||||
m[event]()
|
||||
_m[event]()
|
||||
if event == 'VARIABLES_LOADED' then
|
||||
for _, f in variables_loaded_hooks do f() end
|
||||
end
|
||||
|
||||
@@ -34,7 +34,7 @@ function create_frames()
|
||||
end
|
||||
do
|
||||
local btn = gui.button(frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Cancel')
|
||||
@@ -42,13 +42,13 @@ function create_frames()
|
||||
cancel_button = btn
|
||||
end
|
||||
do
|
||||
local btn = gui.button(m.frame, 16)
|
||||
btn:SetPoint('TOPLEFT', m.cancel_button, 'TOPRIGHT', 5, 0)
|
||||
local btn = gui.button(frame, 16)
|
||||
btn:SetPoint('TOPLEFT', cancel_button, 'TOPRIGHT', 5, 0)
|
||||
btn:SetWidth(80)
|
||||
btn:SetHeight(24)
|
||||
btn:SetText('Refresh')
|
||||
btn:SetScript('OnClick', function()
|
||||
m.scan_auctions()
|
||||
scan_auctions()
|
||||
end)
|
||||
end
|
||||
end
|
||||
+1
-1
@@ -314,7 +314,7 @@ function update_item_configuration()
|
||||
stack_count = stack_count_slider:GetValue()
|
||||
local deposit = floor(selected_item.unit_vendor_price * deposit_factor * (selected_item.max_charges and 1 or stack_size)) * stack_count * UIDropDownMenu_GetSelectedValue(duration_dropdown) / 120
|
||||
|
||||
m.deposit:SetText('Deposit: '..money.to_string(deposit, nil, nil, nil, gui.inline_color.text.enabled))
|
||||
_m.deposit:SetText('Deposit: '..money.to_string(deposit, nil, nil, nil, gui.inline_color.text.enabled))
|
||||
end
|
||||
|
||||
refresh_button:Enable()
|
||||
|
||||
@@ -216,7 +216,7 @@ function create_frames()
|
||||
local frame = CreateFrame('Frame', nil, frame.parameters)
|
||||
start_price_frame = frame
|
||||
gui.set_content_style(frame)
|
||||
frame:SetPoint('TOPRIGHT', m.frame.parameters, 'TOPRIGHT', -71, -60)
|
||||
frame:SetPoint('TOPRIGHT', _m.frame.parameters, 'TOPRIGHT', -71, -60)
|
||||
frame:SetWidth(180)
|
||||
frame:SetHeight(22)
|
||||
local editbox = gui.editbox(frame)
|
||||
|
||||
@@ -73,7 +73,7 @@ function update_form()
|
||||
|
||||
if blizzard_query.exact then
|
||||
for _, key in {'class', 'subclass', 'slot', 'quality'} do
|
||||
m[key..'_dropdown'].button:Disable()
|
||||
_m[key..'_dropdown'].button:Disable()
|
||||
end
|
||||
else
|
||||
class_dropdown.button:Enable()
|
||||
@@ -81,9 +81,9 @@ function update_form()
|
||||
end
|
||||
for _, key in {'min_level', 'max_level'} do
|
||||
if blizzard_query.exact then
|
||||
m[key..'_input']:Disable()
|
||||
_m[key..'_input']:Disable()
|
||||
else
|
||||
m[key..'_input']:Enable()
|
||||
_m[key..'_input']:Enable()
|
||||
end
|
||||
end
|
||||
if blizzard_query.exact then
|
||||
|
||||
+1
-1
@@ -50,7 +50,7 @@ do
|
||||
for i=1,9 do
|
||||
local key = '_'..i
|
||||
public[key] = {}
|
||||
formal_parameters[m[key]] = i
|
||||
formal_parameters[_m[key]] = i
|
||||
end
|
||||
local function helper(f, arg1, arg2)
|
||||
local params = {}
|
||||
|
||||
+16
-16
@@ -41,10 +41,10 @@ function public.container_item(bag, slot)
|
||||
for link in present(GetContainerItemLink(bag, slot)) do
|
||||
|
||||
local item_id, suffix_id, unique_id, enchant_id = parse_link(link)
|
||||
local item_info = m.item(item_id, suffix_id, unique_id, enchant_id)
|
||||
local item_info = item(item_id, suffix_id, unique_id, enchant_id)
|
||||
|
||||
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working?
|
||||
local tooltip, tooltip_money = m.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
||||
local tooltip, tooltip_money = tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
||||
local max_charges = max_item_charges(item_id)
|
||||
local charges = max_charges and item_charges(tooltip)
|
||||
local aux_quantity = charges or count
|
||||
@@ -100,14 +100,14 @@ function public.auction(index, query_type)
|
||||
|
||||
for link in present(GetAuctionItemLink(query_type, index)) do
|
||||
local item_id, suffix_id, unique_id, enchant_id = parse_link(link)
|
||||
local item_info = m.item(item_id, suffix_id, unique_id, enchant_id)
|
||||
local item_info = item(item_id, suffix_id, unique_id, enchant_id)
|
||||
|
||||
local name, texture, count, quality, usable, level, start_price, min_increment, buyout_price, high_bid, high_bidder, owner, sale_status = GetAuctionItemInfo(query_type, index)
|
||||
|
||||
local duration = GetAuctionItemTimeLeft(query_type, index)
|
||||
local tooltip, tooltip_money = m.tooltip(function(tt) tt:SetAuctionItem(query_type, index) end)
|
||||
local max_charges = m.max_item_charges(item_id)
|
||||
local charges = max_charges and m.item_charges(tooltip)
|
||||
local tooltip, tooltip_money = tooltip(function(tt) tt:SetAuctionItem(query_type, index) end)
|
||||
local max_charges = max_item_charges(item_id)
|
||||
local charges = max_charges and item_charges(tooltip)
|
||||
local aux_quantity = charges or count
|
||||
local blizzard_bid = high_bid > 0 and high_bid or start_price
|
||||
local bid_price = high_bid > 0 and (high_bid + min_increment) or start_price
|
||||
@@ -178,13 +178,13 @@ function public.set_shopping_tooltip(slot)
|
||||
local index1, index2 = inventory_index(slot)
|
||||
local tooltips = {}
|
||||
if index1 then
|
||||
local tooltip = m.tooltip(function(tt) tt:SetInventoryItem('player', index1) end)
|
||||
local tooltip = tooltip(function(tt) tt:SetInventoryItem('player', index1) end)
|
||||
if getn(tooltip) > 0 then
|
||||
tinsert(tooltips, tooltip)
|
||||
end
|
||||
end
|
||||
if index2 then
|
||||
local tooltip = m.tooltip(function(tt) tt:SetInventoryItem('player', index2) end)
|
||||
local tooltip = tooltip(function(tt) tt:SetInventoryItem('player', index2) end)
|
||||
if getn(tooltip) > 0 then
|
||||
tinsert(tooltips, tooltip)
|
||||
end
|
||||
@@ -193,7 +193,7 @@ function public.set_shopping_tooltip(slot)
|
||||
if tooltips[1] then
|
||||
tinsert(tooltips[1], 1, {left_text='Currently Equipped', left_color={ 0.5, 0.5, 0.5 }})
|
||||
ShoppingTooltip1:SetOwner(GameTooltip, 'ANCHOR_BOTTOMRIGHT')
|
||||
m.load_tooltip(ShoppingTooltip1, tooltips[1])
|
||||
load_tooltip(ShoppingTooltip1, tooltips[1])
|
||||
ShoppingTooltip1:Show()
|
||||
ShoppingTooltip1:SetPoint('TOPLEFT', GameTooltip, 'TOPRIGHT', 0, -10)
|
||||
end
|
||||
@@ -201,7 +201,7 @@ function public.set_shopping_tooltip(slot)
|
||||
if tooltips[2] then
|
||||
tinsert(tooltips[2], 1, {left_text='Currently Equipped', left_color={ 0.5, 0.5, 0.5 }})
|
||||
ShoppingTooltip2:SetOwner(ShoppingTooltip1, 'ANCHOR_BOTTOMRIGHT')
|
||||
m.load_tooltip(ShoppingTooltip2, tooltips[2])
|
||||
load_tooltip(ShoppingTooltip2, tooltips[2])
|
||||
ShoppingTooltip2:Show()
|
||||
ShoppingTooltip2:SetPoint('TOPLEFT', ShoppingTooltip1, 'TOPRIGHT')
|
||||
end
|
||||
@@ -257,13 +257,13 @@ function public.display_name(item_id, no_brackets, no_color)
|
||||
end
|
||||
|
||||
function public.auctionable(tooltip, quality, lootable)
|
||||
local durability, max_durability = m.durability(tooltip)
|
||||
local durability, max_durability = durability(tooltip)
|
||||
return not lootable
|
||||
and (not quality or quality < 6)
|
||||
and not m.tooltip_match(ITEM_BIND_ON_PICKUP, tooltip)
|
||||
and not m.tooltip_match(ITEM_BIND_QUEST, tooltip)
|
||||
and not m.tooltip_match(ITEM_SOULBOUND, tooltip)
|
||||
and (not m.tooltip_match(ITEM_CONJURED, tooltip) or m.tooltip_find(ITEM_MIN_LEVEL, tooltip) > 1)
|
||||
and not tooltip_match(ITEM_BIND_ON_PICKUP, tooltip)
|
||||
and not tooltip_match(ITEM_BIND_QUEST, tooltip)
|
||||
and not tooltip_match(ITEM_SOULBOUND, tooltip)
|
||||
and (not tooltip_match(ITEM_CONJURED, tooltip) or tooltip_find(ITEM_MIN_LEVEL, tooltip) > 1)
|
||||
and not (durability and durability < max_durability)
|
||||
end
|
||||
|
||||
@@ -340,7 +340,7 @@ function public.durability(tooltip)
|
||||
end
|
||||
|
||||
function public.item_key(link)
|
||||
local item_id, suffix_id = m.parse_link(link)
|
||||
local item_id, suffix_id = parse_link(link)
|
||||
return item_id..':'..suffix_id
|
||||
end
|
||||
|
||||
|
||||
+3
-3
@@ -6,11 +6,11 @@ public.GT = {}
|
||||
|
||||
function public.compare(a, b, desc)
|
||||
if a < b then
|
||||
return desc and m.GT or m.LT
|
||||
return desc and GT or LT
|
||||
elseif a > b then
|
||||
return desc and m.LT or m.GT
|
||||
return desc and LT or GT
|
||||
else
|
||||
return m.EQ
|
||||
return EQ
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user