How to limit who list search result ?

Hello friends

how can limit who list search result (just when player input somthing on wholist search) ?

for example if anyone search a and total amount is about 500 just show 49 or 50 and don’t show total found players . just displayed 45 .

Thanks

Edit this line : https://github.com/devil1234/TrinityCore/blob/master/src/server/worldserver/worldserver.conf.dist#L639 on your worldserver.conf

Thanks but I don’t want to change displayed results , in who list have two result number , for example : 543 People Found ( 50 displayed ) .

I want change " People Found results " to maximum 50 just when anyone search in who list .

changes must set on misc_handler.cpp but I don’t know where I must set a break line for greater than 50 number of result if anyone input a search string !!?

I never saw the point in why someone would open a server without even the slightest knowledge in this area… Can someone please enlighten me?

its a client side thing

as you can see in “HandleWhoOpcod”


// 49 is maximum player count sent to client

@discover , thanks for your help (my programming skill is is zero against you /emoticons/default_rolleyes.gif ) , I know how can break it , my exact problem is how can detect client is input a string on who-list ? , can help ? /emoticons/default_wink.png

Is in this line : https://github.com/T…andler.cpp#L217 ?

below is HandleWhoOpcod :


void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)

{

sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");

time_t now = time(NULL);

if (now - timeLastWhoCommand < 5)

	 return;

else timeLastWhoCommand = now;

uint32 matchcount = 0;

uint32 level_min, level_max, racemask, classmask, zones_count, str_count;

uint32 zoneids[10];									 // 10 is client limit

std::string player_name, guild_name;

recv_data >> level_min;								 // maximal player level, default 0

recv_data >> level_max;								 // minimal player level, default 100 (MAX_LEVEL)

recv_data >> player_name;							 // player name, case sensitive...

recv_data >> guild_name;							 // guild name, case sensitive...

recv_data >> racemask;								 // race mask

recv_data >> classmask;								 // class mask

recv_data >> zones_count;							 // zones count, client limit = 10 (2.0.10)

if (zones_count > 10)

	 return;											 // can't be received from real client or broken packet

for (uint32 i = 0; i < zones_count; ++i)

{

	 uint32 temp;

	 recv_data >> temp;								 // zone id, 0 if zone is unknown...

	 zoneids[i] = temp;

	 sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]);

}

recv_data >> str_count;								 // user entered strings count, client limit=4 (checked on 2.0.10)

if (str_count > 4)

	 return;											 // can't be received from real client or broken packet

sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count);

std::wstring str[4];								 // 4 is client limit

for (uint32 i = 0; i < str_count; ++i)

{

	 std::string temp;

	 recv_data >> temp;								 // user entered string, it used as universal search pattern(guild+player name)?

	 if (!Utf8toWStr(temp, str[i]))

		 continue;

	 wstrToLower(str[i]);

	 sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str());

}

std::wstring wplayer_name;

std::wstring wguild_name;

if (!(Utf8toWStr(player_name, wplayer_name) && Utf8toWStr(guild_name, wguild_name)))

	 return;

wstrToLower(wplayer_name);

wstrToLower(wguild_name);

// client send in case not set max level value 100 but Trinity supports 255 max level,

// update it to show GMs with characters after 100 level

if (level_max >= MAX_LEVEL)

	 level_max = STRONG_MAX_LEVEL;

uint32 team = _player->GetTeam();

uint32 security = GetSecurity();

bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);

uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);

uint32 displaycount = 0;

WorldPacket data(SMSG_WHO, 50);					 // guess size

data << uint32(matchcount);						 // placeholder, count of players matching criteria

data << uint32(displaycount);						 // placeholder, count of players displayed

TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());

HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();

for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)

