PDA

View Full Version : Barovian Calendar



mattekure
February 12th, 2019, 12:47
I've been digging into the calendar stuff lately and noticed that it seems the barovian calendar entry may be incomplete. I know there isnt an official published standard for the barovian calendar, so its implementation is subject to interpretation.

In the calendar.mod db.xml, the barovian calendar includes the tags:

<lunardaycalc type="string">barovian</lunardaycalc>
and
<periodvarcalc type="string">barovian</periodvarcalc>


However, in the corerpg manager_calendar.lua file, there are no registered or defined LunarDayHandler or MonthVarHandler functions for the Barovian calendar. So these tags from the calendar appear to be ignored. The calendar is defined to have 30 days per month except Oct which has 31, and without a barovian lunardayhandler defined the months all start on the first day of the week. If the month were 28 days instead, the function wouldnt be needed. Also, I cant find any reference that Barovia has leap years, so that tag can probably be removed.

26292

mattekure
February 12th, 2019, 15:06
The following lunar day calculator works for the barovian calendar as currently defined in the FG calendar.



function calcBaroviaLunarDay(nYear, nMonth, nDay)
local rYear = nYear%7;
if (rYear % 2) == 0 then
rYearDay = (rYear/2);
else
rYearDay = (rYear/2)+3.5;
end

local rMonthDays = (nMonth-1)*30;
if nMonth > 10 then
rMonthDays = rMonthDays + 1;
end
local rDay = (rYearDay + rMonthDays + nDay)%7;
if rDay == 0 then
return 7;
end
return rDay;
end