Пример #1
0
        public static bool CanOffer(PlayerMobile from, BaseQuest quest, bool message)
        {
            if (!quest.CanOffer())
                return false;
			
            // if a player wants to start quest chain (already started) again (not osi)			
            if (quest.ChainID != QuestChain.None && FirstChainQuest(quest, quest.Quester) && from.Chains.ContainsKey(quest.ChainID))
                return false;
				
            if (!Delayed(from, quest, message))
                return false;
		
            for (int i = quest.Objectives.Count - 1; i >= 0; i --)
            {
                Type type = quest.Objectives[i].Type();
				
                if (type == null)
                    continue;
			
                for (int j = from.Quests.Count - 1; j >= 0; j --)
                {
                    BaseQuest pQuest = from.Quests[j];
					
                    for (int k = pQuest.Objectives.Count - 1; k >= 0; k --)
                    {
                        BaseObjective obj = pQuest.Objectives[k];
						
                        if (type == obj.Type())
                            return false;					
                    }
                }
            }
			
            return true;
        }
Пример #2
0
        public QAndAGump(Mobile owner, BaseQuest quest) : base(50, 50)
        {
            m_From = owner;
            m_Quest = quest;
            this.Closable = false;

            foreach (BaseObjective objective in quest.Objectives)
            {
                if (objective is QuestionAndAnswerObjective)
                {
                    m_Objective = (QuestionAndAnswerObjective)objective;
                    break;
                }
            }

            if (m_Objective == null)
                return;

            QuestionAndAnswerEntry entry = m_Objective.GetRandomQandA();

            if (entry == null)
                return;

            AddPage(0);

            int question = entry.Question;
            object answer = entry.Answers[Utility.Random(entry.Answers.Length)];

            List<object> selections = new List<object>(entry.WrongAnswers);
            m_Index = Utility.Random(selections.Count); //Gets correct answer
            selections.Insert(m_Index, answer);

            AddBackground(0, 0, 305, 145 + (selections.Count * 35), 9270);
            AddHtmlLocalized(104, 25, 200, 26, (int)m_Quest.Title, FontColor, false, false); //La Insep Om
            AddHtmlLocalized(20, 55, 250, 36, question, FontColor, false, false); //question

            int y = 105;

            for (int i = 0; i < selections.Count; i++)
            {
                //AddButton(82, y, 2152, 2153, i + 1, GumpButtonType.Reply, 0);
                AddRadio(20, y, 2152, 2153, false, i + 1);

                object selection = selections[i];

                if (selection is int)
                    AddHtmlLocalized(70, y - 2, 200, 18, (int)selection, FontColor, false, false);
                else
                    AddHtml(70, y - 2, 200, 18, String.Format( "<BASEFONT COLOR=#{0:X6}>{1}</BASEFONT>", FontColor, selections[i]), false, false);

                y += 35;
            }

            AddButton(129, y, 2074, 2076, 1, GumpButtonType.Reply, 0);
        }
Пример #3
0
        public MondainResignGump(BaseQuest quest)
            : base(120, 50)
        {
            if (quest == null)
                return;
		
            this.m_Quest = quest;
		
            this.Closable = false;
            this.Disposable = true;
            this.Dragable = true;
            this.Resizable = false;
			
            this.AddPage(0);
			
            this.AddImageTiled(0, 0, 348, 262, 0xA8E);
            this.AddAlphaRegion(0, 0, 348, 262);
            this.AddImage(0, 15, 0x27A8);
            this.AddImageTiled(0, 30, 17, 200, 0x27A7);
            this.AddImage(0, 230, 0x27AA);
            this.AddImage(15, 0, 0x280C);
            this.AddImageTiled(30, 0, 300, 17, 0x280A);
            this.AddImage(315, 0, 0x280E);
            this.AddImage(15, 244, 0x280C);
            this.AddImageTiled(30, 244, 300, 17, 0x280A);
            this.AddImage(315, 244, 0x280E);
            this.AddImage(330, 15, 0x27A8);
            this.AddImageTiled(330, 30, 17, 200, 0x27A7);
            this.AddImage(330, 230, 0x27AA);
            this.AddImage(333, 2, 0x2716);
            this.AddImage(333, 248, 0x2716);
            this.AddImage(2, 248, 0x216);
            this.AddImage(2, 2, 0x2716);
			
            this.AddHtmlLocalized(25, 22, 200, 20, 1049000, 0x7D00, false, false); // Confirm Quest Cancellation
            this.AddImage(25, 40, 0xBBF);
            this.AddHtmlLocalized(25, 55, 300, 120, 1060836, 0xFFFFFF, false, false); // This quest will give you valuable information, skills and equipment that will help you advance in the game at a quicker pace.<BR><BR>Are you certain you wish to cancel at this time?
			
            if (quest.ChainID != QuestChain.None)
            {
                this.AddRadio(25, 145, 0x25F8, 0x25FB, false, (int)Radios.Chain);
                this.AddHtmlLocalized(60, 150, 280, 20, 1075023, 0xFFFFFF, false, false); // Yes, I want to quit this entire chain!
            }
			
            this.AddRadio(25, 180, 0x25F8, 0x25FB, true, (int)Radios.Quest);
            this.AddHtmlLocalized(60, 185, 280, 20, 1049005, 0xFFFFFF, false, false); // Yes, I really want to quit this quest!
            this.AddRadio(25, 215, 0x25F8, 0x25FB, false, (int)Radios.None);
            this.AddHtmlLocalized(60, 220, 280, 20, 1049006, 0xFFFFFF, false, false); // No, I don't want to quit.
            this.AddButton(265, 220, 0xF7, 0xF8, (int)Buttons.Okay, GumpButtonType.Reply, 0); // okay
        }
Пример #4
0
        public static void CompleteQuest(PlayerMobile from, BaseQuest quest)
        {
            if (quest == null)
            {
                return;
            }

            for (int i = 0; i < quest.Objectives.Count; i++)
            {
                BaseObjective obj = quest.Objectives[i];

                obj.Complete();
            }

            from.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete.
            from.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
            from.PlaySound(quest.CompleteSound);

            quest.OnCompleted();
        }
Пример #5
0
        public static void DeleteEscort(Mobile owner)
        {
            PlayerMobile pm = (PlayerMobile)owner;

            for (var index = 0; index < pm.Quests.Count; index++)
            {
                BaseQuest escortquest = pm.Quests[index];

                if (escortquest.Quester is BaseEscort escort)
                {
                    Timer.DelayCall(TimeSpan.FromSeconds(3), delegate
                    {
                        escort.Say(500901);                  // Ack!  My escort has come to haunt me!
                        owner.SendLocalizedMessage(1071194); // You have failed your escort quest…
                        owner.PlaySound(0x5B3);
                        escort.Delete();
                    });
                }
            }
        }
