LFGMgr.cpp and LFGMgr.h added to Three

LFGMgr.cpp and LFGMgr.h added to Three.

This is part of the current build error fixes,
This commit is contained in:
Charles A Edwards 2016-02-07 11:21:16 +00:00 committed by Antz
parent 165cfba9c4
commit 8ef55a922f
10 changed files with 3053 additions and 49 deletions

View file

@ -35,7 +35,6 @@
#include "Opcodes.h"
#include "WorldSession.h"
#include "WorldPacket.h"
#include "Weather.h"
#include "Player.h"
#include "SkillExtraItems.h"
#include "SkillDiscovery.h"
@ -76,6 +75,8 @@
#include "CreatureLinkingMgr.h"
#include "Calendar.h"
#include "PhaseMgr.h"
#include "Weather.h"
#include "LFGMgr.h"
#ifdef ENABLE_ELUNA
#include "LuaEngine.h"
#endif /*ENABLE_ELUNA*/
@ -2271,6 +2272,36 @@ void World::InitCurrencyResetTime()
delete result;
}
void World::InitRandomBGResetTime()
{
QueryResult * result = CharacterDatabase.Query("SELECT NextRandomBGResetTime FROM saved_variables");
if (!result)
m_NextRandomBGReset = time_t(time(NULL)); // game time not yet init
else
m_NextRandomBGReset = time_t((*result)[0].GetUInt64());
// generate time by config
time_t curTime = time(NULL);
tm localTm = *localtime(&curTime);
localTm.tm_hour = getConfig(CONFIG_UINT32_RANDOM_BG_RESET_HOUR);
localTm.tm_min = 0;
localTm.tm_sec = 0;
// current day reset time
time_t nextDayResetTime = mktime(&localTm);
// next reset time before current moment
if (curTime >= nextDayResetTime)
nextDayResetTime += DAY;
// normalize reset time
m_NextRandomBGReset = m_NextRandomBGReset < curTime ? nextDayResetTime - DAY : nextDayResetTime;
if (!result)
CharacterDatabase.PExecute("INSERT INTO saved_variables (NextRandomBGResetTime) VALUES ('" UI64FMTD "')", uint64(m_NextRandomBGReset));
else
delete result;
}
void World::ResetDailyQuests()
{
DETAIL_LOG("Daily quests reset for all characters.");