Beispiel #1
0
        public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
        {
            if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038); // You have worn out your tool!
            }
            else if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263); // The tool must be on your person to use.
            }
            if (typeItem != null)
            {
                object o = Activator.CreateInstance(typeItem);

                if (o is SpellScroll)
                {
                    SpellScroll scroll = (SpellScroll)o;
                    Spellbook   book   = Spellbook.Find(from, scroll.SpellID);

                    bool hasSpell = (book != null && book.HasSpell(scroll.SpellID));

                    scroll.Delete();

                    return(hasSpell ? 0 : 1042404);  // null : You don't have that spell!
                }
                else if (o is Item)
                {
                    ((Item)o).Delete();
                }
            }

            return(0);
        }
Beispiel #2
0
 protected override bool CanCraft(CraftSystemItem item)
 {
     return(m_Mobile.Skills[SkillName.Magery].Value >= item.MinSkill &&
            m_Mobile.Skills[SkillName.Inscribe].Value >= item.MinSkill &&
            item is CSI_Scroll &&
            Spellbook.Find(m_Mobile, ((CSI_Scroll)item).SpellID) != null);
 }
Beispiel #3
0
        public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
        {
            if (tool?.Deleted != false || tool.UsesRemaining < 0)
            {
                return(1044038); // You have worn out your tool!
            }
            if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263); // The tool must be on your person to use.
            }
            if (typeItem != null)
            {
                object o = ActivatorUtil.CreateInstance(typeItem);

                if (o is SpellScroll scroll)
                {
                    bool hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;

                    scroll.Delete();

                    return(hasSpell ? 0 : 1042404); // null : You don't have that spell!
                }

                if (o is Item item)
                {
                    item.Delete();
                }
            }

            return(0);
        }
        public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
        {
            if (tool.Deleted || tool.UsesRemaining < 0)
            {
                return(1044038);                // You have worn out your tool!
            }
            else if (!BaseTool.CheckAccessible(tool, from))
            {
                return(1044263);                // The tool must be on your person to use.
            }
            if (typeItem != null)
            {
                object o = Activator.CreateInstance(typeItem);

                if (o is SpellScroll)
                {
                    SpellScroll scroll = (SpellScroll)o;
                    Spellbook   book   = Spellbook.Find(from, scroll.SpellID);

                    bool hasSpell = (book != null && book.HasSpell(scroll.SpellID));

                    scroll.Delete();

                    //return ( hasSpell ? 0 : 1042404 ); // null : You don't have that spell!
                    if (hasSpell)
                    {
                        //GetCastSkills
                        Server.Spells.Spell spell = Server.Spells.SpellRegistry.NewSpell(scroll.SpellID, from, null);
                        if (spell == null)
                        {
                            return(0);
                        }
                        else
                        {
                            double minmagery = 0.0;
                            double maxmagery = 0.0;
                            spell.GetCastSkills(out minmagery, out maxmagery);
                            if (minmagery > from.Skills.Magery.Value)
                            {
                                return(1044153);                                // You don't have the required skills to attempt this item.
                            }
                            else
                            {
                                return(0);
                            }
                        }
                    }
                    else
                    {
                        return(1042404);                        // You don't have that spell!
                    }
                }
                else if (o is Item)
                {
                    ((Item)o).Delete();
                }
            }

            return(0);
        }
        public void Target(Mobile m)
        {
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }

            m_Book = (SongBook)book;

            PlayerMobile p     = m as PlayerMobile;
            bool         sings = false;

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                sings = true;

                if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
                {
                    Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                    return;
                }

                Mobile source = Caster;
                SpellHelper.Turn(source, m);

                bool IsSlayer = false;
                if (m is BaseCreature)
                {
                    IsSlayer = CheckSlayer(m_Book.Instrument, m);
                }

                int      amount   = (int)(MusicSkill(Caster) / 16);
                TimeSpan duration = TimeSpan.FromSeconds((double)(MusicSkill(Caster)));

                if (IsSlayer == true)
                {
                    amount   = amount * 2;
                    duration = TimeSpan.FromSeconds((double)(MusicSkill(Caster) * 2));
                }

                m.SendMessage("Your resistance to fire has decreased.");
                ResistanceMod mod1 = new ResistanceMod(ResistanceType.Fire, -amount);

                m.FixedParticles(0x374A, 10, 30, 5013, 0x489, 2, EffectLayer.Waist);

                m.AddResistanceMod(mod1);

                ExpireTimer timer1 = new ExpireTimer(m, mod1, duration);
                timer1.Start();
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Beispiel #6
0
    public override int CanCraft(Mobile from, BaseTool tool, Type typeItem)
    {
        if (tool?.Deleted != false || tool.UsesRemaining < 0)
        {
            return(1044038); // You have worn out your tool!
        }

        if (!BaseTool.CheckAccessible(tool, from))
        {
            return(1044263); // The tool must be on your person to use.
        }

        var scroll = typeItem?.CreateEntityInstance <SpellScroll>();

        if (scroll != null)
        {
            var hasSpell = Spellbook.Find(from, scroll.SpellID)?.HasSpell(scroll.SpellID) == true;

            scroll.Delete();

            return(hasSpell ? 0 : 1042404); // null : You don't have that spell!
        }

        return(0);
    }
Beispiel #7
0
        public void Target(Mobile m)
        {
            bool sings = false;

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                sings = true;

                //get songbook instrument
                Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);
                if (book == null)
                {
                    return;
                }
                m_Book = (SongBook)book;
                if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
                {
                    Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                    return;
                }

                Mobile source = Caster;

                SpellHelper.Turn(source, m);

                m.FixedParticles(0x374A, 10, 30, 5013, 0x14, 2, EffectLayer.Waist);

                bool IsSlayer = false;
                if (m is BaseCreature)
                {
                    IsSlayer = CheckSlayer(m_Book.Instrument, m);
                }

                int      amount   = (int)((Caster.Skills[SkillName.Musicianship].Value + Caster.Skills[SkillName.Peacemaking].Value + Caster.Skills[SkillName.Provocation].Value + Caster.Skills[SkillName.Discordance].Value) / 4 * .167);
                TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Musicianship].Value * 0.3);

                if (IsSlayer == true)
                {
                    amount   = amount * 2;
                    duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Musicianship].Value * 0.6);
                }

                m.SendMessage("Your resistance to energy has decreased.");
                ResistanceMod mod1 = new ResistanceMod(ResistanceType.Energy, -amount);

                m.AddResistanceMod(mod1);

                ExpireTimer timer1 = new ExpireTimer(m, mod1, duration);
                timer1.Start();
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Beispiel #8
0
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }


                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    Mobile source   = Caster;
                    double allvalue = Caster.Skills[SkillName.Musicianship].Value + Caster.Skills[SkillName.Provocation].Value + Caster.Skills[SkillName.Discordance].Value + Caster.Skills[SkillName.Peacemaking].Value;


                    int amount = (int)(Math.Max((Caster.Skills[SkillName.Musicianship].Value * 0.1), (allvalue - 360 * 0.15)));
                    //int amount = (int)( Caster.Skills[SkillName.Musicianship].Value * 0.1 );
                    string str = "str";

                    double duration = (Caster.Skills[SkillName.Musicianship].Value);

                    StatMod mod = new StatMod(StatType.Str, str, +amount, TimeSpan.FromSeconds(duration));

                    m.AddStatMod(mod);

                    m.FixedParticles(0x375A, 10, 15, 5017, 0x224, 3, EffectLayer.Waist);
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Beispiel #9
0
        public override void OnCast()
        {
            bool sings = false;

            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            //added this to test
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("You need an instrument to play that song!");
            }
            else if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }


                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Musicianship].Value * 2.5);
                    int      amount   = (int)((Caster.Skills[SkillName.Musicianship].Value + Caster.Skills[SkillName.Peacemaking].Value + Caster.Skills[SkillName.Provocation].Value + Caster.Skills[SkillName.Discordance].Value) / 4 * .125);
                    m.SendMessage("Your resistance to fire has increased.");
                    ResistanceMod mod1 = new ResistanceMod(ResistanceType.Fire, +amount);

                    m.AddResistanceMod(mod1);

                    m.FixedParticles(0x373A, 10, 15, 5012, 0x21, 3, EffectLayer.Waist);

                    new ExpireTimer(m, mod1, duration).Start();
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Beispiel #10
0
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(4))
                {
                    if (m is BaseCreature)
                    {
                        BaseCreature mn = m as BaseCreature;
                        if (mn.ControlSlots == 666)
                        {
                            targets.Add(m);
                        }
                    }

                    if (m is BaseCreature && ((BaseCreature)m).Summoned)
                    {
                        targets.Add(m);
                    }
                }

                Caster.FixedParticles(0x3709, 1, 30, 9965, 5, 7, EffectLayer.Waist);

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042);

                    m.Delete();
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Beispiel #11
0
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }


                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    TimeSpan duration = TimeSpan.FromSeconds((double)(MusicSkill(Caster) * 2));
                    int      amount   = Server.Misc.MyServerSettings.PlayerLevelMod((int)(MusicSkill(Caster) / 16), Caster);

                    m.SendMessage("Your resistance to poison has increased.");
                    ResistanceMod mod1 = new ResistanceMod(ResistanceType.Poison, +amount);

                    m.AddResistanceMod(mod1);

                    m.FixedParticles(0x373A, 10, 15, 5012, 0x238, 3, EffectLayer.Waist);

                    new ExpireTimer(m, mod1, duration).Start();
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Beispiel #12
0
        public void Target(Mobile m)
        {
            bool sings = false;

            if (!Caster.CanSee(m))
            {
                Caster.SendLocalizedMessage(500237);                   // Target can not be seen.
            }
            else if (CheckHSequence(m))
            {
                sings = true;

                //get songbook instrument
                Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);
                if (book == null)
                {
                    return;
                }
                m_Book = (SongBook)book;
                if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
                {
                    Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                    return;
                }

                Mobile source = Caster;

                SpellHelper.Turn(Caster, m);

                bool IsSlayer = false;
                if (m is BaseCreature)
                {
                    IsSlayer = CheckSlayer(m_Book.Instrument, m);
                }

                double damage = ((Caster.Skills[SkillName.Musicianship].Value + Caster.Skills[SkillName.Peacemaking].Value + Caster.Skills[SkillName.Provocation].Value + Caster.Skills[SkillName.Discordance].Value) / 4 * 0.25);

                if (IsSlayer == true)
                {
                    damage = damage * 2;
                }

                SpellHelper.Damage(this, m, damage, 20, 20, 20, 20, 20);

                m.FixedParticles(0x374A, 10, 15, 5028, EffectLayer.Head);
                source.MovingParticles(m, 0x379F, 7, 0, false, true, 3043, 4043, 0x211);
                m.PlaySound(0x1EA);
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                ArrayList targets = new ArrayList();

                foreach (Mobile m in Caster.GetMobilesInRange(3))
                {
                    if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem))
                    {
                        targets.Add(m);
                    }
                }

                for (int i = 0; i < targets.Count; ++i)
                {
                    Mobile m = (Mobile)targets[i];

                    int    amount = Server.Misc.MyServerSettings.PlayerLevelMod((int)(MusicSkill(Caster) / 16), Caster);
                    string intt   = "int";

                    double duration = (double)(MusicSkill(Caster) * 2);

                    StatMod mod = new StatMod(StatType.Int, intt, +amount, TimeSpan.FromSeconds(duration));

                    m.AddStatMod(mod);

                    m.FixedParticles(0x375A, 10, 15, 5017, 0x1F8, 3, EffectLayer.Waist);
                }
            }

            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
            FinishSequence();
        }
Beispiel #14
0
        public override void OnItemSelected(CraftSystemItem item)
        {
            if (m_Mobile.Deleted || !m_Mobile.Alive)
            {
                End();
                return;
            }

            CSI_Scroll scr = item as CSI_Scroll;

            if (scr == null)
            {
                End();
                return;
            }
            if (Spellbook.Find(m_Mobile, scr.SpellID) == null)
            {
                m_Mobile.SendAsciiMessage("You do not have that spell!");
                End();
                return;
            }

            Spell spell = SpellRegistry.NewSpell(scr.SpellID, m_Mobile, null);

            if (spell == null)
            {
                End();
                return;
            }

            int mana = spell.ScaleMana(spell.GetMana());

            if (m_Mobile.Mana < mana)
            {
                m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x22, 502625);                   // Insufficient mana for this spell.
                End();
                return;
            }
            else if (!spell.ConsumeReagents())
            {
                m_Mobile.LocalOverheadMessage(MessageType.Regular, 0x22, 502630);                   // More reagents are needed for this spell.
                End();
                return;
            }

            m_Mobile.Mana -= mana;

            base.OnItemSelected(item);
        }
        protected virtual int GetProgress(ConquestState state, CastSpellConquestContainer args)
        {
            if (state.User == null)
            {
                return(0);
            }

            if (args == null || args.SpellID < 0 || args.Mobile is PlayerMobile && args.Mobile.Account != state.User.Account)
            {
                return(0);
            }

            if (CheckBook)
            {
                var book = args.Spellbook as Spellbook;

                if (book == null || !book.HasSpell(args.SpellID))
                {
                    book = Spellbook.Find(args.Mobile, args.SpellID);
                }

                if (book == null)
                {
                    return(0);
                }
            }

            if (CheckRegs)
            {
                SpellInfo info = SpellRegistry.GetSpellInfo(args.SpellID);

                if (info != null && !args.Mobile.HasItems(info.Reagents, info.Amounts))
                {
                    return(0);
                }
            }

            if (Spell.IsNotNull && SpellRegistry.GetRegistryNumber(Spell) != args.SpellID)
            {
                if (ChangeSpellReset)
                {
                    return(-state.Progress);
                }

                return(0);
            }

            return(1);
        }
Beispiel #16
0
        public override int CanCraft(Mobile from, ITool tool, Type typeItem)
        {
            int num = 0;

            if (tool == null || tool.Deleted || tool.UsesRemaining <= 0)
            {
                return(1044038); // You have worn out your tool!
            }
            else if (!tool.CheckAccessible(from, ref num))
            {
                return(num); // The tool must be on your person to use.
            }

            if (typeItem != null && typeItem.IsSubclassOf(typeof(SpellScroll)))
            {
                if (!_Buffer.ContainsKey(typeItem))
                {
                    object o = Activator.CreateInstance(typeItem);

                    if (o is SpellScroll)
                    {
                        SpellScroll scroll = (SpellScroll)o;
                        _Buffer[typeItem] = scroll.SpellID;
                        scroll.Delete();
                    }
                    else if (o is IEntity)
                    {
                        ((IEntity)o).Delete();
                        return(1042404); // You don't have that spell!
                    }
                }

                int       id   = _Buffer[typeItem];
                Spellbook book = Spellbook.Find(from, id);

                if (book == null || !book.HasSpell(id))
                {
                    return(1042404); // You don't have that spell!
                }
            }

            return(0);
        }
Beispiel #17
0
        public static bool GetScroll(Mobile from, Type typeItem)
        {
            if (typeItem != null)
            {
                object o = Activator.CreateInstance(typeItem);

                if (o is SpellScroll)
                {
                    SpellScroll scroll = (SpellScroll)o;
                    Spellbook   book   = Spellbook.Find(from, scroll.SpellID);

                    bool hasSpell = (book != null && book.HasSpell(scroll.SpellID));

                    scroll.Delete();

                    return(hasSpell);
                }
                else if (o is Item)
                {
                    ((Item)o).Delete();
                }
            }
            return(false);
        }
Beispiel #18
0
        public bool HasSpell(int id)
        {
            Spellbook book = Spellbook.Find(m_From, id);

            return(book != null && book.HasSpell(id));
        }
        public static bool HasSpell(Mobile from, int spellID)
        {
            Spellbook book = Spellbook.Find(from, spellID);

            return(book != null && book.HasSpell(spellID));
        }
