示例#1
0
        public static TaskCompleteCompletionistEntry Require <TProtoEntity>(bool isRewardClaimRequired = false)
            where TProtoEntity : IProtoEntity, new()
        {
            var protoEntity = Api.GetProtoEntity <TProtoEntity>();
            var pageName    = CompletionistSystem.GetCompletionistPageName(protoEntity);

            return(new(protoEntity, pageName, isRewardClaimRequired));
        }
示例#2
0
        private ViewModelWindowCompletionist()
        {
            var commandClaimReward = new ActionCommandWithParameter(
                proto => CompletionistSystem.ClientClaimReward((IProtoEntity)proto));

            allFoodEntries ??= CompletionistSystem.CompletionistAllFood.ToDictionary(
                proto => (IProtoEntity)proto,
                proto => new ViewDataEntryCompletionist(proto,
                                                        commandClaimReward));

            allMobEntries ??= CompletionistSystem.CompletionistAllMobs.ToDictionary(
                proto => (IProtoEntity)proto,
                proto => new ViewDataEntryCompletionist(proto,
                                                        commandClaimReward));

            allLootEntries ??= CompletionistSystem.CompletionistAllLoot.ToDictionary(
                proto => (IProtoEntity)proto,
                proto => new ViewDataEntryCompletionist(proto,
                                                        commandClaimReward));

            allFishEntries ??= CompletionistSystem.CompletionistAllFish.ToDictionary(
                proto => (IProtoEntity)proto,
                proto => new ViewDataEntryFishCompletionist(proto,
                                                            commandClaimReward));

            this.EntriesFood = new ViewModelCompletionistPageDefault(
                allFoodEntries,
                columnsCount: 4,
                iconSize: 74,
                entriesPendingCountChanged: this.EntriesPendingCountChangedHandler);

            this.EntriesMobs = new ViewModelCompletionistPageDefault(
                allMobEntries,
                columnsCount: 3,
                iconSize: 111,
                entriesPendingCountChanged: this.EntriesPendingCountChangedHandler);

            this.EntriesLoot = new ViewModelCompletionistPageDefault(
                allLootEntries,
                columnsCount: 3,
                iconSize: 111,
                entriesPendingCountChanged: this.EntriesPendingCountChangedHandler);

            this.EntriesFish = new ViewModelCompletionistPageFish(
                allFishEntries,
                columnsCount: 3,
                iconSize: 111,
                entriesPendingCountChanged: this.EntriesPendingCountChangedHandler);

            BootstrapperClientGame.InitCallback += this.BootstrapperClientGameInitCallbackHandler;

            this.RefreshLists();
        }
示例#3
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);
        }
示例#4
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);
        }