Advertisement
peterisgb

movetown1.php

May 27th, 2023
1,243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 43.58 KB | Gaming | 0 0
  1. <?php
  2. $locationmxy ="20";
  3. $locationmxx ="20";
  4. include "globals.php";
  5. $tresder=(int) rand(100,999);
  6. if($ir['jail'] or $ir['hospital']) {
  7.    echo "This page cannot be accessed while in jail or hospital.";
  8.    $h->endpage();
  9.    exit;
  10. }
  11. $locationx = $ir['locationxt'];
  12. $locationy = $ir['locationyt'];
  13. $moves = $ir['moves'];
  14. $action = ( array_key_exists( 'action', $_GET) ? $_GET['action'] : "" );
  15. switch ($action) {
  16.    case 'moven': do_move1_north(); break;
  17.    case 'movew': do_move1_west(); break;
  18.    case 'movee': do_move1_east(); break;
  19.    case 'moves': do_move1_south(); break;
  20.    case 'leave': do_leave(); break;
  21.    case 'entermainhouse': enter_main_house(); break;
  22.    case 'house': enter_house(); break;
  23.    case 'buyhouse': buy_house(); break;
  24.    case 'buyhousedo': buy_house_do(); break;
  25.    case 'sellhouse': sell_house(); break;
  26.    case 'sellhousedo': sell_house_do(); break;
  27.    case 'updatedesc': update_desc(); break;
  28.    case 'updatedescdo': udpate_desc_do(); break;
  29.    case 'allowguests': allow_guests(); break;
  30.    case 'allowguestsdo': allow_guests_do(); break;
  31.    case 'shop': enter_shop(); break;
  32.    case 'church': enter_church(); break;
  33.    case 'takeholywater': take_holywater(); break;
  34.    case 'leaveholywater': leave_holywater(); break;
  35.    case 'churchcontinue': church_continue(); break;
  36.    case 'staff': do_staff(); break;
  37.    case 'staffmoveuser': staff_move_user(); break;
  38.    case 'staffmoveuserdo': staff_move_user_do(); break;
  39.    case 'staffmoveusercom': staff_move_user_com(); break;
  40.    default:
  41.  
  42. $town = $db->query("SELECT * FROM maptowns");
  43. while($t = $db->fetch_row($town)) {
  44.    $name = $t['townID'];
  45. }
  46. echo "<br /><hr /><h3>In the Town of $name</h3><br /><a href=movetown1.php?action=leave>Back to Maps</a>";
  47.  
  48. if($ir['user_level'] == 2)
  49. {
  50. echo "<br /><a href=movetown1.php?action=staff>Staff Options</a><br />";
  51. }
  52. echo "
  53. <small>Please Note that most images are only temporary until system is completed</small>
  54. <table width='95%'>
  55. <tr><td></td>
  56. <td align='center'>
  57. </td><tr>
  58. <tr><td align='center' valign='top' width='100'><hr />";
  59.  
  60. if ($locationy == 0) { $northstop="<img src='/images/no.png' width='44' height='44'>"; } else { $northstop="<a href='movetown1.php?action=moven'><img src='/images/up.png'></a>"; }
  61. if ($locationy == $locationmxy) { $eaststop="<img src='/images/no.png' width='44' height='44'>"; } else { $eaststop="<a href='movetown1.php?action=movee'><img src='/images/right.png'></a>"; }
  62. if ($locationx == $locationmxx) { $southstop="<img src='/images/no.png' width='44' height='44'>"; } else { $southstop="<a href='movetown1.php?action=moves'><img src='/images/down.png'></a>"; }
  63. if ($locationx == 0) { $weststop="<img src='/images/no.png' width='44' height='44'>"; } else { $weststop="<a href='movetown1.php?action=movew'><img src='/images/left.png'></a>"; }
  64.  
  65. if ($moves <=  0) { echo "No Moves, Nav Disabled"; } else {
  66. echo "
  67. Your Map Location: <font color='blue' size='3'>
  68. <font color='green'>".$locationx."</font>,
  69. <font color='red'>".$locationy."</font><br />
  70. You have <font color='yellow'>".$moves."</font> left.</font><hr />
  71. <table>
  72. <tr>
  73. <td></td>
  74. <td></td>
  75. <td align='center'><font color='red'><b>N</b></font></td>
  76. <td></td>
  77. <td></td>
  78. </tr>
  79. <tr>
  80. <td></td>
  81. <td align='center'></td>
  82. <td align='center'>".$northstop."</td>
  83. <td align='center'></td>
  84. <td></td>
  85. </tr>
  86. <tr>
  87. <td><font color='green'><b>W</b></font></td>
  88. <td align='center'>".$weststop."</td>
  89. <td align='center'><b>+</b></td>
  90. <td align='center'>".$eaststop."</td>
  91. <td><font color='green'><b>E</b></font></td>
  92. </tr>
  93. <tr>
  94. <td></td>
  95. <td align='center'></td>
  96. <td align='center'>".$southstop."</td>
  97. <td align='center'></td>
  98. <td></td>
  99. </tr>
  100. <tr>
  101. <td></td>
  102. <td></td>
  103. <td align='center'><font color='red'><b>S</b></font></td>
  104. <td></td>
  105. <td></td>
  106. </tr>
  107. </table>"; }
  108. echo "<hr /><h4>Misc</h4>";
  109. $ulocation = array();
  110. $ulocationq = $db->query("SELECT * FROM users");
  111. while ($r=$db->fetch_row($ulocationq)){
  112.        $username = $r['username'];
  113.        $ulocation[$r['userid']] = array();
  114.        $ulocation[$r['userid']][0] = $r['locationyt'];
  115.        $ulocation[$r['userid']][1] = $r['locationxt'];
  116. }
  117.  
  118. if (($locationy == 0) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  119. if (($locationy == 0) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  120. if (($locationy == 0) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  121. if (($locationy == 0) && ($locationx == 3)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  122. if (($locationy == 0) && ($locationx == 4)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  123. if (($locationy == 0) && ($locationx == 5)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  124. if (($locationy == 0) && ($locationx == 6)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  125. if (($locationy == 0) && ($locationx == 7)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  126. if (($locationy == 0) && ($locationx == 8)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  127. if (($locationy == 0) && ($locationx == 9)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  128. if (($locationy == 0) && ($locationx == 10)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  129. if (($locationy == 0) && ($locationx == 11)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  130. if (($locationy == 0) && ($locationx == 12)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  131. if (($locationy == 0) && ($locationx == 13)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  132. if (($locationy == 0) && ($locationx == 14)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  133. if (($locationy == 0) && ($locationx == 15)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  134. if (($locationy == 0) && ($locationx == 16)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  135. if (($locationy == 0) && ($locationx == 17)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  136. if (($locationy == 0) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  137. if (($locationy == 0) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  138.  
  139. if (($locationy == 2) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  140. if (($locationy == 2) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  141. if (($locationy == 2) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  142. if (($locationy == 2) && ($locationx == 4)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  143. if (($locationy == 2) && ($locationx == 5)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  144. if (($locationy == 2) && ($locationx == 6)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  145. if (($locationy == 2) && ($locationx == 7)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  146. if (($locationy == 2) && ($locationx == 8)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  147. if (($locationy == 2) && ($locationx == 9)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  148. if (($locationy == 2) && ($locationx == 12)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  149. if (($locationy == 2) && ($locationx == 13)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  150. if (($locationy == 2) && ($locationx == 14)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  151. if (($locationy == 2) && ($locationx == 15)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  152. if (($locationy == 2) && ($locationx == 16)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  153. if (($locationy == 2) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  154. if (($locationy == 2) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  155.  
  156. if (($locationy == 3) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  157. if (($locationy == 3) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  158. if (($locationy == 3) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  159. if (($locationy == 3) && ($locationx == 4)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  160. if (($locationy == 3) && ($locationx == 5)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  161. if (($locationy == 3) && ($locationx == 6)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  162. if (($locationy == 3) && ($locationx == 7)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  163. if (($locationy == 3) && ($locationx == 8)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  164. if (($locationy == 3) && ($locationx == 9)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  165. if (($locationy == 3) && ($locationx == 12)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  166. if (($locationy == 3) && ($locationx == 13)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  167. if (($locationy == 3) && ($locationx == 14)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  168. if (($locationy == 3) && ($locationx == 15)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  169. if (($locationy == 3) && ($locationx == 16)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  170. if (($locationy == 3) && ($locationx == 18)) { echo "<h3>Shop</h3><a href='movetown1.php?action=shop'><u>CLOSED</u></a><br />"; }
  171. if (($locationy == 3) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  172.  
  173. if (($locationy == 5) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  174. if (($locationy == 5) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  175. if (($locationy == 5) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  176. if (($locationy == 5) && ($locationx == 4)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  177. if (($locationy == 5) && ($locationx == 5)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  178. if (($locationy == 5) && ($locationx == 6)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  179. if (($locationy == 5) && ($locationx == 7)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  180. if (($locationy == 5) && ($locationx == 8)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  181. if (($locationy == 5) && ($locationx == 9)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  182. if (($locationy == 5) && ($locationx == 12)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  183. if (($locationy == 5) && ($locationx == 13)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  184. if (($locationy == 5) && ($locationx == 14)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  185. if (($locationy == 5) && ($locationx == 15)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  186. if (($locationy == 5) && ($locationx == 16)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  187. if (($locationy == 5) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  188. if (($locationy == 5) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  189.  
  190. if (($locationy == 6) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  191. if (($locationy == 6) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  192. if (($locationy == 6) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  193. if (($locationy == 6) && ($locationx == 4)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  194. if (($locationy == 6) && ($locationx == 5)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  195. if (($locationy == 6) && ($locationx == 6)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  196. if (($locationy == 6) && ($locationx == 7)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  197. if (($locationy == 6) && ($locationx == 8)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  198. if (($locationy == 6) && ($locationx == 9)) { echo "<h3>Church</h3><a href='movetown1.php?action=church'><u>Check it Out</u></a><br />"; }
  199. if (($locationy == 6) && ($locationx == 12)) { echo "<h3>Shop</h3><a href='movetown1.php?action=shop'><u>CLOSED</u></a><br />"; }
  200. if (($locationy == 6) && ($locationx == 13)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  201. if (($locationy == 6) && ($locationx == 14)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  202. if (($locationy == 6) && ($locationx == 15)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  203. if (($locationy == 6) && ($locationx == 16)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  204. if (($locationy == 6) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  205. if (($locationy == 6) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  206.  
  207. if (($locationy == 8) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  208. if (($locationy == 8) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  209. if (($locationy == 8) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  210. if (($locationy == 8) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  211. if (($locationy == 8) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  212.  
  213. if (($locationy == 9) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  214. if (($locationy == 9) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  215. if (($locationy == 9) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  216. if (($locationy == 9) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  217. if (($locationy == 9) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  218.  
  219. if (($locationy == 11) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  220. if (($locationy == 11) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  221. if (($locationy == 11) && ($locationx == 2)) { echo "<h3>Shop</h3><a href='movetown1.php?action=shop'><u>CLOSED</u></a><br />"; }
  222. if (($locationy == 11) && ($locationx == 18)) { echo "<h3>Shop</h3><a href='movetown1.php?action=shop'><u>CLOSED</u></a><br />"; }
  223. if (($locationy == 11) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  224.  
  225. if (($locationy == 12) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  226. if (($locationy == 12) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  227. if (($locationy == 12) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  228. if (($locationy == 12) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  229. if (($locationy == 12) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  230.  
  231. if (($locationy == 14) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  232. if (($locationy == 14) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  233. if (($locationy == 14) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  234. if (($locationy == 14) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  235. if (($locationy == 14) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  236.  
  237. if (($locationy == 15) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  238. if (($locationy == 15) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  239. if (($locationy == 15) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  240. if (($locationy == 15) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  241. if (($locationy == 15) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  242.  
  243. if (($locationy == 17) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  244. if (($locationy == 17) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  245. if (($locationy == 17) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  246. if (($locationy == 17) && ($locationx == 4)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  247. if (($locationy == 17) && ($locationx == 5)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  248. if (($locationy == 17) && ($locationx == 6)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  249. if (($locationy == 17) && ($locationx == 7)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  250. if (($locationy == 17) && ($locationx == 8)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  251. if (($locationy == 17) && ($locationx == 9)) { echo "<h3>Shop</h3><a href='movetown1.php?action=shop'><u>Closed</u></a><br />"; }
  252. if (($locationy == 17) && ($locationx == 12)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  253. if (($locationy == 17) && ($locationx == 13)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  254. if (($locationy == 17) && ($locationx == 14)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  255. if (($locationy == 17) && ($locationx == 15)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  256. if (($locationy == 17) && ($locationx == 16)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  257. if (($locationy == 17) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  258. if (($locationy == 17) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  259.  
  260. if (($locationy == 18) && ($locationx == 0)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  261. if (($locationy == 18) && ($locationx == 1)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  262. if (($locationy == 18) && ($locationx == 2)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  263. if (($locationy == 18) && ($locationx == 4)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  264. if (($locationy == 18) && ($locationx == 5)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  265. if (($locationy == 18) && ($locationx == 6)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  266. if (($locationy == 18) && ($locationx == 7)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  267. if (($locationy == 18) && ($locationx == 8)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  268. if (($locationy == 18) && ($locationx == 9)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  269. if (($locationy == 18) && ($locationx == 12)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  270. if (($locationy == 18) && ($locationx == 13)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  271. if (($locationy == 18) && ($locationx == 14)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  272. if (($locationy == 18) && ($locationx == 15)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  273. if (($locationy == 18) && ($locationx == 16)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  274. if (($locationy == 18) && ($locationx == 18)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  275. if (($locationy == 18) && ($locationx == 19)) { echo "<h3>House No.".$locationx."".$locationy."</h3><a href='movetown1.php?action=house'><u>Enter</u></a><br />"; }
  276.  
  277. $i = 1;
  278. foreach($ulocation as $loc)
  279. {
  280.        if (($locationy == $loc[1]) && ($locationx == $loc[0]) && ($i != $user_id)) {
  281.                echo "<h3>Another User is Here.</h3>
  282.               <a href='viewuser.php?u=".$i."'>View user ID ".$i."</a><br />
  283.               <a href='mailbox.php?action=compose&ID=".$i."'>Mail user ID ".$i."</a><br />
  284.  
  285. ";
  286.        }
  287.        $i++;
  288. }
  289. echo "<hr />
  290. <u><b>Legend</b></u><br />
  291. <table width='110px'>
  292. <tr>
  293. <td>You</td>
  294. <td> - </td>
  295. <td><img src='/images/punki.jpg' width='20' height='20'></td>
  296. </tr>
  297. <tr>
  298. <td>Users</td>
  299. <td> - </td>
  300. <td><img src='/images/cop.jpg' width='20' height='20'></td>
  301. </tr>
  302. <tr>
  303. <td>House</td>
  304. <td> - </td>
  305. <td><img src='/images/grasshouse.png' width='20' height='20'></td>
  306. </tr>
  307. <tr>
  308. <td>Shops</td>
  309. <td> - </td>
  310. <td><img src='/images/pub.png' width='20' height='20'></td>
  311. </tr>
  312. <tr>
  313. <td>Church</td>
  314. <td> - </td>
  315. <td><img src='/images/church.png' width='20' height='20'></td>
  316. </tr>
  317. </table>
  318. <hr />";
  319. echo "</td><td width='600' align='center'><small>(".$locationmxy."x".$locationmxx." Grid Currently.)</small><br />";
  320. define('HEIGHT', $locationmxx);
  321. define('WIDTH',  $locationmxy);
  322. define('GRASS',   0);
  323. define('PATH', 1);
  324. define('MISSION',   2);
  325. define('YOU',   3);
  326. define('USERS',     4);
  327. define('TREE',    5);
  328. define('ROCK',    6);
  329. define('CITY',    7);
  330. define('CHURCH', 8);
  331. define('PUB',     9);
  332. define('HOUSE',   10);
  333.  
  334. // Create blank map array [y][x]
  335. $map = array_fill(0, HEIGHT, array_fill(0, WIDTH, GRASS));
  336. $i = 1;
  337. foreach($ulocation as $loc)
  338. {
  339.        if($i != $user_id)
  340.        {
  341.                $map[$loc[1]][$loc[0]] = USERS;
  342.        }
  343.        $i++;
  344. }
  345. $map[0][0] = HOUSE;
  346. $map[0][1] = HOUSE;
  347. $map[0][2] = HOUSE;
  348. $map[0][3] = HOUSE;
  349. $map[0][4] = HOUSE;
  350. $map[0][5] = HOUSE;
  351. $map[0][6] = HOUSE;
  352. $map[0][7] = HOUSE;
  353. $map[0][8] = HOUSE;
  354. $map[0][9] = HOUSE;
  355. $map[0][10] = HOUSE;
  356. $map[0][11] = HOUSE;
  357. $map[0][12] = HOUSE;
  358. $map[0][13] = HOUSE;
  359. $map[0][14] = HOUSE;
  360. $map[0][15] = HOUSE;
  361. $map[0][16] = HOUSE;
  362. $map[0][17] = HOUSE;
  363. $map[0][18] = HOUSE;
  364. $map[0][19] = HOUSE;
  365.  
  366. $map[2][0] = HOUSE;
  367. $map[2][1] = HOUSE;
  368. $map[2][2] = HOUSE;
  369. $map[2][4] = HOUSE;
  370. $map[2][5] = HOUSE;
  371. $map[2][6] = HOUSE;
  372. $map[2][7] = HOUSE;
  373. $map[2][8] = HOUSE;
  374. $map[2][9] = HOUSE;
  375. $map[2][12] = HOUSE;
  376. $map[2][12] = HOUSE;
  377. $map[2][13] = HOUSE;
  378. $map[2][14] = HOUSE;
  379. $map[2][15] = HOUSE;
  380. $map[2][16] = HOUSE;
  381. $map[2][18] = HOUSE;
  382. $map[2][19] = HOUSE;
  383.  
  384. $map[3][0] = HOUSE;
  385. $map[3][1] = HOUSE;
  386. $map[3][2] = HOUSE;
  387. $map[3][4] = HOUSE;
  388. $map[3][5] = HOUSE;
  389. $map[3][6] = HOUSE;
  390. $map[3][7] = HOUSE;
  391. $map[3][8] = HOUSE;
  392. $map[3][9] = HOUSE;
  393. $map[3][12] = HOUSE;
  394. $map[3][12] = HOUSE;
  395. $map[3][13] = HOUSE;
  396. $map[3][14] = HOUSE;
  397. $map[3][15] = HOUSE;
  398. $map[3][16] = HOUSE;
  399. $map[3][18] = PUB;
  400. $map[3][19] = HOUSE;
  401.  
  402. $map[5][0] = HOUSE;
  403. $map[5][1] = HOUSE;
  404. $map[5][2] = HOUSE;
  405. $map[5][4] = HOUSE;
  406. $map[5][5] = HOUSE;
  407. $map[5][6] = HOUSE;
  408. $map[5][7] = HOUSE;
  409. $map[5][8] = HOUSE;
  410. $map[5][9] = HOUSE;
  411. $map[5][12] = HOUSE;
  412. $map[5][12] = HOUSE;
  413. $map[5][13] = HOUSE;
  414. $map[5][14] = HOUSE;
  415. $map[5][15] = HOUSE;
  416. $map[5][16] = HOUSE;
  417. $map[5][18] = HOUSE;
  418. $map[5][19] = HOUSE;
  419.  
  420. $map[6][0] = HOUSE;
  421. $map[6][1] = HOUSE;
  422. $map[6][2] = HOUSE;
  423. $map[6][4] = HOUSE;
  424. $map[6][5] = HOUSE;
  425. $map[6][6] = HOUSE;
  426. $map[6][7] = HOUSE;
  427. $map[6][8] = HOUSE;
  428. $map[6][9] = CHURCH;
  429. $map[6][12] = PUB;
  430. $map[6][12] = HOUSE;
  431. $map[6][13] = HOUSE;
  432. $map[6][14] = HOUSE;
  433. $map[6][15] = HOUSE;
  434. $map[6][16] = HOUSE;
  435. $map[6][18] = HOUSE;
  436. $map[6][19] = HOUSE;
  437.  
  438. $map[8][0] = HOUSE;
  439. $map[8][1] = HOUSE;
  440. $map[8][2] = HOUSE;
  441. $map[8][18] = HOUSE;
  442. $map[8][19] = HOUSE;
  443.  
  444. $map[9][0] = HOUSE;
  445. $map[9][1] = HOUSE;
  446. $map[9][2] = HOUSE;
  447. $map[9][18] = HOUSE;
  448. $map[9][19] = HOUSE;
  449.  
  450. $map[11][0] = HOUSE;
  451. $map[11][1] = HOUSE;
  452. $map[11][2] = PUB;
  453. $map[11][18] = PUB;
  454. $map[11][19] = HOUSE;
  455.  
  456. $map[12][0] = HOUSE;
  457. $map[12][1] = HOUSE;
  458. $map[12][2] = HOUSE;
  459. $map[12][18] = HOUSE;
  460. $map[12][19] = HOUSE;
  461.  
  462. $map[14][0] = HOUSE;
  463. $map[14][1] = HOUSE;
  464. $map[14][2] = HOUSE;
  465. $map[14][18] = HOUSE;
  466. $map[14][19] = HOUSE;
  467.  
  468. $map[15][0] = HOUSE;
  469. $map[15][1] = HOUSE;
  470. $map[15][2] = HOUSE;
  471. $map[15][18] = HOUSE;
  472. $map[15][19] = HOUSE;
  473.  
  474. $map[17][0] = HOUSE;
  475. $map[17][1] = HOUSE;
  476. $map[17][2] = HOUSE;
  477. $map[17][4] = HOUSE;
  478. $map[17][5] = HOUSE;
  479. $map[17][6] = HOUSE;
  480. $map[17][7] = HOUSE;
  481. $map[17][8] = HOUSE;
  482. $map[17][9] = PUB;
  483. $map[17][12] = HOUSE;
  484. $map[17][12] = HOUSE;
  485. $map[17][13] = HOUSE;
  486. $map[17][14] = HOUSE;
  487. $map[17][15] = HOUSE;
  488. $map[17][16] = HOUSE;
  489. $map[17][18] = HOUSE;
  490. $map[17][19] = HOUSE;
  491.  
  492. $map[18][0] = HOUSE;
  493. $map[18][1] = HOUSE;
  494. $map[18][2] = HOUSE;
  495. $map[18][4] = HOUSE;
  496. $map[18][5] = HOUSE;
  497. $map[18][6] = HOUSE;
  498. $map[18][7] = HOUSE;
  499. $map[18][8] = HOUSE;
  500. $map[18][9] = HOUSE;
  501. $map[18][12] = HOUSE;
  502. $map[18][12] = HOUSE;
  503. $map[18][13] = HOUSE;
  504. $map[18][14] = HOUSE;
  505. $map[18][15] = HOUSE;
  506. $map[18][16] = HOUSE;
  507. $map[18][18] = HOUSE;
  508. $map[18][19] = HOUSE;
  509.  
  510. $map[$locationy][$locationx] = YOU;
  511.  
  512. // Translation table for integers to images
  513. $image = array(
  514.    GRASS  => '/images/grass.png',
  515.    PATH => '/images/path.png',
  516.    MISSION => '/images/mission.png',
  517.    USERS  => '/images/cop.jpg',
  518.    TREE   => '/images/grasstrees.png',
  519.    ROCK   => '/images/grassrock.png',
  520.    CITY   => '/images/city.png',
  521.    YOU    => '/images/punki.jpg',
  522.    PUB    => '/images/pub.png',
  523.    HOUSE  => '/images/grasshouse.png',
  524.    CHURCH => '/images/church.png',
  525. );
  526.  
  527. // Display the map (Note that the \t and \n chars are simply for clarity)
  528. echo '<table style="background: url(/images/grass.png)" border="0" cellpadding="0" width="275px" height="275px">' . "\n";
  529. for ($y = 0; $y < HEIGHT; $y++)
  530. {
  531.    echo "\t" . '<tr>' . "\n";
  532.    for ($x = 0; $x < WIDTH; $x++) {
  533.            echo "\t\t" . '<td><img src="'.$image[$map[$y][$x]].'" width="20" height="20"></td>' . "\n";
  534.    }
  535.    echo "\t" . '</tr>' . "\n";
  536. }
  537. echo '</table>';
  538. echo "</td></tr>
  539. </table>";
  540. }
  541.  
  542.  
  543. // Move Functions
  544. function do_move1_north()
  545. {
  546. global $db, $userid;
  547. $db->query("UPDATE users SET locationyt=locationyt-1, moves=moves-1 WHERE userid=$userid");
  548. echo "Moved North<br /><meta http-equiv='refresh' content='0;URL=movetown1.php' /> ";
  549. }
  550.  
  551. function do_move1_east()
  552. {
  553. global $db, $userid;
  554. $db->query("UPDATE users SET locationxt=locationxt+1, moves=moves-1 WHERE userid=$userid");
  555. echo "Moved East<br /><meta http-equiv='refresh' content='0;URL=movetown1.php' /> ";
  556. }
  557. function do_move1_west()
  558. {
  559. global $db, $userid;
  560. $db->query("UPDATE users SET locationxt=locationxt-1, moves=moves-1 WHERE userid=$userid");
  561. echo "Moved West<br /><meta http-equiv='refresh' content='0;URL=movetown1.php' /> ";
  562. }
  563. function do_move1_south()
  564. {
  565. global $db, $userid;
  566. $db->query("UPDATE users SET locationyt=locationyt+1, moves=moves-1 WHERE userid=$userid");
  567. echo "Moved South<br /><meta http-equiv='refresh' content='0;URL=movetown1.php' /> ";
  568. }
  569.  
  570.  
  571. // Staff Section
  572. function do_staff()
  573. {
  574. global $db,$ir, $c;
  575. if($ir['user_level'] != 2)
  576. {
  577. die("403");
  578. }
  579. echo "<br /><br />
  580. <a href=movetown1.php?action=staffmoveuser>Move Users Town Location</a><br /><br />
  581. <a href=movetown1.php>Back to Map</a><br />
  582. ";
  583. }
  584.  
  585. function staff_move_user()
  586. {
  587. global $db,$ir,$c,$h,$userid;
  588. if($ir['user_level'] != 2)
  589. {
  590. die("Restricted Area");
  591. }
  592. print "<h3>Editing Users Town Location</h3>
  593. Enter users ID<br />
  594. <form action='movetown1.php?action=staffmoveuserdo' method='post'>
  595. User: <input type='text' name='user' value='0' /><br />
  596. <input type='submit' value='Edit Users Town Location' /></form>";
  597. }
  598. function staff_move_user_do()
  599. {
  600. global $db,$ir,$c,$h,$userid;
  601. if($ir['user_level'] != 2)
  602. {
  603. die("403");
  604. }
  605. $d=$db->query("SELECT * FROM users WHERE userid={$_POST['user']}");
  606. $user=$db->fetch_row($d);
  607. echo "<h3>Editing Users Town Location</h3>
  608. <form action='movetown1.php?action=staffmoveusercom' method='post'>
  609. <input type='hidden' name='userid' value='{$_POST['user']}' /><br />
  610. <br /><br />
  611. location x: <input type='text' name='locationxt' value='{$user['locationxt']}' /><br />
  612. location y: <input type='text' name='locationyt' value='{$user['locationyt']}' /><br />
  613. <input type='submit' value='Edit users Town location' /></form>
  614. <br />";
  615. }
  616. function staff_move_user_com()
  617. {
  618. global $db,$ir,$c,$h,$userid;
  619. if($ir['user_level'] != 2)
  620. {
  621. die("Restricted Area");
  622. }
  623. $db->query("UPDATE users SET locationxt={$_POST['locationxt']}, locationyt={$_POST['locationyt']} WHERE userid={$_POST['userid']}");
  624. echo "User has been moved to location <font color='green'>{$_POST['locationxt']} </font>, <font color='red'>{$_POST['locationyt']}</font><meta http-equiv='refresh' content='1;URL=movetown1.php' />";
  625. }
  626.  
  627.  
  628. // Map interaction functions
  629. function enter_church()
  630. {
  631.    echo "<br /><br /><h2>The Church</h2>You Enter the church. You see Holy Water to the right. Do you take some or not?<br /><br />
  632. <a href='movetown1.php?action=takeholywater'>Take</a><br />
  633. <a href='movetown1.php?action=leaveholywater'>Leave</a><br />
  634. ";
  635. }
  636. function take_holywater()
  637. {
  638. global $db,$ir,$c,$h,$userid;
  639. $chance = rand(0, 1);
  640. $amount = rand(2, 100);
  641. $amount2 = rand(10, 100);
  642. if($chance == 1) {
  643. $db->query("UPDATE users SET will=will+$amount WHERE userid=$userid");
  644. echo "<br /><br /><br /><br />You Grabbed the Holy Water, Put it in your pocket, Luckily the Priest didn't see you take it.<br />You gained $amount Will. <br /><br /><a href='movetown1.php?action=churchcontinue'>Continue</a>";
  645. } else {
  646. $db->query("UPDATE users SET hp=hp-$amount2 WHERE userid=$userid");
  647. echo "<br /><br /><br /><br />You Grabbed the Holy Water, You go to put it in your pocket before a man behinds you hits you in the head, You put the Holy Water back<br />The Man caused $amount2 damage to your health.<br /><br /><a href='movetown1.php?action=churchcontinue'>Continue</a>";
  648. }
  649. }
  650.  
  651. function leave_holywater()
  652. {
  653. global $db,$ir,$c,$h,$userid;
  654. $chance = rand(0, 1);
  655. $amount = rand(2,100);
  656. $amount2 = rand(10,20);
  657. if($chance == 1) {
  658. $db->query("UPDATE users SET will=will+$amount WHERE userid=$userid");
  659. echo "<br /><br /><br /><br />You Left the Holy Water.<br />You gained $amount Will. <br /><br /><a href='movetown1.php?action=churchcontinue'>Continue</a>";
  660. } else {
  661. $db->query("UPDATE users SET will=will-$amount2 WHERE userid=$userid");
  662. echo "<br /><br /><br /><br />You Left the Holy Water.<br />You Lost $amount2 Will.<br /><br /><a href='movetown1.php?action=churchcontinue'>Continue</a>";
  663. }
  664. }
  665. function church_continue()
  666. {
  667. echo "<br /><br /><br /><br />You Walk down the isle to a seat on your own on the far left side of the church, you look around.<br />This is as far as the church demo goes. If you Like this Stick around.<br /><br />
  668. <a href='movetown1.php'>Back to Town</a>";
  669. }
  670.  
  671.  
  672.  
  673.  
  674.  
  675. // house options
  676. function enter_house()
  677. {
  678. global $db,$userid, $ir;
  679. $hidt=$db->query("SELECT * FROM maphouses WHERE houseID={$ir['locationxt']}{$ir['locationyt']}");
  680. $tr=$db->fetch_row($hidt);
  681. echo "<br /><h3>House {$ir['locationxt']}{$ir['locationyt']}.</h3><br /><br />";
  682.  
  683. if($tr['houseOWNER'] == $userid)
  684. {
  685. echo "<i>Your House Options<i><br />
  686. <a href='movetown1.php?action=sellhouse'>Sell House</a><br />
  687. <a href='movetown1.php?action=updatedesc'>House Description</a><br />
  688. <a href='movetown1.php?action=allowguests'>Allow Guests</a><br />
  689. <a href='movetown1.php?aciton=slothouse'>House Items</a><br /><br />";
  690. }
  691.  
  692.  
  693.  
  694. if($tr['houseOWNER'] == 0)
  695. {
  696. echo "
  697. <i>Options<i><br />
  698. <a href='movetown1.php?action=buyhouse'>Buy House</a><br />";
  699. }
  700.  
  701. if($tr['houseOWNER'] >= 1)
  702. {
  703. global $db,$c,$h,$userid;
  704. $u=$db->query("SELECT * FROM users WHERE userid={$tr['houseOWNER']}");
  705. $user=$db->fetch_row($u);
  706. echo "This House belongs to: {$user['username']}.<br />
  707. <a href='movetown1.php?action=entermainhouse'>Enter House</a><br /><br />";
  708. }
  709.  
  710.  
  711.  
  712. echo "<br /><br />
  713. <a href='movetown1.php'>Back to Town</a>";
  714. }
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722. function enter_main_house() {
  723. global $db,$c,$h,$userid,$ir;
  724.  
  725.  
  726. $hid=$db->query("SELECT * FROM maphouses WHERE houseID={$ir['locationxt']}{$ir['locationyt']}");
  727. $r=$db->fetch_row($hid);
  728. $u=$db->query("SELECT * FROM users WHERE userid={$r['houseOWNER']}");
  729. $user=$db->fetch_row($u);
  730. $username = $user['username'];
  731. $description = $r['houseDESC'];
  732. if($r['allowguests'] == 1)
  733. {
  734. echo "This House belongs to: $username.<br /><br />
  735. <i>Desc.</i><br />$description<br /><br />
  736.  
  737.  
  738.  
  739. ";
  740. } else {
  741. echo "This User Does not wish to allow Guests.";
  742. }
  743. echo "<br /><br />
  744. <a href='movetown1.php'>Back to Town</a>";
  745. }
  746.  
  747.  
  748.  
  749. function buy_house()
  750. {
  751. $cost='1000000';
  752. echo "<h2>Buy This House</h3>
  753. It Currently Costs $cost.<br /><br />
  754. Are you Sure?<br />
  755. <a href='movetown1.php?action=buyhousedo'>Yes</a><br />
  756. <a href='movetown1.php'>No</a>
  757. ";
  758. }
  759. function buy_house_do()
  760. {
  761. global $db,$c,$h,$userid;
  762. $d=$db->query("SELECT * FROM users WHERE userid=$userid");
  763. $user=$db->fetch_row($d);
  764. $h=$db->query("SELECT * FROM maphouses");
  765. $owned=$db->fetch_row($h);
  766. if(($user['money'] <= 999999) && ($owned['houseID'] <=0)) {
  767. echo "You don't have enough money or this house is Already Owned by someone.<br />Returning you to Town. <meta http-equiv='refresh' content='2;URL=movetown1.php' />";
  768. } else {
  769. $db->query("UPDATE users SET money=money-1000000 WHERE userid=$userid");
  770. $db->query("INSERT INTO `maphouses`(`houseID`, `houseOWNER`, `houseDESC`, `housesize`, `allowguests`, `itemslot1`, `itemslot2`, `itemslot3`, `itemslot4`, `itemslot5`, `itemslot6`, `itemslot7`, `itemslot8`, `itemslot9`, `itemslot10`, `itemslot11`, `itemslot12`, `itemslot13`, `itemslot14`, `itemslot15`, `itemslot16`, `itemslot17`, `itemslot18`, `itemslot19`, `itemslot20`) VALUES ( '{$user['locationxt']}{$user['locationyt']}', '$userid', 'Description', 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)");
  771. echo "Contratz on Your New House.<br />No.{$user['locationxt']}{$user['locationyt']}. <br /><br />Returning you to Town. <meta http-equiv='refresh' content='2;URL=movetown1.php' />";
  772. }
  773. }
  774.  
  775.  
  776.  
  777. function sell_house()
  778. {
  779. echo "<h2>Sell This House</h3>
  780. <br /><br />
  781. Are you Sure?<br />
  782. <a href='movetown1.php?action=sellhousedo'>Yes</a><br />
  783. <a href='movetown1.php'>No</a>
  784. ";
  785. }
  786. function sell_house_do()
  787. {
  788. global $db,$c,$h,$userid;
  789. $d=$db->query("SELECT * FROM users WHERE userid=$userid");
  790. $user=$db->fetch_row($d);
  791. $db->query("UPDATE users SET money=money+1000000 WHERE userid=$userid");
  792. $db->query("DELETE FROM maphouses WHERE houseID={$user['locationxt']}{$user['locationyt']}");
  793. echo "Contratz on Your Selling your House.<br />No.{$user['locationxt']}{$user['locationyt']}. Returning you to Town. <meta http-equiv='refresh' content='5;URL=movetown1.php' />";
  794. }
  795.  
  796.  
  797.  
  798.  
  799. function update_desc()
  800. {
  801. global $db,$c,$h,$userid,$ir;
  802. $d=$db->query("SELECT * FROM maphouses WHERE houseOWNER=$userid");
  803. $miss=$db->fetch_row($d);
  804. echo "<h2>Your House Description</h3>
  805. <br /><br />
  806. <form action='movetown1.php?action=updatedescdo' method='post'>
  807. <input type='hidden' name='uid' value='{$ir['userid']}' /><br />
  808. <textarea rows=6 cols=60 name='hDESC' />{$miss['houseDESC']}</textarea><br />
  809. <input type='submit' value='Update Description' /></form>";
  810. }
  811.  
  812. function update_desc_do()
  813. {
  814. global $db,$c,$h;
  815. $uidt = $_POST['uid'];
  816. $descc = $_POST['hDESC'];
  817. $db->query("UPDATE maphouses SET houseDESC='$descc' WHERE houseOWNER=$uidt");
  818. echo "House Description Updated. Returning you to Town. <meta http-equiv='refresh' content='5;URL=movetown1.php?action=house' />";
  819. }
  820.  
  821.  
  822.  
  823.  
  824. function allow_guests()
  825. {
  826. global $ir,$c,$userid,$h;
  827. echo "<h3>Allow Guests into your house?</h3><br />
  828. <form action='movetown1.php?action=allowguestsdo' method='post'>
  829. <select name='allowguests' type='dropdown'>
  830. <option value='1'>Yes</option>
  831. <option value='0'>No</option></select>
  832. <input type='submit' value='Change' /></form>";
  833. }
  834. function allow_guests_do()
  835. {
  836. global $db,$ir,$c,$userid,$h;
  837. $db->query("UPDATE maphouses SET allowguests={$_POST['allowguests']} WHERE houseOWNER=$userid");
  838. echo "Set. Returning you to Town. <meta http-equiv='refresh' content='5;URL=movetown1.php?action=house' />";
  839. }
  840.  
  841.  
  842. function enter_shop()
  843. {
  844. global $db,$c,$h,$userid;
  845. $d=$db->query("SELECT * FROM users WHERE userid=$userid");
  846. $user=$db->fetch_row($d);
  847. echo "Shops Closed. <br />Returning you to Town. <meta http-equiv='refresh' content='2;URL=movetown1.php' />";
  848. }
  849. function do_leave()
  850. {
  851.    echo "You Left, Returning to Map.<meta http-equiv='refresh' content='1;URL=move.php' /> ";
  852. }
  853.  
  854. $h->endpage();
  855. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement