亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? class_entity_list.php

?? 一個基于web的rpg游戲源代碼
?? PHP
?? 第 1 頁 / 共 2 頁
字號:
<?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 *//*** Class to manage list of entities** In order to avoid using global arrays and other "not so clean" stuff. The* concept is that this class knows and manage all entities defined thought* itselft. Thanks to {@link mailto:supercoco@menta.net Tony Aguilar} for his* concept contribution.** @version $Id: class_entity_list.php,v 1.7 2002/09/29 02:31:52 doneval Exp $* @author Ricard Pillosu <ricardpillosu@dorna.com>* @copyright Ricard Pillosu 2002* @since Wed, 31 Jul 2002 23:21:04 +0200*/class entity_list {    /**    * The first and "root" key (like '/') for a filesystem    * @var object     */    private $root_entity;    /**    * @var string     */    private $root_name;    /**    * Maybe this data could be a 2 dimension array with types    * @var array $list All the data is here :)    */    var $list;    /**    * @var string Stores where to save/load files    */    private $directory;    /**    * @var string Stores default file name to save data    */    private $default_file;    /**    * Storages last error operating with this object    *    * Each "return(FALSE)" will store a string explaining the error    * Each "return(TRUE)" will flush this variable to "Success"    *    * @var string $last_error    */    private $last_error;    /**    * Constants about entity types    */    const T_NDEF = 0;    const T_OBJK = 1;    const T_CHAR = 2;    const T_ROOM = 3;    const T_DOOR = 4;    const T_AREA = 5;    /**    * Array containing class names of the entities    */    private $entity_types;    /**    * Only reset vars    */    function __construct($directory, $default_file = 'entities') {        $this->root_entity = NULL;        $this->root_name = "__ROOT__";        $this->list = array();        $this->flush_error();        $this->directory = $directory;        $this->default_file = $default_file;        $this->entity_types[T_NDEF] = "entity";        $this->entity_types[T_OBJK] = "objekt";        $this->entity_types[T_CHAR] = "character";        $this->entity_types[T_ROOM] = "room";        $this->entity_types[T_DOOR] = "door";        $this->entity_types[T_AREA] = "area";    }    /**    * Maybe force deletion of root_entity    */    function __destruct() {        // All references to my entities are lost, there is no need to        // call delete_entity foreach object in $list    }    /**    * Check validity of a "name" for a entity    */    function is_valid_name($string) {        $expr = "^[0-9a-zA-z _\-\.]{3,25}$";        if(ereg($expr, $string) == FALSE) {            $this->last_error = "invalid name";            throw new exception($this->last_error, debug_backtrace());            return(FALSE);        }        $this->flush_error();        return(TRUE);    }    /**    * Returns the "name" of the entity type    */    function get_type_name($type=0)    {        if(isset($this->entity_types[$type])) {            $this->flush_error();            return($this->entity_types[$type]);        }        $this->last_error = "invalid type";        throw new exception($this->last_error, debug_backtrace());        return(FALSE);    }    /**    * Returns the entity type from the "name"    */    function get_type_from_name($string)    {        $type = array_search($string, $this->entity_types);        if($type === FALSE) {            $this->last_error = "invalid type name";            throw new exception($this->last_error, debug_backtrace());            return(FALSE);        }        $this->flush_error();        return($type); // array_search return FALSE if not found    }    /**    * Save my state in a file    *    * @param string $file_name    */    function save($file = '') {        global $config;        // Filter $file        if(empty($file)) $file = $this->default_file;        // Check file to write        $file_name = $this->directory.$file;        if(file_exists($file_name)) {            if(is_writable($file_name) != TRUE) {                $this->last_error = "file is not writeable >".$file_name;                throw new exception($this->last_error, debug_backtrace());                return(FALSE);            }        } else {            // File is new            if(is_writable($this->directory) != TRUE) {                $this->last_error = "directory is not writeable >";                $this->last_error.= $this->directory;                throw new exception($this->last_error, debug_backtrace());                return(FALSE);            }        }        // Save root_entity        if($this->is_entity($this->root_entity) == FALSE) {            // Nothing to save :)            $this->flush_error();            return(TRUE);        }        $e = & $this->root_entity;        $data_to_save['id'] = $e->get_key();        $data_to_save['name'] = $this->root_name;        $data_to_save['xml_name'] = $this->get_type_name($e->type);        $data = get_xml_from_array($data_to_save);                // Rotate $list and add XML lines to $data        foreach(array_keys($this->list) as $key) {            $e = & $this->list[$key];            $data_to_save = $e->get_game_vars();            $data_to_save['xml_name'] = $this->get_type_name($e->type);            $data_to_save['id'] = $e->get_key();            $data_to_save['parent_id'] = $e->parent->get_key();            $data.= "\n".get_xml_from_array($data_to_save);        }        // Save $data to $file_name        $fp = fopen("$file_name", "w");        if(!$fp) {            $msg = "could not open >$file_name";            $this->last_error = $msg;            throw new exception($this->last_error, debug_backtrace());            return(FALSE);        }        $written = fwrite($fp, $data);        if($written < 0) {            fclose($fp);            $msg = "could not write to >$file_name";            $this->last_error = $msg;            throw new exception($this->last_error, debug_backtrace());            return(FALSE);        }        fclose($fp);        $this->flush_error();        return(TRUE);    }    /**    * Load a entities file    */    function load($file = '') {        // Filter $file        if(empty($file)) $file = $this->default_file;        // Check file to load        $file_name = $this->directory.$file;        if(is_readable($file_name) == FALSE) {            $this->last_error = "file is not readable >".$file_name;            throw new exception($this->last_error, debug_backtrace());            return(FALSE);        }        // Load file        $data = file($file_name);        $chars_to_link = array();        $moves = array();        $updates = array();        // Rotate lines        foreach($data as $xml) {            $command = get_array_from_xml($xml);             if(is_array($command) != TRUE) {                continue;            }            $type = get_type_from_name($command['xml_name']);            $key  = $command['id'];            // is this the root key ?            if(isset($command["name"]) && $command["name"] == $this->root_name) {                if($this->root_entity == NULL) {                    $this->root_entity = &new entity($this, $key);                    $msg = "Loaded ".$command['xml_name']." $this->root_name ($key)";                    log_msg($msg, "game");                }            } else {                $this->add_entity($key, '', $type);                 // Log                $msg = "Loaded ".$command["xml_name"]." $key";                log_msg($msg, "game");                // Save positions for do it later                if($command['parent_id'] != $this->root_entity->get_key()) {                    $moves[] = array(                            'entity_key' => $key,                            'parent_key' => $command['parent_id']);                }                // Saves all remaining for updates                unset($command['id']);                unset($command['parent_id'], $command['xml_name']);                if(is_array($command) && count($command) > 0) {                    $updates[$key] = $command;                }            }        }        // Now that all entities exists, move them        foreach($moves as $m) {            $entity = & get_entity($m['entity_key']);            $parent = & get_entity($m['parent_key']);            $this->move_entity_to($entity, $parent, ($foo = NULL), FALSE);            $msg = "Moved ".$entity->get_key()." -> ".$parent->get_key();            log_msg($msg, "game");        }        // Now update other infos for them        foreach($updates as $key => $data_to_update) {            $entity = & get_entity($key);            $entity->update_game_vars($data_to_update);            $msg = "Updated ".$entity->get_key();            foreach(array_keys($data_to_update) as $k) {                $msg.= " ".$k;            }            log_msg($msg, "game");        }            // Save with good parents and updates        $this->save();        $this->flush_error();        return(TRUE);    }    /**    * Empty error buffer    */    function flush_error() {        $this->last_error = "Success";        return(TRUE);    }    /**    * Return last error    */    function get_last_error() {        return($this->last_error);    }    /**    * Creates a new key (unique id)    *    * We are discussing if it is necessary to make a object type "key"    * that could include server, time created, unique id, etc ...    */    function create_key() {        do {            $key = md5(microtime());        } while($this->key_exists($key, FALSE));        return($key);    }    /**    * Check the validity of a key    */    function is_valid_key($key) {        $expr = "^[0-9a-f]{32}$";        if(!ereg($expr, $key)) { // Maybe PCRE better?            $this->last_error = "key is not valid";            throw new exception($this->last_error, debug_backtrace());            return(FALSE);        }        return(TRUE);    }    /**    * Check if key is defined or is the key of $root_entity    */    function key_exists($key, $exception=TRUE) {        if(isset($this->list[$key])) return(TRUE);        if($this->is_entity($this->root_entity)) {            if($key === $this->root_entity->get_key()) return(TRUE);        }        if($exception == TRUE) {            $this->last_error = "key does not exists";            throw new exception($this->last_error, debug_backtrace());        }        return(FALSE);    }    /**    * Return TRUE if object is a valid entity    */    function is_entity(&$object, $exception=TRUE) {        if(is_a($object, "entity") == FALSE) {            if($exception == TRUE) {                $this->last_error = "object is not an entity";                throw new exception($this->last_error, debug_backtrace(), $object);            }            return(FALSE);        }        $this->flush_error();        return(TRUE);

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人av在线一区二区| 一区二区三区在线视频免费| 日韩电影在线免费观看| 欧美撒尿777hd撒尿| 亚洲电影在线免费观看| 这里只有精品视频在线观看| 日韩成人一区二区| 精品国产乱码久久久久久免费| 蜜桃av一区二区| 久久―日本道色综合久久| 国产乱码精品一品二品| 国产日韩综合av| av在线这里只有精品| 一区二区日韩电影| 91精品国产全国免费观看| 久久精品国产精品亚洲红杏| 国产欧美日本一区二区三区| 91免费版pro下载短视频| 亚洲电影视频在线| 26uuuu精品一区二区| 成人免费视频app| 一区二区三区影院| 欧美成人一区二区| 成a人片国产精品| 亚洲成人一区在线| 久久综合九色综合97婷婷| 99精品国产一区二区三区不卡| 亚洲午夜久久久久中文字幕久| 欧美一级在线观看| 成人av在线影院| 奇米888四色在线精品| 欧美韩国日本一区| 欧美男同性恋视频网站| 国产一区二区导航在线播放| 一区二区三区中文字幕电影| 精品欧美黑人一区二区三区| 99精品欧美一区二区蜜桃免费 | 国产在线视频一区二区三区| 中文av字幕一区| 欧美日韩色一区| 成人免费看视频| 麻豆精品视频在线| 夜夜嗨av一区二区三区四季av| xfplay精品久久| 欧美群妇大交群中文字幕| 成人动漫中文字幕| 麻豆国产精品视频| 亚洲最新视频在线观看| 国产日产欧美一区二区三区 | 91精品国产入口在线| 成人免费视频免费观看| 久久精品国产成人一区二区三区| 尤物视频一区二区| 国产欧美一区二区精品秋霞影院 | 不卡欧美aaaaa| 蜜桃av一区二区| 三级欧美韩日大片在线看| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 欧美变态凌虐bdsm| 欧美美女一区二区| 在线观看日韩一区| 99精品1区2区| 欧美日韩www| 色婷婷av一区二区| av电影在线观看一区| 国产精品一区二区在线看| 美国av一区二区| 日韩国产欧美一区二区三区| 亚洲午夜羞羞片| 亚洲午夜在线电影| 亚洲精品va在线观看| 亚洲欧洲精品一区二区三区不卡| 国产亚洲精品免费| 国产日韩欧美制服另类| 久久只精品国产| 久久久久久久久久久久久久久99| 欧美不卡一区二区三区| 久久综合中文字幕| 久久久99久久| 日本一区二区三级电影在线观看| 久久久久九九视频| 欧美经典三级视频一区二区三区| 久久九九影视网| 国产精品卡一卡二卡三| 中文字幕一区在线观看| 中文字幕国产一区| **欧美大码日韩| 一区二区三区加勒比av| 亚洲成人综合网站| 男人操女人的视频在线观看欧美| 蜜臀精品久久久久久蜜臀 | 日韩欧美精品三级| 欧美成人女星排名| 久久免费视频色| 国产精品免费久久| 一级女性全黄久久生活片免费| 亚洲欧美另类小说| 日韩国产在线观看一区| 久久成人av少妇免费| 国产91色综合久久免费分享| a亚洲天堂av| 欧美人妇做爰xxxⅹ性高电影| 日韩午夜激情av| 日本一区二区视频在线| 亚洲综合区在线| 久久99热狠狠色一区二区| 国产盗摄一区二区三区| 91福利在线观看| 精品入口麻豆88视频| 国产精品美女久久福利网站| 亚洲一区二区三区在线看| 美女视频免费一区| 成人影视亚洲图片在线| 在线看日本不卡| 久久在线免费观看| 亚洲精品国产无套在线观| 免费成人av资源网| 99久久精品国产一区二区三区| 欧美日韩国产综合视频在线观看| 精品国产一区二区三区忘忧草 | 亚洲bt欧美bt精品| 国内精品国产成人国产三级粉色| 不卡在线视频中文字幕| 欧美高清你懂得| 中文字幕免费在线观看视频一区| 亚洲一区二区三区影院| 激情综合一区二区三区| 日本韩国精品一区二区在线观看| 日韩欧美一二区| 亚洲色图视频网站| 精品一区二区日韩| 欧美在线观看一二区| 国产午夜亚洲精品理论片色戒 | 亚洲免费观看高清完整版在线| 石原莉奈在线亚洲三区| 不卡av免费在线观看| 日韩欧美国产成人一区二区| 亚洲人成精品久久久久久| 黄页视频在线91| 欧美精品成人一区二区三区四区| 亚洲国产高清aⅴ视频| 免费在线观看日韩欧美| 在线观看不卡一区| 亚洲欧洲av另类| 国产精品系列在线播放| 在线成人高清不卡| 亚洲精品免费在线播放| 成人性生交大片免费| 久久综合成人精品亚洲另类欧美| 婷婷久久综合九色国产成人| 色狠狠综合天天综合综合| 国产精品激情偷乱一区二区∴| 麻豆精品在线观看| 欧美丰满少妇xxxxx高潮对白| 亚洲美女电影在线| 99热99精品| 国产精品美女久久久久久久久久久| 狠狠色丁香久久婷婷综合丁香| 9191精品国产综合久久久久久| 亚洲一区二区精品久久av| 99精品视频在线播放观看| 中文字幕亚洲在| 白白色 亚洲乱淫| 国产精品理伦片| 91视视频在线观看入口直接观看www | 韩国一区二区视频| 亚洲人成影院在线观看| 亚洲妇熟xx妇色黄| 成人精品视频一区二区三区| 久久婷婷一区二区三区| 国产主播一区二区三区| 精品国产乱码久久| 国内外成人在线视频| 久久这里都是精品| 国产精品一二三四| 日本一区二区三区四区在线视频| 国产高清亚洲一区| 国产精品女上位| 99精品视频一区| 一区二区免费视频| 欧美老女人在线| 久久se这里有精品| 久久久久免费观看| 成人国产精品免费观看视频| 国产精品国产精品国产专区不片| 99re成人精品视频| 亚洲国产日韩a在线播放| 欧美一级淫片007| 国产一区二区精品久久91| 亚洲国产成人一区二区三区| 色婷婷狠狠综合| 蜜臀av一区二区在线免费观看| 久久久综合激的五月天| 成人黄色小视频在线观看| 一区二区在线看| 91精品国产色综合久久久蜜香臀| 国产一区高清在线| **性色生活片久久毛片| 欧美一区二区三区色| 国产91精品免费|