diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..f9f0cc7 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,76 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as +contributors and maintainers pledge to making participation in our project and +our community a harassment-free experience for everyone, regardless of age, body +size, disability, ethnicity, sex characteristics, gender identity and expression, +level of experience, education, socio-economic status, nationality, personal +appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment +include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or + advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic + address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable +behavior and are expected to take appropriate and fair corrective action in +response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or +reject comments, commits, code, wiki edits, issues, and other contributions +that are not aligned to this Code of Conduct, or to ban temporarily or +permanently any contributor for other behaviors that they deem inappropriate, +threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces +when an individual is representing the project or its community. Examples of +representing a project or community include using an official project e-mail +address, posting via an official social media account, or acting as an appointed +representative at an online or offline event. Representation of a project may be +further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported by contacting the project team at sabouri.sadra@gmail.com. All +complaints will be reviewed and investigated and will result in a response that +is deemed necessary and appropriate to the circumstances. The project team is +obligated to maintain confidentiality with regard to the reporter of an incident. +Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good +faith may face temporary or permanent repercussions as determined by other +members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, +available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see +https://www.contributor-covenant.org/faq diff --git a/README.md b/README.md index f0379e9..9cb9d1f 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@ Playing mafia game made easy simply by having: There you go, lets play some mafia :sunglasses:. - + ## Usage After cloning into mafia using command bellow: @@ -47,7 +47,7 @@ There you go, now each player can open a browser and type `serverhost:port_name` In defualt mode your address should be `server_ip:5000`. | What player should see in the browser | |:-------------------------------------:| -| | +| | 4. Tracing roles from commandline @@ -56,7 +56,7 @@ players should inform the GOD with thier unique id so that GOD can find who is w | What GOD should see in the CLI | |:------------------------------:| -| | +| | ## Game Rules Mafia is a social deduction game, created by Dimitry Davidoff in 1986. The game models a conflict between two groups: an informed minority (the mafia team), and an uninformed majority (the Residents). @@ -79,17 +79,38 @@ Dead players are not permitted to attempt to influence the remainder of the game The game continues until a faction achieves its win condition; for the Residents, this usually means eliminating the whole mafia team, while for the minority this usually means reaching numerical parity with the Residents. ### Roles -| Role | image(s) | -| :-------------: |:----------------------------------------------------------------------------------------------------------------------------: | -| Don | | -| Mafia | | -| Rebel | | -| Doctor | | -| Detective | | -| Anti-attack | | -| Resident | | + +#### Mafia Team +| Role | image(s) | Descriptions | +|:----:|:--------:|:------------:| +| Don | | Don is the boss of the mafia group. At night mode Don decides whom to be killed from the mafia team.Don can't be detected by detective. | +| Hit Man | | Hit Man is a rather powerful member of mafia team. His/Her shots won't fail even if the doctor save or the victim is Bulletproof. Hit Man can use his shot only one time during the game his shot will be replaced by one of mafia's night shot. | +| Made Man | | Made Man is the one of the most powerful participant of the mafia team. Made Man gets up at night and turn one of the members of city team to Mafia. | +| Kind Wife | | Kind Wife is mafia team's sweetheart. After the day she died the mafia team get up and kill two suspects instead of one to take her revenge. | +| Mafia | | Mafia is the simple participant of the mafia team. Mafia gets up at night and try to decide which one of the players they want to kill, detective can detect this kind of mafia in night mode. | + +#### City Team +| Role | image(s) | Descriptions | +|:----:|:--------:|:------------:| +| Rebel | | Rebel is from city team which gets up at night mode and kills a person.if the victim was chosen from residents, Rebel (him/her)self may die. | +| Doctor | | Doctor is a helpful participant of city team which gets up after mafia team and tries to rescue a person (or two in the first night) from mafia's shot. | +| Detective | | Detective is from city team gets up at night mode and tries to ask GOD if someone is good (Resident, Doctor, Rebel, Bulletproof) or bad(Mafia), but his/her first attempt to ask from. Don may be answered incorrect by GOD. | +| Bulletproof | | Bulletproof is the most powerful resident which doesn't hurt from night shots. he/she won't die through night mode. | +| Bride | | Bride is a member of city team. Bride has been engaged to Groom recently at nigh both of them will get up and see each other after death of each one of them, other one can kill anyone as a revenge of his/her sweetheart at night phase. | +| Groom | | Groom is a member of city team. Groom has been engaged to Bride recently at nigh both of them will get up and see each other after death of each one of them, other one can kill anyone as a revenge of his/her sweetheart at night phase. | +| Chef | | Chef is critical member of city team. After his/her death city team should win at last after 3 days. | +| Miller | | Miller is a member of city team. When Detective ask GOD about Millers role the result will be bad(Mafia) so Detective will be confused about Millers role and asume he/she as a mafia team member. | +| Undercover Cop | | Undercover Cop is a member of city team but he/she will act just like mafia (wakes up at night) and decide whome to be killed). | +| Reporter | | Reporter is a city team member. GOD will inform Reporter who was chosen by Made Man to become Mafia. | +| Grandma | | Grandma with gun is a frightening member of city team. She will kill anyone who tries to kill her at night. Mafia and other roles with kiling power should be aware of her. | +| Student | | Student is a innocent city team member. After His/Her death, players will kill two players at day court. | +| Postman | | Postman is a member of city team. After Postman's death he/she can select a player to die with him/her. With this power Postman can help city team by killing a mafia member. | +| Clown | | Clown is a member of city team. Clown forces someone to reveal his/her role for another players. Clown can do this just for one time and this should take place at night, GOD should be informed whos role to be reavealed. | +| Resident | | Resident is the typical player of the game. he/she has no power but to blame mafia in order to remove them from the game in day mode. | ## References -Icons made by Vectors Market from www.flaticon.com +Icons made by Vectors Market and Pixel perfect from www.flaticon.com. + +Sounds from Soundjay. + [https://en.wikipedia.org/wiki/Mafia_(party_game)](https://en.wikipedia.org/wiki/Mafia_(party_game)) diff --git a/mafia.py b/mafia.py index 8cf916e..47f7803 100644 --- a/mafia.py +++ b/mafia.py @@ -1,41 +1,114 @@ from sys import argv from random import randrange, shuffle from flask import Flask, render_template, url_for, request +from flask_httpauth import HTTPBasicAuth from mafia_params import * app = Flask(__name__) +auth = HTTPBasicAuth() +auth_GOD = HTTPBasicAuth() +preshared_key = "" id = 0 nPlayers = 0 roles = [] -ip2role_idx = {} +ip2role_index_name = {} +nComments = 0 +comments_ordered = [] + +@auth.verify_password +def verify_password(username, password): + if len(username) > 0: + return username + return None @app.route('/') +@auth.login_required def index(): - global id, ip2role_idx + global id, ip2role_index_name + username = str(auth.current_user()) role = "" image_name = "" ip = str(request.remote_addr) - if ip in ip2role_idx.keys(): - role = ip2role_idx[ip][0] - image_name = ip2role_idx[ip][0] + "_" + str(ip2role_idx[ip][1]) + if ip in ip2role_index_name.keys(): + return render_template("Player.html", player=ip2role_index_name[ip]) else: if id > nPlayers: - return "Numbers of players out of range!" #TODO:well defined Error Page + return render_template("404.html", is_farsi=True) role = roles[id] - ip2role_idx[ip] = (role, str(randrange(1, nRoles[role] + 1))) - image_name = role + "_" + str(ip2role_idx[ip][1]) + ip2role_index_name[ip] = [role, + str(randrange(1, nRoles[role] + 1)), + username, + "alive", + False] + image_name = role + "_" + str(ip2role_index_name[ip][1]) print("*" * 20, "New Player","*" * 20) - print(ip + " : " + str(id) + " --> " + role) + toGod = ip + " : " + str(id) + " : " + username + " --> " + role + toGod += "/" + role2fa[role] #TODO: Just in Farsi Mode + print(toGod) id += 1 return render_template("index.html", image_name=image_name, role_name=role, role_name_fa=role2fa[role], - description=descriptions[role], - player_id=id - 1, + description=descriptions[role], description_fa=descriptions_fa[role], is_farsi=True) +@auth_GOD.verify_password +def verify_password_god(username, password): + if password == preshared_key: + return username + + +@app.route('/GOD') +@auth_GOD.login_required +def GOD_PAGE(): + global ip2role_index_name, nComments, comments_ordered + msg = "" + if request.args.get("Kill") is not None: + ip = request.args.get("Kill") + if ip in ip2role_index_name.keys(): + if ip2role_index_name[ip][3] == "alive": + ip2role_index_name[ip][3] = "dead" + else: + ip2role_index_name[ip][3] = "alive" + else: + return render_template("404.html", is_farsi=True) + if request.args.get("Ban") is not None: + ip = request.args.get("Ban") + if ip in ip2role_index_name.keys(): + if ip2role_index_name[ip][3] == "alive": + ip2role_index_name[ip][3] = "banned" + elif ip2role_index_name[ip][3] == "banned": + ip2role_index_name[ip][3] = "alive" + else: + return render_template("404.html", is_farsi=True) + if request.args.get("Comment") is not None: + ip = request.args.get("Comment") + if ip in ip2role_index_name.keys(): + if ip2role_index_name[ip][4] == False: + if nComments <= nPlayers // 3: + ip2role_index_name[ip][4] = True + nComments += 1 + comments_ordered.append(ip) + else: + msg = "Error: Out of Comments." + else: + ip2role_index_name[ip][4] = False + nComments -= 1 + comments_ordered.remove(ip) + else: + return render_template("404.html", is_farsi=True) + return render_template("GOD.html", ip2role_index_name=ip2role_index_name, + prompt_message=msg, roles={role:roles.count(role) for role in set(roles)}, + comments=comments_ordered, role2team=role2team) + + +@app.errorhandler(404) +def invalid_route(e): + return render_template("404.html", is_farsi=True) + + def help_me(): usage = "-" * 70 + "\n" usage += "mafia - Web Server Application For Mafia Game Playing On Local Network \n\n" @@ -49,6 +122,29 @@ def help_me(): exit() +def give_me_roles(ordered_roles): + n = len(ordered_roles) + if n >= 14: + ordered_roles[12] = 'Groom' + ordered_roles[13] = 'Bride' + if n % 3 == 0: + ordered_roles[14] = 'Serial Killer' + if n % 3 != 0: + try: + i = ordered_roles.index('Mafia') + ordered_roles[i] = 'Made Man' + ordered_roles[2] = 'Reporter' + except ValueError: + pass + if n % 3 == 2: + try: + i = ordered_roles.index('Mafia') + ordered_roles[i] = 'Kind Wife' + except ValueError: + pass + return ordered_roles + + if __name__ == "__main__": if len(argv) < 2 or argv[1] in ['--help', 'help', '-h']: help_me() @@ -56,8 +152,15 @@ def help_me(): if nPlayers > len(ordered_roles): print("Too many players, mafia doesn't support a game with", nPlayers, "player.") help_me() - roles = ordered_roles[:nPlayers] + roles = give_me_roles(ordered_roles[:nPlayers]) shuffle(roles) - app.run(host="0.0.0.0", \ - port=5000, \ - debug=True) + chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789!@#$%^&*()" + for i in range(4): + preshared_key += chars[randrange(0, len(chars))] + print("_" * 20 + "GOD's password" + "_" * 20) + print(preshared_key) + print("_" * 54) + app.run(host="0.0.0.0", + port=5000, + debug=True, + use_reloader=False) diff --git a/mafia_params.py b/mafia_params.py index 299db19..0faabbf 100644 --- a/mafia_params.py +++ b/mafia_params.py @@ -1,37 +1,227 @@ ordered_roles = ["Resident", "Don", "Resident", - "Mafia", + "Detective", "Doctor", - "Detector", + "Hit Man", + "Rebel", + "Bulletproof", "Mafia", "Resident", - "Rebel", - "Anti-attck", + "Resident", + "Mafia", + "Resident", + "Resident", + "Mafia", + "Doctor", + "Chef", + "Mafia", + "Detective", + "Miller", + "Mafia", + "Undercover Cop", + "Grandma", + "Mafia", + "Student", + "Postman", "Mafia", + "Clown", + "Resident", + "Mafia" + "Resident", "Resident"] -nRoles = {"Don" : 1, - "Resident" : 4, - "Mafia" : 2, - "Doctor" : 2, - "Rebel" : 1, - "Detective" : 1, - "Anti-attack" : 1} +nRoles = {"Boxer" : 2, + "Bride" : 5, + "Bulletproof" : 9, + "Bus Driver" : 3, + "Chef" : 3, + "Clown" : 2, + "Curious Kid" : 2, + "Detective" : 3, + "Doctor" : 10, + "Don" : 4, + "Genie" : 2, + "Grandma" : 2, + "Groom" : 4, + "Hit Man" : 2, + "Insane" : 3, + "Jailer" : 2, + "Judge" : 6, + "Kind Wife" : 4, + "Lawyer" : 3, + "Made Man" : 2, + "Mafia" : 9, + "Magician" : 4, + "Miller" : 3, + "Postman" : 3, + "Priest" : 3, + "Rebel" : 3, + "Reporter" : 6, + "Resident" : 21, + "Serial Killer" : 6, + "Student" : 2, + "Undercover Cop" : 2 + } + +role2team = {"Boxer" : "mafia", + "Bride" : "city", + "Bulletproof" : "city", + "Bus Driver" : "city", + "Chef" : "city", + "Clown" : "city", + "Curious Kid" : "city", + "Detective" : "city", + "Doctor" : "city", + "Don" : "mafia", + "Genie" : "city", + "Grandma" : "city", + "Groom" : "city", + "Hit Man" : "mafia", + "Insane" : "city", + "Jailer" : "city", + "Judge" : "city", + "Kind Wife" : "mafia", + "Lawyer" : "mafia", + "Made Man" : "mafia", + "Mafia" : "mafia", + "Magician" : "city", + "Miller" : "city", + "Postman" : "city", + "Priest" : "city", + "Rebel" : "city", + "Reporter" : "city", + "Resident" : "city", + "Serial Killer" : "serial_killer", + "Student" : "city", + "Undercover Cop" : "city" + } + +descriptions = {"Boxor" : "Boxor is a member of mafia team. Boxor hits one of the players at night and the one" + " who hited Can't deffend oneself during day phase due to it's hit effect.", + "Bride" : "Bride is a member of city team. Bride has been engaged to Groom recently at nigh both of" + " them will get up and see each other after death of each one of them, other one can kill" + " anyone as a revenge of his/her sweetheart at night phase.", + "Bulletproof" : "Bulletproof is the most powerful resident which doesn't hurt from night shots. he/she won't die" + " through night phase.", + "Bus Driver" : "Bus Driver is city team member. He/She can switch two player which means each shot/question" + " from first one will hurt/asked from second one.", + "Chef" : "Chef is critical member of city team. After his/her death city team should win at last after 3 days.", + "Clown" : "Clown is a member of city team. Clown forces someone to reveal his/her role for another players." + " Clown can do this just for one time and this should take place at night, GOD should be informed" + " whos role to be reavealed.", + "Curious Kid" : "He/She is a member of city team which can open his/her eyes and spy on mafias in the way" + " that no one can see him/her.", + "Detective" : "Detective is from city team gets up at night phase and tries to ask GOD if someone is good" + " (Resident, Doctor, Rebel, Bulletproof) or bad(Mafia), but his/her first attempt to ask from" + " Don may be answered incorrect by GOD.", + "Doctor": "Doctor is a helpful participant of city team which gets up after mafia team and tries to rescue a person" + " (or two in the first night) from mafia's shot.", + "Don" : "Don is the boss of the mafia group. At night phsae Don decides whom to be killed from the mafia team." + "Don can't be detected by detective.", + "Genie" : "Genie is a kind member of city team despite his/her name. Genie selects a player at night and GOD " + "will ask the player to wish something and his/her wish will come true. Genie can use his/her power" + " just three time in a game.", + "Grandma" : "Grandma with gun is a frightening member of city team. She will kill anyone who tries to kill her" + " at night. Mafia and other roles with kiling power should be aware of her.", + "Groom" : "Groom is a member of city team. Groom has been engaged to Bride recently at nigh both of" + " them will get up and see each other after death of each one of them, other one can kill" + " anyone as a revenge of his/her sweetheart at night phase.", + "Hit Man" : "Hit Man is a rather powerful member of mafia team. His/Her shots won't fail even if the doctor save" + " or the victim is Bulletproof. Hit Man can use his shot only one time during the game his shot will" + " be replaced by one of mafia's night shot.", + "Insane" : "Insane is a member of city team. GOD will infrom Insane who is aiming at his/her neighbors (left hand" + " player or right hand player).", + "Jailer" : "Jailer is a member of city team. Jailer can bust any player at night phase, one who has been busted won't" + " play at earlier day phase just for a night.", + "Judge" : "Judge is a member of city team. Judge can reveal his role and decide to kill a player at day phase, Judge" + " can use his/her power only once during the game.", + "Kind Wife" : "Kind Wife is mafia team's sweetheart. After the day she died the mafia team get up and kill two suspects" + " instead of one to take her revenge.", + "Lawyer" : "Lawyer is from mafia team. Lawyer wakes up at night and inform the GOD whom should be sued to be to the court" + " for next day phase.", + "Made Man" : "Made Man is the one of the most powerful participant of the mafia team. Made Man gets up at night and turn" + " one of the members of city team to Mafia.", + "Mafia" : "Mafia is the simple participant of the mafia team. Mafia gets up at night and try to decide which one of" + "the players they want to kill, detective can detect this kind of mafia in night phase.", + "Magician" : "Magician is member of city team. He/She decides to kill or save a player during night and can use his/her" + "power just once during the game.", + "Miller" : "Miller is a member of city team. When Detective ask GOD about Millers role the result will be bad(Mafia) so" + " Detective will be confused about Millers role and asume he/she as a mafia team member.", + "Postman" : "Postman is a member of city team. After Postman's death he/she can select a player to die with him/her." + " With this power Postman can help city team by killing a mafia member.", + "Priest" : "", + "Rebel" : "Rebel is from city team which gets up at night phase and kills a person.if the victim was chosen from" + " residents, Rebel (him/her)self may die.", + "Reporter" : "Reporter is a city team member. GOD will inform Reporter who was chosen by Made Man to become Mafia.", + "Resident" : "Resident is the typical player of the game. he/she has no power but to blame mafia in order to remove " + "them from the game in day phase.", + "Serial Killer" : "Serial Killer is a seperate team. He/She wakes up once each two night and shot a player." + " Serial Killer will win if He/She is in last three players.", + "Student" : "Student is a innocent city team member. After His/Her death, players will kill two players at day court.", + "Undercover Cop" : "Undercover Cop is a member of city team but he/she will act just like mafia (wakes up at night)" + " and decide whome to be killed)."} -descriptions = {"Don" : "Don is the boss of the mafia group. At night mode he'll decide whom to be killed from mafia team.", - "Resident" : "Resident is the most simple player in the mafia game. he/she has no power but to blame mafia in order to remove them from game in day mode.", - "Mafia" : "Mafia is the simple mafia player. they'll get up at night and try to decide which one of the peoples they want to kill.", - "Doctor": "Doctor gets up after mafia team and try to rescue a person (or two in first night) from mafia's attack.", - "Detector" : "Detector gets up after Doctor and try to ask GOD if someone is good (Resident, Doctor, Rebel, Anti-attack)
" - "or bad(Mafia), but his/her first attempt to ask from Don may be answered incorrect by GOD.", - "Rebel" : "Rebel gets up at night mode and kill a person.if the victim was chosen from residents Rebel (him/her)self may die", - "Anti-attack" : "Anti-attack won't hurt from night shoots. he/she won't die through night mode."} +descriptions_fa = {"Boxor" : "بوکسور عضو تیم مافیا است. او یک فرد را در شب انتخاب میکند و به او مشت میزند پس از این حرکت آن فرد نمیتواند در روز بعد صحبت کند.", + "Bride" : "عروس عضو تیم شهروندان است. او که به تازگی با داماد وصلت کرده است دوران عاشقی را میگذراند. در صورتی که داماد کشته شود عروس میتواند یک فردرا به دلخواه بکشد.", + "Bulletproof" : "ضد ضربه قوی ترين شهروند بازی ميباشد ،و از هر تير مافیا در فاز شب در امان ميباشد.بنابرين ضد ضربه توسط مافيا در فاز شب قابل کشته شدن نميباشد", + "BusDriver" : "راننده اتوبوس عضو تیم شهروندان است و میتواند جای دو نفر را عوض کند یعنی استعلامات و ضربه های روی نفر اول روی نفر دوم اثر میکند.", + "Chef" : "آشپز عضو تیم شهروندان است و با مرگ او شهروندان تنها ۳ روز دیگر برای برد وقت دارند و در غیر این صورت از گشنگی می میرند و مافیا برنده می شود", + "Clown" : "دلقک عضو تیم شهروندان است. در هر بازی میتواند یکبار یک فرد را انتخاب کند تا نقش خود را فاش کند.", + "Curious Kid" : "کودک کنجکاو عضو تیم شهروندان است. وی باید در شب به شکلی که کسی متوجه نشود تیم مافیا را تشخیص دهد.", + "Detective" : "کارآگاه يکی از اعضای تیم شهروند ميباشد که در فاز شب چشم هايش را باز کرده و ميتواند از خدای بازی هويت يکی از افراد بازی را بپرسد ، و خدا با اشاره بله يا خیر به کاراگاه ميگويد که فرد استعلام شده جزو اعضای مافيا هست يا نه", + "Doctor": "دکتر يکی از اعضای تیم شهروند ميباشد که در فاز شب به فرمان خدای بازی چشم هايش را باز کرده و ميتواند خود و يا يکی از بازيکنان را از حذف شدن و کشته شدن در فاز شب بازی نجات دهد.", + "Don" : "اين نقش سردسته تيم مافيا مي باشد و مسئوليت تيم مافيا بر عهده دُن است.امتياز حائز اهميتی که دُن در بازی دارد اين است که استعلامش توسط کاراگاه همانند شهروندان منفی میباشد.", + "Genie" : "غول چراغ جادو عضو تیم شهروندان است. در مجموع می تواند ۳ آرزو را برآورده کند. در شب مشخص می شود که آرزو چه کسی را برآورده کند در روز با آرزو کردن آن شخص آرزو او برآروده می شود", + "Grandma" : "مادربزرگ با اسلحه عضو تیم شهروندان است. در شب هر کسی که به وی سر بزند (بخواهد او را بکشد) خودش خواهد مرد.", + "Groom" : "داماد عضو تیم شهروندان است. او که به تازگی با عروس وصلت کرده است و دوران عاشقی خود را می گذراند . در صورتی که عروس در بازی بمیرد میتواند یک فرد را به دلخواه بکشد.", + "Hit Man" : "آدمکش یکی از حرفه ای ترین مافیا ها است. او تنها یک تیر دارد که جایگزین یکی از قتل های مافیا میشود. اگر تصمیم بگیرد کسی را بکشد چیزی جلوی او را نمیگیرد (نه دکتر و نه ضد ضربه بودن آن شخص)", + "Insane" : "دیوانه عضو تیم شهروندان است. در شب میتواند ببیند که چه کسی فرد کناری او را انتخاب کرده است.", + "Jailer" : "زندان بان عضو تیم شهروندان است. او هر شب به دلخواه یک فرد را انتخاب میکند تا به زندان برود و یک شب از بازی محروم شود.", + "Judge" : "قاضی عضو تیم شهروندان است. او نقش خود را فاش میکند و یک فرد را به دلخواه اعدام میکند.", + "Kind Wife" : "همسر مهربان عضو تیم مافیا است. با مرگ او مافیا ۲ نفر را در فاز شب میکشد.", + "Lawyer" : "وکیل عضو تیم مافیا است. او در شب بیدار میشود و تصمیم میگیرد که چه کسی باید امشب به دادگاه برود.", + "Made Man" : "آدم اجیر کن عضو تیم مافیا است. او شب از خواب بلند میشود و یک فرد از شهروندان را تبدیل به مافیا میکند.", + "Mafia" : "از اعضای تیم مافیا میباشد و اگر کارآگاه از او استعلام بگیرد، استعلامش مثبت می شود", + "Magician" : "جادوگر عضو تیم شهروندان است. او می تواند تنها یکبار یک فرد را بکشد یا نجات دهد.", + "Miller" : "آسیابان عضو تیم شهروندان است. استعلام آسیابان توسط کارآگاه منفی (شبیه مافیا) است .", + "Postman" : "پستچی یکی از اعضای شروندان است. او پس از مرگ یک فرد دیگر را برای مرگ انتخاب میکند و همراه خودش میکشد.", + "Priest" : "", + "Rebel" : "از اعضای تیم شهروند میباشد و در فاز شب میتواند کسی را که فکر میکند مافیا است را هدف قرار دهد اگر شخص مافیا بود خواهد مرد.اما اگر شورشی به اشتباه یک شهروند را هدف قرار دهد خودش خواهد مرد.", + "Reporter" : "گزارشگر عضو تیم شهروندان است. هنگامی که آدم اجیر کن بازیکنی را برای تیم مافیا انتخاب میکند به گزارشگر اطلاع داده می شود.", + "Resident" : "شهروند عضو ساده شهر است. تنها قدرتی که شهروند دارد حذف افراد به واسطه رای گیری در روز است", + "Serial Killer" : "قاتل سریالی یک تیم جدا است که اگر در ۳ نفر آخر باشد برنده است. او یک شب در میان بلند می شود و یک فرد را به دلخواه میشکد", + "Student" : "دانش آموز شهروند بیگناهی است که در صورت کشته شدن تیم شهروندان در فاز روز ۲ تفر را در دادگاه می شکند.", + "Undercover Cop" : "پلیس مخفی عضو تیم شهروندان است او به همراه مافیا بازی میکند و به همراه آن ها در شب بیدار میشود و افراد را برای مرگ انتخاب میکند ولی در نهایت باید به نفع شهروندان عمل کند."} -role2fa = {"Don" : "دن", - "Resident" : "شهروند", - "Mafia" : "مافیا", - "Doctor": "دکتر", - "Detector" : "کارآگاه", - "Rebel" : "شورشی", - "Anti-attack" : "ضد ضربه"} +role2fa = {"Boxer" : "بوکسور", + "Bride" : "عروس", + "Bulletproof" : "ضدضربه", + "Bus Driver" : "راننده اتوبوس", + "Chef" : "آشپز", + "Clown" : "دلقک", + "Curious Kid" : "کودک کنجکاو", + "Detective" : "کارآگاه", + "Doctor" : "دکتر", + "Don" : "دن", + "Genie" : "غول چراغ جادو", + "Grandma" : "مادربزرگ با اسلحه", + "Groom" : "داماد", + "Hit Man" : "آدم کش", + "Insane" : "دیوانه", + "Jailer" : "زندان بان", + "Judge" : "قاضی", + "Kind Wife" : "همسر مهربان", + "Lawyer" : "وکیل", + "Made Man" : "آدم اجیر کن", + "Mafia" : "مافیا", + "Magician" : "جادوگر", + "Miller" : "آسیابان", + "Postman" : "پست چی", + "Priest" : "کشیش", + "Rebel" : "شورشی", + "Reporter" : "خبرنگار", + "Resident" : "شهروند", + "Serial Killer" : "قاتل سریالی", + "Student" : "دانش آموز", + "Undercover Cop" : "پلیس مخفی"} diff --git a/requirements.txt b/requirements.txt index be33b19..093e8f4 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,6 @@ # mafia/mafia.py: 3 Flask == 1.1.2 + +# mafia/mafia.py: 4 +Flask_HTTPAuth == 4.1.0 diff --git a/static/css/style.css b/static/css/style.css index 3ac1725..a5dfda5 100644 --- a/static/css/style.css +++ b/static/css/style.css @@ -1,20 +1,42 @@ +.description { + text-align: justify; + text-justify: auto; + padding-left: 10%; + padding-right: 10%; +} + +#fa { + direction: rtl; + color: rgb(189, 185, 181); +} + h1 { font-size: 30px; padding: 0 0 0 0; margin: 0 0 0 0; } + h2 { font-size: 25px; color: rgb(172, 161, 147); padding: 0 0 0 0; margin: 0 0 0 0; } + +.table_header { + margin: 0 0 0 0; + margin-bottom: 10px; + padding: 0 0 0 0; + text-align: center; +} + p { font-size: 10px; color: rgb(163, 157, 150); padding: 0 0 0 0; margin: 0 0 0 0; } + table, td, th { width: 100%; text-align: center; @@ -27,15 +49,68 @@ th, td { .avatar { width: 200px; height: 200px; + border-radius: 100px; } .id_section { font-size: 10px; } -.description { - text-align: justify; - text-justify: auto; - padding-left: 10%; - padding-right: 10%; +.action_table { + width: auto; + border: 1px solid black; + text-align: center; +} + +.alive { + background-color: white; +} +.banned { + background-color: darkgray; +} +.dead { + background-color: red; +} + +.mafia { + font-size: 20px; + color: #cf3232; +} + +.city { + font-size: 20px; + color: #3283cf; +} + +.serial_killer { + font-size: 20px; + color: #784e88; +} + +#myProgress { + width: 100%; + background-color: #ddd; + border-radius: 5px; +} + +#myBar { + width: 0%; + height: 30px; + background-color: #4f8ace; + color:#ffffff; + text-align: center; + line-height: 30px; + border-radius: 5px; +} + +#player_name { + width: 20%; +} + +#player_role { + width: 20%; +} + +#is_comment { + width: 5%; } diff --git a/static/images/Warns/cross.png b/static/images/Warns/cross.png new file mode 100644 index 0000000..2b4c356 Binary files /dev/null and b/static/images/Warns/cross.png differ diff --git a/static/images/Warns/play.png b/static/images/Warns/play.png new file mode 100644 index 0000000..092121e Binary files /dev/null and b/static/images/Warns/play.png differ diff --git a/static/images/roles/135-waiter.png b/static/images/roles/135-waiter.png deleted file mode 100644 index 7f0f3a1..0000000 Binary files a/static/images/roles/135-waiter.png and /dev/null differ diff --git a/static/images/roles/099-athlete.png b/static/images/roles/Boxer_1.png similarity index 100% rename from static/images/roles/099-athlete.png rename to static/images/roles/Boxer_1.png diff --git a/static/images/roles/024-basketball-player.png b/static/images/roles/Boxer_2.png similarity index 100% rename from static/images/roles/024-basketball-player.png rename to static/images/roles/Boxer_2.png diff --git a/static/images/roles/043-woman-24.png b/static/images/roles/Bride_1.png similarity index 100% rename from static/images/roles/043-woman-24.png rename to static/images/roles/Bride_1.png diff --git a/static/images/roles/109-woman-13.png b/static/images/roles/Bride_2.png similarity index 100% rename from static/images/roles/109-woman-13.png rename to static/images/roles/Bride_2.png diff --git a/static/images/roles/040-woman-25.png b/static/images/roles/Bride_3.png similarity index 100% rename from static/images/roles/040-woman-25.png rename to static/images/roles/Bride_3.png diff --git a/static/images/roles/123-woman-1.png b/static/images/roles/Bride_4.png similarity index 100% rename from static/images/roles/123-woman-1.png rename to static/images/roles/Bride_4.png diff --git a/static/images/roles/105-woman-17.png b/static/images/roles/Bride_5.png similarity index 100% rename from static/images/roles/105-woman-17.png rename to static/images/roles/Bride_5.png diff --git a/static/images/roles/Anti-attack_1.png b/static/images/roles/Bulletproof_1.png similarity index 100% rename from static/images/roles/Anti-attack_1.png rename to static/images/roles/Bulletproof_1.png diff --git a/static/images/roles/140-engineer.png b/static/images/roles/Bulletproof_2.png similarity index 100% rename from static/images/roles/140-engineer.png rename to static/images/roles/Bulletproof_2.png diff --git a/static/images/roles/131-firefighter.png b/static/images/roles/Bulletproof_3.png similarity index 100% rename from static/images/roles/131-firefighter.png rename to static/images/roles/Bulletproof_3.png diff --git a/static/images/roles/128-worker.png b/static/images/roles/Bulletproof_4.png similarity index 100% rename from static/images/roles/128-worker.png rename to static/images/roles/Bulletproof_4.png diff --git a/static/images/roles/010-fireman-1.png b/static/images/roles/Bulletproof_5.png similarity index 100% rename from static/images/roles/010-fireman-1.png rename to static/images/roles/Bulletproof_5.png diff --git a/static/images/roles/076-engineer-1.png b/static/images/roles/Bulletproof_6.png similarity index 100% rename from static/images/roles/076-engineer-1.png rename to static/images/roles/Bulletproof_6.png diff --git a/static/images/roles/078-worker-1.png b/static/images/roles/Bulletproof_7.png similarity index 100% rename from static/images/roles/078-worker-1.png rename to static/images/roles/Bulletproof_7.png diff --git a/static/images/roles/111-profession.png b/static/images/roles/Bulletproof_8.png similarity index 100% rename from static/images/roles/111-profession.png rename to static/images/roles/Bulletproof_8.png diff --git a/static/images/roles/057-nurse-4.png b/static/images/roles/Bulletproof_9.png similarity index 100% rename from static/images/roles/057-nurse-4.png rename to static/images/roles/Bulletproof_9.png diff --git a/static/images/roles/124-man.png b/static/images/roles/Bus Driver_1.png similarity index 100% rename from static/images/roles/124-man.png rename to static/images/roles/Bus Driver_1.png diff --git a/static/images/roles/009-pilot-1.png b/static/images/roles/Bus Driver_2.png similarity index 100% rename from static/images/roles/009-pilot-1.png rename to static/images/roles/Bus Driver_2.png diff --git a/static/images/roles/087-captain.png b/static/images/roles/Bus Driver_3.png similarity index 100% rename from static/images/roles/087-captain.png rename to static/images/roles/Bus Driver_3.png diff --git a/static/images/roles/011-chef-2.png b/static/images/roles/Chef_1.png similarity index 100% rename from static/images/roles/011-chef-2.png rename to static/images/roles/Chef_1.png diff --git a/static/images/roles/132-chef.png b/static/images/roles/Chef_2.png similarity index 100% rename from static/images/roles/132-chef.png rename to static/images/roles/Chef_2.png diff --git a/static/images/roles/056-chef-1.png b/static/images/roles/Chef_3.png similarity index 100% rename from static/images/roles/056-chef-1.png rename to static/images/roles/Chef_3.png diff --git a/static/images/roles/136-bellboy.png b/static/images/roles/Clown_1.png similarity index 100% rename from static/images/roles/136-bellboy.png rename to static/images/roles/Clown_1.png diff --git a/static/images/roles/080-bellboy-1.png b/static/images/roles/Clown_2.png similarity index 100% rename from static/images/roles/080-bellboy-1.png rename to static/images/roles/Clown_2.png diff --git a/static/images/roles/042-teacher-1.png b/static/images/roles/Curious Kid_1.png similarity index 100% rename from static/images/roles/042-teacher-1.png rename to static/images/roles/Curious Kid_1.png diff --git a/static/images/roles/119-woman-5.png b/static/images/roles/Curious Kid_2.png similarity index 100% rename from static/images/roles/119-woman-5.png rename to static/images/roles/Curious Kid_2.png diff --git a/static/images/roles/133-police.png b/static/images/roles/Detective_2.png similarity index 100% rename from static/images/roles/133-police.png rename to static/images/roles/Detective_2.png diff --git a/static/images/roles/052-policeman.png b/static/images/roles/Detective_3.png similarity index 100% rename from static/images/roles/052-policeman.png rename to static/images/roles/Detective_3.png diff --git a/static/images/roles/032-nurse-5.png b/static/images/roles/Doctor_10.png similarity index 100% rename from static/images/roles/032-nurse-5.png rename to static/images/roles/Doctor_10.png diff --git a/static/images/roles/139-nurse.png b/static/images/roles/Doctor_3.png similarity index 100% rename from static/images/roles/139-nurse.png rename to static/images/roles/Doctor_3.png diff --git a/static/images/roles/117-doctor.png b/static/images/roles/Doctor_4.png similarity index 100% rename from static/images/roles/117-doctor.png rename to static/images/roles/Doctor_4.png diff --git a/static/images/roles/058-doctor-2.png b/static/images/roles/Doctor_5.png similarity index 100% rename from static/images/roles/058-doctor-2.png rename to static/images/roles/Doctor_5.png diff --git a/static/images/roles/093-doctor-1.png b/static/images/roles/Doctor_6.png similarity index 100% rename from static/images/roles/093-doctor-1.png rename to static/images/roles/Doctor_6.png diff --git a/static/images/roles/083-nurse-1.png b/static/images/roles/Doctor_7.png similarity index 100% rename from static/images/roles/083-nurse-1.png rename to static/images/roles/Doctor_7.png diff --git a/static/images/roles/081-nurse-2.png b/static/images/roles/Doctor_8.png similarity index 100% rename from static/images/roles/081-nurse-2.png rename to static/images/roles/Doctor_8.png diff --git a/static/images/roles/065-nurse-3.png b/static/images/roles/Doctor_9.png similarity index 100% rename from static/images/roles/065-nurse-3.png rename to static/images/roles/Doctor_9.png diff --git a/static/images/roles/036-teacher-2.png b/static/images/roles/Don_2.png similarity index 100% rename from static/images/roles/036-teacher-2.png rename to static/images/roles/Don_2.png diff --git a/static/images/roles/041-businessman-9.png b/static/images/roles/Don_3.png similarity index 100% rename from static/images/roles/041-businessman-9.png rename to static/images/roles/Don_3.png diff --git a/static/images/roles/063-stewardess.png b/static/images/roles/Don_4.png similarity index 100% rename from static/images/roles/063-stewardess.png rename to static/images/roles/Don_4.png diff --git a/static/images/roles/082-firefighter-1.png b/static/images/roles/Genie_1.png similarity index 100% rename from static/images/roles/082-firefighter-1.png rename to static/images/roles/Genie_1.png diff --git a/static/images/roles/061-fireman.png b/static/images/roles/Genie_2.png similarity index 100% rename from static/images/roles/061-fireman.png rename to static/images/roles/Genie_2.png diff --git a/static/images/roles/075-woman-20.png b/static/images/roles/Grandma_1.png similarity index 100% rename from static/images/roles/075-woman-20.png rename to static/images/roles/Grandma_1.png diff --git a/static/images/roles/120-woman-4.png b/static/images/roles/Grandma_2.png similarity index 100% rename from static/images/roles/120-woman-4.png rename to static/images/roles/Grandma_2.png diff --git a/static/images/roles/045-waiter-2.png b/static/images/roles/Groom_1.png similarity index 100% rename from static/images/roles/045-waiter-2.png rename to static/images/roles/Groom_1.png diff --git a/static/images/roles/012-man-17.png b/static/images/roles/Groom_2.png similarity index 100% rename from static/images/roles/012-man-17.png rename to static/images/roles/Groom_2.png diff --git a/static/images/roles/033-waiter-3.png b/static/images/roles/Groom_3.png similarity index 100% rename from static/images/roles/033-waiter-3.png rename to static/images/roles/Groom_3.png diff --git a/static/images/roles/073-waiter-1.png b/static/images/roles/Groom_4.png similarity index 100% rename from static/images/roles/073-waiter-1.png rename to static/images/roles/Groom_4.png diff --git a/static/images/roles/130-burglar.png b/static/images/roles/Hit Man_1.png similarity index 100% rename from static/images/roles/130-burglar.png rename to static/images/roles/Hit Man_1.png diff --git a/static/images/roles/035-man-11.png b/static/images/roles/Hit Man_2.png similarity index 100% rename from static/images/roles/035-man-11.png rename to static/images/roles/Hit Man_2.png diff --git a/static/images/roles/051-geek.png b/static/images/roles/Insane_1.png similarity index 100% rename from static/images/roles/051-geek.png rename to static/images/roles/Insane_1.png diff --git a/static/images/roles/039-man-10.png b/static/images/roles/Insane_2.png similarity index 100% rename from static/images/roles/039-man-10.png rename to static/images/roles/Insane_2.png diff --git a/static/images/roles/027-football-player.png b/static/images/roles/Insane_3.png similarity index 100% rename from static/images/roles/027-football-player.png rename to static/images/roles/Insane_3.png diff --git a/static/images/roles/138-soldier.png b/static/images/roles/Jailer_1.png similarity index 100% rename from static/images/roles/138-soldier.png rename to static/images/roles/Jailer_1.png diff --git a/static/images/roles/096-businessman.png b/static/images/roles/Jailer_2.png similarity index 100% rename from static/images/roles/096-businessman.png rename to static/images/roles/Jailer_2.png diff --git a/static/images/roles/029-man-12.png b/static/images/roles/Judge_1.png similarity index 100% rename from static/images/roles/029-man-12.png rename to static/images/roles/Judge_1.png diff --git a/static/images/roles/095-businessman-1.png b/static/images/roles/Judge_2.png similarity index 100% rename from static/images/roles/095-businessman-1.png rename to static/images/roles/Judge_2.png diff --git a/static/images/roles/084-businessman-3.png b/static/images/roles/Judge_3.png similarity index 100% rename from static/images/roles/084-businessman-3.png rename to static/images/roles/Judge_3.png diff --git a/static/images/roles/074-businessman-5.png b/static/images/roles/Judge_4.png similarity index 100% rename from static/images/roles/074-businessman-5.png rename to static/images/roles/Judge_4.png diff --git a/static/images/roles/089-businessman-2.png b/static/images/roles/Judge_5.png similarity index 100% rename from static/images/roles/089-businessman-2.png rename to static/images/roles/Judge_5.png diff --git a/static/images/roles/023-businessman-11.png b/static/images/roles/Judge_6.png similarity index 100% rename from static/images/roles/023-businessman-11.png rename to static/images/roles/Judge_6.png diff --git a/static/images/roles/014-woman-33.png b/static/images/roles/Kind Wife_1.png similarity index 100% rename from static/images/roles/014-woman-33.png rename to static/images/roles/Kind Wife_1.png diff --git a/static/images/roles/037-waitress.png b/static/images/roles/Kind Wife_2.png similarity index 100% rename from static/images/roles/037-waitress.png rename to static/images/roles/Kind Wife_2.png diff --git a/static/images/roles/072-woman-21.png b/static/images/roles/Kind Wife_3.png similarity index 100% rename from static/images/roles/072-woman-21.png rename to static/images/roles/Kind Wife_3.png diff --git a/static/images/roles/108-woman-14.png b/static/images/roles/Kind Wife_4.png similarity index 100% rename from static/images/roles/108-woman-14.png rename to static/images/roles/Kind Wife_4.png diff --git a/static/images/roles/049-businessman-7.png b/static/images/roles/Lawyer_1.png similarity index 100% rename from static/images/roles/049-businessman-7.png rename to static/images/roles/Lawyer_1.png diff --git a/static/images/roles/097-lawyer.png b/static/images/roles/Lawyer_2.png similarity index 100% rename from static/images/roles/097-lawyer.png rename to static/images/roles/Lawyer_2.png diff --git a/static/images/roles/034-businessman-10.png b/static/images/roles/Lawyer_3.png similarity index 100% rename from static/images/roles/034-businessman-10.png rename to static/images/roles/Lawyer_3.png diff --git a/static/images/roles/025-man-14.png b/static/images/roles/Made Man_1.png similarity index 100% rename from static/images/roles/025-man-14.png rename to static/images/roles/Made Man_1.png diff --git a/static/images/roles/090-man-6.png b/static/images/roles/Made Man_2.png similarity index 100% rename from static/images/roles/090-man-6.png rename to static/images/roles/Made Man_2.png diff --git a/static/images/roles/092-businesswoman.png b/static/images/roles/Mafia_10.png similarity index 100% rename from static/images/roles/092-businesswoman.png rename to static/images/roles/Mafia_10.png diff --git a/static/images/roles/066-clerk-2.png b/static/images/roles/Mafia_11.png similarity index 100% rename from static/images/roles/066-clerk-2.png rename to static/images/roles/Mafia_11.png diff --git a/static/images/roles/050-clerk-4.png b/static/images/roles/Mafia_12.png similarity index 100% rename from static/images/roles/050-clerk-4.png rename to static/images/roles/Mafia_12.png diff --git a/static/images/roles/019-woman-28.png b/static/images/roles/Mafia_3.png similarity index 100% rename from static/images/roles/019-woman-28.png rename to static/images/roles/Mafia_3.png diff --git a/static/images/roles/098-teacher.png b/static/images/roles/Mafia_4.png similarity index 100% rename from static/images/roles/098-teacher.png rename to static/images/roles/Mafia_4.png diff --git a/static/images/roles/102-man-2.png b/static/images/roles/Mafia_5.png similarity index 100% rename from static/images/roles/102-man-2.png rename to static/images/roles/Mafia_5.png diff --git a/static/images/roles/107-woman-15.png b/static/images/roles/Mafia_6.png similarity index 100% rename from static/images/roles/107-woman-15.png rename to static/images/roles/Mafia_6.png diff --git a/static/images/roles/112-woman-11.png b/static/images/roles/Mafia_7.png similarity index 100% rename from static/images/roles/112-woman-11.png rename to static/images/roles/Mafia_7.png diff --git a/static/images/roles/008-woman-34.png b/static/images/roles/Mafia_8.png similarity index 100% rename from static/images/roles/008-woman-34.png rename to static/images/roles/Mafia_8.png diff --git a/static/images/roles/113-woman-10.png b/static/images/roles/Mafia_9.png similarity index 100% rename from static/images/roles/113-woman-10.png rename to static/images/roles/Mafia_9.png diff --git a/static/images/roles/013-artist.png b/static/images/roles/Magician_1.png similarity index 100% rename from static/images/roles/013-artist.png rename to static/images/roles/Magician_1.png diff --git a/static/images/roles/114-woman-9.png b/static/images/roles/Magician_2.png similarity index 100% rename from static/images/roles/114-woman-9.png rename to static/images/roles/Magician_2.png diff --git a/static/images/roles/104-man-1.png b/static/images/roles/Magician_3.png similarity index 100% rename from static/images/roles/104-man-1.png rename to static/images/roles/Magician_3.png diff --git a/static/images/roles/020-man-16.png b/static/images/roles/Magician_4.png similarity index 100% rename from static/images/roles/020-man-16.png rename to static/images/roles/Magician_4.png diff --git a/static/images/roles/006-man-18.png b/static/images/roles/Miller_1.png similarity index 100% rename from static/images/roles/006-man-18.png rename to static/images/roles/Miller_1.png diff --git a/static/images/roles/046-woman-23.png b/static/images/roles/Miller_2.png similarity index 100% rename from static/images/roles/046-woman-23.png rename to static/images/roles/Miller_2.png diff --git a/static/images/roles/017-woman-30.png b/static/images/roles/Miller_3.png similarity index 100% rename from static/images/roles/017-woman-30.png rename to static/images/roles/Miller_3.png diff --git a/static/images/roles/053-clerk-3.png b/static/images/roles/Miller_4.png similarity index 100% rename from static/images/roles/053-clerk-3.png rename to static/images/roles/Miller_4.png diff --git a/static/images/roles/127-driver.png b/static/images/roles/Postman_1.png similarity index 100% rename from static/images/roles/127-driver.png rename to static/images/roles/Postman_1.png diff --git a/static/images/roles/137-clerk.png b/static/images/roles/Postman_2.png similarity index 100% rename from static/images/roles/137-clerk.png rename to static/images/roles/Postman_2.png diff --git a/static/images/roles/044-stewardess-1.png b/static/images/roles/Postman_3.png similarity index 100% rename from static/images/roles/044-stewardess-1.png rename to static/images/roles/Postman_3.png diff --git a/static/images/roles/054-priest-1.png b/static/images/roles/Priest_1.png similarity index 100% rename from static/images/roles/054-priest-1.png rename to static/images/roles/Priest_1.png diff --git a/static/images/roles/064-priest.png b/static/images/roles/Priest_2.png similarity index 100% rename from static/images/roles/064-priest.png rename to static/images/roles/Priest_2.png diff --git a/static/images/roles/085-nun.png b/static/images/roles/Priest_3.png similarity index 100% rename from static/images/roles/085-nun.png rename to static/images/roles/Priest_3.png diff --git a/static/images/roles/091-man-5.png b/static/images/roles/Rebel_2.png similarity index 100% rename from static/images/roles/091-man-5.png rename to static/images/roles/Rebel_2.png diff --git a/static/images/roles/101-man-3.png b/static/images/roles/Rebel_3.png similarity index 100% rename from static/images/roles/101-man-3.png rename to static/images/roles/Rebel_3.png diff --git a/static/images/roles/002-telemarketer-4.png b/static/images/roles/Reporter_1.png similarity index 100% rename from static/images/roles/002-telemarketer-4.png rename to static/images/roles/Reporter_1.png diff --git a/static/images/roles/134-telemarketer.png b/static/images/roles/Reporter_2.png similarity index 100% rename from static/images/roles/134-telemarketer.png rename to static/images/roles/Reporter_2.png diff --git a/static/images/roles/022-telemarketer-3.png b/static/images/roles/Reporter_3.png similarity index 100% rename from static/images/roles/022-telemarketer-3.png rename to static/images/roles/Reporter_3.png diff --git a/static/images/roles/086-customer-service.png b/static/images/roles/Reporter_4.png similarity index 100% rename from static/images/roles/086-customer-service.png rename to static/images/roles/Reporter_4.png diff --git a/static/images/roles/068-telemarketer-1.png b/static/images/roles/Reporter_5.png similarity index 100% rename from static/images/roles/068-telemarketer-1.png rename to static/images/roles/Reporter_5.png diff --git a/static/images/roles/060-telemarketer-2.png b/static/images/roles/Reporter_6.png similarity index 100% rename from static/images/roles/060-telemarketer-2.png rename to static/images/roles/Reporter_6.png diff --git a/static/images/roles/122-woman-2.png b/static/images/roles/Resident_10.png similarity index 100% rename from static/images/roles/122-woman-2.png rename to static/images/roles/Resident_10.png diff --git a/static/images/roles/018-woman-29.png b/static/images/roles/Resident_11.png similarity index 100% rename from static/images/roles/018-woman-29.png rename to static/images/roles/Resident_11.png diff --git a/static/images/roles/016-woman-31.png b/static/images/roles/Resident_12.png similarity index 100% rename from static/images/roles/016-woman-31.png rename to static/images/roles/Resident_12.png diff --git a/static/images/roles/118-woman-6.png b/static/images/roles/Resident_13.png similarity index 100% rename from static/images/roles/118-woman-6.png rename to static/images/roles/Resident_13.png diff --git a/static/images/roles/115-woman-8.png b/static/images/roles/Resident_14.png similarity index 100% rename from static/images/roles/115-woman-8.png rename to static/images/roles/Resident_14.png diff --git a/static/images/roles/110-woman-12.png b/static/images/roles/Resident_15.png similarity index 100% rename from static/images/roles/110-woman-12.png rename to static/images/roles/Resident_15.png diff --git a/static/images/roles/106-woman-16.png b/static/images/roles/Resident_16.png similarity index 100% rename from static/images/roles/106-woman-16.png rename to static/images/roles/Resident_16.png diff --git a/static/images/roles/100-woman-19.png b/static/images/roles/Resident_17.png similarity index 100% rename from static/images/roles/100-woman-19.png rename to static/images/roles/Resident_17.png diff --git a/static/images/roles/055-businessman-6.png b/static/images/roles/Resident_18.png similarity index 100% rename from static/images/roles/055-businessman-6.png rename to static/images/roles/Resident_18.png diff --git a/static/images/roles/070-clerk-1.png b/static/images/roles/Resident_19.png similarity index 100% rename from static/images/roles/070-clerk-1.png rename to static/images/roles/Resident_19.png diff --git a/static/images/roles/030-cleaner.png b/static/images/roles/Resident_20.png similarity index 100% rename from static/images/roles/030-cleaner.png rename to static/images/roles/Resident_20.png diff --git a/static/images/roles/038-woman-26.png b/static/images/roles/Resident_21.png similarity index 100% rename from static/images/roles/038-woman-26.png rename to static/images/roles/Resident_21.png diff --git a/static/images/roles/015-woman-32.png b/static/images/roles/Resident_5.png similarity index 100% rename from static/images/roles/015-woman-32.png rename to static/images/roles/Resident_5.png diff --git a/static/images/roles/028-woman-27.png b/static/images/roles/Resident_6.png similarity index 100% rename from static/images/roles/028-woman-27.png rename to static/images/roles/Resident_6.png diff --git a/static/images/roles/116-woman-7.png b/static/images/roles/Resident_7.png similarity index 100% rename from static/images/roles/116-woman-7.png rename to static/images/roles/Resident_7.png diff --git a/static/images/roles/026-man-13.png b/static/images/roles/Resident_8.png similarity index 100% rename from static/images/roles/026-man-13.png rename to static/images/roles/Resident_8.png diff --git a/static/images/roles/126-woman.png b/static/images/roles/Resident_9.png similarity index 100% rename from static/images/roles/126-woman.png rename to static/images/roles/Resident_9.png diff --git a/static/images/roles/088-man-7.png b/static/images/roles/Serial Killer_1.png similarity index 100% rename from static/images/roles/088-man-7.png rename to static/images/roles/Serial Killer_1.png diff --git a/static/images/roles/079-hipster.png b/static/images/roles/Serial Killer_2.png similarity index 100% rename from static/images/roles/079-hipster.png rename to static/images/roles/Serial Killer_2.png diff --git a/static/images/roles/094-man-4.png b/static/images/roles/Serial Killer_3.png similarity index 100% rename from static/images/roles/094-man-4.png rename to static/images/roles/Serial Killer_3.png diff --git a/static/images/roles/103-woman-18.png b/static/images/roles/Serial Killer_4.png similarity index 100% rename from static/images/roles/103-woman-18.png rename to static/images/roles/Serial Killer_4.png diff --git a/static/images/roles/021-man-15.png b/static/images/roles/Serial Killer_5.png similarity index 100% rename from static/images/roles/021-man-15.png rename to static/images/roles/Serial Killer_5.png diff --git a/static/images/roles/047-businesswoman-1.png b/static/images/roles/Serial Killer_6.png similarity index 100% rename from static/images/roles/047-businesswoman-1.png rename to static/images/roles/Serial Killer_6.png diff --git a/static/images/roles/125-graduate.png b/static/images/roles/Student_1.png similarity index 100% rename from static/images/roles/125-graduate.png rename to static/images/roles/Student_1.png diff --git a/static/images/roles/077-businessman-4.png b/static/images/roles/Student_2.png similarity index 100% rename from static/images/roles/077-businessman-4.png rename to static/images/roles/Student_2.png diff --git a/static/images/roles/031-secret-service.png b/static/images/roles/Undercover Cop_1.png similarity index 100% rename from static/images/roles/031-secret-service.png rename to static/images/roles/Undercover Cop_1.png diff --git a/static/images/roles/067-pilot.png b/static/images/roles/Undercover Cop_2.png similarity index 100% rename from static/images/roles/067-pilot.png rename to static/images/roles/Undercover Cop_2.png diff --git a/static/js/main.js b/static/js/main.js new file mode 100644 index 0000000..fd11e19 --- /dev/null +++ b/static/js/main.js @@ -0,0 +1,38 @@ +var i = 0; +function start() { + if (i == 0) { + i = 1; + var elem = document.getElementById("myBar"); + var beep_sound = document.getElementById("beep") + var width = 0; + var time_from_start = 0; + var id = setInterval(frame, 10); + function frame() { + if (width >= 100) { + clearInterval(id); + beep_sound.play(); + i = 0; + } else { + width += 1 / 45; + time_from_start = 45 * width / 100; + elem.style.width = width + "%"; + elem.innerHTML = time_from_start.toFixed(2); + elem.style.backgroundColor = "rgb(" + time_from_start * 6 +", 50, 50)"; + } + } + } +} + +function delay (URL, delay_time) { + setTimeout( function() { window.location = URL }, delay_time ); +} + +function kill_sound_play(){ + var kill_sound = document.getElementById("kill"); + kill_sound.play(); +} + +function ban_sound_play(){ + var ban_sound = document.getElementById("ban"); + ban_sound.play(); +} diff --git a/static/voices/ban.mp3 b/static/voices/ban.mp3 new file mode 100644 index 0000000..d9e7a9f Binary files /dev/null and b/static/voices/ban.mp3 differ diff --git a/static/voices/beep.mp3 b/static/voices/beep.mp3 new file mode 100644 index 0000000..fdcaa16 Binary files /dev/null and b/static/voices/beep.mp3 differ diff --git a/static/voices/kill.mp3 b/static/voices/kill.mp3 new file mode 100644 index 0000000..7b1146f Binary files /dev/null and b/static/voices/kill.mp3 differ diff --git a/templates/404.html b/templates/404.html new file mode 100644 index 0000000..4d39042 --- /dev/null +++ b/templates/404.html @@ -0,0 +1,17 @@ +{% extends 'base.html' %} + +{% block title %} +FekroBot::mafia::404 +{% endblock %} + +{% block avatar %} + +{% endblock %} + +{% block role_title %} +

404

+

Page Not Found!

+{% if is_farsi == True %} +

صفحه مورد نظر یافت نشد

+{% endif %} +{% endblock %} diff --git a/templates/GOD.html b/templates/GOD.html new file mode 100644 index 0000000..77cf431 --- /dev/null +++ b/templates/GOD.html @@ -0,0 +1,92 @@ +{% extends 'base_action.html' %} + +{% block Audio %} + + +{% endblock %} + +{% block sub_table_1 %} +

Players

+ + C + Player Name + Player Role + Actions + +{% for ip in ip2role_index_name.keys() %} +{% if ip2role_index_name[ip][3] == "alive" %} + + {% if ip2role_index_name[ip][4] == True%}+{% endif %} + {{ ip2role_index_name[ip][2] }} +

{{ ip2role_index_name[ip][0] }}

+ Ban + Comment + Kill + +{% endif %} +{% endfor %} + +{% for ip in ip2role_index_name.keys() %} +{% if ip2role_index_name[ip][3] == "banned" %} + + {% if ip2role_index_name[ip][4] == True%}+{% endif %} + {{ ip2role_index_name[ip][2] }} +

{{ ip2role_index_name[ip][0] }}

+ Ban + Comment + Kill + +{% endif %} +{% endfor %} + +{% for ip in ip2role_index_name.keys() %} +{% if ip2role_index_name[ip][3] == "dead" %} + + {% if ip2role_index_name[ip][4] == True%}+{% endif %} + {{ ip2role_index_name[ip][2] }} +

