4,951
edits
Falterfire (talk | contribs) (Fixed potion tier levels) |
Falterfire (talk | contribs) (Added getSpecialFishingTable) |
||
Line 33: | Line 33: | ||
local specialFishWt = | local specialFishWt = 6722 | ||
local specialFishLoot = {{129, 2000}, {130, 1600}, {131, 1400}, {132, 1000}, {133, 400}, {668, 10}, {669, 10}, {671, 1}, {670, 50}, {121, 250}} | local specialFishLoot = {{129, 2000}, {130, 1600}, {131, 1400}, {132, 1000}, {133, 400}, {668, 10}, {669, 10}, {903, 1}, {671, 1}, {670, 50}, {121, 250}} | ||
function p.buildSpecialFishingTable() | function p.buildSpecialFishingTable() | ||
Line 1,850: | Line 1,850: | ||
return p._getItemCategories(item) | return p._getItemCategories(item) | ||
end | |||
function p.getSpecialFishingTable(frame) | |||
local lootValue = 0 | |||
local totalWt = specialFishWt | |||
local result = '' | |||
result = result..'\r\n{|class="wikitable sortable"' | |||
result = result..'\r\n!Item' | |||
result = result..'!!Price!!colspan="2"|Chance' | |||
--Sort the loot table by weight in descending order | |||
table.sort(specialFishLoot, function(a, b) return a[2] > b[2] end) | |||
for i, row in pairs(specialFishLoot) do | |||
local thisItem = p.getItemByID(row[1]) | |||
result = result..'\r\n|-\r\n|'..Icons.Icon({thisItem.name, type='item'}) | |||
result = result..'||style="text-align:left" data-sort-value="'..thisItem.sellsFor..'"' | |||
result = result..'|'..Icons.GP(thisItem.sellsFor) | |||
local dropChance = (row[2] / totalWt) * 100 | |||
result = result..'||style="text-align:right" data-sort-value="'..row[2]..'"' | |||
result = result..'|'..Shared.fraction(row[2], totalWt) | |||
result = result..'||style="text-align:right"|'..Shared.round(dropChance, 2, 2)..'%' | |||
lootValue = lootValue + (dropChance * 0.01 * thisItem.sellsFor) | |||
end | |||
result = result..'\r\n|}' | |||
result = result..'\r\nThe average value of a roll on the special fishing loot table is '..Icons.GP(Shared.round(lootValue, 2, 0)) | |||
return result | |||
end | end | ||
return p | return p |