X-Git-Url: https://git.nubati.net/cgi-bin/gitweb.cgi?p=e-DoKo.git;a=blobdiff_plain;f=index.php;h=a53a23c3b163d789c08df73474303527911f82ae;hp=a2366ed6fda7c54d88a8cdd1538bfa7f01fc46e4;hb=6ea17e122f89f4175a6be53f6573c9957926376f;hpb=9197d1d5144a1d281db321fbaa523172c88da07e
diff --git a/index.php b/index.php
index a2366ed..a53a23c 100644
--- a/index.php
+++ b/index.php
@@ -16,7 +16,7 @@
$host = "http://doko.nubati.net/index.php";
$wiki = "http://wiki.nubati.net/index.php?title=EmailDoko";
-$debug = 0;
+$debug = 1;
/*
* end config
@@ -30,8 +30,8 @@ function mymail($To,$Subject,$message)
if($debug)
{
- str_replace("\n","
",$message);
- echo "
To: $To
Subject: $Subject
$message
";
+ $message = str_replace("\n","
",$message);
+ echo "
To: $To
Subject: $Subject
$message
\n";
}
else
mail($To,$Subject,$message);
@@ -46,7 +46,7 @@ function parse_status()
$game["solo-who"] = -1;
$game["solo-what"] = "todo";
$game["wedding"] = -1;
- $game["poverty"] = -1;
+ $game["poverty"] = "";
$game["nines"] = -1;
$game["startplayer"] = 0;
@@ -61,14 +61,31 @@ function parse_status()
$player[$tmp[0]]["option"] = $tmp[3];
$player[$tmp[0]]["points"] = $tmp[4];
$player[$tmp[0]]["cards"] = $tmp[5];
- if(ereg("s",$tmp[3])) $game["init"]++;
- if(ereg("P",$tmp[3])) $game["poverty"] = $i;
- if(ereg("N",$tmp[3])) $game["nines"] = $i;
- if(ereg("W",$tmp[3])) $game["wedding"] = $i;
- if(ereg("[OSQJCAH]",$tmp[3]) && ($game["solo-who"]<0) )
+ if(ereg("s",$tmp[3])) $game["init"]++; /* how many players are ready? */
+ if(ereg("P",$tmp[3])) $game["poverty"].= $i; /* players with poverty, could be two, so use a string */
+ if(ereg("N",$tmp[3])) $game["nines"] = $i; /* the player with too many nines, only one possible */
+ if(ereg("W",$tmp[3])) $game["wedding"] = $i; /* the player with the wedding, also only one possible */
+ if(ereg("([OSQJCAH])",$tmp[3],$match) && ($game["solo-who"]<0) )
{
$game["solo-who"] = $i;
$game["startplayer"] = $i;
+ switch($match[1])
+ {
+ case "O":
+ $game["solo-what"] = "No Trump";
+ case "S":
+ $game["solo-what"] = "Trump";
+ case "Q":
+ $game["solo-what"] = "Queen";
+ case "J":
+ $game["solo-what"] = "Jack";
+ case "C":
+ $game["solo-what"] = "Club";
+ case "A":
+ $game["solo-what"] = "Spade";
+ case "H":
+ $game["solo-what"] = "Heart";
+ }
}
}
@@ -297,18 +314,18 @@ function card_value($card)
function display_card($card)
{
if( $card/2 - (int)($card/2) == 0.5)
- echo "\n";
+ echo "\n";
else
- echo "\n";
+ echo "\n";
return;
}
function display_link_card($card,$me)
{
if( $card/2 - (int)($card/2) == 0.5)
- echo "\n";
+ echo "\n";
else
- echo "\n";
+ echo "\n";
return;
}
@@ -377,6 +394,8 @@ function save_status()
echo "
If you find bugs, please list them in the wiki
\n"; +echo "Cards that have a green background have a comment, which you can access by hovering over the card with your mouse ;)
\n"; + $history=array(); /* check for status file and read it, if possible */ @@ -424,10 +443,10 @@ if( isset($_REQUEST["PlayerA"]) && "If you want to join this game, please follow this link:\n\n". " ".$host."?a="; - mymail($EmailA,"Invite for a game of DoKo","Hello $PlayerA,\n".$message.$hashA); - mymail($EmailB,"Invite for a game of DoKo","Hello $PlayerB,\n".$message.$hashB); - mymail($EmailC,"Invite for a game of DoKo","Hello $PlayerC,\n".$message.$hashC); - mymail($EmailD,"Invite for a game of DoKo","Hello $PlayerD,\n".$message.$hashD); + mymail($EmailA,"You are invited to a game of DoKo","Hello $PlayerA,\n".$message.$hashA); + mymail($EmailB,"You are invited to a game of DoKo","Hello $PlayerB,\n".$message.$hashB); + mymail($EmailC,"You are invited to a game of DoKo","Hello $PlayerC,\n".$message.$hashC); + mymail($EmailD,"You are invited to a game of DoKo","Hello $PlayerD,\n".$message.$hashD); /* read in random.txt */ if(file_exists("random.txt")) @@ -435,7 +454,7 @@ if( isset($_REQUEST["PlayerA"]) && else die("no random file"); - $randomNR = explode( ":", $random[1] ); + $randomNR = explode( ":", $random[2] ); /* write initial status into file */ $output = fopen("status.txt","w"); @@ -470,6 +489,11 @@ if( isset($_REQUEST["PlayerA"]) && else echo "can't open file for writing"; }; +/* reread file */ +if(file_exists("status.txt")) + $lines = file("status.txt"); + else + die("no file"); /* test if a game is running, else output everything for a new game */ if(sizeof($lines)<2) @@ -581,14 +605,14 @@ if(sizeof($lines)<2) $mycards = explode(";",$allcards); sort($mycards); - echo "your cards areaehm... at the moment please just answer everything with no, still need to implement this
+aehm... at the moment poverty is not implented. so I guess you need to play a normal game, even if you have less than 3 turmp :(...sorry