{

	 if (AccountMgr::IsPlayerAccount(security))

	 {

		 // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST

		 if (itr->second->GetTeam() != team && !allowTwoSideWhoList)

			 continue;

		 // player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST

		 if ((itr->second->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList)))

			 continue;

	 }

	 //do not process players which are not in world

	 if (!(itr->second->IsInWorld()))

		 continue;

	 // check if target is globally visible for player

	 if (!(itr->second->IsVisibleGloballyFor(_player)))

		 continue;

	 // check if target's level is in level range

	 uint8 lvl = itr->second->getLevel();

	 if (lvl < level_min || lvl > level_max)

		 continue;

	 // check if class matches classmask

	 uint32 class_ = itr->second->getClass();

	 if (!(classmask & (1 << class_)))

		 continue;

	 // check if race matches racemask

	 uint32 race = itr->second->getRace();

	 if (!(racemask & (1 << race)))

		 continue;

	 uint32 pzoneid = itr->second->GetZoneId();

	 uint8 gender = itr->second->getGender();

	 bool z_show = true;

	 for (uint32 i = 0; i < zones_count; ++i)

	 {

		 if (zoneids[i] == pzoneid)

		 {

			 z_show = true;

			 break;

		 }

		 z_show = false;

	 }

	 if (!z_show)

		 continue;

	 std::string pname = itr->second->GetName();

	 std::wstring wpname;

	 if (!Utf8toWStr(pname, wpname))

		 continue;

	 wstrToLower(wpname);

	 if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))

		 continue;

	 std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId());

	 std::wstring wgname;

	 if (!Utf8toWStr(gname, wgname))

		 continue;

	 wstrToLower(wgname);

	 if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos))

		 continue;

	 std::string aname;

	 if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))

		 aname = areaEntry->area_name[GetSessionDbcLocale()];

	 bool s_show = true;

	 for (uint32 i = 0; i < str_count; ++i)

	 {

		 if (!str[i].empty())

		 {

			 if (wgname.find(str[i]) != std::wstring::npos ||

				 wpname.find(str[i]) != std::wstring::npos ||

				 Utf8FitTo(aname, str[i]))

			 {

				 s_show = true;

				 break;

			 }

			 s_show = false;

		 }

	 }

	 if (!s_show)

		 continue;

	 // 49 is maximum player count sent to client - can be overridden

	 // through config, but is unstable

	 if ((matchcount++) >= sWorld->getIntConfig(CONFIG_MAX_WHO))

		 continue;

	 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

	 ++displaycount;

}

data.put(0, displaycount);						 // insert right count, count displayed

data.put(4, matchcount);							 // insert right count, count of matches

SendPacket(&data);

sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message");

}

Thanks /emoticons/default_wink.png

data.put(0, displaycount); // insert right count, count displayed

data.put(4, matchcount); // insert right count, count of matches

I would say here…

Thanks paradox , I want limit [FONT=helvetica]matchcount[/FONT] just when player search something on wholist search input .

I’m waiting for your answer /emoticons/default_wink.png

Thanks

– EDIT –

is this true ?



    std::wstring str[4];                                    // 4 is client limit

    for (uint32 i = 0; i < str_count; ++i)

    {

        std::string temp;

        recv_data >> temp;                                  // user entered string, it used as universal search pattern(guild+player name)?


        if (!Utf8toWStr(temp, str[i]))

{



+           if(matchcount > 49)

+           {

+               break;

+            }

+           else

+           {

                 continue;

+           }


}



        wstrToLower(str[i]);
data.put(0, displaycount);                            // insert right count, count displayed

if (matchcoumt > 50)
    matchcount = 50;
data.put(4, matchcount);                              // insert right count, count of matches[/CODE]

Thanks , Nay

with this edit , every time matchcount (total found players is leave on 50)

I want set matchcount fix on 50 Just when client search something on wholist search input

I totally am not getting the question from the OP here.

Yeah, no comprende here, either.

no any way ? /emoticons/default_wacko.png

@_root: no one understood what you want

thanks nay , sorry for my bad Question saying .

in default who list have two number (matchcount and Displaycount) , for example when someone open wholist , on bottom show (people found : 974 , displayed:49)

when player insert a string or number in wholist search , server sent to client a result , for example ( people found : 93 , displayed : 49)

I want set matchcount to 49 Just when players search in wholist (people can’t retrieve real matchcount on searches), for example result must be (people found: 49 , displayed : 49) if player search in wholist and matchcount is bigger than 50 .

Thanks

Funny thing is, this is opposite of what most people want, most people who ask about changing the wholist want to show fake entries to make their pathetic server look more populated than it is… lol

@paradox , now inverse … lol

no anyone yet have a solution.

Put a breakpoint at the start of that packet handler, go in-game, do a search and see what values the variables get

that way you can known what to put inside the “if (matchcoumt > 50)”

@nay , Thanks for reply .

how can I set a breakpoint at start of packethandler ? I must using sniffer softwares like wireshark to know what’s sent and get ?

thanks

No, you need to use Visual Studio debugger (Windows) or GDB (Linux)