From a5ee8db5edfe9c58e31bfc0815e7b524c524a384 Mon Sep 17 00:00:00 2001 From: wh_zcy Date: Wed, 15 Mar 2023 14:23:37 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B4=BE=E9=81=A3=E9=A2=9D=E5=A4=96?= =?UTF-8?q?=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/dispatch/model_dispatch.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/dispatch/model_dispatch.go b/modules/dispatch/model_dispatch.go index 69442d20a..12f6adca2 100644 --- a/modules/dispatch/model_dispatch.go +++ b/modules/dispatch/model_dispatch.go @@ -306,12 +306,15 @@ func (this *modelDispatch) validHeroCond(uid string, taskId int32, heroId string case 1: //校验英雄的基础条件 if hero.Lv >= v.Param { ok1 = true - return } + } + } + + for _, v := range gd.Taskreqex { + switch v.Key { case 2: //校验英雄的额外要求 if hero.Star >= v.Param { ok2 = true - return } } } From ec892aa56f30a6ab2a9bc2010c954bd251e598c3 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 15 Mar 2023 15:08:01 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E7=AD=89=E7=BA=A7?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E8=B7=A8=E6=9C=8D=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 39 +++++++++++++++++++++++++++----- modules/pagoda/api_ranklist.go | 1 - modules/smithy/comp_configure.go | 3 +-- 3 files changed, 34 insertions(+), 9 deletions(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index 0999779ac..6a0dce208 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -841,9 +841,24 @@ func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update } func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, fulllvenr int32) (code pb.ErrorCode) { - _hero, code := this.GetHeroByObjID(session.GetUserId(), heroOid) - if code != pb.ErrorCode_Success { - return + var ( + _hero *pb.DBHero + model *db.DBModel + err error + ) + if this.IsCross() { + _hero = &pb.DBHero{} + if model, err = this.GetDBModuleByUid(session.GetUserId(), this.modelHero.TableName, this.modelHero.Expired); err == nil { + if err := model.GetListObj(session.GetUserId(), heroOid, _hero); err != nil { + this.Errorf("err:%v", err) + return + } + } + } else { + _hero, code = this.GetHeroByObjID(session.GetUserId(), heroOid) + if code != pb.ErrorCode_Success { + return + } } if _hero.Fulllvenr == 0 { @@ -856,9 +871,21 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, _heroMap := map[string]interface{}{ "fulllvenr": _hero.Fulllvenr, } - if err := this.modelHero.ChangeList(session.GetUserId(), _hero.Id, _heroMap); err != nil { - code = pb.ErrorCode_DBError - return + + if this.IsCross() { + if model != nil { + if err := model.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { + this.Errorf("err:%v", err) + code = pb.ErrorCode_DBError + return + } + } + } else { + if err := this.modelHero.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { // 修改英雄信息 + this.Errorf("err:%v", err) + code = pb.ErrorCode_DBError + return + } } } else { diff --git a/modules/pagoda/api_ranklist.go b/modules/pagoda/api_ranklist.go index f2cc8a92d..5ae070b1b 100644 --- a/modules/pagoda/api_ranklist.go +++ b/modules/pagoda/api_ranklist.go @@ -46,7 +46,6 @@ func (this *apiComp) RankList(session comm.IUserSession, req *pb.PagodaRankListR _dataList := rd.Val() for _, v := range _dataList { //conn_, err := db.Cross() - dbModel := db.NewDBModel(comm.TableSeasonRecord, 0, conn) result := &pb.DBPagodaRecord{} if err = dbModel.GetListObj(session.GetUserId(), v, result); err == nil { diff --git a/modules/smithy/comp_configure.go b/modules/smithy/comp_configure.go index 07797a477..5b13cf373 100644 --- a/modules/smithy/comp_configure.go +++ b/modules/smithy/comp_configure.go @@ -92,7 +92,7 @@ func (this *configureComp) CheckSmithyFirstReelConfigData(etype int32, id int32) if v, err := this.GetConfigure(game_smithyreel); err == nil { if configure, ok := v.(*cfg.GameNewSmithy); ok { for _, v := range configure.GetDataList() { - if v.Type == etype { + if v.Type == etype{ if v.Id == id { return true } else { @@ -100,7 +100,6 @@ func (this *configureComp) CheckSmithyFirstReelConfigData(etype int32, id int32) } } } - return true } } return false From 72bb00422ea4abf3347e9ef991b83aa9a786ec8f Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 15 Mar 2023 15:15:16 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=8B=B1=E9=9B=84=E5=8F=AF=E4=BB=A5?= =?UTF-8?q?=E5=8F=96=E6=B6=88=E6=B3=A8=E5=86=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index 6a0dce208..5f16f59f8 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -842,9 +842,10 @@ func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, fulllvenr int32) (code pb.ErrorCode) { var ( - _hero *pb.DBHero - model *db.DBModel - err error + _hero *pb.DBHero + model *db.DBModel + err error + _heroMap map[string]interface{} ) if this.IsCross() { _hero = &pb.DBHero{} @@ -860,37 +861,36 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, return } } - - if _hero.Fulllvenr == 0 { + _heroMap = make(map[string]interface{}) + if fulllvenr == 0 && _hero.Fulllvenr != 0 { + _heroMap["fulllvenr"] = 0 + } else if _hero.Fulllvenr == 0 && fulllvenr != 0 { // 校验有没有满级 if _hero.Lv < this.configure.GetHeroMaxLv(_hero.Star) { code = pb.ErrorCode_HeroLvNoEnough // 必须满级 return } _hero.Fulllvenr = fulllvenr - _heroMap := map[string]interface{}{ - "fulllvenr": _hero.Fulllvenr, - } + _heroMap["fulllvenr"] = _hero.Fulllvenr - if this.IsCross() { - if model != nil { - if err := model.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { - this.Errorf("err:%v", err) - code = pb.ErrorCode_DBError - return - } - } - } else { - if err := this.modelHero.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { // 修改英雄信息 + } else { + code = pb.ErrorCode_HeroIsRegister + return + } + if this.IsCross() { + if model != nil { + if err := model.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { this.Errorf("err:%v", err) code = pb.ErrorCode_DBError return } } - } else { - code = pb.ErrorCode_HeroIsRegister // 英雄已经注册过 - return + if err := this.modelHero.ChangeList(session.GetUserId(), heroOid, _heroMap); err != nil { // 修改英雄信息 + this.Errorf("err:%v", err) + code = pb.ErrorCode_DBError + return + } } return } From ea02710279db3c8a0e39d7c00d1aca89d35ca083 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Wed, 15 Mar 2023 15:33:43 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=8E=A8=E9=80=81=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/modules/hero/module.go b/modules/hero/module.go index 5f16f59f8..0efb2818b 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -842,10 +842,11 @@ func (this *Hero) InRange(heroRecord *pb.DBHeroRecord, strPool []string, update func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, fulllvenr int32) (code pb.ErrorCode) { var ( - _hero *pb.DBHero - model *db.DBModel - err error - _heroMap map[string]interface{} + _hero *pb.DBHero + model *db.DBModel + err error + _heroMap map[string]interface{} + _changeHero []*pb.DBHero // 变化的英雄 ) if this.IsCross() { _hero = &pb.DBHero{} @@ -892,6 +893,8 @@ func (this *Hero) RegisterInstructor(session comm.IUserSession, heroOid string, return } } + _changeHero = append(_changeHero, _hero) + session.SendMsg(string(this.GetType()), "change", &pb.HeroChangePush{List: _changeHero}) return }