17,101
edits
0x4a6f6e6573 (talk | contribs) m (_getItemSources: Adds summoning as a source for familiars) |
(_getItemLootSourceTable: Add secondary sort on average quantity descending) |
||
Line 761: | Line 761: | ||
if Shared.tableCount(dropRows) == 0 then return '' end | if Shared.tableCount(dropRows) == 0 then return '' end | ||
table.sort(dropRows, function(a, b) return a.weight / a.totalWeight > b.weight / b.totalWeight end) | table.sort(dropRows, function(a, b) | ||
if a.weight / a.totalWeight == b.weight / b.totalWeight then | |||
return a.minqty + a.qty > b.minqty + b.qty | |||
else | |||
return a.weight / a.totalWeight > b.weight / b.totalWeight | |||
end | |||
end) | |||
for i, data in pairs(dropRows) do | for i, data in pairs(dropRows) do | ||
result = result..buildRow(data.source, data.type, data.minqty, data.qty, data.weight, data.totalWeight) | result = result..buildRow(data.source, data.type, data.minqty, data.qty, data.weight, data.totalWeight) |