Merge branch 'meixiongfeng' of http://git.legu.cc/liwei_3d/go_dreamfactory into dev

This commit is contained in:
meixiongfeng 2022-10-24 18:12:48 +08:00
commit 3f32c57814
6 changed files with 126 additions and 58 deletions

View File

@ -155,6 +155,9 @@ const (
///竞技场
TableArena = "arena"
// 天赋
TableTalent = "herotalent"
)
//RPC服务接口定义处

View File

@ -0,0 +1,20 @@
package hero
import (
"go_dreamfactory/comm"
"go_dreamfactory/pb"
"google.golang.org/protobuf/proto"
)
//参数校验
func (this *apiComp) TalentListCheck(session comm.IUserSession, req *pb.HeroTalentListReq) (code pb.ErrorCode) {
return
}
func (this *apiComp) TalentList(session comm.IUserSession, req *pb.HeroTalentListReq) (code pb.ErrorCode, data proto.Message) {
rsp := &pb.HeroTalentListResp{}
rsp.Telnet, _ = this.module.modelTalent.GetHerotalent(session.GetUserId())
session.SendMsg(string(this.module.GetType()), HeroSubTypeList, rsp)
return
}

View File

@ -0,0 +1,44 @@
package hero
import (
"errors"
"go_dreamfactory/comm"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/redis"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
)
// 英雄天赋组件
type ModelTalent struct {
modules.MCompModel
module *Hero
}
func (this *ModelTalent) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
this.TableName = comm.TableTalent
err = this.MCompModel.Init(service, module, comp, options)
this.module = module.(*Hero)
return
}
//获取用户天赋数据
func (this *ModelTalent) GetHerotalent(uid string) (result []*pb.DBHeroTalent, err error) {
result = make([]*pb.DBHeroTalent, 0)
if err = this.GetList(uid, result); err != nil && err != redis.RedisNil {
return
}
err = nil
return result, err
}
//修改天赋数据
func (this *ModelTalent) ChangeHeroTalent(talent *pb.DBHeroTalent, update map[string]interface{}) (err error) {
if talent == nil || len(update) == 0 {
return errors.New("err")
}
if err := this.ChangeList(talent.Uid, talent.Id, update); err != nil {
this.module.Debugf("ChangeHeroTalent err %v", err)
}
return nil
}

View File

