Пример #1
0
        internal override void Chat(string Message, bool Shout)
        {
            if (Client != null)
            {
                if (Client.GetHabbo().Rank < 5)
                {
                    if (GetRoom().RoomMuted)
                        return;
                }
            }

            Unidle();

                Users.Habbo clientUser = GetClient().GetHabbo();
                if (clientUser.Muted)
                {
                    GetClient().SendNotif("You are muted.");
                    return;
                }

                if (Message.StartsWith(":"))
                {
                    string[] parsedCommand = Message.Split(' ');
                    if (ChatCommandRegister.IsChatCommand(parsedCommand[0].ToLower().Substring(1)))
                    {
                        try
                        {
                            ChatCommandHandler handler = new ChatCommandHandler(Message.Split(' '), Client);

                            if (handler.WasExecuted())
                            {
                                //Logging.LogMessage(string.Format("User {0} issued command {1}", GetUsername(), Message));
                                if (Client.GetHabbo().Rank > 5)
                                {
                                    FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Client.GetHabbo().Username, string.Empty, "Chat command", string.Format("Issued chat command {0}", Message));
                                }
                                return;
                            }
                        }
                        catch (Exception x) { Logging.LogException("In-game command error: " + x.ToString()); }
                    }
                }

                uint rank = 1;
                Message = LanguageLocale.FilterSwearwords(Message);
                if (Client != null && Client.GetHabbo() != null)
                    rank = Client.GetHabbo().Rank;
                TimeSpan SinceLastMessage = DateTime.Now - clientUser.spamFloodTime;
                if (SinceLastMessage.TotalSeconds > clientUser.spamProtectionTime && clientUser.spamProtectionBol == true)
                {
                    FloodCount = 0;
                    clientUser.spamProtectionBol = false;
                    clientUser.spamProtectionAbuse = 0;
                }
                else
                {
                    if (SinceLastMessage.TotalSeconds > 4)
                        FloodCount = 0;
                }

                if (SinceLastMessage.TotalSeconds < clientUser.spamProtectionTime && clientUser.spamProtectionBol == true)
                {
                    ServerMessage Packet = new ServerMessage(Outgoing.FloodFilter);
                    int timeToWait = clientUser.spamProtectionTime - SinceLastMessage.Seconds;
                    Packet.AppendInt32(timeToWait); //Blocked for X sec
                    GetClient().SendMessage(Packet);

                    if (FirewindEnvironment.spamBans == true)
                    {
                        clientUser.spamProtectionAbuse++;
                        GameClient toBan;
                        toBan = FirewindEnvironment.GetGame().GetClientManager().GetClientByUsername(Client.GetHabbo().Username);
                        if (clientUser.spamProtectionAbuse >= FirewindEnvironment.spamBans_limit)
                        {
                            FirewindEnvironment.GetGame().GetBanManager().BanUser(toBan, "SPAM*ABUSE", 800, LanguageLocale.GetValue("flood.banmessage"), false);
                        }
                        else
                        {
                            toBan.SendNotif(LanguageLocale.GetValue("flood.pleasewait").Replace("%secs%", Convert.ToString(timeToWait)));
                        }
                    }
                    return;
                }

                if (SinceLastMessage.TotalSeconds < 4 && FloodCount > 5 && rank < 5)
                {
                    ServerMessage Packet = new ServerMessage(Outgoing.FloodFilter);
                    clientUser.spamProtectionCount += 1;
                    if (clientUser.spamProtectionCount % 2 == 0)
                    {
                        clientUser.spamProtectionTime = (10 * clientUser.spamProtectionCount);
                    }
                    else
                    {
                        clientUser.spamProtectionTime = 10 * (clientUser.spamProtectionCount - 1);
                    }
                    clientUser.spamProtectionBol = true;
                    Packet.AppendInt32(clientUser.spamProtectionTime - SinceLastMessage.Seconds); //Blocked for X sec
                    GetClient().SendMessage(Packet);
                    return;
                }

                clientUser.spamFloodTime = DateTime.Now;
                FloodCount++;

                FirewindEnvironment.GetGame().GetQuestManager().ProgressUserQuest(Client, HabboHotel.Quests.QuestType.SOCIAL_CHAT);

                GetClient().GetHabbo().GetChatMessageManager().AddMessage(ChatMessageFactory.CreateMessage(Message, this.GetClient(), this.GetRoom()));

                base.Chat(Message, Shout);
        }