Пример #6
0
        public static bool DeliveryArrived(PlayerMobile player, BaseVendor vendor)
        {
            for (int i = 0; i < player.Quests.Count; i++)
            {
                BaseQuest quest = player.Quests[i];

                for (int j = 0; j < quest.Objectives.Count; j++)
                {
                    BaseObjective objective = quest.Objectives[j];

                    if (objective is DeliverObjective)
                    {
                        DeliverObjective deliver = (DeliverObjective)objective;

                        if (deliver.Update(vendor))
                        {
                            if (quest.Completed)
                            {
                                player.SendLocalizedMessage(1046258, null, 0x23);                                   // Your quest is complete.
                                player.PlaySound(quest.CompleteSound);

                                quest.OnCompleted();

                                if (vendor is MondainQuester)
                                {
                                    player.SendGump(new MondainQuestGump(player, quest, MondainQuestGump.Section.Complete, false, true, (MondainQuester)vendor));
                                }
                                else
                                {
                                    player.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));
                                }
                            }

                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Пример #7
0
        public static void CompleteQuest(PlayerMobile from, BaseQuest quest)
        {
            if (quest == null)
            {
                return;
            }

            for (int i = 0; i < quest.Objectives.Count; i++)
            {
                BaseObjective obj = quest.Objectives[i];

                obj.Complete();
            }

            from.SendLocalizedMessage(1046258, null, 0x23);               // Your quest is complete.
            from.CloseGump(typeof(BaseQuestGump));
            from.SendGump(new MLQuestFinishGump(from, quest));
            from.PlaySound(quest.CompleteSound);

            quest.OnCompleted();
        }
Пример #8
0
        public static bool TryDeleteItems(BaseQuest quest)
        {
            if (quest == null)
            {
                return(false);
            }

            for (int i = 0; i < quest.Objectives.Count; i++)
            {
                if (quest.Objectives[i] is ObtainObjective)
                {
                    ObtainObjective obtain = (ObtainObjective)quest.Objectives[i];

                    if (obtain.MaxProgress > CountQuestItems(quest.Owner, obtain.Obtain))
                    {
                        return(false);
                    }
                }
                else if (quest.Objectives[i] is DeliverObjective)
                {
                    DeliverObjective deliver = (DeliverObjective)quest.Objectives[i];

                    if (quest.StartingItem != null)
                    {
                        continue;
                    }
                    else if (deliver.MaxProgress > CountQuestItems(quest.Owner, deliver.Delivery))
                    {
                        quest.Owner.SendLocalizedMessage(1074813);                            // You have failed to complete your delivery.
                        deliver.Fail();

                        return(false);
                    }
                }
            }

            DeleteItems(quest);

            return(true);
        }
Пример #9
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);
        }
Пример #10
0
        public virtual void RefuseRewards()
        {
            // remove quest
            if (NextQuest == null)
            {
                RemoveQuest(true);
            }
            else
            {
                RemoveQuest();
            }

            // offer next quest if present
            if (NextQuest != null)
            {
                BaseQuest quest = QuestHelper.RandomQuest(m_Owner, new Type[] { NextQuest }, StartingMobile);

                if (quest != null && quest.ChainID == ChainID)
                {
                    m_Owner.SendGump(new MondainQuestGump(quest));
                }
            }
        }
Пример #11
0
        public virtual void SecMain()
        {
            if (m_From == null)
            {
                return;
            }

            AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false); // Quest Log

            int offset = 140;

            for (int i = m_From.Quests.Count - 1; i >= 0; i--)
            {
                BaseQuest quest = m_From.Quests[i];

                AddHtmlObject(98, offset, 270, 21, quest.Title, quest.Failed ? 0x3C00 : White, false, false);
                AddButton(368, offset, 0x26B0, 0x26B1, ButtonOffset + i, GumpButtonType.Reply, 0);

                offset += 21;
            }

            AddButton(313, 455, 0x2EEC, 0x2EEE, (int)Buttons.Close, GumpButtonType.Reply, 0);
        }
Пример #12
0
        public static List <BaseQuest> Quests(GenericReader reader, PlayerMobile player)
        {
            List <BaseQuest> quests = new List <BaseQuest>();

            int count = reader.ReadInt();

            for (int i = 0; i < count; i++)
            {
                BaseQuest quest = Construct(reader) as BaseQuest;

                if (quest == null)
                {
                    continue;
                }

                quest.Owner = player;
                quest.Deserialize(reader);

                quests.Add(quest);
            }

            return(quests);
        }
        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);
        }
Пример #14
0
        public static bool Delayed(PlayerMobile player, BaseQuest quest, bool message)
        {
            List <QuestRestartInfo> doneQuests = player.DoneQuests;

            for (int i = doneQuests.Count - 1; i >= 0; i--)
            {
                QuestRestartInfo restartInfo = doneQuests[i];

                if (restartInfo.QuestType == quest.GetType())
                {
                    if (quest.DoneOnce)
                    {
                        if (message && quest.StartingMobile != null)
                        {
                            quest.StartingMobile.Say(1075454);                               // I can not offer you the quest again.
                        }
                        return(false);
                    }

                    DateTime endTime = restartInfo.RestartTime;

                    if (DateTime.Now < endTime)
                    {
                        return(false);
                    }

                    if (quest.RestartDelay > TimeSpan.Zero)
                    {
                        doneQuests.RemoveAt(i);
                    }

                    return(true);
                }
            }

            return(true);
        }
Пример #15
0
        public static Type FindFirstChainQuest(BaseQuest quest)
        {
            if (quest == null)
            {
                return(null);
            }

            Type[] quests = null;

            if (quest.Quester is MondainQuester)
            {
                MondainQuester mQuester = (MondainQuester)quest.Quester;

                quests = mQuester.Quests;
            }
            else if (quest.Quester is BaseQuestItem)
            {
                BaseQuestItem iQuester = (BaseQuestItem)quest.Quester;

                quests = iQuester.Quests;
            }

            if (quests != null)
            {
                for (int i = 0; i < quests.Length; i++)
                {
                    BaseQuest fQuest = Construct(quests[i]) as BaseQuest;

                    if (fQuest != null && fQuest.ChainID == quest.ChainID)
                    {
                        return(fQuest.GetType());
                    }
                }
            }

            return(null);
        }
