Are you trying to make a specific type of spellbook that needs to be equipped to work, or are you trying to make it so that ALL spellbooks must be equipped to work?
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);
}
// THIS WILL CHECK TO SEE IF THE MAGERY BOOK IS EQUIPPED
else if (book is MagerySpellbook && !(book == FindEquippedSpellbook(from)))
{
from.SendMessage("That spellbook must be equipped.");
}
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!
}
}
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 ) )
{
SpecialMove move = SpellRegistry.GetSpecialMove( spellID );
if ( move != null )
{
SpecialMove.SetCurrentMove( from, move );
}
else if (book.SpellbookType = SpellbookType.Regular && !(book = FindEquippedSpellbook(from)))
{
from.SendMessage("That spellbook must be equipped.");
}
else
{
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!
}
}
We use essential cookies to make this site work, and optional cookies to enhance your experience.