#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
85
Scripts/Items/Traps/BaseTrap.cs
Normal file
85
Scripts/Items/Traps/BaseTrap.cs
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public abstract class BaseTrap : Item
|
||||
{
|
||||
public virtual bool PassivelyTriggered{ get{ return false; } }
|
||||
public virtual TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public virtual int PassiveTriggerRange{ get{ return -1; } }
|
||||
public virtual TimeSpan ResetDelay{ get{ return TimeSpan.Zero; } }
|
||||
|
||||
private DateTime m_NextPassiveTrigger, m_NextActiveTrigger;
|
||||
|
||||
public virtual void OnTrigger( Mobile from )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement{ get{ return true; } } // Tell the core that we implement OnMovement
|
||||
|
||||
public virtual int GetEffectHue()
|
||||
{
|
||||
int hue = this.Hue & 0x3FFF;
|
||||
|
||||
if ( hue < 2 )
|
||||
return 0;
|
||||
|
||||
return hue - 1;
|
||||
}
|
||||
|
||||
public bool CheckRange( Point3D loc, Point3D oldLoc, int range )
|
||||
{
|
||||
return CheckRange( loc, range ) && !CheckRange( oldLoc, range );
|
||||
}
|
||||
|
||||
public bool CheckRange( Point3D loc, int range )
|
||||
{
|
||||
return ( (this.Z + 8) >= loc.Z && (loc.Z + 16) > this.Z )
|
||||
&& Utility.InRange( GetWorldLocation(), loc, range );
|
||||
}
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
base.OnMovement( m, oldLocation );
|
||||
|
||||
if ( m.Location == oldLocation )
|
||||
return;
|
||||
|
||||
if ( CheckRange( m.Location, oldLocation, 0 ) && DateTime.UtcNow >= m_NextActiveTrigger )
|
||||
{
|
||||
m_NextActiveTrigger = m_NextPassiveTrigger = DateTime.UtcNow + ResetDelay;
|
||||
|
||||
OnTrigger( m );
|
||||
}
|
||||
else if ( PassivelyTriggered && CheckRange( m.Location, oldLocation, PassiveTriggerRange ) && DateTime.UtcNow >= m_NextPassiveTrigger )
|
||||
{
|
||||
m_NextPassiveTrigger = DateTime.UtcNow + PassiveTriggerDelay;
|
||||
|
||||
OnTrigger( m );
|
||||
}
|
||||
}
|
||||
|
||||
public BaseTrap( int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public BaseTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
111
Scripts/Items/Traps/FireColumnTrap.cs
Normal file
111
Scripts/Items/Traps/FireColumnTrap.cs
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FireColumnTrap : BaseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public FireColumnTrap() : base( 0x1B71 )
|
||||
{
|
||||
m_MinDamage = 10;
|
||||
m_MaxDamage = 40;
|
||||
|
||||
m_WarningFlame = true;
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return true; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.FromSeconds( 2.0 ); } }
|
||||
public override int PassiveTriggerRange{ get{ return 3; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.FromSeconds( 0.5 ); } }
|
||||
|
||||
private int m_MinDamage;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual int MinDamage
|
||||
{
|
||||
get { return m_MinDamage; }
|
||||
set { m_MinDamage = value; }
|
||||
}
|
||||
|
||||
private int m_MaxDamage;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual int MaxDamage
|
||||
{
|
||||
get { return m_MaxDamage; }
|
||||
set { m_MaxDamage = value; }
|
||||
}
|
||||
|
||||
private bool m_WarningFlame;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public virtual bool WarningFlame
|
||||
{
|
||||
get { return m_WarningFlame; }
|
||||
set { m_WarningFlame = value; }
|
||||
}
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
if ( WarningFlame )
|
||||
DoEffect();
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
private void DoEffect()
|
||||
{
|
||||
Effects.SendLocationParticles( EffectItem.Create( Location, Map, EffectItem.DefaultDuration ), 0x3709, 10, 30, 5052 );
|
||||
Effects.PlaySound( Location, Map, 0x225 );
|
||||
}
|
||||
|
||||
public FireColumnTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_WarningFlame );
|
||||
writer.Write( m_MinDamage );
|
||||
writer.Write( m_MaxDamage );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
181
Scripts/Items/Traps/FlameSpurtTrap.cs
Normal file
181
Scripts/Items/Traps/FlameSpurtTrap.cs
Normal file
|
|
@ -0,0 +1,181 @@
|
|||
using System;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class FlameSpurtTrap : BaseTrap
|
||||
{
|
||||
private Item m_Spurt;
|
||||
private Timer m_Timer;
|
||||
|
||||
[Constructable]
|
||||
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 ), new TimerCallback( Refresh ) );
|
||||
}
|
||||
|
||||
public virtual void StopTimer()
|
||||
{
|
||||
if ( m_Timer != null )
|
||||
m_Timer.Stop();
|
||||
|
||||
m_Timer = null;
|
||||
}
|
||||
|
||||
public virtual void CheckTimer()
|
||||
{
|
||||
Map map = this.Map;
|
||||
|
||||
if ( map != null && map.GetSector( GetWorldLocation() ).Active )
|
||||
StartTimer();
|
||||
else
|
||||
StopTimer();
|
||||
}
|
||||
|
||||
public override void OnLocationChange( Point3D oldLocation )
|
||||
{
|
||||
base.OnLocationChange( oldLocation );
|
||||
|
||||
CheckTimer();
|
||||
}
|
||||
|
||||
public override void OnMapChange()
|
||||
{
|
||||
base.OnMapChange();
|
||||
|
||||
CheckTimer();
|
||||
}
|
||||
|
||||
public override void OnSectorActivate()
|
||||
{
|
||||
base.OnSectorActivate();
|
||||
|
||||
StartTimer();
|
||||
}
|
||||
|
||||
public override void OnSectorDeactivate()
|
||||
{
|
||||
base.OnSectorDeactivate();
|
||||
|
||||
StopTimer();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
|
||||
if ( m_Spurt != null )
|
||||
m_Spurt.Delete();
|
||||
}
|
||||
|
||||
public virtual void Refresh()
|
||||
{
|
||||
if ( Deleted )
|
||||
return;
|
||||
|
||||
bool foundPlayer = false;
|
||||
|
||||
foreach ( Mobile mob in GetMobilesInRange( 3 ) )
|
||||
{
|
||||
if ( !mob.Player || !mob.Alive || mob.AccessLevel > AccessLevel.Player )
|
||||
continue;
|
||||
|
||||
if ( ( (this.Z + 8) >= mob.Z && (mob.Z + 16) > this.Z ) )
|
||||
{
|
||||
foundPlayer = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !foundPlayer )
|
||||
{
|
||||
if ( m_Spurt != null )
|
||||
m_Spurt.Delete();
|
||||
|
||||
m_Spurt = null;
|
||||
}
|
||||
else if ( m_Spurt == null || m_Spurt.Deleted )
|
||||
{
|
||||
m_Spurt = new Static( 0x3709 );
|
||||
m_Spurt.MoveToWorld( this.Location, this.Map );
|
||||
|
||||
Effects.PlaySound( GetWorldLocation(), Map, 0x309 );
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnMoveOver( Mobile m )
|
||||
{
|
||||
if ( m.AccessLevel > AccessLevel.Player )
|
||||
return true;
|
||||
|
||||
if ( m.Player && m.Alive )
|
||||
{
|
||||
CheckTimer();
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), m, m, Utility.RandomMinMax( 1, 30 ) );
|
||||
m.PlaySound( m.Female ? 0x327 : 0x437 );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
base.OnMovement( m, oldLocation );
|
||||
|
||||
if ( m.Location == oldLocation || !m.Player || !m.Alive || m.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
if ( CheckRange( m.Location, oldLocation, 1 ) )
|
||||
{
|
||||
CheckTimer();
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), m, m, Utility.RandomMinMax( 1, 10 ) );
|
||||
m.PlaySound( m.Female ? 0x327 : 0x437 );
|
||||
|
||||
if ( m.Body.IsHuman )
|
||||
m.Animate( 20, 1, 1, true, false, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
public FlameSpurtTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (Item) m_Spurt );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
Item item = reader.ReadItem();
|
||||
|
||||
if ( item != null )
|
||||
item.Delete();
|
||||
|
||||
CheckTimer();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
125
Scripts/Items/Traps/GasTrap.cs
Normal file
125
Scripts/Items/Traps/GasTrap.cs
Normal file
|
|
@ -0,0 +1,125 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum GasTrapType
|
||||
{
|
||||
NorthWall,
|
||||
WestWall,
|
||||
Floor
|
||||
}
|
||||
|
||||
public class GasTrap : BaseTrap
|
||||
{
|
||||
private Poison m_Poison;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Poison Poison
|
||||
{
|
||||
get{ return m_Poison; }
|
||||
set{ m_Poison = value; }
|
||||
}
|
||||
|
||||
[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 static int GetBaseID( GasTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case GasTrapType.NorthWall: return 0x113C;
|
||||
case GasTrapType.WestWall: return 0x1147;
|
||||
case GasTrapType.Floor: return 0x11A8;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GasTrap() : this( GasTrapType.Floor )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GasTrap( GasTrapType type ) : this( type, Poison.Lesser )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GasTrap( Poison poison ) : this( GasTrapType.Floor, Poison.Lesser )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public GasTrap( GasTrapType type, Poison poison ) : base( GetBaseID( type ) )
|
||||
{
|
||||
m_Poison = poison;
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return false; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public override int PassiveTriggerRange{ get{ return 0; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.FromSeconds( 0.0 ); } }
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( m_Poison == null || !from.Player || !from.Alive || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( this.Type ) - 2, 16, 3, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x231 );
|
||||
|
||||
from.ApplyPoison( from, m_Poison );
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500855 ); // You are enveloped by a noxious gas cloud!
|
||||
}
|
||||
|
||||
public GasTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
Poison.Serialize( m_Poison, writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Poison = Poison.Deserialize( reader );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
Scripts/Items/Traps/GiantSpikeTrap.cs
Normal file
48
Scripts/Items/Traps/GiantSpikeTrap.cs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GiantSpikeTrap : BaseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public GiantSpikeTrap() : base( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return true; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public override int PassiveTriggerRange{ get{ return 3; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.FromSeconds( 0.0 ); } }
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, 0x1D99, 48, 2, GetEffectHue(), 0 );
|
||||
|
||||
if ( from.Alive && CheckRange( from.Location, 0 ) )
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), from, from, Utility.Dice( 10, 7, 0 ) );
|
||||
}
|
||||
|
||||
public GiantSpikeTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
62
Scripts/Items/Traps/MushroomTrap.cs
Normal file
62
Scripts/Items/Traps/MushroomTrap.cs
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MushroomTrap : BaseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public MushroomTrap() : base( 0x1125 )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return true; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public override int PassiveTriggerRange{ get{ return 2; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.Zero; } }
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || ItemID != 0x1125 || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
ItemID = 0x1126;
|
||||
Effects.PlaySound( Location, Map, 0x306 );
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, from, Utility.Dice( 2, 4, 0 ) );
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerCallback( OnMushroomReset ) );
|
||||
}
|
||||
|
||||
public virtual void OnMushroomReset()
|
||||
{
|
||||
if ( Region.Find( Location, Map ).IsPartOf( typeof( DungeonRegion ) ) )
|
||||
ItemID = 0x1125; // reset
|
||||
else
|
||||
Delete();
|
||||
}
|
||||
|
||||
public MushroomTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
if ( ItemID == 0x1126 )
|
||||
OnMushroomReset();
|
||||
}
|
||||
}
|
||||
}
|
||||
97
Scripts/Items/Traps/SawTrap.cs
Normal file
97
Scripts/Items/Traps/SawTrap.cs
Normal file
|
|
@ -0,0 +1,97 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
return SawTrapType.NorthWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
ItemID = GetBaseID( value );
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SawTrap() : this( SawTrapType.NorthFloor )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SawTrap( SawTrapType type ) : base( GetBaseID( type ) )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return false; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public override int PassiveTriggerRange{ get{ return 0; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.FromSeconds( 0.0 ); } }
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( this.Type ) + 1, 6, 3, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x21C );
|
||||
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), from, from, Utility.RandomMinMax( 5, 15 ) );
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500853 ); // You stepped onto a blade trap!
|
||||
}
|
||||
|
||||
public SawTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
150
Scripts/Items/Traps/SpikeTrap.cs
Normal file
150
Scripts/Items/Traps/SpikeTrap.cs
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
return SpikeTrapType.WestWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool extended = this.Extended;
|
||||
|
||||
ItemID = ( extended ? GetExtendedID( value ) : GetBaseID( value ) );
|
||||
}
|
||||
}
|
||||
|
||||
public bool Extended
|
||||
{
|
||||
get{ return ( ItemID == GetExtendedID( this.Type ) ); }
|
||||
set
|
||||
{
|
||||
if ( value )
|
||||
ItemID = GetExtendedID( this.Type );
|
||||
else
|
||||
ItemID = GetBaseID( this.Type );
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public static int GetExtendedID( SpikeTrapType type )
|
||||
{
|
||||
return GetBaseID( type ) + GetExtendedOffset( type );
|
||||
}
|
||||
|
||||
public static int GetExtendedOffset( SpikeTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case SpikeTrapType.WestWall: return 6;
|
||||
case SpikeTrapType.NorthWall: return 6;
|
||||
|
||||
case SpikeTrapType.WestFloor: return 5;
|
||||
case SpikeTrapType.NorthFloor: return 5;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpikeTrap() : this( SpikeTrapType.WestFloor )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SpikeTrap( SpikeTrapType type ) : base( GetBaseID( type ) )
|
||||
{
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return false; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public override int PassiveTriggerRange{ get{ return 0; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.FromSeconds( 6.0 ); } }
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( this.Type ) + 1, 18, 3, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x22C );
|
||||
|
||||
foreach ( Mobile mob in GetMobilesInRange( 0 ) )
|
||||
{
|
||||
if ( mob.Alive && !mob.IsDeadBondedPet )
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromTicks( 1 ), mob, mob, Utility.RandomMinMax( 1, 6 ) * 6 );
|
||||
}
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( OnSpikeExtended ) );
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 500852 ); // You stepped onto a spike trap!
|
||||
}
|
||||
|
||||
public virtual void OnSpikeExtended()
|
||||
{
|
||||
Extended = true;
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 5.0 ), new TimerCallback( OnSpikeRetracted ) );
|
||||
}
|
||||
|
||||
public virtual void OnSpikeRetracted()
|
||||
{
|
||||
Extended = false;
|
||||
Effects.SendLocationEffect( Location, Map, GetExtendedID( this.Type ) - 1, 6, 3, GetEffectHue(), 0 );
|
||||
}
|
||||
|
||||
public SpikeTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Extended = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
163
Scripts/Items/Traps/StoneFaceTrap.cs
Normal file
163
Scripts/Items/Traps/StoneFaceTrap.cs
Normal file
|
|
@ -0,0 +1,163 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
return StoneFaceTrapType.NorthWestWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
bool breathing = this.Breathing;
|
||||
|
||||
ItemID = ( breathing ? GetFireID( value ) : GetBaseID( value ) );
|
||||
}
|
||||
}
|
||||
|
||||
public bool Breathing
|
||||
{
|
||||
get{ return ( ItemID == GetFireID( this.Type ) ); }
|
||||
set
|
||||
{
|
||||
if ( value )
|
||||
ItemID = GetFireID( this.Type );
|
||||
else
|
||||
ItemID = GetBaseID( this.Type );
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBaseID( StoneFaceTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case StoneFaceTrapType.NorthWestWall: return 0x10F5;
|
||||
case StoneFaceTrapType.NorthWall: return 0x10FC;
|
||||
case StoneFaceTrapType.WestWall: return 0x110F;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int GetFireID( StoneFaceTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case StoneFaceTrapType.NorthWestWall: return 0x10F7;
|
||||
case StoneFaceTrapType.NorthWall: return 0x10FE;
|
||||
case StoneFaceTrapType.WestWall: return 0x1111;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public StoneFaceTrap() : base( 0x10FC )
|
||||
{
|
||||
Light = LightType.Circle225;
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered{ get{ return true; } }
|
||||
public override TimeSpan PassiveTriggerDelay{ get{ return TimeSpan.Zero; } }
|
||||
public override int PassiveTriggerRange{ get{ return 2; } }
|
||||
public override TimeSpan ResetDelay{ get{ return TimeSpan.Zero; } }
|
||||
|
||||
public override void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || from.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
Effects.PlaySound( Location, Map, 0x359 );
|
||||
|
||||
Breathing = true;
|
||||
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 2.0 ), new TimerCallback( FinishBreath ) );
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerCallback( TriggerDamage ) );
|
||||
}
|
||||
|
||||
public virtual void FinishBreath()
|
||||
{
|
||||
Breathing = false;
|
||||
}
|
||||
|
||||
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 StoneFaceTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
Breathing = false;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoneFaceTrapNoDamage : StoneFaceTrap
|
||||
{
|
||||
[Constructable]
|
||||
public StoneFaceTrapNoDamage()
|
||||
{
|
||||
}
|
||||
|
||||
public StoneFaceTrapNoDamage( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void TriggerDamage()
|
||||
{
|
||||
// nothing..
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
|
||||
writer.Write( (int) 0 ); // version
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
|
||||
int version = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue