ecs/servers/game/logic/player_treasure.go

27 lines
594 B
Go
Raw Normal View History

package logic
import "ecs/proto/pb"
type PlayerTreasure struct {
Uid uint64 `bson:"uid" key:"1"`
Id uint32 `bson:"id"`
Level uint32 `bson:"level"`
HeroUid uint64 `bson:"hero_id"`
}
func (this *PlayerTreasure) BuildMsgTreasure() *pb.Treasure {
return &pb.Treasure{
Uid: this.Uid,
Id: this.Id,
HeroUid: this.HeroUid,
}
}
func (this *Player) BuildMsgTreasureListAck() *pb.TreasureListAck {
var list []*pb.Treasure
for _, treasure := range this.Treasure {
list = append(list, treasure.BuildMsgTreasure())
}
return &pb.TreasureListAck{TreasureList: list}
}