mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2025-12-19 22:00:11 +08:00
fix(mcfish): 鱼竿Number大于1,合成时少鱼竿的情况 (#947)
合成鱼竿未考虑鱼竿articles.Number>1的情况。 如果要修复这个问题,需要重构这块代码 所以梭哈功能直接按照原有思路,生成多个Number=1的鱼竿。
This commit is contained in:
parent
4ffa18c511
commit
f6ef326495
@ -383,7 +383,7 @@ func init() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
list := []int{0, 1, 2}
|
list := []int{0, 1, 2}
|
||||||
// 可以用于合成的鱼竿数量(取3的倍数)
|
// 可以用于合成的鱼竿数量(取3的倍数),note:此处未对article.Number>1的情况做处理
|
||||||
upgradeNum := (len(articles) / 3) * 3
|
upgradeNum := (len(articles) / 3) * 3
|
||||||
check := false
|
check := false
|
||||||
if len(articles) > 3 {
|
if len(articles) > 3 {
|
||||||
@ -485,17 +485,22 @@ func init() {
|
|||||||
Duration: time.Now().Unix(),
|
Duration: time.Now().Unix(),
|
||||||
Type: "pole",
|
Type: "pole",
|
||||||
Name: thingName,
|
Name: thingName,
|
||||||
Number: upgradeNum / 3,
|
Number: 1,
|
||||||
Other: attribute,
|
Other: attribute,
|
||||||
}
|
}
|
||||||
err = dbdata.updateUserThingInfo(uid, newthing)
|
// 代码未对article.Number>1的情况做处理,直接生成多个Number=1的鱼竿
|
||||||
if err != nil {
|
for i := 0; i < upgradeNum/3; i++ {
|
||||||
ctx.SendChain(message.Text("[ERROR at pole.go.12]:", err))
|
// 使用时间戳作为主键,增加固定值避免主键冲突
|
||||||
return
|
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(
|
ctx.Send(
|
||||||
message.ReplyWithMessage(ctx.Event.MessageID,
|
message.ReplyWithMessage(ctx.Event.MessageID,
|
||||||
message.Text("成功合成", upgradeNum/3, "个", thingName, "\n属性: ", attribute),
|
message.Text("成功合成:", upgradeNum/3, "个", thingName, "\n属性: ", attribute),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user