Пример #16
0
        public static void RemoveStatus(PlayerMobile from, Item item)
        {
            for (int i = from.Quests.Count - 1; i >= 0; i--)
            {
                BaseQuest quest = from.Quests[i];

                for (int j = quest.Objectives.Count - 1; j >= 0; j--)
                {
                    if (quest.Objectives[j] is ObtainObjective)
                    {
                        ObtainObjective obtain = (ObtainObjective)quest.Objectives[j];

                        if (obtain.Obtain != null && obtain.Obtain.IsAssignableFrom(item.GetType()))
                        {
                            obtain.CurProgress -= item.Amount;
                            item.QuestItem      = false;
                            from.SendLocalizedMessage(1074769);                               // An item must be in your backpack (and not in a container within) to be toggled as a quest item.
                            return;
                        }
                    }
                    else if (quest.Objectives[j] is DeliverObjective)
                    {
                        DeliverObjective deliver = (DeliverObjective)quest.Objectives[j];

                        if (deliver.Delivery != null && deliver.Delivery.IsAssignableFrom(item.GetType()))
                        {
                            from.SendLocalizedMessage(1074813);                                // You have failed to complete your delivery.
                            DeleteItems(from, deliver.Delivery, deliver.MaxProgress, false);
                            deliver.Fail();
                            item.Delete();
                            return;
                        }
                    }
                }
            }
        }
Пример #17
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);
        }
Пример #18
0
        public static bool TryDeleteItems(BaseQuest quest)
        {
            if (quest == null)
                return false;
				
            for (int i = 0; i < quest.Objectives.Count; i ++)
            {
                if (quest.Objectives[i] is ObtainObjective)
                {
                    ObtainObjective obtain = (ObtainObjective)quest.Objectives[i];
					
                    if (obtain.MaxProgress > CountQuestItems(quest.Owner, obtain.Obtain))
                        return false;
                }
                else if (quest.Objectives[i] is DeliverObjective)
                {
                    DeliverObjective deliver = (DeliverObjective)quest.Objectives[i];
					
                    if (quest.StartingItem != null)
                        continue;
                    else if (deliver.MaxProgress > CountQuestItems(quest.Owner, deliver.Delivery))
                    { 
                        quest.Owner.SendLocalizedMessage(1074813);  // You have failed to complete your delivery.
                        deliver.Fail();
						
                        return false;
                    }
                }
            }
			
            DeleteItems(quest);
			
            return true;
        }
Пример #19
0
 public static bool FirstChainQuest(BaseQuest quest, object quester)
 {
     return(quest != null && BaseChain.Chains[(int)quest.ChainID] != null && BaseChain.Chains[(int)quest.ChainID].Length > 0 && BaseChain.Chains[(int)quest.ChainID][0] == quest.GetType());
 }
Пример #20
0
 public static bool InChainProgress(PlayerMobile pm, BaseQuest quest)
 {
     return(pm.Quests.Any(q => q.ChainID != QuestChain.None && q.ChainID == quest.ChainID && q.GetType() != quest.GetType()));
 }
Пример #21
0
 public MondainQuestGump(BaseQuest quest)
     : this(quest, Section.Description, true)
 {
 }
Пример #22
0
        public static void DeleteItems(BaseQuest quest)
        { 
            for (int i = 0; i < quest.Objectives.Count; i ++)
            { 
                BaseObjective objective = quest.Objectives[i];				
			
                DeleteItems(quest.Owner, objective.Type(), objective.MaxProgress, true);
                RemoveStatus(quest.Owner, objective.Type());		
            }
        }
Пример #23
0
        public static bool AnyRewards(BaseQuest quest)
        {
            for (int i = 0; i < quest.Rewards.Count; i ++)
            {
                BaseReward reward = quest.Rewards[i];
				
                if (reward.Type != null)
                    return true;
            }
			
            return false;
        }
Пример #24
0
        public static bool Delayed(PlayerMobile player, BaseQuest quest, bool message)
        {
            List<QuestRestartInfo> doneQuests = player.DoneQuests;
																					
            for (int i = doneQuests.Count - 1; i >= 0; i --)
            { 
                QuestRestartInfo restartInfo = doneQuests[i];

                if (restartInfo.QuestType == quest.GetType())
                {
                    if (quest.DoneOnce)
                    {
                        if (message && quest.StartingMobile != null)
                            quest.StartingMobile.Say(1075454); // I can not offer you the quest again.
					
                        return false;
                    }
						
                    DateTime endTime = restartInfo.RestartTime;
					
                    if (DateTime.UtcNow < endTime)
                        return false;
					
                    if (quest.RestartDelay > TimeSpan.Zero)
                        doneQuests.RemoveAt(i);
													
                    return true;
                }
            }
			
            return true;
        }
Пример #25
0
        public static Type FindFirstChainQuest(BaseQuest quest)
        {
            if (quest == null)
                return null;
				
            Type[] quests = null;
		
            if (quest.Quester is MondainQuester)
            {
                MondainQuester mQuester = (MondainQuester)quest.Quester;
				
                quests = mQuester.Quests;
            }
            else if (quest.Quester is BaseQuestItem)
            {
                BaseQuestItem iQuester = (BaseQuestItem)quest.Quester;
				
                quests = iQuester.Quests;
            }
			
            if (quests != null)
            {
                for (int i = 0; i < quests.Length; i ++)
                {
                    BaseQuest fQuest = Construct(quests[i]) as BaseQuest;
					
                    if (fQuest != null && fQuest.ChainID == quest.ChainID)
                        return fQuest.GetType();
                }
            }
			
            return null;
        }
Пример #26
0
 private void AddDetail(BaseQuest quest)
 {
     AddLabel(90, 75, GreenHue, "Title");
     AddHtml(90, 95, 185, 50, quest.Title, 0x20, true, true);
     AddLabel(280, 75, GreenHue, "Chain ID");
     AddHtml(280, 95, 185, 50, quest.ChainID.ToString(), 0x20, true, true);
     AddLabel(90, 150, GreenHue, "Description");
     AddHtml(90, 170, 380, 100, quest.Description, 0x20, true, true);
     AddLabel(90, 275, GreenHue, "Refuse");
     AddHtml(90, 295, 380, 100, quest.Refuse, 0x20, true, true);
     AddLabel(90, 400, GreenHue, "Complete");
     AddHtml(90, 420, 380, 100, quest.Complete, 0x20, true, true);
     AddLabel(90, 525, GreenHue, "Uncomplete");
     AddHtml(90, 545, 380, 100, quest.Uncomplete, 0x20, true, true);
 }
