Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -3,113 +3,113 @@ using Server.Network;
namespace Server.Items
{
public enum GasTrapType
{
NorthWall,
WestWall,
Floor
}
public enum GasTrapType
{
NorthWall,
WestWall,
Floor
}
public class GasTrap : BaseTrap
{
[CommandProperty( AccessLevel.GameMaster )]
public Poison Poison { get; set; }
public class GasTrap : BaseTrap
{
[Constructible]
public GasTrap() : this(GasTrapType.Floor)
{
}
[CommandProperty( AccessLevel.GameMaster )]
public GasTrapType Type
{
get
{
switch ( ItemID )
{
case 0x113C: return GasTrapType.NorthWall;
case 0x1147: return GasTrapType.WestWall;
case 0x11A8: return GasTrapType.Floor;
}
[Constructible]
public GasTrap(GasTrapType type) : this(type, Poison.Lesser)
{
}
return GasTrapType.WestWall;
}
set => ItemID = GetBaseID( value );
}
[Constructible]
public GasTrap(Poison poison) : this(GasTrapType.Floor, Poison.Lesser)
{
}
public static int GetBaseID( GasTrapType type )
{
switch ( type )
{
case GasTrapType.NorthWall: return 0x113C;
case GasTrapType.WestWall: return 0x1147;
case GasTrapType.Floor: return 0x11A8;
}
[Constructible]
public GasTrap(GasTrapType type, Poison poison) : base(GetBaseID(type))
{
Poison = poison;
}
return 0;
}
public GasTrap(Serial serial) : base(serial)
{
}
[Constructible]
public GasTrap() : this( GasTrapType.Floor )
{
}
[CommandProperty(AccessLevel.GameMaster)]
public Poison Poison{ get; set; }
[Constructible]
public GasTrap( GasTrapType type ) : this( type, Poison.Lesser )
{
}
[CommandProperty(AccessLevel.GameMaster)]
public GasTrapType Type
{
get
{
switch (ItemID)
{
case 0x113C: return GasTrapType.NorthWall;
case 0x1147: return GasTrapType.WestWall;
case 0x11A8: return GasTrapType.Floor;
}
[Constructible]
public GasTrap( Poison poison ) : this( GasTrapType.Floor, Poison.Lesser )
{
}
return GasTrapType.WestWall;
}
set => ItemID = GetBaseID(value);
}
[Constructible]
public GasTrap( GasTrapType type, Poison poison ) : base( GetBaseID( type ) )
{
Poison = poison;
}
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 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;
}
public override void OnTrigger( Mobile from )
{
if ( Poison == null || !from.Player || !from.Alive || from.AccessLevel > AccessLevel.Player )
return;
return 0;
}
Effects.SendLocationEffect( Location, Map, GetBaseID( Type ) - 2, 16, 3, GetEffectHue(), 0 );
Effects.PlaySound( Location, Map, 0x231 );
public override void OnTrigger(Mobile from)
{
if (Poison == null || !from.Player || !from.Alive || from.AccessLevel > AccessLevel.Player)
return;
from.ApplyPoison( from, Poison );
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) - 2, 16, 3, GetEffectHue(), 0);
Effects.PlaySound(Location, Map, 0x231);
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500855 ); // You are enveloped by a noxious gas cloud!
}
from.ApplyPoison(from, Poison);
public GasTrap( Serial serial ) : base( serial )
{
}
from.LocalOverheadMessage(MessageType.Regular, 0x22, 500855); // You are enveloped by a noxious gas cloud!
}
public override void Serialize( GenericWriter writer )
{
base.Serialize( writer );
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write( (int) 0 ); // version
writer.Write(0); // version
Poison.Serialize( Poison, writer );
}
Poison.Serialize(Poison, writer);
}
public override void Deserialize( GenericReader reader )
{
base.Deserialize( reader );
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
int version = reader.ReadInt();
switch ( version )
{
case 0:
{
Poison = Poison.Deserialize( reader );
break;
}
}
}
}
}
switch (version)
{
case 0:
{
Poison = Poison.Deserialize(reader);
break;
}
}
}
}
}