X-Git-Url: https://disinclined.org/git/?a=blobdiff_plain;f=mud.php;fp=mud.php;h=7dae85396233e767a707cc6fced429134d2862cc;hb=015246c8a445dfad325cb9df846885d34d6284ff;hp=7306bd0f746d54ff5ea0dc1297f8c1a5a14d27d3;hpb=27d2f15507f85650b7651d409ec38cfbea8fd31f;p=mudd.git diff --git a/mud.php b/mud.php index 7306bd0..7dae853 100644 --- a/mud.php +++ b/mud.php @@ -65,7 +65,7 @@ class universe { public $rooms = array(); public function __construct($db) { - $rooms = $db->query("SELECT id,x,y,state FROM rooms"); + $rooms = $db->query('SELECT id,x,y,state FROM rooms'); if ($rooms) { foreach ($rooms as $room) { $this->rooms[$room['x']][$room['y']] = @@ -143,7 +143,7 @@ class mud extends model { 'si', $_GET['name'], $this->universe->rooms[$x][$y]['id']); $_SESSION['id'] = $id; //$others = $this->query('SELECT id, room FROM players WHERE id != ?', 'i', $this->player->id); - return array('x' => $x, 'y' => $y, 'id' => $id, 'name' => $name); + return array('x' => $x, 'y' => $y, 'id' => $id, 'name' => $name, 'poll' => $this->poll()); } private function yell($msg) { @@ -173,8 +173,12 @@ class mud extends model { . ' OR (type = "tell" AND destination = ?)' . ' OR (type = "say" AND messages.room = ?))', 'iii', $time, $this->player->id, $this->player->room); + $players = $this->query( + 'SELECT players.id, name, x ,y ' + . 'FROM players JOIN rooms ' + . 'ON players.room = rooms.id'); $_SESSION['last_polled'] = time(); - return $messages; + return array('messages' => $messages, 'players' => $players); } public function response($content) {