Core/Chat: Custom channel preservation rewrite. Channel data is now loaded at startup, and written to the DB periodically, instead of both things happening in real time.

Port From (https://github.com/TrinityCore/TrinityCore/commit/8839fa3fe24e72e4506e94389663b82ab2292649)
This commit is contained in:
hondacrx
2022-01-02 13:44:00 -05:00
parent 4c0eb3f2e2
commit 75d3497d38
7 changed files with 142 additions and 87 deletions
+4 -2
View File
@@ -887,11 +887,12 @@ namespace Framework.Constants
public enum WorldStates
{
CurrencyResetTime = 20001, // Next currency reset time
WeeklyQuestResetTime = 20002, // Next weekly reset time
WeeklyQuestResetTime = 20002, // Next weekly quest reset time
BGDailyResetTime = 20003, // Next daily BG reset time
CleaningFlags = 20004, // Cleaning Flags
GuildDailyResetTime = 20006, // Next guild cap reset time
MonthlyQuestResetTime = 20007, // Next monthly reset time
MonthlyQuestResetTime = 20007, // Next monthly quest reset time
DailyQuestResetTime = 2008, // Next daily quest reset time
// Cata specific custom worldstates
GuildWeeklyResetTime = 20050, // Next guild week reset time
}
@@ -1575,6 +1576,7 @@ namespace Framework.Constants
PortInstance,
PortWorld,
PreserveCustomChannelDuration,
PreserveCustomChannelInterval,
PreserveCustomChannels,
PreventRenameCustomization,
PvpTokenCount,
@@ -318,11 +318,11 @@ namespace Framework.Database
" ON DUPLICATE KEY UPDATE LogGuid = VALUES (LogGuid), EventType = VALUES (EventType), PlayerGuid = VALUES (PlayerGuid), Flags = VALUES (Flags), Value = VALUES (Value), Timestamp = VALUES (Timestamp)");
// Chat channel handling
PrepareStatement(CharStatements.SEL_CHANNEL, "SELECT name, announce, ownership, password, bannedList FROM channels WHERE name = ? AND team = ?");
PrepareStatement(CharStatements.INS_CHANNEL, "INSERT INTO channels(name, team, lastUsed) VALUES (?, ?, UNIX_TIMESTAMP())");
PrepareStatement(CharStatements.UPD_CHANNEL, "UPDATE channels SET announce = ?, ownership = ?, password = ?, bannedList = ?, lastUsed = UNIX_TIMESTAMP() WHERE name = ? AND team = ?");
PrepareStatement(CharStatements.UPD_CHANNEL, "INSERT INTO channels (name, team, announce, ownership, password, bannedList, lastUsed) VALUES (?, ?, ?, ?, ?, ?, UNIX_TIMESTAMP()) " +
"ON DUPLICATE KEY UPDATE announce=VALUES(announce), ownership=VALUES(ownership), password=VALUES(password), bannedList=VALUES(bannedList), lastUsed=VALUES(lastUsed)");
PrepareStatement(CharStatements.UPD_CHANNEL_USAGE, "UPDATE channels SET lastUsed = UNIX_TIMESTAMP() WHERE name = ? AND team = ?");
PrepareStatement(CharStatements.UPD_CHANNEL_OWNERSHIP, "UPDATE channels SET ownership = ? WHERE name LIKE ?");
PrepareStatement(CharStatements.DEL_CHANNEL, "DELETE FROM channels WHERE name = ? AND team = ?");
PrepareStatement(CharStatements.DEL_OLD_CHANNELS, "DELETE FROM channels WHERE ownership = 1 AND lastUsed + ? < UNIX_TIMESTAMP()");
// Equipmentsets
@@ -1020,11 +1020,10 @@ namespace Framework.Database
SEL_GUILD_ACHIEVEMENT_CRITERIA,
INS_GUILD_NEWS,
SEL_CHANNEL,
INS_CHANNEL,
UPD_CHANNEL,
UPD_CHANNEL_USAGE,
UPD_CHANNEL_OWNERSHIP,
DEL_CHANNEL,
DEL_OLD_CHANNELS,
UPD_EQUIP_SET,