12,790
edits
(_getItemLootSourceTable: Add fraction alongside percentage for chance stat) |
(_getItemLootSourceTable: Add fraction alongside percentage for chance stat (Attempt 2)) |
||
(One intermediate revision by the same user not shown) | |||
Line 588: | Line 588: | ||
qty = loot[3] | qty = loot[3] | ||
end | end | ||
end | end | ||
end | end | ||
if wt > 0 then | local lootChance = monster.lootChance ~= nil and monster.lootChance or 100 | ||
if wt > 0 and lootChance > 0 then | |||
local sourceTxt = nil | |||
local typeTxt = nil | |||
--If we're dealing with a boss, this is a Dungeon row instead | --If we're dealing with a boss, this is a Dungeon row instead | ||
if monster.isBoss and not Shared.contains(item.name, 'Shard') then | if monster.isBoss and not Shared.contains(item.name, 'Shard') then | ||
local dung = Areas.getMonsterAreas(i - 1)[1] | local dung = Areas.getMonsterAreas(i - 1)[1] | ||
sourceTxt = Icons.Icon({dung.name, type='dungeon', notext=true}) | |||
typeTxt = '[[Dungeon]]' | |||
else | else | ||
sourceTxt = Icons.Icon({monster.name, type='monster'}) | |||
typeTxt = '[[Monster]]' | |||
end | end | ||
table.insert(dropRows, {source = sourceTxt, type = typeTxt, minqty = minqty, qty = qty, weight = wt * lootChance, totalWeight = totalWt * 100}) | |||
end | end | ||
end | end | ||
Line 608: | Line 609: | ||
--Special exception for the Fire/Infernal Cape and first two lore books as bonus dungeon drops | --Special exception for the Fire/Infernal Cape and first two lore books as bonus dungeon drops | ||
if sourceOverrides['Dungeon'][item.id] ~= nil then | if sourceOverrides['Dungeon'][item.id] ~= nil then | ||
local sourceTxt = Icons.Icon({sourceOverrides['Dungeon'][item.id], type= | local sourceTxt = Icons.Icon({sourceOverrides['Dungeon'][item.id], type='dungeon', notext=true}) | ||
table.insert(dropRows, {source=sourceTxt, type='[[Dungeon]]', minqty=1, qty=1, weight = 1, totalWeight = 1}) | table.insert(dropRows, {source=sourceTxt, type='[[Dungeon]]', minqty=1, qty=1, weight = 1, totalWeight = 1}) | ||
end | end | ||
Line 650: | Line 651: | ||
if wt > 0 then | if wt > 0 then | ||
-- There is a constant 75% chance of gaining an item per successful steal attempt | -- There is a constant 75% chance of gaining an item per successful steal attempt | ||
local sourceTxt = Icons.Icon({npc.name, type='thieving'}) | local sourceTxt = Icons.Icon({npc.name, type='thieving'}) | ||
table.insert(dropRows, {source = sourceTxt, type = thiefType, minqty = 1, qty = qty, weight = wt, totalWeight = totalWt}) | table.insert(dropRows, {source = sourceTxt, type = thiefType, minqty = 1, qty = qty, weight = wt * 75, totalWeight = totalWt * 100}) | ||
end | end | ||
end | end |