Fixes parent references. (#15)
This commit is contained in:
parent
01d0fb75b8
commit
90ffe0ea3c
20 changed files with 55 additions and 93 deletions
|
|
@ -84,7 +84,7 @@ namespace Server
|
|||
void OnConnectionChanged();
|
||||
bool OnCasterMoving(Direction d);
|
||||
bool OnCasterEquipping(Item item);
|
||||
bool OnCasterUsingObject(object o);
|
||||
bool OnCasterUsingObject(IEntity entity);
|
||||
bool OnCastInTown(Region r);
|
||||
}
|
||||
|
||||
|
|
@ -111,4 +111,4 @@ namespace Server
|
|||
void OnBeforeSpawn(Point3D location, Map map);
|
||||
void OnAfterSpawn();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3681,15 +3681,13 @@ namespace Server
|
|||
target.Map == null)
|
||||
return false;
|
||||
|
||||
object root = target.RootParent;
|
||||
|
||||
if (from.AccessLevel < AccessLevel.GameMaster && !from.InRange(target.GetWorldLocation(), 2))
|
||||
return false;
|
||||
if (!from.CanSee(target) || !from.InLOS(target))
|
||||
return false;
|
||||
if (!target.IsAccessibleTo(from))
|
||||
return false;
|
||||
if (root is Mobile mobile && !mobile.CheckNonlocalDrop(from, this, target))
|
||||
if (target.RootParent is Mobile mobile && !mobile.CheckNonlocalDrop(from, this, target))
|
||||
return false;
|
||||
if (!from.OnDroppedItemToItem(this, target, p))
|
||||
return false;
|
||||
|
|
@ -4290,11 +4288,6 @@ namespace Server
|
|||
Delete();
|
||||
}
|
||||
|
||||
public virtual bool CheckBlessed(object obj)
|
||||
{
|
||||
return CheckBlessed(obj as Mobile);
|
||||
}
|
||||
|
||||
public virtual bool CheckBlessed(Mobile m)
|
||||
{
|
||||
if (m_LootType == LootType.Blessed || Mobile.InsuranceEnabled && Insured)
|
||||
|
|
|
|||
|
|
@ -233,7 +233,7 @@ namespace Server.Items
|
|||
}
|
||||
}
|
||||
|
||||
object parent = Parent;
|
||||
IEntity parent = Parent;
|
||||
|
||||
while (parent != null)
|
||||
{
|
||||
|
|
@ -627,15 +627,9 @@ namespace Server.Items
|
|||
|
||||
public virtual bool CheckContentDisplay(Mobile from)
|
||||
{
|
||||
if (DisplaysContent)
|
||||
{
|
||||
object root = RootParent;
|
||||
|
||||
if (root == null || root is Item || root == from || from.AccessLevel > AccessLevel.Player)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return DisplaysContent && RootParent == null ||
|
||||
RootParent is Item || RootParent == from ||
|
||||
from.AccessLevel > AccessLevel.Player;
|
||||
}
|
||||
|
||||
public override void OnSingleClick(Mobile from)
|
||||
|
|
|
|||
|
|
@ -4667,7 +4667,7 @@ namespace Server
|
|||
if (m_Spell != null && !m_Spell.OnCasterUsingObject(item))
|
||||
return;
|
||||
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
bool okay = false;
|
||||
|
||||
if (!Utility.InUpdateRange(this, item.GetWorldLocation()))
|
||||
|
|
@ -4789,7 +4789,7 @@ namespace Server
|
|||
}
|
||||
else
|
||||
{
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
|
||||
if (root is Mobile mobile && !mobile.CheckNonlocalLift(from, item))
|
||||
{
|
||||
|
|
@ -4964,7 +4964,7 @@ namespace Server
|
|||
if (DragEffects && !item.Deleted)
|
||||
{
|
||||
Map map = m_Map;
|
||||
object root = item.RootParent;
|
||||
IEntity root = item.RootParent;
|
||||
|
||||
if (map != null && (root == null || root is Item))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ namespace Server
|
|||
UnsafeNativeMethods.ReadFile(ptr, buffer, (uint)length, ref lpNumberOfBytesRead, null);
|
||||
}
|
||||
|
||||
internal class UnsafeNativeMethods
|
||||
internal static class UnsafeNativeMethods
|
||||
{
|
||||
/*[DllImport("kernel32")]
|
||||
internal unsafe static extern int _lread(IntPtr hFile, void* lpBuffer, int wBytes);*/
|
||||
|
|
@ -74,10 +74,10 @@ namespace Server
|
|||
UnsafeNativeMethods.read(ptr, buffer, length);
|
||||
}
|
||||
|
||||
internal class UnsafeNativeMethods
|
||||
internal static class UnsafeNativeMethods
|
||||
{
|
||||
[DllImport("libc")]
|
||||
internal static extern unsafe int read(IntPtr ptr, void* buffer, int length);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -165,9 +165,7 @@ namespace Server.Targeting
|
|||
return;
|
||||
}
|
||||
|
||||
object root = item.RootParent;
|
||||
|
||||
if (!AllowNonlocal && root is Mobile && root != from && from.AccessLevel == AccessLevel.Player)
|
||||
if (!AllowNonlocal && item.RootParent is Mobile && item.RootParent != from && from.AccessLevel == AccessLevel.Player)
|
||||
{
|
||||
OnNonlocalTarget(from, item);
|
||||
OnTargetFinish(from);
|
||||
|
|
@ -290,4 +288,4 @@ namespace Server.Targeting
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue