Skip to content

Commit 5e12cb5

Browse files
committedFeb 18, 2017
Update detection of guest clients
1 parent 58f03d0 commit 5e12cb5

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

Diff for: ‎server.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
import os, sys, json, time, socket
2+
import os, re, sys, json, time, socket
33
from threading import Thread, RLock
44

55
from apscheduler.schedulers.background import BackgroundScheduler
@@ -288,12 +288,10 @@ def sort(self):
288288
def server_points(server):
289289
points = 0
290290

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
293292
if "clients_list" in server:
294293
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):
297295
points += 1/8
298296
else:
299297
points += 1
@@ -304,7 +302,7 @@ def server_points(server):
304302
# Penalize highly loaded servers to improve player distribution.
305303
# Note: This doesn't just make more than 16 players stop
306304
# increasing your points, it can actually reduce your points
307-
# if you have guests/all-numerics.
305+
# if you have guests.
308306
if server["clients"] > 16:
309307
points -= server["clients"] - 16
310308

0 commit comments

Comments
 (0)