mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix(Core/Calendar): Correct calculation of reset time (#14834)
This commit is contained in:
@@ -3130,20 +3130,9 @@ void World::InitCalendarOldEventsDeletionTime()
|
||||
Seconds currentDeletionTime = Seconds(getWorldState(WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME));
|
||||
Seconds nextDeletionTime = currentDeletionTime > 0s ? currentDeletionTime : Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, getIntConfig(CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR)));
|
||||
|
||||
// If the reset time saved in the worldstate is before now it means the server was offline when the reset was supposed to occur.
|
||||
// In this case we set the reset time in the past and next world update will do the reset and schedule next one in the future.
|
||||
if (currentDeletionTime < GameTime::GetGameTime())
|
||||
{
|
||||
_nextCalendarOldEventsDeletionTime = nextDeletionTime - 1_days;
|
||||
}
|
||||
else
|
||||
{
|
||||
_nextCalendarOldEventsDeletionTime = nextDeletionTime;
|
||||
}
|
||||
|
||||
if (currentDeletionTime == 0s)
|
||||
{
|
||||
sWorld->setWorldState(WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME, _nextCalendarOldEventsDeletionTime.count());
|
||||
sWorld->setWorldState(WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME, nextDeletionTime.count());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3254,7 +3243,7 @@ void World::CalendarDeleteOldEvents()
|
||||
{
|
||||
LOG_INFO("server.worldserver", "Calendar deletion of old events.");
|
||||
|
||||
_nextCalendarOldEventsDeletionTime += 1_days;
|
||||
_nextCalendarOldEventsDeletionTime = Seconds(Acore::Time::GetNextTimeWithDayAndHour(-1, getIntConfig(CONFIG_CALENDAR_DELETE_OLD_EVENTS_HOUR)));
|
||||
sWorld->setWorldState(WS_DAILY_CALENDAR_DELETION_OLD_EVENTS_TIME, _nextCalendarOldEventsDeletionTime.count());
|
||||
sCalendarMgr->DeleteOldEvents();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user