Module:MoneyMakingGuide: Difference between revisions

Add support for SC name and SC icon as item
(Fix styling issues with lists)
(Add support for SC name and SC icon as item)
Line 19: Line 19:
aod = icons.AoD(),  
aod = icons.AoD(),  
ita = icons.ItA()
ita = icons.ItA()
}
local SpecialItems = {
['GP'] = 'Gold Pieces',
['SC'] = 'Slayer Coins',
}
local SpecialIcons = {
['Gold Pieces'] = icons.GP(),
['Slayer Coins'] = icons.SC(),
}
}


Line 33: Line 43:
local function formatItemName(name)
local function formatItemName(name)
-- Special case to correctly format GP name.
-- Special case to correctly format GP name.
if shared.compareString(name, 'Gold Pieces', true) or shared.compareString(name, 'GP', true) then
if SpecialItems[name] then
return 'Gold Pieces'
        return SpecialItems[name]
end
    end
 
-- Got to solve too many edge case swith this (like of and IV)
-- Got to solve too many edge case swith this (like of and IV)
-- Better just make the user use the correct name instead.
-- Better just make the user use the correct name instead.
Line 62: Line 72:


local function getItemIcon(iconName)
local function getItemIcon(iconName)
if iconName == 'Gold Pieces' then
if SpecialIcons[iconName] then
return icons.GP()
return SpecialIcons[iconName]
end
end
 
return icons.Icon({iconName, type='item', notext=true})
return icons.Icon({iconName, type='item', notext=true})
end
end
2,875

edits