X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=3fbc451e1d83bd149af696c05eddbb028e95f8a9;hp=4dbf68f0a6e291dd194c485d8844a4c8aa49bc2b;hb=0049ad8507bb304c0f755dd156fd5f3082b1d6b5;hpb=c956a58882bbfef255af6817d8f21432968ac785 diff --git a/include/game.php b/include/game.php index 4dbf68f..3fbc451 100644 --- a/include/game.php +++ b/include/game.php @@ -105,7 +105,7 @@ if($ok) set_gametype('normal'); /* put everyting in a form */ -echo "
\n"; +echo "\n"; /* output game */ @@ -121,7 +121,7 @@ if($session) if($hash == $me) echo "$i \n"; else - echo "$i \n"; + echo "$i \n"; $i++; } echo "\n"; @@ -142,7 +142,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 +155,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". @@ -210,7 +214,7 @@ switch($mystatus) DB_set_player_by_gameid($gameid,$who); $message = "It's your turn now in game ".DB_format_gameid($gameid).".\n". - "Use this link to go the game: ".$HOST.$INDEX."?action=game&me=".$hash."\n\n" ; + "Use this link to go the game: ".$HOST.$INDEX."?action=game&me=".$hash."\n\n" ; mymail($email,$EmailName."ready, set, go... (game ".DB_format_gameid($gameid).") ",$message); */ } @@ -268,7 +272,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) @@ -601,12 +605,12 @@ switch($mystatus) { /* 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" ; + "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"; + echo " Please, start the game.
\n"; } else { @@ -616,7 +620,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); @@ -627,7 +631,7 @@ switch($mystatus) { /* email player for poverty */ $message = "Poverty: It's your turn now in game ".DB_format_gameid($gameid).".\n". - "Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$whohash."\n\n" ; + "Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$whohash."\n\n" ; mymail($email,$EmailName."Poverty (game ".DB_format_gameid($gameid).") ",$message); } } @@ -709,12 +713,12 @@ switch($mystatus) { /* 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" ; + "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"; + echo " Please, start the game.
\n"; } /* the following is part A) of what needs to be done */ @@ -740,10 +744,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"; @@ -812,7 +816,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); } } @@ -898,13 +902,13 @@ switch($mystatus) DB_set_hand_status_by_hash($userhash,'poverty'); $message = "Two people have 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." double poverty (game ".DB_format_gameid($gameid).")",$message); } } - echo "
Please, continue here.
\n"; + echo "
Please, continue here.
\n"; } } echo "
"; @@ -951,7 +955,7 @@ switch($mystatus) { /* 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" ; + "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); } } @@ -1041,7 +1045,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 */ @@ -1057,7 +1061,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++) { @@ -1085,6 +1089,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']) @@ -1132,7 +1140,6 @@ switch($mystatus) /* end of trick? */ if($seq==4) { - $trickNR++; echo "
    \n
  • \n"; /* end div trick, end li trick */ } } @@ -1415,7 +1422,7 @@ switch($mystatus) $message = "A card has been played in game ".DB_format_gameid($gameid).".\n\n". "It's your turn now.\n". - "Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$next_hash."\n\n" ; + "Use this link to play a card: ".$HOST.$INDEX."?action=game&me=".$next_hash."\n\n" ; if( DB_get_email_pref_by_uid($who)!="emailaddict" ) mymail($email,$EmailName."a card has been played in game ".DB_format_gameid($gameid),$message); } @@ -1688,7 +1695,7 @@ switch($mystatus) $hash = DB_get_hash_from_gameid_and_userid($gameid,$user); $link = "Use this link to have a look at game ".DB_format_gameid($gameid).": ". - $HOST.$INDEX."?action=game&me=".$hash."\n\n" ; + $HOST.$INDEX."?action=game&me=".$hash."\n\n" ; if( DB_get_email_pref_by_uid($user) != "emailaddict" ) mymail($To,$EmailName."game over (game ".DB_format_gameid($gameid).") part 2(2)",$link); } @@ -1704,7 +1711,7 @@ switch($mystatus) echo "please wait until it's your turn!
    \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 */ @@ -1731,13 +1738,14 @@ 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 "$note
    \n"; echo "Insert note:\n"; echo "
    \n";