商队随机事件触发概率问题

This commit is contained in:
meixiongfeng 2023-08-04 22:12:26 +08:00
parent 63d1275a8e
commit d8221d1ce9

View File

@ -76,6 +76,8 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
} }
if bNewTask { // 到该城市随机一个新的任务 if bNewTask { // 到该城市随机一个新的任务
if newCity, e := this.module.configure.GetCaravanCity(req.City); e == nil { if newCity, e := this.module.configure.GetCaravanCity(req.City); e == nil {
//newCity.Cityeventpro
if newCity.Cityeventpro > comm.GetRandNum(0, 1000) {
if elist, err := this.module.configure.GetCaravanEventByGroup(newCity.Cityevent); err == nil { if elist, err := this.module.configure.GetCaravanEventByGroup(newCity.Cityevent); err == nil {
var sz []*cfg.GameCaravanEventData var sz []*cfg.GameCaravanEventData
for _, v := range elist { for _, v := range elist {
@ -91,6 +93,9 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
list.Eventid = sz[comm.GetRandW(randW)].Id list.Eventid = sz[comm.GetRandW(randW)].Id
} }
} }
} else {
bNewTask = false
}
} else { } else {
errdata = &pb.ErrorData{ errdata = &pb.ErrorData{
@ -98,6 +103,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
Title: pb.ErrorCode_ConfigNoFound.ToString(), Title: pb.ErrorCode_ConfigNoFound.ToString(),
Message: e.Error(), Message: e.Error(),
} }
return
} }
} }
if list.Curcity == req.City { if list.Curcity == req.City {