From 80919efbd924d13a116b346bbeead42d6e67480d Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Tue, 22 Nov 2022 18:50:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BE=81=E7=BB=8A=E5=9F=8B=E7=82=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 7 +++++++ modules/gourmet/model_gourmet.go | 1 + modules/hero/api_resonance.go | 5 ++++- modules/hero/module.go | 11 +++++++++++ modules/library/api_usegift.go | 9 +++++++++ modules/library/module.go | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 64 insertions(+), 1 deletion(-) diff --git a/comm/imodule.go b/comm/imodule.go index b01751a38..41d828b1b 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -83,6 +83,7 @@ type ( //拥有觉醒至A级的B星英雄N个 Rtype123 CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32 //拥有共鸣至N级的英雄 Rtype124 + CheckResonaceHeroNum(uid string, resonaceLv int32) int32 } //玩家 @@ -302,4 +303,10 @@ type ( ///红点 IReddot } + ILibrary interface { + //与N个英雄好感度等级达到A + CheckRtype132(uid string, num int32, lv int32) bool + //与指定英雄好感度等级达到N + CheckRtype133(uid string, heroId string, lv int32) bool + } ) diff --git a/modules/gourmet/model_gourmet.go b/modules/gourmet/model_gourmet.go index 8c5d4ed60..0febbcdd7 100644 --- a/modules/gourmet/model_gourmet.go +++ b/modules/gourmet/model_gourmet.go @@ -149,6 +149,7 @@ func (this *modelGourmet) CalculationGourmet(uid string, gourmet *pb.DBGourmet) mapData["cookingFood"] = gourmet.CookingFood // 正在做的 this.module.ModifyGourmetData(uid, mapData) // 同步数据 + } // 技能等级提高了 重新计算订单时间(只对订单中数据有影响) diff --git a/modules/hero/api_resonance.go b/modules/hero/api_resonance.go index 0f3fd7865..1a294aa0a 100644 --- a/modules/hero/api_resonance.go +++ b/modules/hero/api_resonance.go @@ -4,6 +4,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" + "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -150,10 +151,12 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR // 任务相关 this.module.ModuleRtask.SendToRtask(session, comm.Rtype39, 1) + this.module.ModuleRtask.SendToRtask(session, comm.Rtype127, _hero.Star, utils.ToInt32(_hero.HeroID), _hero.ResonateNum) //A星英雄共鸣N级 this.module.ModuleRtask.SendToRtask(session, comm.Rtype40, 1, 1) cfg := this.module.configure.GetHeroConfig(_hero.HeroID) if cfg != nil { - this.module.ModuleRtask.SendToRtask(session, comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, _hero.JuexingLv) + this.module.ModuleRtask.SendToRtask(session, comm.Rtype126, cfg.Race, _hero.ResonateNum) + this.module.ModuleRtask.SendToRtask(session, comm.Rtype36, 1, cfg.Color, cfg.Job, cfg.Race, _hero.ResonateNum) //xx英雄满级、共鸣、觉醒至最高状态 nextAwaken := this.module.configure.GetHeroAwakenConfig(_hero.HeroID, _hero.JuexingLv+1) if nextAwaken == nil { // 达到满级觉醒 diff --git a/modules/hero/module.go b/modules/hero/module.go index c98e48210..9b67927b8 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -591,3 +591,14 @@ func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) i } return int32(len(tmp)) } + +//拥有共鸣至N级的英雄 +func (this *Hero) CheckResonaceHeroNum(uid string, resonaceLv int32) int32 { + tmp := make([]*pb.DBHero, 0) + for _, v := range this.modelHero.getHeroList(uid) { + if v.ResonateNum >= resonaceLv { + tmp = append(tmp, v) + } + } + return int32(len(tmp)) +} diff --git a/modules/library/api_usegift.go b/modules/library/api_usegift.go index e04380a6e..d7113444d 100644 --- a/modules/library/api_usegift.go +++ b/modules/library/api_usegift.go @@ -4,6 +4,7 @@ import ( "go_dreamfactory/comm" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" + "go_dreamfactory/utils" "google.golang.org/protobuf/proto" ) @@ -22,6 +23,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe totalExp int32 curStar int32 // 配置表星级 maxLv int32 // 羁绊最大等级 + upLv int32 ) code = this.UseGiftCheck(session, req) if code != pb.ErrorCode_Success { @@ -76,6 +78,7 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe if favorConf[_heroObj.Favorlv] <= _heroObj.Favorexp { _heroObj.Favorexp -= favorConf[_heroObj.Favorlv] _heroObj.Favorlv += 1 + upLv++ } else { break } @@ -91,5 +94,11 @@ func (this *apiComp) UseGift(session comm.IUserSession, req *pb.LibraryUseGiftRe rsp.Data = _heroObj session.SendMsg(string(this.module.GetType()), LibraryUseGiftResp, rsp) + // 任务统计 + //赠送英雄礼物并增加N点好感度 + if upLv > 0 { + this.module.ModuleRtask.SendToRtask(session, comm.Rtype134, utils.ToInt32(_heroObj.Heroid), upLv) + } + return } diff --git a/modules/library/module.go b/modules/library/module.go index cebe34f65..e6b0fa62c 100644 --- a/modules/library/module.go +++ b/modules/library/module.go @@ -240,3 +240,35 @@ func (this *Library) Rpc_ModuleFetter(ctx context.Context, args *pb.RPCGeneralRe } return } + +//与N个英雄好感度等级达到A +func (this *Library) CheckRtype132(uid string, num int32, lv int32) bool { + fetter := this.GetHeroFetterList(uid) + if len(fetter) == 0 { + return false + } + for _, v := range fetter { + if v.Favorlv >= lv { + num-- + } + } + if num >= 0 { + return true + } + return false +} + +//与指定英雄好感度等级达到N +func (this *Library) CheckRtype133(uid string, heroId string, lv int32) bool { + fetter := this.GetHeroFetterList(uid) + if len(fetter) == 0 { + return false + } + for _, v := range fetter { + if v.Heroid == heroId && v.Favorlv >= lv { + return true + } + } + + return false +}