4,951
edits
Falterfire (talk | contribs) (Fixed a minor typo that was preventing spell requirements from including equipped items) |
Falterfire (talk | contribs) (Added a getSpellItems function) |
||
Line 157: | Line 157: | ||
end | end | ||
return table.concat(runeList, ', ') | return table.concat(runeList, ', ') | ||
end | |||
function p._getSpellItems(spell) | |||
if type(spell.fixedItemCosts) == 'table' then | |||
local resultPart = {} | |||
for i, req in ipairs(spell.fixedItemCosts) do | |||
local item = Items.getItemByID(req.id) | |||
if item ~= nil then | |||
table.insert(resultPart, Icons.Icon({item.name, type='item', qty = req.quantity})) | |||
end | |||
end | |||
return table.concat(resultPart, '<br/>') | |||
else | |||
return '' | |||
end | |||
end | |||
function p.getSpellItems(frame) | |||
local spellName = frame.args ~= nil and frame.args[1] or frame | |||
local spell = p.getSpell(spellName) | |||
if spell == nil then | |||
return "ERROR: No spell named "..spellName.." exists in the data module" | |||
end | |||
return p._getSpellItems(spell) | |||
end | end | ||