4,951
edits
(Automate some Thieving tables/navigation) |
Falterfire (talk | contribs) (Added 'no item' drop chance to NPC table) |
||
Line 113: | Line 113: | ||
-- Get the length (in characters) of the largest drop chance so that they can be right aligned | -- Get the length (in characters) of the largest drop chance so that they can be right aligned | ||
local maxDropLen = string.len(Shared.round(lootTable[1][2] / totalWeight * chanceMult, 2, 2)) | -- [4/16/21]: Adding info for no drop | ||
local maxDropLen = math.max(string.len(Shared.round(25, 2, 2)), string.len(Shared.round(lootTable[1][2] / totalWeight * chanceMult, 2, 2))) | |||
local returnPart = {} | local returnPart = {} | ||
table.insert(returnPart, '* ' .. string.rep(' ', math.max(0, (maxDropLen - string.len(Shared.round(25, 2, 2))) * 2)) .. '25.00% No Item') | |||
for i, drop in pairs(lootTable) do | for i, drop in pairs(lootTable) do | ||
local item, itemText, dropChance = Items.getItemByID(drop[1]), nil, Shared.round(drop[2] / totalWeight * chanceMult, 2, 2) | local item, itemText, dropChance = Items.getItemByID(drop[1]), nil, Shared.round(drop[2] / totalWeight * chanceMult, 2, 2) |