Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -485,6 +485,9 @@ namespace Server.Items
int extraItems = 0;
int extraWeight = 0;
// from.SendMessage( String.Format( "There are {0} items in this container.", this.Items.Count ) );
// from.SendMessage( String.Format( "There are {0} items being dropped into this container.", droppedItems.Length ) );
for (int i = 0; i < droppedItems.Length; i++)
{
Item dropped = droppedItems[i];
@ -593,7 +596,9 @@ namespace Server.Items
}
}
else
{
from.SendLocalizedMessage(500446); // That is too far away.
}
}
public virtual bool CheckContentDisplay(Mobile from) =>
@ -625,7 +630,10 @@ namespace Server.Items
if (ns != null)
{
Packets.SendDisplayContainer(ns, Serial, (short)GumpID);
if (ns.HighSeas)
to.Send(new ContainerDisplayHS(this));
else
to.Send(new ContainerDisplay(this));
SendContentTo(ns);
@ -634,7 +642,7 @@ namespace Server.Items
List<Item> items = Items;
for (int i = 0; i < items.Count; ++i)
items[i].PropertyList.SendOPLInfo(ns);
to.Send(items[i].OPLPacket);
}
}
}
@ -656,7 +664,9 @@ namespace Server.Items
Mobile mob = Openers[i];
if (mob == opener)
{
contains = true;
}
else
{
int range = GetUpdateRange(mob);
@ -669,14 +679,24 @@ namespace Server.Items
if (!contains)
{
Openers ??= new List<Mobile>();
if (Openers == null)
Openers = new List<Mobile>();
Openers.Add(opener);
}
else if (Openers?.Count == 0)
{
Openers = null;
}
}
public virtual void SendContentTo(NetState state) => Packets.SendContainerContent(state, state.Mobile, this);
public virtual void SendContentTo(NetState state)
{
if (state?.ContainerGridLines == true)
state.Send(new ContainerContent6017(state.Mobile, this));
else
state.Send(new ContainerContent(state.Mobile, this));
}
public override void GetProperties(ObjectPropertyList list)
{
@ -788,7 +808,8 @@ namespace Server.Items
for (int j = 0; j < items[i].Length; ++j)
totals[i] += items[i][j].Amount;
hasEnough |= totals[i] >= amount;
if (totals[i] >= amount)
hasEnough = true;
}
if (!hasEnough)
@ -880,7 +901,8 @@ namespace Server.Items
for (int k = 0; k < items[i][j].Length; ++k)
totals[i][j] += items[i][j][k].Amount;
hasEnough |= totals[i][j] >= amounts[i];
if (totals[i][j] >= amounts[i])
hasEnough = true;
}
if (!hasEnough)
@ -974,7 +996,8 @@ namespace Server.Items
for (int k = 0; k < items[i][j].Length; ++k)
totals[i][j] += items[i][j][k].Amount;
hasEnough |= totals[i][j] >= amounts[i];
if (totals[i][j] >= amounts[i])
hasEnough = true;
}
if (!hasEnough)
@ -1575,10 +1598,12 @@ namespace Server.Items
public class ContainerData
{
private static readonly Dictionary<int, ContainerData> Table = new Dictionary<int, ContainerData>();
private static Dictionary<int, ContainerData> m_Table;
static ContainerData()
{
m_Table = new Dictionary<int, ContainerData>();
string path = Path.Combine(Core.BaseDirectory, "Data/containers.cfg");
if (!File.Exists(path))
@ -1604,7 +1629,7 @@ namespace Server.Items
if (split.Length >= 3)
{
int gumpId = Utility.ToInt32(split[0]);
int gumpID = Utility.ToInt32(split[0]);
string[] aRect = split[1].Split(' ');
if (aRect.Length < 4)
@ -1619,9 +1644,10 @@ namespace Server.Items
int dropSound = Utility.ToInt32(split[2]);
ContainerData data = new ContainerData(gumpId, bounds, dropSound);
ContainerData data = new ContainerData(gumpID, bounds, dropSound);
Default ??= data;
if (Default == null)
Default = data;
if (split.Length >= 4)
{
@ -1631,10 +1657,10 @@ namespace Server.Items
{
int id = Utility.ToInt32(aIDs[i]);
if (Table.ContainsKey(id))
if (m_Table.ContainsKey(id))
Console.WriteLine(@"Warning: double ItemID entry in Data\containers.cfg");
else
Table[id] = data;
m_Table[id] = data;
}
}
}
@ -1646,12 +1672,13 @@ namespace Server.Items
}
}
Default ??= new ContainerData(0x3C, new Rectangle2D(44, 65, 142, 94), 0x48);
if (Default == null)
Default = new ContainerData(0x3C, new Rectangle2D(44, 65, 142, 94), 0x48);
}
public ContainerData(int gumpId, Rectangle2D bounds, int dropSound)
public ContainerData(int gumpID, Rectangle2D bounds, int dropSound)
{
GumpID = gumpId;
GumpID = gumpID;
Bounds = bounds;
DropSound = dropSound;
}
@ -1664,9 +1691,9 @@ namespace Server.Items
public int DropSound{ get; }
public static ContainerData GetData(int itemId)
public static ContainerData GetData(int itemID)
{
Table.TryGetValue(itemId, out ContainerData data);
m_Table.TryGetValue(itemID, out ContainerData data);
return data ?? Default;
}
}