HasSpell() публичный Метод

public HasSpell ( int spellID ) : bool
spellID int
Результат bool
Пример #1
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                Spell spell = SpellRegistry.NewSpell(spellID, from, null);

                if (spell != null)
                {
                    spell.Cast();
                }
                else
                {
                    from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);                   // You do not have that spell!
            }
        }
Пример #2
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!Multis.DesignContext.Check(from))
            {
                return;                 // They are customizing
            }
            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                Spell spell = SpellRegistry.NewSpell(spellID, from, null);

                if (spell != null)
                {
                    spell.Cast();
                }
                else
                {
                    from.SendAsciiMessage("This spell has been temporarily disabled.");
                }
            }
            else
            {
                from.SendAsciiMessage("You do not have that spell!");
            }
        }
Пример #3
0
        private static void Targeted_Spell(TargetedSpellEventArgs e)
        {
            try
            {
                Mobile from = e.Mobile;

                if (!DesignContext.Check(from))
                {
                    return; // They are customizing
                }

                Spellbook book    = null;
                int       spellID = e.SpellID;

                if (book == null || !book.HasSpell(spellID))
                {
                    book = Find(from, spellID);
                }

                if (book != null && book.HasSpell(spellID))
                {
                    SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                    if (move != null)
                    {
                        SpecialMove.SetCurrentMove(from, move);
                    }
                    else
                    {
                        Mobile to    = World.FindMobile(e.Target.Serial);
                        Item   toI   = World.FindItem(e.Target.Serial);
                        Spell  spell = SpellRegistry.NewSpell(spellID, from, null);

                        if (to != null)
                        {
                            spell.InstantTarget = to;
                        }
                        else if (toI != null)
                        {
                            spell.InstantTarget = toI as IDamageableItem;
                        }

                        if (spell != null)
                        {
                            spell.Cast();
                        }
                        else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID))
                        {
                            from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500015); // You do not have that spell!
                }
            }
            catch { }
        }
Пример #4
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from  = e.Mobile;
            Spell  spell = SpellRegistry.NewSpell(e.SpellID, from, null);

            if (!Multis.DesignContext.Check(from))
            {
                return; // They are customizing
            }
            if (spell != null && from.AccessLevel > AccessLevel.Player)
            {
                spell.Cast(); //staff do not need the spellbook
                return;
            }

            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                if (move != null)
                {
                    SpecialMove.SetCurrentMove(from, move);
                }
                else
                {
                    if (spell != null)
                    {
                        spell.Cast();
                    }
                    else
                    {
                        from.SendLocalizedMessage(502345);   // This spell has been temporarily disabled.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);   // You do not have that spell!
            }
        }
Пример #5
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

            if (!DesignContext.Check(from))
            {
                return;                 // They are customizing
            }

            Spellbook book    = e.Spellbook as Spellbook;
            int       spellID = e.SpellID;

            if (book == null || !book.HasSpell(spellID))
            {
                book = Find(from, spellID);
            }

            if (book != null && book.HasSpell(spellID))
            {
                SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                if (move != null)
                {
                    SpecialMove.SetCurrentMove(from, move);
                }
                else
                {
                    Spell spell = SpellRegistry.NewSpell(spellID, from, null);

                    if (spell != null)
                    {
                        spell.Cast();
                    }
                    else if (!Server.Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID))
                    {
                        from.SendLocalizedMessage(502345);                           // This spell has been temporarily disabled.
                    }
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);                 // You do not have that spell!
            }
        }
Пример #6
0
        private static void Targeted_Spell(TargetedSpellEventArgs e)
        {
            try
            {
                Mobile from = e.Mobile;

                if (!DesignContext.Check(from))
                {
                    return; // They are customizing
                }

                int spellID = e.SpellID;

                Spellbook book = Find(from, spellID);

                if (book != null && book.HasSpell(spellID))
                {
                    SpecialMove move = SpellRegistry.GetSpecialMove(spellID);

                    if (move != null)
                    {
                        SpecialMove.SetCurrentMove(from, move);
                    }
                    else if (e.Target != null)
                    {
                        Mobile to    = World.FindMobile(e.Target.Serial);
                        Item   toI   = World.FindItem(e.Target.Serial);
                        Spell  spell = SpellRegistry.NewSpell(spellID, from, null);

                        if (spell != null && !Spells.SkillMasteries.MasteryInfo.IsPassiveMastery(spellID))
                        {
                            if (to != null)
                            {
                                spell.InstantTarget = to;
                            }
                            else if (toI != null)
                            {
                                spell.InstantTarget = toI as IDamageableItem;
                            }

                            spell.Cast();
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(500015); // You do not have that spell!
                }
            }
            catch (Exception ex)
            {
                Diagnostics.ExceptionLogging.LogException(ex);
            }
        }
Пример #7
0
		public static bool ValidateSpellbook( Spellbook book, int spellID, SpellbookType type )
		{
			return ( book.SpellbookType == type && ( spellID == -1 || book.HasSpell( spellID ) ) );
		}
Пример #8
0
 public static bool ValidateSpellbook(Spellbook book, int spellID, SpellbookType type)
 {
     return(book.SpellbookType == type && (spellID == -1 || book.HasSpell(spellID)));
 }
Пример #9
0
        public static bool HasSpell(Mobile from, int spellID)
        {
            Spellbook book = Spellbook.Find(from, spellID);

            return(book != null && book.HasSpell(spellID));
        }
Пример #10
0
 public static bool ValidateSpellbook(Spellbook book, SpellEntry spellId, SpellbookType type)
 {
     return(book.SpellbookType == type && (spellId == SpellEntry.None || book.HasSpell(spellId)));
 }
        public void FillBook(Spellbook spb, Mobile from, bool gump)
        {
            if (spb is BookOfChivalry || spb is BookOfBushido || spb is BookOfNinjitsu)    //NOTE:tookout druid cause dont have:ENDNOTE || spb is DruidSpellbook)
            {
                from.SendMessage("That spellbook is not supported.");
                return;
            }

            if (al_GlobalEntry == null)
            {
                InitArray();
            }

            int numSpellMissing = 0;
            int numSpellFilled  = 0;

            for (int sid = spb.BookOffset; sid < spb.BookOffset + spb.BookCount; sid++)
            {
                int tid = sid;
                if (spb.HasSpell(sid))
                {
                    continue;
                }

                if (tid >= 100 && tid <= 115)
                {
                    tid -= 36;
                }
                else if (tid > 64)
                {
                    continue;
                }

                if (((ScrollEntry)al_GlobalEntry[tid]).Amount <= 0)
                {
                    numSpellMissing++;
                    continue;
                }

                ((ScrollEntry)al_GlobalEntry[tid]).Amount--;
                int val = sid - spb.BookOffset;

                if (val >= 0 && val < spb.BookCount)                   // double check
                {
                    spb.Content |= (ulong)1 << val;

                    numSpellFilled++;

                    spb.InvalidateProperties();
                }
            }

            from.SendMessage(numSpellFilled.ToString() + " spells are added to the book. ");
            if (numSpellMissing > 0)
            {
                from.SendMessage("There are still " + numSpellMissing.ToString() + " spells missing.");
            }
            else
            {
                from.SendMessage("Now the spell book is complete.");
            }

            if (gump)
            {
                from.SendGump(new ResourceStorageKeyScribersTomeGump(from, this));
            }
        }
Пример #12
0
            protected override void OnTarget(Mobile from, object target)
            {
                if (!SpecialAbilities.Exists(from))
                {
                    return;
                }
                if (from.Backpack == null)
                {
                    return;
                }

                if (!(target is Spellbook))
                {
                    from.SendMessage("That is not a spellbook.");
                    return;
                }

                Spellbook spellbook = target as Spellbook;

                Item item = from.FindItemOnLayer(Layer.FirstValid);

                if (!(spellbook.IsChildOf(from.Backpack) || item == spellbook))
                {
                    from.SendMessage("You may only target spellbooks you have equipped or in your backpack.");
                    return;
                }

                List <SpellScroll> m_Scrolls = from.Backpack.FindItemsByType <SpellScroll>();

                int totalCount = 0;

                Queue m_Queue = new Queue();

                foreach (SpellScroll spellScroll in m_Scrolls)
                {
                    SpellbookType type = GetTypeForSpell(spellScroll.SpellID);

                    if (type != spellbook.SpellbookType)
                    {
                        continue;
                    }

                    if (spellbook.HasSpell(spellScroll.SpellID))
                    {
                        continue;
                    }

                    m_Queue.Enqueue(spellScroll);
                }

                while (m_Queue.Count > 0)
                {
                    SpellScroll spellScroll = (SpellScroll)m_Queue.Dequeue();

                    if (spellbook.HasSpell(spellScroll.SpellID))
                    {
                        continue;
                    }

                    int val = spellScroll.SpellID - spellbook.BookOffset;

                    if (val >= 0 && val < spellbook.BookCount)
                    {
                        totalCount++;

                        spellbook.m_Content |= (ulong)1 << val;
                        ++spellbook.m_Count;

                        spellbook.InvalidateProperties();

                        if (spellScroll.Amount > 1)
                        {
                            spellScroll.Amount--;
                        }

                        else
                        {
                            spellScroll.Delete();
                        }
                    }
                }

                if (totalCount > 0)
                {
                    from.SendSound(0x249);
                    from.SendMessage("You add " + totalCount.ToString() + " spells into the spellbook.");
                }

                else
                {
                    if (m_Scrolls.Count == 0)
                    {
                        from.SendMessage("You do not have any spell scrolls in your backpack.");
                    }

                    else
                    {
                        from.SendMessage("That spellbook already has those spells present within.");
                    }
                }
            }
        public void FillBook(Spellbook spb, Mobile from, bool gump)
        {
        	if (spb is BookOfChivalry || spb is BookOfBushido || spb is BookOfNinjitsu)//NOTE:tookout druid cause dont have:ENDNOTE || spb is DruidSpellbook)
            {
                from.SendMessage("That spellbook is not supported.");
                return;
            }

            if (al_GlobalEntry == null)
                InitArray();

            int numSpellMissing = 0;
            int numSpellFilled = 0;
            for (int sid = spb.BookOffset; sid < spb.BookOffset + spb.BookCount; sid++)
            {
                int tid = sid;
                if (spb.HasSpell(sid))
                    continue;

                if (tid >= 100 && tid <= 115)
                    tid -= 36;
                else if (tid > 64)
                    continue;

                if (((ScrollEntry)al_GlobalEntry[tid]).Amount <= 0)
                {
                    numSpellMissing++;
                    continue;
                }

                ((ScrollEntry)al_GlobalEntry[tid]).Amount --;
					int val = sid - spb.BookOffset;

				if ( val >= 0 && val < spb.BookCount ) // double check
				{
					spb.Content |= (ulong)1 << val;

                    numSpellFilled++;

					spb.InvalidateProperties();
                }
            
            }

            from.SendMessage(numSpellFilled.ToString() + " spells are added to the book. ");
            if (numSpellMissing > 0)
                from.SendMessage("There are still " + numSpellMissing.ToString() + " spells missing.");
            else
                from.SendMessage("Now the spell book is complete.");

            if (gump)
                from.SendGump(new ResourceStorageKeyScribersTomeGump(from, this));
        }