Module:MainPageSections

local p = {} local h = {} local utilsClasses = require("Module:UtilsClasses") local utilsString = require("Module:UtilsString")

function p._Classes(frame) local result = mw.html.create("div") :attr("id", "main-page-classes")

result:node(h.GenerateClassesRolesContainer) result:node(h.GenerateClassesContainer) return result end

function h.GenerateClassesRolesContainer local classRoles = {"Specialty", "Preventing movement", "Tank", "Heals", "Damage", "Positioning", "Minion", "Control", "Support"} local rolesContainer = mw.html.create("div") :addClass("main-page-classes-roles-container") for key, classRole in ipairs(classRoles) do		rolesContainer:node(mw.html.create("div")			:addClass("main-page-classes-roles-item")			:attr("data-role", string.gsub(classRole, " ", "-"))			:wikitext(mw.getCurrentFrame:expandTemplate{title = "Tooltip", args = {"", classRole}})) end return rolesContainer end function h.GenerateClassesContainer local classesContainer = mw.html.create("div") :addClass("main-page-classes-container") local classes = utilsClasses.GetAllClasses for key, class in ipairs(classes) do   	-- 50% chance to output a male or female every time local gender = "Male" if math.random(0, 1) == 1 then gender = "Female" end -- Create the class element local classItem = mw.html.create("div") :addClass("main-page-classes-item") :node(mw.html.create("div")           	:addClass("main-page-classes-item-image")            	:wikitext(mw.getCurrentFrame:expandTemplate{title = "Tooltip", args = {"", class["name"]}})) -- Adding role classes for key2, classRole in ipairs(class["roles"]) do classItem:addClass("main-page-classes-" .. string.gsub(classRole, " ", "-")) end classesContainer:node(classItem) end return classesContainer end return p