From d5189ea101ba734c28d669b1d71576c510fa238f Mon Sep 17 00:00:00 2001 From: MX-fox <1009592348@qq.com> Date: Tue, 13 Aug 2024 10:00:09 +0800 Subject: [PATCH] as review --- dice/config.go | 24 ++++++------------------ dice/ext_log.go | 23 ++++++++++++++--------- 2 files changed, 20 insertions(+), 27 deletions(-) diff --git a/dice/config.go b/dice/config.go index b8699b32..c9f98c68 100644 --- a/dice/config.go +++ b/dice/config.go @@ -1103,17 +1103,11 @@ func setupBaseTextTemplate(d *Dice) { {`跑团日志上传失败:{$t错误原因}\n若未出现线上日志地址,可换时间重试,或联系骰主在data/default/log-exports路径下取出日志\n文件名: 群号_日志名_随机数.zip\n注意此文件log end/get后才会生成`, 1}, }, // 1.5.0+ - "名片_coc": { - {`已自动设置名片为COC7格式: {$t名片格式}\n如有权限会持续自动改名片。使用.sn off可关闭`, 1}, + "名片_规则模板": { + {`已自动设置名片格式为{$t名片格式}:{$t名片预览}\n如有权限会在属性更新时自动更新名片。使用.sn off可关闭。`, 1}, }, - "名片_dnd": { - {`已自动设置名片为DND5E格式: {$t名片格式}\n如有权限会持续自动改名片。使用.sn off可关闭`, 1}, - }, - "名片_none": { - {`已自动设置名片为空白格式: {$t名片格式}\n如有权限会持续自动改名片。使用.sn off可关闭`, 1}, - }, - "名片_expr": { - {`应用玩家自设,预览文本: {$t名片格式}`, 1}, + "名片_玩家自设": { + {`应用玩家自设,预览文本: {$t名片预览}`, 1}, }, }, } @@ -1837,16 +1831,10 @@ func setupBaseTextTemplate(d *Dice) { }, // 1.5.0+ - "名片_coc": { - SubType: ".sn", - }, - "名片_dnd": { - SubType: ".sn", - }, - "名片_none": { + "名片_规则模板": { SubType: ".sn", }, - "名片_expr": { + "名片_玩家自设": { SubType: ".sn", }, }, diff --git a/dice/ext_log.go b/dice/ext_log.go index d2bb0071..c63fd01b 100644 --- a/dice/ext_log.go +++ b/dice/ext_log.go @@ -613,9 +613,10 @@ func RegisterBuiltinExtLog(self *Dice) { if errors.Is(err, ErrGroupCardOverlong) { return handleOverlong(ctx, msg, text) } - VarSetValueStr(ctx, "$t名片格式", text) + VarSetValueStr(ctx, "$t名片格式", val) + VarSetValueStr(ctx, "$t名片预览", text) // 玩家 SAN60 HP10/10 DEX65 - ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_coc")) + ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_规则模板")) case "dnd", "dnd5e": // PW{pw} ctx.Player.AutoSetNameTemplate = "{$t玩家_RAW} HP{hp}/{hpmax} AC{ac} DC{dc} PP{pp}" @@ -624,9 +625,10 @@ func RegisterBuiltinExtLog(self *Dice) { if errors.Is(err, ErrGroupCardOverlong) { return handleOverlong(ctx, msg, text) } - VarSetValueStr(ctx, "$t名片格式", text) + VarSetValueStr(ctx, "$t名片格式", val) + VarSetValueStr(ctx, "$t名片预览", text) // 玩家 HP10/10 AC15 DC15 PW10 - ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_dnd")) + ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_规则模板")) case "none": ctx.Player.AutoSetNameTemplate = "{$t玩家_RAW}" ctx.Player.UpdatedAtTime = time.Now().Unix() @@ -634,8 +636,9 @@ func RegisterBuiltinExtLog(self *Dice) { if errors.Is(err, ErrGroupCardOverlong) { // 大约不至于会走到这里,但是为了统一也这样写了 return handleOverlong(ctx, msg, text) } - VarSetValueStr(ctx, "$t名片格式", text) - ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_none")) + VarSetValueStr(ctx, "$t名片格式", val) + VarSetValueStr(ctx, "$t名片预览", text) + ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_规则模板")) case "off", "cancel": _, _ = SetPlayerGroupCardByTemplate(ctx, "{$t玩家_RAW}") ctx.Player.AutoSetNameTemplate = "" @@ -662,8 +665,8 @@ func RegisterBuiltinExtLog(self *Dice) { return handleOverlong(ctx, msg, text) } else { ctx.Player.UpdatedAtTime = time.Now().Unix() - VarSetValueStr(ctx, "$t名片格式", text) - ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_expr")) + VarSetValueStr(ctx, "$t名片预览", text) + ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_玩家自设")) } } default: @@ -683,7 +686,9 @@ func RegisterBuiltinExtLog(self *Dice) { text, _ := SetPlayerGroupCardByTemplate(ctx, t.Template) ctx.Player.AutoSetNameTemplate = t.Template - ReplyToSender(ctx, msg, "已自动设置名片为"+val+"格式: "+text+"\n如有权限会持续自动改名片。使用.sn off可关闭") + VarSetValueStr(ctx, "$t名片格式", val) + VarSetValueStr(ctx, "$t名片预览", text) + ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "日志:名片_规则模板")) ok = true return false })