Module:Items: Difference between revisions

Add function to grab item value (sellsfor) based on item name or item object
(hasCombatStats: More robust Summoning familiar check)
(Add function to grab item value (sellsfor) based on item name or item object)
Line 112: Line 112:
if result == nil and ZeroIfNil then result = 0 end
if result == nil and ZeroIfNil then result = 0 end
return result
return result
end
function p.getItemValue(item)
function isGP(itemName)
return itemName == 'GP' or itemName == 'Gold Pieces'
end
if type(item) == 'string' then
if isGP(item:upper()) then
return 1
end
item = p.getItem(item)
end
if item then
return item.sellsFor
end
return nil
end
end


2,875

edits