From a5508dcd47b3d45014cb2d2b0ac0727055fcf1e0 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 30 Jun 2022 20:07:35 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=A2=A6=E5=B7=A5?= =?UTF-8?q?=E5=8E=82=E5=8D=8F=E8=AE=AE=E6=8E=A5=E5=8F=A3=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/usersession.go | 15 +- lego/sys/redis/cluster/hash.go | 4 + lego/sys/redis/cluster/list.go | 4 + lego/sys/redis/single/hash.go | 3 + lego/utils/codec/decoder.go | 13 +- modules/equipment/api_equip.go | 6 + modules/equipment/api_upgrade.go | 24 +-- modules/equipment/configure.go | 2 + modules/equipment/model_equipment.go | 4 +- modules/equipment/module.go | 9 +- modules/equipment/module_test.go | 37 +++- modules/modulebase.go | 21 ++- pb/equipment_msg.pb.go | 61 +++++-- pb/hero_msg.pb.go | 240 ++++++++++++------------- pb/proto/equipment/equipment_msg.proto | 5 +- services/worker/main.go | 3 +- 16 files changed, 269 insertions(+), 182 deletions(-) diff --git a/comm/usersession.go b/comm/usersession.go index ddcec3825..eeab688e2 100644 --- a/comm/usersession.go +++ b/comm/usersession.go @@ -93,24 +93,13 @@ func (this *UserSession) UnBind() (err error) { //向用户发送消息 func (this *UserSession) SendMsg(mainType, subType string, msg proto.Message) (err error) { - log.Debugf("SendMsg to SessionId:[%s] UserId:[%s] Data: %v", this.UserId, msg) + log.Debugf("SendMsg to UserId:[%s] Data: %v", this.UserId, msg) data, _ := anypb.New(msg) this.msgqueue = append(this.msgqueue, &pb.UserMessage{ MainType: mainType, SubType: subType, Data: data, }) - // reply := &pb.RPCMessageReply{} - // data, _ := anypb.New(msg) - // log.Debugf("SendMsg to SessionId:[%s] UserId:[%s] Data: %v", this.UserId, msg) - // if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentSendMsg), &pb.AgentSendMessageReq{ - // UserSessionId: this.SessionId, - // MainType: mainType, - // SubType: subType, - // Data: data, - // }, reply); err != nil { - // log.Errorf("SendMsg:%s UserSession:%s UserId:%s err:%v", mainType, this.SessionId, this.UserId, err) - // } return } @@ -120,7 +109,7 @@ func (this *UserSession) Close() (err error) { if err := this.service.RpcCall(context.Background(), fmt.Sprintf("%s/%s", Service_Gateway, this.GatewayServiceId), string(Rpc_GatewayAgentSendMsg), &pb.AgentCloseeReq{ UserSessionId: this.SessionId, }, reply); err != nil { - log.Errorf("Close UserSession:%s UserId:%d err:%v", this.SessionId, this.UserId, err) + log.Errorf("Close UserSession:%s UserId:%s err:%v", this.SessionId, this.UserId, err) } return } diff --git a/lego/sys/redis/cluster/hash.go b/lego/sys/redis/cluster/hash.go index 8cc2cbb20..55bed3662 100644 --- a/lego/sys/redis/cluster/hash.go +++ b/lego/sys/redis/cluster/hash.go @@ -136,6 +136,10 @@ func (this *Redis) HMGet(key string, v interface{}, fields ...string) (err error this.client.Process(this.getContext(), cmd) var _result map[string]string if _result, err = cmd.Result(); err == nil { + if len(_result) == 0 { + err = redis.Nil + return + } err = this.decode.DecoderMapString(_result, v) } return diff --git a/lego/sys/redis/cluster/list.go b/lego/sys/redis/cluster/list.go index 168c435fc..b141c485b 100644 --- a/lego/sys/redis/cluster/list.go +++ b/lego/sys/redis/cluster/list.go @@ -12,6 +12,10 @@ func (this *Redis) Lindex(key string, v interface{}) (err error) { this.client.Process(this.getContext(), cmd) var _result string if _result, err = cmd.Result(); err == nil { + if len(_result) == 0 { + err = redis.Nil + return + } err = this.decode.DecoderString(_result, v) } return diff --git a/lego/sys/redis/single/hash.go b/lego/sys/redis/single/hash.go index 2bd9f15e4..d37c24f05 100644 --- a/lego/sys/redis/single/hash.go +++ b/lego/sys/redis/single/hash.go @@ -68,6 +68,9 @@ func (this *Redis) HGetAll(key string, v interface{}) (err error) { this.client.Process(this.getContext(), cmd) var _result map[string]string if _result, err = cmd.Result(); err == nil { + if len(_result) == 0 { + return redis.Nil + } err = this.decode.DecoderMapString(_result, v) } return diff --git a/lego/utils/codec/decoder.go b/lego/utils/codec/decoder.go index 83adb73da..6d34bb75a 100644 --- a/lego/utils/codec/decoder.go +++ b/lego/utils/codec/decoder.go @@ -307,17 +307,10 @@ func (this *Decoder) DecoderMapString(data map[string]string, v interface{}) err } if value, ok := data[name]; ok { v := reflect.New(fieldInfo.Type).Elem() - if fieldInfo.Type.Kind() != reflect.Ptr { - if err := this.DecoderString(value, v.Addr().Interface()); err != nil { - return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err) - } - elem.FieldByName(fieldInfo.Name).Set(v) - } else { - if err := this.DecoderString(value, v); err != nil { - return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err) - } - elem.FieldByName(fieldInfo.Name).Set(v) + if err := this.DecoderString(value, v.Addr().Interface()); err != nil { + return fmt.Errorf("Decoder: Decoder(non-pointer %T) err:%v", value, err) } + elem.FieldByName(fieldInfo.Name).Set(v) } } } diff --git a/modules/equipment/api_equip.go b/modules/equipment/api_equip.go index 250b32f4b..825e54930 100644 --- a/modules/equipment/api_equip.go +++ b/modules/equipment/api_equip.go @@ -56,6 +56,12 @@ func (this *apiComp) Equip(session comm.IUserSession, agrs map[string]interface{ hero *pb.DBHero ) + defer func() { + if code == pb.ErrorCode_Success { + session.SendMsg(string(this.module.GetType()), "equip", &pb.EquipmentEquipResp{Equipments: equipments}) + } + }() + confs = agrs["conf"].([]*cfg.Game_equipData) equipments = agrs["equipment"].([]*pb.DB_Equipment) updatequipment = make([]*pb.DB_Equipment, 0) diff --git a/modules/equipment/api_upgrade.go b/modules/equipment/api_upgrade.go index 72c497ff0..22d3810a4 100644 --- a/modules/equipment/api_upgrade.go +++ b/modules/equipment/api_upgrade.go @@ -51,17 +51,18 @@ func (this *apiComp) UpgradeCheck(session comm.IUserSession, req *pb.EquipmentUp ///英雄挂在装备 func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interface{}, req *pb.EquipmentUpgradeReq) (code pb.ErrorCode) { var ( - err error - conf *cfg.Game_equipData - intensify *cfg.Game_equipIntensifyData - equipment *pb.DB_Equipment - hero *pb.DBHero - equipments []*pb.DB_Equipment - issucc bool + err error + conf *cfg.Game_equipData + intensify *cfg.Game_equipIntensifyData + equipment *pb.DB_Equipment + modifyequipments []*pb.DB_Equipment + hero *pb.DBHero + equipments []*pb.DB_Equipment + issucc bool ) defer func() { if code == pb.ErrorCode_Success { - session.SendMsg(string(this.module.GetType()), "", &pb.EquipmentUpgradeResp{}) + session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments}) } }() conf = agrs["conf"].(*cfg.Game_equipData) @@ -78,10 +79,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac } } if issucc { - if code = this.module.CheckConsumeRes(session.GetUserId(), intensify.Need); err != nil { + if code = this.module.CheckConsumeRes(session.GetUserId(), intensify.Need); code != pb.ErrorCode_Success { return } - + modifyequipments = make([]*pb.DB_Equipment, 0) //叠加装备 拆分处理 if equipment.IsInitialState && equipment.OverlayNum > 1 { equipment.OverlayNum-- @@ -93,10 +94,12 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac code = pb.ErrorCode_SystemError return } + modifyequipments = append(modifyequipments, equipment) equipment = CloneEquipment(equipment) equipment.Id = primitive.NewObjectID().Hex() equipment.IsInitialState = false equipment.OverlayNum = 1 + modifyequipments = append(modifyequipments, equipment) if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil { code = pb.ErrorCode_SystemError log.Errorf("Upgrade err:%v", err) @@ -109,6 +112,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, agrs map[string]interfac } } else { equipment.IsInitialState = false + modifyequipments = append(modifyequipments, equipment) if err = this.module.modelEquipment.upgradeEquipment(equipment, conf, intensify); err != nil { code = pb.ErrorCode_SystemError log.Errorf("Upgrade err:%v", err) diff --git a/modules/equipment/configure.go b/modules/equipment/configure.go index 918d36308..925c8ec41 100644 --- a/modules/equipment/configure.go +++ b/modules/equipment/configure.go @@ -26,6 +26,8 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp this.ModuleCompBase.Init(service, module, comp, options) this.LoadConfigure(game_equip, cfg.NewGame_equip) this.LoadConfigure(equip_attrlibrary, cfg.NewGame_equipAttrlibrary) + this.LoadConfigure(equip_intensify, cfg.NewGame_equipIntensify) + this.LoadConfigure(equip_suit, cfg.NewGame_equipSuit) return } diff --git a/modules/equipment/model_equipment.go b/modules/equipment/model_equipment.go index c1268de44..f19c0df18 100644 --- a/modules/equipment/model_equipment.go +++ b/modules/equipment/model_equipment.go @@ -187,7 +187,7 @@ func (this *modelEquipmentComp) newEquipment(uid string, conf *cfg.Game_equipDat func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equip *cfg.Game_equipData, intensify *cfg.Game_equipIntensifyData) (err error) { equipment.Lv++ equipment.MainEntry.Lv++ - equipment.MainEntry.Value += equipment.MainEntry.Value * (intensify.Bonus / 1000.0) + equipment.MainEntry.Value += int32(float64(equipment.MainEntry.Value) * float64(intensify.Bonus) / 1000.0) if !intensify.Activation { //不触发副词条变化 return } @@ -227,7 +227,7 @@ func (this *modelEquipmentComp) upgradeEquipment(equipment *pb.DB_Equipment, equ if attrlibrary, err = this.module.configure.GetEquipmentAttrlibraryConfigureByKey(equipment.AdverbEntry[index].Id); err != nil { return } - equipment.AdverbEntry[index].Value += attrlibrary.Addition[equipment.AdverbEntry[index].Lv-1] / 1000.0 * attrlibrary.Attrvar + equipment.AdverbEntry[index].Value += int32(float64(attrlibrary.Addition[equipment.AdverbEntry[index].Lv-1]) / 1000.0 * float64(attrlibrary.Attrvar)) equipment.AdverbEntry[index].Lv++ } return diff --git a/modules/equipment/module.go b/modules/equipment/module.go index 739c5f282..cf9baa8be 100644 --- a/modules/equipment/module.go +++ b/modules/equipment/module.go @@ -63,9 +63,14 @@ func (this *Equipment) OnInstallComp() { //IEquipment------------------------------------------------------------------------------------------------------------------------------- //查询武器信息 -func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string, Id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) { +func (this *Equipment) QueryEquipment(source *comm.ModuleCallSource, uid string, id string) (equipment *pb.DB_Equipment, code pb.ErrorCode) { var err error - if equipment, err = this.modelEquipment.QueryUserEquipmentsById(uid, Id); err != nil { + if uid == "" || id == "" { + log.Errorf("请求参数错误 uid:%s Id:%s", uid, id) + code = pb.ErrorCode_ReqParameterError + return + } + if equipment, err = this.modelEquipment.QueryUserEquipmentsById(uid, id); err != nil { if err == redis.Nil { code = pb.ErrorCode_EquipmentOnFoundEquipment } else { diff --git a/modules/equipment/module_test.go b/modules/equipment/module_test.go index 811d65168..751748d67 100644 --- a/modules/equipment/module_test.go +++ b/modules/equipment/module_test.go @@ -1,6 +1,7 @@ package equipment_test import ( + "context" "fmt" "go_dreamfactory/comm" "go_dreamfactory/lego" @@ -9,6 +10,9 @@ import ( "go_dreamfactory/lego/sys/log" "go_dreamfactory/modules/equipment" "go_dreamfactory/modules/hero" + "go_dreamfactory/modules/items" + "go_dreamfactory/modules/user" + "go_dreamfactory/pb" "go_dreamfactory/services" "go_dreamfactory/sys/cache" "go_dreamfactory/sys/configure" @@ -16,6 +20,8 @@ import ( "os" "testing" "time" + + "github.com/golang/protobuf/ptypes" ) func newService(ops ...rpcx.Option) core.IService { @@ -66,13 +72,32 @@ func TestMain(m *testing.M) { lego.Run(service, //运行模块 module, hero.NewModule(), + user.NewModule(), + items.NewModule(), ) }() time.Sleep(time.Second * 3) defer os.Exit(m.Run()) } -func Test_Module(t *testing.T) { +//测试协议 查询武器 +func Test_Modules_EquipmentGetListReq(t *testing.T) { + data, _ := ptypes.MarshalAny(&pb.EquipmentGetListReq{}) + reply := &pb.RPCMessageReply{} + s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "equipment", SubType: "getlist", Message: data}, reply) + log.Debugf("Test_Modules_Proro reply:%v", reply) +} + +//测试协议 武器升级 +func Test_Modules_EquipmentUpgradeReq(t *testing.T) { + data, _ := ptypes.MarshalAny(&pb.EquipmentUpgradeReq{EquipmentId: "62bd82860863ffbf2eb67f3a"}) + reply := &pb.RPCMessageReply{} + s_gateComp.ReceiveMsg(context.Background(), &pb.AgentMessage{UserId: "0_62b16dda909b2f8faeff788d", MainType: "equipment", SubType: "upgrade", Message: data}, reply) + log.Debugf("Test_Modules_Proro reply:%v", reply) +} + +//添加武器测试 +func Test_Module_AddNewEquipments(t *testing.T) { code := module.AddNewEquipments(&comm.ModuleCallSource{ Module: "Test", FuncName: "Test_Module", @@ -80,3 +105,13 @@ func Test_Module(t *testing.T) { }, "0_62b16dda909b2f8faeff788d", map[int32]uint32{10001: 1}) log.Debugf("Test_Module Code:%d", code) } + +//查询武器信息 +func Test_Module_QueryEquipment(t *testing.T) { + equipment, code := module.QueryEquipment(&comm.ModuleCallSource{ + Module: "Test", + FuncName: "Test_Module", + Describe: "摸底测试", + }, "0_62b16dda909b2f8faeff788d", "62bd82860863ffbf2eb67f3a") + log.Debugf("Test_Module equipment:%v code:%d", equipment, code) +} diff --git a/modules/modulebase.go b/modules/modulebase.go index 7662c0e43..5eaf6e347 100644 --- a/modules/modulebase.go +++ b/modules/modulebase.go @@ -89,15 +89,18 @@ func (this *ModuleBase) CheckConsumeRes(uid string, res []*cfg.Game_atn) (code p hero comm.IHero //英雄模块 // equipment comm.IEquipment //装备模块 ) - if module, err = this.service.GetModule(comm.ModuleUser); err == nil { + if module, err = this.service.GetModule(comm.ModuleUser); err != nil { + code = pb.ErrorCode_SystemError return } user = module.(comm.IUser) - if module, err = this.service.GetModule(comm.ModuleItems); err == nil { + if module, err = this.service.GetModule(comm.ModuleItems); err != nil { + code = pb.ErrorCode_SystemError return } items = module.(comm.IItems) - if module, err = this.service.GetModule(comm.ModuleHero); err == nil { + if module, err = this.service.GetModule(comm.ModuleHero); err != nil { + code = pb.ErrorCode_SystemError return } hero = module.(comm.IHero) @@ -179,19 +182,23 @@ func (this *ModuleBase) DispenseRes(uid string, res []*cfg.Game_atn) (code pb.Er hero comm.IHero //英雄模块 equipment comm.IEquipment //装备模块 ) - if module, err = this.service.GetModule(comm.ModuleUser); err == nil { + if module, err = this.service.GetModule(comm.ModuleUser); err != nil { + code = pb.ErrorCode_SystemError return } user = module.(comm.IUser) - if module, err = this.service.GetModule(comm.ModuleItems); err == nil { + if module, err = this.service.GetModule(comm.ModuleItems); err != nil { + code = pb.ErrorCode_SystemError return } items = module.(comm.IItems) - if module, err = this.service.GetModule(comm.ModuleHero); err == nil { + if module, err = this.service.GetModule(comm.ModuleHero); err != nil { + code = pb.ErrorCode_SystemError return } hero = module.(comm.IHero) - if module, err = this.service.GetModule(comm.ModuleEquipment); err == nil { + if module, err = this.service.GetModule(comm.ModuleEquipment); err != nil { + code = pb.ErrorCode_SystemError return } equipment = module.(comm.IEquipment) diff --git a/pb/equipment_msg.pb.go b/pb/equipment_msg.pb.go index f5928e36e..c9c67a1a1 100644 --- a/pb/equipment_msg.pb.go +++ b/pb/equipment_msg.pb.go @@ -168,6 +168,8 @@ type EquipmentEquipResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + Equipments []*DB_Equipment `protobuf:"bytes,1,rep,name=Equipments,proto3" json:"Equipments"` //挂在装备列表 } func (x *EquipmentEquipResp) Reset() { @@ -202,6 +204,13 @@ func (*EquipmentEquipResp) Descriptor() ([]byte, []int) { return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{3} } +func (x *EquipmentEquipResp) GetEquipments() []*DB_Equipment { + if x != nil { + return x.Equipments + } + return nil +} + //装备升级 type EquipmentUpgradeReq struct { state protoimpl.MessageState @@ -255,6 +264,9 @@ type EquipmentUpgradeResp struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields + + IsSucc bool `protobuf:"varint,1,opt,name=IsSucc,proto3" json:"IsSucc"` + Equipment []*DB_Equipment `protobuf:"bytes,2,rep,name=Equipment,proto3" json:"Equipment"` //由于装备可以叠加 升级后会创建一个新的装备出来 所以可能影响两个装备 } func (x *EquipmentUpgradeResp) Reset() { @@ -289,6 +301,20 @@ func (*EquipmentUpgradeResp) Descriptor() ([]byte, []int) { return file_equipment_equipment_msg_proto_rawDescGZIP(), []int{5} } +func (x *EquipmentUpgradeResp) GetIsSucc() bool { + if x != nil { + return x.IsSucc + } + return false +} + +func (x *EquipmentUpgradeResp) GetEquipment() []*DB_Equipment { + if x != nil { + return x.Equipment + } + return nil +} + var File_equipment_equipment_msg_proto protoreflect.FileDescriptor var file_equipment_equipment_msg_proto_rawDesc = []byte{ @@ -307,14 +333,21 @@ var file_equipment_equipment_msg_proto_rawDesc = []byte{ 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x61, 0x72, 0x64, 0x49, 0x64, 0x12, 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, - 0x49, 0x64, 0x22, 0x14, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x45, - 0x71, 0x75, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x22, 0x37, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, - 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, - 0x20, 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, - 0x64, 0x22, 0x16, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, - 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, - 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x49, 0x64, 0x22, 0x43, 0x0a, 0x12, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x45, + 0x71, 0x75, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x12, 0x2d, 0x0a, 0x0a, 0x45, 0x71, 0x75, 0x69, + 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, + 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x0a, 0x45, 0x71, 0x75, + 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x73, 0x22, 0x37, 0x0a, 0x13, 0x45, 0x71, 0x75, 0x69, 0x70, + 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x71, 0x12, 0x20, + 0x0a, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0b, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x49, 0x64, + 0x22, 0x5b, 0x0a, 0x14, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x55, 0x70, 0x67, + 0x72, 0x61, 0x64, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x49, 0x73, 0x53, 0x75, + 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x49, 0x73, 0x53, 0x75, 0x63, 0x63, + 0x12, 0x2b, 0x0a, 0x09, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x44, 0x42, 0x5f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, + 0x6e, 0x74, 0x52, 0x09, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x42, 0x06, 0x5a, + 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -341,11 +374,13 @@ var file_equipment_equipment_msg_proto_goTypes = []interface{}{ } var file_equipment_equipment_msg_proto_depIdxs = []int32{ 6, // 0: EquipmentGetListResp.Equipments:type_name -> DB_Equipment - 1, // [1:1] is the sub-list for method output_type - 1, // [1:1] is the sub-list for method input_type - 1, // [1:1] is the sub-list for extension type_name - 1, // [1:1] is the sub-list for extension extendee - 0, // [0:1] is the sub-list for field type_name + 6, // 1: EquipmentEquipResp.Equipments:type_name -> DB_Equipment + 6, // 2: EquipmentUpgradeResp.Equipment:type_name -> DB_Equipment + 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 } func init() { file_equipment_equipment_msg_proto_init() } diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index ff03bec56..59af13af8 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -1275,87 +1275,85 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x65, 0x72, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x29, 0x0a, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x52, 0x61, 0x63, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x10, 0x2e, 0x70, 0x62, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61, - 0x74, 0x61, 0x52, 0x08, 0x68, 0x65, 0x72, 0x6f, 0x52, 0x61, 0x63, 0x65, 0x22, 0x3a, 0x0a, 0x18, - 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, - 0x53, 0x74, 0x61, 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, - 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x5a, 0x0a, 0x18, 0x48, 0x65, 0x72, 0x6f, - 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, - 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, - 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, - 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, 0x63, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x4f, 0x62, - 0x6a, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, - 0x64, 0x4f, 0x62, 0x6a, 0x22, 0x3b, 0x0a, 0x19, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x72, 0x65, - 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x73, - 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, - 0x6f, 0x22, 0x66, 0x0a, 0x10, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, - 0x63, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, - 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, - 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x49, 0x44, - 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, 0x6f, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x49, - 0x44, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x05, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x77, 0x0a, 0x11, 0x48, 0x65, 0x72, - 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, - 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, - 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x12, 0x16, - 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, - 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x2a, 0x0a, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, - 0x43, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, - 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, - 0x72, 0x64, 0x22, 0x35, 0x0a, 0x15, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, - 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, - 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, - 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x50, 0x0a, 0x16, 0x48, 0x65, 0x72, - 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, - 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, - 0x65, 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x22, 0x71, 0x0a, 0x19, 0x48, - 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x45, - 0x6e, 0x65, 0x72, 0x67, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, + 0x32, 0x0d, 0x2e, 0x43, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x44, 0x61, 0x74, 0x61, 0x52, + 0x08, 0x68, 0x65, 0x72, 0x6f, 0x52, 0x61, 0x63, 0x65, 0x22, 0x37, 0x0a, 0x18, 0x48, 0x65, 0x72, + 0x6f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x74, 0x61, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, + 0x72, 0x6f, 0x22, 0x5a, 0x0a, 0x18, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, + 0x74, 0x68, 0x65, 0x6e, 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x71, 0x12, 0x1c, + 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x20, 0x0a, 0x0b, + 0x63, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x4f, 0x62, 0x6a, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x73, 0x74, 0x43, 0x61, 0x72, 0x64, 0x4f, 0x62, 0x6a, 0x22, 0x38, + 0x0a, 0x19, 0x48, 0x65, 0x72, 0x6f, 0x53, 0x74, 0x72, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x65, 0x6e, + 0x55, 0x70, 0x53, 0x6b, 0x69, 0x6c, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, + 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, + 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x66, 0x0a, 0x10, 0x48, 0x65, 0x72, 0x6f, + 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, + 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x6f, + 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x63, + 0x6f, 0x73, 0x74, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x22, 0x71, 0x0a, 0x11, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, + 0x65, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, + 0x72, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x12, 0x27, 0x0a, 0x0a, 0x75, 0x70, + 0x53, 0x74, 0x61, 0x72, 0x43, 0x61, 0x72, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, + 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x0a, 0x75, 0x70, 0x53, 0x74, 0x61, 0x72, 0x43, + 0x61, 0x72, 0x64, 0x22, 0x35, 0x0a, 0x15, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, + 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, + 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x4d, 0x0a, 0x16, 0x48, 0x65, + 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x52, 0x65, 0x73, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, + 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x06, 0x65, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x22, 0x71, 0x0a, 0x19, 0x48, 0x65, 0x72, + 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, 0x45, 0x6e, 0x65, + 0x72, 0x67, 0x79, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, + 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, + 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, + 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, + 0x67, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x39, 0x0a, 0x1a, + 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x55, 0x73, 0x65, + 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, + 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, + 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x2d, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x41, + 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x68, 0x65, 0x72, - 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x12, 0x1c, 0x0a, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, 0x65, - 0x72, 0x67, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x75, 0x73, 0x65, 0x45, 0x6e, - 0x65, 0x72, 0x67, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, - 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x75, 0x73, 0x65, 0x54, 0x79, 0x70, 0x65, 0x22, 0x3c, - 0x0a, 0x1a, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x65, 0x73, 0x6f, 0x6e, 0x61, 0x6e, 0x63, 0x65, 0x55, - 0x73, 0x65, 0x45, 0x6e, 0x65, 0x72, 0x67, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, 0x04, - 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, - 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x2d, 0x0a, 0x0d, - 0x48, 0x65, 0x72, 0x6f, 0x41, 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x12, 0x1c, 0x0a, - 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x09, 0x68, 0x65, 0x72, 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x30, 0x0a, 0x0e, 0x48, - 0x65, 0x72, 0x6f, 0x41, 0x77, 0x61, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1e, 0x0a, - 0x04, 0x68, 0x65, 0x72, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, - 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x29, 0x0a, - 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x12, 0x18, - 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, - 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, 0x22, 0x34, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, - 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, 0x73, 0x70, 0x12, 0x22, 0x0a, 0x06, 0x68, 0x65, - 0x72, 0x6f, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0a, 0x2e, 0x70, 0x62, 0x2e, - 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x22, 0xa4, - 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, - 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x3a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x70, 0x62, 0x2e, 0x48, - 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x70, 0x65, - 0x72, 0x74, 0x79, 0x12, 0x43, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, - 0x74, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x70, 0x62, 0x2e, 0x48, 0x65, - 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, - 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x64, - 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 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, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, - 0x65, 0x72, 0x74, 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, + 0x6f, 0x4f, 0x62, 0x6a, 0x49, 0x44, 0x22, 0x2d, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x41, 0x77, + 0x61, 0x6b, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1b, 0x0a, 0x04, 0x68, 0x65, 0x72, 0x6f, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, + 0x04, 0x68, 0x65, 0x72, 0x6f, 0x22, 0x29, 0x0a, 0x0d, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, + 0x75, 0x6b, 0x61, 0x52, 0x65, 0x71, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, + 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x05, 0x52, 0x07, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x73, + 0x22, 0x31, 0x0a, 0x0e, 0x48, 0x65, 0x72, 0x6f, 0x43, 0x68, 0x6f, 0x75, 0x6b, 0x61, 0x52, 0x65, + 0x73, 0x70, 0x12, 0x1f, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x48, 0x65, 0x72, 0x6f, 0x52, 0x06, 0x68, 0x65, 0x72, + 0x6f, 0x65, 0x73, 0x22, 0x9e, 0x02, 0x0a, 0x0c, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, + 0x65, 0x72, 0x74, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x68, 0x65, 0x72, 0x6f, 0x49, 0x64, 0x12, 0x37, 0x0a, 0x08, + 0x70, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, + 0x2e, 0x48, 0x65, 0x72, 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x50, 0x72, + 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x08, 0x70, 0x72, 0x6f, + 0x70, 0x65, 0x72, 0x74, 0x79, 0x12, 0x40, 0x0a, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, + 0x65, 0x72, 0x74, 0x79, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x48, 0x65, 0x72, + 0x6f, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x2e, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, + 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x50, + 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 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, 0x1a, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, + 0x72, 0x74, 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, } var ( @@ -1372,49 +1370,49 @@ func file_hero_hero_msg_proto_rawDescGZIP() []byte { var file_hero_hero_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 25) var file_hero_hero_msg_proto_goTypes = []interface{}{ - (*HeroInfoReq)(nil), // 0: pb.HeroInfoReq - (*HeroInfoRsp)(nil), // 1: pb.HeroInfoRsp - (*HeroListReq)(nil), // 2: pb.HeroListReq - (*HeroListRsp)(nil), // 3: pb.HeroListRsp - (*ItemData)(nil), // 4: pb.ItemData - (*HeroStrengthenUplvReq)(nil), // 5: pb.HeroStrengthenUplvReq - (*HeroStrengthenUplvResp)(nil), // 6: pb.HeroStrengthenUplvResp - (*CostCardData)(nil), // 7: pb.CostCardData - (*HeroStrengthenUpStarReq)(nil), // 8: pb.HeroStrengthenUpStarReq - (*HeroStrengthenUpStarResp)(nil), // 9: pb.HeroStrengthenUpStarResp - (*HeroStrengthenUpSkillReq)(nil), // 10: pb.HeroStrengthenUpSkillReq - (*HeroStrengthenUpSkillResp)(nil), // 11: pb.HeroStrengthenUpSkillResp - (*HeroResonanceReq)(nil), // 12: pb.HeroResonanceReq - (*HeroResonanceResp)(nil), // 13: pb.HeroResonanceResp - (*HeroResonanceResetReq)(nil), // 14: pb.HeroResonanceResetReq - (*HeroResonanceResetResp)(nil), // 15: pb.HeroResonanceResetResp - (*HeroResonanceUseEnergyReq)(nil), // 16: pb.HeroResonanceUseEnergyReq - (*HeroResonanceUseEnergyResp)(nil), // 17: pb.HeroResonanceUseEnergyResp - (*HeroAwakenReq)(nil), // 18: pb.HeroAwakenReq - (*HeroAwakenResp)(nil), // 19: pb.HeroAwakenResp - (*HeroChoukaReq)(nil), // 20: pb.HeroChoukaReq - (*HeroChoukaResp)(nil), // 21: pb.HeroChoukaResp - (*HeroProperty)(nil), // 22: pb.HeroProperty - nil, // 23: pb.HeroProperty.PropertyEntry - nil, // 24: pb.HeroProperty.AddPropertyEntry - (*DBHero)(nil), // 25: pb.DBHero + (*HeroInfoReq)(nil), // 0: HeroInfoReq + (*HeroInfoRsp)(nil), // 1: HeroInfoRsp + (*HeroListReq)(nil), // 2: HeroListReq + (*HeroListRsp)(nil), // 3: HeroListRsp + (*ItemData)(nil), // 4: ItemData + (*HeroStrengthenUplvReq)(nil), // 5: HeroStrengthenUplvReq + (*HeroStrengthenUplvResp)(nil), // 6: HeroStrengthenUplvResp + (*CostCardData)(nil), // 7: CostCardData + (*HeroStrengthenUpStarReq)(nil), // 8: HeroStrengthenUpStarReq + (*HeroStrengthenUpStarResp)(nil), // 9: HeroStrengthenUpStarResp + (*HeroStrengthenUpSkillReq)(nil), // 10: HeroStrengthenUpSkillReq + (*HeroStrengthenUpSkillResp)(nil), // 11: HeroStrengthenUpSkillResp + (*HeroResonanceReq)(nil), // 12: HeroResonanceReq + (*HeroResonanceResp)(nil), // 13: HeroResonanceResp + (*HeroResonanceResetReq)(nil), // 14: HeroResonanceResetReq + (*HeroResonanceResetResp)(nil), // 15: HeroResonanceResetResp + (*HeroResonanceUseEnergyReq)(nil), // 16: HeroResonanceUseEnergyReq + (*HeroResonanceUseEnergyResp)(nil), // 17: HeroResonanceUseEnergyResp + (*HeroAwakenReq)(nil), // 18: HeroAwakenReq + (*HeroAwakenResp)(nil), // 19: HeroAwakenResp + (*HeroChoukaReq)(nil), // 20: HeroChoukaReq + (*HeroChoukaResp)(nil), // 21: HeroChoukaResp + (*HeroProperty)(nil), // 22: HeroProperty + nil, // 23: HeroProperty.PropertyEntry + nil, // 24: HeroProperty.AddPropertyEntry + (*DBHero)(nil), // 25: DBHero } var file_hero_hero_msg_proto_depIdxs = []int32{ - 25, // 0: pb.HeroInfoRsp.base:type_name -> pb.DBHero - 25, // 1: pb.HeroListRsp.list:type_name -> pb.DBHero - 25, // 2: pb.HeroStrengthenUplvResp.hero:type_name -> pb.DBHero - 7, // 3: pb.HeroStrengthenUpStarReq.hero:type_name -> pb.CostCardData - 7, // 4: pb.HeroStrengthenUpStarReq.heroRace:type_name -> pb.CostCardData - 25, // 5: pb.HeroStrengthenUpStarResp.hero:type_name -> pb.DBHero - 25, // 6: pb.HeroStrengthenUpSkillResp.hero:type_name -> pb.DBHero - 25, // 7: pb.HeroResonanceResp.hero:type_name -> pb.DBHero - 25, // 8: pb.HeroResonanceResp.upStarCard:type_name -> pb.DBHero - 25, // 9: pb.HeroResonanceResetResp.hero:type_name -> pb.DBHero - 25, // 10: pb.HeroResonanceUseEnergyResp.hero:type_name -> pb.DBHero - 25, // 11: pb.HeroAwakenResp.hero:type_name -> pb.DBHero - 25, // 12: pb.HeroChoukaResp.heroes:type_name -> pb.DBHero - 23, // 13: pb.HeroProperty.property:type_name -> pb.HeroProperty.PropertyEntry - 24, // 14: pb.HeroProperty.addProperty:type_name -> pb.HeroProperty.AddPropertyEntry + 25, // 0: HeroInfoRsp.base:type_name -> DBHero + 25, // 1: HeroListRsp.list:type_name -> DBHero + 25, // 2: HeroStrengthenUplvResp.hero:type_name -> DBHero + 7, // 3: HeroStrengthenUpStarReq.hero:type_name -> CostCardData + 7, // 4: HeroStrengthenUpStarReq.heroRace:type_name -> CostCardData + 25, // 5: HeroStrengthenUpStarResp.hero:type_name -> DBHero + 25, // 6: HeroStrengthenUpSkillResp.hero:type_name -> DBHero + 25, // 7: HeroResonanceResp.hero:type_name -> DBHero + 25, // 8: HeroResonanceResp.upStarCard:type_name -> DBHero + 25, // 9: HeroResonanceResetResp.hero:type_name -> DBHero + 25, // 10: HeroResonanceUseEnergyResp.hero:type_name -> DBHero + 25, // 11: HeroAwakenResp.hero:type_name -> DBHero + 25, // 12: HeroChoukaResp.heroes:type_name -> DBHero + 23, // 13: HeroProperty.property:type_name -> HeroProperty.PropertyEntry + 24, // 14: HeroProperty.addProperty:type_name -> HeroProperty.AddPropertyEntry 15, // [15:15] is the sub-list for method output_type 15, // [15:15] is the sub-list for method input_type 15, // [15:15] is the sub-list for extension type_name diff --git a/pb/proto/equipment/equipment_msg.proto b/pb/proto/equipment/equipment_msg.proto index b37d4d68a..22587d42f 100644 --- a/pb/proto/equipment/equipment_msg.proto +++ b/pb/proto/equipment/equipment_msg.proto @@ -19,7 +19,7 @@ message EquipmentEquipReq{ //装备挂在到英雄上 回应 message EquipmentEquipResp{ - + repeated DB_Equipment Equipments = 1; //挂在装备列表 } //装备升级 @@ -29,5 +29,6 @@ message EquipmentUpgradeReq{ //装备升级 回应 message EquipmentUpgradeResp{ - + bool IsSucc = 1; + repeated DB_Equipment Equipment = 2; //由于装备可以叠加 升级后会创建一个新的装备出来 所以可能影响两个装备 } \ No newline at end of file diff --git a/services/worker/main.go b/services/worker/main.go index 7807b3169..3afb7c4b9 100644 --- a/services/worker/main.go +++ b/services/worker/main.go @@ -3,6 +3,7 @@ package main import ( "flag" "fmt" + "go_dreamfactory/modules/equipment" "go_dreamfactory/modules/friend" "go_dreamfactory/modules/hero" "go_dreamfactory/modules/items" @@ -42,8 +43,8 @@ func main() { mail.NewModule(), friend.NewModule(), hero.NewModule(), + equipment.NewModule(), ) - } func NewService(ops ...rpcx.Option) core.IService { From 318198e924d74f930d447f3d4bf847b15536a094 Mon Sep 17 00:00:00 2001 From: zhaocy Date: Thu, 30 Jun 2022 20:15:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E7=B4=AF=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- comm/const.go | 6 ++-- modules/hero/api_resonance.go | 2 +- modules/hero/api_resonanceReset.go | 2 +- modules/hero/api_resonanceSelect.go | 2 +- modules/hero/api_skillUp.go | 2 +- modules/hero/api_starUp.go | 2 +- modules/hero/hero_test.go | 2 +- modules/hero/model_hero.go | 44 ++++++++++++----------- modules/hero/module.go | 3 +- modules/user/module.go | 4 ++- pb/hero_db.pb.go | 56 ++++++++++++++--------------- pb/hero_msg.pb.go | 14 ++++---- pb/proto/hero/hero_db.proto | 4 +-- pb/proto/hero/hero_msg.proto | 8 ++--- 14 files changed, 78 insertions(+), 73 deletions(-) diff --git a/comm/const.go b/comm/const.go index 19d5df06e..c98c242db 100644 --- a/comm/const.go +++ b/comm/const.go @@ -65,9 +65,9 @@ const ( ) const ( - PropertyHp int32 = 1 //生命 - PropertyAtk int32 = 2 //攻击 - PropertyDef int32 = 3 //防御 + PropertyHp string = "hp" //生命 + PropertyAtk string = "atk" //攻击 + PropertyDef string = "def" //防御 ) const ( diff --git a/modules/hero/api_resonance.go b/modules/hero/api_resonance.go index 5ee8af76e..5bee9151d 100644 --- a/modules/hero/api_resonance.go +++ b/modules/hero/api_resonance.go @@ -118,7 +118,7 @@ func (this *apiComp) Resonance(session comm.IUserSession, agrs map[string]interf _heroMap := map[string]interface{}{ "resonateNum": _hero.ResonateNum + resonConfig.Energy, } - err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 + err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 if err != nil { log.Errorf("update hero skill failed:%v", err) } diff --git a/modules/hero/api_resonanceReset.go b/modules/hero/api_resonanceReset.go index 70616061c..bd96a6403 100644 --- a/modules/hero/api_resonanceReset.go +++ b/modules/hero/api_resonanceReset.go @@ -84,7 +84,7 @@ func (this *apiComp) ResonanceReset(session comm.IUserSession, agrs map[string]i "Energy": _hero.Energy, } - err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 + err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 if err != nil { log.Errorf("update hero skill failed:%v", err) } diff --git a/modules/hero/api_resonanceSelect.go b/modules/hero/api_resonanceSelect.go index 1cd398f4e..1b35de107 100644 --- a/modules/hero/api_resonanceSelect.go +++ b/modules/hero/api_resonanceSelect.go @@ -47,7 +47,7 @@ func (this *apiComp) ResonanceUseEnergy(session comm.IUserSession, agrs map[stri "Energy": _hero.Energy, } - err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 + err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 if err != nil { code = pb.ErrorCode_DBError log.Errorf("update hero skill failed:%v", err) diff --git a/modules/hero/api_skillUp.go b/modules/hero/api_skillUp.go index f3349e347..43bf09424 100644 --- a/modules/hero/api_skillUp.go +++ b/modules/hero/api_skillUp.go @@ -129,7 +129,7 @@ func (this *apiComp) StrengthenUpSkill(session comm.IUserSession, agrs map[strin _heroMap := map[string]interface{}{ "normalSkill": _hero.NormalSkill, } - err = this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 + err = this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) // 修改英雄信息 if err != nil { log.Errorf("update hero skill failed:%v", err) } diff --git a/modules/hero/api_starUp.go b/modules/hero/api_starUp.go index 94dcc3fd8..3a9e44b16 100644 --- a/modules/hero/api_starUp.go +++ b/modules/hero/api_starUp.go @@ -148,7 +148,7 @@ func (this *apiComp) StrengthenUpStar(session comm.IUserSession, agrs map[string "star": _hero.Star, } // 保存数据 - err := this.moduleHero.modelHero.modifyHero(session.GetUserId(), req.HeroObjID, _heroMap) + err := this.moduleHero.modelHero.modifyHeroData(session.GetUserId(), req.HeroObjID, _heroMap) if err != nil { code = pb.ErrorCode_DBError log.Errorf("update hero skill failed:%v", err) diff --git a/modules/hero/hero_test.go b/modules/hero/hero_test.go index 730fc0d2a..6f2f760a1 100644 --- a/modules/hero/hero_test.go +++ b/modules/hero/hero_test.go @@ -95,6 +95,6 @@ func TestModify(t *testing.T) { "lv": 2, "exp": 1000, } - err := module.modelHero.modifyHero("u1", "62b534bebf4745d4117acabe", data) + err := module.modelHero.modifyHeroData("u1", "62b534bebf4745d4117acabe", data) fmt.Printf("%v ", err) } diff --git a/modules/hero/model_hero.go b/modules/hero/model_hero.go index b78464f11..150bf7a6b 100644 --- a/modules/hero/model_hero.go +++ b/modules/hero/model_hero.go @@ -46,9 +46,9 @@ func (this *ModelHero) initHero(uid string, heroCfgId int32) *pb.DBHero { Skins: []int32{}, EquipID: make([]string, 6), //初始装备 SameCount: 1, //默认叠加数量 - AddProperty: make(map[int32]int32), + AddProperty: make(map[string]int32), Energy: make(map[int32]int32), - Property: make(map[int32]int32), + Property: make(map[string]int32), } return newHero } @@ -94,7 +94,7 @@ func (this *ModelHero) createMultiHero(uid string, heroCfgIds ...int32) error { data := map[string]interface{}{ "sameCount": h.SameCount, //叠加数 } - if err := this.modifyHero(uid, h.Id, data); err != nil { + if err := this.modifyHeroData(uid, h.Id, data); err != nil { return err } } else { @@ -130,7 +130,7 @@ func (this *ModelHero) consumeOneHeroCard(uid, heroId string, count int32) (err } //更新英雄数据 -func (this *ModelHero) modifyHero(uid, heroId string, data map[string]interface{}) error { +func (this *ModelHero) modifyHeroData(uid, heroId string, data map[string]interface{}) error { return this.moduleHero.modelHero.ChangeList(uid, heroId, data) } @@ -155,25 +155,21 @@ func (this *ModelHero) setEquipment(uid, heroId string, equipIds []string) pb.Er return pb.ErrorCode_Success } -//指定英雄升级 -func (this *ModelHero) levelUp(uid string, heroId int32) error { - var heroes []*pb.DBHero - err := this.moduleHero.modelHero.GetList(uid, heroes) - if err != nil { - log.Errorf("levelUp err:%v", err) - return err +//合并属性即属性值累加 +func (this *ModelHero) mergeProperty(uid, heroId string, data map[string]int32) { + hero := this.getOneHero(uid, heroId) + if hero == nil { + return } - return nil -} - -//升星 -func (this *ModelHero) starUp() { + hero.Property[comm.PropertyHp] += data[comm.PropertyHp] + hero.Property[comm.PropertyAtk] += data[comm.PropertyAtk] + hero.Property[comm.PropertyDef] += data[comm.PropertyDef] } //属性计算 - 暂时放在modelHero里实现 //英雄基础属性 + 英雄等级基础属性 * 英雄成长系数 + 英雄星级对应等级属性 * 英雄品质系数 -func (this *ModelHero) PropertyCompute(uid, heroId string) map[int32]int32 { +func (this *ModelHero) PropertyCompute(uid, heroId string) map[string]int32 { hero := this.getOneHero(uid, heroId) if hero == nil { return nil @@ -209,16 +205,22 @@ func (this *ModelHero) PropertyCompute(uid, heroId string) map[int32]int32 { return nil } - exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v", lvGrow.Hp, heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp) + curHp := hero.Property[comm.PropertyHp] + exprHp := fmt.Sprintf("%v + %v * %v/1000 + %v * %v", + (curHp + lvGrow.Hp), heroLvCfg.Hp, lvGrow.Hpgrow, heroStarCfg.Hp, stargrowCfg.StarupHp) hp, _ := mengine.ParseAndExec(exprHp) - exprAtk := fmt.Sprintf("%v +%v * %v/1000 + %v * %v", lvGrow.Atk, heroLvCfg.Atk, lvGrow.Atkgrow, heroStarCfg.Atk, stargrowCfg.StarupAtk) + curAtk := hero.Property[comm.PropertyAtk] + exprAtk := fmt.Sprintf("%v +%v * %v/1000 + %v * %v", + (curAtk + lvGrow.Atk), heroLvCfg.Atk, lvGrow.Atkgrow, heroStarCfg.Atk, stargrowCfg.StarupAtk) atk, _ := mengine.ParseAndExec(exprAtk) - exprDef := fmt.Sprintf("%v +%v * %v/1000 + %v * %v", lvGrow.Def, heroLvCfg.Def, lvGrow.Defgrow, heroStarCfg.Def, stargrowCfg.StarupDef) + curDef := hero.Property[comm.PropertyDef] + exprDef := fmt.Sprintf("%v +%v * %v/1000 + %v * %v", + (curDef + lvGrow.Def), heroLvCfg.Def, lvGrow.Defgrow, heroStarCfg.Def, stargrowCfg.StarupDef) def, _ := mengine.ParseAndExec(exprDef) - return map[int32]int32{ + return map[string]int32{ comm.PropertyHp: int32(math.Floor(hp)), comm.PropertyAtk: int32(math.Floor(atk)), comm.PropertyDef: int32(math.Floor(def)), diff --git a/modules/hero/module.go b/modules/hero/module.go index b0650a012..e51cf5afb 100644 --- a/modules/hero/module.go +++ b/modules/hero/module.go @@ -82,6 +82,7 @@ func (this *Hero) UpdateEquipment(hero *pb.DBHero, equip []*pb.DB_Equipment) (co for _, v := range equip { equipIds = append(equipIds, v.Id) } + return this.modelHero.setEquipment(hero.Uid, hero.Id, equipIds) } @@ -155,7 +156,7 @@ func (this *Hero) AddCardExp(uid string, heroId string, exp int32) (code pb.Erro "exp": curExp, } - if err := this.modelHero.modifyHero(uid, heroId, update); err != nil { + if err := this.modelHero.modifyHeroData(uid, heroId, update); err != nil { code = pb.ErrorCode_DBError } // 修改英雄数据 } else { diff --git a/modules/user/module.go b/modules/user/module.go index eb61bf57e..03051fe63 100644 --- a/modules/user/module.go +++ b/modules/user/module.go @@ -47,12 +47,14 @@ func (this *User) GetHeroList(uid string) []*pb.DBHero { //查询用户属性值 例如 金币 经验 func (this *User) QueryAttributeValue(uid string, attr string) (value int32) { user := this.modelUser.getUser(uid) + if user == nil { + return + } switch attr { case comm.ResGold: return user.Gold case comm.ResExp: return user.Exp - } return } diff --git a/pb/hero_db.pb.go b/pb/hero_db.pb.go index 0ca3abe4b..1fa8bc268 100644 --- a/pb/hero_db.pb.go +++ b/pb/hero_db.pb.go @@ -80,30 +80,30 @@ type DBHero struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - 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" 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"` // @go_tags(`bson:"energy"`)能量分配到哪里 - SameCount int32 `protobuf:"varint,21,opt,name=sameCount,proto3" json:"sameCount" bson:"sameCount"` // 卡片叠加数量 - SuiteId int32 `protobuf:"varint,22,opt,name=suiteId,proto3" json:"suiteId" bson:"suiteId"` // 套装Id - SuiteExtId int32 `protobuf:"varint,23,opt,name=suiteExtId,proto3" json:"suiteExtId"` // go_tags(`bson:"suiteExtId"`) 扩展套装Id - IsOverlying bool `protobuf:"varint,24,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true + 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" 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[string]int32 `protobuf:"bytes,10,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` // 属性相关 + AddProperty map[string]int32 `protobuf:"bytes,11,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"bytes,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"` // @go_tags(`bson:"energy"`)能量分配到哪里 + SameCount int32 `protobuf:"varint,21,opt,name=sameCount,proto3" json:"sameCount" bson:"sameCount"` // 卡片叠加数量 + SuiteId int32 `protobuf:"varint,22,opt,name=suiteId,proto3" json:"suiteId" bson:"suiteId"` // 套装Id + SuiteExtId int32 `protobuf:"varint,23,opt,name=suiteExtId,proto3" json:"suiteExtId"` // go_tags(`bson:"suiteExtId"`) 扩展套装Id + IsOverlying bool `protobuf:"varint,24,opt,name=isOverlying,proto3" json:"isOverlying"` // go_tags(`bson:"isOverlying"`) 是否允许叠加 默认true } func (x *DBHero) Reset() { @@ -201,14 +201,14 @@ func (x *DBHero) GetNormalSkill() []*SkillData { return nil } -func (x *DBHero) GetProperty() map[int32]int32 { +func (x *DBHero) GetProperty() map[string]int32 { if x != nil { return x.Property } return nil } -func (x *DBHero) GetAddProperty() map[int32]int32 { +func (x *DBHero) GetAddProperty() map[string]int32 { if x != nil { return x.AddProperty } @@ -363,11 +363,11 @@ var file_hero_hero_db_proto_rawDesc = []byte{ 0x69, 0x6e, 0x67, 0x18, 0x18, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0b, 0x69, 0x73, 0x4f, 0x76, 0x65, 0x72, 0x6c, 0x79, 0x69, 0x6e, 0x67, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 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, + 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, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 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, + 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, 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, diff --git a/pb/hero_msg.pb.go b/pb/hero_msg.pb.go index 59af13af8..6b46ddbd2 100644 --- a/pb/hero_msg.pb.go +++ b/pb/hero_msg.pb.go @@ -1177,9 +1177,9 @@ type HeroProperty struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - HeroId string `protobuf:"bytes,1,opt,name=heroId,proto3" json:"heroId"` //英雄唯一ID - Property map[int32]int32 `protobuf:"bytes,2,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,3,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //附加属性 + HeroId string `protobuf:"bytes,1,opt,name=heroId,proto3" json:"heroId"` //英雄唯一ID + Property map[string]int32 `protobuf:"bytes,2,rep,name=property,proto3" json:"property" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //基础属性 + AddProperty map[string]int32 `protobuf:"bytes,3,rep,name=addProperty,proto3" json:"addProperty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` //附加属性 } func (x *HeroProperty) Reset() { @@ -1221,14 +1221,14 @@ func (x *HeroProperty) GetHeroId() string { return "" } -func (x *HeroProperty) GetProperty() map[int32]int32 { +func (x *HeroProperty) GetProperty() map[string]int32 { if x != nil { return x.Property } return nil } -func (x *HeroProperty) GetAddProperty() map[int32]int32 { +func (x *HeroProperty) GetAddProperty() map[string]int32 { if x != nil { return x.AddProperty } @@ -1346,11 +1346,11 @@ var file_hero_hero_msg_proto_rawDesc = []byte{ 0x70, 0x65, 0x72, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x52, 0x0b, 0x61, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x1a, 0x3b, 0x0a, 0x0d, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 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, + 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, 0x3e, 0x0a, 0x10, 0x41, 0x64, 0x64, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 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, + 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, diff --git a/pb/proto/hero/hero_db.proto b/pb/proto/hero/hero_db.proto index 96765bc89..ff12059dd 100644 --- a/pb/proto/hero/hero_db.proto +++ b/pb/proto/hero/hero_db.proto @@ -16,8 +16,8 @@ message DBHero { 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 = + map property = 10; // 属性相关 + map addProperty = 11; //@go_tags(`bson:"addProperty"`) 附加属性相关 int32 formation = 12; // 阵型类型 int32 cardType = diff --git a/pb/proto/hero/hero_msg.proto b/pb/proto/hero/hero_msg.proto index be963e6ee..693ec100d 100644 --- a/pb/proto/hero/hero_msg.proto +++ b/pb/proto/hero/hero_msg.proto @@ -97,7 +97,7 @@ message HeroResonanceUseEnergyResp { // 觉醒 message HeroAwakenReq { - string heroObjID = 1; // 英雄对象ID + string heroObjID = 1; // 英雄对象ID } // 觉醒返回 @@ -112,7 +112,7 @@ message HeroChoukaResp { repeated DBHero heroes = 1; } //英雄属性推送 message HeroProperty { - string heroId = 1; //英雄唯一ID - map property = 2; //基础属性 - map addProperty = 3; //附加属性 + string heroId = 1; //英雄唯一ID + map property = 2; //基础属性 + map addProperty = 3; //附加属性 } \ No newline at end of file