Exemple #1
0
        public override void OnDoubleClick(Mobile from)
        {
            if (IsChildOf(from.Backpack))
            {
                BaseHouse house = BaseHouse.FindHouseAt(from);

                if (house != null && house.IsCoOwner(from))
                {
                    bool northWall = BaseAddon.IsWall(from.X, from.Y - 1, from.Z, from.Map);
                    bool westWall  = BaseAddon.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 trophy."); return;
                        }
                    }

                    int itemID = 0;

                    if (northWall)
                    {
                        itemID = m_NorthID;
                    }
                    else if (westWall)
                    {
                        itemID = m_WestID;
                    }
                    else
                    {
                        from.SendLocalizedMessage(1042626);                           // The trophy must be placed next to a wall.
                    }
                    if (itemID > 0)
                    {
                        TrophyAddon trophy = new TrophyAddon(itemID, m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight, Hue);
                        trophy.Movable = false;
                        trophy.MoveToWorld(from.Location, from.Map);
                        house.Addons.Add(trophy);
                        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.
            }
        }
        public override void OnDoubleClick( Mobile from )
        {
            if ( IsChildOf( from.Backpack ) )
            {
                BaseHouse house = BaseHouse.FindHouseAt( from );

                if ( house != null && house.IsCoOwner( from ) )
                {
                    bool northWall = BaseAddon.IsWall( from.X, from.Y - 1, from.Z, from.Map );
                    bool westWall = BaseAddon.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 trophy." ); return;
                        }
                    }

                    int itemID = 0;

                    if ( northWall )
                        itemID = m_NorthID;
                    else if ( westWall )
                        itemID = m_WestID;
                    else
                        from.SendLocalizedMessage( 1042626 ); // The trophy must be placed next to a wall.

                    if ( itemID > 0 )
                    {
                        TrophyAddon trophy = new TrophyAddon( itemID, m_WestID, m_NorthID, m_DeedNumber, m_AddonNumber, m_Hunter, m_AnimalWeight, Hue );
                        trophy.Movable = false;
                        trophy.MoveToWorld( from.Location, from.Map );
                        house.Addons.Add( trophy );
                        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.
        }