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.
(cherry picked from commit 1277c54263)
This commit is contained in:
@@ -3650,7 +3650,8 @@ INSERT INTO `updates` VALUES
|
||||
('2021_11_02_00_characters.sql','A3C0A6DA70CC70803C80685E4E2ED6255156520A','ARCHIVED','2021-11-02 18:11:13',0),
|
||||
('2021_11_04_00_characters.sql','ED533235ADAD174F91A6B8E51D1046243B78B46D','ARCHIVED','2021-11-04 21:53:04',0),
|
||||
('2021_11_17_00_characters.sql','03A0AB8ECD8BE5D818D41A8A610097C94A9C7DB9','ARCHIVED','2021-11-17 13:23:17',0),
|
||||
('2021_12_16_00_characters_2019_07_14_00_characters.sql','DC1A3D3311FCF9106B4D91F8D2C5B893AD66C093','RELEASED','2021-12-16 01:06:53',0);
|
||||
('2021_12_16_00_characters_2019_07_14_00_characters.sql','DC1A3D3311FCF9106B4D91F8D2C5B893AD66C093','RELEASED','2021-12-16 01:06:53',0),
|
||||
('2021_12_16_01_characters_2019_07_16_00_characters.sql','76AE193EFA3129FA1702BF7B6FA7C4127B543BDF','RELEASED','2021-12-16 20:16:25',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -3732,7 +3733,10 @@ INSERT INTO `worldstates` VALUES
|
||||
(20001,0,'NextArenaPointDistributionTime'),
|
||||
(20002,0,'NextWeeklyQuestResetTime'),
|
||||
(20003,0,'NextBGRandomDailyResetTime'),
|
||||
(20004,0,'cleaning_flags');
|
||||
(20004,0,'cleaning_flags'),
|
||||
(20006,0,'NextGuildDailyResetTime'),
|
||||
(20007,0,'NextMonthlyQuestResetTime'),
|
||||
(20008,0,'NextDailyQuestResetTime');
|
||||
/*!40000 ALTER TABLE `worldstates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
|
||||
@@ -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');
|
||||
@@ -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.");
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user