Module:NameAbout

From Fire Emblem Heroes Wiki
Jump to: navigation, search

This module is intended to serve as a disambiguation of sorts for Heroes (hence its historical "about" part in its name, after Template:About). The purpose of this module is to clear up any confusion and direct people to the Hero they may be looking for, it is not to make a statement about whether certain Heroes belong in a group or not. Even loosely related Heroes may be included as a result.

Usage[edit source]

{{#invoke:NameAbout|main|Name=|Name2=|Name3=}}

Infinitely many NameX parameters can be specified. Do not use Name1.

The module will return Heroes with Name or Person values matching the parameters passed. It excludes Heroes that matches the page name when used on a Hero page.

Examples[edit source]

{{#invoke:NameAbout|main|Name=Robin}}
You may be looking for:
Robin: High Deliverer
Robin: High Deliverer
Robin: Mystery Tactician
Robin: Mystery Tactician
Robin: Seaside Tactician
Robin: Seaside Tactician
Robin: Festive Tactician
Robin: Festive Tactician
Robin: Fell Reincarnation
Robin: Fell Reincarnation
Robin: Fell Vessel
Robin: Fell Vessel
{{#invoke:NameAbout|main|Name=Black Knight|Name2=Zelgius}}
You may be looking for:
Black Knight: Sinister General
Black Knight: Sinister General
Zelgius: Jet-Black General
Zelgius: Jet-Black General
{{#invoke:NameAbout|main|Name=Lucina}}
You may be looking for:
Lucina: Future Witness
Lucina: Future Witness
Lucina: Spring Exalt
Lucina: Spring Exalt
Lucina: Brave Princess
Lucina: Brave Princess
Lucina: Glorious Archer
Lucina: Glorious Archer
Marth: Enigmatic Blade
Marth: Enigmatic Blade

local cargo = mw.ext.cargo
local Util = require 'Module:Util'
local Superimpose = require ('Module:Superimpose').main
local p = {}

function p.main(frame)
	local i = 2
	local list = "('"..Util.escq(frame.args["Name"]).."'"
	while frame.args["Name" .. i] ~= nil do
		list = list .. ",'"..Util.escq(frame.args["Name" .. i]).."'"
		i = i + 1
	end
	local list = list .. ")"
	
	local listQuery = cargo.query(
		"Heroes",
		"_pageName,MoveType,WeaponType,CONCAT(Name,': ',Title)=Hero",
		{
			where = "(Name IN "..list.." OR Person IN "..list..") AND _pageName != '"..Util.escq(mw.title.getCurrentTitle().text).."'",
			orderBy="Name,IFNULL(IntID,9999)",
			limit=9000
		}
	)
	
	local tbl = mw.html.create("table")
		:addClass("wikitable")
		:addClass("default")
		:addClass("character-about")
	
	tbl:tag("tr"):tag("th"):css("padding",".1em .5em"):wikitext("You may be looking for:")
	local total = ""
	for _,v in ipairs(listQuery) do
		total = total .. frame:expandTemplate{ title = "Tooltip", args = {  '<div style="margin:0 4px">' .. Superimpose({args= {
			["c1"]="[[File:"..Util.mf(v["_pageName"]).."_Face_FC.png|60x60px|"..v["Hero"].."|alt="..v["Hero"].."|link="..v["_pageName"].."]]",
			["c2"]="[[File:Icon_Move_"..v["MoveType"]..".png|14x14px|alt=|link=]]",
			["x2"]="44",
			["y2"]="40",
			["c3"]="[[File:Icon_Class_"..v["WeaponType"]..".png|18x18px|alt=|link=]]",
			["x3"]="0",
			["y3"]="0"
		}}) .. "</div>" , v["Hero"] } }
	end
	
	
	tbl:tag("tr"):tag("td"):css("padding","0"):wikitext(total)
	if listQuery[1] then
		return '<div style="margin:-5px 0 1.5em 0">' .. tostring(tbl) .. "</div>"
	else
		return ""
	end
end
return p