Esempio n. 1
0
 public override void OnCompleted()
 {
     QuestHelper.RemoveAcceleratedSkillgain(Quest.Owner);
 }
Esempio n. 2
0
 public override Region GetDestination()
 {
     return(QuestHelper.FindRegion(m_Destinations[m_Quest]));
 }
Esempio n. 3
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, 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~
                        }
                    }
                }
            }

            // 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));
                }
            }

            Server.Engines.Points.PointsSystem.HandleQuest(Owner, this);
        }
        public override void OnResponse(Server.Network.NetState state, RelayInfo info)
        {
            if (this.m_From != null)
            {
                this.m_From.CloseGump(typeof(MondainQuestGump));
            }

            switch (info.ButtonID)
            {
            // close quest list
            case (int)Buttons.Close:
                break;

            // close quest
            case (int)Buttons.CloseQuest:
                this.m_From.SendGump(new MondainQuestGump(this.m_From));
                break;

            // accept quest
            case (int)Buttons.AcceptQuest:
                if (this.m_Offer)
                {
                    this.m_Quest.OnAccept();
                }
                break;

            // refuse quest
            case (int)Buttons.RefuseQuest:
                if (this.m_Offer)
                {
                    this.m_Quest.OnRefuse();
                    this.m_From.SendGump(new MondainQuestGump(this.m_Quest, Section.Refuse, true));
                }
                break;

            // resign quest
            case (int)Buttons.ResignQuest:
                if (!this.m_Offer)
                {
                    this.m_From.SendGump(new MondainResignGump(this.m_Quest));
                }
                break;

            // accept reward
            case (int)Buttons.AcceptReward:
                if (!this.m_Offer && this.m_Section == Section.Rewards && this.m_Completed)
                {
                    this.m_Quest.GiveRewards();
                }
                break;

            // refuse reward
            case (int)Buttons.RefuseReward:
                if (!m_Offer && m_Section == Section.Rewards && m_Completed)
                {
                    m_Quest.RefuseRewards();
                }
                break;

            // previous page
            case (int)Buttons.PreviousPage:
                if (this.m_Section == Section.Objectives || (this.m_Section == Section.Rewards && !this.m_Completed))
                {
                    this.m_Section = (Section)((int)this.m_Section - 1);
                    this.m_From.SendGump(new MondainQuestGump(this.m_Quest, this.m_Section, this.m_Offer));
                }
                break;

            // next page
            case (int)Buttons.NextPage:
                if (this.m_Section == Section.Description || this.m_Section == Section.Objectives)
                {
                    this.m_Section = (Section)((int)this.m_Section + 1);
                    this.m_From.SendGump(new MondainQuestGump(this.m_Quest, this.m_Section, this.m_Offer));
                }
                break;

            // player complete quest
            case (int)Buttons.Complete:
                if (!this.m_Offer && this.m_Section == Section.Complete)
                {
                    if (!this.m_Quest.Completed)
                    {
                        this.m_From.SendLocalizedMessage(1074861);     // You do not have everything you need!
                    }
                    else
                    {
                        QuestHelper.DeleteItems(this.m_Quest);

                        if (this.m_Quester != null)
                        {
                            this.m_Quest.Quester = this.m_Quester;
                        }

                        if (!QuestHelper.AnyRewards(this.m_Quest))
                        {
                            this.m_Quest.GiveRewards();
                        }
                        else
                        {
                            this.m_From.SendGump(new MondainQuestGump(this.m_Quest, Section.Rewards, false, true));
                        }
                    }
                }
                break;

            // admin complete quest
            case (int)Buttons.CompleteQuest:
                if ((int)this.m_From.AccessLevel > (int)AccessLevel.Counselor && this.m_Quest != null)
                {
                    QuestHelper.CompleteQuest(this.m_From, this.m_Quest);
                }
                break;

            // show quest
            default:
                if (this.m_Section != Section.Main || info.ButtonID >= this.m_From.Quests.Count + ButtonOffset || info.ButtonID < ButtonOffset)
                {
                    break;
                }

                this.m_From.SendGump(new MondainQuestGump(this.m_From.Quests[(int)info.ButtonID - ButtonOffset], Section.Description, false));
                break;
            }
        }
Esempio n. 5
0
        public virtual bool CheckAtDestination()
        {
            if (this.m_Quest != null)
            {
                EscortObjective escort = this.GetObjective();

                if (escort == null)
                {
                    return(false);
                }

                Mobile escorter = this.GetEscorter();

                if (escorter == null)
                {
                    return(false);
                }

                if (escort.Region != null && escort.Region.Contains(this.Location))
                {
                    this.Say(1042809, escorter.Name); // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

                    escort.Complete();

                    if (this.m_Quest.Completed)
                    {
                        escorter.SendLocalizedMessage(1046258, null, 0x23); // Your quest is complete.

                        if (QuestHelper.AnyRewards(this.m_Quest))
                        {
                            escorter.SendGump(new MondainQuestGump(this.m_Quest, MondainQuestGump.Section.Rewards, false, true));
                        }
                        else
                        {
                            this.m_Quest.GiveRewards();
                        }

                        escorter.PlaySound(this.m_Quest.CompleteSound);

                        this.StopFollow();
                        m_EscortTable.Remove(escorter);
                        this.m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete));

                        // fame
                        Misc.Titles.AwardFame(escorter, escort.Fame, true);

                        // compassion
                        bool gainedPath = false;

                        PlayerMobile pm = escorter as PlayerMobile;

                        if (pm != null)
                        {
                            if (pm.CompassionGains > 0 && DateTime.UtcNow > pm.NextCompassionDay)
                            {
                                pm.NextCompassionDay = DateTime.MinValue;
                                pm.CompassionGains   = 0;
                            }

                            if (pm.CompassionGains >= 5)          // have already gained 5 times in one day, can gain no more
                            {
                                pm.SendLocalizedMessage(1053004); // You must wait about a day before you can gain in compassion again.
                            }
                            else if (VirtueHelper.Award(pm, VirtueName.Compassion, escort.Compassion, ref gainedPath))
                            {
                                pm.SendLocalizedMessage(1074949, null, 0x2A);  // You have demonstrated your compassion!  Your kind actions have been noted.

                                if (gainedPath)
                                {
                                    pm.SendLocalizedMessage(1053005); // You have achieved a path in compassion!
                                }
                                else
                                {
                                    pm.SendLocalizedMessage(1053002);                            // You have gained in compassion.
                                }
                                pm.NextCompassionDay = DateTime.UtcNow + TimeSpan.FromDays(1.0); // in one day CompassionGains gets reset to 0
                                ++pm.CompassionGains;
                            }
                            else
                            {
                                pm.SendLocalizedMessage(1053003); // You have achieved the highest path of compassion and can no longer gain any further.
                            }
                        }
                    }
                    else
                    {
                        escorter.PlaySound(this.m_Quest.UpdateSound);
                    }

                    return(true);
                }
            }
            else if (!this.m_Checked)
            {
                Region region = this.GetDestination();

                if (region != null && region.Contains(this.Location))
                {
                    this.m_DeleteTimer = Timer.DelayCall(TimeSpan.FromSeconds(5.0), new TimerCallback(Delete));
                    this.m_Checked     = true;
                }
            }

            return(false);
        }
Esempio n. 6
0
 public override void OnDoubleClick(Mobile m)
 {
     if (m is PlayerMobile mobile && !QuestHelper.CheckDoneOnce(mobile, typeof(ToolsOfTheTradeQuest), this, false))
     {
         mobile.SendLocalizedMessage(1080107); // I'm sorry, I have nothing for you at this time.
     }
Esempio n. 7
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, 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()));
        }
