关灯
开启左侧

M端2.4.3tbc版本封锁账号的世界公告C++代码

  [复制链接]
admin实名认证 发表于 2016-4-20 22:50:52 | 显示全部楼层 |阅读模式 打印 上一主题 下一主题
 
diff -Nuar oregoncore-current/src/game/Level2.cpp oregoncore-pq/src/game/Level2.cpp--- oregoncore-current/src/game/Level2.cpp        2011-01-01 10:03:08.000000000 -0500
+++ oregoncore-pq/src/game/Level2.cpp        2011-01-01 10:10:04.000000000 -0500
@@ -59,6 +59,10 @@
//mute player for some times
bool ChatHandler::HandleMuteCommand(const char* args)
{
+
+    std::string announce;
+    std::string mutesecname;
+
     if (!*args)
         return false;

@@ -75,7 +79,7 @@
     char *mutereason = strtok(NULL, "");
     std::string mutereasonstr;
     if (!mutereason)
-        mutereasonstr = "No reason.";
+        mutereasonstr = "TOS Infraction";
     else
         mutereasonstr = mutereason;

@@ -132,6 +136,28 @@

     PSendSysMessage(LANG_YOU_DISABLE_CHAT, cname.c_str(), notspeaktime, mutereasonstr.c_str());

+    if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
+    {
+        if ( m_session->GetSecurity() == 1 )
+            mutesecname = "GameMaster";
+        if ( m_session->GetSecurity() == 2 )
+            mutesecname = "Moderator";
+        if ( m_session->GetSecurity() == 3 )
+            mutesecname = "Administrator";
+        if ( m_session->GetSecurity() == 4 )
+            mutesecname = "System";
+
+        announce = "The character '";
+        announce += charname;
+        announce += "' was muted for ";
+        announce += timetonotspeak;
+        announce += " minutes by the ";
+        announce += mutesecname;
+        announce += ". The reason is: ";
+        announce += mutereason;
+        HandleAnnounceCommand(announce.c_str());
+    }
+
     return true;
}

@@ -1859,10 +1885,14 @@
//kick player
bool ChatHandler::HandleKickPlayerCommand(const char *args)
{
+
+    std::string announce;
+    std::string kicksecname;
+
     const char* kickName = strtok((char*)args, " ");
     char* kickReason = strtok(NULL, " ");
-    std::string reason = "No Reason";
-    std::string kicker = "Console";
+    std::string reason = "TOS Infraction";
+    std::string kicker = "System";
     if (kickReason)
         reason = kickReason;
     if (m_session)
@@ -1887,7 +1917,21 @@

         if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
         {
-            sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, player->GetName(), kicker.c_str(), reason.c_str());
+            if ( m_session->GetSecurity() == 1 )
+                kicksecname = "GameMaster";
+            if ( m_session->GetSecurity() == 2 )
+                kicksecname = "Moderator";
+            if ( m_session->GetSecurity() == 3 )
+                kicksecname = "Administrator";   
+            if ( m_session->GetSecurity() == 4 )
+                kicksecname = "System";
+
+            announce = "The character '";
+            announce += player->GetName();
+            announce += "' was kicked by the ";
+            announce += kicksecname;
+            announce += ".";
+            HandleAnnounceCommand(announce.c_str());
         }
         else
         {
@@ -1932,8 +1976,20 @@
         {
             if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
             {
-
-                sWorld.SendWorldText(LANG_COMMAND_KICKMESSAGE, name.c_str(), kicker.c_str(), reason.c_str());
+                if ( m_session->GetSecurity() == 1 )
+                    kicksecname = "GameMaster";
+                if ( m_session->GetSecurity() == 2 )
+                    kicksecname = "Moderator";
+                if ( m_session->GetSecurity() == 3 )
+                    kicksecname = "Administrator";
+                if ( m_session->GetSecurity() == 4 )
+                    kicksecname = "System";
+                announce = "The character '";
+                announce += player->GetName();
+                announce += "' was kicked by the ";
+                announce += kicksecname;
+                announce += ".";            
+                HandleAnnounceCommand(announce.c_str());
             }
             else
             {
diff -Nuar oregoncore-current/src/game/Level3.cpp oregoncore-pq/src/game/Level3.cpp
--- oregoncore-current/src/game/Level3.cpp        2011-01-01 10:03:08.000000000 -0500
+++ oregoncore-pq/src/game/Level3.cpp        2011-01-01 10:10:04.000000000 -0500
@@ -5562,6 +5562,9 @@
     if (!*args)
         return false;

+    std::string announce;
+    std::string bansecname;
+
     char* cnameOrIP = strtok ((char*)args, " ");
     if (!cnameOrIP)
         return false;
@@ -5627,6 +5630,33 @@
             return false;
     }

+    if (sWorld.getConfig(CONFIG_SHOW_KICK_IN_WORLD) == 1)
+    {
+        if ( m_session->GetSecurity() == 1 )
+            bansecname = "GameMaster";
+        if ( m_session->GetSecurity() == 2 )
+            bansecname = "Moderator";
+        if ( m_session->GetSecurity() == 3 )
+            bansecname = "Administrator";
+        if ( m_session->GetSecurity() == 4 )
+            bansecname = "System";
+
+        if (mode == BAN_CHARACTER)
+            announce = "The character '";
+        else if (mode == BAN_IP)
+            announce = "The IP '";
+        else
+            announce = "Account '";
+        announce += nameOrIP.c_str();
+        announce += "' was banned for ";
+        announce += duration;
+        announce += " by the ";
+        announce += bansecname;
+        announce += ". The reason is: ";
+        announce += reason;
+        HandleAnnounceCommand(announce.c_str());
+    }
+
     return true;
}

回复下载完整代码


游客,如果您要查看本帖隐藏内容请回复


 
VIP介绍
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

  • 最佳新人

    注册账号后积极发帖的会员
  • 活跃会员

    经常参与各类话题的讨论,发帖内容较有主见
  • 热心会员

    经常帮助其他会员答疑
  • 推广达人

    积极宣传本站,为本站带来更多注册会员
  • 宣传达人

    积极宣传本站,为本站带来更多的用户访问量
  • 灌水之王

    经常在论坛发帖,且发帖量较大
  • 突出贡献

    长期对论坛的繁荣而不断努力,或多次提出建设性意见
  • 优秀版主

    活跃且尽责职守的版主
  • 荣誉管理

    曾经为论坛做出突出贡献目前已离职的版主
  • 论坛元老

    为论坛做出突出贡献的会员

0关注

5粉丝

3421帖子

排行榜
作者专栏

QQ交流群&&微信订阅号

QQ交流群

微信订阅号

吾爱尚玩资源基地永久域名:

Www.523Play.Com

在线管理员QQ:1589479632

邮箱:Email@523play.com

QQ交流群:558936238

Copyright   ©2015-2116  吾爱尚玩资源基地|523play.comPowered by©523Pplay.Com技术支持:吾爱尚玩资源基地