mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 15:20:22 +00:00
优化钓鱼插件一些逻辑问题 (#726)
* Update main.go * Update pole.go * Update store.go * Update main.go * Update store.go * Update store.go
This commit is contained in:
@@ -385,6 +385,15 @@ func init() {
|
||||
}
|
||||
}
|
||||
|
||||
ok, err := dbdata.checkStoreFor(thing, number)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("[ERROR at store.go.11]:", err))
|
||||
return
|
||||
}
|
||||
if !ok {
|
||||
ctx.SendChain(message.Reply(ctx.Event.MessageID),message.Text("你慢了一步,物品被别人买走了"))
|
||||
return
|
||||
}
|
||||
thing.Number -= number
|
||||
err = dbdata.updateStoreInfo(thing)
|
||||
if err != nil {
|
||||
@@ -520,7 +529,7 @@ func drawStroeInfoImage(stroeInfo []store) (picImage image.Image, err error) {
|
||||
textDx, textDh := canvas.MeasureString("下界合金竿(均价1000)")
|
||||
valueDx, _ := canvas.MeasureString("+100%")
|
||||
i := 0
|
||||
for name, info := range discountList {
|
||||
for _, name := range thingList {
|
||||
text := name + "(均价" + strconv.Itoa(priceList[name]) + ") "
|
||||
|
||||
if i == 2 {
|
||||
@@ -529,12 +538,12 @@ func drawStroeInfoImage(stroeInfo []store) (picImage image.Image, err error) {
|
||||
}
|
||||
canvas.SetColor(color.Black)
|
||||
canvas.DrawStringAnchored(text, 20+(textDx+valueDx+10)*float64(i)+10, textDy+textDh/2, 0, 0.5)
|
||||
if info-100 > 0 {
|
||||
if discountList[name]-100 > 0 {
|
||||
canvas.SetRGBA255(200, 50, 50, 255)
|
||||
text = "+" + strconv.Itoa(info-100) + "%"
|
||||
text = "+" + strconv.Itoa(discountList[name]-100) + "%"
|
||||
} else {
|
||||
canvas.SetRGBA255(63, 133, 55, 255)
|
||||
text = strconv.Itoa(info-100) + "%"
|
||||
text = strconv.Itoa(discountList[name]-100) + "%"
|
||||
}
|
||||
canvas.DrawStringAnchored(text, 20+(textDx+valueDx+10)*float64(i)+10+textDx+10, textDy+textDh/2, 0, 0.5)
|
||||
i++
|
||||
|
||||
Reference in New Issue
Block a user