📄 class_character.php
字号:
<?php/*** Netlands World Server is the coordinator of the VR in the Netlands Project* Copyright (C) 2002 Ricard Pillosu* * This program is free software; you can redistribute it and/or* modify it under the terms of the GNU General Public License* as published by the Free Software Foundation; either version 2* of the License, or (at your option) any later version.* * This program is distributed in the hope that it will be useful,* but WITHOUT ANY WARRANTY; without even the implied warranty of* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the* GNU General Public License for more details.* * You should have received a copy of the GNU General Public License* along with this program; if not, write to the Free Software* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.*//* vim: set expandtab tabstop=4 shiftwidth=4 *//*** All characters are defined by this class** What we define here is the class for all entities in the VR that can make* and do actions for their own. The basic difference between a character* and an object is that the object never will start an action itself. This* class has to be used for ANYTHING that can make actions. ** @see entity** @version $Id: class_character.php,v 1.3 2002/09/28 19:24:24 doneval Exp $* @author Ricard Pillosu <ricardpillosu@dorna.com>* @copyright Ricard Pillosu 2002* @since Sun, 04 Aug 2002 15:13:32 +0200*/class character extends entity { /** * @var object Reference to user that controlls it */ var $user; /** * Init vars * @param object $entity_list the reference to the list where I belong * @param string $key The key to be used by this entity */ function __construct(&$entity_list, $key = NULL) { global $config; parent::__construct($entity_list, $key); $this->type = entity_list::T_CHAR; } /** * Send a message to the user that is controlling me * * @param array $msg */ function send_message($msg) { // Add the "to" for pointing to me $msg["to"] = $this->key; $data = get_xml_from_array($msg); if($data == FALSE) { throw new exception("bad data provided", debug_backtrace(), $msg); return(FALSE); } if(!is_a($this->user, "user")) { //throw new exception("this character have not a valid user"); return(FALSE); } $res = write_data_to_socket($this->user->connection, $data); if($res == FALSE) { return(FALSE); } return(TRUE); } }?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -