go_dreamfactory/cmd/robot/hero.go
2022-07-07 15:07:06 +08:00

78 lines
1.7 KiB
Go

package robot
import (
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/modules/hero"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
var (
//hero
heroBuilders = []*TestCase{
{
Desc: "英雄列表",
mainType: string(comm.ModuleHero),
subType: hero.HeroSubTypeList,
req: &pb.HeroListReq{},
rsp: &pb.HeroListResp{},
print: func(rsp proto.Message) {
out := rsp.(*pb.HeroListResp)
for i, v := range out.List {
fmt.Printf("%d- %v\n", (i + 1), v)
}
},
enabled: true,
}, {
Desc: "英雄详情",
mainType: string(comm.ModuleHero),
subType: hero.HeroSubTypeInfo,
req: &pb.HeroInfoReq{
HeroId: "62c676d57deea8b9af8884a5",
},
rsp: &pb.HeroInfoResp{},
// enabled: true,
}, {
Desc: "抽卡",
mainType: string(comm.ModuleHero),
subType: hero.HeroSubTypeChouka,
req: &pb.HeroChoukaReq{
HeroIds: []int32{42911},
},
rsp: &pb.HeroChoukaResp{},
// enabled: true,
}, {
mainType: string(comm.ModuleHero),
subType: hero.StrengthenUpStar,
req: &pb.HeroStrengthenUpStarReq{
HeroObjID: "62bd0489ff6632434a7d0d1f",
Hero: []*pb.CostCardData{
{
CostCardObj: "",
},
},
},
rsp: &pb.HeroStrengthenUpStarResp{},
// enabled: true,
}, {
mainType: string(comm.ModuleHero),
subType: hero.StrengthenUplv,
req: &pb.HeroStrengthenUplvReq{
HeroObjID: "62bd0489ff6632434a7d0d1f",
ExpCardID: "62bd0b4eca37634b8230d4be",
Amount: 1,
},
rsp: &pb.HeroStrengthenUplvResp{},
// enabled: true,
},
}
)
//声明加入到构建器并发起请求
func (r *Robot) RunHero() {
r.addBuilders(heroBuilders)
r.handleReq()
}