Example #1
0
        public bool IsPass(IPlayerCharacterData character)
        {
            int  indexOfQuest        = -1;
            bool questTasksCompleted = false;
            bool questCompleted      = false;

            if (quest != null)
            {
                indexOfQuest = character.IndexOfQuest(quest.DataId);
                if (indexOfQuest >= 0)
                {
                    CharacterQuest characterQuest = character.Quests[indexOfQuest];
                    questTasksCompleted = characterQuest.IsAllTasksDone(character);
                    questCompleted      = characterQuest.isComplete;
                }
            }
            switch (conditionType)
            {
            case NpcDialogConditionType.LevelMoreThanOrEqual:
                return(character.Level >= conditionalLevel);

            case NpcDialogConditionType.LevelLessThanOrEqual:
                return(character.Level <= conditionalLevel);

            case NpcDialogConditionType.QuestNotStarted:
                return(indexOfQuest < 0);

            case NpcDialogConditionType.QuestOngoing:
                return(!questTasksCompleted);

            case NpcDialogConditionType.QuestTasksCompleted:
                return(questTasksCompleted);

            case NpcDialogConditionType.QuestCompleted:
                return(questCompleted);
            }
            return(true);
        }
Example #2
0
 public bool IsPassConditions(IPlayerCharacterData character)
 {
     if (dialog != null && dialog.type == NpcDialogType.Quest)
     {
         if (dialog.quest == null)
         {
             return(false);
         }
         int indexOfQuest = character.IndexOfQuest(dialog.quest.DataId);
         if (indexOfQuest >= 0 && character.Quests[indexOfQuest].isComplete)
         {
             return(false);
         }
     }
     foreach (NpcDialogCondition showCondition in showConditions)
     {
         if (!showCondition.IsPass(character))
         {
             return(false);
         }
     }
     return(true);
 }