mud兼容tomud客户端实现步骤
[日期:2008-12-25] |
来源:
作者: |
[字体:大 中 小]
|
// 以下部分为修改内容
int look_room(object me, object env, int brief) { int i; mapping exits; string str, *dirs;
if( !env ) { tell_object(me, "你的四周灰蒙蒙地一片,什么也没有。\n"); return 1; }
if( !brief ) { str = sprintf( HIC + "%s" + NOR + "%s\n %s%s" + NOR, env->short(), wizardp(me)? " - " + file_name(env): "", env->long(), env->query("outdoors") ? NATURE_D->outdoor_room_description() : ""); } else { str = sprintf( HIC + "%s" + NOR + "%s\n" + NOR, env->short(), wizardp(me)? " - " + file_name(env): ""); }
if (mapp(exits = env->query("exits"))) { dirs = keys(exits); for(i=0; i<sizeof(dirs); i++) if ((int)env->query_door(dirs[i], "status") & DOOR_CLOSED ) dirs[i] = 0; dirs -= ({ 0 }); if (sizeof(dirs) == 0) str += " 这里没有任何明显的出路。\n"; else if (sizeof(dirs) == 1) str += " 这里唯一的出口是 " + BOLD + dirs[0] + NOR + "。\n"; else str += sprintf(" 这里明显的出口是 " + BOLD + "%s" + NOR + " 和 " + BOLD + "%s" + NOR + "。\n", implode(dirs[0..sizeof(dirs)-2], "、"), dirs[sizeof(dirs)-1]); }
// 对tomud和非tomud客户端显示做区分判断 if (! me->query_temp("tomud")) str += look_all_inventory_of_room(me, env, RETURN_RESULT); else { // tomud房间物品和人物显示处理 info(me, env); str +=CLEAN0+ look_all_inventory_of_room(me, env, RETURN_RESULT); } tell_object(me, str); return 1; }
string look_all_inventory_of_room(object me, object env, int ret_str) { object *inv; object *obs; object ob; string str;
if (! env || ! me) return "";
str = "";
inv = all_inventory(env); if (! sizeof(inv)) return str; // 添加tomud客户端房间人物和物品显示 if (me->query_temp("tomud")) { foreach(ob in inv) if (ob != me && me->visible(ob)) str += ADD0(ob); } if (! me->query("env/brief") || (intp(me->query("env/brief")) && me->query("env/brief") > 1)) { obs = filter_array(inv, (: $(me) != $1 && userp($1) && $(me)->visible($1) :)); str += desc_of_objects(obs); obs = filter_array(inv, (: $(me) != $1 && ! userp($1) && $1->is_character() && $(me)->visible($1) :)); str += desc_of_objects(obs); obs = filter_array(inv, (: ! $1->is_character() :), me); str += desc_of_objects(obs); } if (! ret_str) tell_object(me, str);
return str; }
|
|