|
|
|
@ -10,6 +10,7 @@ import MySQLdb |
|
|
|
from time import time, localtime, strftime |
|
|
|
import locale |
|
|
|
import random |
|
|
|
import json |
|
|
|
|
|
|
|
# configuration |
|
|
|
DEBUG = True |
|
|
|
@ -164,12 +165,9 @@ def get_players_not_banned(): |
|
|
|
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']+' '+user['name'] not in immunity: |
|
|
|
result.append(user) |
|
|
|
result = [] |
|
|
|
for user in not_banned: |
|
|
|
result.append(user) |
|
|
|
return result |
|
|
|
|
|
|
|
def cheat(player_id, target_id): |
|
|
|
@ -419,5 +417,18 @@ def play(): |
|
|
|
else: |
|
|
|
return render_template('precampagne.html', user=player,stats=statistiques()) |
|
|
|
|
|
|
|
|
|
|
|
@app.route('/complete') |
|
|
|
def complete(): |
|
|
|
v = request.args['v'] |
|
|
|
con = connect_sql() |
|
|
|
cur = con.cursor() |
|
|
|
cur.execute("""select id, firstname, name from players where |
|
|
|
name like "{value}%" or firstname like "{value}%";""".format(value=v)) |
|
|
|
rows = [[i[0], i[1]+' '+i[2]] for i in cur.fetchall()] |
|
|
|
con.close() |
|
|
|
return json.dumps(rows) |
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
app.run() |
|
|
|
|