From 4feab9788e17ae2c68df06ebbdf94d65f5989318 Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Fri, 14 Jul 2023 14:04:51 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E4=B8=96=E7=95=8C?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 ++ modules/gm/module.go | 17 ++------------ modules/wtask/module.go | 50 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+), 15 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index b0d17ff98..f1c9c694c 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -545,6 +545,8 @@ type ( IOpenCmdNotice AcceptCaravanTask(session IUserSession, groupId int32) (tid, groud int32, errdata *pb.ErrorData) ClearCaravanTask(session IUserSession, task int32) + // bingo任务 + BingoJumpTask(session IUserSession, rtaskId int32) (errdata *pb.ErrorData) } //战令 IWarorder interface { diff --git a/modules/gm/module.go b/modules/gm/module.go index 605546b50..bd9aef7f9 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -166,26 +166,13 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er log.Field{Key: "param", Value: datas[0]}, log.Field{Key: "res", Value: res}, ) - } else if len(datas) == 3 && (datas[0] == "worldtask") { - module, err := this.service.GetModule(comm.ModuleWorldtask) - if err != nil { - return - } - if wt, ok := module.(comm.IWorldtask); ok { - if err = wt.BingoJumpTask(session, utils.ToInt32(datas[1]), utils.ToInt32(datas[2])); err != nil { - this.Error("bingo 世界任务", - log.Field{Key: "params", Value: datas}, - log.Field{Key: "err", Value: err.Error()}, - ) - } - } } else if len(datas) == 2 && (datas[0] == "worldtask") { module, err := this.service.GetModule(comm.ModuleWorldtask) if err != nil { return } - if wt, ok := module.(comm.IWorldtask); ok { - if err = wt.JumpTaskByTaskId(session, utils.ToInt32(datas[1])); err != nil { + if wt, ok := module.(comm.IWtask); ok { + if errdata = wt.BingoJumpTask(session, utils.ToInt32(datas[1])); err != nil { this.Error("bingo 世界任务", log.Field{Key: "params", Value: datas}, log.Field{Key: "err", Value: err.Error()}, diff --git a/modules/wtask/module.go b/modules/wtask/module.go index c293a6676..1b0102f90 100644 --- a/modules/wtask/module.go +++ b/modules/wtask/module.go @@ -280,6 +280,56 @@ 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 + ) + if _, err = this.configure.gettaskconfconfigure(taskId); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ConfigNoFound, + Title: pb.ErrorCode_ConfigNoFound.ToString(), + Message: err.Error(), + } + return + } + + if wtask, err = this.modelwtask.getUserWTasks(session.GetUserId()); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + ok = false + for _, v := range wtask.Activations { + if taskId == v { + ok = true + } + } + + if ok { + return + } + + update["activations"] = wtask.Activations + + if err = this.modelwtask.Change(session.GetUserId(), update); err != nil { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_DBError, + Title: pb.ErrorCode_DBError.ToString(), + Message: err.Error(), + } + return + } + session.SendMsg(string(this.GetType()), "activationschange", &pb.WTaskActivationsChangePush{Activations: wtask.Activations}) + return +} + // 校验任务进度 func (this *WTask) pushtaskprogress(session comm.IUserSession, wtask *pb.DBWTask, ispush bool) (progress []*pb.DBWTaskItem, errdata *pb.ErrorData) { var ( From aa692be3a2c4436c5e9c24c986e79e12af34da9a Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Fri, 14 Jul 2023 14:50:48 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=A4=84=E7=90=86=E5=95=86=E9=98=9F?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=98=AF=E5=90=A6=E5=8F=AF=E4=BB=A5=E9=87=8D?= =?UTF-8?q?=E5=A4=8D=E6=8E=A5=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/wtask/module.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/wtask/module.go b/modules/wtask/module.go index 1b0102f90..6fdd29d1f 100644 --- a/modules/wtask/module.go +++ b/modules/wtask/module.go @@ -220,7 +220,7 @@ func (this *WTask) AcceptCaravanTask(session comm.IUserSession, groupId int32) ( } for _, v := range grouptask { - if _, ok = completeMap[v.Key]; !ok { //找到一个为完成任务 + if _, ok = completeMap[v.Key]; v.LockAdd == 1 || !ok { //找到一个为完成任务 target = v break } From 1bc39a111402a85d6099b05bfde224fcd9db7101 Mon Sep 17 00:00:00 2001 From: liwei <2211068034@qq.com> Date: Fri, 14 Jul 2023 14:57:35 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=95=86=E9=98=9F?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=8E=A5=E5=8F=96=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/wtask/api_accept.go | 8 -------- modules/wtask/api_finish.go | 9 +++++++++ modules/wtask/module.go | 2 +- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/modules/wtask/api_accept.go b/modules/wtask/api_accept.go index 7102c6f7e..0907c9400 100644 --- a/modules/wtask/api_accept.go +++ b/modules/wtask/api_accept.go @@ -50,14 +50,6 @@ func (this *apiComp) Accept(session comm.IUserSession, req *pb.WTaskAcceptReq) ( ok = true } } - if conf.Des == 5 { //商队任务 接取任务时 移除下一个任务的完成条件 方便顺序获取任务 - for i, v := range wtask.Completes { - if conf.IdAfter != 0 && conf.IdAfter == v { - wtask.Completes = append(wtask.Completes[0:i], wtask.Completes[i+1:]...) - update["completes"] = wtask.Completes - } - } - } if !ok { errdata = &pb.ErrorData{ diff --git a/modules/wtask/api_finish.go b/modules/wtask/api_finish.go index a4cf6291f..9eb1499ee 100644 --- a/modules/wtask/api_finish.go +++ b/modules/wtask/api_finish.go @@ -111,6 +111,15 @@ func (this *apiComp) Finish(session comm.IUserSession, req *pb.WTaskFinishReq) ( } } wtask.Completes = append(wtask.Completes, req.Tid) + + if conf.Des == 5 { //商队任务 完成任务时 移除下一个任务的完成条件 方便顺序获取任务 + for i, v := range wtask.Completes { + if conf.IdAfter != 0 && conf.IdAfter == v { + wtask.Completes = append(wtask.Completes[0:i], wtask.Completes[i+1:]...) + } + } + } + session.SendMsg(string(this.module.GetType()), "finish", &pb.WTaskFinishResp{Tid: req.Tid, Award: award}) this.module.checkgroupState(session, wtask, conf.Group) this.module.fishtask(session, wtask, true) diff --git a/modules/wtask/module.go b/modules/wtask/module.go index 6fdd29d1f..1b0102f90 100644 --- a/modules/wtask/module.go +++ b/modules/wtask/module.go @@ -220,7 +220,7 @@ func (this *WTask) AcceptCaravanTask(session comm.IUserSession, groupId int32) ( } for _, v := range grouptask { - if _, ok = completeMap[v.Key]; v.LockAdd == 1 || !ok { //找到一个为完成任务 + if _, ok = completeMap[v.Key]; !ok { //找到一个为完成任务 target = v break }