diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/server/game/World/World.cpp | 40 | ||||
| -rw-r--r-- | src/server/game/World/World.h | 5 |
2 files changed, 24 insertions, 21 deletions
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 0b6c7641b8b..97311508ebb 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -216,6 +216,25 @@ void World::SetClosed(bool val) sScriptMgr->OnOpenStateChange(!val); } +void World::LoadDBAllowedSecurityLevel() +{ + LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL); + stmt->setInt32(0, int32(realm.Id.Realm)); + PreparedQueryResult result = LoginDatabase.Query(stmt); + + if (result) + SetPlayerSecurityLimit(AccountTypes(result->Fetch()->GetUInt8())); +} + +void World::SetPlayerSecurityLimit(AccountTypes _sec) +{ + AccountTypes sec = _sec < SEC_CONSOLE ? _sec : SEC_PLAYER; + bool update = sec > m_allowedSecurityLevel; + m_allowedSecurityLevel = sec; + if (update) + KickAllLess(m_allowedSecurityLevel); +} + void World::SetMotd(std::string motd) { /// we are using a string copy here to allow modifications in script hooks @@ -3368,6 +3387,8 @@ void World::InitDailyQuestResetTime(bool loading) m_NextDailyQuestReset = mostRecentQuestTime; else // plan next reset time m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + DAY : curDayResetTime; + + sWorld->setWorldState(WS_DAILY_QUEST_RESET_TIME, uint64(m_NextDailyQuestReset)); } void World::InitMonthlyQuestResetTime() @@ -3494,25 +3515,6 @@ void World::ResetCurrencyWeekCap() sWorld->setWorldState(WS_CURRENCY_RESET_TIME, uint32(m_NextCurrencyReset)); } -void World::LoadDBAllowedSecurityLevel() -{ - LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL); - stmt->setInt32(0, int32(realm.Id.Realm)); - PreparedQueryResult result = LoginDatabase.Query(stmt); - - if (result) - SetPlayerSecurityLimit(AccountTypes(result->Fetch()->GetUInt8())); -} - -void World::SetPlayerSecurityLimit(AccountTypes _sec) -{ - AccountTypes sec = _sec < SEC_CONSOLE ? _sec : SEC_PLAYER; - bool update = sec > m_allowedSecurityLevel; - m_allowedSecurityLevel = sec; - if (update) - KickAllLess(m_allowedSecurityLevel); -} - void World::ResetWeeklyQuests() { TC_LOG_INFO("misc", "Weekly quests reset for all characters."); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index ac66c13380d..0c568b60e9c 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -552,11 +552,12 @@ enum RealmZone enum WorldStates { WS_CURRENCY_RESET_TIME = 20001, // Next currency reset time - WS_WEEKLY_QUEST_RESET_TIME = 20002, // Next weekly reset time + WS_WEEKLY_QUEST_RESET_TIME = 20002, // Next weekly quest reset time WS_BG_DAILY_RESET_TIME = 20003, // Next daily BG reset time WS_CLEANING_FLAGS = 20004, // Cleaning Flags WS_GUILD_DAILY_RESET_TIME = 20006, // Next guild cap reset time - WS_MONTHLY_QUEST_RESET_TIME = 20007, // Next monthly reset time + WS_MONTHLY_QUEST_RESET_TIME = 20007, // Next monthly quest reset time + WS_DAILY_QUEST_RESET_TIME = 20008, // Next daily quest reset time // Cata specific custom worldstates WS_GUILD_WEEKLY_RESET_TIME = 20050, // Next guild week reset time }; |
