I'm trying to do something similar with spells also. I'm trying to make a cleric line of spells with their own book. I'm using the same book as the main spellbook. To save space, I only inserted parts of the script. I can post the entire scripts if needed.
holybook.cs
[code:1]using System;
using Server.Network;
using Server.Spells;
namespace Server.Items
{
public class Holybook : Spellbook
{
public override SpellbookType SpellbookType{ get{ return SpellbookType.Cleric; } }
public override int BookOffset{ get{ return 300; } }
public override int BookCount{ get{ return 22; } }
public override Item Dupe( int amount )
{
Spellbook book = new Holybook();
book.Content = this.Content;
return base.Dupe( book, amount );
}
[Constructable]
public Holybook() : this( (ulong)0 )
{
}
[Constructable]
public Holybook( ulong content ) : base( content, 0xEFA )
{
}
public Holybook( Serial serial ) : base( serial )
{
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
writer.Write( (int) 0 ); // version
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
int version = reader.ReadInt();
}
}
}[/code:1]
Changes to spellbook.cs
[code:1] public enum SpellbookType
{
Invalid = -1,
Regular,
Necromancer,
Paladin,
Cleric // ***ADDED***
}[/code:1]
[code:1] 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.Cleric; break; // ***ADDED***
}
[/code:1]
[code:1] public static SpellbookType GetTypeForSpell( int spellID )
{
if ( spellID >= 0 && spellID < 64 )
return SpellbookType.Regular;
else if ( spellID >= 100 && spellID < 116 )
return SpellbookType.Necromancer;
else if ( spellID >= 200 && spellID < 210 )
return SpellbookType.Paladin;
else if ( spellID >= 300 && spellID < 322 ) // ***ADDED***
return SpellbookType.Cleric; // ***ADDED***
return SpellbookType.Invalid;
}
[/code:1]
[code:1] public static Spellbook FindCleric( Mobile from ) // ***ADDED***
{ // ***ADDED***
return Find( from, -1, SpellbookType.Cleric ); // ***ADDED***
} // ***ADDED***
[/code:1]
Changes to healscroll.cs
[code:1] [Constructable]
public HealScroll( int amount ) : base( 300, 0x1F31, amount ) // *** originally base( 3,
{
}
[/code:1]
Changes to initializer.cs
[code:1] // Cleric spells
Register( 300, typeof( First.HealSpell ) );
[/code:1]
No errors during startup.
I can create the holybook, even though it stills labels as spellbook.
I can create the new healscroll.
I can put the healscroll in the holybook, and NOT the spellbook, as I wanted.
The problem is the spell lists as "Bad Spell" in the spell book.
Also, when I try to cast the spell from the book, or from the scroll I get this message - "This spell has been temporarily disabled"
Jalister