Correction de l'immunité
This commit is contained in:
parent
15dbb71759
commit
2b20eb9a0d
3 changed files with 6 additions and 10 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -1,4 +1,6 @@
|
|||
players.db
|
||||
immunity
|
||||
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
|
6
immunity
6
immunity
|
@ -1,6 +0,0 @@
|
|||
Goulven Kermarec
|
||||
Lazare Olivry
|
||||
Brieuc Lacroix
|
||||
Cyriaque Millot
|
||||
Juliette Tibayrenc
|
||||
Siqi Liu
|
|
@ -27,7 +27,7 @@ MYSQL_DB = 'rezo_admin'
|
|||
|
||||
BAN_DURATION = 30. * 60.
|
||||
|
||||
IMMUNITY_FILE = '/var/www/roulette/immunity'
|
||||
IMMUNITY_FILE = '/var/roulette/immunity'
|
||||
ASSHOLES_FILE = '/var/www/roulette/assholes'
|
||||
|
||||
IMMUNITY = [
|
||||
|
@ -143,6 +143,7 @@ def get_player_from_ip(ip):
|
|||
row = cur.fetchone()
|
||||
con.close()
|
||||
|
||||
print("last good line")
|
||||
user = None
|
||||
if row is not None:
|
||||
user = {'id': row[0], 'firstname': row[1], 'name': row[2], \
|
||||
|
@ -208,15 +209,14 @@ def get_players_not_banned():
|
|||
con.close()
|
||||
|
||||
not_banned = [{'id': row[0], 'firstname': row[1], 'name': row[2]} for row in rows]
|
||||
|
||||
|
||||
# Ensuite on applique les règles d'immunité
|
||||
with open(IMMUNITY_FILE, 'r') as f:
|
||||
immunity = f.read()
|
||||
result = []
|
||||
for user in not_banned:
|
||||
if user['firstname']+' '+usr['name'] not in immunity:
|
||||
if user['firstname']+' '+user['name'] not in immunity:
|
||||
result.append(user)
|
||||
|
||||
return result
|
||||
|
||||
def cheat(player_id, target_id):
|
||||
|
|
Loading…
Reference in a new issue