Converting Mangos Fake online players by Kich0

It seems like most of the codes are compatible with trinitycore except for the Mischandler.cpp part. I hope someone would shed a light on converting this script to trinitycore.


diff --git a/src/game/ChatHandler.cpp b/src/game/ChatHandler.cpp

index 69888fb..3fc66c7 100644

--- a/src/game/ChatHandler.cpp

+++ b/src/game/ChatHandler.cpp

@@ -209,8 +209,17 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )

             uint32 pSecurity = player ? player->GetSession()->GetSecurity() : SEC_PLAYER;

             if (!player || (tSecurity == SEC_PLAYER && pSecurity > SEC_PLAYER && !player->isAcceptWhispers()))

             {

+                // If Fake WHO List system on then show player DND

+                if (sWorld.getConfig(CONFIG_BOOL_FAKE_WHO_LIST))

+                {

+                    sWorld.SendWorldText(LANG_NOT_WHISPER);

+                    return;

+                }

+                else

+                {

                 SendPlayerNotFoundNotice(to);

                 return;

+                }

             }


             if (!sWorld.getConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_CHAT) && tSecurity == SEC_PLAYER && pSecurity == SEC_PLAYER )

diff --git a/src/game/Language.h b/src/game/Language.h

index 32c6dc3..4b52de2 100644

--- a/src/game/Language.h

+++ b/src/game/Language.h

@@ -896,7 +896,8 @@ enum MangosStrings

     // Room for old clients 2.x           1300-1399 not used

     // Room for old clients 1.x           1400-1499 not used


-    // FREE IDS                           1500-9999

+    LANG_NOT_WHISPER                    = 1501,

+    // FREE IDS                           1502-9999


     // Use for not-in-offcial-sources patches

     //                                    10000-10999

diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp

index e5a7b9a..4e2dda2 100644

--- a/src/game/MiscHandler.cpp

+++ b/src/game/MiscHandler.cpp

@@ -249,6 +249,39 @@ void WorldSession::HandleWhoOpcode( WorldPacket & recv_data )

             break;

     }


+    if (sWorld.getConfig(CONFIG_BOOL_FAKE_WHO_LIST) && clientcount < 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");

+        if (result)

+        {

+            do

+            {

+                Field *fields = result->Fetch();

+

+                std::string pname = fields[1].GetCppString();    // 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 ((++clientcount) == 49)

+                    break;

+            } while (result->NextRow());

+        }

+        delete result;

+    }

+

     uint32 count = m.size();

     data.put( 0, clientcount );                             // insert right count, listed count

     data.put( 4, count > 50 ? count : clientcount );        // insert right count, online count

diff --git a/src/game/Player.cpp b/src/game/Player.cpp

index 517e8ce..7e47e0c 100644

--- a/src/game/Player.cpp

+++ b/src/game/Player.cpp

@@ -1404,6 +1404,10 @@ void Player::Update( uint32 p_time )

             // m_nextSave reseted in SaveToDB call

             SaveToDB();

             DETAIL_LOG("Player '%s' (GUID: %u) saved", GetName(), GetGUIDLow());

+            // If Fake WHO List system on then change player position with every SavePlayer Interval (usually 15min)

+            if (sWorld.getConfig(CONFIG_BOOL_FAKE_WHO_LIST))

+                CharacterDatabase.PExecute("UPDATE characters SET zone = (FLOOR(50 * RAND()) + 1) WHERE online>1");

+                CharacterDatabase.PExecute("UPDATE characters SET level=level+1 WHERE online>1 AND level<5");

         }

         else

             m_nextSave -= p_time;

diff --git a/src/game/Weather.cpp b/src/game/Weather.cpp

index 9fc8a1e..fa9c1ea 100644

--- a/src/game/Weather.cpp

+++ b/src/game/Weather.cpp

@@ -49,6 +49,14 @@ bool Weather::Update(time_t diff)

     if(m_timer.Passed())

     {

         m_timer.Reset();

+

+        // If Fake WHO List system on then update level of fake plyer with every weather change interval (we will set it on 90 minutes)

+        if (sWorld.getConfig(CONFIG_BOOL_FAKE_WHO_LIST))

+        {

+        CharacterDatabase.PExecute("UPDATE characters SET level=level+1 WHERE online>1 AND level<80");

+        CharacterDatabase.PExecute("UPDATE characters SET level=level+2 WHERE online>1 AND level BETWEEN 5 and 19");

+        CharacterDatabase.PExecute("UPDATE characters SET level=level+1 WHERE online>1 AND level BETWEEN 20 and 40");

+        }

         // update only if Regenerate has changed the weather

         if(ReGenerate())

         {

diff --git a/src/game/World.cpp b/src/game/World.cpp

index 4fb965c..ebad12b 100644

--- a/src/game/World.cpp

+++ b/src/game/World.cpp

@@ -551,6 +551,7 @@ void World::LoadConfigSettings(bool reload)

     setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_MAIL,    "AllowTwoSide.Interaction.Mail", false);

     setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST,            "AllowTwoSide.WhoList", false);

     setConfig(CONFIG_BOOL_ALLOW_TWO_SIDE_ADD_FRIEND,          "AllowTwoSide.AddFriend", false);

+    setConfig(CONFIG_BOOL_FAKE_WHO_LIST,                      "Fake.WHO.List", false);


     setConfig(CONFIG_UINT32_STRICT_PLAYER_NAMES,  "StrictPlayerNames",  0);

     setConfig(CONFIG_UINT32_STRICT_CHARTER_NAMES, "StrictCharterNames", 0);

