From 1fa4dfe51019540efafb9d65e8d0cf5fb45c0143 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Wed, 24 May 2023 15:36:12 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=95=B4=E7=90=861?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/rtask/module.go | 137 +++++++++++----------------------- modules/rtask/verifyHandle.go | 5 +- 2 files changed, 48 insertions(+), 94 deletions(-) diff --git a/modules/rtask/module.go b/modules/rtask/module.go index 8717eafaa..a9bb15ae1 100644 --- a/modules/rtask/module.go +++ b/modules/rtask/module.go @@ -24,14 +24,14 @@ var _ comm.IRtask = (*ModuleRtask)(nil) // 限定条件 type rtaskCondHandle struct { - condId int32 //任务条件配置ID - verify verifyHandle //校验任务条件 - find condiFindHandle //检索任务条件 + condId int32 //任务条件配置ID + verify verifyHandle //校验任务条件 update updateDataHandle //更新任务数据 } +// 任务参数校验 type verifyHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (bool, error) -type condiFindHandle func(cfg *cfg.GameRdtaskCondiData, vals ...int32) (int32, error) +// 任务数据更新 type updateDataHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, vals ...int32) error type ModuleRtask struct { @@ -75,90 +75,49 @@ func (this *ModuleRtask) registerVerifyHandle(condiId int32, condi *rtaskCondHan this.handleMap.Store(condiId, condi) } -func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondHandle) { +func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle) { for _, v := range this.configure.getRtaskCondis(int32(tt)) { switch tt { case comm.Rtype1: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, - verify: this.modelRtaskRecord.verifyFromDb, + verify: this.modelRtaskRecord.verifyGreatEqual, update: this.modelRtaskRecord.addUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype3: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, verify: this.modelRtask.verifyRtype3, update: this.modelRtaskRecord.overrideUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) - case comm.Rtype4: - condi := &rtaskCondHandle{ + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) + case comm.Rtype4, comm.Rtype5, comm.Rtype6, comm.Rtype8, comm.Rtype10: + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, - verify: this.modelRtask.verifyRtype4, + verify: this.modelRtaskRecord.verifyGreatEqual, update: this.modelRtaskRecord.overrideUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) - case comm.Rtype5: - condi := &rtaskCondHandle{ - condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, - verify: this.modelRtask.verifyRtype5, - update: this.modelRtaskRecord.overrideUpdate, - } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) - case comm.Rtype6: - condi := &rtaskCondHandle{ - condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, - verify: this.modelRtask.verifyRtype6, - update: this.modelRtaskRecord.overrideUpdate, - } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) - case comm.Rtype8: - condi := &rtaskCondHandle{ - condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, - verify: this.modelRtask.verfiyRtype8, - update: this.modelRtaskRecord.overrideUpdate, - } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype9: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, verify: this.modelRtask.verfiyRtype9, update: this.modelRtaskRecord.overrideUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) - case comm.Rtype10: - condi := &rtaskCondHandle{ - condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, - verify: this.modelRtask.verfiyRtype10, - update: this.modelRtaskRecord.overrideUpdate, - } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype18: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.greatEqualFirstParam, verify: this.modelRtaskRecord.verifyFirstGreatEqualParam, update: this.modelRtaskRecord.addUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype7, comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15, comm.Rtype19, comm.Rtype21, comm.Rtype24, comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38, @@ -169,53 +128,48 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondHandle) comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146, comm.Rtype147, comm.Rtype149, comm.Rtype153, comm.Rtype154, comm.Rtype155, comm.Rtype156, comm.Rtype171, comm.Rtype186, comm.Rtype187: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.lessEqualFirstParam, verify: this.modelRtaskRecord.verifyFirstGreatEqualParam, update: this.modelRtaskRecord.addUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype50, comm.Rtype73: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.lessEqualFirstParam, - verify: this.modelRtaskRecord.verifyFromDb, + verify: this.modelRtaskRecord.verifyGreatEqual, update: this.modelRtaskRecord.addUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype20: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, verify: this.modelRtask.verifyRtype20, update: this.modelRtaskRecord.overrideUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype109: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.equalFirstParam, verify: this.modelRtaskRecord.verifyFirstEqualParam, update: this.modelRtaskRecord.overrideUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype16, comm.Rtype17, comm.Rtype35, comm.Rtype61: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.equalParams, - verify: this.modelRtaskRecord.verifyFromDb, + verify: this.modelRtaskRecord.verifyGreatEqual, update: this.modelRtaskRecord.overrideUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) case comm.Rtype23, comm.Rtype25, comm.Rtype30, comm.Rtype32, comm.Rtype33, comm.Rtype34, comm.Rtype36, comm.Rtype37, comm.Rtype40, comm.Rtype41, @@ -223,16 +177,15 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (condis []*rtaskCondHandle) comm.Rtype46, comm.Rtype47, comm.Rtype52, comm.Rtype55, comm.Rtype56, comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140: - condi := &rtaskCondHandle{ + handle := &rtaskCondHandle{ condId: v.Id, - find: this.modelRtaskRecord.lessThanParams, - verify: this.modelRtaskRecord.verifyFromDb, + verify: this.modelRtaskRecord.verifyGreatEqual, update: this.modelRtaskRecord.addUpdate, } - condis = append(condis, condi) - this.registerVerifyHandle(v.Id, condi) + handles = append(handles, handle) + this.registerVerifyHandle(v.Id, handle) default: - log.Warnf("rtaskType[%v] not register", tt) + log.Warnf("rtaskType[%v] handle not register", tt) } } return diff --git a/modules/rtask/verifyHandle.go b/modules/rtask/verifyHandle.go index 08f64b645..70dd5a5b7 100644 --- a/modules/rtask/verifyHandle.go +++ b/modules/rtask/verifyHandle.go @@ -11,7 +11,8 @@ import ( "github.com/spf13/cast" ) -func (this *ModelRtaskRecord) verifyFromDb(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { +// GreatEqual +func (this *ModelRtaskRecord) verifyGreatEqual(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { if record == nil { err = errors.WithMessagef(err, "玩家数据DBRtaskRecord空") return @@ -278,7 +279,7 @@ func (this *ModelRtask) verfiyRtype8(uid string, record *pb.DBRtaskRecord, cfg * return } -// 连续登陆xx天 +// 连续登陆xx天 未埋点的处理方法 func (this *ModelRtask) verfiyRtype9(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (ok bool, err error) { userModule, err := this.service.GetModule(comm.ModuleUser) if err != nil { From e73b025e95ad7c53534954b9f8dcf581faa2a8eb Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Wed, 24 May 2023 15:40:39 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E4=B8=A2=E5=BC=83?= =?UTF-8?q?=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/rtask/condiFindHandle.go | 286 ------------------------------- 1 file changed, 286 deletions(-) delete mode 100644 modules/rtask/condiFindHandle.go diff --git a/modules/rtask/condiFindHandle.go b/modules/rtask/condiFindHandle.go deleted file mode 100644 index 3930ee896..000000000 --- a/modules/rtask/condiFindHandle.go +++ /dev/null @@ -1,286 +0,0 @@ -package rtask - -import ( - cfg "go_dreamfactory/sys/configure/structs" - - "github.com/pkg/errors" -) - -func (this *ModelRtaskRecord) equalFirstParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32, err error) { - //只查询参数于配置相等的情况下设置condiId,否则返回0 - if ok, err1 := soEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - condiId = cfg.Id - return -} - -func (this *ModelRtaskRecord) greatEqualFirstParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32, err error) { - if ok, err1 := soGreatEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - condiId = cfg.Id - return -} - -// 传递参数小于等于配置参数 -// 适合只比较首个参数(一个参数) -func (this *ModelRtaskRecord) lessEqualFirstParam(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32, err error) { - if ok, err1 := soLessEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - condiId = cfg.Id - return -} - -// 与每个参数比较 -func (this *ModelRtaskRecord) equalParams(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32, err error) { - var ( - paramLen int - ) - if paramLen, err = lenParam(cfg, vals...); err != nil { - return - } - - switch paramLen { - case 1: - if ok, err1 := soEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 2: - if ok, err1 := soEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 3: - if ok, err1 := soEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 4: - if ok, err1 := soEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[3], cfg.Data4); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 5: - if ok, err1 := soEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[3], cfg.Data4); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soEqual(vals[4], cfg.Data5); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - default: - return - } - - condiId = cfg.Id - - return -} - -func (this *ModelRtaskRecord) greatThanParams(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32, err error) { - var ( - paramLen int - ) - if paramLen, err = lenParam(cfg, vals...); err != nil { - return - } - - switch paramLen { - case 1: - if ok, err1 := soGreatEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 2: - if ok, err1 := soGreatEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 3: - if ok, err1 := soGreatEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 4: - if ok, err1 := soGreatEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[3], cfg.Data4); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 5: - if ok, err1 := soGreatEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[3], cfg.Data4); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[4], cfg.Data5); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - default: - return - } - - condiId = cfg.Id - return -} - -// 需要累加更新的查询 -func (this *ModelRtaskRecord) lessThanParams(cfg *cfg.GameRdtaskCondiData, vals ...int32) (condiId int32, err error) { - var ( - paramLen int - ) - if paramLen, err = lenParam(cfg, vals...); err != nil { - return - } - - switch paramLen { - case 1: - if ok, err1 := soLessEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 2: - if ok, err1 := soLessEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 3: - if ok, err1 := soLessEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 4: - if ok, err1 := soLessEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[3], cfg.Data4); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - case 5: - if ok, err1 := soLessEqual(vals[0], cfg.Data1); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[1], cfg.Data2); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[2], cfg.Data3); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[3], cfg.Data4); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - if ok, err1 := soGreatEqual(vals[4], cfg.Data5); !ok { - err = errors.WithMessagef(err1, "id: %v type:%v vals:%v", cfg.Id, cfg.Type, vals) - return - } - default: - return - } - - condiId = cfg.Id - return -} From a371d1952b9ff4bae6a4e14dc4d37648e2957cbf Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 24 May 2023 16:27:32 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/model_hero.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 3e29e5cfe..2bf92171d 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -584,7 +584,7 @@ func (this *ModelHero) AddCardExp(session comm.IUserSession, hero *pb.DBHero, ex if curLv-preLv > 0 { // 升级了 统计任务 var szTask []*comm.TaskParam szTask = append(szTask, comm.GettaskParam(comm.Rtype147, utils.ToInt32(hero.HeroID), curLv-preLv)) - szTask = append(szTask, comm.GettaskParam(comm.Rtype113, utils.ToInt32(hero.HeroID), curLv-preLv)) + szTask = append(szTask, comm.GettaskParam(comm.Rtype113, curLv-preLv)) szTask = append(szTask, comm.GettaskParam(comm.Rtype4, hero.Lv, utils.ToInt32(hero.HeroID))) szTask = append(szTask, comm.GettaskParam(comm.Rtype23, 1, hero.Star, hero.Lv)) szTask = append(szTask, comm.GettaskParam(comm.Rtype24, 1)) From ef0363f78bb32454eb72df1a7ad854c65f0920df Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Wed, 24 May 2023 17:20:31 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=B1=BB=E5=9E=8B?= =?UTF-8?q?=E6=95=B4=E7=90=862?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 7 ++++++- modules/rtask/api_tasktest.go | 1 - modules/rtask/module.go | 38 +++++++++++++++++++---------------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/comm/const.go b/comm/const.go index 6fc628b87..9fb93aa43 100644 --- a/comm/const.go +++ b/comm/const.go @@ -635,7 +635,12 @@ const ( Rtype159 TaskType = 159 //主线第X章关卡全部达到三星 Rtype160 TaskType = 160 //主线总星数达到X星 Rtype161 TaskType = 161 //在自动战斗过程中完成另一场战斗 - + Rtype162 TaskType = 162 //收藏X件攻击套装部件(激活一个套装部位+1) + Rtype163 TaskType = 163 //收藏X件防御套装部件(激活一个套装部位+1) + Rtype164 TaskType = 164 //收藏X件辅助套装部件(激活一个套装部位+1) + Rtype165 TaskType = 165 //铁匠铺收藏X件收藏品 + Rtype166 TaskType = 166 //铁匠铺图鉴收藏总计达到X个 + Rtype167 TaskType = 167 //铁匠铺收藏积分达到X分 Rtype168 TaskType = 168 //完成功夫大师挑战塔第X层 Rtype169 TaskType = 169 //触发指定套装的套装效果 Rtype170 TaskType = 170 //获得指定材料X个 diff --git a/modules/rtask/api_tasktest.go b/modules/rtask/api_tasktest.go index e65491109..9fb12b7d9 100644 --- a/modules/rtask/api_tasktest.go +++ b/modules/rtask/api_tasktest.go @@ -17,7 +17,6 @@ func (this *apiComp) Rtest(session comm.IUserSession, req *pb.RtaskTestReq) (cod if req.CondiId != 0 { if code = this.moduleRtask.CheckCondi(session.GetUserId(), req.CondiId); code != pb.ErrorCode_Success { rsp.Flag = false - return } } else if req.GroupId != 0 { // 获取当前玩家 diff --git a/modules/rtask/module.go b/modules/rtask/module.go index a9bb15ae1..7ea72fb49 100644 --- a/modules/rtask/module.go +++ b/modules/rtask/module.go @@ -24,13 +24,14 @@ var _ comm.IRtask = (*ModuleRtask)(nil) // 限定条件 type rtaskCondHandle struct { - condId int32 //任务条件配置ID - verify verifyHandle //校验任务条件 + condId int32 //任务条件配置ID + verify verifyHandle //校验任务条件 update updateDataHandle //更新任务数据 } // 任务参数校验 type verifyHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData) (bool, error) + // 任务数据更新 type updateDataHandle func(uid string, record *pb.DBRtaskRecord, cfg *cfg.GameRdtaskCondiData, vals ...int32) error @@ -110,24 +111,24 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle } handles = append(handles, handle) this.registerVerifyHandle(v.Id, handle) - case comm.Rtype18: - handle := &rtaskCondHandle{ - condId: v.Id, - verify: this.modelRtaskRecord.verifyFirstGreatEqualParam, - update: this.modelRtaskRecord.addUpdate, - } - handles = append(handles, handle) - this.registerVerifyHandle(v.Id, handle) + case comm.Rtype7, comm.Rtype12, comm.Rtype13, comm.Rtype14, comm.Rtype15, - comm.Rtype19, comm.Rtype21, comm.Rtype24, + comm.Rtype18, comm.Rtype19, comm.Rtype24, comm.Rtype26, comm.Rtype27, comm.Rtype28, comm.Rtype38, comm.Rtype39, comm.Rtype51, comm.Rtype53, comm.Rtype54, comm.Rtype57, comm.Rtype60, - comm.Rtype62, comm.Rtype64, comm.Rtype88, comm.Rtype104, - comm.Rtype96, comm.Rtype105, comm.Rtype128, comm.Rtype130, comm.Rtype131, + comm.Rtype62, comm.Rtype64, comm.Rtype87, comm.Rtype88, comm.Rtype89, comm.Rtype90, + comm.Rtype91, comm.Rtype92, comm.Rtype94, comm.Rtype95, comm.Rtype97, comm.Rtype104, + comm.Rtype96, comm.Rtype98, comm.Rtype99, comm.Rtype102, comm.Rtype103, comm.Rtype105, + comm.Rtype106, comm.Rtype108, comm.Rtype113, comm.Rtype114, comm.Rtype115, comm.Rtype116, + comm.Rtype117, comm.Rtype118, comm.Rtype119, comm.Rtype120, comm.Rtype121, comm.Rtype123, + comm.Rtype128, comm.Rtype130, comm.Rtype131, comm.Rtype132, comm.Rtype135, comm.Rtype141, comm.Rtype142, comm.Rtype143, comm.Rtype144, comm.Rtype145, comm.Rtype146, - comm.Rtype147, comm.Rtype149, comm.Rtype153, comm.Rtype154, comm.Rtype155, comm.Rtype156, - comm.Rtype171, comm.Rtype186, comm.Rtype187: + comm.Rtype147, comm.Rtype148, comm.Rtype149, comm.Rtype152, comm.Rtype153, comm.Rtype154, + comm.Rtype155, comm.Rtype156, comm.Rtype161, comm.Rtype162, comm.Rtype163, comm.Rtype164, + comm.Rtype165, comm.Rtype166, comm.Rtype167, + comm.Rtype171, comm.Rtype172, comm.Rtype173, comm.Rtype175, comm.Rtype177, + comm.Rtype181, comm.Rtype182, comm.Rtype183, comm.Rtype184, comm.Rtype185, comm.Rtype186, comm.Rtype187: handle := &rtaskCondHandle{ condId: v.Id, verify: this.modelRtaskRecord.verifyFirstGreatEqualParam, @@ -152,7 +153,9 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle handles = append(handles, handle) this.registerVerifyHandle(v.Id, handle) - case comm.Rtype109: + case comm.Rtype109, comm.Rtype122, comm.Rtype124, comm.Rtype125, comm.Rtype126, + comm.Rtype127, comm.Rtype129, comm.Rtype133, comm.Rtype134, comm.Rtype158, + comm.Rtype159, comm.Rtype160: handle := &rtaskCondHandle{ condId: v.Id, verify: this.modelRtaskRecord.verifyFirstEqualParam, @@ -176,7 +179,8 @@ func (this *ModuleRtask) getHandle(tt comm.TaskType) (handles []*rtaskCondHandle comm.Rtype42, comm.Rtype43, comm.Rtype46, comm.Rtype47, comm.Rtype52, comm.Rtype55, comm.Rtype56, - comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140: + comm.Rtype65, comm.Rtype66, comm.Rtype67, comm.Rtype68, comm.Rtype70, comm.Rtype140, + comm.Rtype168, comm.Rtype169, comm.Rtype170, comm.Rtype174, comm.Rtype179, comm.Rtype180: handle := &rtaskCondHandle{ condId: v.Id, verify: this.modelRtaskRecord.verifyGreatEqual,