上传代码

This commit is contained in:
liwei 2023-07-04 18:30:31 +08:00
parent 92a08ee808
commit a0c07187a2

View File

@ -137,19 +137,22 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
return return
} }
room.Knapsack[req.Teacher].Usenum++ room.Knapsack[req.Teacher].Usenum++
if tconfigure.Race != heroconf.Race { room.Knapsack[req.Teacher].Lastusetime = configure.Now().Unix()
if tconfigure.Race != 0 && tconfigure.Race != heroconf.Race {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
Message: fmt.Sprintf("the teacher race:%d and the herorace:%d is race no can use", tconfigure.Race, heroconf.Race), Message: fmt.Sprintf("the teacher race:%d and the herorace:%d is race no can use", tconfigure.Race, heroconf.Race),
} }
return
} }
if tconfigure.Job != heroconf.Job { if tconfigure.Job != 0 && tconfigure.Job != heroconf.Job {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
Message: fmt.Sprintf("the teacher job:%d and the hero job:%d is race no can use", tconfigure.Job, heroconf.Job), Message: fmt.Sprintf("the teacher job:%d and the hero job:%d is race no can use", tconfigure.Job, heroconf.Job),
} }
return
} }
if tconfigure.BanHero == hero.HeroID { //禁止使用 if tconfigure.BanHero == hero.HeroID { //禁止使用
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
@ -181,7 +184,7 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
} }
if !utils.IsToday(room.Knapsack[req.Prop].Lastusetime) { if !utils.IsToday(room.Knapsack[req.Prop].Lastusetime) {
room.Knapsack[req.Teacher].Usenum = 0 room.Knapsack[req.Prop].Usenum = 0
} }
if room.Knapsack[req.Prop].Usenum >= tconfigure.Limitation { if room.Knapsack[req.Prop].Usenum >= tconfigure.Limitation {
@ -193,20 +196,22 @@ func (this *apiComp) Practice(session comm.IUserSession, req *pb.PracticePractic
return return
} }
room.Knapsack[req.Prop].Usenum++ room.Knapsack[req.Prop].Usenum++
room.Knapsack[req.Prop].Lastusetime = configure.Now().Unix()
if pconfigure.Race != heroconf.Race { if pconfigure.Race != 0 && pconfigure.Race != heroconf.Race {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
Message: fmt.Sprintf("the teacher race:%d and the herorace:%d is race no can use", tconfigure.Race, heroconf.Race), Message: fmt.Sprintf("the teacher race:%d and the herorace:%d is race no can use", tconfigure.Race, heroconf.Race),
} }
return
} }
if pconfigure.Job != heroconf.Job { if pconfigure.Job != 0 && pconfigure.Job != heroconf.Job {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
Code: pb.ErrorCode_ReqParameterError, Code: pb.ErrorCode_ReqParameterError,
Title: pb.ErrorCode_ReqParameterError.ToString(), Title: pb.ErrorCode_ReqParameterError.ToString(),
Message: fmt.Sprintf("the teacher job:%d and the hero job:%d is race no can use", tconfigure.Job, heroconf.Job), Message: fmt.Sprintf("the teacher job:%d and the hero job:%d is race no can use", tconfigure.Job, heroconf.Job),
} }
return
} }
extra += int32(float64(pillarconfigure.PlacementDuration) * float64(pconfigure.Duration) / float64(1000)) extra += int32(float64(pillarconfigure.PlacementDuration) * float64(pconfigure.Duration) / float64(1000))
pillar.Prop = req.Prop pillar.Prop = req.Prop