2,875
edits
No edit summary |
No edit summary |
||
Line 719: | Line 719: | ||
function p.getThievingNPCTable(frame) | function p.getThievingNPCTable(frame) | ||
local args = frame.args or frame:getParent().args | |||
local realmName = args.realm | |||
local realm = Skills.getRealmFromName(realmName) | |||
if realm == nil then | |||
return Shared.printError('Failed to find a realm with name ' .. (realmName or 'nil')) | |||
end | |||
local skillID = 'Thieving' | |||
local root = mw.html.create('table') | |||
:addClass('wikitable sortable stickyHeader') | |||
-- Header row | |||
local headerRow = root:tag('tr') | |||
:addClass('headerRow-0') | |||
:tag('th'):attr('colspan', '2'):wikitext('Name') | |||
:tag('th'):wikitext('Area') | |||
:tag('th'):wikitext(Icons.Icon({'Thieving', type='skill', notext=true}) .. '<br>Level') | |||
:tag('th'):wikitext('[[DLC]]') | |||
:tag('th'):wikitext('Experience') | |||
:tag('th'):wikitext('Max Hit') | |||
:tag('th'):wikitext('Perception') | |||
:tag('th'):wikitext('Currency') | |||
:tag('th'):wikitext('Unique Drop') | |||
local npcArray = GameData.getEntities(SkillData.Thieving.npcs, | |||
function(obj) | |||
return Skills.getRecipeRealm(obj) == realm.id | |||
end | |||
) | |||
table.sort(npcArray, function(a, b) return Skills.standardRecipeSort(skillID, a, b) end) | |||
for i, npc in ipairs(npcArray) do | |||
local level = Skills.getRecipeLevel(skillID, npc) | |||
local baseXP = npc.baseAbyssalExperience or npc.baseExperience | |||
local area = Skills.getThievingNPCArea(npc) | |||
local currSortAmt = npc.currencyDrops[1].quantity | |||
local row = root:tag('tr') | |||
row:tag('td'):wikitext(Icons.Icon({npc.name, type='thieving', notext=true})) | |||
row:tag('td'):attr('data-sort-value', npc.name) | |||
:wikitext('[[' .. npc.name .. ']]') | |||
row:tag('td'):wikitext(area.name) | |||
row:tag('td'):wikitext(level) | |||
row:tag('td'):wikitext(Icons.getDLCColumnIcon(npc.id)) | |||
:css('text-align', 'center') | |||
:attr('data-sort-value', Icons.getExpansionID(npc.id)) | |||
row:tag('td'):css('text-align', 'right') | |||
:wikitext(Shared.formatnum(baseXP)) | |||
row:tag('td'):css('text-align', 'right') | |||
:wikitext(Shared.formatnum(npc.maxHit * 10)) | |||
row:tag('td'):css('text-align', 'right') | |||
:attr('data-sort-value', npc.perception) | |||
:wikitext(Shared.formatnum(npc.perception)) | |||
row:tag('td'):attr('data-sort-value', currSortAmt) | |||
:wikitext(p._getThievingNPCCurrencyText(npc)) | |||
if npc.uniqueDrop ~= nil then | |||
local uniqueDrop = Items.getItemByID(npc.uniqueDrop.id) | |||
if npc.uniqueDrop.quantity > 1 then | |||
row:tag('td'):attr('data-sort-value', uniqueDrop.name) | |||
:wikitext(Icons.Icon({uniqueDrop.name, type='item', qty=npc.uniqueDrop.quantity})) | |||
else | |||
row:tag('td'):attr('data-sort-value', uniqueDrop.name) | |||
:wikitext(Icons.Icon({uniqueDrop.name, type='item'})) | |||
end | |||
else | |||
row:tag('td'):wikitext(' ') | |||
end | |||
end | |||
return tostring(root) | |||
end | end | ||
edits