Fix bounce exploit (#281)

Bumps release version
This commit is contained in:
Kamron Batman 2020-10-20 22:57:57 -07:00 committed by GitHub
parent d366fa8e3c
commit 185bee7ae2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 36 deletions

View file

@ -18,6 +18,8 @@ namespace Server
bool InRange(Point3D p, int range);
bool InRange(IPoint2D p, int range);
void RemoveItem(Item item);
}
public class Entity : IEntity, IComparable<Entity>
@ -62,6 +64,10 @@ namespace Server
{
}
public void RemoveItem(Item item)
{
}
public bool InRange(Point2D p, int range) =>
p.m_X >= Location.m_X - range
&& p.m_X <= Location.m_X + range

View file

@ -2170,60 +2170,54 @@ namespace Server
public void Bounce(Mobile from)
{
if (m_Parent is Item item)
{
item.RemoveItem(this);
}
else if (m_Parent is Mobile mobile)
{
mobile.RemoveItem(this);
}
m_Parent.RemoveItem(this);
m_Parent = null;
var bounce = GetBounce();
if (bounce != null)
if (bounce == null)
{
var parent = bounce.Parent;
MoveToWorld(from.Location, from.Map);
return;
}
if (parent?.Deleted != false)
{
MoveToWorld(bounce.WorldLoc, bounce.Map);
}
else if (parent is Item p)
{
var root = p.RootParent;
var parent = bounce.Parent;
if (p.IsAccessibleTo(from) &&
(!(root is Mobile mobileRoot) || mobileRoot.CheckNonlocalDrop(from, this, p)))
{
Location = bounce.Location;
p.AddItem(this);
}
else
{
MoveToWorld(from.Location, from.Map);
}
}
else if (parent is Mobile parentMobile)
if (parent?.Deleted != false)
{
MoveToWorld(from.Location, from.Map);
return;
}
if (parent is Item ip)
{
var root = ip.RootParent;
var rpm = root as Mobile;
if (ip.IsAccessibleTo(from) &&
rpm?.CheckNonlocalDrop(from, this, ip) == true &&
(!ip.Movable || rpm == from || ip.Map == bounce.Map && root.Location == bounce.WorldLoc)
)
{
if (!parentMobile.EquipItem(this))
{
MoveToWorld(bounce.WorldLoc, bounce.Map);
}
Location = bounce.Location;
ip.AddItem(this);
}
else
{
MoveToWorld(bounce.WorldLoc, bounce.Map);
MoveToWorld(from.Location, from.Map);
}
ClearBounce();
}
else if ((parent as Mobile)?.EquipItem(this) == false)
{
MoveToWorld(bounce.WorldLoc, bounce.Map);
}
else
{
MoveToWorld(from.Location, from.Map);
}
ClearBounce();
}
/// <summary>