From Fire Emblem Heroes Wiki
Jump to: navigation, search
Template-info.svg Documentation
This module has been deprecated. Reason: "Module:SkillBuildInfobox performs this directly in the main function since it relies on not having to re-query the database for skill definitions."

This module is no longer supported, and exists solely to maintain integrity of previous page revisions that used this module. New content should not use this module anymore, as it might be moved, deleted, or broken without prior notice.

Checks for validity of a build.


Returns something if invalid, nothing if valid.

local cargo = mw.ext.cargo
local List = require 'Module:ListUtil'
local Hash = require 'Module:HashUtil'
local getArgs = require('Module:Arguments').getArgs
local split = mw.text.split
local p = {}

function p.main(frame)
	return p._main(getArgs(frame, {removeBlanks = false}))

function p._main(args)
	local hero = escq(args[1] or mw.title.getCurrentTitle().subpageText)
	local heroData = cargo.query("Heroes", "MoveType,WeaponType", {
		where = ("_pageName = '%s'"):format(hero),
		limit = 1,
	if heroData == nil then
		return ""
	local heroMoveType = heroData.MoveType
	local heroWeaponType = heroData.WeaponType

	local skills = {}
	for k, v in ipairs(args) do
		if v ~= "" and v ~= "Flexible" and k ~= 1 then
			skills[escq(v)] = true
	local list = ("('" .. table.concat(Hash.keys(skills), "','") .. "')") 
	local validityTable = cargo.query(
			where = ("CanUseMove__full IS NOT NULL AND CanUseWeapon__full IS NOT NULL AND RefinePath IS NULL AND (_pageName IN %s OR WikiName IN %s OR GroupName IN %s)"):format(list, list, list),
			groupBy = "CanUseMove__full,CanUseWeapon__full",
	local _, invalid = List.find_if(validityTable, function (row)
		return not (List.find((split(row.m, "%s*,%s*")), heroMoveType) and List.find((split(row.w, "%s*,%s*")), heroWeaponType))
	return invalid and or ''

return p