source: irpg/trunk/htdocs/quest.php@ 1451

Last change on this file since 1451 was 1451, checked in by skalpette, 15 years ago

Import initial

File size: 3.5 KB
Line 
1<?php
2 include("config.php");
3 $irpg_page_title = "Les qu&ecirc;tes";
4 include("header.php");
5 echo " <h1>Qu&ecirc;te en cours</h1>\n";
6 include("commonfunctions.php");
7 $file = fopen($irpg_qfile,"r");
8 $type=0;
9 while ($line=fgets($file,1024)) {
10 $arg = explode(" ",trim($line));
11 if ($arg[0] == "T") {
12 unset($arg[0]);
13 $text = implode(" ",$arg);
14 }
15 elseif ($arg[0] == "Y") {
16 $type = $arg[1];
17 }
18 elseif ($arg[0] == "P") {
19 $p1[0] = $arg[1];
20 $p1[1] = $arg[2];
21 $p2[0] = $arg[3];
22 $p2[1] = $arg[4];
23 }
24 elseif ($arg[0] == "S") {
25 if ($type == 1) $time = $arg[1];
26 elseif ($type == 2) $stage = $arg[1];
27 }
28 elseif ($arg[0] == "P1") {
29 $player[1]['name'] = $arg[1];
30 if ($type == 2) {
31 $player[1]['x'] = $arg[2];
32 $player[1]['y'] = $arg[3];
33 }
34 }
35 elseif ($arg[0] == "P2") {
36 $player[2]['name'] = $arg[1];
37 if ($type == 2) {
38 $player[2]['x'] = $arg[2];
39 $player[2]['y'] = $arg[3];
40 }
41 }
42 elseif ($arg[0] == "P3") {
43 $player[3]['name'] = $arg[1];
44 if ($type == 2) {
45 $player[3]['x'] = $arg[2];
46 $player[3]['y'] = $arg[3];
47 }
48 }
49 elseif ($arg[0] == "P4") {
50 $player[4]['name'] = $arg[1];
51 if ($type == 2) {
52 $player[4]['x'] = $arg[2];
53 $player[4]['y'] = $arg[3];
54 }
55 }
56 }
57 if (!$type) {
58 echo " <p>D&eacute;sol&eacute;, il n'y a aucune qu&ecirc;te actuellement.</p>\n";
59 }
60 else {
61 echo " <p><b>Qu&ecirc;te :</b> A $text.</p>\n";
62 if ($type == 1) {
63 echo " <p><b>Temps restant :</b> ".duration($time-time()).
64 "</p>\n";
65 }
66 elseif ($type == 2) {
67 if ($stage == 1) {
68 echo " <p><b>Destination actuelle :</b> [$p1[0],$p1[1]]</p>\n";
69 }
70 else {
71 echo " <p><b>Destination actuelle :</b> [$p2[0],$p2[1]]</p>>\n";
72 }
73 }
74 for ($i=1;$i<=4;$i++) {
75 echo " <p><b>Participant $i :</b> <a href=\"playerview.php?player=".
76 urlencode($player[$i]['name'])."\">".htmlentities($player[$i]['name']).
77 "</a><br />\n";
78 if ($type == 2) {
79 echo " <b>Position :</b> [".$player[$i]['x'].",".$player[$i]['y']."]</p>\n";
80 }
81 else echo "<br />\n";
82 }
83 if ($type == 2) {
84 echo " <h2>Carte :</h2>\n".
85 " <p>[Les participant sont en bleu et leur destination en rouge]</p>\n".
86 " <div id=\"map\"><img src=\"makequestmap.php\" alt=\"Carte de la qu&ecirc;te Idle RPG\" usemap=\"#quest\" border=\"0\" /></div>\n".
87 " <map id=\"quest\" name=\"quest\">\n";
88
89 for ($i=1;$i<=4;$i++) {
90 echo " <area shape=\"circle\" coords=\"".$player[$i]['x'].",".$player[$i]['y'].",6\" alt=\"".htmlentities($player[$i]['name']).
91 "\" href=\"playerview.php?player=".urlencode($player[$i]['name'])."\" title=\"".htmlentities($player[$i]['name'])."\" />\n";
92 }
93 echo " </map>\n";
94 }
95 else echo "<br />\n";
96 }
97 echo " <br />\n";
98 include("footer.php");
99?>
Note: See TracBrowser for help on using the repository browser.