#W# Source and Scripts added. Added Scripts/Settings.cs to expose some basic tweak able settings.
This commit is contained in:
parent
b51c58f514
commit
3045c83799
3512 changed files with 627673 additions and 0 deletions
91
Scripts/Items/Suits/BaseSuit.cs
Normal file
91
Scripts/Items/Suits/BaseSuit.cs
Normal file
|
|
@ -0,0 +1,91 @@
|
|||
using System;
|
||||
using Server;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseSuit : Item
|
||||
{
|
||||
private AccessLevel m_AccessLevel;
|
||||
|
||||
[CommandProperty( AccessLevel.Administrator )]
|
||||
public AccessLevel AccessLevel{ get{ return m_AccessLevel; } set{ m_AccessLevel = value; } }
|
||||
|
||||
public BaseSuit( AccessLevel level, int hue, int itemID ) : base( itemID )
|
||||
{
|
||||
Hue = hue;
|
||||
Weight = 1.0;
|
||||
Movable = false;
|
||||
LootType = LootType.Newbied;
|
||||
Layer = Layer.OuterTorso;
|
||||
|
||||
m_AccessLevel = level;
|
||||
}
|
||||
|
||||
public BaseSuit( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (int) m_AccessLevel );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_AccessLevel = (AccessLevel)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
object root = RootParent;
|
||||
|
||||
if ( root is Mobile && ((Mobile)root).AccessLevel < m_AccessLevel )
|
||||
{
|
||||
Delete();
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void OnSingleClick( Mobile from )
|
||||
{
|
||||
if ( Validate() )
|
||||
base.OnSingleClick( from );
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( Validate() )
|
||||
base.OnDoubleClick( from );
|
||||
}
|
||||
|
||||
public override bool VerifyMove( Mobile from )
|
||||
{
|
||||
return ( from.AccessLevel >= m_AccessLevel );
|
||||
}
|
||||
|
||||
public override bool OnEquip( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel < m_AccessLevel )
|
||||
from.SendMessage( "You may not wear this." );
|
||||
|
||||
return ( from.AccessLevel >= m_AccessLevel );
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue