Anonymous

Module:Skills: Difference between revisions

From Melvor Idle
_formatLootTable: Re-order columns for table output & include total row
(getThievingNPCTable/getThievingNavbox: Fix text shown for some NPC pages)
(_formatLootTable: Re-order columns for table output & include total row)
(One intermediate revision by the same user not shown)
Line 163: Line 163:
     end
     end
   else
   else
     table.insert(returnPart, '{|class="wikitable sortable"\r\n!Item!!colspan="2"|Chance!!Price')
     table.insert(returnPart, '{|class="wikitable sortable"\r\n!Item!!Price!!colspan="2"|Chance')
   end
   end
   -- Generate row for each item
   -- Generate row for each item
Line 175: Line 175:
     else
     else
       table.insert(returnPart, '|-\r\n|' .. itemText)
       table.insert(returnPart, '|-\r\n|' .. itemText)
      table.insert(returnPart, '|style="text-align:right;" data-sort-value="' .. sellsFor .. '"|' .. Icons.GP(sellsFor))
       table.insert(returnPart, '|style="text-align:right;" data-sort-value="' .. dropChance .. '"|' .. Shared.fraction(drop[2] * chanceMult, totalWeight * 100))
       table.insert(returnPart, '|style="text-align:right;" data-sort-value="' .. dropChance .. '"|' .. Shared.fraction(drop[2] * chanceMult, totalWeight * 100))
       table.insert(returnPart, '|style="text-align:right;"|' .. dropChance .. '%')
       table.insert(returnPart, '|style="text-align:right;"|' .. dropChance .. '%')
      table.insert(returnPart, '|style="text-align:right;" data-sort-value="' .. sellsFor .. '"|' .. Icons.GP(sellsFor))
     end
     end
   end
   end
   if not asList then
   if not asList then
     table.insert(returnPart, '|}')
     table.insert(returnPart, '|-class="sortbottom" \r\n!colspan="2"|Total:')
    local textTotChance = ''
    if chanceMult < 100 then
      textTotChance = '|style="text-align:right"|' .. Shared.fraction(chanceMult, 100) .. '\r\n|'
    else
      textTotChance = '|colspan="2" '
    end
    textTotChance = textTotChance .. 'style="text-align:right;"|' .. Shared.round(chanceMult, 2, 2) .. '%' .. '\r\n|}'
    table.insert(returnPart, textTotChance)
   end
   end


Line 192: Line 200:
   -- Create table header
   -- Create table header
   table.insert(returnPart, '{| class="wikitable sortable stickyHeader"')
   table.insert(returnPart, '{| class="wikitable sortable stickyHeader"')
   table.insert(returnPart, '|- class="headerRow-0"\r\n!Target!!Name!!' .. Icons.Icon({'Thieving', type='skill', notext=true}).. ' Level!!Experience!!Max Hit!!Max Coins')
   table.insert(returnPart, '|- class="headerRow-0"\r\n!Target!!Name!!' .. Icons.Icon({'Thieving', type='skill', notext=true}).. ' Level!!Experience!!Max Hit!!Max Coins!!<abbr title="Assumes all loot is sold, and no GP boosts apply (such as those from Mastery & Gloves of Silence)">GP/Theft</abbr>')
    
    
   -- Create row for each NPC
   -- Create row for each NPC
Line 202: Line 210:
     table.insert(returnPart, '|style="text-align: right;" |' .. p._getThievingNPCStat(npc, 'xp'))
     table.insert(returnPart, '|style="text-align: right;" |' .. p._getThievingNPCStat(npc, 'xp'))
     table.insert(returnPart, '|style="text-align: right;" |' .. p._getThievingNPCStat(npc, 'maxHit'))
     table.insert(returnPart, '|style="text-align: right;" |' .. p._getThievingNPCStat(npc, 'maxHit'))
     table.insert(returnPart, '|style="text-align: right;" |' .. p._getThievingNPCStat(npc, 'maxCoins'))
     table.insert(returnPart, '|style="text-align: right;" data-sort-value="' .. p._getThievingNPCStat(npc, 'maxCoins') .. '" |' .. Icons.GP(p._getThievingNPCStat(npc, 'maxCoins')))
    table.insert(returnPart, '|style="text-align: right;" data-sort-value="' .. p._getThievingNPCStat(npc, 'pickpocketValue') .. '" |' .. Icons.GP(p._getThievingNPCStat(npc, 'pickpocketValue')))
   end
   end
   table.insert(returnPart, '|}')
   table.insert(returnPart, '|}')