吾爱尚玩资源基地

标题: Trinity-Core魔兽私服单机中锁定账号,踢玩家,等世界公告 [打印本页]

作者: admin    时间: 2016-4-24 17:28
标题: Trinity-Core魔兽私服单机中锁定账号,踢玩家,等世界公告
下面是适合用在T端的代码。这里介绍一下说明

代码分成3个部分。分别对应锁定账号,踢玩家下线,沉默 这几个功能。。

你把代码替换到你的内核中就可以使用了

src/server/scripts/Commands/cs_ban.cpp  |  12 ++++++------src/server/scripts/Commands/cs_misc.cpp |  26 +++++++++++++-------------
2 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/src/server/scripts/Commands/cs_ban.cpp b/src/server/scripts/Commands/cs_ban.cpp
index 1c0ffd4..1c152dd 100644
--- a/src/server/scripts/Commands/cs_ban.cpp
+++ b/src/server/scripts/Commands/cs_ban.cpp
@@ -221,15 +221,15 @@ class ban_commandscript : public CommandScript
          else if (mode == BAN_IP)
                        announce = "The IP '";
                    else
-                    announce = "Account '";
+                    announce = "Account ";  //第一部是
                      announce += nameOrIP.c_str();
-                    announce += "' was banned for ";
+                    announce += " was banned for ";
                      announce += durationStr;
-                    announce += " by the character '";
-                    announce += m_session->GetPlayerName();
-                    announce += "'. The reason is: ";
+                    announce += " by the character ";
+                    announce +=  handler->GetSession()->GetPlayerName();
+                    announce += ". The reason is: ";
                      announce += reasonStr;
-          HandleAnnounceCommand(announce.c_str());
+                    sWorld->SendServerMessage(SERVER_MSG_STRING, announce.c_str());//这里进行世界公告
        }

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

        if (sWorld->getBoolConfig(CONFIG_SHOW_KICK_IN_WORLD))
        {
-          announce = "The character '";
+          announce = "The character ";   //这里是踢玩家下线进行世界公告的
            announce += playerName.c_str();
-          announce += "' was kicked by the character '";
-          announce += m_session->GetPlayerName();
-          announce += "'.";
-          HandleAnnounceCommand(announce.c_str());
+          announce += " was kicked by the character ";
+          announce += handler->GetSession()->GetPlayerName();
+          announce += ".";
+          sWorld->SendServerMessage(SERVER_MSG_STRING, announce.c_str());//这里进行世界公告
        }

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

        if(!muteReason)
        {
-            PSendSysMessage("You must enter a reason of mute");
-            SetSentErrorMessage(true);
+            handler->PSendSysMessage("You must enter a reason of mute");
+            handler->SetSentErrorMessage(true);
            return false;
        }

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

        if (sWorld->getBoolConfig(CONFIG_SHOW_MUTE_IN_WORLD))
        {
-            announce = "The character '";
+            announce = "The character ";
            announce += nameLink.c_str();
-            announce += "' was muted for ";
+            announce += " was muted for ";
            announce += notSpeakTime;
-            announce += " minutes by the character '";
-            announce += m_session->GetPlayerName();
-            announce += "'. The reason is: ";
+            announce += " minutes by the character ";
+            announce += handler->GetSession()->GetPlayerName();
+            announce += ". The reason is: ";
            announce += muteReasonStr.c_str();
-            HandleAnnounceCommand(announce.c_str());
+            sWorld->SendServerMessage(SERVER_MSG_STRING, announce.c_str());
        }

        return true;






欢迎光临 吾爱尚玩资源基地 (http://bbs.523play.com/) Powered by Discuz! X3.4