protected override void OnTarget(Mobile from, object targeted) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if (p == null || map == null || m_Deed == null || m_Deed.Deleted) { return; } if (m_Deed.IsChildOf(from.Backpack)) { SpellHelper.GetSurfaceTop(ref p); BaseHouse house = null; Point3D loc = new Point3D(p); if (targeted is Item && !((Item)targeted).IsLockedDown && !((Item)targeted).IsSecure && !(targeted is AddonComponent)) { from.SendMessage("Grandfather clocks can only be placed in houses."); return; } AddonFitResult result = CouldFit(loc, map, from, ref house); if (result == AddonFitResult.Valid || from.AccessLevel >= AccessLevel.GameMaster) { BaseGrandfatherClock clock; switch (m_Deed.ClockType) { default: case GrandfatherClockType.Small: clock = new SmallGrandfatherClock(); break; case GrandfatherClockType.Large: clock = new LargeGrandfatherClock(); break; case GrandfatherClockType.White: clock = new WhiteGrandfatherClock(); break; } if (house != null) { house.Addons.Add(clock); } //if ( m_Deed is IRewardItem ) // clock.IsRewardItem = ( (IRewardItem) m_Deed).IsRewardItem; m_Deed.Delete(); clock.MoveToWorld(loc, map); } else if (result == AddonFitResult.Blocked) { from.SendLocalizedMessage(500269); // You cannot build that there. } else if (result == AddonFitResult.NotInHouse) { from.SendMessage("Grandfather clocks can only be placed in houses where you are the owner or co-owner"); } else if (result == AddonFitResult.DoorTooClose) { from.SendLocalizedMessage(500271); // You cannot build near the door. } } else { from.SendLocalizedMessage(1042001); // That must be in your pack for you to use it. } }
protected override void OnTarget( Mobile from, object targeted ) { IPoint3D p = targeted as IPoint3D; Map map = from.Map; if ( p == null || map == null || m_Deed == null || m_Deed.Deleted ) return; if ( m_Deed.IsChildOf( from.Backpack ) ) { SpellHelper.GetSurfaceTop( ref p ); BaseHouse house = null; Point3D loc = new Point3D( p ); if ( targeted is Item && !((Item) targeted).IsLockedDown && !((Item) targeted).IsSecure && !(targeted is AddonComponent) ) { from.SendMessage( "Grandfather clocks can only be placed in houses." ); return; } AddonFitResult result = CouldFit( loc, map, from, ref house ); if ( result == AddonFitResult.Valid || from.AccessLevel >= AccessLevel.GameMaster ) { BaseGrandfatherClock clock; switch ( m_Deed.ClockType ) { default: case GrandfatherClockType.Small: clock = new SmallGrandfatherClock(); break; case GrandfatherClockType.Large: clock = new LargeGrandfatherClock(); break; case GrandfatherClockType.White: clock = new WhiteGrandfatherClock(); break; } if ( house != null ) house.Addons.Add( clock ); //if ( m_Deed is IRewardItem ) // clock.IsRewardItem = ( (IRewardItem) m_Deed).IsRewardItem; m_Deed.Delete(); clock.MoveToWorld( loc, map ); } else if ( result == AddonFitResult.Blocked ) from.SendLocalizedMessage( 500269 ); // You cannot build that there. else if ( result == AddonFitResult.NotInHouse ) from.SendMessage( "Grandfather clocks can only be placed in houses where you are the owner or co-owner" ); else if ( result == AddonFitResult.DoorTooClose ) from.SendLocalizedMessage( 500271 ); // You cannot build near the door. } else from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. }