8,461
edits
No edit summary |
(Reinstate support for custom Parallel items) |
||
| (30 intermediate revisions by 2 users not shown) | |||
| Line 51: | Line 51: | ||
link = mw.ustring.gsub( link, "[Pp]arallel:", "" ) | link = mw.ustring.gsub( link, "[Pp]arallel:", "" ) | ||
else | else | ||
link = link .. ' (Vanilla)' | if mw.title.new(link).exists == false then | ||
linkPrefix = 'mcwiki:' | |||
end | |||
-- link = link .. ' (Vanilla)' | |||
end | end | ||
link = linkPrefix .. link | link = linkPrefix .. link | ||
end | end | ||
local scale = args.scale or default.scale | local scale = args.scale or default.scale | ||
| Line 69: | Line 72: | ||
end | end | ||
local name = args.name | local name = args.name or '' | ||
if name == 'InvSprite' then | if name == 'InvSprite' then | ||
name = 'Invicon' | name = 'Invicon' | ||
end | end | ||
-- local file = name .. ' ' .. id .. | local extension = name == 'Dungeons2AchievementSprite' and '.jpg' or name == '' and '' or '.png' | ||
local file = idPrefix .. name .. ' ' .. id .. | -- local file = name .. ' ' .. id .. extension | ||
local altText = | local file = idPrefix .. name .. ' ' .. id .. extension | ||
if link | local altText = '' | ||
altText = | if link == '' then | ||
altText = file .. ': Sprite image for ' .. id .. ' in Minecraft' | |||
end | end | ||
if id == '' then | if id == '' then | ||
| Line 109: | Line 113: | ||
if link:find( '//' ) then | if link:find( '//' ) then | ||
spriteText = '[' .. link .. ' ' .. tostring( spriteText ) .. ']' | spriteText = '[' .. link .. ' ' .. tostring( spriteText ) .. ']' | ||
-- else | |||
-- spriteText = '[[' .. link .. '|' .. tostring( spriteText ) .. ']]' | |||
-- end | |||
else | else | ||
if string.find(link, "(Vanilla)") then | -- if string.find(link, " (Vanilla)") then -- <-- this inner if/else statement is added | ||
spriteText = '[[' .. link .. '|' .. tostring( spriteText ):gsub("(Vanilla)", "") .. ']]' | -- spriteText = '[[' .. link .. '|' .. tostring( spriteText ):gsub(" (Vanilla)", "") .. ']]' | ||
if string.find(tostring(spriteText), "[Pp]arallel:") then | |||
text = tostring(spriteText):gsub(":%l", string.upper) | |||
text = text:gsub("[Pp]arallel:", "") | |||
spriteText = '[[' .. link .. '|' .. text .. ']]' | |||
else | else | ||
spriteText = '[[' .. link .. '|' .. tostring( spriteText ) .. ']]' | spriteText = '[[' .. link .. '|' .. tostring( spriteText ) .. ']]' | ||