Browse Source

fix(ui/tmux): 本地运行方式下,tmux UI 目录可能没有创建

另外一并纠正几处错误的事件名称
dzp 3 years ago
parent
commit
046c195101

+ 8 - 3
mud/pkuxkx/plugins/basic/char/gmcp.tin

@@ -70,7 +70,8 @@ event.Define {char/nofight} {无参} {$MODULE} {角色脱离战斗};
 #alias {char.gmcp.status} {
     #local busy     {};
     #local fight    {};
-    #local hasHP    {};
+    #local hasHP    {0};
+    #local hasScore {0};
 
     #local id {$gGMCP[Status][id]};
     #if { "$id" == "" } {
@@ -89,7 +90,7 @@ event.Define {char/nofight} {无参} {$MODULE} {角色脱离战斗};
 
         #local name {$gmcp-name-map[HP][$key]};
         #if { "$name" != "" } {
-            #local hasHP {true};
+            #local hasHP {1};
 
             #if { "$name" == "{当前.*|经验|潜能|食物|饮水}" } {
                 speedo.Set {$name} {$value} {true} {10};
@@ -135,6 +136,7 @@ event.Define {char/nofight} {无参} {$MODULE} {角色脱离战斗};
 
         #local name {$gmcp-name-map[档案][$key]};
         #if { "$name" != "" } {
+            #local hasScore {1};
             #if { "$name" == "{头衔|大名}" } {
                 #var char[档案][彩色$name] {$value};
                 #replace value {%+1..c} {};
@@ -148,6 +150,7 @@ event.Define {char/nofight} {无参} {$MODULE} {角色脱离战斗};
 
         #local name {$gmcp-name-map[天赋][$key]};
         #if { "$name" != "" } {
+            #local hasScore {1};
             #var char[档案][天赋][$name] {$value};
             #continue;
         };
@@ -155,11 +158,13 @@ event.Define {char/nofight} {无参} {$MODULE} {角色脱离战斗};
         warnLog 未能识别的 GMCP 状态信息 $key => $value;
     };
 
-    #if     { "$hasHP" == "true" }  {
+    #if     { $hasHP } {
         event.Emit char/hpbrief;
         #delay {gmcp.HPSummarize} {char.HPSummarize} {0};
     };
 
+    #if     { $hasScore }           {event.Emit char/score};
+
     #if     { "$busy" == "true" }   {event.Emit char/busy};
     #elseif { "$busy" == "false" }  {event.Emit char/nobusy};
 

+ 2 - 2
mud/pkuxkx/plugins/basic/char/score.tin

@@ -147,7 +147,7 @@
         #replace char[档案][年龄] {岁} {};
         #var char[档案][年龄] {@c2d{$char[档案][年龄]}};
 
-        event.Emit {char/status};
+        event.Emit {char/score};
     };
 
     #class char-score-parser close;
@@ -157,6 +157,6 @@ load-module {basic/title};
 
 load-lib event;
 
-event.Define {char/status} {无参} {$MODULE} {score 命令的数据解析成功时,发送本事件}
+event.Define {char/score} {无参} {$MODULE} {score 命令的数据解析成功时,发送本事件}
 
 score;

+ 5 - 1
plugins/lib/ui/tmux.tin

@@ -82,4 +82,8 @@
 
 load-lib event;
 
-event.Handle {char/status} {tmux} {ui} {tmux.UpdateCharData};
+#if { "@mkdir{{tmux/$user[id]}}" == "false" } {
+    errLog 创建 tmux UI 通信管道(tmux/$user[id])失败;
+};
+
+event.Handle {char/score} {tmux} {ui} {tmux.UpdateCharData};