上传测试服代码

This commit is contained in:
liwei1dao 2023-03-13 19:18:06 +08:00
parent 5215d99828
commit 2ebaa538ae
5 changed files with 10 additions and 11 deletions

View File

@ -269,7 +269,7 @@ func (this *Battle) CreateRolesByHeros(heros []*pb.DBHero) (roles []*pb.BattleRo
roles = make([]*pb.BattleRole, len(heros)) roles = make([]*pb.BattleRole, len(heros))
for i, v := range heros { for i, v := range heros {
if v != nil { if v != nil {
if roles[i], code = this.modelBattle.createBattleRole(v, 100+i, i); code != pb.ErrorCode_Success { if roles[i], code = this.modelBattle.createBattleRole(v, 200+i, i); code != pb.ErrorCode_Success {
return return
} }
} }

View File

@ -31,6 +31,6 @@ func (this *apiComp) GymInfo(session comm.IUserSession, req *pb.PracticeGymInfoR
"gymrefresh": room.Gymrefresh, "gymrefresh": room.Gymrefresh,
}) })
} }
session.SendMsg(string(this.module.GetType()), "confirm", &pb.PracticeGymInfoResp{Lastaction: room.Gymaction, Refreshnum: room.Gymrefresh}) session.SendMsg(string(this.module.GetType()), "gymInfo", &pb.PracticeGymInfoResp{Lastaction: room.Gymaction, Refreshnum: room.Gymrefresh})
return return
} }

View File

@ -57,6 +57,6 @@ func (this *apiComp) GymRefresh(session comm.IUserSession, req *pb.PracticeGymRe
"gymrefresh": room.Gymrefresh, "gymrefresh": room.Gymrefresh,
"lastrefresh": room.Lastrefresh, "lastrefresh": room.Lastrefresh,
}) })
session.SendMsg(string(this.module.GetType()), "confirm", &pb.PracticeGymRefreshResp{Lastaction: room.Gymaction, Refreshnum: room.Gymrefresh}) session.SendMsg(string(this.module.GetType()), "gymrefresh", &pb.PracticeGymRefreshResp{Lastaction: room.Gymaction, Refreshnum: room.Gymrefresh})
return return
} }

View File

@ -33,7 +33,7 @@ func (this *apiComp) NPCBattkle(session comm.IUserSession, req *pb.PracticeNPCBa
}); code != pb.ErrorCode_Success { }); code != pb.ErrorCode_Success {
return return
} }
session.SendMsg(string(this.module.GetType()), "npcbattkle", &pb.MoonfantasyBattleResp{ session.SendMsg(string(this.module.GetType()), "npcbattkle", &pb.PracticeNPCBattkleResp{
Info: &pb.BattleInfo{ Info: &pb.BattleInfo{
Id: record.Id, Id: record.Id,
Title: record.Title, Title: record.Title,

View File

@ -21,22 +21,21 @@ func (this *apiComp) NPCBattkleFinish(session comm.IUserSession, req *pb.Practic
err error err error
room *pb.DBPracticeRoom room *pb.DBPracticeRoom
conf *cfg.GameDispatch_BattleData conf *cfg.GameDispatch_BattleData
iswin bool
) )
if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil { if room, err = this.module.modelPandata.queryUserMartialhall(session.GetUserId()); err != nil {
code = pb.ErrorCode_DBError code = pb.ErrorCode_DBError
return return
} }
if room.Npcstate != 2 { if room.Npcstate == 2 || room.Npcstate == 3 {
code = pb.ErrorCode_ReqParameterError code = pb.ErrorCode_ReqParameterError
return return
} }
if code, iswin = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success { if code, _ = this.module.battle.CheckBattleReport(session, req.Report); code != pb.ErrorCode_Success {
return return
} }
if iswin { if req.Report.WinSide == 1 {
room.Npcstate = 2 room.Npcstate = 2
if conf, err = this.module.configure.getDispatchBattleData(room.Currnpc); err != nil { if conf, err = this.module.configure.getDispatchBattleData(room.Currnpc); err != nil {
code = pb.ErrorCode_ConfigNoFound code = pb.ErrorCode_ConfigNoFound