ElEditors, Interface administrators, Administrators
70,981
edits
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
local getArgs = require('Module:Arguments').getArgs | local getArgs = require('Module:Arguments').getArgs | ||
local p = {} | local p = {} | ||
local get_char_list = require('Module:CharList').main | |||
-- Main process | -- Main process | ||
function p.main(frame) | function p.main(frame) | ||
local char_outer = mw.html.create('div'):addClass('character-banner-outer') | |||
local char_banner = mw.html.create('div'):addClass('character-banner-wrap border-color tone-2') | |||
local char_list = get_char_list(frame) | |||
local char_order = char_list[1] | |||
local not_exist = char_list[3] | |||
local char_list = char_list[2] | |||
local args = getArgs(frame); | local args = getArgs(frame); | ||
local char_tree = mw.html.create('div'):addClass('char-banner-tree'):attr('data-base', args[1]) | local char_tree = mw.html.create('div'):addClass('char-banner-tree'):attr('data-base', args[1]) | ||
local out = | local out = '' | ||
local char, file_name, link, nopath, nopathnojob, entry, image_arg, icon_str; | local char, file_name, link, nopath, nopathnojob, entry, image_arg, icon_str; | ||
for | for char_iter=1, #char_order, 1 do | ||
local base, jobs = char_order[char_iter], {{}, {}, {}} | |||
local tree = mw.html.create('div'):addClass('char-banner-tree'):attr('data-base', base:gsub('/', '')) | |||
for path_iter=1, 4, 1 do | |||
local path = char_list[base][path_iter] | |||
for job_iter=1, 3, 1 do | |||
local job = path[job_iter] | |||
local out_table = jobs[job_iter] | |||
if job == nil and jobs[1][path_iter] ~= nil then | |||
job = jobs[1][path_iter] | |||
end | |||
if job ~= nil then | |||
table.insert(out_table, job) | |||
end | |||
end | end | ||
end | |||
for job_iter, job_name in ipairs(jobs) do | |||
for path_iter, path_name in ipairs(job_name) do | |||
local file_name = path_name:gsub(':', ''); | |||
local icon_str = 'Icon - ' | |||
local link = '|link=' .. path_name | |||
local unreleased = indexOf(path_name, not_exist) | |||
if unreleased then | |||
icon_str = '' | |||
file_name = 'Dunno' | |||
link = '|link=#!' | |||
end | |||
file_name = '[[File:' .. icon_str .. file_name .. '.png' .. link .. ']]' | |||
local img = tree:tag('div'):addClass('char-banner-tree-image'):attr('data-class-name', path_name):wikitext(file_name) | |||
if unreleased then | |||
img:attr('data-unreleased', 'true') | |||
end | |||
end | end | ||
end | |||
char_banner:node(tree) | |||
out = not_exist | |||
end | |||
local styles = frame:preprocess('{{#css:MediaWiki:Character-Banner.css}}') | |||
local header = frame:expandTemplate{ | |||
title = 'CharHeader', | |||
args = { | |||
'Elsword', | |||
'Elsword', | |||
'tone-8' | |||
} | |||
} | |||
local select_banner = mw.html.create('p'):addClass('character-banner-select tone-8 border-color') | |||
for k, v in ipairs(char_order) do | |||
if v == 'Lu/Ciel' then v = 'LuCiel (Lu)' end | |||
select_banner:wikitext('[[File: Icon - ' .. v .. '.png]]') | |||
end | |||
char_outer:wikitext(header):node(char_banner:node(select_banner)) | |||
return styles .. tostring(char_outer) | |||
-- return dump(out) | |||
-- for job_iter=1,3,1 do | |||
-- for path_iter=1,4,1 do | |||
-- char = args[path_iter .. 'x' .. job_iter] or 'Unreleased'; | |||
-- nopath = 'no' .. path_iter .. 'path'; | |||
-- if (args[nopath] ~= nil and args[nopath] ~= 'true') then | |||
-- char = args[nopath] | |||
-- end | |||
-- nopathnojob = 'no' .. path_iter .. 'x' .. job_iter; | |||
-- entry = char_tree:tag('div'):addClass('char-banner-tree-image') | |||
-- icon_str = 'Icon - ' | |||
-- if char ~= 'Unreleased' then | |||
-- file_name = char:gsub(':', ''); | |||
-- link = '|link=' .. char | |||
-- end | |||
-- if (args[nopath] ~= nil or args[nopathnojob] ~= nil) then | |||
-- file_name = 'Dunno'; | |||
-- link = '|link=' .. char; | |||
-- icon_str = '' | |||
-- end | |||
-- image_arg = args['image' .. path_iter .. 'x' .. job_iter] | |||
-- if image_arg ~= nil then | |||
-- file_name = image_arg | |||
-- end | |||
-- entry:attr('data-class-name', char):wikitext('[[File:' .. icon_str .. file_name .. '.png' .. link .. ']]'); | |||
-- if (args[nopath] ~= nil or args.releasing == tostring(path_iter)) then | |||
-- entry:attr('data-unreleased', 'true'); | |||
-- end | |||
-- if (args[nopathnojob] ~= nil) then | |||
-- entry:addClass('disable-image-link'); | |||
-- entry:attr('data-unreleased', 'true'); | |||
-- end | |||
-- end | |||
end | -- end | ||
return tostring(char_tree); | -- return tostring(char_tree); | ||
end | end | ||
return p | return p |