商队随机事件触发概率问题
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 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 {
|
//newCity.Cityeventpro
|
||||||
var sz []*cfg.GameCaravanEventData
|
if newCity.Cityeventpro > comm.GetRandNum(0, 1000) {
|
||||||
for _, v := range elist {
|
if elist, err := this.module.configure.GetCaravanEventByGroup(newCity.Cityevent); err == nil {
|
||||||
if _, ok := list.Group[v.Worldtask]; !ok {
|
var sz []*cfg.GameCaravanEventData
|
||||||
sz = append(sz, v)
|
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 { // 容错处理
|
} else {
|
||||||
var randW []int32
|
bNewTask = false
|
||||||
for _, v := range sz {
|
|
||||||
randW = append(randW, v.Eventweight)
|
|
||||||
}
|
|
||||||
list.Eventid = sz[comm.GetRandW(randW)].Id
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user