Merge branch 'master' of http://git.legu.cc/zhaochangyuan/airobot
This commit is contained in:
commit
a5d2426328
@ -58,7 +58,7 @@ func (f *ArenaScene) Run(ai lib.IRobot) (err error) {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second * 5)
|
||||
Sleep(time.Second*3, time.Second*5)
|
||||
if code = ai.SendMsg("arena", "challengereward", &pb.ArenaChallengeRewardReq{
|
||||
Iswin: true,
|
||||
Isai: v.Isai,
|
||||
@ -74,7 +74,7 @@ func (f *ArenaScene) Run(ai lib.IRobot) (err error) {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second * 2)
|
||||
Sleep(time.Second*1, time.Second*3)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func (f *ChatScene) Run(ai lib.IRobot) (err error) {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
time.Sleep(time.Second * 1)
|
||||
Sleep(time.Second*1, time.Second*3)
|
||||
}
|
||||
}
|
||||
|
||||
|
12
busi/core.go
Normal file
12
busi/core.go
Normal file
@ -0,0 +1,12 @@
|
||||
package busi
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"time"
|
||||
)
|
||||
|
||||
func Sleep(min, max time.Duration) {
|
||||
ulit := int64(max - min)
|
||||
t := time.Duration(rand.Int63n(ulit)) + min
|
||||
time.Sleep(t)
|
||||
}
|
61
busi/hero.go
61
busi/hero.go
@ -1,6 +1,7 @@
|
||||
package busi
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
"legu.airobot/lib"
|
||||
@ -58,6 +59,11 @@ func (f *HeroScene) Run(robot lib.IRobot) error {
|
||||
f.AddHero(robot, "25004") // 加英雄
|
||||
f.AddHero(robot, "25004") // 加英雄
|
||||
f.AddHero(robot, "25004") // 加英雄
|
||||
f.HeroFusion(robot)
|
||||
|
||||
f.AddItem(robot, "525001")
|
||||
f.HeroTalent(robot)
|
||||
f.HeroTalentV2(robot) // 学习其他天赋
|
||||
return nil
|
||||
}
|
||||
|
||||
@ -245,6 +251,9 @@ func (f *HeroScene) HeroStarUp(robot lib.IRobot) error {
|
||||
break
|
||||
}
|
||||
}
|
||||
if lvcard == nil {
|
||||
return errors.New("data")
|
||||
}
|
||||
// 升星
|
||||
starReq := &pb.HeroStrengthenUpStarReq{
|
||||
HeroObjID: lvcard.Id,
|
||||
@ -440,3 +449,55 @@ func (f *HeroScene) HerouseEnegry(robot lib.IRobot) error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// 天赋压测
|
||||
func (f *HeroScene) HeroTalent(robot lib.IRobot) error {
|
||||
var (
|
||||
code pb.ErrorCode
|
||||
)
|
||||
talentReq := &pb.HeroTalentLearnReq{
|
||||
TalentID: 1,
|
||||
ObjId: "",
|
||||
Heroid: "25001",
|
||||
}
|
||||
|
||||
talentResp := &pb.HeroTalentLearnResp{}
|
||||
code = robot.SendMsg("hero", "talentlearn", talentReq, talentResp)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// 学习其他天赋
|
||||
func (f *HeroScene) HeroTalentV2(robot lib.IRobot) error {
|
||||
var (
|
||||
code pb.ErrorCode
|
||||
obj string
|
||||
)
|
||||
listReq := &pb.HeroTalentListReq{}
|
||||
listResp := &pb.HeroTalentListResp{}
|
||||
code = robot.SendMsg("hero", "talentlist", listReq, listResp)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return nil
|
||||
}
|
||||
for _, v := range listResp.Telnet {
|
||||
if v.Id != "" {
|
||||
obj = v.Id
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
talentReq := &pb.HeroTalentLearnReq{
|
||||
TalentID: 2,
|
||||
ObjId: obj,
|
||||
Heroid: "",
|
||||
}
|
||||
|
||||
talentResp := &pb.HeroTalentLearnResp{}
|
||||
code = robot.SendMsg("hero", "talentlearn", talentReq, talentResp)
|
||||
if code != pb.ErrorCode_Success {
|
||||
return nil
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
80
busi/mfantasy.go
Normal file
80
busi/mfantasy.go
Normal file
@ -0,0 +1,80 @@
|
||||
package busi
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"legu.airobot/lib"
|
||||
"legu.airobot/pb"
|
||||
)
|
||||
|
||||
//竞技场场景
|
||||
|
||||
var _ lib.IScene = (*MfantasyScene)(nil)
|
||||
|
||||
type MfantasyScene struct {
|
||||
lib.Action
|
||||
}
|
||||
|
||||
func (f *MfantasyScene) Info() lib.SceneInfo {
|
||||
return lib.SceneInfo{
|
||||
Name: "秘境",
|
||||
Desc: "秘境测试",
|
||||
}
|
||||
}
|
||||
|
||||
func (f *MfantasyScene) Run(ai lib.IRobot) (err error) {
|
||||
var (
|
||||
code pb.ErrorCode
|
||||
herolistrsp *pb.HeroListResp
|
||||
mflist *pb.MoonfantasyGetListResp = &pb.MoonfantasyGetListResp{}
|
||||
battlereq *pb.MoonfantasyBattleResp = &pb.MoonfantasyBattleResp{}
|
||||
)
|
||||
|
||||
if herolist := ai.Get("hero.list"); herolist == nil {
|
||||
ai.Stop()
|
||||
return
|
||||
} else {
|
||||
herolistrsp = herolist.(*pb.HeroListResp)
|
||||
if herolistrsp.List == nil || len(herolistrsp.List) == 0 {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
if code = ai.SendMsg("gm", "cmd", &pb.GMCmdReq{
|
||||
Cmod: "bingo:moon,1",
|
||||
}, &pb.GMCmdResp{}); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
}
|
||||
|
||||
if code = ai.SendMsg("moonfantasy", "getlist", &pb.MoonfantasyGetListReq{}, mflist); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
}
|
||||
|
||||
for _, v := range mflist.Dfantasys {
|
||||
if code = ai.SendMsg("moonfantasy", "battle", &pb.MoonfantasyBattleReq{
|
||||
Mid: v.Monster,
|
||||
Battle: &pb.BattleFormation{
|
||||
Leadpos: 0,
|
||||
Format: []string{herolistrsp.List[0].Id},
|
||||
},
|
||||
}, battlereq); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
}
|
||||
Sleep(time.Second*3, time.Second*5)
|
||||
if code = ai.SendMsg("moonfantasy", "receive", &pb.MoonfantasyReceiveReq{
|
||||
Report: &pb.BattleReport{
|
||||
Info: battlereq.Info,
|
||||
Costtime: 1,
|
||||
Process: []byte{123},
|
||||
Completetask: []int32{},
|
||||
},
|
||||
}, &pb.MoonfantasyReceiveResp{}); code != pb.ErrorCode_Success {
|
||||
ai.Stop()
|
||||
return
|
||||
}
|
||||
Sleep(time.Second, time.Second*3)
|
||||
}
|
||||
|
||||
return
|
||||
}
|
Loading…
Reference in New Issue
Block a user