Exemplo n.º 1
0
        private static void OnSpellRequest(CastSpellRequestEventArgs e)
        {
            if (!CMOptions.ModuleEnabled)
            {
                return;
            }

            var user = e.Mobile as PlayerMobile;

            if (user == null)
            {
                return;
            }

            var o = EnsureState(user);

            if (o != null && o.Enabled)
            {
                if (CMOptions.ModuleDebug)
                {
                    CMOptions.ToConsole("{0} casting {1} ({2})", user, e.SpellID, user.Spell);
                }

                if (user.Spell != null && SpellRegistry.GetRegistryNumber(user.Spell) == e.SpellID)
                {
                    SendCastBarGump(user);
                }
                else
                {
                    _CastBarQueue.Enqueue(user);
                }
            }
        }
Exemplo n.º 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.SendLocalizedMessage(502345);                       // This spell has been temporarily disabled.
                }
            }
            else
            {
                from.SendLocalizedMessage(500015);                   // You do not have that spell!
            }
        }
Exemplo n.º 3
0
        private static void OnSpellRequest(CastSpellRequestEventArgs e)
        {
            if (!CMOptions.ModuleEnabled || !(e.Mobile is PlayerMobile))
            {
                return;
            }

            PlayerMobile user = (PlayerMobile)e.Mobile;

            if (!States.ContainsKey(user) || States[user].Item1)
            {
                _CastBarQueue.Enqueue(user);
            }
        }
Exemplo n.º 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!
            }
        }
Exemplo n.º 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!
            }
        }
Exemplo n.º 6
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!
            }
        }
Exemplo n.º 7
0
        private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
        {
            Mobile from = e.Mobile;

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

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

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

            // add check for pseudoseer controlled mob
            var bc = from as BaseCreature;

            if ((from is PlayerMobile || bc == null || bc.Deleted || bc.NetState == null || bc.Pseu_SpellBookRequired) &&
                (book == null || !book.HasSpell(spellID)))
            {
                from.SendLocalizedMessage(500015);                 // You do not have that spell!
                return;
            }

            Spell spell = SpellRegistry.NewSpell(spellID, from, null);

            if (spell != null)
            {
                spell.Cast();
            }
            else
            {
                from.SendLocalizedMessage(502345);                 // This spell has been temporarily disabled.
            }
        }
Exemplo n.º 8
0
 public void InvokeCastSpellRequest( CastSpellRequestEventArgs e )
 {
     if ( CastSpellRequest != null )
         CastSpellRequest( e );
 }
Exemplo n.º 9
0
		private static void EventSink_CastSpellRequest(CastSpellRequestEventArgs e)
		{
			Mobile from = e.Mobile;

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

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

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

			// add check for pseudoseer controlled mob
			var bc = from as BaseCreature;

			if ((from is PlayerMobile || bc == null || bc.Deleted || bc.NetState == null || bc.Pseu_SpellBookRequired) &&
				(book == null || !book.HasSpell(spellID)))
			{
				from.SendLocalizedMessage(500015); // You do not have that spell!
				return;
			}

			Spell spell = SpellRegistry.NewSpell(spellID, from, null);

			if (spell != null)
			{
				spell.Cast();
			}
			else
			{
				from.SendLocalizedMessage(502345); // This spell has been temporarily disabled.
			}
		}
Exemplo n.º 10
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!
			}
		}