报错处理,英雄变更消息推送
This commit is contained in:
parent
fc38b7f4ca
commit
595d83581f
@ -35,8 +35,8 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
)
|
)
|
||||||
szCards = make([]int32, 0)
|
szCards = make([]int32, 0)
|
||||||
rsp := &pb.HeroDrawCardResp{}
|
rsp := &pb.HeroDrawCardResp{}
|
||||||
curStar4Count = this.GetFloorStarData(req.DrawType, session.GetUserId(), 4)
|
//curStar4Count = this.GetFloorStarData(req.DrawType, session.GetUserId(), 4)
|
||||||
curStar5Count = this.GetFloorStarData(req.DrawType, session.GetUserId(), 5)
|
//curStar5Count = this.GetFloorStarData(req.DrawType, session.GetUserId(), 5)
|
||||||
this.module.Debugf("当前4星抽卡没中次数:%d, 当前5星抽卡没中次数:%d", curStar4Count, curStar5Count)
|
this.module.Debugf("当前4星抽卡没中次数:%d, 当前5星抽卡没中次数:%d", curStar4Count, curStar5Count)
|
||||||
|
|
||||||
// 抽卡相关
|
// 抽卡相关
|
||||||
@ -83,12 +83,12 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
if _getCardCfg.Star == 4 { // 当抽取到的英雄是4星的时候 清除 该类型的保底次数
|
||||||
this.SetFloorStarData(req.DrawType, session.GetUserId(), 4)
|
//SetFloorStarData(req.DrawType, session.GetUserId(), 4)
|
||||||
hitStar4 = 0
|
hitStar4 = 0
|
||||||
hitStar = 4
|
hitStar = 4
|
||||||
break
|
break
|
||||||
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
} else if _getCardCfg.Star == 5 { // 当抽取到的英雄是5星的时候 清除 该类型的保底次数
|
||||||
this.SetFloorStarData(req.DrawType, session.GetUserId(), 5)
|
//SetFloorStarData(req.DrawType, session.GetUserId(), 5)
|
||||||
hitStar5 = 0 // 清0
|
hitStar5 = 0 // 清0
|
||||||
hitStar = 5
|
hitStar = 5
|
||||||
break
|
break
|
||||||
@ -108,15 +108,15 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
}
|
}
|
||||||
if hitStar != 0 {
|
if hitStar != 0 {
|
||||||
hitStar = 0
|
hitStar = 0
|
||||||
this.ModifyFloorStarData(req.DrawType, session.GetUserId(), hitStar) // 重置该星级保底
|
//ModifyFloorStarData(req.DrawType, session.GetUserId(), hitStar) // 重置该星级保底
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if hitStar4 != 0 {
|
if hitStar4 != 0 {
|
||||||
this.AddFloorStarData(req.DrawType, session.GetUserId(), 4, hitStar4) // 增加4星保底次数
|
//AddFloorStarData(req.DrawType, session.GetUserId(), 4, hitStar4) // 增加4星保底次数
|
||||||
}
|
}
|
||||||
|
|
||||||
if hitStar5 != 0 {
|
if hitStar5 != 0 {
|
||||||
this.AddFloorStarData(req.DrawType, session.GetUserId(), 5, hitStar5) // 增加5星保底次数
|
//AddFloorStarData(req.DrawType, session.GetUserId(), 5, hitStar5) // 增加5星保底次数
|
||||||
}
|
}
|
||||||
//计算保底
|
//计算保底
|
||||||
|
|
||||||
@ -130,24 +130,24 @@ func (this *apiComp) DrawCard(session comm.IUserSession, req *pb.HeroDrawCardReq
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// 获取当前卡牌类型保底次数
|
// // 获取当前卡牌类型保底次数
|
||||||
func (this *apiComp) GetFloorStarData(drawType int32, uid string, star int32) (count int32) {
|
// func GetFloorStarData(drawType int32, uid string, star int32) (count int32) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 清除保底信息(drawType 抽卡类型)
|
// // 清除保底信息(drawType 抽卡类型)
|
||||||
func (this *apiComp) SetFloorStarData(drawType int32, uid string, star int32) {
|
// func SetFloorStarData(drawType int32, uid string, star int32) {
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 当前没有抽中 增加保底次数
|
// // 当前没有抽中 增加保底次数
|
||||||
func (this *apiComp) AddFloorStarData(drawType int32, uid string, star int32, count int32) {
|
// func AddFloorStarData(drawType int32, uid string, star int32, count int32) {
|
||||||
|
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 当前有抽中 修改保底次数
|
// // 当前有抽中 修改保底次数
|
||||||
func (this *apiComp) ModifyFloorStarData(drawType int32, uid string, star int32) {
|
// func ModifyFloorStarData(drawType int32, uid string, star int32) {
|
||||||
|
|
||||||
return
|
// return
|
||||||
}
|
// }
|
||||||
|
@ -263,9 +263,9 @@ func (this *ModelHero) setEquipProperty(hero *pb.DBHero, equip []*pb.DB_Equipmen
|
|||||||
}
|
}
|
||||||
|
|
||||||
//设置装备
|
//设置装备
|
||||||
func (this *ModelHero) setEquipment(hero *pb.DBHero) (err error) {
|
func (this *ModelHero) setEquipment(hero *pb.DBHero) (newHero *pb.DBHero, err error) {
|
||||||
if len(hero.EquipID) == 0 {
|
if len(hero.EquipID) == 0 {
|
||||||
return nil
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
update := make(map[string]interface{})
|
update := make(map[string]interface{})
|
||||||
@ -280,19 +280,21 @@ func (this *ModelHero) setEquipment(hero *pb.DBHero) (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//创建新卡
|
//创建新卡
|
||||||
newHero, err := this.createOneHero(hero.Uid, hero.HeroID)
|
newHero, err = this.createOneHero(hero.Uid, hero.HeroID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
this.moduleHero.Errorf("%v", err)
|
this.moduleHero.Errorf("%v", err)
|
||||||
return err
|
return
|
||||||
}
|
}
|
||||||
newHero.EquipID = hero.EquipID
|
newHero.EquipID = hero.EquipID
|
||||||
hero = newHero
|
hero = newHero
|
||||||
return this.modifyHeroData(newHero.Uid, newHero.Id, update)
|
this.modifyHeroData(newHero.Uid, newHero.Id, update)
|
||||||
|
return
|
||||||
} else {
|
} else {
|
||||||
update["equipID"] = hero.EquipID
|
update["equipID"] = hero.EquipID
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.modifyHeroData(hero.Uid, hero.Id, update)
|
this.modifyHeroData(hero.Uid, hero.Id, update)
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
//合并属性即属性值累加
|
//合并属性即属性值累加
|
||||||
|
@ -64,9 +64,17 @@ func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, eq
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := this.modelHero.setEquipment(hero); err != nil {
|
if newHero, err := this.modelHero.setEquipment(hero); err != nil {
|
||||||
code = pb.ErrorCode_HeroEquipUpdate
|
code = pb.ErrorCode_HeroEquipUpdate
|
||||||
return
|
return
|
||||||
|
} else {
|
||||||
|
list := make([]*pb.DBHero, 0)
|
||||||
|
if newHero != nil {
|
||||||
|
list = append(list, newHero)
|
||||||
|
}
|
||||||
|
|
||||||
|
list = append(list, hero)
|
||||||
|
session.SendMsg("hero", "change", &pb.HeroChangePush{List: list})
|
||||||
}
|
}
|
||||||
this.modelHero.setEquipProperty(hero, equip)
|
this.modelHero.setEquipProperty(hero, equip)
|
||||||
|
|
||||||
@ -75,6 +83,7 @@ func (this *Hero) UpdateEquipment(session comm.IUserSession, hero *pb.DBHero, eq
|
|||||||
code = pb.ErrorCode_Unknown
|
code = pb.ErrorCode_Unknown
|
||||||
this.Errorf("PushHeroProperty err!")
|
this.Errorf("PushHeroProperty err!")
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1632,6 +1632,54 @@ func (x *HeroDrawCardResp) GetHeroes() []int32 {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 英雄变化推送
|
||||||
|
type HeroChangePush struct {
|
||||||
|
state protoimpl.MessageState
|
||||||
|
sizeCache protoimpl.SizeCache
|
||||||
|
unknownFields protoimpl.UnknownFields
|
||||||
|
|
||||||
|
List []*DBHero `protobuf:"bytes,1,rep,name=list,proto3" json:"list"`
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HeroChangePush) Reset() {
|
||||||
|
*x = HeroChangePush{}
|
||||||
|
if protoimpl.UnsafeEnabled {
|
||||||
|
mi := &file_hero_hero_msg_proto_msgTypes[31]
|
||||||
|
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
|
||||||
|
ms.StoreMessageInfo(mi)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HeroChangePush) String() string {
|
||||||
|
return protoimpl.X.MessageStringOf(x)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (*HeroChangePush) ProtoMessage() {}
|
||||||
|
|
||||||
|
func (x *HeroChangePush) ProtoReflect() protoreflect.Message {
|
||||||
|
mi := &file_hero_hero_msg_proto_msgTypes[31]
|
||||||
|
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 HeroChangePush.ProtoReflect.Descriptor instead.
|
||||||
|
func (*HeroChangePush) Descriptor() ([]byte, []int) {
|
||||||
|
return file_hero_hero_msg_proto_rawDescGZIP(), []int{31}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HeroChangePush) GetList() []*DBHero {
|
||||||
|
if x != nil {
|
||||||
|
return x.List
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
var File_hero_hero_msg_proto protoreflect.FileDescriptor
|
var File_hero_hero_msg_proto protoreflect.FileDescriptor
|
||||||
|
|
||||||
var file_hero_hero_msg_proto_rawDesc = []byte{
|
var file_hero_hero_msg_proto_rawDesc = []byte{
|
||||||
@ -1787,8 +1835,11 @@ var file_hero_hero_msg_proto_rawDesc = []byte{
|
|||||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x72, 0x61, 0x77, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2a,
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x72, 0x61, 0x77, 0x54, 0x79, 0x70, 0x65, 0x22, 0x2a,
|
||||||
0x0a, 0x10, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65,
|
0x0a, 0x10, 0x48, 0x65, 0x72, 0x6f, 0x44, 0x72, 0x61, 0x77, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65,
|
||||||
0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
|
0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
|
||||||
0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b,
|
0x28, 0x05, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x22, 0x2d, 0x0a, 0x0e, 0x48, 0x65,
|
||||||
0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
0x72, 0x6f, 0x43, 0x68, 0x61, 0x6e, 0x67, 0x65, 0x50, 0x75, 0x73, 0x68, 0x12, 0x1b, 0x0a, 0x04,
|
||||||
|
0x6c, 0x69, 0x73, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48,
|
||||||
|
0x65, 0x72, 0x6f, 0x52, 0x04, 0x6c, 0x69, 0x73, 0x74, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70,
|
||||||
|
0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -1803,7 +1854,7 @@ func file_hero_hero_msg_proto_rawDescGZIP() []byte {
|
|||||||
return file_hero_hero_msg_proto_rawDescData
|
return file_hero_hero_msg_proto_rawDescData
|
||||||
}
|
}
|
||||||
|
|
||||||
var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 35)
|
var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 36)
|
||||||
var file_hero_hero_msg_proto_goTypes = []interface{}{
|
var file_hero_hero_msg_proto_goTypes = []interface{}{
|
||||||
(*HeroInfoReq)(nil), // 0: HeroInfoReq
|
(*HeroInfoReq)(nil), // 0: HeroInfoReq
|
||||||
(*HeroInfoResp)(nil), // 1: HeroInfoResp
|
(*HeroInfoResp)(nil), // 1: HeroInfoResp
|
||||||
@ -1836,38 +1887,40 @@ var file_hero_hero_msg_proto_goTypes = []interface{}{
|
|||||||
(*HeroDelHeroPush)(nil), // 28: HeroDelHeroPush
|
(*HeroDelHeroPush)(nil), // 28: HeroDelHeroPush
|
||||||
(*HeroDrawCardReq)(nil), // 29: HeroDrawCardReq
|
(*HeroDrawCardReq)(nil), // 29: HeroDrawCardReq
|
||||||
(*HeroDrawCardResp)(nil), // 30: HeroDrawCardResp
|
(*HeroDrawCardResp)(nil), // 30: HeroDrawCardResp
|
||||||
nil, // 31: HeroStrengthenUplvReq.ExpCardsEntry
|
(*HeroChangePush)(nil), // 31: HeroChangePush
|
||||||
nil, // 32: HeroPropertyPush.PropertyEntry
|
nil, // 32: HeroStrengthenUplvReq.ExpCardsEntry
|
||||||
nil, // 33: HeroPropertyPush.AddPropertyEntry
|
nil, // 33: HeroPropertyPush.PropertyEntry
|
||||||
nil, // 34: HeroDelHeroPush.HerosEntry
|
nil, // 34: HeroPropertyPush.AddPropertyEntry
|
||||||
(*DBHero)(nil), // 35: DBHero
|
nil, // 35: HeroDelHeroPush.HerosEntry
|
||||||
|
(*DBHero)(nil), // 36: DBHero
|
||||||
}
|
}
|
||||||
var file_hero_hero_msg_proto_depIdxs = []int32{
|
var file_hero_hero_msg_proto_depIdxs = []int32{
|
||||||
35, // 0: HeroInfoResp.base:type_name -> DBHero
|
36, // 0: HeroInfoResp.base:type_name -> DBHero
|
||||||
35, // 1: HeroListResp.list:type_name -> DBHero
|
36, // 1: HeroListResp.list:type_name -> DBHero
|
||||||
31, // 2: HeroStrengthenUplvReq.expCards:type_name -> HeroStrengthenUplvReq.ExpCardsEntry
|
32, // 2: HeroStrengthenUplvReq.expCards:type_name -> HeroStrengthenUplvReq.ExpCardsEntry
|
||||||
35, // 3: HeroStrengthenUplvResp.hero:type_name -> DBHero
|
36, // 3: HeroStrengthenUplvResp.hero:type_name -> DBHero
|
||||||
7, // 4: HeroStrengthenUpStarReq.hero:type_name -> CostCardData
|
7, // 4: HeroStrengthenUpStarReq.hero:type_name -> CostCardData
|
||||||
7, // 5: HeroStrengthenUpStarReq.heroRace:type_name -> CostCardData
|
7, // 5: HeroStrengthenUpStarReq.heroRace:type_name -> CostCardData
|
||||||
35, // 6: HeroStrengthenUpStarResp.hero:type_name -> DBHero
|
36, // 6: HeroStrengthenUpStarResp.hero:type_name -> DBHero
|
||||||
35, // 7: HeroStrengthenUpSkillResp.hero:type_name -> DBHero
|
36, // 7: HeroStrengthenUpSkillResp.hero:type_name -> DBHero
|
||||||
35, // 8: HeroResonanceResp.hero:type_name -> DBHero
|
36, // 8: HeroResonanceResp.hero:type_name -> DBHero
|
||||||
35, // 9: HeroResonanceResp.upStarCard:type_name -> DBHero
|
36, // 9: HeroResonanceResp.upStarCard:type_name -> DBHero
|
||||||
35, // 10: HeroResonanceResetResp.hero:type_name -> DBHero
|
36, // 10: HeroResonanceResetResp.hero:type_name -> DBHero
|
||||||
35, // 11: HeroResonanceUseEnergyResp.hero:type_name -> DBHero
|
36, // 11: HeroResonanceUseEnergyResp.hero:type_name -> DBHero
|
||||||
35, // 12: HeroAwakenResp.hero:type_name -> DBHero
|
36, // 12: HeroAwakenResp.hero:type_name -> DBHero
|
||||||
35, // 13: HeroChoukaResp.heroes:type_name -> DBHero
|
36, // 13: HeroChoukaResp.heroes:type_name -> DBHero
|
||||||
32, // 14: HeroPropertyPush.property:type_name -> HeroPropertyPush.PropertyEntry
|
33, // 14: HeroPropertyPush.property:type_name -> HeroPropertyPush.PropertyEntry
|
||||||
33, // 15: HeroPropertyPush.addProperty:type_name -> HeroPropertyPush.AddPropertyEntry
|
34, // 15: HeroPropertyPush.addProperty:type_name -> HeroPropertyPush.AddPropertyEntry
|
||||||
35, // 16: HeroLockResp.hero:type_name -> DBHero
|
36, // 16: HeroLockResp.hero:type_name -> DBHero
|
||||||
35, // 17: HeroAddNewHeroPush.hero:type_name -> DBHero
|
36, // 17: HeroAddNewHeroPush.hero:type_name -> DBHero
|
||||||
35, // 18: HeroGetSpecifiedResp.hero:type_name -> DBHero
|
36, // 18: HeroGetSpecifiedResp.hero:type_name -> DBHero
|
||||||
34, // 19: HeroDelHeroPush.heros:type_name -> HeroDelHeroPush.HerosEntry
|
35, // 19: HeroDelHeroPush.heros:type_name -> HeroDelHeroPush.HerosEntry
|
||||||
20, // [20:20] is the sub-list for method output_type
|
36, // 20: HeroChangePush.list:type_name -> DBHero
|
||||||
20, // [20:20] is the sub-list for method input_type
|
21, // [21:21] is the sub-list for method output_type
|
||||||
20, // [20:20] is the sub-list for extension type_name
|
21, // [21:21] is the sub-list for method input_type
|
||||||
20, // [20:20] is the sub-list for extension extendee
|
21, // [21:21] is the sub-list for extension type_name
|
||||||
0, // [0:20] is the sub-list for field type_name
|
21, // [21:21] is the sub-list for extension extendee
|
||||||
|
0, // [0:21] is the sub-list for field type_name
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() { file_hero_hero_msg_proto_init() }
|
func init() { file_hero_hero_msg_proto_init() }
|
||||||
@ -2249,6 +2302,18 @@ func file_hero_hero_msg_proto_init() {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
file_hero_hero_msg_proto_msgTypes[31].Exporter = func(v interface{}, i int) interface{} {
|
||||||
|
switch v := v.(*HeroChangePush); i {
|
||||||
|
case 0:
|
||||||
|
return &v.state
|
||||||
|
case 1:
|
||||||
|
return &v.sizeCache
|
||||||
|
case 2:
|
||||||
|
return &v.unknownFields
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
type x struct{}
|
type x struct{}
|
||||||
out := protoimpl.TypeBuilder{
|
out := protoimpl.TypeBuilder{
|
||||||
@ -2256,7 +2321,7 @@ func file_hero_hero_msg_proto_init() {
|
|||||||
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
|
||||||
RawDescriptor: file_hero_hero_msg_proto_rawDesc,
|
RawDescriptor: file_hero_hero_msg_proto_rawDesc,
|
||||||
NumEnums: 0,
|
NumEnums: 0,
|
||||||
NumMessages: 35,
|
NumMessages: 36,
|
||||||
NumExtensions: 0,
|
NumExtensions: 0,
|
||||||
NumServices: 0,
|
NumServices: 0,
|
||||||
},
|
},
|
||||||
|
@ -153,3 +153,8 @@ message HeroDrawCardReq {
|
|||||||
message HeroDrawCardResp {
|
message HeroDrawCardResp {
|
||||||
repeated int32 heroes = 1; // 返回英雄的configID
|
repeated int32 heroes = 1; // 返回英雄的configID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 英雄变化推送
|
||||||
|
message HeroChangePush{
|
||||||
|
repeated DBHero list = 1;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user