@ -23,9 +23,9 @@ type Hero struct {
api *apiComp
configure *configureComp
modelHero *ModelHero
modelRecord *ModelRecord
modelRecord *ModelRecord // 英雄抽卡保底,次数等数据
modelTalent *ModelTalent // 天赋系统
moduleFetter comm.IHeroFetter
service core.IService
}
@ -47,8 +47,8 @@ func (this *Hero) OnInstallComp() {
this.api = this.RegisterComp(new(apiComp)).(*apiComp)
this.modelHero = this.RegisterComp(new(ModelHero)).(*ModelHero)
this.modelRecord = this.RegisterComp(new(ModelRecord)).(*ModelRecord)
this.modelTalent = this.RegisterComp(new(ModelTalent)).(*ModelTalent)
this.configure = this.RegisterComp(new(configureComp)).(*configureComp)
}
func (this *Hero) Start() (err error) {
var module core.IModule

View File

@ -544,7 +544,7 @@ func (x *DBHeroRecord) GetDrawcount() int32 {
}
// 英雄天赋系统
type HeroTalent struct {
type DBHeroTalent struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
@ -552,11 +552,11 @@ type HeroTalent struct {
Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id" bson:"_id"` //ID 主键id
Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid" bson:"uid"` //用户ID
HeroId string `protobuf:"bytes,3,opt,name=heroId,proto3" json:"heroId"` // 英雄ID
Talnet map[int32]int32 `protobuf:"bytes,4,rep,name=talnet,proto3" json:"talnet" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 已经学习过的天赋
Talent map[int32]int32 `protobuf:"bytes,4,rep,name=talent,proto3" json:"talent" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 已经学习过的天赋
}
func (x *HeroTalent) Reset() {
*x = HeroTalent{}
func (x *DBHeroTalent) Reset() {
*x = DBHeroTalent{}
if protoimpl.UnsafeEnabled {
mi := &file_hero_hero_db_proto_msgTypes[4]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -564,13 +564,13 @@ func (x *HeroTalent) Reset() {
}
}
func (x *HeroTalent) String() string {
func (x *DBHeroTalent) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*HeroTalent) ProtoMessage() {}
func (*DBHeroTalent) ProtoMessage() {}
func (x *HeroTalent) ProtoReflect() protoreflect.Message {
func (x *DBHeroTalent) ProtoReflect() protoreflect.Message {
mi := &file_hero_hero_db_proto_msgTypes[4]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@ -582,35 +582,35 @@ func (x *HeroTalent) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
// Deprecated: Use HeroTalent.ProtoReflect.Descriptor instead.
func (*HeroTalent) Descriptor() ([]byte, []int) {
// Deprecated: Use DBHeroTalent.ProtoReflect.Descriptor instead.
func (*DBHeroTalent) Descriptor() ([]byte, []int) {
return file_hero_hero_db_proto_rawDescGZIP(), []int{4}
}
func (x *HeroTalent) GetId() string {
func (x *DBHeroTalent) GetId() string {
if x != nil {
return x.Id
}
return ""
}
func (x *HeroTalent) GetUid() string {
func (x *DBHeroTalent) GetUid() string {
if x != nil {
return x.Uid
}
return ""
}
func (x *HeroTalent) GetHeroId() string {
func (x *DBHeroTalent) GetHeroId() string {
if x != nil {
return x.HeroId
}
return ""
}
func (x *HeroTalent) GetTalnet() map[int32]int32 {
func (x *DBHeroTalent) GetTalent() map[int32]int32 {
if x != nil {
return x.Talnet
return x.Talent
}
return nil
}
@ -718,22 +718,22 @@ var file_hero_hero_db_proto_rawDesc = []byte{
0x74, 0x69, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x6d, 0x74, 0x69, 0x6d,
0x65, 0x12, 0x1c, 0x0a, 0x09, 0x64, 0x72, 0x61, 0x77, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06,
0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x64, 0x72, 0x61, 0x77, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22,
0xb2, 0x01, 0x0a, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x12, 0x0e,
0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10,
0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75, 0x69, 0x64,
0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09,
0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x2f, 0x0a, 0x06, 0x74, 0x61, 0x6c, 0x6e,
0x65, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x54,
0x61, 0x6c, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x61, 0x6c, 0x6e, 0x65, 0x74, 0x45, 0x6e, 0x74, 0x72,
0x79, 0x52, 0x06, 0x74, 0x61, 0x6c, 0x6e, 0x65, 0x74, 0x1a, 0x39, 0x0a, 0x0b, 0x54, 0x61, 0x6c,
0x6e, 0x65, 0x74, 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, 0x2a, 0x2f, 0x0a, 0x08, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65,
0x12, 0x0f, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4e, 0x69, 0x6c, 0x10,
0x00, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65, 0x4b, 0x6f, 0x6e,
0x67, 0x46, 0x75, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70,
0x72, 0x6f, 0x74, 0x6f, 0x33,
0xb6, 0x01, 0x0a, 0x0c, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74,
0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64,
0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x75,
0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x03, 0x20, 0x01,
0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x31, 0x0a, 0x06, 0x74, 0x61,
0x6c, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x44, 0x42, 0x48,
0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x2e, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74,
0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x06, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x1a, 0x39, 0x0a,
0x0b, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 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, 0x2a, 0x2f, 0x0a, 0x08, 0x48, 0x65, 0x72, 0x6f,
0x54, 0x79, 0x70, 0x65, 0x12, 0x0f, 0x0a, 0x0b, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70, 0x65,
0x4e, 0x69, 0x6c, 0x10, 0x00, 0x12, 0x12, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x79, 0x70,
0x65, 0x4b, 0x6f, 0x6e, 0x67, 0x46, 0x75, 0x10, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -756,13 +756,13 @@ var file_hero_hero_db_proto_goTypes = []interface{}{
(*DBHero)(nil), // 2: DBHero
(*Floor)(nil), // 3: Floor
(*DBHeroRecord)(nil), // 4: DBHeroRecord
(*HeroTalent)(nil), // 5: HeroTalent
(*DBHeroTalent)(nil), // 5: DBHeroTalent
nil, // 6: DBHero.PropertyEntry
nil, // 7: DBHero.AddPropertyEntry
nil, // 8: DBHero.EnergyEntry
nil, // 9: DBHero.EnergyPropertyEntry
nil, // 10: DBHero.JuexPropertyEntry
nil, // 11: HeroTalent.TalnetEntry
nil, // 11: DBHeroTalent.TalentEntry
}
var file_hero_hero_db_proto_depIdxs = []int32{
1, // 0: DBHero.normalSkill:type_name -> SkillData
@ -772,7 +772,7 @@ var file_hero_hero_db_proto_depIdxs = []int32{
9, // 4: DBHero.energyProperty:type_name -> DBHero.EnergyPropertyEntry
10, // 5: DBHero.juexProperty:type_name -> DBHero.JuexPropertyEntry
0, // 6: DBHero.status:type_name -> HeroType
11, // 7: HeroTalent.talnet:type_name -> HeroTalent.TalnetEntry
11, // 7: DBHeroTalent.talent:type_name -> DBHeroTalent.TalentEntry
8, // [8:8] is the sub-list for method output_type
8, // [8:8] is the sub-list for method input_type
8, // [8:8] is the sub-list for extension type_name
@ -835,7 +835,7 @@ func file_hero_hero_db_proto_init() {
}
}
file_hero_hero_db_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*HeroTalent); i {
switch v := v.(*DBHeroTalent); i {
case 0:
return &v.state
case 1:

View File

@ -1849,7 +1849,7 @@ type HeroTalentListResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Telnet []*HeroTalent `protobuf:"bytes,1,rep,name=telnet,proto3" json:"telnet"`
Telnet []*DBHeroTalent `protobuf:"bytes,1,rep,name=telnet,proto3" json:"telnet"`
}
func (x *HeroTalentListResp) Reset() {
@ -1884,7 +1884,7 @@ func (*HeroTalentListResp) Descriptor() ([]byte, []int) {
return file_hero_hero_msg_proto_rawDescGZIP(), []int{35}
}
func (x *HeroTalentListResp) GetTelnet() []*HeroTalent {
func (x *HeroTalentListResp) GetTelnet() []*DBHeroTalent {
if x != nil {
return x.Telnet
}
@ -1952,7 +1952,7 @@ type HeroTalentLearnResp struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
Telnet *HeroTalent `protobuf:"bytes,1,opt,name=telnet,proto3" json:"telnet"`
Telnet *DBHeroTalent `protobuf:"bytes,1,opt,name=telnet,proto3" json:"telnet"`
}
func (x *HeroTalentLearnResp) Reset() {
@ -1987,7 +1987,7 @@ func (*HeroTalentLearnResp) Descriptor() ([]byte, []int) {
return file_hero_hero_msg_proto_rawDescGZIP(), []int{37}
}
func (x *HeroTalentLearnResp) GetTelnet() *HeroTalent {
func (x *HeroTalentLearnResp) GetTelnet() *DBHeroTalent {
if x != nil {
return x.Telnet
}
@ -2159,19 +2159,20 @@ var file_hero_hero_msg_proto_rawDesc = []byte{
0x73, 0x70, 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, 0x13, 0x0a, 0x11, 0x48, 0x65,
0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x22,
0x39, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73,
0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x06, 0x74, 0x65, 0x6c, 0x6e, 0x65, 0x74, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65,
0x6e, 0x74, 0x52, 0x06, 0x74, 0x65, 0x6c, 0x6e, 0x65, 0x74, 0x22, 0x48, 0x0a, 0x12, 0x48, 0x65,
0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x52, 0x65, 0x71,
0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01,
0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06,
0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65,
0x72, 0x6f, 0x69, 0x64, 0x22, 0x3a, 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65,
0x6e, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x23, 0x0a, 0x06, 0x74,
0x65, 0x6c, 0x6e, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x48, 0x65,
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,
0x3b, 0x0a, 0x12, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x4c, 0x69, 0x73,
0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a, 0x06, 0x74, 0x65, 0x6c, 0x6e, 0x65, 0x74, 0x18,
0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61,
0x6c, 0x65, 0x6e, 0x74, 0x52, 0x06, 0x74, 0x65, 0x6c, 0x6e, 0x65, 0x74, 0x22, 0x48, 0x0a, 0x12,
0x48, 0x65, 0x72, 0x6f, 0x54, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x52,
0x65, 0x71, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x18, 0x01,
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x74, 0x61, 0x6c, 0x65, 0x6e, 0x74, 0x49, 0x44, 0x12, 0x16,
0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x68, 0x65, 0x72, 0x6f, 0x69, 0x64, 0x22, 0x3c, 0x0a, 0x13, 0x48, 0x65, 0x72, 0x6f, 0x54, 0x61,
0x6c, 0x65, 0x6e, 0x74, 0x4c, 0x65, 0x61, 0x72, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x25, 0x0a,
0x06, 0x74, 0x65, 0x6c, 0x6e, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0d, 0x2e,
0x44, 0x42, 0x48, 0x65, 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,
}
var (
@ -2230,7 +2231,7 @@ var file_hero_hero_msg_proto_goTypes = []interface{}{
nil, // 39: HeroPropertyPush.AddPropertyEntry
nil, // 40: HeroFusionReq.HerosEntry
(*DBHero)(nil), // 41: DBHero
(*HeroTalent)(nil), // 42: HeroTalent
(*DBHeroTalent)(nil), // 42: DBHeroTalent
}
var file_hero_hero_msg_proto_depIdxs = []int32{
41, // 0: HeroInfoResp.base:type_name -> DBHero
@ -2253,8 +2254,8 @@ var file_hero_hero_msg_proto_depIdxs = []int32{
41, // 17: HeroGetSpecifiedResp.hero:type_name -> DBHero
41, // 18: HeroChangePush.list:type_name -> DBHero
40, // 19: HeroFusionReq.heros:type_name -> HeroFusionReq.HerosEntry
42, // 20: HeroTalentListResp.telnet:type_name -> HeroTalent
42, // 21: HeroTalentLearnResp.telnet:type_name -> HeroTalent
42, // 20: HeroTalentListResp.telnet:type_name -> DBHeroTalent
42, // 21: HeroTalentLearnResp.telnet:type_name -> DBHeroTalent
22, // [22:22] is the sub-list for method output_type
22, // [22:22] is the sub-list for method input_type
22, // [22:22] is the sub-list for extension type_name