Beispiel #1
0
		bool match_key(const std::wstring & key) const
		{
			if (is_sub(artist, key)
				|| is_sub(artist_romanized, key)
				|| is_sub(title, key)
				|| is_sub(title_romanized, key)
				|| is_sub(source, key)
				)
				return true;
			if (tags.size() == 0)
				return false;
			return std::all_of(tags.begin(), tags.end(), [&key](const std::wstring & str){ return is_sub(str, key); });
		}
Beispiel #2
0
string remote_tell(string cname, string from, string mud, string to, string msg, int wiz_level)
{
	object ob;
	string fromid;
	string no_tell;
	string can_tell;
       // mapping conn;
        //string reject;
        string tell_out;

	if (ob = MESSAGE_D->find_user(to))
        {
		if (ob->query("env/invisible"))
			return "这个人现在不在线上。";

		fromid = lower_case(from + "@" + mud);
		no_tell = ob->query("env/no_tell");
		if ((! intp(wiz_level) || wiz_level < 3) &&
                    (no_tell == "all" || no_tell == "ALL" ||
	             is_sub(fromid, no_tell)))
        	{
                	can_tell = ob->query("env/can_tell");
                	if (! is_sub(fromid, can_tell))
		        	return "这个人不想听你罗嗦啦。";
        	}

		fromid = capitalize(from) + "@" + upper_case(mud);
		msg = replace_string(msg, "\n", "");
		if (cname)
                        tell_out = sprintf(HIG "%s(%s)告诉你:%s\n" NOR,
                                           cname, fromid, msg);
		else
                {
                        cname = "未知";
			tell_out = sprintf(HIG "%s 告诉你:%s\n" NOR,
				           fromid, msg);
                }

                to = capitalize(to);
                if (! notice_user(cname, fromid, ob, tell_out))
                        msg = sprintf(HIG "你的话没有送到%s(%s@%s)的耳边。\n" NOR,
                                      ob->name(1), to, upper_case(INTERMUD_MUD_NAME));
                else
		        msg = sprintf(HIG "你告诉%s(%s@%s):%s" NOR, ob->name(1), to,
			              upper_case(INTERMUD_MUD_NAME), msg);
                return msg;

	} else
		return "这个人现在不在线上。";
}
Beispiel #3
0
int my_func(char *str1,char *str2){
	int len = strlen(str2);
	char *temp = (char *)malloc(sizeof(char)*len);
	if(!temp){
		return -1;
	}

	for(int i = 0;i<len;i++){
		int pos = 0;
		for(int j = i;j<len;j++){
			temp[pos] = str2[j];
			pos++;
		}
		for(int k = 0;k<i;k++){
			temp[pos] = str2[k];
			pos++;
		}
		temp[pos] = '\0';
		if (is_sub(str1,temp)){
			return 1;
		}
	}
	return 0;
}
Beispiel #4
0
int main(object me, string arg)
{
	string target, mud;
	object obj;
        string no_tell, can_tell;
        string reply_out;

	if (! arg || arg == "")
		return notify_fail("你要回答什么?\n");

	if (! stringp(target = me->query_temp("reply")) )
		return notify_fail("刚才没有人和你说过话。\n");

	if (sscanf(target, "%s@%s", target, mud) == 2)
	{
		GTELL->send_gtell(lower_case(mud), lower_case(target), me, arg);
		write("网路讯息已送出,可能要稍候才能得到回应。\n");
		return 1;
	}

	obj = find_player(target);
	if (! obj || ! me->visible(obj))
	{
		if (MESSAGE_D->send_msg_to(me, target, arg))
			return 1;
		return notify_fail("刚才和你说话的人现在已经离开游戏了。\n");
	}

        no_tell = obj->query("env/no_tell");
	if (! wizardp(me) && (no_tell == "all" || no_tell == "ALL" ||
	    is_sub(me->query("id"), no_tell)))
        {
                can_tell = obj->query("env/can_tell");
                if (! is_sub(me->query("id"), can_tell))
		        return notify_fail("这个人不想听你罗嗦啦。\n");
        }

	if (playerp(obj) && obj->is_net_dead())
		return notify_fail("这个人现在不在线上,听不到你的话。\n");

	if (! living(obj))
		return notify_fail("这人现在恐怕听不到你说的话了...\n");

	reply_out = sprintf(HIG "%s回答你:%s\n" NOR,
                            me->name(1) + HIG "(" + me->query("id") + ")", arg);
        if (! TELL_CMD->notice_user(me->name(1), me->query("id"), obj, reply_out))
                return 1;

        // 成功的回答了
	write(HIG "你回答" + obj->name(1) + HIG + "(" + obj->query("id") +
              "):" + arg + "\n" NOR);

        if (query_idle(obj) >= 120)
                write(YEL "可是" + obj->name(1) +
                      YEL "已经在猪圈中发呆有" + chinese_number(query_idle(obj) / 60) +
                      "分钟了,恐怕没法听到你的话。\n");

        // 如果选择的不是全阻塞(2),则自动忽略这条信息,显示
        // 下一条信息。
        if (me->query("env/jam_talk") != 2)
                SKIP_CMD->main(me, "");

	return 1;
}
Beispiel #5
0
int main(object me, string arg)
{
	string target, msg, mud;
        string my_id;
	object obj;
        string no_tell, can_tell;
        string tell_out;

	if (! arg || sscanf(arg, "%s %s", target, msg) != 2)
                return help(me);

	if (sscanf(target, "%s@%s", target, mud) == 2)
	{
		if (GTELL->send_gtell(mud, target, me, msg))
		{
			write("网路讯息已送出,可能要稍候才能得到回应。\n");
			return 1;
		}
	}

	obj = find_player(target);
	if (! obj || ! me->visible(obj))
	{
		if (MESSAGE_D->send_msg_to(me, target, msg))
			return 1;
		return notify_fail("这个用户没有登录,你无法和他交谈。\n");
	}

        my_id = me->query("id");
        no_tell = obj->query("env/no_tell");
	if (! wizardp(me) && (no_tell == "all" || no_tell == "ALL" ||
	    is_sub(my_id, no_tell)))
        {
                can_tell = obj->query("env/can_tell");
                if (! is_sub(my_id, can_tell))
		        return notify_fail("这个人不想听你罗嗦啦。\n");
        }

	if (! interactive(obj) || obj->is_net_dead())
		return notify_fail("此人现在不在线上,听不到你的话。\n");

	if (! living(obj))
		return notify_fail("这人现在恐怕听不到你说的话了...\n");

        if (me->ban_say(1))
                return 0;

        if (obj == me)
        {
                message_vision("$N喃喃自语。\n", me);
                return 1;
        }

        tell_out = sprintf(HIG "%s告诉你:%s\n" NOR,
		           me->name(1) + HIG + "(" +
                           capitalize(my_id) + ")", msg);

        if (! notice_user(me->name(1), my_id, obj, tell_out))
                return 1;

	write(sprintf(HIG "你告诉%s(%s):%s\n" NOR,
                      obj->name(1) + HIG,
                      capitalize(obj->query("id")), msg));

        if (query_idle(obj) >= 120)
                write(YEL "可是" + obj->name(1) +
                      YEL "已经在猪圈中发呆有" + chinese_number(query_idle(obj) / 60) +
                      "分钟了,恐怕没法立刻回答你。\n");

	return 1;
}