|
|
|
@ -644,293 +644,6 @@ func (this *PlayerMgr) EndPlayerLoading(accid string) int64 {
|
|
|
|
|
return 0
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//func PlayerRankGe(p1, p2 *Player, n int) bool {
|
|
|
|
|
// switch n {
|
|
|
|
|
// case 0:
|
|
|
|
|
// if p1.TotalCoin == p2.TotalCoin {
|
|
|
|
|
// return p1.SnId < p2.SnId
|
|
|
|
|
// } else {
|
|
|
|
|
// return p1.TotalCoin > p2.TotalCoin
|
|
|
|
|
// }
|
|
|
|
|
// case 1:
|
|
|
|
|
// if p1.CoinPayTotal == p2.CoinPayTotal {
|
|
|
|
|
// return p1.SnId < p2.SnId
|
|
|
|
|
// } else {
|
|
|
|
|
// return p1.CoinPayTotal > p2.CoinPayTotal
|
|
|
|
|
// }
|
|
|
|
|
// case 2:
|
|
|
|
|
// if p1.CoinExchangeTotal == p2.CoinExchangeTotal {
|
|
|
|
|
// return p1.SnId < p2.SnId
|
|
|
|
|
// } else {
|
|
|
|
|
// return p1.CoinExchangeTotal > p2.CoinExchangeTotal
|
|
|
|
|
// }
|
|
|
|
|
// case 3:
|
|
|
|
|
// a := p1.Coin + p1.SafeBoxCoin - p1.CoinPayTotal
|
|
|
|
|
// b := p2.Coin + p2.SafeBoxCoin - p2.CoinPayTotal
|
|
|
|
|
// if a == b {
|
|
|
|
|
// return p1.SnId < p2.SnId
|
|
|
|
|
// } else {
|
|
|
|
|
// return a > b
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// }
|
|
|
|
|
// return false
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
// func (this *PlayerMgr) GetRank() map[string][]*model.Rank {
|
|
|
|
|
// ret := make(map[string][]*model.Rank)
|
|
|
|
|
// ls := make(map[string]*list.List)
|
|
|
|
|
//
|
|
|
|
|
// platforms := PlatformMgrSingleton.Platforms
|
|
|
|
|
// for p := range platforms {
|
|
|
|
|
// ret[p] = make([]*model.Rank, 0)
|
|
|
|
|
// ls[p] = list.New()
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for _, player := range this.players {
|
|
|
|
|
// if player.IsRob {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// p := player.PlayerData.Platform
|
|
|
|
|
// if _, ok := platforms[p]; !ok {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// l := ls[p]
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// if PlayerRankGe(player, np) {
|
|
|
|
|
// l.InsertBefore(player, n)
|
|
|
|
|
// goto CHECK
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// //else {
|
|
|
|
|
// // logger.Logger.Warnf("PlayerMgr.GetRank n.Value.(*Player) fail")
|
|
|
|
|
// // continue
|
|
|
|
|
// //}
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// l.PushBack(player)
|
|
|
|
|
// CHECK:
|
|
|
|
|
// if l.Len() > model.MAX_RANK_COUNT {
|
|
|
|
|
// l.Remove(l.Back())
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for p := range platforms {
|
|
|
|
|
// l := ls[p]
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// ret[p] = append(ret[p], &model.Rank{
|
|
|
|
|
// SnId: np.PlayerData.SnId,
|
|
|
|
|
// Name: np.PlayerData.Name,
|
|
|
|
|
// Head: np.PlayerData.Head,
|
|
|
|
|
// VIP: np.PlayerData.VIP,
|
|
|
|
|
// TotalCoin: np.PlayerData.TotalCoin,
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return ret
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
//func (this *PlayerMgr) GetAssetRank(platform string) []*model.Rank {
|
|
|
|
|
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
|
|
|
// l := list.New()
|
|
|
|
|
//
|
|
|
|
|
// for _, player := range this.players {
|
|
|
|
|
// if player.IsRob {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if player.PlayerData.Platform != platform {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// if PlayerRankGe(player, np, 0) {
|
|
|
|
|
// l.InsertBefore(player, n)
|
|
|
|
|
// goto CHECK
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// l.PushBack(player)
|
|
|
|
|
// CHECK:
|
|
|
|
|
// if l.Len() > model.MAX_RANK_COUNT {
|
|
|
|
|
// l.Remove(l.Back())
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// ret = append(ret, &model.Rank{
|
|
|
|
|
// SnId: np.PlayerData.SnId,
|
|
|
|
|
// Name: np.PlayerData.Name,
|
|
|
|
|
// Head: np.PlayerData.Head,
|
|
|
|
|
// VIP: np.PlayerData.VIP,
|
|
|
|
|
// TotalCoin: np.PlayerData.TotalCoin,
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return ret
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//func (this *PlayerMgr) GetRechargeLists(platform string) []*model.Rank {
|
|
|
|
|
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
|
|
|
// l := list.New()
|
|
|
|
|
//
|
|
|
|
|
// for _, player := range this.players {
|
|
|
|
|
// if player.IsRob {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if player.PlayerData.Platform != platform {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// if PlayerRankGe(player, np, 1) {
|
|
|
|
|
// l.InsertBefore(player, n)
|
|
|
|
|
// goto CHECK
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// l.PushBack(player)
|
|
|
|
|
// CHECK:
|
|
|
|
|
// if l.Len() > model.MAX_RANK_COUNT {
|
|
|
|
|
// l.Remove(l.Back())
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// ret = append(ret, &model.Rank{
|
|
|
|
|
// SnId: np.PlayerData.SnId,
|
|
|
|
|
// Name: np.PlayerData.Name,
|
|
|
|
|
// Head: np.PlayerData.Head,
|
|
|
|
|
// VIP: np.PlayerData.VIP,
|
|
|
|
|
// TotalCoin: np.PlayerData.CoinPayTotal,
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return ret
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//func (this *PlayerMgr) GetExchangeLists(platform string) []*model.Rank {
|
|
|
|
|
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
|
|
|
// l := list.New()
|
|
|
|
|
//
|
|
|
|
|
// for _, player := range this.players {
|
|
|
|
|
// if player.IsRob {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if player.PlayerData.Platform != platform {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// if PlayerRankGe(player, np, 2) {
|
|
|
|
|
// l.InsertBefore(player, n)
|
|
|
|
|
// goto CHECK
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// l.PushBack(player)
|
|
|
|
|
// CHECK:
|
|
|
|
|
// if l.Len() > model.MAX_RANK_COUNT {
|
|
|
|
|
// l.Remove(l.Back())
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// ret = append(ret, &model.Rank{
|
|
|
|
|
// SnId: np.PlayerData.SnId,
|
|
|
|
|
// Name: np.PlayerData.Name,
|
|
|
|
|
// Head: np.PlayerData.Head,
|
|
|
|
|
// VIP: np.PlayerData.VIP,
|
|
|
|
|
// TotalCoin: np.PlayerData.CoinExchangeTotal,
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return ret
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//func (this *PlayerMgr) GetProfitLists(platform string) []*model.Rank {
|
|
|
|
|
// ret := make([]*model.Rank, 0, model.MAX_RANK_COUNT)
|
|
|
|
|
// l := list.New()
|
|
|
|
|
//
|
|
|
|
|
// for _, player := range this.players {
|
|
|
|
|
// if player.IsRob {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// if player.PlayerData.Platform != platform {
|
|
|
|
|
// continue
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// if PlayerRankGe(player, np, 3) {
|
|
|
|
|
// l.InsertBefore(player, n)
|
|
|
|
|
// goto CHECK
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// l.PushBack(player)
|
|
|
|
|
// CHECK:
|
|
|
|
|
// if l.Len() > model.MAX_RANK_COUNT {
|
|
|
|
|
// l.Remove(l.Back())
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for n := l.Front(); n != nil; n = n.Next() {
|
|
|
|
|
// if np, ok := n.Value.(*Player); ok {
|
|
|
|
|
// ret = append(ret, &model.Rank{
|
|
|
|
|
// SnId: np.PlayerData.SnId,
|
|
|
|
|
// Name: np.PlayerData.Name,
|
|
|
|
|
// Head: np.PlayerData.Head,
|
|
|
|
|
// VIP: np.PlayerData.VIP,
|
|
|
|
|
// //TotalCoin: np.PlayerData.ProfitCoin,
|
|
|
|
|
// })
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return ret
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//func (this *PlayerMgr) DeletePlayerByPlatform(platform string) {
|
|
|
|
|
// var dels []*Player
|
|
|
|
|
// for _, p := range this.players {
|
|
|
|
|
// if p != nil && p.Platform == platform {
|
|
|
|
|
// p.Kickout(common.KickReason_Disconnection)
|
|
|
|
|
// dels = append(dels, p)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// for _, p := range dels {
|
|
|
|
|
// if p != nil {
|
|
|
|
|
// p.isDelete = true
|
|
|
|
|
// if p.scene == nil {
|
|
|
|
|
// this.DelPlayer(p.SnId)
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
func (this *PlayerMgr) StatsOnline() model.PlayerOLStats {
|
|
|
|
|
stats := model.PlayerOLStats{
|
|
|
|
|
PlatformStats: make(map[string]*model.PlayerStats),
|
|
|
|
|