Module:Inventory slot/Aliases: Difference between revisions
mNo edit summary |
No edit summary |
||
| Line 646: | Line 646: | ||
for _, type in ipairs(types) do | for _, type in ipairs(types) do | ||
-- form name, it will be reused | -- form name, it will be reused | ||
local name = {} | local name = type.text .. effect.name | ||
local potionName = {} | |||
if type.name == 'Tipped Arrow' then | |||
potionName = type.text .. effect.name .. '.gif' | |||
else | |||
potionName = type.text .. effect.name | |||
end | |||
-- if we have durations, add times | -- if we have durations, add times | ||
if effect.durations then | if effect.durations then | ||
| Line 659: | Line 660: | ||
-- turtle master is weird, so just do a fancy string replacement | -- turtle master is weird, so just do a fancy string replacement | ||
if effect.text then | if effect.text then | ||
aliases[name] = { name = | aliases[name] = { name = potionName, text = string.gsub( effect.text, '%$1', durations[1] ) } | ||
aliases[name .. ' Extended'] = { name = | aliases[name .. ' Extended'] = { name = potionName, text = string.gsub( effect.text, '%$1', durations[2] ) } | ||
aliases[name .. ' Enhanced'] = { name = | aliases[name .. ' Enhanced'] = { name = potionName, text = string.gsub( effect.enhanced, '%$1', durations[3] ) } | ||
else | else | ||
-- we always have normal | -- we always have normal | ||
aliases[name] = { name = | aliases[name] = { name = potionName, text = string.format( '%s (%s)', effect.effect, durations[1] ) } | ||
-- ensure we have extended | -- ensure we have extended | ||
if durations[2] then | if durations[2] then | ||
aliases[name .. ' Extended'] = { name = | aliases[name .. ' Extended'] = { name = potionName, text = string.format( '%s (%s)', effect.effect, durations[2] ) } | ||
-- and enhanced, currently there is nothing with a duration that can be extended but not enhanced | -- and enhanced, currently there is nothing with a duration that can be extended but not enhanced | ||
if effect.enhanced then | if effect.enhanced then | ||
aliases[name .. ' Enhanced'] = { name = | aliases[name .. ' Enhanced'] = { name = potionName, text = string.format( '%s %s (%s)', effect.effect, effect.enhanced, durations[3] ) } | ||
end | end | ||
end | end | ||
| Line 678: | Line 679: | ||
else | else | ||
-- otherwise its just effect, currently every potion with no duration can be enhanced | -- otherwise its just effect, currently every potion with no duration can be enhanced | ||
aliases[name] = { name = | aliases[name] = { name = potionName, text = effect.effect} | ||
aliases[name .. ' Enhanced'] = { name = | aliases[name .. ' Enhanced'] = { name = potionName, text = effect.effect .. ' ' .. effect.enhanced } | ||
end | end | ||