ecs/servers/game/logic/player_copy_status.go
2025-06-04 18:17:39 +08:00

148 lines
4.9 KiB
Go

package logic
//type PlayerCopyStatus struct {
// Key uint64 `bson:"key" key:"1"` //copyType<<48|copyArg1<<32|copyArg2<<16|copyArg3
// IndexId uint32 `bson:"index_id"`
// MaxDepth uint32 `bson:"max_depth"`
// MaxScore int32 `bson:"max_score"`
//}
//
//func (this *PlayerCopyStatus) BuildMsgCopyStatus() *proto.CopyStatus {
// arg1, _ := util.Split2uint32(this.Key)
// copyType, _ := util.Split2uint16(arg1)
// return &proto.CopyStatus{CopyType: uint32(copyType), IndexId: this.IndexId, MaxScore: this.MaxScore}
//}
//
//func (this *Player) GetCopyStatus(copyType proto.CopyType, copyArg1, copyArg2, copyArg3 uint16) *PlayerCopyStatus {
// return this.CopyStatus[util.Compose2uint32(util.Compose2uint16(uint16(copyType), copyArg1), util.Compose2uint16(copyArg2, copyArg3))]
//}
//
//func (this *Player) PassedCopyMainline(copyChapterTable *data.CopyChapter, duration int64, maxDepth uint32, maxScore int32) uint32 {
// var key = util.Compose2uint32(util.Compose2uint16(uint16(proto.CopyTypeMainline), 0), 0)
// var copyStatus = this.CopyStatus[key]
// if copyStatus == nil {
// copyStatus = &PlayerCopyStatus{Key: key}
// this.CopyStatus[copyStatus.Key] = copyStatus
// }
//
// copyStatus.IndexId = uint32(copyChapterTable.Id)
// if maxDepth > copyStatus.MaxDepth {
// copyStatus.MaxDepth = maxDepth
// }
// if maxScore > copyStatus.MaxScore {
// copyStatus.MaxScore = maxScore
// }
// this.SaveModel(copyStatus)
//
// this.Role.MainlineSceneId = uint32(copyChapterTable.SceneId)
// this.SaveField("role.mainline_scene_id", this.Role.MainlineSceneId)
//
// _ = this.Send(proto.ModIdLevel, proto.MsgIdCopyStatueChange, &proto.MsgCopyStatusChangeAck{CopyStatus: copyStatus.BuildMsgCopyStatus()})
//
// var copyMainRanking = this.manager.arenaManager.copyMainRanking
// if copyMainRanking != nil {
// copyMainRanking.SavePlayer(this, uint32(copyChapterTable.Id), util.UnixMilli(), 0, 0)
// }
//
// this.checkComponentUnlock(1, copyStatus.IndexId)
// this.checkCharacterUnlock(1, copyStatus.IndexId)
//
// this.checkChapterGiftPack(3, uint32(copyChapterTable.SceneId))
//
// this.checkArenaEnter()
// return 0
//}
//
//func (this *Player) PassedCopyMaterial(copyMaterialTable *data.CopyMaterial, duration int64, maxDepth uint32, maxScore int32) uint32 {
// var key = util.Compose2uint32(util.Compose2uint16(uint16(proto.CopyTypeMaterial), uint16(copyMaterialTable.MaterialType)), 0)
// var copyStatus = this.CopyStatus[key]
// if copyStatus == nil {
// copyStatus = &PlayerCopyStatus{Key: key}
// this.CopyStatus[copyStatus.Key] = copyStatus
// }
//
// copyStatus.IndexId = uint32(copyMaterialTable.Id)
// if maxDepth > copyStatus.MaxDepth {
// copyStatus.MaxDepth = maxDepth
// }
// if maxScore > copyStatus.MaxScore {
// copyStatus.MaxScore = maxScore
// }
// this.SaveModel(copyStatus)
//
// _ = this.Send(proto.ModIdLevel, proto.MsgIdCopyStatueChange, &proto.MsgCopyStatusChangeAck{CopyStatus: copyStatus.BuildMsgCopyStatus()})
// return 0
//}
//
//func (this *Player) BuildMsgCopyStatusListAck() *proto.MsgCopyStatusListAck {
// var list []*proto.CopyStatus
// for _, copyStatus := range this.CopyStatus {
// list = append(list, copyStatus.BuildMsgCopyStatus())
// }
// return &proto.MsgCopyStatusListAck{List: list}
//}
//
//func (this *Player) BuildMsgCopyMainlineRankListAck() *proto.MsgCopyMainlineRankListAck {
// var myRank = &proto.ArenaPlayer{
// PlayerId: this.PlayerId,
// IsRobot: false,
// Name: this.Role.Name,
// Avatar: this.Role.Avatar,
// Capacity: this.RigAttrsCapacity(),
// }
//
// var copoment *PlayerRigComponent
// copoment = this.RigComponent[this.Rig.Head]
// if copoment != nil {
// myRank.RigHead = copoment.Id
// }
//
// copoment = this.RigComponent[this.Rig.Body]
// if copoment != nil {
// myRank.RigBody = copoment.Id
// }
//
// copoment = this.RigComponent[this.Rig.Tail]
// if copoment != nil {
// myRank.RigTail = copoment.Id
// }
//
// var ranking = this.manager.arenaManager.CopyMainRanking()
// if ranking == nil {
// return &proto.MsgCopyMainlineRankListAck{MyRank: myRank}
// }
//
// var score *RankingScore
// var rankingPlayer = ranking.GetPlayer(this.PlayerId)
// if rankingPlayer != nil {
// score = rankingPlayer.Scores[0]
// }
//
// if score != nil {
// myRank.CopyId = score.CopyId
// myRank.RankIndex = score.RankIndex
// }
//
// var rankList []*proto.ArenaPlayer
// for _, rank := range ranking.GetRanking(0, 50) {
// if rank.player.PlayerId == this.PlayerId {
// rankList = append(rankList, myRank)
// } else {
// rankList = append(rankList, &proto.ArenaPlayer{
// PlayerId: rank.player.PlayerId,
// IsRobot: rank.player.PlayerId < 1000000000,
// Name: rank.player.Name,
// Avatar: rank.player.Avatar,
// Capacity: rank.player.Capacity,
// RigHead: rank.player.RigHead,
// RigBody: rank.player.RigBody,
// RigTail: rank.player.RigTail,
// CopyId: rank.score.CopyId,
// RankIndex: rank.score.RankIndex,
// })
// }
// }
//
// return &proto.MsgCopyMainlineRankListAck{MyRank: myRank, RankList: rankList}
//}