private bool SkipQuestReward(PlayerMobile pm, CollectionItem item)
        {
            if (pm.Quests != null)
            {
                for (var index = 0; index < pm.Quests.Count; index++)
                {
                    BaseQuest q = pm.Quests[index];

                    if (!q.Completed)
                    {
                        for (var i = 0; i < q.Objectives.Count; i++)
                        {
                            BaseObjective obj = q.Objectives[i];

                            if (obj is CollectionsObtainObjective objective && item.Type == objective.Obtain)
                            {
                                return(false);
                            }
                        }
                    }
                }
            }

            return(true);
        }
Exemple #2
0
        private static string GetObjective(BaseObjective objective)
        {
            string objectivestring = "";

            if (objective is SlayObjective)
            {
                objectivestring += "Slay " + ((SlayObjective)objective).Name + "\n";
            }
            else if (objective is ObtainObjective)
            {
                objectivestring += "Obtain " + ((ObtainObjective)objective).Name + "\n";
            }
            else if (objective is EscortObjective)
            {
                objectivestring += ((EscortObjective)objective).Region + " Escort\n";
            }
            else if (objective is DeliverObjective)
            {
                objectivestring += "Deliver " + ((DeliverObjective)objective).DeliveryName + "\n";
            }
            else if (objective is ApprenticeObjective)
            {
                objectivestring += ((ApprenticeObjective)objective).Skill + " Apprenticeship\n";
            }

            return(objectivestring);
        }
Exemple #3
0
        public override void OnEnter(Mobile m)
        {
            base.OnEnter(m);

            if (m is PlayerMobile player)
            {
                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 ApprenticeObjective apprentice && !apprentice.Completed && IsPartOf(apprentice.Region))
                        {
                            if (apprentice.Enter is int iEnter)
                            {
                                player.SendLocalizedMessage(iEnter);
                            }
                            else if (apprentice.Enter is string sEnter)
                            {
                                player.SendMessage(sEnter);
                            }

                            BuffInfo info = new BuffInfo(BuffIcon.ArcaneEmpowerment, 1078511, 1078512,
                                                         apprentice.Skill.ToString()); // Accelerated Skillgain Skill: ~1_val~
                            BuffInfo.AddBuff(player, info);
                            m_Table[m] = info;
                        }
                    }
                }
            }
        }
Exemple #4
0
        public override void OnExit(Mobile m)
        {
            base.OnExit(m);

            if (m is PlayerMobile player)
            {
                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 ApprenticeObjective apprentice && !apprentice.Completed && IsPartOf(apprentice.Region))
                        {
                            if (apprentice.Leave is int iLeave)
                            {
                                player.SendLocalizedMessage(iLeave);
                            }
                            else if (apprentice.Leave is string sLeave)
                            {
                                player.SendMessage(sLeave);
                            }

                            if (m_Table[m] is BuffInfo)
                            {
                                BuffInfo.RemoveBuff(player, (BuffInfo)m_Table[m]);
                            }
                        }
                    }
                }
            }
        }
Exemple #5
0
 public void StartTask(BaseObjective task)
 {
     objective = task as NavigationObjective;
     if (null == objective)
     {
         return;
     }
     points = new List<NavPoint>(objective.NavPoints);
     FindNextPoint();
 }
Exemple #6
0
        public override bool CanUse(Mobile from)
        {
            if (!base.CanUse(from))
            {
                return(false);
            }

            PlayerMobile pm = from as PlayerMobile;

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

            #region Mondain's Legacy


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

                for (int j = quest.Objectives.Count - 1; j >= 0; j--)
                {
                    BaseObjective objective = quest.Objectives[j];

                    if (objective is ApprenticeObjective)
                    {
                        from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
                        return(false);
                    }
                }
            }


            #endregion

            #region Scroll of Alacrity
            if (pm.AcceleratedStart > DateTime.UtcNow)
            {
                from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
                return(false);
            }
            #endregion

            return(true);
        }
Exemple #7
0
        public override void OnExit(Mobile m)
        {
            base.OnExit(m);

            if (m is PlayerMobile)
            {
                PlayerMobile player = (PlayerMobile)m;

                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 ApprenticeObjective && !objective.Completed)
                        {
                            ApprenticeObjective apprentice = (ApprenticeObjective)objective;

                            if (this.IsPartOf(apprentice.Region))
                            {
                                if (apprentice.Leave is int)
                                {
                                    player.SendLocalizedMessage((int)apprentice.Leave);
                                }
                                else if (apprentice.Leave is string)
                                {
                                    player.SendMessage((string)apprentice.Leave);
                                }

                                if (this.m_Table[m] is BuffInfo)
                                {
                                    BuffInfo.RemoveBuff(m, (BuffInfo)this.m_Table[m]);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #8
0
        public override void OnEnter(Mobile m)
        {
            base.OnEnter(m);

            if (m is PlayerMobile)
            {
                PlayerMobile player = (PlayerMobile)m;

                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 ApprenticeObjective && !objective.Completed)
                        {
                            ApprenticeObjective apprentice = (ApprenticeObjective)objective;

                            if (IsPartOf(apprentice.Region))
                            {
                                if (apprentice.Enter is int)
                                {
                                    player.SendLocalizedMessage((int)apprentice.Enter);
                                }
                                else if (apprentice.Enter is string)
                                {
                                    player.SendMessage((string)apprentice.Enter);
                                }

                                BuffInfo info = new BuffInfo(BuffIcon.ArcaneEmpowerment, 1078511);                                   // Accelerated Skillgain
                                BuffInfo.AddBuff(m, info);
                                m_Table[m] = info;
                            }
                        }
                    }
                }
            }
        }
Exemple #9
0
        public override bool CanUse(Mobile from)
        {
            if (!base.CanUse(from))
            {
                return(false);
            }

            if (!(from is PlayerMobile pm))
            {
                return(false);
            }

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

                for (int j = quest.Objectives.Count - 1; j >= 0; j--)
                {
                    BaseObjective objective = quest.Objectives[j];

                    if (objective is ApprenticeObjective)
                    {
                        from.SendLocalizedMessage(1079254); // You may not use your Scroll of Alacrity while your character is on a new player skill quest.
                        return(false);
                    }
                }
            }

            if (pm.AcceleratedStart > DateTime.UtcNow)
            {
                from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
                return(false);
            }

            return(true);
        }
Exemple #10
0
        public void Use(Mobile from, bool firstStage)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (Deleted)
            {
                return;
            }

            #region Mondain's Legacy
            for (int i = pm.Quests.Count - 1; i >= 0; i--)
            {
                BaseQuest quest = pm.Quests[i];

                for (int j = quest.Objectives.Count - 1; j >= 0; j--)
                {
                    BaseObjective objective = quest.Objectives[j];

                    if (objective is ApprenticeObjective)
                    {
                        from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
                        return;
                    }
                }
            }
            #endregion

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }

            else if (pm.AcceleratedStart > DateTime.Now)
            {
                from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
                return;
            }

            else
            {
                if (firstStage)
                {
                    from.CloseGump(typeof(StatCapScroll.InternalGump));
                    from.CloseGump(typeof(PowerScroll.InternalGump));
                    #region Scroll of Transcendence
                    from.CloseGump(typeof(ScrollofTranscendence.InternalGump));
                    #endregion
                    from.CloseGump(typeof(ScrollofAlacrity.InternalGump));
                    from.SendGump(new InternalGump(from, this));
                }
                else
                {
                    double tskill = from.Skills[m_Skill].Base;
                    double tcap   = from.Skills[m_Skill].Cap;

                    if (tskill >= tcap || from.Skills[m_Skill].Lock == SkillLock.Locked || from.Skills[m_Skill].Lock == SkillLock.Down)
                    {
                        from.SendLocalizedMessage(1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
                                                             * If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
                        return;
                    }
                    else
                    {
                        Effects.PlaySound(from.Location, from.Map, 0x1E9);

                        Effects.SendTargetParticles(from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);

                        from.SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll.

                        pm.AcceleratedStart = DateTime.Now + TimeSpan.FromMinutes(15);

                        Timer t = (Timer)m_Table[from];

                        m_Table[from] = Timer.DelayCall(TimeSpan.FromMinutes(15), new TimerStateCallback(Expire_Callback), from);

                        pm.AcceleratedSkill = m_Skill;

                        Delete();
                    }
                }
            }
        }
 public BCMQuestObjective([NotNull] BaseObjective objective)
 {
     Type  = objective.GetType().ToString();
     Id    = objective.ID;
     Value = objective.Value;
 }
Exemple #12
0
        public void Use(Mobile from, bool firstStage)
        {
            PlayerMobile pm = from as PlayerMobile;

            if (Deleted)
            {
                return;
            }

            #region Mondain's Legacy
            for (int i = pm.Quests.Count - 1; i >= 0; i--)
            {
                BaseQuest quest = pm.Quests[i];

                for (int j = quest.Objectives.Count - 1; j >= 0; j--)
                {
                    BaseObjective objective = quest.Objectives[j];

                    if (objective is ApprenticeObjective)
                    {
                        from.SendMessage("You are already under the effect of an enhanced skillgain quest.");
                        return;
                    }
                }
            }
            #endregion

            if (!IsChildOf(from.Backpack))
            {
                from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it.
            }
            #region Acroll of Alacrity
            else if (pm.AcceleratedStart > DateTime.Now)
            {
                from.SendLocalizedMessage(1077951); // You are already under the effect of an accelerated skillgain scroll.
                return;
            }
            #endregion
            else
            {
                if (firstStage)
                {
                    from.CloseGump(typeof(StatCapScroll.InternalGump));
                    from.CloseGump(typeof(PowerScroll.InternalGump));
                    from.CloseGump(typeof(ScrollofTranscendence.InternalGump));
                    #region Scroll of Alacrity
                    from.CloseGump(typeof(ScrollofAlacrity.InternalGump));
                    #endregion
                    from.SendGump(new InternalGump(from, this));
                }
                else
                {
                    double tskill  = from.Skills[m_Skill].Base;
                    double tcap    = from.Skills[m_Skill].Cap;
                    bool   canGain = true;

                    if (tskill >= tcap || from.Skills[m_Skill].Lock == SkillLock.Locked || from.Skills[m_Skill].Lock == SkillLock.Down)
                    {
                        from.SendLocalizedMessage(1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
                                                             * If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
                        return;
                    }

                    if ((tskill + m_Value) > tcap)
                    {
                        m_Value = tcap - tskill;
                    }

                    if ((from.SkillsTotal + m_Value * 10) > from.SkillsCap)
                    {
                        canGain = false;
                        for (int i = 0; i <= 54; i++)
                        {
                            if (from.Skills[i].Lock == SkillLock.Down && from.Skills[i].Base >= m_Value)
                            {
                                from.Skills[i].Base = from.Skills[i].Base - m_Value;
                                canGain             = true;
                                break;
                            }
                        }

                        if (!canGain)
                        {
                            from.SendLocalizedMessage(1094935); /*You cannot increase this skill at this time. The skill may be locked or set to lower in your skill menu.
                                                                 * If you are at your total skill cap, you must use a Powerscroll to increase your current skill cap.*/
                            return;
                        }
                    }

                    if (tskill + m_Value > tcap)
                    {
                        from.Skills[m_Skill].Base = tcap;
                    }
                    else
                    {
                        from.Skills[m_Skill].Base = tskill + m_Value;
                    }

                    from.SendLocalizedMessage(1049513, GetNameLocalized()); // You feel a surge of magic as the scroll enhances your ~1_type~!

                    Effects.PlaySound(from.Location, from.Map, 0x1F7);

                    Effects.SendTargetParticles(from, 0x373A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);
                    Effects.SendTargetParticles(from, 0x376A, 35, 45, 0x00, 0x00, 9502, (EffectLayer)255, 0x100);

                    Delete();
                }
            }
        }
Exemple #13
0
            //public byte Version;
            //public bool Complete;
            //public byte Phase;
            //public Quest OwnerQuest;

            public BCMObjective(BaseObjective objective)
            {
                Id    = objective.ID;
                Value = objective.Value;
            }
Exemple #14
0
            protected override void OnTarget(Mobile from, object target)
            {
                from.RevealingAction();
                from.NextSkillTime = Core.TickCount + 1000;

                if (!m_Instrument.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1062488); // The instrument you are trying to play is no longer in your backpack!
                }
                else if (target is Mobile targ)
                {
                    if (targ == from || !from.CanBeHarmful(targ, false, false, true) ||
                        targ is BaseCreature creature && creature.BardImmune && creature.ControlMaster != from)
                    {
                        from.SendLocalizedMessage(1049535); // A song of discord would have no effect on that.
                    }
                    else if (m_Table.ContainsKey(targ))     //Already discorded
                    {
                        from.SendLocalizedMessage(1049537); // Your target is already in discord.
                    }
                    else if (!targ.Player || from is BaseCreature bc && bc.CanDiscord || targ.Player && from.Player && CanDiscordPVP(from))
                    {
                        double diff  = m_Instrument.GetDifficultyFor(targ) - 10.0;
                        double music = from.Skills[SkillName.Musicianship].Value;

                        if (from is BaseCreature)
                        {
                            music = 120.0;
                        }

                        int masteryBonus = 0;

                        if (music > 100.0)
                        {
                            diff -= (music - 100.0) * 0.5;
                        }

                        if (from is PlayerMobile mobile)
                        {
                            masteryBonus = Spells.SkillMasteries.BardSpell.GetMasteryBonus(mobile, SkillName.Discordance);
                        }

                        if (masteryBonus > 0)
                        {
                            diff -= diff * ((double)masteryBonus / 100);
                        }

                        if (!BaseInstrument.CheckMusicianship(from))
                        {
                            from.SendLocalizedMessage(500612); // You play poorly, and there is no effect.
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);
                        }
                        else if (from.CheckTargetSkill(SkillName.Discordance, targ, diff - 25.0, diff + 25.0))
                        {
                            from.SendLocalizedMessage(1049539); // You play the song surpressing your targets strength

                            if (targ.Player)
                            {
                                targ.SendLocalizedMessage(1072061); // You hear jarring music, suppressing your strength.
                            }
                            m_Instrument.PlayInstrumentWell(from);
                            m_Instrument.ConsumeUse(from);

                            DiscordanceInfo info;

                            if (targ.Player && from.Player)
                            {
                                info = new DiscordanceInfo(from, targ, 0, null, true, from.Skills.CurrentMastery == SkillName.Discordance ? 6 : 4);
                                from.DoHarmful(targ);
                            }
                            else
                            {
                                ArrayList mods = new ArrayList();

                                double discord = from.Skills[SkillName.Discordance].Value;

                                var effect = (int)Math.Max(-28.0, discord / -4.0);

                                if (BaseInstrument.GetBaseDifficulty(targ) >= 160.0)
                                {
                                    effect /= 2;
                                }

                                var scalar = (double)effect / 100;

                                mods.Add(new ResistanceMod(ResistanceType.Physical, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Fire, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Cold, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Poison, effect));
                                mods.Add(new ResistanceMod(ResistanceType.Energy, effect));

                                for (int i = 0; i < targ.Skills.Length; ++i)
                                {
                                    if (targ.Skills[i].Value > 0)
                                    {
                                        mods.Add(new DefaultSkillMod((SkillName)i, true, targ.Skills[i].Value * scalar));
                                    }
                                }

                                info = new DiscordanceInfo(from, targ, Math.Abs(effect), mods);

                                if (from is PlayerMobile playerMobile)
                                {
                                    BaseQuest quest = QuestHelper.GetQuest(playerMobile, typeof(WieldingTheSonicBladeQuest));

                                    if (quest != null)
                                    {
                                        for (var index = 0; index < quest.Objectives.Count; index++)
                                        {
                                            BaseObjective objective = quest.Objectives[index];

                                            objective.Update(targ);
                                        }
                                    }
                                }
                            }

                            info.m_Timer = Timer.DelayCall(TimeSpan.Zero, TimeSpan.FromSeconds(1.25), ProcessDiscordance, info);

                            m_Table[targ]      = info;
                            from.NextSkillTime = Core.TickCount + (8000 - masteryBonus / 5 * 1000);
                        }
                        else
                        {
                            if (from is BaseCreature)
                            {
                                from.CheckSkill(SkillName.Discordance, 0, from.Skills[SkillName.Discordance].Cap);
                            }

                            from.SendLocalizedMessage(1049540); // You attempt to disrupt your target, but fail.

                            if (targ.Player)
                            {
                                targ.SendLocalizedMessage(1072064); // You hear jarring music, but it fails to disrupt you.
                            }
                            m_Instrument.PlayInstrumentBadly(from);
                            m_Instrument.ConsumeUse(from);

                            from.NextSkillTime = Core.TickCount + 5000;
                        }
                    }