channeld.c
来自「C实现的MUD,对大家基本入门网络游戏很有帮助!」· C语言 代码 · 共 475 行 · 第 1/2 页
C
475 行
// channeld.c // 97-10-18 add intermud channel and emote capability// By ken@XAJH & fuyo@XAJH #include <ansi.h>#include <mudlib.h>#include <net/dns.h>#include <net/macros.h>inherit F_DBASE;#define BLOCK_CHAT 0#define BLOCK_RUMOR 0#define REMOTE_Q "/adm/daemons/network/services/remote_q.c"string remove_addresses(string, int all);mapping channels = ([ "sys": ([ "msg_speak": HIR "【系统】%s:%s\n" NOR, "msg_color": NOR+HIR, "wiz_only": 1, ]), "adm": ([ "msg_speak": HIW "%s: %s\n" NOR, "msg_emote": NOR+HIW+"【大巫师】%s" NOR, "msg_color": NOR+HIW, "arch_only": 1, ]), "wiz": ([ "msg_speak": NOR+HIY+"【巫师】"+HIY+"%s:%s\n" NOR, "msg_emote": NOR+HIY+"【巫师】"+HIY+"%s" NOR, "intermud": GCHANNEL, "intermud_emote": 1, "msg_color": NOR+HIY, "wiz_only": 1, "channel": "hywiz", "omit_address": 0, "filter": 1, ]), "asd": ([ "msg_speak": NOR+HIC+"【网络警察】"+HIY+"%s:%s\n" NOR, "msg_emote": NOR+HIC+"【网络警察】"+HIY+"%s" NOR, "eschat_only": 1, "intermud": GCHANNEL, "intermud_emote": 1, "channel": "asd", "msg_color": NOR+HIY, "filter": 1, "omit_address": 0, ]), "gwiz": ([ "msg_speak": NOR+HIC+"【网际巫师】"+HIY+"%s:%s\n" NOR, "msg_emote": NOR+HIC+"【网际巫师】"+HIY+"%s" NOR, "eschat_only": 1, "msg_color": NOR+HIY, "filter": 1, "omit_address": 0, ]), "yqyl": ([ "msg_speak": NOR+HIC+"【云起云落】"+HIW+"%s:%s\n" NOR, "msg_emote": NOR+HIC+"【云起云落】"+HIW+"%s" NOR, "intermud": GCHANNEL, "intermud_emote": 1, "channel": "yqyl", "msg_color": NOR+HIY, "filter": 1, "omit_address": 0, ]), "hy": ([ "msg_speak": NOR+HIC+"【海洋II】"+HIW+"%s:%s\n" NOR, "msg_emote": NOR+HIC+"【海洋II】"+HIW+"%s" NOR, "intermud": GCHANNEL, "intermud_emote": 1, "channel": "hy", "msg_color": NOR+HIY, "filter": 1, "omit_address": 0, ]), "auction":([ "msg_speak": HIY "【拍卖场】%s: %s\n" NOR, "msg_color": HIY, ]), "gwiz": ([ "msg_speak": NOR+HIC+"【网际巫师】"+HIY+"%s:%s\n" NOR, "msg_emote": NOR+HIC+"【网际巫师】"+HIY+"%s" NOR, "eschat_only": 1, "intermud": GCHANNEL, "intermud_emote": 1, "channel": "gwiz", "msg_color": NOR+HIY, "filter": 1, "omit_address": 0, ]), "gbwiz":([ "msg_speak": BOLD "【大陆巫师】%s:%s\n" NOR, "msg_emote": BOLD "【大陆巫师】%s" NOR, "msg_color": BOLD, "intermud": GCHANNEL, "intermud_emote": 1, "channel": "gbwiz", "eschat_only": 1, "omit_address": 0, "filter": (: $1["ENCODING"] == MUDLIB_ENCODING :) ]), "debug":([ "msg_speak": HIW "【调试】%s:%s\n" NOR, "msg_emote": HIY "【调试】%s" NOR, "msg_color":HIW, "wiz_only": 1, ]), "chat": ([ "msg_speak": HIC+"【论道江湖】%s:%s\n" NOR, "msg_emote": HIC+"【论道江湖】"+CYN+"%s" NOR, "msg_color": NOR+HIC, ]), "rumor": ([ "msg_speak": HIM "【江湖谣言】%s:%s\n" NOR, "msg_emote": HIM "【江湖谣言】%s" NOR, "msg_color": NOR+HIR, "anonymous": "某人", ]), "party":([ "msg_speak": HIG "【%s】%s: %s\n" NOR, "msg_emote": HIG "【%s】%s" NOR, "msg_color": NOR+HIG, ]), "es": ([ "msg_speak": NOR+BOLD+"【网际闲聊】"+NOR+BOLD+"%s:%s\n" NOR, "msg_emote": NOR+BOLD+"【网际闲聊】"+NOR+BOLD+"%s" NOR, "msg_color": NOR+BOLD, "intermud": GCHANNEL, "intermud_emote": 1, "eschat_only": 1, "channel": "es", "filter": 1, "omit_address": 0, ]),]);void create(){ // This is required to pass intermud access check. seteuid(getuid()); set("channel_id", "频道精灵");}varargs int do_channel(object me, string verb, string arg, int emote,int remote){ object *ob; string *tuned_ch, who; string arg_bk,self_emote; mixed *value,*index; int i,j; self_emote=arg; // Check if this is a channel emote. if( sizeof(verb) > 2 ) { if( verb[sizeof(verb)-1] == '*' ) { emote = 1; verb = verb[0..<2]; } } // Check if this is a channel messsage. if( !mapp(channels) || undefinedp(channels[verb]) ) return 0; // check if this channel support emote message. if( emote && undefinedp(channels[verb]["msg_emote"]) ) { write("对不起,这个频道不支持 emote 。\n"); return 1; } //now we can be sure it's indeed a channel message: if (!stringp(arg) || arg == "" || arg == " ") arg = "..."; else arg_bk = arg; if(remote) arg_bk = arg; // check if one can write to channels // only block rumor or chat... if (!me) return 0;if(!userp(me) && me->query("id")=="ma fu"){ return 0;} if ( ((int)time() - (int)me->query_temp("chat_times")) < 1 && userp(me)) return notify_fail("有话好好说,不要那么快嘛!\n");if ( strlen(arg)>500)return notify_fail("你说那么多话做什么! 想刷屏? \n"); if ( userp(me) && !wizardp(me)) { if(me->query_condition("killer")) return notify_fail("你正在被通辑中,不能使用公共频道!\n"); if ( ((int)time() - (int)me->query_temp("chat_times")) < 5 ){ if(me->query("combat_exp") < 5000) return notify_fail("只有经验大于5000,才能无限制使用公共频道!\n 现在你只能5秒钟用一次,请完成(help xipanzi) 洗盘子任务(0-5000)任务\n");} if(me->query("combat_exp") < 5000){if ( strlen(arg)>40)return notify_fail("你说那么多话做什么! 想刷屏? 只有经验大于5000,才能无限制使用公共频道!\n");} if(time()-(int)me->query("chblk_channel/all")<3600) return notify_fail("你所有的聊天频道都被关闭了!\n"); switch (verb) { case "rumor" : if (time() - (int)me->query("chblk_channel/rumor") < 3600) return notify_fail("你的谣言频道被关闭了!\n"); break; case "chat" : if (time() - (int)me->query("chblk_channel/chat") < 3600) return notify_fail("你的聊天频道被关闭了!\n"); break; case "party" : if (time() - (int)me->query("chblk_channel/party") < 3600) return notify_fail("你的门派频道被关闭了!\n"); break; case "es" : if (time() - (int)me->query("chblk_channel/es") < 3600) return notify_fail("你的网际闲聊频道被关闭了!\n"); break; case "sing" : if (time() - (int)me->query("chblk_channel/sing") < 3600) return notify_fail("你的歌唱频道被关闭了!\n"); break; case "new" : if (time() - (int)me->query("chblk_channel/new") < 3600) return notify_fail("你的网际闲聊频道被关闭了!\n"); case "yqyl" : if (time() - (int)me->query("chblk_channel/yqyl") < 3600) return notify_fail("你的云起云落频道被关闭了!\n"); case "hy" : if (time() - (int)me->query("chblk_channel/hy") < 3600) return notify_fail("你的海洋频道被关闭了!\n"); break; } } me->set_temp("chat_times",time()); if( userp(me) ) { if( channels[verb]["wiz_only"] && !wizardp(me)) return 0;
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?