Module:Items: Difference between revisions

1,059 bytes removed ,  23 October 2022
getPotionTable: Move to Module:Skills/Artisan
(getSkillcapeTable: Move to Module:Shop)
(getPotionTable: Move to Module:Skills/Artisan)
Line 195: Line 195:
end
end
return p._getWeaponAttackType(item)
return p._getWeaponAttackType(item)
end
-- TODO Move this function to an appropriate Skills module
function p.getPotionTable(frame)
local potionName = frame.args ~= nil and frame.args[1] or frame
local tiers = {'I', 'II', 'III', 'IV'}
local resultPart = {}
table.insert(resultPart, '{| class="wikitable"')
table.insert(resultPart, '\r\n!Potion!!Tier!!Charges!!Effect')
local tier1potion = p.getItem(potionName..' I')
if tier1potion == nil then
return 'ERROR: No potion named "' .. potionName .. '" was found[[Category:Pages with script errors]]'
end
for i, tier in ipairs(tiers) do
local tierName = potionName..' '..tier
local potion = p.getItem(tierName)
if potion ~= nil then
table.insert(resultPart, '\r\n|-')
table.insert(resultPart, '\r\n|'..Icons.Icon({tierName, type='item', notext=true, size='60'}))
table.insert(resultPart, '||'..Icons.Icon({tierName, tier, type='item', noicon=true}))
table.insert(resultPart, '||'..potion.charges..'||'..(potion.customDescription or ''))
end
end
table.insert(resultPart, '\r\n|}')
return table.concat(resultPart)
end
end