商队随机事件触发概率问题
This commit is contained in:
parent
63d1275a8e
commit
d8221d1ce9
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user