Merges bug fixes and cleanup with master (#17)

This commit is contained in:
Kamron Batman 2019-03-03 15:50:57 -08:00 • committed by GitHub
parent 39dfe86e10
commit 55136d8842
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 157 additions and 234 deletions

View file

@ -83,11 +83,7 @@ namespace Server.Items
list.Add(1060738, worth); // value: ~1_val~
}
#if NEWPARENT
public override void OnAdded(IEntity parent)
#else
public override void OnAdded(object parent)
#endif
{
base.OnAdded(parent);
@ -98,7 +94,8 @@ namespace Server.Items
Container root = parent as Container;
while (root?.Parent is Container) root = (Container)root.Parent;
while (root?.Parent is Container container)
root = container;
parent = root ?? parent;
@ -247,4 +244,4 @@ namespace Server.Items
}
}
}
}
}

View file

@ -44,11 +44,7 @@ namespace Server.Items
UpdateTotal(this, TotalType.Gold, newValue - oldValue);
}
#if NEWPARENT
public override void OnAdded(IEntity parent)
#else
public override void OnAdded(object parent)
#endif
{
base.OnAdded(parent);
@ -59,7 +55,8 @@ namespace Server.Items
Container root = parent as Container;
while (root?.Parent is Container) root = (Container)root.Parent;
while (root?.Parent is Container container)
root = container;
parent = root ?? parent;
@ -127,4 +124,4 @@ namespace Server.Items
int version = reader.ReadInt();
}
}
}
}

View file

@ -53,7 +53,7 @@ namespace Server.Items
}
else if (targeted is Item item)
{
object root = item.RootParent;
IEntity root = item.RootParent;
if (root != null && root != from || item.Parent == from)
{
@ -61,10 +61,7 @@ namespace Server.Items
}
else if (item.Movable)
{
if (item.Amount > 1)
message = "You place one item on the scale. ";
else
message = "You place that item on the scale. ";
message = item.Amount > 1 ? "You place one item on the scale. " : "You place that item on the scale. ";
double weight = item.Weight;