Module:Reward/Maps

local Reward = require 'Module:Reward' local RewardText = require 'Module:RewardText' local parseArgs = require 'Module:ObjectArg'.parse local toboolean = require 'Module:Bool'.toboolean

local main = function (args, frame) local allRewards, err = parseArgs(args[1] or '') if err or type(allRewards) ~= 'table' then mw.log('ObjectArg.parse failed: ' .. err) mw.log('Reward parameter: ' .. tostring(args[1] or '')) mw.log('Using reward parameter verbatim.') return args[1] end

local rewardTexts = {} local noCargo = toboolean(args['no cargo'])

for dif, rewards in pairs(allRewards) do		rewards, err = Reward.normalize(rewards) if err then mw.log('ObjectArg.parse failed: ' .. err) mw.log('Reward string: ' .. tostring(args[1] or '')) mw.log('Using reward parameter verbatim.') return args[1] end

rewardTexts[dif] = RewardText._main({rewards, iconfirst = '1'}, frame) if not noCargo then Reward.define(rewards, 'Maps', {				map = args.map,				tabname = dif,				from = args.from,				to = args.to,			}, frame) end end

return require 'Module:DifficultyTexts'._main(rewardTexts) end

return require 'Module:MakeMWModule'.makeMWModule {main = main}