Fixes code according to modern code style. Fixes a few expression bugs.
This commit is contained in:
parent
89eea25e5f
commit
970fd563b2
3324 changed files with 441118 additions and 433755 deletions
|
|
@ -2,84 +2,85 @@ using System;
|
|||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseTrap : Item
|
||||
{
|
||||
public virtual bool PassivelyTriggered => false;
|
||||
public virtual TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public virtual int PassiveTriggerRange => -1;
|
||||
public virtual TimeSpan ResetDelay => TimeSpan.Zero;
|
||||
public abstract class BaseTrap : Item
|
||||
{
|
||||
private DateTime m_NextPassiveTrigger, m_NextActiveTrigger;
|
||||
|
||||
private DateTime m_NextPassiveTrigger, m_NextActiveTrigger;
|
||||
public BaseTrap(int itemID) : base(itemID)
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public virtual void OnTrigger( Mobile from )
|
||||
{
|
||||
}
|
||||
public BaseTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement
|
||||
public virtual bool PassivelyTriggered => false;
|
||||
public virtual TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public virtual int PassiveTriggerRange => -1;
|
||||
public virtual TimeSpan ResetDelay => TimeSpan.Zero;
|
||||
|
||||
public virtual int GetEffectHue()
|
||||
{
|
||||
int hue = Hue & 0x3FFF;
|
||||
public override bool HandlesOnMovement => true; // Tell the core that we implement OnMovement
|
||||
|
||||
if ( hue < 2 )
|
||||
return 0;
|
||||
public virtual void OnTrigger(Mobile from)
|
||||
{
|
||||
}
|
||||
|
||||
return hue - 1;
|
||||
}
|
||||
public virtual int GetEffectHue()
|
||||
{
|
||||
int hue = Hue & 0x3FFF;
|
||||
|
||||
public bool CheckRange( Point3D loc, Point3D oldLoc, int range )
|
||||
{
|
||||
return CheckRange( loc, range ) && !CheckRange( oldLoc, range );
|
||||
}
|
||||
if (hue < 2)
|
||||
return 0;
|
||||
|
||||
public bool CheckRange( Point3D loc, int range )
|
||||
{
|
||||
return ( (Z + 8) >= loc.Z && (loc.Z + 16) > Z )
|
||||
&& Utility.InRange( GetWorldLocation(), loc, range );
|
||||
}
|
||||
return hue - 1;
|
||||
}
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
base.OnMovement( m, oldLocation );
|
||||
public bool CheckRange(Point3D loc, Point3D oldLoc, int range)
|
||||
{
|
||||
return CheckRange(loc, range) && !CheckRange(oldLoc, range);
|
||||
}
|
||||
|
||||
if ( m.Location == oldLocation )
|
||||
return;
|
||||
public bool CheckRange(Point3D loc, int range)
|
||||
{
|
||||
return Z + 8 >= loc.Z && loc.Z + 16 > Z
|
||||
&& Utility.InRange(GetWorldLocation(), loc, range);
|
||||
}
|
||||
|
||||
if ( CheckRange( m.Location, oldLocation, 0 ) && DateTime.UtcNow >= m_NextActiveTrigger )
|
||||
{
|
||||
m_NextActiveTrigger = m_NextPassiveTrigger = DateTime.UtcNow + ResetDelay;
|
||||
public override void OnMovement(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
base.OnMovement(m, oldLocation);
|
||||
|
||||
OnTrigger( m );
|
||||
}
|
||||
else if ( PassivelyTriggered && CheckRange( m.Location, oldLocation, PassiveTriggerRange ) && DateTime.UtcNow >= m_NextPassiveTrigger )
|
||||
{
|
||||
m_NextPassiveTrigger = DateTime.UtcNow + PassiveTriggerDelay;
|
||||
if (m.Location == oldLocation)
|
||||
return;
|
||||
|
||||
OnTrigger( m );
|
||||
}
|
||||
}
|
||||
if (CheckRange(m.Location, oldLocation, 0) && DateTime.UtcNow >= m_NextActiveTrigger)
|
||||
{
|
||||
m_NextActiveTrigger = m_NextPassiveTrigger = DateTime.UtcNow + ResetDelay;
|
||||
|
||||
public BaseTrap( int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
OnTrigger(m);
|
||||
}
|
||||
else if (PassivelyTriggered && CheckRange(m.Location, oldLocation, PassiveTriggerRange) &&
|
||||
DateTime.UtcNow >= m_NextPassiveTrigger)
|
||||
{
|
||||
m_NextPassiveTrigger = DateTime.UtcNow + PassiveTriggerDelay;
|
||||
|
||||
public BaseTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
OnTrigger(m);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,111 +1,114 @@
|
|||
using System;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FireColumnTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public FireColumnTrap() : base( 0x1B71 )
|
||||
{
|
||||
m_MinDamage = 10;
|
||||
m_MaxDamage = 40;
|
||||
public class FireColumnTrap : BaseTrap
|
||||
{
|
||||
private int m_MaxDamage;
|
||||
|
||||
m_WarningFlame = true;
|
||||
}
|
||||
private int m_MinDamage;
|
||||
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.FromSeconds( 2.0 );
|
||||
public override int PassiveTriggerRange => 3;
|
||||
public override TimeSpan ResetDelay => TimeSpan.FromSeconds( 0.5 );
|
||||
private bool m_WarningFlame;
|
||||
|
||||
private int m_MinDamage;
|
||||
[Constructible]
|
||||
public FireColumnTrap() : base(0x1B71)
|
||||
{
|
||||
m_MinDamage = 10;
|
||||
m_MaxDamage = 40;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual int MinDamage
|
||||
{
|
||||
get => m_MinDamage;
|
||||
set => m_MinDamage = value;
|
||||
}
|
||||
m_WarningFlame = true;
|
||||
}
|
||||
|
||||
private int m_MaxDamage;
|
||||
public FireColumnTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual int MaxDamage
|
||||
{
|
||||
get => m_MaxDamage;
|
||||
set => m_MaxDamage = value;
|
||||
}
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.FromSeconds(2.0);
|
||||
public override int PassiveTriggerRange => 3;
|
||||
public override TimeSpan ResetDelay => TimeSpan.FromSeconds(0.5);
|
||||
|
||||
private bool m_WarningFlame;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int MinDamage
|
||||
{
|
||||
get => m_MinDamage;
|
||||
set => m_MinDamage = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual bool WarningFlame
|
||||
{
|
||||
get => m_WarningFlame;
|
||||
set => m_WarningFlame = value;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual int MaxDamage
|
||||
{
|
||||
get => m_MaxDamage;
|
||||
set => m_MaxDamage = value;
|
||||
}
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public virtual bool WarningFlame
|
||||
{
|
||||
get => m_WarningFlame;
|
||||
set => m_WarningFlame = value;
|
||||
}
|
||||
|
||||
if ( WarningFlame )
|
||||
DoEffect();
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
if ( from.Alive && CheckRange( from.Location, 0 ) )
|
||||
{
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, from, Utility.RandomMinMax( MinDamage, MaxDamage ), 0, 100, 0, 0, 0 );
|
||||
if (WarningFlame)
|
||||
DoEffect();
|
||||
|
||||
if ( !WarningFlame )
|
||||
DoEffect();
|
||||
}
|
||||
}
|
||||
if (from.Alive && CheckRange(from.Location, 0))
|
||||
{
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, from, Utility.RandomMinMax(MinDamage, MaxDamage), 0, 100,
|
||||
0, 0, 0);
|
||||
|
||||
private void DoEffect()
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3709, 10, 30, 5052 );
|
||||
Effects.PlaySound( Location, Map, 0x225 );
|
||||
}
|
||||
if (!WarningFlame)
|
||||
DoEffect();
|
||||
}
|
||||
}
|
||||
|
||||
public FireColumnTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
private void DoEffect()
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3709, 10, 30,
|
||||
5052);
|
||||
Effects.PlaySound(Location, Map, 0x225);
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
writer.Write(1); // version
|
||||
|
||||
writer.Write( m_WarningFlame );
|
||||
writer.Write( m_MinDamage );
|
||||
writer.Write( m_MaxDamage );
|
||||
}
|
||||
writer.Write(m_WarningFlame);
|
||||
writer.Write(m_MinDamage);
|
||||
writer.Write(m_MaxDamage);
|
||||
}
|
||||
|
||||
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 1:
|
||||
{
|
||||
m_WarningFlame = reader.ReadBool();
|
||||
m_MinDamage = reader.ReadInt();
|
||||
m_MaxDamage = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_WarningFlame = reader.ReadBool();
|
||||
m_MinDamage = reader.ReadInt();
|
||||
m_MaxDamage = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( version == 0 )
|
||||
{
|
||||
m_WarningFlame = true;
|
||||
m_MinDamage = 10;
|
||||
m_MaxDamage = 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (version == 0)
|
||||
{
|
||||
m_WarningFlame = true;
|
||||
m_MinDamage = 10;
|
||||
m_MaxDamage = 40;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,177 +1,178 @@
|
|||
using System;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FlameSpurtTrap : BaseTrap
|
||||
{
|
||||
private Item m_Spurt;
|
||||
private Timer m_Timer;
|
||||
public class FlameSpurtTrap : BaseTrap
|
||||
{
|
||||
private Item m_Spurt;
|
||||
private Timer m_Timer;
|
||||
|
||||
[Constructible]
|
||||
public FlameSpurtTrap() : base( 0x1B71 )
|
||||
{
|
||||
Visible = false;
|
||||
}
|
||||
[Constructible]
|
||||
public FlameSpurtTrap() : base(0x1B71)
|
||||
{
|
||||
Visible = false;
|
||||
}
|
||||
|
||||
public virtual void StartTimer()
|
||||
{
|
||||
if ( m_Timer == null )
|
||||
m_Timer = Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TimeSpan.FromSeconds( 1.0 ), Refresh );
|
||||
}
|
||||
public FlameSpurtTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void StopTimer()
|
||||
{
|
||||
m_Timer?.Stop();
|
||||
public virtual void StartTimer()
|
||||
{
|
||||
if (m_Timer == null)
|
||||
m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.0), Refresh);
|
||||
}
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
public virtual void StopTimer()
|
||||
{
|
||||
m_Timer?.Stop();
|
||||
|
||||
public virtual void CheckTimer()
|
||||
{
|
||||
Map map = Map;
|
||||
m_Timer = null;
|
||||
}
|
||||
|
||||
if ( map != null && map.GetSector( GetWorldLocation() ).Active )
|
||||
StartTimer();
|
||||
else
|
||||
StopTimer();
|
||||
}
|
||||
public virtual void CheckTimer()
|
||||
{
|
||||
Map map = Map;
|
||||
|
||||
public override void OnLocationChange( Point3D oldLocation )
|
||||
{
|
||||
base.OnLocationChange( oldLocation );
|
||||
if (map != null && map.GetSector(GetWorldLocation()).Active)
|
||||
StartTimer();
|
||||
else
|
||||
StopTimer();
|
||||
}
|
||||
|
||||
CheckTimer();
|
||||
}
|
||||
public override void OnLocationChange(Point3D oldLocation)
|
||||
{
|
||||
base.OnLocationChange(oldLocation);
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
CheckTimer();
|
||||
}
|
||||
|
||||
CheckTimer();
|
||||
}
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
|
||||
public override void OnSectorActivate()
|
||||
{
|
||||
base.OnSectorActivate();
|
||||
CheckTimer();
|
||||
}
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
public override void OnSectorActivate()
|
||||
{
|
||||
base.OnSectorActivate();
|
||||
|
||||
public override void OnSectorDeactivate()
|
||||
{
|
||||
base.OnSectorDeactivate();
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
StopTimer();
|
||||
}
|
||||
public override void OnSectorDeactivate()
|
||||
{
|
||||
base.OnSectorDeactivate();
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
StopTimer();
|
||||
}
|
||||
|
||||
m_Spurt?.Delete();
|
||||
}
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
public virtual void Refresh()
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
m_Spurt?.Delete();
|
||||
}
|
||||
|
||||
bool foundPlayer = false;
|
||||
public virtual void Refresh()
|
||||
{
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
foreach ( Mobile mob in GetMobilesInRange( 3 ) )
|
||||
{
|
||||
if ( !mob.Player || !mob.Alive || mob.AccessLevel > AccessLevel.Player )
|
||||
continue;
|
||||
bool foundPlayer = false;
|
||||
|
||||
if ( ( (Z + 8) >= mob.Z && (mob.Z + 16) > Z ) )
|
||||
{
|
||||
foundPlayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
foreach (Mobile mob in GetMobilesInRange(3))
|
||||
{
|
||||
if (!mob.Player || !mob.Alive || mob.AccessLevel > AccessLevel.Player)
|
||||
continue;
|
||||
|
||||
if ( !foundPlayer )
|
||||
{
|
||||
m_Spurt?.Delete();
|
||||
if (Z + 8 >= mob.Z && mob.Z + 16 > Z)
|
||||
{
|
||||
foundPlayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_Spurt = null;
|
||||
}
|
||||
else if ( m_Spurt == null || m_Spurt.Deleted )
|
||||
{
|
||||
m_Spurt = new Static( 0x3709 );
|
||||
m_Spurt.MoveToWorld( Location, Map );
|
||||
if (!foundPlayer)
|
||||
{
|
||||
m_Spurt?.Delete();
|
||||
|
||||
Effects.PlaySound( GetWorldLocation(), Map, 0x309 );
|
||||
}
|
||||
}
|
||||
m_Spurt = null;
|
||||
}
|
||||
else if (m_Spurt == null || m_Spurt.Deleted)
|
||||
{
|
||||
m_Spurt = new Static(0x3709);
|
||||
m_Spurt.MoveToWorld(Location, Map);
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( m.AccessLevel > AccessLevel.Player )
|
||||
return true;
|
||||
Effects.PlaySound(GetWorldLocation(), Map, 0x309);
|
||||
}
|
||||
}
|
||||
|
||||
if ( m.Player && m.Alive )
|
||||
{
|
||||
CheckTimer();
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (m.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), m, m, Utility.RandomMinMax( 1, 30 ) );
|
||||
m.PlaySound( m.Female ? 0x327 : 0x437 );
|
||||
}
|
||||
if (m.Player && m.Alive)
|
||||
{
|
||||
CheckTimer();
|
||||
|
||||
return false;
|
||||
}
|
||||
SpellHelper.Damage(TimeSpan.FromTicks(1), m, m, Utility.RandomMinMax(1, 30));
|
||||
m.PlaySound(m.Female ? 0x327 : 0x437);
|
||||
}
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
base.OnMovement( m, oldLocation );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( m.Location == oldLocation || !m.Player || !m.Alive || m.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
public override void OnMovement(Mobile m, Point3D oldLocation)
|
||||
{
|
||||
base.OnMovement(m, oldLocation);
|
||||
|
||||
if ( CheckRange( m.Location, oldLocation, 1 ) )
|
||||
{
|
||||
CheckTimer();
|
||||
if (m.Location == oldLocation || !m.Player || !m.Alive || m.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), m, m, Utility.RandomMinMax( 1, 10 ) );
|
||||
m.PlaySound( m.Female ? 0x327 : 0x437 );
|
||||
if (CheckRange(m.Location, oldLocation, 1))
|
||||
{
|
||||
CheckTimer();
|
||||
|
||||
if ( m.Body.IsHuman )
|
||||
m.Animate( 20, 1, 1, true, false, 0 );
|
||||
}
|
||||
}
|
||||
SpellHelper.Damage(TimeSpan.FromTicks(1), m, m, Utility.RandomMinMax(1, 10));
|
||||
m.PlaySound(m.Female ? 0x327 : 0x437);
|
||||
|
||||
public FlameSpurtTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (m.Body.IsHuman)
|
||||
m.Animate(20, 1, 1, true, false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
writer.Write( (Item) m_Spurt );
|
||||
}
|
||||
writer.Write(m_Spurt);
|
||||
}
|
||||
|
||||
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:
|
||||
{
|
||||
Item item = reader.ReadItem();
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Item item = reader.ReadItem();
|
||||
|
||||
item?.Delete();
|
||||
item?.Delete();
|
||||
|
||||
CheckTimer();
|
||||
CheckTimer();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,46 +1,47 @@
|
|||
using System;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GiantSpikeTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public GiantSpikeTrap() : base( 1 )
|
||||
{
|
||||
}
|
||||
public class GiantSpikeTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public GiantSpikeTrap() : base(1)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 3;
|
||||
public override TimeSpan ResetDelay => TimeSpan.FromSeconds( 0.0 );
|
||||
public GiantSpikeTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 3;
|
||||
public override TimeSpan ResetDelay => TimeSpan.FromSeconds(0.0);
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, 0x1D99, 48, 2, GetEffectHue(), 0 );
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (from.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
if ( from.Alive && CheckRange( from.Location, 0 ) )
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), from, from, Utility.Dice( 10, 7, 0 ) );
|
||||
}
|
||||
Effects.SendLocationEffect(Location, Map, 0x1D99, 48, 2, GetEffectHue(), 0);
|
||||
|
||||
public GiantSpikeTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
if (from.Alive && CheckRange(from.Location, 0))
|
||||
SpellHelper.Damage(TimeSpan.FromTicks(1), from, from, Utility.Dice(10, 7, 0));
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,60 +1,61 @@
|
|||
using System;
|
||||
using Server.Regions;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MushroomTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public MushroomTrap() : base( 0x1125 )
|
||||
{
|
||||
}
|
||||
public class MushroomTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public MushroomTrap() : base(0x1125)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 2;
|
||||
public override TimeSpan ResetDelay => TimeSpan.Zero;
|
||||
public MushroomTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || ItemID != 0x1125 || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 2;
|
||||
public override TimeSpan ResetDelay => TimeSpan.Zero;
|
||||
|
||||
ItemID = 0x1126;
|
||||
Effects.PlaySound( Location, Map, 0x306 );
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (!from.Alive || ItemID != 0x1125 || from.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, from, Utility.Dice( 2, 4, 0 ) );
|
||||
ItemID = 0x1126;
|
||||
Effects.PlaySound(Location, Map, 0x306);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), OnMushroomReset );
|
||||
}
|
||||
SpellHelper.Damage(TimeSpan.FromSeconds(0.5), from, from, Utility.Dice(2, 4, 0));
|
||||
|
||||
public virtual void OnMushroomReset()
|
||||
{
|
||||
if ( Region.Find( Location, Map ).IsPartOf( typeof( DungeonRegion ) ) )
|
||||
ItemID = 0x1125; // reset
|
||||
else
|
||||
Delete();
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(2.0), OnMushroomReset);
|
||||
}
|
||||
|
||||
public MushroomTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public virtual void OnMushroomReset()
|
||||
{
|
||||
if (Region.Find(Location, Map).IsPartOf(typeof(DungeonRegion)))
|
||||
ItemID = 0x1125; // reset
|
||||
else
|
||||
Delete();
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if ( ItemID == 0x1126 )
|
||||
OnMushroomReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ItemID == 0x1126)
|
||||
OnMushroomReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,93 +1,94 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum SawTrapType
|
||||
{
|
||||
WestWall,
|
||||
NorthWall,
|
||||
WestFloor,
|
||||
NorthFloor
|
||||
}
|
||||
public enum SawTrapType
|
||||
{
|
||||
WestWall,
|
||||
NorthWall,
|
||||
WestFloor,
|
||||
NorthFloor
|
||||
}
|
||||
|
||||
public class SawTrap : BaseTrap
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SawTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
switch ( ItemID )
|
||||
{
|
||||
case 0x1103: return SawTrapType.NorthWall;
|
||||
case 0x1116: return SawTrapType.WestWall;
|
||||
case 0x11AC: return SawTrapType.NorthFloor;
|
||||
case 0x11B1: return SawTrapType.WestFloor;
|
||||
}
|
||||
public class SawTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public SawTrap() : this(SawTrapType.NorthFloor)
|
||||
{
|
||||
}
|
||||
|
||||
return SawTrapType.NorthWall;
|
||||
}
|
||||
set => ItemID = GetBaseID( value );
|
||||
}
|
||||
[Constructible]
|
||||
public SawTrap(SawTrapType type) : base(GetBaseID(type))
|
||||
{
|
||||
}
|
||||
|
||||
public static int GetBaseID( SawTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case SawTrapType.NorthWall: return 0x1103;
|
||||
case SawTrapType.WestWall: return 0x1116;
|
||||
case SawTrapType.NorthFloor: return 0x11AC;
|
||||
case SawTrapType.WestFloor: return 0x11B1;
|
||||
}
|
||||
public SawTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SawTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (ItemID)
|
||||
{
|
||||
case 0x1103: return SawTrapType.NorthWall;
|
||||
case 0x1116: return SawTrapType.WestWall;
|
||||
case 0x11AC: return SawTrapType.NorthFloor;
|
||||
case 0x11B1: return SawTrapType.WestFloor;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SawTrap() : this( SawTrapType.NorthFloor )
|
||||
{
|
||||
}
|
||||
return SawTrapType.NorthWall;
|
||||
}
|
||||
set => ItemID = GetBaseID(value);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SawTrap( SawTrapType type ) : base( GetBaseID( type ) )
|
||||
{
|
||||
}
|
||||
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(SawTrapType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SawTrapType.NorthWall: return 0x1103;
|
||||
case SawTrapType.WestWall: return 0x1116;
|
||||
case SawTrapType.NorthFloor: return 0x11AC;
|
||||
case SawTrapType.WestFloor: return 0x11B1;
|
||||
}
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( Type ) + 1, 6, 3, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x21C );
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (!from.Alive || from.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), from, from, Utility.RandomMinMax( 5, 15 ) );
|
||||
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) + 1, 6, 3, GetEffectHue(), 0);
|
||||
Effects.PlaySound(Location, Map, 0x21C);
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500853 ); // You stepped onto a blade trap!
|
||||
}
|
||||
SpellHelper.Damage(TimeSpan.FromTicks(1), from, from, Utility.RandomMinMax(5, 15));
|
||||
|
||||
public SawTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x22, 500853); // You stepped onto a blade trap!
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,149 +1,156 @@
|
|||
using System;
|
||||
using Server.Network;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum SpikeTrapType
|
||||
{
|
||||
WestWall,
|
||||
NorthWall,
|
||||
WestFloor,
|
||||
NorthFloor
|
||||
}
|
||||
public enum SpikeTrapType
|
||||
{
|
||||
WestWall,
|
||||
NorthWall,
|
||||
WestFloor,
|
||||
NorthFloor
|
||||
}
|
||||
|
||||
public class SpikeTrap : BaseTrap
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SpikeTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
switch ( ItemID )
|
||||
{
|
||||
case 4360: case 4361: case 4366: return SpikeTrapType.WestWall;
|
||||
case 4379: case 4380: case 4385: return SpikeTrapType.NorthWall;
|
||||
case 4506: case 4507: case 4511: return SpikeTrapType.WestFloor;
|
||||
case 4512: case 4513: case 4517: return SpikeTrapType.NorthFloor;
|
||||
}
|
||||
public class SpikeTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public SpikeTrap() : this(SpikeTrapType.WestFloor)
|
||||
{
|
||||
}
|
||||
|
||||
return SpikeTrapType.WestWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool extended = Extended;
|
||||
[Constructible]
|
||||
public SpikeTrap(SpikeTrapType type) : base(GetBaseID(type))
|
||||
{
|
||||
}
|
||||
|
||||
ItemID = ( extended ? GetExtendedID( value ) : GetBaseID( value ) );
|
||||
}
|
||||
}
|
||||
public SpikeTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public bool Extended
|
||||
{
|
||||
get => ( ItemID == GetExtendedID( Type ) );
|
||||
set
|
||||
{
|
||||
if ( value )
|
||||
ItemID = GetExtendedID( Type );
|
||||
else
|
||||
ItemID = GetBaseID( Type );
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SpikeTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (ItemID)
|
||||
{
|
||||
case 4360:
|
||||
case 4361:
|
||||
case 4366: return SpikeTrapType.WestWall;
|
||||
case 4379:
|
||||
case 4380:
|
||||
case 4385: return SpikeTrapType.NorthWall;
|
||||
case 4506:
|
||||
case 4507:
|
||||
case 4511: return SpikeTrapType.WestFloor;
|
||||
case 4512:
|
||||
case 4513:
|
||||
case 4517: return SpikeTrapType.NorthFloor;
|
||||
}
|
||||
|
||||
public static int GetBaseID( SpikeTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case SpikeTrapType.WestWall: return 4360;
|
||||
case SpikeTrapType.NorthWall: return 4379;
|
||||
case SpikeTrapType.WestFloor: return 4506;
|
||||
case SpikeTrapType.NorthFloor: return 4512;
|
||||
}
|
||||
return SpikeTrapType.WestWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool extended = Extended;
|
||||
|
||||
return 0;
|
||||
}
|
||||
ItemID = extended ? GetExtendedID(value) : GetBaseID(value);
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetExtendedID( SpikeTrapType type )
|
||||
{
|
||||
return GetBaseID( type ) + GetExtendedOffset( type );
|
||||
}
|
||||
public bool Extended
|
||||
{
|
||||
get => ItemID == GetExtendedID(Type);
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
ItemID = GetExtendedID(Type);
|
||||
else
|
||||
ItemID = GetBaseID(Type);
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetExtendedOffset( SpikeTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case SpikeTrapType.WestWall: return 6;
|
||||
case SpikeTrapType.NorthWall: return 6;
|
||||
public override bool PassivelyTriggered => false;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 0;
|
||||
public override TimeSpan ResetDelay => TimeSpan.FromSeconds(6.0);
|
||||
|
||||
case SpikeTrapType.WestFloor: return 5;
|
||||
case SpikeTrapType.NorthFloor: return 5;
|
||||
}
|
||||
public static int GetBaseID(SpikeTrapType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SpikeTrapType.WestWall: return 4360;
|
||||
case SpikeTrapType.NorthWall: return 4379;
|
||||
case SpikeTrapType.WestFloor: return 4506;
|
||||
case SpikeTrapType.NorthFloor: return 4512;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SpikeTrap() : this( SpikeTrapType.WestFloor )
|
||||
{
|
||||
}
|
||||
public static int GetExtendedID(SpikeTrapType type)
|
||||
{
|
||||
return GetBaseID(type) + GetExtendedOffset(type);
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public SpikeTrap( SpikeTrapType type ) : base( GetBaseID( type ) )
|
||||
{
|
||||
}
|
||||
public static int GetExtendedOffset(SpikeTrapType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case SpikeTrapType.WestWall: return 6;
|
||||
case SpikeTrapType.NorthWall: return 6;
|
||||
|
||||
public override bool PassivelyTriggered => false;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 0;
|
||||
public override TimeSpan ResetDelay => TimeSpan.FromSeconds( 6.0 );
|
||||
case SpikeTrapType.WestFloor: return 5;
|
||||
case SpikeTrapType.NorthFloor: return 5;
|
||||
}
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( Type ) + 1, 18, 3, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x22C );
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (!from.Alive || from.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
foreach ( Mobile mob in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
if ( mob.Alive && !mob.IsDeadBondedPet )
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), mob, mob, Utility.RandomMinMax( 1, 6 ) * 6 );
|
||||
}
|
||||
Effects.SendLocationEffect(Location, Map, GetBaseID(Type) + 1, 18, 3, GetEffectHue(), 0);
|
||||
Effects.PlaySound(Location, Map, 0x22C);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), OnSpikeExtended );
|
||||
foreach (Mobile mob in GetMobilesInRange(0))
|
||||
if (mob.Alive && !mob.IsDeadBondedPet)
|
||||
SpellHelper.Damage(TimeSpan.FromTicks(1), mob, mob, Utility.RandomMinMax(1, 6) * 6);
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500852 ); // You stepped onto a spike trap!
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), OnSpikeExtended);
|
||||
|
||||
public virtual void OnSpikeExtended()
|
||||
{
|
||||
Extended = true;
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), OnSpikeRetracted );
|
||||
}
|
||||
from.LocalOverheadMessage(MessageType.Regular, 0x22, 500852); // You stepped onto a spike trap!
|
||||
}
|
||||
|
||||
public virtual void OnSpikeRetracted()
|
||||
{
|
||||
Extended = false;
|
||||
Effects.SendLocationEffect( Location, Map, GetExtendedID( Type ) - 1, 6, 3, GetEffectHue(), 0 );
|
||||
}
|
||||
public virtual void OnSpikeExtended()
|
||||
{
|
||||
Extended = true;
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(5.0), OnSpikeRetracted);
|
||||
}
|
||||
|
||||
public SpikeTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public virtual void OnSpikeRetracted()
|
||||
{
|
||||
Extended = false;
|
||||
Effects.SendLocationEffect(Location, Map, GetExtendedID(Type) - 1, 6, 3, GetEffectHue(), 0);
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
Extended = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
Extended = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,161 +1,166 @@
|
|||
using System;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum StoneFaceTrapType
|
||||
{
|
||||
NorthWestWall,
|
||||
NorthWall,
|
||||
WestWall
|
||||
}
|
||||
public enum StoneFaceTrapType
|
||||
{
|
||||
NorthWestWall,
|
||||
NorthWall,
|
||||
WestWall
|
||||
}
|
||||
|
||||
public class StoneFaceTrap : BaseTrap
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public StoneFaceTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
switch ( ItemID )
|
||||
{
|
||||
case 0x10F5: case 0x10F6: case 0x10F7: return StoneFaceTrapType.NorthWestWall;
|
||||
case 0x10FC: case 0x10FD: case 0x10FE: return StoneFaceTrapType.NorthWall;
|
||||
case 0x110F: case 0x1110: case 0x1111: return StoneFaceTrapType.WestWall;
|
||||
}
|
||||
public class StoneFaceTrap : BaseTrap
|
||||
{
|
||||
[Constructible]
|
||||
public StoneFaceTrap() : base(0x10FC)
|
||||
{
|
||||
Light = LightType.Circle225;
|
||||
}
|
||||
|
||||
return StoneFaceTrapType.NorthWestWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool breathing = Breathing;
|
||||
public StoneFaceTrap(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
ItemID = ( breathing ? GetFireID( value ) : GetBaseID( value ) );
|
||||
}
|
||||
}
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public StoneFaceTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (ItemID)
|
||||
{
|
||||
case 0x10F5:
|
||||
case 0x10F6:
|
||||
case 0x10F7: return StoneFaceTrapType.NorthWestWall;
|
||||
case 0x10FC:
|
||||
case 0x10FD:
|
||||
case 0x10FE: return StoneFaceTrapType.NorthWall;
|
||||
case 0x110F:
|
||||
case 0x1110:
|
||||
case 0x1111: return StoneFaceTrapType.WestWall;
|
||||
}
|
||||
|
||||
public bool Breathing
|
||||
{
|
||||
get => ( ItemID == GetFireID( Type ) );
|
||||
set
|
||||
{
|
||||
if ( value )
|
||||
ItemID = GetFireID( Type );
|
||||
else
|
||||
ItemID = GetBaseID( Type );
|
||||
}
|
||||
}
|
||||
return StoneFaceTrapType.NorthWestWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool breathing = Breathing;
|
||||
|
||||
public static int GetBaseID( StoneFaceTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case StoneFaceTrapType.NorthWestWall: return 0x10F5;
|
||||
case StoneFaceTrapType.NorthWall: return 0x10FC;
|
||||
case StoneFaceTrapType.WestWall: return 0x110F;
|
||||
}
|
||||
ItemID = breathing ? GetFireID(value) : GetBaseID(value);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
public bool Breathing
|
||||
{
|
||||
get => ItemID == GetFireID(Type);
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
ItemID = GetFireID(Type);
|
||||
else
|
||||
ItemID = GetBaseID(Type);
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetFireID( StoneFaceTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case StoneFaceTrapType.NorthWestWall: return 0x10F7;
|
||||
case StoneFaceTrapType.NorthWall: return 0x10FE;
|
||||
case StoneFaceTrapType.WestWall: return 0x1111;
|
||||
}
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 2;
|
||||
public override TimeSpan ResetDelay => TimeSpan.Zero;
|
||||
|
||||
return 0;
|
||||
}
|
||||
public static int GetBaseID(StoneFaceTrapType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case StoneFaceTrapType.NorthWestWall: return 0x10F5;
|
||||
case StoneFaceTrapType.NorthWall: return 0x10FC;
|
||||
case StoneFaceTrapType.WestWall: return 0x110F;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public StoneFaceTrap() : base( 0x10FC )
|
||||
{
|
||||
Light = LightType.Circle225;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered => true;
|
||||
public override TimeSpan PassiveTriggerDelay => TimeSpan.Zero;
|
||||
public override int PassiveTriggerRange => 2;
|
||||
public override TimeSpan ResetDelay => TimeSpan.Zero;
|
||||
public static int GetFireID(StoneFaceTrapType type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case StoneFaceTrapType.NorthWestWall: return 0x10F7;
|
||||
case StoneFaceTrapType.NorthWall: return 0x10FE;
|
||||
case StoneFaceTrapType.WestWall: return 0x1111;
|
||||
}
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Effects.PlaySound( Location, Map, 0x359 );
|
||||
public override void OnTrigger(Mobile from)
|
||||
{
|
||||
if (!from.Alive || from.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
Breathing = true;
|
||||
Effects.PlaySound(Location, Map, 0x359);
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), FinishBreath );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), TriggerDamage );
|
||||
}
|
||||
Breathing = true;
|
||||
|
||||
public virtual void FinishBreath()
|
||||
{
|
||||
Breathing = false;
|
||||
}
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(2.0), FinishBreath);
|
||||
Timer.DelayCall(TimeSpan.FromSeconds(1.0), TriggerDamage);
|
||||
}
|
||||
|
||||
public virtual void TriggerDamage()
|
||||
{
|
||||
foreach ( Mobile mob in GetMobilesInRange( 1 ) )
|
||||
{
|
||||
if ( mob.Alive && !mob.IsDeadBondedPet && mob.AccessLevel == AccessLevel.Player )
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), mob, mob, Utility.Dice( 3, 15, 0 ) );
|
||||
}
|
||||
}
|
||||
public virtual void FinishBreath()
|
||||
{
|
||||
Breathing = false;
|
||||
}
|
||||
|
||||
public StoneFaceTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public virtual void TriggerDamage()
|
||||
{
|
||||
foreach (Mobile mob in GetMobilesInRange(1))
|
||||
if (mob.Alive && !mob.IsDeadBondedPet && mob.AccessLevel == AccessLevel.Player)
|
||||
SpellHelper.Damage(TimeSpan.FromTicks(1), mob, mob, Utility.Dice(3, 15, 0));
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
Breathing = false;
|
||||
}
|
||||
}
|
||||
Breathing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoneFaceTrapNoDamage : StoneFaceTrap
|
||||
{
|
||||
[Constructible]
|
||||
public StoneFaceTrapNoDamage()
|
||||
{
|
||||
}
|
||||
public class StoneFaceTrapNoDamage : StoneFaceTrap
|
||||
{
|
||||
[Constructible]
|
||||
public StoneFaceTrapNoDamage()
|
||||
{
|
||||
}
|
||||
|
||||
public StoneFaceTrapNoDamage( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
public StoneFaceTrapNoDamage(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void TriggerDamage()
|
||||
{
|
||||
// nothing..
|
||||
}
|
||||
public override void TriggerDamage()
|
||||
{
|
||||
// nothing..
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue