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
|
|
@ -11,7 +11,6 @@ namespace Server.Factions
|
|||
{
|
||||
private Faction m_Faction;
|
||||
private Town m_Town;
|
||||
private Orders m_Orders;
|
||||
|
||||
public override bool BardImmune => true;
|
||||
|
||||
|
|
@ -22,7 +21,7 @@ namespace Server.Factions
|
|||
set{ Unregister(); m_Faction = value; Register(); }
|
||||
}
|
||||
|
||||
public Orders Orders => m_Orders;
|
||||
public Orders Orders { get; private set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster, AccessLevel.Administrator )]
|
||||
public Town Town
|
||||
|
|
@ -79,7 +78,7 @@ namespace Server.Factions
|
|||
|
||||
public override void OnMovement( Mobile m, Point3D oldLocation )
|
||||
{
|
||||
if ( m.Player && m.Alive && InRange( m, 10 ) && !InRange( oldLocation, 10 ) && InLOS( m ) && m_Orders.GetReaction( Faction.Find( m ) ).Type == ReactionType.Warn )
|
||||
if ( m.Player && m.Alive && InRange( m, 10 ) && !InRange( oldLocation, 10 ) && InLOS( m ) && Orders.GetReaction( Faction.Find( m ) ).Type == ReactionType.Warn )
|
||||
{
|
||||
Direction = GetDirectionTo( m );
|
||||
|
||||
|
|
@ -141,7 +140,7 @@ namespace Server.Factions
|
|||
Say( def.String );
|
||||
}
|
||||
|
||||
m_Orders.SetReaction( faction, type );
|
||||
Orders.SetReaction( faction, type );
|
||||
}
|
||||
|
||||
private bool WasNamed( string speech )
|
||||
|
|
@ -217,7 +216,7 @@ namespace Server.Factions
|
|||
Home = Location;
|
||||
RangeHome = 6;
|
||||
Combatant = null;
|
||||
m_Orders.Movement = MovementType.Patrol;
|
||||
Orders.Movement = MovementType.Patrol;
|
||||
Say( 1005146 ); // This spot looks like it needs protection! I shall guard it with my life.
|
||||
understood = true;
|
||||
}
|
||||
|
|
@ -226,8 +225,8 @@ namespace Server.Factions
|
|||
Home = Location;
|
||||
RangeHome = 6;
|
||||
Combatant = null;
|
||||
m_Orders.Follow = from;
|
||||
m_Orders.Movement = MovementType.Follow;
|
||||
Orders.Follow = from;
|
||||
Orders.Movement = MovementType.Follow;
|
||||
Say( 1005144 ); // Yes, Sire.
|
||||
understood = true;
|
||||
}
|
||||
|
|
@ -391,7 +390,7 @@ namespace Server.Factions
|
|||
|
||||
public BaseFactionGuard( string title ) : base( AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4 )
|
||||
{
|
||||
m_Orders = new Orders( this );
|
||||
Orders = new Orders( this );
|
||||
Title = title;
|
||||
|
||||
RangeHome = 6;
|
||||
|
|
@ -410,7 +409,7 @@ namespace Server.Factions
|
|||
Faction.WriteReference( writer, m_Faction );
|
||||
Town.WriteReference( writer, m_Town );
|
||||
|
||||
m_Orders.Serialize( writer );
|
||||
Orders.Serialize( writer );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -421,7 +420,7 @@ namespace Server.Factions
|
|||
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
m_Town = Town.ReadReference( reader );
|
||||
m_Orders = new Orders( this, reader );
|
||||
Orders = new Orders( this, reader );
|
||||
|
||||
Timer.DelayCall( TimeSpan.Zero, Register );
|
||||
}
|
||||
|
|
@ -449,16 +448,15 @@ namespace Server.Factions
|
|||
|
||||
public class VirtualMountItem : Item, IMountItem
|
||||
{
|
||||
private Mobile m_Rider;
|
||||
private VirtualMount m_Mount;
|
||||
|
||||
public Mobile Rider => m_Rider;
|
||||
public Mobile Rider { get; private set; }
|
||||
|
||||
public VirtualMountItem( Mobile mob ) : base( 0x3EA0 )
|
||||
{
|
||||
Layer = Layer.Mount;
|
||||
|
||||
m_Rider = mob;
|
||||
Rider = mob;
|
||||
m_Mount = new VirtualMount( this );
|
||||
}
|
||||
|
||||
|
|
@ -475,7 +473,7 @@ namespace Server.Factions
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Rider );
|
||||
writer.Write( (Mobile) Rider );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -484,9 +482,9 @@ namespace Server.Factions
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Rider = reader.ReadMobile();
|
||||
Rider = reader.ReadMobile();
|
||||
|
||||
if ( m_Rider == null )
|
||||
if ( Rider == null )
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,13 +26,11 @@ namespace Server.Factions
|
|||
|
||||
public class ComboEntry
|
||||
{
|
||||
private Type m_Spell;
|
||||
private TimeSpan m_Hold;
|
||||
private int m_Chance;
|
||||
public Type Spell { get; }
|
||||
|
||||
public Type Spell => m_Spell;
|
||||
public TimeSpan Hold => m_Hold;
|
||||
public int Chance => m_Chance;
|
||||
public TimeSpan Hold { get; }
|
||||
|
||||
public int Chance { get; }
|
||||
|
||||
public ComboEntry( Type spell ) : this( spell, 100, TimeSpan.Zero )
|
||||
{
|
||||
|
|
@ -44,24 +42,22 @@ namespace Server.Factions
|
|||
|
||||
public ComboEntry( Type spell, int chance, TimeSpan hold )
|
||||
{
|
||||
m_Spell = spell;
|
||||
m_Chance = chance;
|
||||
m_Hold = hold;
|
||||
Spell = spell;
|
||||
Chance = chance;
|
||||
Hold = hold;
|
||||
}
|
||||
}
|
||||
|
||||
public class SpellCombo
|
||||
{
|
||||
private int m_Mana;
|
||||
private ComboEntry[] m_Entries;
|
||||
public int Mana { get; }
|
||||
|
||||
public int Mana => m_Mana;
|
||||
public ComboEntry[] Entries => m_Entries;
|
||||
public ComboEntry[] Entries { get; }
|
||||
|
||||
public SpellCombo( int mana, params ComboEntry[] entries )
|
||||
{
|
||||
m_Mana = mana;
|
||||
m_Entries = entries;
|
||||
Mana = mana;
|
||||
Entries = entries;
|
||||
}
|
||||
|
||||
public static readonly SpellCombo Simple = new SpellCombo( 50,
|
||||
|
|
@ -83,9 +79,9 @@ namespace Server.Factions
|
|||
|
||||
public static Spell Process( Mobile mob, Mobile targ, ref SpellCombo combo, ref int index, ref DateTime releaseTime )
|
||||
{
|
||||
while ( ++index < combo.m_Entries.Length )
|
||||
while ( ++index < combo.Entries.Length )
|
||||
{
|
||||
ComboEntry entry = combo.m_Entries[index];
|
||||
ComboEntry entry = combo.Entries[index];
|
||||
|
||||
if ( entry.Spell == typeof( PoisonSpell ) && targ.Poisoned )
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -18,18 +18,14 @@ namespace Server.Factions.AI
|
|||
|
||||
public class Reaction
|
||||
{
|
||||
private Faction m_Faction;
|
||||
private ReactionType m_Type;
|
||||
public Faction Faction { get; }
|
||||
|
||||
public Faction Faction => m_Faction;
|
||||
public ReactionType Type{ get => m_Type;
|
||||
set => m_Type = value;
|
||||
}
|
||||
public ReactionType Type { get; set; }
|
||||
|
||||
public Reaction( Faction faction, ReactionType type )
|
||||
{
|
||||
m_Faction = faction;
|
||||
m_Type = type;
|
||||
Faction = faction;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public Reaction( GenericReader reader )
|
||||
|
|
@ -40,8 +36,8 @@ namespace Server.Factions.AI
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Faction = Faction.ReadReference( reader );
|
||||
m_Type = (ReactionType) reader.ReadEncodedInt();
|
||||
Faction = Faction.ReadReference( reader );
|
||||
Type = (ReactionType) reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -52,27 +48,20 @@ namespace Server.Factions.AI
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 0 ); // version
|
||||
|
||||
Faction.WriteReference( writer, m_Faction );
|
||||
writer.WriteEncodedInt( (int) m_Type );
|
||||
Faction.WriteReference( writer, Faction );
|
||||
writer.WriteEncodedInt( (int) Type );
|
||||
}
|
||||
}
|
||||
|
||||
public class Orders
|
||||
{
|
||||
private BaseFactionGuard m_Guard;
|
||||
|
||||
private List<Reaction> m_Reactions;
|
||||
private MovementType m_Movement;
|
||||
private Mobile m_Follow;
|
||||
|
||||
public BaseFactionGuard Guard => m_Guard;
|
||||
public BaseFactionGuard Guard { get; }
|
||||
|
||||
public MovementType Movement{ get => m_Movement;
|
||||
set => m_Movement = value;
|
||||
}
|
||||
public Mobile Follow{ get => m_Follow;
|
||||
set => m_Follow = value;
|
||||
}
|
||||
public MovementType Movement { get; set; }
|
||||
|
||||
public Mobile Follow { get; set; }
|
||||
|
||||
public Reaction GetReaction( Faction faction )
|
||||
{
|
||||
|
|
@ -86,7 +75,7 @@ namespace Server.Factions.AI
|
|||
return reaction;
|
||||
}
|
||||
|
||||
reaction = new Reaction( faction, ( faction == null || faction == m_Guard.Faction ) ? ReactionType.Ignore : ReactionType.Attack );
|
||||
reaction = new Reaction( faction, ( faction == null || faction == Guard.Faction ) ? ReactionType.Ignore : ReactionType.Attack );
|
||||
m_Reactions.Add( reaction );
|
||||
|
||||
return reaction;
|
||||
|
|
@ -101,14 +90,14 @@ namespace Server.Factions.AI
|
|||
|
||||
public Orders( BaseFactionGuard guard )
|
||||
{
|
||||
m_Guard = guard;
|
||||
Guard = guard;
|
||||
m_Reactions = new List<Reaction>();
|
||||
m_Movement = MovementType.Patrol;
|
||||
Movement = MovementType.Patrol;
|
||||
}
|
||||
|
||||
public Orders( BaseFactionGuard guard, GenericReader reader )
|
||||
{
|
||||
m_Guard = guard;
|
||||
Guard = guard;
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
|
|
@ -116,7 +105,7 @@ namespace Server.Factions.AI
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Follow = reader.ReadMobile();
|
||||
Follow = reader.ReadMobile();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
|
|
@ -127,7 +116,7 @@ namespace Server.Factions.AI
|
|||
for ( int i = 0; i < count; ++i )
|
||||
m_Reactions.Add( new Reaction( reader ) );
|
||||
|
||||
m_Movement = (MovementType)reader.ReadEncodedInt();
|
||||
Movement = (MovementType)reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -138,14 +127,14 @@ namespace Server.Factions.AI
|
|||
{
|
||||
writer.WriteEncodedInt( (int) 1 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Follow );
|
||||
writer.Write( (Mobile) Follow );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Reactions.Count );
|
||||
|
||||
for ( int i = 0; i < m_Reactions.Count; ++i )
|
||||
m_Reactions[i].Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Movement );
|
||||
writer.WriteEncodedInt( (int) Movement );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -41,8 +41,7 @@ namespace Server.Factions
|
|||
m_Town?.UnregisterVendor( this );
|
||||
}
|
||||
|
||||
private List<SBInfo> m_SBInfos = new List<SBInfo>();
|
||||
protected override List<SBInfo> SBInfos => m_SBInfos;
|
||||
protected override List<SBInfo> SBInfos { get; } = new List<SBInfo>();
|
||||
|
||||
public override void InitSBInfo()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -45,15 +45,13 @@ namespace Server.Factions
|
|||
|
||||
public class SBFactionBoard : SBInfo
|
||||
{
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionBoard()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -47,15 +47,13 @@ namespace Server.Factions
|
|||
|
||||
public class SBFactionBottle : SBInfo
|
||||
{
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionBottle()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -48,15 +48,13 @@ namespace Server.Factions
|
|||
{
|
||||
private static readonly object[] m_FixedSizeArgs = { true };
|
||||
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionOre()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
|
|
@ -52,15 +52,13 @@ namespace Server.Factions
|
|||
|
||||
public class SBFactionReagent : SBInfo
|
||||
{
|
||||
private List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
|
||||
private IShopSellInfo m_SellInfo = new InternalSellInfo();
|
||||
|
||||
public SBFactionReagent()
|
||||
{
|
||||
}
|
||||
|
||||
public override IShopSellInfo SellInfo => m_SellInfo;
|
||||
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;
|
||||
public override IShopSellInfo SellInfo { get; } = new InternalSellInfo();
|
||||
|
||||
public override List<GenericBuyInfo> BuyInfo { get; } = new InternalBuyInfo();
|
||||
|
||||
public class InternalBuyInfo : List<GenericBuyInfo>
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue