From c72dac29758c93e97d68b43126c7cccba6fc8439 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Jan 2024 10:58:21 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/plunder/api_challenge.go | 15 ++++++++++++++- modules/plunder/api_challengeover.go | 26 ++++++++++++++++++++++---- modules/plunder/api_reach.go | 3 ++- pb/errorcode.pb.go | 10 +++++++--- 4 files changed, 45 insertions(+), 9 deletions(-) diff --git a/modules/plunder/api_challenge.go b/modules/plunder/api_challenge.go index 6bf78125d..a2b9b4c81 100644 --- a/modules/plunder/api_challenge.go +++ b/modules/plunder/api_challenge.go @@ -58,7 +58,20 @@ func (this *apiComp) Challenge(session comm.IUserSession, req *pb.PlunderChallen return } } - + if req.Pos >= int32(len(list.Line)) { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + return + } + if list.Line[req.Pos].Closetime == -1 { // 队列没解锁 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_PlunderLineUnlock, + Title: pb.ErrorCode_PlunderLineUnlock.ToString(), + } + return + } // 配置校验 if conf, err = this.module.configure.getGamePlunderDataById(list.Source[req.Index]); err != nil { errdata = &pb.ErrorData{ diff --git a/modules/plunder/api_challengeover.go b/modules/plunder/api_challengeover.go index 62eecab03..f0debd4ca 100644 --- a/modules/plunder/api_challengeover.go +++ b/modules/plunder/api_challengeover.go @@ -38,9 +38,11 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha shipData *pb.ShipData // 船 users []string update map[string]interface{} // + newShip map[string]*pb.ShipData ) update = make(map[string]interface{}) changExp = make(map[string]int32, 0) + newShip = make(map[string]*pb.ShipData, 0) if errdata = this.ChallengeOverCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } @@ -76,6 +78,20 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha } return } + if req.Pos >= int32(len(list.Line)) { + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_ReqParameterError, + Title: pb.ErrorCode_ReqParameterError.ToString(), + } + return + } + if list.Line[req.Pos].Closetime == -1 { // 队列没解锁 + errdata = &pb.ErrorData{ + Code: pb.ErrorCode_PlunderLineUnlock, + Title: pb.ErrorCode_PlunderLineUnlock.ToString(), + } + return + } // 校验通过 errdata, isWin = this.module.battle.CheckBattleReport(session, req.Report) if errdata != nil { @@ -116,11 +132,13 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha } list.Count++ update["count"] = list.Count - list.Line[req.Index].Oid = _id + + list.Line[req.Pos].Oid = _id update["line"] = list.Line list.Setout = append(list.Setout, req.Index) update["setout"] = list.Setout - + // 广播用 + newShip[_id] = shipData this.module.modelPlunder.changePlunderData(session.GetUserId(), update) // 此处需要redis 锁 land.Ship[_id] = shipData // 一条新船 @@ -130,7 +148,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha }) // 通知大家 this.module.SendMsgToUsers(string(this.module.GetType()), "change", &pb.PlunderChangePush{ - Ship: land.Ship, + Ship: newShip, }, users...) if battleConf.Carexe > 0 { var heroObjs []string @@ -162,7 +180,7 @@ func (this *apiComp) ChallengeOver(session comm.IUserSession, req *pb.PlunderCha } session.SendMsg(string(this.module.GetType()), "challengeover", &pb.PlunderChallengeOverResp{ Line: list.Line, - Ship: map[string]*pb.ShipData{}, + Ship: land.Ship, Atno: atno, Heroexp: changExp, }) diff --git a/modules/plunder/api_reach.go b/modules/plunder/api_reach.go index 5b9f05384..759667259 100644 --- a/modules/plunder/api_reach.go +++ b/modules/plunder/api_reach.go @@ -22,8 +22,9 @@ func (this *apiComp) Reach(session comm.IUserSession, req *pb.PlunderReachReq) ( err error list *pb.DBPlunder land *pb.DBPlunderLand // 岛屿数据 + //changeShip map[string]*pb.ShipData // 变化的信息 ) - + //changeShip = make(map[string]*pb.ShipData, 0) if errdata = this.ReachCheck(session, req); errdata != nil { return // 参数校验失败直接返回 } diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index 45ef88b66..f495f4947 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -473,6 +473,7 @@ const ( ErrorCode_TntegralDayMaxChallenge ErrorCode = 5301 // 当日挑战达上限 //plunder ErrorCode_PlunderNotFoundShip ErrorCode = 5401 // pvp 没找到数据 + ErrorCode_PlunderLineUnlock ErrorCode = 5402 // 队列没解锁 ) // Enum value maps for ErrorCode. @@ -881,6 +882,7 @@ var ( 5212: "EntertainNoSkillCard", 5301: "TntegralDayMaxChallenge", 5401: "PlunderNotFoundShip", + 5402: "PlunderLineUnlock", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -1286,6 +1288,7 @@ var ( "EntertainNoSkillCard": 5212, "TntegralDayMaxChallenge": 5301, "PlunderNotFoundShip": 5401, + "PlunderLineUnlock": 5402, } ) @@ -1320,7 +1323,7 @@ var File_errorcode_proto protoreflect.FileDescriptor var file_errorcode_proto_rawDesc = []byte{ 0x0a, 0x0f, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x2a, 0x94, 0x4b, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xac, 0x4b, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x47, 0x61, 0x74, 0x65, 0x77, 0x61, 0x79, 0x45, 0x78, 0x63, 0x65, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x10, 0x01, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, @@ -1921,8 +1924,9 @@ var file_errorcode_proto_rawDesc = []byte{ 0x12, 0x1c, 0x0a, 0x17, 0x54, 0x6e, 0x74, 0x65, 0x67, 0x72, 0x61, 0x6c, 0x44, 0x61, 0x79, 0x4d, 0x61, 0x78, 0x43, 0x68, 0x61, 0x6c, 0x6c, 0x65, 0x6e, 0x67, 0x65, 0x10, 0xb5, 0x29, 0x12, 0x18, 0x0a, 0x13, 0x50, 0x6c, 0x75, 0x6e, 0x64, 0x65, 0x72, 0x4e, 0x6f, 0x74, 0x46, 0x6f, 0x75, 0x6e, - 0x64, 0x53, 0x68, 0x69, 0x70, 0x10, 0x99, 0x2a, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x64, 0x53, 0x68, 0x69, 0x70, 0x10, 0x99, 0x2a, 0x12, 0x16, 0x0a, 0x11, 0x50, 0x6c, 0x75, 0x6e, + 0x64, 0x65, 0x72, 0x4c, 0x69, 0x6e, 0x65, 0x55, 0x6e, 0x6c, 0x6f, 0x63, 0x6b, 0x10, 0x9a, 0x2a, + 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( From 3caf880fdf5efc8d98fd762838bd669b29caa345 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Jan 2024 11:13:21 +0800 Subject: [PATCH 2/4] =?UTF-8?q?GM=20=E6=BB=A1=E8=8B=B1=E9=9B=84,=20?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=97=A7=E8=8B=B1=E9=9B=84=20=E5=B9=B6?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=E8=A7=89=E9=86=92=E6=8A=80=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/hero/module.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/modules/hero/module.go b/modules/hero/module.go index 25ccfe8b0..3c37c52fe 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -419,6 +419,8 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat if bTalent { this.modelTalent.CleanAllHeroTalent(session.GetUserId()) } + // 清除所有英雄 + this.modelHero.RemoveUserHeroInfo(session.GetUserId()) data := this.modelHero.module.configure.GetHeroConfigData() var ( changeHero []*pb.DBHero @@ -461,6 +463,22 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat Message: err.Error(), } } + // 觉醒技能带入 + for i := 1; i <= maxJux; i++ { + if awakenData, err := this.configure.GetHeroAwakenConfig(cid, int32(i)); err == nil { + if awakenData.Skill != 0 { + skillMaxLv := this.configure.GetHeroSkillMaxLvConfig(uint32(awakenData.Skill)) + hero.Awakenskill = append(hero.Awakenskill, &pb.SkillData{ + SkillID: awakenData.Skill, + SkillLv: skillMaxLv, + }) + + } + } else { + break + } + } + //this.modelHero.resetJuexingProperty(hero) // 获取满级技能 for _, skill := range hero.NormalSkill { skillMaxLv := this.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID)) @@ -482,6 +500,7 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat "property": hero.Property, "horoscopeProperty": hero.HoroscopeProperty, "juexProperty": hero.JuexProperty, + "awakenskill": hero.Awakenskill, } if bTalent { // 满天赋 From 3d6fc46cc2ccbc7e1d08f53d36dd6cc9b13ec37c Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Jan 2024 11:57:44 +0800 Subject: [PATCH 3/4] =?UTF-8?q?gm=20=E6=BB=A1=E5=B1=9E=E6=80=A7=E8=8B=B1?= =?UTF-8?q?=E9=9B=84=20=E5=A4=A9=E8=B5=8B=E6=8A=80=E8=83=BD=E5=B8=A6?= =?UTF-8?q?=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/imodule.go | 2 +- modules/gm/module.go | 4 +-- modules/hero/model_hero.go | 2 +- modules/hero/module.go | 53 +++++++++++++++++++------------------- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/comm/imodule.go b/comm/imodule.go index ab3fd5d7f..899b48b7f 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -135,7 +135,7 @@ type ( CheckJuexingHeroNum(uid string, juexingLv int32, star int32) int32 // 获取所有满星满级满觉醒的英雄 - GetAllMaxHero(session IUserSession, bTalent bool) (errdata *pb.ErrorData) + GetAllMaxHero(session IUserSession) (errdata *pb.ErrorData) // 教习登记 RegisterInstructor(session IUserSession, heroOid []string, registerId int32) (errdata *pb.ErrorData) diff --git a/modules/gm/module.go b/modules/gm/module.go index f0c00a8f5..64a41f79f 100644 --- a/modules/gm/module.go +++ b/modules/gm/module.go @@ -193,7 +193,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er return } - errdata = module1.(comm.IHero).GetAllMaxHero(session, false) + errdata = module1.(comm.IHero).GetAllMaxHero(session) this.Debug("使用bingo命令:uid = %s ", log.Field{Key: "uid", Value: session.GetUserId()}, log.Field{Key: "0", Value: datas[0]}, @@ -650,7 +650,7 @@ func (this *GM) CreateCmd(session comm.IUserSession, cmd string) (errdata *pb.Er return } - errdata = module1.(comm.IHero).GetAllMaxHero(session, true) + errdata = module1.(comm.IHero).GetAllMaxHero(session) module1, err = this.service.GetModule(comm.ModuleMainline) if err != nil { diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 96883df78..69a04f764 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -728,7 +728,7 @@ func (this *ModelHero) resetTalentProperty(hero *pb.DBHero) { if hero == nil { return } - if rst, err := this.module.modelTalent.GetHerotalent(hero.Uid); err != nil { + if rst, err := this.module.modelTalent.GetHerotalent(hero.Uid); err == nil { for _, v := range rst { if v.HeroId == hero.HeroID { // 找到对应的英雄 for k := range v.Talent { diff --git a/modules/hero/module.go b/modules/hero/module.go index 3c37c52fe..5d676f01e 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -415,10 +415,10 @@ func (this *Hero) CheckJuexingHeroNum(uid string, juexingLv int32, star int32) i } // 获取所有满星满级满觉醒的英雄 -func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdata *pb.ErrorData) { - if bTalent { - this.modelTalent.CleanAllHeroTalent(session.GetUserId()) - } +func (this *Hero) GetAllMaxHero(session comm.IUserSession) (errdata *pb.ErrorData) { + + this.modelTalent.CleanAllHeroTalent(session.GetUserId()) + // 清除所有英雄 this.modelHero.RemoveUserHeroInfo(session.GetUserId()) data := this.modelHero.module.configure.GetHeroConfigData() @@ -478,7 +478,6 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat break } } - //this.modelHero.resetJuexingProperty(hero) // 获取满级技能 for _, skill := range hero.NormalSkill { skillMaxLv := this.configure.GetHeroSkillMaxLvConfig(uint32(skill.SkillID)) @@ -489,7 +488,29 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat hero.Lv = maxLv hero.Star = maxStar hero.JuexingLv = int32(maxJux) + + if true { // 满天赋 + talent, _ := this.modelTalent.CreateHeroTalent(session.GetUserId(), hero.HeroID) + data, err := this.configure.GMGetTalentByHeroId(hero.HeroID) + if err == nil { + for _, v := range data { + talent.Talent[v.Skillid] = 1 + if v.Skill != 0 { + hero.Talentskill = append(hero.Talentskill, &pb.SkillData{ + SkillID: v.Skill, + SkillLv: 1, + }) + } + } + } + update := make(map[string]interface{}, 0) + update["talent"] = talent.Talent + if err = this.modelTalent.ChangeHeroTalent(talent, update); err != nil { + this.Errorf("update failed :%v", err) + } + } this.modelHero.PropertyCompute(hero) // 重新计算属性 + _heroMap := map[string]interface{}{ "lv": hero.Lv, "star": hero.Star, @@ -501,29 +522,9 @@ func (this *Hero) GetAllMaxHero(session comm.IUserSession, bTalent bool) (errdat "horoscopeProperty": hero.HoroscopeProperty, "juexProperty": hero.JuexProperty, "awakenskill": hero.Awakenskill, + "talentskill": hero.Talentskill, } - if bTalent { // 满天赋 - talent, _ := this.modelTalent.CreateHeroTalent(session.GetUserId(), hero.HeroID) - data, err := this.configure.GMGetTalentByHeroId(hero.HeroID) - if err == nil { - for _, v := range data { - talent.Talent[v.Skillid] = 1 - } - } - update := make(map[string]interface{}, 0) - update["talent"] = talent.Talent - if err = this.modelTalent.ChangeHeroTalent(talent, update); err != nil { - this.Errorf("update failed :%v", err) - } - // talent.Talent[req.TalentID] = 1 - // update := make(map[string]interface{}, 0) - // update["talent"] = talent.Talent - // if err = this.module.modelTalent.ChangeHeroTalent(talent, update); err != nil { - // this.module.Errorf("update failed :%v", err) - // } - // this.modelHero.setTalentProperty(hero) - } // 保存数据 err = this.modelHero.ChangeList(session.GetUserId(), hero.Id, _heroMap) if err != nil { From 39735362829d2cf13042605fa6b51ea5f10854b7 Mon Sep 17 00:00:00 2001 From: meixiongfeng <766881921@qq.com> Date: Fri, 19 Jan 2024 11:59:07 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=B7=E6=96=B0=E8=B4=A7=E7=89=A9=20?= =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=B7=B2=E5=87=BA=E5=8F=91=E7=9A=84=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/plunder/api_refresh.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/plunder/api_refresh.go b/modules/plunder/api_refresh.go index d25740fd9..d7aefed84 100644 --- a/modules/plunder/api_refresh.go +++ b/modules/plunder/api_refresh.go @@ -28,8 +28,10 @@ func (this *apiComp) Refresh(session comm.IUserSession, req *pb.PlunderRefreshRe } // 刷新货物 list.Source, err = this.module.modelPlunder.refreshGoodsInfo() + list.Setout = []int32{} this.module.modelPlunder.changePlunderData(session.GetUserId(), map[string]interface{}{ "source": list.Source, + "setout": list.Setout, }) session.SendMsg(string(this.module.GetType()), "refresh", &pb.PlunderRefreshResp{ Source: list.Source,