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.