private void InitHeroCountProgress(TrackingAchievement achievement)
        {
            PlayerHeroLogic ph = new PlayerHeroLogic();

            ph.SetUser(m_UserId);
            achievement.Progress = ph.GetHeroList().Count;
        }
        private void InitPlayerLevelAchievementProgress(TrackingAchievement achievement)
        {
            PlayerLogic player = new PlayerLogic();

            player.SetUser(m_UserId);
            achievement.Progress = player.MyPlayer.Level;
        }
        private void InitInstanceCompletedCountAchievementProgress(TrackingAchievement achievement)
        {
            InstanceProgressLogic ip = new InstanceProgressLogic();

            ip.SetUser(m_UserId);
            achievement.Progress = ip.GetInstanceProgress().Count;
        }
        private void InitGearLevelAchievementProgress(TrackingAchievement achievement)
        {
            PlayerPackageLogic pp = new PlayerPackageLogic();

            pp.SetUser(m_UserId);
            PlayerHeroLogic ph = new PlayerHeroLogic();

            ph.SetUser(m_UserId);
            int       progress = 0;
            GearLogic g        = new GearLogic();

            foreach (var hero in ph.GetHeroList())
            {
                foreach (var gear in hero.Value.Gears)
                {
                    g.SetGear(gear.Value);
                    if (g.MyGear.Level >= achievement.Params[0])
                    {
                        progress++;
                    }
                }
            }
            foreach (var gear in pp.MyPackage.Gears)
            {
                g.SetGear(gear.Key);
                if (g.MyGear.Level >= achievement.Params[0])
                {
                    progress++;
                }
            }
            achievement.Progress = progress;
        }
        private void InitFriendCountAchievementProgress(TrackingAchievement achievement)
        {
            PlayerFriendsLogic pf = new PlayerFriendsLogic();

            pf.SetUser(m_UserId);
            achievement.Progress = pf.GetFriends().Count;
        }
示例#6
0
        public CacheDictionary <int, int> CompleteAchievement(int id, out TrackingAchievement newAchievement)
        {
            newAchievement = null;
            var aData             = CacheSet.AchievementTable.GetData(id);
            PlayerPackageLogic pp = new PlayerPackageLogic();

            pp.SetUser(m_UserId);
            if (!pp.CheckPackageSlot(aData.RewardItems))
            {
                return(null);
            }
            if (aData == null)
            {
                TraceLog.WriteError("DataTable Error: can not find Id:" + id.ToString());
                return(null);
            }
            if (!m_AchievementInfo.TrackingAchievements.ContainsKey(aData.AchievementType))
            {
                TraceLog.WriteError("You don not have this achievement, Id:" + id.ToString());
                return(null);
            }
            var completedAchievement = m_AchievementInfo.TrackingAchievements[aData.AchievementType];

            if (completedAchievement.Id != id)
            {
                TraceLog.WriteError("You don not have this achievement, Id:" + id.ToString());
                return(null);
            }
            if (completedAchievement.Progress < completedAchievement.RequiredProgress)
            {
                TraceLog.WriteError("You have not completed this achievement, Id:" + id.ToString());
                return(null);
            }
            m_AchievementInfo.CompletedAchievements.Add(id);
            var nextAchievementData = CacheSet.AchievementTable.GetData(a => a.PreAchievementId == id);

            m_AchievementInfo.TrackingAchievements.Remove(aData.AchievementType);
            if (nextAchievementData != null)
            {
                TrackingAchievement ta = new TrackingAchievement()
                {
                    Id = nextAchievementData.Id,
                    RequiredProgress = nextAchievementData.TargetProgressCount,
                };
                ta.Params.AddRange(nextAchievementData.Params);
                m_AchievementIniters[nextAchievementData.AchievementType](ta);
                newAchievement = ta;
                m_AchievementInfo.TrackingAchievements.Add(nextAchievementData.AchievementType, ta);
            }
            return(aData.RewardItems);
        }
示例#7
0
        private void InitHeroStarLevelProgress(TrackingAchievement achievement)
        {
            PlayerHeroLogic ph = new PlayerHeroLogic();

            ph.SetUser(m_UserId);
            int progress = 0;

            foreach (var hero in ph.GetHeroList())
            {
                if (hero.Value.HeroStarLevel >= achievement.Params[0])
                {
                    progress++;
                }
            }
            achievement.Progress = progress;
        }
示例#8
0
        private void InitHeroLevelAchievementProgress(TrackingAchievement achievement)
        {
            PlayerHeroLogic ph = new PlayerHeroLogic();

            ph.SetUser(m_UserId);
            int progress = 0;

            foreach (var hero in ph.GetHeroList())
            {
                if (hero.Value.HeroLv > progress)
                {
                    progress = hero.Value.HeroLv;
                }
            }
            achievement.Progress = progress;
        }
示例#9
0
        private void InitAchievementInfo()
        {
            PlayerLogic player = new PlayerLogic();

            player.SetUser(m_UserId);

            var initialAchievements = CacheSet.AchievementTable.GetAllData(a => a.PreAchievementId == -1 && a.PrePlayerLevel <= player.MyPlayer.Level);

            foreach (var achievement in initialAchievements)
            {
                TrackingAchievement ta = new TrackingAchievement()
                {
                    Id = achievement.Id,
                    RequiredProgress = achievement.TargetProgressCount,
                };
                ta.Params.AddRange(achievement.Params);
                m_AchievementIniters[achievement.AchievementType](ta);
                m_AchievementInfo.TrackingAchievements.Add(achievement.AchievementType, ta);
            }
        }
示例#10
0
        public void OpenNewAchievement(int newLevel)
        {
            var initialAchievements = CacheSet.AchievementTable.GetAllData(a => a.PrePlayerLevel <= newLevel);
            var addedAchievement    = new List <TrackingAchievement>();

            foreach (var achievement in initialAchievements)
            {
                if (m_AchievementInfo.TrackingAchievements.ContainsKey(achievement.AchievementType) || m_AchievementInfo.CompletedAchievements.Contains(achievement.Id))
                {
                    continue;
                }
                TrackingAchievement ta = new TrackingAchievement()
                {
                    Id = achievement.Id,
                    RequiredProgress = achievement.TargetProgressCount,
                };
                ta.Params.AddRange(achievement.Params);
                m_AchievementIniters[achievement.AchievementType](ta);
                m_AchievementInfo.TrackingAchievements.Add(achievement.AchievementType, ta);
                addedAchievement.Add(ta);
            }
            PushProgressModified(addedAchievement);
        }
示例#11
0
 private void InitPvpWinCountAchievementProgress(TrackingAchievement achievement)
 {
     achievement.Progress = 0;
 }
 private void InitOpenedMoneyChanceCountAchievementProgress(TrackingAchievement achievement)
 {
     achievement.Progress = 0;
 }
 private void InitCostedMoneyAchievementProgress(TrackingAchievement achievement)
 {
     achievement.Progress = 0;
 }