Commit 51d48d119340593ff8a9d67e1fcdab04ba540f68
1 parent
84316161
fix: 删除装备 删除物品请求
Showing
5 changed files
with
175 additions
and
90 deletions
Show diff stats
cmd/gameserver/action/GmAction.go
| 1 | package action | 1 | package action |
| 2 | 2 | ||
| 3 | import ( | 3 | import ( |
| 4 | - "github.com/golang/protobuf/proto" | ||
| 5 | - "pro2d/common/db/mongoproxy" | ||
| 6 | "pro2d/common/logger" | 4 | "pro2d/common/logger" |
| 7 | "pro2d/models" | 5 | "pro2d/models" |
| 8 | "pro2d/pb" | 6 | "pro2d/pb" |
| @@ -31,32 +29,3 @@ func (gm *GmAction) AddEquip(role *models.RoleModel, params ...interface{}) { | @@ -31,32 +29,3 @@ func (gm *GmAction) AddEquip(role *models.RoleModel, params ...interface{}) { | ||
| 31 | } | 29 | } |
| 32 | role.AddEquip(equip) | 30 | role.AddEquip(equip) |
| 33 | } | 31 | } |
| 34 | - | ||
| 35 | -func (gm *GmAction) DelEquip(role *models.RoleModel, params ...interface{}) { | ||
| 36 | - logger.Debug(params) | ||
| 37 | - id := params[0].(string) | ||
| 38 | - if err := mongoproxy.DelOne("equip", "id", id); err != nil { | ||
| 39 | - logger.Error(err.Error()) | ||
| 40 | - return | ||
| 41 | - } | ||
| 42 | - delete(role.Equipments, id) | ||
| 43 | - update := &pb.EquipmentDelRsp{Id: id} | ||
| 44 | - if rsp, err := proto.Marshal(update); err != nil { | ||
| 45 | - logger.Error(" err:", err.Error()) | ||
| 46 | - return | ||
| 47 | - } else { | ||
| 48 | - if role.GetConn() != nil { | ||
| 49 | - role.GetConn().SendSuccess(uint32(pb.ProtoCode_EquipmentDelRsp), rsp) | ||
| 50 | - } | ||
| 51 | - } | ||
| 52 | -} | ||
| 53 | - | ||
| 54 | -func (gm *GmAction) DelItem(role *models.RoleModel, params ...interface{}) { | ||
| 55 | - logger.Debug(params) | ||
| 56 | - id := params[0].(string) | ||
| 57 | - count := params[1].(int32) | ||
| 58 | - | ||
| 59 | - if !role.CostItem(id, count) { | ||
| 60 | - logger.Error("item cost error: ", id) | ||
| 61 | - } | ||
| 62 | -} |
cmd/gameserver/action/RoleAction.go
| @@ -5,6 +5,7 @@ import ( | @@ -5,6 +5,7 @@ import ( | ||
| 5 | "github.com/golang/protobuf/proto" | 5 | "github.com/golang/protobuf/proto" |
| 6 | "pro2d/common" | 6 | "pro2d/common" |
| 7 | "pro2d/common/components" | 7 | "pro2d/common/components" |
| 8 | + "pro2d/common/db/mongoproxy" | ||
| 8 | "pro2d/common/db/redisproxy" | 9 | "pro2d/common/db/redisproxy" |
| 9 | "pro2d/common/logger" | 10 | "pro2d/common/logger" |
| 10 | "pro2d/models" | 11 | "pro2d/models" |
| @@ -148,3 +149,41 @@ func HeroEquipReferRpc(agent components.IAgent, msg components.IMessage) (int32, | @@ -148,3 +149,41 @@ func HeroEquipReferRpc(agent components.IAgent, msg components.IMessage) (int32, | ||
| 148 | } | 149 | } |
| 149 | return 0, nil | 150 | return 0, nil |
| 150 | } | 151 | } |
| 152 | + | ||
| 153 | +func RoleClearItemsRpc(agent components.IAgent, msg components.IMessage) (int32, interface{}) { | ||
| 154 | + req := pb.RoleClearItemsReq{} | ||
| 155 | + if err := proto.Unmarshal(msg.GetData(), &req); err != nil { | ||
| 156 | + logger.Error("loginRpc err: %v", err) | ||
| 157 | + return 1, nil | ||
| 158 | + } | ||
| 159 | + role := agent.GetSchema().(*models.RoleModel) | ||
| 160 | + if role == nil { | ||
| 161 | + return 2, nil | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + if !role.CostItem(req.Id, req.Count) { | ||
| 165 | + logger.Error("cost err: %s, %d", req.Id, req.Count) | ||
| 166 | + return 3, nil | ||
| 167 | + } | ||
| 168 | + return 0, nil | ||
| 169 | +} | ||
| 170 | + | ||
| 171 | +func EquipmentDelRpc(agent components.IAgent, msg components.IMessage) (int32, interface{}) { | ||
| 172 | + req := pb.EquipmentDelReq{} | ||
| 173 | + if err := proto.Unmarshal(msg.GetData(), &req); err != nil { | ||
| 174 | + logger.Error("loginRpc err: %v", err) | ||
| 175 | + return 1, nil | ||
| 176 | + } | ||
| 177 | + role := agent.GetSchema().(*models.RoleModel) | ||
| 178 | + if role == nil { | ||
| 179 | + return 2, nil | ||
| 180 | + } | ||
| 181 | + | ||
| 182 | + if err := mongoproxy.DelOne("equip", "id", req.Id); err != nil { | ||
| 183 | + logger.Error(err.Error()) | ||
| 184 | + return 3, nil | ||
| 185 | + } | ||
| 186 | + delete(role.Equipments, req.Id) | ||
| 187 | + | ||
| 188 | + return 0, nil | ||
| 189 | +} |
cmd/gameserver/action/protocode.go
| @@ -13,6 +13,8 @@ func GetActionMap() map[interface{}]interface{} { | @@ -13,6 +13,8 @@ func GetActionMap() map[interface{}]interface{} { | ||
| 13 | am[uint32(pb.ProtoCode_CreateReq)] = CreateRpc | 13 | am[uint32(pb.ProtoCode_CreateReq)] = CreateRpc |
| 14 | am[uint32(pb.ProtoCode_ChangeTeamReq)] = ChangeTeamRpc | 14 | am[uint32(pb.ProtoCode_ChangeTeamReq)] = ChangeTeamRpc |
| 15 | am[uint32(pb.ProtoCode_HeroEquipReferReq)] = HeroEquipReferRpc | 15 | am[uint32(pb.ProtoCode_HeroEquipReferReq)] = HeroEquipReferRpc |
| 16 | + am[uint32(pb.ProtoCode_RoleClearItemsReq)] = RoleClearItemsRpc | ||
| 17 | + am[uint32(pb.ProtoCode_EquipmentDelReq)] = EquipmentDelRpc | ||
| 16 | 18 | ||
| 17 | return am | 19 | return am |
| 18 | } | 20 | } |
pb/game.pb.go
| @@ -514,17 +514,17 @@ func (x *RoleUpdateItemsRsp) GetItems() string { | @@ -514,17 +514,17 @@ func (x *RoleUpdateItemsRsp) GetItems() string { | ||
| 514 | return "" | 514 | return "" |
| 515 | } | 515 | } |
| 516 | 516 | ||
| 517 | -//ResponseCmd EquipmentAddRsp | ||
| 518 | -type EquipmentAddRsp struct { | 517 | +type RoleClearItemsReq struct { |
| 519 | state protoimpl.MessageState | 518 | state protoimpl.MessageState |
| 520 | sizeCache protoimpl.SizeCache | 519 | sizeCache protoimpl.SizeCache |
| 521 | unknownFields protoimpl.UnknownFields | 520 | unknownFields protoimpl.UnknownFields |
| 522 | 521 | ||
| 523 | - Equip *Equipment `protobuf:"bytes,1,opt,name=equip,proto3" json:"equip,omitempty"` | 522 | + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` |
| 523 | + Count int32 `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"` | ||
| 524 | } | 524 | } |
| 525 | 525 | ||
| 526 | -func (x *EquipmentAddRsp) Reset() { | ||
| 527 | - *x = EquipmentAddRsp{} | 526 | +func (x *RoleClearItemsReq) Reset() { |
| 527 | + *x = RoleClearItemsReq{} | ||
| 528 | if protoimpl.UnsafeEnabled { | 528 | if protoimpl.UnsafeEnabled { |
| 529 | mi := &file_game_proto_msgTypes[9] | 529 | mi := &file_game_proto_msgTypes[9] |
| 530 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 530 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| @@ -532,13 +532,13 @@ func (x *EquipmentAddRsp) Reset() { | @@ -532,13 +532,13 @@ func (x *EquipmentAddRsp) Reset() { | ||
| 532 | } | 532 | } |
| 533 | } | 533 | } |
| 534 | 534 | ||
| 535 | -func (x *EquipmentAddRsp) String() string { | 535 | +func (x *RoleClearItemsReq) String() string { |
| 536 | return protoimpl.X.MessageStringOf(x) | 536 | return protoimpl.X.MessageStringOf(x) |
| 537 | } | 537 | } |
| 538 | 538 | ||
| 539 | -func (*EquipmentAddRsp) ProtoMessage() {} | 539 | +func (*RoleClearItemsReq) ProtoMessage() {} |
| 540 | 540 | ||
| 541 | -func (x *EquipmentAddRsp) ProtoReflect() protoreflect.Message { | 541 | +func (x *RoleClearItemsReq) ProtoReflect() protoreflect.Message { |
| 542 | mi := &file_game_proto_msgTypes[9] | 542 | mi := &file_game_proto_msgTypes[9] |
| 543 | if protoimpl.UnsafeEnabled && x != nil { | 543 | if protoimpl.UnsafeEnabled && x != nil { |
| 544 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 544 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| @@ -550,19 +550,26 @@ func (x *EquipmentAddRsp) ProtoReflect() protoreflect.Message { | @@ -550,19 +550,26 @@ func (x *EquipmentAddRsp) ProtoReflect() protoreflect.Message { | ||
| 550 | return mi.MessageOf(x) | 550 | return mi.MessageOf(x) |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | -// Deprecated: Use EquipmentAddRsp.ProtoReflect.Descriptor instead. | ||
| 554 | -func (*EquipmentAddRsp) Descriptor() ([]byte, []int) { | 553 | +// Deprecated: Use RoleClearItemsReq.ProtoReflect.Descriptor instead. |
| 554 | +func (*RoleClearItemsReq) Descriptor() ([]byte, []int) { | ||
| 555 | return file_game_proto_rawDescGZIP(), []int{9} | 555 | return file_game_proto_rawDescGZIP(), []int{9} |
| 556 | } | 556 | } |
| 557 | 557 | ||
| 558 | -func (x *EquipmentAddRsp) GetEquip() *Equipment { | 558 | +func (x *RoleClearItemsReq) GetId() string { |
| 559 | if x != nil { | 559 | if x != nil { |
| 560 | - return x.Equip | 560 | + return x.Id |
| 561 | } | 561 | } |
| 562 | - return nil | 562 | + return "" |
| 563 | +} | ||
| 564 | + | ||
| 565 | +func (x *RoleClearItemsReq) GetCount() int32 { | ||
| 566 | + if x != nil { | ||
| 567 | + return x.Count | ||
| 568 | + } | ||
| 569 | + return 0 | ||
| 563 | } | 570 | } |
| 564 | 571 | ||
| 565 | -type EquipmentDelRsp struct { | 572 | +type EquipmentDelReq struct { |
| 566 | state protoimpl.MessageState | 573 | state protoimpl.MessageState |
| 567 | sizeCache protoimpl.SizeCache | 574 | sizeCache protoimpl.SizeCache |
| 568 | unknownFields protoimpl.UnknownFields | 575 | unknownFields protoimpl.UnknownFields |
| @@ -570,8 +577,8 @@ type EquipmentDelRsp struct { | @@ -570,8 +577,8 @@ type EquipmentDelRsp struct { | ||
| 570 | Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` | 577 | Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` |
| 571 | } | 578 | } |
| 572 | 579 | ||
| 573 | -func (x *EquipmentDelRsp) Reset() { | ||
| 574 | - *x = EquipmentDelRsp{} | 580 | +func (x *EquipmentDelReq) Reset() { |
| 581 | + *x = EquipmentDelReq{} | ||
| 575 | if protoimpl.UnsafeEnabled { | 582 | if protoimpl.UnsafeEnabled { |
| 576 | mi := &file_game_proto_msgTypes[10] | 583 | mi := &file_game_proto_msgTypes[10] |
| 577 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 584 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| @@ -579,13 +586,13 @@ func (x *EquipmentDelRsp) Reset() { | @@ -579,13 +586,13 @@ func (x *EquipmentDelRsp) Reset() { | ||
| 579 | } | 586 | } |
| 580 | } | 587 | } |
| 581 | 588 | ||
| 582 | -func (x *EquipmentDelRsp) String() string { | 589 | +func (x *EquipmentDelReq) String() string { |
| 583 | return protoimpl.X.MessageStringOf(x) | 590 | return protoimpl.X.MessageStringOf(x) |
| 584 | } | 591 | } |
| 585 | 592 | ||
| 586 | -func (*EquipmentDelRsp) ProtoMessage() {} | 593 | +func (*EquipmentDelReq) ProtoMessage() {} |
| 587 | 594 | ||
| 588 | -func (x *EquipmentDelRsp) ProtoReflect() protoreflect.Message { | 595 | +func (x *EquipmentDelReq) ProtoReflect() protoreflect.Message { |
| 589 | mi := &file_game_proto_msgTypes[10] | 596 | mi := &file_game_proto_msgTypes[10] |
| 590 | if protoimpl.UnsafeEnabled && x != nil { | 597 | if protoimpl.UnsafeEnabled && x != nil { |
| 591 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | 598 | ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) |
| @@ -597,18 +604,66 @@ func (x *EquipmentDelRsp) ProtoReflect() protoreflect.Message { | @@ -597,18 +604,66 @@ func (x *EquipmentDelRsp) ProtoReflect() protoreflect.Message { | ||
| 597 | return mi.MessageOf(x) | 604 | return mi.MessageOf(x) |
| 598 | } | 605 | } |
| 599 | 606 | ||
| 600 | -// Deprecated: Use EquipmentDelRsp.ProtoReflect.Descriptor instead. | ||
| 601 | -func (*EquipmentDelRsp) Descriptor() ([]byte, []int) { | 607 | +// Deprecated: Use EquipmentDelReq.ProtoReflect.Descriptor instead. |
| 608 | +func (*EquipmentDelReq) Descriptor() ([]byte, []int) { | ||
| 602 | return file_game_proto_rawDescGZIP(), []int{10} | 609 | return file_game_proto_rawDescGZIP(), []int{10} |
| 603 | } | 610 | } |
| 604 | 611 | ||
| 605 | -func (x *EquipmentDelRsp) GetId() string { | 612 | +func (x *EquipmentDelReq) GetId() string { |
| 606 | if x != nil { | 613 | if x != nil { |
| 607 | return x.Id | 614 | return x.Id |
| 608 | } | 615 | } |
| 609 | return "" | 616 | return "" |
| 610 | } | 617 | } |
| 611 | 618 | ||
| 619 | +//ResponseCmd EquipmentAddRsp | ||
| 620 | +type EquipmentAddRsp struct { | ||
| 621 | + state protoimpl.MessageState | ||
| 622 | + sizeCache protoimpl.SizeCache | ||
| 623 | + unknownFields protoimpl.UnknownFields | ||
| 624 | + | ||
| 625 | + Equip *Equipment `protobuf:"bytes,1,opt,name=equip,proto3" json:"equip,omitempty"` | ||
| 626 | +} | ||
| 627 | + | ||
| 628 | +func (x *EquipmentAddRsp) Reset() { | ||
| 629 | + *x = EquipmentAddRsp{} | ||
| 630 | + if protoimpl.UnsafeEnabled { | ||
| 631 | + mi := &file_game_proto_msgTypes[11] | ||
| 632 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 633 | + ms.StoreMessageInfo(mi) | ||
| 634 | + } | ||
| 635 | +} | ||
| 636 | + | ||
| 637 | +func (x *EquipmentAddRsp) String() string { | ||
| 638 | + return protoimpl.X.MessageStringOf(x) | ||
| 639 | +} | ||
| 640 | + | ||
| 641 | +func (*EquipmentAddRsp) ProtoMessage() {} | ||
| 642 | + | ||
| 643 | +func (x *EquipmentAddRsp) ProtoReflect() protoreflect.Message { | ||
| 644 | + mi := &file_game_proto_msgTypes[11] | ||
| 645 | + if protoimpl.UnsafeEnabled && x != nil { | ||
| 646 | + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) | ||
| 647 | + if ms.LoadMessageInfo() == nil { | ||
| 648 | + ms.StoreMessageInfo(mi) | ||
| 649 | + } | ||
| 650 | + return ms | ||
| 651 | + } | ||
| 652 | + return mi.MessageOf(x) | ||
| 653 | +} | ||
| 654 | + | ||
| 655 | +// Deprecated: Use EquipmentAddRsp.ProtoReflect.Descriptor instead. | ||
| 656 | +func (*EquipmentAddRsp) Descriptor() ([]byte, []int) { | ||
| 657 | + return file_game_proto_rawDescGZIP(), []int{11} | ||
| 658 | +} | ||
| 659 | + | ||
| 660 | +func (x *EquipmentAddRsp) GetEquip() *Equipment { | ||
| 661 | + if x != nil { | ||
| 662 | + return x.Equip | ||
| 663 | + } | ||
| 664 | + return nil | ||
| 665 | +} | ||
| 666 | + | ||
| 612 | var File_game_proto protoreflect.FileDescriptor | 667 | var File_game_proto protoreflect.FileDescriptor |
| 613 | 668 | ||
| 614 | var file_game_proto_rawDesc = []byte{ | 669 | var file_game_proto_rawDesc = []byte{ |
| @@ -652,14 +707,17 @@ var file_game_proto_rawDesc = []byte{ | @@ -652,14 +707,17 @@ var file_game_proto_rawDesc = []byte{ | ||
| 652 | 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0x2a, 0x0a, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, | 707 | 0x52, 0x04, 0x72, 0x6f, 0x6c, 0x65, 0x22, 0x2a, 0x0a, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, |
| 653 | 0x64, 0x61, 0x74, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, | 708 | 0x64, 0x61, 0x74, 0x65, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x73, 0x70, 0x12, 0x14, 0x0a, 0x05, |
| 654 | 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x65, | 709 | 0x69, 0x74, 0x65, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x69, 0x74, 0x65, |
| 655 | - 0x6d, 0x73, 0x22, 0x3a, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, | ||
| 656 | - 0x64, 0x64, 0x52, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x05, 0x65, 0x71, 0x75, 0x69, 0x70, 0x18, 0x01, | ||
| 657 | - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x45, 0x71, | ||
| 658 | - 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x71, 0x75, 0x69, 0x70, 0x22, 0x21, | ||
| 659 | - 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x52, 0x73, | ||
| 660 | - 0x70, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, | ||
| 661 | - 0x64, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, | ||
| 662 | - 0x72, 0x6f, 0x74, 0x6f, 0x33, | 710 | + 0x6d, 0x73, 0x22, 0x39, 0x0a, 0x11, 0x52, 0x6f, 0x6c, 0x65, 0x43, 0x6c, 0x65, 0x61, 0x72, 0x49, |
| 711 | + 0x74, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, | ||
| 712 | + 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, 0x12, 0x14, 0x0a, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, | ||
| 713 | + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x22, 0x21, 0x0a, | ||
| 714 | + 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x52, 0x65, 0x71, | ||
| 715 | + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x69, 0x64, | ||
| 716 | + 0x22, 0x3a, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, | ||
| 717 | + 0x52, 0x73, 0x70, 0x12, 0x27, 0x0a, 0x05, 0x65, 0x71, 0x75, 0x69, 0x70, 0x18, 0x01, 0x20, 0x01, | ||
| 718 | + 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x6d, 0x6f, 0x64, 0x65, 0x6c, 0x73, 0x2e, 0x45, 0x71, 0x75, 0x69, | ||
| 719 | + 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x52, 0x05, 0x65, 0x71, 0x75, 0x69, 0x70, 0x42, 0x0a, 0x5a, 0x08, | ||
| 720 | + 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | ||
| 663 | } | 721 | } |
| 664 | 722 | ||
| 665 | var ( | 723 | var ( |
| @@ -674,7 +732,7 @@ func file_game_proto_rawDescGZIP() []byte { | @@ -674,7 +732,7 @@ func file_game_proto_rawDescGZIP() []byte { | ||
| 674 | return file_game_proto_rawDescData | 732 | return file_game_proto_rawDescData |
| 675 | } | 733 | } |
| 676 | 734 | ||
| 677 | -var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 11) | 735 | +var file_game_proto_msgTypes = make([]protoimpl.MessageInfo, 12) |
| 678 | var file_game_proto_goTypes = []interface{}{ | 736 | var file_game_proto_goTypes = []interface{}{ |
| 679 | (*HeartReq)(nil), // 0: game.HeartReq | 737 | (*HeartReq)(nil), // 0: game.HeartReq |
| 680 | (*HeartRsp)(nil), // 1: game.HeartRsp | 738 | (*HeartRsp)(nil), // 1: game.HeartRsp |
| @@ -685,21 +743,22 @@ var file_game_proto_goTypes = []interface{}{ | @@ -685,21 +743,22 @@ var file_game_proto_goTypes = []interface{}{ | ||
| 685 | (*RoleRsp)(nil), // 6: game.RoleRsp | 743 | (*RoleRsp)(nil), // 6: game.RoleRsp |
| 686 | (*RoleUpdatePropertyRsp)(nil), // 7: game.RoleUpdatePropertyRsp | 744 | (*RoleUpdatePropertyRsp)(nil), // 7: game.RoleUpdatePropertyRsp |
| 687 | (*RoleUpdateItemsRsp)(nil), // 8: game.RoleUpdateItemsRsp | 745 | (*RoleUpdateItemsRsp)(nil), // 8: game.RoleUpdateItemsRsp |
| 688 | - (*EquipmentAddRsp)(nil), // 9: game.EquipmentAddRsp | ||
| 689 | - (*EquipmentDelRsp)(nil), // 10: game.EquipmentDelRsp | ||
| 690 | - (*Team)(nil), // 11: models.Team | ||
| 691 | - (*Role)(nil), // 12: models.Role | ||
| 692 | - (*Hero)(nil), // 13: models.Hero | ||
| 693 | - (*Equipment)(nil), // 14: models.Equipment | 746 | + (*RoleClearItemsReq)(nil), // 9: game.RoleClearItemsReq |
| 747 | + (*EquipmentDelReq)(nil), // 10: game.EquipmentDelReq | ||
| 748 | + (*EquipmentAddRsp)(nil), // 11: game.EquipmentAddRsp | ||
| 749 | + (*Team)(nil), // 12: models.Team | ||
| 750 | + (*Role)(nil), // 13: models.Role | ||
| 751 | + (*Hero)(nil), // 14: models.Hero | ||
| 752 | + (*Equipment)(nil), // 15: models.Equipment | ||
| 694 | } | 753 | } |
| 695 | var file_game_proto_depIdxs = []int32{ | 754 | var file_game_proto_depIdxs = []int32{ |
| 696 | - 11, // 0: game.ChangeTeamReq.team:type_name -> models.Team | ||
| 697 | - 12, // 1: game.RoleRsp.role:type_name -> models.Role | ||
| 698 | - 13, // 2: game.RoleRsp.hero:type_name -> models.Hero | ||
| 699 | - 11, // 3: game.RoleRsp.team:type_name -> models.Team | ||
| 700 | - 14, // 4: game.RoleRsp.equipments:type_name -> models.Equipment | ||
| 701 | - 12, // 5: game.RoleUpdatePropertyRsp.role:type_name -> models.Role | ||
| 702 | - 14, // 6: game.EquipmentAddRsp.equip:type_name -> models.Equipment | 755 | + 12, // 0: game.ChangeTeamReq.team:type_name -> models.Team |
| 756 | + 13, // 1: game.RoleRsp.role:type_name -> models.Role | ||
| 757 | + 14, // 2: game.RoleRsp.hero:type_name -> models.Hero | ||
| 758 | + 12, // 3: game.RoleRsp.team:type_name -> models.Team | ||
| 759 | + 15, // 4: game.RoleRsp.equipments:type_name -> models.Equipment | ||
| 760 | + 13, // 5: game.RoleUpdatePropertyRsp.role:type_name -> models.Role | ||
| 761 | + 15, // 6: game.EquipmentAddRsp.equip:type_name -> models.Equipment | ||
| 703 | 7, // [7:7] is the sub-list for method output_type | 762 | 7, // [7:7] is the sub-list for method output_type |
| 704 | 7, // [7:7] is the sub-list for method input_type | 763 | 7, // [7:7] is the sub-list for method input_type |
| 705 | 7, // [7:7] is the sub-list for extension type_name | 764 | 7, // [7:7] is the sub-list for extension type_name |
| @@ -823,7 +882,7 @@ func file_game_proto_init() { | @@ -823,7 +882,7 @@ func file_game_proto_init() { | ||
| 823 | } | 882 | } |
| 824 | } | 883 | } |
| 825 | file_game_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { | 884 | file_game_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { |
| 826 | - switch v := v.(*EquipmentAddRsp); i { | 885 | + switch v := v.(*RoleClearItemsReq); i { |
| 827 | case 0: | 886 | case 0: |
| 828 | return &v.state | 887 | return &v.state |
| 829 | case 1: | 888 | case 1: |
| @@ -835,7 +894,19 @@ func file_game_proto_init() { | @@ -835,7 +894,19 @@ func file_game_proto_init() { | ||
| 835 | } | 894 | } |
| 836 | } | 895 | } |
| 837 | file_game_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { | 896 | file_game_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { |
| 838 | - switch v := v.(*EquipmentDelRsp); i { | 897 | + switch v := v.(*EquipmentDelReq); i { |
| 898 | + case 0: | ||
| 899 | + return &v.state | ||
| 900 | + case 1: | ||
| 901 | + return &v.sizeCache | ||
| 902 | + case 2: | ||
| 903 | + return &v.unknownFields | ||
| 904 | + default: | ||
| 905 | + return nil | ||
| 906 | + } | ||
| 907 | + } | ||
| 908 | + file_game_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { | ||
| 909 | + switch v := v.(*EquipmentAddRsp); i { | ||
| 839 | case 0: | 910 | case 0: |
| 840 | return &v.state | 911 | return &v.state |
| 841 | case 1: | 912 | case 1: |
| @@ -853,7 +924,7 @@ func file_game_proto_init() { | @@ -853,7 +924,7 @@ func file_game_proto_init() { | ||
| 853 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), | 924 | GoPackagePath: reflect.TypeOf(x{}).PkgPath(), |
| 854 | RawDescriptor: file_game_proto_rawDesc, | 925 | RawDescriptor: file_game_proto_rawDesc, |
| 855 | NumEnums: 0, | 926 | NumEnums: 0, |
| 856 | - NumMessages: 11, | 927 | + NumMessages: 12, |
| 857 | NumExtensions: 0, | 928 | NumExtensions: 0, |
| 858 | NumServices: 0, | 929 | NumServices: 0, |
| 859 | }, | 930 | }, |
pb/protocode.pb.go
| @@ -34,8 +34,9 @@ const ( | @@ -34,8 +34,9 @@ const ( | ||
| 34 | ProtoCode_RoleRsp ProtoCode = 8 | 34 | ProtoCode_RoleRsp ProtoCode = 8 |
| 35 | ProtoCode_RoleUpdatePropertyRsp ProtoCode = 9 | 35 | ProtoCode_RoleUpdatePropertyRsp ProtoCode = 9 |
| 36 | ProtoCode_RoleUpdateItemsRsp ProtoCode = 10 | 36 | ProtoCode_RoleUpdateItemsRsp ProtoCode = 10 |
| 37 | - ProtoCode_EquipmentAddRsp ProtoCode = 11 | ||
| 38 | - ProtoCode_EquipmentDelRsp ProtoCode = 12 | 37 | + ProtoCode_RoleClearItemsReq ProtoCode = 11 |
| 38 | + ProtoCode_EquipmentDelReq ProtoCode = 12 | ||
| 39 | + ProtoCode_EquipmentAddRsp ProtoCode = 13 | ||
| 39 | ) | 40 | ) |
| 40 | 41 | ||
| 41 | // Enum value maps for ProtoCode. | 42 | // Enum value maps for ProtoCode. |
| @@ -52,8 +53,9 @@ var ( | @@ -52,8 +53,9 @@ var ( | ||
| 52 | 8: "RoleRsp", | 53 | 8: "RoleRsp", |
| 53 | 9: "RoleUpdatePropertyRsp", | 54 | 9: "RoleUpdatePropertyRsp", |
| 54 | 10: "RoleUpdateItemsRsp", | 55 | 10: "RoleUpdateItemsRsp", |
| 55 | - 11: "EquipmentAddRsp", | ||
| 56 | - 12: "EquipmentDelRsp", | 56 | + 11: "RoleClearItemsReq", |
| 57 | + 12: "EquipmentDelReq", | ||
| 58 | + 13: "EquipmentAddRsp", | ||
| 57 | } | 59 | } |
| 58 | ProtoCode_value = map[string]int32{ | 60 | ProtoCode_value = map[string]int32{ |
| 59 | "UNKNOWN": 0, | 61 | "UNKNOWN": 0, |
| @@ -67,8 +69,9 @@ var ( | @@ -67,8 +69,9 @@ var ( | ||
| 67 | "RoleRsp": 8, | 69 | "RoleRsp": 8, |
| 68 | "RoleUpdatePropertyRsp": 9, | 70 | "RoleUpdatePropertyRsp": 9, |
| 69 | "RoleUpdateItemsRsp": 10, | 71 | "RoleUpdateItemsRsp": 10, |
| 70 | - "EquipmentAddRsp": 11, | ||
| 71 | - "EquipmentDelRsp": 12, | 72 | + "RoleClearItemsReq": 11, |
| 73 | + "EquipmentDelReq": 12, | ||
| 74 | + "EquipmentAddRsp": 13, | ||
| 72 | } | 75 | } |
| 73 | ) | 76 | ) |
| 74 | 77 | ||
| @@ -103,7 +106,7 @@ var File_protocode_proto protoreflect.FileDescriptor | @@ -103,7 +106,7 @@ var File_protocode_proto protoreflect.FileDescriptor | ||
| 103 | 106 | ||
| 104 | var file_protocode_proto_rawDesc = []byte{ | 107 | var file_protocode_proto_rawDesc = []byte{ |
| 105 | 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, | 108 | 0x0a, 0x0f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, |
| 106 | - 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0xf3, 0x01, 0x0a, | 109 | + 0x6f, 0x12, 0x09, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x63, 0x6f, 0x64, 0x65, 0x2a, 0x8a, 0x02, 0x0a, |
| 107 | 0x09, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, | 110 | 0x09, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x43, 0x6f, 0x64, 0x65, 0x12, 0x0b, 0x0a, 0x07, 0x55, 0x4e, |
| 108 | 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, | 111 | 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x4c, 0x6f, 0x67, 0x69, 0x6e, |
| 109 | 0x52, 0x73, 0x70, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, | 112 | 0x52, 0x73, 0x70, 0x10, 0x01, 0x12, 0x0c, 0x0a, 0x08, 0x48, 0x65, 0x61, 0x72, 0x74, 0x52, 0x65, |
| @@ -116,11 +119,12 @@ var file_protocode_proto_rawDesc = []byte{ | @@ -116,11 +119,12 @@ var file_protocode_proto_rawDesc = []byte{ | ||
| 116 | 0x52, 0x73, 0x70, 0x10, 0x08, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, | 119 | 0x52, 0x73, 0x70, 0x10, 0x08, 0x12, 0x19, 0x0a, 0x15, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, |
| 117 | 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52, 0x73, 0x70, 0x10, 0x09, | 120 | 0x61, 0x74, 0x65, 0x50, 0x72, 0x6f, 0x70, 0x65, 0x72, 0x74, 0x79, 0x52, 0x73, 0x70, 0x10, 0x09, |
| 118 | 0x12, 0x16, 0x0a, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x74, | 121 | 0x12, 0x16, 0x0a, 0x12, 0x52, 0x6f, 0x6c, 0x65, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x74, |
| 119 | - 0x65, 0x6d, 0x73, 0x52, 0x73, 0x70, 0x10, 0x0a, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, | ||
| 120 | - 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x41, 0x64, 0x64, 0x52, 0x73, 0x70, 0x10, 0x0b, 0x12, 0x13, 0x0a, | ||
| 121 | - 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x52, 0x73, 0x70, | ||
| 122 | - 0x10, 0x0c, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, | ||
| 123 | - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | 122 | + 0x65, 0x6d, 0x73, 0x52, 0x73, 0x70, 0x10, 0x0a, 0x12, 0x15, 0x0a, 0x11, 0x52, 0x6f, 0x6c, 0x65, |
| 123 | + 0x43, 0x6c, 0x65, 0x61, 0x72, 0x49, 0x74, 0x65, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x10, 0x0b, 0x12, | ||
| 124 | + 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x44, 0x65, 0x6c, 0x52, | ||
| 125 | + 0x65, 0x71, 0x10, 0x0c, 0x12, 0x13, 0x0a, 0x0f, 0x45, 0x71, 0x75, 0x69, 0x70, 0x6d, 0x65, 0x6e, | ||
| 126 | + 0x74, 0x41, 0x64, 0x64, 0x52, 0x73, 0x70, 0x10, 0x0d, 0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2e, 0x2f, | ||
| 127 | + 0x70, 0x62, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, | ||
| 124 | } | 128 | } |
| 125 | 129 | ||
| 126 | var ( | 130 | var ( |