Module:BuildValidityChecker

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})) end

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,	})[1] if heroData == nil then return "" end 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 end end local list = ("('" .. table.concat(Hash.keys(skills), "','") .. "')") 	local validityTable = cargo.query(		"Skills",		"WikiName=name,CONCAT(CanUseMove__full)=m,CONCAT(CanUseWeapon__full)=w",		{			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))	end) return invalid and invalid.name or '' end

return (require "Module:Deprecated").module(p, "BuildValidityChecker")