2,875
edits
No edit summary |
No edit summary |
||
Line 506: | Line 506: | ||
end | end | ||
local | local html = mw.html.create('table') | ||
html:addClass('wikitable sortable') | |||
-- Add header row | |||
local headerRow = html:tag('tr') | |||
headerRow:tag('th'):wikitext('Item') | |||
headerRow:tag('th'):wikitext('[[DLC]]') | |||
headerRow:tag('th'):wikitext('Qty') | |||
headerRow:tag('th'):wikitext('Price') | |||
headerRow:tag('th'):attr('colspan', '2'):wikitext('Chance') | |||
-- Add rows for each rare item | |||
for i, drop in ipairs(SkillData.Thieving.generalRareItems) do | for i, drop in ipairs(SkillData.Thieving.generalRareItems) do | ||
-- If an npcID has been passed and the item is NPC specific, only display | -- If an npcID has been passed and the item is NPC specific, only display the item if it may be obtained while pickpocketing that NPC | ||
local npcMatch = (npc == nil or drop.npcs == nil or Shared.contains(drop.npcs, npc.id)) | |||
local npcMatch = ( | local realmMatch = (npcRealm == nil or drop.realms == nil or Shared.contains(drop.realms, npcRealm)) | ||
local realmMatch = ( | |||
if npcMatch and realmMatch then | if npcMatch and realmMatch then | ||
local thisItem = Items.getItemByID(drop.itemID) | local thisItem = Items.getItemByID(drop.itemID) | ||
local odds = drop.chance | local odds = drop.chance | ||
local row = html:tag('tr') | |||
row:tag('td') | |||
:attr('data-sort-value', thisItem.name) | |||
:wikitext(Icons.Icon({thisItem.name, type='item'})) | |||
row:tag('td') | |||
:wikitext('1') | |||
row:tag('td') | |||
:wikitext(Icons.getDLCColumnIcon(thisItem.id)) | |||
:attr('data-sort-value', Icons.getExpansionID(thisItem.id)) | |||
:css('text-align', 'center') | |||
row:tag('td') | |||
:attr('data-sort-value', thisItem.sellsFor) | |||
:wikitext(Items.getValueText(thisItem)) | |||
row:tag('td') | |||
:css('text-align', 'right') | |||
:attr('data-sort-value', odds) | |||
:wikitext(Shared.fraction(1, Shared.round2(1/(odds/100), 0))) | |||
row:tag('td') | |||
:css('text-align', 'right') | |||
:attr('data-sort-value', odds) | |||
:wikitext(Shared.round(odds, 4, 4) .. '%') | |||
end | end | ||
end | end | ||
return | return tostring(html) | ||
end | end | ||
function p._getThievingNPCCurrencyText(npc) | function p._getThievingNPCCurrencyText(npc) |
edits