diff --git a/server/matchserver/common/types.go b/server/matchserver/common/types.go index 94279a32..d8d98f6d 100644 --- a/server/matchserver/common/types.go +++ b/server/matchserver/common/types.go @@ -10,6 +10,13 @@ import ( proto "github.com/golang/protobuf/proto" ) +type BattleItem struct { + ItemId int32 `json:"item_id"` + ItemNum int32 `json:"item_num"` + ItemType int32 `json:"item_type"` + ItemSubType int32 `json:"item_sub_type"` +} + type UserInfo struct { //Activated string `json:"activated"` //RenameCount string `json:"rename_count"` diff --git a/server/matchserver/player/player.go b/server/matchserver/player/player.go index 6e19e26f..6b8fe11b 100644 --- a/server/matchserver/player/player.go +++ b/server/matchserver/player/player.go @@ -24,13 +24,6 @@ type hero struct { skinId int32 } -type battleItem struct { - itemId int32 - itemNum int32 - itemType int32 - itemSubType int32 -} - type player struct { cs.MsgHandlerImpl socket f5.WspCliConn @@ -54,7 +47,7 @@ type player struct { vipLv int32 vipExp int64 hasVipLucky int32 - battleItems []*battleItem + battleItems []*common.BattleItem } func (this *player) SendMsg(rspMsg proto.Message) { @@ -249,8 +242,8 @@ func (this *player) FillMFTeamMember(member_pb *cs.MFTeamMember) { q5.NewSlice(&member_pb.BattleItems, 0, 0) for _, p := range(this.battleItems) { item_pb := new(cs.MFBattleItem) - item_pb.ItemId = proto.Int32(p.itemId) - item_pb.ItemNum = proto.Int32(p.itemNum) + item_pb.ItemId = proto.Int32(p.ItemId) + item_pb.ItemNum = proto.Int32(p.ItemNum) q5.AppendSlice(&member_pb.BattleItems, item_pb) } } @@ -608,21 +601,21 @@ func (this *player) CMChooseBattleItem(hdr *f5.MsgHdr, msg *cs.CMChooseBattleIte if itemNum > 0 { found := false for _, p := range(this.battleItems) { - if p.itemType == itemType && p.itemSubType == itemSubType { - p.itemId = itemId - p.itemNum = itemNum - p.itemType = itemType - p.itemSubType = itemSubType + if p.ItemType == itemType && p.ItemSubType == itemSubType { + p.ItemId = itemId + p.ItemNum = itemNum + p.ItemType = itemType + p.ItemSubType = itemSubType found = true break } } if !found { - p := new(battleItem) - p.itemId = itemId - p.itemNum = itemNum - p.itemType = itemType - p.itemSubType = itemSubType + p := new(common.BattleItem) + p.ItemId = itemId + p.ItemNum = itemNum + p.ItemType = itemType + p.ItemSubType = itemSubType q5.AppendSlice(&this.battleItems, p) } }