Changes properties to use automatic property initializers

This commit is contained in:
Kamron Batman 2018-09-14 15:23:29 -07:00
parent f0a48ad431
commit 06fa31a7bf
623 changed files with 13072 additions and 19304 deletions

View file

@ -138,18 +138,16 @@ namespace Server.Items
private class ThrowTarget : Target
{
private BaseConflagrationPotion m_Potion;
public BaseConflagrationPotion Potion => m_Potion;
public BaseConflagrationPotion Potion { get; }
public ThrowTarget( BaseConflagrationPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
if ( Potion.Deleted || Potion.Map == Map.Internal )
return;
if ( !(targeted is IPoint3D p) || from.Map == null )
@ -169,20 +167,19 @@ namespace Server.Items
else
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.5 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
}
}
public class InternalItem : Item
{
private Mobile m_From;
private int m_MinDamage;
private int m_MaxDamage;
private DateTime m_End;
private Timer m_Timer;
public Mobile From => m_From;
public Mobile From { get; private set; }
public override bool BlocksFit => true;
@ -193,7 +190,7 @@ namespace Server.Items
MoveToWorld( loc, map );
m_From = from;
From = from;
m_End = DateTime.UtcNow + TimeSpan.FromSeconds( 10 );
SetDamage( min, max );
@ -224,14 +221,14 @@ namespace Server.Items
m_MinDamage = min;
m_MaxDamage = max;
if ( m_From == null )
if ( From == null )
return;
int alchemySkill = m_From.Skills.Alchemy.Fixed;
int alchemySkill = From.Skills.Alchemy.Fixed;
int alchemyBonus = alchemySkill / 125 + alchemySkill / 250 ;
m_MinDamage = Scale( m_From, m_MinDamage + alchemyBonus );
m_MaxDamage = Scale( m_From, m_MaxDamage + alchemyBonus );
m_MinDamage = Scale( From, m_MinDamage + alchemyBonus );
m_MaxDamage = Scale( From, m_MaxDamage + alchemyBonus );
}
public override void Serialize( GenericWriter writer )
@ -240,7 +237,7 @@ namespace Server.Items
writer.Write( (int) 0 ); // version
writer.Write( (Mobile) m_From );
writer.Write( (Mobile) From );
writer.Write( (DateTime) m_End );
writer.Write( (int) m_MinDamage );
writer.Write( (int) m_MaxDamage );
@ -252,7 +249,7 @@ namespace Server.Items
int version = reader.ReadInt();
m_From = reader.ReadMobile();
From = reader.ReadMobile();
m_End = reader.ReadDateTime();
m_MinDamage = reader.ReadInt();
m_MaxDamage = reader.ReadInt();
@ -263,11 +260,11 @@ namespace Server.Items
public override bool OnMoveOver( Mobile m )
{
if ( Visible && m_From != null && (!Core.AOS || m != m_From) && SpellHelper.ValidIndirectTarget( m_From, m ) && m_From.CanBeHarmful( m, false ) )
if ( Visible && From != null && (!Core.AOS || m != From) && SpellHelper.ValidIndirectTarget( From, m ) && From.CanBeHarmful( m, false ) )
{
m_From.DoHarmful( m );
From.DoHarmful( m );
AOS.Damage( m, m_From, GetDamage(), 0, 100, 0, 0, 0 );
AOS.Damage( m, From, GetDamage(), 0, 100, 0, 0, 0 );
m.PlaySound( 0x208 );
}

View file

@ -158,18 +158,16 @@ namespace Server.Items
private class ThrowTarget : Target
{
private BaseConfusionBlastPotion m_Potion;
public BaseConfusionBlastPotion Potion => m_Potion;
public BaseConfusionBlastPotion Potion { get; }
public ThrowTarget( BaseConfusionBlastPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
if ( Potion.Deleted || Potion.Map == Map.Internal )
return;
if ( !(targeted is IPoint3D p) || from.Map == null )
@ -189,8 +187,8 @@ namespace Server.Items
else
to = new Entity( Serial.Zero, new Point3D( p ), from.Map );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, m_Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
Effects.SendMovingEffect( from, to, 0xF0D, 7, 0, false, false, Potion.Hue, 0 );
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Explode_Callback ), new object[] { from, new Point3D( p ), from.Map } );
}
}
}

View file

@ -4,17 +4,14 @@ namespace Server.Items
{
public class CureLevelInfo
{
private Poison m_Poison;
private double m_Chance;
public Poison Poison { get; }
public Poison Poison => m_Poison;
public double Chance => m_Chance;
public double Chance { get; }
public CureLevelInfo( Poison poison, double chance )
{
m_Poison = poison;
m_Chance = chance;
Poison = poison;
Chance = chance;
}
}

View file

@ -60,9 +60,7 @@ namespace Server.Items
private Timer m_Timer;
public List<Mobile> Users => m_Users;
private List<Mobile> m_Users;
public List<Mobile> Users { get; private set; }
public override void Drink( Mobile from )
{
@ -80,11 +78,11 @@ namespace Server.Items
from.RevealingAction();
if ( m_Users == null )
m_Users = new List<Mobile>();
if ( Users == null )
Users = new List<Mobile>();
if ( !m_Users.Contains( from ) )
m_Users.Add( from );
if ( !Users.Contains( from ) )
Users.Add( from );
from.Target = new ThrowTarget( this );
@ -164,18 +162,16 @@ namespace Server.Items
private class ThrowTarget : Target
{
private BaseExplosionPotion m_Potion;
public BaseExplosionPotion Potion => m_Potion;
public BaseExplosionPotion Potion { get; }
public ThrowTarget( BaseExplosionPotion potion ) : base( 12, true, TargetFlags.None )
{
m_Potion = potion;
Potion = potion;
}
protected override void OnTarget( Mobile from, object targeted )
{
if ( m_Potion.Deleted || m_Potion.Map == Map.Internal )
if ( Potion.Deleted || Potion.Map == Map.Internal )
return;
if ( !(targeted is IPoint3D p) )
@ -200,15 +196,15 @@ namespace Server.Items
to = m;
}
Effects.SendMovingEffect( from, to, m_Potion.ItemID, 7, 0, false, false, m_Potion.Hue, 0 );
Effects.SendMovingEffect( from, to, Potion.ItemID, 7, 0, false, false, Potion.Hue, 0 );
if ( m_Potion.Amount > 1 )
if ( Potion.Amount > 1 )
{
Mobile.LiftItemDupe( m_Potion, 1 );
Mobile.LiftItemDupe( Potion, 1 );
}
m_Potion.Internalize();
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( m_Potion.Reposition_OnTick ), new object[]{ from, p, map } );
Potion.Internalize();
Timer.DelayCall( TimeSpan.FromSeconds( 1.0 ), new TimerStateCallback( Potion.Reposition_OnTick ), new object[]{ from, p, map } );
}
}
@ -219,9 +215,9 @@ namespace Server.Items
Consume();
for ( int i = 0; m_Users != null && i < m_Users.Count; ++i )
for ( int i = 0; Users != null && i < Users.Count; ++i )
{
Mobile m = m_Users[i];
Mobile m = Users[i];
if ( m.Target is ThrowTarget targ && targ.Potion == this )
Target.Cancel( m );