X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=b339c03c38bb410f6b280e93ddd044ac9776ad22;hp=c78482c1042dd8e409bb1cdccea8c481691fdb56;hb=34745273b4e8935b4423a0db050dcd75bc672209;hpb=34dca92fa9209df27921dcc58b9ea5bfb8f131f0
diff --git a/include/game.php b/include/game.php
index c78482c..b339c03 100644
--- a/include/game.php
+++ b/include/game.php
@@ -1,5 +1,5 @@
+/* Copyright 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Arun Persaud
\n";
@@ -267,13 +290,13 @@ if($session)
foreach($finalscore as $user=>$value)
{
$name = DB_get_name('userid',$user);
- echo " ".substr($name,0,2).": $value ";
+ echo ' '.substr($name,0,2).": $value ";
}
}
else
{
/* first game, no score yet */
- echo " ";
+ echo ' ';
}
/* output all games for the score table */
@@ -305,8 +328,8 @@ if($session)
$next = NULL;
/* check for solo, add game type to session number */
- echo " Game $session.$j";
- if($GT !='normal')
+ echo ' '._('Game')." $session.$j";
+ if($gamestatus != 'pre' && $GT !='normal' )
echo " ($GT)";
if(isset($_SESSION['id']) && $_SESSION['id']==$myid)
{
@@ -314,9 +337,10 @@ if($session)
echo " "._('previous')." \n";
if($next)
echo " "._('next')." \n";
+
+ if($j != $i )
+ echo " "._('last')." \n";
}
- if($j != $i )
- echo " last \n";
echo "\n\n";
+ echo "
\n"; /* end div trick, end li trick , end tricks*/
+ /* end displaying sickness */
+ break;
+ case 'poverty':
+ /* output pre-game trick in case user reloads,
+ * only needs to be done when a team has been formed */
+ if($myparty=='re' || $myparty=='contra')
+ {
+ echo "\n\n";
+
+ $mygametype = DB_get_gametype_by_gameid($gameid);
+
+ echo "
\n\n"; /* end div trick, end li trick , end ul tricks */
+ }
+ /* end output pre-game trick */
+ break;
+ case 'play':
+ case 'gameover':
+
+ echo "\n\n";
+
+ /* output vorbehalte */
+ $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 "
\n\n";
+
+ break;
+ default:
+ }
+
+
/******************************************************************************
* Output tricks played, table, messages, and cards (depending on game status)
******************************************************************************/
@@ -338,7 +440,7 @@ if($mystatus!='gameover')
echo "
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."; + $messages[] = _("The game has been canceled due to the request of one player.
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-timedout':
- $messages[] = "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.";
+ $messages[] = _("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':
- $messages[] = "The game has been canceled because one player had too many nines.";
+ $messages[] = _('The game has been canceled because one player had too many nines.');
break;
case 'cancel-lowtrump':
- $messages[] = "The game has been canceled because one player had low trump.";
+ $messages[] = _('The game has been canceled because one player had low trump.');
break;
case 'cancel-trump':
- $messages[] = "The game has been canceled because nobody wanted to take the trump.";
+ $messages[] = _('The game has been canceled because nobody wanted to take the trump.');
break;
}
/* for these two types, we shouldn't show the cards, since we might want to restart the game */
@@ -1162,13 +1220,13 @@ switch($mystatus)
{
$ok = 1;
$userids = DB_get_all_userid_by_gameid($gameid);
- foreach($userids as $user)
+ foreach($userids as $userid)
{
- $userstatus = DB_get_hand_status_by_userid_and_gameid($user,$gameid);
+ $userstatus = DB_get_hand_status_by_userid_and_gameid($userid,$gameid);
if($userstatus !='play' && $userstatus!='gameover')
{
$ok = 0;
- DB_set_player_by_gameid($gameid,$user);
+ DB_set_player_by_gameid($gameid,$userid);
break;
}
}
@@ -1180,15 +1238,17 @@ switch($mystatus)
/* email startplayer */
$startplayer = DB_get_startplayer_by_gameid($gameid);
$hash = DB_get_hash_from_game_and_pos($gameid,$startplayer);
- $who = DB_get_userid('hash',$hash);
- DB_set_player_by_gameid($gameid,$who);
+ $userid = DB_get_userid('hash',$hash);
+ DB_set_player_by_gameid($gameid,$userid);
if($hash!=$me && DB_get_email_pref_by_hash($hash)!='emailaddict')
{
/* email startplayer) */
- $email_message = "It's your turn now in game ".DB_format_gameid($gameid).".\n".
- "Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$hash."\n\n" ;
- mymail($who,$gameid, GAME_READY, $email_message);
+ set_language($userid,'uid');
+ $email_message = sprintf(_("It's your turn now in game %s.\n".
+ 'Use this link to play a card: '),DB_format_gameid($gameid)).$HOST.$INDEX."?action=game&me=".$hash."\n\n" ;
+ mymail($userid,$gameid, GAME_READY, $email_message);
+ set_language($myid,'uid');
}
}
}
@@ -1222,46 +1282,28 @@ switch($mystatus)
$messages[] = _('You finished the setup, but not everyone else finished it... '.
'You need to wait for the others. Just wait for an email.');
- $card_status = CARDS_SHOW;
-
break; /* not sure this works... the idea is that you can
* only play a card after everyone is ready to play */
}
-
- /* 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]);
-
- /* handle comments in case player didn't play a card, allow comments a week after the end of the game */
- if( (!myisset('card') && $mystatus=='play') || ($mystatus=='gameover' && ($gameend < 60*60*24*7)) )
- if(myisset('comment'))
- {
- $comment = $_REQUEST['comment'];
- $playid = DB_get_current_playid($gameid);
-
- if($comment != '')
- DB_insert_comment($comment,$playid,$myid);
- };
-
/* get everything relevant to display the tricks */
- $result = DB_query("SELECT Hand_Card.card_id as card,".
- " Hand.position as position,".
- " Play.sequence as sequence, ".
- " Trick.id, ".
+ $result = DB_query('SELECT Hand_Card.card_id as card,'.
+ ' Hand.position as position,'.
+ ' Play.sequence as sequence, '.
+ ' Trick.id, '.
" GROUP_CONCAT(CONCAT('',User.fullname,': ',Comment.comment,'')".
" SEPARATOR '\n' ), ".
- " Play.create_date, ".
- " Hand.user_id ".
- "FROM Trick ".
- "LEFT JOIN Play ON Trick.id=Play.trick_id ".
- "LEFT JOIN Hand_Card ON Play.hand_card_id=Hand_Card.id ".
- "LEFT JOIN Hand ON Hand_Card.hand_id=Hand.id ".
- "LEFT JOIN Comment ON Play.id=Comment.play_id ".
- "LEFT JOIN User On User.id=Comment.user_id ".
+ ' Play.create_date, '.
+ ' Hand.user_id '.
+ 'FROM Trick '.
+ 'LEFT JOIN Play ON Trick.id=Play.trick_id '.
+ 'LEFT JOIN Hand_Card ON Play.hand_card_id=Hand_Card.id '.
+ 'LEFT JOIN Hand ON Hand_Card.hand_id=Hand.id '.
+ 'LEFT JOIN Comment ON Play.id=Comment.play_id '.
+ 'LEFT JOIN User On User.id=Comment.user_id '.
"WHERE Trick.game_id='".$gameid."' ".
- "GROUP BY Trick.id, sequence ".
- "ORDER BY Trick.id, sequence ASC");
+ 'GROUP BY Trick.id, sequence '.
+ 'ORDER BY Trick.id, sequence ASC');
$trickNR = 0;
$lasttrick = DB_get_max_trickid($gameid);
@@ -1270,22 +1312,41 @@ switch($mystatus)
$pos = DB_get_startplayer_by_gameid($gameid)-1;
$firstcard = ''; /* first card in a trick */
- echo "\n
This game took ".$r[0]." hours.
\n"; + echo 'This game took '.$r[0]." hours.
\n"; - echo "