\n".
- "This game is part of session $session: \n";
+ echo "
\n";
+ echo "
Rules (+icons fur rules) \n";
+ echo "
\n";
+ echo " 10ofhearts : ".$RULES["dullen"] ."
\n";
+ echo " schweinchen: ".$RULES["schweinchen"] ."
\n";
+ echo " call: ".$RULES["call"] ."
\n";
+ echo "
\n
\n";
+ echo "
Score \n";
+ $score = generate_score_table($session);
+ echo format_score_table_html($score,$myid);
+ echo "
\n";
$hashes = DB_get_hashes_by_session($session,$myid);
$i = 1;
foreach($hashes as $hash)
{
- if($hash == $me)
- echo "$i \n";
- else
- echo "
$i \n";
- $i++;
+ if($hash == $me)
+ $j=$i;
+ $i++;
+ $lasthash=$hash;
}
+ $i--;
+ echo "This is game number $j of
$i in session $session.";
echo "
\n";
}
@@ -142,7 +173,11 @@ display_table();
switch($mystatus)
{
case 'start':
- if( !myisset("in") )
+ /* don't ask if user has autosetup set to yest */
+ $skip = 0;
+ if($PREF['autosetup']=='yes') $skip = 1;
+
+ if( !myisset("in") && !$skip)
{
/* asks the player, if he wants to join the game */
output_check_want_to_play($me);
@@ -151,7 +186,7 @@ switch($mystatus)
else
{
/* check the result, if player wants to join, got next stage, else cancel game */
- if($_REQUEST["in"] == "no")
+ if(!$skip && $_REQUEST["in"] == "no" )
{
/* cancel the game */
$message = "Hello, \n\n".
@@ -268,7 +303,7 @@ switch($mystatus)
if($Nsickness>1)
{
echo "
You selected more than one sickness, please go back ".
- "and answer the question again.
";
+ "and answer the
question again.";
echo "
Your cards are:
\n";
foreach($mycards as $card)
@@ -606,7 +641,7 @@ switch($mystatus)
}
}
else
- echo " Please,
start the game.
\n";
+ echo " Please,
start the game.
\n";
}
else
{
@@ -616,7 +651,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";
else
{
$email = DB_get_email('position-gameid',$who,$gameid);
@@ -642,6 +677,7 @@ switch($mystatus)
* poverty: set re/contra
* dpoverty: first time: set re, send email to second player
* second time: set contra
+ * poverty: set status of other players to 'play'
* set status to play in case 0 trump
* no -> set status to play,
* ask next player or cancle the game if no more players
@@ -673,6 +709,7 @@ switch($mystatus)
" WHERE hand_id='$myhand' AND card_id=".DB_quote_smart($exchange));
};
}
+
/* update hand */
$mycards = DB_get_hand($me);
$mycards = mysort($mycards,$gametype);
@@ -693,7 +730,26 @@ switch($mystatus)
{
/* user is done, ready to play */
DB_set_hand_status_by_hash($me,'play');
- /* TODO if resolved; email start player, set startplayer */
+
+ /* email start player */
+ $startplayer = DB_get_startplayer_by_gameid($gameid);
+ $email = DB_get_email('position-gameid',$startplayer,$gameid);
+ $hash = DB_get_hash_from_game_and_pos($gameid,$startplayer);
+ $who = DB_get_userid('email',$email);
+ DB_set_player_by_gameid($gameid,$who);
+
+ if($hash!=$me)
+ {
+ if(DB_get_email_pref_by_hash($hash)!="emailaddict")
+ {
+ /* email startplayer */
+ $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($email,$EmailName."ready, set, go... (game ".DB_format_gameid($gameid).") ",$message);
+ }
+ }
+ else
+ echo " Please,
start the game.
\n";
}
/* the following is part A) of what needs to be done */
@@ -719,10 +775,10 @@ switch($mystatus)
foreach($cards as $card)
if($card<27) $nrtrump++;
echo "Player $name has $nrtrump trump. Do you want to take them?".
- "
yes \n";
+ "
Yes \n";
}
}
- echo "
No,way I take those trump... \n";
+ echo "
No way \n";
echo "
\n";
echo "
Your cards are:
\n";
@@ -791,7 +847,7 @@ switch($mystatus)
DB_set_hand_status_by_hash($userhash,'poverty');
$message = "Someone has poverty, it's your turn to decide, if you want to take the trump. Please visit:".
- " ".$HOST.$INDEX."?action=game&me=".$userhash."\n\n" ;
+ " ".$HOST.$INDEX."?action=game&me=".$userhash."\n\n" ;
mymail($To,$EmailName." poverty (game ".DB_format_gameid($gameid).")",$message);
}
}
@@ -807,6 +863,7 @@ switch($mystatus)
/* copy trump from player A to B */
$result = DB_query("UPDATE Hand_Card SET hand_id='$myhand' WHERE hand_id='$userhand' AND card_id<'27'" );
+ /* reload cards */
$mycards = DB_get_hand($me);
/* set re/contra */
@@ -817,18 +874,19 @@ switch($mystatus)
{
$hash = DB_get_hash_from_gameid_and_userid($gameid,$user);
if($hash==$userhash||$hash==$me)
- DB_set_party_by_hash($hash,"re");
+ {
+ DB_set_party_by_hash($hash,"re");
+ }
else
- DB_set_party_by_hash($hash,"contra");
+ {
+ DB_set_party_by_hash($hash,"contra");
+ DB_set_hand_status_by_hash($hash,'play'); /* the contra party is ready to play */
+ }
}
- /* check if we are done, if so, send everyone into the 'play' phase */
+ /* check if we are done (in case of no trump handed over), if so, go to 'play' phase right away*/
if(count($mycards)==12)
{
- foreach($userids as $user)
- {
- $hash = DB_get_hash_from_gameid_and_userid($gameid,$user);
- DB_set_hand_status_by_hash($hash,'play');
- }
+ DB_set_hand_status_by_hash($me,'play');
}
}
else /*dpoverty*/
@@ -881,7 +939,7 @@ switch($mystatus)
}
}
- echo "
\n";
+ echo "
\n";
}
}
echo "
";
@@ -990,16 +1048,6 @@ switch($mystatus)
DB_insert_comment($comment,$playid,$myid);
};
- /* handle notes in case player didn't play a card, allow notes only during a game */
- if( (!myisset("card") && $mystatus=='play') )
- if(myisset("note"))
- {
- $note = $_REQUEST["note"];
-
- if($note != "")
- DB_insert_note($note,$gameid,$myid);
- };
-
/* get everything relevant to display the tricks */
$result = DB_query("SELECT Hand_Card.card_id as card,".
" Hand.position as position,".
@@ -1018,7 +1066,7 @@ switch($mystatus)
"WHERE Trick.game_id='".$gameid."' ".
"GROUP BY Trick.id, sequence ".
"ORDER BY Trick.id, sequence ASC");
- $trickNR = 1;
+ $trickNR = 0;
$lasttrick = DB_get_max_trickid($gameid);
$play = array(); /* needed to calculate winner later */
@@ -1034,7 +1082,7 @@ switch($mystatus)
if($mygametype != 'normal' && $mygametype != 'silent') /* only show when needed */
{
echo "
Pre\n".
- " \n";
+ "
\n";
$show = 1;
for($mypos=1;$mypos<5;$mypos++)
{
@@ -1062,6 +1110,10 @@ switch($mystatus)
$comment = $r[4];
$user = $r[6];
+ /* count number of tricks */
+ if($seq==1)
+ $trickNR++;
+
/* check if first schweinchen has been played */
if( $GAME['schweinchen-who'] && ($r[0] == 19 || $r[0] == 20) )
if(!$GAME['schweinchen-first'])
@@ -1109,7 +1161,6 @@ switch($mystatus)
/* end of trick? */
if($seq==4)
{
- $trickNR++;
echo "
\n \n"; /* end div trick, end li trick */
}
}
@@ -1151,18 +1202,6 @@ switch($mystatus)
/* update Game timestamp */
DB_update_game_timestamp($gameid);
- /* check if a call was made, must do this before we set the card status to played */
- if(myisset("call") && $_REQUEST["call"] == "120" && can_call(120,$me))
- $result = DB_query("UPDATE Hand SET point_call='120' WHERE hash='$me' ");
- if(myisset("call") && $_REQUEST["call"] == "90" && can_call(90,$me))
- $result = DB_query("UPDATE Hand SET point_call='90' WHERE hash='$me' ");
- if(myisset("call") && $_REQUEST["call"] == "60" && can_call(60,$me))
- $result = DB_query("UPDATE Hand SET point_call='60' WHERE hash='$me' ");
- if(myisset("call") && $_REQUEST["call"] == "30" && can_call(30,$me))
- $result = DB_query("UPDATE Hand SET point_call='30' WHERE hash='$me' ");
- if(myisset("call") && $_REQUEST["call"] == "0" && can_call(0,$me))
- $result = DB_query("UPDATE Hand SET point_call='0' WHERE hash='$me' ");
-
/* mark card as played */
DB_query("UPDATE Hand_Card SET played='true' WHERE hand_id='$handid' AND card_id=".
DB_quote_smart($card));
@@ -1619,35 +1658,9 @@ switch($mystatus)
$session = DB_get_session_by_gameid($gameid);
$score = generate_score_table($session);
- /* convert html to ascii */
- $score = str_replace("
\n
\n \n","",$score);
- $score = str_replace("
\n","",$score);
- $score = str_replace("\n","",$score);
- $score = str_replace(array("
","
","
"," | "),array("","\n","","|"),$score);
- $score = explode("\n",$score);
-
- $header = array_slice($score,0,1);
- $header = explode("|",$header[0]);
- for($i=0;$i
5) $header.= " ... \n";
-
- if(sizeof($score)>5) $score = array_slice($score,-5,5);
- for($i=0;$i\n";
}
- if($seq!=4 && $trickNR>1)
+ if($seq!=4 && $trickNR>=1)
echo " \n \n"; /* end div trick, end li trick */
/* display points in case game is over */
@@ -1708,16 +1721,10 @@ switch($mystatus)
echo "
\n \n"; /* end div trick, end li trick */
}
-
+ echo "
prev\n";
+ echo "
next\n";
echo "\n"; /* end ul tricks*/
- echo "
Personal notes:
\n";
- $notes = DB_get_notes_by_userid_and_gameid($myid,$gameid);
- foreach($notes as $note)
- echo "$note
\n";
- echo "Insert note:\n";
- echo " \n";
-
$mycards = DB_get_hand($me);
$mycards = mysort($mycards,$gametype);
echo "