fix: Fixes vendor OPL (#672)

This commit is contained in:
Kamron Batman 2021-08-03 00:34:44 -07:00 • committed by GitHub
parent 3dc406624e
commit b112be4e1f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 94 additions and 115 deletions

View file

@ -106,23 +106,7 @@ namespace Server.Mobiles
{
if (m_Amount <= 0)
{
/*
Core.ML using this vendor system is undefined behavior, so being
as it lends itself to an abusable exploit to cause ingame havok
and the stackable items are not found to be over 20 items, this is
changed until there is a better solution.
*/
object Obj_Disp = GetDisplayEntity();
if (Core.ML && Obj_Disp is Item item && !item.Stackable)
{
MaxAmount = Math.Min(20, MaxAmount);
}
else
{
MaxAmount = Math.Min(999, MaxAmount * 2);
}
MaxAmount = Math.Min(999, MaxAmount * 2);
}
else
{
@ -152,22 +136,15 @@ namespace Server.Mobiles
m_Amount = MaxAmount;
}
private bool IsDeleted(IEntity obj) => obj.Deleted;
public void DeleteDisplayEntity()
{
if (m_DisplayEntity == null)
{
return;
}
m_DisplayEntity.Delete();
m_DisplayEntity?.Delete();
m_DisplayEntity = null;
}
public IEntity GetDisplayEntity()
{
if (m_DisplayEntity != null && !IsDeleted(m_DisplayEntity))
if (m_DisplayEntity?.Deleted == false)
{
return m_DisplayEntity;
}
@ -179,13 +156,12 @@ namespace Server.Mobiles
m_DisplayEntity = DisplayCache.Cache.Lookup(Type);
}
if (m_DisplayEntity == null || IsDeleted(m_DisplayEntity))
if (m_DisplayEntity?.Deleted != false)
{
m_DisplayEntity = GetEntity();
DisplayCache.Cache.Store(Type, m_DisplayEntity, canCache);
}
DisplayCache.Cache.Store(Type, m_DisplayEntity, canCache);
return m_DisplayEntity;
}
@ -196,7 +172,7 @@ namespace Server.Mobiles
private Dictionary<Type, IEntity> m_Table;
public DisplayCache() : base(0)
private DisplayCache() : base(0)
{
m_Table = new Dictionary<Type, IEntity>();
m_Mobiles = new List<Mobile>();
@ -301,7 +277,7 @@ namespace Server.Mobiles
}
}
private void DeleteEntities(List<IEntity> entities)
private static void DeleteEntities(List<IEntity> entities)
{
foreach (var entity in entities)
{