Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
SpotlightForBugs committed Aug 4, 2022
1 parent 3ba445d commit 0dc415d
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 6 deletions.
20 changes: 16 additions & 4 deletions app.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from cgi import print_form
from traceback import print_tb
from flask import Flask, request, url_for, render_template, session, make_response, redirect, Response
#from flask_session import Session
import requests, logging, werwolf, datetime, re
Expand Down Expand Up @@ -146,9 +147,22 @@ def reset():
return(render_template('index.html')) #zurück zur homepage


@app.route("/player/kill/<name_kill>") #kill a player
def kill_player(name_kill):
#@app.route("/<name>/<rolle>/toeten/<name_kill>") #kill a player

@app.route("/<name>/<rolle>/toeten/<name_kill>") #kill a player
def kill_player(name,rolle,name_kill):
wort = name+" = "+rolle # create a string with the name and the role
file = open('rollen_log.txt', "r") # open the log file
players_vorhanden = file.read() # read the log file
if wort in players_vorhanden: # if the name and the role is in the log file
pass
else:
return(render_template('fehler.html'))



with open('rollen_log.txt', 'r+') as fileTot_kill:


file_list_kill = []
counter_tot = 0
Expand Down Expand Up @@ -181,8 +195,6 @@ def kill_player(name_kill):
fileFinal.close()

return(render_template('Dashboards/Dash_Dorfbewohner.html'))




##Übersicht der Spieler
Expand Down
2 changes: 1 addition & 1 deletion templates/Dashboards/Dash_Armor.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ <h2>Hallo, {{name}}</h2> <br>
<p>Als {{rolle}} wählst du nun zwei Personen aus, die sich unsterblich ineinader verlieben.</p>


<!--TODO- #21 Auswahl der beiden Partner:innen->
<!--TODO- #21 Auswahl der beiden Partner:innen-->


{% endblock %}
Expand Down
32 changes: 32 additions & 0 deletions templates/Dashboards/Dash_Hexe.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,40 @@ <h2>{{rolle}}</h2> <br>



Als Hexe kannst du zweimal im Spiel einen Zauber wirken.<br>

Du kannst eine Person umbringen, <br>
eine Person heilen (Auch dich selbst, wenn Du einmal tot bist.) <br>

Du kannst natürlich auch keine Person umbringen oder heilen.


<div class="spacer"><br><br></div>


<!--Wenn aktionen erlaubt:-->
<div class="btn-group-vertical">

<input name="" id="" class="btn btn-success" type="button" value="heilen">
<input name="" id="" class="btn btn-info" type="button" value="ignorieren">
<input name="" id="" class="btn btn-danger" onclick="document.getElementById('toeten').style.visibility= 'visible'" type="button" value="Eine zusätzliche Person umbringen">

</div>



<div style="visibility:hidden;" id="toeten">

<br>
<ul style="list-style-type :none;">
{%for el in nurNamen if not name in el%}

<li><button onclick=location.href="{{ url_for('kill_player', name_kill = el,name=name,rolle=rolle) }}" class='wahlfeld' id='"+text+"' >{{el}}</p></button></li><br><br><br>


{%endfor%}
</div>
</ul>

{% endblock %}

2 changes: 1 addition & 1 deletion templates/Dashboards/Dash_Jaeger.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ <h2>{{rolle}}</h2>

if (text.includes("Erzaehler")==false) {

document.write("<li><button onclick=location.href='{{ url_for('kill_player', name_kill = el) }}' class='chooseplayer' id='"+text+"' >"+text+"</p></button></li><br>");
document.write("<li><button onclick=location.href='{{ url_for('kill_player', name_kill = el,name=name,rolle=rolle) }}' class='chooseplayer' id='"+text+"' >"+text+"</p></button></li><br>");
btn = document.getElementById(text);
btn.addEventListener('click', function onClick(event) {
console.log(document.activeElement);
Expand Down

0 comments on commit 0dc415d

Please sign in to comment.