Module:Girl Requirements
Appearance
This is a module implementing functionality for {{Girl Requirements }}.
local p = {}
--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.displayRewards(frame)
local args = require('Module:Arguments').getArgs(frame, {
wrapper="Template:Girl Requirements"
})
return p._displayRewards(args, frame)
end
function p._displayRewards(args, frame)
frame = frame or mw.getCurrentFrame()
local rewards = frame.args["reward"] or ""
local resetBoost = args["reset_bonus"] or ""
local rankMult = frame.args["rankMult"] or 0
if isEmpty(rewards) and isEmpty(resetBoost) then
return "Unknown"
end
if not isEmpty(rewards) then
if not isEmpty(resetBoost) then
return rewards.."<br>"..frame:preprocess("{{Bonus|x="..string.format("%.2f",tonumber(resetBoost)*rankMult).."}}")
end
return rewards
end
if not isEmpty(resetBoost) then
return frame:preprocess("{{Bonus|x="..string.format("%.2f",tonumber(resetBoost)*rankMult).."}}")
end
return rewardString
end
return p