Пример #2
0
        internal static void InvokeCommand(ChatCommandHandler commandHandler, int commandID)
        {
            switch (commandID)
            {
                case 1:
                    {
                        commandHandler.pickall();
                        break;
                    }

                case 2:
                    {
                        commandHandler.setspeed();
                        break;
                    }

                case 3:
                    {
                        commandHandler.unload();
                        break;
                    }

                case 4:
                    {
                        commandHandler.disablediagonal();
                        break;
                    }

                case 5:
                    {
                        commandHandler.setmax();
                        break;
                    }

                case 6:
                    {
                        commandHandler.overridee();
                        break;
                    }

                case 7:
                    {
                        commandHandler.teleport();
                        break;
                    }

                case 8:
                    {
                        ChatCommandHandler.catarefresh();
                        break;
                    }

                case 10:
                    {
                        commandHandler.roomalert();
                        break;
                    }

                case 11:
                    {
                        commandHandler.coords();
                        break;
                    }

                case 12:
                    {
                        commandHandler.coins();
                        break;
                    }

                case 13:
                    {
                        commandHandler.pixels();
                        break;
                    }

                case 14:
                    {
                        commandHandler.handitem();
                        break;
                    }

                case 15:
                    {
                        commandHandler.hotelalert();
                        break;
                    }

                case 16:
                    {
                        commandHandler.freeze();
                        break;
                    }

                case 17:
                    {
                        commandHandler.buyx();
                        break;
                    }

                case 18:
                    {
                        commandHandler.enable();
                        break;
                    }

                case 19:
                    {
                        commandHandler.roommute();
                        break;
                    }

                case 20:
                    {
                        commandHandler.masscredits();
                        break;
                    }

                case 21:
                    {
                        commandHandler.globalcredits();
                        break;
                    }

                case 22:
                    {
                        commandHandler.openroom();
                        break;
                    }

                case 23:
                    {
                        commandHandler.roombadge();
                        break;
                    }

                case 24:
                    {
                        commandHandler.massbadge();
                        break;
                    }

                case 25:
                    {
                        commandHandler.language();
                        break;
                    }

                case 26:
                    {
                        commandHandler.userinfo();
                        break;
                    }

                case 27:
                    {
                        commandHandler.linkAlert();
                        break;
                    }

                case 28:
                    {
                        commandHandler.shutdown();
                        break;
                    }

                case 29:
                    {
                        commandHandler.dumpmaps();
                        break;
                    }

                case 30:
                    {
                        commandHandler.giveBadge();
                        break;
                    }

                case 31:
                    {
                        commandHandler.invisible();
                        break;
                    }

                case 32:
                    {
                        commandHandler.ban();
                        break;
                    }

                case 33:
                    {
                        commandHandler.disconnect();
                        break;
                    }

                case 34:
                    {
                        commandHandler.superban();
                        break;
                    }

                case 35:
                    {
                        commandHandler.langban();
                        break;
                    }

                case 36:
                    {
                        commandHandler.roomkick();
                        break;
                    }

                case 37:
                    {
                        commandHandler.mute();
                        break;
                    }

                case 38:
                    {
                        commandHandler.unmute();
                        break;
                    }

                case 39:
                    {
                        commandHandler.alert();
                        break;
                    }

                case 40:
                    {
                        commandHandler.kick();
                        break;
                    }

                case 41:
                    {
                        commandHandler.commands();
                        break;
                    }

                case 43:
                    {
                        commandHandler.info();
                        break;
                    }

                case 44:
                    {
                        commandHandler.enablestatus();
                        break;
                    }

                case 45:
                    {
                        commandHandler.disablefriends();
                        break;
                    }

                case 46:
                    {
                        commandHandler.enablefriends();
                        break;
                    }

                case 47:
                    {
                        commandHandler.disabletrade();
                        break;
                    }

                case 48:
                    {
                        commandHandler.enabletrade();
                        break;
                    }

                //case 49:
                //    {
                //        commandHandler.mordi();
                //        break;
                //    }

                case 50:
                    {
                        commandHandler.wheresmypet();
                        break;
                    }

                //case 51:
                //    {
                //        commandHandler.powerlevels();
                //        break;
                //    }

                case 52:
                    {
                        commandHandler.forcerot();
                        break;
                    }

                case 53:
                    {
                        commandHandler.seteffect();
                        break;
                    }

                case 54:
                    {
                        commandHandler.empty();
                        break;
                    }

                case 55:
                    {
                        commandHandler.whosonline();
                        break;
                    }

                case 56:
                    {
                        commandHandler.stalk();
                        break;
                    }

                case 57:
                    {
                        commandHandler.registerIRC();
                        break;
                    }
                case 58:
                    {
                        commandHandler.unbanUser();
                        break;
                    }
                case 59:
                    {
                        commandHandler.giveCrystals();
                        break;
                    }
                case 60:
                    {
                        commandHandler.warp();
                        break;
                    }
                case 61:
                    {
                        commandHandler.deleteMission();
                        break;
                    }
                case 62:
                    {
                        break;
                    }
                case 63:
                    {
                        commandHandler.come();
                        break;
                    }
                case 64:
                    {
                        commandHandler.moonwalk();
                        break;
                    }
                case 65:
                    {
                        commandHandler.push();
                        break;
                    }
                case 66:
                    {
                        commandHandler.pull();
                        break;
                    }
                case 67:
                    {
                        commandHandler.copylook();
                        break;
                    }
                case 68:
                    {
                        commandHandler.Fly();
                        break;
                    }

                case 69:
                    {
                        commandHandler.sit();
                        break;
                    }

                case 70:
                    {
                        commandHandler.lay();
                        break;
                    }

                case 76:
                    {
                        commandHandler.givescore();
                        break;
                    }

                case 1000:
                    {
                        commandHandler.close();
                        break;
                    }

                case 1001:
                    {
                        commandHandler.refresh();
                        break;
                    }

                case 1002:
                    {
                        commandHandler.vippoints();
                        break;
                    }
                case 1003:
                    {
                        commandHandler.massroombadge();
                        break;
                    }
                case 1005:
                    {
                        commandHandler.massdance();
                        break;
                    }
                case 1006:
                    {
                        commandHandler.massaction();
                        break;
                    }
                case 1007:
                    {
                        commandHandler.masslay();
                        break;
                    }
                case 1008:
                    {
                        commandHandler.vipcommands();
                        break;
                    }
                case 1009:
                    {
                        commandHandler.massclothes();
                        break;
                    }

            }
        }