public virtual void OnTalk(PlayerMobile player) { 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 Type[] { 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 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)); } } }
public override void OnDoubleClick(Mobile m) { if (m is PlayerMobile pm && m.InRange(Location, 5)) { if (QuestHelper.CheckDoneOnce(pm, typeof(Missing), null, false)) { if (QuestHelper.CheckDoneOnce(pm, typeof(EscortToDugan), null, false)) { var q = QuestHelper.GetQuest <EndingtheThreat>(pm); if (q == null) { var quest = QuestHelper.RandomQuest(pm, new[] { typeof(EndingtheThreat) }, this); if (quest != null) { pm.CloseGump(typeof(MondainQuestGump)); pm.SendGump(new MondainQuestGump(quest)); } } else { OnTalk(pm); } } else { OnOfferFailed(); } } else { OnTalk(pm); } } }
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)); } } }
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())); }
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); }
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)); } }