Module:Bee

--WIP, don't touch -bony local p = {}

local util = require("Module:Utility_functions") local lang = require("Module:Language") local grid = require("Module:Grid")

-- Copied from Module:Infobox. Maybe this should be common or something. function loadTranslatedModule(name, forceUntranslated) local moduleName = name if not forceUntranslated then moduleName = moduleName .. util.pageSuffix end return pcall(function       return require(moduleName)    end) end

local stringsLoaded, strings = loadTranslatedModule("Module:Bee/strings") if not stringsLoaded then strings = {} end

p.bee = function(f) local args = f.args or f	if f == mw.getCurrentFrame and args[1] == nil then args = f:getParent.args else f = mw.getCurrentFrame end args = require(Module:ProcessArgs).norm(args) local wikitext = "{| class=\"wikitable\"" .. "\n" .. "|+ style=\"padding-bottom:1em; text-align:center; font-size:200%\" | " local modd = "" -- Mod author (discoverer) local modn = "" -- Mod name local modl = "" -- Mod name (localized) local moda = "" -- Mod abbreviation if args["disc"] then modd = args["disc"] for disc, data in pairs(strings.moddata) do			if disc == modd then modn = data[1] modl = data[2] moda = data[3] end end if modn == "" then return "Unknown discoverer. Please Report to the FTB Wiki Staff." end else return "Discoverer missing. Please Report to the FTB Wiki Staff." end local name = "" if args["name"] then name = args["name"] else return "Name missing. Please Report to the FTB Wiki Staff." end wikitext = wikitext .. name .. " " .. strings.bees .. " " .. 		mw.getCurrentFrame:expandTemplate{title = "P", args = {name .. " Queen", "F"}} .. "\n" .. "|-" .. "\n" .. "| " .. 		strings.latinname .. "\n" .. "| ''"	if args["latin"] then wikitext = wikitext .. args["latin"] else wikitext = wikitext .. strings.missingno end wikitext = wikitext .. "''" .. "\n" .. "| colspan = 2 style=\"text-align:center\" | " .. strings.description .. "\n" .. "|-" .. 		"\n" .. "| " .. strings.discoveredby .. "\n" .. "| ''" .. modd .. "''" .. "\n" .. "| colspan = 2 rowspan = 4 style=\"text-align:center\" | " if args["desc"] then wikitext = wikitext .. args["desc"] else wikitext = wikitext .. "''" .. strings.nodescription .. "''"	end wikitext = wikitext .. "\n" .. "|-" .. "\n" .. "| " .. strings.addedbymod .. "\n" .. "| ''" .. lang.link({modn, modl}) .. "''" .. 		"\n" .. "|-" .. "\n" .. "| " .. strings.branch .. "\n" .. "| ''"	if args["branch"] then local branch = strings.branchfillin:gsub("&s", args["branch"]) if args["branch-name"] then wikitext = wikitext .. lang.link({branch, args["branch-name"]}) else wikitext = wikitext .. lang.link({branch, branch}) end else wikitext = wikitext .. strings.nobranch end wikitext = wikitext .. "''" .. "\n" .. "|-" .. "\n" .. "| " .. lang.link({"isNocturnal", strings.isnocturnal}) .. "\n" .. "| " ..		"''"	if args["noct"] then if args["noct"] == "yes" then wikitext = wikitext .. strings.yes elseif args["noct"] == "no" then wikitext = wikitext .. strings.no		else wikitext = wikitext .. strings.no		end else wikitext = wikitext .. strings.no	end wikitext = wikitext .. "''" .. "\n" .. "|-" .. "\n" .. "| Colspan = 2 style=\"text-align:center\" | " .. strings.product .. "\n" .. "| Colspan = 2 style=\"text-align:center\" | " .. strings.specialty .. "\n" .. "|-" .. "\n" -- Maybe the following code should be optimized. if args["prod-1"] then local prodlink = args["prod-1"] local prodmod = moda if args["prod-1-lnk"] then prodlink = args["prod-1-lnk"] end if args["prod-1-mod"] then prodmod = args["prod-1-mod"] end wikitext = wikitext .. "\n" .. "| " .. grid.cell({args["prod-1"], link = prodlink, ["no-bg"] = "1", mod = prodmod}) .. " " .. 			lang.link({prodlink, args["prod-1"]}) .. "\n" .. "| " .. strings.basechance:gsub("&s", args["time-1"]) .. "\n" else wikitext = wikitext .. "\n" .. "| colspan=2 style=\"border:1\" |" .. "\n" end if args["prod-s"] then local prodlink = args["prod-s"] local prodmod = moda if args["prod-s-lnk"] then prodlink = args["prod-s-lnk"] end if args["prod-s-mod"] then prodmod = args["prod-s-mod"] end wikitext = wikitext .. "\n" .. "| " .. grid.cell({args["prod-s"], link = prodlink, ["no-bg"] = "1", mod = prodmod}) .. " " .. 			lang.link({prodlink, args["prod-s"]}) .. "\n" .. "| " .. strings.basechance:gsub("&s", args["time-s"]) .. "\n" else wikitext = wikitext .. "\n" .. "| colspan=2 style=\"border:1\" |" .. "\n" end if args["prod-2"] then local prodlink = args["prod-2"] local prodmod = moda if args["prod-2-lnk"] then prodlink = args["prod-2-lnk"] end if args["prod-2-mod"] then prodmod = args["prod-2-mod"] end wikitext = wikitext .. "\n" .. "|-" .. "| " .. grid.cell({args["prod-2"], link = prodlink, ["no-bg"] = "1", mod = prodmod}) .. " " .. lang.link({prodlink, args["prod-2"]}) .. "\n" .. "| " .. strings.basechance:gsub("&s", args["time-2"]) .. "\n" if args["prod-s2"] then local prodlink = args["prod-s2"] local prodmod = moda if args["prod-s2-lnk"] then prodlink = args["prod-s2-lnk"] end if args["prod-s2-mod"] then prodmod = args["prod-2-mod"] end wikitext = wikitext .. "\n" .. "| " .. 				grid.cell({args["prod-s2"], link = prodlink, ["no-bg"] = "1", mod = prodmod}) .. " " .. 				lang.link({prodlink, args["prod-s2"]}) .. "\n" .. "| " .. strings.basechance:gsub("&s", args["time-s2"]) .. " "		else wikitext = wikitext .. "\n" .. "| colspan=2 style=\"border:1\" |" .. "\n" end else if args["prod-s2"] then local prodlink = args["prod-s2"] local prodmod = moda if args["prod-s2-lnk"] then prodlink = args["prod-s2-lnk"] end if args["prod-s2-mod"] then prodmod = args["prod-s2-mod"] end wikitext = wikitext .. "\n" .. "|-" .. "\n" .. "| colspan=2 style=\"border:1\" |" .. "\n" .. "| " .. grid.cell({args["prod-s2"], link = prodlink, ["no-bg"] = "1", mod = prodmod}) .. " " .. 				lang.link({prodlink, args["prod-s2"]}) .. "\n" .. "| " .. strings.basechance:gsub("&s", args["time-s2"]) .. " "		else wikitext = wikitext .. "\n" end end if args["prod-3"] then local prodlink = args["prod-3"] local prodmod = moda if args["prod-3-lnk"] then prodlink = args["prod-3-lnk"] end if args["prod-3-mod"] then prodmod = args["prod-3-mod"] end wikitext = wikitext .. " " .. "\n" .."|-" .. "\n" .. "| " .. 			grid.cell({args["prod-3"], link = prodlink, ["no-bg"] = "1", mod = prodmod}) .. " " .. lang.link({prodlink, args["prod-3"]}) .. "\n" .. "| " .. strings.basechance:gsub("&s", args["time-3"]) .. "\n" .. "| colspan=2 style=\"border:1\" |" .. "\n" end wikitext = wikitext .. "|}"	return wikitext end

return p