コード例 #1
0
        private bool CanUpdateCriteria(SaintCoinach.Xiv.Achievement entry, params int[] parameters)
        {
            Debug.Assert(entry != null);
            switch ((CriteriaType)entry.Type)
            {
            case CriteriaType.Achievement:
                if (parameters.Length < 1)
                {
                    return(false);
                }
                return(entry.Data.Contains(parameters[0]));

            case CriteriaType.Level:
            {
                if (parameters.Length < 1)
                {
                    return(false);
                }
                if (entry.GetCriteriaParameter(CriteriaParameter.JobClassId) != parameters[0])
                {
                    return(false);
                }
                return(entry.GetCriteriaParameter(CriteriaParameter.ClassLevel) < owner.Character.GetClassInfo((uint)parameters[0]).Level);
            }

            /* TODO: handle these types when related systems are implemented
             * case CriteriaType.MateriaMelding:
             * case CriteriaType.HuntingLog:
             * case CriteriaType.Exploration:
             * case CriteriaType.QuestCompleteAny:
             * case CriteriaType.ChocoboRank:
             * case CriteriaType.PvPRank:
             * case CriteriaType.PvPMatch:
             * case CriteriaType.PvPMatchWin:
             * case CriteriaType.ReputationRank:
             * case CriteriaType.FrontlineCampaign:
             * case CriteriaType.FrontlineCampaignWin:
             * case CriteriaType.FrontlineCampaignWinAny:
             * case CriteriaType.AetherCurrent:
             * case CriteriaType.Minion:
             * case CriteriaType.VerminionChallenge:
             * case CriteriaType.AnimaWeapon:*/
            default:
            {
                    #if DEBUG
                Console.WriteLine($"Unhandled AchievementCriteriaType: {entry.Type} in CanUpdateCriteria!");
                    #endif
                return(false);
            }
            }
        }
コード例 #2
0
        /// <summary>
        /// Get current amount of criteria progress for Achievement.
        /// </summary>
        private uint GetAchievementCriteriaCounter(SaintCoinach.Xiv.Achievement entry)
        {
            switch ((CriteriaType)entry.Type)
            {
            case CriteriaType.Counter:
                CriteriaCounterType type = (CriteriaCounterType)entry.GetCriteriaParameter(CriteriaParameter.CriteriaCounterTypeId);
                return(counterCriteria.ContainsKey(type) ? counterCriteria[type].Value : 0u);

            case CriteriaType.Level:
                return(owner.Character.GetClassInfo((uint)entry.GetCriteriaParameter(CriteriaParameter.JobClassId)).Level);

            /* TODO: handle these types when related systems are implemented
             * case CriteriaType.Achievement:
             * case CriteriaType.MateriaMelding:
             * case CriteriaType.HuntingLog:
             * case CriteriaType.Exploration:
             * case CriteriaType.QuestCompleteAny:
             * case CriteriaType.ChocoboRank:
             * case CriteriaType.PvPRank:
             * case CriteriaType.PvPMatch:
             * case CriteriaType.PvPMatchWin:
             * case CriteriaType.ReputationRank:
             * case CriteriaType.FrontlineCampaign:
             * case CriteriaType.FrontlineCampaignWin:
             * case CriteriaType.FrontlineCampaignWinAny:
             * case CriteriaType.AetherCurrent:
             * case CriteriaType.Minion:
             * case CriteriaType.VerminionChallenge:
             * case CriteriaType.AnimaWeapon:*/
            default:
            {
                    #if DEBUG
                Console.WriteLine($"Unhandled CriteriaType: {entry.Type}, unable to return valid criteria counter!");
                    #endif
                return(0);
            }
            }
        }