|
|
Line 33: |
Line 33: |
|
| |
|
|
| |
|
| local specialFishWt = 6722
| | p.specialFishWt = 6722 |
| local specialFishLoot = {{128, 2000}, {129, 1600}, {130, 1400}, {131, 1000}, {132, 400}, {667, 10}, {668, 10}, {902, 1}, {670, 1}, {669, 50}, {120, 250}}
| | p.specialFishLoot = {{128, 2000}, {129, 1600}, {130, 1400}, {131, 1000}, {132, 400}, {667, 10}, {668, 10}, {902, 1}, {670, 1}, {669, 50}, {120, 250}} |
|
| |
|
| function p.buildSpecialFishingTable() | | function p.buildSpecialFishingTable() |
Line 1,899: |
Line 1,899: |
| result = result..'||[['..cape.name..']]||'..cape.description | | result = result..'||[['..cape.name..']]||'..cape.description |
| result = result..'\r\n|}' | | result = result..'\r\n|}' |
| return result
| |
| 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 | | return result |
| end | | end |