Example #1
0
        /// <summary>
        /// Check if player is eligible for this quest.
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public override bool CheckQuestQualification(GamePlayer player)
        {
            // Must have the encounter, must have the book; must not be on the quest
            // and must not have the quest finished either.
            Type encounterType = ArtifactMgr.GetEncounterType(ArtifactId);

            if (encounterType == null)
            {
                ReasonFailQualification = "It does not appear this encounter type is set up correctly.";
                Log.Warn($"ArtifactQuest: EncounterType is null for ArtifactID {ArtifactId}");
                return(false);
            }

            if (player == null)
            {
                ReasonFailQualification = "Player is null for quest, serious error!";
                Log.Warn($"ArtifactQuest: Player is null for ArtifactID {ArtifactId} encounterType {encounterType.FullName}");
                return(false);
            }

            if (player.CanReceiveArtifact(ArtifactId) == false)
            {
                ReasonFailQualification = "Your class is not eligible for this artifact.";
                return(false);
            }

            if (player.Level < Level)
            {
                ReasonFailQualification = $"You must be at least level {Level} in order to complete this quest.";
                return(false);
            }

            if (player.HasFinishedQuest(GetType()) != 0)
            {
                ReasonFailQualification = "You've already completed the quest for this artifact.";
                return(false);
            }

            if (player.HasFinishedQuest(encounterType) <= 0)
            {
                ReasonFailQualification = "You must first get the encounter credit for this artifact.";
                return(false);
            }

            if (!ArtifactMgr.HasBook(player, ArtifactId))
            {
                ReasonFailQualification = "You are missing the correct book for this artifact.";
                return(false);
            }

            if (player.IsDoingQuest(GetType()) != null)
            {
                ReasonFailQualification = "You've already started the quest for this artifact.";
                return(false);
            }

            return(true);
        }