Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:CosmeticOwnership

From MCC Island Wiki

This module is invoked by Template:Cosmetic to display a cosmetic's globalNumberOwned value, but only if ownership reporting is enabled in the API for that cosmetic. All globalNumberOwned values can be found in this module's data page.


local getArgs = require('Module:Arguments').getArgs

local ownershipData = mw.loadData('Module:CosmeticOwnership/Data')
if not ownershipData then
	return "Error: Unable to load data"
end

local p = {}

function p.getOwnershipNumber(frame)
	local args = getArgs(frame)
	return ownershipData["cosmetics"][args.name]
end

function p.getLastUpdatedDate()
	local lang = mw.language.getContentLanguage()
	return lang:formatDate( 'd F Y, h:i a', '@' .. ownershipData['last_updated'], false ) .. ' UTC'
end

function p.lastUpdatedIcon()
    return string.format('<sup><abbr title="Value updated every 12 hours from MCC Island\'s API. Last updated on: %s" tabindex="0">ⓘ</abbr></sup>', p.getLastUpdatedDate())
end

return p