Modernization Fixes & Updates to Default Values (#3)

This commit is contained in:
Kamron Batman 2018-10-28 00:33:16 -07:00 • committed by GitHub
parent 445eddff68
commit dcf64091b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
768 changed files with 10507 additions and 14196 deletions

View file

@ -845,7 +845,6 @@ namespace Server.Items
for (int i = 0; i < groups.Count; ++i)
{
items[i] = groups[i].ToArray();
//items[i] = (Item[])(((ArrayList)groups[i]).ToArray( typeof( Item ) ));
for (int j = 0; j < items[i].Length; ++j)
totals[i] += items[i][j].Amount;
@ -939,7 +938,6 @@ namespace Server.Items
for (int j = 0; j < groups.Count; ++j)
{
items[i][j] = groups[j].ToArray();
//items[i][j] = (Item[])(((ArrayList)groups[j]).ToArray( typeof( Item ) ));
for (int k = 0; k < items[i][j].Length; ++k)
totals[i][j] += items[i][j][k].Amount;
@ -1341,7 +1339,6 @@ namespace Server.Items
{
Item[] items = groups[i].ToArray();
//Item[] items = (Item[])(((ArrayList)groups[i]).ToArray( typeof( Item ) ));
int total = 0;
for (int j = 0; j < items.Length; ++j)
@ -1392,7 +1389,6 @@ namespace Server.Items
for (int j = 0; j < groups.Count; ++j)
{
Item[] items = groups[j].ToArray();
//Item[] items = (Item[])(((ArrayList)groups[j]).ToArray( typeof( Item ) ));
int total = 0;
for (int k = 0; k < items.Length; ++k)
@ -1445,7 +1441,6 @@ namespace Server.Items
for (int j = 0; j < groups.Count; ++j)
{
Item[] items = groups[j].ToArray();
//Item[] items = (Item[])(((ArrayList)groups[j]).ToArray( typeof( Item ) ));
int total = 0;
for (int k = 0; k < items.Length; ++k)
@ -1501,7 +1496,7 @@ namespace Server.Items
{
if (current == null || current.Items.Count == 0)
return;
List<Item> items = current.Items;
for (int i = 0; i < items.Count; ++i)
@ -1530,7 +1525,7 @@ namespace Server.Items
{
if (current == null || current.Items.Count == 0)
return;
List<Item> items = current.Items;
for (int i = 0; i < items.Count; ++i)
@ -1554,7 +1549,7 @@ namespace Server.Items
{
if (current == null || current.Items.Count == 0)
return null;
List<Item> list = current.Items;
for (int i = 0; i < list.Count; ++i)
@ -1585,7 +1580,7 @@ namespace Server.Items
{
if (current == null || current.Items.Count <= 0)
return null;
List<Item> list = current.Items;
for (int i = 0; i < list.Count; ++i)
@ -1619,7 +1614,7 @@ namespace Server.Items
{
List<T> list = new List<T>();
RecurseFindItemsByType(this, recurse, list, predicate);
return list;
}
@ -1628,7 +1623,7 @@ namespace Server.Items
{
if (current == null || current.Items.Count == 0)
return;
List<Item> items = current.Items;
for (int i = 0; i < items.Count; ++i)
@ -1655,7 +1650,7 @@ namespace Server.Items
{
if (current == null || current.Items.Count == 0)
return null;
List<Item> list = current.Items;
for (int i = 0; i < list.Count; ++i)
@ -1777,12 +1772,8 @@ namespace Server.Items
public static ContainerData GetData(int itemID)
{
ContainerData data = null;
m_Table.TryGetValue(itemID, out data);
if (data != null)
return data;
return Default;
m_Table.TryGetValue(itemID, out ContainerData data);
return data ?? Default;
}
}
}
}

View file

@ -181,10 +181,10 @@ namespace Server
Closable = true;
Disposable = true;
Dragable = true;
Draggable = true;
Resizable = false;
User.CloseGump(GetType());
User.CloseGump<EditGump>();
CompileLayout();
}
@ -201,7 +201,7 @@ namespace Server
public void Close()
{
User.CloseGump(GetType());
User.CloseGump<EditGump>();
if (Check != null && !Check.Deleted)
Check.UpdateTrade(User);

View file

@ -24,12 +24,7 @@ namespace Server
{
public abstract class BaseHairInfo
{
protected BaseHairInfo(int itemid)
: this(itemid, 0)
{
}
protected BaseHairInfo(int itemid, int hue)
protected BaseHairInfo(int itemid, int hue = 0)
{
ItemID = itemid;
Hue = hue;
@ -67,7 +62,7 @@ namespace Server
public class HairInfo : BaseHairInfo
{
public HairInfo(int itemid)
: base(itemid, 0)
: base(itemid)
{
}
@ -81,7 +76,8 @@ namespace Server
{
}
public static int FakeSerial(Mobile parent)
// TOOD: Can we make this higher for newer clients?
public static uint FakeSerial(Mobile parent)
{
return 0x7FFFFFFF - 0x400 - parent.Serial * 4;
}
@ -90,7 +86,7 @@ namespace Server
public class FacialHairInfo : BaseHairInfo
{
public FacialHairInfo(int itemid)
: base(itemid, 0)
: base(itemid)
{
}
@ -104,7 +100,8 @@ namespace Server
{
}
public static int FakeSerial(Mobile parent)
// TOOD: Can we make this higher for newer clients?
public static uint FakeSerial(Mobile parent)
{
return 0x7FFFFFFF - 0x400 - 1 - parent.Serial * 4;
}
@ -120,9 +117,7 @@ namespace Server
if (parent.SolidHueOverride >= 0)
hue = parent.SolidHueOverride;
int hairSerial = HairInfo.FakeSerial(parent);
m_Stream.Write(hairSerial);
m_Stream.Write(HairInfo.FakeSerial(parent));
m_Stream.Write((short)parent.HairItemID);
m_Stream.Write((byte)0);
m_Stream.Write((byte)Layer.Hair);
@ -141,9 +136,7 @@ namespace Server
if (parent.SolidHueOverride >= 0)
hue = parent.SolidHueOverride;
int hairSerial = FacialHairInfo.FakeSerial(parent);
m_Stream.Write(hairSerial);
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
m_Stream.Write((short)parent.FacialHairItemID);
m_Stream.Write((byte)0);
m_Stream.Write((byte)Layer.FacialHair);