コード例 #1
0
        protected override bool ServerIsSatisfied(ICharacter character, QuestRequirementStateWithCount state)
        {
            var containerEquipment = character.SharedGetPlayerContainerEquipment();

            if (this.List.Count == 1)
            {
                var requiredProtoItem = this.List[0];
                foreach (var item in containerEquipment.Items)
                {
                    if (item.ProtoItem == requiredProtoItem)
                    {
                        return(true);
                    }
                }
            }
            else
            {
                foreach (var item in containerEquipment.Items)
                {
                    if (this.List.Contains(item.ProtoItem))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
コード例 #2
0
        protected override bool ServerIsSatisfied(ICharacter character, QuestRequirementStateWithCount state)
        {
            var containerEquipment = character.SharedGetPlayerContainerEquipment();

            foreach (var protoItemEquipment in this.List)
            {
                if (containerEquipment.ContainsItemsOfType(protoItemEquipment, requiredCount: 1))
                {
                    return(true);
                }
            }

            return(false);
        }
コード例 #3
0
        protected override bool ServerIsSatisfied(ICharacter character, QuestRequirementStateWithCount state)
        {
            if (base.ServerIsSatisfied(character, state))
            {
                return(true);
            }

            // check whether any of the other party members has this requirement satisfied
            var partyMembers = PartySystem.ServerGetPartyMembersReadOnly(character);

            if (partyMembers.Count <= 1)
            {
                // no party or single-player party
                return(false);
            }

            var currentCharacterName = character.Name;

            foreach (var partyMemberName in partyMembers)
            {
                if (partyMemberName == currentCharacterName)
                {
                    continue;
                }

                var partyMember = Api.Server.Characters
                                  .GetPlayerCharacter(partyMemberName);

                if (partyMember == null)
                {
                    continue;
                }

                if (partyMember.SharedGetQuests()
                    .SharedHasCompletedRequirement(this))
                {
                    // party member has satisfied this requirement
                    return(true);
                }
            }

            return(false);
        }
コード例 #4
0
        protected override bool ServerIsSatisfied(ICharacter character, QuestRequirementStateWithCount 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.ServerIsSatisfied(character, state));
        }
コード例 #5
0
        protected override bool ServerIsSatisfied(ICharacter character, QuestRequirementStateWithCount 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.ServerIsSatisfied(character, state));
        }
コード例 #6
0
        protected override bool ServerIsSatisfied(ICharacter character, QuestRequirementStateWithCount 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(availableCount, this.RequiredCount);
            return(state.CountCurrent >= this.RequiredCount);
        }