Overwrite
Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.ACC.CSS.Systems.Ancient
|
||||
{
|
||||
public class FakeGold : Item
|
||||
{
|
||||
public int m_Amount;
|
||||
|
||||
[Constructable]
|
||||
public FakeGold()
|
||||
: base(0xEEF)
|
||||
{
|
||||
Weight = 0.0;
|
||||
Name = "" + m_Amount + " Gold Coins";
|
||||
|
||||
}
|
||||
|
||||
public FakeGold(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override int GetDropSound()
|
||||
{
|
||||
if (m_Amount <= 1)
|
||||
return 0x2E4;
|
||||
else if (m_Amount <= 5)
|
||||
return 0x2E5;
|
||||
else
|
||||
return 0x2E6;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)0); // version
|
||||
writer.Write(m_Amount);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
m_Amount = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using Server.Misc;
|
||||
using Server.Items;
|
||||
using System.Collections;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.ACC.CSS.Systems.Ancient
|
||||
{
|
||||
public class GreaterNaturalFire : Item
|
||||
{
|
||||
private Timer m_Timer;
|
||||
private Timer m_Burn;
|
||||
private DateTime m_End;
|
||||
private Mobile m_Caster;
|
||||
|
||||
public override bool BlocksFit { get { return true; } }
|
||||
|
||||
public GreaterNaturalFire(Point3D loc, Map map, Mobile caster)
|
||||
: base(0x19AB)
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
Light = LightType.Circle150;
|
||||
MoveToWorld(loc, map);
|
||||
m_Caster = caster;
|
||||
|
||||
if (caster.InLOS(this))
|
||||
Visible = true;
|
||||
else
|
||||
Delete();
|
||||
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
m_Timer = new InternalTimer(this, TimeSpan.FromMinutes(5.0));
|
||||
m_Timer.Start();
|
||||
m_Burn = new BurnTimer(this, m_Caster);
|
||||
m_Burn.Start();
|
||||
|
||||
m_End = DateTime.Now + TimeSpan.FromMinutes(5.0);
|
||||
}
|
||||
|
||||
public GreaterNaturalFire(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Visible && m_Caster != null && SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
m_Caster.DoHarmful(m);
|
||||
|
||||
int damage = Utility.Random(5, 10);
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
damage = Utility.Random(2, 5);
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, m_Caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x1DD);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_End - DateTime.Now);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
TimeSpan duration = reader.ReadTimeSpan();
|
||||
|
||||
m_Timer = new InternalTimer(this, duration);
|
||||
m_Timer.Start();
|
||||
|
||||
m_End = DateTime.Now + duration;
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
TimeSpan duration = TimeSpan.FromSeconds(10.0);
|
||||
|
||||
m_Timer = new InternalTimer(this, duration);
|
||||
m_Timer.Start();
|
||||
|
||||
m_End = DateTime.Now + duration;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (m_Timer != null)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private GreaterNaturalFire m_Item;
|
||||
|
||||
public InternalTimer(GreaterNaturalFire item, TimeSpan duration)
|
||||
: base(duration)
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
private class BurnTimer : Timer
|
||||
{
|
||||
private Item m_FireRing;
|
||||
private Mobile m_Caster;
|
||||
private DateTime m_Duration;
|
||||
|
||||
private static Queue m_Queue = new Queue();
|
||||
|
||||
public BurnTimer(Item ap, Mobile ca)
|
||||
: base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(0.5))
|
||||
{
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
|
||||
m_FireRing = ap;
|
||||
m_Caster = ca;
|
||||
m_Duration = DateTime.Now + TimeSpan.FromSeconds(15.0 + (Utility.RandomDouble() * 15.0));
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_FireRing.Deleted)
|
||||
return;
|
||||
|
||||
if (DateTime.Now > m_Duration)
|
||||
{
|
||||
|
||||
Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = m_FireRing.Map;
|
||||
|
||||
if (map != null)
|
||||
{
|
||||
foreach (Mobile m in m_FireRing.GetMobilesInRange(1))
|
||||
{
|
||||
if ((m.Z + 16) > m_FireRing.Z && (m_FireRing.Z + 12) > m.Z)
|
||||
m_Queue.Enqueue(m);
|
||||
}
|
||||
|
||||
while (m_Queue.Count > 0)
|
||||
{
|
||||
Mobile m = (Mobile)m_Queue.Dequeue();
|
||||
|
||||
if (m_FireRing.Visible && m_Caster != null && SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
m_Caster.DoHarmful(m);
|
||||
|
||||
int damage = Utility.Random(5, 10);
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
damage = Utility.Random(2, 5);
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, m_Caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x1DD);
|
||||
m.SendLocalizedMessage(503000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,421 @@
|
||||
using System;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.ACC.CSS.Systems.Ancient
|
||||
{
|
||||
public class LesserBladeTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public LesserBladeTrapDeed() : base( HouseTrapStrength.Lesser, HouseTrapType.Blades )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserBladeTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class RegularBladeTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public RegularBladeTrapDeed() : base( HouseTrapStrength.Regular, HouseTrapType.Blades )
|
||||
{
|
||||
}
|
||||
|
||||
public RegularBladeTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class GreaterBladeTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public GreaterBladeTrapDeed() : base( HouseTrapStrength.Greater, HouseTrapType.Blades )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterBladeTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeadlyBladeTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public DeadlyBladeTrapDeed() : base( HouseTrapStrength.Deadly, HouseTrapType.Blades )
|
||||
{
|
||||
}
|
||||
|
||||
public DeadlyBladeTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class LesserExplosionTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public LesserExplosionTrapDeed() : base( HouseTrapStrength.Lesser, HouseTrapType.Explosion )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserExplosionTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class RegularExplosionTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public RegularExplosionTrapDeed() : base( HouseTrapStrength.Regular, HouseTrapType.Explosion )
|
||||
{
|
||||
}
|
||||
|
||||
public RegularExplosionTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class GreaterExplosionTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public GreaterExplosionTrapDeed() : base( HouseTrapStrength.Greater, HouseTrapType.Explosion )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterExplosionTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeadlyExplosionTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public DeadlyExplosionTrapDeed() : base( HouseTrapStrength.Deadly, HouseTrapType.Explosion )
|
||||
{
|
||||
}
|
||||
|
||||
public DeadlyExplosionTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class LesserFireColumnTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public LesserFireColumnTrapDeed() : base( HouseTrapStrength.Lesser, HouseTrapType.FireColumn )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserFireColumnTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class RegularFireColumnTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public RegularFireColumnTrapDeed() : base( HouseTrapStrength.Regular, HouseTrapType.FireColumn )
|
||||
{
|
||||
}
|
||||
|
||||
public RegularFireColumnTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class GreaterFireColumnTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public GreaterFireColumnTrapDeed() : base( HouseTrapStrength.Greater, HouseTrapType.FireColumn )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterFireColumnTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeadlyFireColumnTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public DeadlyFireColumnTrapDeed() : base( HouseTrapStrength.Deadly, HouseTrapType.FireColumn )
|
||||
{
|
||||
}
|
||||
|
||||
public DeadlyFireColumnTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class LesserPoisonTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public LesserPoisonTrapDeed() : base( HouseTrapStrength.Lesser, HouseTrapType.Poison )
|
||||
{
|
||||
}
|
||||
|
||||
public LesserPoisonTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class RegularPoisonTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public RegularPoisonTrapDeed() : base( HouseTrapStrength.Regular, HouseTrapType.Poison )
|
||||
{
|
||||
}
|
||||
|
||||
public RegularPoisonTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class GreaterPoisonTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public GreaterPoisonTrapDeed() : base( HouseTrapStrength.Greater, HouseTrapType.Poison )
|
||||
{
|
||||
}
|
||||
|
||||
public GreaterPoisonTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
|
||||
public class DeadlyPoisonTrapDeed : HouseTrapDeed
|
||||
{
|
||||
[Constructable]
|
||||
public DeadlyPoisonTrapDeed() : base( HouseTrapStrength.Deadly, HouseTrapType.Poison )
|
||||
{
|
||||
}
|
||||
|
||||
public DeadlyPoisonTrapDeed( 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();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,469 @@
|
||||
using System;
|
||||
using Server.Multis;
|
||||
using Server.Regions;
|
||||
using Server.Spells;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.ACC.CSS.Systems.Ancient
|
||||
{
|
||||
public enum HouseTrapStrength
|
||||
{
|
||||
Lesser = 1,
|
||||
Regular = 2,
|
||||
Greater = 3,
|
||||
Deadly = 4,
|
||||
None = 0
|
||||
}
|
||||
|
||||
public enum HouseTrapType
|
||||
{
|
||||
Blades = 1,
|
||||
FireColumn = 2,
|
||||
Explosion = 3,
|
||||
Poison = 4
|
||||
}
|
||||
|
||||
public class BaseHouseTrap : BaseTrap
|
||||
{
|
||||
public BaseHouseTrap(HouseTrapStrength p_Strength, HouseTrapType p_Type)
|
||||
: base(0x3133)
|
||||
{
|
||||
TrapType = p_Type;
|
||||
TrapStrength = p_Strength;
|
||||
}
|
||||
|
||||
public BaseHouseTrap(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
private Mobile m_Placer;
|
||||
private bool m_Detected;
|
||||
private HouseTrapType m_TrapType;
|
||||
private HouseTrapStrength m_TrapStrength;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Placer
|
||||
{
|
||||
get { return m_Placer; }
|
||||
set { m_Placer = value; }
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Detected
|
||||
{
|
||||
get { return m_Detected; }
|
||||
set { m_Detected = value; }
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HouseTrapType TrapType
|
||||
{
|
||||
get { return m_TrapType; }
|
||||
set { m_TrapType = value; }
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HouseTrapStrength TrapStrength
|
||||
{
|
||||
get { return m_TrapStrength; }
|
||||
set { m_TrapStrength = value; }
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write((Mobile)m_Placer);
|
||||
writer.Write((int)TrapType);
|
||||
writer.Write((int)TrapStrength);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_Placer = reader.ReadMobile();
|
||||
TrapType = (HouseTrapType)reader.ReadInt();
|
||||
TrapStrength = (HouseTrapStrength)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ItemID = 12595;
|
||||
}
|
||||
|
||||
public override bool PassivelyTriggered { get { return true; } }
|
||||
public override TimeSpan PassiveTriggerDelay { get { return TimeSpan.FromSeconds(2.0); } } // Two seconds to get the f**k off the trap
|
||||
public override int PassiveTriggerRange { get { return 0; } } // Have to be ON TOP of the trap to activate it..
|
||||
public override TimeSpan ResetDelay { get { return TimeSpan.FromSeconds(0.5); } } // Resets after half a second
|
||||
|
||||
public override void OnTrigger(Mobile from) // Add Types of Trap Poison, Blade, Explosion etc...
|
||||
{
|
||||
if (from != null && m_Placer != null)
|
||||
{
|
||||
if (from != m_Placer && from.Z == this.Z && from.Alive && from.AccessLevel == AccessLevel.Player) // Must not be the placer, must be alive, and standing on the trap for it to work.
|
||||
{
|
||||
if (m_Placer.GuildFealty != from.GuildFealty)
|
||||
{
|
||||
switch (TrapType)
|
||||
{
|
||||
case HouseTrapType.FireColumn:
|
||||
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x3709, 10, 30, 5052);
|
||||
Effects.PlaySound(Location, Map, 0x225);
|
||||
break;
|
||||
case HouseTrapType.Blades:
|
||||
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x37A0, 10, 30, 5052);
|
||||
Effects.PlaySound(Location, Map, 0x23A);
|
||||
break;
|
||||
case HouseTrapType.Poison:
|
||||
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x11A6, 10, 30, 5052);
|
||||
Effects.PlaySound(Location, Map, 0x1DE);
|
||||
break;
|
||||
case HouseTrapType.Explosion:
|
||||
Effects.SendLocationParticles(EffectItem.Create(Location, Map, EffectItem.DefaultDuration), 0x36BD, 10, 30, 5052);
|
||||
Effects.PlaySound(Location, Map, 0x234);
|
||||
break;
|
||||
}
|
||||
|
||||
if (TrapType == HouseTrapType.Poison)
|
||||
switch (TrapStrength)
|
||||
{
|
||||
case HouseTrapStrength.Lesser:
|
||||
m_Placer.DoHarmful(from);
|
||||
from.ApplyPoison(m_Placer, Poison.Lesser);
|
||||
break;
|
||||
case HouseTrapStrength.Regular:
|
||||
m_Placer.DoHarmful(from);
|
||||
from.ApplyPoison(m_Placer, Poison.Regular);
|
||||
break;
|
||||
case HouseTrapStrength.Greater:
|
||||
m_Placer.DoHarmful(from);
|
||||
from.ApplyPoison(m_Placer, Poison.Greater);
|
||||
break;
|
||||
case HouseTrapStrength.Deadly:
|
||||
m_Placer.DoHarmful(from);
|
||||
from.ApplyPoison(m_Placer, Poison.Deadly);
|
||||
break;
|
||||
case HouseTrapStrength.None:
|
||||
break;
|
||||
}
|
||||
else if (TrapType == HouseTrapType.Blades)
|
||||
switch (TrapStrength)
|
||||
{
|
||||
case HouseTrapStrength.Lesser:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(from, m_Placer, Utility.RandomMinMax(5, 20), 0, 100, 0, 0, 0);
|
||||
break;
|
||||
case HouseTrapStrength.Regular:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(from, m_Placer, Utility.RandomMinMax(10, 40), 0, 100, 0, 0, 0); break;
|
||||
case HouseTrapStrength.Greater:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(from, m_Placer, Utility.RandomMinMax(50, 100), 0, 100, 0, 0, 0); break;
|
||||
case HouseTrapStrength.Deadly:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(from, m_Placer, Utility.RandomMinMax(80, 120), 0, 100, 0, 0, 0); break;
|
||||
case HouseTrapStrength.None:
|
||||
break;
|
||||
}
|
||||
else
|
||||
switch (TrapStrength)
|
||||
{
|
||||
case HouseTrapStrength.Lesser:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(m_Placer, from, Utility.RandomMinMax(5, 20), 100, 0, 0, 0, 0);
|
||||
break;
|
||||
case HouseTrapStrength.Regular:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(from, m_Placer, Utility.RandomMinMax(10, 40), 100, 0, 0, 0, 0); break;
|
||||
case HouseTrapStrength.Greater:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(from, m_Placer, Utility.RandomMinMax(50, 100), 100, 0, 0, 0, 0); break;
|
||||
case HouseTrapStrength.Deadly:
|
||||
m_Placer.DoHarmful(from);
|
||||
AOS.Damage(from, m_Placer, Utility.RandomMinMax(80, 120), 100, 0, 0, 0, 0); break;
|
||||
case HouseTrapStrength.None:
|
||||
break;
|
||||
}
|
||||
|
||||
if (0.3 > Utility.RandomDouble())
|
||||
{
|
||||
m_Placer.SendMessage("A trap you placed has broken!");
|
||||
Blood shards = new Blood();
|
||||
shards.ItemID = 0xC2D;
|
||||
shards.Map = this.Map;
|
||||
shards.Location = this.Location;
|
||||
Effects.PlaySound(this.Location, this.Map, 0x305);
|
||||
this.Delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if (from.InRange(this.GetWorldLocation(), 1))
|
||||
{
|
||||
if (m_Placer == null || from == m_Placer)
|
||||
{
|
||||
from.AddToBackpack(new HouseTrapDeed(TrapStrength, TrapType));
|
||||
|
||||
this.Delete();
|
||||
|
||||
from.SendMessage("You disassemble the trap.");
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You can not disassemble that trap.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class HouseTrap : BaseHouseTrap
|
||||
{
|
||||
[Constructable]
|
||||
public HouseTrap(Mobile from, HouseTrapStrength p_Strength, HouseTrapType p_Type)
|
||||
: base(p_Strength, p_Type)
|
||||
{
|
||||
Name = "";
|
||||
Visible = false;
|
||||
|
||||
switch (p_Strength)
|
||||
{
|
||||
case HouseTrapStrength.Lesser:
|
||||
Name = Name + "Lesser";
|
||||
break;
|
||||
case HouseTrapStrength.Regular:
|
||||
Name = Name + "Regular";
|
||||
break;
|
||||
case HouseTrapStrength.Greater:
|
||||
Name = Name + "Greater";
|
||||
break;
|
||||
case HouseTrapStrength.Deadly:
|
||||
Name = Name + "Deadly";
|
||||
break;
|
||||
case HouseTrapStrength.None:
|
||||
Name = Name + "None";
|
||||
break;
|
||||
}
|
||||
|
||||
Name = Name + " ";
|
||||
|
||||
switch (p_Type)
|
||||
{
|
||||
case HouseTrapType.Blades:
|
||||
Name = Name + "Blade";
|
||||
break;
|
||||
case HouseTrapType.FireColumn:
|
||||
Name = Name + "Fire Column";
|
||||
break;
|
||||
case HouseTrapType.Explosion:
|
||||
Name = Name + "Explosion";
|
||||
break;
|
||||
case HouseTrapType.Poison:
|
||||
Name = Name + "Poison";
|
||||
break;
|
||||
}
|
||||
|
||||
Name = Name + " Trap";
|
||||
|
||||
Placer = from;
|
||||
Movable = false;
|
||||
MoveToWorld(from.Location, from.Map);
|
||||
}
|
||||
|
||||
public HouseTrap(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();
|
||||
}
|
||||
}
|
||||
|
||||
public class HouseTrapDeed : Item
|
||||
{
|
||||
private HouseTrapType m_TrapType;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HouseTrapType TrapType
|
||||
{
|
||||
get { return m_TrapType; }
|
||||
set { m_TrapType = value; }
|
||||
}
|
||||
|
||||
private HouseTrapStrength m_TrapStrength;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public HouseTrapStrength TrapStrength
|
||||
{
|
||||
get { return m_TrapStrength; }
|
||||
set { m_TrapStrength = value; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public HouseTrapDeed(HouseTrapStrength p_Strength, HouseTrapType p_Type)
|
||||
: base(0x14F0)
|
||||
{
|
||||
Name = "a ";
|
||||
|
||||
switch (p_Strength)
|
||||
{
|
||||
case HouseTrapStrength.Lesser:
|
||||
Name = Name + "Lesser";
|
||||
break;
|
||||
case HouseTrapStrength.Regular:
|
||||
Name = Name + "Regular";
|
||||
break;
|
||||
case HouseTrapStrength.Greater:
|
||||
Name = Name + "Greater";
|
||||
break;
|
||||
case HouseTrapStrength.Deadly:
|
||||
Name = Name + "Deadly";
|
||||
break;
|
||||
case HouseTrapStrength.None:
|
||||
Name = Name + "None";
|
||||
break;
|
||||
}
|
||||
|
||||
Name = Name + " ";
|
||||
|
||||
switch (p_Type)
|
||||
{
|
||||
case HouseTrapType.Blades:
|
||||
Name = Name + "Blade";
|
||||
break;
|
||||
case HouseTrapType.FireColumn:
|
||||
Name = Name + "Fire Column";
|
||||
break;
|
||||
case HouseTrapType.Explosion:
|
||||
Name = Name + "Explosion";
|
||||
break;
|
||||
case HouseTrapType.Poison:
|
||||
Name = Name + "Poison";
|
||||
break;
|
||||
}
|
||||
|
||||
Name = Name + " Trap Deed";
|
||||
|
||||
m_TrapType = p_Type;
|
||||
m_TrapStrength = p_Strength;
|
||||
|
||||
Weight = 1.0;
|
||||
}
|
||||
|
||||
public HouseTrapDeed(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
writer.Write((int)TrapType);
|
||||
writer.Write((int)TrapStrength);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
m_TrapType = (HouseTrapType)reader.ReadInt();
|
||||
m_TrapStrength = (HouseTrapStrength)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if (from.InRange(this.GetWorldLocation(), 1))
|
||||
{
|
||||
if (pack != null && IsChildOf(pack))
|
||||
{
|
||||
if (!SpellHelper.IsTown(from.Location, from))
|
||||
{
|
||||
if (!NonTrapLocations(from))
|
||||
{
|
||||
this.Delete();
|
||||
new HouseTrap(from, TrapStrength, TrapType);
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("You cannot place that there.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendMessage("! , .");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(1060640); // Must be in backpack...
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
}
|
||||
|
||||
public bool NonTrapLocations(Mobile from)
|
||||
{
|
||||
Map map = from.Map;
|
||||
|
||||
if (map == null)
|
||||
return false;
|
||||
|
||||
IPooledEnumerable eable = map.GetItemsInRange(from.Location, 0);
|
||||
|
||||
foreach (Item item in eable)
|
||||
{
|
||||
if ((item.Z + 16) > from.Z && (from.Z + 16) > item.Z && item.ItemID == 0x1BBF)
|
||||
{
|
||||
eable.Free();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
eable.Free();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,206 @@
|
||||
using System;
|
||||
using Server.Targeting;
|
||||
using Server.Network;
|
||||
using Server.Misc;
|
||||
using Server.Items;
|
||||
using System.Collections;
|
||||
using Server.Mobiles;
|
||||
using Server.Spells;
|
||||
|
||||
namespace Server.ACC.CSS.Systems.Ancient
|
||||
{
|
||||
public class NaturalFire : Item
|
||||
{
|
||||
private Timer m_Timer;
|
||||
private Timer m_Burn;
|
||||
private DateTime m_End;
|
||||
private Mobile m_Caster;
|
||||
|
||||
public override bool BlocksFit { get { return true; } }
|
||||
|
||||
public NaturalFire(Point3D loc, Map map, Mobile caster)
|
||||
: base(0xF53)
|
||||
{
|
||||
Visible = false;
|
||||
Movable = false;
|
||||
Light = LightType.Circle150;
|
||||
MoveToWorld(loc, map);
|
||||
m_Caster = caster;
|
||||
|
||||
if (caster.InLOS(this))
|
||||
Visible = true;
|
||||
else
|
||||
Delete();
|
||||
|
||||
if (Deleted)
|
||||
return;
|
||||
|
||||
m_Timer = new InternalTimer(this, TimeSpan.FromMinutes(5.0));
|
||||
m_Timer.Start();
|
||||
m_Burn = new BurnTimer(this, m_Caster);
|
||||
m_Burn.Start();
|
||||
|
||||
m_End = DateTime.Now + TimeSpan.FromMinutes(5.0);
|
||||
}
|
||||
|
||||
public NaturalFire(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
if (Visible && m_Caster != null && SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
m_Caster.DoHarmful(m);
|
||||
|
||||
int damage = Utility.Random(1, 2);
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
damage = Utility.Random(1);
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, m_Caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x1DD);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1); // version
|
||||
|
||||
writer.Write(m_End - DateTime.Now);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
TimeSpan duration = reader.ReadTimeSpan();
|
||||
|
||||
m_Timer = new InternalTimer(this, duration);
|
||||
m_Timer.Start();
|
||||
|
||||
m_End = DateTime.Now + duration;
|
||||
|
||||
break;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
TimeSpan duration = TimeSpan.FromSeconds(10.0);
|
||||
|
||||
m_Timer = new InternalTimer(this, duration);
|
||||
m_Timer.Start();
|
||||
|
||||
m_End = DateTime.Now + duration;
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
base.OnAfterDelete();
|
||||
|
||||
if (m_Timer != null)
|
||||
m_Timer.Stop();
|
||||
}
|
||||
|
||||
private class InternalTimer : Timer
|
||||
{
|
||||
private NaturalFire m_Item;
|
||||
|
||||
public InternalTimer(NaturalFire item, TimeSpan duration)
|
||||
: base(duration)
|
||||
{
|
||||
m_Item = item;
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
m_Item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
private class BurnTimer : Timer
|
||||
{
|
||||
private Item m_FireRing;
|
||||
private Mobile m_Caster;
|
||||
private DateTime m_Duration;
|
||||
|
||||
private static Queue m_Queue = new Queue();
|
||||
|
||||
public BurnTimer(Item ap, Mobile ca)
|
||||
: base(TimeSpan.FromSeconds(0.25), TimeSpan.FromSeconds(0.5))
|
||||
{
|
||||
Priority = TimerPriority.FiftyMS;
|
||||
|
||||
m_FireRing = ap;
|
||||
m_Caster = ca;
|
||||
m_Duration = DateTime.Now + TimeSpan.FromSeconds(15.0 + (Utility.RandomDouble() * 15.0));
|
||||
}
|
||||
|
||||
protected override void OnTick()
|
||||
{
|
||||
if (m_FireRing.Deleted)
|
||||
return;
|
||||
|
||||
if (DateTime.Now > m_Duration)
|
||||
{
|
||||
|
||||
Stop();
|
||||
}
|
||||
else
|
||||
{
|
||||
Map map = m_FireRing.Map;
|
||||
|
||||
if (map != null)
|
||||
{
|
||||
foreach (Mobile m in m_FireRing.GetMobilesInRange(1))
|
||||
{
|
||||
if ((m.Z + 16) > m_FireRing.Z && (m_FireRing.Z + 12) > m.Z)
|
||||
m_Queue.Enqueue(m);
|
||||
}
|
||||
|
||||
while (m_Queue.Count > 0)
|
||||
{
|
||||
Mobile m = (Mobile)m_Queue.Dequeue();
|
||||
|
||||
if (m_FireRing.Visible && m_Caster != null && SpellHelper.ValidIndirectTarget(m_Caster, m) && m_Caster.CanBeHarmful(m, false))
|
||||
{
|
||||
m_Caster.DoHarmful(m);
|
||||
|
||||
int damage = Utility.Random(1, 2);
|
||||
|
||||
if (!Core.AOS && m.CheckSkill(SkillName.MagicResist, 0.0, 30.0))
|
||||
{
|
||||
damage = Utility.Random(1);
|
||||
|
||||
m.SendLocalizedMessage(501783); // You feel yourself resisting magical energy.
|
||||
}
|
||||
|
||||
AOS.Damage(m, m_Caster, damage, 0, 100, 0, 0, 0);
|
||||
m.PlaySound(0x1DD);
|
||||
m.SendLocalizedMessage(503000);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,357 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using Server;
|
||||
using Server.Engines.PartySystem;
|
||||
using Server.Misc;
|
||||
using Server.Guilds;
|
||||
using Server.Mobiles;
|
||||
using Server.Network;
|
||||
using Server.ContextMenus;
|
||||
using Server.Items;
|
||||
|
||||
namespace Server.ACC.CSS.Systems.Ancient
|
||||
{
|
||||
public class SleepingBody : Container
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
private string m_SleepingBodyName; // Value of the SleepingNameAttribute attached to the owner when he died -or- null if the owner had no SleepingBodyNameAttribute; use "the remains of ~name~"
|
||||
private bool m_Blessed;
|
||||
|
||||
private ArrayList m_EquipItems; // List of items equiped when the owner died. Ingame, these items display /on/ the SleepingBody, not just inside
|
||||
private bool m_spell;
|
||||
private DateTime m_NextSnoreTrigger;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Mobile Owner
|
||||
{
|
||||
get { return m_Owner; }
|
||||
}
|
||||
|
||||
public ArrayList EquipItems
|
||||
{
|
||||
get { return m_EquipItems; }
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool Invuln
|
||||
{
|
||||
get { return m_Blessed; }
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SleepingBody(Mobile owner, bool blessed)
|
||||
: this(owner, blessed, true)
|
||||
{
|
||||
}
|
||||
|
||||
[Constructable]
|
||||
public SleepingBody(Mobile owner, bool blessed, bool isSpell)
|
||||
: base(0x2006)
|
||||
{
|
||||
Stackable = true; // To supress console warnings, stackable must be true
|
||||
Amount = owner.Body; // protocol defines that for itemid 0x2006, amount=body
|
||||
Stackable = false;
|
||||
m_Blessed = blessed;
|
||||
Movable = false;
|
||||
|
||||
m_Owner = owner;
|
||||
Name = m_Owner.Name;
|
||||
m_SleepingBodyName = GetBodyName(owner);
|
||||
Hue = m_Owner.Hue;
|
||||
Direction = m_Owner.Direction;
|
||||
m_spell = isSpell;
|
||||
|
||||
m_EquipItems = new ArrayList();
|
||||
AddFromLayer(m_Owner, Layer.FirstValid, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.TwoHanded, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Shoes, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Pants, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Shirt, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Helm, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Gloves, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Ring, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Neck, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Hair, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Waist, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.InnerTorso, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Bracelet, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.FacialHair, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.MiddleTorso, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Earrings, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Arms, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.Cloak, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.OuterTorso, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.OuterLegs, ref m_EquipItems);
|
||||
AddFromLayer(m_Owner, Layer.LastUserValid, ref m_EquipItems);
|
||||
}
|
||||
|
||||
private void AddFromLayer(Mobile from, Layer layer, ref ArrayList list)
|
||||
{
|
||||
if (list == null)
|
||||
list = new ArrayList();
|
||||
|
||||
Item worn = from.FindItemOnLayer(layer);
|
||||
if (worn != null)
|
||||
{
|
||||
Item item = new Item();
|
||||
item.ItemID = worn.ItemID;
|
||||
item.Hue = worn.Hue;
|
||||
item.Layer = layer;
|
||||
DropItem(item);
|
||||
list.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
from.SendLocalizedMessage(1001018); // You cannot perform negative acts on your target.
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement { get { return true; } } // Tell the core that we implement OnMovement
|
||||
|
||||
public override bool OnDragDropInto(Mobile from, Item item, Point3D p)
|
||||
{
|
||||
from.SendLocalizedMessage(1005468, "", 0x8A5); // Me Sleepy.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
from.SendLocalizedMessage(1005468, "", 0x8A5); // Me Sleepy.
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool CheckContentDisplay(Mobile from)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool DisplaysContent { get { return false; } }
|
||||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
if (m_Owner != null)
|
||||
{
|
||||
m_Owner.Z = this.Z;
|
||||
m_Owner.Blessed = this.m_Blessed;
|
||||
}
|
||||
|
||||
for (int i = 0; i < m_EquipItems.Count; i++)
|
||||
{
|
||||
object o = m_EquipItems[i];
|
||||
if (o != null && o is Item)
|
||||
{
|
||||
Item item = (Item)o;
|
||||
item.Delete();
|
||||
}
|
||||
}
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
||||
public SleepingBody(Serial serial)
|
||||
: base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void SendInfoTo(NetState state, bool sendOplPacket)
|
||||
{
|
||||
base.SendInfoTo(state, ObjectPropertyList.Enabled);
|
||||
|
||||
if (ItemID == 0x2006)
|
||||
{
|
||||
state.Send(new SleepingBodyContent(state.Mobile, this));
|
||||
state.Send(new SleepingBodyEquip(state.Mobile, this));
|
||||
}
|
||||
}
|
||||
|
||||
public override void AddNameProperty(ObjectPropertyList list)
|
||||
{
|
||||
if (m_SleepingBodyName != null)
|
||||
list.Add(m_SleepingBodyName);
|
||||
else
|
||||
list.Add(1049644, String.Format("Sleeping {0}", Name));
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
{
|
||||
LabelTo(from, m_SleepingBodyName == null ? String.Format("Sleeping {0}", Name) : m_SleepingBodyName);
|
||||
}
|
||||
|
||||
public static string GetBodyName(Mobile m)
|
||||
{
|
||||
Type t = m.GetType();
|
||||
|
||||
object[] attrs = t.GetCustomAttributes(typeof(SleepingNameAttribute), true);
|
||||
|
||||
if (attrs != null && attrs.Length > 0)
|
||||
{
|
||||
SleepingNameAttribute attr = attrs[0] as SleepingNameAttribute;
|
||||
|
||||
if (attr != null)
|
||||
return attr.Name;
|
||||
}
|
||||
|
||||
return m.Name;
|
||||
}
|
||||
|
||||
public override void Serialize(GenericWriter writer)
|
||||
{
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write((int)1);
|
||||
|
||||
writer.Write(m_spell); // version 1
|
||||
|
||||
writer.Write(m_Owner); // version 0
|
||||
writer.Write(m_SleepingBodyName);
|
||||
writer.Write(m_Blessed);
|
||||
|
||||
writer.WriteItemList(m_EquipItems, true);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
{
|
||||
m_spell = true;
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
m_spell = reader.ReadBool();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Owner = reader.ReadMobile();
|
||||
m_SleepingBodyName = reader.ReadString();
|
||||
m_Blessed = reader.ReadBool();
|
||||
|
||||
m_EquipItems = reader.ReadItemList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
m_NextSnoreTrigger = DateTime.Now;
|
||||
|
||||
// Delete on Server restart if spell action
|
||||
if (m_spell)
|
||||
this.Delete();
|
||||
}
|
||||
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, 5) && DateTime.Now >= m_NextSnoreTrigger)
|
||||
{
|
||||
m_NextSnoreTrigger = DateTime.Now + TimeSpan.FromSeconds(Utility.Random(5, 10));
|
||||
|
||||
if (this != null && this.Owner != null)
|
||||
{
|
||||
this.PublicOverheadMessage(0, Owner.SpeechHue, false, "zZz");
|
||||
Owner.PlaySound(Owner.Female ? 819 : 1093);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SleepingBodyEquip : Packet
|
||||
{
|
||||
public SleepingBodyEquip(Mobile beholder, SleepingBody beheld)
|
||||
: base(0x89)
|
||||
{
|
||||
ArrayList list = beheld.EquipItems;
|
||||
|
||||
EnsureCapacity(8 + (list.Count * 5));
|
||||
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
|
||||
for (int i = 0; i < list.Count; ++i)
|
||||
{
|
||||
Item item = (Item)list[i];
|
||||
|
||||
if (!item.Deleted && beholder.CanSee(item) && item.Parent == beheld)
|
||||
{
|
||||
m_Stream.Write((byte)(item.Layer + 1));
|
||||
m_Stream.Write((int)item.Serial);
|
||||
}
|
||||
}
|
||||
|
||||
m_Stream.Write((byte)Layer.Invalid);
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class SleepingBodyContent : Packet
|
||||
{
|
||||
public SleepingBodyContent(Mobile beholder, SleepingBody beheld)
|
||||
: base(0x3C)
|
||||
{
|
||||
ArrayList items = beheld.EquipItems;
|
||||
int count = items.Count;
|
||||
|
||||
EnsureCapacity(5 + (count * 19));
|
||||
|
||||
long pos = m_Stream.Position;
|
||||
|
||||
int written = 0;
|
||||
|
||||
m_Stream.Write((ushort)0);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
Item child = (Item)items[i];
|
||||
|
||||
if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
|
||||
{
|
||||
m_Stream.Write((int)child.Serial);
|
||||
m_Stream.Write((ushort)child.ItemID);
|
||||
m_Stream.Write((byte)0); // signed, itemID offset
|
||||
m_Stream.Write((ushort)child.Amount);
|
||||
m_Stream.Write((short)child.X);
|
||||
m_Stream.Write((short)child.Y);
|
||||
m_Stream.Write((int)beheld.Serial);
|
||||
m_Stream.Write((ushort)child.Hue);
|
||||
|
||||
++written;
|
||||
}
|
||||
}
|
||||
|
||||
m_Stream.Seek(pos, SeekOrigin.Begin);
|
||||
m_Stream.Write((ushort)written);
|
||||
}
|
||||
}
|
||||
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
public class SleepingNameAttribute : Attribute
|
||||
{
|
||||
private string m_Name;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return m_Name; }
|
||||
}
|
||||
|
||||
public SleepingNameAttribute(string name)
|
||||
{
|
||||
m_Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user