Module:Skills: Difference between revisions

_formatLootTable: Re-order columns for table output & include total row
(getThievingNPCTable: Add average pickpocket value)
(_formatLootTable: Re-order columns for table output & include total row)
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