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
|
|
@ -5,23 +5,12 @@ namespace Server.Mobiles
|
|||
public class Cow : BaseCreature
|
||||
{
|
||||
public override string CorpseName => "a cow corpse";
|
||||
private DateTime m_MilkedOn;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime MilkedOn
|
||||
{
|
||||
get => m_MilkedOn;
|
||||
set => m_MilkedOn = value;
|
||||
}
|
||||
|
||||
private int m_Milk;
|
||||
public DateTime MilkedOn { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Milk
|
||||
{
|
||||
get => m_Milk;
|
||||
set => m_Milk = value;
|
||||
}
|
||||
public int Milk { get; set; }
|
||||
|
||||
public override string DefaultName => "a cow";
|
||||
|
||||
|
|
@ -93,15 +82,15 @@ namespace Server.Mobiles
|
|||
from.SendLocalizedMessage( 1080400 ); // You can not milk the cow from this location.
|
||||
if ( Controlled && ControlMaster != from )
|
||||
from.SendLocalizedMessage( 1071182 ); // The cow nimbly escapes your attempts to milk it.
|
||||
if ( m_Milk == 0 && m_MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.UtcNow )
|
||||
if ( Milk == 0 && MilkedOn + TimeSpan.FromDays( 1 ) > DateTime.UtcNow )
|
||||
from.SendLocalizedMessage( 1080198 ); // This cow can not be milked now. Please wait for some time.
|
||||
else
|
||||
{
|
||||
if ( m_Milk == 0 )
|
||||
m_Milk = 4;
|
||||
if ( Milk == 0 )
|
||||
Milk = 4;
|
||||
|
||||
m_MilkedOn = DateTime.UtcNow;
|
||||
m_Milk--;
|
||||
MilkedOn = DateTime.UtcNow;
|
||||
Milk--;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -119,8 +108,8 @@ namespace Server.Mobiles
|
|||
|
||||
writer.Write( (int) 1 );
|
||||
|
||||
writer.Write( (DateTime) m_MilkedOn );
|
||||
writer.Write( (int) m_Milk );
|
||||
writer.Write( (DateTime) MilkedOn );
|
||||
writer.Write( (int) Milk );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -131,8 +120,8 @@ namespace Server.Mobiles
|
|||
|
||||
if ( version > 0 )
|
||||
{
|
||||
m_MilkedOn = reader.ReadDateTime();
|
||||
m_Milk = reader.ReadInt();
|
||||
MilkedOn = reader.ReadDateTime();
|
||||
Milk = reader.ReadInt();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,19 +7,13 @@ namespace Server.Mobiles
|
|||
public abstract class BaseMount : BaseCreature, IMount
|
||||
{
|
||||
private Mobile m_Rider;
|
||||
private Item m_InternalItem;
|
||||
private DateTime m_NextMountAbility;
|
||||
|
||||
public virtual TimeSpan MountAbilityDelay => TimeSpan.Zero;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public DateTime NextMountAbility
|
||||
{
|
||||
get => m_NextMountAbility;
|
||||
set => m_NextMountAbility = value;
|
||||
}
|
||||
public DateTime NextMountAbility { get; set; }
|
||||
|
||||
protected Item InternalItem => m_InternalItem;
|
||||
protected Item InternalItem { get; private set; }
|
||||
|
||||
public virtual bool AllowMaleRider => true;
|
||||
public virtual bool AllowFemaleRider => true;
|
||||
|
|
@ -29,7 +23,7 @@ namespace Server.Mobiles
|
|||
Name = name;
|
||||
Body = bodyID;
|
||||
|
||||
m_InternalItem = new MountItem( this, itemID );
|
||||
InternalItem = new MountItem( this, itemID );
|
||||
}
|
||||
|
||||
[Hue, CommandProperty( AccessLevel.GameMaster )]
|
||||
|
|
@ -40,8 +34,8 @@ namespace Server.Mobiles
|
|||
{
|
||||
base.Hue = value;
|
||||
|
||||
if ( m_InternalItem != null )
|
||||
m_InternalItem.Hue = value;
|
||||
if ( InternalItem != null )
|
||||
InternalItem.Hue = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -54,8 +48,8 @@ namespace Server.Mobiles
|
|||
|
||||
public override void OnAfterDelete()
|
||||
{
|
||||
m_InternalItem?.Delete();
|
||||
m_InternalItem = null;
|
||||
InternalItem?.Delete();
|
||||
InternalItem = null;
|
||||
|
||||
base.OnAfterDelete();
|
||||
}
|
||||
|
|
@ -78,10 +72,10 @@ namespace Server.Mobiles
|
|||
|
||||
writer.Write( ( int )1 ); // version
|
||||
|
||||
writer.Write( m_NextMountAbility );
|
||||
writer.Write( NextMountAbility );
|
||||
|
||||
writer.Write( m_Rider );
|
||||
writer.Write( m_InternalItem );
|
||||
writer.Write( InternalItem );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -94,15 +88,15 @@ namespace Server.Mobiles
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_NextMountAbility = reader.ReadDateTime();
|
||||
NextMountAbility = reader.ReadDateTime();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_Rider = reader.ReadMobile();
|
||||
m_InternalItem = reader.ReadItem();
|
||||
InternalItem = reader.ReadItem();
|
||||
|
||||
if ( m_InternalItem == null )
|
||||
if ( InternalItem == null )
|
||||
Delete();
|
||||
|
||||
break;
|
||||
|
|
@ -187,11 +181,11 @@ namespace Server.Mobiles
|
|||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int ItemID
|
||||
{
|
||||
get => m_InternalItem?.ItemID ?? 0;
|
||||
get => InternalItem?.ItemID ?? 0;
|
||||
set
|
||||
{
|
||||
if ( m_InternalItem != null )
|
||||
m_InternalItem.ItemID = value;
|
||||
if ( InternalItem != null )
|
||||
InternalItem.ItemID = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -226,7 +220,7 @@ namespace Server.Mobiles
|
|||
Location = loc;
|
||||
Map = map;
|
||||
|
||||
m_InternalItem?.Internalize();
|
||||
InternalItem?.Internalize();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -237,8 +231,8 @@ namespace Server.Mobiles
|
|||
|
||||
Dismount( value );
|
||||
|
||||
if ( m_InternalItem != null )
|
||||
value.AddItem( m_InternalItem );
|
||||
if ( InternalItem != null )
|
||||
value.AddItem( InternalItem );
|
||||
|
||||
value.Direction = Direction;
|
||||
|
||||
|
|
@ -281,10 +275,10 @@ namespace Server.Mobiles
|
|||
if ( attacker == null )
|
||||
attacker = m_Rider.FindMostRecentDamager( true );
|
||||
|
||||
if ( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < m_NextMountAbility) )
|
||||
if ( !(attacker == this || attacker == m_Rider || willKill || DateTime.UtcNow < NextMountAbility) )
|
||||
{
|
||||
if ( DoMountAbility( amount, from ) )
|
||||
m_NextMountAbility = DateTime.UtcNow + MountAbilityDelay;
|
||||
NextMountAbility = DateTime.UtcNow + MountAbilityDelay;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,15 +10,10 @@ namespace Server.Mobiles
|
|||
private int m_MountedID;
|
||||
private int m_RegularID;
|
||||
private Mobile m_Rider;
|
||||
private bool m_IsRewardItem;
|
||||
private bool m_IsDonationItem;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool IsRewardItem
|
||||
{
|
||||
get => m_IsRewardItem;
|
||||
set => m_IsRewardItem = value;
|
||||
}
|
||||
public bool IsRewardItem { get; set; }
|
||||
|
||||
public override double DefaultWeight => 1.0;
|
||||
|
||||
|
|
@ -51,7 +46,7 @@ namespace Server.Mobiles
|
|||
list.Add( "Donation Ethereal" );
|
||||
list.Add( "7.5 sec slower cast time if not a 9mo. Veteran" );
|
||||
}
|
||||
if ( Core.ML && m_IsRewardItem )
|
||||
if ( Core.ML && IsRewardItem )
|
||||
list.Add( RewardSystem.GetRewardYearLabel( this, new object[] { } ) ); // X Year Veteran Reward
|
||||
}
|
||||
|
||||
|
|
@ -119,7 +114,7 @@ namespace Server.Mobiles
|
|||
return false;
|
||||
}
|
||||
|
||||
if ( m_IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
|
||||
if ( IsRewardItem && !RewardSystem.CheckIsUsableBy( from, this, null ) )
|
||||
{
|
||||
// CheckIsUsableBy sends the message
|
||||
return false;
|
||||
|
|
@ -181,7 +176,7 @@ namespace Server.Mobiles
|
|||
writer.Write( (int)3 ); // version
|
||||
|
||||
writer.Write( m_IsDonationItem );
|
||||
writer.Write( m_IsRewardItem );
|
||||
writer.Write( IsRewardItem );
|
||||
|
||||
writer.Write( (int)m_MountedID );
|
||||
writer.Write( (int)m_RegularID );
|
||||
|
|
@ -204,7 +199,7 @@ namespace Server.Mobiles
|
|||
}
|
||||
case 2:
|
||||
{
|
||||
m_IsRewardItem = reader.ReadBool();
|
||||
IsRewardItem = reader.ReadBool();
|
||||
goto case 0;
|
||||
}
|
||||
case 1: reader.ReadInt(); goto case 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue