rpgillusion

RPG Illusion: French fork of Dragon Knight
git clone https://git.neuralcrash.com/rpgillusion.git
Log | Files | Refs | README

explore.php (1644B)


      1 <?php // explore.php :: Exploration, combats....
      2 
      3 function move() {
      4     
      5     global $userrow, $controlrow;
      6     
      7     if ($userrow["currentaction"] == "En combat") { header("Location: index.php?do=fight"); die(); }
      8     
      9     $latitude = $userrow["latitude"];
     10     $longitude = $userrow["longitude"];
     11     if (isset($_POST["north_x"])) { $latitude++; if ($latitude > $controlrow["gamesize"]) { $latitude = $controlrow["gamesize"]; } }
     12     if (isset($_POST["south_x"])) { $latitude--; if ($latitude < ($controlrow["gamesize"]*-1)) { $latitude = ($controlrow["gamesize"]*-1); } }
     13     if (isset($_POST["east_x"])) { $longitude++; if ($longitude > $controlrow["gamesize"]) { $longitude = $controlrow["gamesize"]; } }
     14     if (isset($_POST["west_x"])) { $longitude--; if ($longitude < ($controlrow["gamesize"]*-1)) { $longitude = ($controlrow["gamesize"]*-1); } }
     15     
     16     $townquery = doquery("SELECT id FROM {{table}} WHERE latitude='$latitude' AND longitude='$longitude' LIMIT 1", "towns");
     17     if (mysql_num_rows($townquery) > 0) {
     18         $townrow = mysql_fetch_array($townquery);
     19         include('towns.php');
     20         travelto($townrow["id"], false);
     21         die();
     22     }
     23     
     24     $chancetofight = rand(1,5);
     25     if ($chancetofight == 1) { 
     26         $action = "currentaction='En combat', currentfight='1',";
     27     } else {
     28         $action = "currentaction='En exploration',";
     29     }
     30 
     31     
     32     $updatequery = doquery("UPDATE {{table}} SET onlinetime=NOW(), $action latitude='$latitude', longitude='$longitude', dropcode='0' WHERE id='".$userrow["id"]."' LIMIT 1", "users");
     33     header("Location: index.php");
     34     
     35 }
     36 
     37 ?>