Skip to content

Commit

Permalink
Merge branch 'master' into banQuitGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
MX-fox authored Aug 13, 2024
2 parents 8ee1a95 + 3eea1e4 commit 00d5a0b
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 4 deletions.
8 changes: 8 additions & 0 deletions dice/builtin_commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,14 @@ func (d *Dice) registerCoreCommands() {
return CmdExecuteResult{Matched: true, Solved: true}
}

if !cmdArgs.AmIBeMentioned {
// 裸指令,如果当前群内开启,予以提示
if ctx.IsCurGroupBotOn {
ReplyToSender(ctx, msg, "[退群指令] 请@我使用这个命令,以进行确认")
}
return CmdExecuteResult{Matched: true, Solved: true}
}

ReplyToSender(ctx, msg, DiceFormatTmpl(ctx, "核心:骰子退群预告"))

userName := ctx.Dice.Parent.TryGetUserName(msg.Sender.UserID)
Expand Down
19 changes: 19 additions & 0 deletions dice/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,12 @@ func setupBaseTextTemplate(d *Dice) {
"受到伤害_进入昏迷_附加语": {
{`\n{$t玩家}遭受了{$t伤害点数}点过量伤害,生命值降至0,陷入了昏迷!`, 1},
},
"制卡_预设模式": {
{"{$t玩家}使用预设模板的DND5E人物作成:\n{$t制卡结果文本}", 1},
},
"制卡_自由分配模式": {
{"{$t玩家}使用自由分配的DND5E人物作成:\n{$t制卡结果文本}", 1},
},
"制卡_分隔符": {
{`\n`, 1},
},
Expand Down Expand Up @@ -1109,6 +1115,9 @@ func setupBaseTextTemplate(d *Dice) {
"名片_取消设置": {
{`已关闭对{$t玩家}的名片自动修改。`, 1},
},
"记录_导出_成功": {
{`日志文件《{$t文件名字}》已上传至群文件,请自行到群文件查看。`, 1},
},
},
}

Expand Down Expand Up @@ -1444,6 +1453,13 @@ func setupBaseTextTemplate(d *Dice) {
SubType: ".st hp-1d4",
ExtraText: "hp在st后从正数变为0",
},
"制卡_预设模式": {
SubType: ".dnd",
ExtraText: "不带属性名"},
"制卡_自由分配模式": {
SubType: ".dndx",
ExtraText: "带属性名",
},
},
"核心": {
"骰子名字": {
Expand Down Expand Up @@ -1837,6 +1853,9 @@ func setupBaseTextTemplate(d *Dice) {
"名片_取消设置": {
SubType: ".sn",
},
"记录_导出_成功": {
SubType: ".log export",
},
},
}
d.TextMapRaw = texts
Expand Down
9 changes: 5 additions & 4 deletions dice/ext_dnd5e.go
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,6 @@ func RegisterBuiltinExtDnd5e(self *Dice) {
break
}
result := r.ToString()

var nums Int64SliceDesc
total := int64(0)
for _, i := range strings.Split(result, ", ") {
Expand All @@ -1130,15 +1129,17 @@ func RegisterBuiltinExtDnd5e(self *Dice) {
}
sep := DiceFormatTmpl(ctx, "DND:制卡_分隔符")
info := strings.Join(ss, sep)
VarSetValueStr(ctx, "$t制卡结果文本", info)
var text string
if isMode2 {
ReplyToSender(ctx, msg, fmt.Sprintf("%s的DnD5e人物作成(预设模式):\n%s\n自由分配模式请用.dnd", getPlayerNameTempFunc(ctx), info))
text = DiceFormatTmpl(ctx, "DND:制卡_预设模式")
} else {
ReplyToSender(ctx, msg, fmt.Sprintf("%s的DnD5e人物作成(自由分配模式):\n%s\n获取带属性名的预设请用.dndx", getPlayerNameTempFunc(ctx), info))
text = DiceFormatTmpl(ctx, "DND:制卡_自由分配模式")
}
ReplyToSender(ctx, msg, text)
return CmdExecuteResult{Matched: true, Solved: true}
},
}

helpRi := `.ri 小明 // 格式1,值为D20
.ri 12 张三 // 格式2,值12(只能写数字)
.ri +2 李四 // 格式3,值为D20+2
Expand Down
2 changes: 2 additions & 0 deletions dice/ext_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,8 @@ func RegisterBuiltinExtLog(self *Dice) {
uri = "files://" + logFile.Name()
}
SendFileToSenderRaw(ctx, msg, uri, "skip")
VarSetValueStr(ctx, "$t文件名字", logFileNamePrefix)
ReplyToSenderRaw(ctx, msg, DiceFormatTmpl(ctx, "日志:记录_导出_成功"), "skip")
return CmdExecuteResult{Matched: true, Solved: true}
} else {
return CmdExecuteResult{Matched: true, Solved: true, ShowHelp: true}
Expand Down

0 comments on commit 00d5a0b

Please sign in to comment.