Esempio n. 1
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            m_Region = new HouseRegion(this);

            switch (version)
            {
            case 0:
            {
                m_KeyValue          = reader.ReadUInt();
                m_Visits            = reader.ReadInt();
                m_Price             = reader.ReadInt();
                m_BuiltOn           = reader.ReadDateTime();
                m_LastTraded        = reader.ReadDateTime();
                m_Public            = reader.ReadBool();
                m_Region.GoLocation = reader.ReadPoint3D();
                if (version < 8)
                {
                    m_Price = DefaultPrice;
                }

                m_Owner = reader.ReadMobile();

                UpdateRegionArea();

                Region.AddRegion(m_Region);

                m_Sign  = reader.ReadItem() as HouseSign;
                m_Trash = reader.ReadItem() as TrashBarrel;

                m_Doors  = reader.ReadItemList();
                m_Addons = reader.ReadItemList();

                if ((Map == null || Map == Map.Internal) && Location == Point3D.Zero)
                {
                    Delete();
                }
                break;
            }
            }
        }
Esempio n. 2
0
        public void AddTrashBarrel(Mobile from)
        {
            for (int i = 0; m_Doors != null && i < m_Doors.Count; ++i)
            {
                BaseDoor door = m_Doors[i] as BaseDoor;
                Point3D  p    = door.Location;

                if (door.Open)
                {
                    p = new Point3D(p.X - door.Offset.X, p.Y - door.Offset.Y, p.Z - door.Offset.Z);
                }

                if ((from.Z + 16) >= p.Z && (p.Z + 16) >= from.Z)
                {
                    if (from.InRange(p, 1))
                    {
                        from.SendLocalizedMessage(502120);                           // You cannot place a trash barrel near a door or near steps.
                        return;
                    }
                }
            }

            if (m_Trash == null || m_Trash.Deleted)
            {
                m_Trash = new TrashBarrel();

                m_Trash.Movable = false;
                m_Trash.MoveToWorld(from.Location, from.Map);

                from.SendLocalizedMessage(502121);                   /* You have a new trash barrel.
                                                                      * Three minutes after you put something in the barrel, the trash will be emptied.
                                                                      * Be forewarned, this is permanent! */
            }
            else
            {
                m_Trash.MoveToWorld(from.Location, from.Map);
            }
        }
Esempio n. 3
0
        public override void OnSpeech(SpeechEventArgs e)
        {
            base.OnSpeech(e);

            Mobile from = e.Mobile;
            Item   sign = m_House.Sign;

            bool isOwner   = m_House.IsOwner(from);
            bool isCoOwner = isOwner || m_House.IsCoOwner(from);
            bool isFriend  = isCoOwner || m_House.IsFriend(from);

            if (!isFriend)
            {
                return;
            }

            if (!from.Alive)
            {
                return;
            }

            /*Zycron
            *  if ( Core.ML && Insensitive.Equals( e.Speech, "I wish to resize my house" ) )
            *  {
            *       if ( from.Map != sign.Map || !from.InRange( sign, 0 ) )
            *       {
            *           from.SendLocalizedMessage( 500295 ); // you are too far away to do that.
            *       }
            *       else if ( DateTime.UtcNow  <= m_House.BuiltOn.AddHours ( 1 ) )
            *       {
            *               from.SendLocalizedMessage( 1080178 ); // You must wait one hour between each house demolition.
            *       }
            *       else if ( isOwner )
            *       {
            *               from.CloseGump( typeof( ConfirmHouseResize ) );
            *               from.CloseGump( typeof( HouseGumpAOS ) );
            *               from.SendGump( new ConfirmHouseResize( from, m_House ) );
            *       }
            *       else
            *       {
            *               from.SendLocalizedMessage( 501320 ); // Only the house owner may do this.
            *       }
            *  }
            *
            *  if ( !m_House.IsInside( from ) || !m_House.IsActive )
            *       return;
            *  Zycron*/
            else if (e.HasKeyword(0x33))                 // remove thyself
            {
                if (isFriend)
                {
                    from.SendLocalizedMessage(501326);                       // Target the individual to eject from this house.
                    from.Target = new HouseKickTarget(m_House);
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x34))                 // I ban thee
            {
                if (!isFriend)
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }

/*Zycron
 *                              else if ( !m_House.Public && m_House.IsAosRules )
 *                              {
 *                                      from.SendLocalizedMessage( 1062521 ); // You cannot ban someone from a private house.  Revoke their access instead.
 *                              }
 * Zycron */
                else
                {
                    from.SendLocalizedMessage(501325);                       // Target the individual to ban from this house.
                    from.Target = new HouseBanTarget(true, m_House);
                }
            }
            else if (e.HasKeyword(0x23))                 // I wish to lock this down
            {
                if (isCoOwner)
                {
                    from.SendLocalizedMessage(502097);                       // Lock what down?
                    from.Target = new LockdownTarget(false, m_House);
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x24))                 // I wish to release this
            {
                if (isCoOwner)
                {
                    from.SendLocalizedMessage(502100);                       // Choose the item you wish to release
                    from.Target = new LockdownTarget(true, m_House);
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x25))                 // I wish to secure this
            {
                if (isOwner)
                {
                    from.SendLocalizedMessage(502103);                       // Choose the item you wish to secure
                    from.Target = new  SecureTarget(false, m_House);
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x26))                 // I wish to unsecure this
            {
                if (isOwner)
                {
                    from.SendLocalizedMessage(502106);                       // Choose the item you wish to unsecure
                    from.Target = new  SecureTarget(true, m_House);
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x27))                 // I wish to place a strongbox
            {
                if (isOwner)
                {
                    from.SendLocalizedMessage(502109);                       // Owners do not get a strongbox of their own.
                }
                else if (isCoOwner)
                {
                    m_House.AddStrongBox(from);
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
            else if (e.HasKeyword(0x28))                 // trash barrel
            {
                TrashBarrel t = m_House.TrashBarrel;
                if (t != null && !t.Deleted)
                {
                    if (m_House.HasSecureAccess(from, t.Level))
                    {
                        m_House.AddTrashBarrel(from);
                    }
                    else
                    {
                        from.SendMessage("You cannot access this house's trash barrel.");
                    }

                    return;
                }

                if (isCoOwner)
                {
                    m_House.AddTrashBarrel(from);
                }
                else if (isFriend)
                {
                    from.SendLocalizedMessage(1010587);                       // You are not a co-owner of this house.
                }
                else
                {
                    from.SendLocalizedMessage(502094);                       // You must be in your house to do this.
                }
            }
        }