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
|
|
@ -2,44 +2,23 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBFilter
|
||||
{
|
||||
private int m_Type;
|
||||
private int m_Quality;
|
||||
private int m_Material;
|
||||
private int m_Quantity;
|
||||
|
||||
public bool IsDefault => ( m_Type == 0 && m_Quality == 0 && m_Material == 0 && m_Quantity == 0 );
|
||||
public bool IsDefault => ( Type == 0 && Quality == 0 && Material == 0 && Quantity == 0 );
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_Type = 0;
|
||||
m_Quality = 0;
|
||||
m_Material = 0;
|
||||
m_Quantity = 0;
|
||||
Type = 0;
|
||||
Quality = 0;
|
||||
Material = 0;
|
||||
Quantity = 0;
|
||||
}
|
||||
|
||||
public int Type
|
||||
{
|
||||
get => m_Type;
|
||||
set => m_Type = value;
|
||||
}
|
||||
public int Type { get; set; }
|
||||
|
||||
public int Quality
|
||||
{
|
||||
get => m_Quality;
|
||||
set => m_Quality = value;
|
||||
}
|
||||
public int Quality { get; set; }
|
||||
|
||||
public int Material
|
||||
{
|
||||
get => m_Material;
|
||||
set => m_Material = value;
|
||||
}
|
||||
public int Material { get; set; }
|
||||
|
||||
public int Quantity
|
||||
{
|
||||
get => m_Quantity;
|
||||
set => m_Quantity = value;
|
||||
}
|
||||
public int Quantity { get; set; }
|
||||
|
||||
public BOBFilter()
|
||||
{
|
||||
|
|
@ -53,10 +32,10 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
case 1:
|
||||
{
|
||||
m_Type = reader.ReadEncodedInt();
|
||||
m_Quality = reader.ReadEncodedInt();
|
||||
m_Material = reader.ReadEncodedInt();
|
||||
m_Quantity = reader.ReadEncodedInt();
|
||||
Type = reader.ReadEncodedInt();
|
||||
Quality = reader.ReadEncodedInt();
|
||||
Material = reader.ReadEncodedInt();
|
||||
Quantity = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -73,10 +52,10 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 1 ); // version
|
||||
|
||||
writer.WriteEncodedInt( m_Type );
|
||||
writer.WriteEncodedInt( m_Quality );
|
||||
writer.WriteEncodedInt( m_Material );
|
||||
writer.WriteEncodedInt( m_Quantity );
|
||||
writer.WriteEncodedInt( Type );
|
||||
writer.WriteEncodedInt( Quality );
|
||||
writer.WriteEncodedInt( Material );
|
||||
writer.WriteEncodedInt( Quantity );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,30 +2,26 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBLargeEntry
|
||||
{
|
||||
private bool m_RequireExceptional;
|
||||
private BODType m_DeedType;
|
||||
private BulkMaterialType m_Material;
|
||||
private int m_AmountMax;
|
||||
private int m_Price;
|
||||
private BOBLargeSubEntry[] m_Entries;
|
||||
public bool RequireExceptional { get; }
|
||||
|
||||
public bool RequireExceptional => m_RequireExceptional;
|
||||
public BODType DeedType => m_DeedType;
|
||||
public BulkMaterialType Material => m_Material;
|
||||
public int AmountMax => m_AmountMax;
|
||||
public int Price{ get => m_Price;
|
||||
set => m_Price = value;
|
||||
}
|
||||
public BOBLargeSubEntry[] Entries => m_Entries;
|
||||
public BODType DeedType { get; }
|
||||
|
||||
public BulkMaterialType Material { get; }
|
||||
|
||||
public int AmountMax { get; }
|
||||
|
||||
public int Price { get; set; }
|
||||
|
||||
public BOBLargeSubEntry[] Entries { get; }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
LargeBOD bod = null;
|
||||
|
||||
if ( m_DeedType == BODType.Smith )
|
||||
bod = new LargeSmithBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() );
|
||||
else if ( m_DeedType == BODType.Tailor )
|
||||
bod = new LargeTailorBOD( m_AmountMax, m_RequireExceptional, m_Material, ReconstructEntries() );
|
||||
if ( DeedType == BODType.Smith )
|
||||
bod = new LargeSmithBOD( AmountMax, RequireExceptional, Material, ReconstructEntries() );
|
||||
else if ( DeedType == BODType.Tailor )
|
||||
bod = new LargeTailorBOD( AmountMax, RequireExceptional, Material, ReconstructEntries() );
|
||||
|
||||
for ( int i = 0; bod != null && i < bod.Entries.Length; ++i )
|
||||
bod.Entries[i].Owner = bod;
|
||||
|
|
@ -35,12 +31,12 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
private LargeBulkEntry[] ReconstructEntries()
|
||||
{
|
||||
LargeBulkEntry[] entries = new LargeBulkEntry[m_Entries.Length];
|
||||
LargeBulkEntry[] entries = new LargeBulkEntry[Entries.Length];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
{
|
||||
entries[i] = new LargeBulkEntry( null, new SmallBulkEntry( m_Entries[i].ItemType, m_Entries[i].Number, m_Entries[i].Graphic ) );
|
||||
entries[i].Amount = m_Entries[i].AmountCur;
|
||||
entries[i] = new LargeBulkEntry( null, new SmallBulkEntry( Entries[i].ItemType, Entries[i].Number, Entries[i].Graphic ) );
|
||||
entries[i].Amount = Entries[i].AmountCur;
|
||||
}
|
||||
|
||||
return entries;
|
||||
|
|
@ -48,20 +44,20 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public BOBLargeEntry( LargeBOD bod )
|
||||
{
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
if ( bod is LargeTailorBOD )
|
||||
m_DeedType = BODType.Tailor;
|
||||
DeedType = BODType.Tailor;
|
||||
else if ( bod is LargeSmithBOD )
|
||||
m_DeedType = BODType.Smith;
|
||||
DeedType = BODType.Smith;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
Material = bod.Material;
|
||||
AmountMax = bod.AmountMax;
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||
Entries = new BOBLargeSubEntry[bod.Entries.Length];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new BOBLargeSubEntry( bod.Entries[i] );
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
Entries[i] = new BOBLargeSubEntry( bod.Entries[i] );
|
||||
}
|
||||
|
||||
public BOBLargeEntry( GenericReader reader )
|
||||
|
|
@ -72,18 +68,18 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
case 0:
|
||||
{
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new BOBLargeSubEntry( reader );
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
Entries[i] = new BOBLargeSubEntry( reader );
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -94,17 +90,17 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( (bool) m_RequireExceptional );
|
||||
writer.Write( (bool) RequireExceptional );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_DeedType );
|
||||
writer.WriteEncodedInt( (int) m_Material );
|
||||
writer.WriteEncodedInt( (int) m_AmountMax );
|
||||
writer.WriteEncodedInt( (int) m_Price );
|
||||
writer.WriteEncodedInt( (int) DeedType );
|
||||
writer.WriteEncodedInt( (int) Material );
|
||||
writer.WriteEncodedInt( (int) AmountMax );
|
||||
writer.WriteEncodedInt( (int) Price );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Length );
|
||||
writer.WriteEncodedInt( (int) Entries.Length );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i].Serialize( writer );
|
||||
for ( int i = 0; i < Entries.Length; ++i )
|
||||
Entries[i].Serialize( writer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,22 +4,20 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBLargeSubEntry
|
||||
{
|
||||
private Type m_ItemType;
|
||||
private int m_AmountCur;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
public Type ItemType { get; }
|
||||
|
||||
public Type ItemType => m_ItemType;
|
||||
public int AmountCur => m_AmountCur;
|
||||
public int Number => m_Number;
|
||||
public int Graphic => m_Graphic;
|
||||
public int AmountCur { get; }
|
||||
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic { get; }
|
||||
|
||||
public BOBLargeSubEntry( LargeBulkEntry lbe )
|
||||
{
|
||||
m_ItemType = lbe.Details.Type;
|
||||
m_AmountCur = lbe.Amount;
|
||||
m_Number = lbe.Details.Number;
|
||||
m_Graphic = lbe.Details.Graphic;
|
||||
ItemType = lbe.Details.Type;
|
||||
AmountCur = lbe.Amount;
|
||||
Number = lbe.Details.Number;
|
||||
Graphic = lbe.Details.Graphic;
|
||||
}
|
||||
|
||||
public BOBLargeSubEntry( GenericReader reader )
|
||||
|
|
@ -33,11 +31,11 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -48,11 +46,11 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_ItemType == null ? null : m_ItemType.FullName );
|
||||
writer.Write( ItemType == null ? null : ItemType.FullName );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_AmountCur );
|
||||
writer.WriteEncodedInt( (int) m_Number );
|
||||
writer.WriteEncodedInt( (int) m_Graphic );
|
||||
writer.WriteEncodedInt( (int) AmountCur );
|
||||
writer.WriteEncodedInt( (int) Number );
|
||||
writer.WriteEncodedInt( (int) Graphic );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,54 +4,51 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BOBSmallEntry
|
||||
{
|
||||
private Type m_ItemType;
|
||||
private bool m_RequireExceptional;
|
||||
private BODType m_DeedType;
|
||||
private BulkMaterialType m_Material;
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private int m_Price;
|
||||
public Type ItemType { get; }
|
||||
|
||||
public Type ItemType => m_ItemType;
|
||||
public bool RequireExceptional => m_RequireExceptional;
|
||||
public BODType DeedType => m_DeedType;
|
||||
public BulkMaterialType Material => m_Material;
|
||||
public int AmountCur => m_AmountCur;
|
||||
public int AmountMax => m_AmountMax;
|
||||
public int Number => m_Number;
|
||||
public int Graphic => m_Graphic;
|
||||
public int Price{ get => m_Price;
|
||||
set => m_Price = value;
|
||||
}
|
||||
public bool RequireExceptional { get; }
|
||||
|
||||
public BODType DeedType { get; }
|
||||
|
||||
public BulkMaterialType Material { get; }
|
||||
|
||||
public int AmountCur { get; }
|
||||
|
||||
public int AmountMax { get; }
|
||||
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic { get; }
|
||||
|
||||
public int Price { get; set; }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
SmallBOD bod = null;
|
||||
|
||||
if ( m_DeedType == BODType.Smith )
|
||||
bod = new SmallSmithBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material );
|
||||
else if ( m_DeedType == BODType.Tailor )
|
||||
bod = new SmallTailorBOD( m_AmountCur, m_AmountMax, m_ItemType, m_Number, m_Graphic, m_RequireExceptional, m_Material );
|
||||
if ( DeedType == BODType.Smith )
|
||||
bod = new SmallSmithBOD( AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material );
|
||||
else if ( DeedType == BODType.Tailor )
|
||||
bod = new SmallTailorBOD( AmountCur, AmountMax, ItemType, Number, Graphic, RequireExceptional, Material );
|
||||
|
||||
return bod;
|
||||
}
|
||||
|
||||
public BOBSmallEntry( SmallBOD bod )
|
||||
{
|
||||
m_ItemType = bod.Type;
|
||||
m_RequireExceptional = bod.RequireExceptional;
|
||||
ItemType = bod.Type;
|
||||
RequireExceptional = bod.RequireExceptional;
|
||||
|
||||
if ( bod is SmallTailorBOD )
|
||||
m_DeedType = BODType.Tailor;
|
||||
DeedType = BODType.Tailor;
|
||||
else if ( bod is SmallSmithBOD )
|
||||
m_DeedType = BODType.Smith;
|
||||
DeedType = BODType.Smith;
|
||||
|
||||
m_Material = bod.Material;
|
||||
m_AmountCur = bod.AmountCur;
|
||||
m_AmountMax = bod.AmountMax;
|
||||
m_Number = bod.Number;
|
||||
m_Graphic = bod.Graphic;
|
||||
Material = bod.Material;
|
||||
AmountCur = bod.AmountCur;
|
||||
AmountMax = bod.AmountMax;
|
||||
Number = bod.Number;
|
||||
Graphic = bod.Graphic;
|
||||
}
|
||||
|
||||
public BOBSmallEntry( GenericReader reader )
|
||||
|
|
@ -65,18 +62,18 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
ItemType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
RequireExceptional = reader.ReadBool();
|
||||
|
||||
m_DeedType = (BODType)reader.ReadEncodedInt();
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
m_Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
m_AmountCur = reader.ReadEncodedInt();
|
||||
m_AmountMax = reader.ReadEncodedInt();
|
||||
m_Number = reader.ReadEncodedInt();
|
||||
m_Graphic = reader.ReadEncodedInt();
|
||||
m_Price = reader.ReadEncodedInt();
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
@ -87,17 +84,17 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
|
||||
writer.Write( m_ItemType == null ? null : m_ItemType.FullName );
|
||||
writer.Write( ItemType == null ? null : ItemType.FullName );
|
||||
|
||||
writer.Write( (bool) m_RequireExceptional );
|
||||
writer.Write( (bool) RequireExceptional );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_DeedType );
|
||||
writer.WriteEncodedInt( (int) m_Material );
|
||||
writer.WriteEncodedInt( (int) m_AmountCur );
|
||||
writer.WriteEncodedInt( (int) m_AmountMax );
|
||||
writer.WriteEncodedInt( (int) m_Number );
|
||||
writer.WriteEncodedInt( (int) m_Graphic );
|
||||
writer.WriteEncodedInt( (int) m_Price );
|
||||
writer.WriteEncodedInt( (int) DeedType );
|
||||
writer.WriteEncodedInt( (int) Material );
|
||||
writer.WriteEncodedInt( (int) AmountCur );
|
||||
writer.WriteEncodedInt( (int) AmountMax );
|
||||
writer.WriteEncodedInt( (int) Number );
|
||||
writer.WriteEncodedInt( (int) Graphic );
|
||||
writer.WriteEncodedInt( (int) Price );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -12,11 +12,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BulkOrderBook : Item, ISecurable
|
||||
{
|
||||
private ArrayList m_Entries;
|
||||
private BOBFilter m_Filter;
|
||||
private string m_BookName;
|
||||
private SecureLevel m_Level;
|
||||
private int m_ItemCount;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public string BookName
|
||||
|
|
@ -26,21 +22,13 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public SecureLevel Level
|
||||
{
|
||||
get => m_Level;
|
||||
set => m_Level = value;
|
||||
}
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
public ArrayList Entries => m_Entries;
|
||||
public ArrayList Entries { get; private set; }
|
||||
|
||||
public BOBFilter Filter => m_Filter;
|
||||
public BOBFilter Filter { get; private set; }
|
||||
|
||||
public int ItemCount
|
||||
{
|
||||
get => m_ItemCount;
|
||||
set => m_ItemCount = value;
|
||||
}
|
||||
public int ItemCount { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public BulkOrderBook() : base( 0x2259 )
|
||||
|
|
@ -48,17 +36,17 @@ namespace Server.Engines.BulkOrders
|
|||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
|
||||
m_Entries = new ArrayList();
|
||||
m_Filter = new BOBFilter();
|
||||
Entries = new ArrayList();
|
||||
Filter = new BOBFilter();
|
||||
|
||||
m_Level = SecureLevel.CoOwners;
|
||||
Level = SecureLevel.CoOwners;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
from.LocalOverheadMessage( Network.MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that.
|
||||
else if ( m_Entries.Count == 0 )
|
||||
else if ( Entries.Count == 0 )
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
else if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, this ) );
|
||||
|
|
@ -70,7 +58,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
}
|
||||
else if ( m_Entries.Count == 0 )
|
||||
else if ( Entries.Count == 0 )
|
||||
{
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
}
|
||||
|
|
@ -103,18 +91,18 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
|
||||
return false;
|
||||
if ( m_Entries.Count < 500 )
|
||||
if ( Entries.Count < 500 )
|
||||
{
|
||||
if ( dropped is LargeBOD bod )
|
||||
m_Entries.Add( new BOBLargeEntry( bod ) );
|
||||
Entries.Add( new BOBLargeEntry( bod ) );
|
||||
else
|
||||
m_Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
|
||||
InvalidateProperties();
|
||||
|
||||
if ( m_Entries.Count / 5 > m_ItemCount )
|
||||
if ( Entries.Count / 5 > ItemCount )
|
||||
{
|
||||
m_ItemCount++;
|
||||
ItemCount++;
|
||||
InvalidateItems();
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +130,7 @@ namespace Server.Engines.BulkOrders
|
|||
int total = base.GetTotal( type );
|
||||
|
||||
if ( type == TotalType.Items )
|
||||
total = m_ItemCount;
|
||||
total = ItemCount;
|
||||
|
||||
return total;
|
||||
}
|
||||
|
|
@ -175,19 +163,19 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
writer.Write( (int) 2 ); // version
|
||||
|
||||
writer.Write( (int) m_ItemCount );
|
||||
writer.Write( (int) ItemCount );
|
||||
|
||||
writer.Write( (int) m_Level );
|
||||
writer.Write( (int) Level );
|
||||
|
||||
writer.Write( m_BookName );
|
||||
|
||||
m_Filter.Serialize( writer );
|
||||
Filter.Serialize( writer );
|
||||
|
||||
writer.WriteEncodedInt( (int) m_Entries.Count );
|
||||
writer.WriteEncodedInt( (int) Entries.Count );
|
||||
|
||||
for ( int i = 0; i < m_Entries.Count; ++i )
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
{
|
||||
object obj = m_Entries[i];
|
||||
object obj = Entries[i];
|
||||
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
{
|
||||
|
|
@ -212,23 +200,23 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
case 2:
|
||||
{
|
||||
m_ItemCount = reader.ReadInt();
|
||||
ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
m_Level = (SecureLevel)reader.ReadInt();
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_BookName = reader.ReadString();
|
||||
|
||||
m_Filter = new BOBFilter( reader );
|
||||
Filter = new BOBFilter( reader );
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
m_Entries = new ArrayList( count );
|
||||
Entries = new ArrayList( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
|
|
@ -236,8 +224,8 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
switch ( v )
|
||||
{
|
||||
case 0: m_Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: m_Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
case 0: Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -250,7 +238,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.GetProperties( list );
|
||||
|
||||
list.Add( 1062344, m_Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
|
||||
if ( m_BookName != null && m_BookName.Length > 0 )
|
||||
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
|
||||
|
|
@ -260,7 +248,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
base.OnSingleClick(from);
|
||||
|
||||
LabelTo(from, 1062344, m_Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
LabelTo(from, 1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
|
||||
if (!string.IsNullOrEmpty(m_BookName))
|
||||
LabelTo(from, 1062481, m_BookName);
|
||||
|
|
|
|||
|
|
@ -5,18 +5,15 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class LargeBulkEntry
|
||||
{
|
||||
private LargeBOD m_Owner;
|
||||
private int m_Amount;
|
||||
private SmallBulkEntry m_Details;
|
||||
|
||||
public LargeBOD Owner{ get => m_Owner;
|
||||
set => m_Owner = value;
|
||||
}
|
||||
public LargeBOD Owner { get; set; }
|
||||
|
||||
public int Amount{ get => m_Amount;
|
||||
set{ m_Amount = value;
|
||||
m_Owner?.InvalidateProperties();
|
||||
Owner?.InvalidateProperties();
|
||||
} }
|
||||
public SmallBulkEntry Details => m_Details;
|
||||
public SmallBulkEntry Details { get; }
|
||||
|
||||
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
|
||||
|
||||
|
|
@ -92,13 +89,13 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
|
||||
{
|
||||
m_Owner = owner;
|
||||
m_Details = details;
|
||||
Owner = owner;
|
||||
Details = details;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, GenericReader reader )
|
||||
{
|
||||
m_Owner = owner;
|
||||
Owner = owner;
|
||||
m_Amount = reader.ReadInt();
|
||||
|
||||
Type realType = null;
|
||||
|
|
@ -108,15 +105,15 @@ namespace Server.Engines.BulkOrders
|
|||
if ( type != null )
|
||||
realType = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
}
|
||||
|
||||
public void Serialize( GenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( m_Details.Type == null ? null : m_Details.Type.FullName );
|
||||
writer.Write( m_Details.Number );
|
||||
writer.Write( m_Details.Graphic );
|
||||
writer.Write( Details.Type == null ? null : Details.Type.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,23 +7,21 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public sealed class RewardType
|
||||
{
|
||||
private int m_Points;
|
||||
private Type[] m_Types;
|
||||
public int Points { get; }
|
||||
|
||||
public int Points => m_Points;
|
||||
public Type[] Types => m_Types;
|
||||
public Type[] Types { get; }
|
||||
|
||||
public RewardType( int points, params Type[] types )
|
||||
{
|
||||
m_Points = points;
|
||||
m_Types = types;
|
||||
Points = points;
|
||||
Types = types;
|
||||
}
|
||||
|
||||
public bool Contains( Type type )
|
||||
{
|
||||
for ( int i = 0; i < m_Types.Length; ++i )
|
||||
for ( int i = 0; i < Types.Length; ++i )
|
||||
{
|
||||
if ( m_Types[i] == type )
|
||||
if ( Types[i] == type )
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -33,13 +31,11 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public sealed class RewardItem
|
||||
{
|
||||
private int m_Weight;
|
||||
private ConstructCallback m_Constructor;
|
||||
private int m_Type;
|
||||
public int Weight { get; }
|
||||
|
||||
public int Weight => m_Weight;
|
||||
public ConstructCallback Constructor => m_Constructor;
|
||||
public int Type => m_Type;
|
||||
public ConstructCallback Constructor { get; }
|
||||
|
||||
public int Type { get; }
|
||||
|
||||
public RewardItem( int weight, ConstructCallback constructor ) : this( weight, constructor, 0 )
|
||||
{
|
||||
|
|
@ -47,49 +43,47 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public RewardItem( int weight, ConstructCallback constructor, int type )
|
||||
{
|
||||
m_Weight = weight;
|
||||
m_Constructor = constructor;
|
||||
m_Type = type;
|
||||
Weight = weight;
|
||||
Constructor = constructor;
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public Item Construct()
|
||||
{
|
||||
try{ return m_Constructor( m_Type ); }
|
||||
try{ return Constructor( Type ); }
|
||||
catch{ return null; }
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class RewardGroup
|
||||
{
|
||||
private int m_Points;
|
||||
private RewardItem[] m_Items;
|
||||
public int Points { get; }
|
||||
|
||||
public int Points => m_Points;
|
||||
public RewardItem[] Items => m_Items;
|
||||
public RewardItem[] Items { get; }
|
||||
|
||||
public RewardGroup( int points, params RewardItem[] items )
|
||||
{
|
||||
m_Points = points;
|
||||
m_Items = items;
|
||||
Points = points;
|
||||
Items = items;
|
||||
}
|
||||
|
||||
public RewardItem AcquireItem()
|
||||
{
|
||||
if ( m_Items.Length == 0 )
|
||||
if ( Items.Length == 0 )
|
||||
return null;
|
||||
if ( m_Items.Length == 1 )
|
||||
return m_Items[0];
|
||||
if ( Items.Length == 1 )
|
||||
return Items[0];
|
||||
|
||||
int totalWeight = 0;
|
||||
|
||||
for ( int i = 0; i < m_Items.Length; ++i )
|
||||
totalWeight += m_Items[i].Weight;
|
||||
for ( int i = 0; i < Items.Length; ++i )
|
||||
totalWeight += Items[i].Weight;
|
||||
|
||||
int randomWeight = Utility.Random( totalWeight );
|
||||
|
||||
for ( int i = 0; i < m_Items.Length; ++i )
|
||||
for ( int i = 0; i < Items.Length; ++i )
|
||||
{
|
||||
RewardItem item = m_Items[i];
|
||||
RewardItem item = Items[i];
|
||||
|
||||
if ( randomWeight < item.Weight )
|
||||
return item;
|
||||
|
|
@ -103,11 +97,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public abstract class RewardCalculator
|
||||
{
|
||||
private RewardGroup[] m_Groups;
|
||||
|
||||
public RewardGroup[] Groups{ get => m_Groups;
|
||||
set => m_Groups = value;
|
||||
}
|
||||
public RewardGroup[] Groups { get; set; }
|
||||
|
||||
public abstract int ComputePoints( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type );
|
||||
public abstract int ComputeGold( int quantity, bool exceptional, BulkMaterialType material, int itemCount, Type type );
|
||||
|
|
@ -148,15 +138,15 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public virtual RewardGroup LookupRewards( int points )
|
||||
{
|
||||
for ( int i = m_Groups.Length - 1; i >= 1; --i )
|
||||
for ( int i = Groups.Length - 1; i >= 1; --i )
|
||||
{
|
||||
RewardGroup group = m_Groups[i];
|
||||
RewardGroup group = Groups[i];
|
||||
|
||||
if ( points >= group.Points )
|
||||
return group;
|
||||
}
|
||||
|
||||
return m_Groups[0];
|
||||
return Groups[0];
|
||||
}
|
||||
|
||||
public virtual int LookupTypePoints( RewardType[] types, Type type )
|
||||
|
|
|
|||
|
|
@ -9,9 +9,7 @@ namespace Server.Engines.BulkOrders
|
|||
public abstract class SmallBOD : Item
|
||||
{
|
||||
private int m_AmountCur, m_AmountMax;
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
private bool m_RequireExceptional;
|
||||
private BulkMaterialType m_Material;
|
||||
|
||||
|
|
@ -24,18 +22,14 @@ namespace Server.Engines.BulkOrders
|
|||
set{ m_AmountMax = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public Type Type{ get => m_Type;
|
||||
set => m_Type = value;
|
||||
}
|
||||
public Type Type { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Number{ get => m_Number;
|
||||
set{ m_Number = value; InvalidateProperties(); } }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public int Graphic{ get => m_Graphic;
|
||||
set => m_Graphic = value;
|
||||
}
|
||||
public int Graphic { get; set; }
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
public bool RequireExceptional{ get => m_RequireExceptional;
|
||||
|
|
@ -58,9 +52,9 @@ namespace Server.Engines.BulkOrders
|
|||
LootType = LootType.Blessed;
|
||||
|
||||
m_AmountMax = amountMax;
|
||||
m_Type = type;
|
||||
Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
Graphic = graphic;
|
||||
m_RequireExceptional = requireExeptional;
|
||||
m_Material = material;
|
||||
}
|
||||
|
|
@ -182,7 +176,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
from.SendLocalizedMessage( 1045166 ); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else if ( m_Type == null || (objectType != m_Type && !objectType.IsSubclassOf( m_Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) )
|
||||
else if ( Type == null || (objectType != Type && !objectType.IsSubclassOf( Type )) || (!(item is BaseWeapon) && !(item is BaseArmor) && !(item is BaseClothing)) )
|
||||
{
|
||||
from.SendLocalizedMessage( 1045169 ); // The item is not in the request.
|
||||
}
|
||||
|
|
@ -249,9 +243,9 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
writer.Write( m_AmountCur );
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_Type == null ? null : m_Type.FullName );
|
||||
writer.Write( Type == null ? null : Type.FullName );
|
||||
writer.Write( m_Number );
|
||||
writer.Write( m_Graphic );
|
||||
writer.Write( Graphic );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
}
|
||||
|
|
@ -272,10 +266,10 @@ namespace Server.Engines.BulkOrders
|
|||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
m_Type = ScriptCompiler.FindTypeByFullName( type );
|
||||
Type = ScriptCompiler.FindTypeByFullName( type );
|
||||
|
||||
m_Number = reader.ReadInt();
|
||||
m_Graphic = reader.ReadInt();
|
||||
Graphic = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
|
||||
|
|
|
|||
|
|
@ -6,19 +6,17 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class SmallBulkEntry
|
||||
{
|
||||
private Type m_Type;
|
||||
private int m_Number;
|
||||
private int m_Graphic;
|
||||
public Type Type { get; }
|
||||
|
||||
public Type Type => m_Type;
|
||||
public int Number => m_Number;
|
||||
public int Graphic => m_Graphic;
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic { get; }
|
||||
|
||||
public SmallBulkEntry( Type type, int number, int graphic )
|
||||
{
|
||||
m_Type = type;
|
||||
m_Number = number;
|
||||
m_Graphic = graphic;
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue