#W# Initial Commit: Avatars Conquest
This commit is contained in:
commit
8eae46895e
7512 changed files with 416187 additions and 0 deletions
150
Scripts/Items/Traps/AxeTrap.cs
Normal file
150
Scripts/Items/Traps/AxeTrap.cs
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum AxeTrapType
|
||||
{
|
||||
WestWall,
|
||||
NorthWall,
|
||||
WestDown,
|
||||
NorthDown
|
||||
}
|
||||
|
||||
public class AxeTrap : BaseTrap
|
||||
{
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public AxeTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( ItemID >= 4403 && ItemID <= 4409 )
|
||||
return AxeTrapType.WestWall;
|
||||
else if ( ItemID >= 4499 && ItemID <= 4505 )
|
||||
return AxeTrapType.NorthWall;
|
||||
else if ( ItemID >= 4416 && ItemID <= 4420 )
|
||||
return AxeTrapType.WestDown;
|
||||
else if ( ItemID >= 4427 && ItemID <= 4431 )
|
||||
return AxeTrapType.NorthDown;
|
||||
|
||||
return AxeTrapType.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( AxeTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case AxeTrapType.WestWall: return 4403;
|
||||
case AxeTrapType.NorthWall: return 4499;
|
||||
case AxeTrapType.WestDown: return 4416;
|
||||
case AxeTrapType.NorthDown: return 4427;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int GetExtendedID( AxeTrapType type )
|
||||
{
|
||||
return GetBaseID( type ) + GetExtendedOffset( type );
|
||||
}
|
||||
|
||||
public static int GetExtendedOffset( AxeTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case AxeTrapType.WestWall: return 6;
|
||||
case AxeTrapType.NorthWall: return 6;
|
||||
case AxeTrapType.WestDown: return 4;
|
||||
case AxeTrapType.NorthDown: return 4;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public AxeTrap() : this( AxeTrapType.WestWall )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public AxeTrap( AxeTrapType 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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( this.Type ) + 1, 18, 3, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x232 );
|
||||
|
||||
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( OnAxeExtended ) );
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 501622 ); // You stepped into a scything blade!
|
||||
}
|
||||
|
||||
public virtual void OnAxeExtended()
|
||||
{
|
||||
Extended = true;
|
||||
Timer.DelayCall( TimeSpan.FromSeconds( 4.0 ), new TimerCallback( OnAxeRetracted ) );
|
||||
}
|
||||
|
||||
public virtual void OnAxeRetracted()
|
||||
{
|
||||
Extended = false;
|
||||
Effects.SendLocationEffect( Location, Map, GetExtendedID( this.Type ) - 1, 6, 3, GetEffectHue(), 0 );
|
||||
}
|
||||
|
||||
public AxeTrap( 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
204
Scripts/Items/Traps/BaseTrap.cs
Normal file
204
Scripts/Items/Traps/BaseTrap.cs
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
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_WhenDisarmed;
|
||||
private DateTime m_WhenSkilled;
|
||||
|
||||
private DateTime m_NextPassiveTrigger, m_NextActiveTrigger;
|
||||
|
||||
public virtual void OnTrigger( Mobile from )
|
||||
{
|
||||
if ( !TriggerCheck( from ) )
|
||||
return;
|
||||
|
||||
if ( DisarmCheck( from ) )
|
||||
return;
|
||||
}
|
||||
|
||||
public bool TriggerCheck( Mobile from )
|
||||
{
|
||||
if ( !from.Alive || from is BaseCreature || m_WhenDisarmed > DateTime.Now )
|
||||
return false;
|
||||
|
||||
bool skillUp = false;
|
||||
|
||||
if ( Utility.RandomBool() )
|
||||
{
|
||||
if ( from != LastTriggeredBy || ( from == LastTriggeredBy && m_WhenSkilled < DateTime.Now ) )
|
||||
skillUp = true;
|
||||
|
||||
if ( BaseWeapon.CheckDodge( from, skillUp ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool DisarmCheck( Mobile from )
|
||||
{
|
||||
if ( m_WhenDisarmed > DateTime.Now )
|
||||
return true;
|
||||
|
||||
if ( from is PlayerMobile )
|
||||
{
|
||||
bool disarmed = false;
|
||||
double skill = from.Skills[SkillName.RemoveTrap].Base;
|
||||
|
||||
if ( from.Skills[SkillName.RemoveTrap].Value > Utility.RandomMinMax(1,101) )
|
||||
disarmed = true;
|
||||
|
||||
if ( from != LastTriggeredBy || ( from == LastTriggeredBy && m_WhenSkilled < DateTime.Now ) )
|
||||
{
|
||||
// If they cannot pass this skill check, allow them to keep gaining skill
|
||||
// Not only pass the kill check, but also gain skill
|
||||
// Otherwise, record them so they can't keep gaining over and over on the same trap
|
||||
if ( from.CheckSkill( SkillName.RemoveTrap, 0, 120 ) )
|
||||
{
|
||||
if ( skill != from.Skills[SkillName.RemoveTrap].Base )
|
||||
{
|
||||
LastTriggeredBy = from;
|
||||
m_WhenSkilled = (DateTime.Now).AddMinutes(30.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( disarmed )
|
||||
{
|
||||
if ( this is MushroomTrap )
|
||||
{
|
||||
from.SendMessage( "You squish the mushroom so its harmless!" );
|
||||
from.PlaySound( 0x050 );
|
||||
}
|
||||
else if ( this is FireColumnTrap && this.ItemID == 0x028F )
|
||||
{
|
||||
from.SendMessage( "You plug the hole so no further flames will erupt!" );
|
||||
from.PlaySound( 0x057 );
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage( "You disabled a trap!" );
|
||||
from.PlaySound( 0x241 );
|
||||
}
|
||||
|
||||
m_WhenDisarmed = (DateTime.Now).AddMinutes((double)(Utility.RandomMinMax(30,60)));
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
if ( m_WhenDisarmed > DateTime.Now )
|
||||
return;
|
||||
|
||||
base.OnMovement( m, oldLocation );
|
||||
|
||||
if ( m.Location == oldLocation || m is BaseCreature )
|
||||
return;
|
||||
|
||||
if ( CheckRange( m.Location, oldLocation, 0 ) && DateTime.Now >= m_NextActiveTrigger )
|
||||
{
|
||||
m_NextActiveTrigger = m_NextPassiveTrigger = DateTime.Now + ResetDelay;
|
||||
|
||||
OnTrigger( m );
|
||||
}
|
||||
else if ( PassivelyTriggered && CheckRange( m.Location, oldLocation, PassiveTriggerRange ) && DateTime.Now >= m_NextPassiveTrigger )
|
||||
{
|
||||
m_NextPassiveTrigger = DateTime.Now + PassiveTriggerDelay;
|
||||
|
||||
OnTrigger( m );
|
||||
}
|
||||
}
|
||||
|
||||
public BaseTrap( int itemID ) : base( itemID )
|
||||
{
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
public Mobile LastTriggeredBy;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Last_TriggeredBy { get{ return LastTriggeredBy; } set{ LastTriggeredBy = value; } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime WhenDisarmed
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WhenDisarmed;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WhenDisarmed = value;
|
||||
}
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime WhenSkilled
|
||||
{
|
||||
get
|
||||
{
|
||||
return m_WhenSkilled;
|
||||
}
|
||||
set
|
||||
{
|
||||
m_WhenSkilled = value;
|
||||
}
|
||||
}
|
||||
|
||||
public BaseTrap( Serial serial ) : base( serial )
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
base.Serialize( writer );
|
||||
writer.Write( (int) 0 ); // version
|
||||
writer.Write( (Mobile)LastTriggeredBy);
|
||||
writer.Write( m_WhenDisarmed );
|
||||
writer.Write( m_WhenSkilled );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
int version = reader.ReadInt();
|
||||
LastTriggeredBy = reader.ReadMobile();
|
||||
m_WhenDisarmed = reader.ReadDateTime();
|
||||
m_WhenSkilled = reader.ReadDateTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
117
Scripts/Items/Traps/DartTrap.cs
Normal file
117
Scripts/Items/Traps/DartTrap.cs
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public enum DartTrapType
|
||||
{
|
||||
NorthWall,
|
||||
WestWall
|
||||
}
|
||||
|
||||
public class DartTrap : BaseTrap
|
||||
{
|
||||
private Poison m_Poison;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Poison Poison
|
||||
{
|
||||
get{ return m_Poison; }
|
||||
set{ m_Poison = value; }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DartTrapType Type
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( ItemID >= 0x0403 && ItemID <=0x0408 )
|
||||
return DartTrapType.WestWall;
|
||||
|
||||
return DartTrapType.NorthWall;
|
||||
}
|
||||
set
|
||||
{
|
||||
ItemID = GetBaseID( value );
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBaseID( DartTrapType type )
|
||||
{
|
||||
if ( type ==DartTrapType.NorthWall )
|
||||
return 0x063F;
|
||||
|
||||
return 0x0403;
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DartTrap() : this( DartTrapType.NorthWall )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DartTrap( DartTrapType type ) : this( type, Poison.Lesser )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DartTrap( Poison poison ) : this( DartTrapType.NorthWall, Poison.Lesser )
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public DartTrap( DartTrapType type, Poison poison ) : base( GetBaseID( type ) )
|
||||
{
|
||||
m_Poison = poison;
|
||||
Name = "dart trap";
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( this.Type ) + 1, 18, 3, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x224 );
|
||||
|
||||
from.ApplyPoison( from, m_Poison );
|
||||
|
||||
from.LocalOverheadMessage( MessageType.Regular, 0x22, 502380 ); // A dart imbeds itself in your flesh!
|
||||
}
|
||||
|
||||
public DartTrap( 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
114
Scripts/Items/Traps/FireColumnTrap.cs
Normal file
114
Scripts/Items/Traps/FireColumnTrap.cs
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
using System;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
[Flipable( 0x028F, 0x0290 )]
|
||||
public class FireColumnTrap : BaseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public FireColumnTrap() : base( 0x028F )
|
||||
{
|
||||
Name = "fire trap";
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
if ( WarningFlame )
|
||||
DoEffect();
|
||||
|
||||
if ( from.Alive && CheckRange( from.Location, 0 ) )
|
||||
{
|
||||
Spells.SpellHelper.Damage( TimeSpan.FromSeconds( 0.5 ), from, from, Utility.RandomMinMax( MinDamage, MaxDamage ) );
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
123
Scripts/Items/Traps/GasTrap.cs
Normal file
123
Scripts/Items/Traps/GasTrap.cs
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
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
|
||||
{
|
||||
if ( ItemID >= 0x138D && ItemID <= 0x1392 )
|
||||
return GasTrapType.WestWall;
|
||||
else if ( ItemID >= 0x1387 && ItemID <= 0x138C )
|
||||
return GasTrapType.NorthWall;
|
||||
|
||||
return GasTrapType.Floor;
|
||||
}
|
||||
set
|
||||
{
|
||||
ItemID = GetBaseID( value );
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetBaseID( GasTrapType type )
|
||||
{
|
||||
switch ( type )
|
||||
{
|
||||
case GasTrapType.NorthWall: return 0x1387;
|
||||
case GasTrapType.WestWall: return 0x138D;
|
||||
}
|
||||
|
||||
return 0x10B2;
|
||||
}
|
||||
|
||||
[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;
|
||||
Name = "gas trap";
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, GetBaseID( this.Type ) + 1, 18, 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
50
Scripts/Items/Traps/GiantSpikeTrap.cs
Normal file
50
Scripts/Items/Traps/GiantSpikeTrap.cs
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class GiantSpikeTrap : BaseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public GiantSpikeTrap() : base( 0x1BFF )
|
||||
{
|
||||
Name = "spike trap";
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
Effects.SendLocationEffect( Location, Map, 0x1D99, 48, 2, GetEffectHue(), 0 );
|
||||
Effects.PlaySound( Location, Map, 0x22C );
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
68
Scripts/Items/Traps/MushroomTrap.cs
Normal file
68
Scripts/Items/Traps/MushroomTrap.cs
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
using System;
|
||||
using Server;
|
||||
using Server.Network;
|
||||
using Server.Regions;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server.Items
|
||||
{
|
||||
public class MushroomTrap : BaseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public MushroomTrap() : base( 0x19C2 )
|
||||
{
|
||||
Name = "mushroom";
|
||||
Hue = Utility.RandomList( 0x49B, 0x4A4 );
|
||||
Light = LightType.Circle150;
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
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 = 0x19C2; // reset
|
||||
Hue = Utility.RandomList( 0x49B, 0x4A4 );
|
||||
}
|
||||
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;
|
||||
using Server.Mobiles;
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
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;
|
||||
using Server.Mobiles;
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
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;
|
||||
using Server.Mobiles;
|
||||
|
||||
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 )
|
||||
{
|
||||
base.OnTrigger( from );
|
||||
|
||||
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