diff --git a/modules/hero/api_talentreset.go b/modules/hero/api_talentreset.go index 2520dd153..7a537dd90 100644 --- a/modules/hero/api_talentreset.go +++ b/modules/hero/api_talentreset.go @@ -9,6 +9,9 @@ import ( //参数校验 func (this *apiComp) TalentResetCheck(session comm.IUserSession, req *pb.HeroTalentResetReq) (code pb.ErrorCode) { + if req.ObjId == "" { + code = pb.ErrorCode_ReqParameterError + } return } @@ -17,9 +20,21 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe heroList []*pb.DBHero chanegCard []*pb.DBHero // 推送属性变化 ) + if code = this.TalentResetCheck(session, req); code != pb.ErrorCode_Success { + return + } + + _talent, err1 := this.module.modelTalent.GetHerotalentByObjId(session.GetUserId(), req.ObjId) //根据对象id 获取数据 + if err1 != nil { + code = pb.ErrorCode_TalentErrData + return + } + if len(_talent.Talent) == 0 { // 已经是重置状态 + code = pb.ErrorCode_TalentResetState + return + } + chanegCard = make([]*pb.DBHero, 0) - heroList = this.module.GetHeroList(session.GetUserId()) - rsp := &pb.HeroTalentResetResp{} globalCnf := this.module.configure.GetGlobalAtnConf("talent_reset") // 获取重置消耗 if globalCnf == nil { @@ -34,22 +49,24 @@ func (this *apiComp) TalentReset(session comm.IUserSession, req *pb.HeroTalentRe if code = this.module.ConsumeRes(session, globalCnf.Var, true); code != pb.ErrorCode_Success { return } - list, _ := this.module.modelTalent.GetHerotalent(session.GetUserId()) - for _, v := range list { - if len(v.Talent) > 0 { - update := make(map[string]interface{}, 0) - szTalent := map[int32]int32{} - update["talent"] = szTalent - this.module.modelTalent.ChangeHeroTalent(v, update) - for _, hero := range heroList { - if hero.HeroID == v.HeroId { - this.module.modelHero.cleanTalentProperty(hero) - chanegCard = append(chanegCard, hero) // 添加推送属性变化信息 - } + + if len(_talent.Talent) > 0 { + update := make(map[string]interface{}, 0) + szTalent := map[int32]int32{} + update["talent"] = szTalent + this.module.modelTalent.ChangeHeroTalent(_talent, update) + heroList = this.module.GetHeroList(session.GetUserId()) + for _, hero := range heroList { + if hero.HeroID == _talent.HeroId { + this.module.modelHero.cleanTalentProperty(hero) + chanegCard = append(chanegCard, hero) // 添加推送属性变化信息 } } } + session.SendMsg(string(this.module.GetType()), "change", &pb.HeroChangePush{List: chanegCard}) - session.SendMsg(string(this.module.GetType()), HeroTalentResetResp, rsp) + session.SendMsg(string(this.module.GetType()), HeroTalentResetResp, &pb.HeroTalentResetResp{ + Telnet: _talent, + }) return } diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index e795d196f..10e915c8d 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -201,12 +201,18 @@ const ( ErrorCode_SociatyAdded ErrorCode = 3001 //已在公会里 ErrorCode_SociatyDiamondNoEnough ErrorCode = 3002 //钻石不足 ErrorCode_SociatyApply ErrorCode = 3003 //申请失败 + ErrorCode_SociatyNoRight ErrorCode = 3004 //无权限 + ErrorCode_SociatyNoAdded ErrorCode = 3005 //未加入公会 // arena ErrorCode_ArenaTicketBuyUp ErrorCode = 3101 //票据上限 // talent ErrorCode_TalentRepeatLearn ErrorCode = 3201 // 天赋已学习 ErrorCode_TalentErrData ErrorCode = 3202 /// 天赋不存在 ErrorCode_TalentUnLockerBefore ErrorCode = 3203 //先解锁前置天赋 +<<<<<<< HEAD +======= + ErrorCode_TalentResetState ErrorCode = 3204 //当前天赋已经是重置状态 +>>>>>>> bdc162616c093452fa61f4a055657a4898086725 ) // Enum value maps for ErrorCode. @@ -371,10 +377,16 @@ var ( 3001: "SociatyAdded", 3002: "SociatyDiamondNoEnough", 3003: "SociatyApply", + 3004: "SociatyNoRight", + 3005: "SociatyNoAdded", 3101: "ArenaTicketBuyUp", 3201: "TalentRepeatLearn", 3202: "TalentErrData", 3203: "TalentUnLockerBefore", +<<<<<<< HEAD +======= + 3204: "TalentResetState", +>>>>>>> bdc162616c093452fa61f4a055657a4898086725 } ErrorCode_value = map[string]int32{ "Success": 0, @@ -536,10 +548,16 @@ var ( "SociatyAdded": 3001, "SociatyDiamondNoEnough": 3002, "SociatyApply": 3003, + "SociatyNoRight": 3004, + "SociatyNoAdded": 3005, "ArenaTicketBuyUp": 3101, "TalentRepeatLearn": 3201, "TalentErrData": 3202, "TalentUnLockerBefore": 3203, +<<<<<<< HEAD +======= + "TalentResetState": 3204, +>>>>>>> bdc162616c093452fa61f4a055657a4898086725 } ) @@ -574,7 +592,11 @@ 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, +<<<<<<< HEAD 0x6f, 0x2a, 0xb7, 0x1c, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, +======= + 0x6f, 0x2a, 0xf8, 0x1c, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, +>>>>>>> bdc162616c093452fa61f4a055657a4898086725 0x0b, 0x0a, 0x07, 0x53, 0x75, 0x63, 0x63, 0x65, 0x73, 0x73, 0x10, 0x00, 0x12, 0x11, 0x0a, 0x0d, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x10, 0x0a, 0x12, 0x1b, 0x0a, 0x17, 0x4e, 0x6f, 0x46, 0x69, 0x6e, 0x64, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, @@ -795,6 +817,7 @@ var file_errorcode_proto_rawDesc = []byte{ 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x64, 0x64, 0x65, 0x64, 0x10, 0xb9, 0x17, 0x12, 0x1b, 0x0a, 0x16, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x44, 0x69, 0x61, 0x6d, 0x6f, 0x6e, 0x64, 0x4e, 0x6f, 0x45, 0x6e, 0x6f, 0x75, 0x67, 0x68, 0x10, 0xba, 0x17, 0x12, 0x11, 0x0a, 0x0c, 0x53, 0x6f, +<<<<<<< HEAD 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x10, 0xbb, 0x17, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x16, 0x0a, 0x11, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, @@ -803,6 +826,20 @@ var file_errorcode_proto_rawDesc = []byte{ 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, 0x72, 0x65, 0x10, 0x83, 0x19, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +======= + 0x63, 0x69, 0x61, 0x74, 0x79, 0x41, 0x70, 0x70, 0x6c, 0x79, 0x10, 0xbb, 0x17, 0x12, 0x13, 0x0a, + 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x52, 0x69, 0x67, 0x68, 0x74, 0x10, + 0xbc, 0x17, 0x12, 0x13, 0x0a, 0x0e, 0x53, 0x6f, 0x63, 0x69, 0x61, 0x74, 0x79, 0x4e, 0x6f, 0x41, + 0x64, 0x64, 0x65, 0x64, 0x10, 0xbd, 0x17, 0x12, 0x15, 0x0a, 0x10, 0x41, 0x72, 0x65, 0x6e, 0x61, + 0x54, 0x69, 0x63, 0x6b, 0x65, 0x74, 0x42, 0x75, 0x79, 0x55, 0x70, 0x10, 0x9d, 0x18, 0x12, 0x16, + 0x0a, 0x11, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x70, 0x65, 0x61, 0x74, 0x4c, 0x65, + 0x61, 0x72, 0x6e, 0x10, 0x81, 0x19, 0x12, 0x12, 0x0a, 0x0d, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, + 0x45, 0x72, 0x72, 0x44, 0x61, 0x74, 0x61, 0x10, 0x82, 0x19, 0x12, 0x19, 0x0a, 0x14, 0x54, 0x61, + 0x6c, 0x65, 0x6e, 0x74, 0x55, 0x6e, 0x4c, 0x6f, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x65, 0x66, 0x6f, + 0x72, 0x65, 0x10, 0x83, 0x19, 0x12, 0x15, 0x0a, 0x10, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, + 0x65, 0x73, 0x65, 0x74, 0x53, 0x74, 0x61, 0x74, 0x65, 0x10, 0x84, 0x19, 0x42, 0x06, 0x5a, 0x04, + 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +>>>>>>> bdc162616c093452fa61f4a055657a4898086725 } var ( diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index edb804d7f..69f1a8fb1 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -2290,7 +2290,11 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x6f, 0x62, 0x6a, 0x49, 0x64, 0x22, 0x3c, 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x65, 0x6c, +<<<<<<< HEAD 0x6e, 0x65, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, +======= + 0x6e, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, +>>>>>>> bdc162616c093452fa61f4a055657a4898086725 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x74, 0x65, 0x6c, 0x6e, 0x65, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, }