Beispiel #1
0
        protected override bool ServerIsCompleted(ICharacter character, PlayerTaskStateWithCount state)
        {
            var characterContainers = new AggregatedItemsContainers(character, includeEquipmentContainer: true);

            if (this.RequiredCount == 1)
            {
                // only one item is required
                foreach (var protoItem in this.List)
                {
                    if (characterContainers.ContainsItemsOfType(protoItem, requiredCount: 1))
                    {
                        // found at least one item of the required item type
                        state.SetCountCurrent(1, countMax: 1);
                        return(true);
                    }
                }

                state.SetCountCurrent(0, countMax: 1);
                return(false);
            }

            // more than a single item is required
            var availableCount = 0;

            foreach (var protoItem in this.List)
            {
                availableCount += characterContainers.CountItemsOfType(protoItem);
                if (availableCount >= this.RequiredCount)
                {
                    break;
                }
            }

            state.SetCountCurrent(this.IsReversible
                                      ? availableCount
                                      : Math.Max(state.CountCurrent, availableCount),
                                  this.RequiredCount);
            return(state.CountCurrent >= this.RequiredCount);
        }
        protected override bool ServerIsCompleted(ICharacter character, PlayerTaskStateWithCount state)
        {
            var characterTechnologies = character.SharedGetTechnologies();
            var unlockedCount         = 0;

            foreach (var entry in this.List)
            {
                if (!characterTechnologies.SharedIsGroupUnlocked(entry))
                {
                    continue;
                }

                unlockedCount++;
                if (unlockedCount > this.RequiredCount)
                {
                    break;
                }
            }

            state.SetCountCurrent(unlockedCount, this.RequiredCount);

            return(base.ServerIsCompleted(character, state));
        }
Beispiel #3
0
        protected override bool ServerIsCompleted(ICharacter character, PlayerTaskStateWithCount state)
        {
            var characterSkills = character.SharedGetSkills();
            var unlockedCount   = 0;

            foreach (var entry in this.List)
            {
                if (!characterSkills.SharedHasSkill(entry, this.MinLevel))
                {
                    continue;
                }

                unlockedCount++;
                if (unlockedCount > this.RequiredCount)
                {
                    break;
                }
            }

            state.SetCountCurrent(unlockedCount, this.RequiredCount);

            return(base.ServerIsCompleted(character, state));
        }