Changes properties to use automatic property initializers
This commit is contained in:
parent
f0a48ad431
commit
06fa31a7bf
623 changed files with 13072 additions and 19304 deletions
|
|
@ -33,18 +33,12 @@ namespace Server.Items
|
|||
|
||||
public abstract class BaseBulletinBoard : Item
|
||||
{
|
||||
private string m_BoardName;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string BoardName
|
||||
{
|
||||
get => m_BoardName;
|
||||
set => m_BoardName = value;
|
||||
}
|
||||
public string BoardName { get; set; }
|
||||
|
||||
public BaseBulletinBoard( int itemID ) : base( itemID )
|
||||
{
|
||||
m_BoardName = "bulletin board";
|
||||
BoardName = "bulletin board";
|
||||
Movable = false;
|
||||
}
|
||||
|
||||
|
|
@ -188,7 +182,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (string) m_BoardName );
|
||||
writer.Write( (string) BoardName );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -201,7 +195,7 @@ namespace Server.Items
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_BoardName = reader.ReadString();
|
||||
BoardName = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -315,19 +309,9 @@ namespace Server.Items
|
|||
|
||||
public class BulletinMessage : Item
|
||||
{
|
||||
private Mobile m_Poster;
|
||||
private string m_Subject;
|
||||
private DateTime m_Time, m_LastPostTime;
|
||||
private BulletinMessage m_Thread;
|
||||
private string m_PostedName;
|
||||
private int m_PostedBody;
|
||||
private int m_PostedHue;
|
||||
private BulletinEquip[] m_PostedEquip;
|
||||
private string[] m_Lines;
|
||||
|
||||
public string GetTimeAsString()
|
||||
{
|
||||
return m_Time.ToString( "MMM dd, yyyy" );
|
||||
return Time.ToString( "MMM dd, yyyy" );
|
||||
}
|
||||
|
||||
public override bool CheckTarget( Mobile from, Targeting.Target targ, object targeted )
|
||||
|
|
@ -344,15 +328,15 @@ namespace Server.Items
|
|||
{
|
||||
Movable = false;
|
||||
|
||||
m_Poster = poster;
|
||||
m_Subject = subject;
|
||||
m_Time = DateTime.UtcNow;
|
||||
m_LastPostTime = m_Time;
|
||||
m_Thread = thread;
|
||||
m_PostedName = m_Poster.Name;
|
||||
m_PostedBody = m_Poster.Body;
|
||||
m_PostedHue = m_Poster.Hue;
|
||||
m_Lines = lines;
|
||||
Poster = poster;
|
||||
Subject = subject;
|
||||
Time = DateTime.UtcNow;
|
||||
LastPostTime = Time;
|
||||
Thread = thread;
|
||||
PostedName = Poster.Name;
|
||||
PostedBody = Poster.Body;
|
||||
PostedHue = Poster.Hue;
|
||||
Lines = lines;
|
||||
|
||||
List<BulletinEquip> list = new List<BulletinEquip>();
|
||||
|
||||
|
|
@ -364,21 +348,28 @@ namespace Server.Items
|
|||
list.Add( new BulletinEquip( item.ItemID, item.Hue ) );
|
||||
}
|
||||
|
||||
m_PostedEquip = list.ToArray();
|
||||
PostedEquip = list.ToArray();
|
||||
}
|
||||
|
||||
public Mobile Poster => m_Poster;
|
||||
public BulletinMessage Thread => m_Thread;
|
||||
public string Subject => m_Subject;
|
||||
public DateTime Time => m_Time;
|
||||
public DateTime LastPostTime{ get => m_LastPostTime;
|
||||
set => m_LastPostTime = value;
|
||||
}
|
||||
public string PostedName => m_PostedName;
|
||||
public int PostedBody => m_PostedBody;
|
||||
public int PostedHue => m_PostedHue;
|
||||
public BulletinEquip[] PostedEquip => m_PostedEquip;
|
||||
public string[] Lines => m_Lines;
|
||||
public Mobile Poster { get; private set; }
|
||||
|
||||
public BulletinMessage Thread { get; private set; }
|
||||
|
||||
public string Subject { get; private set; }
|
||||
|
||||
public DateTime Time { get; private set; }
|
||||
|
||||
public DateTime LastPostTime { get; set; }
|
||||
|
||||
public string PostedName { get; private set; }
|
||||
|
||||
public int PostedBody { get; private set; }
|
||||
|
||||
public int PostedHue { get; private set; }
|
||||
|
||||
public BulletinEquip[] PostedEquip { get; private set; }
|
||||
|
||||
public string[] Lines { get; private set; }
|
||||
|
||||
public BulletinMessage( Serial serial ) : base( serial )
|
||||
{
|
||||
|
|
@ -390,28 +381,28 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Poster );
|
||||
writer.Write( (string) m_Subject );
|
||||
writer.Write( (DateTime) m_Time );
|
||||
writer.Write( (DateTime) m_LastPostTime );
|
||||
writer.Write( (bool) (m_Thread != null) );
|
||||
writer.Write( (Item) m_Thread );
|
||||
writer.Write( (string) m_PostedName );
|
||||
writer.Write( (int) m_PostedBody );
|
||||
writer.Write( (int) m_PostedHue );
|
||||
writer.Write( (Mobile) Poster );
|
||||
writer.Write( (string) Subject );
|
||||
writer.Write( (DateTime) Time );
|
||||
writer.Write( (DateTime) LastPostTime );
|
||||
writer.Write( (bool) (Thread != null) );
|
||||
writer.Write( (Item) Thread );
|
||||
writer.Write( (string) PostedName );
|
||||
writer.Write( (int) PostedBody );
|
||||
writer.Write( (int) PostedHue );
|
||||
|
||||
writer.Write( (int) m_PostedEquip.Length );
|
||||
writer.Write( (int) PostedEquip.Length );
|
||||
|
||||
for ( int i = 0; i < m_PostedEquip.Length; ++i )
|
||||
for ( int i = 0; i < PostedEquip.Length; ++i )
|
||||
{
|
||||
writer.Write( (int) m_PostedEquip[i].itemID );
|
||||
writer.Write( (int) m_PostedEquip[i].hue );
|
||||
writer.Write( (int) PostedEquip[i].itemID );
|
||||
writer.Write( (int) PostedEquip[i].hue );
|
||||
}
|
||||
|
||||
writer.Write( (int) m_Lines.Length );
|
||||
writer.Write( (int) Lines.Length );
|
||||
|
||||
for ( int i = 0; i < m_Lines.Length; ++i )
|
||||
writer.Write( (string) m_Lines[i] );
|
||||
for ( int i = 0; i < Lines.Length; ++i )
|
||||
writer.Write( (string) Lines[i] );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -425,30 +416,30 @@ namespace Server.Items
|
|||
case 1:
|
||||
case 0:
|
||||
{
|
||||
m_Poster = reader.ReadMobile();
|
||||
m_Subject = reader.ReadString();
|
||||
m_Time = reader.ReadDateTime();
|
||||
m_LastPostTime = reader.ReadDateTime();
|
||||
Poster = reader.ReadMobile();
|
||||
Subject = reader.ReadString();
|
||||
Time = reader.ReadDateTime();
|
||||
LastPostTime = reader.ReadDateTime();
|
||||
bool hasThread = reader.ReadBool();
|
||||
m_Thread = reader.ReadItem() as BulletinMessage;
|
||||
m_PostedName = reader.ReadString();
|
||||
m_PostedBody = reader.ReadInt();
|
||||
m_PostedHue = reader.ReadInt();
|
||||
Thread = reader.ReadItem() as BulletinMessage;
|
||||
PostedName = reader.ReadString();
|
||||
PostedBody = reader.ReadInt();
|
||||
PostedHue = reader.ReadInt();
|
||||
|
||||
m_PostedEquip = new BulletinEquip[reader.ReadInt()];
|
||||
PostedEquip = new BulletinEquip[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_PostedEquip.Length; ++i )
|
||||
for ( int i = 0; i < PostedEquip.Length; ++i )
|
||||
{
|
||||
m_PostedEquip[i].itemID = reader.ReadInt();
|
||||
m_PostedEquip[i].hue = reader.ReadInt();
|
||||
PostedEquip[i].itemID = reader.ReadInt();
|
||||
PostedEquip[i].hue = reader.ReadInt();
|
||||
}
|
||||
|
||||
m_Lines = new string[reader.ReadInt()];
|
||||
Lines = new string[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_Lines.Length; ++i )
|
||||
m_Lines[i] = reader.ReadString();
|
||||
for ( int i = 0; i < Lines.Length; ++i )
|
||||
Lines[i] = reader.ReadString();
|
||||
|
||||
if ( hasThread && m_Thread == null )
|
||||
if ( hasThread && Thread == null )
|
||||
Delete();
|
||||
|
||||
if ( version == 0 )
|
||||
|
|
|
|||
|
|
@ -29,16 +29,14 @@ namespace Server.Items
|
|||
return null;
|
||||
}
|
||||
|
||||
private Type m_Type;
|
||||
private int m_Amount;
|
||||
public Type Type { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public int Amount => m_Amount;
|
||||
public int Amount { get; }
|
||||
|
||||
private CrystalRechargeInfo( Type type, int amount )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Amount = amount;
|
||||
Type = type;
|
||||
Amount = amount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -49,7 +47,6 @@ namespace Server.Items
|
|||
public override int LabelNumber => 1060740; // communication crystal
|
||||
|
||||
private int m_Charges;
|
||||
private List<ReceiverCrystal> m_Receivers;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
|
|
@ -73,7 +70,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public List<ReceiverCrystal> Receivers => m_Receivers;
|
||||
public List<ReceiverCrystal> Receivers { get; private set; }
|
||||
|
||||
[Constructible]
|
||||
public BroadcastCrystal() : this( 2000 )
|
||||
|
|
@ -87,7 +84,7 @@ namespace Server.Items
|
|||
|
||||
m_Charges = charges;
|
||||
|
||||
m_Receivers = new List<ReceiverCrystal>();
|
||||
Receivers = new List<ReceiverCrystal>();
|
||||
}
|
||||
|
||||
public BroadcastCrystal( Serial serial ) : base( serial )
|
||||
|
|
@ -274,7 +271,7 @@ namespace Server.Items
|
|||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.WriteEncodedInt( m_Charges );
|
||||
writer.WriteItemList<ReceiverCrystal>( m_Receivers );
|
||||
writer.WriteItemList<ReceiverCrystal>( Receivers );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -284,7 +281,7 @@ namespace Server.Items
|
|||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Charges = reader.ReadEncodedInt();
|
||||
m_Receivers = reader.ReadStrongItemList<ReceiverCrystal>();
|
||||
Receivers = reader.ReadStrongItemList<ReceiverCrystal>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -65,27 +65,12 @@ namespace Server.Items
|
|||
|
||||
public class Corpse : Container, ICarvable
|
||||
{
|
||||
private Mobile m_Owner; // Whos corpse is this?
|
||||
private Mobile m_Killer; // Who killed the owner?
|
||||
private CorpseFlag m_Flags; // @see CorpseFlag
|
||||
|
||||
private List<Mobile> m_Looters; // Who's looted this corpse?
|
||||
private List<Item> m_EquipItems; // List of dropped equipment when the owner died. Ingame, these items display /on/ the corpse, not just inside
|
||||
private List<Item> m_RestoreEquip; // List of items equipped when the owner died. Includes insured and blessed items.
|
||||
private List<Mobile> m_Aggressors; // Anyone from this list will be able to loot this corpse; we attacked them, or they attacked us when we were freely attackable
|
||||
|
||||
private string m_CorpseName; // Value of the CorpseNameAttribute attached to the owner when he died -or- null if the owner had no CorpseNameAttribute; use "the remains of ~name~"
|
||||
private IDevourer m_Devourer; // The creature that devoured this corpse
|
||||
|
||||
// For notoriety:
|
||||
private AccessLevel m_AccessLevel; // Which AccessLevel the owner had when he died
|
||||
private Guild m_Guild; // Which Guild the owner was in when he died
|
||||
private int m_Kills; // How many kills the owner had when he died
|
||||
|
||||
private DateTime m_TimeOfDeath; // What time was this corpse created?
|
||||
|
||||
private HairInfo m_Hair; // This contains the hair of the owner
|
||||
private FacialHairInfo m_FacialHair; // This contains the facial hair of the owner
|
||||
|
||||
// For Forensics Evaluation
|
||||
public string m_Forensicist; // Name of the first PlayerMobile who used Forensic Evaluation on the corpse
|
||||
|
|
@ -102,7 +87,7 @@ namespace Server.Items
|
|||
if ( !Core.SE )
|
||||
return false;
|
||||
|
||||
return ( DateTime.UtcNow < (m_TimeOfDeath + InstancedCorpseTime) );
|
||||
return ( DateTime.UtcNow < (TimeOfDeath + InstancedCorpseTime) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -113,10 +98,7 @@ namespace Server.Items
|
|||
private Mobile m_Mobile;
|
||||
private Item m_Item;
|
||||
|
||||
private bool m_Perpetual; //Needed for Rummaged stuff. CONTRARY to the Patchlog, cause a later FoF contradicts it. Verify on OSI.
|
||||
public bool Perpetual { get => m_Perpetual;
|
||||
set => m_Perpetual = value;
|
||||
}
|
||||
public bool Perpetual { get; set; }
|
||||
|
||||
public InstancedItemInfo( Item i, Mobile m )
|
||||
{
|
||||
|
|
@ -159,7 +141,7 @@ namespace Server.Items
|
|||
|
||||
private void AssignInstancedLoot()
|
||||
{
|
||||
if ( m_Aggressors.Count == 0 || Items.Count == 0 )
|
||||
if ( Aggressors.Count == 0 || Items.Count == 0 )
|
||||
return;
|
||||
|
||||
if ( m_InstancedItems == null )
|
||||
|
|
@ -181,7 +163,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
List<Mobile> attackers = new List<Mobile>( m_Aggressors );
|
||||
List<Mobile> attackers = new List<Mobile>( Aggressors );
|
||||
|
||||
for ( int i = 1; i < attackers.Count -1; i++ ) //randomize
|
||||
{
|
||||
|
|
@ -254,16 +236,13 @@ namespace Server.Items
|
|||
public override bool IsDecoContainer => false;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime TimeOfDeath
|
||||
{
|
||||
get => m_TimeOfDeath;
|
||||
set => m_TimeOfDeath = value;
|
||||
}
|
||||
public DateTime TimeOfDeath { get; set; }
|
||||
|
||||
public override bool DisplayWeight => false;
|
||||
|
||||
public HairInfo Hair => m_Hair;
|
||||
public FacialHairInfo FacialHair => m_FacialHair;
|
||||
public HairInfo Hair { get; }
|
||||
|
||||
public FacialHairInfo FacialHair { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsBones => GetFlag( CorpseFlag.IsBones );
|
||||
|
|
@ -307,31 +286,23 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public AccessLevel AccessLevel => m_AccessLevel;
|
||||
public AccessLevel AccessLevel { get; private set; }
|
||||
|
||||
public List<Mobile> Aggressors => m_Aggressors;
|
||||
public List<Mobile> Aggressors { get; private set; }
|
||||
|
||||
public List<Mobile> Looters => m_Looters;
|
||||
public List<Mobile> Looters { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Killer => m_Killer;
|
||||
public Mobile Killer { get; private set; }
|
||||
|
||||
public List<Item> EquipItems => m_EquipItems;
|
||||
public List<Item> EquipItems { get; private set; }
|
||||
|
||||
public List<Item> RestoreEquip
|
||||
{
|
||||
get => m_RestoreEquip;
|
||||
set => m_RestoreEquip = value;
|
||||
}
|
||||
public List<Item> RestoreEquip { get; set; }
|
||||
|
||||
public Guild Guild => m_Guild;
|
||||
public Guild Guild { get; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Kills
|
||||
{
|
||||
get => m_Kills;
|
||||
set => m_Kills = value;
|
||||
}
|
||||
public int Kills { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Criminal
|
||||
|
|
@ -341,7 +312,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner => m_Owner;
|
||||
public Mobile Owner { get; private set; }
|
||||
|
||||
public void TurnToBones()
|
||||
{
|
||||
|
|
@ -488,27 +459,27 @@ namespace Server.Items
|
|||
Direction = owner.Direction;
|
||||
Name = owner.Name;
|
||||
|
||||
m_Owner = owner;
|
||||
Owner = owner;
|
||||
|
||||
m_CorpseName = GetCorpseName( owner );
|
||||
|
||||
m_TimeOfDeath = DateTime.UtcNow;
|
||||
TimeOfDeath = DateTime.UtcNow;
|
||||
|
||||
m_AccessLevel = owner.AccessLevel;
|
||||
m_Guild = owner.Guild as Guild;
|
||||
m_Kills = owner.Kills;
|
||||
AccessLevel = owner.AccessLevel;
|
||||
Guild = owner.Guild as Guild;
|
||||
Kills = owner.Kills;
|
||||
SetFlag( CorpseFlag.Criminal, owner.Criminal );
|
||||
|
||||
m_Hair = hair;
|
||||
m_FacialHair = facialhair;
|
||||
Hair = hair;
|
||||
FacialHair = facialhair;
|
||||
|
||||
// This corpse does not turn to bones if: the owner is not a player
|
||||
SetFlag( CorpseFlag.NoBones, !owner.Player );
|
||||
|
||||
m_Looters = new List<Mobile>();
|
||||
m_EquipItems = equipItems;
|
||||
Looters = new List<Mobile>();
|
||||
EquipItems = equipItems;
|
||||
|
||||
m_Aggressors = new List<Mobile>( owner.Aggressors.Count + owner.Aggressed.Count );
|
||||
Aggressors = new List<Mobile>( owner.Aggressors.Count + owner.Aggressed.Count );
|
||||
//bool addToAggressors = !( owner is BaseCreature );
|
||||
|
||||
bool isBaseCreature = (owner is BaseCreature);
|
||||
|
|
@ -521,12 +492,12 @@ namespace Server.Items
|
|||
|
||||
if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime )
|
||||
{
|
||||
m_Killer = info.Attacker;
|
||||
Killer = info.Attacker;
|
||||
lastTime = (DateTime.UtcNow - info.LastCombatTime);
|
||||
}
|
||||
|
||||
if ( !isBaseCreature && !info.CriminalAggression )
|
||||
m_Aggressors.Add( info.Attacker );
|
||||
Aggressors.Add( info.Attacker );
|
||||
}
|
||||
|
||||
for ( int i = 0; i < owner.Aggressed.Count; ++i )
|
||||
|
|
@ -535,12 +506,12 @@ namespace Server.Items
|
|||
|
||||
if ( (DateTime.UtcNow - info.LastCombatTime) < lastTime )
|
||||
{
|
||||
m_Killer = info.Defender;
|
||||
Killer = info.Defender;
|
||||
lastTime = (DateTime.UtcNow - info.LastCombatTime);
|
||||
}
|
||||
|
||||
if ( !isBaseCreature )
|
||||
m_Aggressors.Add( info.Defender );
|
||||
Aggressors.Add( info.Defender );
|
||||
}
|
||||
|
||||
if ( isBaseCreature )
|
||||
|
|
@ -549,7 +520,7 @@ namespace Server.Items
|
|||
|
||||
Mobile master = bc.GetMaster();
|
||||
if ( master != null )
|
||||
m_Aggressors.Add( master );
|
||||
Aggressors.Add( master );
|
||||
|
||||
List<DamageStore> rights = BaseCreature.GetLootingRights( bc.DamageEntries, bc.HitsMax );
|
||||
for ( int i = 0; i < rights.Count; ++i )
|
||||
|
|
@ -557,7 +528,7 @@ namespace Server.Items
|
|||
DamageStore ds = rights[i];
|
||||
|
||||
if ( ds.m_HasRight )
|
||||
m_Aggressors.Add( ds.m_Mobile );
|
||||
Aggressors.Add( ds.m_Mobile );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -586,19 +557,19 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 12 ); // version
|
||||
|
||||
if ( m_RestoreEquip == null )
|
||||
if ( RestoreEquip == null )
|
||||
{
|
||||
writer.Write( false );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write( true );
|
||||
writer.Write( m_RestoreEquip );
|
||||
writer.Write( RestoreEquip );
|
||||
}
|
||||
|
||||
writer.Write( (int)m_Flags );
|
||||
|
||||
writer.WriteDeltaTime( m_TimeOfDeath );
|
||||
writer.WriteDeltaTime( TimeOfDeath );
|
||||
|
||||
List<KeyValuePair<Item, Point3D>> list = ( m_RestoreTable == null ? null : new List<KeyValuePair<Item, Point3D>>( m_RestoreTable ) );
|
||||
int count = list?.Count ?? 0;
|
||||
|
|
@ -629,20 +600,20 @@ namespace Server.Items
|
|||
if ( m_DecayTimer != null )
|
||||
writer.WriteDeltaTime( m_DecayTime );
|
||||
|
||||
writer.Write( m_Looters );
|
||||
writer.Write( m_Killer );
|
||||
writer.Write( Looters );
|
||||
writer.Write( Killer );
|
||||
|
||||
writer.Write( m_Aggressors );
|
||||
writer.Write( Aggressors );
|
||||
|
||||
writer.Write( m_Owner );
|
||||
writer.Write( Owner );
|
||||
|
||||
writer.Write( (string) m_CorpseName );
|
||||
|
||||
writer.Write( (int) m_AccessLevel );
|
||||
writer.Write( (Guild) m_Guild );
|
||||
writer.Write( (int) m_Kills );
|
||||
writer.Write( (int) AccessLevel );
|
||||
writer.Write( (Guild) Guild );
|
||||
writer.Write( (int) Kills );
|
||||
|
||||
writer.Write( m_EquipItems );
|
||||
writer.Write( EquipItems );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -656,7 +627,7 @@ namespace Server.Items
|
|||
case 12:
|
||||
{
|
||||
if ( reader.ReadBool() )
|
||||
m_RestoreEquip = reader.ReadStrongItemList();
|
||||
RestoreEquip = reader.ReadStrongItemList();
|
||||
|
||||
goto case 11;
|
||||
}
|
||||
|
|
@ -665,7 +636,7 @@ namespace Server.Items
|
|||
// Version 11, we move all bools to a CorpseFlag
|
||||
m_Flags = (CorpseFlag)reader.ReadInt();
|
||||
|
||||
m_TimeOfDeath = reader.ReadDeltaTime();
|
||||
TimeOfDeath = reader.ReadDeltaTime();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
||||
|
|
@ -682,24 +653,24 @@ namespace Server.Items
|
|||
if ( reader.ReadBool() )
|
||||
BeginDecay( reader.ReadDeltaTime() - DateTime.UtcNow );
|
||||
|
||||
m_Looters = reader.ReadStrongMobileList();
|
||||
m_Killer = reader.ReadMobile();
|
||||
Looters = reader.ReadStrongMobileList();
|
||||
Killer = reader.ReadMobile();
|
||||
|
||||
m_Aggressors = reader.ReadStrongMobileList();
|
||||
m_Owner = reader.ReadMobile();
|
||||
Aggressors = reader.ReadStrongMobileList();
|
||||
Owner = reader.ReadMobile();
|
||||
|
||||
m_CorpseName = reader.ReadString();
|
||||
|
||||
m_AccessLevel = (AccessLevel)reader.ReadInt();
|
||||
AccessLevel = (AccessLevel)reader.ReadInt();
|
||||
reader.ReadInt(); // guild reserve
|
||||
m_Kills = reader.ReadInt();
|
||||
Kills = reader.ReadInt();
|
||||
|
||||
m_EquipItems = reader.ReadStrongItemList();
|
||||
EquipItems = reader.ReadStrongItemList();
|
||||
break;
|
||||
}
|
||||
case 10:
|
||||
{
|
||||
m_TimeOfDeath = reader.ReadDeltaTime();
|
||||
TimeOfDeath = reader.ReadDeltaTime();
|
||||
|
||||
goto case 9;
|
||||
}
|
||||
|
|
@ -734,8 +705,8 @@ namespace Server.Items
|
|||
}
|
||||
case 6:
|
||||
{
|
||||
m_Looters = reader.ReadStrongMobileList();
|
||||
m_Killer = reader.ReadMobile();
|
||||
Looters = reader.ReadStrongMobileList();
|
||||
Killer = reader.ReadMobile();
|
||||
|
||||
goto case 5;
|
||||
}
|
||||
|
|
@ -747,13 +718,13 @@ namespace Server.Items
|
|||
}
|
||||
case 4:
|
||||
{
|
||||
m_Aggressors = reader.ReadStrongMobileList();
|
||||
Aggressors = reader.ReadStrongMobileList();
|
||||
|
||||
goto case 3;
|
||||
}
|
||||
case 3:
|
||||
{
|
||||
m_Owner = reader.ReadMobile();
|
||||
Owner = reader.ReadMobile();
|
||||
|
||||
goto case 2;
|
||||
}
|
||||
|
|
@ -772,23 +743,23 @@ namespace Server.Items
|
|||
case 0:
|
||||
{
|
||||
if ( version < 10 )
|
||||
m_TimeOfDeath = DateTime.UtcNow;
|
||||
TimeOfDeath = DateTime.UtcNow;
|
||||
|
||||
if ( version < 7 )
|
||||
BeginDecay( m_DefaultDecayTime );
|
||||
|
||||
if ( version < 6 )
|
||||
m_Looters = new List<Mobile>();
|
||||
Looters = new List<Mobile>();
|
||||
|
||||
if ( version < 4 )
|
||||
m_Aggressors = new List<Mobile>();
|
||||
Aggressors = new List<Mobile>();
|
||||
|
||||
m_AccessLevel = (AccessLevel)reader.ReadInt();
|
||||
AccessLevel = (AccessLevel)reader.ReadInt();
|
||||
reader.ReadInt(); // guild reserve
|
||||
m_Kills = reader.ReadInt();
|
||||
Kills = reader.ReadInt();
|
||||
SetFlag( CorpseFlag.Criminal, reader.ReadBool() );
|
||||
|
||||
m_EquipItems = reader.ReadStrongItemList();
|
||||
EquipItems = reader.ReadStrongItemList();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -797,10 +768,10 @@ namespace Server.Items
|
|||
|
||||
public bool DevourCorpse()
|
||||
{
|
||||
if ( Devoured || Deleted || m_Killer == null || m_Killer.Deleted || !m_Killer.Alive || !(m_Killer is IDevourer) || m_Owner == null || m_Owner.Deleted )
|
||||
if ( Devoured || Deleted || Killer == null || Killer.Deleted || !Killer.Alive || !(Killer is IDevourer) || Owner == null || Owner.Deleted )
|
||||
return false;
|
||||
|
||||
m_Devourer = (IDevourer)m_Killer; // Set the devourer the killer
|
||||
m_Devourer = (IDevourer)Killer; // Set the devourer the killer
|
||||
return m_Devourer.Devour( this ); // Devour the corpse if it hasn't
|
||||
}
|
||||
|
||||
|
|
@ -825,14 +796,14 @@ namespace Server.Items
|
|||
|
||||
public bool IsCriminalAction( Mobile from )
|
||||
{
|
||||
if ( from == m_Owner || from.AccessLevel >= AccessLevel.GameMaster )
|
||||
if ( from == Owner || from.AccessLevel >= AccessLevel.GameMaster )
|
||||
return false;
|
||||
|
||||
Party p = Party.Get( m_Owner );
|
||||
Party p = Party.Get( Owner );
|
||||
|
||||
if ( p != null && p.Contains( from ) )
|
||||
{
|
||||
PartyMemberInfo pmi = p[m_Owner];
|
||||
PartyMemberInfo pmi = p[Owner];
|
||||
|
||||
if ( pmi != null && pmi.CanLoot )
|
||||
return false;
|
||||
|
|
@ -870,8 +841,8 @@ namespace Server.Items
|
|||
if ( item != this && IsCriminalAction( from ) )
|
||||
from.CriminalAction( true );
|
||||
|
||||
if ( !m_Looters.Contains( from ) )
|
||||
m_Looters.Add( from );
|
||||
if ( !Looters.Contains( from ) )
|
||||
Looters.Add( from );
|
||||
|
||||
if ( m_InstancedItems != null && m_InstancedItems.ContainsKey( item ) )
|
||||
m_InstancedItems.Remove( item );
|
||||
|
|
@ -881,14 +852,14 @@ namespace Server.Items
|
|||
{
|
||||
base.OnItemLifted( from, item );
|
||||
|
||||
if ( item != this && from != m_Owner )
|
||||
if ( item != this && from != Owner )
|
||||
from.RevealingAction();
|
||||
|
||||
if ( item != this && IsCriminalAction( from ) )
|
||||
from.CriminalAction( true );
|
||||
|
||||
if ( !m_Looters.Contains( from ) )
|
||||
m_Looters.Add( from );
|
||||
if ( !Looters.Contains( from ) )
|
||||
Looters.Add( from );
|
||||
|
||||
if ( m_InstancedItems != null && m_InstancedItems.ContainsKey( item ) )
|
||||
m_InstancedItems.Remove( item );
|
||||
|
|
@ -911,7 +882,7 @@ namespace Server.Items
|
|||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
|
||||
if ( Core.AOS && m_Owner == from && from.Alive )
|
||||
if ( Core.AOS && Owner == from && from.Alive )
|
||||
list.Add( new OpenCorpseEntry() );
|
||||
}
|
||||
|
||||
|
|
@ -964,7 +935,7 @@ namespace Server.Items
|
|||
{
|
||||
if ( !CanLoot( from, item ) )
|
||||
{
|
||||
if ( m_Owner == null || !m_Owner.Player )
|
||||
if ( Owner == null || !Owner.Player )
|
||||
from.SendLocalizedMessage( 1005035 ); // You did not earn the right to loot this creature!
|
||||
else
|
||||
from.SendLocalizedMessage( 1010049 ); // You may not loot this corpse.
|
||||
|
|
@ -974,7 +945,7 @@ namespace Server.Items
|
|||
|
||||
if ( IsCriminalAction( from ) )
|
||||
{
|
||||
if ( m_Owner == null || !m_Owner.Player )
|
||||
if ( Owner == null || !Owner.Player )
|
||||
from.SendLocalizedMessage( 1005036 ); // Looting this monster corpse will be a criminal act!
|
||||
else
|
||||
from.SendLocalizedMessage( 1005038 ); // Looting this corpse will be a criminal act!
|
||||
|
|
@ -988,7 +959,7 @@ namespace Server.Items
|
|||
if ( from.AccessLevel > AccessLevel.Player || from.InRange( GetWorldLocation(), 2 ) )
|
||||
{
|
||||
#region Self Looting
|
||||
if ( checkSelfLoot && from == m_Owner && !GetFlag( CorpseFlag.SelfLooted ) && Items.Count != 0 )
|
||||
if ( checkSelfLoot && from == Owner && !GetFlag( CorpseFlag.SelfLooted ) && Items.Count != 0 )
|
||||
{
|
||||
if ( from.FindItemOnLayer( Layer.OuterTorso ) is DeathRobe robe )
|
||||
{
|
||||
|
|
@ -1003,7 +974,7 @@ namespace Server.Items
|
|||
|
||||
Container pack = from.Backpack;
|
||||
|
||||
if ( m_RestoreEquip != null && pack != null )
|
||||
if ( RestoreEquip != null && pack != null )
|
||||
{
|
||||
List<Item> packItems = new List<Item>( pack.Items ); // Only items in the top-level pack are re-equipped
|
||||
|
||||
|
|
@ -1011,7 +982,7 @@ namespace Server.Items
|
|||
{
|
||||
Item packItem = packItems[i];
|
||||
|
||||
if ( m_RestoreEquip.Contains( packItem ) && packItem.Movable )
|
||||
if ( RestoreEquip.Contains( packItem ) && packItem.Movable )
|
||||
from.EquipItem( packItem );
|
||||
}
|
||||
}
|
||||
|
|
@ -1033,7 +1004,7 @@ namespace Server.Items
|
|||
item.Location = loc;
|
||||
pack.AddItem( item );
|
||||
|
||||
if ( m_RestoreEquip != null && m_RestoreEquip.Contains( item ) )
|
||||
if ( RestoreEquip != null && RestoreEquip.Contains( item ) )
|
||||
from.EquipItem( item );
|
||||
}
|
||||
else
|
||||
|
|
@ -1189,7 +1160,7 @@ namespace Server.Items
|
|||
{
|
||||
if ( IsCriminalAction( from ) && Map != null && (Map.Rules & MapRules.HarmfulRestrictions) != 0 )
|
||||
{
|
||||
if ( m_Owner == null || !m_Owner.Player )
|
||||
if ( Owner == null || !Owner.Player )
|
||||
from.SendLocalizedMessage( 1005035 ); // You did not earn the right to loot this creature!
|
||||
else
|
||||
from.SendLocalizedMessage( 1010049 ); // You may not loot this corpse.
|
||||
|
|
@ -1197,7 +1168,7 @@ namespace Server.Items
|
|||
return;
|
||||
}
|
||||
|
||||
Mobile dead = m_Owner;
|
||||
Mobile dead = Owner;
|
||||
|
||||
if ( GetFlag( CorpseFlag.Carved ) || dead == null )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,13 +5,11 @@ namespace Server
|
|||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class CorpseNameAttribute : Attribute
|
||||
{
|
||||
private string m_Name;
|
||||
|
||||
public string Name => m_Name;
|
||||
public string Name { get; }
|
||||
|
||||
public CorpseNameAttribute( string name )
|
||||
{
|
||||
m_Name = name;
|
||||
Name = name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,84 +6,76 @@ namespace Server.Items
|
|||
{
|
||||
public class DeceitBrazier : Item
|
||||
{
|
||||
private static Type[] m_Creatures = {
|
||||
#region Animals
|
||||
typeof( FireSteed ), //Set the tents up people!
|
||||
#endregion
|
||||
public static Type[] Creatures { get; } =
|
||||
{
|
||||
#region Animals
|
||||
typeof( FireSteed ), //Set the tents up people!
|
||||
#endregion
|
||||
|
||||
#region Undead
|
||||
typeof( Skeleton ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( Mummy ),
|
||||
typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ), typeof( BoneMagi ),
|
||||
typeof( Wraith ), typeof( Shade ), typeof( Spectre ), typeof( Zombie ),
|
||||
typeof( RottingCorpse ), typeof( Ghoul ),
|
||||
#endregion
|
||||
#region Undead
|
||||
typeof( Skeleton ), typeof( SkeletalKnight ), typeof( SkeletalMage ), typeof( Mummy ),
|
||||
typeof( BoneKnight ), typeof( Lich ), typeof( LichLord ), typeof( BoneMagi ),
|
||||
typeof( Wraith ), typeof( Shade ), typeof( Spectre ), typeof( Zombie ),
|
||||
typeof( RottingCorpse ), typeof( Ghoul ),
|
||||
#endregion
|
||||
|
||||
#region Demons
|
||||
typeof( Balron ), typeof( Daemon ), typeof( Imp ), typeof( GreaterMongbat ),
|
||||
typeof( Mongbat ), typeof( IceFiend ), typeof( Gargoyle ), typeof( StoneGargoyle ),
|
||||
typeof( FireGargoyle ), typeof( HordeMinion ),
|
||||
#endregion
|
||||
#region Demons
|
||||
typeof( Balron ), typeof( Daemon ), typeof( Imp ), typeof( GreaterMongbat ),
|
||||
typeof( Mongbat ), typeof( IceFiend ), typeof( Gargoyle ), typeof( StoneGargoyle ),
|
||||
typeof( FireGargoyle ), typeof( HordeMinion ),
|
||||
#endregion
|
||||
|
||||
#region Gazers
|
||||
typeof( Gazer ), typeof( ElderGazer ), typeof( GazerLarva ),
|
||||
#endregion
|
||||
#region Gazers
|
||||
typeof( Gazer ), typeof( ElderGazer ), typeof( GazerLarva ),
|
||||
#endregion
|
||||
|
||||
#region Uncategorized
|
||||
typeof( Harpy ), typeof( StoneHarpy ), typeof( HeadlessOne ), typeof( HellHound ),
|
||||
typeof( HellCat ), typeof( Phoenix ), typeof( LavaLizard ), typeof( SandVortex ),
|
||||
typeof( ShadowWisp ), typeof( SwampTentacle ), typeof( PredatorHellCat ), typeof( Wisp ),
|
||||
#endregion
|
||||
#region Uncategorized
|
||||
typeof( Harpy ), typeof( StoneHarpy ), typeof( HeadlessOne ), typeof( HellHound ),
|
||||
typeof( HellCat ), typeof( Phoenix ), typeof( LavaLizard ), typeof( SandVortex ),
|
||||
typeof( ShadowWisp ), typeof( SwampTentacle ), typeof( PredatorHellCat ), typeof( Wisp ),
|
||||
#endregion
|
||||
|
||||
#region Arachnid
|
||||
typeof( GiantSpider ), typeof( DreadSpider ), typeof( FrostSpider ), typeof( Scorpion ),
|
||||
#endregion
|
||||
#region Arachnid
|
||||
typeof( GiantSpider ), typeof( DreadSpider ), typeof( FrostSpider ), typeof( Scorpion ),
|
||||
#endregion
|
||||
|
||||
#region Repond
|
||||
typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ),
|
||||
typeof( FrostTroll ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ),
|
||||
typeof( OrcishLord ), typeof( OrcishMage ), typeof( OrcBrute ), typeof( Ratman ),
|
||||
typeof( RatmanMage ), typeof( OrcCaptain ), typeof( Troll ), typeof( Titan ),
|
||||
typeof( EvilMageLord ), typeof( OrcBomber ), typeof( RatmanArcher ),
|
||||
#endregion
|
||||
#region Repond
|
||||
typeof( ArcticOgreLord ), typeof( Cyclops ), typeof( Ettin ), typeof( EvilMage ),
|
||||
typeof( FrostTroll ), typeof( Ogre ), typeof( OgreLord ), typeof( Orc ),
|
||||
typeof( OrcishLord ), typeof( OrcishMage ), typeof( OrcBrute ), typeof( Ratman ),
|
||||
typeof( RatmanMage ), typeof( OrcCaptain ), typeof( Troll ), typeof( Titan ),
|
||||
typeof( EvilMageLord ), typeof( OrcBomber ), typeof( RatmanArcher ),
|
||||
#endregion
|
||||
|
||||
#region Reptilian
|
||||
typeof( Dragon ), typeof( Drake ), typeof( Snake ), typeof( GreaterDragon ),
|
||||
typeof( IceSerpent ), typeof( GiantSerpent ), typeof( IceSnake ), typeof( LavaSerpent ),
|
||||
typeof( Lizardman ), typeof( Wyvern ), typeof( WhiteWyrm ),
|
||||
typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( LavaSnake ),
|
||||
#endregion
|
||||
#region Reptilian
|
||||
typeof( Dragon ), typeof( Drake ), typeof( Snake ), typeof( GreaterDragon ),
|
||||
typeof( IceSerpent ), typeof( GiantSerpent ), typeof( IceSnake ), typeof( LavaSerpent ),
|
||||
typeof( Lizardman ), typeof( Wyvern ), typeof( WhiteWyrm ),
|
||||
typeof( ShadowWyrm ), typeof( SilverSerpent ), typeof( LavaSnake ),
|
||||
#endregion
|
||||
|
||||
#region Elementals
|
||||
typeof( EarthElemental ), typeof( PoisonElemental ), typeof( FireElemental ), typeof( SnowElemental ),
|
||||
typeof( IceElemental ), typeof( AcidElemental ), typeof( WaterElemental ), typeof( Efreet ),
|
||||
typeof( AirElemental ), typeof( Golem ),
|
||||
#endregion
|
||||
#region Elementals
|
||||
typeof( EarthElemental ), typeof( PoisonElemental ), typeof( FireElemental ), typeof( SnowElemental ),
|
||||
typeof( IceElemental ), typeof( AcidElemental ), typeof( WaterElemental ), typeof( Efreet ),
|
||||
typeof( AirElemental ), typeof( Golem ),
|
||||
#endregion
|
||||
|
||||
#region Random Critters
|
||||
typeof( SewerRat ), typeof( GiantRat ), typeof( DireWolf ), typeof( TimberWolf ),
|
||||
typeof( Cougar ), typeof( Alligator )
|
||||
#endregion
|
||||
};
|
||||
|
||||
public static Type[] Creatures => m_Creatures;
|
||||
#region Random Critters
|
||||
typeof( SewerRat ), typeof( GiantRat ), typeof( DireWolf ), typeof( TimberWolf ),
|
||||
typeof( Cougar ), typeof( Alligator )
|
||||
#endregion
|
||||
};
|
||||
|
||||
private Timer m_Timer;
|
||||
private DateTime m_NextSpawn;
|
||||
private int m_SpawnRange;
|
||||
private TimeSpan m_NextSpawnDelay;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime NextSpawn => m_NextSpawn;
|
||||
public DateTime NextSpawn { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int SpawnRange { get => m_SpawnRange;
|
||||
set => m_SpawnRange = value;
|
||||
}
|
||||
public int SpawnRange { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan NextSpawnDelay { get => m_NextSpawnDelay;
|
||||
set => m_NextSpawnDelay = value;
|
||||
}
|
||||
public TimeSpan NextSpawnDelay { get; set; }
|
||||
|
||||
public override int LabelNumber => 1023633; // Brazier
|
||||
|
||||
|
|
@ -92,9 +84,9 @@ namespace Server.Items
|
|||
{
|
||||
Movable = false;
|
||||
Light = LightType.Circle225;
|
||||
m_NextSpawn = DateTime.UtcNow;
|
||||
m_NextSpawnDelay = TimeSpan.FromMinutes( 15.0 );
|
||||
m_SpawnRange = 5;
|
||||
NextSpawn = DateTime.UtcNow;
|
||||
NextSpawnDelay = TimeSpan.FromMinutes( 15.0 );
|
||||
SpawnRange = 5;
|
||||
}
|
||||
|
||||
public DeceitBrazier( Serial serial ) : base( serial )
|
||||
|
|
@ -107,8 +99,8 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int)0 ); // version
|
||||
|
||||
writer.Write( (int)m_SpawnRange );
|
||||
writer.Write( m_NextSpawnDelay );
|
||||
writer.Write( (int)SpawnRange );
|
||||
writer.Write( NextSpawnDelay );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -119,11 +111,11 @@ namespace Server.Items
|
|||
|
||||
if ( version >= 0 )
|
||||
{
|
||||
m_SpawnRange = reader.ReadInt();
|
||||
m_NextSpawnDelay = reader.ReadTimeSpan();
|
||||
SpawnRange = reader.ReadInt();
|
||||
NextSpawnDelay = reader.ReadTimeSpan();
|
||||
}
|
||||
|
||||
m_NextSpawn = DateTime.UtcNow;
|
||||
NextSpawn = DateTime.UtcNow;
|
||||
}
|
||||
|
||||
public virtual void HeedWarning()
|
||||
|
|
@ -135,7 +127,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m_NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below
|
||||
if ( NextSpawn < DateTime.UtcNow ) // means we haven't spawned anything if the next spawn is below
|
||||
{
|
||||
if ( Utility.InRange( m.Location, Location, 1 ) && !Utility.InRange( oldLocation, Location, 1 ) && m.Player && !(m.AccessLevel > AccessLevel.Player || m.Hidden) )
|
||||
{
|
||||
|
|
@ -157,8 +149,8 @@ namespace Server.Items
|
|||
// Try 10 times to find a Spawnable location.
|
||||
for( int i = 0; i < 10; i++ )
|
||||
{
|
||||
int x = Location.X + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
|
||||
int y = Location.Y + (Utility.Random( (m_SpawnRange * 2) + 1 ) - m_SpawnRange);
|
||||
int x = Location.X + (Utility.Random( (SpawnRange * 2) + 1 ) - SpawnRange);
|
||||
int y = Location.Y + (Utility.Random( (SpawnRange * 2) + 1 ) - SpawnRange);
|
||||
int z = Map.GetAverageZ( x, y );
|
||||
|
||||
if ( Map.CanSpawnMobile( new Point2D( x, y ), Z ) )
|
||||
|
|
@ -182,10 +174,10 @@ namespace Server.Items
|
|||
{
|
||||
try
|
||||
{
|
||||
if ( m_NextSpawn < DateTime.UtcNow )
|
||||
if ( NextSpawn < DateTime.UtcNow )
|
||||
{
|
||||
Map map = Map;
|
||||
BaseCreature bc = (BaseCreature)Activator.CreateInstance( m_Creatures[Utility.Random( m_Creatures.Length )] );
|
||||
BaseCreature bc = (BaseCreature)Activator.CreateInstance( Creatures[Utility.Random( Creatures.Length )] );
|
||||
|
||||
if ( bc != null )
|
||||
{
|
||||
|
|
@ -196,7 +188,7 @@ namespace Server.Items
|
|||
Timer.DelayCall( TimeSpan.FromSeconds( 1 ), delegate
|
||||
{
|
||||
bc.Home = Location;
|
||||
bc.RangeHome = m_SpawnRange;
|
||||
bc.RangeHome = SpawnRange;
|
||||
bc.FightMode = FightMode.Closest;
|
||||
|
||||
bc.MoveToWorld( spawnLoc, map );
|
||||
|
|
@ -206,7 +198,7 @@ namespace Server.Items
|
|||
bc.ForceReacquire();
|
||||
} );
|
||||
|
||||
m_NextSpawn = DateTime.UtcNow + m_NextSpawnDelay;
|
||||
NextSpawn = DateTime.UtcNow + NextSpawnDelay;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -21,69 +21,26 @@ namespace Server.Items
|
|||
|
||||
public class EffectController : Item
|
||||
{
|
||||
private TimeSpan m_EffectDelay;
|
||||
|
||||
private ECEffectType m_EffectType;
|
||||
private EffectTriggerType m_TriggerType;
|
||||
|
||||
private IEntity m_Source;
|
||||
private IEntity m_Target;
|
||||
|
||||
private TimeSpan m_TriggerDelay;
|
||||
private EffectController m_Trigger;
|
||||
|
||||
private int m_ItemID;
|
||||
private int m_Hue;
|
||||
private int m_RenderMode;
|
||||
|
||||
private int m_Speed;
|
||||
private int m_Duration;
|
||||
|
||||
private bool m_FixedDirection;
|
||||
private bool m_Explodes;
|
||||
|
||||
private int m_ParticleEffect;
|
||||
private int m_ExplodeParticleEffect;
|
||||
private int m_ExplodeSound;
|
||||
|
||||
private EffectLayer m_EffectLayer;
|
||||
private int m_Unknown;
|
||||
|
||||
private TimeSpan m_SoundDelay;
|
||||
private int m_SoundID;
|
||||
private bool m_PlaySoundAtTrigger;
|
||||
|
||||
private int m_TriggerRange;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ECEffectType EffectType { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public ECEffectType EffectType{ get => m_EffectType;
|
||||
set => m_EffectType = value;
|
||||
}
|
||||
public EffectTriggerType TriggerType { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public EffectTriggerType TriggerType{ get => m_TriggerType;
|
||||
set => m_TriggerType = value;
|
||||
}
|
||||
public EffectLayer EffectLayer { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public EffectLayer EffectLayer{ get => m_EffectLayer;
|
||||
set => m_EffectLayer = value;
|
||||
}
|
||||
public TimeSpan EffectDelay { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan EffectDelay{ get => m_EffectDelay;
|
||||
set => m_EffectDelay = value;
|
||||
}
|
||||
public TimeSpan TriggerDelay { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan TriggerDelay{ get => m_TriggerDelay;
|
||||
set => m_TriggerDelay = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan SoundDelay{ get => m_SoundDelay;
|
||||
set => m_SoundDelay = value;
|
||||
}
|
||||
public TimeSpan SoundDelay { get; set; }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
|
|
@ -117,81 +74,51 @@ namespace Server.Items
|
|||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public EffectController Sequence{ get => m_Trigger;
|
||||
set => m_Trigger = value;
|
||||
}
|
||||
public EffectController Sequence { get; set; }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
private bool FixedDirection{ get => m_FixedDirection;
|
||||
set => m_FixedDirection = value;
|
||||
}
|
||||
private bool FixedDirection { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
private bool Explodes{ get => m_Explodes;
|
||||
set => m_Explodes = value;
|
||||
}
|
||||
private bool Explodes { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
private bool PlaySoundAtTrigger{ get => m_PlaySoundAtTrigger;
|
||||
set => m_PlaySoundAtTrigger = value;
|
||||
}
|
||||
private bool PlaySoundAtTrigger { get; set; }
|
||||
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int EffectItemID{ get => m_ItemID;
|
||||
set => m_ItemID = value;
|
||||
}
|
||||
public int EffectItemID { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int EffectHue{ get => m_Hue;
|
||||
set => m_Hue = value;
|
||||
}
|
||||
public int EffectHue { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int RenderMode{ get => m_RenderMode;
|
||||
set => m_RenderMode = value;
|
||||
}
|
||||
public int RenderMode { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Speed{ get => m_Speed;
|
||||
set => m_Speed = value;
|
||||
}
|
||||
public int Speed { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Duration{ get => m_Duration;
|
||||
set => m_Duration = value;
|
||||
}
|
||||
public int Duration { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ParticleEffect{ get => m_ParticleEffect;
|
||||
set => m_ParticleEffect = value;
|
||||
}
|
||||
public int ParticleEffect { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ExplodeParticleEffect{ get => m_ExplodeParticleEffect;
|
||||
set => m_ExplodeParticleEffect = value;
|
||||
}
|
||||
public int ExplodeParticleEffect { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ExplodeSound{ get => m_ExplodeSound;
|
||||
set => m_ExplodeSound = value;
|
||||
}
|
||||
public int ExplodeSound { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Unknown{ get => m_Unknown;
|
||||
set => m_Unknown = value;
|
||||
}
|
||||
public int Unknown { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int SoundID{ get => m_SoundID;
|
||||
set => m_SoundID = value;
|
||||
}
|
||||
public int SoundID { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int TriggerRange{ get => m_TriggerRange;
|
||||
set => m_TriggerRange = value;
|
||||
}
|
||||
public int TriggerRange { get; set; }
|
||||
|
||||
public override string DefaultName => "Effect Controller";
|
||||
|
||||
|
|
@ -200,21 +127,21 @@ namespace Server.Items
|
|||
{
|
||||
Movable = false;
|
||||
Visible = false;
|
||||
m_TriggerType = EffectTriggerType.Sequenced;
|
||||
m_EffectLayer = (EffectLayer)255;
|
||||
TriggerType = EffectTriggerType.Sequenced;
|
||||
EffectLayer = (EffectLayer)255;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( m_TriggerType == EffectTriggerType.DoubleClick )
|
||||
if ( TriggerType == EffectTriggerType.DoubleClick )
|
||||
DoEffect( from );
|
||||
}
|
||||
|
||||
public override bool HandlesOnMovement => ( m_TriggerType == EffectTriggerType.InRange );
|
||||
public override bool HandlesOnMovement => ( TriggerType == EffectTriggerType.InRange );
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Location != oldLocation && m_TriggerType == EffectTriggerType.InRange && Utility.InRange( GetWorldLocation(), m.Location, m_TriggerRange ) && !Utility.InRange( GetWorldLocation(), oldLocation, m_TriggerRange ) )
|
||||
if ( m.Location != oldLocation && TriggerType == EffectTriggerType.InRange && Utility.InRange( GetWorldLocation(), m.Location, TriggerRange ) && !Utility.InRange( GetWorldLocation(), oldLocation, TriggerRange ) )
|
||||
DoEffect( m );
|
||||
}
|
||||
|
||||
|
|
@ -228,9 +155,9 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( m_EffectDelay );
|
||||
writer.Write( m_TriggerDelay );
|
||||
writer.Write( m_SoundDelay );
|
||||
writer.Write( EffectDelay );
|
||||
writer.Write( TriggerDelay );
|
||||
writer.Write( SoundDelay );
|
||||
|
||||
if ( m_Source is Item srcItem )
|
||||
writer.Write( srcItem );
|
||||
|
|
@ -242,27 +169,27 @@ namespace Server.Items
|
|||
else
|
||||
writer.Write( m_Target as Mobile );
|
||||
|
||||
writer.Write( m_Trigger as Item );
|
||||
writer.Write( Sequence as Item );
|
||||
|
||||
writer.Write( m_FixedDirection );
|
||||
writer.Write( m_Explodes );
|
||||
writer.Write( m_PlaySoundAtTrigger );
|
||||
writer.Write( FixedDirection );
|
||||
writer.Write( Explodes );
|
||||
writer.Write( PlaySoundAtTrigger );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_EffectType );
|
||||
writer.WriteEncodedInt( (int) m_EffectLayer );
|
||||
writer.WriteEncodedInt( (int) m_TriggerType );
|
||||
writer.WriteEncodedInt( (int) EffectType );
|
||||
writer.WriteEncodedInt( (int) EffectLayer );
|
||||
writer.WriteEncodedInt( (int) TriggerType );
|
||||
|
||||
writer.WriteEncodedInt( m_ItemID );
|
||||
writer.WriteEncodedInt( m_Hue );
|
||||
writer.WriteEncodedInt( m_RenderMode );
|
||||
writer.WriteEncodedInt( m_Speed );
|
||||
writer.WriteEncodedInt( m_Duration );
|
||||
writer.WriteEncodedInt( m_ParticleEffect );
|
||||
writer.WriteEncodedInt( m_ExplodeParticleEffect );
|
||||
writer.WriteEncodedInt( m_ExplodeSound );
|
||||
writer.WriteEncodedInt( m_Unknown );
|
||||
writer.WriteEncodedInt( m_SoundID );
|
||||
writer.WriteEncodedInt( m_TriggerRange );
|
||||
writer.WriteEncodedInt( EffectItemID );
|
||||
writer.WriteEncodedInt( EffectHue );
|
||||
writer.WriteEncodedInt( RenderMode );
|
||||
writer.WriteEncodedInt( Speed );
|
||||
writer.WriteEncodedInt( Duration );
|
||||
writer.WriteEncodedInt( ParticleEffect );
|
||||
writer.WriteEncodedInt( ExplodeParticleEffect );
|
||||
writer.WriteEncodedInt( ExplodeSound );
|
||||
writer.WriteEncodedInt( Unknown );
|
||||
writer.WriteEncodedInt( SoundID );
|
||||
writer.WriteEncodedInt( TriggerRange );
|
||||
}
|
||||
|
||||
private IEntity ReadEntity( GenericReader reader )
|
||||
|
|
@ -280,33 +207,33 @@ namespace Server.Items
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_EffectDelay = reader.ReadTimeSpan();
|
||||
m_TriggerDelay = reader.ReadTimeSpan();
|
||||
m_SoundDelay = reader.ReadTimeSpan();
|
||||
EffectDelay = reader.ReadTimeSpan();
|
||||
TriggerDelay = reader.ReadTimeSpan();
|
||||
SoundDelay = reader.ReadTimeSpan();
|
||||
|
||||
m_Source = ReadEntity( reader );
|
||||
m_Target = ReadEntity( reader );
|
||||
m_Trigger = reader.ReadItem() as EffectController;
|
||||
Sequence = reader.ReadItem() as EffectController;
|
||||
|
||||
m_FixedDirection = reader.ReadBool();
|
||||
m_Explodes = reader.ReadBool();
|
||||
m_PlaySoundAtTrigger = reader.ReadBool();
|
||||
FixedDirection = reader.ReadBool();
|
||||
Explodes = reader.ReadBool();
|
||||
PlaySoundAtTrigger = reader.ReadBool();
|
||||
|
||||
m_EffectType = (ECEffectType)reader.ReadEncodedInt();
|
||||
m_EffectLayer = (EffectLayer)reader.ReadEncodedInt();
|
||||
m_TriggerType = (EffectTriggerType)reader.ReadEncodedInt();
|
||||
EffectType = (ECEffectType)reader.ReadEncodedInt();
|
||||
EffectLayer = (EffectLayer)reader.ReadEncodedInt();
|
||||
TriggerType = (EffectTriggerType)reader.ReadEncodedInt();
|
||||
|
||||
m_ItemID = reader.ReadEncodedInt();
|
||||
m_Hue = reader.ReadEncodedInt();
|
||||
m_RenderMode = reader.ReadEncodedInt();
|
||||
m_Speed = reader.ReadEncodedInt();
|
||||
m_Duration = reader.ReadEncodedInt();
|
||||
m_ParticleEffect = reader.ReadEncodedInt();
|
||||
m_ExplodeParticleEffect = reader.ReadEncodedInt();
|
||||
m_ExplodeSound = reader.ReadEncodedInt();
|
||||
m_Unknown = reader.ReadEncodedInt();
|
||||
m_SoundID = reader.ReadEncodedInt();
|
||||
m_TriggerRange = reader.ReadEncodedInt();
|
||||
EffectItemID = reader.ReadEncodedInt();
|
||||
EffectHue = reader.ReadEncodedInt();
|
||||
RenderMode = reader.ReadEncodedInt();
|
||||
Speed = reader.ReadEncodedInt();
|
||||
Duration = reader.ReadEncodedInt();
|
||||
ParticleEffect = reader.ReadEncodedInt();
|
||||
ExplodeParticleEffect = reader.ReadEncodedInt();
|
||||
ExplodeSound = reader.ReadEncodedInt();
|
||||
Unknown = reader.ReadEncodedInt();
|
||||
SoundID = reader.ReadEncodedInt();
|
||||
TriggerRange = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -317,31 +244,31 @@ namespace Server.Items
|
|||
{
|
||||
IEntity ent = null;
|
||||
|
||||
if (m_PlaySoundAtTrigger)
|
||||
if (PlaySoundAtTrigger)
|
||||
ent = trigger;
|
||||
|
||||
if (ent == null)
|
||||
ent = this;
|
||||
|
||||
Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, m_SoundID);
|
||||
Effects.PlaySound((ent as Item)?.GetWorldLocation() ?? ent.Location, ent.Map, SoundID);
|
||||
}
|
||||
|
||||
public void DoEffect(IEntity trigger)
|
||||
{
|
||||
if (Deleted || m_TriggerType == EffectTriggerType.None)
|
||||
if (Deleted || TriggerType == EffectTriggerType.None)
|
||||
return;
|
||||
|
||||
if (trigger is Mobile mobile && mobile.Hidden && mobile.AccessLevel > AccessLevel.Player)
|
||||
return;
|
||||
|
||||
if (m_SoundID > 0)
|
||||
Timer.DelayCall<IEntity>(m_SoundDelay, PlaySound, trigger);
|
||||
if (SoundID > 0)
|
||||
Timer.DelayCall<IEntity>(SoundDelay, PlaySound, trigger);
|
||||
|
||||
if (m_Trigger != null)
|
||||
Timer.DelayCall<IEntity>(m_TriggerDelay, m_Trigger.DoEffect, trigger);
|
||||
if (Sequence != null)
|
||||
Timer.DelayCall<IEntity>(TriggerDelay, Sequence.DoEffect, trigger);
|
||||
|
||||
if (m_EffectType != ECEffectType.None)
|
||||
Timer.DelayCall<IEntity>(m_EffectDelay, InternalDoEffect, trigger);
|
||||
if (EffectType != ECEffectType.None)
|
||||
Timer.DelayCall<IEntity>(EffectDelay, InternalDoEffect, trigger);
|
||||
}
|
||||
|
||||
public void InternalDoEffect(IEntity trigger)
|
||||
|
|
@ -354,16 +281,16 @@ namespace Server.Items
|
|||
if (to == null)
|
||||
to = trigger;
|
||||
|
||||
switch (m_EffectType)
|
||||
switch (EffectType)
|
||||
{
|
||||
case ECEffectType.Lightning:
|
||||
{
|
||||
Effects.SendBoltEffect(from, false, m_Hue);
|
||||
Effects.SendBoltEffect(from, false, EffectHue);
|
||||
break;
|
||||
}
|
||||
case ECEffectType.Location:
|
||||
{
|
||||
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_Unknown);
|
||||
Effects.SendLocationParticles(EffectItem.Create(from.Location, from.Map, EffectItem.DefaultDuration), EffectItemID, Speed, Duration, EffectHue, RenderMode, ParticleEffect, Unknown);
|
||||
break;
|
||||
}
|
||||
case ECEffectType.Moving:
|
||||
|
|
@ -374,12 +301,12 @@ namespace Server.Items
|
|||
if (to == this)
|
||||
to = EffectItem.Create(to.Location, to.Map, EffectItem.DefaultDuration);
|
||||
|
||||
Effects.SendMovingParticles(from, to, m_ItemID, m_Speed, m_Duration, m_FixedDirection, m_Explodes, m_Hue, m_RenderMode, m_ParticleEffect, m_ExplodeParticleEffect, m_ExplodeSound, m_EffectLayer, m_Unknown);
|
||||
Effects.SendMovingParticles(from, to, EffectItemID, Speed, Duration, FixedDirection, Explodes, EffectHue, RenderMode, ParticleEffect, ExplodeParticleEffect, ExplodeSound, EffectLayer, Unknown);
|
||||
break;
|
||||
}
|
||||
case ECEffectType.Target:
|
||||
{
|
||||
Effects.SendTargetParticles(from, m_ItemID, m_Speed, m_Duration, m_Hue, m_RenderMode, m_ParticleEffect, m_EffectLayer, m_Unknown);
|
||||
Effects.SendTargetParticles(from, EffectItemID, Speed, Duration, EffectHue, RenderMode, ParticleEffect, EffectLayer, Unknown);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,19 +191,17 @@ namespace Server.Items
|
|||
|
||||
private class ThrowTarget : Target
|
||||
{
|
||||
private Firebomb m_Bomb;
|
||||
|
||||
public Firebomb Bomb => m_Bomb;
|
||||
public Firebomb Bomb { get; }
|
||||
|
||||
public ThrowTarget( Firebomb bomb )
|
||||
: base( 12, true, TargetFlags.None )
|
||||
{
|
||||
m_Bomb = bomb;
|
||||
Bomb = bomb;
|
||||
}
|
||||
|
||||
protected override void OnTarget( Mobile from, object targeted )
|
||||
{
|
||||
m_Bomb.OnFirebombTarget( from, targeted );
|
||||
Bomb.OnFirebombTarget( from, targeted );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,18 +13,16 @@ namespace Server.Items
|
|||
typeof( Mobile ), typeof( Direction )
|
||||
};
|
||||
|
||||
private Direction[] m_Directions;
|
||||
|
||||
public Direction[] Directions => m_Directions;
|
||||
public Direction[] Directions { get; }
|
||||
|
||||
public FlippableAddonAttribute( params Direction[] directions )
|
||||
{
|
||||
m_Directions = directions;
|
||||
Directions = directions;
|
||||
}
|
||||
|
||||
public virtual void Flip( Mobile from, Item addon )
|
||||
{
|
||||
if ( m_Directions != null && m_Directions.Length > 1 )
|
||||
if ( Directions != null && Directions.Length > 1 )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -34,21 +32,21 @@ namespace Server.Items
|
|||
{
|
||||
int index = 0;
|
||||
|
||||
for ( int i = 0; i < m_Directions.Length; i++ )
|
||||
for ( int i = 0; i < Directions.Length; i++ )
|
||||
{
|
||||
if ( addon.Direction == m_Directions[ i ] )
|
||||
if ( addon.Direction == Directions[ i ] )
|
||||
{
|
||||
index = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( index >= m_Directions.Length )
|
||||
if ( index >= Directions.Length )
|
||||
index = 0;
|
||||
|
||||
ClearComponents( addon );
|
||||
|
||||
flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } );
|
||||
flipMethod.Invoke( addon, new object[ 2 ] { from, Directions[ index ] } );
|
||||
|
||||
BaseHouse house = null;
|
||||
AddonFitResult result = AddonFitResult.Valid;
|
||||
|
|
@ -65,13 +63,13 @@ namespace Server.Items
|
|||
if ( result != AddonFitResult.Valid )
|
||||
{
|
||||
if ( index == 0 )
|
||||
index = m_Directions.Length - 1;
|
||||
index = Directions.Length - 1;
|
||||
else
|
||||
index -= 1;
|
||||
|
||||
ClearComponents( addon );
|
||||
|
||||
flipMethod.Invoke( addon, new object[ 2 ] { from, m_Directions[ index ] } );
|
||||
flipMethod.Invoke( addon, new object[ 2 ] { from, Directions[ index ] } );
|
||||
|
||||
if ( result == AddonFitResult.Blocked )
|
||||
from.SendLocalizedMessage( 500269 ); // You cannot build that there.
|
||||
|
|
@ -85,7 +83,7 @@ namespace Server.Items
|
|||
from.SendLocalizedMessage( 500268 ); // This object needs to be mounted on something.
|
||||
}
|
||||
|
||||
addon.Direction = m_Directions[ index ];
|
||||
addon.Direction = Directions[ index ];
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -61,9 +61,7 @@ namespace Server.Items
|
|||
[AttributeUsage( AttributeTargets.Class )]
|
||||
public class FlippableAttribute : Attribute
|
||||
{
|
||||
private int[] m_ItemIDs;
|
||||
|
||||
public int[] ItemIDs => m_ItemIDs;
|
||||
public int[] ItemIDs { get; }
|
||||
|
||||
public FlippableAttribute()
|
||||
: this( null )
|
||||
|
|
@ -72,12 +70,12 @@ namespace Server.Items
|
|||
|
||||
public FlippableAttribute( params int[] itemIDs )
|
||||
{
|
||||
m_ItemIDs = itemIDs;
|
||||
ItemIDs = itemIDs;
|
||||
}
|
||||
|
||||
public virtual void Flip( Item item )
|
||||
{
|
||||
if ( m_ItemIDs == null )
|
||||
if ( ItemIDs == null )
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -93,19 +91,19 @@ namespace Server.Items
|
|||
else
|
||||
{
|
||||
int index = 0;
|
||||
for( int i = 0; i < m_ItemIDs.Length; i++ )
|
||||
for( int i = 0; i < ItemIDs.Length; i++ )
|
||||
{
|
||||
if ( item.ItemID == m_ItemIDs[i] )
|
||||
if ( item.ItemID == ItemIDs[i] )
|
||||
{
|
||||
index = i + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( index > m_ItemIDs.Length - 1 )
|
||||
if ( index > ItemIDs.Length - 1 )
|
||||
index = 0;
|
||||
|
||||
item.ItemID = m_ItemIDs[index];
|
||||
item.ItemID = ItemIDs[index];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,21 +51,17 @@ namespace Server.Items
|
|||
|
||||
private class HairDyeEntry
|
||||
{
|
||||
private string m_Name;
|
||||
private int m_HueStart;
|
||||
private int m_HueCount;
|
||||
public string Name { get; }
|
||||
|
||||
public string Name => m_Name;
|
||||
public int HueStart { get; }
|
||||
|
||||
public int HueStart => m_HueStart;
|
||||
|
||||
public int HueCount => m_HueCount;
|
||||
public int HueCount { get; }
|
||||
|
||||
public HairDyeEntry( string name, int hueStart, int hueCount )
|
||||
{
|
||||
m_Name = name;
|
||||
m_HueStart = hueStart;
|
||||
m_HueCount = hueCount;
|
||||
Name = name;
|
||||
HueStart = hueStart;
|
||||
HueCount = hueCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -23,8 +23,6 @@ namespace Server.Items
|
|||
{
|
||||
private string m_Description;
|
||||
private uint m_KeyVal;
|
||||
private Item m_Link;
|
||||
private int m_MaxRange;
|
||||
|
||||
public static uint RandomValue()
|
||||
{
|
||||
|
|
@ -101,12 +99,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int MaxRange
|
||||
{
|
||||
get => m_MaxRange;
|
||||
|
||||
set => m_MaxRange = value;
|
||||
}
|
||||
public int MaxRange { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public uint KeyValue
|
||||
|
|
@ -121,12 +114,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Link
|
||||
{
|
||||
get => m_Link;
|
||||
|
||||
set => m_Link = value;
|
||||
}
|
||||
public Item Link { get; set; }
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
{
|
||||
|
|
@ -134,9 +122,9 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (int) m_MaxRange );
|
||||
writer.Write( (int) MaxRange );
|
||||
|
||||
writer.Write( (Item) m_Link );
|
||||
writer.Write( (Item) Link );
|
||||
|
||||
writer.Write( (string) m_Description );
|
||||
writer.Write( (uint) m_KeyVal );
|
||||
|
|
@ -152,20 +140,20 @@ namespace Server.Items
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_MaxRange = reader.ReadInt();
|
||||
MaxRange = reader.ReadInt();
|
||||
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Link = reader.ReadItem();
|
||||
Link = reader.ReadItem();
|
||||
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 2 || m_MaxRange == 0 )
|
||||
m_MaxRange = 3;
|
||||
if ( version < 2 || MaxRange == 0 )
|
||||
MaxRange = 3;
|
||||
|
||||
m_Description = reader.ReadString();
|
||||
|
||||
|
|
@ -201,9 +189,9 @@ namespace Server.Items
|
|||
{
|
||||
Weight = 1.0;
|
||||
|
||||
m_MaxRange = 3;
|
||||
MaxRange = 3;
|
||||
m_KeyVal = LockVal;
|
||||
m_Link = link;
|
||||
Link = link;
|
||||
}
|
||||
|
||||
public Key( Serial serial ) : base( serial )
|
||||
|
|
|
|||
|
|
@ -7,16 +7,14 @@ namespace Server.Items
|
|||
{
|
||||
public static readonly int MaxKeys = 20;
|
||||
|
||||
private List<Key> m_Keys;
|
||||
|
||||
public List<Key> Keys => m_Keys;
|
||||
public List<Key> Keys { get; private set; }
|
||||
|
||||
[Constructible]
|
||||
public KeyRing() : base( 0x1011 )
|
||||
{
|
||||
Weight = 1.0; // They seem to have no weight on OSI ?!
|
||||
|
||||
m_Keys = new List<Key>();
|
||||
Keys = new List<Key>();
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
|
|
@ -98,18 +96,18 @@ namespace Server.Items
|
|||
{
|
||||
base.OnDelete();
|
||||
|
||||
foreach ( Key key in m_Keys )
|
||||
foreach ( Key key in Keys )
|
||||
{
|
||||
key.Delete();
|
||||
}
|
||||
|
||||
m_Keys.Clear();
|
||||
Keys.Clear();
|
||||
}
|
||||
|
||||
public void Add( Key key )
|
||||
{
|
||||
key.Internalize();
|
||||
m_Keys.Add( key );
|
||||
Keys.Add( key );
|
||||
|
||||
UpdateItemID();
|
||||
}
|
||||
|
|
@ -119,14 +117,14 @@ namespace Server.Items
|
|||
if ( !(Parent is Container cont) )
|
||||
return;
|
||||
|
||||
for ( int i = m_Keys.Count - 1; i >= 0; i-- )
|
||||
for ( int i = Keys.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
Key key = m_Keys[i];
|
||||
Key key = Keys[i];
|
||||
|
||||
if ( !key.Deleted && !cont.TryDropItem( from, key, true ) )
|
||||
break;
|
||||
|
||||
m_Keys.RemoveAt( i );
|
||||
Keys.RemoveAt( i );
|
||||
}
|
||||
|
||||
UpdateItemID();
|
||||
|
|
@ -134,14 +132,14 @@ namespace Server.Items
|
|||
|
||||
public void RemoveKeys( uint keyValue )
|
||||
{
|
||||
for ( int i = m_Keys.Count - 1; i >= 0; i-- )
|
||||
for ( int i = Keys.Count - 1; i >= 0; i-- )
|
||||
{
|
||||
Key key = m_Keys[i];
|
||||
Key key = Keys[i];
|
||||
|
||||
if ( key.KeyValue == keyValue )
|
||||
{
|
||||
key.Delete();
|
||||
m_Keys.RemoveAt( i );
|
||||
Keys.RemoveAt( i );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +148,7 @@ namespace Server.Items
|
|||
|
||||
public bool ContainsKey( uint keyValue )
|
||||
{
|
||||
foreach ( Key key in m_Keys )
|
||||
foreach ( Key key in Keys )
|
||||
{
|
||||
if ( key.KeyValue == keyValue )
|
||||
return true;
|
||||
|
|
@ -181,7 +179,7 @@ namespace Server.Items
|
|||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.WriteItemList<Key>( m_Keys );
|
||||
writer.WriteItemList<Key>( Keys );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -190,7 +188,7 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Keys = reader.ReadStrongItemList<Key>();
|
||||
Keys = reader.ReadStrongItemList<Key>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,24 +4,14 @@ namespace Server.Items
|
|||
{
|
||||
public class MorphItem : Item
|
||||
{
|
||||
private int m_InactiveItemID;
|
||||
private int m_ActiveItemID;
|
||||
private int m_InRange;
|
||||
private int m_OutRange;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int InactiveItemID
|
||||
{
|
||||
get => m_InactiveItemID;
|
||||
set => m_InactiveItemID = value;
|
||||
}
|
||||
public int InactiveItemID { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ActiveItemID
|
||||
{
|
||||
get => m_ActiveItemID;
|
||||
set => m_ActiveItemID = value;
|
||||
}
|
||||
public int ActiveItemID { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int InRange
|
||||
|
|
@ -109,8 +99,8 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) m_OutRange );
|
||||
|
||||
writer.Write( (int) m_InactiveItemID );
|
||||
writer.Write( (int) m_ActiveItemID );
|
||||
writer.Write( (int) InactiveItemID );
|
||||
writer.Write( (int) ActiveItemID );
|
||||
writer.Write( (int) m_InRange );
|
||||
}
|
||||
|
||||
|
|
@ -129,8 +119,8 @@ namespace Server.Items
|
|||
}
|
||||
case 0:
|
||||
{
|
||||
m_InactiveItemID = reader.ReadInt();
|
||||
m_ActiveItemID = reader.ReadInt();
|
||||
InactiveItemID = reader.ReadInt();
|
||||
ActiveItemID = reader.ReadInt();
|
||||
m_InRange = reader.ReadInt();
|
||||
|
||||
if ( version < 1 )
|
||||
|
|
|
|||
|
|
@ -69,37 +69,20 @@ namespace Server.Items
|
|||
|
||||
public abstract class BasePlayerBB : Item, ISecurable
|
||||
{
|
||||
private PlayerBBMessage m_Greeting;
|
||||
private List<PlayerBBMessage> m_Messages;
|
||||
private string m_Title;
|
||||
private SecureLevel m_Level;
|
||||
public List<PlayerBBMessage> Messages { get; private set; }
|
||||
|
||||
public List<PlayerBBMessage> Messages => m_Messages;
|
||||
|
||||
public PlayerBBMessage Greeting
|
||||
{
|
||||
get => m_Greeting;
|
||||
set => m_Greeting = value;
|
||||
}
|
||||
public PlayerBBMessage Greeting { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Title
|
||||
{
|
||||
get => m_Title;
|
||||
set => m_Title = value;
|
||||
}
|
||||
public string Title { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get => m_Level;
|
||||
set => m_Level = value;
|
||||
}
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
public BasePlayerBB( int itemID ) : base( itemID )
|
||||
{
|
||||
m_Messages = new List<PlayerBBMessage>();
|
||||
m_Level = SecureLevel.Anyone;
|
||||
Messages = new List<PlayerBBMessage>();
|
||||
Level = SecureLevel.Anyone;
|
||||
}
|
||||
|
||||
public BasePlayerBB( Serial serial ) : base( serial )
|
||||
|
|
@ -118,24 +101,24 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.Write( (int) Level );
|
||||
|
||||
writer.Write( m_Title );
|
||||
writer.Write( Title );
|
||||
|
||||
if ( m_Greeting != null )
|
||||
if ( Greeting != null )
|
||||
{
|
||||
writer.Write( true );
|
||||
m_Greeting.Serialize( writer );
|
||||
Greeting.Serialize( writer );
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.Write( false );
|
||||
}
|
||||
|
||||
writer.WriteEncodedInt( m_Messages.Count );
|
||||
writer.WriteEncodedInt( Messages.Count );
|
||||
|
||||
for ( int i = 0; i < m_Messages.Count; ++i )
|
||||
m_Messages[i].Serialize( writer );
|
||||
for ( int i = 0; i < Messages.Count; ++i )
|
||||
Messages[i].Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -148,25 +131,25 @@ namespace Server.Items
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Level = (SecureLevel)reader.ReadInt();
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
if ( version < 1 )
|
||||
m_Level = SecureLevel.Anyone;
|
||||
Level = SecureLevel.Anyone;
|
||||
|
||||
m_Title = reader.ReadString();
|
||||
Title = reader.ReadString();
|
||||
|
||||
if ( reader.ReadBool() )
|
||||
m_Greeting = new PlayerBBMessage( reader );
|
||||
Greeting = new PlayerBBMessage( reader );
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Messages = new List<PlayerBBMessage>( count );
|
||||
Messages = new List<PlayerBBMessage>( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
m_Messages.Add( new PlayerBBMessage( reader ) );
|
||||
Messages.Add( new PlayerBBMessage( reader ) );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -327,36 +310,20 @@ namespace Server.Items
|
|||
|
||||
public class PlayerBBMessage
|
||||
{
|
||||
private DateTime m_Time;
|
||||
private Mobile m_Poster;
|
||||
private string m_Message;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime Time { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime Time
|
||||
{
|
||||
get => m_Time;
|
||||
set => m_Time = value;
|
||||
}
|
||||
public Mobile Poster { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Poster
|
||||
{
|
||||
get => m_Poster;
|
||||
set => m_Poster = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Message
|
||||
{
|
||||
get => m_Message;
|
||||
set => m_Message = value;
|
||||
}
|
||||
public string Message { get; set; }
|
||||
|
||||
public PlayerBBMessage( DateTime time, Mobile poster, string message )
|
||||
{
|
||||
m_Time = time;
|
||||
m_Poster = poster;
|
||||
m_Message = message;
|
||||
Time = time;
|
||||
Poster = poster;
|
||||
Message = message;
|
||||
}
|
||||
|
||||
public PlayerBBMessage( GenericReader reader )
|
||||
|
|
@ -367,9 +334,9 @@ namespace Server.Items
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Time = reader.ReadDateTime();
|
||||
m_Poster = reader.ReadMobile();
|
||||
m_Message = reader.ReadString();
|
||||
Time = reader.ReadDateTime();
|
||||
Poster = reader.ReadMobile();
|
||||
Message = reader.ReadString();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -379,9 +346,9 @@ namespace Server.Items
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_Time );
|
||||
writer.Write( m_Poster );
|
||||
writer.Write( m_Message );
|
||||
writer.Write( Time );
|
||||
writer.Write( Poster );
|
||||
writer.Write( Message );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,25 +59,18 @@ namespace Server.Items
|
|||
|
||||
public struct Node
|
||||
{
|
||||
private int m_X;
|
||||
private int m_Y;
|
||||
public int X { get; set; }
|
||||
|
||||
public int X{ get => m_X;
|
||||
set => m_X = value;
|
||||
}
|
||||
public int Y{ get => m_Y;
|
||||
set => m_Y = value;
|
||||
}
|
||||
public int Y { get; set; }
|
||||
|
||||
public Node( int x, int y )
|
||||
{
|
||||
m_X = x;
|
||||
m_Y = y;
|
||||
X = x;
|
||||
Y = y;
|
||||
}
|
||||
}
|
||||
|
||||
private int m_SideLength;
|
||||
private Node[] m_Path;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int SideLength
|
||||
|
|
@ -98,7 +91,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
public Node[] Path => m_Path;
|
||||
public Node[] Path { get; private set; }
|
||||
|
||||
public override string DefaultName => "a control panel";
|
||||
|
||||
|
|
@ -180,11 +173,11 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
m_Path = new Node[stackSize];
|
||||
Path = new Node[stackSize];
|
||||
|
||||
for ( int i = 0; i < stackSize; i++ )
|
||||
{
|
||||
m_Path[i] = stack[i];
|
||||
Path[i] = stack[i];
|
||||
}
|
||||
|
||||
if ( m_User != null )
|
||||
|
|
@ -544,10 +537,10 @@ namespace Server.Items
|
|||
|
||||
writer.WriteEncodedInt( (int) m_SideLength );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Path.Length );
|
||||
for ( int i = 0; i < m_Path.Length; i++ )
|
||||
writer.WriteEncodedInt( (int) Path.Length );
|
||||
for ( int i = 0; i < Path.Length; i++ )
|
||||
{
|
||||
Node cur = m_Path[i];
|
||||
Node cur = Path[i];
|
||||
|
||||
writer.WriteEncodedInt( cur.X );
|
||||
writer.WriteEncodedInt( cur.Y );
|
||||
|
|
@ -562,10 +555,10 @@ namespace Server.Items
|
|||
|
||||
m_SideLength = reader.ReadEncodedInt();
|
||||
|
||||
m_Path = new Node[reader.ReadEncodedInt()];
|
||||
for ( int i = 0; i < m_Path.Length; i++ )
|
||||
Path = new Node[reader.ReadEncodedInt()];
|
||||
for ( int i = 0; i < Path.Length; i++ )
|
||||
{
|
||||
m_Path[i] = new Node( reader.ReadEncodedInt(), reader.ReadEncodedInt() );
|
||||
Path[i] = new Node( reader.ReadEncodedInt(), reader.ReadEncodedInt() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,40 +152,33 @@ namespace Server.Items
|
|||
|
||||
public class PMEntry
|
||||
{
|
||||
private Point3D m_Location;
|
||||
private int m_Number;
|
||||
public Point3D Location { get; }
|
||||
|
||||
public Point3D Location => m_Location;
|
||||
|
||||
public int Number => m_Number;
|
||||
public int Number { get; }
|
||||
|
||||
public PMEntry( Point3D loc, int number )
|
||||
{
|
||||
m_Location = loc;
|
||||
m_Number = number;
|
||||
Location = loc;
|
||||
Number = number;
|
||||
}
|
||||
}
|
||||
|
||||
public class PMList
|
||||
{
|
||||
private int m_Number, m_SelNumber;
|
||||
private Map m_Map;
|
||||
private PMEntry[] m_Entries;
|
||||
public int Number { get; }
|
||||
|
||||
public int Number => m_Number;
|
||||
public int SelNumber { get; }
|
||||
|
||||
public int SelNumber => m_SelNumber;
|
||||
public Map Map { get; }
|
||||
|
||||
public Map Map => m_Map;
|
||||
|
||||
public PMEntry[] Entries => m_Entries;
|
||||
public PMEntry[] Entries { get; }
|
||||
|
||||
public PMList( int number, int selNumber, Map map, PMEntry[] entries )
|
||||
{
|
||||
m_Number = number;
|
||||
m_SelNumber = selNumber;
|
||||
m_Map = map;
|
||||
m_Entries = entries;
|
||||
Number = number;
|
||||
SelNumber = selNumber;
|
||||
Map = map;
|
||||
Entries = entries;
|
||||
}
|
||||
|
||||
public static readonly PMList Trammel =
|
||||
|
|
|
|||
|
|
@ -4,30 +4,14 @@ namespace Server.Items
|
|||
{
|
||||
public class SerpentPillar : Item
|
||||
{
|
||||
private bool m_Active;
|
||||
private string m_Word;
|
||||
private Rectangle2D m_Destination;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool Active
|
||||
{
|
||||
get => m_Active;
|
||||
set => m_Active = value;
|
||||
}
|
||||
public string Word { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string Word
|
||||
{
|
||||
get => m_Word;
|
||||
set => m_Word = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Rectangle2D Destination
|
||||
{
|
||||
get => m_Destination;
|
||||
set => m_Destination = value;
|
||||
}
|
||||
public Rectangle2D Destination { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public SerpentPillar() : this( null, new Rectangle2D(), false )
|
||||
|
|
@ -42,9 +26,9 @@ namespace Server.Items
|
|||
{
|
||||
Movable = false;
|
||||
|
||||
m_Active = active;
|
||||
m_Word = word;
|
||||
m_Destination = destination;
|
||||
Active = active;
|
||||
Word = word;
|
||||
Destination = destination;
|
||||
}
|
||||
|
||||
public override bool HandlesOnSpeech => true;
|
||||
|
|
@ -103,9 +87,9 @@ namespace Server.Items
|
|||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( (bool) m_Active );
|
||||
writer.Write( (string) m_Word );
|
||||
writer.Write( (Rectangle2D) m_Destination );
|
||||
writer.Write( (bool) Active );
|
||||
writer.Write( (string) Word );
|
||||
writer.Write( (Rectangle2D) Destination );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -114,9 +98,9 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
m_Active = reader.ReadBool();
|
||||
m_Word = reader.ReadString();
|
||||
m_Destination = reader.ReadRect2D();
|
||||
Active = reader.ReadBool();
|
||||
Word = reader.ReadString();
|
||||
Destination = reader.ReadRect2D();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,21 +52,17 @@ namespace Server.Items
|
|||
|
||||
private class SpecialBeardDyeEntry
|
||||
{
|
||||
private string m_Name;
|
||||
private int m_HueStart;
|
||||
private int m_HueCount;
|
||||
public string Name { get; }
|
||||
|
||||
public string Name => m_Name;
|
||||
public int HueStart { get; }
|
||||
|
||||
public int HueStart => m_HueStart;
|
||||
|
||||
public int HueCount => m_HueCount;
|
||||
public int HueCount { get; }
|
||||
|
||||
public SpecialBeardDyeEntry( string name, int hueStart, int hueCount )
|
||||
{
|
||||
m_Name = name;
|
||||
m_HueStart = hueStart;
|
||||
m_HueCount = hueCount;
|
||||
Name = name;
|
||||
HueStart = hueStart;
|
||||
HueCount = hueCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -53,21 +53,17 @@ namespace Server.Items
|
|||
|
||||
private class SpecialHairDyeEntry
|
||||
{
|
||||
private string m_Name;
|
||||
private int m_HueStart;
|
||||
private int m_HueCount;
|
||||
public string Name { get; }
|
||||
|
||||
public string Name => m_Name;
|
||||
public int HueStart { get; }
|
||||
|
||||
public int HueStart => m_HueStart;
|
||||
|
||||
public int HueCount => m_HueCount;
|
||||
public int HueCount { get; }
|
||||
|
||||
public SpecialHairDyeEntry( string name, int hueStart, int hueCount )
|
||||
{
|
||||
m_Name = name;
|
||||
m_HueStart = hueStart;
|
||||
m_HueCount = hueCount;
|
||||
Name = name;
|
||||
HueStart = hueStart;
|
||||
HueCount = hueCount;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -565,46 +565,20 @@ namespace Server.Items
|
|||
m_Table.Remove(from);
|
||||
}
|
||||
|
||||
private int m_StartNumber;
|
||||
private string m_StartMessage;
|
||||
private int m_ProgressNumber;
|
||||
private string m_ProgressMessage;
|
||||
private bool m_ShowTimeRemaining;
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int StartNumber { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int StartNumber
|
||||
{
|
||||
get => m_StartNumber;
|
||||
set => m_StartNumber = value;
|
||||
}
|
||||
public string StartMessage { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string StartMessage
|
||||
{
|
||||
get => m_StartMessage;
|
||||
set => m_StartMessage = value;
|
||||
}
|
||||
public int ProgressNumber { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int ProgressNumber
|
||||
{
|
||||
get => m_ProgressNumber;
|
||||
set => m_ProgressNumber = value;
|
||||
}
|
||||
public string ProgressMessage { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string ProgressMessage
|
||||
{
|
||||
get => m_ProgressMessage;
|
||||
set => m_ProgressMessage = value;
|
||||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool ShowTimeRemaining
|
||||
{
|
||||
get => m_ShowTimeRemaining;
|
||||
set => m_ShowTimeRemaining = value;
|
||||
}
|
||||
public bool ShowTimeRemaining { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public WaitTeleporter()
|
||||
|
|
@ -642,12 +616,12 @@ namespace Server.Items
|
|||
{
|
||||
if (m.BeginAction(this))
|
||||
{
|
||||
if (m_ProgressMessage != null)
|
||||
m.SendMessage(m_ProgressMessage);
|
||||
else if (m_ProgressNumber != 0)
|
||||
m.SendLocalizedMessage(m_ProgressNumber);
|
||||
if (ProgressMessage != null)
|
||||
m.SendMessage(ProgressMessage);
|
||||
else if (ProgressNumber != 0)
|
||||
m.SendLocalizedMessage(ProgressNumber);
|
||||
|
||||
if (m_ShowTimeRemaining)
|
||||
if (ShowTimeRemaining)
|
||||
m.SendMessage("Time remaining: {0}", FormatTime(m_Table[m].Timer.Next - DateTime.UtcNow));
|
||||
|
||||
Timer.DelayCall<Mobile>(TimeSpan.FromSeconds(5), EndLock, m);
|
||||
|
|
@ -659,10 +633,10 @@ namespace Server.Items
|
|||
info.Timer.Stop();
|
||||
}
|
||||
|
||||
if (m_StartMessage != null)
|
||||
m.SendMessage(m_StartMessage);
|
||||
else if (m_StartNumber != 0)
|
||||
m.SendLocalizedMessage(m_StartNumber);
|
||||
if (StartMessage != null)
|
||||
m.SendMessage(StartMessage);
|
||||
else if (StartNumber != 0)
|
||||
m.SendLocalizedMessage(StartNumber);
|
||||
|
||||
if (Delay == TimeSpan.Zero)
|
||||
DoTeleport(m);
|
||||
|
|
@ -688,11 +662,11 @@ namespace Server.Items
|
|||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(m_StartNumber);
|
||||
writer.Write(m_StartMessage);
|
||||
writer.Write(m_ProgressNumber);
|
||||
writer.Write(m_ProgressMessage);
|
||||
writer.Write(m_ShowTimeRemaining);
|
||||
writer.Write(StartNumber);
|
||||
writer.Write(StartMessage);
|
||||
writer.Write(ProgressNumber);
|
||||
writer.Write(ProgressMessage);
|
||||
writer.Write(ShowTimeRemaining);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
|
|
@ -701,40 +675,33 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_StartNumber = reader.ReadInt();
|
||||
m_StartMessage = reader.ReadString();
|
||||
m_ProgressNumber = reader.ReadInt();
|
||||
m_ProgressMessage = reader.ReadString();
|
||||
m_ShowTimeRemaining = reader.ReadBool();
|
||||
StartNumber = reader.ReadInt();
|
||||
StartMessage = reader.ReadString();
|
||||
ProgressNumber = reader.ReadInt();
|
||||
ProgressMessage = reader.ReadString();
|
||||
ShowTimeRemaining = reader.ReadBool();
|
||||
}
|
||||
|
||||
private class TeleportingInfo
|
||||
{
|
||||
private WaitTeleporter m_Teleporter;
|
||||
private Timer m_Timer;
|
||||
public WaitTeleporter Teleporter { get; }
|
||||
|
||||
public WaitTeleporter Teleporter => m_Teleporter;
|
||||
public Timer Timer => m_Timer;
|
||||
public Timer Timer { get; }
|
||||
|
||||
public TeleportingInfo(WaitTeleporter tele, Timer t)
|
||||
{
|
||||
m_Teleporter = tele;
|
||||
m_Timer = t;
|
||||
Teleporter = tele;
|
||||
Timer = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class TimeoutTeleporter : Teleporter
|
||||
{
|
||||
private TimeSpan m_TimeoutDelay;
|
||||
private Dictionary<Mobile, Timer> m_Teleporting;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeSpan TimeoutDelay
|
||||
{
|
||||
get => m_TimeoutDelay;
|
||||
set => m_TimeoutDelay = value;
|
||||
}
|
||||
public TimeSpan TimeoutDelay { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public TimeoutTeleporter()
|
||||
|
|
@ -757,7 +724,7 @@ namespace Server.Items
|
|||
|
||||
public void StartTimer(Mobile m)
|
||||
{
|
||||
StartTimer(m, m_TimeoutDelay);
|
||||
StartTimer(m, TimeoutDelay);
|
||||
}
|
||||
|
||||
private void StartTimer(Mobile m, TimeSpan delay)
|
||||
|
|
@ -808,7 +775,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.Write(m_TimeoutDelay);
|
||||
writer.Write(TimeoutDelay);
|
||||
writer.Write(m_Teleporting.Count);
|
||||
|
||||
foreach (KeyValuePair<Mobile, Timer> kvp in m_Teleporting)
|
||||
|
|
@ -824,7 +791,7 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_TimeoutDelay = reader.ReadTimeSpan();
|
||||
TimeoutDelay = reader.ReadTimeSpan();
|
||||
m_Teleporting = new Dictionary<Mobile, Timer>();
|
||||
|
||||
int count = reader.ReadInt();
|
||||
|
|
@ -841,14 +808,8 @@ namespace Server.Items
|
|||
|
||||
public class TimeoutGoal : Item
|
||||
{
|
||||
private TimeoutTeleporter m_Teleporter;
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public TimeoutTeleporter Teleporter
|
||||
{
|
||||
get => m_Teleporter;
|
||||
set => m_Teleporter = value;
|
||||
}
|
||||
public TimeoutTeleporter Teleporter { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public TimeoutGoal()
|
||||
|
|
@ -862,7 +823,7 @@ namespace Server.Items
|
|||
|
||||
public override bool OnMoveOver(Mobile m)
|
||||
{
|
||||
m_Teleporter?.StopTimer(m);
|
||||
Teleporter?.StopTimer(m);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -880,7 +841,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write((int)0); // version
|
||||
|
||||
writer.WriteItem<TimeoutTeleporter>(m_Teleporter);
|
||||
writer.WriteItem<TimeoutTeleporter>(Teleporter);
|
||||
}
|
||||
|
||||
public override void Deserialize(GenericReader reader)
|
||||
|
|
@ -889,7 +850,7 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Teleporter = reader.ReadItem<TimeoutTeleporter>();
|
||||
Teleporter = reader.ReadItem<TimeoutTeleporter>();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -6,24 +6,13 @@ namespace Server.Items
|
|||
{
|
||||
public class WarningItem : Item
|
||||
{
|
||||
private string m_WarningString;
|
||||
private int m_WarningNumber;
|
||||
private int m_Range;
|
||||
private TimeSpan m_ResetDelay;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string WarningString
|
||||
{
|
||||
get => m_WarningString;
|
||||
set => m_WarningString = value;
|
||||
}
|
||||
public string WarningString { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int WarningNumber
|
||||
{
|
||||
get => m_WarningNumber;
|
||||
set => m_WarningNumber = value;
|
||||
}
|
||||
public int WarningNumber { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Range
|
||||
|
|
@ -33,11 +22,7 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public TimeSpan ResetDelay
|
||||
{
|
||||
get => m_ResetDelay;
|
||||
set => m_ResetDelay = value;
|
||||
}
|
||||
public TimeSpan ResetDelay { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public WarningItem( int itemID, int range, int warning ) : base( itemID )
|
||||
|
|
@ -47,7 +32,7 @@ namespace Server.Items
|
|||
|
||||
Movable = false;
|
||||
|
||||
m_WarningNumber = warning;
|
||||
WarningNumber = warning;
|
||||
m_Range = range;
|
||||
}
|
||||
|
||||
|
|
@ -59,7 +44,7 @@ namespace Server.Items
|
|||
|
||||
Movable = false;
|
||||
|
||||
m_WarningString = warning;
|
||||
WarningString = warning;
|
||||
m_Range = range;
|
||||
}
|
||||
|
||||
|
|
@ -94,14 +79,14 @@ namespace Server.Items
|
|||
|
||||
public virtual void Broadcast( Mobile triggerer )
|
||||
{
|
||||
if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + m_ResetDelay)) )
|
||||
if ( m_Broadcasting || (DateTime.UtcNow < (m_LastBroadcast + ResetDelay)) )
|
||||
return;
|
||||
|
||||
m_LastBroadcast = DateTime.UtcNow;
|
||||
|
||||
m_Broadcasting = true;
|
||||
|
||||
SendMessage( triggerer, OnlyToTriggerer, m_WarningString, m_WarningNumber );
|
||||
SendMessage( triggerer, OnlyToTriggerer, WarningString, WarningNumber );
|
||||
|
||||
if ( NeighborRange >= 0 )
|
||||
{
|
||||
|
|
@ -139,11 +124,11 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( (string) m_WarningString );
|
||||
writer.Write( (int) m_WarningNumber );
|
||||
writer.Write( (string) WarningString );
|
||||
writer.Write( (int) WarningNumber );
|
||||
writer.Write( (int) m_Range );
|
||||
|
||||
writer.Write( (TimeSpan) m_ResetDelay );
|
||||
writer.Write( (TimeSpan) ResetDelay );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -156,10 +141,10 @@ namespace Server.Items
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_WarningString = reader.ReadString();
|
||||
m_WarningNumber = reader.ReadInt();
|
||||
WarningString = reader.ReadString();
|
||||
WarningNumber = reader.ReadInt();
|
||||
m_Range = reader.ReadInt();
|
||||
m_ResetDelay = reader.ReadTimeSpan();
|
||||
ResetDelay = reader.ReadTimeSpan();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -169,35 +154,24 @@ namespace Server.Items
|
|||
|
||||
public class HintItem : WarningItem
|
||||
{
|
||||
private string m_HintString;
|
||||
private int m_HintNumber;
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string HintString { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string HintString
|
||||
{
|
||||
get => m_HintString;
|
||||
set => m_HintString = value;
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int HintNumber
|
||||
{
|
||||
get => m_HintNumber;
|
||||
set => m_HintNumber = value;
|
||||
}
|
||||
public int HintNumber { get; set; }
|
||||
|
||||
public override bool OnlyToTriggerer => true;
|
||||
|
||||
[Constructible]
|
||||
public HintItem( int itemID, int range, int warning, int hint ) : base( itemID, range, warning )
|
||||
{
|
||||
m_HintNumber = hint;
|
||||
HintNumber = hint;
|
||||
}
|
||||
|
||||
[Constructible]
|
||||
public HintItem( int itemID, int range, string warning, string hint ) : base( itemID, range, warning )
|
||||
{
|
||||
m_HintString = hint;
|
||||
HintString = hint;
|
||||
}
|
||||
|
||||
public HintItem( Serial serial ) : base( serial )
|
||||
|
|
@ -206,7 +180,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
SendMessage( from, true, m_HintString, m_HintNumber );
|
||||
SendMessage( from, true, HintString, HintNumber );
|
||||
}
|
||||
|
||||
public override void Serialize( GenericWriter writer )
|
||||
|
|
@ -215,8 +189,8 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 0 );
|
||||
|
||||
writer.Write( (string) m_HintString );
|
||||
writer.Write( (int) m_HintNumber );
|
||||
writer.Write( (string) HintString );
|
||||
writer.Write( (int) HintNumber );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -229,8 +203,8 @@ namespace Server.Items
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_HintString = reader.ReadString();
|
||||
m_HintNumber = reader.ReadInt();
|
||||
HintString = reader.ReadString();
|
||||
HintNumber = reader.ReadInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,16 +19,14 @@ namespace Server.Items
|
|||
{
|
||||
}
|
||||
|
||||
private static int[] m_Sounds = { 0x505, 0x506, 0x507 };
|
||||
|
||||
public static int[] Sounds => m_Sounds;
|
||||
public static int[] Sounds { get; } = { 0x505, 0x506, 0x507 };
|
||||
|
||||
public override bool HandlesOnMovement => m_TurnedOn && IsLockedDown;
|
||||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m_TurnedOn && IsLockedDown && (!m.Hidden || m.AccessLevel == AccessLevel.Player) && Utility.InRange( m.Location, Location, 2 ) && !Utility.InRange( oldLocation, Location, 2 ) )
|
||||
Effects.PlaySound( Location, Map, m_Sounds[Utility.Random( m_Sounds.Length )] );
|
||||
Effects.PlaySound( Location, Map, Sounds[Utility.Random( Sounds.Length )] );
|
||||
|
||||
base.OnMovement( m, oldLocation );
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue