I have been trying to setup a new spell school on my server. I've script checked against ACCs way of doing it, and the base servers way of doing it, and decided to go with the couple of core edits I would need. I have the Spellbook created and Constructable in game, along with a Spell Scroll (Just doing 1 spell for now for proof of concept). The Spell Scroll successfully casts the spell, but the Spellbook shows it as a Bad Spell if added to the Spellbook.

I modified Spellbook.cs to include in the SpellbookType enum my custom spell school, and Added GetTypeForSpell(int spellID)

else if (spellID >= 900 && spellID < 916)
{
return SpellbookType.AdvancedSpells;
}


public static Spellbook FindAdvancedSpells(Mobile from)
{
return Find(from, -1, SpellbookType.AdvancedSpells);
}

and I've added AdvancedSpells to m_CircleNames in SpellRegistry.cs
and I've added Register(900, typeof(AdvancedSpells.DeathVortexSpell)); to Initializer.cs

Does anyone know what I am missing to allow the New Spellbook to be filled by the Spells with ID 900-915 (16 spells). If you need any parts of the code, feel free to ask. I just didn't want to upload that many files / places.
Post automatically merged:

Minor update: I managed to get the spell to add to the book, and updated spell count, still with the name Bad Spell, but it is castable out of the Spellbook.
 
Last edited:
In your custom spellbook, did you override BookOffset with your offset of 900?

C#:
public override int BookOffset => 900;
 
public override SpellbookType SpellbookType => SpellbookType.AdvancedSpells;
public override int BookOffset => 900;
public override int BookCount => 16;

And yes namespace Server.Spells.AdvancedSpells
 
In Spellbook.cs, did you modify the following method?:
C#:
        private static void EventSink_OpenSpellbookRequest(OpenSpellbookRequestEventArgs e)
        {
            Mobile from = e.Mobile;

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

            SpellbookType type;

            switch (e.Type)
            {
                default:
                case 1:
                    type = SpellbookType.Regular;
                    break;
                case 2:
                    type = SpellbookType.Necromancer;
                    break;
                case 3:
                    type = SpellbookType.Paladin;
                    break;
                case 4:
                    type = SpellbookType.Ninja;
                    break;
                case 5:
                    type = SpellbookType.Samurai;
                    break;
                case 6:
                    type = SpellbookType.Arcanist;
                    break;
                case 7:
                    type = SpellbookType.Mystic;
                    break;
            }

            Spellbook book = Find(from, -1, type);

            if (book != null)
            {
                book.DisplayTo(from);
            }
        }

I am guessing that when you open the Advanced Spellbook, it defaults to the default case so it thinks it's opening a Regular spellbook and when it finds spell ID 900 it does not recognize it as a regular spell. Not sure how to fix that, since the spellbook ID I think is coming from the Client.
 
You declare it and other variables in your custom spellbook. For example, I'm using a druid spellbook.

Code:
   public class DruidicSpellbook : Spellbook
   {
      public override SpellbookType SpellbookType{ get{ return SpellbookType.Druidic; } }
      public override int BookOffset{ get{ return 301; } }
      public override int BookCount{ get{ return 18; } }

Then the other edits already made should work.
 
Back