Forráskód Böngészése

feat(chat): chat 插件和 move 插件,用来处理聊天信息和走来走去

dzp 3 éve
szülő
commit
311c0af816

+ 9 - 0
mud/pkuxkx/etc/ui-chat.tin

@@ -0,0 +1,9 @@
+#list chat-channel create {
+    {{pattern}{求助}                        {action}{helpmeLog}     {gag}{true}}
+    {{pattern}{北侠QQ群}                    {action}{qqLog}         {gag}{true}}
+    {{pattern}{%!{闲聊|副本|谣言}}          {action}{chatLog}       {gag}{true}}
+    {{pattern}{%!{江湖|任务|交易}}          {action}{jhLog}         {gag}{true}}
+    {{pattern}{%!{队伍|门派|本地|区域}}     {action}{bdLog}         {gag}{true}}
+    {{pattern}{私聊}                        {action}{tellLog}       {gag}{false}}
+    {{pattern}{%*}                          {action}{groupLog}      {gag}{true}}
+};

+ 96 - 0
mud/pkuxkx/plugins/lib/ui/chat.tin

@@ -0,0 +1,96 @@
+#var lib_ui_chat[META] {
+    {NAME}      {聊天日志}
+    {DESC}      {抓取聊天信息,分置到不同的日志文件里去}
+    {AUTHOR}    {担子炮}
+};
+
+#list chat-channel create {
+    {{pattern}{求助}                        {action}{helpmeLog}     {gag}{true}}
+    {{pattern}{北侠QQ群}                    {action}{qqLog}         {gag}{true}}
+    {{pattern}{%!{闲聊|副本|谣言}}          {action}{chatLog}       {gag}{true}}
+    {{pattern}{%!{江湖|任务|交易}}          {action}{jhLog}         {gag}{true}}
+    {{pattern}{%!{队伍|门派|本地|区域}}     {action}{bdLog}         {gag}{true}}
+    {{pattern}{私聊}                        {action}{tellLog}       {gag}{false}}
+    {{pattern}{%*}                          {action}{groupLog}      {gag}{true}}
+};
+
+#function {lib_ui_chat.Init} {
+    load-file {etc/ui-chat.tin};
+    #return true;
+};
+
+#nop 普通聊天信息;
+#action {~^%c【%+2..5u】%c%+1..10u%c({[a-z A-Z]+})%c: %*$E} {
+    chat.log {%2} {%0};
+} {4.994};
+
+#nop 单行的 emote 表情;
+#action {~^%c【%+2..5u】%*(%+1..S{| \S+} ||{| \S+} %+1..S)%c$E} {
+    chat.log {%2} {%0};
+} {4.994};
+
+#nop 多行的 emote 表情;
+#action {~^%c【%+2..5u】%*$E} {
+    chat.log-multi-line {%2} {%0};
+} {4.995};
+
+#alias {chat.log} {
+    #local type {%1};
+    #local text {%2};
+
+    #local id {};
+    #loop {1} {&chat-channel[]} {id} {
+        #local pattern {$chat-channel[$id][pattern]};
+        #local action  {$chat-channel[$id][action]};
+        #local gag     {$chat-channel[$id][gag]};
+        #if { "$type" == "$pattern" } {
+            $action $text;
+            #if { "$gag" == "true" } {
+                #line gag;
+            };
+            #return;
+        };
+    };
+};
+
+#alias {chat.log-multi-line} {
+    #local type {%1};
+    #local text {%2};
+    chat.log {$type} {$text};
+
+    #if { "$type" != "{闲聊|求助|谣言}" } {
+        #return;
+    };
+
+    #if { "$type" == "{闲聊|谣言}" && {$text} == {%* {\e\[0m}} } {
+        #return;
+    };
+
+    #class chat.log open;
+
+    #action {~^%*{|ID=chat.log}$} {
+        chat.log {%1} {%%0};
+    } {4.993};
+
+    #action {~^%*(%w ||{| \S+} %+1..S)%c{|ID=chat.log}$} {
+        chat.log {%1} {%%0};
+        #class chat.log kill;
+    } {4.992};
+
+    #if { "$type" == "{闲聊|谣言}" } {
+        #action {~^%* {\e\[0m}{|ID=chat.log}$} {
+            chat.log {%1} {%%0};
+            #class chat.log kill;
+        } {4.992};
+    };
+
+    #delay chat.log {#class chat.log kill} 0;
+
+    #class chat.log close;
+};
+
+#action {~^%c%u%c(%w)告诉你:%*$} {
+    chat.log 私聊 {%0};
+} {9.999};
+
+set learn_emote 1;

+ 79 - 0
mud/pkuxkx/plugins/lib/ui/move.tin

@@ -0,0 +1,79 @@
+#var lib_ui_move[META] {
+    {NAME}      {走来走去}
+    {DESC}      {抓取玩家走来走去的信息,放置到单独的日志}
+    {AUTHOR}    {担子炮}
+};
+
+load-lib option;
+option.Define {GagMove} {Bool} {是否抑制玩家移动信息} {true};
+
+#alias {move-log} {
+    #local text {%1};
+    #replace {text} {,右手拿着} {/};
+    #replace {text} {,左手拿着} {/};
+    #replace {text} {,右手} {/};
+    #replace {text} {,左手} {/};
+    #replace {text} {,手持} {/};
+    #replace {text} {,身穿} {/};
+    #replace {text} {,拿着} {/};
+    #replace {text} {右手拿着} {/};
+    #replace {text} {左手拿着} {/};
+    #replace {text} {右手} {/};
+    #replace {text} {左手} {/};
+    #replace {text} {手持} {/};
+    #replace {text} {身穿} {/};
+    #replace {text} {拿着} {/};
+    #replace {text} {走了过来} {/&0};
+
+    moveLog $text;
+
+    #if { @option.IsEnable{GagMove} } {
+        #line gag;
+    };
+};
+
+#action {^你} {#0} {9.998};
+#action {~^%*{往|向}{((东|西)(南|北|))|((东|南|西|北|上|下)(|上|下|面))}{离开|离去|驶去}。$CE} { move-log {%0} }{9.999};
+#action {~^%*本来好端端在这里的,忽然消失了,好象人间蒸发了一样。$CE} { move-log {%0} }{9.999};
+#action {~^%*走过来扫了在场各人一眼,一股凛冽的杀意油然而生。$CE} { move-log {%0} }{9.999};
+#action {~^%*你闻到一丝淡淡的香气,紧接着%*走了过来。$CE} { move-log {%0} }{9.997};
+#action {~^%*跌跌撞撞地跑了过来,模样有些狼狈。$CE}     { move-log {%0} }{9.999};
+#action {~^%*如离弦之箭一般冲了过来。$CE}               { move-log {%0} }{9.999};
+#action {~^%*一转眼,场间早已没有了%*的身影。$CE}       { move-log {%0} }{9.999};
+#action {~^%*开始往%*方向飞奔过去……$CE}               { move-log {%0} }{9.999};
+#action {~^%*顺着%*的路径飞奔了过去。$CE}               { move-log {%0} }{9.999};
+#action {~^%*{走|驶}了{过来|进去|出来}。$CE}            { move-log {%0} }{9.999};
+#action {~^%*走了过来,%*$CE}                           { move-log {%0} }{9.999};
+#action {~^%*走了过来。$CE}                             { move-log {%0} }{9.999};
+#action {~^%*慢慢地离开。$CE}                           { move-log {%0} }{9.999};
+#action {~^%*轻轻地离开了。$CE}                         { move-log {%0} }{9.999};
+#action {~^%*不紧不慢地踱着步子离开了。$CE}             { move-log {%0} }{9.999};
+
+#action {~^%*一道身影出现在场间%*$CE}                   { move-log {%0} }{9.999};
+#action {~^%*人影飘了过来。$CE}                         { move-log {%0} }{9.999};
+#action {~^%*人影一闪就消失不见了。$CE}                 { move-log {%0} }{9.999};
+#action {~^%*一条人影从这里离开。$CE}                   { move-log {%0} }{9.999};
+
+#action {~^%*已经离开了这里。$CE}                       { move-log {%0} }{9.999};
+#action {~^%*疾步走了过来%*$CE}                         { move-log {%0} }{9.999};
+#action {~^%*快步离开%*气势也随之而散。$CE}             { move-log {%0} }{9.999};
+
+#action {~^%*一道人影轻轻地飘了过来。$CE}               { move-log {%0} }{9.999};
+#action {~^%*不经意间,只是人影一闪。$CE}               { move-log {%0} }{9.999};
+#action {~^%*杀意随着%*也离开了这里。$CE}               { move-log {%0} }{9.999};
+
+#action {~^%*将%*脱了下来。$CE}                         { move-log {%0} }{9.999};
+#action {~^%*将锦囊%*,放回怀中。$CE}                   { move-log {%0} }{9.999};
+#action {~^%*{穿|戴}上一%*。$CE}                        { move-log {%0} }{9.999};
+#action {~^%*丢下一%*。$CE}                             { move-log {%0} }{9.999};
+#action {~^%*装备%*。$CE}                               { move-log {%0} }{9.999};
+
+#action {~^%*脸色看起来好多了。$CE}                     { move-log {%0} }{9.999};
+#action {~^%*拿起%*咕噜噜地喝了几口%*。$CE}             { move-log {%0} }{9.999};
+#action {~^%*拿起%*咬了几口。$CE}                       { move-log {%0} }{9.999};
+
+#action {~^%*运行真气加速自身的气血恢复。$CE}           { move-log {%0} }{9.999};
+#action {~^%*减缓真气运行,让气血运行恢复正常。$CE}     { move-log {%0} }{9.999};
+
+#action {~^%*从陈旧的剑鞘中拔出一把%*握在手中。$CE}     { move-log {%0} }{9.999};
+#action {~^%*放下手中的%*。$CE}                         { move-log {%0} }{9.999};