Module:SkillTable: Difference between revisions
From Elwiki
No edit summary |
No edit summary |
||
Line 46: | Line 46: | ||
local mod_subpage = '' | local mod_subpage = '' | ||
local cube = '' | local cube = '' | ||
local is_art = false | |||
-- Locked skills | -- Locked skills | ||
Line 55: | Line 56: | ||
args = {lock_arg} | args = {lock_arg} | ||
} | } | ||
end | end | ||
Line 72: | Line 67: | ||
args = {cube_arg} | args = {cube_arg} | ||
} | } | ||
end | |||
-- Secret Art | |||
if (string.find(image, '\\') or string.find(name, '\\')) then | |||
is_art = true; | |||
end | end | ||
Line 89: | Line 89: | ||
-- Spawn regular cells | -- Spawn regular cells | ||
if not (is_header) then | if not (is_header) then | ||
local image_cell = row:tag('div'):attr('data-type', 'table-cell'):attr('style', ' | local full_name = name; | ||
if ( | image = split(image, '\\'); | ||
image_cell: | name = split(name:gsub('%s?#%s?.*', ''), '\\'); | ||
local index = 1; | |||
local image_cell = row:tag('div'):attr('data-type', 'table-cell'); | |||
if (args.skill_columns ~= nil) then | |||
image_cell:attr('style', 'grid-template-columns: repeat(' .. args.skill_columns .. ', auto)'); | |||
end | |||
if (#image > 1 and #name > 1) then | |||
image_cell:addClass('skill-columns'); | |||
local name_match = full_name:match('%s?#%s?(.*)'); | |||
if (name_match ~= nil) then | |||
full_name = name_match; | |||
else | |||
full_name = name[1] | |||
end | |||
end | end | ||
local name_cell = row:tag('div'):attr('data-type', 'table-cell | |||
while index <= #image do | |||
image[index] = trim(image[index]); | |||
name[index] = trim(name[index]); | |||
-- Mod skills | |||
if (string.find(name[index], '/Mod')) then | |||
name[index] = name[index]:gsub('%/Mod', ''); | |||
mod_subpage = '/ModA'; | |||
else | |||
mod_subpage = '' | |||
end | |||
if (mod_subpage == '') then | |||
image_cell:wikitext('[[File:' .. image[index] .. '|link=' .. name[index] .. ']]') | |||
else | |||
image_cell:wikitext(frame:expandTemplate{ | |||
title = 'Force', | |||
args = {image[index], link = name[index]} | |||
}); | |||
end | |||
index = index + 1 | |||
end | |||
full_name = full_name:gsub('/Mod', ''); | |||
local name_cell = row:tag('div'):attr('data-type', 'table-cell'); | |||
local skill_wrap = name_cell:tag('div'):addClass('skill-wrap'); | local skill_wrap = name_cell:tag('div'):addClass('skill-wrap'); | ||
skill_wrap:wikitext('[[' .. | skill_wrap:wikitext('[[' .. full_name .. mod_subpage .. '|.]]'); | ||
local display_name = | local display_name = full_name:gsub("%s%([%w%s%/]+%)", ""); | ||
if not (mod_subpage == '') then | if not (mod_subpage == '') then | ||
display_name = '[Mod] ' .. display_name; | display_name = '[Mod] ' .. display_name; | ||
end | end | ||
skill_wrap:tag('div'):addClass('skill-wrap-text'):wikitext('[[' .. | skill_wrap:tag('div'):addClass('skill-wrap-text'):wikitext('[[' .. full_name .. mod_subpage .. '|' .. display_name .. ']] ' .. lock .. cube ); | ||
-- If a header is detected, it will not interrupt chunking. | -- If a header is detected, it will not interrupt chunking. |