Code Cleanup & Fixes Warnings (#74)
This commit is contained in:
parent
e11d1f3ad9
commit
57b14ad690
143 changed files with 2960 additions and 3427 deletions
|
|
@ -46,7 +46,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(ItemType == null ? null : ItemType.FullName);
|
||||
writer.Write(ItemType?.FullName);
|
||||
|
||||
writer.WriteEncodedInt(AmountCur);
|
||||
writer.WriteEncodedInt(Number);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
writer.WriteEncodedInt(0); // version
|
||||
|
||||
writer.Write(ItemType == null ? null : ItemType.FullName);
|
||||
writer.Write(ItemType?.FullName);
|
||||
|
||||
writer.Write(RequireExceptional);
|
||||
|
||||
|
|
|
|||
|
|
@ -66,8 +66,7 @@ namespace Server.Engines.BulkOrders
|
|||
|
||||
public static SmallBulkEntry[] GetEntries( string type, string name )
|
||||
{
|
||||
if (m_Cache == null)
|
||||
m_Cache = new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
m_Cache ??= new Dictionary<string, Dictionary<string, SmallBulkEntry[]>>();
|
||||
|
||||
if (!m_Cache.TryGetValue( type, out Dictionary<string, SmallBulkEntry[]> table ))
|
||||
m_Cache[type] = table = new Dictionary<string, SmallBulkEntry[]>();
|
||||
|
|
@ -112,7 +111,7 @@ namespace Server.Engines.BulkOrders
|
|||
public void Serialize(IGenericWriter writer )
|
||||
{
|
||||
writer.Write( m_Amount );
|
||||
writer.Write( Details.Type == null ? null : Details.Type.FullName );
|
||||
writer.Write( Details.Type?.FullName );
|
||||
writer.Write( Details.Number );
|
||||
writer.Write( Details.Graphic );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@ namespace Server.Engines.BulkOrders
|
|||
switch (Utility.Random(14))
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
entries = LargeBulkEntry.ConvertEntries(this, LargeBulkEntry.Farmer);
|
||||
break;
|
||||
case 1:
|
||||
|
|
|
|||
|
|
@ -357,7 +357,13 @@ namespace Server.Engines.BulkOrders
|
|||
int[][][] goldTable = m_GoldTable;
|
||||
|
||||
int typeIndex = ComputeType(type, itemCount);
|
||||
int quanIndex = quantity == 20 ? 2 : quantity == 15 ? 1 : 0;
|
||||
int quanIndex = quantity switch
|
||||
{
|
||||
20 => 2,
|
||||
15 => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int mtrlIndex = material >= BulkMaterialType.DullCopper && material <= BulkMaterialType.Valorite
|
||||
? 1 + (material - BulkMaterialType.DullCopper)
|
||||
: 0;
|
||||
|
|
@ -599,11 +605,28 @@ namespace Server.Engines.BulkOrders
|
|||
{
|
||||
int[][][] goldTable = Core.AOS ? m_AosGoldTable : m_OldGoldTable;
|
||||
|
||||
int typeIndex = (itemCount == 6 ? 3 : itemCount == 5 ? 2 : itemCount == 4 ? 1 : 0) * 2 + (exceptional ? 1 : 0);
|
||||
int quanIndex = quantity == 20 ? 2 : quantity == 15 ? 1 : 0;
|
||||
int mtrlIndex = material == BulkMaterialType.Barbed ? 3 :
|
||||
material == BulkMaterialType.Horned ? 2 :
|
||||
material == BulkMaterialType.Spined ? 1 : 0;
|
||||
int typeIndex = itemCount switch
|
||||
{
|
||||
6 => 3,
|
||||
5 => 2,
|
||||
4 => 1,
|
||||
_ => 0
|
||||
} * 2 + (exceptional ? 1 : 0);
|
||||
|
||||
int quanIndex = quantity switch
|
||||
{
|
||||
20 => 2,
|
||||
15 => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int mtrlIndex = material switch
|
||||
{
|
||||
BulkMaterialType.Barbed => 3,
|
||||
BulkMaterialType.Horned => 2,
|
||||
BulkMaterialType.Spined => 1,
|
||||
_ => 0
|
||||
};
|
||||
|
||||
int gold = goldTable[typeIndex][quanIndex][mtrlIndex];
|
||||
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ namespace Server.Engines.BulkOrders
|
|||
writer.Write(0); // version
|
||||
|
||||
writer.Write(m_AmountCur);
|
||||
writer.Write(Type == null ? null : Type.FullName);
|
||||
writer.Write(Type?.FullName);
|
||||
writer.Write(m_Number);
|
||||
writer.Write(Graphic);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -135,7 +135,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
double chance = item.GetSuccessChance(m, null, system, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace Server.Engines.BulkOrders
|
|||
if (item != null)
|
||||
{
|
||||
bool allRequiredSkills = true;
|
||||
double chance = item.GetSuccessChance(m, null, system, false, ref allRequiredSkills);
|
||||
double chance = item.GetSuccessChance(m, null, system, false, out allRequiredSkills);
|
||||
|
||||
if (allRequiredSkills && chance >= 0.0)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue