Jump to content

Module:Jobs

From SPS Wiki

This module is intended for managing Job data (right now only names per rank). Used on {{Jobs }}.


local p = {}

local ccJobData = require('Module:Jobs/Data Crush Crush')
local bbJobData = require('Module:Jobs/Data Blush Blush')

--Function to determine if string is empty value 
local function isEmpty(s)
  return s == nil or s == ''
end

--uses the template as a wrapper, grabbing any arguments passed to the template
function p.main(frame)
	local args = require('Module:Arguments').getArgs(frame, {
		wrapper="Template:Jobs"
	})
	return p._main(args, frame)
end

function p._main(args, frame)
	if args["title"] ~= nil then
		return args["title"]
	end
	if args["bb"] == nil then
		if ccJobData[args[1]] == nil then
			return "Incorrect Job Name for Crush Crush"
		end
		local output = ccJobData[args[1]][tonumber(args["level"])]
	    return output
	end
	if args["bb"] ~= nil then
		if bbJobData[args[1]] == nil then
			return "Incorrect Job Name for Blush Blush"
		end
		local output = bbJobData[args[1]][tonumber(args["level"])]
	    return output
	end
end

return p