Exemplo n.º 1
0
        public override bool TakeAction()
        {
            PlayerFriendsLogic pf = new PlayerFriendsLogic();

            pf.SetUser(m_UserId);
            PlayerLogic p = new PlayerLogic();

            foreach (var player in pf.GetFriends())
            {
                p.SetUser(player.Key);
                m_ResponsePacket.Players.Add(new PBPlayerInfo()
                {
                    Id               = player.Key,
                    Name             = p.MyPlayer.Name,
                    Level            = p.MyPlayer.Level,
                    VipLevel         = p.MyPlayer.VIPLevel,
                    LastLoginInTicks = p.MyPlayer.LastLoginTime,
                    IsOnline         = p.MyPlayer.Status == PlayerStatus.Online
                });

                m_ResponsePacket.CanGiveEnergy.Add(player.Value.CanSendEnergy);
                m_ResponsePacket.CanReceiveEnergy.Add(player.Value.CanReceiveEnergy);
            }
            return(true);
        }
        private void InitFriendCountAchievementProgress(TrackingAchievement achievement)
        {
            PlayerFriendsLogic pf = new PlayerFriendsLogic();

            pf.SetUser(m_UserId);
            achievement.Progress = pf.GetFriends().Count;
        }
Exemplo n.º 3
0
        public override bool TakeAction()
        {
            PlayerFriendsLogic pf = new PlayerFriendsLogic();

            pf.SetUser(m_UserId);
            var               nearbyPlayers = pf.GetOnlinePlayers();
            var               friends       = pf.GetFriends();
            HeroTeamLogic     ht            = new HeroTeamLogic();
            PlayerHeroLogic   ph            = new PlayerHeroLogic();
            NearbyPlayerLogic np            = new NearbyPlayerLogic();

            foreach (var player in nearbyPlayers)
            {
                ht.SetUser(player.Id);
                ph.SetUser(player.Id).SetHero(ht.GetTeam()[0]);
                Hero hero = ph.GetHeroInfo();
                if (hero == null)
                {
                    continue;
                }
                m_ResponsePacket.Heroes.Add(new PBLobbyHeroInfo()
                {
                    Type               = hero.HeroType,
                    Level              = hero.HeroLv,
                    StarLevel          = hero.HeroStarLevel,
                    ConsciousnessLevel = hero.ConsciousnessLevel,
                    ElevationLevel     = hero.ElevationLevel
                });
                np.SetUser(player.Id);
                m_ResponsePacket.Players.Add(new PBPlayerInfo()
                {
                    Id               = player.Id,
                    Name             = player.Name,
                    Level            = player.Level,
                    VipLevel         = player.VIPLevel,
                    PortraitType     = player.PortraitType,
                    LastLoginInTicks = player.LastLoginTime,
                    PositionX        = np.NearbyPlayers.MyPositionX,
                    PositionY        = np.NearbyPlayers.MyPositionY,
                    DisplayId        = player.UUID
                });
                if (friends.ContainsKey(player.Id))
                {
                    m_ResponsePacket.IsMyFriend.Add(true);
                }
                else
                {
                    m_ResponsePacket.IsMyFriend.Add(false);
                }
            }
            return(true);
        }
Exemplo n.º 4
0
        public override bool TakeAction()
        {
            List <Player> resPlayers;

            if (m_RequestPacket.HasDisplayId)
            {
                resPlayers = PlayerLogic.FindUserByUUID(m_RequestPacket.DisplayId);
            }
            else
            {
                resPlayers = PlayerLogic.FindUsersByName(m_RequestPacket.Input);
            }

            PlayerFriendsLogic pf = new PlayerFriendsLogic();

            pf.SetUser(m_UserId);
            var friends = pf.GetFriends();

            foreach (var player in resPlayers)
            {
                if (player == null)
                {
                    continue;
                }
                m_ResponsePacket.Players.Add(new PBPlayerInfo()
                {
                    Id               = player.Id,
                    Name             = player.Name,
                    Level            = player.Level,
                    VipLevel         = player.VIPLevel,
                    LastLoginInTicks = player.LastLoginTime
                });
                if (friends.ContainsKey(player.Id))
                {
                    m_ResponsePacket.IsMyFriend.Add(true);
                }
                else
                {
                    m_ResponsePacket.IsMyFriend.Add(false);
                }
            }
            return(true);
        }
Exemplo n.º 5
0
        public override bool TakeAction()
        {
            PlayerLogic player = new PlayerLogic();

            player.SetUser(m_RequestPacket.PlayerId);
            PlayerHeroLogic ph = new PlayerHeroLogic();

            ph.SetUser(m_RequestPacket.PlayerId);
            m_ResponsePacket.Player = new PBPlayerInfo()
            {
                Id              = player.MyPlayer.Id,
                Name            = player.MyPlayer.Name,
                VipLevel        = player.MyPlayer.VIPLevel,
                Level           = player.MyPlayer.Level,
                PlayerHeroCount = ph.MyHeros.Heros.Count,
                Might           = player.MyPlayer.Might,
                DisplayId       = player.MyPlayer.UUID
            };
            PlayerFriendsLogic pf = new PlayerFriendsLogic();

            pf.SetUser(m_RequestPacket.PlayerId);
            var friends = pf.GetFriends();

            if (friends.ContainsKey(m_UserId))
            {
                m_ResponsePacket.IsMyFriend = true;
            }
            else
            {
                m_ResponsePacket.IsMyFriend = false;
            }

            HeroTeamLogic ht = new HeroTeamLogic();

            ht.SetUser(m_RequestPacket.PlayerId);
            GearLogic g = new GearLogic();
            SoulLogic s = new SoulLogic();

            foreach (int heroType in ht.MyHeroTeam.Team)
            {
                if (heroType == 0)
                {
                    continue;
                }
                var hero     = ph.SetHero(heroType).GetHeroInfo();
                var heroInfo = new PBLobbyHeroInfo()
                {
                    Type  = hero.HeroType,
                    Level = hero.HeroLv,
                    ConsciousnessLevel = hero.ConsciousnessLevel,
                    ElevationLevel     = hero.ElevationLevel,
                    StarLevel          = hero.HeroStarLevel,
                    Might = hero.Might,
                };
                heroInfo.SkillLevels.AddRange(hero.SkillLevels);
                foreach (var gear in hero.Gears)
                {
                    g.SetGear(gear.Value);
                    heroInfo.GearInfo.Add(new PBGearInfo()
                    {
                        Id              = g.MyGear.Id,
                        Type            = g.MyGear.TypeId,
                        Level           = g.MyGear.Level,
                        StrengthenLevel = g.MyGear.StrengthenLevel
                    });
                }
                foreach (var soul in hero.Souls)
                {
                    s.SetSoul(soul.Value);
                    heroInfo.SoulInfo.Add(new PBSoulInfo()
                    {
                        Id   = s.MySoul.Id,
                        Type = s.MySoul.TypeId,
                    });
                }
                m_ResponsePacket.HeroTeam.Add(heroInfo);
            }
            return(true);
        }