update
This commit is contained in:
parent
4cda2451d6
commit
c220db525c
@ -40,10 +40,9 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq)
|
||||
myWorldtask.CurrentTask[curTaskConf.Group] = &pb.Worldtask{
|
||||
TaskId: req.TaskId,
|
||||
TaskType: curTaskConf.Des,
|
||||
NpcStatus: 1,
|
||||
}
|
||||
|
||||
myWorldtask.CurrentTask[curTaskConf.Group].NpcStatus = 1
|
||||
|
||||
update := map[string]interface{}{
|
||||
"currentTask": myWorldtask.CurrentTask,
|
||||
}
|
||||
|
@ -88,49 +88,33 @@ func (this *ModelWorldtask) finishTask(groupId, taskId int32, task *pb.DBWorldta
|
||||
TaskType: taskConf.Des,
|
||||
}
|
||||
|
||||
for _, tId := range task.TaskList {
|
||||
if tId == taskId {
|
||||
return comm.NewCustomError(pb.ErrorCode_WorldtaskFinihed)
|
||||
}
|
||||
}
|
||||
|
||||
task.TaskList = append(task.TaskList, taskId)
|
||||
|
||||
if task.CurrentTask == nil {
|
||||
task.CurrentTask = make(map[int32]*pb.Worldtask)
|
||||
}
|
||||
|
||||
//判断是否有下个任务
|
||||
if taskConf.IdAfter != 0 {
|
||||
wt.NpcStatus = 0
|
||||
wt.DeliverNpc = 0
|
||||
wt.CondiIds = []int32{}
|
||||
task.CurrentTask[groupId] = wt
|
||||
update["currentTask"] = task.CurrentTask
|
||||
}
|
||||
|
||||
update["taskList"] = task.TaskList
|
||||
update["currentTask"] = task.CurrentTask
|
||||
|
||||
if err := this.Change(task.Uid, update); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// if module, err := this.service.GetModule(comm.ModuleLinestory); err == nil {
|
||||
// if iLinestory, ok := module.(comm.ILinestory); ok {
|
||||
// if err := iLinestory.TaskFinishNotify(task.Uid, taskId, groupId); err != nil {
|
||||
// log.Debug("世界任务完成通知支线剧情任务",
|
||||
// log.Field{Key: "uid", Value: task.Uid},
|
||||
// log.Field{Key: "groupId", Value: groupId},
|
||||
// log.Field{Key: "taskId", Value: taskId},
|
||||
// log.Field{Key: "err", Value: err.Error()},
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// if module, err := this.service.GetModule(comm.ModuleLibrary); err == nil {
|
||||
// if iLibrary, ok := module.(comm.ILibrary); ok {
|
||||
// if err := iLibrary.TaskFinishNotify(task.Uid, taskId, groupId); err != nil {
|
||||
// log.Debug("世界任务完成通知羁绊剧情任务",
|
||||
// log.Field{Key: "uid", Value: task.Uid},
|
||||
// log.Field{Key: "fetterId", Value: groupId},
|
||||
// log.Field{Key: "taskId", Value: taskId},
|
||||
// log.Field{Key: "err", Value: err.Error()},
|
||||
// )
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -70,9 +70,20 @@ func (this *Worldtask) TaskCondFinishNotify(session comm.IUserSession, condId in
|
||||
for _, c := range this.worldtaskConf.GetDataList() {
|
||||
for _, v := range c.Completetask {
|
||||
if v == condId {
|
||||
//校验任务是否是当前任务
|
||||
if task, ok := userTask.CurrentTask[c.Group]; ok {
|
||||
this.Debug("推送NextTask",
|
||||
log.Field{Key: "group", Value: c.Group},
|
||||
log.Field{Key: "Key", Value: c.Key},
|
||||
log.Field{Key: "taskId", Value: task.TaskId},
|
||||
log.Field{Key: "condId", Value: condId},
|
||||
log.Field{Key: "npcStatus", Value: task.NpcStatus})
|
||||
if task.NpcStatus == 1 {
|
||||
finishedTaskIds[c.Group] = c.Key
|
||||
groupId = c.Group
|
||||
taskId = c.Key
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -97,6 +108,7 @@ func (this *Worldtask) TaskCondFinishNotify(session comm.IUserSession, condId in
|
||||
|
||||
userTask.CurrentTask[groupId] = wt
|
||||
|
||||
this.Debug("当前任务更新", log.Field{Key: "currentTask", Value: userTask.CurrentTask})
|
||||
update := map[string]interface{}{
|
||||
"currentTask": userTask.CurrentTask,
|
||||
}
|
||||
@ -111,14 +123,14 @@ func (this *Worldtask) TaskCondFinishNotify(session comm.IUserSession, condId in
|
||||
log.Field{Key: "condiIds", Value: wt.CondiIds},
|
||||
log.Field{Key: "taskId", Value: taskId})
|
||||
|
||||
//判断是否要结束任务
|
||||
// 当前任务配置
|
||||
curTaskConf, err := this.configure.getWorldtaskById(taskId)
|
||||
if err != nil || curTaskConf == nil {
|
||||
return comm.NewCustomError(pb.ErrorCode_ConfigNoFound)
|
||||
}
|
||||
if curTaskConf.DeliverNpc == 0 {
|
||||
|
||||
//结束任务
|
||||
if curTaskConf.DeliverNpc == 0 {
|
||||
this.modelWorldtask.taskFinish(session, groupId, taskId, userTask, curTaskConf)
|
||||
this.modelWorldtask.taskFinishPush(session, groupId, userTask, curTaskConf)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user