Skip to content

Commit

Permalink
Add a way to see which options are being used during a game.
Browse files Browse the repository at this point in the history
  • Loading branch information
corlewis committed Nov 24, 2015
1 parent 12691bf commit 319e8b4
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 7 deletions.
43 changes: 42 additions & 1 deletion client/client.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Array::sum = () ->
@reduce (x, y) -> x + y

VERSION = 2

jQuery ->
#Socket.io stuff
Expand Down Expand Up @@ -489,7 +490,7 @@ jQuery ->
else
$("#quest").hide()

#Draw the hidden info box
#Draw the hidden info box and store whether the player is the assassin
$("#hiddeninfo").empty()
if me.role == "Assassin" && game.state != GAME_ASSASSIN
$("#hiddeninfo").addClass("Assassin")
Expand All @@ -516,6 +517,39 @@ jQuery ->
.append(info)
$("#hiddeninfo").append(li)

#Draw the chosen options box
$("#chosenoptions").empty()
if game.options.mordred
li = $("<li>")
.addClass("list-group-item")
.text("Mordred")
$("#chosenoptions").append(li)
if game.options.oberon
li = $("<li>")
.addClass("list-group-item")
.text("Oberon")
$("#chosenoptions").append(li)
if game.options.showfails
li = $("<li>")
.addClass("list-group-item")
.text("Show number of fails")
$("#chosenoptions").append(li)
if game.options.ladylake
li = $("<li>")
.addClass("list-group-item")
.text("Lady of the Lake")
$("#chosenoptions").append(li)
if game.options.ptrc
li = $("<li>")
.addClass("list-group-item")
.text("PTRC")
$("#chosenoptions").append(li)
if game.options.hidden_ptrc
li = $("<li>")
.addClass("list-group-item")
.text("Hidden PTRC")
$("#chosenoptions").append(li)

#If someone is trying to reconnect show vote
if game.reconnect_user && game.reconnect_user != ""
if game.reconnect_vote[me.order] == 0
Expand Down Expand Up @@ -576,6 +610,13 @@ jQuery ->
$("#btn_early_assassinate").show()
$("#hiddeninfo").toggle()

$("#btn_showoptions").on 'click', () ->
if $("#chosenoptions").is(":visible")
$("#btn_showoptions").text("Show Options")
else
$("#btn_showoptions").text("Hide Options")
$("#chosenoptions").toggle()

$(".options-list li").on 'click', (e) ->
e.preventDefault()
chk = $(this).find("input").first()
Expand Down
6 changes: 3 additions & 3 deletions css/avalon.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ a {
#hiddeninfo {
display: none;
}
#chosenoptions {
display: none;
}
#quest {
display: none;
}
Expand Down Expand Up @@ -98,9 +101,6 @@ a {
color: red;
}

.Assassin {
}

.good {
color: blue;
}
Expand Down
4 changes: 4 additions & 0 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ <h2>Avalon</h2>
<ul class="list-group" id="hiddeninfo"></ul>
<button class="btn btn-lg btn-primary btn-block" id="btn_early_assassinate">Assassinate</button>

<button class="btn btn-lg btn-warning btn-block" id="btn_showoptions">Show Options</button>
<ul class="list-group" id="chosenoptions"></ul>


<br />
<button class="btn btn-lg btn-danger btn-block" id="btn_quit">Quit Game</button>

Expand Down
2 changes: 2 additions & 0 deletions server/avalon.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Q = require('q')
Array::sum = () ->
@reduce (x, y) -> x + y

VERSION = 2

send_game_list = () ->
Game.find {}, (err, games) ->
data =
Expand Down
2 changes: 1 addition & 1 deletion server/db.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ gameSchema.methods.start_game = (order) ->

if this.gameOptions.danmode
for p, i in this.players
if p.name == "Dan"
if p.name == "Alex"
p.role = "Servant"
p.isEvil = false

Expand Down
3 changes: 1 addition & 2 deletions server/default_config.coffee
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
PORT = 80
IP = "192.168.1.1"
DEBUG = true
ADMINPW = "adminpassword_changeme"
VERSION = 1
ADMINPW = "adminpassword_changeme"

0 comments on commit 319e8b4

Please sign in to comment.