Core/DB: Add a world state for daily quest reset time to characters. Not used right now, but written to allow easier transition later.
Port From (https://github.com/TrinityCore/TrinityCore/commit/9fa5c714096a9755a3a7ada45c8d5e6a54f18950)
This commit is contained in:
@@ -80,6 +80,25 @@ namespace Game
|
||||
Global.ScriptMgr.OnOpenStateChange(!val);
|
||||
}
|
||||
|
||||
void LoadDBAllowedSecurityLevel()
|
||||
{
|
||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_REALMLIST_SECURITY_LEVEL);
|
||||
stmt.AddValue(0, (int)_realm.Id.Index);
|
||||
SQLResult result = DB.Login.Query(stmt);
|
||||
|
||||
if (!result.IsEmpty())
|
||||
SetPlayerSecurityLimit((AccountTypes)result.Read<byte>(0));
|
||||
}
|
||||
|
||||
void SetPlayerSecurityLimit(AccountTypes _sec)
|
||||
{
|
||||
AccountTypes sec = _sec < AccountTypes.Console ? _sec : AccountTypes.Player;
|
||||
bool update = sec > m_allowedSecurityLevel;
|
||||
m_allowedSecurityLevel = sec;
|
||||
if (update)
|
||||
KickAllLess(m_allowedSecurityLevel);
|
||||
}
|
||||
|
||||
public void SetMotd(string motd)
|
||||
{
|
||||
Global.ScriptMgr.OnMotdChange(motd);
|
||||
@@ -1979,6 +1998,8 @@ namespace Game
|
||||
m_NextDailyQuestReset = mostRecentQuestTime;
|
||||
else // plan next reset time
|
||||
m_NextDailyQuestReset = (curTime >= curDayResetTime) ? curDayResetTime + Time.Day : curDayResetTime;
|
||||
|
||||
SetWorldState(WorldStates.DailyQuestResetTime, (ulong)m_NextDailyQuestReset);
|
||||
}
|
||||
|
||||
void InitMonthlyQuestResetTime()
|
||||
@@ -2083,25 +2104,6 @@ namespace Game
|
||||
SetWorldState(WorldStates.CurrencyResetTime, (ulong)m_NextCurrencyReset);
|
||||
}
|
||||
|
||||
public void LoadDBAllowedSecurityLevel()
|
||||
{
|
||||
PreparedStatement stmt = DB.Login.GetPreparedStatement(LoginStatements.SEL_REALMLIST_SECURITY_LEVEL);
|
||||
stmt.AddValue(0, _realm.Id.Index);
|
||||
SQLResult result = DB.Login.Query(stmt);
|
||||
|
||||
if (!result.IsEmpty())
|
||||
SetPlayerSecurityLimit((AccountTypes)result.Read<byte>(0));
|
||||
}
|
||||
|
||||
public void SetPlayerSecurityLimit(AccountTypes accountType)
|
||||
{
|
||||
AccountTypes security = accountType < AccountTypes.Console ? accountType : AccountTypes.Player;
|
||||
bool update = security > m_allowedSecurityLevel;
|
||||
m_allowedSecurityLevel = security;
|
||||
if (update)
|
||||
KickAllLess(m_allowedSecurityLevel);
|
||||
}
|
||||
|
||||
void ResetWeeklyQuests()
|
||||
{
|
||||
Log.outInfo(LogFilter.Server, "Weekly quests reset for all characters.");
|
||||
|
||||
@@ -357,7 +357,7 @@ CREATE TABLE `channels` (
|
||||
`team` int(10) unsigned NOT NULL,
|
||||
`announce` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||
`ownership` tinyint(3) unsigned NOT NULL DEFAULT '1',
|
||||
`password` varchar(32) DEFAULT NULL,
|
||||
`password` varchar(128) DEFAULT NULL,
|
||||
`bannedList` text,
|
||||
`lastUsed` bigint(20) unsigned NOT NULL,
|
||||
PRIMARY KEY (`name`,`team`)
|
||||
@@ -3650,7 +3650,9 @@ 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),
|
||||
('2021_12_23_00_characters.sql','7F2BD7CA61CD28D74AD9CA9F06FD7E542837ED3F','RELEASED','2021-12-23 19:16:29',0);
|
||||
/*!40000 ALTER TABLE `updates` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
@@ -3732,7 +3734,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');
|
||||
Reference in New Issue
Block a user