X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=eb66a987157c6bcd98ddbcf57f0ce343e7e7fcca;hp=a1c02a0b4f90f4929f6c856254bf3b13ca6a7b30;hb=8550cac6f9bedbd9219d898f7b3de731bf1cb2b2;hpb=6e7ed2d202da016b9a74256371369cc41201df2e diff --git a/include/game.php b/include/game.php index a1c02a0..eb66a98 100644 --- a/include/game.php +++ b/include/game.php @@ -47,6 +47,7 @@ global $GAME,$RULES,$CARDS; $gameid = DB_get_gameid_by_hash($me); $myname = DB_get_name('hash',$me); $mystatus = DB_get_status_by_hash($me); +$origmystatus = DB_get_status_by_hash($me); /* to show "it's your turn" menu when game has just finished */ $mypos = DB_get_pos_by_hash($me); $myhand = DB_get_handid('hash',$me); $myparty = DB_get_party_by_hash($me); @@ -184,44 +185,45 @@ unset($comment); if($session) { echo "
'._('This step can only be handled after everyone finished the last step. '. + 'Seems like this is not the case, so you need to wait a bit... '. + 'you will get an email once that is the case, please use the link in '. + 'that email to continue the game.').'
Ok, everyone is done... figuring out what kind of game we are playing.
"; + echo ''._('Ok, everyone is done... figuring out what kind of game we are playing.').'
'; $gametype = DB_get_gametype_by_gameid($gameid); $startplayer = DB_get_startplayer_by_gameid($gameid); /* check for sickness */ - $nines = 0; + $cancel = 0; $poverty = 0; $wedding = 0; $solo = 0; @@ -599,12 +612,13 @@ switch($mystatus) { $name = DB_get_name('userid',$user); $usersick = DB_get_sickness_by_userid_and_gameid($user,$gameid); - if($usersick == 'nines') + if($usersick == 'nines' || ($RULES['lowtrump']=='cancel' && $usersick=='lowtrump') ) { - $nines = $user; + $cancel = $user; + $cancelsick = $usersick; break; /* no need to check for other poverties, since only solo can win and that is already set */ } - else if($usersick == 'poverty') + else if($usersick == 'poverty' || ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) $poverty++; else if($usersick == 'wedding') $wedding=$user; @@ -617,13 +631,35 @@ switch($mystatus) { /* do nothing */ } - else if($nines) + else if($cancel) { /* cancel game */ - $message = "The game has been canceled because ".DB_get_name('userid',$nines). - " has five or more nines and nobody is playing solo.\n\n". - "To redeal either start a new game or, in case the game was part of a tournament,\n". - "go to the last game and use the link at the bottom of the page to redeal.\n\n"; + if($cancelsick == 'nines') + { + $message = "The game has been canceled because ".DB_get_name('userid',$cancel). + " has five or more nines and nobody is playing solo.\n\n". + "To redeal either start a new game or, in case the game was part of a tournament,\n". + "go to the last game and use the link at the bottom of the page to redeal.\n\n"; + + /* update game status */ + cancel_game('nines',$gameid); + + echo "The game has been canceled because ".DB_get_name('userid',$cancel). + " has five or more nines and nobody is playing solo.
\n"; + } + else if ($cancelsick == 'lowtrump') + { + $message = "The game has been canceled because ".DB_get_name('userid',$cancel). + " has low trump and nobody is playing solo.\n\n". + "To redeal either start a new game or, in case the game was part of a tournament,\n". + "go to the last game and use the link at the bottom of the page to redeal.\n\n"; + + /* update game status */ + cancel_game('lowtrump',$gameid); + + echo "The game has been canceled because ".DB_get_name('userid',$cancel). + " has low trump and nobody is playing solo.
\n"; + }; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) @@ -632,12 +668,7 @@ switch($mystatus) mymail($user,$subject,$message); } - /* update game status */ - cancel_game('nines',$gameid); - - echo "The game has been canceled because ".DB_get_name('userid',$nines). - " has five or more nines and nobody is playing solo.
\n"; - echo "Got it :)
"; + echo ''._('Got it').' :)
'; /* loop over all players, set re/contra if possible and start the game if possible */ $userids = DB_get_all_userid_by_gameid($gameid); @@ -725,7 +756,7 @@ switch($mystatus) case 'dpoverty': /* set person with poverty to play status */ $usersick = DB_get_sickness_by_userid_and_gameid($userid,$gameid); - if($usersick == 'poverty') + if($usersick == 'poverty' || ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) DB_set_hand_status_by_hash($userhash,'play'); /* set status of first player to be asked to poverty */ @@ -776,7 +807,7 @@ switch($mystatus) } } else - echo " \n"; + echo "Please, start the game.See how other played the same hand:
\n";
+ echo "
See how other played the same hand: \n";
foreach($other_game_ids as $id)
{
$otherhash = DB_get_hash_from_game_and_pos($id,$mypos);
$othername = DB_get_name('hash',$otherhash);
- echo "$othername
";
+ echo " $othername ";
}
- echo "