mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
Core/World: properly re-initialize daily quest reset time when resetting daily quests. (#17986)
Prevents daily quests from resetting at weird times when restarting the server after a player has completed a daily quest.
This commit is contained in:
@@ -2143,7 +2143,7 @@ void World::Update(uint32 diff)
|
||||
if (m_gameTime > m_NextDailyQuestReset)
|
||||
{
|
||||
ResetDailyQuests();
|
||||
m_NextDailyQuestReset += DAY;
|
||||
InitDailyQuestResetTime(false);
|
||||
}
|
||||
|
||||
/// Handle weekly quests reset time
|
||||
@@ -2981,18 +2981,19 @@ void World::InitWeeklyQuestResetTime()
|
||||
m_NextWeeklyQuestReset = wstime < curtime ? curtime : time_t(wstime);
|
||||
}
|
||||
|
||||
void World::InitDailyQuestResetTime()
|
||||
void World::InitDailyQuestResetTime(bool loading)
|
||||
{
|
||||
time_t mostRecentQuestTime;
|
||||
time_t mostRecentQuestTime = 0;
|
||||
|
||||
QueryResult result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily");
|
||||
if (result)
|
||||
if (loading)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
mostRecentQuestTime = time_t(fields[0].GetUInt32());
|
||||
QueryResult result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily");
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
mostRecentQuestTime = time_t(fields[0].GetUInt32());
|
||||
}
|
||||
}
|
||||
else
|
||||
mostRecentQuestTime = 0;
|
||||
|
||||
// client built-in time for reset is 6:00 AM
|
||||
// FIX ME: client not show day start time
|
||||
|
||||
@@ -811,7 +811,7 @@ class TC_GAME_API World
|
||||
// callback for UpdateRealmCharacters
|
||||
void _UpdateRealmCharCount(PreparedQueryResult resultCharCount);
|
||||
|
||||
void InitDailyQuestResetTime();
|
||||
void InitDailyQuestResetTime(bool loading = true);
|
||||
void InitWeeklyQuestResetTime();
|
||||
void InitMonthlyQuestResetTime();
|
||||
void InitRandomBGResetTime();
|
||||
|
||||
Reference in New Issue
Block a user