{{ ip2role_index_name[ip][0] }}

+ Ban + Comment + Kill + +{% endif %} +{% endfor %} +{% endblock %} + +{% block sub_table_2 %} +
+

Comments

+ + # + Player Name + Player Role + +{% for ip in comments %} + + {{ comments.index(ip) + 1 }} + {{ ip2role_index_name[ip][2] }} +

{{ ip2role_index_name[ip][0] }}

+ +{% endfor %} +{% endblock %} + +{% block roles %} +
+

Game Roles

+{% for role in roles.keys() %} +

+{{ role }} : {{ roles[role] }} +

+{% endfor %} +
+{% endblock %} + +{% block messages %} +{{ prompt_message }} +{% endblock %} diff --git a/templates/Player.html b/templates/Player.html new file mode 100644 index 0000000..82c2d2a --- /dev/null +++ b/templates/Player.html @@ -0,0 +1,31 @@ +{% extends 'base_action.html' %} + +{% block Audio %} + +{% endblock %} + +{% block sub_table_1 %} + + +

{{ player[2] }}

+ + + + + {% if player[3] == "alive" %} + +
+
0
+
+ {% endif %} + {% if player[3] == "dead" %}You are Killed!{% endif %} + {% if player[3] == "banned" %}You are Banned from speaking this turn!{% endif %} + + +{% endblock %} + +{% block messages %} +{% endblock %} diff --git a/templates/base.html b/templates/base.html index 891f893..3416292 100644 --- a/templates/base.html +++ b/templates/base.html @@ -4,6 +4,7 @@ + {% block import %}{% endblock %} diff --git a/templates/base_action.html b/templates/base_action.html new file mode 100644 index 0000000..2e3e03d --- /dev/null +++ b/templates/base_action.html @@ -0,0 +1,22 @@ + + + Codestin Search App + + + + + + +{% block Audio %} +{% endblock %} +
+ {% block sub_table_1 %}{% endblock %} +
+ + {% block sub_table_2 %}{% endblock %} +
+{% block roles %} +{% endblock %} +{% block messages %} +{% endblock %} + diff --git a/templates/index.html b/templates/index.html index 5fe512f..557c63a 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,6 +4,16 @@ FekroBot::mafia::{{ role_name }} {% endblock %} +{% block import %} + +{% endblock %} + {% block avatar %} {% endblock %} @@ -19,10 +29,9 @@

{{ role_name_fa }}

{% block desc %}

{{ description }}

{% if is_farsi == True %} -

...

+

{{ description_fa }}

{% endif %} {% endblock %} {% block id_sec %} -

Your id (Tell it to the God): {{ player_id }}

{% endblock %}