Пример #27
0
        public MLQuestLogGump(BaseQuest quest)
            : base(75, 25)
        {
            m_Quest = quest;

            Intern("");

            AddPage(1);

            Closable = false;

            AddImageTiled(50, 20, 400, 400, 0x1404);
            AddImageTiled(50, 29, 30, 390, 0x28DC);
            AddImageTiled(34, 140, 17, 279, 0x242F);
            AddImage(48, 135, 0x28AB);
            AddImage(-16, 285, 0x28A2);
            AddImage(0, 10, 0x28B5);
            AddImage(25, 0, 0x28B4);
            AddImageTiled(83, 15, 350, 15, 0x280A);
            AddImage(34, 419, 0x2842);
            AddImage(442, 419, 0x2840);
            AddImageTiled(51, 419, 392, 17, 0x2775);
            AddImageTiled(415, 29, 44, 390, 0xA2D);
            AddImageTiled(415, 29, 30, 390, 0x28DC);
            AddLabelIntern(100, 50, 0x481, 0);
            AddImage(370, 50, 0x589);
            AddImage(379, 60, 0x15A9);
            AddImage(425, 0, 0x28C9);
            AddImage(90, 33, 0x232D);
            AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false);          // Quest Log
            AddImageTiled(130, 65, 175, 1, 0x238D);
            AddButton(95, 395, 0x2EF5, 0x2EF7, 1, GumpButtonType.Reply, 0);               // Resign
            AddButton(313, 395, 0x2EEC, 0x2EEE, 2, GumpButtonType.Reply, 0);              // Okay

            if (m_Quest.Failed)
            {
                AddHtmlLocalized(160, 80, 250, 16, 500039, 0x3C00, false, false);                   // Failed!
            }
            AddHtmlLocalized(130, 68, 220, 48, 1114513, String.Format("#{0}", quest.Title.ToString()), 0x2710, false, false);

            if (m_Quest.ChainID != QuestChain.None)
            {
                AddHtmlLocalized(98, 140, 312, 16, 1075024, 0x2710, false, false);                   // Description (quest chain)
            }
            else
            {
                AddHtmlLocalized(98, 140, 312, 16, 1072202, 0x2710, false, false);                   // Description
            }
            AddHtmlObject(98, 156, 312, 180, quest.Description, LightGreen, false, true);
            AddButton(275, 370, 0x2EE9, 0x2EEB, 0, GumpButtonType.Page, 2);               // Continue

            AddPage(2);

            Closable = false;

            AddImageTiled(50, 20, 400, 400, 0x1404);
            AddImageTiled(50, 29, 30, 390, 0x28DC);
            AddImageTiled(34, 140, 17, 279, 0x242F);
            AddImage(48, 135, 0x28AB);
            AddImage(-16, 285, 0x28A2);
            AddImage(0, 10, 0x28B5);
            AddImage(25, 0, 0x28B4);
            AddImageTiled(83, 15, 350, 15, 0x280A);
            AddImage(34, 419, 0x2842);
            AddImage(442, 419, 0x2840);
            AddImageTiled(51, 419, 392, 17, 0x2775);
            AddImageTiled(415, 29, 44, 390, 0xA2D);
            AddImageTiled(415, 29, 30, 390, 0x28DC);
            AddLabelIntern(100, 50, 0x481, 0);
            AddImage(370, 50, 0x589);
            AddImage(379, 60, 0x15A9);
            AddImage(425, 0, 0x28C9);
            AddImage(90, 33, 0x232D);

            AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false);               // Quest Log

            AddImageTiled(130, 65, 175, 1, 0x238D);

            AddButton(95, 395, 0x2EF5, 0x2EF7, 1, GumpButtonType.Reply, 0);
            AddButton(313, 395, 0x2EEC, 0x2EEE, 2, GumpButtonType.Reply, 0);

            AddHtmlLocalized(130, 68, 220, 48, 1114513, String.Format("#{0}", quest.Title.ToString()), 0x2710, false, false);

            AddButton(275, 370, 0x2EE9, 0x2EEB, 0, GumpButtonType.Page, 2);
            AddButton(130, 370, 0x2EEF, 0x2EF1, 0, GumpButtonType.Page, 1);

            AddHtmlLocalized(98, 140, 312, 16, 1049073, 0x2710, false, false);               // Objective:

            if (m_Quest.AllObjectives)
            {
                AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false);                   // All of the following
            }
            else
            {
                AddHtmlLocalized(98, 156, 312, 16, 1072209, 0x2710, false, false);                   // Only one of the following
            }
            int offset    = 172;
            int internidx = 0;

            for (int i = 0; i < m_Quest.Objectives.Count; i++)
            {
                int field = 1;

                BaseObjective objective = m_Quest.Objectives[i];

                if (objective is ObtainObjective)
                {
                    ObtainObjective obtain   = (ObtainObjective)objective;
                    string          returnTo = ReturnTo();

                    AddKRHtmlLocalized(0, 0, 0, 0, -3, false, false);

                    /*1*/
                    Intern(obtain.MaxProgress.ToString());
                    /*2*/
                    Intern(obtain.Name);
                    /*3*/
                    Intern(obtain.Timed ? obtain.Seconds.ToString() : "");
                    /*4*/
                    Intern("");
                    /*5*/
                    Intern("");
                    /*6*/
                    Intern(obtain.CurProgress.ToString());
                    /*7*/
                    Intern(returnTo);

                    AddHtmlLocalized(98, offset, 350, 16, 1072205, 0x15F90, false, false);                       // Obtain
                    AddLabelIntern(143, offset, 0x481, 1 + (internidx * 7));

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddLabelIntern(173, offset, 0x481, 2 + (internidx * 7));

                    if (obtain.Image > 0)
                    {
                        AddItem(350, offset, obtain.Image);                           // Image
                    }
                    offset += 16;

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);

                    if (obtain.Timed)
                    {
                        AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false);              // Est. time remaining:
                        AddLabelIntern(223, offset, 0x481, 3 + (internidx * 7));                             // %est. time remaining%

                        offset += 16;
                    }
                    else
                    {
                        AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                        AddKRLabel(0, 0, 0, 0, 3 + (internidx * 7), false, false);
                    }

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddKRLabel(0, 0, 0, 0, 4 + (internidx * 7), false, false);


                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddKRLabel(0, 0, 0, 0, 5 + (internidx * 7), false, false);

                    AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false);                       // Total
                    AddLabelIntern(223, offset, 0x481, 6 + (internidx * 7));

                    offset += 16;

                    AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false);                       // Return to
                    AddLabelIntern(223, offset, 0x481, 7 + (internidx * 7));

                    offset += 16;
                }
                else if (objective is SlayObjective)
                {
                    SlayObjective slay         = (SlayObjective)objective;
                    int           internOffset = internidx * 8;
                    string        returnTo     = ReturnTo();

                    AddKRHtmlLocalized(0, 0, 0, 0, -2, false, false);

                    /*1*/
                    Intern(slay.MaxProgress.ToString());
                    /*2*/
                    Intern(slay.Name);
                    /*3*/
                    Intern(slay.Timed ? slay.Seconds.ToString() : "");
                    /*4*/
                    Intern(slay.Region != null ? slay.Region.Name : "");
                    /*5*/
                    Intern("");
                    /*6*/
                    Intern("");
                    /*7*/
                    Intern(slay.CurProgress.ToString());
                    /*8*/
                    Intern(returnTo);

                    AddHtmlLocalized(98, offset, 312, 16, 1072204, 0x15F90, false, false);      // Slay
                    AddLabelIntern(133, offset, 0x481, 1 + internOffset);                       // Amount

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddLabelIntern(slay.MaxProgress > 10 ? 163 : 148, offset, 0x481, 2 + internOffset);                       // Type

                    offset += 16;

                    if (slay.Timed)
                    {
                        AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false);         // Est. time remaining:
                        AddLabelIntern(223, offset, 0x481, 3 + internOffset);                           // %est. time remaining%

                        offset += 16;
                    }
                    else
                    {
                        AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                        AddKRLabel(0, 0, 0, 0, 3 + internOffset, false, false);
                    }

                    if (slay.Region != null)
                    {
                        AddHtmlLocalized(103, offset, 312, 20, 1018327, 0x15F90, false, false);         // Location
                        AddLabelIntern(223, offset, 0x481, 4 + internOffset);                           // %est. time remaining%

                        offset += 16;
                    }
                    else
                    {
                        AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                        AddKRLabel(0, 0, 0, 0, 4 + internOffset, false, false);
                    }

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddKRLabel(0, 0, 0, 0, 5 + internOffset, false, false);

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddKRLabel(0, 0, 0, 0, 6 + internOffset, false, false);

                    AddHtmlLocalized(103, offset, 120, 16, 3000087, 0x15F90, false, false);                       // Total
                    AddLabelIntern(223, offset, 0x481, 7 + internOffset);

                    offset += 16;

                    AddHtmlLocalized(103, offset, 120, 16, 1074782, 0x15F90, false, false);                       // Return to
                    AddLabelIntern(223, offset, 0x481, 8 + internOffset);

                    offset += 16;
                }
                else if (objective is DeliverObjective)
                {
                    DeliverObjective deliver = (DeliverObjective)objective;
                    int internOffset         = internidx * 5;

                    AddKRHtmlLocalized(0, 0, 0, 0, -5, false, false);

                    AddHtmlLocalized(98, offset, 312, 16, 1072207, 0x15F90, false, false);                       // Deliver

                    Intern(deliver.MaxProgress.ToString());
                    Intern(deliver.DeliveryName);

                    AddLabelIntern(143, offset, 0x481, internOffset + 1);
                    AddLabelIntern(158, offset, 0x481, internOffset + 2);

                    offset += 16;

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);

                    if (deliver.Timed)
                    {
                        AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false);         // Est. time remaining:
                        Intern(deliver.Seconds.ToString());
                        AddLabelIntern(223, offset, 0x481, internOffset + 3);                           // %est. time remaining%

                        offset += 16;
                    }
                    else
                    {
                        AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                        AddKRLabel(0, 0, 0, 0, internOffset + 3, false, false);
                        Intern("");
                    }

                    AddHtmlLocalized(103, offset, 120, 16, 1072379, 0x15F90, false, false);                       // Deliver to
                    Intern(deliver.DestName);
                    AddLabelIntern(223, offset, 0x481, internOffset + 4);

                    offset += 16;

                    AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                    AddKRLabel(0, 0, 0, 0, internOffset + 5, false, false);
                    Intern("");
                }
                else if (objective is EscortObjective)
                {
                    EscortObjective escort = (EscortObjective)objective;

                    AddKRHtmlLocalized(0, 0, 0, 0, -4, false, false);

                    AddHtmlLocalized(98, offset, 312, 16, 1072206, 0x15F90, false, false);                       // Escort to
                    AddHtmlObject(173, offset, 312, 20, escort.Region.Name, 0xFFFFFF, false, false);

                    offset += 16;

                    if (escort.Timed)
                    {
                        AddHtmlLocalized(103, offset, 120, 16, 1062379, 0x15F90, false, false);                           // Est. time remaining:

                        Intern(escort.Seconds.ToString());

                        AddLabelIntern(223, offset, 0x481, (internidx * 3) + (field++));                               // %est. time remaining%

                        offset += 16;
                    }

                    for (int j = field; j < 3; j++)
                    {
                        AddKRHtmlLocalized(0, 0, 0, 0, 1078089, false, false);
                        AddKRLabel(0, 0, 0, 0, j, false, false);
                        Intern("");
                    }
                }
                else if (objective is ApprenticeObjective)
                {
                    ApprenticeObjective apprentice = (ApprenticeObjective)objective;

                    AddKRHtmlLocalized(0, 0, 0, 0, -9, false, false);

                    AddHtmlLocalized(98, offset, 200, 16, 1077485, "#" + (1044060 + (int)apprentice.Skill) + "\t" + apprentice.MaxProgress, 0x15F90, false, false);                          // Increase ~1_SKILL~ to ~2_VALUE~

                    offset += 16;
                }
                else if (objective is BaseBardObjective)
                {
                    BaseBardObjective bardObjective = (BaseBardObjective)objective;

                    AddHtmlLocalized(98, offset, 200, 16, bardObjective.Cliloc, 0x15F90, false, false);

                    offset += 16;
                }

                internidx++;
            }

            AddButton(275, 370, 0x2EE9, 0x2EEB, 0, GumpButtonType.Page, 3);

            AddPage(3);

            Closable = false;

            AddImageTiled(50, 20, 400, 400, 0x1404);
            AddImageTiled(50, 29, 30, 390, 0x28DC);
            AddImageTiled(34, 140, 17, 279, 0x242F);
            AddImage(48, 135, 0x28AB);
            AddImage(-16, 285, 0x28A2);
            AddImage(0, 10, 0x28B5);
            AddImage(25, 0, 0x28B4);
            AddImageTiled(83, 15, 350, 15, 0x280A);
            AddImage(34, 419, 0x2842);
            AddImage(442, 419, 0x2840);
            AddImageTiled(51, 419, 392, 17, 0x2775);
            AddImageTiled(415, 29, 44, 390, 0xA2D);
            AddImageTiled(415, 29, 30, 390, 0x28DC);
            AddLabelIntern(100, 50, 0x481, 0);
            AddImage(370, 50, 0x589);
            AddImage(379, 60, 0x15A9);
            AddImage(425, 0, 0x28C9);
            AddImage(90, 33, 0x232D);
            AddHtmlLocalized(130, 45, 270, 16, 1046026, 0xFFFFFF, false, false);               // Quest Log
            AddImageTiled(130, 65, 175, 1, 0x238D);
            AddButton(95, 395, 0x2EF5, 0x2EF7, 1, GumpButtonType.Reply, 0);
            AddButton(313, 395, 0x2EEC, 0x2EEE, 2, GumpButtonType.Reply, 0);
            AddHtmlLocalized(130, 68, 220, 48, 1114513, String.Format("#{0}", quest.Title.ToString()), 0x2710, false, false);
            AddButton(130, 370, 0x2EEF, 0x2EF1, 0, GumpButtonType.Page, 2);
            AddHtmlLocalized(98, 140, 312, 16, 1072201, 0x2710, false, false);               // Reward

            if (quest.Rewards.Count == 1)
            {
                BaseReward reward = m_Quest.Rewards[0];

                AddImage(105, 163, 0x4B9);
                AddHtmlObject(133, 162, 280, 32, reward.Name, 0x15F90, false, false);
            }
            else
            {
                AddHtmlLocalized(98, 156, 312, 16, 1072208, 0x2710, false, false);                   // All of the following

                for (int n = 0; n < quest.Rewards.Count; ++n)
                {
                    BaseReward reward = m_Quest.Rewards[n];

                    AddImage(105, 179 + (n * 16), 0x4B9);
                    AddHtmlObject(133, 178 + (n * 16), 280, 32, reward.Name, 0x15F90, false, false);
                }
            }
        }
