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=3cc1d656489e853fb2160adcae081d8f268d1b66;hb=8550cac6f9bedbd9219d898f7b3de731bf1cb2b2;hpb=850378a3e2da48d387dc565cc6e3c2b47f12e34d diff --git a/include/game.php b/include/game.php index 3cc1d65..eb66a98 100644 --- a/include/game.php +++ b/include/game.php @@ -185,45 +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 " lowtrump: {$RULES['lowtrump']}
\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 */ @@ -239,7 +239,7 @@ if($session) if($finalscore) { - echo "Score: \n"; + echo _('Score').": \n"; foreach($finalscore as $user=>$value) { $name = DB_get_name('userid',$user); @@ -283,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."; @@ -428,7 +428,7 @@ switch($mystatus) output_check_for_sickness($me,$mycards); - echo "
Your cards are:
\n"; + echo '
'._('Your cards are').":
\n"; foreach($mycards as $card) display_card($card,$PREF['cardset']); echo "
\n"; @@ -450,7 +450,7 @@ switch($mystatus) echo "

You selected more than one sickness, please go back ". "and answer the question again.

"; - echo "
Your cards are:
\n"; + echo '
'._('Your cards are').":
\n"; foreach($mycards as $card) display_card($card,$PREF['cardset']); echo "
\n"; @@ -491,27 +491,27 @@ switch($mystatus) else if($_REQUEST['wedding'] == 'yes') { /* silent solo is set further down */ - echo "Ok, you don't want to play a silent solo...wedding was chosen.
\n"; + echo _("Ok, you don't want to play a silent solo...wedding was chosen.")."
\n"; DB_set_sickness_by_hash($me,'wedding'); } else if($_REQUEST['poverty'] == 'yes') { - echo "Don't think you can win with just a few trump...? ok, poverty chosen
\n"; + echo _("Don't think you can win with just a few trump...? Ok, poverty chosen.")."
\n"; DB_set_sickness_by_hash($me,'poverty'); } else if($_REQUEST['nines'] == 'yes') { - echo "What? You just don't want to play a game because you have a few nines? Well, if no one". - " is playing solo, this game will be canceled.
\n"; + echo _("What? You just don't want to play a game because you have a few nines? Well, if no one". + " is playing solo, this game will be canceled.")."
\n"; DB_set_sickness_by_hash($me,'nines'); } else if($_REQUEST['lowtrump'] == 'yes') { if($RULES['lowtrump']=='cancel') - echo "What? You just don't want to play a game because you have low trump? Well, if no one". - " is playing solo, this game will be canceled.
\n"; + echo _("What? You just don't want to play a game because you have low trump? Well, if no one". + " is playing solo, this game will be canceled.")."
\n"; else - echo "Don't think you can win with low trumps...? ok, poverty chosen
.
\n"; + echo _("Don't think you can win with low trumps...? Ok, poverty chosen.")."
.
\n"; DB_set_sickness_by_hash($me,'lowtrump'); } @@ -531,7 +531,7 @@ switch($mystatus) $mycards = DB_get_hand($me); $mycards = mysort($mycards,$gametype); - /* output sickness of other playes, in case the already selected and are sitting in front of the current player */ + /* output sickness of other playes, in case they already selected and are sitting in front of the current player */ echo "\n
    \n"; echo "
  • Game ".DB_format_gameid($gameid).":
  • \n"; echo "
  • Pre\n". @@ -555,7 +555,7 @@ switch($mystatus) /* end displaying sickness */ echo "
    \n"; - echo "

    Checking if someone else selected solo, nines, wedding or poverty.

    "; + echo '

    '._('Checking if someone else selected solo, nines, wedding or poverty.').'

    '; /* check if everyone has reached this stage */ $userids = DB_get_all_userid_by_gameid($gameid); @@ -573,10 +573,10 @@ switch($mystatus) if(!$ok) { - 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.

    "; + 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.').'

'; /* display cards, if player was just at the init-phase he will still see the cards from there * we can put this one here, since the last player to finish the init state won't get here and @@ -585,7 +585,7 @@ switch($mystatus) if($mystatus=='check') { /* show cards */ - echo "
Your cards are:
\n"; + echo '
'._('Your cards are').":
\n"; foreach($mycards as $card) display_card($card,$PREF['cardset']); echo "
\n"; @@ -598,7 +598,7 @@ switch($mystatus) * are playing, in case there are any solos this already * will have the correct information in it */ - echo "

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); @@ -668,7 +668,7 @@ switch($mystatus) mymail($user,$subject,$message); } - echo "
\n"; + echo "
\n"; /* end div message */ break; } else if($poverty==1) /* one person has poverty */ @@ -712,7 +712,7 @@ switch($mystatus) $gametype = 'wedding'; }; /* now the gametype is set correctly in the database */ - 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); @@ -807,7 +807,7 @@ switch($mystatus) } } else - echo "
Please, start the game.
\n"; + echo "Please, start the game.
\n"; } else { @@ -817,7 +817,7 @@ switch($mystatus) $whoid = DB_get_userid('gameid-position',$gameid,$who); if($whoid==$myid) - echo "
Please, start the game.
\n"; + echo "Please, start the game.
\n"; break; } - echo "
\n"; + case 'poverty': /* user only gets here in a poverty game, several things have to be handled here: * A) ask, if user wants to take trump @@ -894,17 +894,17 @@ switch($mystatus) /* get information so show the cards that have been handed over in a poverty game */ output_exchanged_cards(); - echo "
\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"; @@ -968,7 +968,7 @@ switch($mystatus) 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"; @@ -1230,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"; @@ -1288,20 +1288,22 @@ switch($mystatus) $firstcard = ''; /* first card in a trick */ echo "\n
    \n"; - echo "
  • Game ".DB_format_gameid($gameid).":
  • \n"; + echo '
  • '._('Game').' '.DB_format_gameid($gameid).":
  • \n"; /* output vorbehalte */ - $mygametype = DB_get_gametype_by_gameid($gameid); - if($mygametype != 'normal' && $mygametype != 'silent') /* only show when needed */ - { - echo "
  • Pre\n". - "
    \n"; + $mygametype = DB_get_gametype_by_gameid($gameid); + $mygamesolo = DB_get_solo_by_gameid($gameid); + if($mygametype != 'normal') /* only show when needed */ + if(!( $mygametype == 'solo' && $mygamesolo == 'silent') ) + { + echo "
  • Pre\n". + "
    \n"; - /* get information so show the cards that have been handed over in a poverty game */ - output_exchanged_cards(); + /* get information so show the cards that have been handed over in a poverty game */ + output_exchanged_cards(); - echo "
    \n
  • \n"; /* end div trick, end li trick */ - } + echo "
\n \n"; /* end div trick, end li trick */ + } /* output tricks */ while($r = DB_fetch_array($result)) @@ -1332,14 +1334,14 @@ switch($mystatus) if($trick!=$lasttrick) { /* start of an old trick? */ - echo "
  • Trick $trickNR\n". + echo "
  • "._('Trick')." $trickNR\n". "
    \n". " \"table\"\n"; } else if($trick==$lasttrick) { /* start of a last trick? */ - echo "
  • Trick $trickNR\n". + echo "
  • "._('Trick')." $trickNR\n". "
    \n". " \"table\"\n"; }; @@ -1524,28 +1526,31 @@ switch($mystatus) /* same as for foxes, karlchen doesn't always make sense * check what kind of game it is and set karlchen accordingly */ - $ok = 1; /* default: karlchen should be accounted for */ - if($tricknr != 12 ) - $ok = 0; /* Karlchen works only in the last trick */ - if($ok && DB_get_gametype_by_gameid($gameid)=='solo' ) + + if($tricknr == 12 ) /* Karlchen works only in the last trick */ { - $solo = DB_get_solo_by_gameid($gameid); - if($solo == 'trumpless' || $solo == 'jack' || $solo == 'queen' ) - $ok = 0; /* no Karlchen in these solos */ - } + /* check for solo */ + $solo = 'none'; + if(DB_get_gametype_by_gameid($gameid)=='solo' ) + $solo = DB_get_solo_by_gameid($gameid); - if($ok) - foreach($play as $played) - if ( $played['card']==11 || $played['card']==12 ) - if ($played['pos'] == $winner ) - { - /* possible caught a fox, check party */ - $uid1 = DB_get_userid('gameid-position',$gameid,$winner); - $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1); + /* no Karlchen in these solos */ + if($solo != 'trumpless' && $solo != 'jack' && $solo != 'queen' ) + { + foreach($play as $played) + if ( $played['card']==11 || $played['card']==12 ) + if ($played['pos'] == $winner ) + { + /* save Karlchen */ + $uid1 = DB_get_userid('gameid-position',$gameid,$winner); + $party1 = DB_get_party_by_gameid_and_userid($gameid,$uid1); + + DB_query("INSERT INTO Score". + " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')"); + }; + }; + }; /* end scoring Karlchen */ - DB_query("INSERT INTO Score". - " VALUES( NULL,NULL,$gameid,'$party1',$uid1,NULL,'karlchen')"); - } /* * check for doppelopf (>40 points) ***********************************/ @@ -1599,7 +1604,7 @@ switch($mystatus) $pos = DB_get_pos_by_hash($me); if($sequence==1) { - echo "
  • Trick ".($tricknr)."\n". + echo "
  • "._('Trick').' '.($tricknr)."\n". "
    \n". " \"table\"\n"; } @@ -1901,7 +1906,7 @@ switch($mystatus) } else if(myisset('card') && !$myturn ) { - echo "please wait until it's your turn!
    \n"; + echo _("please wait until it's your turn!")."
    \n"; } if($seq!=4 && $trickNR>=1 && !(myisset('card') && $myturn) ) @@ -1910,7 +1915,7 @@ switch($mystatus) /* display points in case game is over */ if($mystatus=='gameover' && DB_get_game_status_by_gameid($gameid)=='gameover' ) { - echo "
  • Score\n". + echo "
  • "._('Score')."\n". "
    \n"; /* add pic for re/contra " \"table\"\n";*/ @@ -1967,8 +1972,8 @@ switch($mystatus) echo "
    \n
  • \n"; /* end div trick, end li trick */ } - echo "
  • prev
  • \n"; - echo "
  • next
  • \n"; + echo "
  • "._('prev')."
  • \n"; + echo "
  • "._('next')."
  • \n"; echo "\n"; /* end ul tricks*/ $mycards = DB_get_hand($me); @@ -1978,7 +1983,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; @@ -2010,7 +2015,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']); } @@ -2020,7 +2025,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); @@ -2058,7 +2063,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: @@ -2092,41 +2097,51 @@ else echo "
    \n"; } -/* display rule set for this game */ +/* + * display gameinfo: re/contra, comment-box, play-card button, games played by others + */ + echo "
    \n"; +/* get time from the last action of the game */ +$r = DB_query_array("SELECT mod_date from Game WHERE id='$gameid' " ); +$gameend = time() - strtotime($r[0]); + +/* comment box */ +if($gamestatus == 'play' || $gameend < 60*60*24*7) + { + echo ' '._('A short comment').":\n"; + } + +/* re-contra */ if($gamestatus == 'play' ) { $myparty = DB_get_party_by_hash($me); output_form_calls($me,$myparty); } -/* get time from the last action of the game */ -$r = DB_query_array("SELECT mod_date from Game WHERE id='$gameid' " ); -$gameend = time() - strtotime($r[0]); +/* play-card button */ if($gamestatus == 'play' || $gameend < 60*60*24*7) { - echo "
    \nA short comment:\n"; + echo " \n"; } -echo "\n"; - /* has this hand been played by others? */ $other_game_ids = DB_played_by_others($gameid); if(sizeof($other_game_ids)>0 && $mystatus=='gameover') { $mypos = DB_get_pos_by_hash($me); - echo "

    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 "

    \n"; + echo "

    \n"; } -echo "
    \n"; +echo "
    \n"; /* end gameinfo */ echo "\n";