商队 取小道消息数据bug
This commit is contained in:
parent
bd0c853b36
commit
3cc286864b
@ -253,23 +253,23 @@ func (this *Caravan) refreshCaravanCityInfo(uid string, caravan *pb.DBCaravan) {
|
||||
if v, ok := caravan.City[conf.Id]; ok {
|
||||
if len(v.Nextexspecial) == 0 || v.NextexspecialPCT == 0 { // 没有数据 则构建一条数据
|
||||
if len(v.Exspecial) > int(conf.ExspecialNum) {
|
||||
ids := utils.RandomNumbers(0, len(v.Exspecial), int(conf.ExspecialNum))
|
||||
ids := utils.RandomNumbers(0, len(conf.Exspecial), int(conf.ExspecialNum))
|
||||
for _, id := range ids {
|
||||
v.Exspecial = append(v.Exspecial, conf.Exspecial[id])
|
||||
}
|
||||
} else {
|
||||
v.Exspecial = append(v.Exspecial, conf.Exspecial...)
|
||||
}
|
||||
v.NextexspecialPCT = conf.Exspecialnum[comm.GetRandW(conf.ExspecialnumWeight)] // 获取权重
|
||||
v.ExspecialPCT = conf.Exspecialnum[comm.GetRandW(conf.ExspecialnumWeight)] // 获取权重
|
||||
} else {
|
||||
v.Exspecial = make([]string, 0)
|
||||
v.Exspecial = append(v.Exspecial, v.Nextexspecial...)
|
||||
v.ExspecialPCT = v.NextexspecialPCT
|
||||
}
|
||||
|
||||
v.Nextexspecial = []string{}
|
||||
// 初始化下一天的信息
|
||||
if len(v.Exspecial) > int(conf.ExspecialNum) {
|
||||
ids := utils.RandomNumbers(0, len(v.Exspecial), int(conf.ExspecialNum))
|
||||
ids := utils.RandomNumbers(0, len(conf.Exspecial), int(conf.ExspecialNum))
|
||||
for _, id := range ids {
|
||||
v.Nextexspecial = append(v.Nextexspecial, conf.Exspecial[id])
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user