Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
83
Projects/Scripts/Items/Suits/BaseSuit.cs
Normal file
83
Projects/Scripts/Items/Suits/BaseSuit.cs
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseSuit : Item
|
||||
{
|
||||
public BaseSuit(AccessLevel level, int hue, int itemID) : base(itemID)
|
||||
{
|
||||
Hue = hue;
|
||||
Weight = 1.0;
|
||||
Movable = false;
|
||||
LootType = LootType.Newbied;
|
||||
Layer = Layer.OuterTorso;
|
||||
|
||||
AccessLevel = level;
|
||||
}
|
||||
|
||||
public BaseSuit(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.Administrator)]
|
||||
public AccessLevel AccessLevel{ get; set; }
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
writer.Write((int)AccessLevel);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
AccessLevel = (AccessLevel)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Validate()
|
||||
{
|
||||
if (!(RootParent is Mobile mobile) || mobile.AccessLevel >= AccessLevel)
|
||||
return true;
|
||||
|
||||
Delete();
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
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 >= AccessLevel;
|
||||
}
|
||||
|
||||
public override bool OnEquip(Mobile from)
|
||||
{
|
||||
if (from.AccessLevel < AccessLevel)
|
||||
from.SendMessage("You may not wear this.");
|
||||
|
||||
return from.AccessLevel >= AccessLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue