public override bool OnDroppedItemToWorld(Item item, Point3D location)
{
if (!base.OnDroppedItemToWorld(item, location))
return false;
BounceInfo bi = item.GetBounce();
if (bi != null)
{
Type type = item.GetType();
if (type.IsDefined(typeof(FurnitureAttribute), true) || type.IsDefined(typeof(DynamicFlipingAttribute), true))
{
object[] objs = type.GetCustomAttributes(typeof(FlipableAttribute), true);
if (objs != null && objs.Length > 0)
{
FlipableAttribute fp = objs[0] as FlipableAttribute;
if (fp != null)
{
int[] itemIDs = fp.ItemIDs;
Point3D oldWorldLoc = bi.m_WorldLoc;
Point3D newWorldLoc = location;
if (oldWorldLoc.X != newWorldLoc.X || oldWorldLoc.Y != newWorldLoc.Y)
{
Direction dir = GetDirection4(oldWorldLoc, newWorldLoc);
if (itemIDs.Length == 2)
{
switch (dir)
{
case Direction.North:
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East:
case Direction.West: item.ItemID = itemIDs[1]; break;
}
}
else if (itemIDs.Length == 4)
{
switch (dir)
{
case Direction.South: item.ItemID = itemIDs[0]; break;
case Direction.East: item.ItemID = itemIDs[1]; break;
case Direction.North: item.ItemID = itemIDs[2]; break;
case Direction.West: item.ItemID = itemIDs[3]; break;
}
}
}
}
}
}
}
return true;
}