modified /who command

EQ2Emulator Development forum.

Moderator: Team Members

Post Reply
AdnaeDMorte
Posts: 4
Joined: Fri Jan 16, 2009 12:50 pm

modified /who command

Post by AdnaeDMorte » Fri Jan 23, 2009 5:11 pm

This modification allows admins to show more than 10 players on the who command.

Code: Select all

brugh World # diff /usr/src/eq2Emu/202/Source/World/World.cpp ./World.cpp
651c651,654
<               if(num_characters > 10){
---
>               if ( client->GetAdminStatus() > 0 )     {
>                   client->Message(CHANNEL_COLOR_RED, "** ADMIN-MODE ** ");
>               }
>               if(num_characters > 10 && client->GetAdminStatus() > 0){

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: modified /who command

Post by John Adams » Thu Feb 19, 2009 4:39 pm

Sorry I missed this the first time around.

I'm not sure I see the logic in this code. For one, there is likely a good reason why the list is capped at 10. I doubt LE pulled a number out of his hat and just said "10", so we should ask him what will happen if we start showing more data than he expects.

Secondly, "if(num_characters > 10 && client->GetAdminStatus() > 0){" will make lists greater-than 10 show for everyone *except* admins, if I am reading this right. Maybe this check should be if(num_characters > 10 && client->GetAdminStatus() == 0){ ?

LethalEncounter
Team: Zombie
Posts: 2717
Joined: Wed Jul 25, 2007 10:10 pm

Re: modified /who command

Post by LethalEncounter » Thu Feb 19, 2009 4:47 pm

I can't remember when i came up with the 10 cap, but I think it was because the client has a problem displaying too many chat messages at once and we were crashing the client when we used to do the who display in the chat window. We now use the proper packet for who queries so it isn't an issue anymore. Does anyone know the cap on live?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: modified /who command

Post by John Adams » Thu Feb 19, 2009 5:00 pm

Ok that is good news. I will log in and check some /who stats now. I owe you some AA packets anyway.

AdnaeDMorte
Posts: 4
Joined: Fri Jan 16, 2009 12:50 pm

Re: modified /who command

Post by AdnaeDMorte » Fri Feb 20, 2009 1:09 am

the cap for who on live is 100 on normal player clients. And right, that was the wrong code on my posting, sorry about this.

My idea was, that the admin can show all players without a cap, and right the if clause is here completly stupid :P

Image
Retired
Posts: 251
Joined: Sun Oct 26, 2008 10:07 am

Re: modified /who command

Post by Image » Fri Feb 20, 2009 7:13 am

We added caps same to itemsearch (think who as well) because of an issue with either the netcode or the client. When we tried sending more than 10 lines to print at once the client crashed. It has probably since been fixed.

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: modified /who command

Post by John Adams » Fri Feb 20, 2009 12:08 pm

Thanks guys, then this is indeed a good fix that we can experiment with to see if we can match live.

Obviously Live does not have an items list cap (hah) so I will attempt to gradually bump it above 10 to see where it breaks. The best solution of course is to make the list caps a variable in the DB so a recompile is not necessary each time you want to change it.

Any objections?

User avatar
John Adams
Retired
Posts: 9684
Joined: Thu Jul 26, 2007 6:27 am
EQ2Emu Server: EQ2Emulator Test Center
Characters: John
Location: Arizona
Contact:

Re: modified /who command

Post by John Adams » Fri Feb 20, 2009 6:02 pm

I went ahead and implemented this code, with a few variations.

The value for "max_who_results" is set in the `variables` table, and if it is missing, the default is 10.
I've also added the usual status override, also set in `variables` and if it is missing, defaults to 100.

Diff:

Code: Select all

Index: World.cpp
===================================================================
--- World.cpp	(revision 608)
+++ World.cpp	(working copy)
@@ -648,8 +648,26 @@
 		packet->setDataByName("account_id", client->GetAccountID());
 		packet->setDataByName("unknown", 0xFFFFFFFF);
 		int8 num_characters = players.size();
-		if(num_characters > 10){
-			num_characters = 10;
+		int8 max_who_results = 10;
+		int8 max_who_results_status_override = 100;
+
+		Variable* var = variables.FindVariable("max_who_results_status_override");
+		if ( var ){
+			max_who_results_status_override = atoi(var->GetValue());
+		}
+
+		// AdnaeDMorte
+		if ( client->GetAdminStatus() >= max_who_results_status_override ){
+			client->Message(CHANNEL_COLOR_RED, "** ADMIN-MODE ** ");
+		}
+
+		Variable* var1 = variables.FindVariable("max_who_results");
+		if ( var1 ){
+			max_who_results = atoi(var1->GetValue());
+		}
+
+		if(num_characters > max_who_results && client->GetAdminStatus() < max_who_results_status_override){
+			num_characters = max_who_results;
 			packet->setDataByName("response", 3);  //response 1 = error message, 3 == capped
 		}
 		else
Optional SQL:

Code: Select all

insert into `variables`(`variable_name`,`variable_value`,`comment`) values ( 'max_who_results','10','Maximum number of players to show up in /who commands');
insert into `variables`(`variable_name`,`variable_value`,`comment`) values ( 'max_who_results_status_override','100','Admin status to override the cap and display all results');
I tested this on Tess with a /who cap of 2, with 4 clients connected, and one Admin - and the results show up as expected in /who all tests.

Committed.

Changes, Modifications, Enhancements, or complete dismissal of this code is welcomed.

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests