From f225ec088f8def2ded98b19f6399ebbefdc1c6a0 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Thu, 15 Jun 2023 21:00:57 +0800 Subject: [PATCH] update --- modules/worldtask/api_accept.go | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/modules/worldtask/api_accept.go b/modules/worldtask/api_accept.go index dce749d3b..5e58e5af6 100644 --- a/modules/worldtask/api_accept.go +++ b/modules/worldtask/api_accept.go @@ -92,9 +92,13 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq) } else { task.NpcStatus = 1 for _, cid := range curTaskConf.Completetask { - task.Conds = append(task.Conds, &pb.ConIProgress{ - Conid: cid, - }) + for _, cond := range task.Conds { + if cid != cond.Conid { + task.Conds = append(task.Conds, &pb.ConIProgress{ + Conid: cid, + }) + } + } } } break @@ -110,9 +114,13 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq) } for _, cid := range curTaskConf.Completetask { - task.Conds = append(task.Conds, &pb.ConIProgress{ - Conid: cid, - }) + for _, cond := range task.Conds { + if cid != cond.Conid { + task.Conds = append(task.Conds, &pb.ConIProgress{ + Conid: cid, + }) + } + } } tasks.TaskMap[task.TaskId] = task } @@ -127,9 +135,13 @@ func (a *apiComp) Accept(session comm.IUserSession, req *pb.WorldtaskAcceptReq) NpcStatus: 1, //接取 } for _, cid := range curTaskConf.Completetask { - task.Conds = append(task.Conds, &pb.ConIProgress{ - Conid: cid, - }) + for _, cond := range task.Conds { + if cid != cond.Conid { + task.Conds = append(task.Conds, &pb.ConIProgress{ + Conid: cid, + }) + } + } } tasks.TaskMap[req.TaskId] = task myWorldtask.CurrentTasks[curTaskConf.Group] = tasks