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:format(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 .. "| Colspan = 2 style=\"text-align:center\" | " .. strings.specialty .. "\n" .. "|-" .. "\n" -- Maybe the following code should be optimized. if args["prod-1"] then local prodlink = "" if args["prod-1-lnk"] then prodlink = args["prod-1-lnk"] else prodlink = args["prod-1"] end wikitext = wikitext .. grid.cell({args["prod-1"], link = prodlink, ["no-bg"] = "1", mod = moda}) .. " " .. 			lang.link({prodlink, args["prod-1"]}) .. "\n" .. "| " .. strings.basechance:format(args["time-1"], "") else wikitext = wikitext .. "| colspan=2 style=\"border:1\" |" end if args["prod-s"] then local prodlink = "" if args["prod-s-lnk"] then prodlink = args["prod-s-lnk"] else prodlink = args["prod-s"] end wikitext = wikitext .. "| " .. grid.cell({args["prod-s"], link = prodlink, ["no-bg"] = "1", mod = moda}) .. " " .. 			lang.link({prodlink, args["prod-s"]}) .. "\n" .. "| " .. strings.basechance:format(args["time-s"], "") else wikitext = wikitext .. "| colspan=2 style=\"border:1\" |" end if args["prod-2"] then local prodlink = "" if args["prod-2-lnk"] then prodlink = args["prod-2-lnk"] else prodlink = args["prod-2"] end wikitext = wikitext .. "| " .. grid.cell({args["prod-2"], link = prodlink, ["no-bg"] = "1", mod = moda}) .. " " .. 			lang.link({prodlink, args["prod-2"]}) .. "\n" .. "| " .. strings.basechance:format(args["time-2"], "") if args["prod-s2"] then local prodlink = "" if args["prod-s2-lnk"] then prodlink = args["prod-s2-lnk"] else prodlink = args["prod-s2"] end wikitext = wikitext .. "|-" .. "\n" .. "| " .. grid.cell({args["prod-s2"], link = prodlink, ["no-bg"] = "1", mod = moda}) .. " " .. lang.link({prodlink, args["prod-s2"]}) .. "\n" .. "| " .. strings.basechance:format(args["time-s2"], "") else wikitext = wikitext .. "| colspan=2 style=\"border:1\" |" end else wikitext = wikitext .. "| colspan=2 style=\"border:1\" |" if args["prod-s2"] then local prodlink = "" if args["prod-s2-lnk"] then prodlink = args["prod-s2-lnk"] else prodlink = args["prod-s2"] end wikitext = wikitext .. "|-" .. "\n" .. "| colspan=2 style=\"border:1\" |" .. "\n" .. "| " .. grid.cell({args["prod-s2"], link = prodlink, ["no-bg"] = "1", mod = moda}) .. " " .. 				lang.link({prodlink, args["prod-s2"]}) .. "\n" .. "| " .. strings.basechance:format(args["time-s2"], "") else wikitext = wikitext .. "| colspan=2 style=\"border:1\" |" end end if args["prod-3"] then wikitext = wikitext .. " | "		local prodlink = "" if args["prod-3-lnk"] then prodlink = args["prod-3-lnk"] else prodlink = args["prod-3"] end wikitext = wikitext .. "|-" .. "\n" .. "| colspan=2 style=\"border:1\" |" .. "\n" .. "| " .. grid.cell({args["prod-3"], link = prodlink, ["no-bg"] = "1", mod = moda}) .. " " .. 			lang.link({prodlink, args["prod-3"]}) .. "\n" .. "| " .. strings.basechance:format(args["time-3"], "") .. "| colspan=2 style=\"border:1\" |" end wikitext = wikitext .. "|}"	return wikitext end

return p

--