Files
bl/logic/service/player/pet_bag.go

34 lines
859 B
Go

package player
import (
"blazing/logic/service/pet"
"blazing/modules/player/model"
)
func buildCatchTimeSet(petLists ...[]model.PetInfo) map[uint32]struct{} {
total := 0
for _, petList := range petLists {
total += len(petList)
}
catchTimes := make(map[uint32]struct{}, total)
for _, petList := range petLists {
for _, petInfo := range petList {
catchTimes[petInfo.CatchTime] = struct{}{}
}
}
return catchTimes
}
// GetUserBagPetInfo 返回主背包和并列备用精灵列表。
func (p *Player) GetUserBagPetInfo() *pet.GetUserBagPetInfoOutboundInfo {
result := &pet.GetUserBagPetInfoOutboundInfo{
PetList: make([]model.PetInfo, len(p.Info.PetList)),
BackupPetList: make([]model.PetInfo, len(p.Info.BackupPetList)),
}
copy(result.PetList, p.Info.PetList)
copy(result.BackupPetList, p.Info.BackupPetList)
return result
}