Anonymous

Module:Common: Difference between revisions

From Melvor Idle
getPurchaseIcon: Amend logic for certain item bundles introduced in V1.2.2
(getCostString: Initial implementation)
(getPurchaseIcon: Amend logic for certain item bundles introduced in V1.2.2)
Line 80: Line 80:
local purchaseName = p.getPurchaseName(purchase)
local purchaseName = p.getPurchaseName(purchase)
local purchType = p.getPurchaseType(purchase)
local purchType = p.getPurchaseType(purchase)
local iconType = nil
if purchType == 'Item Bundle' then
local upgBundles = {
'melvorAoD:Summoners_Pack_I',
'melvorAoD:Summoners_Pack_II',
'melvorAoD:Summoners_Pack_III',
'melvorAoD:Combat_Supply_I',
'melvorAoD:Combat_Supply_II',
'melvorAoD:Combat_Supply_III'
}
if Shared.contains(upgBundles, purchase.id) then
iconType = 'upgrade'
else
iconType = 'item'
end
else
iconType = string.lower(purchType)
end
-- Amend iconArgs before passing to Icons.Icon()
-- Amend iconArgs before passing to Icons.Icon()
iconArgs[1] = purchaseName
iconArgs[1] = purchaseName
iconArgs['type'] = (purchType == 'Item Bundle' and 'item') or string.lower(purchType)
iconArgs['type'] = iconType


return Icons.Icon(iconArgs)
return Icons.Icon(iconArgs)