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:
SnapperRy
2016-09-30 13:16:37 +02:00
committed by Aokromes
parent abfc973bdc
commit af87a5d5bf
2 changed files with 11 additions and 10 deletions

View File

@@ -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

View File

@@ -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();