Module:EvolvingWeaponTable

local cargo = mw.ext.cargo local List = require 'Module:ListUtil'

local main = function (args) local weapons = cargo.query(		'WeaponEvolutions,Skills=b,Skills=a,Skills__CanUseWeapon,WeaponTypes',		b._pageName=bpage,b.Name=bname,a._pageName=apage,a.Name=aname,b.Might=bmt,a.Might=amt,b.Description=bdesc,a.Description=adesc,		 b.UseRange=rng,WeaponTypes.Type=wtype,CostMedals=medals,CostStones=stones,CostDew=dews,a.SP=spcost, {			join = 'WeaponEvolutions.BaseWeapon=b.WikiName,WeaponEvolutions.EvolvesInto=a.WikiName,b._ID=Skills__CanUseWeapon._rowID,Skills__CanUseWeapon._value=WeaponTypes.WikiName',			groupBy = 'BaseWeapon,EvolvesInto',			orderBy = 'bname,aname',			limit = 100,		})

local tbl = mw.html.create('table'):addClass('wikitable'):addClass('unsortable') :css('text-align', 'center'):css('width', '1200px') local row = tbl:tag('tr') row:tag('th'):css('width', '10%'):wikitext('Type') row:tag('th'):css('width', '15%'):wikitext('Weapon names') row:tag('th'):css('width', '4%'):css('min-width', '65px'):wikitext('Might') row:tag('th'):css('width', '3%'):wikitext('Range') row:tag('th'):css('width', '33%'):wikitext('Original effect') row:tag('th'):css('width', '33%'):wikitext('Evolved effect') row:tag('th'):css('width', '5%'):css('min-width', '65px'):wikitext('Cost')

for _, v in ipairs(weapons) do		row = tbl:tag('tr') row:tag('td'):wikitext((' %s'):format(v.wtype, v.wtype)) row:tag('td'):wikitext(('%s ↓ %s'):format(v.bpage, v.bname, v.apage, v.aname)) row:tag('td'):wikitext(('%s → %s'):format(v.bmt, v.amt)) row:tag('td'):wikitext(v.rng) row:tag('td'):wikitext(v.bdesc) row:tag('td'):wikitext(v.adesc) local costs = List.select({			{tonumber(v.spcost) or 0, 'SP'},			{tonumber(v.medals) or 0, },			{tonumber(v.stones) or 0, },			{tonumber(v.dews) or 0, ''},		}, function (v) return v[1] ~= 0 end) row:tag('td'):wikitext(table.concat(List.map_self(costs, function (c)			return ('%d %s'):format(c[1], c[2])		end), ' ')) end

return tostring(tbl) end

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