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,19 +11,17 @@ namespace Server.Items
|
|||
|
||||
public class CommodityDeed : Item
|
||||
{
|
||||
private Item m_Commodity;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Item Commodity => m_Commodity;
|
||||
public Item Commodity { get; private set; }
|
||||
|
||||
public bool SetCommodity( Item item )
|
||||
{
|
||||
InvalidateProperties();
|
||||
|
||||
if ( m_Commodity == null && (item as ICommodity)?.IsDeedable == true )
|
||||
if ( Commodity == null && (item as ICommodity)?.IsDeedable == true )
|
||||
{
|
||||
m_Commodity = item;
|
||||
m_Commodity.Internalize();
|
||||
Commodity = item;
|
||||
Commodity.Internalize();
|
||||
InvalidateProperties();
|
||||
|
||||
return true;
|
||||
|
|
@ -38,7 +36,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 1 ); // version
|
||||
|
||||
writer.Write( m_Commodity );
|
||||
writer.Write( Commodity );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -47,13 +45,13 @@ namespace Server.Items
|
|||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
m_Commodity = reader.ReadItem();
|
||||
Commodity = reader.ReadItem();
|
||||
|
||||
switch ( version )
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (m_Commodity != null)
|
||||
if (Commodity != null)
|
||||
{
|
||||
Hue = 0x592;
|
||||
}
|
||||
|
|
@ -67,7 +65,7 @@ namespace Server.Items
|
|||
Weight = 1.0;
|
||||
Hue = 0x47;
|
||||
|
||||
m_Commodity = commodity;
|
||||
Commodity = commodity;
|
||||
|
||||
LootType = LootType.Blessed;
|
||||
}
|
||||
|
|
@ -83,26 +81,26 @@ namespace Server.Items
|
|||
|
||||
public override void OnDelete()
|
||||
{
|
||||
m_Commodity?.Delete();
|
||||
Commodity?.Delete();
|
||||
|
||||
base.OnDelete();
|
||||
}
|
||||
|
||||
public override int LabelNumber => m_Commodity == null ? 1047016 : 1047017;
|
||||
public override int LabelNumber => Commodity == null ? 1047016 : 1047017;
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
if ( m_Commodity != null )
|
||||
if ( Commodity != null )
|
||||
{
|
||||
string args;
|
||||
|
||||
if ( m_Commodity.Name == null )
|
||||
if ( Commodity.Name == null )
|
||||
args =
|
||||
$"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}";
|
||||
$"#{((Commodity is ICommodity commodity) ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}";
|
||||
else
|
||||
args = $"{m_Commodity.Name}\t{m_Commodity.Amount}";
|
||||
args = $"{Commodity.Name}\t{Commodity.Amount}";
|
||||
|
||||
list.Add( 1060658, args ); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
|
@ -116,15 +114,15 @@ namespace Server.Items
|
|||
{
|
||||
base.OnSingleClick( from );
|
||||
|
||||
if ( m_Commodity != null )
|
||||
if ( Commodity != null )
|
||||
{
|
||||
string args;
|
||||
|
||||
if ( m_Commodity.Name == null )
|
||||
if ( Commodity.Name == null )
|
||||
args =
|
||||
$"#{((m_Commodity is ICommodity commodity) ? commodity.DescriptionNumber : m_Commodity.LabelNumber)}\t{m_Commodity.Amount}";
|
||||
$"#{((Commodity is ICommodity commodity) ? commodity.DescriptionNumber : Commodity.LabelNumber)}\t{Commodity.Amount}";
|
||||
else
|
||||
args = $"{m_Commodity.Name}\t{m_Commodity.Amount}";
|
||||
args = $"{Commodity.Name}\t{Commodity.Amount}";
|
||||
|
||||
LabelTo( from, 1060658, args ); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
|
@ -138,15 +136,15 @@ namespace Server.Items
|
|||
CommodityDeedBox cox = CommodityDeedBox.Find( this );
|
||||
|
||||
// Veteran Rewards mods
|
||||
if ( m_Commodity != null )
|
||||
if ( Commodity != null )
|
||||
{
|
||||
if ( box != null && IsChildOf( box ) )
|
||||
{
|
||||
number = 1047031; // The commodity has been redeemed.
|
||||
|
||||
box.DropItem( m_Commodity );
|
||||
box.DropItem( Commodity );
|
||||
|
||||
m_Commodity = null;
|
||||
Commodity = null;
|
||||
Delete();
|
||||
}
|
||||
else if ( cox != null )
|
||||
|
|
@ -155,9 +153,9 @@ namespace Server.Items
|
|||
{
|
||||
number = 1047031; // The commodity has been redeemed.
|
||||
|
||||
cox.DropItem( m_Commodity );
|
||||
cox.DropItem( Commodity );
|
||||
|
||||
m_Commodity = null;
|
||||
Commodity = null;
|
||||
Delete();
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -6,14 +6,8 @@ namespace Server.Items
|
|||
{
|
||||
public class NewPlayerTicket : Item
|
||||
{
|
||||
private Mobile m_Owner;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Mobile Owner
|
||||
{
|
||||
get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public Mobile Owner { get; set; }
|
||||
|
||||
public override int LabelNumber => 1062094; // a young player ticket
|
||||
|
||||
|
|
@ -43,7 +37,7 @@ namespace Server.Items
|
|||
|
||||
writer.Write( (int) 0 ); // version
|
||||
|
||||
writer.Write( (Mobile) m_Owner );
|
||||
writer.Write( (Mobile) Owner );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -56,7 +50,7 @@ namespace Server.Items
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_Owner = reader.ReadMobile();
|
||||
Owner = reader.ReadMobile();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -67,7 +61,7 @@ namespace Server.Items
|
|||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( from != m_Owner )
|
||||
if ( from != Owner )
|
||||
{
|
||||
from.SendLocalizedMessage( 501926 ); // This isn't your ticket! Shame on you! You have to use YOUR ticket.
|
||||
}
|
||||
|
|
@ -99,7 +93,7 @@ namespace Server.Items
|
|||
}
|
||||
else if ( targeted is NewPlayerTicket theirTicket )
|
||||
{
|
||||
Mobile them = theirTicket.m_Owner;
|
||||
Mobile them = theirTicket.Owner;
|
||||
|
||||
if ( them == null || them.Deleted )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -13,8 +13,6 @@ namespace Server.Items
|
|||
public override int LabelNumber => 1062332; // a vendor rental contract
|
||||
|
||||
private VendorRentalDuration m_Duration;
|
||||
private int m_Price;
|
||||
private bool m_LandlordRenew;
|
||||
|
||||
private Mobile m_Offeree;
|
||||
private Timer m_OfferExpireTimer;
|
||||
|
|
@ -30,18 +28,10 @@ namespace Server.Items
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Price
|
||||
{
|
||||
get => m_Price;
|
||||
set => m_Price = value;
|
||||
}
|
||||
public int Price { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool LandlordRenew
|
||||
{
|
||||
get => m_LandlordRenew;
|
||||
set => m_LandlordRenew = value;
|
||||
}
|
||||
public bool LandlordRenew { get; set; }
|
||||
|
||||
public Mobile Offeree
|
||||
{
|
||||
|
|
@ -73,7 +63,7 @@ namespace Server.Items
|
|||
Hue = 0x672;
|
||||
|
||||
m_Duration = VendorRentalDuration.Instances[0];
|
||||
m_Price = 1500;
|
||||
Price = 1500;
|
||||
}
|
||||
|
||||
public VendorRentalContract( Serial serial ) : base( serial )
|
||||
|
|
@ -338,8 +328,8 @@ namespace Server.Items
|
|||
|
||||
writer.WriteEncodedInt( m_Duration.ID );
|
||||
|
||||
writer.Write( (int) m_Price );
|
||||
writer.Write( (bool) m_LandlordRenew );
|
||||
writer.Write( (int) Price );
|
||||
writer.Write( (bool) LandlordRenew );
|
||||
}
|
||||
|
||||
public override void Deserialize( GenericReader reader )
|
||||
|
|
@ -354,8 +344,8 @@ namespace Server.Items
|
|||
else
|
||||
m_Duration = VendorRentalDuration.Instances[0];
|
||||
|
||||
m_Price = reader.ReadInt();
|
||||
m_LandlordRenew = reader.ReadBool();
|
||||
Price = reader.ReadInt();
|
||||
LandlordRenew = reader.ReadBool();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue