T端带数据库查询的假人系统

T端带数据库查询的假人系统
commit 87f8ac21ca6d2d086984dfc39b1869dc51ecd36f
Author: Vitasic <vitasic_pokataev@yandex.ru>
Date:   Tue Jun 26 15:43:38 2012 +0400

    Add Fake Players

diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp
index 966eae5..3f4e3fb 100755
--- a/src/server/game/Handlers/ChatHandler.cpp
+++ b/src/server/game/Handlers/ChatHandler.cpp
@@ -274,8 +274,17 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data)
             bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER);
             if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID())))
             {
+                // If Fake WHO List system on then show player DND 
+                if (sWorld->getBoolConfig(CONFIG_FAKE_WHO_LIST)) 
+                { 
+                    sWorld->SendWorldText(LANG_NOT_WHISPER); 
+                    return; 
+                } 
+                else 
+                { 
                 SendPlayerNotFoundNotice(to);
                 return;
+                }
             }
 
             if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer)
diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp
index 11f0857..dfc4b6a 100755
--- a/src/server/game/Handlers/MiscHandler.cpp
+++ b/src/server/game/Handlers/MiscHandler.cpp
@@ -356,8 +356,40 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
 
         ++displaycount;
     }
-
-    data.put(0, displaycount);                            // insert right count, count displayed
+    
+    if (sWorld->getBoolConfig(CONFIG_FAKE_WHO_LIST) && displaycount < 49) 
+    { 
+        // Fake players on WHO LIST                            0,   1,    2,   3,    4,   5     6 
+        QueryResult result = CharacterDatabase.Query("SELECT guid,name,race,class,level,zone,gender FROM characters WHERE online>1 AND level > 3"); 
+        if (result) 
+        { 
+            do 
+            { 
+                Field *fields = result->Fetch(); 
+ 
+                std::string pname = fields[1].GetString();    // player name 
+                std::string gname;                                // guild name 
+                uint32 lvl = fields[4].GetUInt32();                // player level 
+                uint32 class_ = fields[3].GetUInt32();            // player class 
+                uint32 race = fields[2].GetUInt32();            // player race 
+                uint32 pzoneid = fields[5].GetUInt32();            // player zone id 
+                uint8 gender = fields[6].GetUInt8();            // player gender 
+ 
+                data << pname;                              // player name 
+                data << gname;                              // guild name 
+                data << uint32(lvl);                        // player level 
+                data << uint32(class_);                     // player class 
+                data << uint32(race);                       // player race 
+                data << uint8(gender);                      // player gender 
+                data << uint32(pzoneid);                    // player zone id 
+ 
+                if ((++matchcount) == 49) 
+                    break; 
+            } while (result->NextRow()); 
+        } 
+    } 
+ 
+    data.put(0, matchcount);                            // insert right count, count displayed
     data.put(4, matchcount);                              // insert right count, count of matches
 
     SendPacket(&data);
diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp
index 8a6b4cd..518effd 100755
--- a/src/server/game/World/World.cpp
+++ b/src/server/game/World/World.cpp
@@ -667,6 +667,7 @@ void World::LoadConfigSettings(bool reload)
     m_bool_configs[CONFIG_ALLOW_TWO_SIDE_WHO_LIST]            = ConfigMgr::GetBoolDefault("AllowTwoSide.WhoList", false);
     m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND]          = ConfigMgr::GetBoolDefault("AllowTwoSide.AddFriend", false);
     m_bool_configs[CONFIG_ALLOW_TWO_SIDE_TRADE]               = ConfigMgr::GetBoolDefault("AllowTwoSide.trade", false);
+    m_bool_configs[CONFIG_FAKE_WHO_LIST]                      = ConfigMgr::GetBoolDefault("Fake.WHO.List", false);
     m_int_configs[CONFIG_STRICT_PLAYER_NAMES]                 = ConfigMgr::GetIntDefault ("StrictPlayerNames",  0);
     m_int_configs[CONFIG_STRICT_CHARTER_NAMES]                = ConfigMgr::GetIntDefault ("StrictCharterNames", 0);
     m_int_configs[CONFIG_STRICT_PET_NAMES]                    = ConfigMgr::GetIntDefault ("StrictPetNames",     0);
diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h
index f566ece..0d430bf 100755
--- a/src/server/game/World/World.h
+++ b/src/server/game/World/World.h
@@ -100,6 +100,7 @@ enum WorldBoolConfigs
     CONFIG_ALLOW_TWO_SIDE_WHO_LIST,
     CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND,
     CONFIG_ALLOW_TWO_SIDE_TRADE,
+    CONFIG_FAKE_WHO_LIST,
     CONFIG_ALL_TAXI_PATHS,
     CONFIG_INSTANT_TAXI,
     CONFIG_INSTANCE_IGNORE_LEVEL,
diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist
index 9f0ad53..40a04a1 100644
--- a/src/server/worldserver/worldserver.conf.dist
+++ b/src/server/worldserver/worldserver.conf.dist
@@ -1601,6 +1601,14 @@ AllowTwoSide.Trade = 0
 
 TalentsInspecting = 1
 
+#    Fake.WHO.List 
+#        Add fake players to fill in WHO LIST (who is online list, "O" button) if there is less then 
+#        49 real players online (need to set online=2 in character database in order to work) 
+#        Default: 0 (disabled) 
+#                 1 (enabled) 
+
+Fake.Who.List = 0 
+
 #
 ###################################################################################################
 
T端带数据库查询的假人系统

 

T端带数据库查询的假人系统,布布扣,bubuko.com

T端带数据库查询的假人系统

上一篇:【转】sql递归查询问题


下一篇:oracle 数据恢复,只有oradata文件夹里的文件,没有备份文件的数据库恢复,重装系统后,oracle 10g数据库恢复