protected function _logout() { $userName = Dura::user()->getName(); $userId = Dura::user()->getId(); $userOffset = 0; foreach ($this->roomModel->users as $user) { if ($userId == (string) $user->id) { break; } $userOffset++; } unset($this->roomModel->users[$userOffset]); if (count($this->roomModel->users)) { $this->_npcLogout($userName); if ($this->_isHost()) { $this->_moveHostRight(); } $this->roomHandler->save($this->id, $this->roomModel); } else { $this->roomHandler->delete($this->id); } Dura_Class_RoomSession::delete(); Dura::redirect('lounge'); }