X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=include%2Fgame.php;h=3bbfccd6d7096e5e2829859f65b019e362110ce3;hp=7905acd63a00a9d1e5ae7619711e5a0d520e85a7;hb=1132ca2ccda76df5ed2b1bea6b64015d4dc86880;hpb=853c2a611637ab3abf65feb86b4b5f96c1749cb9
diff --git a/include/game.php b/include/game.php
index 7905acd..3bbfccd 100644
--- a/include/game.php
+++ b/include/game.php
@@ -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($_REQUEST["in"] == "no" && !$skip)
{
/* cancel the game */
$message = "Hello, \n\n".
@@ -189,6 +193,7 @@ switch($mystatus)
/* whos turn is it? */
DB_set_player_by_gameid($gameid,$user);
$ok = 0;
+ break;
}
};
if($ok)
@@ -309,7 +314,7 @@ switch($mystatus)
}
else if($_REQUEST["wedding"] == "yes")
{
- /* TODO: add silent solo somewhere*/
+ /* silent solo is set further down */
echo "Ok, you don't want to play a silent solo...wedding was chosen.
\n";
DB_set_sickness_by_hash($me,"wedding");
}
@@ -380,6 +385,7 @@ switch($mystatus)
{
$ok = 0;
DB_set_player_by_gameid($gameid,$user);
+ break;
}
};
@@ -640,6 +646,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
@@ -671,6 +678,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);
@@ -691,7 +699,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 */
@@ -717,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 "