Adds style cop (#109)
This commit is contained in:
parent
3e715bcb60
commit
556a17aba8
1725 changed files with 33831 additions and 38046 deletions
|
|
@ -4,7 +4,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BODTarget : Target
|
||||
{
|
||||
private BaseBOD m_Deed;
|
||||
private readonly BaseBOD m_Deed;
|
||||
|
||||
public BODTarget(BaseBOD deed) : base(18, false, TargetFlags.None) => m_Deed = deed;
|
||||
|
||||
|
|
@ -15,7 +15,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
if (!(targeted is Item item && item.IsChildOf(from.Backpack)))
|
||||
{
|
||||
from.SendLocalizedMessage( 1045158 ); // You must have the item in your backpack to target it.
|
||||
from.SendLocalizedMessage(1045158); // You must have the item in your backpack to target it.
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
double random = Utility.RandomDouble();
|
||||
|
||||
for ( int i = 0; i < chances.Length; ++i )
|
||||
for (int i = 0; i < chances.Length; ++i)
|
||||
{
|
||||
if ( random < chances[i] )
|
||||
if (random < chances[i])
|
||||
return i == 0 ? BulkMaterialType.None : start + (i - 1);
|
||||
|
||||
random -= chances[i];
|
||||
|
|
@ -41,30 +41,30 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
}
|
||||
|
||||
public abstract bool Complete{ get; }
|
||||
public abstract bool Complete { get; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public sealed override int Hue{ get; set; }
|
||||
public sealed override int Hue { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int AmountMax
|
||||
{
|
||||
get => m_AmountMax;
|
||||
set{ m_AmountMax = value; InvalidateProperties(); }
|
||||
set { m_AmountMax = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public bool RequireExceptional
|
||||
{
|
||||
get => m_RequireExceptional;
|
||||
set{ m_RequireExceptional = value; InvalidateProperties(); }
|
||||
set { m_RequireExceptional = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public BulkMaterialType Material
|
||||
{
|
||||
get => m_Material;
|
||||
set{ m_Material = value; InvalidateProperties(); }
|
||||
set { m_Material = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
public abstract RewardGroup GetRewardGroup();
|
||||
|
|
@ -118,35 +118,35 @@ namespace Server.Engines.BulkOrders
|
|||
from.Target = new BODTarget(this);
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer )
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize( writer );
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write( m_AmountMax );
|
||||
writer.Write( m_RequireExceptional );
|
||||
writer.Write( (int) m_Material );
|
||||
writer.Write(m_AmountMax);
|
||||
writer.Write(m_RequireExceptional);
|
||||
writer.Write((int)m_Material);
|
||||
}
|
||||
|
||||
public override void Deserialize( IGenericReader reader )
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_AmountMax = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
{
|
||||
m_AmountMax = reader.ReadInt();
|
||||
m_RequireExceptional = reader.ReadBool();
|
||||
m_Material = (BulkMaterialType)reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( Parent == null && Map == Map.Internal && Location == Point3D.Zero )
|
||||
if (Parent == null && Map == Map.Internal && Location == Point3D.Zero)
|
||||
Delete();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,26 +13,26 @@ namespace Server.Engines.BulkOrders
|
|||
switch (version)
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
Type = reader.ReadEncodedInt();
|
||||
Quality = reader.ReadEncodedInt();
|
||||
Material = reader.ReadEncodedInt();
|
||||
Quantity = reader.ReadEncodedInt();
|
||||
{
|
||||
Type = reader.ReadEncodedInt();
|
||||
Quality = reader.ReadEncodedInt();
|
||||
Material = reader.ReadEncodedInt();
|
||||
Quantity = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsDefault => Type == 0 && Quality == 0 && Material == 0 && Quantity == 0;
|
||||
|
||||
public int Type{ get; set; }
|
||||
public int Type { get; set; }
|
||||
|
||||
public int Quality{ get; set; }
|
||||
public int Quality { get; set; }
|
||||
|
||||
public int Material{ get; set; }
|
||||
public int Material { get; set; }
|
||||
|
||||
public int Quantity{ get; set; }
|
||||
public int Quantity { get; set; }
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
private const int LabelColor = 0x7FFF;
|
||||
|
||||
private static int[,] m_MaterialFilters =
|
||||
private static readonly int[,] m_MaterialFilters =
|
||||
{
|
||||
{ 1044067, 1 }, // Blacksmithy
|
||||
{ 1062226, 3 }, // Iron
|
||||
|
|
@ -16,14 +16,12 @@ namespace Server.Engines.BulkOrders
|
|||
{ 1018333, 5 }, // Shadow Iron
|
||||
{ 1018334, 6 }, // Copper
|
||||
{ 1018335, 7 }, // Bronze
|
||||
|
||||
{ 0, 0 }, // --Blank--
|
||||
{ 1018336, 8 }, // Golden
|
||||
{ 1018337, 9 }, // Agapite
|
||||
{ 1018338, 10 }, // Verite
|
||||
{ 1018339, 11 }, // Valorite
|
||||
{ 0, 0 }, // --Blank--
|
||||
|
||||
{ 1044094, 2 }, // Tailoring
|
||||
{ 1044286, 12 }, // Cloth
|
||||
{ 1062235, 13 }, // Leather
|
||||
|
|
@ -32,21 +30,21 @@ namespace Server.Engines.BulkOrders
|
|||
{ 1062238, 16 } // Barbed
|
||||
};
|
||||
|
||||
private static int[,] m_TypeFilters =
|
||||
private static readonly int[,] m_TypeFilters =
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1062224, 1 }, // Small
|
||||
{ 1062225, 2 } // Large
|
||||
};
|
||||
|
||||
private static int[,] m_QualityFilters =
|
||||
private static readonly int[,] m_QualityFilters =
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1011542, 1 }, // Normal
|
||||
{ 1060636, 2 } // Exceptional
|
||||
};
|
||||
|
||||
private static int[,] m_AmountFilters =
|
||||
private static readonly int[,] m_AmountFilters =
|
||||
{
|
||||
{ 1062229, 0 }, // All
|
||||
{ 1049706, 1 }, // 10
|
||||
|
|
@ -54,7 +52,7 @@ namespace Server.Engines.BulkOrders
|
|||
{ 1062239, 3 } // 20
|
||||
};
|
||||
|
||||
private static int[][,] m_Filters =
|
||||
private static readonly int[][,] m_Filters =
|
||||
{
|
||||
m_TypeFilters,
|
||||
m_QualityFilters,
|
||||
|
|
@ -62,15 +60,15 @@ namespace Server.Engines.BulkOrders
|
|||
m_AmountFilters
|
||||
};
|
||||
|
||||
private static int[] m_XOffsets_Type = { 0, 75, 170 };
|
||||
private static int[] m_XOffsets_Quality = { 0, 75, 170 };
|
||||
private static int[] m_XOffsets_Amount = { 0, 75, 180, 275 };
|
||||
private static int[] m_XOffsets_Material = { 0, 105, 210, 305, 390, 485 };
|
||||
private static readonly int[] m_XOffsets_Type = { 0, 75, 170 };
|
||||
private static readonly int[] m_XOffsets_Quality = { 0, 75, 170 };
|
||||
private static readonly int[] m_XOffsets_Amount = { 0, 75, 180, 275 };
|
||||
private static readonly int[] m_XOffsets_Material = { 0, 105, 210, 305, 390, 485 };
|
||||
|
||||
private static int[] m_XWidths_Small = { 50, 50, 70, 50 };
|
||||
private static int[] m_XWidths_Large = { 80, 50, 50, 50, 50, 50 };
|
||||
private BulkOrderBook m_Book;
|
||||
private PlayerMobile m_From;
|
||||
private static readonly int[] m_XWidths_Small = { 50, 50, 70, 50 };
|
||||
private static readonly int[] m_XWidths_Large = { 80, 50, 50, 50, 50, 50 };
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly PlayerMobile m_From;
|
||||
|
||||
public BOBFilterGump(PlayerMobile from, BulkOrderBook book) : base(12, 24)
|
||||
{
|
||||
|
|
@ -132,7 +130,7 @@ namespace Server.Engines.BulkOrders
|
|||
continue;
|
||||
|
||||
bool isSelected = filters[i, 1] == filterValue ||
|
||||
i % xOffsets.Length == 0 && filterValue == 0;
|
||||
(i % xOffsets.Length == 0 && filterValue == 0);
|
||||
|
||||
AddHtmlLocalized(x + 35 + xOffsets[i % xOffsets.Length], y + i / xOffsets.Length * yOffset,
|
||||
xWidths[i % xOffsets.Length], 32, number, isSelected ? 16927 : LabelColor);
|
||||
|
|
@ -150,70 +148,70 @@ namespace Server.Engines.BulkOrders
|
|||
switch (index)
|
||||
{
|
||||
case 0: // Apply
|
||||
{
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 1: // Set Book Filter
|
||||
{
|
||||
m_From.UseOwnFilter = false;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 2: // Set Your Filter
|
||||
{
|
||||
m_From.UseOwnFilter = true;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Clear Filter
|
||||
{
|
||||
f.Clear();
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
index -= 4;
|
||||
|
||||
int type = index % 4;
|
||||
index /= 4;
|
||||
|
||||
if (type >= 0 && type < m_Filters.Length)
|
||||
{
|
||||
int[,] filters = m_Filters[type];
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book));
|
||||
|
||||
if (index >= 0 && index < filters.GetLength(0))
|
||||
{
|
||||
if (filters[index, 0] == 0)
|
||||
break;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
f.Type = filters[index, 1];
|
||||
break;
|
||||
case 1:
|
||||
f.Quality = filters[index, 1];
|
||||
break;
|
||||
case 2:
|
||||
f.Material = filters[index, 1];
|
||||
break;
|
||||
case 3:
|
||||
f.Quantity = filters[index, 1];
|
||||
break;
|
||||
}
|
||||
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: // Set Book Filter
|
||||
{
|
||||
m_From.UseOwnFilter = false;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Set Your Filter
|
||||
{
|
||||
m_From.UseOwnFilter = true;
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
case 3: // Clear Filter
|
||||
{
|
||||
f.Clear();
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
index -= 4;
|
||||
|
||||
int type = index % 4;
|
||||
index /= 4;
|
||||
|
||||
if (type >= 0 && type < m_Filters.Length)
|
||||
{
|
||||
int[,] filters = m_Filters[type];
|
||||
|
||||
if (index >= 0 && index < filters.GetLength(0))
|
||||
{
|
||||
if (filters[index, 0] == 0)
|
||||
break;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case 0:
|
||||
f.Type = filters[index, 1];
|
||||
break;
|
||||
case 1:
|
||||
f.Quality = filters[index, 1];
|
||||
break;
|
||||
case 2:
|
||||
f.Material = filters[index, 1];
|
||||
break;
|
||||
case 3:
|
||||
f.Quantity = filters[index, 1];
|
||||
break;
|
||||
}
|
||||
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,9 @@ namespace Server.Engines.BulkOrders
|
|||
public class BOBGump : Gump
|
||||
{
|
||||
private const int LabelColor = 0x7FFF;
|
||||
private BulkOrderBook m_Book;
|
||||
private PlayerMobile m_From;
|
||||
private List<IBOBEntry> m_List;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly List<IBOBEntry> m_List;
|
||||
|
||||
private int m_Page;
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||
|
||||
if (canDrop || canBuy && entry.Price > 0)
|
||||
if (canDrop || (canBuy && entry.Price > 0))
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
|
||||
AddLabel(495, y, 1152, entry.Price.ToString());
|
||||
|
|
@ -214,7 +214,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (canDrop)
|
||||
AddButton(35, y + 2, 5602, 5606, 5 + i * 2);
|
||||
|
||||
if (canDrop || canBuy && smallEntry.Price > 0)
|
||||
if (canDrop || (canBuy && smallEntry.Price > 0))
|
||||
{
|
||||
AddButton(579, y + 2, 2117, 2118, 6 + i * 2);
|
||||
AddLabel(495, y, 1152, smallEntry.Price.ToString());
|
||||
|
|
@ -281,22 +281,22 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
return f.Material switch
|
||||
{
|
||||
1 => (deedType == BODType.Smith),
|
||||
2 => (deedType == BODType.Tailor),
|
||||
3 => (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Iron),
|
||||
4 => (mat == BulkMaterialType.DullCopper),
|
||||
5 => (mat == BulkMaterialType.ShadowIron),
|
||||
6 => (mat == BulkMaterialType.Copper),
|
||||
7 => (mat == BulkMaterialType.Bronze),
|
||||
8 => (mat == BulkMaterialType.Gold),
|
||||
9 => (mat == BulkMaterialType.Agapite),
|
||||
10 => (mat == BulkMaterialType.Verite),
|
||||
11 => (mat == BulkMaterialType.Valorite),
|
||||
12 => (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Cloth),
|
||||
13 => (mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather),
|
||||
14 => (mat == BulkMaterialType.Spined),
|
||||
15 => (mat == BulkMaterialType.Horned),
|
||||
16 => (mat == BulkMaterialType.Barbed),
|
||||
1 => deedType == BODType.Smith,
|
||||
2 => deedType == BODType.Tailor,
|
||||
3 => mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Iron,
|
||||
4 => mat == BulkMaterialType.DullCopper,
|
||||
5 => mat == BulkMaterialType.ShadowIron,
|
||||
6 => mat == BulkMaterialType.Copper,
|
||||
7 => mat == BulkMaterialType.Bronze,
|
||||
8 => mat == BulkMaterialType.Gold,
|
||||
9 => mat == BulkMaterialType.Agapite,
|
||||
10 => mat == BulkMaterialType.Verite,
|
||||
11 => mat == BulkMaterialType.Valorite,
|
||||
12 => mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Cloth,
|
||||
13 => mat == BulkMaterialType.None && BGTClassifier.Classify(deedType, itemType) == BulkGenericType.Leather,
|
||||
14 => mat == BulkMaterialType.Spined,
|
||||
15 => mat == BulkMaterialType.Horned,
|
||||
16 => mat == BulkMaterialType.Barbed,
|
||||
_ => true
|
||||
};
|
||||
}
|
||||
|
|
@ -391,46 +391,45 @@ namespace Server.Engines.BulkOrders
|
|||
return page;
|
||||
}
|
||||
|
||||
|
||||
public object GetMaterialName(BulkMaterialType mat, BODType type, Type itemType)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case BODType.Smith:
|
||||
{
|
||||
switch (mat)
|
||||
{
|
||||
case BulkMaterialType.None: return 1062226;
|
||||
case BulkMaterialType.DullCopper: return 1018332;
|
||||
case BulkMaterialType.ShadowIron: return 1018333;
|
||||
case BulkMaterialType.Copper: return 1018334;
|
||||
case BulkMaterialType.Bronze: return 1018335;
|
||||
case BulkMaterialType.Gold: return 1018336;
|
||||
case BulkMaterialType.Agapite: return 1018337;
|
||||
case BulkMaterialType.Verite: return 1018338;
|
||||
case BulkMaterialType.Valorite: return 1018339;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case BODType.Tailor:
|
||||
{
|
||||
switch (mat)
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
switch (mat)
|
||||
{
|
||||
if (itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||
return 1062235;
|
||||
|
||||
return 1044286;
|
||||
case BulkMaterialType.None: return 1062226;
|
||||
case BulkMaterialType.DullCopper: return 1018332;
|
||||
case BulkMaterialType.ShadowIron: return 1018333;
|
||||
case BulkMaterialType.Copper: return 1018334;
|
||||
case BulkMaterialType.Bronze: return 1018335;
|
||||
case BulkMaterialType.Gold: return 1018336;
|
||||
case BulkMaterialType.Agapite: return 1018337;
|
||||
case BulkMaterialType.Verite: return 1018338;
|
||||
case BulkMaterialType.Valorite: return 1018339;
|
||||
}
|
||||
case BulkMaterialType.Spined: return 1062236;
|
||||
case BulkMaterialType.Horned: return 1062237;
|
||||
case BulkMaterialType.Barbed: return 1062238;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case BODType.Tailor:
|
||||
{
|
||||
switch (mat)
|
||||
{
|
||||
case BulkMaterialType.None:
|
||||
{
|
||||
if (itemType.IsSubclassOf(typeof(BaseArmor)) || itemType.IsSubclassOf(typeof(BaseShoes)))
|
||||
return 1062235;
|
||||
|
||||
return 1044286;
|
||||
}
|
||||
case BulkMaterialType.Spined: return 1062236;
|
||||
case BulkMaterialType.Horned: return 1062237;
|
||||
case BulkMaterialType.Barbed: return 1062238;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return "Invalid";
|
||||
|
|
@ -443,148 +442,148 @@ namespace Server.Engines.BulkOrders
|
|||
switch (index)
|
||||
{
|
||||
case 0: // EXIT
|
||||
{
|
||||
break;
|
||||
}
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1: // Set Filter
|
||||
{
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
{
|
||||
m_From.SendGump(new BOBFilterGump(m_From, m_Book));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // Previous page
|
||||
{
|
||||
if (m_Page > 0)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
|
||||
{
|
||||
if (m_Page > 0)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page - 1, m_List));
|
||||
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
case 3: // Next page
|
||||
{
|
||||
if (GetIndexForPage(m_Page + 1) < m_List.Count)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
|
||||
{
|
||||
if (GetIndexForPage(m_Page + 1) < m_List.Count)
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page + 1, m_List));
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: // Price all
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt(m_Book, null, m_Page, m_List);
|
||||
m_From.SendMessage("Type in a price for all deeds in the book:");
|
||||
}
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt(m_Book, null, m_Page, m_List);
|
||||
m_From.SendMessage("Type in a price for all deeds in the book:");
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
index -= 5;
|
||||
|
||||
int type = index % 2;
|
||||
index /= 2;
|
||||
|
||||
if (index < 0 || index >= m_List.Count)
|
||||
break;
|
||||
|
||||
IBOBEntry bobEntry = m_List[index];
|
||||
|
||||
if (!m_Book.Entries.Contains(bobEntry))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
break;
|
||||
}
|
||||
index -= 5;
|
||||
|
||||
if (type == 0) // Drop
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
int type = index % 2;
|
||||
index /= 2;
|
||||
|
||||
if (index < 0 || index >= m_List.Count)
|
||||
break;
|
||||
|
||||
IBOBEntry bobEntry = m_List[index];
|
||||
|
||||
if (!m_Book.Entries.Contains(bobEntry))
|
||||
{
|
||||
Item item = bobEntry.Reconstruct();
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
if (pack?.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight) != true)
|
||||
{
|
||||
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry entry ? entry.Entries.Length : 1;
|
||||
|
||||
m_From.AddToBackpack(item);
|
||||
m_From.SendLocalizedMessage(
|
||||
1045152); // The bulk order deed has been placed in your backpack.
|
||||
m_Book.Entries.Remove(bobEntry);
|
||||
m_Book.InvalidateProperties();
|
||||
|
||||
if (m_Book.Entries.Count / 5 < m_Book.ItemCount)
|
||||
{
|
||||
m_Book.ItemCount--;
|
||||
m_Book.InvalidateItems();
|
||||
}
|
||||
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
}
|
||||
}
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
break;
|
||||
}
|
||||
}
|
||||
else // Set Price | Buy
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
|
||||
if (type == 0) // Drop
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt(m_Book, bobEntry, m_Page, m_List);
|
||||
m_From.SendLocalizedMessage(1062383); // Type in a price for the deed:
|
||||
}
|
||||
else if (m_Book.RootParent is PlayerVendor pv)
|
||||
{
|
||||
VendorItem vi = pv.GetVendorItem(m_Book);
|
||||
|
||||
if (vi?.IsForSale != false)
|
||||
return;
|
||||
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||
int price = bobEntry.Price;
|
||||
|
||||
if (price == 0)
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
Item item = bobEntry.Reconstruct();
|
||||
|
||||
Container pack = m_From.Backpack;
|
||||
if (pack?.CheckHold(m_From, item, true, true, 0,
|
||||
item.PileWeight + item.TotalWeight) != true)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
|
||||
m_From.SendLocalizedMessage(503204); // You do not have room in your backpack for this
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry entry ? entry.Entries.Length : 1;
|
||||
|
||||
m_From.AddToBackpack(item);
|
||||
m_From.SendLocalizedMessage(
|
||||
1045152); // The bulk order deed has been placed in your backpack.
|
||||
m_Book.Entries.Remove(bobEntry);
|
||||
m_Book.InvalidateProperties();
|
||||
|
||||
if (m_Book.Entries.Count / 5 < m_Book.ItemCount)
|
||||
{
|
||||
m_Book.ItemCount--;
|
||||
m_Book.InvalidateItems();
|
||||
}
|
||||
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BOBGump(m_From, m_Book, m_Page));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else // Set Price | Buy
|
||||
{
|
||||
if (m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.Prompt = new SetPricePrompt(m_Book, bobEntry, m_Page, m_List);
|
||||
m_From.SendLocalizedMessage(1062383); // Type in a price for the deed:
|
||||
}
|
||||
else if (m_Book.RootParent is PlayerVendor pv)
|
||||
{
|
||||
VendorItem vi = pv.GetVendorItem(m_Book);
|
||||
|
||||
break;
|
||||
}
|
||||
if (vi?.IsForSale != false)
|
||||
return;
|
||||
|
||||
int sizeOfDroppedBod = bobEntry is BOBLargeEntry largeEntry ? largeEntry.Entries.Length : 1;
|
||||
int price = bobEntry.Price;
|
||||
|
||||
if (price == 0)
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062382); // The deed selected is not available.
|
||||
}
|
||||
else
|
||||
{
|
||||
if (m_Book.Entries.Count > 0)
|
||||
{
|
||||
m_Page = GetPageForIndex(index, sizeOfDroppedBod);
|
||||
m_From.SendGump(new BODBuyGump(m_From, m_Book, bobEntry, m_Page, price));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_From.SendLocalizedMessage(1062381); // The book is emptz
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class SetPricePrompt : Prompt
|
||||
{
|
||||
private BulkOrderBook m_Book;
|
||||
private List<IBOBEntry> m_List;
|
||||
private IBOBEntry m_Entry;
|
||||
private int m_Page;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly List<IBOBEntry> m_List;
|
||||
private readonly IBOBEntry m_Entry;
|
||||
private readonly int m_Page;
|
||||
|
||||
public SetPricePrompt(BulkOrderBook book, IBOBEntry entry, int page, List<IBOBEntry> list)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
namespace Server.Engines.BulkOrders
|
||||
{
|
||||
public class BOBLargeEntry: IBOBEntry
|
||||
public class BOBLargeEntry : IBOBEntry
|
||||
{
|
||||
public BOBLargeEntry(LargeBOD bod)
|
||||
{
|
||||
|
|
@ -27,36 +27,36 @@ namespace Server.Engines.BulkOrders
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
RequireExceptional = reader.ReadBool();
|
||||
{
|
||||
RequireExceptional = reader.ReadBool();
|
||||
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
|
||||
Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
Entries = new BOBLargeSubEntry[reader.ReadEncodedInt()];
|
||||
|
||||
for (int i = 0; i < Entries.Length; ++i)
|
||||
Entries[i] = new BOBLargeSubEntry(reader);
|
||||
for (int i = 0; i < Entries.Length; ++i)
|
||||
Entries[i] = new BOBLargeSubEntry(reader);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool RequireExceptional{ get; }
|
||||
public bool RequireExceptional { get; }
|
||||
|
||||
public BODType DeedType{ get; }
|
||||
public BODType DeedType { get; }
|
||||
|
||||
public BulkMaterialType Material{ get; }
|
||||
public BulkMaterialType Material { get; }
|
||||
|
||||
public int AmountMax{ get; }
|
||||
public int AmountMax { get; }
|
||||
|
||||
public int Price{ get; set; }
|
||||
public int Price { get; set; }
|
||||
|
||||
public BOBLargeSubEntry[] Entries{ get; }
|
||||
public BOBLargeSubEntry[] Entries { get; }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
|
|
@ -79,7 +79,8 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
for (int i = 0; i < Entries.Length; ++i)
|
||||
entries[i] = new LargeBulkEntry(null,
|
||||
new SmallBulkEntry(Entries[i].ItemType, Entries[i].Number, Entries[i].Graphic)) { Amount = Entries[i].AmountCur };
|
||||
new SmallBulkEntry(Entries[i].ItemType, Entries[i].Number, Entries[i].Graphic))
|
||||
{ Amount = Entries[i].AmountCur };
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,28 +19,28 @@ namespace Server.Engines.BulkOrders
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||
if (type != null)
|
||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Type ItemType{ get; }
|
||||
public Type ItemType { get; }
|
||||
|
||||
public int AmountCur{ get; }
|
||||
public int AmountCur { get; }
|
||||
|
||||
public int Number{ get; }
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic{ get; }
|
||||
public int Graphic { get; }
|
||||
|
||||
public void Serialize(IGenericWriter writer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -28,45 +28,45 @@ namespace Server.Engines.BulkOrders
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
{
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||
if (type != null)
|
||||
ItemType = AssemblyHandler.FindFirstTypeForName(type);
|
||||
|
||||
RequireExceptional = reader.ReadBool();
|
||||
RequireExceptional = reader.ReadBool();
|
||||
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
DeedType = (BODType)reader.ReadEncodedInt();
|
||||
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
Material = (BulkMaterialType)reader.ReadEncodedInt();
|
||||
AmountCur = reader.ReadEncodedInt();
|
||||
AmountMax = reader.ReadEncodedInt();
|
||||
Number = reader.ReadEncodedInt();
|
||||
Graphic = reader.ReadEncodedInt();
|
||||
Price = reader.ReadEncodedInt();
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Type ItemType{ get; }
|
||||
public Type ItemType { get; }
|
||||
|
||||
public bool RequireExceptional{ get; }
|
||||
public bool RequireExceptional { get; }
|
||||
|
||||
public BODType DeedType{ get; }
|
||||
public BODType DeedType { get; }
|
||||
|
||||
public BulkMaterialType Material{ get; }
|
||||
public BulkMaterialType Material { get; }
|
||||
|
||||
public int AmountCur{ get; }
|
||||
public int AmountCur { get; }
|
||||
|
||||
public int AmountMax{ get; }
|
||||
public int AmountMax { get; }
|
||||
|
||||
public int Number{ get; }
|
||||
public int Number { get; }
|
||||
|
||||
public int Graphic{ get; }
|
||||
public int Graphic { get; }
|
||||
|
||||
public int Price{ get; set; }
|
||||
public int Price { get; set; }
|
||||
|
||||
public Item Reconstruct()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class BODBuyGump : Gump
|
||||
{
|
||||
private BulkOrderBook m_Book;
|
||||
private PlayerMobile m_From;
|
||||
private IBOBEntry m_Entry;
|
||||
private int m_Page;
|
||||
private int m_Price;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
private readonly PlayerMobile m_From;
|
||||
private readonly IBOBEntry m_Entry;
|
||||
private readonly int m_Page;
|
||||
private readonly int m_Price;
|
||||
|
||||
public BODBuyGump(PlayerMobile from, BulkOrderBook book, IBOBEntry entry, int page, int price) : base(100, 200)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,14 +12,14 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
private string m_BookName;
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public string BookName
|
||||
{
|
||||
get => m_BookName;
|
||||
set{ m_BookName = value; InvalidateProperties(); }
|
||||
set { m_BookName = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public SecureLevel Level { get; set; }
|
||||
|
||||
public List<IBOBEntry> Entries { get; private set; }
|
||||
|
|
@ -29,7 +29,7 @@ namespace Server.Engines.BulkOrders
|
|||
public int ItemCount { get; set; }
|
||||
|
||||
[Constructible]
|
||||
public BulkOrderBook() : base( 0x2259 )
|
||||
public BulkOrderBook() : base(0x2259)
|
||||
{
|
||||
Weight = 1.0;
|
||||
LootType = LootType.Blessed;
|
||||
|
|
@ -40,89 +40,89 @@ namespace Server.Engines.BulkOrders
|
|||
Level = SecureLevel.CoOwners;
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
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 ( Entries.Count == 0 )
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
else if ( from is PlayerMobile mobile )
|
||||
mobile.SendGump( new BOBGump( mobile, this ) );
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
from.LocalOverheadMessage(Network.MessageType.Regular, 0x3B2, 1019045); // I can't reach that.
|
||||
else if (Entries.Count == 0)
|
||||
from.SendLocalizedMessage(1062381); // The book is empty.
|
||||
else if (from is PlayerMobile mobile)
|
||||
mobile.SendGump(new BOBGump(mobile, this));
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade( Mobile from )
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
if ( !from.InRange( GetWorldLocation(), 2 ) )
|
||||
if (!from.InRange(GetWorldLocation(), 2))
|
||||
{
|
||||
from.SendLocalizedMessage( 500446 ); // That is too far away.
|
||||
from.SendLocalizedMessage(500446); // That is too far away.
|
||||
}
|
||||
else if ( Entries.Count == 0 )
|
||||
else if (Entries.Count == 0)
|
||||
{
|
||||
from.SendLocalizedMessage( 1062381 ); // The book is empty.
|
||||
from.SendLocalizedMessage(1062381); // The book is empty.
|
||||
}
|
||||
else
|
||||
{
|
||||
from.SendGump( new BOBGump( (PlayerMobile)from, this ) );
|
||||
from.SendGump(new BOBGump((PlayerMobile)from, this));
|
||||
|
||||
SecureTrade trade = GetSecureTradeCont()?.Trade;
|
||||
|
||||
if (trade?.From.Mobile == from )
|
||||
trade.To.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.To.Mobile, this ) );
|
||||
else if (trade?.To.Mobile == from )
|
||||
trade.From.Mobile.SendGump( new BOBGump( (PlayerMobile)trade.From.Mobile, this ) );
|
||||
if (trade?.From.Mobile == from)
|
||||
trade.To.Mobile.SendGump(new BOBGump((PlayerMobile)trade.To.Mobile, this));
|
||||
else if (trade?.To.Mobile == from)
|
||||
trade.From.Mobile.SendGump(new BOBGump((PlayerMobile)trade.From.Mobile, this));
|
||||
}
|
||||
}
|
||||
|
||||
public override bool OnDragDrop( Mobile from, Item dropped )
|
||||
public override bool OnDragDrop(Mobile from, Item dropped)
|
||||
{
|
||||
if ( dropped is BaseBOD )
|
||||
if (dropped is BaseBOD)
|
||||
{
|
||||
if ( !IsChildOf( from.Backpack ) )
|
||||
if (!IsChildOf(from.Backpack))
|
||||
{
|
||||
from.SendLocalizedMessage( 1062385 ); // You must have the book in your backpack to add deeds to it.
|
||||
from.SendLocalizedMessage(1062385); // You must have the book in your backpack to add deeds to it.
|
||||
return false;
|
||||
}
|
||||
if ( !from.Backpack.CheckHold( from, dropped, true, true ) )
|
||||
if (!from.Backpack.CheckHold(from, dropped, true, true))
|
||||
return false;
|
||||
if ( Entries.Count < 500 )
|
||||
if (Entries.Count < 500)
|
||||
{
|
||||
if ( dropped is LargeBOD bod )
|
||||
Entries.Add( new BOBLargeEntry( bod ) );
|
||||
if (dropped is LargeBOD bod)
|
||||
Entries.Add(new BOBLargeEntry(bod));
|
||||
else
|
||||
Entries.Add( new BOBSmallEntry( (SmallBOD)dropped ) );
|
||||
Entries.Add(new BOBSmallEntry((SmallBOD)dropped));
|
||||
|
||||
InvalidateProperties();
|
||||
|
||||
if ( Entries.Count / 5 > ItemCount )
|
||||
if (Entries.Count / 5 > ItemCount)
|
||||
{
|
||||
ItemCount++;
|
||||
InvalidateItems();
|
||||
}
|
||||
|
||||
from.SendSound(0x42, GetWorldLocation());
|
||||
from.SendLocalizedMessage( 1062386 ); // Deed added to book.
|
||||
from.SendLocalizedMessage(1062386); // Deed added to book.
|
||||
|
||||
if ( from is PlayerMobile pm )
|
||||
pm.SendGump( new BOBGump( pm, this ) );
|
||||
if (from is PlayerMobile pm)
|
||||
pm.SendGump(new BOBGump(pm, this));
|
||||
|
||||
dropped.Delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1062387 ); // The book is full of deeds.
|
||||
from.SendLocalizedMessage(1062387); // The book is full of deeds.
|
||||
return false;
|
||||
}
|
||||
|
||||
from.SendLocalizedMessage( 1062388 ); // That is not a bulk order deed.
|
||||
from.SendLocalizedMessage(1062388); // That is not a bulk order deed.
|
||||
return false;
|
||||
}
|
||||
|
||||
public override int GetTotal( TotalType type )
|
||||
public override int GetTotal(TotalType type)
|
||||
{
|
||||
int total = base.GetTotal( type );
|
||||
int total = base.GetTotal(type);
|
||||
|
||||
if ( type == TotalType.Items )
|
||||
if (type == TotalType.Items)
|
||||
total = ItemCount;
|
||||
|
||||
return total;
|
||||
|
|
@ -130,111 +130,111 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public void InvalidateItems()
|
||||
{
|
||||
if ( RootParent is Mobile m )
|
||||
if (RootParent is Mobile m)
|
||||
{
|
||||
m.UpdateTotals();
|
||||
InvalidateContainers( Parent );
|
||||
InvalidateContainers(Parent);
|
||||
}
|
||||
}
|
||||
|
||||
public void InvalidateContainers(IEntity parent)
|
||||
{
|
||||
if ( parent is Container c )
|
||||
if (parent is Container c)
|
||||
{
|
||||
c.InvalidateProperties();
|
||||
InvalidateContainers( c.Parent );
|
||||
InvalidateContainers(c.Parent);
|
||||
}
|
||||
}
|
||||
|
||||
public BulkOrderBook( Serial serial ) : base( serial )
|
||||
public BulkOrderBook(Serial serial) : base(serial)
|
||||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer )
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize( writer );
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.Write( 2 ); // version
|
||||
writer.Write(2); // version
|
||||
|
||||
writer.Write( ItemCount );
|
||||
writer.Write(ItemCount);
|
||||
|
||||
writer.Write( (int) Level );
|
||||
writer.Write((int)Level);
|
||||
|
||||
writer.Write( m_BookName );
|
||||
writer.Write(m_BookName);
|
||||
|
||||
Filter.Serialize( writer );
|
||||
Filter.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( Entries.Count );
|
||||
writer.WriteEncodedInt(Entries.Count);
|
||||
|
||||
for ( int i = 0; i < Entries.Count; ++i )
|
||||
for (int i = 0; i < Entries.Count; ++i)
|
||||
{
|
||||
object obj = Entries[i];
|
||||
|
||||
if ( obj is BOBLargeEntry entry )
|
||||
if (obj is BOBLargeEntry entry)
|
||||
{
|
||||
writer.WriteEncodedInt( 0 );
|
||||
entry.Serialize( writer );
|
||||
writer.WriteEncodedInt(0);
|
||||
entry.Serialize(writer);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.WriteEncodedInt( 1 );
|
||||
((BOBSmallEntry)obj).Serialize( writer );
|
||||
writer.WriteEncodedInt(1);
|
||||
((BOBSmallEntry)obj).Serialize(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void Deserialize( IGenericReader reader )
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadInt();
|
||||
|
||||
switch ( version )
|
||||
switch (version)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_BookName = reader.ReadString();
|
||||
|
||||
Filter = new BOBFilter( reader );
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
Entries = new List<IBOBEntry>( count );
|
||||
|
||||
for ( int i = 0; i < count; ++i )
|
||||
{
|
||||
int v = reader.ReadEncodedInt();
|
||||
|
||||
switch ( v )
|
||||
{
|
||||
case 0: Entries.Add( new BOBLargeEntry( reader ) ); break;
|
||||
case 1: Entries.Add( new BOBSmallEntry( reader ) ); break;
|
||||
}
|
||||
ItemCount = reader.ReadInt();
|
||||
goto case 1;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
Level = (SecureLevel)reader.ReadInt();
|
||||
goto case 0;
|
||||
}
|
||||
case 0:
|
||||
{
|
||||
m_BookName = reader.ReadString();
|
||||
|
||||
break;
|
||||
}
|
||||
Filter = new BOBFilter(reader);
|
||||
|
||||
int count = reader.ReadEncodedInt();
|
||||
|
||||
Entries = new List<IBOBEntry>(count);
|
||||
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
int v = reader.ReadEncodedInt();
|
||||
|
||||
switch (v)
|
||||
{
|
||||
case 0: Entries.Add(new BOBLargeEntry(reader)); break;
|
||||
case 1: Entries.Add(new BOBSmallEntry(reader)); break;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties( list );
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add( 1062344, Entries.Count.ToString() ); // Deeds in book: ~1_val~
|
||||
list.Add(1062344, Entries.Count.ToString()); // Deeds in book: ~1_val~
|
||||
|
||||
if ( !string.IsNullOrEmpty(m_BookName) )
|
||||
list.Add( 1062481, m_BookName ); // Book Name: ~1_val~
|
||||
if (!string.IsNullOrEmpty(m_BookName))
|
||||
list.Add(1062481, m_BookName); // Book Name: ~1_val~
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
@ -247,22 +247,22 @@ namespace Server.Engines.BulkOrders
|
|||
LabelTo(from, 1062481, m_BookName);
|
||||
}
|
||||
|
||||
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
|
||||
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> list)
|
||||
{
|
||||
base.GetContextMenuEntries( from, list );
|
||||
base.GetContextMenuEntries(from, list);
|
||||
|
||||
if ( from.CheckAlive() && IsChildOf( from.Backpack ) )
|
||||
list.Add( new NameBookEntry( from, this ) );
|
||||
if (from.CheckAlive() && IsChildOf(from.Backpack))
|
||||
list.Add(new NameBookEntry(from, this));
|
||||
|
||||
SetSecureLevelEntry.AddTo( from, this, list );
|
||||
SetSecureLevelEntry.AddTo(from, this, list);
|
||||
}
|
||||
|
||||
private class NameBookEntry : ContextMenuEntry
|
||||
{
|
||||
private Mobile m_From;
|
||||
private BulkOrderBook m_Book;
|
||||
private readonly Mobile m_From;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
|
||||
public NameBookEntry( Mobile from, BulkOrderBook book ) : base( 6216 )
|
||||
public NameBookEntry(Mobile from, BulkOrderBook book) : base(6216)
|
||||
{
|
||||
m_From = from;
|
||||
m_Book = book;
|
||||
|
|
@ -270,34 +270,34 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public override void OnClick()
|
||||
{
|
||||
if ( m_From.CheckAlive() && m_Book.IsChildOf( m_From.Backpack ) )
|
||||
if (m_From.CheckAlive() && m_Book.IsChildOf(m_From.Backpack))
|
||||
{
|
||||
m_From.Prompt = new NameBookPrompt( m_Book );
|
||||
m_From.SendLocalizedMessage( 1062479 ); // Type in the new name of the book:
|
||||
m_From.Prompt = new NameBookPrompt(m_Book);
|
||||
m_From.SendLocalizedMessage(1062479); // Type in the new name of the book:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class NameBookPrompt : Prompt
|
||||
{
|
||||
private BulkOrderBook m_Book;
|
||||
private readonly BulkOrderBook m_Book;
|
||||
|
||||
public NameBookPrompt( BulkOrderBook book ) => m_Book = book;
|
||||
public NameBookPrompt(BulkOrderBook book) => m_Book = book;
|
||||
|
||||
public override void OnResponse( Mobile from, string text )
|
||||
public override void OnResponse(Mobile from, string text)
|
||||
{
|
||||
if ( text.Length > 40 )
|
||||
text = text.Substring( 0, 40 );
|
||||
if (text.Length > 40)
|
||||
text = text.Substring(0, 40);
|
||||
|
||||
if ( from.CheckAlive() && m_Book.IsChildOf( from.Backpack ) )
|
||||
if (from.CheckAlive() && m_Book.IsChildOf(from.Backpack))
|
||||
{
|
||||
m_Book.BookName = Utility.FixHtml( text.Trim() );
|
||||
m_Book.BookName = Utility.FixHtml(text.Trim());
|
||||
|
||||
from.SendLocalizedMessage( 1062480 ); // The bulk order book's name has been changed.
|
||||
from.SendLocalizedMessage(1062480); // The bulk order book's name has been changed.
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnCancel( Mobile from )
|
||||
public override void OnCancel(Mobile from)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public interface IBOBEntry
|
||||
{
|
||||
bool RequireExceptional{ get; }
|
||||
BODType DeedType{ get; }
|
||||
BulkMaterialType Material{ get; }
|
||||
int AmountMax{ get; }
|
||||
int Price{ get; set; }
|
||||
bool RequireExceptional { get; }
|
||||
BODType DeedType { get; }
|
||||
BulkMaterialType Material { get; }
|
||||
int AmountMax { get; }
|
||||
int Price { get; set; }
|
||||
Item Reconstruct();
|
||||
}
|
||||
}
|
||||
|
|
@ -9,16 +9,16 @@ namespace Server.Engines.BulkOrders
|
|||
public LargeBulkEntry[] Entries
|
||||
{
|
||||
get => m_Entries;
|
||||
set{ m_Entries = value; InvalidateProperties(); }
|
||||
set { m_Entries = value; InvalidateProperties(); }
|
||||
}
|
||||
|
||||
[CommandProperty( AccessLevel.GameMaster )]
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public override bool Complete
|
||||
{
|
||||
get
|
||||
{
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
if ( m_Entries[i].Amount < AmountMax )
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
if (m_Entries[i].Amount < AmountMax)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
|
@ -27,48 +27,47 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public override int LabelNumber => 1045151; // a bulk order deed
|
||||
|
||||
public LargeBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries) :
|
||||
base(hue, amountMax, requireExeptional, material) =>
|
||||
public LargeBOD(int hue, int amountMax, bool requireExeptional, BulkMaterialType material, LargeBulkEntry[] entries) : base(hue, amountMax, requireExeptional, material) =>
|
||||
m_Entries = entries;
|
||||
|
||||
public LargeBOD()
|
||||
{
|
||||
}
|
||||
|
||||
public override void GetProperties( ObjectPropertyList list )
|
||||
public override void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
base.GetProperties( list );
|
||||
base.GetProperties(list);
|
||||
|
||||
list.Add( 1060655 ); // large bulk order
|
||||
list.Add(1060655); // large bulk order
|
||||
|
||||
if ( RequireExceptional )
|
||||
list.Add( 1045141 ); // All items must be exceptional.
|
||||
if (RequireExceptional)
|
||||
list.Add(1045141); // All items must be exceptional.
|
||||
|
||||
if ( Material != BulkMaterialType.None )
|
||||
list.Add( LargeBODGump.GetMaterialNumberFor( Material ) ); // All items must be made with x material.
|
||||
if (Material != BulkMaterialType.None)
|
||||
list.Add(LargeBODGump.GetMaterialNumberFor(Material)); // All items must be made with x material.
|
||||
|
||||
list.Add( 1060656, AmountMax.ToString() ); // amount to make: ~1_val~
|
||||
list.Add(1060656, AmountMax.ToString()); // amount to make: ~1_val~
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
list.Add( 1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount ); // ~1_val~: ~2_val~
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
list.Add(1060658 + i, "#{0}\t{1}", m_Entries[i].Details.Number, m_Entries[i].Amount); // ~1_val~: ~2_val~
|
||||
}
|
||||
|
||||
public override void OnDoubleClickNotAccessible( Mobile from )
|
||||
public override void OnDoubleClickNotAccessible(Mobile from)
|
||||
{
|
||||
OnDoubleClick( from );
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClickSecureTrade( Mobile from )
|
||||
public override void OnDoubleClickSecureTrade(Mobile from)
|
||||
{
|
||||
OnDoubleClick( from );
|
||||
OnDoubleClick(from);
|
||||
}
|
||||
|
||||
public override void OnDoubleClick( Mobile from )
|
||||
public override void OnDoubleClick(Mobile from)
|
||||
{
|
||||
if ( IsChildOf( from.Backpack ) || InSecureTrade || RootParent is PlayerVendor )
|
||||
from.SendGump( new LargeBODGump( from, this ) );
|
||||
if (IsChildOf(from.Backpack) || InSecureTrade || RootParent is PlayerVendor)
|
||||
from.SendGump(new LargeBODGump(from, this));
|
||||
else
|
||||
from.SendLocalizedMessage( 1045156 ); // You must have the deed in your backpack to use it.
|
||||
from.SendLocalizedMessage(1045156); // You must have the deed in your backpack to use it.
|
||||
}
|
||||
|
||||
public override void EndCombine(Mobile from, Item item)
|
||||
|
|
@ -136,35 +135,35 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer )
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
base.Serialize( writer );
|
||||
base.Serialize(writer);
|
||||
|
||||
writer.WriteEncodedInt( 0 ); // version
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write( m_Entries.Length );
|
||||
writer.Write(m_Entries.Length);
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i].Serialize( writer );
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i].Serialize(writer);
|
||||
}
|
||||
|
||||
public override void Deserialize( IGenericReader reader )
|
||||
public override void Deserialize(IGenericReader reader)
|
||||
{
|
||||
base.Deserialize( reader );
|
||||
base.Deserialize(reader);
|
||||
|
||||
int version = reader.ReadEncodedInt();
|
||||
|
||||
switch ( version )
|
||||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
||||
{
|
||||
m_Entries = new LargeBulkEntry[reader.ReadInt()];
|
||||
|
||||
for ( int i = 0; i < m_Entries.Length; ++i )
|
||||
m_Entries[i] = new LargeBulkEntry( this, reader );
|
||||
for (int i = 0; i < m_Entries.Length; ++i)
|
||||
m_Entries[i] = new LargeBulkEntry(this, reader);
|
||||
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class LargeBODAcceptGump : Gump
|
||||
{
|
||||
private LargeBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
private readonly LargeBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public LargeBODAcceptGump(Mobile from, LargeBOD deed) : base(50, 50)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class LargeBODGump : Gump
|
||||
{
|
||||
private LargeBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
private readonly LargeBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public LargeBODGump(Mobile from, LargeBOD deed) : base(25, 25)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,88 +12,86 @@ namespace Server.Engines.BulkOrders
|
|||
public int Amount
|
||||
{
|
||||
get => m_Amount;
|
||||
set{ m_Amount = value; Owner?.InvalidateProperties(); }
|
||||
set { m_Amount = value; Owner?.InvalidateProperties(); }
|
||||
}
|
||||
public SmallBulkEntry Details { get; }
|
||||
|
||||
public static SmallBulkEntry[] LargeRing => GetEntries( "Blacksmith", "largering" );
|
||||
public static SmallBulkEntry[] LargeRing => GetEntries("Blacksmith", "largering");
|
||||
|
||||
public static SmallBulkEntry[] LargePlate => GetEntries( "Blacksmith", "largeplate" );
|
||||
public static SmallBulkEntry[] LargePlate => GetEntries("Blacksmith", "largeplate");
|
||||
|
||||
public static SmallBulkEntry[] LargeChain => GetEntries( "Blacksmith", "largechain" );
|
||||
public static SmallBulkEntry[] LargeChain => GetEntries("Blacksmith", "largechain");
|
||||
|
||||
public static SmallBulkEntry[] LargeAxes => GetEntries( "Blacksmith", "largeaxes" );
|
||||
public static SmallBulkEntry[] LargeAxes => GetEntries("Blacksmith", "largeaxes");
|
||||
|
||||
public static SmallBulkEntry[] LargeFencing => GetEntries( "Blacksmith", "largefencing" );
|
||||
public static SmallBulkEntry[] LargeFencing => GetEntries("Blacksmith", "largefencing");
|
||||
|
||||
public static SmallBulkEntry[] LargeMaces => GetEntries( "Blacksmith", "largemaces" );
|
||||
public static SmallBulkEntry[] LargeMaces => GetEntries("Blacksmith", "largemaces");
|
||||
|
||||
public static SmallBulkEntry[] LargePolearms => GetEntries( "Blacksmith", "largepolearms" );
|
||||
public static SmallBulkEntry[] LargePolearms => GetEntries("Blacksmith", "largepolearms");
|
||||
|
||||
public static SmallBulkEntry[] LargeSwords => GetEntries( "Blacksmith", "largeswords" );
|
||||
public static SmallBulkEntry[] LargeSwords => GetEntries("Blacksmith", "largeswords");
|
||||
|
||||
public static SmallBulkEntry[] BoneSet => GetEntries("Tailoring", "boneset");
|
||||
|
||||
public static SmallBulkEntry[] BoneSet => GetEntries( "Tailoring", "boneset" );
|
||||
public static SmallBulkEntry[] Farmer => GetEntries("Tailoring", "farmer");
|
||||
|
||||
public static SmallBulkEntry[] Farmer => GetEntries( "Tailoring", "farmer" );
|
||||
public static SmallBulkEntry[] FemaleLeatherSet => GetEntries("Tailoring", "femaleleatherset");
|
||||
|
||||
public static SmallBulkEntry[] FemaleLeatherSet => GetEntries( "Tailoring", "femaleleatherset" );
|
||||
public static SmallBulkEntry[] FisherGirl => GetEntries("Tailoring", "fishergirl");
|
||||
|
||||
public static SmallBulkEntry[] FisherGirl => GetEntries( "Tailoring", "fishergirl" );
|
||||
public static SmallBulkEntry[] Gypsy => GetEntries("Tailoring", "gypsy");
|
||||
|
||||
public static SmallBulkEntry[] Gypsy => GetEntries( "Tailoring", "gypsy" );
|
||||
public static SmallBulkEntry[] HatSet => GetEntries("Tailoring", "hatset");
|
||||
|
||||
public static SmallBulkEntry[] HatSet => GetEntries( "Tailoring", "hatset" );
|
||||
public static SmallBulkEntry[] Jester => GetEntries("Tailoring", "jester");
|
||||
|
||||
public static SmallBulkEntry[] Jester => GetEntries( "Tailoring", "jester" );
|
||||
public static SmallBulkEntry[] Lady => GetEntries("Tailoring", "lady");
|
||||
|
||||
public static SmallBulkEntry[] Lady => GetEntries( "Tailoring", "lady" );
|
||||
public static SmallBulkEntry[] MaleLeatherSet => GetEntries("Tailoring", "maleleatherset");
|
||||
|
||||
public static SmallBulkEntry[] MaleLeatherSet => GetEntries( "Tailoring", "maleleatherset" );
|
||||
public static SmallBulkEntry[] Pirate => GetEntries("Tailoring", "pirate");
|
||||
|
||||
public static SmallBulkEntry[] Pirate => GetEntries( "Tailoring", "pirate" );
|
||||
public static SmallBulkEntry[] ShoeSet => GetEntries("Tailoring", "shoeset");
|
||||
|
||||
public static SmallBulkEntry[] ShoeSet => GetEntries( "Tailoring", "shoeset" );
|
||||
public static SmallBulkEntry[] StuddedSet => GetEntries("Tailoring", "studdedset");
|
||||
|
||||
public static SmallBulkEntry[] StuddedSet => GetEntries( "Tailoring", "studdedset" );
|
||||
public static SmallBulkEntry[] TownCrier => GetEntries("Tailoring", "towncrier");
|
||||
|
||||
public static SmallBulkEntry[] TownCrier => GetEntries( "Tailoring", "towncrier" );
|
||||
public static SmallBulkEntry[] Wizard => GetEntries("Tailoring", "wizard");
|
||||
|
||||
public static SmallBulkEntry[] Wizard => GetEntries( "Tailoring", "wizard" );
|
||||
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
|
||||
|
||||
|
||||
private static Dictionary<string,Dictionary<string,SmallBulkEntry[]>> m_Cache;
|
||||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||
{
|
||||
m_Cache ??= new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
if (!m_Cache.TryGetValue(type, out Dictionary<string, SmallBulkEntry[]> table))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
||||
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
|
||||
if (!table.TryGetValue(name, out SmallBulkEntry[] entries))
|
||||
table[name] = entries = SmallBulkEntry.LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static LargeBulkEntry[] ConvertEntries( LargeBOD owner, SmallBulkEntry[] small )
|
||||
public static LargeBulkEntry[] ConvertEntries(LargeBOD owner, SmallBulkEntry[] small)
|
||||
{
|
||||
LargeBulkEntry[] large = new LargeBulkEntry[small.Length];
|
||||
|
||||
for ( int i = 0; i < small.Length; ++i )
|
||||
large[i] = new LargeBulkEntry( owner, small[i] );
|
||||
for (int i = 0; i < small.Length; ++i)
|
||||
large[i] = new LargeBulkEntry(owner, small[i]);
|
||||
|
||||
return large;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, SmallBulkEntry details )
|
||||
public LargeBulkEntry(LargeBOD owner, SmallBulkEntry details)
|
||||
{
|
||||
Owner = owner;
|
||||
Details = details;
|
||||
}
|
||||
|
||||
public LargeBulkEntry( LargeBOD owner, IGenericReader reader )
|
||||
public LargeBulkEntry(LargeBOD owner, IGenericReader reader)
|
||||
{
|
||||
Owner = owner;
|
||||
m_Amount = reader.ReadInt();
|
||||
|
|
@ -102,18 +100,18 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
string type = reader.ReadString();
|
||||
|
||||
if ( type != null )
|
||||
realType = AssemblyHandler.FindFirstTypeForName( type );
|
||||
if (type != null)
|
||||
realType = AssemblyHandler.FindFirstTypeForName(type);
|
||||
|
||||
Details = new SmallBulkEntry( realType, reader.ReadInt(), reader.ReadInt() );
|
||||
Details = new SmallBulkEntry(realType, reader.ReadInt(), reader.ReadInt());
|
||||
}
|
||||
|
||||
public void Serialize(IGenericWriter writer )
|
||||
public void Serialize(IGenericWriter writer)
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( Details.Type?.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
writer.Write(m_Amount);
|
||||
writer.Write(Details.Type?.FullName);
|
||||
writer.Write(Details.Number);
|
||||
writer.Write(Details.Graphic);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
int hue = 0x44E;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = 0.825 > Utility.RandomDouble();
|
||||
bool reqExceptional = Utility.RandomDouble() < 0.825;
|
||||
|
||||
BulkMaterialType material = useMaterials ? GetRandomMaterial(BulkMaterialType.DullCopper, m_BlacksmithMaterialChances)
|
||||
: BulkMaterialType.None;
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
int hue = 0x483;
|
||||
int amountMax = Utility.RandomList(10, 15, 20, 20);
|
||||
bool reqExceptional = 0.825 > Utility.RandomDouble();
|
||||
bool reqExceptional = Utility.RandomDouble() < 0.825;
|
||||
|
||||
BulkMaterialType material = useMaterials ? GetRandomMaterial(BulkMaterialType.Spined, m_TailoringMaterialChances)
|
||||
: BulkMaterialType.None;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ namespace Server.Engines.BulkOrders
|
|||
Types = types;
|
||||
}
|
||||
|
||||
public int Points{ get; }
|
||||
public int Points { get; }
|
||||
|
||||
public Type[] Types{ get; }
|
||||
public Type[] Types { get; }
|
||||
|
||||
public bool Contains(Type type)
|
||||
{
|
||||
|
|
@ -36,11 +36,11 @@ namespace Server.Engines.BulkOrders
|
|||
Type = type;
|
||||
}
|
||||
|
||||
public int Weight{ get; }
|
||||
public int Weight { get; }
|
||||
|
||||
public ConstructCallback Constructor{ get; }
|
||||
public ConstructCallback Constructor { get; }
|
||||
|
||||
public int Type{ get; }
|
||||
public int Type { get; }
|
||||
|
||||
public Item Construct()
|
||||
{
|
||||
|
|
@ -63,9 +63,9 @@ namespace Server.Engines.BulkOrders
|
|||
Items = items;
|
||||
}
|
||||
|
||||
public int Points{ get; }
|
||||
public int Points { get; }
|
||||
|
||||
public RewardItem[] Items{ get; }
|
||||
public RewardItem[] Items { get; }
|
||||
|
||||
public RewardItem AcquireItem()
|
||||
{
|
||||
|
|
@ -97,7 +97,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public abstract class RewardCalculator
|
||||
{
|
||||
public RewardGroup[] Groups{ get; set; }
|
||||
public RewardGroup[] Groups { get; set; }
|
||||
|
||||
public abstract int ComputePoints(int quantity, bool exceptional, BulkMaterialType material, int itemCount,
|
||||
Type type);
|
||||
|
|
@ -165,7 +165,7 @@ namespace Server.Engines.BulkOrders
|
|||
private static readonly ConstructCallback AncientHammer = CreateAncientHammer;
|
||||
public static readonly SmithRewardCalculator Instance = new SmithRewardCalculator();
|
||||
|
||||
private static int[][][] m_GoldTable =
|
||||
private static readonly int[][][] m_GoldTable =
|
||||
{
|
||||
new[] // 1-part (regular)
|
||||
{
|
||||
|
|
@ -253,7 +253,7 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
};
|
||||
|
||||
private RewardType[] m_Types =
|
||||
private readonly RewardType[] m_Types =
|
||||
{
|
||||
// Armors
|
||||
new RewardType(200, typeof(RingmailGloves), typeof(RingmailChest), typeof(RingmailArms), typeof(RingmailLegs)),
|
||||
|
|
@ -264,7 +264,7 @@ namespace Server.Engines.BulkOrders
|
|||
// Weapons
|
||||
new RewardType(200, typeof(Bardiche), typeof(Halberd)),
|
||||
new RewardType(300, typeof(Dagger), typeof(ShortSpear), typeof(Spear), typeof(WarFork),
|
||||
typeof(Kryss)), //OSI put the dagger in there. Odd, ain't it.
|
||||
typeof(Kryss)), // OSI put the dagger in there. Odd, ain't it.
|
||||
new RewardType(350, typeof(Axe), typeof(BattleAxe), typeof(DoubleAxe), typeof(ExecutionersAxe),
|
||||
typeof(LargeBattleAxe), typeof(TwoHandedAxe)),
|
||||
new RewardType(350, typeof(Broadsword), typeof(Cutlass), typeof(Katana), typeof(Longsword),
|
||||
|
|
@ -379,8 +379,6 @@ namespace Server.Engines.BulkOrders
|
|||
return Utility.RandomMinMax(min, max);
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
|
||||
private static Item CreateSturdyShovel(int type) => new SturdyShovel();
|
||||
|
||||
private static Item CreateSturdyPickaxe(int type) => new SturdyPickaxe();
|
||||
|
|
@ -427,8 +425,6 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public sealed class TailorRewardCalculator : RewardCalculator
|
||||
|
|
@ -443,7 +439,7 @@ namespace Server.Engines.BulkOrders
|
|||
private static readonly ConstructCallback ClothingBlessDeed = CreateCBD;
|
||||
public static readonly TailorRewardCalculator Instance = new TailorRewardCalculator();
|
||||
|
||||
private static int[][][] m_AosGoldTable =
|
||||
private static readonly int[][][] m_AosGoldTable =
|
||||
{
|
||||
new[] // 1-part (regular)
|
||||
{
|
||||
|
|
@ -495,7 +491,7 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
};
|
||||
|
||||
private static int[][][] m_OldGoldTable =
|
||||
private static readonly int[][][] m_OldGoldTable =
|
||||
{
|
||||
new[] // 1-part (regular)
|
||||
{
|
||||
|
|
@ -612,7 +608,7 @@ namespace Server.Engines.BulkOrders
|
|||
4 => 1,
|
||||
_ => 0
|
||||
} * 2 + (exceptional ? 1 : 0);
|
||||
|
||||
|
||||
int quanIndex = quantity switch
|
||||
{
|
||||
20 => 2,
|
||||
|
|
@ -636,9 +632,7 @@ namespace Server.Engines.BulkOrders
|
|||
return Utility.RandomMinMax(min, max);
|
||||
}
|
||||
|
||||
#region Constructors
|
||||
|
||||
private static int[][] m_ClothHues =
|
||||
private static readonly int[][] m_ClothHues =
|
||||
{
|
||||
new[] { 0x483, 0x48C, 0x488, 0x48A },
|
||||
new[] { 0x495, 0x48B, 0x486, 0x485 },
|
||||
|
|
@ -659,7 +653,7 @@ namespace Server.Engines.BulkOrders
|
|||
throw new InvalidOperationException();
|
||||
}
|
||||
|
||||
private static int[] m_SandalHues =
|
||||
private static readonly int[] m_SandalHues =
|
||||
{
|
||||
0x489, 0x47F, 0x482,
|
||||
0x47E, 0x48F, 0x494,
|
||||
|
|
@ -718,7 +712,5 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
private static Item CreateCBD(int type) => new ClothingBlessDeed();
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public Type Type{ get; set; }
|
||||
public Type Type { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Number
|
||||
|
|
@ -52,7 +52,7 @@ namespace Server.Engines.BulkOrders
|
|||
}
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public int Graphic{ get; set; }
|
||||
public int Graphic { get; set; }
|
||||
|
||||
[CommandProperty(AccessLevel.GameMaster)]
|
||||
public override bool Complete => m_AmountCur == AmountMax;
|
||||
|
|
@ -121,8 +121,8 @@ namespace Server.Engines.BulkOrders
|
|||
from.SendLocalizedMessage(
|
||||
1045166); // The maximum amount of requested items have already been combined to this deed.
|
||||
}
|
||||
else if (Type == null || objectType != Type && !objectType.IsSubclassOf(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.
|
||||
}
|
||||
|
|
@ -194,18 +194,18 @@ namespace Server.Engines.BulkOrders
|
|||
switch (version)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
m_AmountCur = reader.ReadInt();
|
||||
{
|
||||
m_AmountCur = reader.ReadInt();
|
||||
|
||||
string type = reader.ReadString();
|
||||
string type = reader.ReadString();
|
||||
|
||||
if (type != null)
|
||||
Type = AssemblyHandler.FindFirstTypeForName(type);
|
||||
if (type != null)
|
||||
Type = AssemblyHandler.FindFirstTypeForName(type);
|
||||
|
||||
m_Number = reader.ReadInt();
|
||||
Graphic = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
m_Number = reader.ReadInt();
|
||||
Graphic = reader.ReadInt();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class SmallBODAcceptGump : Gump
|
||||
{
|
||||
private SmallBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
private readonly SmallBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public SmallBODAcceptGump(Mobile from, SmallBOD deed) : base(50, 50)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
public class SmallBODGump : Gump
|
||||
{
|
||||
private SmallBOD m_Deed;
|
||||
private Mobile m_From;
|
||||
private readonly SmallBOD m_Deed;
|
||||
private readonly Mobile m_From;
|
||||
|
||||
public SmallBODGump(Mobile from, SmallBOD deed) : base(25, 25)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -12,66 +12,66 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public int Graphic { get; }
|
||||
|
||||
public SmallBulkEntry( Type type, int number, int graphic )
|
||||
public SmallBulkEntry(Type type, int number, int graphic)
|
||||
{
|
||||
Type = type;
|
||||
Number = number;
|
||||
Graphic = graphic;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries( "Blacksmith", "weapons" );
|
||||
public static SmallBulkEntry[] BlacksmithWeapons => GetEntries("Blacksmith", "weapons");
|
||||
|
||||
public static SmallBulkEntry[] BlacksmithArmor => GetEntries( "Blacksmith", "armor" );
|
||||
public static SmallBulkEntry[] BlacksmithArmor => GetEntries("Blacksmith", "armor");
|
||||
|
||||
public static SmallBulkEntry[] TailorCloth => GetEntries( "Tailoring", "cloth" );
|
||||
public static SmallBulkEntry[] TailorCloth => GetEntries("Tailoring", "cloth");
|
||||
|
||||
public static SmallBulkEntry[] TailorLeather => GetEntries( "Tailoring", "leather" );
|
||||
public static SmallBulkEntry[] TailorLeather => GetEntries("Tailoring", "leather");
|
||||
|
||||
private static Dictionary<string, Dictionary<string, SmallBulkEntry[]>> m_Cache;
|
||||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
public static SmallBulkEntry[] GetEntries(string type, string name)
|
||||
{
|
||||
if ( m_Cache == null )
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
if (!m_Cache.TryGetValue(type, out Dictionary<string, SmallBulkEntry[]> table))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
||||
if (!table.TryGetValue( name, out SmallBulkEntry[] entries ))
|
||||
if (!table.TryGetValue(name, out SmallBulkEntry[] entries))
|
||||
table[name] = entries = LoadEntries(type, name);
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string type, string name ) => LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
|
||||
public static SmallBulkEntry[] LoadEntries(string type, string name) => LoadEntries($"Data/Bulk Orders/{type}/{name}.cfg");
|
||||
|
||||
public static SmallBulkEntry[] LoadEntries( string path )
|
||||
public static SmallBulkEntry[] LoadEntries(string path)
|
||||
{
|
||||
path = Path.Combine( Core.BaseDirectory, path );
|
||||
path = Path.Combine(Core.BaseDirectory, path);
|
||||
|
||||
List<SmallBulkEntry> list = new List<SmallBulkEntry>();
|
||||
|
||||
if ( File.Exists( path ) )
|
||||
if (File.Exists(path))
|
||||
{
|
||||
using StreamReader ip = new StreamReader( path );
|
||||
using StreamReader ip = new StreamReader(path);
|
||||
string line;
|
||||
|
||||
while ( (line = ip.ReadLine()) != null )
|
||||
while ((line = ip.ReadLine()) != null)
|
||||
{
|
||||
if ( line.Length == 0 || line.StartsWith( "#" ) )
|
||||
if (line.Length == 0 || line.StartsWith("#"))
|
||||
continue;
|
||||
|
||||
try
|
||||
{
|
||||
string[] split = line.Split( '\t' );
|
||||
string[] split = line.Split('\t');
|
||||
|
||||
if ( split.Length >= 2 )
|
||||
if (split.Length >= 2)
|
||||
{
|
||||
Type type = AssemblyHandler.FindFirstTypeForName( split[0] );
|
||||
int graphic = Utility.ToInt32( split[split.Length - 1] );
|
||||
Type type = AssemblyHandler.FindFirstTypeForName(split[0]);
|
||||
int graphic = Utility.ToInt32(split[split.Length - 1]);
|
||||
|
||||
if ( type != null && graphic > 0 )
|
||||
list.Add( new SmallBulkEntry( type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic ) );
|
||||
if (type != null && graphic > 0)
|
||||
list.Add(new SmallBulkEntry(type, graphic < 0x4000 ? 1020000 + graphic : 1078872 + graphic, graphic));
|
||||
}
|
||||
}
|
||||
catch
|
||||
|
|
|
|||
|
|
@ -153,7 +153,6 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
SmallBulkEntry entry = validEntries[Utility.Random(validEntries.Count)];
|
||||
return new SmallSmithBOD(entry, material, amountMax, reqExceptional);
|
||||
|
||||
}
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
|
|
|
|||
|
|
@ -121,7 +121,6 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
bool reqExceptional = excChance > Utility.RandomDouble();
|
||||
|
||||
|
||||
CraftSystem system = DefTailoring.CraftSystem;
|
||||
|
||||
List<SmallBulkEntry> validEntries = new List<SmallBulkEntry>();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue