X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=aa2561699b15a43a74ec8b26f30b69da056b43ed;hp=a1c02a0b4f90f4929f6c856254bf3b13ca6a7b30;hb=4601624395d2f42086d058668b1b96778c8fcbb6;hpb=6e7ed2d202da016b9a74256371369cc41201df2e diff --git a/include/game.php b/include/game.php index a1c02a0..aa25616 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 "
\n"; - echo "
Rules: "; + echo '
'._('Rules').': '; switch($RULES['dullen']) { case 'none': - echo " \"not\n"; break; + echo " \""._('no\n"; break; case 'firstwins': - echo " \"ten\n"; break; + echo " \""._('ten\n"; break; case 'secondwins': - echo " \"second\n"; break; + echo " \""._('second\n"; break; } switch($RULES['schweinchen']) { case 'none': - echo " \"no\n"; break; case 'both': - echo " \"two\n"; break; case 'second': - echo " \"second\n"; break; case 'secondaftercall': - echo " \"second\n"; break; } switch($RULES['call']) { case '1st-own-card': - echo " \"1st-own-card\"\n"; break; + echo " \""._('1st-own-card')."\"\n"; break; case '5th-card': - echo " \"5th-card\"\n"; break; + echo " \""._('5th-card')."\"\n"; break; case '9-cards': - echo " \"9-cards\"\n"; break; + echo " \""._('9-cards')."\"\n"; break; } echo "
\n"; - echo " 10ofhearts : {$RULES['dullen']}
\n"; - echo " schweinchen: {$RULES['schweinchen']}
\n"; - echo " call: {$RULES['call']}
\n"; + echo ' '._('10ofhearts').": {$RULES['dullen']}
\n"; + echo ' '._('schweinchen').": {$RULES['schweinchen']}
\n"; + echo ' '._('call').": {$RULES['call']}
\n"; + echo ' '._('lowtrump').": {$RULES['lowtrump']}
\n"; echo "
\n
\n"; /* show score */ @@ -237,7 +239,7 @@ if($session) if($finalscore) { - echo "Score: \n"; + echo _('Score').": \n"; foreach($finalscore as $user=>$value) { $name = DB_get_name('userid',$user); @@ -281,10 +283,10 @@ if($session) if(isset($_SESSION['id']) && $_SESSION['id']==$myid) { if($previous) - echo "previous game    \n"; + echo ""._('previous game')."    \n"; echo "This is game number $j of $i in session $session.\n"; if($next) - echo "   next game \n"; + echo "   "._('next game')." \n"; } else echo "This is game number $j of $i in session $session."; @@ -399,7 +401,7 @@ switch($mystatus) $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); - if(!myisset('solo','wedding','poverty','nines') ) + if(!myisset('solo','wedding','poverty','nines','lowtrump') ) { /* output sickness of other playes, in case the already selected and are sitting in front of the current player */ echo "\n
\n \n"; /* end div trick, end li trick */ + echo "
\n \n\n\n"; /* end div trick, end li trick , end ul tricks */ } /* end output pre-game trick */ /* check if user need to give more cards back */ if( ($myparty=='re' || $myparty=='contra') && count($mycards)>12) { - echo "
you need to get rid of a few cards
\n"; + echo '
'._('You need to get rid of a few cards')."
\n"; $type='exchange'; - echo "
Your cards are:
\n"; + echo '
'._('Your cards are').":
\n"; foreach($mycards as $card) display_link_card($card,$PREF['cardset'],$type); echo " \n"; @@ -918,7 +950,7 @@ switch($mystatus) $userhash = DB_get_hash_from_gameid_and_userid($gameid,$user); $userparty = DB_get_party_by_hash($userhash); - if($usersick=='poverty' && !$userparty) + if(($usersick=='poverty'|| ($RULES['lowtrump']=='poverty' && $usersick=='lowtrump')) && !$userparty) { $hash = DB_get_hash_from_gameid_and_userid($gameid,$user); $cards = DB_get_hand($hash); @@ -926,14 +958,17 @@ switch($mystatus) $nrtrump = 0; foreach($cards as $card) if($card<27) $nrtrump++; - echo "Player $name has $nrtrump trump. Do you want to take them?". + $low=''; + if($usersick=='lowtrump') + $low='low'; + echo "Player $name has $nrtrump $low trump. Do you want to take them?". "Yes
\n"; } } echo "No way
\n"; echo "
\n"; - echo "
Your cards are:
\n"; + echo '
'._('Your cards are').":
\n"; foreach($mycards as $card) display_card($card,$PREF['cardset']); echo "
\n"; @@ -955,9 +990,9 @@ switch($mystatus) /* don't ask people who have poverty */ $next=1; - if($firstsick=='poverty') + if($firstsick=='poverty' || ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) { - if($secondsick=='poverty') + if($secondsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump')) $next=3; else $next=2; @@ -1072,8 +1107,8 @@ switch($mystatus) $secondsick = (string) DB_get_sickness_by_pos_and_gameid($mypos+2,$gameid); $next=1; - if($firstsick=='poverty') - if($secondsick=='poverty') + if($firstsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $firstsick=='lowtrump')) + if($secondsick=='poverty'|| ($RULES['lowtrump']=='poverty' && $secondsick=='lowtrump')) $next=3; else $next=2; @@ -1096,7 +1131,7 @@ switch($mystatus) echo "
Please, continue here.
\n"; } } - echo "
"; + echo "
\n"; break; case 'play': @@ -1115,9 +1150,11 @@ switch($mystatus) echo "

The game has been canceled because one player wasn't responding.

If this was a mistake all 4 players need to send an Email to $ADMIN_NAME at $ADMIN_EMAIL requesting that the game should be restarted.

"; break; case 'cancel-nines': - case 'cancel-timedout': echo "

The game has been canceled because one player had too many nines.

"; break; + case 'cancel-lowtrump': + echo "

The game has been canceled because one player had low trump.

"; + break; case 'cancel-trump': echo "

The game has been canceled because nobody wanted to take the trump.

"; break; @@ -1193,13 +1230,13 @@ switch($mystatus) /* has the game started? No, then just wait here...*/ if($gamestatus == 'pre') { - echo "

You finished the setup, but not everyone else finished it... ". - "You need to wait for the others. Just wait for an email.

"; + echo '

'._('You finished the setup, but not everyone else finished it... '. + 'You need to wait for the others. Just wait for an email.').'

'; $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); - echo "
Your cards are:
\n"; + echo '
'._('Your cards are').":
\n"; foreach($mycards as $card) display_card($card,$PREF['cardset']); echo "
\n"; @@ -1251,7 +1288,7 @@ switch($mystatus) $firstcard = ''; /* first card in a trick */ echo "\n\n"; /* end ul tricks*/ $mycards = DB_get_hand($me); @@ -1941,7 +1981,7 @@ switch($mystatus) if($myturn && !myisset('card') && $mystatus=='play' ) { echo "Hello ".$myname.", it's your turn!
\n"; - echo "Your cards are:
\n"; + echo _('Your cards are').":
\n"; /* do we have to follow suite? */ $followsuit = 0; @@ -1973,7 +2013,7 @@ switch($mystatus) } else if($mystatus=='play' ) { - echo "Your cards are:
\n"; + echo _('Your cards are').":
\n"; foreach($mycards as $card) display_card($card,$PREF['cardset']); } @@ -1983,7 +2023,7 @@ switch($mystatus) $oldcards = mysort($oldcards,$gametype); if(isset($_SESSION['id']) && $myid==$_SESSION['id']) - echo "Your cards were:
\n"; + echo _('Your cards were').":
\n"; else { $name = DB_get_name('userid',$myid); @@ -2021,7 +2061,7 @@ switch($mystatus) /* check if game is over, display results */ if(DB_get_game_status_by_gameid($gameid)=='play') { - echo "The game is over for you.. other people still need to play though"; + echo _('The game is over for you... other people still need to play though'); } break; default: @@ -2031,11 +2071,20 @@ switch($mystatus) /* output other games where it is the users turn * make sure that the people looking at old games don't see the wrong games here */ -if( $mystatus != 'gameover' ) - display_user_menu($myid); +if( $gamestatus != 'gameover' ) + { + /* game isn't over, only valid user can get here, so show menu */ + display_user_menu($myid); + } +else if( $origmystatus != 'gameover' ) + { + /* user just played the very last card, game is now over, it's still ok to show the menu though */ + display_user_menu($myid); + } else if( $mystatus == 'gameover' && - isset($_SESSION['id']) ) + isset($_SESSION['id']) ) { + /* user is looking at someone else's game, show the menu for the correct user */ display_user_menu($_SESSION['id']); } else @@ -2060,10 +2109,10 @@ $gameend = time() - strtotime($r[0]); if($gamestatus == 'play' || $gameend < 60*60*24*7) { - echo "
\nA short comment:\n"; + echo "
\n"._('A short comment').":\n"; } -echo "\n"; +echo "\n"; /* has this hand been played by others? */ $other_game_ids = DB_played_by_others($gameid);