Пример #28
0
 public MondainQuestGump(BaseQuest quest, Section section, bool offer)
     : this(null, quest, section, offer, false)
 {
 }
Пример #29
0
 public MondainQuestGump(BaseQuest quest, Section section, bool offer, bool completed)
     : this(null, quest, section, offer, completed)
 {
 }
Пример #30
0
 public MondainQuestGump(BaseQuest quest)
     : this(quest, Section.Description, true)
 {
 }
Пример #31
0
 public MLQuestFinishGump(PlayerMobile pm, BaseQuest quest)
     : this(pm, quest, null)
 {
 }
Пример #32
0
 public MondainQuestGump(BaseQuest quest, Section section, bool offer, bool completed)
     : this(null, quest, section, offer, completed)
 {
 }
Пример #33
0
 public MondainQuestGump(PlayerMobile owner, BaseQuest quest, Section section, bool offer, bool completed)
     : this(owner, quest, section, offer, completed, null)
 {
 }
Пример #34
0
        public MondainQuestGump(PlayerMobile owner, BaseQuest quest, Section section, bool offer, bool completed, object quester)
            : base(75, 25)
        {
            m_Quester   = quester;
            m_Quest     = quest;
            m_Section   = section;
            m_Offer     = offer;
            m_Completed = completed;

            if (quest != null)
            {
                m_From = quest.Owner;
            }
            else
            {
                m_From = owner;
            }

            Closable   = false;
            Disposable = true;
            Dragable   = true;
            Resizable  = false;

            AddPage(0);

            AddImageTiled(50, 20, 400, 460, 0x1404);
            AddImageTiled(50, 29, 30, 450, 0x28DC);
            AddImageTiled(34, 140, 17, 339, 0x242F);
            AddImage(48, 135, 0x28AB);
            AddImage(-16, 285, 0x28A2);
            AddImage(0, 10, 0x28B5);
            AddImage(25, 0, 0x28B4);
            AddImageTiled(83, 15, 350, 15, 0x280A);
            AddImage(34, 479, 0x2842);
            AddImage(442, 479, 0x2840);
            AddImageTiled(51, 479, 392, 17, 0x2775);
            AddImageTiled(415, 29, 44, 450, 0xA2D);
            AddImageTiled(415, 29, 30, 450, 0x28DC);
            AddImage(370, 50, 0x589);

            if ((int)m_From.AccessLevel > (int)AccessLevel.Counselor && quest != null)
            {
                AddButton(379, 60, 0x15A9, 0x15A9, (int)Buttons.CompleteQuest, GumpButtonType.Reply, 0);
            }
            else
            {
                if (m_Quest == null)
                {
                    AddImage(379, 60, 0x15A9);
                }
                else if (!m_Quest.ShowDescription)
                {
                    AddImage(379, 60, 0x15E8);
                }
            }

            AddImage(425, 0, 0x28C9);
            AddImage(90, 33, 0x232D);
            AddImageTiled(130, 65, 175, 1, 0x238D);

            switch (m_Section)
            {
            case Section.Main:
                SecMain();
                break;

            case Section.Description:
                SecDescription();
                break;

            case Section.Objectives:
                SecObjectives();
                break;

            case Section.Rewards:
                SecRewards();
                break;

            case Section.Refuse:
                SecRefuse();
                break;

            case Section.Complete:
                SecComplete();
                break;

            case Section.InProgress:
                SecInProgress();
                break;

            case Section.Failed:
                SecFailed();
                break;
            }
        }
