From 6b917ba72e761a85603f38f52311951da393759e Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Tue, 25 Jul 2023 15:07:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0gm=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/wtask/module.go | 54 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 49 insertions(+), 5 deletions(-) diff --git a/modules/wtask/module.go b/modules/wtask/module.go index bbd8ace71..e2b7f1a35 100644 --- a/modules/wtask/module.go +++ b/modules/wtask/module.go @@ -430,12 +430,17 @@ func (this *WTask) ClearCaravanTask(session comm.IUserSession, task int32) { // 跳世界任务 func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errdata *pb.ErrorData) { var ( - wtask *pb.DBWTask - update map[string]interface{} = make(map[string]interface{}) - ok bool - err error + wtask *pb.DBWTask + accepts []int32 = make([]int32, 0) + acceptsMap map[int32]struct{} = make(map[int32]struct{}) + complete []int32 = make([]int32, 0) + completeMap map[int32]struct{} = make(map[int32]struct{}) + conf *cfg.GameWorldTaskData + update map[string]interface{} = make(map[string]interface{}) + ok bool + err error ) - if _, err = this.configure.gettaskconfconfigure(taskId); err != nil { + if conf, err = this.configure.gettaskconfconfigure(taskId); err != nil { errdata = &pb.ErrorData{ Code: pb.ErrorCode_ConfigNoFound, Title: pb.ErrorCode_ConfigNoFound.ToString(), @@ -452,6 +457,12 @@ func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errda } return } + for _, v := range wtask.Accepts { + acceptsMap[v] = struct{}{} + } + for _, v := range wtask.Completes { + completeMap[v] = struct{}{} + } ok = false for _, v := range wtask.Activations { if taskId == v { @@ -462,8 +473,41 @@ func (this *WTask) BingoJumpTask(session comm.IUserSession, taskId int32) (errda if ok { return } + + for { + if conf.Ontxe != 0 { + if _, ok = completeMap[conf.Ontxe]; !ok { + completeMap[conf.Ontxe] = struct{}{} + if _, ok = acceptsMap[conf.Ontxe]; ok { + delete(acceptsMap, conf.Ontxe) + } + + if conf, err = this.configure.gettaskconfconfigure(conf.Ontxe); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: err.Error(), + } + return + } + } + } else { + break + } + } + for k, _ := range acceptsMap { + accepts = append(accepts, k) + } + for k, _ := range completeMap { + complete = append(complete, k) + } + wtask.Activations = append(wtask.Activations, taskId) + wtask.Accepts = accepts + wtask.Completes = complete update["activations"] = wtask.Activations + update["accepts"] = wtask.Accepts + update["completes"] = wtask.Completes if err = this.modelwtask.Change(session.GetUserId(), update); err != nil { errdata = &pb.ErrorData{