This commit is contained in:
aozhiwei 2024-10-12 15:16:42 +08:00
parent bc43c9e28f
commit 7c260b04cb
2 changed files with 20 additions and 20 deletions

View File

@ -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"`

View File

@ -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)
}
}