コード例 #1
0
 internal GameClientMessageHandler(GameClient Session)
 {
     this.Session         = Session;
     this.packetsuserlogs = new PacketsUserLogs();
     this.Response        = new ServerMessage();
 }
コード例 #2
0
 internal void appendResponse(ServerMessage message)
 {
     appendBytes(message.GetBytes());
 }
コード例 #3
0
        internal void AddRoomToSelectionStaff()
        {
            if (!Session.GetHabbo().HasFuse("fuse_add_room_staff"))
            {
                return;
            }

            //if (!OtanixEnvironment.GetGame().GetNewNavigatorManager().CategoryExists(EmuSettings.NAVIGATOR_STAFF_SELECTION))
            //{
            //    Session.SendNotif(LanguageLocale.GetValue("navigator.contains.selection.staff").Replace("{0}", EmuSettings.NAVIGATOR_STAFF_SELECTION));
            //    return;
            //}

            uint     RoomId = Request.PopWiredUInt();
            RoomData Data   = OtanixEnvironment.GetGame().GetRoomManager().GenerateRoomData(RoomId);

            if (Data == null)
            {
                return;
            }

            bool RemoveRoom = Request.PopWiredBoolean();

            if (RemoveRoom == false)
            {
                if (OtanixEnvironment.GetGame().GetNewNavigatorManager().GetRoomsInCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION).Contains(RoomId))
                {
                    Session.SendNotif(LanguageLocale.GetValue("navigator.contains.room.selection.staff"));
                    return;
                }

                using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.setQuery("INSERT INTO navigator_new_selections VALUES (@id, '" + RoomId + "')");
                    dbClient.addParameter("id", EmuSettings.NAVIGATOR_STAFF_SELECTION);
                    dbClient.runQuery();
                }

                OtanixEnvironment.GetGame().GetNewNavigatorManager().AddRoomToCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION, RoomId);

                Data.Type = "public";
                Data.roomNeedSqlUpdate = true;

                GameClient User = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID((UInt32)Data.OwnerId);
                OtanixEnvironment.GetGame().GetAchievementManager().ProgressUserAchievement((UInt32)Data.OwnerId, "ACH_Spr", 1);

                OtanixEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "-Selection Staff-", "Added this room:" + RoomId);
            }
            else
            {
                if (!OtanixEnvironment.GetGame().GetNewNavigatorManager().GetRoomsInCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION).Contains(RoomId))
                {
                    Session.SendNotif(LanguageLocale.GetValue("navigator.no.contains.room.selection.staff"));
                    return;
                }

                using (IQueryAdapter dbClient = OtanixEnvironment.GetDatabaseManager().getQueryreactor())
                {
                    dbClient.runFastQuery("DELETE FROM navigator_new_selections WHERE room_id = '" + RoomId + "'");
                }

                OtanixEnvironment.GetGame().GetNewNavigatorManager().RemoveRoomToCategory(EmuSettings.NAVIGATOR_STAFF_SELECTION, RoomId);

                Data.Type = "private";
                Data.roomNeedSqlUpdate = true;

                OtanixEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.GetHabbo().Username, string.Empty, "-Selection Staff-", "Removed this room:" + RoomId);
            }

            Room Room = OtanixEnvironment.GetGame().GetRoomManager().GetRoom(RoomId);

            if (Room != null)
            {
                ServerMessage Update = new ServerMessage(Outgoing.UpdateRoom);
                Update.AppendUInt(Room.Id);
                Room.SendMessage(Update);
            }
        }
コード例 #4
0
ファイル: Messenger.cs プロジェクト: fuding/Coolmemes
        internal void SendInstantInvite()
        {
            var count = Request.PopWiredInt32();

            var UserIds = new List <uint>();

            for (var i = 0; i < count; i++)
            {
                UserIds.Add(Request.PopWiredUInt());
            }

            var message = OtanixEnvironment.FilterInjectionChars(Request.PopFixedString(), true);

            #region Mute
            if (Session.GetHabbo().Rank < 4) // Si no es un staff comprobamos si está muteado.
            {
                int timeToEndGlobalMute = OtanixEnvironment.GetGame().GetMuteManager().HasMuteExpired(Session.GetHabbo().Id);
                if (timeToEndGlobalMute > 0)
                {
                    return;
                }
            }
            #endregion
            #region Flood
            if (!Session.GetHabbo().HasFuse("ignore_flood_filter"))
            {
                TimeSpan SinceLastMessage = DateTime.Now - Session.GetHabbo().spamFloodTime;
                if (SinceLastMessage.Seconds > 3)
                {
                    FloodCount = 0;
                }
                else if (FloodCount > 5)
                {
                    OtanixEnvironment.GetGame().GetMuteManager().AddUserMute(Session.GetHabbo().Id, 0.5);
                    return;
                }
                Session.GetHabbo().spamFloodTime = DateTime.Now;
                FloodCount++;
            }
            #endregion
            #region Filter
            if (!Session.GetHabbo().HasFuse("ignore_spam_filter"))
            {
                if (BlackWordsManager.Check(message, BlackWordType.Hotel, Session, "<Consola Spam>"))
                {
                    return;
                }
            }
            #endregion

            ServerMessage Message = new ServerMessage(Outgoing.InstantInvite);
            Message.AppendUInt(Session.GetHabbo().Id);
            Message.AppendString(message);

            foreach (var Id in UserIds)
            {
                if (!Session.GetHabbo().GetMessenger().FriendshipExists(Id))
                {
                    continue;
                }

                var Client = OtanixEnvironment.GetGame().GetClientManager().GetClientByUserID(Id);

                if (Client == null || Client.GetHabbo() == null || Client.GetHabbo().IgnoreRoomInvitations)
                {
                    return;
                }

                Client.SendMessage(Message);
            }
        }
コード例 #5
0
ファイル: PacketRank.cs プロジェクト: nightwolf93/Bfly
 public FusedPacket(ServerMessage content, string requirements)
 {
     this.content      = content;
     this.requirements = requirements;
 }
コード例 #6
0
        //private delegate void RequestHandler();
        //private Dictionary<uint, RequestHandler> RequestHandlers;

        internal GameClientMessageHandler(GameClient Session)
        {
            this.Session = Session;
            //this.RequestHandlers = new Dictionary<uint, RequestHandler>();
            this.Response = new ServerMessage(0);
        }
コード例 #7
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()));
        }