aboutsummaryrefslogtreecommitdiff
path: root/src/server/scripts
diff options
context:
space:
mode:
authorCraftedRO <24683355+CraftedRO@users.noreply.github.com>2024-06-27 19:54:31 +0300
committerGitHub <noreply@github.com>2024-06-27 18:54:31 +0200
commitc5a9ab65af58c8642f914c31f327f09ca3a0ce0c (patch)
tree14d02252a2e0e9306cc9caa16a022c752d11cc5c /src/server/scripts
parent6c15d7f7502d50520b502067c6401a4bf11075a2 (diff)
Core/Players: Add level restrictions for faction changes (#30057)
Co-authored-by: Shauren <shauren.trinity@gmail.com>
Diffstat (limited to 'src/server/scripts')
-rw-r--r--src/server/scripts/Commands/cs_character.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp
index b8c175f0fa1..2633b8313a2 100644
--- a/src/server/scripts/Commands/cs_character.cpp
+++ b/src/server/scripts/Commands/cs_character.cpp
@@ -422,6 +422,24 @@ public:
if (!player)
return false;
+ CharacterCacheEntry const* characterInfo = sCharacterCache->GetCharacterCacheByGuid(player->GetGUID());
+ if (!characterInfo)
+ return false;
+
+ if (characterInfo->Level < 10)
+ {
+ handler->PSendSysMessage(LANG_CHANGEFACTION_NOT_ELIGIBLE_10);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
+ if (characterInfo->Class == CLASS_DEATH_KNIGHT && characterInfo->Level < 60)
+ {
+ handler->PSendSysMessage(LANG_CHANGEFACTION_NOT_ELIGIBLE_60);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+
if (Player* target = player->GetConnectedPlayer())
{
handler->PSendSysMessage(LANG_CUSTOMIZE_PLAYER, handler->GetNameLink(target).c_str());