diff --git a/modules/hero/api.go b/modules/hero/api.go index 12518ac38..da37ba010 100644 --- a/modules/hero/api.go +++ b/modules/hero/api.go @@ -11,6 +11,10 @@ type Api_Comp struct { module *Hero } +const ( //消息回复的头名称 + StrengthenUplv = "strengthenherolv" +) + //组件初始化接口 func (this *Api_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.MComp_GateComp.Init(service, module, comp, options) diff --git a/modules/hero/api_hero.go b/modules/hero/api_hero.go new file mode 100644 index 000000000..68cac2678 --- /dev/null +++ b/modules/hero/api_hero.go @@ -0,0 +1,23 @@ +package hero + +import ( + "go_dreamfactory/comm" + "go_dreamfactory/pb" +) + +//参数校验 +func (this *Api_Comp) Hero_Check(session comm.IUserSession, req *pb.Hero_StrengthenUplv_Req) (result map[string]interface{}, code comm.ErrorCode) { + return +} + +/// 英雄升级 +func (this *Api_Comp) HeroLv(session comm.IUserSession, agrs map[string]interface{}, req *pb.Hero_StrengthenUplv_Req) (code pb.ErrorCode) { + + defer func() { + if code == pb.ErrorCode_Success { + session.SendMsg(string(this.module.GetType()), StrengthenUplv, &pb.Hero_StrengthenUplv_Resp{}) + } + }() + + return +} diff --git a/modules/mail/db_comp.go b/modules/mail/db_comp.go index e24175257..52dcffd66 100644 --- a/modules/mail/db_comp.go +++ b/modules/mail/db_comp.go @@ -24,7 +24,7 @@ type DB_Comp struct { func (this *DB_Comp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) { this.Model_Comp.Init(service, module, comp, options) - + this.TableName = "mail" //创建uid索引 this.DB.CreateIndex(core.SqlTable(DB_MailTable), mongo.IndexModel{ Keys: bsonx.Doc{{Key: "uid", Value: bsonx.Int32(1)}}, diff --git a/pb/hero_db.pb.go b/pb/hero_db.pb.go index 1e6d962bd..c0a676485 100644 --- a/pb/hero_db.pb.go +++ b/pb/hero_db.pb.go @@ -20,6 +20,61 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +type PropertyType int32 + +const ( + PropertyType_Hp PropertyType = 0 //血量 + PropertyType_Atk PropertyType = 1 //攻击 + PropertyType_Def PropertyType = 2 //防御 + PropertyType_Speed PropertyType = 3 //速度 + PropertyType_Crit PropertyType = 4 //暴击 +) + +// Enum value maps for PropertyType. +var ( + PropertyType_name = map[int32]string{ + 0: "Hp", + 1: "Atk", + 2: "Def", + 3: "Speed", + 4: "Crit", + } + PropertyType_value = map[string]int32{ + "Hp": 0, + "Atk": 1, + "Def": 2, + "Speed": 3, + "Crit": 4, + } +) + +func (x PropertyType) Enum() *PropertyType { + p := new(PropertyType) + *p = x + return p +} + +func (x PropertyType) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (PropertyType) Descriptor() protoreflect.EnumDescriptor { + return file_hero_hero_db_proto_enumTypes[0].Descriptor() +} + +func (PropertyType) Type() protoreflect.EnumType { + return &file_hero_hero_db_proto_enumTypes[0] +} + +func (x PropertyType) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use PropertyType.Descriptor instead. +func (PropertyType) EnumDescriptor() ([]byte, []int) { + return file_hero_hero_db_proto_rawDescGZIP(), []int{0} +} + type SkillData struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -82,25 +137,25 @@ type DB_HeroData struct { Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid"` - HeroID int32 `protobuf:"varint,3,opt,name=heroID,proto3" json:"heroID"` // 英雄的配置表ID - Star int32 `protobuf:"varint,4,opt,name=star,proto3" json:"star"` // 英雄星级 - Lv int32 `protobuf:"varint,5,opt,name=lv,proto3" json:"lv"` // 英雄等级 - Exp int32 `protobuf:"varint,6,opt,name=exp,proto3" json:"exp"` // 英雄经验 - JuexingLv int32 `protobuf:"varint,7,opt,name=juexingLv,proto3" json:"juexingLv"` // 觉醒等级 - CaptainSkill int32 `protobuf:"varint,8,opt,name=captainSkill,proto3" json:"captainSkill"` // 队长技能 - NormalSkill []*SkillData `protobuf:"bytes,9,rep,name=normalSkill,proto3" json:"normalSkill"` // 普通技能 - Property map[int32]int32 `protobuf:"bytes,10,rep,name=property,proto3" json:"property" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 属性相关 - AddProperty map[int32]int32 `protobuf:"bytes,11,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 附加属性相关 - Formation int32 `protobuf:"varint,12,opt,name=formation,proto3" json:"formation"` // 阵型类型 - CardType int32 `protobuf:"varint,13,opt,name=cardType,proto3" json:"cardType"` // 卡片类型(升星卡、经验卡、技能升级卡) - CurSkin int32 `protobuf:"varint,14,opt,name=curSkin,proto3" json:"curSkin"` // 当前装备的皮肤ID - Skins []int32 `protobuf:"varint,15,rep,packed,name=skins,proto3" json:"skins"` // 所有皮肤ID - Block bool `protobuf:"varint,16,opt,name=block,proto3" json:"block"` // 锁定 - EquipID []string `protobuf:"bytes,17,rep,name=equipID,proto3" json:"equipID"` // 装备 objID - ResonateNum int32 `protobuf:"varint,18,opt,name=resonateNum,proto3" json:"resonateNum"` // 共鸣次数 - DistributionResonate int32 `protobuf:"varint,19,opt,name=distributionResonate,proto3" json:"distributionResonate"` // 分配的共鸣能量 - Energy map[int32]int32 `protobuf:"bytes,20,rep,name=energy,proto3" json:"energy" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 能量分配到哪里 - Count int32 `protobuf:"varint,21,opt,name=count,proto3" json:"count"` // 数量 + HeroID int32 `protobuf:"varint,3,opt,name=heroID,proto3" json:"heroID" bson:"heroID"` // 英雄的配置表ID + Star int32 `protobuf:"varint,4,opt,name=star,proto3" json:"star"` // 英雄星级 + Lv int32 `protobuf:"varint,5,opt,name=lv,proto3" json:"lv"` // 英雄等级 + Exp int32 `protobuf:"varint,6,opt,name=exp,proto3" json:"exp"` // 英雄经验 + JuexingLv int32 `protobuf:"varint,7,opt,name=juexingLv,proto3" json:"juexingLv" bson:"juexingLv"` //觉醒等级 + CaptainSkill int32 `protobuf:"varint,8,opt,name=captainSkill,proto3" json:"captainSkill" bson:"captainSkill"` //队长技能 + NormalSkill []*SkillData `protobuf:"bytes,9,rep,name=normalSkill,proto3" json:"normalSkill" bson:"normalSkill"` //普通技能 + Property map[int32]int32 `protobuf:"bytes,10,rep,name=property,proto3" json:"property" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 属性相关 + AddProperty map[int32]int32 `protobuf:"bytes,11,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3" bson:"addProperty"` //附加属性相关 + Formation int32 `protobuf:"varint,12,opt,name=formation,proto3" json:"formation"` // 阵型类型 + CardType int32 `protobuf:"varint,13,opt,name=cardType,proto3" json:"cardType" bson:"cardType"` //卡片类型(升星卡、经验卡、技能升级卡) + CurSkin int32 `protobuf:"varint,14,opt,name=curSkin,proto3" json:"curSkin" bson:"curSkin"` //当前装备的皮肤ID + Skins []int32 `protobuf:"varint,15,rep,packed,name=skins,proto3" json:"skins"` // 所有皮肤ID + Block bool `protobuf:"varint,16,opt,name=block,proto3" json:"block"` // 锁定 + EquipID []string `protobuf:"bytes,17,rep,name=equipID,proto3" json:"equipID" bson:"equipID"` //装备 objID + ResonateNum int32 `protobuf:"varint,18,opt,name=resonateNum,proto3" json:"resonateNum" bson:"resonateNum"` //共鸣次数 + DistributionResonate int32 `protobuf:"varint,19,opt,name=distributionResonate,proto3" json:"distributionResonate" bson:"distributionResonate"` //分配的共鸣能量 + Energy map[int32]int32 `protobuf:"bytes,20,rep,name=energy,proto3" json:"energy" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 能量分配到哪里 + Count int32 `protobuf:"varint,21,opt,name=count,proto3" json:"count"` // 数量 } func (x *DB_HeroData) Reset() { @@ -343,8 +398,12 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x02, 0x38, 0x01, 0x1a, 0x39, 0x0a, 0x0b, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 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, 0x2a, 0x3d, + 0x0a, 0x0c, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 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 ( @@ -359,19 +418,21 @@ func file_hero_hero_db_proto_rawDescGZIP() []byte { return file_hero_hero_db_proto_rawDescData } +var file_hero_hero_db_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_hero_hero_db_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_hero_hero_db_proto_goTypes = []interface{}{ - (*SkillData)(nil), // 0: SkillData - (*DB_HeroData)(nil), // 1: DB_HeroData - nil, // 2: DB_HeroData.PropertyEntry - nil, // 3: DB_HeroData.AddPropertyEntry - nil, // 4: DB_HeroData.EnergyEntry + (PropertyType)(0), // 0: PropertyType + (*SkillData)(nil), // 1: SkillData + (*DB_HeroData)(nil), // 2: DB_HeroData + nil, // 3: DB_HeroData.PropertyEntry + nil, // 4: DB_HeroData.AddPropertyEntry + nil, // 5: DB_HeroData.EnergyEntry } var file_hero_hero_db_proto_depIdxs = []int32{ - 0, // 0: DB_HeroData.normalSkill:type_name -> SkillData - 2, // 1: DB_HeroData.property:type_name -> DB_HeroData.PropertyEntry - 3, // 2: DB_HeroData.addProperty:type_name -> DB_HeroData.AddPropertyEntry - 4, // 3: DB_HeroData.energy:type_name -> DB_HeroData.EnergyEntry + 1, // 0: DB_HeroData.normalSkill:type_name -> SkillData + 3, // 1: DB_HeroData.property:type_name -> DB_HeroData.PropertyEntry + 4, // 2: DB_HeroData.addProperty:type_name -> DB_HeroData.AddPropertyEntry + 5, // 3: DB_HeroData.energy:type_name -> DB_HeroData.EnergyEntry 4, // [4:4] is the sub-list for method output_type 4, // [4:4] is the sub-list for method input_type 4, // [4:4] is the sub-list for extension type_name @@ -415,13 +476,14 @@ func file_hero_hero_db_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_hero_hero_db_proto_rawDesc, - NumEnums: 0, + NumEnums: 1, NumMessages: 5, NumExtensions: 0, NumServices: 0, }, GoTypes: file_hero_hero_db_proto_goTypes, DependencyIndexes: file_hero_hero_db_proto_depIdxs, + EnumInfos: file_hero_hero_db_proto_enumTypes, MessageInfos: file_hero_hero_db_proto_msgTypes, }.Build() File_hero_hero_db_proto = out.File diff --git a/pb/proto/hero/hero_db.proto b/pb/proto/hero/hero_db.proto index 7b6f4c603..81aeeb765 100644 --- a/pb/proto/hero/hero_db.proto +++ b/pb/proto/hero/hero_db.proto @@ -1,38 +1,38 @@ syntax = "proto3"; option go_package = ".;pb"; -// enum PropertyType{ -// Hp = 0; //血量 -// Atk = 1; //攻击 -// Def = 2; //防御 -// Speed = 3; //速度 -// Crit = 4; //暴击 -// } +enum PropertyType{ + Hp = 0; //血量 + Atk = 1; //攻击 + Def = 2; //防御 + Speed = 3; //速度 + Crit = 4; //暴击 +} message SkillData{ int32 skillID = 1; int32 skillLv = 2; } message DB_HeroData { - string id = 1; //@go_tags(`bson:"_id"`) ID - string uid = 2; - int32 heroID = 3; // 英雄的配置表ID - int32 star = 4; // 英雄星级 - int32 lv = 5; // 英雄等级 - int32 exp = 6; // 英雄经验 - int32 juexingLv = 7; // 觉醒等级 - int32 captainSkill = 8; // 队长技能 - repeated SkillData normalSkill = 9; // 普通技能 - map property = 10; // 属性相关 - map addProperty = 11; // 附加属性相关 - int32 formation = 12; // 阵型类型 - int32 cardType = 13; // 卡片类型(升星卡、经验卡、技能升级卡) - int32 curSkin = 14; // 当前装备的皮肤ID - repeated int32 skins = 15; // 所有皮肤ID - bool block = 16;// 锁定 - repeated string equipID = 17; // 装备 objID - int32 resonateNum = 18; // 共鸣次数 - int32 distributionResonate = 19; // 分配的共鸣能量 - map energy = 20; // 能量分配到哪里 - int32 count = 21; // 数量 + string id = 1; //@go_tags(`bson:"_id"`) ID + string uid = 2; + int32 heroID = 3; //@go_tags(`bson:"heroID"`) 英雄的配置表ID + int32 star = 4; // 英雄星级 + int32 lv = 5; // 英雄等级 + int32 exp = 6; // 英雄经验 + int32 juexingLv = 7; //@go_tags(`bson:"juexingLv"`) 觉醒等级 + int32 captainSkill = 8; //@go_tags(`bson:"captainSkill"`) 队长技能 + repeated SkillData normalSkill= 9; //@go_tags(`bson:"normalSkill"`) 普通技能 + map property = 10; // 属性相关 + map addProperty = 11; //@go_tags(`bson:"addProperty"`) 附加属性相关 + int32 formation = 12; // 阵型类型 + int32 cardType = 13; //@go_tags(`bson:"cardType"`) 卡片类型(升星卡、经验卡、技能升级卡) + int32 curSkin = 14; //@go_tags(`bson:"curSkin"`) 当前装备的皮肤ID + repeated int32 skins = 15; // 所有皮肤ID + bool block = 16; // 锁定 + repeated string equipID = 17; //@go_tags(`bson:"equipID"`) 装备 objID + int32 resonateNum = 18; //@go_tags(`bson:"resonateNum"`) 共鸣次数 + int32 distributionResonate = 19; //@go_tags(`bson:"distributionResonate"`) 分配的共鸣能量 + map energy = 20; // 能量分配到哪里 + int32 count = 21; // 数量 } \ No newline at end of file