Module:Items: Difference between revisions

Add getCurrencyItemBoxText to get the sell value and currency icon of an item
No edit summary
(Add getCurrencyItemBoxText to get the sell value and currency icon of an item)
Line 536: Line 536:


return p._getOtherItemBoxText(item)
return p._getOtherItemBoxText(item)
end
function p._getCurrencyItemBoxText(item)
local span = mw.html.create('span')
:wikitext("'''Sells For:''' ")
:wikitext(Icons._Currency((item.sellsforCurrency or 'melvorD:GP'), item.sellsFor))
return span
end
function p.getCurrencyItemBoxText(frame)
local itemName = frame.args ~= nil and frame.args[1] or frame
local item = p.getItem(itemName)
if item == nil then
return Shared.printError('No item named "' .. itemName .. '" exists in the data module')
end
return p._getCurrencyItemBoxText(item)
end
end