Module:ClockPhase

local p = {} function p.base( f )

local arg = require( 'Module:ProcessArgs' ).merge( true )[1] or 0

local num = tonumber(arg) local span = mw.html.create( 'span' )

if type(num) == "number" then span:attr( 'data-minetip-title', tostring(num) )

local pos = (num % 24000) / 24000 span:wikitext( f:expandTemplate{     title = 'Sprite',      args = {        image = 'ClockSprite.png',        sheetsize = 256,        size = 16,        pos = math.floor((pos * 64 + 48.74) % 64) + 1,        scale = 2,      }    }) return tostring( span )

else

local keys = { day = 1000, noon = 6000, sunset = 12000, dusk = 12000, night = 13000, midnight = 18000, sunrise = 23000, dawn = 23000 }

local word = string.lower(arg)

if keys[word] ~= nil then num = (keys[word] % 24000) / 24000 else num = 0 end span:attr( 'data-minetip-title', tostring(num) )

span:wikitext( f:expandTemplate{     title = 'Sprite',      args = {        image = 'ClockSprite.png',        sheetsize = 256,        size = 16,        pos = math.floor((num * 64 + 48.74) % 64) + 1,        scale = 2,      }    }) return tostring( span )

end end return p