Example #1
0
        public void PlacePremiumItem(bool FloorItem)
        {
            Room CurrentRoom = Session.GetHabbo().CurrentRoom;

            if (CurrentRoom == null)
            {
                return;
            }

            // Si no es el dueño de sala:
            if (CurrentRoom.RoomData.OwnerId != Session.GetHabbo().Id)
            {
                NotificaStaff.Notifica(Session, true);
                return;
            }

            // Si este usuario no es premium:
            if (!Session.GetHabbo().IsPremium())
            {
                NotificaStaff.Notifica(Session);
                return;
            }

            // Si ha llegado al límite de furnis establecidos:
            if (Session.GetHabbo().GetPremiumManager().GetActualItems() >= Session.GetHabbo().GetPremiumManager().GetMaxItems())
            {
                ServerMessage messageError = new ServerMessage(Outgoing.CustomAlert);
                messageError.AppendString("furni_placement_error");
                messageError.AppendInt32(1);
                messageError.AppendString("message");
                messageError.AppendString("${room.error.max_furniture}");
                Session.SendMessage(messageError);

                return;
            }

            // Obtenemos la página del catálogo.
            int PageId = Request.PopWiredInt32();
            CatalogPremiumPage Page = OtanixEnvironment.GetGame().GetCatalogPremium().GetPage(PageId);

            if (Page == null || !Page.Enable || !Page.Visible)
            {
                return;
            }

            // Obtenemos el item del catálogo.
            uint ItemId             = Request.PopWiredUInt();
            CatalogPremiumItem Item = Page.GetItem(ItemId);

            if (Item == null)
            {
                return;
            }

            Request.PopFixedString();

            if (FloorItem)
            {
                int X   = Request.PopWiredInt32();
                int Y   = Request.PopWiredInt32();
                int Rot = Request.PopWiredInt32();

                RoomItem RoomItem = new RoomItem(EmuSettings.PREMIUM_BASEID + Session.GetHabbo().GetPremiumManager().GetValidPosition(), CurrentRoom.RoomId, Item.BaseId, "", CurrentRoom.RoomData.OwnerId, X, Y, 0, Rot, CurrentRoom, true);

                if (CurrentRoom.GetRoomItemHandler().SetFloorItem(Session, RoomItem, X, Y, Rot, true, false, true, false) == false)
                {
                    Session.GetHabbo().GetPremiumManager().ModifyItemPosition((int)(RoomItem.Id - EmuSettings.PREMIUM_BASEID), false);
                    return;
                }
            }
            else
            {
                string W = Request.PopFixedString();

                WallCoordinate coordinate = new WallCoordinate(W);
                RoomItem       RoomItem   = new RoomItem(EmuSettings.PREMIUM_BASEID + Session.GetHabbo().GetPremiumManager().GetValidPosition(), CurrentRoom.RoomId, Item.BaseId, "", CurrentRoom.RoomData.OwnerId, coordinate, CurrentRoom, true);

                if (CurrentRoom.GetRoomItemHandler().SetWallItem(Session, RoomItem) == false)
                {
                    Session.GetHabbo().GetPremiumManager().ModifyItemPosition((int)(RoomItem.Id - EmuSettings.PREMIUM_BASEID), false);
                    return;
                }
            }

            // Incrementamos en 1 los items usados.
            Session.GetHabbo().GetPremiumManager().IncreaseItems();

            // Actualizamos el packet del catálogo.
            Session.SendMessage(PremiumManager.SerializePremiumItemsCount(Session.GetHabbo()));
        }
Example #2
0
 public RoomItemDice(uint id, uint roomId, uint userId, Item baseItem, string extraData, int x, int y, double z, int rot, WallCoordinate wallCoordinate, Room room)
     : base(id, roomId, userId, baseItem, extraData, x, y, z, rot, wallCoordinate, room)
 {
 }
Example #3
0
 public RoomItemWiredTriggererOnFurni(uint id, uint roomId, uint userId, Item baseItem, string extraData, int x, int y, double z, int rot, WallCoordinate wallCoordinate, Room room)
     : base(id, roomId, userId, baseItem, extraData, x, y, z, rot, wallCoordinate, room)
 {
     this.SelectedItems = new List <RoomItem>();
 }