feat: 添加扭蛋物品和扭蛋精灵查询指令
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
All checks were successful
ci/woodpecker/push/my-first-workflow Pipeline was successful
This commit is contained in:
40
modules/config/controller/robot/eggitem.go
Normal file
40
modules/config/controller/robot/eggitem.go
Normal file
@@ -0,0 +1,40 @@
|
||||
package robot
|
||||
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/modules/config/service"
|
||||
"strings"
|
||||
|
||||
"github.com/gogf/gf/v2/util/gconv"
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
)
|
||||
|
||||
func init() {
|
||||
zero.OnCommand("扭蛋物品").
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
|
||||
msgs := strings.Fields(ctx.Event.Message.String())
|
||||
count := 1
|
||||
if len(msgs) > 1 {
|
||||
count = gconv.Int(msgs[1])
|
||||
|
||||
}
|
||||
if count > 10 {
|
||||
count = 10
|
||||
}
|
||||
var rets []string
|
||||
for _, v := range service.NewItemService().GetEgg(int64(count)) {
|
||||
if v.ItemId == 0 {
|
||||
continue
|
||||
}
|
||||
var buf strings.Builder
|
||||
buf.WriteString(xmlres.ItemsMAP[int(v.ItemId)].Name)
|
||||
buf.WriteString(": " + gconv.String(v.ItemCnt))
|
||||
// 你想加什么格式自己加
|
||||
rets = append(rets, buf.String())
|
||||
|
||||
}
|
||||
|
||||
ctx.Send(strings.Join(rets, "\n"))
|
||||
})
|
||||
}
|
||||
24
modules/config/controller/robot/eggpet.go
Normal file
24
modules/config/controller/robot/eggpet.go
Normal file
@@ -0,0 +1,24 @@
|
||||
package robot
|
||||
|
||||
import (
|
||||
"blazing/common/data/xmlres"
|
||||
"blazing/modules/config/service"
|
||||
"strings"
|
||||
|
||||
zero "github.com/wdvxdr1123/ZeroBot"
|
||||
)
|
||||
|
||||
func init() {
|
||||
zero.OnCommand("扭蛋精灵").
|
||||
Handle(func(ctx *zero.Ctx) {
|
||||
|
||||
var cdks []string
|
||||
for _, v := range service.NewPetRewardService().AllEgg() {
|
||||
|
||||
cdks = append(cdks, xmlres.PetMAP[int(v.MonID)].DefName)
|
||||
|
||||
}
|
||||
|
||||
ctx.Send(strings.Join(cdks, "\n"))
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user