Merge branch 'master' of gitlab.rezometz.org:guimoz/roulette-legacy

This commit is contained in:
guimoz 2017-01-28 17:12:34 +01:00
commit 8f9303958d

View file

@ -207,13 +207,23 @@ def get_players_not_banned():
rows = cur.fetchall()
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):
success = random.choice([True, False])
try:
ok = [line.strip().partition(' ') for line in IMMUNITY]
ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok]
# ok = [line.strip().partition(' ') for line in IMMUNITY]
# ok = [get_player_from_full_name(names[0], names[2])['id'] for names in ok]
ko = [line.strip().partition(' ') for line in ASSHOLES]
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
elif player_id in ko:
success = False
elif target_id in ok:
success = False
# elif target_id in ok:
# success = False
except TypeError:
pass