随机触发事件处理
This commit is contained in:
parent
344b9351ff
commit
d45353e82b
@ -32,7 +32,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
|
||||
}
|
||||
// 获取事件
|
||||
if list.Eventid != 0 {
|
||||
if event := this.module.configure.GetAllCaravanEvent(list.Eventid); event != nil {
|
||||
if event := this.module.configure.GetCaravanEventById(list.Eventid); event != nil {
|
||||
// 校验任务是否超时
|
||||
if list.Tasktime-configure.Now().Unix() > int64(event.Eventtime) { //TODO 任务超时
|
||||
|
||||
@ -49,10 +49,10 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
|
||||
if newCity := this.module.configure.GetCaravanCity(req.City); newCity != nil {
|
||||
ipos := comm.GetRandW(newCity.Cityevent)
|
||||
list.Eventid = newCity.Cityevent[ipos] // 新的任务
|
||||
list.Tasktime = configure.Now().Unix()
|
||||
if event := this.module.configure.GetAllCaravanEvent(list.Eventid); event != nil {
|
||||
list.Task = event.Worldtask // 对应世界任务组
|
||||
}
|
||||
// list.Tasktime = configure.Now().Unix()
|
||||
// if event := this.module.configure.GetCaravanEventById(list.Eventid); event != nil {
|
||||
// list.Task = event.Worldtask // 对应世界任务组
|
||||
// }
|
||||
}
|
||||
}
|
||||
if list.Curcity == req.City {
|
||||
@ -75,6 +75,7 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity
|
||||
list.Curcity = req.City
|
||||
this.module.modelCaravan.modifyCaravanDataByObjId(session.GetUserId(), map[string]interface{}{
|
||||
"curcity": list.Curcity,
|
||||
"eventid": list.Eventid,
|
||||
})
|
||||
resp.Data = list
|
||||
resp.Newtask = bNewTask
|
||||
|
Loading…
Reference in New Issue
Block a user