From 179f1127c976121b5e0c57b6d348595854499e70 Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Tue, 13 Oct 2015 02:20:27 +0200 Subject: [PATCH] more progress with the new layout --- buy.lua | 2 ++ list.lua | 56 +++++++++++++++------------------- list.xml | 93 ++++++++++++++++++++++---------------------------------- util.lua | 25 +++++++++++++++ 4 files changed, 89 insertions(+), 87 deletions(-) diff --git a/buy.lua b/buy.lua index 9388e72..8a376f5 100644 --- a/buy.lua +++ b/buy.lua @@ -61,6 +61,7 @@ function Aux.buy.SearchButton_onclick() slot = category and category.slot, class = category and category.class, subclass = category and category.subclass, + quality = UIDropDownMenu_GetSelectedValue(AuxBuyQualityDropDown), usable = AuxBuyUsableCheckButton:GetChecked() } @@ -289,6 +290,7 @@ function process_auction(auction_item, current_page) if auction_item.owner ~= UnitName("player") then tinsert(entries, { name = auction_item.name, + level = auction_item.level, texture = auction_item.texture, tooltip = auction_item.tooltip, stack_size = stack_size, diff --git a/list.lua b/list.lua index 17b52a1..17d0296 100644 --- a/list.lua +++ b/list.lua @@ -1,8 +1,8 @@ Aux.list = {} -local MAX_COLUMNS = 6 +local MAX_COLUMNS = 7 -local NAME, OWNER, BID, BID_UNIT, BUYOUT, BUYOUT_UNIT, QUANTITY, TIME_LEFT = 1, 2, 3, 4, 5, 6, 7, 8 +local NAME, LEVEL, OWNER, BID, BID_UNIT, BUYOUT, BUYOUT_UNIT, QUANTITY, TIME_LEFT = 1, 2, 3, 4, 5, 6, 7, 8, 9 MoneyTypeInfo["AUX_LIST"] = { UpdateFunc = function() @@ -22,6 +22,12 @@ local logical_columns = { getter = function(row) return ' ['..row.tooltip[1][1].text..']' end, color = function(row) return ITEM_QUALITY_COLORS[row.quality] end, }, + { + type = 'NUMBER', + title = 'Lvl', + comparator = function(row1, row2) return Aux.util.compare(row1.level, row2.level, Aux.util.GT) end, + getter = function(row) return row.level end, + }, { type = 'STRING', title = 'Owner', @@ -29,28 +35,28 @@ local logical_columns = { getter = function(row) return row.owner end, }, { - type = 'MONEY', + type = 'STRING', title = 'Bid', comparator = function(row1, row2) return Aux.util.compare(row1.bid, row2.bid, Aux.util.GT) end, - getter = function(row) return row.bid end, + getter = function(row) return Aux.util.coins(row.bid) end, }, { - type = 'MONEY', + type = 'STRING', title = 'Bid (Unit)', comparator = function(row1, row2) return Aux.util.compare(row1.bid_per_unit, row2.bid_per_unit, Aux.util.GT) end, - getter = function(row) return row.bid_per_unit end, + getter = function(row) return Aux.util.coins(row.bid_per_unit) end, }, { - type = 'MONEY', + type = 'STRING', title = 'Buyout', comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price, row2.buyout_price, Aux.util.GT) end, - getter = function(row) return row.buyout_price end, + getter = function(row) return Aux.util.coins(row.buyout_price) end, }, { - type = 'MONEY', + type = 'STRING', title = 'Buyout (Unit)', comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price_per_unit, row2.buyout_price_per_unit, Aux.util.GT) end, - getter = function(row) return row.buyout_price_per_unit end, + getter = function(row) return Aux.util.coins(row.buyout_price_per_unit) end, }, { type = 'NUMBER', @@ -70,7 +76,7 @@ local logical_columns = { elseif row.duration == 3 then return '8h' elseif row.duration == 4 then - return '12h' + return '24h' end end, }, @@ -87,10 +93,15 @@ local physical_columns = { logical_column = logical_columns[NAME], width = 180 }, + { + logical_columns = { logical_columns[LEVEL] }, + logical_column = logical_columns[LEVEL], + width = 40 + }, { logical_columns = { logical_columns[TIME_LEFT] }, logical_column = logical_columns[TIME_LEFT], - width = 40 + width = 50 }, { logical_columns = { logical_columns[OWNER] }, @@ -100,12 +111,12 @@ local physical_columns = { { logical_columns = { logical_columns[BID_UNIT], logical_columns[BUYOUT_UNIT] }, logical_column = logical_columns[BUYOUT_UNIT], - width = 140 + width = 100 }, { logical_columns = { logical_columns[BID], logical_columns[BUYOUT] }, logical_column = logical_columns[BUYOUT], - width = 140 + width = 100 }, } @@ -301,9 +312,6 @@ function Aux.list.scroll_frame_update(frame) local text = getglobal(parent:GetName().."Item"..line.."Column"..column_index) -- text:Hide() TODO text:SetText() - - local moneyFrame = getglobal(parent:GetName().."Item"..line.."Column"..column_index.."MoneyFrame") - moneyFrame:Hide() if column_index <= table.getn(parent.physical_columns) then local physical_column = parent.physical_columns[column_index] @@ -334,20 +342,6 @@ function Aux.list.scroll_frame_update(frame) -- text:SetJustifyH("LEFT") -- end text:Show() - elseif moneyFrame and logical_column.type == "MONEY" then - if value >= 0 then - MoneyFrame_Update(moneyFrame:GetName(), value) - SetMoneyFrameColor(moneyFrame:GetName(), 255, 255, 255) - else - MoneyFrame_Update(moneyFrame:GetName(), -value) - SetMoneyFrameColor(moneyFrame:GetName(), 255, 0, 0) - end - if logical_column.alphaFunc then - moneyFrame:SetAlpha(logical_column.alphaFunc(content[row_index])) - else - moneyFrame:SetAlpha(1.0) - end - moneyFrame:Show() end end end diff --git a/list.xml b/list.xml index 9a1d3e1..7c5b023 100644 --- a/list.xml +++ b/list.xml @@ -14,11 +14,11 @@ - + - + @@ -30,6 +30,10 @@ + + + + @@ -73,60 +77,6 @@ - - - - - SmallMoneyFrame_OnLoad() - MoneyFrame_SetType("AUX_LIST") - - - - - - - - SmallMoneyFrame_OnLoad() - MoneyFrame_SetType("AUX_LIST") - - - - - - - - SmallMoneyFrame_OnLoad() - MoneyFrame_SetType("AUX_LIST") - - - - - - - - SmallMoneyFrame_OnLoad() - MoneyFrame_SetType("AUX_LIST") - - - - - - - - SmallMoneyFrame_OnLoad() - MoneyFrame_SetType("AUX_LIST") - - - - - - - - SmallMoneyFrame_OnLoad() - MoneyFrame_SetType("AUX_LIST") - - - @@ -354,6 +304,37 @@ + + + + + + + + + + + + Aux.list.dropdown_on_load() + + + diff --git a/util.lua b/util.lua index 6f5bc69..2203b2c 100644 --- a/util.lua +++ b/util.lua @@ -188,4 +188,29 @@ function Aux.util.index_of(value, array) return i end end +end + +local GOLD = "ffd100" +local SILVER = "e6e6e6" +local COPPER = "c8602c" + +local GSC_3 = "|cff%s%d|cff000000.|cff%s%02d|cff000000.|cff%s%02d|r" +local GSC_2 = "|cff%s%d|cff000000.|cff%s%02d|r" +local GSC_1 = "|cff%s%d|r" + +function Aux.util.coins(money) + money = floor(tonumber(money) or 0) + local g = floor(money / 10000) + money = money - g * 10000 + local s = floor(money / 100) + money = money - s * 100 + local c = money + + if g > 0 then + return string.format(GSC_3, GOLD, g, SILVER, s, COPPER, c) + elseif s > 0 then + return string.format(GSC_2, SILVER, s, COPPER, c) + else + return string.format(GSC_1, COPPER, c) + end end \ No newline at end of file