summaryrefslogtreecommitdiff
path: root/src/server/database/Database/Implementation
diff options
context:
space:
mode:
authorExitare <Exitare@users.noreply.github.com>2024-12-15 10:50:02 -0800
committerGitHub <noreply@github.com>2024-12-15 19:50:02 +0100
commit7fd8b04a564be4f9f5cebfaf9fa7e261de0733ac (patch)
treef52fe2dafd1b846863aedcc0eaf89af2369c6bb2 /src/server/database/Database/Implementation
parent7732e1a5b2b383ff6905fd13e7ede5a697fe7647 (diff)
feat(Core/Motd): Allow localized motd (#20542)
* Initial commit for localized motd * Rename function that created world packages * Update to satisfy code check * Update code to accomodate localized motd * Update command to support multiple optionales & adjusted db * Code cleanup * Update sql name * Fix codestyle issues * Remove hardcoded schema * Add check for valid player in reload command * Update to better code style * Add missing include * Fix redundant code usage * Add missing include * Remove sql files and create new rev sql files * Address minor code reviews * Fix code style * Update code to address code revisions. - Remove two unused functions - Remove map - Use available function to resolve LocaleConstant * Fix code style * Add check for base motd and update locale to DEFAULT_LOCALE * Code docs * Removed some docs, readd defaultd motd formatting * Fix oversight in variable declaration * Code style fix * Update code based on code review * ready for merge * Fix set motd command due to changes to DEFAULT_LOCALE * Fix CI * Fix trailing whitespace --------- Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
Diffstat (limited to 'src/server/database/Database/Implementation')
-rw-r--r--src/server/database/Database/Implementation/LoginDatabase.cpp4
-rw-r--r--src/server/database/Database/Implementation/LoginDatabase.h4
2 files changed, 6 insertions, 2 deletions
diff --git a/src/server/database/Database/Implementation/LoginDatabase.cpp b/src/server/database/Database/Implementation/LoginDatabase.cpp
index 79559524fd..51eb7d8ec1 100644
--- a/src/server/database/Database/Implementation/LoginDatabase.cpp
+++ b/src/server/database/Database/Implementation/LoginDatabase.cpp
@@ -116,7 +116,9 @@ void LoginDatabaseConnection::DoPrepareStatements()
PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
PrepareStatement(LOGIN_SEL_MOTD, "SELECT text FROM motd WHERE realmid = ? OR realmid = -1 ORDER BY realmid DESC", CONNECTION_SYNCH);
- PrepareStatement(LOGIN_REP_MOTD, "REPLACE INTO motd (realmid, text) VALUES (?, ?)", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_SEL_MOTD_LOCALE, "SELECT locale, text FROM motd_localized WHERE realmid = ? OR realmid = -1 ORDER BY realmid DESC", CONNECTION_SYNCH);
+ PrepareStatement(LOGIN_INS_MOTD, "INSERT INTO motd (realmid, text) VALUES (?, ?) ON DUPLICATE KEY UPDATE text = ?", CONNECTION_ASYNC);
+ PrepareStatement(LOGIN_INS_MOTD_LOCALE, "INSERT INTO motd_localized (realmid, locale, text) VALUES(?, ?, ?) ON DUPLICATE KEY UPDATE text = ?;", CONNECTION_ASYNC);
PrepareStatement(LOGIN_INS_ACCOUNT_MUTE, "INSERT INTO account_muted VALUES (?, UNIX_TIMESTAMP(), ?, ?, ?)", CONNECTION_ASYNC);
PrepareStatement(LOGIN_SEL_ACCOUNT_MUTE_INFO, "SELECT mutedate, mutetime, mutereason, mutedby FROM account_muted WHERE guid = ? ORDER BY mutedate ASC", CONNECTION_SYNCH);
PrepareStatement(LOGIN_DEL_ACCOUNT_MUTED, "DELETE FROM account_muted WHERE guid = ?", CONNECTION_ASYNC);
diff --git a/src/server/database/Database/Implementation/LoginDatabase.h b/src/server/database/Database/Implementation/LoginDatabase.h
index 713dc3b07c..f6791ac801 100644
--- a/src/server/database/Database/Implementation/LoginDatabase.h
+++ b/src/server/database/Database/Implementation/LoginDatabase.h
@@ -98,7 +98,9 @@ enum LoginDatabaseStatements : uint32
LOGIN_DEL_ACCOUNT,
LOGIN_SEL_AUTOBROADCAST,
LOGIN_SEL_MOTD,
- LOGIN_REP_MOTD,
+ LOGIN_SEL_MOTD_LOCALE,
+ LOGIN_INS_MOTD,
+ LOGIN_INS_MOTD_LOCALE,
LOGIN_SEL_LAST_ATTEMPT_IP,
LOGIN_SEL_LAST_IP,
LOGIN_INS_ALDL_IP_LOGGING,