Example #1
0
    public bool IsAvailable(ActorInfo character)
    {
        //Is already complete?
        if (LocalUserInfo.Me.ClientCharacter.CompletedQuests.Contains(this.Key))
        {
            return(false);
        }

        //Is already in progress?
        if (LocalUserInfo.Me.ClientCharacter.GetQuest(this.Key) != null)
        {
            return(false);
        }

        //Is for a higher level?
        if (character.LVL < MinimumLevel)
        {
            return(false);
        }

        //Is it a chain quest?
        for (int i = 0; i < QuestsStates.Count; i++)
        {
            switch (QuestsStates[i].State)
            {
            case "InProgress":
            {
                if (character.GetQuest(QuestsStates[i].QuestKey) == null)
                {
                    return(false);
                }

                break;
            }

            case "Completed":
            {
                if (!character.CompletedQuests.Contains(QuestsStates[i].QuestKey))
                {
                    return(false);
                }

                break;
            }

            case "NotInProgress":
            {
                if (character.GetQuest(QuestsStates[i].QuestKey) != null)
                {
                    return(false);
                }

                break;
            }

            case "NotCompleted":
            {
                if (character.CompletedQuests.Contains(QuestsStates[i].QuestKey))
                {
                    return(false);
                }

                break;
            }
            }
        }


        return(true);
    }