Reorganizes Project (#41)
This commit is contained in:
parent
08bf44af9a
commit
3614a66aee
3499 changed files with 79 additions and 55 deletions
110
Projects/Scripts/Items/Traps/GasTrap.cs
Normal file
110
Projects/Scripts/Items/Traps/GasTrap.cs
Normal file
|
|
@ -0,0 +1,110 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum GasTrapType
|
||||
{
|
||||
NorthWall,
|
||||
WestWall,
|
||||
Floor
|
||||
}
|
||||
|
||||
public class GasTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public GasTrap() : this(Poison.Lesser)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GasTrap(Poison poison) : this(GasTrapType.Floor, poison)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public GasTrap(GasTrapType type, Poison poison = null) : base(GetBaseID(type))
|
||||
{
|
||||
Poison = poison;
|
||||
}
|
||||
|
||||
public GasTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Poison Poison{ get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public GasTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (ItemID)
|
||||
{
|
||||
case 0x113C: return GasTrapType.NorthWall;
|
||||
case 0x1147: return GasTrapType.WestWall;
|
||||
case 0x11A8: return GasTrapType.Floor;
|
||||
}
|
||||
|
||||
return GasTrapType.WestWall;
|
||||
}
|
||||
set => ItemID = GetBaseID(value);
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered => false;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 0;
|
||||
public override TimeSpan ResetDelay => TimeSpan.FromSeconds(0.0);
|
||||
|
||||
public static int GetBaseID(GasTrapType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case GasTrapType.NorthWall: return 0x113C;
|
||||
case GasTrapType.WestWall: return 0x1147;
|
||||
case GasTrapType.Floor: return 0x11A8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (Poison == null || !from.Player || !from.Alive || from.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) - 2, 16, 3, GetEffectHue(), 0);
|
||||
Effects.PlaySound(Location, Map, 0x231);
|
||||
|
||||
from.ApplyPoison(from, Poison);
|
||||
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x22, 500855); // You are enveloped by a noxious gas cloud!
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write(0); // version
|
||||
|
||||
Poison.Serialize(Poison, writer);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Poison = Poison.Deserialize(reader);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue