tass23

Member
This Spellbook Basket was given to me by a friend from a 'shard they no longer had running. My 'shard also has ACC Spells installed, but I could not get the spellbooks to fully work from inside the Spellbook Basket. You could put the book in there, open it and cast from the button, but not from the scroll or a locked into position icon.

Now everything works as intended. All spellbooks can be put into the Spellbook basket and still work, including the OSI spellbooks.

I tried a ton to fix CSpellbook.cs, but it was not the whole problem, CheckRestrictions was the other half to the equation.

So if you want to use the Spellbook Basket with ACC, here are the changes in two places.
ACC-->Complete Spell System-->Core --> CSpellbook.cs
inside the method for [public static book MobileHasSpell], underneath the backpack code, add this region:
C#:
#region SpellbookBasket
Container pack2 = m.Backpack.FindItemByType( typeof( SpellbookBasket )) as Container;
foreach( Item i in pack2.FindItemsByType( typeof( CSpellbook ), true ) )
{
    CSpellbook book = (CSpellbook)i;
    if (book.School == school && book.HasSpell(type))
        return true;
}
#endregion

Then go into the ACC-->Complete Spell System-->Changing-->SpellRestrictions.cs
inside the method for [public static book CheckRestrictions], add this region before the [return false;] line
C#:
#region SpellbookBasket
Container pack2 = caster.Backpack.FindItemByType( typeof( SpellbookBasket )) as Container;
if( pack2 == null )
    return false;

    for( int i = 0; i < pack2.Items.Count; i++ )
    {
        item = (Item)pack2.Items[i];
        if( item is CSpellbook && CheckRestrictions( caster, ((CSpellbook)item).School ) )
            return true;
    }
#endregion

The last edit comes to each spellbook inside ACC -->Systems (Open Each folder and open the XSpellbook.cs, where X is the system). This edit removes the check for Players, which does not apply to Staff and then CheckRestrictions becomes the main way to verify the spellbook is inside the player's backpack (or the spellbook basket).

C#:
public override void OnDoubleClick( Mobile from )
{
    if ( from.AccessLevel == AccessLevel.Player )
    {
        /*Container pack = from.Backpack;
        if( !(Parent == from || (pack != null && Parent == pack)) )
        {
            from.SendMessage( "The spellbook must be in your backpack [and not in a container within] to open." );
                return;
        }
        else*/if( SpellRestrictions.UseRestrictions && !SpellRestrictions.CheckRestrictions( from, this.School ) )
                {
                    return;
                }
    }

    from.CloseGump( typeof( ChivalrySpellbookGump ) );
    from.SendGump( new ChivalrySpellbookGump( this ) );
}

Spellbook Basket script has already been edited to include ACC and OSI spellbooks.
(Doubtful this is drag/drop, so PM for help or post on the forums.)
 

Attachments

  • SpellbookBasket.zip
    899 bytes · Views: 38
Last edited:
------------------------------------------------------------------------------------------------------------------------
ServUO - [ServUO - Ultima Online Emulation] Version 0.5, Build 6437.20990
Publish 54
Core: Optimizing for 4 64-bit processors
RandomImpl: CSPRandom (Software)
Core: Loading config...
Scripts: Compiling C# scripts...Failed with: 1 errors, 8 warnings
Warnings:
+ Custom/Server Things/Stripper.cs:
CS0105: Line 11: The using directive for 'Server.Misc' appeared previously in this namespace
+ Custom/Working on 10.14.2019/Easter 2011/RobinEgg.cs:
CS0105: Line 17: The using directive for 'Server.Items' appeared previously in this namespace
+ Custom/Working on 10.14.2019/Easter 2012/Easter Collection/Rewards/SquirrelAcorn.cs:
CS0105: Line 20: The using directive for 'Server.Items' appeared previously in this namespace
+ Items/Tools/ProspectorsTool.cs:
CS0105: Line 4: The using directive for 'Server.Engines.Harvest' appeared previously in this namespace
+ Quests/1My Quest/Holiday Quest/FEB/ValentineQuest/EvilCupid1.cs:
CS0105: Line 9: The using directive for 'Server.Items' appeared previously in this namespace
+ Quests/Baby Quest/Mother.cs:
CS0105: Line 8: The using directive for 'Server.ContextMenus' appeared previously in this namespace
+ Quests/SaturnQuest DONE/Mobiles & Quest Items/NebulasRing.cs:
CS0105: Line 6: The using directive for 'System' appeared previously in this namespace
+ Quests/[ServUO.com]-GraniteFurnessAddon.cs:
CS0105: Line 2: The using directive for 'System' appeared previously in this namespace
Errors:
+ Custom/123/Working On/SpellbookBasket.cs:
CS0234: Line 5: The type or namespace name 'Spellweaving' does not exist in the namespace 'Server.ACC.CSS.Systems' (are you missing an assembly reference?)
CS0234: Line 6: The type or namespace name 'Mysticism' does not exist in the namespace 'Server.ACC.CSS.Systems' (are you missing an assembly reference?)
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.
 
It doesn't work with the new spellweaving system, and it appears you don't have the Mysticism part installed. You can try this I just removed those two:
C#:
using System;
using Server;
using Server.Items;
using Server.ACC.CSS;
using Server.ACC.CSS.Systems.Chivalry;
using Server.ACC.CSS.Systems.Mage;
using Server.ACC.CSS.Systems.Necromancy;

namespace Server.Items
{
    public class SpellbookBasket : BaseContainer
    {
        public override int DefaultGumpID{ get{ return 0x108; } }
        public override int DefaultDropSound{ get{ return 0x4F; } }

