FANDOM


-- <pre>
local p = {}
 
local coins = require('Module:Coins')._amount
local gep = require('Module:Exchange')._price
local commas = require('Module:Addcommas')._add
 
function p.main(frame)
	local args = frame:getParent().args
	local items = {}
	for _, v in ipairs(args) do
		local amt, itm = string.match(mw.text.trim(v),'%s*(%d+)%s*%*%s*(.*)')
		table.insert(items,{ n = itm, x = amt }) 
	end
	local ret = mw.html.create('table')
							:addClass('wikitable')
							:addClass('sortable')
							:addClass('mw-collapsible')
							:css('text-align','right')
							:tag('caption')
								:wikitext('Raffle prize pool')
							:done()
							:tag('tr')
								:tag('th')
									:addClass('unsortable')
									:wikitext('Prize')
								:done()
								:tag('th')
									:wikitext('GE value')
								:done()
							:done()
	local total_value = 0
	for _, v in ipairs(items) do
		local item_ge
		if string.lower(v.n) == 'coins' then
			item_ge = 1
		else
			item_ge = gep(v.n)
		end
		ret:tag('tr')
			:tag('td')
				:wikitext(commas(v.x) .. ' × ' .. plinkp(v.n))
			:done()
			:tag('td')
				:wikitext(coins(item_ge * v.x))
			:done()
			:done()
		total_value = total_value + item_ge * v.x
	end
 
	ret:tag('b')
		:wikitext('Total value: ' .. coins(total_value))
		:done()
 
	return ret
end
function plinkp(item)
	local item_img
	if string.lower(item) == 'coins' then
		item_img = 'Coins 1000'
	else
		item_img = item
	end
	return string.format('[[File:%s.png|link=%s]]',item_img,item)
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.