コード例 #1
0
ファイル: Wreath.cs プロジェクト: zerodowned/angelisland
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    bool northWall = IsWall(from.X, from.Y - 1, from.Z, from.Map);
                    bool westWall  = IsWall(from.X - 1, from.Y, from.Z, from.Map);

                    if (northWall && westWall)
                    {
                        switch (from.Direction & Direction.Mask)
                        {
                        case Direction.North:
                        case Direction.South: northWall = true; westWall = false; break;

                        case Direction.East:
                        case Direction.West:  northWall = false; westWall = true; break;

                        default: from.SendMessage("Turn to face the wall on which to hang this decoration."); return;
                        }
                    }

                    int itemID = 0;

                    if (northWall)
                    {
                        itemID = 0x232C;
                    }
                    else if (westWall)
                    {
                        itemID = 0x232D;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1062840);                           // The decoration must be placed next to a wall.
                    }
                    if (itemID > 0)
                    {
                        Item addon = new WreathAddon(this.Hue);

                        addon.ItemID = itemID;
                        addon.MoveToWorld(from.Location, from.Map);

                        house.Addons.Add(addon);
                        Delete();
                    }
                }
                else
                {
                    from.SendLocalizedMessage(502092);                       // You must be in your house to do this.
                }
            }
            else
            {
                from.SendLocalizedMessage(1042001);                   // That must be in your pack for you to use it.
            }
        }
コード例 #2
0
ファイル: Wreath.cs プロジェクト: StoryOfTheBard/UOLegends
        private void PlaceAddon(Mobile from, Point3D loc, bool northWall, bool westWall)
        {
            if (Deleted)
            {
                return;
            }

            BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);

            if (house == null || !house.IsCoOwner(from))
            {
                from.SendAsciiMessage("That location is not in your house.");
                return;
            }

            int itemID = 0;

            if (northWall)
            {
                itemID = 0x232C;
            }
            else if (westWall)
            {
                itemID = 0x232D;
            }
            else
            {
                from.SendAsciiMessage("The decoration must be placed next to a wall.");
            }

            if (itemID > 0)
            {
                Item addon = new WreathAddon(this.Hue);

                addon.ItemID = itemID;
                addon.MoveToWorld(loc, from.Map);

                house.Addons.Add(addon);
                Delete();
            }
        }
コード例 #3
0
        private void PlaceAddon(Mobile from, Point3D loc, bool northWall, bool westWall)
        {
            if (Deleted)
            {
                return;
            }

            var house = BaseHouse.FindHouseAt(loc, from.Map, 16);

            if (house?.IsCoOwner(from) != true)
            {
                from.SendLocalizedMessage(1042036); // That location is not in your house.
                return;
            }

            var itemID = 0;

            if (northWall)
            {
                itemID = 0x232C;
            }
            else if (westWall)
            {
                itemID = 0x232D;
            }
            else
            {
                from.SendLocalizedMessage(1062840); // The decoration must be placed next to a wall.
            }

            if (itemID > 0)
            {
                Item addon = new WreathAddon(Hue);

                addon.ItemID = itemID;
                addon.MoveToWorld(loc, from.Map);

                house.Addons.Add(addon);
                Delete();
            }
        }
コード例 #4
0
ファイル: Wreath.cs プロジェクト: Crome696/ServUO
        private void PlaceAddon(Mobile from, Point3D loc, bool northWall, bool westWall)
        {
            if (this.Deleted)
                return;

            BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);

            if (house == null || !house.IsCoOwner(from))
            {
                from.SendLocalizedMessage(1042036); // That location is not in your house.
                return;
            }

            int itemID = 0;

            if (northWall)
                itemID = 0x232C;
            else if (westWall)
                itemID = 0x232D;
            else
                from.SendLocalizedMessage(1062840); // The decoration must be placed next to a wall.

            if (itemID > 0)
            {
                Item addon = new WreathAddon(this.Hue);

                addon.ItemID = itemID;
                addon.MoveToWorld(loc, from.Map);

                house.Addons.Add(addon);
                this.Delete();
            }
        }
コード例 #5
0
ファイル: Wreath.cs プロジェクト: zerodowned/angelisland
		public override void OnDoubleClick( Mobile from )
		{
			if ( IsChildOf( from.Backpack ) )
			{
				BaseHouse house = BaseHouse.FindHouseAt( from );

				if ( house != null && house.IsCoOwner( from ) )
				{
					bool northWall = IsWall( from.X, from.Y - 1, from.Z, from.Map );
					bool westWall = IsWall( from.X - 1, from.Y, from.Z, from.Map );

					if ( northWall && westWall )
					{
						switch ( from.Direction & Direction.Mask )
						{
							case Direction.North:
							case Direction.South: northWall = true; westWall = false; break;

							case Direction.East:
							case Direction.West:  northWall = false; westWall = true; break;

							default: from.SendMessage( "Turn to face the wall on which to hang this decoration." ); return;
						}
					}

					int itemID = 0;

					if ( northWall )
						itemID = 0x232C;
					else if ( westWall )
						itemID = 0x232D;
					else
						from.SendLocalizedMessage( 1062840 ); // The decoration must be placed next to a wall.

					if ( itemID > 0 )
					{
						Item addon = new WreathAddon( this.Hue );

						addon.ItemID = itemID;
						addon.MoveToWorld( from.Location, from.Map );

						house.Addons.Add( addon );
						Delete();
					}
				}
				else
				{
					from.SendLocalizedMessage( 502092 ); // You must be in your house to do this.
				}
			}
			else
			{
				from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it.
			}
		}