Module:Constants: Difference between revisions

From Sekaipedia
Content added Content deleted
(created constants for use in modules across the wiki)
 
mNo edit summary
Line 52: Line 52:


function get_unit_image(unit_name)
function get_unit_image(unit_name)
if unit_name then
if unit_name and unit_name ~= '' then
local unit = unit_abbr_to_unit[unit_name]
local unit = unit_abbr_to_unit[string.lower(unit_name)]
if unit then
if unit then
return unit_images[unit]
return unit_images[unit]
Line 63: Line 63:


function get_unit_colors(unit_name)
function get_unit_colors(unit_name)
if unit_name then
if unit_name and unit_name ~= '' then
local unit = unit_abbr_to_unit[unit_name]
local unit = unit_abbr_to_unit[string.lower(unit_name)]
if unit then
if unit then
return unit_colors[unit]
return unit_colors[unit]

Revision as of 05:45, 4 July 2021

Documentation for this module may be created at Module:Constants/doc

local unit_abbr_to_unit = {
	-- VIRTUAL SINGER
	['virtual singer'] = 'VIRTUAL SINGER',
		['vs']         = 'VIRTUAL SINGER',
	
	-- Leo/need
	['leo/need'] = 'Leo/need',
		['ln']   = 'Leo/need',
		['l/n'] = 'Leo/need',
	
	-- MORE MORE JUMP!
	['more more jump!'] = 'MORE MORE JUMP!',
		['mmj']         = 'MORE MORE JUMP!',
		['mmj!']        = 'MORE MORE JUMP!',
	
	-- Vivid BAD SQUAD
	['vivid bad squad'] = 'Vivid BAD SQUAD',
		['vbs']         = 'Vivid BAD SQUAD',
	
	-- Wonderlands×Showtime
	['wonderlands×showtime']  = 'Wonderlands×Showtime',
		['wxs']               = 'Wonderlands×Showtime',
		
	-- 25-ji, Night Code de.
	['25-ji, night code de.'] = '25-ji, Night Code de.',
		['25ji']              = '25-ji, Night Code de.',
		['25-ji']             = '25-ji, Night Code de.',
		['niigo']             = '25-ji, Night Code de.',
		
	-- Other
	['other'] = 'Other'
}

local unit_images = {
	['VIRTUAL SINGER']        = 'Virtualsingerlogo.png',
	['Leo/need']              = 'Leoneedlogo.png',
	['MORE MORE JUMP!']       = 'MMJ logo.png',
	['Vivid BAD SQUAD']       = 'Vivid logo.png',
	['Wonderlands×Showtime']  = 'Wonderlandsxswowtimelogo.png',
	['25-ji, Night Code de.'] = '25ji-logo.png'
}

local unit_colors = {
	['VIRTUAL SINGER']        = { ['background-color'] = '#00CDBA', color = '#FFFFFF' },
	['Leo/need']              = { ['background-color'] = '#4455DD', color = '#FFFFFF' },
	['MORE MORE JUMP!']       = { ['background-color'] = '#6CCB20', color = '#FFFFFF' },
	['Vivid BAD SQUAD']       = { ['background-color'] = '#EE1166', color = '#FFFFFF' },
	['Wonderlands×Showtime']  = { ['background-color'] = '#FF9900', color = '#FFFFFF' },
	['25-ji, Night Code de.'] = { ['background-color'] = '#884499', color = '#FFFFFF' },
	['Other']                 = { ['background-color'] = '#3F939D', color = '#FFFFFF' }
}

function get_unit_image(unit_name)
	if unit_name and unit_name ~= '' then
		local unit = unit_abbr_to_unit[string.lower(unit_name)]
		if unit then
			return unit_images[unit]
		end
	end
	
	return nil
end

function get_unit_colors(unit_name)
	if unit_name and unit_name ~= '' then
		local unit = unit_abbr_to_unit[string.lower(unit_name)]
		if unit then
			return unit_colors[unit]
		end
	end
	
	return nil
end

local attribute_colors = {
	cute       = { bg = '#ff70a8', text = '#ffffff' },
	cool       = { bg = '#435cff', text = '#ffffff'},
	pure       = { bg = '#00bf51', text = '#ffffff'},
	happy      = { bg = '#ff9821', text = '#ffffff'},
	mysterious = { bg = '#8651bc', text = '#ffffff' }
}

local p = {
	get_unit_image   = get_unit_image,
	get_unit_colors  = get_unit_colors,
	attribute_colors = attribute_colors
}

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.