Module:DropsLine

-- local p = {}

local yesno = require('Module:Yesno') local uclc = require('Module:Paramtest').ucflc local coins = require('Module:Coins')._amount local commas = require('Module:Addcommas')

local raritybg = { ['always'] = '#AFEEEE', ['common'] = '#98FB98', ['uncommon'] = '#F0E68C', ['rare'] = '#F4A460', ['very rare'] = '#F08080', ['random'] = '#EE82EE', ['varies'] = '#EE82EE', ['discontinued'] = '#C5B358' }

local raritysort = { ['always'] = '1', ['common'] = '2', ['uncommon'] = '3', ['rare'] = '4', ['very rare'] = '5', ['varies'] = '6', ['random'] = '6', ['discontinued'] = '7' }

function p._main(frame) local args = frame:getParent.args local name = args.Name or 'item' local namenotes = args.Namenotes or '' local quantity = args.Quantity or 'Unknown' local rarity = uclc(args.Rarity or 'Unknown') local raritynotes = args.Raritynotes or '' local gemw = args.gemw or true local gemw = yesno(gemw) local price local alt = false if gemw then price = frame:expandTemplate{ title = 'GEP', args = { name } } elseif args.AltValue then price = args.AltValue .. ' '		alt = true else price = 'Not sold' end price = commas._strip(price) local image = 'File:' .. (args.Image or (name .. '.png')) local ret = main(name,namenotes,quantity,rarity,raritynotes,price,alt,image) local cats = '' local ns = mw.title.getCurrentTitle.nsText if ns == '' then cats = categories(name,quantity,rarity) end return ret..cats end

function main(name,namenotes,quantity,rarity,raritynotes,price,alt,image) local rare_bg = raritybg[rarity:lower] or '#FFFFFF' local rare_sort = raritysort[rarity:lower] or '8' local ret = '| center' .. '\n| ' .. name .. ' ' .. namenotes .. '\n| ' .. quantity .. ' ' .. quantitynotes .. '\n| style="background:' .. rare_bg .. ';"' .. ' | ' .. rare_sort .. '; ' .. rarity .. ' ' .. raritynotes if not alt then local range_price = qty(price,quantity) ret = ret .. '\n| title="' .. commas._add(price) .. ' coins each" | ' else ret = ret .. '\n| ' end end

function qty(price,quantity) quantity = quantity:gsub('%s*[-—]%s*','–') --:gsub('	return true end

return p