4,951
edits
Falterfire (talk | contribs) (Fixed Cape of Completion being counted as a Skillcape) |
Falterfire (talk | contribs) (added code to show special attacks in the Modifiers table for equipment because it seemed like the thing to do) |
||
(3 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local Constants = require('Module:Constants') | local Constants = require('Module:Constants') | ||
Line 198: | Line 196: | ||
if includeModifiers then | if includeModifiers then | ||
table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|') | table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|') | ||
table.insert( | local txtLines = {} | ||
local modTxt = Constants.getModifiersText(item.modifiers, true) | |||
if modTxt ~= '' then | |||
table.insert(txtLines, modTxt) | |||
end | |||
--For items with a special attack, show the details | |||
if item.hasSpecialAttack then | |||
table.insert(txtLines, "'''Special Attack:'''") | |||
for i, spAtt in ipairs(item.specialAttacks) do | |||
table.insert(txtLines, spAtt.defaultChance .. '% chance for ' .. spAtt.name .. ':') | |||
table.insert(txtLines, spAtt.description) | |||
end | |||
end | |||
table.insert(resultPart, table.concat(txtLines, '<br/>')) | |||
end | end | ||
--If requested, add description | --If requested, add description | ||
Line 224: | Line 235: | ||
if includeModifiers then | if includeModifiers then | ||
table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|') | table.insert(resultPart, '\r\n|style="text-align:left;padding:0 0.5em 0 0.5em;"|') | ||
table.insert( | local txtLines = {} | ||
local modTxt = Constants.getModifiersText(item.modifiers, true) | |||
if modTxt ~= '' then | |||
table.insert(txtLines, modTxt) | |||
end | |||
--For items with a special attack, show the details | |||
if item.hasSpecialAttack then | |||
table.insert(txtLines, "'''Special Attack:'''") | |||
for i, spAtt in ipairs(item.specialAttacks) do | |||
table.insert(txtLines, spAtt.defaultChance .. '% chance for ' .. spAtt.name .. ':') | |||
table.insert(txtLines, spAtt.description) | |||
end | |||
end | |||
table.insert(resultPart, table.concat(txtLines, '<br/>')) | |||
end | end | ||
--If requested, add description | --If requested, add description | ||
Line 237: | Line 261: | ||
return table.concat(resultPart) | return table.concat(resultPart) | ||
end | end | ||
Line 302: | Line 269: | ||
local itemList = Items.getItems(function(item) | local itemList = Items.getItems(function(item) | ||
-- Exclude Golbin raid exclusives for now, such that they don't | |||
-- pollute various equipment tables | |||
if item.golbinRaidExclusive ~= nil and item.golbinRaidExclusive then | |||
return false | |||
end | |||
local isMatch = true | local isMatch = true | ||
if style == 'Melee' then | if style == 'Melee' then | ||
Line 311: | Line 283: | ||
elseif style == 'None' then | elseif style == 'None' then | ||
if (Items._getItemStat(item, 'defenceLevelRequired') ~= nil or Items._getItemStat(item, 'rangedLevelRequired') ~= nil or Items._getItemStat(item, 'magicLevelRequired') ~= nil or | if (Items._getItemStat(item, 'defenceLevelRequired') ~= nil or Items._getItemStat(item, 'rangedLevelRequired') ~= nil or Items._getItemStat(item, 'magicLevelRequired') ~= nil or | ||
Shared.contains(styleOverrides.Melee, item.name) or Shared.contains(styleOverrides.Ranged, item.name) or Shared.contains(styleOverrides.Magic, item.name)) and | |||
not Shared.contains(styleOverrides.None, item.name) then | |||
isMatch = false | isMatch = false | ||
end | end | ||
Line 493: | Line 465: | ||
elseif string.upper(category) == 'OTHER' then | elseif string.upper(category) == 'OTHER' then | ||
itemArray = Items.getItems(function(item) | itemArray = Items.getItems(function(item) | ||
return not Shared.contains(item.name, 'Potion') and item.itemsRequired ~= nil and item.validSlots == nil | |||
end) | |||
else | else | ||
if Constants.getEquipmentSlotID(category) == nil then | if Constants.getEquipmentSlotID(category) == nil then | ||
Line 501: | Line 473: | ||
isEquipment = true | isEquipment = true | ||
itemArray = Items.getItems(function(item) | itemArray = Items.getItems(function(item) | ||
return item.itemsRequired ~= nil and Shared.contains(item.validSlots, category) | |||
end) | |||
end | end | ||
table.sort(itemArray, function(a, b) return a.id < b.id end) | table.sort(itemArray, function(a, b) return a.id < b.id end) |