Module:Calendar/shaacamthanj

From Nguhcraft Wiki
Revision as of 14:07, 17 November 2026 by Annwan (talk | contribs) (wip)
Jump to navigation Jump to search

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

local calendar = {}

local epoch_date = 0 -- TO FIX, datestamp for Casting Rains 

local subdigits = {[0] = '', '', '','','','','','',}
local natdigits = {[0] = '', '', '', '', '', ''}
local subseparators = {'', '', '', '󰴂'}
local natseparators = {'', '', '', ''}

local daynames = {
eng = {'1', '2', '3', '4', '5', '6', '7', '8'},
scs = {'', '', '', '', '', '', '', ''}
}

local monthnames = {
eng = {[0] = 'the Depths', 'the Casting Rains', 'Hunger', 'Hunting', 'Floods', 'Light', 'Storms', 'Forage', 'Bloods', 'Harvest', 'Drought', 'the Dry Season Solstice', 'Decay', 'Lanterns'},
scs = {[0] = '', '', '', '', '', '', '', '', '', '', '', '', '', ''}
}

local weeknames = {
	eng = {'Quiet Week', 'Unlucky Week', 'Lucky Week', 'Nightly Week'},
	scs = {'QUIET WEEK', 'Unlucky Week', 'Lucky Week', 'Nightly Week'},
}


local function substrate_num(num)
	--- Digits in the subtrate system
	local place = 0
	local digits = { subdigits[num % 8] }
	num = math.floor(num / 8)
	while num > 0 do
		place = place + 1
		local d = num % 6
		if d ~= 0 then
			digits[#digits+1] = subseparators[place]
			if d ~= 1 then digits[#digits+1] = natdigits[d] end
		end
		num = math.floor(num / 6)
	end
	return '' .. table.concat(digits)
end

local function native_num(num)
	--- Digits in the subtrate system
	local place = 0
	local digits = { natdigits[num % 6] }
	num = math.floor(num / 6)
	while num > 0 do
		place = place + 1
		local d = num % 6
		if d ~= 0 then
			digits[#digits+1] = natseparators[place]
			if d ~= 1 then digits[#digits+1] = natdigits[d] end
		end
		num = math.floor(num / 6)
	end
	return '' .. table.concat(digits)
end

return calendar