leitai.c

来自「C实现的MUD,对大家基本入门网络游戏很有帮助!」· C语言 代码 · 共 451 行 · 第 1/2 页

C
451
字号
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

        allob = users();
        me = this_object();
        ob = this_player();
        if (!me) return 1;
        if (!ob) return 1;
        j = 0;
        for ( i=sizeof(allob); i>0; i-- ) {
//             if (environment(allob[i-1])->query("short") =="擂台") {
                if (j == 0) {
                    me = allob[i-1];
                    j = 1;
                }
                else ob = allob[i-1]; 
             }
//        }
        if (ob != this_player()) me->fight_ob(ob);
        return 1;
}
int do_allow(string arg)
{
	object ob, me;
string wiz_status;
	me = this_player();
	wiz_status = SECURITY_D->get_status(me);
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	me = this_player();
	if (!arg) return notify_fail("<Syntax>: allow <player id>\n");
	ob = LOGIN_D->find_body(arg);
	if (!ob) return notify_fail("没这个人耶。\n");
	message_vision(HIG"$N设定让"+ob->name()+"上擂台。\n"NOR, me);
	ob -> set_temp("leitai_allow",1);
	ob -> delete("env/combatd");
	tell_object(ob,HIR"\n该你上擂台了。\n"NOR);
	return 1;
}
int do_deny(string arg)
{
	object ob, me;
string wiz_status;
	me = this_player();
	wiz_status = SECURITY_D->get_status(me);
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	me = this_player();
	if (!arg) return notify_fail("<Syntax>: deny <player id>\n");
	ob = LOGIN_D->find_body(arg);
	if (!ob) return notify_fail("没这个人耶。\n");
	message_vision(HIG"$N设定让"+ob->name()+"先暂时别上擂台。\n"NOR, me);
	ob -> delete_temp("leitai_allow");
	tell_object(ob,HIR"\n先不急上擂台了吧。\n"NOR);
	return 1;
}
int do_load(string arg)
{
	object ob, me;
string wiz_status;
	me = this_player();
	wiz_status = SECURITY_D->get_status(me);
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");
	if (!arg) return notify_fail("<Syntax>: loadup <player id>\n");
	ob = LOGIN_D->find_body(arg);
	if (!ob) return notify_fail("没这个人耶。\n");
	message_vision(HIG"$N拉"+ob->name()+"上擂台。\n"NOR, me);
	message_vision(HIG"$N双腿一蹬,腾空而起,轻轻落在擂台边上,衣袂襟风,十分潇洒。\n"NOR, ob);
	ob -> delete_temp("leitai_allow");
	tell_object(ob,HIR"\n发什么呆呀你,先上来吧给我。\n"NOR);
	ob -> move("/d/city/leitai");
	ob -> delete_temp("view_leitai");
	ob -> delete("env/combatd");
	message_vision(HIG"$N腾空落在擂台边上,衣袂襟风,十分潇洒。\n"NOR, ob);
	return 1;
}
int do_kick(string arg)
{
	object ob, me;

	string wiz_status;
	me = this_player();
	wiz_status = SECURITY_D->get_status(me);
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");
	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if (!arg) return notify_fail("<Syntax>: kickdown <player id>\n");
	ob = LOGIN_D->find_body(arg);
	if (!ob) return notify_fail("没这个人耶。\n");
	message_vision(HIG"$N把"+ob->name()+"踢下擂台。\n"NOR, me);
	ob -> delete_temp("leitai_allow");
	message_vision(HIG"只听得$N嗷的一声,飞身跳下擂台去了。\n"NOR, ob);
	tell_object(ob,HIR"\n没玩够啊,先下去吧你给我。\n"NOR);
	ob -> move("/d/city/wudao1");
	ob -> set_temp("view_leitai",1);
	message_vision(HIG"只见$N长呼声中,一个大屁股墩坐在地上唉唉不绝。\n"NOR, ob);
	return 1;
}
int do_heal(string arg)
{
	object ob, me, obj;
	string wiz_status;
	me = this_player();
	wiz_status = SECURITY_D->get_status(me);
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if (!arg) return notify_fail("<Syntax>: heal <player id>\n");
	ob = LOGIN_D->find_body(arg);
	if (!ob) return notify_fail("没这个人耶。\n");
	message_vision(HIG"$N给"+ob->name()+"一粒九花玉露丸。\n"NOR, me);
	obj = new("/clone/misc/jiuhua");
	obj -> move(ob); 
	tell_object(ob,HIR"\n给你一粒九花玉露丸恢复体力。\n"NOR);
	return 1;
}
int do_life(string arg)
{
	object ob, me;

	string wiz_status;
	me = this_player();
	wiz_status = SECURITY_D->get_status(me);
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if (!arg) return notify_fail("<Syntax>: reback <player id>\n");
	ob = LOGIN_D->find_body(arg);
	if (!ob) return notify_fail("没这个人耶。\n");
	message_vision(HIG"$N送"+ob->name()+"上天堂恢复损失。\n"NOR, me);
	ob -> delete_temp("leitai_allow");
	tell_object(ob,HIR"\n送你上天堂,下来后就会恢复的。\n"NOR);
	ob -> move("/d/death/god2");
	ob -> delete_temp("view_leitai");
	return 1;
}
int do_titles(string arg)
{
	object obj, me=this_player();
	string dest, topic;
	string wiz_status;
	wiz_status = SECURITY_D->get_status(me);
if (!wizardp(me))
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( wiz_status != "(admin)" && wiz_status != "(arch)"&& wiz_status != "(wizard)" )
		return notify_fail("只有 (wizard) 以上的巫师才能使用此命令" + MUD_NAME + "\n");

	if( !arg || sscanf(arg, "%s %s", dest, topic)!=2 )
		return notify_fail("你要封谁什么称号?\n");
	obj = find_player(dest);
	if(!obj || !me->visible(obj)) return notify_fail("没有这个人....。\n");
	switch (topic)
	{
		case "01": add_title(obj, "幼年天下第一"); break;
		case "02": add_title(obj, "幼年天下第二"); break;
		case "11": add_title(obj, "少年天下第一"); break;
		case "12": add_title(obj, "少年天下第二"); break;
		case "21": add_title(obj, "天下第一侠少"); break;
		case "22": add_title(obj, "天下第二侠少"); break;
		case "31": add_title(obj, "天下第一侠客"); break;
		case "32": add_title(obj, "天下第二侠客"); break;
		case "41": add_title(obj, "天下第一大侠"); break;
		case "42": add_title(obj, "天下第二大侠"); break;
		default: break;
	}
	message_vision(HIG"$N授"+obj->name()+"封号。\n"NOR, me);
	return 1;
}
void add_title(object me,string arg)
{
        string title;
        title=arg+clear_title(me->query("title"));
        me->set("title",title);
}
string clear_title(string arg)
{
        if( (strsrch(arg, "幼年天下第一") >= 0) ||
            (strsrch(arg, "幼年天下第二") >= 0) ||
            (strsrch(arg, "少年天下第一") >= 0) ||
            (strsrch(arg, "少年天下第二") >= 0) ||
            (strsrch(arg, "天下第一侠少") >= 0) ||
            (strsrch(arg, "天下第二侠少") >= 0) ||
            (strsrch(arg, "天下第一侠客") >= 0) ||
            (strsrch(arg, "天下第二侠客") >= 0) ||
            (strsrch(arg, "天下第一大侠") >= 0) ||
            (strsrch(arg, "天下第二大侠") >= 0))
                {
                arg = replace_string(arg, "幼年天下第一","");
                arg = replace_string(arg, "幼年天下第二","");
                arg = replace_string(arg, "少年天下第一","");
                arg = replace_string(arg, "少年天下第二","");
                arg = replace_string(arg, "天下第一侠少","");
                arg = replace_string(arg, "天下第二侠少","");
                arg = replace_string(arg, "天下第一侠客","");
                arg = replace_string(arg, "天下第二侠客","");
                arg = replace_string(arg, "天下第一大侠","");
                arg = replace_string(arg, "天下第二大侠","");
        }
        return arg;
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?