Official Tower Defense Simulator Wiki
Succumb to the dark sun! Like many before you.
2,699
articles

Documentation for this module may be created at Module:RewardsList/doc

local p = {}

function p.heeho(frame)
	local  args = frame:getParent().args
	local  difficulty = mw.text.trim(args[1] or "")
	local  diffMult
	if     difficulty == "Very Easy" then diffMult = .5
	elseif difficulty == "Easy"      then diffMult = .85
	elseif difficulty == "Hard"      then diffMult = 1.25
	elseif difficulty == "Insane"    then diffMult = 1.5
	else                                  diffMult = 1
	end

	local modifiers = tonumber(args.Modifiers) or 1

	local function coins(amount)     return frame:expandTemplate { title = "Coins",      args = { math.floor(amount) } } end
	local function exp(amount)       return frame:expandTemplate { title = "Exp",        args = { math.floor(amount) } } end
	local function gem(amount)       return frame:expandTemplate{ title = "Gem",         args = { math.floor(amount) } } end
	local function towerexp(amount)  return frame:expandTemplate{ title = "TowerExp",    args = { math.floor(amount) } } end
	local function shown(param)      return mw.text.trim(args[param] or "") ~= "Hide" end
	local lines = {}

	-- IMPORTANT ONES
	if shown("Easy") then
		table.insert(lines,
			-- {{Coins|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Easy Mode|Easy]])
			coins(300 * modifiers * diffMult) .. ", " .. exp(50 * modifiers * diffMult) .. " & " .. towerexp(25 * modifiers) .. " ([[Easy Mode|Easy]])<br/>")
	end

	if shown("Casual") then
		table.insert(lines,
			-- {{Coins|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Casual Mode|Casual]])
			coins(450 * modifiers * diffMult) .. ", " .. exp(90 * modifiers * diffMult) .. " & " .. towerexp(50 * modifiers) .. " ([[Casual Mode|Casual]])<br/>")
	end

	if shown("Intermediate") then
		table.insert(lines,
			-- {{Coins|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Intermediate Mode|Intermediate]])
			coins(600 * modifiers * diffMult) .. ", " .. exp(120 * modifiers * diffMult) .. " & " .. towerexp(75 * modifiers) .. " ([[Intermediate Mode|Intermediate]])<br/>")
	end

	if shown("Molten") then
		table.insert(lines,
			-- {{Coins|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Molten Mode|Molten]])
			coins(950 * modifiers * diffMult) .. ", " .. exp(185 * modifiers * diffMult) .. " & " .. towerexp(120 * modifiers) .. " ([[Molten Mode|Molten]])<br/>")
	end

	if shown("Fallen") then
		table.insert(lines,
			-- {{Coins|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Fallen Mode|Fallen]])
			coins(1350 * modifiers * diffMult) .. ", " .. exp(250 * modifiers * diffMult) .. " & " .. towerexp(185 * modifiers) .. " ([[Fallen Mode|Fallen]])<br/>")

		-- Hidden Wave uses a separate gem table
		local hiddenGems
		if	   difficulty == "Very Easy" then hiddenGems = 50
		elseif difficulty == "Easy"	     then hiddenGems = 75
		elseif difficulty == "Medium"    then hiddenGems = 0
		elseif difficulty == "Hard"	     then hiddenGems = 125
		elseif difficulty == "Insane"    then hiddenGems = 150
		else                                  hiddenGems = 100
		end

		table.insert(lines,
			-- {{Gem|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Hidden Wave]])
			gem(hiddenGems * modifiers) .. ", " .. exp(250 * modifiers * diffMult) .. " & " .. towerexp(185 * modifiers) .." ([[Hidden Wave]])<br/>")
	end

	if shown("Frost") then
		table.insert(lines,
			-- {{Coins|number}}, {{Gem|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Frost Mode|Frost]])
			coins(2000 * modifiers * diffMult) .. ", " .. gem(45 * modifiers) .. ", " .. exp(300 * modifiers * diffMult) .. " & " .. towerexp(195 * modifiers) .. " ([[Frost Mode|Frost]])<br/>")
	end

	if shown("Hardcore") then
		table.insert(lines,
			-- {{Gem|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Hardcore Mode|Hardcore]])
			gem(400 * modifiers) .. ", " .. exp(400 * modifiers) .. " & " .. towerexp(350 * modifiers) .. " ([[Hardcore Mode|Hardcore]])<br/>")
	end

	if shown("Voidcore") then
		table.insert(lines,
			-- {{Gem|number}}, {{Exp|number}} & {{TowerExp|number}} ([[Voidcore Mode|Hardcore]])
			gem(700 * modifiers) .. ", " .. exp(500 * modifiers) .. " & " .. towerexp(420 * modifiers) .. " ([[Voidcore Mode|Voidcore]])")
	end
	-- END IMPORTANT

	return table.concat(lines)
end

return p