diff --git a/cmd/robot/pack.go b/cmd/robot/items.go similarity index 89% rename from cmd/robot/pack.go rename to cmd/robot/items.go index 68d29cc89..900c822b4 100644 --- a/cmd/robot/pack.go +++ b/cmd/robot/items.go @@ -15,7 +15,7 @@ func (r *Robot) handlePackMsg(msg *pb.UserMessage) { //添加好友 func (r *Robot) QueryUserPack() { - req := &pb.Pack_Getlist_Req{IType: 1} + req := &pb.Items_Getlist_Req{IType: 1} head := &pb.UserMessage{MainType: "pack", SubType: "queryuserpackreq"} defer traceFunc(head.MainType, head.SubType, r.user.GetUid(), req) err := r.SendToClient(head, req) @@ -25,7 +25,7 @@ func (r *Robot) QueryUserPack() { } func (r *Robot) handleQueryUserPack(msg *pb.UserMessage) { - rsp := &pb.Pack_Getlist_Resp{} + rsp := &pb.Items_Getlist_Resp{} if !comm.ProtoUnmarshal(msg, rsp) { return } diff --git a/comm/imodule.go b/comm/imodule.go index fd29c9759..e5834e71e 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -1,12 +1,20 @@ package comm -import "go_dreamfactory/pb" +import ( + "go_dreamfactory/pb" +) /* 业务模块 对外接口定义处 */ type ( + IModuleCallSource struct { + Module string //来源模块 + FuncName string //来源方法 + Describe string //调用描述 + } + //邮件业务模块对外接口定义 提供给其他模块使用的 Imail interface { CreateNewMail(uId string) diff --git a/modules/core.go b/modules/core.go index b6628b3d5..66ce4edab 100644 --- a/modules/core.go +++ b/modules/core.go @@ -1,7 +1,6 @@ package modules import ( - "go_dreamfactory/comm" "go_dreamfactory/lego/core" "go_dreamfactory/pb" cfg "go_dreamfactory/sys/configure/structs" @@ -18,6 +17,6 @@ type ( //向多个用户发送消息 SendMsgToUsers(mainType, subType string, msg proto.Message, user ...*pb.Cache_UserData) (err error) //校验消耗资源 - CheckConsumeRes(uid string, res []*cfg.Game_atn) (code comm.ErrorCode) + CheckConsumeRes(uid string, res []*cfg.Game_atn) (code pb.ErrorCode) } ) diff --git a/modules/equipment/configure_comp.go b/modules/equipment/configure_comp.go index d390aefbd..4a662006f 100644 --- a/modules/equipment/configure_comp.go +++ b/modules/equipment/configure_comp.go @@ -97,7 +97,7 @@ func (this *Configure_Comp) GetEquipmentAttrlibraryConfigureById(Id int32) (conf return } -//获取装备属性表 +//获取武器等级消耗表 func (this *Configure_Comp) GetEquipmentIntensifyConfigure() (configure *cfg.Game_equipIntensify, err error) { var ( v interface{} @@ -114,7 +114,7 @@ func (this *Configure_Comp) GetEquipmentIntensifyConfigure() (configure *cfg.Gam return } -//获取属性词列表 +//获取武器等级消耗表 func (this *Configure_Comp) GetEquipmentIntensifyConfigureById(Id int32) (configure *cfg.Game_equipIntensifyData, err error) { var ( v interface{} diff --git a/modules/equipment/core.go b/modules/equipment/core.go index 85a852e10..88cf55362 100644 --- a/modules/equipment/core.go +++ b/modules/equipment/core.go @@ -9,8 +9,6 @@ func CloneEquipment(equipment *pb.DB_Equipment) *pb.DB_Equipment { HeroId: equipment.HeroId, Lv: equipment.Lv, KeepFailNum: equipment.KeepFailNum, - MainEntry: make(map[uint32]int32), - AdverbEntry: make(map[uint32]int32), OverlayNum: equipment.OverlayNum, IsInitialState: equipment.IsInitialState, } diff --git a/modules/equipment/model_equipment_comp.go b/modules/equipment/model_equipment_comp.go index b85237731..93b1335d7 100644 --- a/modules/equipment/model_equipment_comp.go +++ b/modules/equipment/model_equipment_comp.go @@ -72,16 +72,11 @@ func (this *Model_Equipment_Comp) Equipment_AddEquipmentsToPack(uId string, cIds } } if !iskeep { - if _, ok := configure.GetDataMap()[k]; ok { - id := primitive.NewObjectID().Hex() - add[id] = &pb.DB_Equipment{ - Id: id, - CId: k, - UId: uId, - MainEntry: make(map[uint32]int32), - AdverbEntry: make(map[uint32]int32), - OverlayNum: v, - IsInitialState: true, + if c, ok := configure.GetDataMap()[k]; ok { + if equipment, err := this.newEquipment(uId, c, v); err != nil { + return err + } else { + add[equipment.Id] = equipment } } } @@ -110,3 +105,28 @@ func (this *Model_Equipment_Comp) Equipment_UpdateIsEquip(uid string, equipments } return } + +//创建新的武器对象 +func (this *Model_Equipment_Comp) newEquipment(uid string, conf *cfg.Game_equipData, num uint32) (equipment *pb.DB_Equipment, err error) { + var ( + mattr []*cfg.Game_equipAttrlibraryData + ) + equipment = &pb.DB_Equipment{ + Id: primitive.NewObjectID().Hex(), + CId: conf.Id, + UId: uid, + OverlayNum: num, + IsInitialState: true, + } + if mattr, err = this.module.configure_comp.GetEquipmentAttrlibraryConfigureById(conf.Leadlibrary); err != nil || len(mattr) == 0 { + return + } + equipment.MainEntry = &pb.EquipmentAttributeEntry{ + Id: mattr[0].Key, + Libraryid: mattr[0].Libraryid, + Lv: 0, + AttrName: mattr[0].Attr[0], + Value: 0, + } + return +} diff --git a/modules/items/module.go b/modules/items/module.go index 46800627f..965ff2156 100644 --- a/modules/items/module.go +++ b/modules/items/module.go @@ -48,7 +48,7 @@ func (this *Items) OnInstallComp() { //IPack------------------------------------------------------------------------------------------------------------------------------- ///查询用户背包物品数量 -func (this *Items) QueryUserPackItemAmount(uId string, itemid int32) (amount uint32) { +func (this *Items) QueryUserItemAmount(uId string, itemid int32) (amount uint32) { defer log.Debugf("获取物品 uId:%s itemid:%d addnum:%d ", uId, itemid, amount) amount = 0 if result := this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid); result != nil && len(result) > 0 { @@ -58,13 +58,13 @@ func (this *Items) QueryUserPackItemAmount(uId string, itemid int32) (amount uin } ///查询用户背包多个物品数量 -func (this *Items) QueryUserPackItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) { +func (this *Items) QueryUserItemsAmount(uId string, itemid ...int32) (result map[int32]uint32) { result = this.model_pack_comp.Pack_QueryUserPackItemsAmount(uId, itemid...) return } ///添加单个物品到背包 (可以加物品和减物品) -func (this *Items) AddItemToUserPack(uId string, itemid, addnum int32) (code pb.ErrorCode) { +func (this *Items) AddItem(uId string, itemid, addnum int32) (code pb.ErrorCode) { var err error defer log.Debugf("给用户添加物品 uId:%s itemid:%d addnum:%d issucc:%v", uId, itemid, addnum, err == nil) if err = this.model_pack_comp.Pack_AddItemToUserPack(uId, itemid, addnum); err != nil { @@ -81,7 +81,7 @@ func (this *Items) AddItemToUserPack(uId string, itemid, addnum int32) (code pb. } ///添加多个物品到背包 (可以加物品和减物品) -func (this *Items) AddItemsToUserPack(uId string, items map[int32]int32) (code pb.ErrorCode) { +func (this *Items) AddItems(uId string, items map[int32]int32) (code pb.ErrorCode) { var err error defer log.Debugf("给用户添加物品 uId:%s items:%d items:%v", uId, items, err == nil) if err = this.model_pack_comp.Pack_AddItemsToUserPack(uId, items); err != nil { diff --git a/pb/comm.pb.go b/pb/comm.pb.go index 0ebb8a470..1c68904ea 100644 --- a/pb/comm.pb.go +++ b/pb/comm.pb.go @@ -21,6 +21,62 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +//英雄属性类型 +type HeroAttributesType int32 + +const ( + HeroAttributesType_Hp HeroAttributesType = 0 //血量 + HeroAttributesType_Atk HeroAttributesType = 1 //攻击 + HeroAttributesType_Def HeroAttributesType = 2 //防御 + HeroAttributesType_Speed HeroAttributesType = 3 //速度 + HeroAttributesType_Crit HeroAttributesType = 4 //暴击 +) + +// Enum value maps for HeroAttributesType. +var ( + HeroAttributesType_name = map[int32]string{ + 0: "Hp", + 1: "Atk", + 2: "Def", + 3: "Speed", + 4: "Crit", + } + HeroAttributesType_value = map[string]int32{ + "Hp": 0, + "Atk": 1, + "Def": 2, + "Speed": 3, + "Crit": 4, + } +) + +func (x HeroAttributesType) Enum() *HeroAttributesType { + p := new(HeroAttributesType) + *p = x + return p +} + +func (x HeroAttributesType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (HeroAttributesType) Descriptor() protoreflect.EnumDescriptor { + return file_comm_proto_enumTypes[0].Descriptor() +} + +func (HeroAttributesType) Type() protoreflect.EnumType { + return &file_comm_proto_enumTypes[0] +} + +func (x HeroAttributesType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use HeroAttributesType.Descriptor instead. +func (HeroAttributesType) EnumDescriptor() ([]byte, []int) { + return file_comm_proto_rawDescGZIP(), []int{0} +} + //用户消息流结构 type UserMessage struct { state protoimpl.MessageState @@ -739,8 +795,12 @@ var file_comm_proto_rawDesc = []byte{ 0x72, 0x53, 0x65, 0x73, 0x73, 0x69, 0x6f, 0x6e, 0x49, 0x64, 0x22, 0x2c, 0x0a, 0x12, 0x4e, 0x6f, 0x74, 0x69, 0x63, 0x65, 0x55, 0x73, 0x65, 0x72, 0x43, 0x6c, 0x6f, 0x73, 0x65, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, - 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x06, 0x55, 0x73, 0x65, 0x72, 0x49, 0x64, 0x2a, 0x43, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, + 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x54, 0x79, 0x70, 0x65, 0x12, 0x06, + 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x12, 0x07, 0x0a, 0x03, 0x41, 0x74, 0x6b, 0x10, 0x01, 0x12, + 0x07, 0x0a, 0x03, 0x44, 0x65, 0x66, 0x10, 0x02, 0x12, 0x09, 0x0a, 0x05, 0x53, 0x70, 0x65, 0x65, + 0x64, 0x10, 0x03, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10, 0x04, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -755,28 +815,30 @@ func file_comm_proto_rawDescGZIP() []byte { return file_comm_proto_rawDescData } +var file_comm_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_comm_proto_msgTypes = make([]protoimpl.MessageInfo, 10) var file_comm_proto_goTypes = []interface{}{ - (*UserMessage)(nil), // 0: UserMessage - (*AgentMessage)(nil), // 1: AgentMessage - (*RPCMessageReply)(nil), // 2: RPCMessageReply - (*AgentBuildReq)(nil), // 3: AgentBuildReq - (*AgentUnBuildReq)(nil), // 4: AgentUnBuildReq - (*AgentSendMessageReq)(nil), // 5: AgentSendMessageReq - (*BatchMessageReq)(nil), // 6: BatchMessageReq - (*BroadCastMessageReq)(nil), // 7: BroadCastMessageReq - (*AgentCloseeReq)(nil), // 8: AgentCloseeReq - (*NoticeUserCloseReq)(nil), // 9: NoticeUserCloseReq - (*anypb.Any)(nil), // 10: google.protobuf.Any - (ErrorCode)(0), // 11: ErrorCode + (HeroAttributesType)(0), // 0: HeroAttributesType + (*UserMessage)(nil), // 1: UserMessage + (*AgentMessage)(nil), // 2: AgentMessage + (*RPCMessageReply)(nil), // 3: RPCMessageReply + (*AgentBuildReq)(nil), // 4: AgentBuildReq + (*AgentUnBuildReq)(nil), // 5: AgentUnBuildReq + (*AgentSendMessageReq)(nil), // 6: AgentSendMessageReq + (*BatchMessageReq)(nil), // 7: BatchMessageReq + (*BroadCastMessageReq)(nil), // 8: BroadCastMessageReq + (*AgentCloseeReq)(nil), // 9: AgentCloseeReq + (*NoticeUserCloseReq)(nil), // 10: NoticeUserCloseReq + (*anypb.Any)(nil), // 11: google.protobuf.Any + (ErrorCode)(0), // 12: ErrorCode } var file_comm_proto_depIdxs = []int32{ - 10, // 0: UserMessage.data:type_name -> google.protobuf.Any - 10, // 1: AgentMessage.Message:type_name -> google.protobuf.Any - 11, // 2: RPCMessageReply.Code:type_name -> ErrorCode - 10, // 3: AgentSendMessageReq.Data:type_name -> google.protobuf.Any - 10, // 4: BatchMessageReq.Data:type_name -> google.protobuf.Any - 10, // 5: BroadCastMessageReq.Data:type_name -> google.protobuf.Any + 11, // 0: UserMessage.data:type_name -> google.protobuf.Any + 11, // 1: AgentMessage.Message:type_name -> google.protobuf.Any + 12, // 2: RPCMessageReply.Code:type_name -> ErrorCode + 11, // 3: AgentSendMessageReq.Data:type_name -> google.protobuf.Any + 11, // 4: BatchMessageReq.Data:type_name -> google.protobuf.Any + 11, // 5: BroadCastMessageReq.Data:type_name -> google.protobuf.Any 6, // [6:6] is the sub-list for method output_type 6, // [6:6] is the sub-list for method input_type 6, // [6:6] is the sub-list for extension type_name @@ -917,13 +979,14 @@ func file_comm_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_comm_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 10, NumExtensions: 0, NumServices: 0, }, GoTypes: file_comm_proto_goTypes, DependencyIndexes: file_comm_proto_depIdxs, + EnumInfos: file_comm_proto_enumTypes, MessageInfos: file_comm_proto_msgTypes, }.Build() File_comm_proto = out.File diff --git a/pb/equipment_db.pb.go b/pb/equipment_db.pb.go index 29d531673..bc2c68980 100644 --- a/pb/equipment_db.pb.go +++ b/pb/equipment_db.pb.go @@ -20,115 +20,108 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -//装备主词条 -type EquipmentMainEntry int32 +//装备属性词条 +type EquipmentAttributeEntry struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -const ( - EquipmentMainEntry_Hp EquipmentMainEntry = 0 -) + Id int32 `protobuf:"varint,1,opt,name=Id,proto3" json:"Id"` //属性词条主键id 唯一 + Libraryid int32 `protobuf:"varint,2,opt,name=libraryid,proto3" json:"libraryid"` //属性词条id 非唯一 + AttrName string `protobuf:"bytes,3,opt,name=AttrName,proto3" json:"AttrName"` //属性名 + Lv int32 `protobuf:"varint,4,opt,name=Lv,proto3" json:"Lv"` //属性等级 + Value int32 `protobuf:"varint,5,opt,name=Value,proto3" json:"Value"` //属性值 +} -// Enum value maps for EquipmentMainEntry. -var ( - EquipmentMainEntry_name = map[int32]string{ - 0: "Hp", +func (x *EquipmentAttributeEntry) Reset() { + *x = EquipmentAttributeEntry{} + if protoimpl.UnsafeEnabled { + mi := &file_equipment_equipment_db_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - EquipmentMainEntry_value = map[string]int32{ - "Hp": 0, +} + +func (x *EquipmentAttributeEntry) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*EquipmentAttributeEntry) ProtoMessage() {} + +func (x *EquipmentAttributeEntry) ProtoReflect() protoreflect.Message { + mi := &file_equipment_equipment_db_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms } -) - -func (x EquipmentMainEntry) Enum() *EquipmentMainEntry { - p := new(EquipmentMainEntry) - *p = x - return p + return mi.MessageOf(x) } -func (x EquipmentMainEntry) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (EquipmentMainEntry) Descriptor() protoreflect.EnumDescriptor { - return file_equipment_equipment_db_proto_enumTypes[0].Descriptor() -} - -func (EquipmentMainEntry) Type() protoreflect.EnumType { - return &file_equipment_equipment_db_proto_enumTypes[0] -} - -func (x EquipmentMainEntry) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use EquipmentMainEntry.Descriptor instead. -func (EquipmentMainEntry) EnumDescriptor() ([]byte, []int) { +// Deprecated: Use EquipmentAttributeEntry.ProtoReflect.Descriptor instead. +func (*EquipmentAttributeEntry) Descriptor() ([]byte, []int) { return file_equipment_equipment_db_proto_rawDescGZIP(), []int{0} } -//装备副词条 -type EquipmentAdverbEntry int32 - -const ( - EquipmentAdverbEntry_Crit EquipmentAdverbEntry = 0 -) - -// Enum value maps for EquipmentAdverbEntry. -var ( - EquipmentAdverbEntry_name = map[int32]string{ - 0: "Crit", +func (x *EquipmentAttributeEntry) GetId() int32 { + if x != nil { + return x.Id } - EquipmentAdverbEntry_value = map[string]int32{ - "Crit": 0, + return 0 +} + +func (x *EquipmentAttributeEntry) GetLibraryid() int32 { + if x != nil { + return x.Libraryid } -) - -func (x EquipmentAdverbEntry) Enum() *EquipmentAdverbEntry { - p := new(EquipmentAdverbEntry) - *p = x - return p + return 0 } -func (x EquipmentAdverbEntry) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +func (x *EquipmentAttributeEntry) GetAttrName() string { + if x != nil { + return x.AttrName + } + return "" } -func (EquipmentAdverbEntry) Descriptor() protoreflect.EnumDescriptor { - return file_equipment_equipment_db_proto_enumTypes[1].Descriptor() +func (x *EquipmentAttributeEntry) GetLv() int32 { + if x != nil { + return x.Lv + } + return 0 } -func (EquipmentAdverbEntry) Type() protoreflect.EnumType { - return &file_equipment_equipment_db_proto_enumTypes[1] -} - -func (x EquipmentAdverbEntry) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use EquipmentAdverbEntry.Descriptor instead. -func (EquipmentAdverbEntry) EnumDescriptor() ([]byte, []int) { - return file_equipment_equipment_db_proto_rawDescGZIP(), []int{1} +func (x *EquipmentAttributeEntry) GetValue() int32 { + if x != nil { + return x.Value + } + return 0 } +//武器数据 type DB_Equipment struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id" bson:"_id"` //装备id - CId int32 `protobuf:"zigzag32,2,opt,name=cId,proto3" json:"cId" bson:"cId"` // 配置Id - UId string `protobuf:"bytes,3,opt,name=uId,proto3" json:"uId" bson:"uid"` // 所属玩家Id - HeroId string `protobuf:"bytes,5,opt,name=heroId,proto3" json:"heroId" bson:"heroId"` // 挂在的英雄卡片id 未装备 填 '' - Lv int32 `protobuf:"zigzag32,6,opt,name=lv,proto3" json:"lv" bson:"lv"` //装备强化等级 - KeepFailNum int32 `protobuf:"zigzag32,7,opt,name=keepFailNum,proto3" json:"keepFailNum" bson:"keepFailNum"` // 连续强化失败次数 - MainEntry map[uint32]int32 `protobuf:"bytes,8,rep,name=mainEntry,proto3" json:"mainEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"mainEntry"` // 装备主词条 - AdverbEntry map[uint32]int32 `protobuf:"bytes,9,rep,name=adverbEntry,proto3" json:"adverbEntry" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"adverbEntry"` //装备副词条 - OverlayNum uint32 `protobuf:"varint,10,opt,name=overlayNum,proto3" json:"overlayNum" bson:"overlayNum"` //叠加数量 - IsInitialState bool `protobuf:"varint,11,opt,name=isInitialState,proto3" json:"isInitialState" bson:"isInitialState"` //是否初始状态 + Id string `protobuf:"bytes,1,opt,name=Id,proto3" json:"Id" bson:"_id"` //装备id + CId int32 `protobuf:"zigzag32,2,opt,name=cId,proto3" json:"cId" bson:"cId"` // 配置Id + UId string `protobuf:"bytes,3,opt,name=uId,proto3" json:"uId" bson:"uid"` // 所属玩家Id + HeroId string `protobuf:"bytes,5,opt,name=heroId,proto3" json:"heroId" bson:"heroId"` // 挂在的英雄卡片id 未装备 填 '' + Lv int32 `protobuf:"zigzag32,6,opt,name=lv,proto3" json:"lv" bson:"lv"` //装备强化等级 + KeepFailNum int32 `protobuf:"zigzag32,7,opt,name=keepFailNum,proto3" json:"keepFailNum" bson:"keepFailNum"` // 连续强化失败次数 + MainEntry *EquipmentAttributeEntry `protobuf:"bytes,8,opt,name=mainEntry,proto3" json:"mainEntry" bson:"mainEntry"` // 装备主词条 + AdverbEntry []*EquipmentAttributeEntry `protobuf:"bytes,9,rep,name=adverbEntry,proto3" json:"adverbEntry" bson:"adverbEntry"` //装备副词条 + OverlayNum uint32 `protobuf:"varint,10,opt,name=overlayNum,proto3" json:"overlayNum" bson:"overlayNum"` //叠加数量 + IsInitialState bool `protobuf:"varint,11,opt,name=isInitialState,proto3" json:"isInitialState" bson:"isInitialState"` //是否初始状态 } func (x *DB_Equipment) Reset() { *x = DB_Equipment{} if protoimpl.UnsafeEnabled { - mi := &file_equipment_equipment_db_proto_msgTypes[0] + mi := &file_equipment_equipment_db_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -141,7 +134,7 @@ func (x *DB_Equipment) String() string { func (*DB_Equipment) ProtoMessage() {} func (x *DB_Equipment) ProtoReflect() protoreflect.Message { - mi := &file_equipment_equipment_db_proto_msgTypes[0] + mi := &file_equipment_equipment_db_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -154,7 +147,7 @@ func (x *DB_Equipment) ProtoReflect() protoreflect.Message { // Deprecated: Use DB_Equipment.ProtoReflect.Descriptor instead. func (*DB_Equipment) Descriptor() ([]byte, []int) { - return file_equipment_equipment_db_proto_rawDescGZIP(), []int{0} + return file_equipment_equipment_db_proto_rawDescGZIP(), []int{1} } func (x *DB_Equipment) GetId() string { @@ -199,14 +192,14 @@ func (x *DB_Equipment) GetKeepFailNum() int32 { return 0 } -func (x *DB_Equipment) GetMainEntry() map[uint32]int32 { +func (x *DB_Equipment) GetMainEntry() *EquipmentAttributeEntry { if x != nil { return x.MainEntry } return nil } -func (x *DB_Equipment) GetAdverbEntry() map[uint32]int32 { +func (x *DB_Equipment) GetAdverbEntry() []*EquipmentAttributeEntry { if x != nil { return x.AdverbEntry } @@ -231,42 +224,38 @@ var File_equipment_equipment_db_proto protoreflect.FileDescriptor var file_equipment_equipment_db_proto_rawDesc = []byte{ 0x0a, 0x1c, 0x65, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2f, 0x65, 0x71, 0x75, 0x69, - 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0, - 0x03, 0x0a, 0x0c, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12, - 0x0e, 0x0a, 0x02, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, - 0x10, 0x0a, 0x03, 0x63, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x63, 0x49, - 0x64, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x75, 0x49, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x05, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, - 0x76, 0x18, 0x06, 0x20, 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x0b, 0x6b, - 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x11, - 0x52, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x12, 0x3a, 0x0a, - 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1c, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, - 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, - 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x40, 0x0a, 0x0b, 0x61, 0x64, 0x76, - 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, - 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x2e, 0x41, 0x64, - 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, - 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, 0x0a, 0x6f, - 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x0d, 0x52, - 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, 0x0e, 0x69, - 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, 0x0b, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, - 0x61, 0x74, 0x65, 0x1a, 0x3c, 0x0a, 0x0e, 0x4d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 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, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0d, 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, 0x2a, 0x1c, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x4d, 0x61, - 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x06, 0x0a, 0x02, 0x48, 0x70, 0x10, 0x00, 0x2a, - 0x20, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x76, 0x65, - 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x08, 0x0a, 0x04, 0x43, 0x72, 0x69, 0x74, 0x10, - 0x00, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, + 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x5f, 0x64, 0x62, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x89, + 0x01, 0x0a, 0x17, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, + 0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x0e, 0x0a, 0x02, 0x49, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x6c, 0x69, + 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x6c, + 0x69, 0x62, 0x72, 0x61, 0x72, 0x79, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x41, 0x74, 0x74, 0x72, + 0x4e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x41, 0x74, 0x74, 0x72, + 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x0e, 0x0a, 0x02, 0x4c, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x4c, 0x76, 0x12, 0x14, 0x0a, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x05, 0x56, 0x61, 0x6c, 0x75, 0x65, 0x22, 0xc8, 0x02, 0x0a, 0x0c, 0x44, + 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x12, 0x0e, 0x0a, 0x02, 0x49, + 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x63, + 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x11, 0x52, 0x03, 0x63, 0x49, 0x64, 0x12, 0x10, 0x0a, + 0x03, 0x75, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x49, 0x64, 0x12, + 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x6c, 0x76, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x11, 0x52, 0x02, 0x6c, 0x76, 0x12, 0x20, 0x0a, 0x0b, 0x6b, 0x65, 0x65, 0x70, 0x46, + 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x11, 0x52, 0x0b, 0x6b, 0x65, + 0x65, 0x70, 0x46, 0x61, 0x69, 0x6c, 0x4e, 0x75, 0x6d, 0x12, 0x36, 0x0a, 0x09, 0x6d, 0x61, 0x69, + 0x6e, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x45, + 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, + 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x09, 0x6d, 0x61, 0x69, 0x6e, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x3a, 0x0a, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, + 0x6e, 0x74, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x52, 0x0b, 0x61, 0x64, 0x76, 0x65, 0x72, 0x62, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1e, 0x0a, + 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x0d, 0x52, 0x0a, 0x6f, 0x76, 0x65, 0x72, 0x6c, 0x61, 0x79, 0x4e, 0x75, 0x6d, 0x12, 0x26, 0x0a, + 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, 0x53, 0x74, 0x61, 0x74, 0x65, 0x18, + 0x0b, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0e, 0x69, 0x73, 0x49, 0x6e, 0x69, 0x74, 0x69, 0x61, 0x6c, + 0x53, 0x74, 0x61, 0x74, 0x65, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -281,18 +270,14 @@ func file_equipment_equipment_db_proto_rawDescGZIP() []byte { return file_equipment_equipment_db_proto_rawDescData } -var file_equipment_equipment_db_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_equipment_equipment_db_proto_msgTypes = make([]protoimpl.MessageInfo, 3) +var file_equipment_equipment_db_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_equipment_equipment_db_proto_goTypes = []interface{}{ - (EquipmentMainEntry)(0), // 0: EquipmentMainEntry - (EquipmentAdverbEntry)(0), // 1: EquipmentAdverbEntry - (*DB_Equipment)(nil), // 2: DB_Equipment - nil, // 3: DB_Equipment.MainEntryEntry - nil, // 4: DB_Equipment.AdverbEntryEntry + (*EquipmentAttributeEntry)(nil), // 0: EquipmentAttributeEntry + (*DB_Equipment)(nil), // 1: DB_Equipment } var file_equipment_equipment_db_proto_depIdxs = []int32{ - 3, // 0: DB_Equipment.mainEntry:type_name -> DB_Equipment.MainEntryEntry - 4, // 1: DB_Equipment.adverbEntry:type_name -> DB_Equipment.AdverbEntryEntry + 0, // 0: DB_Equipment.mainEntry:type_name -> EquipmentAttributeEntry + 0, // 1: DB_Equipment.adverbEntry:type_name -> EquipmentAttributeEntry 2, // [2:2] is the sub-list for method output_type 2, // [2:2] is the sub-list for method input_type 2, // [2:2] is the sub-list for extension type_name @@ -307,6 +292,18 @@ func file_equipment_equipment_db_proto_init() { } if !protoimpl.UnsafeEnabled { file_equipment_equipment_db_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*EquipmentAttributeEntry); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_equipment_equipment_db_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*DB_Equipment); i { case 0: return &v.state @@ -324,14 +321,13 @@ func file_equipment_equipment_db_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_equipment_equipment_db_proto_rawDesc, - NumEnums: 2, - NumMessages: 3, + NumEnums: 0, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, GoTypes: file_equipment_equipment_db_proto_goTypes, DependencyIndexes: file_equipment_equipment_db_proto_depIdxs, - EnumInfos: file_equipment_equipment_db_proto_enumTypes, MessageInfos: file_equipment_equipment_db_proto_msgTypes, }.Build() File_equipment_equipment_db_proto = out.File diff --git a/pb/proto/comm.proto b/pb/proto/comm.proto index 001e9129c..a04259393 100644 --- a/pb/proto/comm.proto +++ b/pb/proto/comm.proto @@ -65,4 +65,13 @@ message BroadCastMessageReq { message AgentCloseeReq { string UserSessionId = 1; } //通知用户离线 -message NoticeUserCloseReq { string UserId = 1; } \ No newline at end of file +message NoticeUserCloseReq { string UserId = 1; } + +//英雄属性类型 +enum HeroAttributesType{ + Hp = 0; //血量 + Atk = 1; //攻击 + Def = 2; //防御 + Speed = 3; //速度 + Crit = 4; //暴击 +} \ No newline at end of file diff --git a/pb/proto/equipment/equipment_db.proto b/pb/proto/equipment/equipment_db.proto index 441df0c24..914db4876 100644 --- a/pb/proto/equipment/equipment_db.proto +++ b/pb/proto/equipment/equipment_db.proto @@ -1,25 +1,25 @@ syntax = "proto3"; option go_package = ".;pb"; -//装备主词条 -enum EquipmentMainEntry { - Hp = 0; -} - -//装备副词条 -enum EquipmentAdverbEntry { - Crit = 0; +//装备属性词条 +message EquipmentAttributeEntry { + int32 Id = 1; //属性词条主键id 唯一 + int32 libraryid = 2; //属性词条id 非唯一 + string AttrName = 3; //属性名 + int32 Lv = 4; //属性等级 + int32 Value = 5; //属性值 } +//武器数据 message DB_Equipment { - string Id = 1; //@go_tags(`bson:"_id"`) 装备id - sint32 cId = 2; //@go_tags(`bson:"cId"`) 配置Id - string uId = 3; //@go_tags(`bson:"uid"`) 所属玩家Id - string heroId = 5; //@go_tags(`bson:"heroId"`) 挂在的英雄卡片id 未装备 填 '' - sint32 lv = 6; //@go_tags(`bson:"lv"`) 装备强化等级 - sint32 keepFailNum = 7; //@go_tags(`bson:"keepFailNum"`) 连续强化失败次数 - map mainEntry = 8; //@go_tags(`bson:"mainEntry"`) 装备主词条 - map adverbEntry = 9; //@go_tags(`bson:"adverbEntry"`) 装备副词条 - uint32 overlayNum = 10; //@go_tags(`bson:"overlayNum"`) 叠加数量 - bool isInitialState = 11; //@go_tags(`bson:"isInitialState"`) 是否初始状态 + string Id = 1; //@go_tags(`bson:"_id"`) 装备id + sint32 cId = 2; //@go_tags(`bson:"cId"`) 配置Id + string uId = 3; //@go_tags(`bson:"uid"`) 所属玩家Id + string heroId = 5; //@go_tags(`bson:"heroId"`) 挂在的英雄卡片id 未装备 填 '' + sint32 lv = 6; //@go_tags(`bson:"lv"`) 装备强化等级 + sint32 keepFailNum = 7; //@go_tags(`bson:"keepFailNum"`) 连续强化失败次数 + EquipmentAttributeEntry mainEntry = 8; //@go_tags(`bson:"mainEntry"`) 装备主词条 + repeated EquipmentAttributeEntry adverbEntry = 9; //@go_tags(`bson:"adverbEntry"`) 装备副词条 + uint32 overlayNum = 10; //@go_tags(`bson:"overlayNum"`) 叠加数量 + bool isInitialState = 11; //@go_tags(`bson:"isInitialState"`) 是否初始状态 } \ No newline at end of file