quest.php 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. include("./include/config.php");
  3. include("./include/func.php");
  4. $irpg_page_title = "Quest Information";
  5. include("./include/header.php");
  6. ?>
  7. <body>
  8. <!-- NAVBAR
  9. ================================================== -->
  10. <div class="navbar-wrapper">
  11. <div class="container">
  12. <div class="navbar navbar-inverse">
  13. <div class="navbar-inner">
  14. <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
  15. <span class="icon-bar"></span>
  16. <span class="icon-bar"></span>
  17. <span class="icon-bar"></span>
  18. </a>
  19. <div class="nav-collapse collapse">
  20. <ul class="nav">
  21. <li><a href="index.php" class="brand" rel="tooltip" data-placement="bottom" title="Game Information" >IdleRPG</a></li>
  22. <li><a href="players.php" rel="tooltip" data-placement="bottom" title="Player Information" >Players</a></li>
  23. <li><a href="world.php" rel="tooltip" data-placement="bottom" title="IdleRPG World Map" >World Map</a></li>
  24. <li class="active"><a href="quest.php" rel="tooltip" data-placement="bottom" title="Questing Information" >Quest Info</a></li>
  25. <li><a href="about.php" rel="tooltip" data-placement="bottom" title="About Game" >About</a></li>
  26. </ul>
  27. </div><!--/.nav-collapse -->
  28. </div><!-- /.navbar-inner -->
  29. </div><!-- /.navbar -->
  30. </div> <!-- /.container -->
  31. </div><!-- /.navbar-wrapper -->
  32. <div class="container">
  33. <div class="row-fluid">
  34. <div class="span12">
  35. <div class="well">
  36. <h3>Current Quest Information</h3>
  37. <blockquote>
  38. <?php
  39. $file = fopen($irpg_qfile, "r");
  40. $type = 0;
  41. while ($line = fgets($file, 1024)) {
  42. $arg = explode(" ", trim($line));
  43. if ($arg[0] == "T") {
  44. unset($arg[0]);
  45. $text = implode(" ", $arg);
  46. } elseif ($arg[0] == "Y") {
  47. $type = $arg[1];
  48. } elseif ($arg[0] == "P") {
  49. $p1[0] = $arg[1];
  50. $p1[1] = $arg[2];
  51. $p2[0] = $arg[3];
  52. $p2[1] = $arg[4];
  53. } elseif ($arg[0] == "S") {
  54. if ($type == 1)
  55. $time = $arg[1];
  56. elseif ($type == 2)
  57. $stage = $arg[1];
  58. }
  59. elseif ($arg[0] == "P1") {
  60. $player[1]['name'] = $arg[1];
  61. if ($type == 2) {
  62. $player[1]['x'] = $arg[2];
  63. $player[1]['y'] = $arg[3];
  64. }
  65. } elseif ($arg[0] == "P2") {
  66. $player[2]['name'] = $arg[1];
  67. if ($type == 2) {
  68. $player[2]['x'] = $arg[2];
  69. $player[2]['y'] = $arg[3];
  70. }
  71. } elseif ($arg[0] == "P3") {
  72. $player[3]['name'] = $arg[1];
  73. if ($type == 2) {
  74. $player[3]['x'] = $arg[2];
  75. $player[3]['y'] = $arg[3];
  76. }
  77. } elseif ($arg[0] == "P4") {
  78. $player[4]['name'] = $arg[1];
  79. if ($type == 2) {
  80. $player[4]['x'] = $arg[2];
  81. $player[4]['y'] = $arg[3];
  82. }
  83. }
  84. }
  85. if (!$type) {
  86. echo " <p>Sorry, there is no active quest.</p>\n";
  87. } else {
  88. echo " <p><b>Quest:</b> To $text.</p>\n";
  89. if ($type == 1) {
  90. echo " <p><b>Time to completion:</b> " . duration($time - time()) .
  91. "</p>\n";
  92. } elseif ($type == 2) {
  93. if ($stage == 1) {
  94. echo " <p><b>Current goal:</b> [$p1[0],$p1[1]]</p>\n";
  95. } else {
  96. echo " <p><b>Current goal:</b> [$p2[0],$p2[1]]</p>>\n";
  97. }
  98. }
  99. echo " <p><b>Participant 1:</b> <a href=\"playerview.php?player=" .
  100. urlencode($player[1]['name']) . "\">" . htmlentities($player[1]['name']) .
  101. "</a><br />\n";
  102. if ($type == 2) {
  103. echo " <b>Position:</b> [" . $player[1]['x'] . "," . $player[1]['y'] . "]</p>\n";
  104. }
  105. else
  106. echo "<br />\n";
  107. echo " <p><b>Participant 2:</b> <a href=\"playerview.php?player=" .
  108. urlencode($player[2]['name']) . "\">" . htmlentities($player[2]['name']) .
  109. "</a><br />\n";
  110. if ($type == 2) {
  111. echo " <b>Position:</b> [" . $player[2]['x'] . "," . $player[2]['y'] . "]</p>\n";
  112. }
  113. else
  114. echo "<br />\n";
  115. echo " <p><b>Participant 3:</b> <a href=\"playerview.php?player=" .
  116. urlencode($player[3]['name']) . "\">" . htmlentities($player[3]['name']) .
  117. "</a><br />\n";
  118. if ($type == 2) {
  119. echo " <b>Position:</b> [" . $player[3]['x'] . "," . $player[3]['y'] . "]</p>\n";
  120. }
  121. else
  122. echo "<br />\n";
  123. echo " <p><b>Participant 4:</b> <a href=\"playerview.php?player=" .
  124. urlencode($player[4]['name']) . "\">" . htmlentities($player[4]['name']) .
  125. "</a><br />\n";
  126. if ($type == 2) {
  127. echo " <b>Position:</b> [" . $player[4]['x'] . "," . $player[4]['y'] . "]</p>\n" .
  128. " <h2>Quest Map:</h2>\n" .
  129. " <p>[Questers are shown in blue, current goal in red]</p>\n" .
  130. " <div id=\"map\"><img src=\"questmap.php\" alt=\"Idle RPG Quest Map\" usemap=\"#quest\" border=\"0\" /></div>\n" .
  131. " <map id=\"quest\" name=\"quest\">\n" .
  132. " <area shape=\"circle\" coords=\"" . $player[1]['x'] . "," . $player[1]['y'] . ",6\" alt=\"" . htmlentities($player[1]['name']) .
  133. "\" href=\"playerview.php?player=" . urlencode($player[1]['name']) . "\" title=\"" . htmlentities($player[1]['name']) . "\" />\n" .
  134. " <area shape=\"circle\" coords=\"" . $player[2]['x'] . "," . $player[2]['y'] . ",6\" alt=\"" . htmlentities($player[2]['name']) .
  135. "\" href=\"playerview.php?player=" . urlencode($player[2]['name']) . "\" title=\"" . htmlentities($player[2]['name']) . "\" />\n" .
  136. " <area shape=\"circle\" coords=\"" . $player[3]['x'] . "," . $player[3]['y'] . ",6\" alt=\"" . htmlentities($player[3]['name']) .
  137. "\" href=\"playerview.php?player=" . urlencode($player[3]['name']) . "\" title=\"" . htmlentities($player[3]['name']) . "\" />\n" .
  138. " <area shape=\"circle\" coords=\"" . $player[4]['x'] . "," . $player[4]['y'] . ",6\" alt=\"" . htmlentities($player[4]['name']) .
  139. "\" href=\"playerview.php?player=" . urlencode($player[4]['name']) . "\" title=\"" . htmlentities($player[4]['name']) . "\" />\n" .
  140. " </map>\n";
  141. }
  142. else
  143. echo "<br />\n";
  144. }
  145. ?>
  146. </blockquote>
  147. </div>
  148. <?php
  149. include("./include/footer.php");
  150. ?>