diff --git a/modules/worldtask/module.go b/modules/worldtask/module.go index 8514fe020..0cc7c2197 100644 --- a/modules/worldtask/module.go +++ b/modules/worldtask/module.go @@ -411,8 +411,8 @@ func (this *Worldtask) JumpTaskByTaskId(session comm.IUserSession, taskId int32) func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int32) (task *pb.Worldtask, errdata *pb.ErrorData) { uid := session.GetUserId() var ( - curTaskConf *cfg.GameWorldTaskData - isfinsh bool + // curTaskConf *cfg.GameWorldTaskData + // isfinsh bool ) mytask, err := this.modelWorldtask.getWorldtask(uid) if err != nil { @@ -433,7 +433,7 @@ func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int3 TaskType: v.Des, NpcStatus: 1, } - curTaskConf = v + // curTaskConf = v break } } @@ -449,21 +449,21 @@ func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int3 return } - if mytask.CurrentTasks == nil { - mytask.CurrentTasks = make(map[int32]*pb.Worldtasks) - } + // if mytask.CurrentTasks == nil { + // mytask.CurrentTasks = make(map[int32]*pb.Worldtasks) + // } - if _, ok1 := mytask.CurrentTasks[curTaskConf.Group]; !ok1 { - mytask.CurrentTasks[curTaskConf.Group] = &pb.Worldtasks{ - TaskMap: make(map[int32]*pb.Worldtask), - } + // if _, ok1 := mytask.CurrentTasks[curTaskConf.Group]; !ok1 { + // mytask.CurrentTasks[curTaskConf.Group] = &pb.Worldtasks{ + // TaskMap: make(map[int32]*pb.Worldtask), + // } - } - mytask.CurrentTasks[curTaskConf.Group].TaskMap[task.TaskId] = &pb.Worldtask{ - TaskId: task.TaskId, - TaskType: curTaskConf.Des, - NpcStatus: 1, - } + // } + // mytask.CurrentTasks[curTaskConf.Group].TaskMap[task.TaskId] = &pb.Worldtask{ + // TaskId: task.TaskId, + // TaskType: curTaskConf.Des, + // NpcStatus: 1, + // } // if err = this.ModuleBuried.ActiveCondition(uid, curTaskConf.Completetask...); err != nil { // log.Errorf("调用接口错误:%s", err.Error()) // errdata = &pb.ErrorData{ @@ -473,39 +473,39 @@ func (this *Worldtask) AcceptCaravanTask(session comm.IUserSession, groupId int3 // } // return // } - if task.Conds, err = this.ModuleBuried.CheckCondition(uid, curTaskConf.Completetask...); err != nil { - log.Errorf("调用接口错误:%s", err.Error()) - errdata = &pb.ErrorData{ - Code: pb.ErrorCode_ExternalModule, - Title: pb.ErrorCode_ExternalModule.String(), - Message: fmt.Sprintf("ModuleBuried.CheckCondition err:%s", err.Error()), - } - return - } - isfinsh = true - for _, v := range task.Conds { - if v.State != pb.BuriedItemFinishState_buried_finish { - isfinsh = false - } - } - if isfinsh && curTaskConf.DeliverNpc != 0 { - isfinsh = false - } - //判断是否要结束任务 - if ((len(curTaskConf.Completetask) >= 1 && curTaskConf.Completetask[0] == 0) || - len(curTaskConf.Completetask) == 0) && curTaskConf.DeliverNpc == 0 { - isfinsh = true - } + // if task.Conds, err = this.ModuleBuried.CheckCondition(uid, curTaskConf.Completetask...); err != nil { + // log.Errorf("调用接口错误:%s", err.Error()) + // errdata = &pb.ErrorData{ + // Code: pb.ErrorCode_ExternalModule, + // Title: pb.ErrorCode_ExternalModule.String(), + // Message: fmt.Sprintf("ModuleBuried.CheckCondition err:%s", err.Error()), + // } + // return + // } + // isfinsh = true + // for _, v := range task.Conds { + // if v.State != pb.BuriedItemFinishState_buried_finish { + // isfinsh = false + // } + // } + // if isfinsh && curTaskConf.DeliverNpc != 0 { + // isfinsh = false + // } + // //判断是否要结束任务 + // if ((len(curTaskConf.Completetask) >= 1 && curTaskConf.Completetask[0] == 0) || + // len(curTaskConf.Completetask) == 0) && curTaskConf.DeliverNpc == 0 { + // isfinsh = true + // } - update := map[string]interface{}{ - "currentTasks": mytask.CurrentTasks, - } - if err := this.modelWorldtask.Change(uid, update); err != nil { - } - if isfinsh { //结束任务 - this.modelWorldtask.taskFinish(session, task.TaskId, mytask, curTaskConf) - this.modelWorldtask.taskFinishPush(session, mytask, curTaskConf) - } + // update := map[string]interface{}{ + // "currentTasks": mytask.CurrentTasks, + // } + // if err := this.modelWorldtask.Change(uid, update); err != nil { + // } + // if isfinsh { //结束任务 + // this.modelWorldtask.taskFinish(session, task.TaskId, mytask, curTaskConf) + // this.modelWorldtask.taskFinishPush(session, mytask, curTaskConf) + // } return }