diff --git a/comm/imodule.go b/comm/imodule.go index afea3c954..abb0f66b8 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -70,6 +70,9 @@ type ( AddNewEquipments(source *ModuleCallSource, uid string, cIds map[int32]uint32) (code pb.ErrorCode) } IStory interface { - ModifyStoryData(uid string, objid string, data interface{}) (code pb.ErrorCode) + // 修改章节信息 + ModifyStoryData(uid string, objId string, data interface{}) (code pb.ErrorCode) + // 检查能不能挑战该关卡 + CheckChallengeChapter(stroyId int32, uid string, zhangjieID int32) (code pb.ErrorCode) } ) diff --git a/modules/hero/api.go b/modules/hero/api.go index a3db149e5..e37b64ef3 100644 --- a/modules/hero/api.go +++ b/modules/hero/api.go @@ -22,6 +22,7 @@ const ( //消息回复的头名称 StrengthenUpSkill = "strengthenupskill" // 技能强化 StrengthenUpStar = "strengthensupstar" // 英雄升星 Awaken = "awaken" // 英雄觉醒 + HeroLock = "lock" // 英雄锁定 ) //组件初始化接口 diff --git a/modules/hero/api_lock.go b/modules/hero/api_lock.go new file mode 100644 index 000000000..57ef87610 --- /dev/null +++ b/modules/hero/api_lock.go @@ -0,0 +1,50 @@ +package hero + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/lego/sys/log" + "go_dreamfactory/pb" + + "google.golang.org/protobuf/proto" +) + +//参数校验 +func (this *apiComp) LockCheck(session comm.IUserSession, req *pb.HeroLockReq) (code pb.ErrorCode) { + if req.Heroid == "" { + code = pb.ErrorCode_ReqParameterError + return + } + + return +} + +/// 英雄锁定 +func (this *apiComp) Lock(session comm.IUserSession, req *pb.HeroLockReq) (code pb.ErrorCode, data proto.Message) { + + _hero, err := this.module.GetHero(session.GetUserId(), req.Heroid) + defer func() { + if code == pb.ErrorCode_Success { + session.SendMsg(string(this.module.GetType()), HeroLock, &pb.HeroAwakenResp{Hero: _hero}) + } + }() + if err != pb.ErrorCode_Success { + code = pb.ErrorCode_HeroNoExist + return + } + code = this.LockCheck(session, req) // check + if code != pb.ErrorCode_Success { + return + } + _hero.Block = !_hero.Block // 修改是否锁定状态 + _heroMap := map[string]interface{}{ + "block": _hero.Block, + } + // 保存数据 + err1 := this.module.modelHero.modifyHeroData(session.GetUserId(), _hero.Id, _heroMap) + if err1 != nil { + code = pb.ErrorCode_DBError + log.Errorf("update hero skill failed:%v", err1) + } + + return +} diff --git a/modules/hero/api_resonance.go b/modules/hero/api_resonance.go index 02602cde8..dcc5f2f1a 100644 --- a/modules/hero/api_resonance.go +++ b/modules/hero/api_resonance.go @@ -53,11 +53,10 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR code = pb.ErrorCode_HeroMaxResonate // 共鸣次数已满 return } - var _costHero *pb.DBHero for k, v := range szCostHero { - bCheck := false for _, v1 := range resonConfig.Heroneed { + if v1.A == comm.HeroType { totalCostCard += 1 } @@ -66,22 +65,21 @@ func (this *apiComp) Resonance(session comm.IUserSession, req *pb.HeroResonanceR code = pb.ErrorCode_ConfigurationException return } - if int32(value) == _costHero.HeroID && v1.N == v { // 校验消耗类型是否一致 - bCheck = true - break - } - } - if bCheck { _costHero, code = this.module.GetHero(session.GetUserId(), k) // 查询消耗卡是否存在 - if code != pb.ErrorCode_Success && _costHero.SameCount <= v { + if code != pb.ErrorCode_Success { // 英雄被锁不能消耗 + code = pb.ErrorCode_HeroNoEnough + return + } + if _costHero.Block { + code = pb.ErrorCode_HeroIsLock + } + if int32(value) == _costHero.HeroID && (v1.N != v || _costHero.SameCount < v) { code = pb.ErrorCode_HeroNoEnough return } - } else { - code = pb.ErrorCode_HeroNoEnough // 校验失败 - return } } + if int32(len(req.CostObjID)) != totalCostCard { // 总数消耗校验 code = pb.ErrorCode_HeroNoEnough // 消耗数量不对应 return diff --git a/modules/hero/api_skillUp.go b/modules/hero/api_skillUp.go index 4d070142e..c643e1e66 100644 --- a/modules/hero/api_skillUp.go +++ b/modules/hero/api_skillUp.go @@ -52,6 +52,10 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, req *pb.HeroSt code = pb.ErrorCode_HeroNoExist return } + if _costHero.Block { // 锁定的卡不允许被消耗 + code = pb.ErrorCode_HeroIsLock + return + } // 查询配置表 找出原始品质 tmp := this.module.configure.GetHero(_hero.HeroID) if tmp == nil { diff --git a/modules/hero/api_starUp.go b/modules/hero/api_starUp.go index 3b90fdd3b..c7ba7d441 100644 --- a/modules/hero/api_starUp.go +++ b/modules/hero/api_starUp.go @@ -60,6 +60,10 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr code = pb.ErrorCode_ReqParameterError return } else { + if tagHero.Block { // 锁定的卡不允许被消耗 + code = pb.ErrorCode_HeroIsLock + return + } if tagHero.SameCount < v.Amount { // 校验数量 code = pb.ErrorCode_ReqParameterError return @@ -77,6 +81,10 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, req *pb.HeroStr code = pb.ErrorCode_ReqParameterError return } else { + if raceHero.Block { // 锁定的卡不允许被消耗 + code = pb.ErrorCode_HeroIsLock + return + } // 校验阵容信息 if raceHero.Star != target.Needracestar { code = pb.ErrorCode_ReqParameterError diff --git a/modules/hero/api_strengthen.go b/modules/hero/api_strengthen.go index 5532579e3..9e4acedf8 100644 --- a/modules/hero/api_strengthen.go +++ b/modules/hero/api_strengthen.go @@ -53,6 +53,10 @@ func (this *apiComp) StrengthenUplv(session comm.IUserSession, req *pb.HeroStren code = pb.ErrorCode_HeroNoExist return } + if _expHero.Block { // 锁定的卡不允许被消耗 + code = pb.ErrorCode_HeroIsLock + return + } curLv = _hero.Lv curExp = _hero.Exp // 当前英雄的经验 addExp = 1000 diff --git a/modules/hero/module.go b/modules/hero/module.go index 31a511bd7..f4803d3d6 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -18,7 +18,6 @@ type Hero struct { api *apiComp configure *configureComp modelHero *ModelHero - items comm.IItems } //模块名 diff --git a/modules/mail/api.go b/modules/mail/api.go index ee0aa90a1..ad063b9a9 100644 --- a/modules/mail/api.go +++ b/modules/mail/api.go @@ -1,7 +1,6 @@ package mail import ( - "go_dreamfactory/comm" "go_dreamfactory/modules" "go_dreamfactory/lego/core" @@ -19,7 +18,6 @@ type apiComp struct { modules.MCompGate service core.IService module *Mail - items comm.IItems } func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { @@ -32,12 +30,6 @@ func (this *apiComp) Init(service core.IService, module core.IModule, comp core. func (this *apiComp) Start() (err error) { err = this.MCompGate.Start() - var module core.IModule - - if module, err = this.service.GetModule(comm.ModuleItems); err != nil { - return - } - this.items = module.(comm.IItems) return } diff --git a/modules/story/comp_configure.go b/modules/story/comp_configure.go index a570d0f12..2e3b44daf 100644 --- a/modules/story/comp_configure.go +++ b/modules/story/comp_configure.go @@ -16,12 +16,12 @@ const ( ) ///配置管理基础组件 -type MCompConfigure struct { +type configureComp struct { cbase.ModuleCompBase } //组件初始化接口 -func (this *MCompConfigure) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { +func (this *configureComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { err = this.ModuleCompBase.Init(service, module, comp, options) err = this.LoadMultiConfigure(map[string]interface{}{ game_storychapter: cfg.NewGame_storyChapter, @@ -34,7 +34,7 @@ func (this *MCompConfigure) Init(service core.IService, module core.IModule, com } //加载多个配置文件 -func (this *MCompConfigure) LoadMultiConfigure(confs map[string]interface{}) (err error) { +func (this *configureComp) LoadMultiConfigure(confs map[string]interface{}) (err error) { for k, v := range confs { err = configure.RegisterConfigure(k, v) if err != nil { @@ -46,11 +46,11 @@ func (this *MCompConfigure) LoadMultiConfigure(confs map[string]interface{}) (er } //读取配置数据 -func (this *MCompConfigure) GetConfigure(name string) (v interface{}, err error) { +func (this *configureComp) GetConfigure(name string) (v interface{}, err error) { return configure.GetConfigure(name) } -func (this *MCompConfigure) GetStoryChapter(id int32) (data *cfg.Game_storyChapterData) { +func (this *configureComp) GetStoryChapter(id int32) (data *cfg.Game_storyChapterData) { if v, err := this.GetConfigure(game_storychapter); err != nil { log.Errorf("get global conf err:%v", err) return @@ -72,7 +72,7 @@ func (this *MCompConfigure) GetStoryChapter(id int32) (data *cfg.Game_storyChapt } // 获取简单的关卡配置信息 -func (this *MCompConfigure) GetStoryEasyChapter(id int32) (data *cfg.Game_storyEasyData) { +func (this *configureComp) GetStoryEasyChapter(id int32) (data *cfg.Game_storyEasyData) { if v, err := this.GetConfigure(game_storyeasy); err != nil { log.Errorf("get global conf err:%v", err) return @@ -94,7 +94,7 @@ func (this *MCompConfigure) GetStoryEasyChapter(id int32) (data *cfg.Game_storyE } // 获取炼狱级别难度的关卡配置 -func (this *MCompConfigure) GetStoryPurgatoryChapter(id int32) (data *cfg.Game_storyPurgatoryData) { +func (this *configureComp) GetStoryPurgatoryChapter(id int32) (data *cfg.Game_storyPurgatoryData) { if v, err := this.GetConfigure(game_storypurgatory); err != nil { log.Errorf("get global conf err:%v", err) return @@ -116,7 +116,7 @@ func (this *MCompConfigure) GetStoryPurgatoryChapter(id int32) (data *cfg.Game_s } // 获取困难的关卡配置 -func (this *MCompConfigure) GetStoryHardChapter(id int32) (data *cfg.Game_storyHardData) { +func (this *configureComp) GetStoryHardChapter(id int32) (data *cfg.Game_storyHardData) { if v, err := this.GetConfigure(game_storyhard); err != nil { log.Errorf("get global conf err:%v", err) return diff --git a/modules/story/module.go b/modules/story/module.go index a4fd3f47e..4e9014a06 100644 --- a/modules/story/module.go +++ b/modules/story/module.go @@ -5,12 +5,14 @@ import ( "go_dreamfactory/lego/core" "go_dreamfactory/modules" "go_dreamfactory/pb" + "sort" ) type Story struct { modules.ModuleBase modelStory *ModelStory api *apiComp + configure *configureComp } func NewModule() core.IModule { @@ -31,13 +33,57 @@ func (this *Story) OnInstallComp() { this.ModuleBase.OnInstallComp() this.api = this.RegisterComp(new(apiComp)).(*apiComp) this.modelStory = this.RegisterComp(new(ModelStory)).(*ModelStory) + this.configure = this.RegisterComp(new(configureComp)).(*configureComp) } // 接口信息 给其他模块调用 用来修改主线关卡信息 -func (this *Story) ModifyStoryData(uid string, objid string, data map[string]interface{}) (code pb.ErrorCode) { - err := this.modelStory.modifyStoryData(uid, objid, data) +func (this *Story) ModifyStoryData(uid string, objId string, data map[string]interface{}) (code pb.ErrorCode) { + err := this.modelStory.modifyStoryData(uid, objId, data) if err != nil { code = pb.ErrorCode_DBError } return } + +// 校验是否能挑战该关卡 +func (this *Story) CheckChallengeChapter(stroyId int32, uid string, zhangjieID int32) (code pb.ErrorCode) { + var ( + curChapter *pb.DBStory + ) + _szData, err := this.modelStory.getStoryList(uid) + if err != nil { + code = pb.ErrorCode_DBError + return + } + sort.SliceStable(_szData, func(i, j int) bool { // 排序 + return _szData[i].ChapterId > _szData[j].ChapterId + }) + + // 取出最后一条数据 + curChapter = _szData[len(_szData)-1] + if curChapter == nil { + code = pb.ErrorCode_StoryNotFindChapter // 没有找到主线关卡信息 + return + } + // 获取关卡难度用来取配置文件 + switch curChapter.Intensity { + case 1: + configData := this.configure.GetStoryEasyChapter(curChapter.StoryId) + if configData != nil { // 校验章节 + if configData.Zhangshu != zhangjieID { + code = pb.ErrorCode_ConfigNoFound + return + } + // 判断下一关是不是当前传入的值 + if configData.Nextid != stroyId { + code = pb.ErrorCode_StoryIDFailed + return + } + } + break + case 2: + break + + } + return +} diff --git a/pb/errorcode.pb.go b/pb/errorcode.pb.go index d0a4bea73..3880b336c 100644 --- a/pb/errorcode.pb.go +++ b/pb/errorcode.pb.go @@ -82,9 +82,13 @@ const ( ErrorCode_HeroCreate ErrorCode = 1310 // 创建卡失败 ErrorCode_HeroEquipUpdate ErrorCode = 1311 // 更新装备失败 ErrorCode_HeroMaxAwaken ErrorCode = 1312 // 达到最大觉醒等级 + ErrorCode_HeroIsLock ErrorCode = 1313 // 英雄被锁定不能被消耗 // equipment ErrorCode_EquipmentOnFoundEquipment ErrorCode = 1400 // 未找到武器 ErrorCode_EquipmentLvlimitReached ErrorCode = 1401 // 武器等级已达上限 + // mainStory + ErrorCode_StoryNotFindChapter ErrorCode = 1500 // 没有找到主线关卡信息 + ErrorCode_StoryIDFailed ErrorCode = 1501 // 关卡ID 错误 ) // Enum value maps for ErrorCode. @@ -145,8 +149,11 @@ var ( 1310: "HeroCreate", 1311: "HeroEquipUpdate", 1312: "HeroMaxAwaken", + 1313: "HeroIsLock", 1400: "EquipmentOnFoundEquipment", 1401: "EquipmentLvlimitReached", + 1500: "StoryNotFindChapter", + 1501: "StoryIDFailed", } ErrorCode_value = map[string]int32{ "Success": 0, @@ -204,8 +211,11 @@ var ( "HeroCreate": 1310, "HeroEquipUpdate": 1311, "HeroMaxAwaken": 1312, + "HeroIsLock": 1313, "EquipmentOnFoundEquipment": 1400, "EquipmentLvlimitReached": 1401, + "StoryNotFindChapter": 1500, + "StoryIDFailed": 1501, } ) @@ -240,7 +250,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, 0xac, 0x09, 0x0a, 0x09, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x43, 0x6f, 0x64, 0x65, 0x12, + 0x6f, 0x2a, 0xeb, 0x09, 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, 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, @@ -311,11 +321,15 @@ var file_errorcode_proto_rawDesc = []byte{ 0x72, 0x65, 0x61, 0x74, 0x65, 0x10, 0x9e, 0x0a, 0x12, 0x14, 0x0a, 0x0f, 0x48, 0x65, 0x72, 0x6f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x10, 0x9f, 0x0a, 0x12, 0x12, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x4d, 0x61, 0x78, 0x41, 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x10, - 0xa0, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4f, - 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x10, - 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4c, - 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, 0x0a, - 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0xa0, 0x0a, 0x12, 0x0f, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x49, 0x73, 0x4c, 0x6f, 0x63, 0x6b, + 0x10, 0xa1, 0x0a, 0x12, 0x1e, 0x0a, 0x19, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, + 0x4f, 0x6e, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, + 0x10, 0xf8, 0x0a, 0x12, 0x1c, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, + 0x4c, 0x76, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x52, 0x65, 0x61, 0x63, 0x68, 0x65, 0x64, 0x10, 0xf9, + 0x0a, 0x12, 0x18, 0x0a, 0x13, 0x53, 0x74, 0x6f, 0x72, 0x79, 0x4e, 0x6f, 0x74, 0x46, 0x69, 0x6e, + 0x64, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x10, 0xdc, 0x0b, 0x12, 0x12, 0x0a, 0x0d, 0x53, + 0x74, 0x6f, 0x72, 0x79, 0x49, 0x44, 0x46, 0x61, 0x69, 0x6c, 0x65, 0x64, 0x10, 0xdd, 0x0b, 0x42, + 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index 212bcf740..56377377a 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -1227,6 +1227,102 @@ func (x *HeroProperty) GetAddProperty() map[string]int32 { return nil } +// 英雄锁定 +type HeroLockReq struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Heroid string `protobuf:"bytes,1,opt,name=heroid,proto3" json:"heroid"` +} + +func (x *HeroLockReq) Reset() { + *x = HeroLockReq{} + if protoimpl.UnsafeEnabled { + mi := &file_hero_hero_msg_proto_msgTypes[23] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeroLockReq) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeroLockReq) ProtoMessage() {} + +func (x *HeroLockReq) ProtoReflect() protoreflect.Message { + mi := &file_hero_hero_msg_proto_msgTypes[23] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeroLockReq.ProtoReflect.Descriptor instead. +func (*HeroLockReq) Descriptor() ([]byte, []int) { + return file_hero_hero_msg_proto_rawDescGZIP(), []int{23} +} + +func (x *HeroLockReq) GetHeroid() string { + if x != nil { + return x.Heroid + } + return "" +} + +// 英雄锁定返回 +type HeroLockResp struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Hero *DBHero `protobuf:"bytes,1,opt,name=hero,proto3" json:"hero"` // 英雄对象 +} + +func (x *HeroLockResp) Reset() { + *x = HeroLockResp{} + if protoimpl.UnsafeEnabled { + mi := &file_hero_hero_msg_proto_msgTypes[24] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HeroLockResp) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HeroLockResp) ProtoMessage() {} + +func (x *HeroLockResp) ProtoReflect() protoreflect.Message { + mi := &file_hero_hero_msg_proto_msgTypes[24] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HeroLockResp.ProtoReflect.Descriptor instead. +func (*HeroLockResp) Descriptor() ([]byte, []int) { + return file_hero_hero_msg_proto_rawDescGZIP(), []int{24} +} + +func (x *HeroLockResp) GetHero() *DBHero { + if x != nil { + return x.Hero + } + return nil +} + var File_hero_hero_msg_proto protoreflect.FileDescriptor var file_hero_hero_msg_proto_rawDesc = []byte{ @@ -1342,8 +1438,14 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, - 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x22, 0x25, + 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x4c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, + 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, + 0x65, 0x72, 0x6f, 0x69, 0x64, 0x22, 0x2b, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x4c, 0x6f, 0x63, + 0x6b, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, + 0x72, 0x6f, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x33, } var ( @@ -1358,7 +1460,7 @@ func file_hero_hero_msg_proto_rawDescGZIP() []byte { return file_hero_hero_msg_proto_rawDescData } -var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 25) +var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 27) var file_hero_hero_msg_proto_goTypes = []interface{}{ (*HeroInfoReq)(nil), // 0: HeroInfoReq (*HeroInfoResp)(nil), // 1: HeroInfoResp @@ -1383,31 +1485,34 @@ var file_hero_hero_msg_proto_goTypes = []interface{}{ (*HeroChoukaReq)(nil), // 20: HeroChoukaReq (*HeroChoukaResp)(nil), // 21: HeroChoukaResp (*HeroProperty)(nil), // 22: HeroProperty - nil, // 23: HeroProperty.PropertyEntry - nil, // 24: HeroProperty.AddPropertyEntry - (*DBHero)(nil), // 25: DBHero + (*HeroLockReq)(nil), // 23: HeroLockReq + (*HeroLockResp)(nil), // 24: HeroLockResp + nil, // 25: HeroProperty.PropertyEntry + nil, // 26: HeroProperty.AddPropertyEntry + (*DBHero)(nil), // 27: DBHero } var file_hero_hero_msg_proto_depIdxs = []int32{ - 25, // 0: HeroInfoResp.base:type_name -> DBHero - 25, // 1: HeroListResp.list:type_name -> DBHero - 25, // 2: HeroStrengthenUplvResp.hero:type_name -> DBHero + 27, // 0: HeroInfoResp.base:type_name -> DBHero + 27, // 1: HeroListResp.list:type_name -> DBHero + 27, // 2: HeroStrengthenUplvResp.hero:type_name -> DBHero 7, // 3: HeroStrengthenUpStarReq.hero:type_name -> CostCardData 7, // 4: HeroStrengthenUpStarReq.heroRace:type_name -> CostCardData - 25, // 5: HeroStrengthenUpStarResp.hero:type_name -> DBHero - 25, // 6: HeroStrengthenUpSkillResp.hero:type_name -> DBHero - 25, // 7: HeroResonanceResp.hero:type_name -> DBHero - 25, // 8: HeroResonanceResp.upStarCard:type_name -> DBHero - 25, // 9: HeroResonanceResetResp.hero:type_name -> DBHero - 25, // 10: HeroResonanceUseEnergyResp.hero:type_name -> DBHero - 25, // 11: HeroAwakenResp.hero:type_name -> DBHero - 25, // 12: HeroChoukaResp.heroes:type_name -> DBHero - 23, // 13: HeroProperty.property:type_name -> HeroProperty.PropertyEntry - 24, // 14: HeroProperty.addProperty:type_name -> HeroProperty.AddPropertyEntry - 15, // [15:15] is the sub-list for method output_type - 15, // [15:15] is the sub-list for method input_type - 15, // [15:15] is the sub-list for extension type_name - 15, // [15:15] is the sub-list for extension extendee - 0, // [0:15] is the sub-list for field type_name + 27, // 5: HeroStrengthenUpStarResp.hero:type_name -> DBHero + 27, // 6: HeroStrengthenUpSkillResp.hero:type_name -> DBHero + 27, // 7: HeroResonanceResp.hero:type_name -> DBHero + 27, // 8: HeroResonanceResp.upStarCard:type_name -> DBHero + 27, // 9: HeroResonanceResetResp.hero:type_name -> DBHero + 27, // 10: HeroResonanceUseEnergyResp.hero:type_name -> DBHero + 27, // 11: HeroAwakenResp.hero:type_name -> DBHero + 27, // 12: HeroChoukaResp.heroes:type_name -> DBHero + 25, // 13: HeroProperty.property:type_name -> HeroProperty.PropertyEntry + 26, // 14: HeroProperty.addProperty:type_name -> HeroProperty.AddPropertyEntry + 27, // 15: HeroLockResp.hero:type_name -> DBHero + 16, // [16:16] is the sub-list for method output_type + 16, // [16:16] is the sub-list for method input_type + 16, // [16:16] is the sub-list for extension type_name + 16, // [16:16] is the sub-list for extension extendee + 0, // [0:16] is the sub-list for field type_name } func init() { file_hero_hero_msg_proto_init() } @@ -1693,6 +1798,30 @@ func file_hero_hero_msg_proto_init() { return nil } } + file_hero_hero_msg_proto_msgTypes[23].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeroLockReq); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_hero_hero_msg_proto_msgTypes[24].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HeroLockResp); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -1700,7 +1829,7 @@ func file_hero_hero_msg_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hero_hero_msg_proto_rawDesc, NumEnums: 0, - NumMessages: 25, + NumMessages: 27, NumExtensions: 0, NumServices: 0, }, diff --git a/pb/proto/errorcode.proto b/pb/proto/errorcode.proto index 4ff16f90f..40909bd47 100644 --- a/pb/proto/errorcode.proto +++ b/pb/proto/errorcode.proto @@ -65,8 +65,12 @@ enum ErrorCode { HeroCreate = 1310; // 创建卡失败 HeroEquipUpdate = 1311; // 更新装备失败 HeroMaxAwaken = 1312; // 达到最大觉醒等级 + HeroIsLock = 1313; // 英雄被锁定不能被消耗 // equipment EquipmentOnFoundEquipment = 1400; // 未找到武器 EquipmentLvlimitReached = 1401; // 武器等级已达上限 + // mainStory + StoryNotFindChapter = 1500; // 没有找到主线关卡信息 + StoryIDFailed = 1501; // 关卡ID 错误 } \ No newline at end of file diff --git a/pb/proto/hero/hero_msg.proto b/pb/proto/hero/hero_msg.proto index 438fbc0e5..275938431 100644 --- a/pb/proto/hero/hero_msg.proto +++ b/pb/proto/hero/hero_msg.proto @@ -114,4 +114,14 @@ message HeroProperty { string heroId = 1; //英雄唯一ID map property = 2; //基础属性 map addProperty = 3; //附加属性 +} + +// 英雄锁定 +message HeroLockReq{ + string heroid = 1; +} + +// 英雄锁定返回 +message HeroLockResp{ + DBHero hero = 1; // 英雄对象 } \ No newline at end of file