吾爱尚玩资源基地

标题: T端的一个仿官方设置(GM登录的世界公告) [打印本页]

作者: admin    时间: 2016-4-20 23:06
标题: T端的一个仿官方设置(GM登录的世界公告)
这个是TRINTIY端的GM相关的代码。。可以作为参考使用,仅仅是一个载入命令


diff -r 3d55d9aa1fa9 -r 0dadcdc551ce src/server/game/Scripting/ScriptLoader.cpp--- a/src/server/game/Scripting/ScriptLoader.cpp        Fri Aug 17 17:00:39 2012 +0300
+++ b/src/server/game/Scripting/ScriptLoader.cpp        Sun Aug 19 12:39:03 2012 +0300
@@ -1252,6 +1252,7 @@
   void AddSC_arena_spectator_script();
   void AddSC_transmogrify_script();
   void AddSC_antikiller_system();
+  void AddSC_gm_login();

#endif

@@ -1263,6 +1264,7 @@
        AddSC_transmogrify_script();
          AddSC_arena_spectator_script();
        AddSC_antikiller_system();
+        AddSC_gm_login();

#endif
}
diff -r 3d55d9aa1fa9 -r 0dadcdc551ce src/server/game/World/World.cpp
--- a/src/server/game/World/World.cpp        Fri Aug 17 17:00:39 2012 +0300
+++ b/src/server/game/World/World.cpp        Sun Aug 19 12:39:03 2012 +0300
@@ -1228,6 +1228,10 @@
        m_bool_configs[CONFIG_ANTIKILLER_ENABLED] = ConfigMgr::GetBoolDefault("Antikiller.System.Enbled", true);
        m_int_configs[CONFIG_ANTIKILLER_LEVEL] = ConfigMgr::GetIntDefault("Antikiller.System.Level", 5);
        m_int_configs[CONFIG_ANTIKILLER_AURA] = ConfigMgr::GetIntDefault("Antikiller.System.Aura", 15007);       
+
+        //GM Login
+        m_bool_configs[CONFIG_GMLOGIN_ENABLED] = ConfigMgr::GetBoolDefault("Gm.Login.Enable", true);
+
       
     // damage checker  
     m_int_configs[CONFIG_DAMAGE_CHECKER_MAX_DAMAGE] = ConfigMgr::GetIntDefault("DamageChecker.MaxDamage", 50000);  
diff -r 3d55d9aa1fa9 -r 0dadcdc551ce src/server/game/World/World.h
--- a/src/server/game/World/World.h        Fri Aug 17 17:00:39 2012 +0300
+++ b/src/server/game/World/World.h        Sun Aug 19 12:39:03 2012 +0300
@@ -179,6 +179,7 @@
          CONFIG_VIP_EXCHANGE_ARENA_COMMAND,
          CONFIG_VIP_EXCHANGE_FROST_COMMAND,
     CONFIG_ANTIKILLER_ENABLED,
+        CONFIG_GMLOGIN_ENABLED,
     BOOL_CONFIG_VALUE_COUNT
};

diff -r 3d55d9aa1fa9 -r 0dadcdc551ce src/server/scripts/Custom/CMakeLists.txt
--- a/src/server/scripts/Custom/CMakeLists.txt        Fri Aug 17 17:00:39 2012 +0300
+++ b/src/server/scripts/Custom/CMakeLists.txt        Sun Aug 19 12:39:03 2012 +0300
@@ -13,6 +13,7 @@
   Custom/npc_transmogrify.cpp
   Custom/arena_spectator.cpp
   Custom/antikiller_system.cpp
+  Custom/gm_login.cpp
)

message("  -> Prepared: Custom")
diff -r 3d55d9aa1fa9 -r 0dadcdc551ce src/server/scripts/Custom/gm_login.cpp
--- /dev/null        Thu Jan 01 00:00:00 1970 +0000
+++ b/src/server/scripts/Custom/gm_login.cpp        Sun Aug 19 12:39:03 2012 +0300
@@ -0,0 +1,37 @@
+#include "ScriptPCH.h"
+#include "Config.h"
+
+class gm_login : public PlayerScript
+{
+public:
+        gm_login() : PlayerScript("gm_login") { }
+
+        void OnLogin(Player* player)
+        {
+                if (sWorld->getBoolConfig(CONFIG_GMLOGIN_ENABLED))
+                {
+                        if (player->GetSession()->GetSecurity() >= SEC_MODERATOR)
+                        {
+                                ChatHandler handler(player);
+                                uint16 gmlvl = player->GetSession()->GetSecurity();
+                                std::string gmname = player->GetName();
+                                uint32 playeronline = sWorld->GetPlayerCount();
+                                std::string uptime = secsToTimeString(sWorld->GetUptime());
+
+                                handler.PSendSysMessage("|cffff0000=================================|r");
+                                handler.PSendSysMessage("|cff00ff00名称,|r %s", gmname.c_str());
+                                handler.PSendSysMessage("|cff00ff00等级:|r %u", gmlvl);
+                                handler.PSendSysMessage("|cff00ff00在线|r %u |cff00ff00玩家数量|r", playeronline);
+                                handler.PSendSysMessage("|cff00ff00运行时间:|r %s", uptime.c_str());
+                                handler.PSendSysMessage("|cff00ff00GM上线了|r");
+                                handler.PSendSysMessage("|cffff0000=================================|r");
+                                return;
+                        }
+                }
+        }
+};
+
+void AddSC_gm_login()
+{
+        new gm_login();
+}
\ No newline at end of file

回复下载完整代码








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