1
1
#!/usr/bin/env python3
2
- import os , sys , json , time , socket
2
+ import os , re , sys , json , time , socket
3
3
from threading import Thread , RLock
4
4
5
5
from apscheduler .schedulers .background import BackgroundScheduler
@@ -288,12 +288,10 @@ def sort(self):
288
288
def server_points (server ):
289
289
points = 0
290
290
291
- # 1 per client, but only 1/8 per client with a guest
292
- # or all-numeric name.
291
+ # 1 per client, but only 1/8 per "guest" client
293
292
if "clients_list" in server :
294
293
for name in server ["clients_list" ]:
295
- if name .startswith ("Guest" ) or \
296
- name .isdigit ():
294
+ if re .match (r"[A-Z][a-z]+[0-9]{3,4}" , name ):
297
295
points += 1 / 8
298
296
else :
299
297
points += 1
@@ -304,7 +302,7 @@ def server_points(server):
304
302
# Penalize highly loaded servers to improve player distribution.
305
303
# Note: This doesn't just make more than 16 players stop
306
304
# increasing your points, it can actually reduce your points
307
- # if you have guests/all-numerics .
305
+ # if you have guests.
308
306
if server ["clients" ] > 16 :
309
307
points -= server ["clients" ] - 16
310
308
0 commit comments