Merge branch 'master' of gitlab.rezometz.org:guimoz/roulette-legacy
This commit is contained in:
commit
8f9303958d
1 changed files with 15 additions and 5 deletions
20
roulette.py
20
roulette.py
|
@ -207,13 +207,23 @@ def get_players_not_banned():
|
||||||
rows = cur.fetchall()
|
rows = cur.fetchall()
|
||||||
con.close()
|
con.close()
|
||||||
|
|
||||||
return [{'id': row[0], 'firstname': row[1], 'name': row[2]} for row in rows]
|
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:
|
||||||
|
result.append(user)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
def cheat(player_id, target_id):
|
def cheat(player_id, target_id):
|
||||||
success = random.choice([True, False])
|
success = random.choice([True, False])
|
||||||
try:
|
try:
|
||||||
ok = [line.strip().partition(' ') for line in IMMUNITY]
|
# ok = [line.strip().partition(' ') for line in IMMUNITY]
|
||||||
ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok]
|
# ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok]
|
||||||
|
|
||||||
ko = [line.strip().partition(' ') for line in ASSHOLES]
|
ko = [line.strip().partition(' ') for line in ASSHOLES]
|
||||||
ko = [get_player_from_full_name(names[0], names[2])['id'] for names in ko]
|
ko = [get_player_from_full_name(names[0], names[2])['id'] for names in ko]
|
||||||
|
@ -222,8 +232,8 @@ def cheat(player_id, target_id):
|
||||||
success = True
|
success = True
|
||||||
elif player_id in ko:
|
elif player_id in ko:
|
||||||
success = False
|
success = False
|
||||||
elif target_id in ok:
|
# elif target_id in ok:
|
||||||
success = False
|
# success = False
|
||||||
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
pass
|
pass
|
||||||
|
|
Loading…
Reference in a new issue