2021-01-18 13:34:00 -05:00
-----------------------------------
2020-07-01 20:04:20 -04:00
-- func: time
2025-04-23 06:53:06 -04:00
-- desc: Prints time info.
2021-01-18 13:34:00 -05:00
-----------------------------------
2024-08-25 10:54:45 -04:00
---@type TCommand
2023-09-02 07:01:35 -04:00
local commandObj = { }
2020-07-01 20:04:20 -04:00
2023-09-02 07:01:35 -04:00
commandObj.cmdprops =
2020-07-01 20:04:20 -04:00
{
2025-04-23 06:53:06 -04:00
permission = 1 ,
parameters = ' '
2020-07-01 20:04:20 -04:00
}
2025-04-23 06:53:06 -04:00
commandObj.onTrigger = function ( player )
local channel = xi.msg . channel.SYSTEM_3
local elementalDayName =
{
2025-04-27 14:46:41 -04:00
' Firesday ' ,
' Earthsday ' ,
' Watersday ' ,
' Windsday ' ,
' Iceday ' ,
' Lightningday ' ,
' Lightsday ' ,
' Darksday ' ,
2025-04-23 06:53:06 -04:00
}
local totdName =
{
2025-04-27 14:46:41 -04:00
' Midnight ' ,
' New Day ' ,
' Dawn ' ,
' Daytime ' ,
' Dusk ' ,
' Evening ' ,
' Night ' ,
2025-04-23 06:53:06 -04:00
}
local raceName =
{
2025-04-27 14:46:41 -04:00
' Hume Male ' ,
' Hume Female ' ,
' Elvaan Male ' ,
' Elvaan Female ' ,
' Taru Male ' ,
' Taru Female ' ,
' Mithra ' ,
' Galka ' ,
2025-04-23 06:53:06 -04:00
}
local rseZoneName =
{
2025-04-27 14:46:41 -04:00
' Ordelle \' s Caves ' ,
' Gusgen Mines ' ,
' Maze of Shakhrami ' ,
2025-04-23 06:53:06 -04:00
}
2025-04-24 07:29:40 -04:00
local earthDayName =
{
2025-04-27 14:46:41 -04:00
' Sunday ' ,
' Monday ' ,
' Tuesday ' ,
' Wednesday ' ,
' Thursday ' ,
' Friday ' ,
' Saturday ' ,
2025-04-24 07:29:40 -04:00
}
2025-04-23 06:53:06 -04:00
-- Time and Date
local year = VanadielYear ( ) + 886
2025-04-25 19:44:18 -04:00
local month = VanadielMonth ( )
2025-04-23 06:53:06 -04:00
local day = VanadielDayOfTheMonth ( )
local dayElement = elementalDayName [ VanadielDayOfTheWeek ( ) + 1 ]
local hour = VanadielHour ( )
local minute = VanadielMinute ( )
2025-04-27 14:46:41 -04:00
local totd = totdName [ VanadielTOTD ( ) ] or ' None '
2025-04-24 07:29:40 -04:00
player : printToPlayer ( fmt ( ' It has been {} Vana \' diel days ({} seconds) since the Vana \' diel epoch. ' , VanadielUniqueDay ( ) , VanadielTime ( ) ) , channel )
2025-07-03 21:20:08 -04:00
player : printToPlayer ( fmt ( ' The next Vana \' diel day is in {} seconds. ' , getVanaMidnight ( ) - GetSystemTime ( ) ) , channel )
2025-04-24 07:29:40 -04:00
player : printToPlayer ( fmt ( ' Vana \' diel: {}/{}/{}, {}, {}:{:02} ({}, {} days into the year) ' , year , month , day , dayElement , hour , minute , totd , VanadielDayOfTheYear ( ) ) , channel )
2020-07-01 20:04:20 -04:00
2025-04-23 06:53:06 -04:00
-- Moon
local moonPhase = VanadielMoonPhase ( )
2025-11-03 01:16:21 -05:00
local moonCycle = getVanadielMoonCycle ( )
local moonNames = {
[ xi.moonCycle . NEW_MOON ] = ' New Moon ' ,
[ xi.moonCycle . LESSER_WAXING_CRESCENT ] = ' Waxing Crescent ' ,
[ xi.moonCycle . GREATER_WAXING_CRESCENT ] = ' Waxing Crescent ' ,
[ xi.moonCycle . FIRST_QUARTER ] = ' First Quarter ' ,
[ xi.moonCycle . LESSER_WAXING_GIBBOUS ] = ' Waxing Gibbous ' ,
[ xi.moonCycle . GREATER_WAXING_GIBBOUS ] = ' Waxing Gibbous ' ,
[ xi.moonCycle . FULL_MOON ] = ' Full Moon ' ,
[ xi.moonCycle . GREATER_WANING_GIBBOUS ] = ' Waning Gibbous ' ,
[ xi.moonCycle . LESSER_WANING_GIBBOUS ] = ' Waning Gibbous ' ,
[ xi.moonCycle . THIRD_QUARTER ] = ' Last Quarter ' ,
[ xi.moonCycle . GREATER_WANING_CRESCENT ] = ' Waning Crescent ' ,
[ xi.moonCycle . LESSER_WANING_CRESCENT ] = ' Waning Crescent ' ,
}
local moonType = moonNames [ moonCycle ]
2025-04-27 14:46:41 -04:00
2025-04-23 06:53:06 -04:00
player : printToPlayer ( fmt ( ' {} ({}%) ' , moonType , moonPhase ) , channel )
2025-04-24 07:29:40 -04:00
-- Earth time
local utcTimestamp = GetSystemTime ( )
local secondsToMidnight = JstMidnight ( ) - utcTimestamp
local hoursToMidnight = math.floor ( secondsToMidnight / ( 60 * 60 ) )
secondsToMidnight = secondsToMidnight - ( hoursToMidnight * 60 * 60 )
local minutesToMidnight = math.floor ( secondsToMidnight / 60 )
secondsToMidnight = secondsToMidnight - ( minutesToMidnight * 60 )
local jstHours = 23 - hoursToMidnight
local jstMinutes = 59 - minutesToMidnight
local jstSeconds = 59 - secondsToMidnight
local weeklyResetDays = math.floor ( ( NextJstWeek ( ) - utcTimestamp ) / ( 24 * 60 * 60 ) )
2025-07-03 23:04:18 -04:00
player : printToPlayer ( fmt ( ' Japan: {}, {}:{:02}:{:02} (weekly reset in {} days) ' , earthDayName [ JstDayOfTheWeek ( ) + 1 ] , jstHours , jstMinutes , jstSeconds , weeklyResetDays ) , channel )
2025-04-24 07:29:40 -04:00
2025-04-23 06:53:06 -04:00
-- RSE
local rseRace = raceName [ VanadielRSERace ( ) ]
local rseLocation = rseZoneName [ VanadielRSELocation ( ) + 1 ]
player : printToPlayer ( fmt ( ' Current RSE is {} in {}. ' , rseRace , rseLocation ) , channel )
2020-07-01 20:04:20 -04:00
end
2023-09-02 07:01:35 -04:00
return commandObj