Пример #1
0
        /// <summary>
        /// The completionist page is completed when it has all entries claimed by player
        /// and the number of added entries matches the max number of entries for the page.
        /// </summary>
        protected override bool ServerIsCompleted(ICharacter character, PlayerTaskState state)
        {
            var completionistData = CompletionistSystem.SharedGetCompletionistData(character);

            foreach (var abstractEntry in completionistData.GetPageEntries(this.CompletionistPage))
            {
                var entry = ((ICompletionistDataEntry)abstractEntry);
                if (!ReferenceEquals(entry.Prototype, this.EntryProtoEntity))
                {
                    continue;
                }

                return(!this.IsRewardClaimRequired ||
                       entry.IsRewardClaimed);
            }

            return(false);
        }
Пример #2
0
        /// <summary>
        /// The completionist page is completed when it has all entries claimed by player
        /// and the number of added entries matches the max number of entries for the page.
        /// </summary>
        protected override bool ServerIsCompleted(ICharacter character, PlayerTaskState state)
        {
            var completionistData = CompletionistSystem.SharedGetCompletionistData(character);

            var claimedEntriesCount = 0;

            foreach (var entry in completionistData.GetPageEntries(this.CompletionistPage))
            {
                if (!((ICompletionistDataEntry)entry).IsRewardClaimed)
                {
                    // has an unclaimed entry
                    return(false);
                }

                claimedEntriesCount++;
            }

            return(claimedEntriesCount >= CompletionistSystem.GetPageTotalEntriesNumber(this.CompletionistPage));
        }
        /// <summary>
        /// The completionist page is completed when it has all entries claimed by player
        /// and the number of added entries matches the max number of entries for the page.
        /// </summary>
        protected override bool ServerIsCompleted(ICharacter character, PlayerTaskState state)
        {
            var         completionistData = CompletionistSystem.SharedGetCompletionistData(character);
            IEnumerable pageEntries       = this.CompletionistPage switch
            {
                CompletionistPageName.Food => completionistData.ListFood,
                CompletionistPageName.Creatures => completionistData.ListMobs,
                CompletionistPageName.Loot => completionistData.ListLoot,
                CompletionistPageName.Fish => completionistData.ListFish,
                _ => throw new ArgumentOutOfRangeException()
            };

            var claimedEntriesCount = 0;

            foreach (var entry in pageEntries)
            {
                if (!((ICompletionistDataEntry)entry).IsRewardClaimed)
                {
                    // has an unclaimed entry
                    return(false);
                }

                claimedEntriesCount++;
            }

            var requiredPageEntriesCount = this.CompletionistPage switch
            {
                CompletionistPageName.Food => CompletionistSystem.CompletionistAllFood.Count,
                CompletionistPageName.Creatures => CompletionistSystem.CompletionistAllMobs.Count,
                CompletionistPageName.Loot => CompletionistSystem.CompletionistAllLoot.Count,
                CompletionistPageName.Fish => CompletionistSystem.CompletionistAllFish.Count,
                _ => throw new ArgumentOutOfRangeException()
            };

            return(claimedEntriesCount >= requiredPageEntriesCount);
        }