Seuls les immunity peuvent voir le site en precampagne.
This commit is contained in:
parent
6478b31fdc
commit
0612c28e84
2 changed files with 13 additions and 3 deletions
14
roulette.py
14
roulette.py
|
@ -320,6 +320,11 @@ def home():
|
||||||
player = get_player_from_ip(get_ip())
|
player = get_player_from_ip(get_ip())
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
print(player, 'arrived and the site is',STATE)
|
print(player, 'arrived and the site is',STATE)
|
||||||
|
with open(IMMUNITY_FILE, 'r') as f:
|
||||||
|
immunity = f.read()
|
||||||
|
ok = [line.split(' ') for line in immunity.split('\n') if line]
|
||||||
|
ok = [get_player_from_full_name(names[0], names[1])['id'] for names in ok]
|
||||||
|
player_has_immunity = player['id'] in ok
|
||||||
|
|
||||||
bans = sorted(get_bans(player['id']), \
|
bans = sorted(get_bans(player['id']), \
|
||||||
key=lambda ban: ban['time'], \
|
key=lambda ban: ban['time'], \
|
||||||
|
@ -349,7 +354,7 @@ def home():
|
||||||
|
|
||||||
if "down" in STATE:
|
if "down" in STATE:
|
||||||
return render_template('down.html', user=player, stats=statistiques(), bans_hist=bans_hist)
|
return render_template('down.html', user=player, stats=statistiques(), bans_hist=bans_hist)
|
||||||
elif "up" in STATE:
|
elif "up" in STATE or player_has_immunity:
|
||||||
return render_template('home.html', bans_hist=bans_hist, stats=statistiques())
|
return render_template('home.html', bans_hist=bans_hist, stats=statistiques())
|
||||||
else:
|
else:
|
||||||
return render_template('precampagne.html', user=player,stats=statistiques())
|
return render_template('precampagne.html', user=player,stats=statistiques())
|
||||||
|
@ -359,6 +364,11 @@ def home():
|
||||||
def play():
|
def play():
|
||||||
ip = get_ip()
|
ip = get_ip()
|
||||||
player = get_player_from_ip(ip)
|
player = get_player_from_ip(ip)
|
||||||
|
with open(IMMUNITY_FILE, 'r') as f:
|
||||||
|
immunity = f.read()
|
||||||
|
ok = [line.split(' ') for line in immunity.split('\n') if line]
|
||||||
|
ok = [get_player_from_full_name(names[0], names[1])['id'] for names in ok]
|
||||||
|
player_has_immunity = player['id'] in ok
|
||||||
if "down" in STATE:
|
if "down" in STATE:
|
||||||
bans = sorted(get_bans(player['id']), \
|
bans = sorted(get_bans(player['id']), \
|
||||||
key=lambda ban: ban['time'], \
|
key=lambda ban: ban['time'], \
|
||||||
|
@ -387,7 +397,7 @@ def play():
|
||||||
bans_hist.append(entry)
|
bans_hist.append(entry)
|
||||||
return render_template('down.html', user=player,stats=statistiques())
|
return render_template('down.html', user=player,stats=statistiques())
|
||||||
|
|
||||||
elif "up" in STATE:
|
elif "up" in STATE or player_has_immunity:
|
||||||
# Traitement de la requête de bannissement
|
# Traitement de la requête de bannissement
|
||||||
if request.method == 'POST':
|
if request.method == 'POST':
|
||||||
target_id = int(request.form['target_id'])
|
target_id = int(request.form['target_id'])
|
||||||
|
|
2
state
2
state
|
@ -1 +1 @@
|
||||||
up precampagne !!
|
precampagne !!
|
||||||
|
|
Loading…
Reference in a new issue