Skip to content
Permalink
Browse files

Update detection of guest clients

  • Loading branch information
sfan5 committed Feb 18, 2017
1 parent 58f03d0 commit 5e12cb5022ed8ff74c2b23ae6956f7193cfca0de
Showing with 4 additions and 6 deletions.
  1. +4 −6 server.py
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
import os, sys, json, time, socket
import os, re, sys, json, time, socket
from threading import Thread, RLock

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

# 1 per client, but only 1/8 per client with a guest
# or all-numeric name.
# 1 per client, but only 1/8 per "guest" client
if "clients_list" in server:
for name in server["clients_list"]:
if name.startswith("Guest") or \
name.isdigit():
if re.match(r"[A-Z][a-z]+[0-9]{3,4}", name):
points += 1/8
else:
points += 1
@@ -304,7 +302,7 @@ def server_points(server):
# Penalize highly loaded servers to improve player distribution.
# Note: This doesn't just make more than 16 players stop
# increasing your points, it can actually reduce your points
# if you have guests/all-numerics.
# if you have guests.
if server["clients"] > 16:
points -= server["clients"] - 16

0 comments on commit 5e12cb5

Please sign in to comment.