Пример #35
0
        public static bool FirstChainQuest(BaseQuest quest, object quester)
        {
            Type[] quests = null;
		
            if (quester is MondainQuester)
            {
                MondainQuester mQuester = (MondainQuester)quester;
				
                quests = mQuester.Quests;
            }
            else if (quester is BaseQuestItem)
            {
                BaseQuestItem iQuester = (BaseQuestItem)quester;
				
                quests = iQuester.Quests;
            }
			
            if (quests != null)
            {
                for (int i = 0; i < quests.Length; i ++)
                {
                    if (quests[i] == quest.GetType())
                        return true;
                }
            }
			
            return false;
        }
Пример #36
0
        public MondainQuestGump(PlayerMobile owner, BaseQuest quest, Section section, bool offer, bool completed, object quester)
            : base(75, 25)
        {
            m_Quester   = quester;
            m_Quest     = quest;
            m_Section   = section;
            m_Offer     = offer;
            m_Completed = completed;

            if (quest != null)
            {
                m_From            = quest.Owner;
                m_IsQuestionQuest = quest.IsQuestionQuest;
            }
            else
            {
                m_From = owner;
            }

            AddPage(++Page);

            if (m_IsQuestionQuest)
            {
                Disposable = false;
                Closable   = false;

                AddImageTiled(50, 20, 400, 400, 0x1404);
                AddImageTiled(83, 15, 350, 15, 0x280A);
                AddImageTiled(50, 29, 30, 390, 0x28DC);
                AddImageTiled(34, 140, 17, 279, 0x242F);
                AddImage(48, 135, 0x28AB);
                AddImage(-16, 285, 0x28A2);
                AddImage(0, 10, 0x28B5);
                AddImage(25, 0, 0x28B4);
                AddImageTiled(415, 29, 44, 390, 0xA2D);
                AddImageTiled(415, 29, 30, 390, 0x28DC);
                AddLabel(100, 50, 0x481, "");
                AddImage(370, 50, 0x589);
                AddImage(379, 60, 0x15E8);
                AddImage(425, 0, 0x28C9);
                AddImage(34, 419, 0x2842);
                AddImage(442, 419, 0x2840);
                AddImageTiled(51, 419, 392, 17, 0x2775);
                AddImage(90, 33, 0x232D);
                AddImageTiled(130, 65, 175, 1, 0x238D);

                SecQuestionHeader();

                switch (m_Section)
                {
                case Section.Description:
                    SecQuestionDescription();
                    break;

                case Section.Objectives:
                    SecQuestionObjectives();
                    break;

                case Section.Refuse:
                    SecQuestionRefuse();
                    break;

                case Section.Failed:
                    SecQuestionFailed();
                    break;

                case Section.Complete:
                    SecQuestionComplete();
                    break;
                }
            }
            else
            {
                switch (m_Section)
                {
                case Section.Main:
                    SecMain();
                    break;

                case Section.Description:
                    SecDescription();
                    SecObjectives();
                    SecRewards();
                    break;

                case Section.Refuse:
                    SecRefuse();
                    break;

                case Section.Complete:
                    SecComplete();
                    break;

                case Section.Rewards:
                    SecCompleteRewards();
                    break;

                case Section.InProgress:
                    SecInProgress();
                    break;
                }
            }
        }
