Your cards are:
\n";
@@ -752,6 +832,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 */
@@ -762,18 +843,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*/
@@ -840,7 +922,7 @@ switch($mystatus)
/* check if all players are ready to play,
* if so, send out email to the startplayer
- * only need to do this if the game hasn't started yet
+ * only need to do this if the game hasn't started yet
*/
$gamestatus = DB_get_game_status_by_gameid($gameid);
if($gamestatus == 'pre')
@@ -854,20 +936,21 @@ switch($mystatus)
{
$ok = 0;
DB_set_player_by_gameid($gameid,$user);
+ break;
}
}
if($ok)
{
/* only set this after all poverty, etc. are handled*/
DB_set_game_status_by_gameid($gameid,'play');
-
+
/* email startplayer */
$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 && DB_get_email_pref_by_hash($hash)!="emailaddict")
{
/* email startplayer) */
@@ -888,7 +971,10 @@ switch($mystatus)
if($gametype=="solo")
{
$gametype = DB_get_solo_by_gameid($gameid);
- $GT = $gametype." ".$GT;
+ if($gametype=='silent')
+ $GT = 'normal';
+ else
+ $GT = $gametype." ".$GT;
}
else
$gametype = "normal";
@@ -972,7 +1058,7 @@ switch($mystatus)
/* output vorbehalte */
$mygametype = DB_get_gametype_by_gameid($gameid);
- if($mygametype != "normal") /* only show when needed */
+ if($mygametype != 'normal' && $mygametype != 'silent') /* only show when needed */
{
echo "
Pre\n".
" \n";
@@ -1004,8 +1090,11 @@ switch($mystatus)
$user = $r[6];
/* check if first schweinchen has been played */
- if( $GAME["schweinchen"] && ($r[0] == 19 || $r[0] == 20) )
- $GAME["schweinchen"]++;
+ if( $GAME['schweinchen-who'] && ($r[0] == 19 || $r[0] == 20) )
+ if(!$GAME['schweinchen-first'])
+ $GAME['schweinchen-first'] = 1; /* playing the first fox */
+ else
+ $GAME['schweinchen-second'] = 1; /* this must be the second fox */
/* save card to be able to find the winner of the trick later */
$play[$seq] = array("card"=>$r[0],"pos"=>$pos);
@@ -1076,6 +1165,7 @@ switch($mystatus)
{
$card = $_REQUEST["card"];
$handid = DB_get_handid('hash',$me);
+ $commentSchweinchen =""; /* used to add a comment when Schweinchen is being played */
/* check if we have card and that we haven't played it yet*/
/* set played in hand_card to true where hand_id and card_id*/
@@ -1112,20 +1202,23 @@ switch($mystatus)
$playid = DB_play_card($trickid,$handcardid,$sequence);
- /* check special output for schweinchen in case:
- * schweinchen is in the rules, a fox has been played and the gametype is correct
+ /* check special output for schweinchen in case in case a fox is being played
+ * check for correct rules, etc. has already been done
*/
- if( $GAME["schweinchen"] &&
- ($card == 19 || $card == 20) &&
- ($gametype == "normal" || $gametype == "silent"|| $gametype=="trump"))
+ if( $GAME["schweinchen-who"] && ($card == 19 || $card == 20) )
{
- $GAME["schweinchen"]++; // count how many have been played including this one
- if($GAME["schweinchen"]==3 && $RULES["schweinchen"]=="second" )
- DB_insert_comment("Schweinchen! ",$playid,$myid);
- if($RULES["schweinchen"]=="both" )
- DB_insert_comment("Schweinchen! ",$playid,$myid);
+ if(!$GAME['schweinchen-first'])
+ $GAME['schweinchen-first'] = 1; /* playing the first fox */
+ else
+ $GAME['schweinchen-second'] = 1; /* this must be the second fox */
+
+ if( ($GAME['schweinchen-second']==1 && $RULES['schweinchen']=='second') || $RULES['schweinchen']=='both')
+ {
+ DB_insert_comment("Schweinchen! ",$playid,$myid);
+ $commentSchweinchen = "Schweinchen! ";
+ }
if ($debug)
- echo "schweinchen = ".$GAME["schweinchen"]." ---
";
+ echo "schweinchen = ".$GAME["schweinchen-who"]." ---
";
}
/* if sequence == 4 check who one in case of wedding */
@@ -1178,7 +1271,7 @@ switch($mystatus)
if(DB_get_gametype_by_gameid($gameid)=="solo")
{
$solo = DB_get_solo_by_gameid($gameid);
- if($solo == "trump" || $solo == "silent")
+ if($solo == 'trump' || $solo == 'silent')
$ok = 1; /* for trump solos and silent solos, foxes are ok */
}
else
@@ -1266,6 +1359,8 @@ switch($mystatus)
$comment = $_REQUEST["comment"];
if($comment != "")
DB_insert_comment($comment,$playid,$myid);
+ if($commentSchweinchen)
+ $comment = $commentSchweinchen . $comment;
};
/* check for note */
@@ -1640,8 +1735,8 @@ switch($mystatus)
echo "
\n \n"; /* end div trick, end li trick */
}
-
- echo "\n"; /* end ul tricks*/
+ echo "
prev\n";
+ echo "
next\n\n"; /* end ul tricks*/
echo "
Personal notes:
\n";
$notes = DB_get_notes_by_userid_and_gameid($myid,$gameid);
@@ -1666,7 +1761,10 @@ switch($mystatus)
foreach($mycards as $card)
{
- if($followsuit && !same_type($card,$firstcard))
+ if( ($followsuit && !same_type($card,$firstcard)) ||
+ ( (int)($card)==19 && ($RULES['schweinchen']=='second'||$RULES['schweinchen']=='secondaftercall')
+ && $GAME['schweinchen-who']==$me && !$GAME['schweinchen-first'] )
+ )
display_card($card,$PREF["cardset"]);
else
display_link_card($card,$PREF["cardset"]);
@@ -1819,8 +1917,15 @@ switch($mystatus)
$type = DB_get_gametype_by_gameid($gameid);
if($type=="solo")
- output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid);
- else
+ {
+ $solo = DB_get_solo_by_gameid($gameid);
+
+ if($solo!='silent') /* repeat game with same first player */
+ output_ask_for_new_game($names[0],$names[1],$names[2],$names[3],$gameid);
+ else /* rotate normally */
+ output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid);
+ }
+ else /* rotate normally */
output_ask_for_new_game($names[1],$names[2],$names[3],$names[0],$gameid);
}
}