Server.Items.Runebook.OnDragDrop C# (CSharp) Method

OnDragDrop() public method

public OnDragDrop ( Mobile from, Item dropped ) : bool
from Mobile
dropped Item
return bool
        public override bool OnDragDrop( Mobile from, Item dropped )
        {
            if ( dropped is RecallRune )
            {
                if ( IsLockedDown && from.AccessLevel < AccessLevel.GameMaster )
                {
                    from.SendLocalizedMessage( 502413, null, 0x35 ); // That cannot be done while the book is locked down.
                }
                else if ( IsOpen( from ) )
                {
                    from.SendLocalizedMessage( 1005571 ); // You cannot place objects in the book while viewing the contents.
                }
                else if ( m_Entries.Count < 16 )
                {
                    RecallRune rune = (RecallRune)dropped;

                    if ( rune.Marked && rune.TargetMap != null )
                    {
                        m_Entries.Add( new RunebookEntry( rune.Target, rune.TargetMap, rune.Description, rune.House ) );

                        dropped.Delete();

                        from.Send( new PlaySound( 0x42, GetWorldLocation() ) );

                        string desc = rune.Description;

                        if ( desc == null || (desc = desc.Trim()).Length == 0 )
                            desc = "(indescript)";

                        from.SendMessage( desc );

                        return true;
                    }
                    else
                    {
                        from.SendLocalizedMessage( 502409 ); // This rune does not have a marked location.
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 502401 ); // This runebook is full.
                }
            }
            else if ( dropped is RecallScroll )
            {
                if ( m_CurCharges < m_MaxCharges )
                {
                    from.Send( new PlaySound( 0x249, GetWorldLocation() ) );

                    int amount = dropped.Amount;

                    if ( amount > (m_MaxCharges - m_CurCharges) )
                    {
                        dropped.Consume( m_MaxCharges - m_CurCharges );
                        m_CurCharges = m_MaxCharges;
                    }
                    else
                    {
                        m_CurCharges += amount;
                        dropped.Delete();

                        return true;
                    }
                }
                else
                {
                    from.SendLocalizedMessage( 502410 ); // This book already has the maximum amount of charges.
                }
            }

            return false;
        }