You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
818 B
31 lines
818 B
local WIT, core = ...
|
|
|
|
local AceGUI = LibStub("AceGUI-3.0")
|
|
|
|
local GridColumns = core.GridColumns
|
|
|
|
function GridColumns.ProfitColumn(options)
|
|
options = options or {}
|
|
options.Name = options.Name or 'Profit'
|
|
|
|
local self = GridColumns.GridColumn(options)
|
|
|
|
self.CostColumn = options.CostColumn
|
|
self.ValueColumn = options.ValueColumn
|
|
self.Description = core.GetString('ProfitDescription')
|
|
|
|
function self.Value(data)
|
|
local value = self.ValueColumn.Value(data)
|
|
local cost = self.CostColumn.Value(data)
|
|
|
|
return value ~= nil and cost ~= nil and (value - cost) or nil
|
|
end
|
|
|
|
function self.GetRowText(row)
|
|
row[self.Name] = row[self.Name] or self.Value(row.Data)
|
|
|
|
return core.TSMHelper.ToColoredMoneyString(row[self.Name])
|
|
end
|
|
|
|
return self
|
|
end
|
|
|