From 268859f56cb8f19b65eca8550dd6a71b6d475971 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Mon, 11 May 2009 17:39:16 -0700 Subject: BUGFIX: some email messages had newlines missing before the footer all emails now have a "\n\n" at the end of the message. --- include/cancelgame.php | 2 +- include/game.php | 8 ++++---- include/newgame.php | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) (limited to 'include') diff --git a/include/cancelgame.php b/include/cancelgame.php index 71bb58b..b0b4db9 100644 --- a/include/cancelgame.php +++ b/include/cancelgame.php @@ -38,7 +38,7 @@ if(time()-strtotime($r[0]) > 60*60*24*30) /* = 1 month */ { $message = "Hello, \n\n". "Game ".DB_format_gameid($gameid). - " has been canceled since nothing happend for a while and $myname requested it.\n"; + " has been canceled since nothing happend for a while and $myname requested it.\n\n"; /* email to all players */ $userids = DB_get_all_userid_by_gameid($gameid); diff --git a/include/game.php b/include/game.php index 9c8c427..f9daf65 100644 --- a/include/game.php +++ b/include/game.php @@ -302,7 +302,7 @@ switch($mystatus) { /* cancel the game */ $message = "Hello, \n\n". - "the game has been canceled due to the request of one of the players.\n"; + "the game has been canceled due to the request of one of the players.\n\n"; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) @@ -593,7 +593,7 @@ switch($mystatus) " the game has been canceled because ".DB_get_name('userid',$nines). " has five or more nines and nobody is playing solo.\n\n". " To redeal either start a new game or, in case the game was part of a tournament, \n". - " go to the last game and use the link at the bottom of the page to redeal."; + " go to the last game and use the link at the bottom of the page to redeal.\n\n"; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) @@ -940,7 +940,7 @@ switch($mystatus) if($mypos+$next>4) { $message = "Hello, \n\n". - "Game ".DB_format_gameid($gameid)." has been canceled since nobody wanted to take the trump.\n"; + "Game ".DB_format_gameid($gameid)." has been canceled since nobody wanted to take the trump.\n\n"; $userids = DB_get_all_userid_by_gameid($gameid); foreach($userids as $user) @@ -1807,7 +1807,7 @@ switch($mystatus) $link = "$name: ".$HOST.$INDEX."?action=game&me=".$hash."\n" ; $message .= $link; } - $message .= "\n\n (you can use reply all on this email to reach all the players.)\n"; + $message .= "\n\n (you can use reply all on this email to reach all the players.)\n\n"; $subject = ' Game over (game '.DB_format_gameid($gameid).') '; mymail($userids,$subject,$message); } diff --git a/include/newgame.php b/include/newgame.php index 7d77612..b41dc8b 100644 --- a/include/newgame.php +++ b/include/newgame.php @@ -178,14 +178,14 @@ else "$PlayerB\n". "$PlayerC\n". "$PlayerD\n\n". - "If you want to join this game, please follow this link:\n\n". + "If you want to join this game, please follow this link:\n". "".$HOST.$INDEX."?action=game&me="; $subject = 'You are invited to a game of DoKo (game '.DB_format_gameid($gameid).')'; - mymail($useridA,$subject, $message.$hashA); - mymail($useridB,$subject, $message.$hashB); - mymail($useridC,$subject, $message.$hashC); - mymail($useridD,$subject, $message.$hashD); + mymail($useridA,$subject, $message.$hashA."\n\n"); + mymail($useridB,$subject, $message.$hashB."\n\n"); + mymail($useridC,$subject, $message.$hashC."\n\n"); + mymail($useridD,$subject, $message.$hashD."\n\n"); echo "
You started a new game. The emails have been sent out!
\n"; display_user_menu($myid); -- cgit v1.2.3-18-g5258 From 0a4212f2c7179913c6ae87011b8f00d435af93e3 Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Mon, 11 May 2009 21:58:25 -0700 Subject: BUGFIX: wrongly displayed "trump back" in pre-trick during poverty displayed it when the person with not enough trump gave trump to his partner, which is almost always the case. --- include/output.php | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'include') diff --git a/include/output.php b/include/output.php index c2611ba..161ef3a 100644 --- a/include/output.php +++ b/include/output.php @@ -522,7 +522,7 @@ function output_exchanged_cards() * go through all positions, check that position has cards that need to be shown and * show those cards */ - $show = 1; + $show=1; for($mypos=1;$mypos<5;$mypos++) { $usersick = DB_get_sickness_by_pos_and_gameid($mypos,$gameid); @@ -530,22 +530,45 @@ function output_exchanged_cards() $mypos==$povertypos1 || $mypos==$partnerpos1 || $mypos==$povertypos2 || $mypos==$partnerpos2 ) { + /* figure out if we gave trump back */ + $trump_back1=0; + if($povertypos2) + foreach($povertycards1 as $card) + { + if(is_trump($card)) + { + $trump_back1=1; + break; + } + } + $trump_back2=0; + if($povertypos2) + foreach($povertycards2 as $card) + { + if(is_trump($card)) + { + $trump_back2=1; + break; + } + } + + /* output vorbehalt */ echo "
Vorbehalt
\n"; if($show) echo " $usersick
\n"; + + /* output cards */ if($mypos==$partnerpos1) { - $trump_back=0; foreach($partnercards1 as $card) { - if(is_trump($card)) $trump_back=1; echo ' '; if($povertyhash1 == $me || $partnerhash1 == $me || $mystatus=='gameover') display_card($card,$PREF['cardset']); else display_card(0,$PREF['cardset']); } - if($trump_back) echo "Trump back"; + if($trump_back1) echo " Trump back"; } else if($mypos==$povertypos1) { @@ -557,6 +580,7 @@ function output_exchanged_cards() else display_card(0,$PREF['cardset']); } + if($trump_back1) echo " Trump back"; } else if($mypos==$povertypos2) { @@ -568,10 +592,10 @@ function output_exchanged_cards() else display_card(0,$PREF['cardset']); } + if($trump_back2) echo " Trump back"; } else if($mypos==$partnerpos2) { - $trump_back=0; foreach($partnercards2 as $card) { if(is_trump($card)) $trump_back=1; @@ -581,13 +605,12 @@ function output_exchanged_cards() else display_card(0,$PREF['cardset']); } - if($trump_back) echo "Trump back"; + if($trump_back2) echo " Trump back"; } echo "
\n"; - - if($mygametype == $usersick) - $show = 0; } + if($mygametype == $usersick) + $show = 0; } } -- cgit v1.2.3-18-g5258 From 0edb4b26c049e07af0970e081fab699d2bdd333b Mon Sep 17 00:00:00 2001 From: Arun Persaud Date: Thu, 30 Apr 2009 00:08:10 -0700 Subject: NEW FEATURE: show number of tricks a person made only shows 0,1,few or many tricks, so that we don't give too much information away. Might adjust or change this in the future. This addresses issues #11. --- include/db.php | 6 ++++++ include/functions.php | 17 +++++++++++++++++ include/game.php | 1 + 3 files changed, 24 insertions(+) (limited to 'include') diff --git a/include/db.php b/include/db.php index 3d9d98c..b8b184d 100644 --- a/include/db.php +++ b/include/db.php @@ -1149,4 +1149,10 @@ function DB_played_by_others($gameid) $gameids[]=$r[0]; return $gameids; } + +function DB_get_number_of_tricks($gameid,$position) +{ + $r = DB_query_array("SELECT COUNT(winner) FROM Trick Where game_id='$gameid' and winner='$position'"); + return $r[0]; +} ?> \ No newline at end of file diff --git a/include/functions.php b/include/functions.php index e57c2e5..3e21e6d 100644 --- a/include/functions.php +++ b/include/functions.php @@ -816,6 +816,7 @@ function display_table () $call = $r[5]; $hash = $r[7]; $timezone = $r[8]; + $wins = DB_get_number_of_tricks($gameid,$pos); date_default_timezone_set($defaulttimezone); $lastlogin = strtotime($r[6]); date_default_timezone_set($timezone); @@ -939,6 +940,22 @@ function display_table () "last login: ".date("Y-m-d H:i:s",$lastlogin)."\">". "\"time". "\n"; + + /* show how many tricks the person made */ + switch($wins) + { + case 0: + echo "#tricks 0"; break; + case 1: + echo "#tricks 1"; break; + case 2: + case 3: + case 4: + echo "#tricks few"; break; + default: + echo "#tricks many"; break; + } + echo " \n"; } diff --git a/include/game.php b/include/game.php index f9daf65..a11e6b6 100644 --- a/include/game.php +++ b/include/game.php @@ -1295,6 +1295,7 @@ switch($mystatus) /* end of trick? */ if($seq==4) { + $winner = get_winner($play,$gametype); /* returns the position */ echo " \n \n"; /* end div trick, end li trick */ } } -- cgit v1.2.3-18-g5258