From d84f7de6dbb9a1ccf0801bc754a872ca541c8d1b Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 12 Mar 2024 10:11:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E8=84=B1=E4=B8=93=E6=AD=A6?= =?UTF-8?q?=E6=97=B6=E8=8B=B1=E9=9B=84=E6=95=B0=E6=8D=AE=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/exclusive/api_wear.go | 4 ++++ modules/hero/model_hero.go | 42 ++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/modules/exclusive/api_wear.go b/modules/exclusive/api_wear.go index 678599dbf..07731bc0e 100644 --- a/modules/exclusive/api_wear.go +++ b/modules/exclusive/api_wear.go @@ -54,6 +54,10 @@ func (this *apiComp) Wear(session comm.IUserSession, req *pb.ExclusiveWearReq) ( if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, info); errdata != nil { return } + } else { + if errdata = this.module.ModuleHero.UpdateExclusive(session, hero, nil); errdata != nil { + return + } } this.module.equipmentsChangePush(session, change) session.SendMsg(string(this.module.GetType()), "wear", &pb.ExclusiveWearResp{Exclusives: info}) diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index 3a476ab92..9a735d4b5 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -471,25 +471,31 @@ func (this *ModelHero) setExclusiveProperty(hero *pb.DBHero, exw *pb.DB_Exclusiv addProperty := make(map[int32]int32) //副属性 equipSkill := make([]*pb.SkillData, 0) - hero.Exclusiveid = exw.Id + if exw != nil { + hero.Exclusiveid = exw.Id + for k, v := range exw.Property { + addProperty[k] = v //附加属性 + } + hero.ExclusiveProperty = addProperty + if exw.Commonskill != 0 { + equipSkill = append(equipSkill, &pb.SkillData{ + SkillID: exw.Commonskill, + SkillLv: 1, + }) + } + if exw.Exclusiveskill != 0 { + equipSkill = append(equipSkill, &pb.SkillData{ + SkillID: exw.Exclusiveskill, + SkillLv: 1, + }) + } + hero.ExclusiveSkill = equipSkill + } else { + hero.Exclusiveid = "" + hero.ExclusiveProperty = addProperty + hero.ExclusiveSkill = equipSkill + } - for k, v := range exw.Property { - addProperty[k] = v //附加属性 - } - hero.ExclusiveProperty = addProperty - if exw.Commonskill != 0 { - equipSkill = append(equipSkill, &pb.SkillData{ - SkillID: exw.Commonskill, - SkillLv: 1, - }) - } - if exw.Exclusiveskill != 0 { - equipSkill = append(equipSkill, &pb.SkillData{ - SkillID: exw.Exclusiveskill, - SkillLv: 1, - }) - } - hero.ExclusiveSkill = equipSkill this.calFigthValue(hero) if err := this.ChangeList(hero.Uid, hero.Id, map[string]interface{}{ "exclusiveid": hero.Exclusiveid,