From 652852e3104ce4020de53231ee7691a4970439d6 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sat, 1 May 2021 00:48:35 +0200 Subject: Add server and lobby code. --- views/join.ejs | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 views/join.ejs (limited to 'views/join.ejs') diff --git a/views/join.ejs b/views/join.ejs new file mode 100644 index 0000000..810e0f4 --- /dev/null +++ b/views/join.ejs @@ -0,0 +1,85 @@ +<%- include('header', { title: game.title_name, refresh: game.status == 0 ? 15 : 0 }) %> + + + + +

+Owner: <%= game.owner_name %> +

+Scenario: <%= game.scenario %> +

+Description: <%= game.description || "No description." %> + +
+ +

+ + +<% + roles.forEach((role) => { + %> +<% + roles.forEach((role) => { + if (game.active == role.role || game.active == "Both" || game.active == "All") { + %>
<%= role.role %><% + }); +%> +
<% + } else { + %><% + } + let p = players.find(p => p.role == role.role); + if (game.status == 0) { + if (p) { + if ((p.user_id == user.user_id) || (game.owner_id == user.user_id)) { + %> <% + %><%= p.name %><% + } else { + %><%= p.name %><% + } + } else { + %>Join<% + } + } else { + if (p) { + if (p.user_id == user.user_id) { + %>Play<% + } else { + %><%= p.name %><% + } + } else { + %>Empty<% + } + } + }); + if (game.status > 0 && !players.some(p => p.user_id == user.user_id)) { + %> +
View + <% + } +%> +
+ +

+<% + if (game.status == 0) { + if (players.length == roles.length) { + if (game.owner_id == user.user_id) { + %>

<% + } else { + %>Waiting for <%= game.owner_name %> to start the game.<% + } + } else { + %>Waiting for players to join the game.<% + } + } + if (game.owner_id == user.user_id && (game.status == 0 || solo)) { + %>


<% + } +%> -- cgit v1.2.3