Bureaucrats, Check users, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, Widget editors
1,651
edits
(Add single item slot) |
mNo edit summary |
||
(76 intermediate revisions by 3 users not shown) | |||
Line 12: | Line 12: | ||
end | end | ||
return Grid(args, 3, 3) | return Grid(args, args['width'] or args['Width'] or 3, args['height'] or args['Height'] or 3) | ||
end | end | ||
Line 81: | Line 81: | ||
else | else | ||
sprite:SetSize(args['size'] or args['Size'] or 32) | sprite:SetSize(args['size'] or args['Size'] or 32) | ||
end | |||
local name = args['name'] or args['Name'] or args['title'] or args['Title'] | |||
if name and #name ~= 0 then | |||
sprite:SetTitle(name) | |||
end | |||
local lore = args['lore'] or args['Lore'] or args['text'] or args['Text'] | |||
if lore and #lore ~= 0 then | |||
sprite:SetLore(lore) | |||
end | |||
local hideTooltip = args['hideToolTip'] or args['hideTooltip'] or args['HideToolTip'] or args['HideTooltip'] | |||
if hideTooltip then | |||
sprite:HideTooltip() | |||
end | end | ||
local inline = args['inline'] or args['Inline'] | local inline = args['inline'] or args['Inline'] | ||
local spriteDiv | local spriteDiv | ||
if inline then | local parentDiv = mw.html.create("span"):css("position","relative") | ||
if inline ~= 'false' then | |||
spriteDiv = sprite:GenerateHTML("span") | spriteDiv = sprite:GenerateHTML("span") | ||
spriteDiv:css("display","inline-block") | spriteDiv:css("display","inline-block") | ||
Line 93: | Line 110: | ||
end | end | ||
local count = tonumber(args['count']) or tonumber(args['Count']) or string.match(tostring(args['count']),'%?') or string.match(tostring(args['Count']),'%?') or 1 | |||
if count ~= 1 then | |||
local countSpan = parentDiv:tag("span"):wikitext(count) | |||
countSpan:addClass("invslot-stacksize") | |||
end | |||
local | local enchanted = args['enchanted'] or args['Enchanted'] | ||
if | if enchanted == 'true' then | ||
spriteDiv:addClass("enchanted") | |||
end | |||
local link = args['link'] or args['Link'] | |||
if link and #link ~= 0 then | |||
if link:sub( 1,2 ) == '[[' then | |||
parentDiv:wikitext(link:sub( 1,#link-2 ) .. '|') | |||
elseif link:sub ( 1,1 ) == '[' then | |||
parentDiv:wikitext(link:sub( 1,#link-1 ) .. '|') | |||
end | |||
end | |||
parentDiv:node(spriteDiv) | |||
if link and #link ~= 0 then | |||
if link:sub( 1,2 ) == '[[' then | |||
parentDiv:wikitext(']]') | |||
elseif link:sub ( 1,1 ) == '[' then | |||
parentDiv:wikitext(']') | |||
end | |||
end | end | ||
return | return parentDiv | ||
end | end | ||
-- Make a single item | -- Make a single item | ||
Line 139: | Line 177: | ||
else | else | ||
sprite:SetSize(args['size'] or args['Size'] or 32) | sprite:SetSize(args['size'] or args['Size'] or 32) | ||
end | |||
local name = args['name'] or args['Name'] or args['title'] or args['Title'] | |||
if name and #name ~= 0 then | |||
sprite:SetTitle(name) | |||
end | |||
local lore = args['lore'] or args['Lore'] or args['text'] or args['Text'] | |||
if lore and #lore ~= 0 then | |||
sprite:SetLore(lore) | |||
end | |||
local hideTooltip = args['hideToolTip'] or args['hideTooltip'] or args['HideToolTip'] or args['HideTooltip'] | |||
if hideTooltip then | |||
sprite:HideTooltip() | |||
end | end | ||
Line 146: | Line 200: | ||
spriteDiv:css("display","inline-block") | spriteDiv:css("display","inline-block") | ||
spriteDiv:css("vertical-align","middle") | spriteDiv:css("vertical-align","middle") | ||
spriteDiv:css("border-width"," | spriteDiv:css("border-width","3px") | ||
spriteDiv:css("border-style","solid") | spriteDiv:css("border-style","solid") | ||
spriteDiv:css("background-color","#67AFD0") | spriteDiv:css("box-sizing","border-box") | ||
if args['standard'] or args['Standard'] then | |||
spriteDiv:css("background-color","#8B8B8B") | |||
spriteDiv:css("border-color","#373737 #FFFFFF #FFFFFF #373737") | |||
else | |||
spriteDiv:css("background-color","#67AFD0") | |||
spriteDiv:css("border-color","#1A536E #C0DEEB #C0DEEB #1A536E") | |||
end | |||
local count = tonumber(args['count']) or tonumber(args['Count']) or 1 or "?" | |||
if count ~= 1 then | |||
local countSpan = spriteDiv:tag("span"):wikitext(count) | |||
countSpan:addClass("invslot-stacksize") | |||
end | |||
return spriteDiv | return spriteDiv |
edits