4,951
edits
Falterfire (talk | contribs) (Added 'Items With Special Attacks' category) |
Falterfire (talk | contribs) (Added new Passive Items category) |
||
(4 intermediate revisions by the same user not shown) | |||
Line 12: | Line 12: | ||
local Shared = require('Module:Shared') | local Shared = require('Module:Shared') | ||
local Icons = require('Module:Icons') | local Icons = require('Module:Icons') | ||
Line 253: | Line 252: | ||
if item.tier ~= nil then result = result..'[[Category:'..Shared.titleCase(item.tier)..' '..item.type..']]' end | if item.tier ~= nil then result = result..'[[Category:'..Shared.titleCase(item.tier)..' '..item.type..']]' end | ||
if item.hasSpecialAttack then result = result..'[[Category:Items With Special Attacks]]' end | if item.hasSpecialAttack then result = result..'[[Category:Items With Special Attacks]]' end | ||
if item.isPassiveItem then result = result..'[[Category:Passive Items]]' end | |||
return result | return result | ||
end | end | ||
Line 322: | Line 322: | ||
end | end | ||
result = result..'\r\n|}' | result = result..'\r\n|}' | ||
return result | |||
end | |||
function p.getSpecialAttackTable(frame) | |||
local spAttTable = {} | |||
for i, item in Shared.skpairs(ItemData.Items) do | |||
if item.hasSpecialAttack then | |||
if spAttTable[item.specialAttackID] == nil then spAttTable[item.specialAttackID] = {sortName=item.name, Icons = {}} end | |||
table.insert(spAttTable[item.specialAttackID].Icons, Icons.Icon({item.name, type='item'})) | |||
end | |||
end | |||
local result = '{|class="wikitable sortable stickyHeader"' | |||
result = result..'\r\n|-class="headerRow-0"' | |||
result = result..'\r\n!style="min-width:180px"|Weapon(s)!!Name!!Chance!!Effect' | |||
for i, spAttData in Shared.skpairs(spAttTable) do | |||
local spAtt = p.getSpecialAttackByID(i) | |||
table.sort(spAttData.Icons, function(a, b) return a < b end) | |||
result = result..'\r\n|-' | |||
result = result..'\r\n|data-sort-value="'..spAttData.sortName..'"|'..table.concat(spAttData.Icons, '<br/>') | |||
result = result..'||'..spAtt.name..'||data-sort-value="'..spAtt.chance..'"|'..spAtt.chance..'%' | |||
result = result..'||'..spAtt.description | |||
end | |||
result = result..'\r\n|}' | |||
return result | return result | ||
end | end | ||
return p | return p |