This commit is contained in:
meixiongfeng 2023-07-17 14:46:23 +08:00
parent b1134339bb
commit 9c8ec08e22

View File

@ -77,18 +77,18 @@ 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 {
if elist, err := this.module.configure.GetCaravanEventByGroup(newCity.Cityevent); err == nil { if elist, err := this.module.configure.GetCaravanEventByGroup(newCity.Cityevent); err == nil {
var sz []int32 var sz []*cfg.GameCaravanEventData
for _, v := range elist { for _, v := range elist {
if _, ok := list.Group[v.Worldtask]; !ok { if _, ok := list.Group[v.Worldtask]; !ok {
sz = append(sz, v.Worldtask) sz = append(sz, v)
} }
} }
if len(sz) > 0 { // 容错处理 if len(sz) > 0 { // 容错处理
var randW []int32 var randW []int32
for _, v := range sz { for _, v := range sz {
randW = append(randW, v) randW = append(randW, v.Eventweight)
} }
list.Eventid = sz[comm.GetRandW(randW)] list.Eventid = sz[comm.GetRandW(randW)].Id
} }
} }