From d8221d1ce9e76d5d3867af08369fdceacfc073df Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 4 Aug 2023 22:12:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E9=98=9F=E9=9A=8F=E6=9C=BA=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6=E8=A7=A6=E5=8F=91=E6=A6=82=E7=8E=87=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/caravan/api_gotocity.go | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/modules/caravan/api_gotocity.go b/modules/caravan/api_gotocity.go index 1833ddd30..fab7b2e67 100644 --- a/modules/caravan/api_gotocity.go +++ b/modules/caravan/api_gotocity.go @@ -76,20 +76,25 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity } if bNewTask { // 到该城市随机一个新的任务 if newCity, e := this.module.configure.GetCaravanCity(req.City); e == nil { - if elist, err := this.module.configure.GetCaravanEventByGroup(newCity.Cityevent); err == nil { - var sz []*cfg.GameCaravanEventData - for _, v := range elist { - if _, ok := list.Group[v.Worldtask]; !ok { - sz = append(sz, v) + //newCity.Cityeventpro + if newCity.Cityeventpro > comm.GetRandNum(0, 1000) { + if elist, err := this.module.configure.GetCaravanEventByGroup(newCity.Cityevent); err == nil { + var sz []*cfg.GameCaravanEventData + for _, v := range elist { + if _, ok := list.Group[v.Worldtask]; !ok { + sz = append(sz, v) + } + } + if len(sz) > 0 { // 容错处理 + var randW []int32 + for _, v := range sz { + randW = append(randW, v.Eventweight) + } + list.Eventid = sz[comm.GetRandW(randW)].Id } } - if len(sz) > 0 { // 容错处理 - var randW []int32 - for _, v := range sz { - randW = append(randW, v.Eventweight) - } - list.Eventid = sz[comm.GetRandW(randW)].Id - } + } else { + bNewTask = false } } else { @@ -98,6 +103,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity Title: pb.ErrorCode_ConfigNoFound.ToString(), Message: e.Error(), } + return } } if list.Curcity == req.City {