找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 74|回复: 0

魔兽世界Trinity-Core魔兽局域网单机中锁定账号,踢玩家,等世界公告

[复制链接]
发表于 2024-11-13 06:14:16 | 显示全部楼层 |阅读模式
魔兽世界Trinity-Core魔兽局域网单机中锁定账号,踢玩家,等世界公告
下面是适合用在T端的代码。这里介绍一下说明
代码分成3个部分。分别对应锁定账号,踢玩家下线,沉默 这几个功能。。
你把代码替换到你的内核中就可以使用了
  1. src/server/scripts/Commands/cs_ban.cpp  |  12 ++++++------src/server/scripts/Commands/cs_misc.cpp |  26 +++++++++++++-------------
  2. 2 files changed, 19 insertions(+), 19 deletions(-)

  3. diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
  4. index 1c0ffd4..1c152dd 100644
  5. --- a/src/server/scripts/Commands/cs_ban.cpp
  6. +++ b/src/server/scripts/Commands/cs_ban.cpp
  7. @@ -221,15 +221,15 @@ class ban_commandscript : public CommandScript
  8.           else if (mode == BAN_IP)
  9.                         announce = "The IP '";
  10.                     else
  11. -                    announce = "Account '";
  12. +                    announce = "Account ";  //第一部是
  13.                       announce += nameOrIP.c_str();
  14. -                    announce += "' was banned for ";
  15. +                    announce += " was banned for ";
  16.                       announce += durationStr;
  17. -                    announce += " by the character '";
  18. -                    announce += m_session->GetPlayerName();
  19. -                    announce += "'. The reason is: ";
  20. +                    announce += " by the character ";
  21. +                    announce +=  handler->GetSession()->GetPlayerName();
  22. +                    announce += ". The reason is: ";
  23.                       announce += reasonStr;
  24. -          HandleAnnounceCommand(announce.c_str());
  25. +                    sWorld->SendServerMessage(SERVER_MSG_STRING, announce.c_str());//这里进行世界公告
  26.         }

  27.         return true;
  28. diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp
  29. index 2082db1..76f208f 100644
  30. --- a/src/server/scripts/Commands/cs_misc.cpp
  31. +++ b/src/server/scripts/Commands/cs_misc.cpp
  32. @@ -932,12 +932,12 @@ class misc_commandscript : public CommandScript

  33.         if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
  34.         {
  35. -          announce = "The character '";
  36. +          announce = "The character ";   //这里是踢玩家下线进行世界公告的
  37.             announce += playerName.c_str();
  38. -          announce += "' was kicked by the character '";
  39. -          announce += m_session->GetPlayerName();
  40. -          announce += "'.";
  41. -          HandleAnnounceCommand(announce.c_str());
  42. +          announce += " was kicked by the character ";
  43. +          announce += handler->GetSession()->GetPlayerName();
  44. +          announce += ".";
  45. +          sWorld->SendServerMessage(SERVER_MSG_STRING, announce.c_str());//这里进行世界公告
  46.         }

  47.         return true;
  48. @@ -1794,8 +1794,8 @@ class misc_commandscript : public CommandScript

  49.         if(!muteReason)
  50.         {
  51. -            PSendSysMessage("You must enter a reason of mute");
  52. -            SetSentErrorMessage(true);
  53. +            handler->PSendSysMessage("You must enter a reason of mute");
  54. +            handler->SetSentErrorMessage(true);
  55.             return false;
  56.         }

  57. @@ -1843,15 +1843,15 @@ class misc_commandscript : public CommandScript

  58.         if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
  59.         {
  60. -            announce = "The character '";
  61. +            announce = "The character ";
  62.             announce += nameLink.c_str();
  63. -            announce += "' was muted for ";
  64. +            announce += " was muted for ";
  65.             announce += notSpeakTime;
  66. -            announce += " minutes by the character '";
  67. -            announce += m_session->GetPlayerName();
  68. -            announce += "'. The reason is: ";
  69. +            announce += " minutes by the character ";
  70. +            announce += handler->GetSession()->GetPlayerName();
  71. +            announce += ". The reason is: ";
  72.             announce += muteReasonStr.c_str();
  73. -            HandleAnnounceCommand(announce.c_str());
  74. +            sWorld->SendServerMessage(SERVER_MSG_STRING, announce.c_str());
  75.         }

  76.         return true;
复制代码

Archiver|手机版|小黑屋|网单游戏

GMT+8, 2026-11-6 15:31 , Processed in 0.040201 second(s), 15 queries .

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

快速回复 返回顶部 返回列表