コード例 #1
0
ファイル: purge.c プロジェクト: mudchina/es2-utf8
int main(object me, string arg)
{
	string name, reason;
	string status;
	int day;

	status = wizhood(me);
	if( me!=this_player(1)
	|| wiz_level(me) < wiz_level(status) )
		return notify_fail("你没有权力使用这个指令。\n");

	if( !arg ) return notify_fail(SYNTAX);

	if( sscanf(arg, "%d", day) && day >= 0) return do_purge_players(day);

	if( sscanf(arg, "%s because %s", name, reason)!=2 )
		return notify_fail(SYNTAX);

	seteuid(getuid());
	if( file_size(DATA_DIR + "login/" + name[0..0] + "/" + name + SAVE_EXTENSION)<0 )
		return notify_fail("没有这位使用者。\n");

	rm(DATA_DIR + "login/" + name[0..0] + "/" + name + SAVE_EXTENSION);
	rm(DATA_DIR + "user/" + name[0..0] + "/" + name + SAVE_EXTENSION);
	write( "使用者 " + capitalize(name) + " 删除掉了。\n");
	log_file("static/PURGE", sprintf("[%s] %s purged %s because %s.\n",
		ctime(time())[0..15], geteuid(this_player(1)), name, reason));

	return 1;
}
コード例 #2
0
ファイル: recover.c プロジェクト: mudchina/nitan3
int main(object me, string arg)
{
	object ob;
	mapping my;
 
        if (! SECURITY_D->valid_grant(me, "(immortal)"))
                return 0;

	seteuid(getuid(me));
 
	if (! arg)
		ob = me;
	else
        {
		ob = present(arg, environment(me));
		if (! ob) ob = find_player(arg);
		if (! ob) ob = find_living(arg);
        }

        if (! ob) return notify_fail("你要恢复谁的状态?\n");
 
        if (ob != me)
        {
	        if (wiz_level(me) < wiz_level("(wizard)"))
		        return notify_fail("你没有权限恢复" + ob->name() + "。\n");

                if (! me->is_admin())
                        message_system(sprintf("%s(%s)为%s(%s)恢复了状态。\n",
                                               me->name(1), me->query("id"),
                                               ob->name(1), ob->query("id")));
        }

	my = ob->query_entire_dbase();
        my["jing"]   = my["eff_jing"]   = my["max_jing"];
        my["jingli"] = my["eff_jingli"] = my["max_jingli"];
        my["qi"]     = my["eff_qi"]     = my["max_qi"];
        my["neili"]  = my["max_neili"];
        my["food"]   = ob->max_food_capacity();
        my["water"]  = ob->max_water_capacity();

        if (me == ob)
	{
                message_vision(HIY "$N" HIY "口中念念有词,不一会儿就变得"
			       "精神焕发,神采奕奕。\n" NOR, me);
		if (me->is_ghost()) me->reincarnate();
		me->clear_condition();
        } else
        {
                message_vision(HIY "$N" HIY "伸手一指,$n" HIY "立刻精神焕"
			       "发,神采奕奕。\n" NOR,
                               me, ob);
                if (! living(ob)) ob->revive();
		if (ob->is_ghost()) ob->reincarnate();
		ob->clear_condition();
		log_file("static/recover", sprintf("%s %s recover %s(%s)\n",
					   log_time(), log_id(me),
				           ob->name(1), ob->query("id")));
        }
	return 1;
}
コード例 #3
0
ファイル: ppm.c プロジェクト: mudchina/fy3
int main(object me, string arg)
{
	object ob;
	string old_status, new_status;
	int my_level, ob_level, level;

	if( me!=this_player(1) ) return 0;

	if( !arg || sscanf(arg, "%s %s", arg, new_status)!=2 )
		return notify_fail("指令格式:promote <使用者> <等级>\n");

	if ( wiz_level(new_status) < 0 )  return notify_fail("没有这种等级。\n");

	if( !objectp(ob = present(arg, environment(me))) 
	||	!userp(ob) )
		return notify_fail("你只能改变使用者的权限。\n");

        if( wiz_level(me) > wiz_level(new_status) )
		return notify_fail("你没有这种权力。\n");

	old_status = wizhood(ob);

	seteuid(getuid());
	if( !(SECURITY_D->set_status(ob, new_status)) )
		return notify_fail("修改失败。\n");

	message_vision("$N将$n的权限从 " + old_status + " 改为 " + new_status + " 。\n", me, ob);
	seteuid(getuid());
	ob->setup();

	return 1;
}
コード例 #4
0
ファイル: checkleak.c プロジェクト: huangleon/fy2005
int main(object me, string arg)
{
	int i;
	string direc,*dir, roomname;
	string status;
	object room;
        if(!me->query("env/yesiknow")) return notify_fail("╒т╕Ў╓╕┴ю╥╤╛н▒╗╖╧│¤┴╦гб\n");
	status = wizhood(me);
	if( me!=this_player(1)
	|| wiz_level(me) < wiz_level(status) )
		return notify_fail("─у├╗╙╨╚и┴ж╩╣╙├╒т╕Ў╓╕┴юбг\n");
	if( !arg ) return notify_fail(SYNTAX);
	if( sscanf(arg, "%s", direc)!=1 )
		return notify_fail(SYNTAX);
	seteuid(getuid());
	dir = get_dir(arg+"/");
        for(i=0; i<sizeof(dir); i++) {
	if( sscanf(dir[i],"%s.c", roomname) != 1) continue;
	if( room = find_object(arg+"/"+roomname+".c"))
			destruct(room);	
	room = load_object(arg+"/"+roomname+".c");
	if(!room->query("coor"))
	log_file("LEAK",sprintf("%s/%s\n",arg,roomname));
	}
	return 1;
}
コード例 #5
0
ファイル: char.c プロジェクト: mudchina/nitan3
int visible(object ob)
{
        int lvl;

        if (! ob->is_character())
                return 1;

        if (! wizardp(ob))
        {
                if (wizardp(this_object()) || 
                    query("env/invisible") || 
                    is_ghost())
                        return 1;

                if (ob->query("env/invisible") || 
                    ob->is_ghost())
                        return 0;
        }

        lvl = wiz_level(this_object());
        if (lvl && 
            lvl >= wiz_level(ob)) 
                return 1;
        if (ob->query("env/invisible") == "YES") 
                return 0;
        if (lvl && 
            lvl >= (int)ob->query("env/invisible")) 
                return 1;

        if (wizardp(ob) && 
            ob->query("env/invisible")) 
                return 0;

        return 1;
}
コード例 #6
0
ファイル: transferlog.c プロジェクト: gongfuPanada/mhxy2002
int main(object me, string arg)
{
        object user;
	string srcstr, dststr;
	string status;

	status = wizhood(me);
	if( me!=this_player(1) || wiz_level(me) < wiz_level(status) )
		return notify_fail("你没有权力使用这个指令。\n");
	
	if (!arg) return 0;
        if (sscanf(arg, "%s %s", srcstr, dststr)!=2) return 0;

	// login data

        seteuid(getuid());
	user = new(LOGIN_OB);
	if( (string)user->set("id", srcstr) != srcstr ) 
		return notify_fail("Failed setting user name.\n");
	if (! user->restore())	return notify_fail("没有这个玩家。\n");
	export_uid(user);

	if( (string)user->set("id", dststr) != dststr ) 
		return notify_fail("Failed setting user name.\n");
        if (!user->save()) return notify_fail("存档失败!\n");
	destruct(user);

        tell_object(me, 
		"玩家 "+srcstr+" 数据成功转换至玩家 "+dststr+" !\n");
	return 1;
}	
コード例 #7
0
ファイル: snoop.c プロジェクト: huangleon/fy2005
int main(object me, string arg)
{
	object ob, ob1;

	if( !arg ) {
		if( objectp(ob = query_snooping(me)) )
			write("─у╧╓╘┌╒¤╘┌╝р╠¤" + ob->query("name") + "╦∙╩╒╡╜╡─╤╢╧вбг\n");
		else
			write("─у╧╓╘┌▓╗╘┌╝р╠¤╚╬║╬╨┼╧вбг\n");	
		return 1;
	} else if( arg=="none" ) {
		if( objectp(ob = query_snooping(me))
		&&	wiz_level(ob) >= wiz_level(me) )
			tell_object(ob, HIW + me->name(1) + "═г╓╣╝р╠¤─у╦∙╩╒╡╜╡─╤╢╧вбг\n" NOR);
		snoop(me);
		if (objectp(ob))
			write("─у╧╓╘┌═г╓╣╝р╠¤" + ob->query("name") + "╦∙╩╒╡╜╡─╤╢╧вбг\n");
		else
			write("─у╧╓╘┌▓╗╘┌╝р╠¤╚╬║╬╨┼╧вбг\n");
		return 1;
	}

	ob = find_player(arg);
	if(!ob) ob = find_living(arg);
	if(!ob || !me->visible(ob)) return notify_fail("├╗╙╨╒т╕Ў╚╦бг\n");

	if( wizhood(me) != "(admin)"
	&&	wiz_level(me) <= wiz_level(ob) )
		return notify_fail("─у├╗╙╨╝р╠¤" + ob->name() + "╦∙╩╒╠¤╤╢╧в╡─╚и└√бг\n");

	if( me==ob ) return notify_fail("╟ы╙├ snoop none ╜т│¤╝р╠¤бг\n");
	
	if (objectp(ob1=query_snoop(ob)))
		return notify_fail(ob1->name()+"╒¤╘┌╝р╠¤"+ob->name()+"╡─╨┼╧вбг\n");
	
	if (ob->query_temp("netdead",1))
		return notify_fail("┤╦╚╦╒¤┤ж╘┌╢╧╧▀╫┤╠мбг\n");
	
	if (!userp(ob))
		return notify_fail("├╗╖и╟╘╠¤NPC╨┼╧в╡─бг\n");
				
	snoop(me, ob);
	write("─у╧╓╘┌┐к╩╝╟╘╠¤" + ob->name(1) + "╦∙╩╒╡╜╡─╤╢╧вбг\n");
	if( userp(ob) ) log_file("SNOOP_PLAYER",
		sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1),
			ctime(time()) ) );
	if( wizardp(ob) && wizhood(me) != "(admin)")
		tell_object(ob, HIW + me->name(1) + "┐к╩╝╝р╠¤─у╦∙╩╒╡╜╡─╤╢╧вбг\n" + NOR);

	return 1;
}
コード例 #8
0
ファイル: call.c プロジェクト: mudchina/sjsh
int main(object me, string arg)
{
	string objname, func, param, euid;
	object obj;
	mixed *args, result;
	int i;

	if( arg ) {
		if( sscanf(arg, "-%s %s", euid, arg)==2 ) {
			if( (string)SECURITY_D->get_status(me) != "(admin)" )
				return notify_fail("你不能设定自己的 euid。\n");
			seteuid(euid);
		}
		else
			seteuid( geteuid(this_player(1)) );

		if( sscanf(arg, "%s->%s(%s)", objname, func, param)!=3 )
			return notify_fail("指令格式:call <物件>-><函数>( <参数>, ... )\n");
	} else
		return notify_fail("指令格式:call <物件>-><函数>( <参数>, ... )\n");

	obj = present(objname, environment(me));
	if(!obj) obj = present(objname, me);
	if(!obj) obj = find_player(objname);
	if(!obj || !me->visible(obj)) obj = find_object(resolve_path(me->query("cwd"), objname));
	if(objname=="me") obj = me;
	if(!obj) return notify_fail("找不到指定的物件。\n");

	if(wizardp(obj) && wiz_level(me) < wiz_level(obj))
	   return notify_fail("你不能设定等级比你高的巫师状态。\n");
	   
	if( userp(obj) ){
		if( obj != me ) log_file("static/CALL_PLAYER",
			sprintf("%s(%s) call %s(%s)->%s(%s) on %s\n",
				me->name(1), geteuid(me), obj->name(1), geteuid(obj), func, param,
				ctime(time()) ) );
	} else if( !master()->valid_write( base_name(obj), me, "set" ) )
		return notify_fail("你没有直接呼叫这个物件的函数的权力。\n");

	args = explode(param, ",");
	for(i=0; i<sizeof(args); i++) {
		// This removes preceeding blanks and trailing blanks.
		parse_command(args[i], environment(me), "%s", args[i]);
		if( sscanf(args[i], "%d", args[i]) ) continue;
		if( sscanf(args[i], "\"%s\"", args[i]) ) continue;
		//args[i] = restore_variable(args[i]);
	}

	args = ({ func }) + args;
コード例 #9
0
ファイル: snoop.c プロジェクト: gongfuPanada/mhxy2002
int main(object me, string arg)
{
	object ob;

	if( !arg ) {
		if( objectp(ob = query_snooping(me)) )
			write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n");
		return 1;
	}
	 else if( arg=="-none" ) {
if( objectp(ob = query_snooping(me)) && wizardp(ob) )
			tell_object(ob, HIW + me->name(1) + 
				"停止监听你所收到的讯息。\n" NOR);
		snoop(me);
		write("Ok.\n");
		return 1;
	}
else if(query_snooping(me)) snoop(me);

	ob = find_player(arg);
	if(!ob) ob = find_living(arg);
	
	if(!ob) ob = LOGIN_D->find_body(arg);
	/* added by mon. 2/23/97 */

	if(!ob || !me->visible(ob)) return notify_fail("没有这个人。\n");

	if( wizhood(me) != "(admin)"
	&&	wiz_level(me) <= wiz_level(ob) )
		return notify_fail("你没有监听" + ob->name() + "所收听讯息的权利。\n");

	if( me==ob ) return notify_fail("请用 snoop -none 解除监听。\n");
		
	snoop(me, ob);

	me->set_temp("snoop_encoding",
		(int)me->query_encoding()*10+ob->query_encoding());
	// added by mon 6/1/98

	write("你现在开始窃听" + ob->name(1) + "所收到的讯息。\n");
	if( userp(ob) ) log_file("SNOOP_PLAYER",
		sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1),
			ctime(time()) ) );