Esempio n. 8
0
        public static bool OnHarvest(Mobile m, Item tool)
        {
            if (!(m is PlayerMobile) || m.Map != Map.TerMur)
            {
                return(false);
            }

            PlayerMobile pm = m as PlayerMobile;

            if (pm.ToggleMiningStone && VolcanoMineBounds.Contains(m.Location))
            {
                object locked = tool;

                if (!m.BeginAction(locked))
                {
                    return(false);
                }

                m.Animate(AnimationType.Attack, 3);

                Timer.DelayCall(Mining.System.OreAndStone.EffectSoundDelay, () =>
                {
                    m.PlaySound(Utility.RandomList(Mining.System.OreAndStone.EffectSounds));
                });

                Timer.DelayCall(Mining.System.OreAndStone.EffectDelay, () =>
                {
                    TheGreatVolcanoQuest quest = QuestHelper.GetQuest(pm, typeof(TheGreatVolcanoQuest)) as TheGreatVolcanoQuest;

                    if (quest != null && !quest.Completed && 0.05 > Utility.RandomDouble())
                    {
                        if (m.CheckSkill(SkillName.Mining, 90, 100))
                        {
                            double chance = Utility.RandomDouble();

                            if (0.08 > chance)
                            {
                                BaseCreature spawn = new VolcanoElemental();
                                Point3D p          = m.Location;

                                for (int i = 0; i < 10; i++)
                                {
                                    int x = Utility.RandomMinMax(p.X - 1, p.X + 1);
                                    int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1);
                                    int z = Map.TerMur.GetAverageZ(x, y);

                                    if (Map.TerMur.CanSpawnMobile(x, y, z))
                                    {
                                        p = new Point3D(x, y, z);
                                        break;
                                    }
                                }

                                spawn.OnBeforeSpawn(p, Map.TerMur);
                                spawn.MoveToWorld(p, Map.TerMur);
                                spawn.OnAfterSpawn();

                                spawn.Combatant = m;

                                m.SendLocalizedMessage(1156508);      // Uh oh...that doesn't look like a lava rock!
                            }
                            else if (0.55 > chance)
                            {
                                m.PrivateOverheadMessage(Server.Network.MessageType.Regular, 1154, 1156507, m.NetState);     // *You uncover a lava rock and carefully store it for later!*
                                quest.Update(m);
                            }
                            else
                            {
                                m.LocalOverheadMessage(Server.Network.MessageType.Regular, 0x3B2, 1156509);     // You loosen some dirt but fail to find anything.
                            }
                        }
                        else
                        {
                            m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509);     // You loosen some dirt but fail to find anything.
                        }
                    }
                    else
                    {
                        m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509);     // You loosen some dirt but fail to find anything.
                    }
                    if (tool is IUsesRemaining)
                    {
                        ((IUsesRemaining)tool).UsesRemaining--;

                        if (((IUsesRemaining)tool).UsesRemaining <= 0)
                        {
                            m.SendLocalizedMessage(1044038);     // You have worn out your tool!
                            tool.Delete();
                        }
                    }

                    m.EndAction(locked);
                });

                return(true);
            }

            return(false);
        }
Esempio n. 9
0
 public override bool CanOffer()
 {
     return(QuestHelper.CheckDoneOnce(Owner, typeof(RumorsAboundQuest), null, false));
 }
Esempio n. 10
0
        public override void GiveRewards()
        {
            base.GiveRewards();

            QuestHelper.Delay(Owner, typeof(RightingWrongQuest), RestartDelay);
        }
Esempio n. 11
0
 public override string GetDestination()
 {
     return(QuestHelper.ValidateRegion(m_Destinations[m_Quest]) ? m_Destinations[m_Quest] : null);
 }
