Module:StatsAndGrowthsTable

local cargo = mw.ext.cargo local HeroUtil = require 'Module:HeroUtil' local HeroTableBuilder = require 'Module:HeroTableBuilder'

local main = function local heroQueryResult = cargo.query(		"Units=h,UnitStats=s",		h._pageName=_pageName,IFNULL(CONCAT(Name,': ',Title),Name)=Hero,Entries,WeaponType,MoveType,		 CONCAT(HPGR3+AtkGR3+SpdGR3+DefGR3+ResGR3,'%')=TotalGrowths,HPGR3=HP,AtkGR3=Atk,SpdGR3=Spd,DefGR3=Def,ResGR3=Res,		  CONCAT(Lv1HP5+Lv1Atk5+Lv1Spd5+Lv1Def5+Lv1Res5)=TotalLv1Stats, {			join = "h.WikiName=s.WikiName",			groupBy = "h._pageName",			where = "s._pageName IS NOT NULL AND IFNULL(Properties__full,'') NOT LIKE '%enemy%'",			limit = 1000,		}	)

local theUnit = nil local builder = HeroTableBuilder.new local releaseTimes = HeroUtil.getReleaseTimes {}

builder:heroIcon('40px'):css('width', '3%') builder:heroLink:css('width', '15%'):css('min-width', '75px') builder:heroEntry:css('width', '8%'):css('min-width', '90px') builder:moveType:css('width', '5%'):css('min-width', '60px') builder:weaponType:css('width', '5%'):css('min-width', '60px') builder:column('Level 1 total', function (elem) elem:wikitext(theUnit.TotalLv1Stats) end):css('width', '5%') builder:column('Total growths', function (elem) elem:wikitext(theUnit.TotalGrowths) end):css('width', '4%') builder:column('', function (elem) elem:wikitext(theUnit.TotalLv1Stats):wikitext(', ', theUnit.TotalGrowths) end):css('width', '9%') builder:column('HP', function (elem) elem:wikitext(theUnit.HP ~= '' and tonumber(theUnit.HP) or '??', '%') end):css('width', '4%') builder:column('Atk', function (elem) elem:wikitext(theUnit.Atk ~= '' and tonumber(theUnit.Atk) or '??', '%') end):css('width', '4%') builder:column('Spd', function (elem) elem:wikitext(theUnit.Spd ~= '' and tonumber(theUnit.Spd) or '??', '%') end):css('width', '4%') builder:column('Def', function (elem) elem:wikitext(theUnit.Def ~= '' and tonumber(theUnit.Def) or '??', '%') end):css('width', '4%') builder:column('Res', function (elem) elem:wikitext(theUnit.Res ~= '' and tonumber(theUnit.Res) or '??', '%') end):css('width', '4%') builder:column('Release date', function (elem)		local heroReleaseTime = releaseTimes[theUnit._pageName] and releaseTimes[theUnit._pageName]:earliest or 0x7FFFFFFF		elem:wikitext(heroReleaseTime < 0x7FFFFFFF and os.date('%Y-%m-%d', heroReleaseTime) or 'N/A')	end):css('width', '12%'):css('min-width', '88px')

for _, v in ipairs(heroQueryResult) do		theUnit = v		builder:addHero(v._pageName, v.Hero, v.MoveType, v.WeaponType, v.Entries) end

return builder:build:addClass('wikitable'):addClass('default'):css('text-align', 'center'):css('max-width', '100%') end

return require 'Module:MakeMWModule'.makeMWModule {main = main}