Fixes packet length & PropertyList (#82)
This commit is contained in:
parent
1f1ceade8c
commit
27e8d823bd
20 changed files with 251 additions and 225 deletions
|
|
@ -111,19 +111,9 @@ namespace Server.Items
|
|||
&& mcl.Tiles[x][y].Length > 0;
|
||||
}
|
||||
|
||||
public bool Contains(Mobile m)
|
||||
{
|
||||
if (m.Map == Map)
|
||||
return Contains(m.X, m.Y);
|
||||
return false;
|
||||
}
|
||||
public bool Contains(Mobile m) => m.Map == Map && Contains(m.X, m.Y);
|
||||
|
||||
public bool Contains(Item item)
|
||||
{
|
||||
if (item.Map == Map)
|
||||
return Contains(item.X, item.Y);
|
||||
return false;
|
||||
}
|
||||
public bool Contains(Item item) => item.Map == Map && Contains(item.X, item.Y);
|
||||
|
||||
public override void Serialize(IGenericWriter writer)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
@ -1322,10 +1323,7 @@ namespace Server.Items
|
|||
for (int j = 0; j < groups.Count; ++j)
|
||||
{
|
||||
Item[] items = groups[j].ToArray();
|
||||
int total = 0;
|
||||
|
||||
for (int k = 0; k < items.Length; ++k)
|
||||
total += items[k].Amount;
|
||||
int total = items.Sum(t => t.Amount);
|
||||
|
||||
if (total >= best)
|
||||
best = total;
|
||||
|
|
@ -1387,29 +1385,9 @@ namespace Server.Items
|
|||
return best;
|
||||
}
|
||||
|
||||
public int GetAmount(Type type, bool recurse = true)
|
||||
{
|
||||
Item[] items = FindItemsByType(type, recurse);
|
||||
public int GetAmount(Type type, bool recurse = true) => FindItemsByType(type, recurse).Sum(t => t.Amount);
|
||||
|
||||
int amount = 0;
|
||||
|
||||
for (int i = 0; i < items.Length; ++i)
|
||||
amount += items[i].Amount;
|
||||
|
||||
return amount;
|
||||
}
|
||||
|
||||
public int GetAmount(Type[] types, bool recurse = true)
|
||||
{
|
||||
Item[] items = FindItemsByType(types, recurse);
|
||||
|
||||
int amount = 0;
|
||||
|
||||
for (int i = 0; i < items.Length; ++i)
|
||||
amount += items[i].Amount;
|
||||
|
||||
return amount;
|
||||
}
|
||||
public int GetAmount(Type[] types, bool recurse = true) => FindItemsByType(types, recurse).Sum(t => t.Amount);
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -106,10 +106,7 @@ namespace Server
|
|||
public HairEquipUpdate(Mobile parent)
|
||||
: base(0x2E, 15)
|
||||
{
|
||||
int hue = parent.HairHue;
|
||||
|
||||
if (parent.SolidHueOverride >= 0)
|
||||
hue = parent.SolidHueOverride;
|
||||
int hue = parent.SolidHueOverride >= 0 ? parent.SolidHueOverride : parent.HairHue;
|
||||
|
||||
m_Stream.Write(HairInfo.FakeSerial(parent));
|
||||
m_Stream.Write((short)parent.HairItemID);
|
||||
|
|
@ -125,10 +122,7 @@ namespace Server
|
|||
public FacialHairEquipUpdate(Mobile parent)
|
||||
: base(0x2E, 15)
|
||||
{
|
||||
int hue = parent.FacialHairHue;
|
||||
|
||||
if (parent.SolidHueOverride >= 0)
|
||||
hue = parent.SolidHueOverride;
|
||||
int hue = parent.SolidHueOverride >= 0 ? parent.SolidHueOverride : parent.FacialHairHue;
|
||||
|
||||
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
|
||||
m_Stream.Write((short)parent.FacialHairItemID);
|
||||
|
|
@ -156,4 +150,4 @@ namespace Server
|
|||
m_Stream.Write(FacialHairInfo.FakeSerial(parent));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue