Skip to content

Commit

Permalink
Update server ratings
Browse files Browse the repository at this point in the history
* Passworded servers go down the list.
* Almost full ( 85% or more ) servers are less rated
* Bots are not counted towards player count anymore
* Make bots penalize the server a bit more
  • Loading branch information
robotboy655 committed May 1, 2014
1 parent ccc462e commit bff68e0
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions garrysmod/html/js/menu/control.Servers.js
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function AddServer( type, id, ping, name, desc, map, players, maxplayers, botpla
name: name,
desc: desc,
map: map,
players: parseInt( players ),
players: parseInt( players ) - parseInt( botplayers ),
maxplayers: parseInt( maxplayers ),
botplayers: parseInt( botplayers ),
pass: pass,
Expand All @@ -203,10 +203,12 @@ function AddServer( type, id, ping, name, desc, map, players, maxplayers, botpla
data.hasmap = DoWeHaveMap( data.map );

data.recommended = data.ping;
if ( !data.hasmap ) data.recommended += 20;
if ( data.players == 0 ) data.recommended += 100;
if ( data.players == data.maxplayers ) data.recommended += 75;
if ( data.botplayers > 0 ) data.recommended += data.botplayers * 10;
if ( !data.hasmap ) data.recommended += 20; // We don't have that map
if ( data.players == 0 ) data.recommended += 100; // Server is empty
if ( data.players == data.maxplayers ) data.recommended += 75; // Server is full
if ( data.players / data.maxplayers > 0.85 ) data.recommended += 50; // Server is almost full
if ( data.botplayers > 0 ) data.recommended += data.botplayers * 12; // Server has bots
if ( data.pass ) data.recommended += 300; // If we can't join it, don't put it to the top

data.listen = data.desc.indexOf('[L]') >= 0;
if ( data.listen ) data.desc = data.desc.substr( 4 );
Expand All @@ -217,7 +219,7 @@ function AddServer( type, id, ping, name, desc, map, players, maxplayers, botpla
UpdateGamemodeInfo( data )

gm.num_servers += 1;
gm.num_players += data.players - data.botplayers;
gm.num_players += data.players

gm.element_class = "";
if ( gm.num_players == 0 ) gm.element_class = "noplayers";
Expand Down

0 comments on commit bff68e0

Please sign in to comment.