public static Dictionary <QuestChain, BaseChain> Chains(GenericReader reader) { var chains = new Dictionary <QuestChain, BaseChain>(); if (reader == null) { return(chains); } Version(reader); var count = reader.ReadInt(); for (var i = 0; i < count; i++) { var chain = reader.ReadInt(); var quest = Type(reader); var quester = Type(reader); if (Enum.IsDefined(typeof(QuestChain), chain) && quest != null && quester != null) { chains[(QuestChain)chain] = new BaseChain(quest, quester); } } return(chains); }
public override void OnDoubleClick(Mobile from) { if (!this.IsChildOf(from.Backpack) && this.Movable) { from.SendLocalizedMessage(1060640); // The item must be in your backpack to use it. return; } if (!(from is PlayerMobile)) { return; } PlayerMobile player = (PlayerMobile)from; if (QuestHelper.InProgress(player, this.Quests)) { return; } if (QuestHelper.QuestLimitReached(player)) { return; } // check if this quester can offer quest chain (already started) foreach (KeyValuePair <QuestChain, BaseChain> pair in player.Chains) { BaseChain chain = pair.Value; if (chain != null && chain.Quester != null && chain.Quester.IsAssignableFrom(this.GetType())) { BaseQuest quest = QuestHelper.RandomQuest(player, new Type[] { chain.CurrentQuest }, this); if (quest != null) { player.CloseGump(typeof(NewQuestGump)); player.SendGump(new NewQuestGump(quest)); return; } } } BaseQuest questt = QuestHelper.RandomQuest(player, this.Quests, this); if (questt != null) { player.CloseGump(typeof(NewQuestGump)); player.SendGump(new NewQuestGump(questt)); } else { player.SendLocalizedMessage(1075141); // You are too busy with other tasks at this time. } }
public static void AddChain(PlayerMobile pm, QuestChain id, BaseChain chain) { if (pm == null) { return; } if (!ChainData.ContainsKey(pm) || ChainData[pm] == null) { ChainData[pm] = new Dictionary <QuestChain, BaseChain>(); } ChainData[pm].Add(id, chain); }
public virtual void OnTalk(PlayerMobile player) { if (player.Quests.Count >= 10) { SayTo(player, 1156899, 0x3B2); // You are too busy with your other quests, perhaps I will have something for you after you finish one of your current quests. return; } if (QuestHelper.DeliveryArrived(player, this)) { return; } if (QuestHelper.InProgress(player, this)) { return; } if (QuestHelper.QuestLimitReached(player)) { return; } // check if this quester can offer any quest chain (already started) foreach (KeyValuePair <QuestChain, BaseChain> pair in player.Chains) { BaseChain chain = pair.Value; if (chain != null && chain.Quester != null && chain.Quester == GetType()) { BaseQuest quest = QuestHelper.RandomQuest(player, new[] { chain.CurrentQuest }, this); if (quest != null) { player.CloseGump(typeof(MondainQuestGump)); player.SendGump(new MondainQuestGump(quest)); return; } } } BaseQuest questt = QuestHelper.RandomQuest(player, Quests, this); if (questt != null) { player.CloseGump(typeof(MondainQuestGump)); player.SendGump(new MondainQuestGump(questt)); } }
public virtual void UpdateChain() { if (ChainID != QuestChain.None && StartingMobile != null) { if (m_Owner.Chains.ContainsKey(ChainID)) { BaseChain chain = m_Owner.Chains[ChainID]; chain.CurrentQuest = GetType(); chain.Quester = StartingMobile.GetType(); } else { m_Owner.Chains.Add(ChainID, new BaseChain(GetType(), StartingMobile.GetType())); } } }
public virtual void UpdateChain() { if (this.ChainID != QuestChain.None && this.StartingMobile != null) { if (this.m_Owner.Chains.ContainsKey(this.ChainID)) { BaseChain chain = this.m_Owner.Chains[this.ChainID]; chain.CurrentQuest = this.GetType(); chain.Quester = this.StartingMobile.GetType(); } else { this.m_Owner.Chains.Add(this.ChainID, new BaseChain(this.GetType(), this.StartingMobile.GetType())); } } }
public virtual void OnTalk(PlayerMobile player) { if (QuestHelper.DeliveryArrived(player, this)) { return; } if (QuestHelper.InProgress(player, this)) { return; } if (QuestHelper.QuestLimitReached(player)) { return; } Direction = this.GetDirectionTo(player); // check if this quester can offer any quest chain (already started) foreach (KeyValuePair <QuestChain, BaseChain> pair in player.Chains) { BaseChain chain = pair.Value; if (chain != null && chain.Quester != null && chain.Quester == GetType()) { BaseQuest quest = QuestHelper.RandomQuest(player, new Type[] { chain.CurrentQuest }, this); if (quest != null) { player.CloseGump(typeof(BaseQuestGump)); player.SendGump(new MLQuestOfferGump(quest)); return; } } } BaseQuest questt = QuestHelper.RandomQuest(player, Quests, this); if (questt != null) { player.CloseGump(typeof(BaseQuestGump)); player.SendGump(new MLQuestOfferGump(questt)); } }
public virtual void UpdateChain() { if (ChainID != QuestChain.None && StartingMobile != null) { if (m_Owner.Chains.ContainsKey(ChainID)) { BaseChain chain = m_Owner.Chains[ChainID]; chain.CurrentQuest = GetType(); chain.Quester = StartingMobile.GetType(); if (Core.Debug) { Console.WriteLine(); Console.WriteLine("Updating quest chain: "); Console.WriteLine(" CahinID: {0} ", ChainID.ToString()); Console.WriteLine(" CurrentQuest: {0} ", chain.CurrentQuest.ToString()); Console.WriteLine(" Quester: {0} ", chain.Quester.ToString()); Console.WriteLine(); } } else { m_Owner.Chains.Add(ChainID, new BaseChain(GetType(), StartingMobile.GetType())); if (Core.Debug) { Console.WriteLine(); Console.WriteLine("Adding quest chain: "); Console.WriteLine(" CahinID: {0} ", ChainID.ToString()); Console.WriteLine(" CurrentQuest: {0} ", GetType().ToString()); Console.WriteLine(" Quester: {0} ", StartingMobile.GetType().ToString()); Console.WriteLine(); } } } }