战斗指令不走通用 错误返回

This commit is contained in:
liwei1dao 2023-04-12 10:32:29 +08:00
parent 5fbd68322b
commit 305ab73d64

View File

@ -20,8 +20,14 @@ func (this *apiComp) InCmd(session comm.IUserSession, req *pb.PvpInCmdReq) (code
battle *BattleItem
side int32
ok bool
cd pb.ErrorCode
)
if code = this.InCmdCheck(session, req); code != pb.ErrorCode_Success {
defer func() {
session.SendMsg(string(this.module.GetType()), "incmd", &pb.PvpInCmdResp{Code: cd, Battleid: req.Battleid, Cmd: req.Cmd})
}()
if cd = this.InCmdCheck(session, req); cd != pb.ErrorCode_Success {
return
}
this.module.lock.RLock()
@ -46,11 +52,11 @@ func (this *apiComp) InCmd(session comm.IUserSession, req *pb.PvpInCmdReq) (code
return
}
//技能释放指令
if code = this.module.battle.InCmdBattle(&pb.BattleInCmdReq{
if cd = this.module.battle.InCmdBattle(&pb.BattleInCmdReq{
Battleid: req.Battleid,
Side: side,
In: req.Cmd,
}); code != pb.ErrorCode_Success {
}); cd != pb.ErrorCode_Success {
return
} else {
if battle.operatetimer != nil {
@ -58,9 +64,9 @@ func (this *apiComp) InCmd(session comm.IUserSession, req *pb.PvpInCmdReq) (code
}
}
} else {
code = pb.ErrorCode_BattleInCmdFailed
cd = pb.ErrorCode_BattleInCmdFailed
return
}
session.SendMsg(string(this.module.GetType()), "incmd", &pb.PvpInCmdResp{Battleid: req.Battleid, Cmd: req.Cmd})
return
}