Module:AreaOfEffect

local p = {} local Util = require 'Module:Util'

p._areaTable = function (args) local tbl = mw.html.create('table'):addClass('wikitable'):css('text-align', 'center')

for _, row in ipairs(args) do   local tr = tbl:tag('tr') mw.ustring.gsub(row, '.', function (ch)     local td = tr:tag('td'):css('width', '46px'):css('height', '52px')      local cell = nil      if ch == 't' or ch == 'u' then        if args[ch] then          cell = td:tag('div'):css('position', 'relative'):wikitext(Util.getHeroIcon(args[ch], '34px')):css('opacity', '1')        else          cell = td:tag('div'):css('position', 'relative'):wikitext()        end      elseif ch == 's' then        if args[ch] then          cell = td:tag('div'):css('position', 'relative'):wikitext(():format(args[ch]))        end      end      if ch ~= '-' and ch ~= 'u' and ch ~= 's' then        -- affected cells        if args.special then          if cell then            cell:tag('div'):wikitext():css('opacity', '.6'):css('z-index', '3')              :css('position', 'absolute'):css('top', '0px'):css('left', '6px')          else            td:wikitext():css('opacity', '.6') end else td:css('background','#FFD2D2') end end end) end

return tostring(tbl) end

p.areaTable = function (frame) local getArgs = require 'Module:Arguments'.getArgs return p._areaTable(getArgs(frame, {wrappers = 'Template:Area Of Effect'})) end

return p