Exemplo n.º 1
0
        private void SetHeroInfo()
        {
            PlayerHeroLogic playerHeros = new PlayerHeroLogic();

            playerHeros.SetUser(m_UserId);
            CacheDictionary <int, Hero> heros = playerHeros.GetHeroList();

            foreach (var hero in heros)
            {
                PBLobbyHeroInfo heroInfo = new PBLobbyHeroInfo();
                heroInfo.Type               = hero.Key;
                heroInfo.Level              = hero.Value.HeroLv;
                heroInfo.Exp                = hero.Value.HeroExp;
                heroInfo.StarLevel          = hero.Value.HeroStarLevel;
                heroInfo.ConsciousnessLevel = hero.Value.ConsciousnessLevel;
                heroInfo.ElevationLevel     = hero.Value.ElevationLevel;
                heroInfo.SkillLevels.AddRange(hero.Value.SkillLevels);
                heroInfo.SkillExps.AddRange(hero.Value.SkillExps);
                heroInfo.Might = hero.Value.Might;
                foreach (var gear in hero.Value.Gears)
                {
                    if (gear.Value == 0)
                    {
                        continue;
                    }
                    PBGearInfo gearInfo = new PBGearInfo();
                    gearInfo.Id = gear.Value;
                    Gears gearData = CacheSet.GearCache.FindKey(gear.Value);
                    gearInfo.Level           = gearData.Level;
                    gearInfo.StrengthenLevel = gearData.StrengthenLevel;
                    gearInfo.Type            = gearData.TypeId;
                    heroInfo.GearInfo.Add(gearInfo);
                }
                foreach (var soul in hero.Value.Souls)
                {
                    if (soul.Value == 0)
                    {
                        continue;
                    }
                    PBSoulInfo soulInfo = new PBSoulInfo();
                    soulInfo.Id = soul.Value;
                    Souls soulData = CacheSet.SoulCache.FindKey(soul.Value);
                    soulInfo.Type = soulData.TypeId;
                    heroInfo.SoulInfo.Add(soulInfo);
                }
                m_ResponsePacket.LobbyHeroInfo.Add(heroInfo);
            }
        }
Exemplo n.º 2
0
        public override bool TakeAction()
        {
            ArenaRankLogic   ar = new ArenaRankLogic();
            List <ArenaRank> rankList;

            if (ar.TryGetRankList(m_RequestPacket.PageIndex, out rankList))
            {
                m_ResponsePacket.IsLastPage = false;
            }
            else
            {
                m_ResponsePacket.IsLastPage = true;
            }
            m_ResponsePacket.MyRank = ar.GetPlayerRank(m_UserId);
            PlayerLogic   p  = new PlayerLogic();
            HeroTeamLogic ht = new HeroTeamLogic();

            foreach (var player in rankList)
            {
                PBArenaPlayerAndTeamInfo enemy = new PBArenaPlayerAndTeamInfo();
                enemy.Rank = player.RankId;
                p.SetUser(player.PlayerId);
                enemy.PlayerInfo = new PBPlayerInfo()
                {
                    Id           = player.PlayerId,
                    Name         = p.MyPlayer.Name,
                    Level        = p.MyPlayer.Level,
                    PortraitType = p.MyPlayer.PortraitType
                };
                ht.SetUser(player.PlayerId);
                var team = ht.GetTeam();
                foreach (int hero in team)
                {
                    PBLobbyHeroInfo heroInfo = new PBLobbyHeroInfo()
                    {
                        Type = hero
                    };
                    enemy.HeroTeam.Add(heroInfo);
                }
                m_ResponsePacket.Enemies.Add(enemy);
            }
            m_ResponsePacket.PageIndex = m_RequestPacket.PageIndex;
            return(true);
        }
Exemplo n.º 3
0
        public override bool TakeAction()
        {
            PlayerLogic p = new PlayerLogic();

            p.SetUser(m_RequestPacket.EnemyPlayerId);
            ArenaRankLogic ar = new ArenaRankLogic();

            m_ResponsePacket.EnemyInfo            = new PBArenaPlayerAndTeamInfo();
            m_ResponsePacket.EnemyInfo.PlayerInfo = new PBPlayerInfo()
            {
                Id           = p.MyPlayer.Id,
                Name         = p.MyPlayer.Name,
                PortraitType = p.MyPlayer.PortraitType,
                Level        = p.MyPlayer.Level,
            };
            m_ResponsePacket.EnemyInfo.Rank = ar.GetPlayerRank(m_RequestPacket.EnemyPlayerId);
            PlayerHeroLogic ph = new PlayerHeroLogic();

            ph.SetUser(m_RequestPacket.EnemyPlayerId);
            HeroTeamLogic ht = new HeroTeamLogic();

            ht.SetUser(m_RequestPacket.EnemyPlayerId);
            GearLogic gear = new GearLogic();
            SoulLogic soul = new SoulLogic();

            foreach (int heroId in ht.GetTeam())
            {
                if (heroId == 0)
                {
                    continue;
                }
                ph.SetHero(heroId);
                Hero            heroInfo = ph.GetHeroInfo();
                PBLobbyHeroInfo pbhero   = new PBLobbyHeroInfo()
                {
                    Type  = heroInfo.HeroType,
                    Level = heroInfo.HeroLv,
                    ConsciousnessLevel = heroInfo.ConsciousnessLevel,
                    ElevationLevel     = heroInfo.ElevationLevel,
                    StarLevel          = heroInfo.HeroStarLevel,
                };
                pbhero.SkillLevels.AddRange(heroInfo.SkillLevels);
                foreach (var equipedGear in heroInfo.Gears)
                {
                    gear.SetGear(equipedGear.Value);
                    PBGearInfo heroGear = new PBGearInfo()
                    {
                        Id              = gear.MyGear.Id,
                        Type            = gear.MyGear.TypeId,
                        Level           = gear.MyGear.Level,
                        StrengthenLevel = gear.MyGear.StrengthenLevel
                    };
                    pbhero.GearInfo.Add(heroGear);
                }
                foreach (var equipedSoul in heroInfo.Souls)
                {
                    soul.SetSoul(equipedSoul.Value);
                    PBSoulInfo heroSoul = new PBSoulInfo()
                    {
                        Id   = soul.MySoul.Id,
                        Type = soul.MySoul.TypeId
                    };
                    pbhero.SoulInfo.Add(heroSoul);
                }
                m_ResponsePacket.EnemyInfo.HeroTeam.Add(pbhero);
            }
            return(true);
        }
Exemplo n.º 4
0
        public override bool TakeAction()
        {
            IList <int> heroes;

            if (m_RequestPacket.HeroTypes.Count == 0)
            {
                HeroTeamLogic ht = new HeroTeamLogic();
                ht.SetUser(m_UserId);
                heroes = ht.GetTeam();
            }
            else
            {
                heroes = m_RequestPacket.HeroTypes;
            }
            PlayerHeroLogic ph = new PlayerHeroLogic();

            ph.SetUser(m_RequestPacket.PlayerId);
            GearLogic gear = new GearLogic();
            SoulLogic soul = new SoulLogic();

            foreach (int heroId in heroes)
            {
                if (heroId == 0)
                {
                    continue;
                }
                ph.SetHero(heroId);
                Hero            heroInfo = ph.GetHeroInfo();
                PBLobbyHeroInfo pbhero   = new PBLobbyHeroInfo()
                {
                    Type  = heroInfo.HeroType,
                    Level = heroInfo.HeroLv,
                    ConsciousnessLevel = heroInfo.ConsciousnessLevel,
                    ElevationLevel     = heroInfo.ElevationLevel,
                    StarLevel          = heroInfo.HeroStarLevel,
                };
                foreach (var equipedGear in heroInfo.Gears)
                {
                    gear.SetGear(equipedGear.Value);
                    PBGearInfo heroGear = new PBGearInfo()
                    {
                        Id              = gear.MyGear.Id,
                        Type            = gear.MyGear.TypeId,
                        Level           = gear.MyGear.Level,
                        StrengthenLevel = gear.MyGear.StrengthenLevel
                    };
                    pbhero.GearInfo.Add(heroGear);
                }
                foreach (var equipedSoul in heroInfo.Souls)
                {
                    soul.SetSoul(equipedSoul.Value);
                    PBSoulInfo heroSoul = new PBSoulInfo()
                    {
                        Id   = soul.MySoul.Id,
                        Type = soul.MySoul.TypeId
                    };
                    pbhero.SoulInfo.Add(heroSoul);
                }
                m_ResponsePacket.Heroes.Add(pbhero);
            }
            m_ResponsePacket.PlayerId = m_RequestPacket.PlayerId;
            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);
        }
