Module:UnitsShipsConstruction

local p = {} function mysplit (i, sep) if sep == nil then sep = '%s' end local t={} for str in string.gmatch(i, '([^'..sep..']+)') do				table.insert(t, str) end return t end function p.table(frame) local unittbl = {{'Spearman',60,1},{'Slinger',90,2},{'Ram',600,3},{'Hoplite',300,4},{'Cook',1200,5},{'Swordsman',180,6},{'Archer',240,7},{'Catapult',1800,8},{'Doctor',1200,9},{'Gyrocopter',900,10},{'Balloon-Bombardier',1800,11},{'Steam Giant',900,12},{'Sulphur Carabineer',600,13},{'Mortar',2400,14}} local shiptbl = {{'Ram Ship',2400,1},{'Ballista Ship',3000,3},{'Catapult Ship',3000,3},{'Fire Ship',1800,4},{'Balloon Carrier',4000,7},{'Tender',2400,9},{'Rocket Ship',3600,11},{'Paddle Speedboat',1800,13},{'Steam Ram',2400,15},{'Mortar Ship',3000,17},{'Diving Boat',3600,19}} local tbl = {} local unitship = frame.args[1] or frame.args['name'] local levels = mysplit(frame:getParent:getTitle,'-') local tp = mysplit(levels[1],'/') local icon = '' local hd = '' if tp[2]=='Training' then tbl = unittbl icon = '' hd = 'This table lists the Barracks training times for each unit' elseif tp[2]=='Construction' then tbl = shiptbl icon = '' hd = 'This table lists the Shipyard construction times for each ship' end local from = tonumber(levels[2]) local to = tonumber(levels[3]) local lvlcells = ' '..frame:preprocess(icon)..' ' local durcells = '' for i=from,to,1 do		lvlcells = lvlcells..'=50 and 'title8' or '')..'">'..i..' ' end lvlcells = lvlcells..' ' for y=1,#tbl,1 do		durcells = durcells..' '..frame:preprocess(' '..tbl[y][1]..)..' ' for x=from,to,1 do			local cell = '' local cl = 0 if x>=tbl[y][3] then cl = math.ceil(tbl[y][2]*math.pow(0.95,x-tbl[y][3])) if math.floor(cl/(60*60))>0 then cell = string.format('%d:%.2d:%.2d',math.floor(cl/(60*60)),math.floor(cl/60%60),math.floor(cl%60)) else cell = string.format('%d:%.2d',math.floor(cl/60%60),math.floor(cl%60)) end else cell = frame:preprocess('') end durcells = durcells..'=50 and 'alt7' or '')..'">'..cell..' ' end durcells = durcells..' ' end return ' ' end return p