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']] =
'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) {
. ' 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) {