Beispiel #20
0
        protected override void CompileOptions(ToolbarGump toolbar, GumpButton clicked, Point loc, MenuGumpOptions opts)
        {
            if (toolbar == null)
            {
                return;
            }

            base.CompileOptions(toolbar, clicked, loc, opts);

            var user = toolbar.State.User;

            if (CanEdit || user.AccessLevel >= Toolbars.Access)
            {
                opts.Replace(
                    "Set Value",
                    new ListGumpEntry(
                        "Set Spell",
                        b =>
                {
                    toolbar.Refresh(true);
                    MenuGump menu1 = null;
                    var menuOpts1  = new MenuGumpOptions();

                    foreach (var kvp1 in SpellUtility.TreeStructure)
                    {
                        var circle = kvp1.Key;
                        var types  = kvp1.Value;

                        menuOpts1.AppendEntry(
                            new ListGumpEntry(
                                circle,
                                b2 =>
                        {
                            var menuOpts2 = new MenuGumpOptions();

                            foreach (var kvp2 in types)
                            {
                                var id   = SpellRegistry.GetRegistryNumber(kvp2.Key);
                                var si   = kvp2.Value;
                                var book = Spellbook.Find(user, id);

                                if (book != null && book.HasSpell(id))
                                {
                                    menuOpts2.AppendEntry(
                                        new ListGumpEntry(
                                            si.Name,
                                            menu2Button =>
                                    {
                                        SpellID = id;
                                        Value   = si.Name;
                                        Label   = String.Empty;
                                        toolbar.Refresh(true);
                                    },
                                            (SpellID == id) ? toolbar.HighlightHue : toolbar.TextHue));
                                }
                            }

                            if (menu1 != null)
                            {
                                SuperGump.Send(new MenuGump(user, clicked.Parent, menuOpts2, clicked));
                            }
                        }));
                    }

                    menu1 = new MenuGump(user, clicked.Parent, menuOpts1, clicked);
                    SuperGump.Send(menu1);
                },
                        toolbar.HighlightHue));
            }
        }
Beispiel #21
0
        public override void OnCast()
        {
            //get songbook instrument
            Spellbook book = Spellbook.Find(Caster, -1, SpellbookType.Song);

            if (book == null)
            {
                return;
            }
            m_Book = (SongBook)book;
            if (m_Book.Instrument == null || !(Caster.InRange(m_Book.Instrument.GetWorldLocation(), 1)))
            {
                Caster.SendMessage("Your instrument is missing! You can select another from your song book.");
                return;
            }

            bool sings = false;

            if (CheckSequence())
            {
                sings = true;

                double allvalue = (double)MusicSkill(Caster);

                {
                    ArrayList targets = new ArrayList();

                    foreach (Mobile m in Caster.GetMobilesInRange(3))
                    {
                        if (Caster.CanBeBeneficial(m, false, true) && !(m is Golem) && !(m is BaseCreature))
                        {
                            targets.Add(m);
                        }
                        //added: && !(m is BaseCreature ) , if it compiles. add to others
                    }

                    for (int i = 0; i < targets.Count; ++i)
                    {
                        Mobile m = (Mobile)targets[i];

                        //TimeSpan duration = TimeSpan.FromSeconds(Caster.Skills[SkillName.Musicianship].Value * 0.375);
                        TimeSpan duration = TimeSpan.FromSeconds(allvalue / 4 * 0.5);
                        int      rounds   = (int)(Caster.Skills[SkillName.Musicianship].Value * .16);

                        if (allvalue < 120)
                        {
                            new ExpireTimer(m, 0, rounds, TimeSpan.FromSeconds(2)).Start();
                        }
                        //2 mana
                        else if (allvalue < 240)
                        {
                            new ExpireTimer1(m, 0, rounds, TimeSpan.FromSeconds(2)).Start();
                        }
                        //3 mana
                        else if (allvalue < 360)
                        {
                            new ExpireTimer2(m, 0, rounds, TimeSpan.FromSeconds(2)).Start();
                        }
                        //4 mana
                        else if (allvalue < 480)
                        {
                            new ExpireTimer3(m, 0, rounds, TimeSpan.FromSeconds(2)).Start();
                        }
                        //5
                        else if (allvalue >= 480)
                        {
                            new ExpireTimer4(m, 0, rounds, TimeSpan.FromSeconds(2)).Start();
                        }
                        //10
                        else
                        {
                            new ExpireTimer(m, 0, rounds, TimeSpan.FromSeconds(2)).Start();
                        }
                        //not required, just in case the else if dont cover it all, same as first if

                        m.FixedParticles(0x376A, 9, 32, 5030, 0x256, 3, EffectLayer.Waist);
                        m.PlaySound(0x1F2);
                    }
                }

                FinishSequence();
            }
            BardFunctions.UseBardInstrument(m_Book.Instrument, sings, Caster);
        }
Beispiel #22
0
 public static bool HasSpell(Mobile from, int spellID) => Spellbook.Find(from, spellID)?.HasSpell(spellID) == true;
        public static bool HasSpell(Mobile from, SpellEntry spellId)
        {
            Spellbook book = Spellbook.Find(from, spellId);

            return(book != null && book.HasSpell(spellId));
        }