implemented buy grouping
This commit is contained in:
Generated
+68
-51
@@ -3,10 +3,8 @@
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="3c1af1d3-ae57-470d-8daa-a9295703c6fc" name="Default" comment="">
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/buy.lua" afterPath="$PROJECT_DIR$/buy.lua" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/buy.xml" afterPath="$PROJECT_DIR$/buy.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/core.lua" afterPath="$PROJECT_DIR$/core.lua" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/sell.lua" afterPath="$PROJECT_DIR$/sell.lua" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/sell.xml" afterPath="$PROJECT_DIR$/sell.xml" />
|
||||
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/util.lua" afterPath="$PROJECT_DIR$/util.lua" />
|
||||
</list>
|
||||
<ignored path="Aux-Addon.iws" />
|
||||
<ignored path=".idea/workspace.xml" />
|
||||
@@ -72,8 +70,8 @@
|
||||
<file leaf-file-name="core.lua" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="615" max-vertical-offset="8840">
|
||||
<caret line="58" column="34" selection-start-line="58" selection-start-column="34" selection-end-line="58" selection-end-column="34" />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2349" max-vertical-offset="8789">
|
||||
<caret line="151" column="70" selection-start-line="151" selection-start-column="70" selection-end-line="151" selection-end-column="70" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -82,8 +80,18 @@
|
||||
<file leaf-file-name="buy.lua" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/buy.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="-10.321428" vertical-offset="13498" max-vertical-offset="16235">
|
||||
<caret line="811" column="68" selection-start-line="811" selection-start-column="68" selection-end-line="811" selection-end-column="68" />
|
||||
<state vertical-scroll-proportion="-13.892858" vertical-offset="1447" max-vertical-offset="15895">
|
||||
<caret line="108" column="27" selection-start-line="108" selection-start-column="27" selection-end-line="108" selection-end-column="27" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="util.lua" pinned="false" current="true" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/util.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.82167834" vertical-offset="3780" max-vertical-offset="4420">
|
||||
<caret line="250" column="11" selection-start-line="250" selection-start-column="11" selection-end-line="250" selection-end-column="11" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -102,8 +110,8 @@
|
||||
<file leaf-file-name="sell.lua" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/sell.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2676" max-vertical-offset="10336">
|
||||
<caret line="172" column="171" selection-start-line="172" selection-start-column="171" selection-end-line="172" selection-end-column="171" />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2863" max-vertical-offset="10336">
|
||||
<caret line="181" column="11" selection-start-line="181" selection-start-column="11" selection-end-line="181" selection-end-column="11" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
@@ -119,10 +127,10 @@
|
||||
</provider>
|
||||
</entry>
|
||||
</file>
|
||||
<file leaf-file-name="sell.xml" pinned="false" current="true" current-in-tab="true">
|
||||
<file leaf-file-name="sell.xml" pinned="false" current="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/sell.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.505" vertical-offset="7670" max-vertical-offset="9588">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="7670" max-vertical-offset="9588">
|
||||
<caret line="469" column="55" selection-start-line="469" selection-start-column="55" selection-end-line="469" selection-end-column="55" />
|
||||
<folding />
|
||||
</state>
|
||||
@@ -177,10 +185,11 @@
|
||||
<option value="$PROJECT_DIR$/info.lua" />
|
||||
<option value="$PROJECT_DIR$/core.xml" />
|
||||
<option value="$PROJECT_DIR$/buy.xml" />
|
||||
<option value="$PROJECT_DIR$/buy.lua" />
|
||||
<option value="$PROJECT_DIR$/core.lua" />
|
||||
<option value="$PROJECT_DIR$/sell.lua" />
|
||||
<option value="$PROJECT_DIR$/sell.xml" />
|
||||
<option value="$PROJECT_DIR$/core.lua" />
|
||||
<option value="$PROJECT_DIR$/buy.lua" />
|
||||
<option value="$PROJECT_DIR$/util.lua" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
@@ -418,14 +427,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/list.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="1007" max-vertical-offset="4743">
|
||||
<caret line="90" column="73" selection-start-line="90" selection-start-column="73" selection-end-line="90" selection-end-column="73" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/core.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2193" max-vertical-offset="3434">
|
||||
@@ -434,22 +435,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="615" max-vertical-offset="8840">
|
||||
<caret line="58" column="34" selection-start-line="58" selection-start-column="34" selection-end-line="58" selection-end-column="34" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/buy.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="-10.321428" vertical-offset="13498" max-vertical-offset="16235">
|
||||
<caret line="811" column="68" selection-start-line="811" selection-start-column="68" selection-end-line="811" selection-end-column="68" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/stack.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="-11.678572" vertical-offset="2155" max-vertical-offset="3485">
|
||||
@@ -458,14 +443,6 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/info.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="172" max-vertical-offset="2992">
|
||||
<caret line="29" column="17" selection-start-line="29" selection-start-column="17" selection-end-line="29" selection-end-column="17" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/buy.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="3253" max-vertical-offset="7973">
|
||||
@@ -474,18 +451,58 @@
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/sell.lua">
|
||||
<entry file="file://$PROJECT_DIR$/sell.xml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2676" max-vertical-offset="10336">
|
||||
<caret line="172" column="171" selection-start-line="172" selection-start-column="171" selection-end-line="172" selection-end-column="171" />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="7670" max-vertical-offset="9588">
|
||||
<caret line="469" column="55" selection-start-line="469" selection-start-column="55" selection-end-line="469" selection-end-column="55" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/sell.xml">
|
||||
<entry file="file://$PROJECT_DIR$/core.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.505" vertical-offset="7670" max-vertical-offset="9588">
|
||||
<caret line="469" column="55" selection-start-line="469" selection-start-column="55" selection-end-line="469" selection-end-column="55" />
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2349" max-vertical-offset="8789">
|
||||
<caret line="151" column="70" selection-start-line="151" selection-start-column="70" selection-end-line="151" selection-end-column="70" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/sell.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="2863" max-vertical-offset="10336">
|
||||
<caret line="181" column="11" selection-start-line="181" selection-start-column="11" selection-end-line="181" selection-end-column="11" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/info.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="172" max-vertical-offset="2992">
|
||||
<caret line="29" column="17" selection-start-line="29" selection-start-column="17" selection-end-line="29" selection-end-column="17" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/list.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.0" vertical-offset="1007" max-vertical-offset="4743">
|
||||
<caret line="90" column="73" selection-start-line="90" selection-start-column="73" selection-end-line="90" selection-end-column="73" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/buy.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="-13.892858" vertical-offset="1447" max-vertical-offset="15895">
|
||||
<caret line="108" column="27" selection-start-line="108" selection-start-column="27" selection-end-line="108" selection-end-column="27" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/util.lua">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state vertical-scroll-proportion="0.82167834" vertical-offset="3780" max-vertical-offset="4420">
|
||||
<caret line="250" column="11" selection-start-line="250" selection-start-column="11" selection-end-line="250" selection-end-column="11" />
|
||||
<folding />
|
||||
</state>
|
||||
</provider>
|
||||
|
||||
@@ -33,17 +33,17 @@ Aux.buy.modes = {
|
||||
{
|
||||
title = '#',
|
||||
width = 23,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].stack_size, group2[1].stack_size, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.stack_size)
|
||||
alpha_setter(cell, datum)
|
||||
cell_setter = function(cell, group)
|
||||
cell.text:SetText(group[1].stack_size)
|
||||
-- alpha_setter(cell, group)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Auction Item',
|
||||
width = 157,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.tooltip[1][1].text, row2.tooltip[1][1].text, Aux.util.GT) end,
|
||||
width = 214,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].name, group2[1].name, Aux.util.GT) end,
|
||||
cell_initializer = function(cell)
|
||||
local icon = CreateFrame('Button', nil, cell)
|
||||
local icon_texture = icon:CreateTexture(nil, 'BORDER')
|
||||
@@ -73,28 +73,28 @@ Aux.buy.modes = {
|
||||
cell.text = text
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.tooltip = datum.tooltip
|
||||
cell.EnhTooltip_info = datum.EnhTooltip_info
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
if not datum.usable then
|
||||
cell_setter = function(cell, group)
|
||||
cell.tooltip = group[1].tooltip
|
||||
cell.EnhTooltip_info = group[1].EnhTooltip_info
|
||||
cell.icon.icon_texture:SetTexture(group[1].texture)
|
||||
if not group[1].usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
else
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 1.0, 1.0)
|
||||
end
|
||||
cell.text:SetText('['..datum.tooltip[1][1].text..']')
|
||||
local color = ITEM_QUALITY_COLORS[datum.quality]
|
||||
cell.text:SetText('['..group[1].tooltip[1][1].text..']')
|
||||
local color = ITEM_QUALITY_COLORS[group[1].quality]
|
||||
cell.text:SetTextColor(color.r, color.g, color.b)
|
||||
alpha_setter(cell, datum)
|
||||
-- alpha_setter(cell, group)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Lvl',
|
||||
width = 23,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.level, row2.level, Aux.util.GT) end,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].level, group2[1].level, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
local level = max(1, datum.level)
|
||||
cell_setter = function(cell, group)
|
||||
local level = max(1, group[1].level)
|
||||
local text
|
||||
if level > UnitLevel('player') then
|
||||
text = RED_FONT_COLOR_CODE..level..FONT_COLOR_CODE_CLOSE
|
||||
@@ -102,57 +102,37 @@ Aux.buy.modes = {
|
||||
text = level
|
||||
end
|
||||
cell.text:SetText(text)
|
||||
alpha_setter(cell, datum)
|
||||
-- alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Left',
|
||||
width = 30,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.duration, row2.duration, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, datum)
|
||||
local text
|
||||
if datum.duration == 1 then
|
||||
text = '30m'
|
||||
elseif datum.duration == 2 then
|
||||
text = '2h'
|
||||
elseif datum.duration == 3 then
|
||||
text = '8h'
|
||||
elseif datum.duration == 4 then
|
||||
text = '24h'
|
||||
end
|
||||
cell.text:SetText(text)
|
||||
alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Owner',
|
||||
width = 70,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.owner, row2.owner, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.owner)
|
||||
alpha_setter(cell, datum)
|
||||
title = 'No',
|
||||
width = 43,
|
||||
comparator = function(group1, group2) return Aux.util.compare(getn(group1), getn(group2), Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, group)
|
||||
cell.text:SetText(getn(group))
|
||||
-- alpha_setter(cell, group)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Buy/ea',
|
||||
width = 140,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price_per_unit, row2.buyout_price_per_unit, Aux.util.GT) end,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].buyout_price_per_unit, group2[1].buyout_price_per_unit, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(Aux.util.money_string(datum.buyout_price_per_unit))
|
||||
alpha_setter(cell, datum)
|
||||
cell_setter = function(cell, group)
|
||||
cell.text:SetText(Aux.util.money_string(group[1].buyout_price_per_unit))
|
||||
-- alpha_setter(cell, group)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Buy',
|
||||
width = 140,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price, row2.buyout_price, Aux.util.GT) end,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].buyout_price, group2[1].buyout_price, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(Aux.util.money_string(datum.buyout_price))
|
||||
alpha_setter(cell, datum)
|
||||
cell_setter = function(cell, group)
|
||||
cell.text:SetText(Aux.util.money_string(group[1].buyout_price))
|
||||
-- alpha_setter(cell, group)
|
||||
end,
|
||||
},
|
||||
},
|
||||
@@ -811,7 +791,7 @@ end
|
||||
function Aux_Buy_ScrollbarUpdate()
|
||||
local mode = UIDropDownMenu_GetSelectedValue(AuxBuyModeDropDown)
|
||||
if mode == BUY then
|
||||
Aux.list.populate(AuxBuyBuyList.sheet, auctions or {})
|
||||
Aux.list.populate(AuxBuyBuyList.sheet, auctions and Aux.util.group_by(auctions, {'buyout_price', 'stack_size'}) or {})
|
||||
elseif mode == BID then
|
||||
Aux.list.populate(AuxBuyBidList.sheet, auctions or {})
|
||||
elseif mode == FULL then
|
||||
|
||||
@@ -151,9 +151,6 @@ function Aux_SetupHookFunctions()
|
||||
Aux.orig.AuctionFrameAuctions_OnShow = AuctionFrameAuctions_OnShow
|
||||
AuctionFrameAuctions_OnShow = Aux_Sell_AuctionFrameAuctions_OnShow
|
||||
|
||||
Aux.orig.AuctionsRadioButton_OnClick = AuctionsRadioButton_OnClick
|
||||
AuctionsRadioButton_OnClick = Aux_Sell_AuctionsRadioButton_OnClick
|
||||
|
||||
Aux.orig.BrowseButton_OnClick = BrowseButton_OnClick
|
||||
BrowseButton_OnClick = Aux_BrowseButton_OnClick
|
||||
|
||||
|
||||
@@ -238,14 +238,17 @@ end
|
||||
|
||||
function Aux.util.group_by(tables, keys)
|
||||
local groups = {}
|
||||
Aux.util.map(tables, function(table)
|
||||
for _, table in ipairs(tables) do
|
||||
local found_group
|
||||
for _, group in ipairs(groups) do
|
||||
if Aux.util.all(keys, function(key) return table[key] == group[1][key] end) then
|
||||
tinsert(group, table)
|
||||
return
|
||||
found_group = true
|
||||
end
|
||||
end
|
||||
tinsert(groups, { table })
|
||||
end)
|
||||
end
|
||||
if not found_group then
|
||||
tinsert(groups, { table })
|
||||
end
|
||||
end
|
||||
return groups
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user