コード例 #1
0
ファイル: Help.cs プロジェクト: LuxuryJared/Coolmemes
        internal void SanctionMessage()
        {
            ServerMessage Message = new ServerMessage(Outgoing.ModToolSanctionInfo);

            if (Session.GetHabbo().GetSanctionManager().GetSanction(Session.GetHabbo().Id) != null)
            {
                Message.AppendBoolean(true);
                Message.AppendBoolean(false);
                Message.AppendString("ALERT");
                Message.AppendInt32(0);
                Message.AppendInt32(30);


                Message.AppendString(Session.GetHabbo().GetSanctionManager().Reason.ToLower());

                /*
                 * cfh.reason.EMPTY
                 * Motivazione
                 */
                //var offset = TimeZoneInfo.Local.GetUtcOffset(DateTime.UtcNow).TotalHours;
                DateTime startTime = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddSeconds(Session.GetHabbo().GetSanctionManager().GetSanction(Session.GetHabbo().Id).StartTime);
                Message.AppendString(startTime.ToString("dd-MM-yy HH:mm ('GMT' +0100)"));                                             // Tempo di inizio: Datetime to String

                Message.AppendInt32(Session.GetHabbo().GetSanctionManager().GetSanction(Session.GetHabbo().Id).RemainingDaysInHours); // Giorni di prova rimamenti in ore. es.: 720h = 31g

                //Message.AppendString("ALERT"); // Sanzione successiva
                Message.AppendString(Session.GetHabbo().GetSanctionManager().GetSanction(Session.GetHabbo().Id).NextSanction);

                /*
                 * ALERT
                 * MUTE
                 * BAN
                 * BAN_PERMANENT
                 */

                int hours = 0;
                switch (Session.GetHabbo().GetSanctionManager().GetSanction(Session.GetHabbo().Id).NextSanction)
                {
                case "ALERT":
                case "MUTE":
                    hours = 1;
                    break;

                case "BAN":
                    hours = 18;
                    break;
                }
                Message.AppendInt32(hours); // Durata della prossima sanzione

                Message.AppendInt32(0);
                Message.AppendInt32(30);
                Message.AppendString(""); // ??
                Message.AppendBoolean(false);
            }

            else
            {
                Message.AppendBoolean(true);
                Message.AppendBoolean(false);
                Message.AppendString("ALERT");
                Message.AppendInt32(0);
                Message.AppendInt32(30);

                Message.AppendString("cfh.reason.EMPTY");

                /*
                 * cfh.reason.EMPTY
                 * Motivazione
                 */

                Message.AppendString("");      // Tempo di inizio: Datetime to String

                Message.AppendInt32(720);      // Giorni di prova rimamenti in ore. es.: 720h = 31g

                Message.AppendString("ALERT"); // Sanzione successiva

                /*
                 * ALERT
                 * MUTE
                 * BAN
                 * BAN_PERMANENT
                 */

                Message.AppendInt32(1); // Durata della prossima sanzione

                Message.AppendInt32(0);
                Message.AppendInt32(30);
                Message.AppendString(""); // ??
                Message.AppendBoolean(false);
            }
            Session.SendMessage(Message);
        }
コード例 #2
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);
            }
        }
コード例 #3
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()));
        }