Пример #37
0
        public override void OnTalk(PlayerMobile player)
        {
            if (QuestHelper.DeliveryArrived(player, this))
            {
                return;
            }
            else if (QuestHelper.InProgress(player, this))
            {
                return;
            }
            else if (QuestHelper.QuestLimitReached(player))
            {
                return;
            }

            BlueSpellInfo.UpdateTitle(player);

            BaseQuest quest = null;

            if (player.Skills[SkillName.Forensics].Base < 51.0)
            {
                quest = QuestHelper.RandomQuest(player, new Type[] { typeof(BlueMageTrainingQuest) }, this);
            }
            else if (!BlueMageControl.IsBlueMage(player))
            {
                if (!QuestHelper.InProgress(player, this))
                {
                    player.CloseGump(typeof(BlueMageQuestionsGump));
                    player.SendGump(new BlueMageQuestionsGump(player, this));
                }
                else
                {
                    Say("You need to seek your mark.");
                }
            }
            else
            {
                List <Type> types = new List <Type>();
                types.Add(typeof(BlueMageTierOneSlayerQuest));
                types.Add(typeof(BlueMageTierTwoSlayerQuest));
                types.Add(typeof(BlueMageTierThreeSlayerQuest));
                //types.Add( typeof( FindingQuinaQuest ) );

                //if ( BlueSpellInfo.KnowsAllMoves( player ) )
                //{
                //types.Add( typeof( BattleKaysaQuest ) );
                //types.Add( typeof( BattleRakdosQuest ) );

                //if ( BlueSpellInfo.KnowsAllSpells( player ) )
                //{
                // types.Add( typeof( BattleTalimQuest ) );
                //}
                //}

                //if ( BlueSpellInfo.KnowsAllSpells( player ) )
                //{
                //types.Add( typeof( BattleMatoQuest ) );
                //types.Add( typeof( BattleMarkovQuest ) );
                //}

                quest = QuestHelper.RandomQuest(player, types.ToArray(), this);
            }

            if (quest != null)
            {
                player.CloseGump(typeof(MondainQuestGump));
                player.SendGump(new MondainQuestGump(quest));
            }
        }
Пример #38
0
 public MondainQuestGump(BaseQuest quest, Section section, bool offer)
     : this(null, quest, section, offer, false)
 {
 }
Пример #39
0
        public static void CompleteQuest(PlayerMobile from, BaseQuest quest)
        {
            if (quest == null)
                return;
				
            for (int i = 0; i < quest.Objectives.Count; i ++)
            {
                BaseObjective obj = quest.Objectives[i];
				
                obj.Complete();
            }
			
            from.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete.							
            from.SendGump(new MondainQuestGump(quest, MondainQuestGump.Section.Complete, false, true));							
            from.PlaySound(quest.CompleteSound);
			
            quest.OnCompleted();
        }
Пример #40
0
 public MondainQuestGump(PlayerMobile owner, BaseQuest quest, Section section, bool offer, bool completed)
     : this(owner, quest, section, offer, completed, null)
 {
 }
Пример #41
0
        public virtual void GiveRewards()
        {
            // give rewards
            for (int i = 0; i < this.m_Rewards.Count; i++)
            {
                Type type = this.m_Rewards[i].Type;

                this.m_Rewards[i].GiveReward();

                if (type == null)
                {
                    continue;
                }

                Item reward;

                try
                {
                    reward = Activator.CreateInstance(type) as Item;
                }
                catch
                {
                    reward = null;
                }

                if (reward != null)
                {
                    if (reward.Stackable)
                    {
                        reward.Amount            = this.m_Rewards[i].Amount;
                        this.m_Rewards[i].Amount = 1;
                    }

                    for (int j = 0; j < this.m_Rewards[i].Amount; j++)
                    {
                        if (!this.m_Owner.PlaceInBackpack(reward))
                        {
                            reward.MoveToWorld(this.m_Owner.Location);
                        }

                        if (this.m_Rewards[i].Name is int)
                        {
                            this.m_Owner.SendLocalizedMessage(1074360, "#" + (int)this.m_Rewards[i].Name); // You receive a reward: ~1_REWARD~
                        }
                        else if (this.m_Rewards[i].Name is string)
                        {
                            this.m_Owner.SendLocalizedMessage(1074360, (string)this.m_Rewards[i].Name); // You receive a reward: ~1_REWARD~
                        }
                    }
                }
            }

            // remove quest
            if (this.NextQuest == null)
            {
                this.RemoveQuest(true);
            }
            else
            {
                this.RemoveQuest();
            }

            // offer next quest if present
            if (this.NextQuest != null)
            {
                BaseQuest quest = QuestHelper.RandomQuest(this.m_Owner, new Type[] { this.NextQuest }, this.StartingMobile);

                if (quest != null && quest.ChainID == this.ChainID)
                {
                    this.m_Owner.SendGump(new MondainQuestGump(quest));
                }
            }

            Server.Engines.Points.PointsSystem.HandleQuest(Owner, this);
        }
