Ejemplo n.º 1
0
 private void SetSoulInfo(PlayerPackageLogic package)
 {
     foreach (var soul in package.MyPackage.Souls)
     {
         PBSoulInfo soulInfo = new PBSoulInfo();
         soulInfo.Id   = soul.Key;
         soulInfo.Type = soul.Value;
         m_ResponsePacket.SoulInfo.Add(soulInfo);
     }
 }
Ejemplo n.º 2
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);
            }
        }
Ejemplo 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);
        }
Ejemplo 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);
        }
Ejemplo n.º 5
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);
        }