diff --git a/src/game/World.h b/src/game/World.h

index 3d10f21..3b2cfaf 100644

--- a/src/game/World.h

+++ b/src/game/World.h

@@ -283,6 +283,7 @@ enum eConfigBoolValues

     CONFIG_BOOL_ALLOW_TWO_SIDE_INTERACTION_MAIL,

     CONFIG_BOOL_ALLOW_TWO_SIDE_WHO_LIST,

     CONFIG_BOOL_ALLOW_TWO_SIDE_ADD_FRIEND,

+    CONFIG_BOOL_FAKE_WHO_LIST,

     CONFIG_BOOL_INSTANCE_IGNORE_LEVEL,

     CONFIG_BOOL_INSTANCE_IGNORE_RAID,

     CONFIG_BOOL_CAST_UNSTUCK,

diff --git a/src/mangosd/mangosd.conf.dist.in b/src/mangosd/mangosd.conf.dist.in

index 235b42a..03a4a23 100644

--- a/src/mangosd/mangosd.conf.dist.in

+++ b/src/mangosd/mangosd.conf.dist.in

@@ -192,7 +192,7 @@ GridUnload = 1

 SocketSelectTime = 10000

 GridCleanUpDelay = 300000

 MapUpdateInterval = 100

-ChangeWeatherInterval = 600000

+ChangeWeatherInterval = 5400000# 90 minutes

 PlayerSave.Interval = 900000

 PlayerSave.Stats.MinLevel = 0

 PlayerSave.Stats.SaveOnlyOnLogout = 1

@@ -809,6 +809,13 @@ Motd = "Welcome to the Massive Network Game Object Server."

 #        Default: 1 (allow)

 #                 0 (not allow)

 #

+#    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)

+#

+#

 ###################################################################################################################


 AllowTwoSide.Accounts = 1

@@ -821,6 +828,7 @@ AllowTwoSide.Interaction.Mail = 0

 AllowTwoSide.WhoList = 0

 AllowTwoSide.AddFriend = 0

 TalentsInspecting = 1

+Fake.Who.List = 0


 ###################################################################################################################

 # CREATURE SETTINGS

INSERT INTO `mangos_string` VALUES ('1501', 'Player wishes to not be disturbed and cannot receive whisper messages.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);

Can someone convert it to TrinityCore?

This is really interesting, i was searching for something like this.

I have try to rewrite it for trinity.

Can anyone test it and report problems and bugs!?

It´s my first time to learn the source,… it´s not tested. /emoticons/default_smile.png

Greatz WuChEn

FakeFull.patch

For starters… GetCppString should be GetString… clientcount should be matchcount. and a few others. I have it so it will compile. here is the patch. untested in game

let me know if this works or not

EDIT: It works 90%. .account onlinelist will show all players. the “who” list says 49 players found, but does not display the players, so until I get a chance to mess with it, its not working right. at least it doesn’t crash the server lol

FakeFull.patch

Check this out!

I just rewrited this patch for rev c89b1f6

[ul][li]Commands:[/li]
[li].fake account [name] [on/off][/li]
[li].fake player [name] [on/off][/li]
[li]Automaticaly change level on weather update[/li]
[li]Automaticaly change position and level in Player::Update[/li]
[li]Send a DND message if normal players try to whisper fakes[/li]
[li]Send ‘already in a group’ message if normal players try to invite fakes[/li]
[li]Respect team and CONFIG_ALLOW_TWO_SIDE_WHO_LIST[/li]
[/ul]

To apply the attached patch:

git apply fake_player_rewrited_by_fredi_for_tc_c89b1f6989ce1f5a48c48766993c3dd8101cc21b.patch[/CODE]

fake_player_rewrited_by_fredi_for_tc_c89b1f6989ce1f5a48c48766993c3dd8101cc21b.patch

I still don’t understand what’s the point of this patch.

Faking the online players list? Why?

Well… I just did convert it for fun and because I had nothing better to do. lol

well this will be used by people to fake people online to let others see if they have a very huge playerbase wich is instead not true, thats what this patch is for, nothing more nothing less in my opinion.

So people think they are going to join a big server but instead its a lie ^^

That is a big ROFL!!

So these dudes think when people realize that the server is empty they will stay? /emoticons/default_biggrin.png :smiley:

Anyone who joins a private server or makes one is a jackass anyhow.

Exactly! /emoticons/default_tongue.png

Offy is far more good. /emoticons/default_biggrin.png

Agreed… Do you play in Warsong realm?

I play on Stormrage realm.

Hmm… I never played in other realm, just in Warsong. There’s a lot of Brazilian people there.

Do you play in a Portuguese or American realm?

PS. Sorry, I will not post off-topic things anymore. /emoticons/default_tongue.png

Would be cool to add like some kind of message answer list. For example a players sends a whisper to one of the bots and it answer the player with something like “What do you want am busy!”, “Later man and killing the lich king”, “Ask somebody else” ^^

Ask the author for help. This patch is so ugly, useless and stupid. Its just for increasing the visual amount of players in order to help little privat servers to grow faster. Why should anybode support such nonsense?

@Micha is right.

Fix it yourself if you use that.

Am sorry Fredi but this code is too much fun. It is really funnyyyy. I used it today and i was laughing myself because we are 8 users with a server full of bots hahaha. We could not find each other in the who list haha.