Пример #42
0
        public virtual void GiveRewards()
        {
            // give rewards
            for (int i = 0; i < m_Rewards.Count; i++)
            {
                Type type = m_Rewards[i].Type;

                m_Rewards[i].GiveReward();

                if (type == null)
                {
                    continue;
                }

                Item reward;

                try
                {
                    reward = Activator.CreateInstance(type) as Item;
                }
                catch (Exception e)
                {
                    Server.Diagnostics.ExceptionLogging.LogException(e);
                    reward = null;
                }

                if (reward != null)
                {
                    if (reward.Stackable)
                    {
                        reward.Amount       = m_Rewards[i].Amount;
                        m_Rewards[i].Amount = 1;
                    }

                    for (int j = 0; j < m_Rewards[i].Amount; j++)
                    {
                        if (!m_Owner.PlaceInBackpack(reward))
                        {
                            reward.MoveToWorld(m_Owner.Location, m_Owner.Map);
                        }

                        if (m_Rewards[i].Name is int)
                        {
                            m_Owner.SendLocalizedMessage(1074360, "#" + (int)m_Rewards[i].Name); // You receive a reward: ~1_REWARD~
                        }
                        else if (m_Rewards[i].Name is string)
                        {
                            m_Owner.SendLocalizedMessage(1074360, (string)m_Rewards[i].Name); // You receive a reward: ~1_REWARD~
                        }
                        // already marked, we need to see if this gives progress to another quest.
                        if (reward.QuestItem)
                        {
                            QuestHelper.CheckRewardItem(Owner, reward);
                        }
                    }
                }
            }

            // remove quest
            if (NextQuest == null)
            {
                RemoveQuest(true);
            }
            else
            {
                RemoveQuest();
            }

            // offer next quest if present
            if (NextQuest != null)
            {
                BaseQuest quest = QuestHelper.RandomQuest(m_Owner, new Type[] { NextQuest }, StartingMobile);

                if (quest != null && quest.ChainID == ChainID)
                {
                    m_Owner.SendGump(new MondainQuestGump(quest));
                }
            }

            if (this is ITierQuest)
            {
                TierQuestInfo.CompleteQuest(Owner, (ITierQuest)this);
            }

            EventSink.InvokeQuestComplete(new QuestCompleteEventArgs(Owner, GetType()));
        }
Пример #43
0
 public static bool CheckDoneOnce(PlayerMobile player, BaseQuest quest, Mobile quester, bool message)
 {
     return(quest.DoneOnce && CheckDoneOnce(player, quest.GetType(), quester, message));
 }
Пример #44
0
        public virtual void GiveRewards()
        {
            // give rewards
            for (int i = 0; i < m_Rewards.Count; i++)
            {
                Type type = m_Rewards[i].Type;

                m_Rewards[i].GiveReward();

                if (type == null)
                {
                    continue;
                }

                Item reward;

                try { reward = Activator.CreateInstance(type) as Item; }
                catch { reward = null; }

                if (reward != null)
                {
                    if (reward.Stackable)
                    {
                        reward.Amount       = m_Rewards[i].Amount;
                        m_Rewards[i].Amount = 1;
                    }

                    for (int j = 0; j < m_Rewards[i].Amount; j++)
                    {
                        if (!m_Owner.PlaceInBackpack(reward))
                        {
                            reward.MoveToWorld(m_Owner.Location);
                        }

                        if (m_Rewards[i].Name is int)
                        {
                            m_Owner.SendLocalizedMessage(1074360, "#" + (int)m_Rewards[i].Name);                                // You receive a reward: ~1_REWARD~
                        }
                        else if (m_Rewards[i].Name is string)
                        {
                            m_Owner.SendLocalizedMessage(1074360, (string)m_Rewards[i].Name);                                // You receive a reward: ~1_REWARD~
                        }
                    }
                }
            }

            // remove quest
            if (NextQuest == null)
            {
                RemoveQuest(true);
            }
            else
            {
                RemoveQuest();
            }

            // offer next quest if present
            if (NextQuest != null)
            {
                BaseQuest quest = QuestHelper.RandomQuest(m_Owner, new Type[] { NextQuest }, StartingMobile);

                if (quest != null && quest.ChainID == ChainID)
                {
                    m_Owner.CloseGump(typeof(BaseQuestGump));
                    m_Owner.SendGump(new MLQuestOfferGump(quest));
                }
            }
        }
Пример #45
0
        public MondainQuestGump(PlayerMobile owner, BaseQuest quest, Section section, bool offer, bool completed, object quester)
            : base(75, 25)
        {
            this.m_Quester = quester;
            this.m_Quest = quest;
            this.m_Section = section;
            this.m_Offer = offer;
            this.m_Completed = completed;
			
            if (quest != null)
                this.m_From = quest.Owner;
            else
                this.m_From = owner;
		
            this.Closable = false;
            this.Disposable = true;
            this.Dragable = true;
            this.Resizable = false;
			
            this.AddPage(0);

            AddImageTiled(50, 20, 400, 460, 0x1404);
            AddImageTiled(50, 29, 30, 450, 0x28DC);
            AddImageTiled(34, 140, 17, 339, 0x242F);
            AddImage(48, 135, 0x28AB);
            AddImage(-16, 285, 0x28A2);
            AddImage(0, 10, 0x28B5);
            AddImage(25, 0, 0x28B4);
            AddImageTiled(83, 15, 350, 15, 0x280A);
            AddImage(34, 479, 0x2842);
            AddImage(442, 479, 0x2840);
            AddImageTiled(51, 479, 392, 17, 0x2775);
            AddImageTiled(415, 29, 44, 450, 0xA2D);
            AddImageTiled(415, 29, 30, 450, 0x28DC);
            AddImage(370, 50, 0x589);
			
            if ((int)this.m_From.AccessLevel > (int)AccessLevel.Counselor && quest != null)
                this.AddButton(379, 60, 0x15A9, 0x15A9, (int)Buttons.CompleteQuest, GumpButtonType.Reply, 0);
            else
                this.AddImage(379, 60, 0x15A9);
						
            this.AddImage(425, 0, 0x28C9);
            this.AddImage(90, 33, 0x232D);
            this.AddImageTiled(130, 65, 175, 1, 0x238D);
			
            switch ( this.m_Section )
            {
                case Section.Main:
                    this.SecMain();
                    break;
                case Section.Description:
                    this.SecDescription();
                    break;
                case Section.Objectives:
                    this.SecObjectives();
                    break; 
                case Section.Rewards:
                    this.SecRewards();
                    break;
                case Section.Refuse:
                    this.SecRefuse();
                    break;
                case Section.Complete:
                    this.SecComplete();
                    break;
                case Section.InProgress:
                    this.SecInProgress();
                    break;
                case Section.Failed:
                    SecFailed();
                    break;
            }
        }