// if( wizardp(ob) && wizhood(me) != "(admin)")
if( wizardp(ob)) 
		tell_object(ob, HIW + me->name(1) + "开始监听你所收到的讯息。\n" + NOR);

	return 1;
}
コード例 #10
0
ファイル: full.c プロジェクト: huangleon/fy2005
int main(object me, string str)
{
        int i;
        object obj;

        if( !str || str == "")
                obj = me;
        else if ( !obj = present(str,environment(me)))
            return notify_fail("╢╘╧є┤э╬є: ╒╥▓╗╡╜"+str+"\n");

        if (!wizardp(me) && me->is_fighting())
        	return notify_fail(HIG"╟х╖ч╢╘─у╥б┴╦╥б╨б╓╕г║╨б┼є╙╤гм╒т╤∙╩╟▓╗╢╘╡─р▐гб\n"NOR);
    
    	if (wiz_level(me)<4 && obj!=me )
			return notify_fail("─у╓╗─▄╗╓╕┤╫╘╝║╡─╞°╤кбг\n");    		
    
        for( i = 0; i < sizeof(gifts); i++ )
        {
                obj->set(gifts[i],obj->query("max_"+gifts[i]));
                obj->set("eff_"+gifts[i],obj->query("max_"+gifts[i]));
        }
        for( i = 0; i < sizeof(gifts1); i++ )
        {
             obj->set(gifts1[i],obj->query("max_"+gifts1[i])*2);
        }
        obj->set("food",obj->max_food_capacity());
        obj->set("water",obj->max_water_capacity());
        obj->status_msg("all");
        obj->force_status_msg("all");
        obj->clear_condition();
        write("╗╓╕┤│╔╣жбг\n");
        return 1;
}
コード例 #11
0
ファイル: gtell.c プロジェクト: mudchina/nitan3
int send_gtell(string mud, string wiz_to, object source, string msg)
{
	mapping minfo;

	if (! ACCESS_CHECK(previous_object()) &&
	    is_root(previous_object())) return 0;

	mud = htonn(mud);
	if (mud == mud_nname() || ! source) return 0;

	minfo = (mapping)DNS_MASTER->query_mud_info(mud);
	if (! minfo)
        {
                write(LOCAL_MUD_NAME() + "并没有和 " + mud + " 联系上。\n");
                return 0;
        }


	msg = replace_string(msg, "|", "");
	msg = replace_string(msg, "@@@", "");
	DNS_MASTER->send_udp(minfo["HOSTADDRESS"], minfo["PORTUDP"],
		"@@@" + DNS_GTELL +
		"||NAME:" + Mud_name() +
		"||PORTUDP:" + udp_port() +
		"||WIZTO:" + wiz_to +
		"||WIZFROM:" + capitalize(source->query("id")) +
		"||CNAME:" + source->name(1) +
                "||WIZ_LEVEL:" + wiz_level(source) +
		"||MSG:" + msg + "@@@\n");
        return 1;
}
コード例 #12
0
ファイル: cutuser.c プロジェクト: heypnus/xkx2001
int main(object me, string arg)
{
    string id, skill_name=0, err, *arg_list;
    int    i, amount, type, tmp, cloned;
    object user;

    if ( me!=this_player(1)
	 || wiz_level(me) < wiz_level(wizhood(me)) )
	    return notify_fail("你没有权力使用这个指令。\n");

    if (!arg ) return notify_fail(SYNTAX);

    type = 1;	// default is cut exp
    arg_list = explode(arg, " ");
    for (i=0; i<sizeof(arg_list); i++) {
	if (arg_list[i] == "-e") type = 1;
	else  if (arg_list[i] == "-s") {
	    type = 0;
	    if (i == sizeof(arg_list)-1) return notify_fail(SYNTAX);
	    skill_name = arg_list[++i];
	}else  if (arg_list[i] == "-") break;
  	else if (arg_list[i][0] != '-') break;
    }

    if (i >= sizeof(arg_list)) 
	return notify_fail("Please at least say who you want to cut.\n");
    id = arg_list[i];

    i++;
    amount = 30;	// cut 30% by default
    if (i < sizeof(arg_list)){
	if (sscanf(arg_list[i], "%d", amount)!=1)
	    return notify_fail("Cut percentage must be a number.\n");
    }
    if (amount < 0 || amount > 100)
	return notify_fail("cut percentage must be 0-100.\n");

    seteuid(getuid());

    cloned = 0;
    user = LOGIN_D->find_body(id);
    // cut even if the player is not online
    if (! objectp(user)) {
	user = new ("/clone/obj/dummy");
	cloned = 1;
    }
コード例 #13
0
ファイル: char.c プロジェクト: oliverypf/es2-utf8
int visible(object ob)
{
	int lvl, invis;

	lvl = wiz_level(this_object());

	if( lvl > wiz_level(ob) ) return 1;
	invis = ob->query("env/invisibility");
	if( intp(invis) && (invis > lvl) ) return 0;

	if( ob->is_ghost() ) {
		if( is_ghost() ) return 1;
		if( query_temp("apply/astral_vision") ) return 1;
		return 0;
	}
	return 1;
}
コード例 #14
0
ファイル: who.c プロジェクト: gongfuPanada/mhxy2002
int sort_user(object ob1, object ob2)
{
        string name1, name2;;
        reset_eval_cost();
        if( wiz_level(ob1) != wiz_level(ob2) )
                return wiz_level(ob2)
                        - wiz_level(ob1);

        name1 = ob1->query("family/family_name");
        name2 = ob2->query("family/family_name");

        if (intp(name1)) name1 = "";
        if (intp(name2)) name2 = "";
        if (name1 > name2) return -1;
        if (name1 < name2) return 1;

        return (int)ob2->query("combat_exp") - (int)ob1->query("combat_exp");
}
コード例 #15
0
ファイル: wizlock.c プロジェクト: gongfuPanada/xyj45
int main(object me, string arg)
{
   int lvl;

   if( me!=this_player(1) ) return 0;
   if( wiz_level(me) < wiz_level("(arch)") )
     return notify_fail("你的巫师等级太低,没有使用这个指令的权力。\n");
   if( !arg || arg=="" )
     return notify_fail("指令格式:wizlock <巫师等级>\n");

   if( sscanf(arg, "%d", lvl)!=1 ) lvl = wiz_level(arg);
   seteuid(getuid());
   if( LOGIN_D->set_wizlock(lvl) ) {
     write("Ok.\n");
     return 1;
   } else
     return notify_fail("上线权限设定失败。\n");
}
コード例 #16
0
ファイル: system.c プロジェクト: szhowardhuang/fs2
void shutdown(int code)
{
  object me = previous_object(1);
  object mob = previous_object(0);

  if( wiz_level(me) >= 5
  ||  strcmp(file_name(mob), "/obj/npc/demogorgon") != -1 )
    efun::shutdown(code);
}
コード例 #17
0
ファイル: fingerd.c プロジェクト: szhowardhuang/fs2
varargs string remote_finger_user(string name)
{
        object ob, body,me;
        string msg;
        me = this_player();
        ob = new(LOGIN_OB);
        ob->set("id", name);
        if( !ob->restore() )
                return "没有这个玩家。\n";
        body = LOGIN_D->make_body(ob);
        if (body->restore()) ob = body;
        msg =  sprintf(
                "\n英文代号:\t%s\n姓    名:\t%s\n权限等级:\t%s\n"
                "上次连线地址:\t%s( %s )\n",
                ob->query("id"),
                ob->query("name"),
                SECURITY_D->get_status(name),
                ob->query("last_from"),
                ctime(ob->query("last_on"))
        );
        msg += sprintf ("年龄是: %d\n",
                ob->query("age"));

        if( stringp(ob->query("clan/name")) )
        msg += sprintf("所属帮派: %s\n",
                ob->query("clan/name"));

        if( wiz_level(me) < wiz_level(ob) )
            return msg;

        if (ob->query_temp("terminal_type"))
           msg += sprintf ("terminal type is : %s\n",
                ob->query_temp("terminal_type"));


        if( find_player(name) )
                msg +=  "\n" + ob->query("name") + "目前正在线上。\n";

        if( stringp(ob->query("plan")) )
                msg += sprintf("%s 最近的计划是--\n%s", name, ob->query("plan"));
        destruct(ob);
        return msg;
}
コード例 #18
0
ファイル: force.c プロジェクト: szhowardhuang/fs2
int main(object me, string arg)
{
        string dest, cmd;
        object ob;

        if( me != this_player(1) ) return 0;

        if( !arg || sscanf(arg, "%s to %s", dest, cmd) != 2 )
                return notify_fail("指令格式:force <某人> to <指令>\n");
        if( !(ob = present(dest, environment(me))) )
                return notify_fail("这里没有 " + dest + "。\n");
        if( !living(ob) )
                return notify_fail("这个物件不能执行命令。\n");
         if(wiz_level(me) <= wiz_level(ob) && wiz_level(me)<7)
                return notify_fail("你没有强制" + ob->name() + "执行指令的权力。\n");
        if( userp(ob) )
                log_file("FORCE_PLAYER", sprintf("[%s] %s forces %s to %s\n",  
                        ctime(time()), geteuid(me), geteuid(ob), cmd));
        message_vision("$N强制$n去做"+cmd+"这个指令。\n",me,ob);
        return ob->force_me(cmd);
}
コード例 #19
0
ファイル: snoop.c プロジェクト: mudchina/es2-utf8
int main(object me, string arg)
{
    object ob;

    if( !arg ) {
        if( objectp(ob = query_snooping(me)) )
            write("你现在正在监听" + ob->query("name") + "所收到的讯息。\n");
        return 1;
    } else if( arg=="none" ) {
        if( objectp(ob = query_snooping(me))
                &&	wiz_level(ob) >= wiz_level(me) )
            tell_object(ob, HIW + me->name(1) + "停止监听你所收到的讯息。\n" NOR);
        snoop(me);
        write("Ok.\n");
        return 1;
    }

    ob = find_player(arg);
    if(!ob) ob = find_living(arg);
    if(!ob || !me->visible(ob)) return notify_fail("没有这个人。\n");

    if( wizhood(me) != "(admin)"
            &&	wiz_level(me) <= wiz_level(ob) )
        return notify_fail("你没有监听" + ob->name() + "所收听讯息的权利。\n");

    if( me==ob ) return notify_fail("请用 snoop none 解除监听。\n");

    snoop(me, ob);
    write("你现在开始窃听" + ob->name(1) + "所收到的讯息。\n");
    if( userp(ob) ) log_file("SNOOP_PLAYER",
                                 sprintf("%s(%s) snoops %s on %s.\n", me->name(1), geteuid(me), ob->name(1),
                                         ctime(time()) ) );
    if( wizardp(ob) && wizhood(me) != "(admin)")
        tell_object(ob, HIW + me->name(1) + "开始监听你所收到的讯息。\n" + NOR);

    return 1;
}
コード例 #20
0
ファイル: fingerd.c プロジェクト: szhowardhuang/fs2
string finger_all()
{
        object *ob;
        string msg;
        int i;

        ob = users();
        msg = "";
        for(i=0; i<sizeof(ob); i++)
                // if(wiz_level(this_player())>3||(!wizardp(this_player())&&!wizardp(ob[i]))||(wiz_level(this_player())<4&&wizardp(this_player())&&wizardp(ob[i])))
                if(wiz_level(this_player())||(!wizardp(this_player())&&!wizardp(ob[i])))
if(wizardp(this_player()))
                msg = sprintf("%s%-20s  %-20s  %-10s %s\n",
                        msg, ob[i]->query("name"), ob[i]->query("id"),
                        age_string( (int)ob[i]->query("mud_age")), query_ip_name(ob[i]) );
      else msg = sprintf("%s%-20s  %-20s  %-10s\n",msg, ob[i]->query("name"), ob[i]->query("id"),age_string( (int)ob[i]->query("mud_age")));
        return msg;
}
コード例 #21
0
ファイル: wizlist.c プロジェクト: aricxu/xkx100
int level(mixed ob1, mixed ob2)
{
	if (wiz_level(ob1) != wiz_level(ob2))
		return wiz_level(ob2) - wiz_level(ob1);
	return ob1 > ob2?-1:1;
}
コード例 #22
0
int main(object me, string arg)
{
	string *list;
	int my_level, i, j;
	int ch;
	object ob;

	list = sort_array(SECURITY_D->query_wizlist(), 1);
   write(MUD_NAME + "目前的天神地鬼一共有 "+ (sizeof(list)-1) + " 位:(前面有 * 者表正在线上)\n");
	my_level=wiz_level(me);
        printf("----------------------------    "+HIW+" 天帝        地皇"+NOR+"   ----------------------------\n  ");
	for(i=0, j=0; i<sizeof(list); i++)
	if(SECURITY_D->get_status(list[i])=="(manager)")
	{
		ch = ' ';
		if(ob=find_player(list[i]))
			if(wizardp(me))
			if(!ob->query("env/隐身") || wiz_level(ob) <= my_level)
				ch = '*';
		printf("%c%-10s%s", ch, list[i], ((j++)%7==6) ? "\n  " : "");
	}
        printf("\n----------------------------  "+HIM+"混世魔王    罗煞女王  "+NOR+"----------------------------\n  ");
	for(i=0, j=0; i<sizeof(list); i++)
	if(SECURITY_D->get_status(list[i])=="(guest)")
	{
		ch = ' ';
		if(ob=find_player(list[i]))
			if(wizardp(me))
			if(!ob->query("env/隐身") || wiz_level(ob) <= my_level)
				ch = '*';
		printf("%c%-10s%s", ch, list[i], ((j++)%7==6) ? "\n  " : "");
	}
printf("\n----------------------------    "+HIC+"玉帝       修罗王"+NOR+"   ----------------------------\n  ");
	for(i=0, j=0; i<sizeof(list); i++)
	if(SECURITY_D->get_status(list[i])=="(admin)")
	{
		ch = ' ';
		if(ob=find_player(list[i]))
			if(wizardp(me))
			if(!ob->query("env/隐身") || wiz_level(ob) <= my_level)
				ch = '*';
		printf("%c%-10s%s", ch, list[i], ((j++)%7==6) ? "\n  " : "");
	}
        printf("\n----------------------------    "+HIY+"菩萨       夜叉王   "+NOR+"----------------------------\n  ");
	for(i=0, j=0; i<sizeof(list); i++)
	if(SECURITY_D->get_status(list[i])=="(arch)")
	{
		ch = ' ';
		if(ob=find_player(list[i]))
			if(wizardp(me))
			if(!ob->query("env/隐身") || wiz_level(ob) <= my_level)
				ch = '*';
		printf("%c%-10s%s", ch, list[i], ((j++)%7==6) ? "\n  " : "");
	}
        printf("\n----------------------------    "+HIG+"天仙        判官"+NOR+"    ----------------------------\n  ");
	for(i=0, j=0; i<sizeof(list); i++)
	if(SECURITY_D->get_status(list[i])=="(wizard)")
	{
		ch = ' ';
		if(ob=find_player(list[i]))
			if(wizardp(me))
			if(!ob->query("env/隐身") || wiz_level(ob) <= my_level)
				ch = '*';
		printf("%c%-10s%s", ch, list[i], ((j++)%7==6) ? "\n  " : "");
	}
        printf("\n----------------------------    "+HIR+"护法        无常"+NOR+"    ----------------------------\n  ");
	for(i=0, j=0; i<sizeof(list); i++)
	if(SECURITY_D->get_status(list[i])=="(apprentice)")
	{
		ch = ' ';
		if(ob=find_player(list[i]))
			if(wizardp(me))
			if(!ob->query("env/隐身") || wiz_level(ob) <= my_level)
				ch = '*';
		printf("%c%-10s%s", ch, list[i], ((j++)%7==6) ? "\n  " : "");
	}
        printf("\n----------------------------  "+HIB+"天兵天将    牛头马面"+NOR+"  ----------------------------\n  ");
	for(i=0, j=0; i<sizeof(list); i++)
	if(SECURITY_D->get_status(list[i])=="(immortal)")
		printf("%c%-10s%s", (find_player(list[i])) ? ch:' ', list[i], ((j++)%7==6) ? "\n  " : "");
	write("\n");
	return 1;
}
コード例 #23
0
ファイル: fingerd.c プロジェクト: szhowardhuang/fs2
string finger_user(string name)
{
        object me, ob, body;
        object where;
        string msg, mud;

        me = this_player();
        if (!name) ob = me;
        else if( sscanf(name, "%s@%s", name, mud)==2 ) {
                GFINGER_Q->send_finger_q(mud, name, this_player(1));
                return "网路指令传送过程可能需要一些时间,请稍候。\n";
        }
        // ob = new(LOGIN_OB);
        // ob->set("id", name);
        else ob = find_player(name);
//      if( wiz_level(me) < wiz_level(ob) )
//              return "\n";
        if (!ob && wizardp(me) )
                return remote_finger_user(name);
        ob = acquire_login_ob(name);

        if( !ob )
         return "没有这个玩家。\n";
//      if (!user(ob)) return "没有这个玩家: "+name+"\n。";
        msg =  sprintf("\n英文代号:\t%s\n姓    名:\t%s\n权限等级:\t%s\n"
          "上次连线时间:\t%s\n上线时间总和:\t%s\n\n",
                ob->query("id"),
                ob->query("name"),
                SECURITY_D->get_status(name),
                ctime(ob->query("last_on")),
                age_string (ob->query("mud_age")),
        );
if(wizardp(this_player()))
msg += sprintf("上次连线位置:%s\n",ob->query("last_from"));
        msg += sprintf ("年龄是: %d 岁\n",
                ob->query("age"));

         if(SECURITY_D->get_status(name)==("player") && stringp(ob->query("clan/name")) )
        msg += sprintf("所属帮派: %s\n",
                ob->query("clan/name"));

       if(ob->query("new_mail"))
        msg += sprintf("他有新的情书未读\n");
        if( wiz_level(me) < wiz_level(ob) )
            return msg;
        where = environment(ob);
        if (where && wizardp(me))
        msg += sprintf("%s (%s) 现在在--%s (%s).\n",
                (string)ob->name(),
                (string)ob->query("id"),
        where ? where->query("short") : "未知",
                (string)file_name(where));
        else
        msg += sprintf("%s现在在--%s.\n",
                (string)ob->name(),
                where ? where->query("short") : "未知");

         if( objectp(body = find_player(name)) && geteuid(body)==name ) {
               if(wizardp(this_player()))
                msg += sprintf("%s 目前正在从 %s 连线中。\n", body->name(1),
                        query_ip_name(body));
 else msg += sprintf("目前正在连线中。\n");
        }
        if( stringp(ob->query("plan")) )
        msg += sprintf("%s 最近的计划是--\n%s", name, ob->query("plan"));
        
        // destruct(ob);
        return msg;
}
コード例 #24
0
ファイル: give.c プロジェクト: mudchina/fy3
int main(object me, string arg)
{
	string target, item;
	object obj, who, *inv, obj2;
	int i, amount;
	mixed no_give;

      if(this_player()->is_busy())
      return notify_fail("你正忙着呢...\n");
      
	if(!arg) return notify_fail("你要给谁什麽东西?\n");

	if( sscanf(arg, "%s to %s", item, target)==2
	|| sscanf(arg, "%s %s", target, item)==2 );
	else return notify_fail("你要给谁什麽东西?\n");
	
       who = LOGIN_D->find_body(target);
       if(wizardp(me) && who && !wizardp(who))
              return notify_fail("你不能给玩家任何东西。\n");

	if(!objectp(who = present(target, environment(me))) || !living(who))
		return notify_fail("这里没有这个人。\n");
	
	if( me == who )  {
                  write("Ok.\n");
                  return 1;
         }
       if(who->query_temp("block_msg/all"))
                 return notify_fail(who->name()+"现在不能接受你给的东西。\n");
   
	if( who->query("env/no_accept")&& wiz_level(me)<=wiz_level(who))
		return notify_fail("看样子,"+who->query("name")+"并不想接受你的东西。\n");

       
	if(sscanf(item, "%d %s", amount, item)==2) {
		if( !objectp(obj = present(item, me)) )	
			return notify_fail("你身上没有这样东西。\n");
		if( obj->query("no_drop") )
			return notify_fail("这样东西不能随便给人。\n");
		if( !obj->query_amount() )	
			return notify_fail( obj->name() + "不能被分开给人。\n");
		if( amount < 1 )
			return notify_fail("东西的数量至少是一个。\n");
		if( amount > obj->query_amount() ) 
			return notify_fail("你没有那麽多的" + obj->name() + "。\n");
		else if( amount == (int)obj->query_amount() )
			return do_give(me, obj, who);
		else {
			obj->set_amount( (int)obj->query_amount() - amount );
			obj2 = new(base_name(obj));
			obj2->set_amount(amount);
			return do_give(me, obj2, who);
		}
	}

	if(arg=="all") {
		inv = all_inventory(me);
		for(i=0; i<sizeof(inv); i++) {
			do_give(me, inv[i], who);
		}
		write("Ok.\n");
		return 1;
	}

	if(!objectp(obj = present(item, me)))
		return notify_fail("你身上没有这样东西。\n");
		
	if( no_give=obj->query("no_give") )
return notify_fail( stringp(no_give) ? no_give : "这样东西不能随意丢弃。\n");
return do_give(me,obj,who);
}
コード例 #25
0
ファイル: get.c プロジェクト: aricxu/xkx100
int main(object me, string arg)
{
	string from, item;
	object obj, *inv, env, obj2;
	int i, amount , res;
  string msg;

	all=0;
	if (!arg) return notify_fail("你要捡起什么东西?\n");
	if (me->is_busy())
		return notify_fail("你上一个动作还没有完成!\n");
	if (sscanf(arg, "%s from %s", arg, from) == 2)
	{
	//	env = present(from, me);
	    env = i_have(me,from);
//		if (!env) env = present(from, environment(me));
		if (!env) env = i_have(environment(me),from);
		if (!env)
			return notify_fail("你找不到 "+from+" 这样东西。\n");
		if ((env->query("no_get_from") ||
			living(env) && !env->query_temp("noliving/unconcious")) 
			&& (wiz_level(me) <= wiz_level(env)))
			return notify_fail("你的巫师等级必须比对方高,才能搜身。\n");
	} else env = environment(me);

	if (sscanf(arg, "%d %s", amount, item) == 2)
	{
	//	if (!objectp(obj = present(item, env)))
		if( !objectp(obj = i_have( env,item )) ) // env have item	
			return notify_fail("这里没有这样东西。\n");
		if (!obj->query_amount())
			return notify_fail(obj->name() + "不能被分开拿走。\n");
		if (amount < 1)
			return notify_fail("东西的个数至少是一个。\n");
		if (amount > obj->query_amount())
			return notify_fail("这里没那么多的"+obj->name()+"。\n");
		else
			if(amount == (int)obj->query_amount())
				return do_get(me, obj);
			else
			{
				obj2 = new(base_name(obj));
				obj2->set_amount((int)obj->query_amount()-amount);
				obj->set_amount( amount );
				res=do_get(me, obj);
				obj2->move(env);
//				if (me->is_fighting())
//					me->start_busy(3);
				return res;
			}
	}
	if (arg=="all")
	{
		if (me->is_fighting())
			return notify_fail("你还在战斗中!只能一次拿一样。\n");
		if (!env->query_max_encumbrance())
			return notify_fail("那不是容器。\n");
   	if (env->is_tree())
   		return notify_fail("这是给新手活命用的,还是不要太贪心了吧n");
		inv = all_inventory(env);
		if (!sizeof(inv))
		{
   		if (env->is_tree())
         		return notify_fail("树上什么也没有了。\n");
			return notify_fail("那里面没有任何东西。\n");
   	}        	
    if (sizeof(inv)>=20) all=1;
		for (i = 0; i < sizeof(inv); i ++)
		{
			if (inv[i]->is_character() 
			|| inv[i]->query("no_get")
			||inv[i]->query("taskobj")
			||inv[i]->query("owner"))
				continue;
			
			do_get(me, inv[i]);
		}
    if (env->is_character())
        msg = "$N从" + env->name() + "身上搜出了一堆东西。\n";
    else
     if (env == environment(me))
        msg = "$N把地上的东西都拣了起来。\n";
     else
        msg = "$N把" + env->name() + "里面的东西都拿了出来。\n";
 
		if (all!=1)
		write("捡好了。\n");
	  else
	   message_vision(msg,me);
		return 1;
	}
//	if (!objectp(obj = present(arg, env)))
	if( !objectp(obj = i_have( env,arg )) ) // me have item	
		return notify_fail("你附近没有这样东西。\n");
	else
		if( userp(obj))
		{
			if(!obj->query_temp("noliving/unconcious") )
				return notify_fail("你附近没有这样东西。\n");
		}
		else
		{
			if(living(obj))
				return notify_fail("你附近没有这样东西。\n");
		}

	if (obj->query("no_get"))
	  if (stringp(obj->query("no_get")))
      return notify_fail(obj->query("no_get"));
    else
  		return notify_fail("这个东西拿不起来。\n");
	return do_get(me, obj);
}
コード例 #26
0
ファイル: update.c プロジェクト: mudchina/sjsh
int main(object me, string file)
{
        int i;
        object obj, *inv;
        string err;

        seteuid( geteuid(me) );

        if (!file) file = me->query("cwf");
        if (!file)
                return notify_fail("你要重新编译什么档案?\n");

        if( (obj = present(file, environment(me))) && interactive(obj) ) {
            if(wizardp(obj) && wiz_level(me) < wiz_level(obj))
                return notify_fail("你不能更新等级比你高的巫师状态。\n");
                return update_player(obj);
    }
                  
        if( file == "me" )
                return update_player(me);
        else {
                file = resolve_path(me->query("cwd"), file);
                if( !sscanf(file, "%*s.c") ) file += ".c"; 
        }

        if( file_size(file)==-1 )
                return notify_fail("没有这个档案。\n");

        me->set("cwf", file);

        if (obj = find_object(file)) {
                if( obj==environment(me) ) {
                        if( file_name(obj)==VOID_OB )
                                return notify_fail("你不能在 VOID_OB 里重新编译 VOID_OB。\n");
                        inv = all_inventory(obj);
                        i = sizeof(inv);
                        while(i--)
                                if( userp(inv[i]) ) inv[i]->move(VOID_OB, 1);
                                else inv[i] = 0;
                }
                destruct(obj);
        }

        if (obj) return notify_fail("无法清除旧程式码。\n");

    write("重新编译 " + file + ":");
        err = catch( call_other(file, "???") );
        if (err)
                printf( "发生错误:\n%s\n", err );
        else {
                write("成功!\n");
                log_file("/static/update",
			sprintf("%s(%s) update %s on %s\n",
				me->name(1), geteuid(me), file,
				ctime(time()) ) );
                if( (i=sizeof(inv)) && (obj = find_object(file))) {
                        while(i--)
                                if( inv[i] && userp(inv[i]) ) inv[i]->move(obj, 1);
                }
        }
                
        return 1;
}
コード例 #27
0
ファイル: c_view2.c プロジェクト: szhowardhuang/fs2
void second( object *user , string str )
{
	int     i, count, state;
	string  list, CO, state_str, list2;
	user = sort_array(user, "sort_rank", this_object());
        i = sizeof(user);
        list = sprintf( HIG"《"HIY"%|10s"HIG"》"HIC" 线上帮众 "NOR"-\n", str );
	list+= "───────────────────────────────────────\n";
	count = 0;

        while( i-- )
        {
                switch(user[i]->query("clan/rank")) {
	case 1  :       CO = HIW + "Ψ";        break;
	case 2  :       CO = HIC + "ζ";        break;
        case 3  :       CO = HIY + "Φ";        break;
        case 4  :       CO = HIG + "卍";        break;
        case 5  :       CO = HIM + "Ξ";        break;
        case 6  :       CO = HIB + "∏";        break;
        case 7  :       CO = HIR + "Χ";        break;
		default :       CO = NOR + "?";        break;
		}

        if(this_player())
        if( wizardp(user[i]) && !wizardp(this_player()))
			continue;
		if( wiz_level(this_player())<6 && user[i]->query("env/隐身") && wiz_level(user[i]) && wiz_level(user[i]) > wiz_level(this_player()) )
		{
		 continue;
		}
		state = 0;
		state_str = "";
		count++;

                list = sprintf( "%s"HIC"【"NOR"%|10s"HIC"】"NOR"%s%|10s%s"NOR"",
			list,
                        area(user[i]),
                        CO,
                        (user[i]->query("clan/title") ? user[i]->query("clan/title") : "--无职衔--"), CO );
/*
		list2 = (user[i]->query("title") ? user[i]->query("title") : "" ) +
                        (user[i]->query("nickname") ? "「"+user[i]->query("nickname")+"”" : " " ) +
                        user[i]->query("name")+"("+user[i]->query("id")+")";
                if( strlen((list2))>80 )*/
                	list2 = (user[i]->query("nickname") ? "「"+user[i]->query("nickname")+"”" : " " ) +
                        	user[i]->query("name")+"("+user[i]->query("id")+")";
                list += list2;

		if( user[i]->query_temp("netdead") ) {
			state_str += HIR"(断线)"NOR;
			state = 1;
		}
		if( !environment(user[i]) ) {
			state_str += HIG"(异次元)"NOR;
			state = 1;
		}
		if( in_edit(user[i]) ) {
			state_str += HIY"(编辑)"NOR;
			state = 1;
		}
		if( in_input(user[i]) ) {
			state_str += HIC"(阅\读)"NOR;
			state = 1;
		}
		if( interactive(user[i]) && query_idle(user[i])>120 ) {
                	state_str += sprintf( "%s", HIM"(发呆 "+query_idle(user[i])/60+" 分钟)"NOR );
                	state = 1;
                }
                if( state ) list = list + /*"\t\t\t   " +*/ state_str;
                list += "\n";
        }

	list +=	"───────────────────────────────────────\n";
	list += sprintf( " 目前线上共有 %d 位帮众, 系统负担: %s\n\n", count, query_load_average() );

        this_player()->start_more(list);
}
コード例 #28
0
ファイル: get.c プロジェクト: aricxu/xkx100
int main(object me, string arg)
{
	string from, item;
	object obj, *inv, env, obj2;
	int i, amount;

	if (!arg)
		return notify_fail("你要捡起什么东西?\n");

	if (me->is_busy())
		return notify_fail("你上一个动作还没有完成!\n");

	if (sscanf(arg, "%s from %s", arg, from) == 2) {
		env = present(from, me);
		if (!env)
			env = present(from, environment(me));
			
		if (!env)
			return notify_fail("你找不到 " + from + " 这样东西。\n");
			
		if ((env->query("no_get_from") || living(env))
			&& (wiz_level(me) <= wiz_level(env)))
			return notify_fail("你的巫师等级必须比对方高,才能搜身。\n");
	} else
		env = environment(me);

	if (sscanf(arg, "%d %s", amount, item) == 2) {
		if (!objectp(obj = present(item, env)))
			return notify_fail("这里没有这样东西。\n");
			
		if (!obj->query_amount())
			return notify_fail(obj->name() + "不能被分开拿走。\n");
			
		if (amount < 1)
			return notify_fail("东西的个数至少是一个。\n");

		if (amount > obj->query_amount())
			return notify_fail("这里没有那麽多的" + obj->name() + "。\n");
		else if(amount == (int)obj->query_amount())
			return do_get(me, obj);
		else {
			obj2 = new(base_name(obj));
			obj2->set_amount((int)obj->query_amount() - amount);
			obj->set_amount( amount );
			do_get(me, obj);
			obj2->move(env);
			if (me->is_fighting())
				me->start_busy(3);
			return 1;
		}
	}

	if (arg=="all") {
		if (me->is_fighting())
			return notify_fail("你还在战斗中!只能一次拿一样。\n");
			
		if (!env->query_max_encumbrance())
			return notify_fail("那不是容器。\n");
			
        	if (env->is_tree())
        		return notify_fail("这是给新手活命用的,还是不要太贪心了吧n");

		inv = all_inventory(env);
		if (!sizeof(inv)) {
        		if (env->is_tree())
                		return notify_fail("树上什么也没有了。\n");
			return notify_fail("那里面没有任何东西。\n");
        	}

		for (i = 0; i < sizeof(inv); i ++) {
			if (inv[i]->is_character() || inv[i]->query("no_get"))
				continue;
			do_get(me, inv[i]);
		}
		write("捡好了。\n");
		return 1;
	}

	if (!objectp(obj = present(arg, env)) || living(obj))
		return notify_fail("你附近没有这样东西。\n");

	if (obj->query("no_get"))
		return notify_fail("这个东西拿不起来。\n");

	return do_get(me, obj);
}
コード例 #29
0
ファイル: get.c プロジェクト: gongfuPanada/mhxy2002
int main(object me, string arg)
{
	string from, item;
	object obj, *inv, env, obj2,old_env;
	int i, amount;
        mixed no_get;

	if( !arg ) return notify_fail("你要捡起什么东西?\n");
	if( me->is_busy() )
		return notify_fail("你上一个动作还没有完成!\n");

	// Check if a container is specified.
	if( sscanf(arg, "%s from %s", arg, from)==2 ) {
		env = present(from, me);
		if(!env) env = present(from, environment(me));
		if(!env) return notify_fail("你找不到 " + from + " 这样东西。\n");
		if(living(env) && (wiz_level(me) <= wiz_level(env)))
			return notify_fail("你的巫师等级必须比对方高,才能搜身。\n");
	} else env = environment(me);


	// Check if a certain amount is specified.
	if(sscanf(arg, "%d %s", amount, item)==2) {
		if( !objectp(obj = present(item, env)) )
			return notify_fail("这里没有这样东西。\n");
		no_get = obj->query("no_get");
		if( no_get 
		&& !(wizardp(me) && me->query("env/override")) ) {
			return notify_fail(stringp(no_get) ? 
				no_get : "这个东西拿不起来。\n");
		}
	
		if( !obj->query_amount() )
			return notify_fail( obj->name() + "不能被分开拿走。\n");
		if( amount < 1 )
			return notify_fail("东西的个数至少是一个。\n");
		if( amount > obj->query_amount() )
			return notify_fail("这里没有那么多的" + obj->name() + "。\n");
		else if( amount == (int)obj->query_amount() ) {
			return do_get(me, obj,0);
		} else {
			obj2 = new(base_name(obj));
			obj2->set_amount(amount);
			if(do_get(me,obj2, environment(obj))) {
			    obj->set_amount( (int)obj->query_amount()-amount);
			    return 1;
			}
			return 0;
		}
	}

	// Check if we are makeing a quick get.
	if(arg=="all") {
		if( me->is_fighting() )	return notify_fail("你还在战斗中!只能一次拿一样。\n");
		if( !env->query_max_encumbrance() )	return notify_fail("那不是容器。\n");

		inv = all_inventory(env);
		if( !sizeof(inv) )
			return notify_fail("那里面没有任何东西。\n");

		for(i=0; i<sizeof(inv); i++) {
			if( inv[i]->is_character() || inv[i]->query("no_get"))
				continue;
			do_get(me, inv[i],0);
		}
		write("Ok。\n");
		return 1;
	}

// added by mon to incorporate the "bian" function.
        if(!objectp(obj= present(arg, env)) || obj==this_player())
	   return notify_fail("你附近没有这样东西。\n");
        else {
         if((obj->query_temp("d_mana"))>0) {
	  if( obj->query_temp("is_living")==1 )
	    return notify_fail("你附近没有这样东西。\n");
	  else {
	    no_get = obj->query("no_get");
            if( no_get 
	    && !(wizardp(me) && me->query("env/override")))
                return notify_fail(stringp(no_get) ? no_get : "这个东西拿不起来。\n");
            old_env = environment(obj);
	    if( obj->move(me) ) {
                if( me->is_fighting() ) me->start_busy(1);
	    message_vision( sprintf("$N%s一%s$n。\n",
            old_env==environment(me)?  "捡起": (old_env->is_character() ?
            "从" + old_env->name() + "身上" + "搜出":
            "从" + old_env->name() + "中拿出"),
	    undefinedp(obj->query_temp("unit"))?
	    "个":obj->query_temp("unit")
	    ), me, obj);
	    return 1; 
	    } else return 0;
          }
        } else {
	  if( living(obj) )
		return notify_fail("你附近没有这样东西。\n");
        }
	}

        no_get = obj->query("no_get"); 
        if( no_get  
	&& !(wizardp(me) && me->query("env/override")))
                return notify_fail(stringp(no_get) ? no_get : "这个东西拿不起来。\n");

	return do_get(me, obj,0);
}
コード例 #30
0
ファイル: update.c プロジェクト: huangleon/fy2005
int main(object me, string file)
{
        int i;
        object obj, *inv;
        string err;

        seteuid( geteuid(me) );

        if (!file) file = me->query("cwf");
        if (!file)
                return notify_fail("─у╥к╓╪╨┬▒р╥ы╩▓ўс╡╡░╕г┐\n");

        if( (obj = present(file, environment(me))) && interactive(obj) )
                return update_player(obj);

        if( file == "me" )
                return update_player(me);
        else {
                file = resolve_path(me->query("cwd"), file);
                if( !sscanf(file, "%*s.c") ) file += ".c"; 
        }

        if( file_size(file)==-1 )
           	return notify_fail("├╗╙╨╒т╕Ў╡╡░╕бг\n");

		if (wiz_level(me)<4)
			return notify_fail("─у╡─╚и╧▐▓╗─▄╓╪╨┬▒р╥ы╬─╝■бг\n");
		
        me->set("cwf", file);

        if (obj = find_object(file)) {
                if( obj==environment(me) ) {
                        if( file_name(obj)==VOID_OB )
                                return notify_fail("─у▓╗─▄╘┌ VOID_OB └я╓╪╨┬▒р╥ы VOID_OBбг\n");
                }

                inv = all_inventory(obj);
                i = sizeof(inv);
                while(i--) {
                        if(userp(inv[i])|| 
                        	inv[i]->query("possessed")) {
                        	inv[i]->move(VOID_OB, 1);
                        } else {
                        	destruct(inv[i]);
			}
                }

                destruct(obj);
        }

        if (obj) return notify_fail("╬▐╖и╟х│¤╛╔│╠╩╜┬ыбг\n");

    	write("╓╪╨┬▒р╥ы " + file + "г║");
        err = catch( call_other(file, "???") );
        if (err)
                printf( "╖в╔·┤э╬єг║\n%s\n", err );
        else {
                write("│╔╣жгб\n");
   		log_file( "UPDATE_LOG", sprintf("(%s)
%s updated %s\n", ctime(time()), me->query("name"), file));
        
        	if( (i=sizeof(inv)) && (obj = find_object(file))) {
        		while(i--)
                        {
                        	if( inv[i] && (userp(inv[i]) || inv[i]->query("possessed"))) 
					inv[i]->move(obj, 1);
                		
                	}
                }
        }
                
        return 1;
}