同步
This commit is contained in:
parent
59a355bf29
commit
d5b15ce0f7
@ -820,79 +820,99 @@ func (this *ModelHero) createHero(session comm.IUserSession, heroCfgId string, c
|
||||
O: hero.Id,
|
||||
})
|
||||
}
|
||||
|
||||
res := make([]*cfg.Gameatn, 0)
|
||||
rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if rst.Expitem == nil {
|
||||
rst.Expitem = make(map[string]int32)
|
||||
}
|
||||
if rst.Herofrag == nil {
|
||||
rst.Herofrag = make(map[string]int32)
|
||||
}
|
||||
bChange := false
|
||||
// 转碎片处理
|
||||
if count > 0 {
|
||||
res := make([]*cfg.Gameatn, 0)
|
||||
for i := 0; int32(i) < count; i++ {
|
||||
bAdd := false
|
||||
//守护之星 获得
|
||||
if heroCfg.Herofragnum > 0 {
|
||||
if v, ok := rst.Herofrag[hero.HeroID]; !ok {
|
||||
rst.Herofrag[hero.HeroID] = 1
|
||||
bAdd = true
|
||||
bChange = true
|
||||
} else if heroCfg.Herofragnum > v {
|
||||
rst.Herofrag[hero.HeroID] += 1
|
||||
bAdd = true
|
||||
bChange = true
|
||||
}
|
||||
}
|
||||
if bAdd {
|
||||
|
||||
// 如果技能是满级 则转成其他道具
|
||||
if this.checkHeroAllSkillMax(hero) {
|
||||
res = append(res, heroCfg.Herofrag...)
|
||||
for _, v := range heroCfg.Herofrag {
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
} else {
|
||||
list := this.module.ModuleTools.GetGlobalConf().Moonshopmoney
|
||||
if list != nil {
|
||||
|
||||
for pos, v := range list {
|
||||
if int32(pos)+3 == heroCfg.Star && v > 0 {
|
||||
res = append(res, &cfg.Gameatn{
|
||||
A: "attr",
|
||||
T: "moongold",
|
||||
N: v * count,
|
||||
N: v,
|
||||
})
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: "attr",
|
||||
T: "moongold",
|
||||
N: v * count,
|
||||
N: v,
|
||||
})
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for i := 0; i < int(count); i++ {
|
||||
res = append(res, heroCfg.Herofrag...)
|
||||
for _, v := range heroCfg.Herofrag {
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
bAdd = false // 初始化
|
||||
// expitem 获得
|
||||
if heroCfg.Expitemnum > 0 {
|
||||
if v, ok := rst.Expitem[hero.HeroID]; ok {
|
||||
if heroCfg.Expitemnum > v {
|
||||
rst.Expitem[hero.HeroID] += 1
|
||||
bAdd = true
|
||||
bChange = true
|
||||
}
|
||||
} else {
|
||||
rst.Expitem[hero.HeroID] = 1
|
||||
bAdd = true
|
||||
bChange = true
|
||||
}
|
||||
}
|
||||
if bAdd {
|
||||
res = append(res, heroCfg.Expitem...)
|
||||
for _, v := range heroCfg.Expitem {
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// expitem 获得
|
||||
if rst, err := this.module.ModuleUser.GetUserExpand(session.GetUserId()); err == nil { // 统计主线进度
|
||||
_mp := rst.Expitem
|
||||
bAdd := false
|
||||
if heroCfg.Expitemnum > 0 {
|
||||
if v, ok := _mp[hero.HeroID]; ok {
|
||||
if heroCfg.Expitemnum > v {
|
||||
_mp[hero.HeroID] += 1
|
||||
bAdd = true
|
||||
}
|
||||
} else {
|
||||
_mp[hero.HeroID] = 1
|
||||
bAdd = true
|
||||
}
|
||||
}
|
||||
if bAdd {
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
"expitem": _mp,
|
||||
})
|
||||
for i := 0; i < int(count); i++ {
|
||||
res = append(res, heroCfg.Expitem...)
|
||||
for _, v := range heroCfg.Expitem {
|
||||
atno = append(atno, &pb.UserAtno{
|
||||
A: v.A,
|
||||
T: v.T,
|
||||
N: v.N,
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if len(res) > 0 { // 资源统一发放
|
||||
this.module.DispenseRes(session, res, true)
|
||||
}
|
||||
}
|
||||
if bChange {
|
||||
this.module.ModuleUser.ChangeUserExpand(session.GetUserId(), map[string]interface{}{
|
||||
"herofrag": rst.Herofrag,
|
||||
"expitem": rst.Expitem,
|
||||
})
|
||||
}
|
||||
if len(res) > 0 { // 资源统一发放
|
||||
this.module.DispenseRes(session, res, true)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ func (this *ModelExpand) GetUserExpand(uid string) (result *pb.DBUserExpand, err
|
||||
"mline": make(map[string]int32, 0),
|
||||
"race": make(map[string]int32, 0),
|
||||
"givetime": configure.Now().Unix(),
|
||||
"herofrag": make(map[string]int32, 0), // 初始化
|
||||
}
|
||||
result.SociatyTicket = globalConf.GuildBossInitialNum
|
||||
if err = this.module.modelExpand.ChangeUserExpand(uid, initUpdate); err != nil {
|
||||
|
@ -59,6 +59,7 @@ type DBUserExpand struct {
|
||||
SuiteId []int32 `protobuf:"varint,35,rep,packed,name=suiteId,proto3" json:"suiteId" bson:"suiteId"` // 套装Id
|
||||
Globalbuff int32 `protobuf:"varint,36,opt,name=globalbuff,proto3" json:"globalbuff" bson:"globalbuff"` // 全局buff
|
||||
Race map[int32]int32 `protobuf:"bytes,37,rep,name=race,proto3" json:"race" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // key 阵营ID 1~4 value 总好感度
|
||||
Herofrag map[string]int32 `protobuf:"bytes,38,rep,name=herofrag,proto3" json:"herofrag" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //当获得重复守护者时获得的守护之心次数
|
||||
}
|
||||
|
||||
func (x *DBUserExpand) Reset() {
|
||||
@ -324,11 +325,18 @@ func (x *DBUserExpand) GetRace() map[int32]int32 {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (x *DBUserExpand) GetHerofrag() map[string]int32 {
|
||||
if x != nil {
|
||||
return x.Herofrag
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var File_userexpand_proto protoreflect.FileDescriptor
|
||||
|
||||
var file_userexpand_proto_rawDesc = []byte{
|
||||
0x0a, 0x10, 0x75, 0x73, 0x65, 0x72, 0x65, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x22, 0x92, 0x0b, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70,
|
||||
0x74, 0x6f, 0x22, 0x88, 0x0c, 0x0a, 0x0c, 0x44, 0x42, 0x55, 0x73, 0x65, 0x72, 0x45, 0x78, 0x70,
|
||||
0x61, 0x6e, 0x64, 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, 0x2c, 0x0a, 0x11, 0x6c, 0x61, 0x73, 0x74, 0x72, 0x65, 0x61,
|
||||
@ -406,19 +414,26 @@ var file_userexpand_proto_rawDesc = []byte{
|
||||
0x0a, 0x67, 0x6c, 0x6f, 0x62, 0x61, 0x6c, 0x62, 0x75, 0x66, 0x66, 0x12, 0x2b, 0x0a, 0x04, 0x72,
|
||||
0x61, 0x63, 0x65, 0x18, 0x25, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x17, 0x2e, 0x44, 0x42, 0x55, 0x73,
|
||||
0x65, 0x72, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x52, 0x61, 0x63, 0x65, 0x45, 0x6e, 0x74,
|
||||
0x72, 0x79, 0x52, 0x04, 0x72, 0x61, 0x63, 0x65, 0x1a, 0x3a, 0x0a, 0x0c, 0x45, 0x78, 0x70, 0x69,
|
||||
0x74, 0x65, 0x6d, 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, 0x1a, 0x38, 0x0a, 0x0a, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 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, 0x1a, 0x37,
|
||||
0x0a, 0x09, 0x52, 0x61, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b,
|
||||
0x72, 0x79, 0x52, 0x04, 0x72, 0x61, 0x63, 0x65, 0x12, 0x37, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f,
|
||||
0x66, 0x72, 0x61, 0x67, 0x18, 0x26, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x44, 0x42, 0x55,
|
||||
0x73, 0x65, 0x72, 0x45, 0x78, 0x70, 0x61, 0x6e, 0x64, 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x66, 0x72,
|
||||
0x61, 0x67, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x66, 0x72, 0x61,
|
||||
0x67, 0x1a, 0x3a, 0x0a, 0x0c, 0x45, 0x78, 0x70, 0x69, 0x74, 0x65, 0x6d, 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, 0x1a, 0x38, 0x0a,
|
||||
0x0a, 0x4d, 0x6c, 0x69, 0x6e, 0x65, 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,
|
||||
0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x37, 0x0a, 0x09, 0x52, 0x61, 0x63, 0x65, 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,
|
||||
0x1a, 0x3b, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x66, 0x72, 0x61, 0x67, 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,
|
||||
}
|
||||
|
||||
var (
|
||||
@ -433,22 +448,24 @@ func file_userexpand_proto_rawDescGZIP() []byte {
|
||||
return file_userexpand_proto_rawDescData
|
||||
}
|
||||
|
||||
var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_userexpand_proto_msgTypes = make([]protoimpl.MessageInfo, 5)
|
||||
var file_userexpand_proto_goTypes = []interface{}{
|
||||
(*DBUserExpand)(nil), // 0: DBUserExpand
|
||||
nil, // 1: DBUserExpand.ExpitemEntry
|
||||
nil, // 2: DBUserExpand.MlineEntry
|
||||
nil, // 3: DBUserExpand.RaceEntry
|
||||
nil, // 4: DBUserExpand.HerofragEntry
|
||||
}
|
||||
var file_userexpand_proto_depIdxs = []int32{
|
||||
1, // 0: DBUserExpand.expitem:type_name -> DBUserExpand.ExpitemEntry
|
||||
2, // 1: DBUserExpand.mline:type_name -> DBUserExpand.MlineEntry
|
||||
3, // 2: DBUserExpand.race:type_name -> DBUserExpand.RaceEntry
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
3, // [3:3] is the sub-list for extension type_name
|
||||
3, // [3:3] is the sub-list for extension extendee
|
||||
0, // [0:3] is the sub-list for field type_name
|
||||
4, // 3: DBUserExpand.herofrag:type_name -> DBUserExpand.HerofragEntry
|
||||
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
|
||||
4, // [4:4] is the sub-list for extension extendee
|
||||
0, // [0:4] is the sub-list for field type_name
|
||||
}
|
||||
|
||||
func init() { file_userexpand_proto_init() }
|
||||
@ -476,7 +493,7 @@ func file_userexpand_proto_init() {
|
||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||
RawDescriptor: file_userexpand_proto_rawDesc,
|
||||
NumEnums: 0,
|
||||
NumMessages: 4,
|
||||
NumMessages: 5,
|
||||
NumExtensions: 0,
|
||||
NumServices: 0,
|
||||
},
|
||||
|
@ -14,6 +14,7 @@ type GameLoadingData struct {
|
||||
Id int32
|
||||
Scene string
|
||||
Image string
|
||||
Icon string
|
||||
Prompt string
|
||||
}
|
||||
|
||||
@ -27,6 +28,7 @@ func (_v *GameLoadingData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
|
||||
{ var _ok_ bool; if _v.Scene, _ok_ = _buf["scene"].(string); !_ok_ { err = errors.New("scene error"); return } }
|
||||
{ var _ok_ bool; if _v.Image, _ok_ = _buf["image"].(string); !_ok_ { err = errors.New("image error"); return } }
|
||||
{ var _ok_ bool; if _v.Icon, _ok_ = _buf["icon"].(string); !_ok_ { err = errors.New("icon error"); return } }
|
||||
{var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["prompt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Prompt error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Prompt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
|
||||
return
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ type GameHeroData struct {
|
||||
Deviation int32
|
||||
Show int32
|
||||
Herofrag []*Gameatn
|
||||
Herofragnum int32
|
||||
Heroskillup []string
|
||||
Expitem []*Gameatn
|
||||
Expitemnum int32
|
||||
@ -151,6 +152,7 @@ func (_v *GameHeroData)Deserialize(_buf map[string]interface{}) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["herofragnum"].(float64); !_ok_ { err = errors.New("herofragnum error"); return }; _v.Herofragnum = int32(_tempNum_) }
|
||||
{
|
||||
var _arr_ []interface{}
|
||||
var _ok_ bool
|
||||
|
Loading…
Reference in New Issue
Block a user