Skip to content

[mcfish] 修复鱼竿Number大于1,合成时少鱼竿的情况 #947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions plugin/mcfish/pole.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ func init() {
})
}
list := []int{0, 1, 2}
// 可以用于合成的鱼竿数量(取3的倍数)
// 可以用于合成的鱼竿数量(取3的倍数),note:此处未对article.Number>1的情况做处理
upgradeNum := (len(articles) / 3) * 3
check := false
if len(articles) > 3 {
Expand Down Expand Up @@ -485,17 +485,22 @@ func init() {
Duration: time.Now().Unix(),
Type: "pole",
Name: thingName,
Number: upgradeNum / 3,
Number: 1,
Other: attribute,
}
err = dbdata.updateUserThingInfo(uid, newthing)
if err != nil {
ctx.SendChain(message.Text("[ERROR at pole.go.12]:", err))
return
// 代码未对article.Number>1的情况做处理,直接生成多个Number=1的鱼竿
for i := 0; i < upgradeNum/3; i++ {
// 使用时间戳作为主键,增加固定值避免主键冲突
newthing.Duration += int64(i * 10)
err = dbdata.updateUserThingInfo(uid, newthing)
if err != nil {
ctx.SendChain(message.Text("[ERROR at pole.go.12]:", err))
return
}
}
ctx.Send(
message.ReplyWithMessage(ctx.Event.MessageID,
message.Text("成功合成", upgradeNum/3, "个", thingName, "\n属性: ", attribute),
message.Text("成功合成", upgradeNum/3, "个", thingName, "\n属性: ", attribute),
),
)
})
Expand Down
Loading