Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -1,60 +1,60 @@
|
|||
using Server.Items;
|
||||
using Server.Network;
|
||||
using Server.Targeting;
|
||||
|
||||
namespace Server.ContextMenus
|
||||
{
|
||||
public class AddToSpellbookEntry : ContextMenuEntry
|
||||
{
|
||||
public AddToSpellbookEntry() : base( 6144, 3 )
|
||||
{
|
||||
}
|
||||
public class AddToSpellbookEntry : ContextMenuEntry
|
||||
{
|
||||
public AddToSpellbookEntry() : base(6144, 3)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnClick()
|
||||
{
|
||||
if ( Owner.From.CheckAlive() && Owner.Target is SpellScroll scroll )
|
||||
Owner.From.Target = new InternalTarget( scroll );
|
||||
}
|
||||
public override void OnClick()
|
||||
{
|
||||
if (Owner.From.CheckAlive() && Owner.Target is SpellScroll scroll)
|
||||
Owner.From.Target = new InternalTarget(scroll);
|
||||
}
|
||||
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private SpellScroll m_Scroll;
|
||||
private class InternalTarget : Target
|
||||
{
|
||||
private SpellScroll m_Scroll;
|
||||
|
||||
public InternalTarget( SpellScroll scroll ) : base( 3, false, TargetFlags.None )
|
||||
{
|
||||
m_Scroll = scroll;
|
||||
}
|
||||
public InternalTarget(SpellScroll scroll) : base(3, false, TargetFlags.None)
|
||||
{
|
||||
m_Scroll = scroll;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
if ( targeted is Spellbook book )
|
||||
{
|
||||
if ( from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 && m_Scroll.CheckItemUse( from ) )
|
||||
{
|
||||
SpellbookType type = Spellbook.GetTypeForSpell( m_Scroll.SpellID );
|
||||
protected override void OnTarget(Mobile from, object targeted)
|
||||
{
|
||||
if (targeted is Spellbook book)
|
||||
if (from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 &&
|
||||
m_Scroll.CheckItemUse(from))
|
||||
{
|
||||
SpellbookType type = Spellbook.GetTypeForSpell(m_Scroll.SpellID);
|
||||
|
||||
if ( type != book.SpellbookType )
|
||||
{
|
||||
}
|
||||
else if ( book.HasSpell( m_Scroll.SpellID ) )
|
||||
{
|
||||
from.SendLocalizedMessage( 500179 ); // That spell is already present in that spellbook.
|
||||
}
|
||||
else
|
||||
{
|
||||
int val = m_Scroll.SpellID - book.BookOffset;
|
||||
if (type != book.SpellbookType)
|
||||
{
|
||||
}
|
||||
else if (book.HasSpell(m_Scroll.SpellID))
|
||||
{
|
||||
from.SendLocalizedMessage(500179); // That spell is already present in that spellbook.
|
||||
}
|
||||
else
|
||||
{
|
||||
int val = m_Scroll.SpellID - book.BookOffset;
|
||||
|
||||
if ( val >= 0 && val < book.BookCount )
|
||||
{
|
||||
book.Content |= (ulong)1 << val;
|
||||
if (val >= 0 && val < book.BookCount)
|
||||
{
|
||||
book.Content |= (ulong)1 << val;
|
||||
|
||||
m_Scroll.Consume();
|
||||
m_Scroll.Consume();
|
||||
|
||||
from.Send( new Network.PlaySound( 0x249, book.GetWorldLocation() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
from.Send(new PlaySound(0x249, book.GetWorldLocation()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue