17,105
edits
(Fix itemCharges reference) |
(Support itemCharges in various functions) |
||
Line 80: | Line 80: | ||
return purch.customName | return purch.customName | ||
elseif purch.contains ~= nil then | elseif purch.contains ~= nil then | ||
local item = nil | |||
if purch.contains.items ~= nil and not Shared.tableIsEmpty(purch.contains.items) then | if purch.contains.items ~= nil and not Shared.tableIsEmpty(purch.contains.items) then | ||
item = Items.getItemByID(purch.contains.items[1].id) | |||
elseif purch.contains.itemCharges ~= nil and not Shared.tableIsEmpty(purch.contains.itemCharges) then | elseif purch.contains.itemCharges ~= nil and not Shared.tableIsEmpty(purch.contains.itemCharges) then | ||
item = Items.getItemByID(purch.contains.itemCharges.id) | |||
end | |||
if item ~= nil then | |||
return item.name | |||
end | |||
if purch.contains.petID ~= nil then | |||
local pet = GameData.getEntityByID('pets', purch.contains.petID) | local pet = GameData.getEntityByID('pets', purch.contains.petID) | ||
if pet ~= nil then | if pet ~= nil then | ||
Line 103: | Line 102: | ||
if purch.customDescription ~= nil then | if purch.customDescription ~= nil then | ||
return string.gsub(purch.customDescription, '${qty}', '1') | return string.gsub(purch.customDescription, '${qty}', '1') | ||
elseif purch.contains ~= nil | elseif purch.contains ~= nil then | ||
local item = nil | |||
if purch.contains.items ~= nil and Shared.tableCount(purch.contains.items) == 1 then | |||
item = Items.getItemByID(purch.contains.items[1].id) | |||
elseif purch.contains.itemCharges ~= nil then | |||
item = Items.getItemByID(purch.contains.itemCharges.id) | |||
end | |||
if item ~= nil then | if item ~= nil then | ||
if item.customDescription ~= nil then | if item.customDescription ~= nil then | ||
Line 245: | Line 249: | ||
elseif purchase.contains.pet ~= nil then | elseif purchase.contains.pet ~= nil then | ||
return 'Pet' | return 'Pet' | ||
elseif purchase.contains.itemCharges ~= nil then | |||
return 'Item' | |||
elseif purchase.contains.modifiers ~= nil or purchase.contains.items == nil or Shared.tableCount(purchase.contains.items) == 0 then | elseif purchase.contains.modifiers ~= nil or purchase.contains.items == nil or Shared.tableCount(purchase.contains.items) == 0 then | ||
return 'Upgrade' | return 'Upgrade' |