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.
23 lines
638 B
23 lines
638 B
|
5 years ago
|
local WIT, core = ...
|
||
|
|
|
||
|
|
local GridColumns = core.GridColumns
|
||
|
|
|
||
|
|
function GridColumns.ItemValueColumn(options)
|
||
|
|
options = options or {}
|
||
|
|
options.Name = options.Name or 'Value'
|
||
|
|
|
||
|
|
local self = GridColumns.GridColumn(options)
|
||
|
|
|
||
|
|
function self.Value(data)
|
||
|
|
local id = data.ItemId or data.Id
|
||
|
|
return (core.TSMHelper.GetItemPrice(id == core.TSMHelper.PetCageItemId and 'p:'.. data.PetId or id) or 0) * (data.Quantity or 1)
|
||
|
|
end
|
||
|
|
|
||
|
|
function self.GetRowText(row)
|
||
|
|
row[self.Name] = row[self.Name] or self.Value(row.Data)
|
||
|
|
|
||
|
|
return core.TSMHelper.ToMoneyString(row[self.Name])
|
||
|
|
end
|
||
|
|
|
||
|
|
return self
|
||
|
|
end
|