Exemplo n.º 6
0
        public override bool TakeAction()
        {
            PlayerChessLogic playerChess = new PlayerChessLogic();

            playerChess.SetUser(m_UserId);
            if (!(playerChess.MyChess.ChessBoard[m_RequestPacket.ChessFieldIndex] is BattleChessField))
            {
                m_ResponsePacket.Success = false;
                return(true);
            }
            BattleChessField targetField = playerChess.MyChess.ChessBoard[m_RequestPacket.ChessFieldIndex] as BattleChessField;

            m_ResponsePacket.Anger = targetField.EnemyAnger;
            PlayerLogic player = new PlayerLogic();

            player.SetUser(targetField.EnemyPlayerId);
            m_ResponsePacket.EnemyInfo = new PBPlayerInfo()
            {
                Id    = player.MyPlayer.Id,
                Name  = player.MyPlayer.Name,
                Level = player.MyPlayer.Level,
                Might = player.MyPlayer.Might,
            };
            GearLogic gearlogic = new GearLogic();
            int       i         = 0;

            foreach (var hero in targetField.EnemyPlayerHeroTeam)
            {
                PBLobbyHeroInfo enemyHero = new PBLobbyHeroInfo()
                {
                    Type               = hero.HeroType,
                    Level              = hero.HeroLv,
                    StarLevel          = hero.HeroStarLevel,
                    ConsciousnessLevel = hero.ConsciousnessLevel,
                    ElevationLevel     = hero.ElevationLevel,
                };
                enemyHero.SkillLevels.AddRange(hero.SkillLevels);

                foreach (var gear in hero.Gears)
                {
                    gearlogic.SetGear(gear.Value);
                    PBGearInfo enemyGear = new PBGearInfo()
                    {
                        Id    = gearlogic.MyGear.Id,
                        Type  = gearlogic.MyGear.TypeId,
                        Level = gearlogic.MyGear.Level
                    };
                    enemyHero.GearInfo.Add(enemyGear);
                }
                if (targetField.EnemyHeroHP.Count > i)
                {
                    PBLobbyHeroStatus enemyStatus = new PBLobbyHeroStatus()
                    {
                        Type  = hero.HeroType,
                        CurHP = targetField.EnemyHeroHP[i]
                    };
                    m_ResponsePacket.HeroesStatus.Add(enemyStatus);
                }
                m_ResponsePacket.HeroesInfo.Add(enemyHero);
                m_ResponsePacket.ChessFieldIndex = m_RequestPacket.ChessFieldIndex;
                i++;
            }
            m_ResponsePacket.Success = true;
            return(true);
        }
Exemplo n.º 7
0
        private static PBRoomPlayerInfo GetPlayerRoomData(int playerId)
        {
            PBRoomPlayerInfo retData = new PBRoomPlayerInfo();
            PlayerLogic      p       = new PlayerLogic();

            p.SetUser(playerId);
            retData.PlayerInfo = new PBPlayerInfo()
            {
                Id           = playerId,
                Name         = p.MyPlayer.Name,
                Level        = p.MyPlayer.Level,
                VipLevel     = p.MyPlayer.VIPLevel,
                PortraitType = p.MyPlayer.PortraitType,
                Might        = p.MyPlayer.Might,
            };
            HeroTeamLogic heroTeam = new HeroTeamLogic();

            heroTeam.SetUser(playerId);
            CacheList <int> team = heroTeam.GetTeam();
            PlayerHeroLogic ph   = new PlayerHeroLogic().SetUser(playerId);

            foreach (int heroType in team)
            {
                if (heroType == 0)
                {
                    continue;
                }
                ph.SetHero(heroType);
                var             heroInfo      = ph.GetHeroInfo();
                PBLobbyHeroInfo lobbyHeroInfo = new PBLobbyHeroInfo();
                lobbyHeroInfo.Type               = heroInfo.HeroType;
                lobbyHeroInfo.Level              = heroInfo.HeroLv;
                lobbyHeroInfo.Exp                = heroInfo.HeroExp;
                lobbyHeroInfo.StarLevel          = heroInfo.HeroStarLevel;
                lobbyHeroInfo.ConsciousnessLevel = heroInfo.ConsciousnessLevel;
                lobbyHeroInfo.ElevationLevel     = heroInfo.ElevationLevel;
                lobbyHeroInfo.SkillLevels.AddRange(heroInfo.SkillLevels);
                foreach (var gear in heroInfo.Gears)
                {
                    if (gear.Value == 0)
                    {
                        continue;
                    }
                    PBGearInfo gearInfo = new PBGearInfo();
                    gearInfo.Id = gear.Value;
                    Gears gearData = CacheSet.GearCache.FindKey(gear.Value);
                    gearInfo.Level           = gearData.Level;
                    gearInfo.Type            = gearData.TypeId;
                    gearInfo.StrengthenLevel = gearData.StrengthenLevel;
                    lobbyHeroInfo.GearInfo.Add(gearInfo);
                }
                foreach (var soul in heroInfo.Souls)
                {
                    if (soul.Value == 0)
                    {
                        continue;
                    }
                    PBSoulInfo soulInfo = new PBSoulInfo();
                    soulInfo.Id = soul.Value;
                    Souls soulData = CacheSet.SoulCache.FindKey(soul.Value);
                    soulInfo.Type = soulData.TypeId;
                    lobbyHeroInfo.SoulInfo.Add(soulInfo);
                }
                PBRoomHeroInfo roomHeroInfo = new PBRoomHeroInfo()
                {
                    LobbyHeroInfo = lobbyHeroInfo,
                };
                retData.RoomHeroInfo.Add(roomHeroInfo);
            }
            retData.LobbyServerId = int.Parse(ConfigUtils.GetSetting("Server.Id"));
            PlayerSinglePvpLogic psp = new PlayerSinglePvpLogic();

            psp.SetUser(playerId);
            retData.Score = psp.MyPvp.SinglePvpScore;
            return(retData);
        }