From 9e9e56ffa229c337be54142fd50a221f73e96eb4 Mon Sep 17 00:00:00 2001 From: gnieark Date: Wed, 15 Jun 2016 21:24:21 +0200 Subject: [PATCH 1/8] add check to view fulll logs --- src/PHPMailer | 2 +- src/arenas/connectFour/js.js | 6 +----- src/arenas/connectFour/public.php | 1 + 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/PHPMailer b/src/PHPMailer index c2bde34..1d85f9e 160000 --- a/src/PHPMailer +++ b/src/PHPMailer @@ -1 +1 @@ -Subproject commit c2bde34e58caa500b8fb2f7e14fc9765596cdf6d +Subproject commit 1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a diff --git a/src/arenas/connectFour/js.js b/src/arenas/connectFour/js.js index 301df4d..223a40f 100644 --- a/src/arenas/connectFour/js.js +++ b/src/arenas/connectFour/js.js @@ -57,9 +57,6 @@ function connectFour(bot1,bot2,xd_check, gameId, newGame){ var xhr = Ajx(); xhr.onreadystatechange = function(){if(xhr.readyState == 4){ if(xhr.status == 200) { - //for test - // alert(xhr.responseText); - try{ var reponse = JSON.parse(xhr.responseText); }catch(e){ @@ -85,7 +82,6 @@ function connectFour(bot1,bot2,xd_check, gameId, newGame){ } - //if game isn't finished, continue if(reponse['continue'] == 1){ connectFour(bot1,bot2,xd_check,reponse['gameId'], false); @@ -108,5 +104,5 @@ function connectFour(bot1,bot2,xd_check, gameId, newGame){ }else{ var act='fight'; } - xhr.send('act=' + act + '&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check + '&gameId=' + gameId); + xhr.send('act=' + act + '&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check + '&gameId=' + gameId + '&fullLogs=' + document.getElementById("fullLogs").checked;); } diff --git a/src/arenas/connectFour/public.php b/src/arenas/connectFour/public.php index fda7c86..cebcef7 100644 --- a/src/arenas/connectFour/public.php +++ b/src/arenas/connectFour/public.php @@ -23,5 +23,6 @@ $bots=get_Bots_Array('connectFou'); ?>

+

view the full logs

From 1289a49f9cf44f873f42e14becf08fa59c90f2d0 Mon Sep 17 00:00:00 2001 From: gnieark Date: Wed, 15 Jun 2016 21:27:25 +0200 Subject: [PATCH 2/8] add check to view fulll logs --- src/arenas/connectFour/public.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/connectFour/public.php b/src/arenas/connectFour/public.php index cebcef7..cb90320 100644 --- a/src/arenas/connectFour/public.php +++ b/src/arenas/connectFour/public.php @@ -23,6 +23,6 @@ $bots=get_Bots_Array('connectFou'); ?>

-

view the full logs

+

From 5e3d2e6e1b0f4f60352ecf1deb08c369ca3c12ee Mon Sep 17 00:00:00 2001 From: gnieark Date: Wed, 15 Jun 2016 21:30:29 +0200 Subject: [PATCH 3/8] add check to view fulll logs --- src/arenas/connectFour/public.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/arenas/connectFour/public.php b/src/arenas/connectFour/public.php index cb90320..7499db2 100644 --- a/src/arenas/connectFour/public.php +++ b/src/arenas/connectFour/public.php @@ -1,8 +1,6 @@

From ec942f463328dd5ddbebffccfadbce81d02406e8 Mon Sep 17 00:00:00 2001 From: gnieark Date: Wed, 15 Jun 2016 21:37:11 +0200 Subject: [PATCH 4/8] 2 --- src/arenas/Battleship/act.php | 11 +++++++++++ src/arenas/Battleship/functions.php | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/arenas/Battleship/act.php b/src/arenas/Battleship/act.php index b928e8c..1bb6aa7 100644 --- a/src/arenas/Battleship/act.php +++ b/src/arenas/Battleship/act.php @@ -1,4 +1,15 @@ Date: Wed, 15 Jun 2016 21:57:12 +0200 Subject: [PATCH 5/8] fix --- src/arenas/connectFour/js.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arenas/connectFour/js.js b/src/arenas/connectFour/js.js index 223a40f..4ad1759 100644 --- a/src/arenas/connectFour/js.js +++ b/src/arenas/connectFour/js.js @@ -104,5 +104,5 @@ function connectFour(bot1,bot2,xd_check, gameId, newGame){ }else{ var act='fight'; } - xhr.send('act=' + act + '&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check + '&gameId=' + gameId + '&fullLogs=' + document.getElementById("fullLogs").checked;); + xhr.send('act=' + act + '&bot1=' + bot1 + '&bot2=' + bot2 + '&xd_check=' + xd_check + '&gameId=' + gameId + '&fullLogs=' + document.getElementById("fullLogs").checked); } From cad2b778cce94c8049d4d5be80b848b7aa6cd5a8 Mon Sep 17 00:00:00 2001 From: gnieark Date: Thu, 16 Jun 2016 00:17:45 +0200 Subject: [PATCH 6/8] fulll logs --- src/arenas/connectFour/act.php | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/arenas/connectFour/act.php b/src/arenas/connectFour/act.php index 708c9df..3fd4e62 100644 --- a/src/arenas/connectFour/act.php +++ b/src/arenas/connectFour/act.php @@ -132,7 +132,15 @@ switch ($_POST['act']){ }else{ $anwserPlayer = -1; } - + + if($_POST['fullLogs'] == "true"){ + $fullLogs='Arena send to '.$currentBotName.''.htmlentities($tempPlayer['messageSend']).'
+ HTTP status: '.htmlentities($tempPlayer['httpStatus']).'
+ Bot anwser: '.htmlentities($tempPlayer['response']).'
'; + + }else{ + $fullLogs=''; + } //vérifier la validité de la réponse if((isset($_SESSION['map'][5][$anwserPlayer])) && ($_SESSION['map'][5][$anwserPlayer] == "")){ //reponse conforme @@ -258,7 +266,7 @@ switch ($_POST['act']){ 'strikeX' => $strikeX, 'strikeY' => $strikeY, 'strikeSymbol'=> $you, - 'log' => $you." ".$currentBotName." joue colonne ". $anwserPlayer." et a gagné", + 'log' => $fullLogs.$you." ".$currentBotName." joue colonne ". $anwserPlayer." et a gagné", 'cellsWin' => json_encode($cellsWin), 'gameId' => $_SESSION['matchId'] ); @@ -288,7 +296,7 @@ switch ($_POST['act']){ 'strikeX' => $strikeX, 'strikeY' => $strikeY, 'strikeSymbol'=> $you, - 'log' => $you." ".$currentBotName." joue colonne ". $anwserPlayer." match nul", + 'log' => $fullLogs.$you." ".$currentBotName." joue colonne ". $anwserPlayer." match nul", 'gameId' => $_SESSION['matchId'] ); @@ -299,7 +307,7 @@ switch ($_POST['act']){ 'strikeX' => $strikeX, 'strikeY' => $strikeY, 'strikeSymbol'=> $you, - 'log' => $you." ".$currentBotName." joue colonne ". $anwserPlayer, + 'log' => $fullLogs.$you." ".$currentBotName." joue colonne ". $anwserPlayer, 'gameId' => $_SESSION['matchId'] ); } @@ -312,10 +320,7 @@ switch ($_POST['act']){ 'continue' =>0, 'strikeX' => -1, 'strikeY' => -1, - 'log' => $you." ".$currentBotName." made a non conform anwser:
- Bots Arena sent:".$tempPlayer['messageSend']."
- ".$currentBotName." HTTP STATUS: ".$tempPlayer['httpStatus']."
- His response: ".htmlentities($tempPlayer['response'])."", + 'log' => $fullLogs.$you." ".$currentBotName." made a non conform anwser.", 'gameId' => $_SESSION['matchId'] ); if($_SESSION['currentPlayer']==1){ From eee40de1bbc4fd59e1d996380f45788d648ce326 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Thu, 16 Jun 2016 09:21:58 +0200 Subject: [PATCH 7/8] . --- src/PHPMailer | 2 +- src/arenas/connectFour/act.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PHPMailer b/src/PHPMailer index 1d85f9e..7c8b786 160000 --- a/src/PHPMailer +++ b/src/PHPMailer @@ -1 +1 @@ -Subproject commit 1d85f9ef3ecfc42bbc4f3c70d5e37ca9a65f629a +Subproject commit 7c8b786228bb9e1561ff60a2d6f7f6ce91be6fee diff --git a/src/arenas/connectFour/act.php b/src/arenas/connectFour/act.php index 3fd4e62..d5399a0 100644 --- a/src/arenas/connectFour/act.php +++ b/src/arenas/connectFour/act.php @@ -135,8 +135,8 @@ switch ($_POST['act']){ if($_POST['fullLogs'] == "true"){ $fullLogs='Arena send to '.$currentBotName.''.htmlentities($tempPlayer['messageSend']).'
- HTTP status: '.htmlentities($tempPlayer['httpStatus']).'
- Bot anwser: '.htmlentities($tempPlayer['response']).'
'; + HTTP status: '.htmlentities($tempPlayer['httpStatus']).'
+ Bot anwser: '.htmlentities($tempPlayer['response']).'
'; }else{ $fullLogs=''; From bea3a2aa899b981c6debb030d44c86f44b487539 Mon Sep 17 00:00:00 2001 From: Gnieark Date: Thu, 16 Jun 2016 09:46:57 +0200 Subject: [PATCH 8/8] . --- src/arenas/connectFour/js.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/arenas/connectFour/js.js b/src/arenas/connectFour/js.js index 4ad1759..2802f6a 100644 --- a/src/arenas/connectFour/js.js +++ b/src/arenas/connectFour/js.js @@ -13,9 +13,12 @@ function Ajx(){ return request; } function addLog(message){ + var divLogs = document.getElementById("logs"); var p=createElem('p',{}); p.innerHTML=message; - document.getElementById('logs').appendChild(p); + divLogs.appendChild(p); + divLogs.scrollTop = divLogs.scrollHeight; + } function createElem(type,attributes){ var elem=document.createElement(type);