        public override Rectangle2D Bounds
        {
            get{ return new Rectangle2D( 19, 47, 163, 76 ); }
        }

        [Constructable]
        public SpellbookBasket() : base( 0x24D9 )
        {
            Movable = true;
            Hue = 1259;
            Name = "Spellbook Basket";
            LootType = LootType.Blessed;
        }

        public SpellbookBasket( Serial serial ) : base( serial )
        {
        }

        public override bool OnDragDrop( Mobile from, Item dropped )
        {
            if ( dropped is Spellbook )
            { 
                Spellbook spellb = (Spellbook)dropped;           
                DropItem ( spellb );
                return true;
            }
            else if ( dropped is NecroSpellbook )
            {
                NecroSpellbook spellb = (NecroSpellbook)dropped;
                DropItem ( spellb );
                return true;
            }
            else if ( dropped is MageSpellbook )
            {
                MageSpellbook spellb = (MageSpellbook)dropped;
                DropItem ( spellb );
                return true;
            }
            else if ( dropped is ChivalrySpellbook )
            {
                ChivalrySpellbook spellb = (ChivalrySpellbook)dropped;
                DropItem ( spellb );
                return true;
            }

            #region ACC Spellbooks
            else if ( dropped is CSpellbook )
            {
                CSpellbook spellb = (CSpellbook)dropped;
                DropItem ( spellb );
                return true;
            }
            #endregion

            else
        
            return false;
        }

        public override bool OnDragDropInto( Mobile from, Item dropped, Point3D p )
        {
            if ( dropped is Spellbook )
            {
                Spellbook spellb = (Spellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            else if ( dropped is NecroSpellbook )
            {
                NecroSpellbook spellb = (NecroSpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            else if ( dropped is MageSpellbook )
            {
                MageSpellbook spellb = (MageSpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            else if ( dropped is ChivalrySpellbook )
            {
                ChivalrySpellbook spellb = (ChivalrySpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }

            #region ACC Spellbooks
            else if ( dropped is CSpellbook )
            {
                CSpellbook spellb = (CSpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            #endregion
            else

            return false;
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }
}
 
It doesn't work with the new spellweaving system, and it appears you don't have the Mysticism part installed. You can try this I just removed those two:
C#:
using System;
using Server;
using Server.Items;
using Server.ACC.CSS;
using Server.ACC.CSS.Systems.Chivalry;
using Server.ACC.CSS.Systems.Mage;
using Server.ACC.CSS.Systems.Necromancy;

namespace Server.Items
{
    public class SpellbookBasket : BaseContainer
    {
        public override int DefaultGumpID{ get{ return 0x108; } }
        public override int DefaultDropSound{ get{ return 0x4F; } }

        public override Rectangle2D Bounds
        {
            get{ return new Rectangle2D( 19, 47, 163, 76 ); }
        }

        [Constructable]
        public SpellbookBasket() : base( 0x24D9 )
        {
            Movable = true;
            Hue = 1259;
            Name = "Spellbook Basket";
            LootType = LootType.Blessed;
        }

        public SpellbookBasket( Serial serial ) : base( serial )
        {
        }

        public override bool OnDragDrop( Mobile from, Item dropped )
        {
            if ( dropped is Spellbook )
            {
                Spellbook spellb = (Spellbook)dropped;         
                DropItem ( spellb );
                return true;
            }
            else if ( dropped is NecroSpellbook )
            {
                NecroSpellbook spellb = (NecroSpellbook)dropped;
                DropItem ( spellb );
                return true;
            }
            else if ( dropped is MageSpellbook )
            {
                MageSpellbook spellb = (MageSpellbook)dropped;
                DropItem ( spellb );
                return true;
            }
            else if ( dropped is ChivalrySpellbook )
            {
                ChivalrySpellbook spellb = (ChivalrySpellbook)dropped;
                DropItem ( spellb );
                return true;
            }

            #region ACC Spellbooks
            else if ( dropped is CSpellbook )
            {
                CSpellbook spellb = (CSpellbook)dropped;
                DropItem ( spellb );
                return true;
            }
            #endregion

            else
      
            return false;
        }

        public override bool OnDragDropInto( Mobile from, Item dropped, Point3D p )
        {
            if ( dropped is Spellbook )
            {
                Spellbook spellb = (Spellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            else if ( dropped is NecroSpellbook )
            {
                NecroSpellbook spellb = (NecroSpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            else if ( dropped is MageSpellbook )
            {
                MageSpellbook spellb = (MageSpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            else if ( dropped is ChivalrySpellbook )
            {
                ChivalrySpellbook spellb = (ChivalrySpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }

            #region ACC Spellbooks
            else if ( dropped is CSpellbook )
            {
                CSpellbook spellb = (CSpellbook)dropped;
                spellb.Location = new Point3D( p.X, p.Y, 0 );
                AddItem ( spellb );
                return true;
            }
            #endregion
            else

            return false;
        }

        public override void Serialize( GenericWriter writer )
        {
            base.Serialize( writer );

            writer.Write( (int) 0 );
        }

        public override void Deserialize( GenericReader reader )
        {
            base.Deserialize( reader );

            int version = reader.ReadInt();
        }
    }
}
I guess I am missing something because when I put the full spell book in it and try to cast it says I do not have that spell.
 

Attachments

  • Untitled.png
    Untitled.png
    736.1 KB · Views: 34
This was meant for the ACC extra spells system, you would have to modify the base spell book and the basket to accept it. Last time I tried that I was unsuccessful but that was also a long time ago.
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back