From 7a397accb9bb4b5c32618242072ca02bafe20f3b Mon Sep 17 00:00:00 2001 From: catvayor Date: Wed, 14 Sep 2022 17:11:04 +0200 Subject: [PATCH] invisibility code generator --- static/admin.html | 18 ++++++++++++++++-- traque.js | 10 +++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/static/admin.html b/static/admin.html index 7403b81..3928d35 100644 --- a/static/admin.html +++ b/static/admin.html @@ -26,11 +26,20 @@


+

diff --git a/traque.js b/traque.js index 4dda034..48c95e7 100644 --- a/traque.js +++ b/traque.js @@ -20,14 +20,14 @@ Les messages à transmettre par le serveur : // Textes d'interaction avec les conscrits var PWD_TRACKED = "tracked"; var PWD_TRACKER = "tracker"; -var PWD_INVISIBLE = "invisible"; -var MSG_BAD = "La base n'a pas compris votre message..."; +var MSG_BAD = "Code Incorrect"; var MSG_TRACKED = "Vous êtes maintenant traqué.e.s !" var MSG_TRACKER = "Vous pouvez maintenant traquer !"; var MSG_INVISIBLE = "Les autres équipes ne peuvent plus vous voir !"; var equipes = []; var admins = []; +var invisi = {}; // require = include var http = require('https');//require('http'); @@ -118,7 +118,8 @@ io.sockets.on('connection', function(socket){ d.color = 1; socket.emit('popup', {"content": MSG_TRACKER}); } - else if(d.content == PWD_INVISIBLE){ + else if((d.content in invisi) && invisi[d.content]){ + invisi[d.content] = false; d.color = -1; socket.emit('popup', {"content": MSG_INVISIBLE}); } else { @@ -146,6 +147,9 @@ io.sockets.on('connection', function(socket){ for(i in equipes) equipes[i].emit('setName', {"id": socket.id, "name": d.name}); }); + socket.on('newCode', function(d){ + invisi[d.code] = true; + }); socket.on("disconnect", function(_){ console.log(socket.id + " disconnect"); socket.shown = false;