mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-15 23:20:36 +01:00
Core/DB: Add a world state for daily quest reset time to characters. Not used right now, but written to allow easier transition later.
This commit is contained in:
@@ -2633,8 +2633,10 @@ INSERT INTO `updates` VALUES
|
||||
('2019_05_15_00_characters.sql','A12F21C8044C8BC8E2AA17F4C6CEB8B722CBC714','ARCHIVED','2019-05-15 06:13:20',0),
|
||||
('2019_06_15_00_characters.sql','32DA6E004D7DD6EFFB0BB26238D17F6CC9E51DE6','ARCHIVED','2019-06-15 07:33:45',0),
|
||||
('2019_07_14_00_characters.sql','A141F4F15BDF0320483921429871D4C572BD7E2D','ARCHIVED','2019-07-04 00:00:00',0),
|
||||
('2019_07_15_00_characters.sql','5BCF35896BB36A306CE79CF1E3F1945FAF9019D9','ARCHIVED','2019-07-15 05:57:41',4),
|
||||
('2019_07_15_01_characters.sql','5D383B026AB9EDE7114F249D206DE7E432E19468','RELEASED','2019-07-15 17:41:30',0);
|
||||
('2019_07_15_00_characters.sql','5BCF35896BB36A306CE79CF1E3F1945FAF9019D9','ARCHIVED','2019-07-15 00:00:00',0),
|
||||
('2019_07_15_01_characters.sql','5D383B026AB9EDE7114F249D206DE7E432E19468','ARCHIVED','2019-07-15 00:00:00',0),
|
||||
('2019_07_16_00_characters.sql','76AE193EFA3129FA1702BF7B6FA7C4127B543BDF','ARCHIVED','2019-07-16 00:00:00',0);
|
||||
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -2783,11 +2785,12 @@ INSERT INTO `worldstates` VALUES
|
||||
(3801,0,NULL),
|
||||
(3802,1,NULL),
|
||||
(20001,0,'NextArenaPointDistributionTime'),
|
||||
(20002,1477230266,'NextWeeklyQuestResetTime'),
|
||||
(20003,1476680400,'NextBGRandomDailyResetTime'),
|
||||
(20002,0,'NextWeeklyQuestResetTime'),
|
||||
(20003,0,'NextBGRandomDailyResetTime'),
|
||||
(20004,0,'cleaning_flags'),
|
||||
(20006,1476680400,NULL),
|
||||
(20007,1477954800,NULL);
|
||||
(20006,0,'NextGuildDailyResetTime'),
|
||||
(20007,0,'NextMonthlyQuestResetTime'),
|
||||
(20008,0,'NextDailyQuestResetTime');
|
||||
/*!40000 ALTER TABLE `worldstates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
--
|
||||
UPDATE `worldstates` SET `comment`='NextGuildDailyResetTime' WHERE `entry`=20006;
|
||||
UPDATE `worldstates` SET `comment`='NextMonthlyQuestResetTime' WHERE `entry`=20007;
|
||||
INSERT INTO `worldstates` (`entry`,`value`,`comment`) VALUES (20008,0,'NextDailyQuestResetTime');
|
||||
@@ -202,6 +202,25 @@ void World::SetClosed(bool val)
|
||||
sScriptMgr->OnOpenStateChange(!val);
|
||||
}
|
||||
|
||||
void World::LoadDBAllowedSecurityLevel()
|
||||
{
|
||||
PreparedStatement* 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::TriggerGuidWarning()
|
||||
{
|
||||
// Lock this only to prevent multiple maps triggering at the same time
|
||||
@@ -3133,6 +3152,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()
|
||||
@@ -3213,25 +3234,6 @@ void World::ResetDailyQuests()
|
||||
sPoolMgr->ChangeDailyQuests();
|
||||
}
|
||||
|
||||
void World::LoadDBAllowedSecurityLevel()
|
||||
{
|
||||
PreparedStatement* 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.");
|
||||
|
||||
@@ -524,11 +524,12 @@ enum RealmZone
|
||||
enum WorldStates
|
||||
{
|
||||
WS_ARENA_DISTRIBUTION_TIME = 20001, // Next arena distribution 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
|
||||
};
|
||||
|
||||
/// Storage class for commands issued for delayed execution
|
||||
|
||||
Reference in New Issue
Block a user