Esempio n. 1
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_FirefliesDeed?.Deleted != false)
                {
                    return;
                }

                if (m_FirefliesDeed.IsChildOf(from.Backpack))
                {
                    var house = BaseHouse.FindHouseAt(from);

                    if (house?.IsOwner(from) == true)
                    {
                        var p   = targeted as IPoint3D;
                        var map = from.Map;

                        if (p == null || map == null || map == Map.Internal)
                        {
                            return;
                        }

                        var p3d = new Point3D(p);
                        var id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house?.IsOwner(from) == true)
                            {
                                var north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                var west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                bool isclear = true;

                                foreach (Item item in Map.Malas.GetItemsInRange(p3d, 0))
                                {
                                    if (item is Fireflies)
                                    {
                                        isclear = false;
                                    }
                                }

                                if ((m_ItemID == 0x2336 && north || m_ItemID == 0x2332 && west) && isclear)
                                {
                                    var flies = new Fireflies(m_ItemID);

                                    house.Addons.Add(flies);

                                    flies.MoveToWorld(p3d, from.Map);

                                    m_FirefliesDeed.Delete();
                                }
                                else
                                {
                                    from.SendLocalizedMessage(1150065); // Holiday fireflies must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036); // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269); // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092); // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038); // You must have the object in your backpack to use it.
                }
            }
Esempio n. 2
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_FirefliesDeed == null || m_FirefliesDeed.Deleted)
                {
                    return;
                }

                if (m_FirefliesDeed.IsChildOf(from.Backpack))
                {
                    BaseHouse house = BaseHouse.FindHouseAt(from);

                    if (house != null && house.IsOwner(from))
                    {
                        IPoint3D p   = targeted as IPoint3D;
                        Map      map = from.Map;

                        if (p == null || map == null || map == Map.Internal)
                        {
                            return;
                        }

                        Point3D  p3d = new Point3D(p);
                        ItemData id  = TileData.ItemTable[m_ItemID & TileData.MaxItemValue];

                        if (map.CanFit(p3d, id.Height))
                        {
                            house = BaseHouse.FindHouseAt(p3d, map, id.Height);

                            if (house != null && house.IsOwner(from))
                            {
                                bool north = BaseAddon.IsWall(p3d.X, p3d.Y - 1, p3d.Z, map);
                                bool west  = BaseAddon.IsWall(p3d.X - 1, p3d.Y, p3d.Z, map);

                                if ((m_ItemID == 0x2336 && north) || (m_ItemID == 0x2332 && west))
                                {
                                    Fireflies flies = new Fireflies(m_ItemID);

                                    house.Addons.Add(flies);

                                    flies.MoveToWorld(p3d, from.Map);

                                    m_FirefliesDeed.Delete();
                                }

                                else
                                {
                                    from.SendLocalizedMessage(1150065);                                       // Holiday fireflies must be placed next to a wall.
                                }
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042036);                                   // That location is not in your house.
                            }
                        }
                        else
                        {
                            from.SendLocalizedMessage(500269);                               // You cannot build that there.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502092);                           // You must be in your house to do this.
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1042038);                       // You must have the object in your backpack to use it.
                }
            }
Esempio n. 3
0
			protected override void OnTarget( Mobile from, object targeted )
			{
				if( m_FirefliesDeed == null || m_FirefliesDeed.Deleted )
					return;

				if( m_FirefliesDeed.IsChildOf( from.Backpack ) )
				{
					BaseHouse house = BaseHouse.FindHouseAt( from );

					if( house != null && house.IsOwner( from ) )
					{
						IPoint3D p = targeted as IPoint3D;
						Map map = from.Map;

						if( p == null || map == null || map == Map.Internal )
							return;

						Point3D p3d = new Point3D( p );
						ItemData id = TileData.ItemTable[ m_ItemID & TileData.MaxItemValue ];

						if( map.CanFit( p3d, id.Height ) )
						{
							house = BaseHouse.FindHouseAt( p3d, map, id.Height );

							if( house != null && house.IsOwner( from ) )
							{
								bool north = BaseAddon.IsWall( p3d.X, p3d.Y - 1, p3d.Z, map );
								bool west = BaseAddon.IsWall( p3d.X - 1, p3d.Y, p3d.Z, map );

								bool isclear = true;

								foreach( Item item in Map.Malas.GetItemsInRange( p3d, 0 ) )
								{
									if( item is Fireflies )
									{
										isclear = false;
									}
								}

								if( ( ( m_ItemID == 0x2336 && north ) || ( m_ItemID == 0x2332 && west ) ) && isclear )
								{
									Fireflies flies = new Fireflies( m_ItemID );

									house.Addons.Add( flies );

									flies.MoveToWorld( p3d, from.Map );

									m_FirefliesDeed.Delete();
								}

								else
									from.SendLocalizedMessage( 1150065 ); // Holiday fireflies must be placed next to a wall.
							}
							else
								from.SendLocalizedMessage( 1042036 ); // That location is not in your house.
						}
						else
							from.SendLocalizedMessage( 500269 ); // You cannot build that there.
					}
					else
						from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
				}
				else
					from.SendLocalizedMessage( 1042038 ); // You must have the object in your backpack to use it.
			}