branch sync, Constructable can now have an accesslevel defined.

This commit is contained in:
mark 2007-09-13 19:37:44 +00:00
parent fede41b710
commit 5d78b17be1
7 changed files with 52 additions and 11 deletions

View file

@ -157,7 +157,7 @@ namespace Server.Commands
{
ConstructorInfo ctor = ctors[i];
if ( !IsConstructable( ctor ) )
if ( !IsConstructable( ctor, from.AccessLevel ) )
continue;
ParameterInfo[] paramList = ctor.GetParameters();
@ -345,7 +345,7 @@ namespace Server.Commands
{
ConstructorInfo ctor = ctors[i];
if ( !IsConstructable( ctor ) )
if ( !IsConstructable( ctor, from.AccessLevel ) )
continue;
if ( !foundCtor )
@ -524,9 +524,14 @@ namespace Server.Commands
private static Type m_ConstructableType = typeof( ConstructableAttribute );
public static bool IsConstructable( ConstructorInfo ctor )
public static bool IsConstructable( ConstructorInfo ctor, AccessLevel accessLevel )
{
return ctor.IsDefined( m_ConstructableType, false );
object[] attrs = ctor.GetCustomAttributes( m_ConstructableType, false );
if ( attrs.Length == 0 )
return false;
return accessLevel >= ((ConstructableAttribute)attrs[0]).AccessLevel;
}
private static Type m_EnumType = typeof( Enum );

View file

@ -1,5 +1,6 @@
using System;
using Server.Items;
using Server.Network;
using Server.Targeting;
namespace Server.ContextMenus
@ -29,7 +30,7 @@ namespace Server.ContextMenus
{
if ( targeted is Spellbook )
{
if ( from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 )
if ( from.CheckAlive() && !m_Scroll.Deleted && m_Scroll.Movable && m_Scroll.Amount >= 1 && m_Scroll.CheckItemUse( from ) )
{
Spellbook book = (Spellbook)targeted;

View file

@ -16,7 +16,7 @@ namespace Server.ContextMenus
public override void OnClick()
{
if ( m_Food.Deleted || !m_Food.Movable || !m_From.CheckAlive() )
if ( m_Food.Deleted || !m_Food.Movable || !m_From.CheckAlive() || !m_Food.CheckItemUse( m_From ) )
return;
m_Food.Eat( m_From );

View file

@ -70,6 +70,7 @@ namespace Server.Items
if ( from.Alive && this.Movable )
list.Add( new ContextMenus.AddToSpellbookEntry() );
}
public override void OnDoubleClick( Mobile from )
{