17,030
edits
(Update for v1.3) |
(Split purchase icon type derivation into own function, for referencing by other modules) |
||
Line 139: | Line 139: | ||
end | end | ||
-- | -- getPurchaseIconType: Given a purchase from shop dtaa, returns the icon type to be used within | ||
-- Icons.Icon() to retrieve the purchase's icon | |||
function p. | function p.getPurchaseIconType(purchase) | ||
local purchType = p.getPurchaseType(purchase) | local purchType = p.getPurchaseType(purchase) | ||
if purchType == 'Item Bundle' then | if purchType == 'Item Bundle' then | ||
local upgBundles = { | local upgBundles = { | ||
Line 156: | Line 153: | ||
} | } | ||
if Shared.contains(upgBundles, purchase.id) then | if Shared.contains(upgBundles, purchase.id) then | ||
return 'upgrade' | |||
else | else | ||
return 'item' | |||
end | end | ||
else | else | ||
return string.lower(purchType) | |||
end | end | ||
end | |||
-- getPurchaseIcon: Accepts the same arguments as Icons.Icon(), except the first parameter is a | |||
-- shop purchase rather than the icon/linked page name | |||
function p.getPurchaseIcon(iconArgs) | |||
local purchase = iconArgs[1] | |||
local purchaseName = p.getPurchaseName(purchase) | |||
local iconType = p.getPurchaseIconType(purchase) | |||
-- Amend iconArgs before passing to Icons.Icon() | -- Amend iconArgs before passing to Icons.Icon() | ||
iconArgs[1] = purchaseName | iconArgs[1] = purchaseName |