Module:Items: Difference between revisions

m
Improve getItemValue function
(Add function to grab item value (sellsfor) based on item name or item object)
m (Improve getItemValue function)
Line 115: Line 115:


function p.getItemValue(item)
function p.getItemValue(item)
function isGP(itemName)
return itemName == 'GP' or itemName == 'Gold Pieces'
end
if type(item) == 'string' then
if type(item) == 'string' then
if isGP(item:upper()) then  
-- Specific check if the item is GP (value of 1)
return 1  
if Shared.compareString('GP', item, true)
or Shared.compareString('Gold Pieces', item, true) then
return 1
end
end
 
item = p.getItem(item)
item = p.getItem(item)
end
end
914

edits