|
|
@ -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 |
|
|
|