diff --git a/modules/plunder/api_challenge.go b/modules/plunder/api_challenge.go index 6bf78125d..a2b9b4c81 100644 --- a/modules/plunder/api_challenge.go +++ b/modules/plunder/api_challenge.go @@ -58,7 +58,20 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PlunderChallen return } } - + if req.Pos >= int32(len(list.Line)) { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + return + } + if list.Line[req.Pos].Closetime == -1 { // 队列没解锁 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_PlunderLineUnlock, + Title: pb.ErrorCode_PlunderLineUnlock.ToString(), + } + return + } // 配置校验 if conf, err = this.module.configure.getGamePlunderDataById(list.Source[req.Index]); err != nil { errdata = &pb.ErrorData{ diff --git a/modules/plunder/api_challengeover.go b/modules/plunder/api_challengeover.go index 62eecab03..f0debd4ca 100644 --- a/modules/plunder/api_challengeover.go +++ b/modules/plunder/api_challengeover.go @@ -38,9 +38,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha shipData *pb.ShipData // 船 users []string update map[string]interface{} // + newShip map[string]*pb.ShipData ) update = make(map[string]interface{}) changExp = make(map[string]int32, 0) + newShip = make(map[string]*pb.ShipData, 0) if errdata = this.ChallengeOverCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } @@ -76,6 +78,20 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha } return } + if req.Pos >= int32(len(list.Line)) { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + return + } + if list.Line[req.Pos].Closetime == -1 { // 队列没解锁 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_PlunderLineUnlock, + Title: pb.ErrorCode_PlunderLineUnlock.ToString(), + } + return + } // 校验通过 errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report) if errdata != nil { @@ -116,11 +132,13 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha } list.Count++ update["count"] = list.Count - list.Line[req.Index].Oid = _id + + list.Line[req.Pos].Oid = _id update["line"] = list.Line list.Setout = append(list.Setout, req.Index) update["setout"] = list.Setout - + // 广播用 + newShip[_id] = shipData this.module.modelPlunder.changePlunderData(session.GetUserId(), update) // 此处需要redis 锁 land.Ship[_id] = shipData // 一条新船 @@ -130,7 +148,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha }) // 通知大家 this.module.SendMsgToUsers(string(this.module.GetType()), "change", &pb.PlunderChangePush{ - Ship: land.Ship, + Ship: newShip, }, users...) if battleConf.Carexe > 0 { var heroObjs []string @@ -162,7 +180,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha } session.SendMsg(string(this.module.GetType()), "challengeover", &pb.PlunderChallengeOverResp{ Line: list.Line, - Ship: map[string]*pb.ShipData{}, + Ship: land.Ship, Atno: atno, Heroexp: changExp, }) diff --git a/modules/plunder/api_reach.go b/modules/plunder/api_reach.go index 5b9f05384..759667259 100644 --- a/modules/plunder/api_reach.go +++ b/modules/plunder/api_reach.go @@ -22,8 +22,9 @@ func (this *apiComp) Reach(session comm.IUserSession, req *pb.PlunderReachReq) ( err error list *pb.DBPlunder land *pb.DBPlunderLand // 岛屿数据 + //changeShip map[string]*pb.ShipData // 变化的信息 ) - + //changeShip = make(map[string]*pb.ShipData, 0) if errdata = this.ReachCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 45ef88b66..f495f4947 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -473,6 +473,7 @@ const ( ErrorCode_TntegralDayMaxChallenge ErrorCode = 5301 // 当日挑战达上限 //plunder ErrorCode_PlunderNotFoundShip ErrorCode = 5401 // pvp 没找到数据 + ErrorCode_PlunderLineUnlock ErrorCode = 5402 // 队列没解锁 ) // Enum value maps for ErrorCode. @@ -881,6 +882,7 @@ var ( 5212: "EntertainNoSkillCard", 5301: "TntegralDayMaxChallenge", 5401: "PlunderNotFoundShip", + 5402: "PlunderLineUnlock", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -1286,6 +1288,7 @@ var ( "EntertainNoSkillCard": 5212, "TntegralDayMaxChallenge": 5301, "PlunderNotFoundShip": 5401, + "PlunderLineUnlock": 5402, } ) @@ -1320,7 +1323,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0x94, 0x4b, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xac, 0x4b, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, @@ -1921,8 +1924,9 @@ var file_errorcode_proto_rawDesc = []byte{ 0x12, 0x1c, 0x0a, 0x17, 0x54, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x79, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x10, 0xb5, 0x29, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, - 0x64, 0x53, 0x68, 0x69, 0x70, 0x10, 0x99, 0x2a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x53, 0x68, 0x69, 0x70, 0x10, 0x99, 0x2a, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x6c, 0x75, 0x6e, + 0x64, 0x65, 0x72, 0x4c, 0x69, 0x6e, 0x65, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x10, 0x9a, 0x2a, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (