Example #1
0
        public static bool InProgress(PlayerMobile player, MondainQuester quester)
        { 
            for (int i = 0; i < player.Quests.Count; i ++)
            {
                BaseQuest quest = player.Quests[i];
				
                if (quest.Quester == null)
                    continue;
					
                if (quest.Quester.GetType() == quester.GetType())
                {
                    if (quest.Completed)		
                    {
                        if (quest.Complete == null && !AnyRewards(quest))
                            quest.GiveRewards();
                        else 
                            player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                    }
                    else
                    {
                        player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                        quest.InProgress();
                    }
						
                    return true;
                }
            }
			
            return false;
        }
Example #2
0
        public static bool InProgress(PlayerMobile player, Type[] quests)
        {
            if (quests == null)
            {
                return(false);
            }

            for (int i = 0; i < quests.Length; i++)
            {
                for (int j = 0; j < player.Quests.Count; j++)
                {
                    BaseQuest quest = player.Quests[j];

                    if (quests[i].IsAssignableFrom(quest.GetType()))
                    {
                        if (quest.Completed)
                        {
                            player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                        }
                        else
                        {
                            player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                            quest.InProgress();
                        }

                        return(true);
                    }
                }
            }
            return(false);
        }
Example #3
0
        public static bool InProgress(PlayerMobile player, Type[] quests)
        {
            if (quests == null)
            {
                return(false);
            }

            for (int i = 0; i < quests.Length; i++)
            {
                for (int j = 0; j < player.Quests.Count; j++)
                {
                    BaseQuest quest = player.Quests[j];

                    if (quests[i].IsAssignableFrom(quest.GetType()))
                    {
                        player.CloseGump(typeof(BaseQuestGump));

                        if (quest.Completed)
                        {
                            player.SendGump(new MLQuestFinishGump(player, quest));
                        }
                        else
                        {
                            player.SendGump(new MLQuestConversationGump(quest, MLQuestConverType.InProgress));
                            quest.InProgress();
                        }

                        return(true);
                    }
                }
            }
            return(false);
        }
Example #4
0
        /// <summary>
        /// Called in MondainQuester.cs
        /// </summary>
        /// <param name="player"></param>
        /// <param name="quester"></param>
        /// <returns></returns>
        public static bool InProgress(PlayerMobile player, Mobile quester)
        {
            BaseQuest quest = player.Quests.FirstOrDefault(q => q.QuesterType == quester.GetType());

            if (quest != null)
            {
                if (quest.Completed)
                {
                    if (quest.Complete == null && !AnyRewards(quest))
                    {
                        if (TryDeleteItems(quest))
                        {
                            quest.GiveRewards();
                        }
                    }
                    else
                    {
                        player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                    }
                }
                else
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                    quest.InProgress();
                }

                return(true);
            }

            return(false);
        }
Example #5
0
        /// <summary>
        /// Called in BaseQuestItem.cs
        /// </summary>
        /// <param name="player"></param>
        /// <param name="quests"></param>
        /// <returns></returns>
        public static bool InProgress(PlayerMobile player, Type[] quests)
        {
            if (quests == null)
            {
                return(false);
            }

            BaseQuest quest = player.Quests.FirstOrDefault(q => quests.Any(questerType => questerType == q.GetType()));

            if (quest != null)
            {
                if (quest.Completed)
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                }
                else
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                    quest.InProgress();
                }

                return(true);
            }

            return(false);
        }
Example #6
0
        /// <summary>
        /// Called in MondainQuester.cs
        /// </summary>
        /// <param name="player"></param>
        /// <param name="quester"></param>
        /// <returns></returns>
        public static bool InProgress(PlayerMobile player, Mobile quester)
        {
            BaseQuest quest = player.Quests.FirstOrDefault(q => q.QuesterType == quester.GetType());

            if (quest != null)
            {
                if (quest.Completed)
                {
                    if (quest.Complete == null && !AnyRewards(quest))
                    {
                        if (TryDeleteItems(quest))
                        {
                            quest.GiveRewards();
                        }
                    }
                    else
                    {
                        player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                    }
                }
                else
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                    quest.InProgress();
                }

                return(true);
            }

            /*for (int i = 0; i < player.Quests.Count; i ++)
             * {
             *  BaseQuest quest = player.Quests[i];
             *
             *  if (quest.Quester == null && quest.QuesterType == null)
             *      continue;
             *
             *  if (quest.QuesterType == quester.GetType())
             *  {
             *      if (quest.Completed)
             *      {
             *          if (quest.Complete == null && !AnyRewards(quest))
             *              quest.GiveRewards();
             *          else
             *              player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
             *      }
             *      else
             *      {
             *          player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
             *          quest.InProgress();
             *      }
             *
             *      return true;
             *  }
             * }*/

            return(false);
        }
Example #7
0
        /// <summary>
        /// Called in BaseQuestItem.cs
        /// </summary>
        /// <param name="player"></param>
        /// <param name="quests"></param>
        /// <returns></returns>
        public static bool InProgress(PlayerMobile player, Type[] quests)
        {
            if (quests == null)
            {
                return(false);
            }

            BaseQuest quest = null;

            for (var i = 0; i < player.Quests.Count; i++)
            {
                var q = player.Quests[i];

                bool any = false;

                for (var index = 0; index < quests.Length; index++)
                {
                    var questerType = quests[index];

                    if (questerType == q.GetType())
                    {
                        any = true;
                        break;
                    }
                }

                if (any)
                {
                    quest = q;
                    break;
                }
            }

            if (quest != null)
            {
                if (quest.Completed)
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                }
                else
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                    quest.InProgress();
                }

                return(true);
            }

            return(false);
        }
Example #8
0
        /// <summary>
        /// Called in BaseQuestItem.cs
        /// </summary>
        /// <param name="player"></param>
        /// <param name="quests"></param>
        /// <returns></returns>
        public static bool InProgress(PlayerMobile player, Type[] quests)
        {
            if (quests == null)
            {
                return(false);
            }

            BaseQuest quest = player.Quests.FirstOrDefault(q => quests.Any(questerType => questerType == q.GetType()));

            if (quest != null)
            {
                if (quest.Completed)
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                }
                else
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                    quest.InProgress();
                }

                return(true);
            }

            /*for (int i = 0; i < quests.Length; i ++)
             * {
             *  for (int j = 0; j < player.Quests.Count; j ++)
             *  {
             *      BaseQuest quest = player.Quests[j];
             *
             *      if (quests[i].IsAssignableFrom(quest.GetType()))
             *      {
             *          if (quest.Completed)
             *          {
             *              player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
             *          }
             *          else
             *          {
             *              player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
             *              quest.InProgress();
             *          }
             *
             *          return true;
             *      }
             *  }
             * }*/

            return(false);
        }
Example #9
0
        /// <summary>
        /// Called in MondainQuester.cs
        /// </summary>
        /// <param name="player"></param>
        /// <param name="quester"></param>
        /// <returns></returns>
        public static bool InProgress(PlayerMobile player, Mobile quester)
        {
            BaseQuest quest = null;

            for (var index = 0; index < player.Quests.Count; index++)
            {
                var q = player.Quests[index];

                if (q.QuesterType == quester.GetType())
                {
                    quest = q;
                    break;
                }
            }

            if (quest != null)
            {
                if (quest.Completed)
                {
                    if (quest.Complete == null && !AnyRewards(quest))
                    {
                        if (TryDeleteItems(quest))
                        {
                            quest.GiveRewards();
                        }
                    }
                    else
                    {
                        player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                    }
                }
                else
                {
                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                    quest.InProgress();
                }

                return(true);
            }

            return(false);
        }
Example #10
0
        public static bool InProgress(PlayerMobile player, MondainQuester quester)
        {
            for (int i = 0; i < player.Quests.Count; i++)
            {
                BaseQuest quest = player.Quests[i];

                if (quest.Quester == null)
                {
                    continue;
                }

                if (quest.Quester.GetType() == quester.GetType())
                {
                    player.CloseGump(typeof(BaseQuestGump));

                    if (quest.Completed)
                    {
                        if (quest.Complete == null && !AnyRewards(quest))
                        {
                            quest.GiveRewards();
                        }
                        else
                        {
                            player.SendGump(new MLQuestFinishGump(player, quest));
                        }
                    }
                    else
                    {
                        player.SendGump(new MLQuestConversationGump(quest, MLQuestConverType.InProgress));
                        quest.InProgress();
                    }

                    return(true);
                }
            }

            return(false);
        }
        public bool HasQuest(PlayerMobile pm)
        {
            if (pm.Quests == null)
            {
                return(false);
            }

            for (int i = 0; i < pm.Quests.Count; i++)
            {
                BaseQuest quest = pm.Quests[i];

                if (quest.Quester == this)
                {
                    for (int j = 0; j < quest.Objectives.Count; j++)
                    {
                        if (quest.Objectives[j].Update(pm))
                        {
                            quest.Objectives[j].Complete();
                        }
                    }

                    if (quest.Completed)
                    {
                        quest.OnCompleted();
                        pm.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                    }
                    else
                    {
                        pm.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.InProgress, false));
                        quest.InProgress();
                    }

                    return(true);
                }
            }
            return(false);
        }