Esempio n. 12
0
        /// <summary>
        /// Overridable. Checks if at destination.
        /// </summary>
        public virtual bool CheckAtDestination()
        {
            EscortObjective escort = GetObjective();

            if (escort == null)
            {
                return(false);
            }

            if (escort.Region == null)
            {
                escort.Fail();
                return(CheckAtDestination());
            }

            Mobile escorter = GetEscorter();

            if (escorter == null)
            {
                return(false);
            }

            if (escort.Region.Contains(Location))
            {
                Say(1042809, escorter.Name);                   // We have arrived! I thank thee, ~1_PLAYER_NAME~! I have no further need of thy services. Here is thy pay.

                escort.Complete();

                if (m_Quest != null)
                {
                    if (m_Quest.Completed)
                    {
                        escorter.SendLocalizedMessage(1046258, null, 0x23);                           // Your quest is complete.

                        if (!QuestHelper.AnyRewards(m_Quest))
                        {
                            m_Quest.GiveRewards();
                        }
                        else
                        {
                            escorter.SendGump(new MondainQuestGump(m_Quest, MondainQuestGump.Section.Rewards, false, true));
                        }

                        escorter.PlaySound(m_Quest.CompleteSound);
                    }
                    else
                    {
                        escorter.PlaySound(m_Quest.UpdateSound);
                    }
                }

                StopFollow();
                SetControlMaster(null);
                m_EscortTable.Remove(escorter);
                BeginDelete();

                // fame, compassion
                if (escort.Fame > 0)
                {
                    Misc.Titles.AwardFame(escorter, escort.Fame, true);

                    bool gainedPath = false;

                    PlayerMobile pm = escorter as PlayerMobile;

                    if (pm != null)
                    {
                        if (pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay)
                        {
                            pm.NextCompassionDay = DateTime.MinValue;
                            pm.CompassionGains   = 0;
                        }

                        if (pm.CompassionGains >= 5)                           // have already gained 5 times in one day, can gain no more
                        {
                            pm.SendLocalizedMessage(1053004);                  // You must wait about a day before you can gain in compassion again.
                        }
                        else if (VirtueHelper.Award(pm, VirtueName.Compassion, 200, ref gainedPath))
                        {
                            if (gainedPath)
                            {
                                pm.SendLocalizedMessage(1053005);                                   // You have achieved a path in compassion!
                            }
                            else
                            {
                                pm.SendLocalizedMessage(1053002);                                   // You have gained in compassion.
                            }
                            pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays(1.0);           // in one day CompassionGains gets reset to 0
                            ++pm.CompassionGains;
                        }
                        else
                        {
                            pm.SendLocalizedMessage(1053003);                               // You have achieved the highest path of compassion and can no longer gain any further.
                        }
                    }
                }

                return(true);
            }

            return(false);
        }
Esempio n. 13
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));
            }
        }
Esempio n. 14
0
        public override void OnDoubleClick(Mobile from)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (pm == null || !InRange(from.Location, 3))
            {
                return;
            }

            WhosMostHumbleQuest quest = QuestHelper.GetQuest(pm, typeof(WhosMostHumbleQuest)) as WhosMostHumbleQuest;

            if (quest != null && pm.Backpack != null && !quest.HasGivenTo(this))
            {
                Item item = from.FindItemOnLayer(Layer.Cloak);

                if (item is GreyCloak && ((GreyCloak)item).Owner == null)
                {
                    int idx = HumilityQuestMobileInfo.GetNPCIndex(this.GetType());

                    if (idx > -1 && quest.Infos.ContainsKey(idx) && idx < quest.Infos.Count)
                    {
                        Type needs = quest.Infos[idx].Needs;

                        Item need = from.Backpack.FindItemByType(needs);

                        // Found needed item
                        if (need != null)
                        {
                            need.Delete();
                            quest.RemoveQuestItem(need);

                            Item nextItem = Loot.Construct(quest.Infos[idx].Gives);

                            if (nextItem != null)
                            {
                                from.Backpack.DropItem(nextItem);
                                quest.AddQuestItem(nextItem, this);

                                if (this is Sean)
                                {
                                    SayTo(from, Greeting + 3, String.Format("#{0}", quest.Infos[idx].NeedsLoc));
                                }
                                else
                                {
                                    SayTo(from, Greeting + 4, String.Format("#{0}\t#{1}", quest.Infos[idx].NeedsLoc, quest.Infos[idx].GivesLoc));
                                }
                            }
                        }
                        else //Didn't find needed item
                        {
                            from.SendGump(new HumilityItemQuestGump(this, quest, idx));
                        }
                    }
                    else
                    {
                        Console.WriteLine("Error finding index for {0}", this);
                    }
                }
                else
                {
                    base.OnDoubleClick(from);
                }
            }
        }