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>
This commit is contained in:
Exitare
2024-12-15 10:50:02 -08:00
committed by GitHub
parent 7732e1a5b2
commit 7fd8b04a56
15 changed files with 267 additions and 82 deletions

View File

@@ -39,9 +39,9 @@ void ScriptMgr::OnBeforeConfigLoad(bool reload)
CALL_ENABLED_HOOKS(WorldScript, WORLDHOOK_ON_BEFORE_CONFIG_LOAD, script->OnBeforeConfigLoad(reload));
}
void ScriptMgr::OnMotdChange(std::string& newMotd)
void ScriptMgr::OnMotdChange(std::string& newMotd, LocaleConstant& locale)
{
CALL_ENABLED_HOOKS(WorldScript, WORLDHOOK_ON_MOTD_CHANGE, script->OnMotdChange(newMotd));
CALL_ENABLED_HOOKS(WorldScript, WORLDHOOK_ON_MOTD_CHANGE, script->OnMotdChange(newMotd, locale));
}
void ScriptMgr::OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask)

View File

@@ -18,6 +18,7 @@
#ifndef SCRIPT_OBJECT_WORLD_SCRIPT_H_
#define SCRIPT_OBJECT_WORLD_SCRIPT_H_
#include "Common.h"
#include "ScriptObject.h"
#include <vector>
@@ -58,7 +59,7 @@ public:
virtual void OnBeforeConfigLoad(bool /*reload*/) { }
// Called before the message of the day is changed.
virtual void OnMotdChange(std::string& /*newMotd*/) { }
virtual void OnMotdChange(std::string& /*newMotd*/, LocaleConstant& /*locale*/) { }
// Called when a world shutdown is initiated.
virtual void OnShutdownInitiate(ShutdownExitCode /*code*/, ShutdownMask /*mask*/) { }

View File

@@ -166,7 +166,7 @@ public: /* WorldScript */
void OnBeforeConfigLoad(bool reload);
void OnAfterConfigLoad(bool reload);
void OnBeforeFinalizePlayerWorldSession(uint32& cacheVersion);
void OnMotdChange(std::string& newMotd);
void OnMotdChange(std::string& newMotd, LocaleConstant& locale);
void OnShutdownInitiate(ShutdownExitCode code, ShutdownMask mask);
void OnShutdownCancel();
void OnWorldUpdate(uint32 diff);