mirror of
https://github.com/FloatTech/ZeroBot-Plugin.git
synced 2026-02-06 15:20:22 +00:00
[mcfish] Add one click selling (#894)
* [mcfish] Add one click selling Add one click waste selling function to mcfish plugin 给mcfish 添加一键售卖垃圾功能 * 🔖 v1.7.8 * chore: del aipaint due to 过气 * chore: del baidu due to 使えない * chore: del cangtoushi due to 使えない * chore: del dress due to 删库 * chore: del heisi due to 跑路 * chore: del jiami due to 跑路 * chore: del jiuejuezi due to 跑路 * chore: del quan due to 跑路 * chore: del wangyiyun due to 跑路 * chore: del wenben due to 跑路 * fix: atri 早安 conflict with sleep_manage & add 回应表情 * fix: version limit * fix: version limit * fix: version limit * chore: update deps * fix(searcher): forward node * 💩👌 make lint happy * revert: fix(searcher): forward node * fix(github): get api method * chore: del imgfinder due to 跑路 * optimize: saucenao head * chore: tidy * chore: del vtbxxx due to 跑路 * fix(drawlots): draw gif noise * fix(emojimix): connection issue in some regions * 💩👌 make lint happy * fix(drawlots): draw gif noise * fix(emojimix): add more logs * feat: add uwu logo * optimize: README uwu icon * chore: update deps * optimize: 赞我 触发失败时静默 * fix: update img pool * fix: imgpool on LLOB * fix(manager): 回应表情 * ✨ 修复b站小程序解析 (#895) * add control for saucenao & bilibili_parse (#839) * add control for saucenao&bilibili_parse * not only group * update control * reuse variables --------- Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com> * fix(bilibili): parse config * fix(manager): 撤回 * fix: reply face * fix: reply face * 💩👌 make lint happy * feat: add option `-mirror` * chore: update deps * chore: update deps * chore: update deps * chore: update deps * chore: update deps * chore: update deps * chore: update deps * 🔖 v1.8.0 * revert: emojimix http2 * 📝 update README * [mcfish] Add one click selling Add one click waste selling function to mcfish plugin 给mcfish 添加一键售卖垃圾功能 * Update robbery plugin Update robbery plugin 修改打劫功能 --------- Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com> Co-authored-by: himawari <54976075+guohuiyuan@users.noreply.github.com> Co-authored-by: 莫思潋 <55676105+shudorcl@users.noreply.github.com>
This commit is contained in:
@@ -306,6 +306,77 @@ func init() {
|
||||
}
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("出售成功,你赚到了", pice*number, msg)))
|
||||
})
|
||||
engine.OnRegex(`^出售所有垃圾`, getdb, refreshFish).SetBlock(true).Limit(limitSet).Handle(func(ctx *zero.Ctx) {
|
||||
uid := ctx.Event.UserID
|
||||
|
||||
articles, err := dbdata.getUserTypeInfo(uid, "waste")
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("[ERROR]:获取背包信息错误", err))
|
||||
return
|
||||
}
|
||||
if len(articles) == 0 {
|
||||
ctx.SendChain(message.Text("你的背包不存在该物品"))
|
||||
return
|
||||
}
|
||||
if len(articles) > 1 {
|
||||
msg := make(message.Message, 0, 3+len(articles))
|
||||
msg = append(msg, message.Reply(ctx.Event.MessageID), message.Text("找到以下物品:\n"))
|
||||
for i, info := range articles {
|
||||
msg = append(msg, message.Text(
|
||||
"[", i, "]", info.Name, " 数量: ", info.Number, "\n"))
|
||||
}
|
||||
ctx.Send(msg)
|
||||
}
|
||||
|
||||
pice := 0
|
||||
for _, info := range articles {
|
||||
pice += (priceList[info.Name] * discountList[info.Name] / 100) * info.Number * 8 / 10
|
||||
}
|
||||
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("是否接受商店将以", pice, "收购全部垃圾", "?\n回答\"是\"或\"否\"")))
|
||||
// 等待用户下一步选择
|
||||
recv, cancel1 := zero.NewFutureEvent("message", 999, false, zero.RegexRule(`^(是|否)$`), zero.CheckUser(ctx.Event.UserID)).Repeat()
|
||||
defer cancel1()
|
||||
buy := false
|
||||
for {
|
||||
select {
|
||||
case <-time.After(time.Second * 60):
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("等待超时,取消钓鱼")))
|
||||
return
|
||||
case e := <-recv:
|
||||
nextcmd := e.Event.Message.String()
|
||||
if nextcmd == "否" {
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("已取消出售")))
|
||||
return
|
||||
}
|
||||
buy = true
|
||||
}
|
||||
if buy {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
msg := ""
|
||||
curse, err := dbdata.getNumberFor(uid, "宝藏诅咒")
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("[ERROR at store.go.9.3]:", err))
|
||||
return
|
||||
}
|
||||
if curse != 0 {
|
||||
msg = "\n(你身上绑定了" + strconv.Itoa(curse) + "层诅咒)"
|
||||
pice = pice * (100 - 10*curse) / 100
|
||||
}
|
||||
|
||||
for _, info := range articles {
|
||||
info.Number = 0
|
||||
err = dbdata.updateUserThingInfo(uid, info)
|
||||
if err != nil {
|
||||
ctx.SendChain(message.Text("[ERROR at store.go.6]:", err))
|
||||
return
|
||||
}
|
||||
}
|
||||
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("出售成功,你赚到了", pice, msg)))
|
||||
})
|
||||
engine.OnRegex(`^购买(`+strings.Join(thingList, "|")+`)\s*(\d*)$`, getdb, refreshFish).SetBlock(true).Limit(limitSet).Handle(func(ctx *zero.Ctx) {
|
||||
uid := ctx.Event.UserID
|
||||
numberOfPole, err := dbdata.getNumberFor(uid, "竿")
|
||||
|
||||
Reference in New Issue
Block a user