コード例 #1
0
ファイル: RoomUnitManager.cs プロジェクト: Habbotard/Firewind
        internal void AddUserToRoom(GameClient Session)
        {
            RoomUser User = new RoomUser(primaryPrivateUserID++, Session, room);

            Users.Habbo loadingHabbo = User.GetClient().GetHabbo();

            if (loadingHabbo.spamProtectionBol == true)
            {
                TimeSpan SinceLastMessage = DateTime.Now - loadingHabbo.spamFloodTime;
                if (SinceLastMessage.TotalSeconds < loadingHabbo.spamProtectionTime)
                {
                    ServerMessage Packet     = new ServerMessage(Outgoing.FloodFilter);
                    int           timeToWait = loadingHabbo.spamProtectionTime - SinceLastMessage.Seconds;
                    Packet.AppendInt32(timeToWait);  //Blocked for X sec
                    User.GetClient().SendMessage(Packet);
                }
            }
            User.ID = (int)Session.GetHabbo().Id;

            string username = Session.GetHabbo().Username;
            uint   userID   = (uint)User.ID;

            if (usersByUserID.ContainsKey(userID))
            {
                usersByUserID.Remove(userID);
            }

            usersByUserID.Add(Session.GetHabbo().Id, User);
            Session.CurrentRoomUserID = User.VirtualID;

            Session.GetHabbo().CurrentRoomId = room.RoomId;
            UnitList.Add(User.VirtualID, User);
        }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="TeleUserData"/> class.
 /// </summary>
 /// <param name="handler">The p handler.</param>
 /// <param name="userRefference">The p user refference.</param>
 /// <param name="roomId">The room identifier.</param>
 /// <param name="teleId">The tele identifier.</param>
 internal TeleUserData(GameClientMessageHandler handler, Users.Habbo userRefference, uint roomId, uint teleId)
 {
     _mHandler       = handler;
     _userRefference = userRefference;
     _roomId         = roomId;
     _teleId         = teleId;
 }
コード例 #3
0
        internal static int GetHave(uint AchievementId, Users.Habbo Habbo)
        {
            switch (AchievementId)
            {
            case 4:
                return(Habbo.RespectGiven);

            case 6:
                return(Habbo.Respect);

            case 7:
                return(Habbo.list_3.Count);

            case 8:
                return(Habbo.RoomVisits);

            case 10:
                return(Habbo.GiftsGiven);

            case 11:
                return(Habbo.GiftsReceived);

            case 13:
                return(Habbo.FireworkPixelLoadedCount);

            case 14:
                return(Habbo.PetBuyed);

            case 15:
                return(Habbo.OnlineTime / 60);

            case 16:
                return(Habbo.GetSubscriptionManager().CalculateHCSubscription(Habbo));

            case 17:
                return(Habbo.RegistrationDuration);

            case 18:
                return(Habbo.RegularVisitor);

            case 19:
                return(Habbo.FootballGoalScorer);

            case 20:
                return(Habbo.FootballGoalHost);

            case 21:
                return(Habbo.TilesLocked);

            case 22:
                return(Habbo.StaffPicks);

            case 9307620:
                return(Habbo.RandomRares);
            }
            return(0);
        }
コード例 #4
0
 public int CalculateHCSubscription(Users.Habbo Habbo)
 {
     if (Habbo.GetSubscriptionManager().HasSubscription("habbo_club"))
     {
         return(((int)GoldTree.GetUnixTimestamp() - Habbo.GetSubscriptionManager().method_1("habbo_club").Int32_1) / 2678400);
     }
     else
     {
         if (Habbo.GetSubscriptionManager().method_1(Habbo.Id.ToString()) != null)
         {
             return((Habbo.GetSubscriptionManager().method_1("habbo_club").Int32_0 - Habbo.GetSubscriptionManager().method_1("habbo_club").Int32_1) / 2678400);
         }
         return(0);
     }
 }
コード例 #5
0
        //internal void ResetStatus()
        //{
        //    Statusses = new Dictionary<string, string>();
        //}

        internal void Serialize(ServerMessage Message, bool gotPublicRoom)
        {
            // @\Ihqu@UMeth0d13haiihr-893-45.hd-180-8.ch-875-62.lg-280-62.sh-290-62.ca-1813-.he-1601-[IMRAPD4.0JImMcIrDK
            // MSadiePull up a pew and have a brew!hr-500-45.hd-600-1.ch-823-75.lg-716-76.sh-730-62.he-1602-75IRBPA2.0PAK

            if (Message == null)
            {
                return;
            }

            if (IsSpectator)
            {
                return;
            }

            if (IsBot)
            {
                Message.AppendInt32(BotAI.BaseId);
                Message.AppendStringWithBreak(BotData.Name);
                Message.AppendStringWithBreak(BotData.Motto);
                Message.AppendStringWithBreak(BotData.Look);
                Message.AppendInt32(VirtualId);
                Message.AppendInt32(X);
                Message.AppendInt32(Y);
                Message.AppendStringWithBreak(TextHandling.GetString(Z));
                Message.AppendInt32(4);
                Message.AppendInt32((BotData.AiType == AIType.Pet) ? 2 : 3);

                if (BotData.AiType == AIType.Pet)
                {
                    Message.AppendInt32(0);
                }
            }
            else if (!IsBot && GetClient() != null && GetClient().GetHabbo() != null)
            {
                Users.Habbo User = GetClient().GetHabbo();
                Message.AppendUInt(User.Id);
                Message.AppendStringWithBreak(User.Username);
                Message.AppendStringWithBreak(User.Motto);
                Message.AppendStringWithBreak(User.Look);
                Message.AppendInt32(VirtualId);
                Message.AppendInt32(X);
                Message.AppendInt32(Y);
                Message.AppendStringWithBreak(TextHandling.GetString(Z));
                Message.AppendInt32(0);
                Message.AppendInt32(1);
                Message.AppendStringWithBreak(User.Gender.ToLower());
                Message.AppendInt32(-1);
                if (User.userGroup != null)
                {
                    Message.AppendInt32(User.userGroup.groupID);
                }
                else
                {
                    Message.AppendInt32(-1);
                }
                Message.AppendInt32(-1);

                if (gotPublicRoom)
                {
                    Message.AppendStringWithBreak("ch=s01/250,56,49");
                }
                else
                {
                    Message.AppendStringWithBreak(string.Empty);
                }

                Message.AppendInt32(1337);
            }
        }
コード例 #6
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);
        }
コード例 #7
0
        internal static int GetNeed(uint AchievementId, int AchLevel, Users.Habbo Habbo)
        {
            if (AchievementId == 4)
            {
                switch (AchLevel)
                {
                case 1:
                    return(2);

                case 2:
                    return(5);

                case 3:
                    return(10);

                case 4:
                    return(20);

                case 5:
                    return(40);

                case 6:
                    return(70);

                case 7:
                    return(110);

                case 8:
                    return(170);

                case 9:
                    return(250);

                case 10:
                    return(350);

                case 11:
                    return(470);

                case 12:
                    return(610);

                case 13:
                    return(770);

                case 14:
                    return(950);

                case 15:
                    return(1150);

                case 16:
                    return(1370);

                case 17:
                    return(1610);

                case 18:
                    return(1870);

                case 19:
                    return(2150);

                case 20:
                    return(2450);
                }
            }

            if (AchievementId == 6)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(6);

                case 3:
                    return(16);

                case 4:
                    return(66);

                case 5:
                    return(166);

                case 6:
                    return(366);

                case 7:
                    return(566);

                case 8:
                    return(766);

                case 9:
                    return(966);

                case 10:
                    return(1166);
                }
            }

            if (AchievementId == 7)
            {
                return(5);
            }

            if (AchievementId == 8)
            {
                switch (AchLevel)
                {
                case 1:
                    return(5);

                case 2:
                    return(10);

                case 3:
                    return(50);

                case 4:
                    return(100);

                case 5:
                    return(160);

                case 6:
                    return(240);

                case 7:
                    return(360);

                case 8:
                    return(500);

                case 9:
                    return(660);

                case 10:
                    return(860);

                case 11:
                    return(1080);

                case 12:
                    return(1320);

                case 13:
                    return(1580);

                case 14:
                    return(1860);

                case 15:
                    return(2160);

                case 16:
                    return(2480);

                case 17:
                    return(2820);

                case 18:
                    return(3180);

                case 19:
                    return(3560);

                case 20:
                    return(3960);
                }
            }

            if (AchievementId == 10)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(6);

                case 3:
                    return(14);

                case 4:
                    return(26);

                case 5:
                    return(46);

                case 6:
                    return(86);

                case 7:
                    return(146);

                case 8:
                    return(236);

                case 9:
                    return(366);

                case 10:
                    return(566);

                case 11:
                    return(816);

                case 12:
                    return(1066);

                case 13:
                    return(1316);

                case 14:
                    return(1566);

                case 15:
                    return(1816);
                }
            }

            if (AchievementId == 11)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(6);

                case 3:
                    return(14);

                case 4:
                    return(26);

                case 5:
                    return(46);

                case 6:
                    return(86);

                case 7:
                    return(146);

                case 8:
                    return(236);

                case 9:
                    return(366);

                case 10:
                    return(566);
                }
            }

            if (AchievementId == 13)
            {
                switch (AchLevel)
                {
                case 1:
                    return(20);

                case 2:
                    return(100);

                case 3:
                    return(420);

                case 4:
                    return(600);

                case 5:
                    return(1920);

                case 6:
                    return(3120);

                case 7:
                    return(4620);

                case 8:
                    return(6420);

                case 9:
                    return(8520);

                case 10:
                    return(10920);
                }
            }

            if (AchievementId == 14)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(5);

                case 3:
                    return(10);

                case 4:
                    return(15);

                case 5:
                    return(20);

                case 6:
                    return(25);

                case 7:
                    return(30);

                case 8:
                    return(40);

                case 9:
                    return(50);

                case 10:
                    return(75);
                }
            }

            if (AchievementId == 15)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1800 / 60);

                case 2:
                    return(3600 / 60);

                case 3:
                    return(7200 / 60);

                case 4:
                    return(10800 / 60);

                case 5:
                    return(21600 / 60);

                case 6:
                    return(43200 / 60);

                case 7:
                    return(86400 / 60);

                case 8:
                    return(129600 / 60);

                case 9:
                    return(172800 / 60);

                case 10:
                    return(259200 / 60);

                case 11:
                    return(432000 / 60);

                case 12:
                    return(604800 / 60);

                case 13:
                    return(1209600 / 60);

                case 14:
                    return(1814400 / 60);

                case 15:
                    return(2419200 / 60);

                case 16:
                    return(3024000 / 60);

                case 17:
                    return(3628800 / 60);

                case 18:
                    return(4838400 / 60);

                case 19:
                    return(6048000 / 60);

                case 20:
                    return(8294400 / 60);
                }
            }

            if (AchievementId == 16)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(12);

                case 3:
                    return(24);

                case 4:
                    return(36);

                case 5:
                    return(48);
                }
            }

            if (AchievementId == 17)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(3);

                case 3:
                    return(10);

                case 4:
                    return(20);

                case 5:
                    return(30);

                case 6:
                    return(56);

                case 7:
                    return(84);

                case 8:
                    return(126);

                case 9:
                    return(168);

                case 10:
                    return(224);

                case 11:
                    return(280);

                case 12:
                    return(365);

                case 13:
                    return(548);

                case 14:
                    return(730);

                case 15:
                    return(913);

                case 16:
                    return(1095);

                case 17:
                    return(1278);

                case 18:
                    return(1460);

                case 19:
                    return(1643);

                case 20:
                    return(1825);
                }
            }

            if (AchievementId == 18)
            {
                switch (AchLevel)
                {
                case 1:
                    return(5);

                case 2:
                    return(8);

                case 3:
                    return(15);

                case 4:
                    return(28);

                case 5:
                    return(35);

                case 6:
                    return(50);

                case 7:
                    return(60);

                case 8:
                    return(70);

                case 9:
                    return(80);

                case 10:
                    return(100);

                case 11:
                    return(120);

                case 12:
                    return(140);

                case 13:
                    return(160);

                case 14:
                    return(180);

                case 15:
                    return(200);

                case 16:
                    return(220);

                case 17:
                    return(240);

                case 18:
                    return(260);

                case 19:
                    return(280);

                case 20:
                    return(300);
                }
            }

            if (AchievementId == 19)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(10);

                case 3:
                    return(100);

                case 4:
                    return(1000);

                case 5:
                    return(10000);
                }
            }

            if (AchievementId == 20)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(20);

                case 3:
                    return(400);

                case 4:
                    return(8000);

                case 5:
                    return(160000);
                }
            }

            if (AchievementId == 21)
            {
                switch (AchLevel)
                {
                case 1:
                    return(25);

                case 2:
                    return(65);

                case 3:
                    return(125);

                case 4:
                    return(205);

                case 5:
                    return(335);

                case 6:
                    return(525);

                case 7:
                    return(805);

                case 8:
                    return(1235);

                case 9:
                    return(1875);

                case 10:
                    return(2875);

                case 11:
                    return(4375);

                case 12:
                    return(6875);

                case 13:
                    return(10775);

                case 14:
                    return(17075);

                case 15:
                    return(27175);

                case 16:
                    return(43275);

                case 17:
                    return(69075);

                case 18:
                    return(110375);

                case 19:
                    return(176375);

                case 20:
                    return(282075);
                }
            }

            if (AchievementId == 22)
            {
                switch (AchLevel)
                {
                case 1:
                    return(1);

                case 2:
                    return(2);

                case 3:
                    return(3);

                case 4:
                    return(4);

                case 5:
                    return(5);

                case 6:
                    return(6);

                case 7:
                    return(7);

                case 8:
                    return(8);

                case 9:
                    return(9);

                case 10:
                    return(10);
                }
            }

            return(1);
        }
コード例 #8
0
        //internal void ResetStatus()
        //{
        //    Statusses = new Dictionary<string, string>();
        //}

        internal void Serialize(ServerMessage Message)
        {
            // @\Ihqu@UMeth0d13haiihr-893-45.hd-180-8.ch-875-62.lg-280-62.sh-290-62.ca-1813-.he-1601-[IMRAPD4.0JImMcIrDK
            // MSadiePull up a pew and have a brew!hr-500-45.hd-600-1.ch-823-75.lg-716-76.sh-730-62.he-1602-75IRBPA2.0PAK

            if (Message == null)
            {
                return;
            }

            if (IsSpectator)
            {
                return;
            }

            if (IsBot)
            {
                // monster plant:         2   1 3 8    0 -1 9
                // no saddle:             2   2 -1 1   3 -1 1
                // with saddle (cool):    3   2 -1 1   3 -1 1   4 10 0
                // with saddle (normal):  3   2 -1 1   3 -1 1   4  9 0
                // // typeId + paletteId + color + unkcount + 3 int
                // hair -1 hairid
                // tail -1 tailid
                string horseData = "";
                //string[,] data = new string[,] { [2, };

                Message.AppendInt32(BotAI.BaseId);
                Message.AppendString(BotData.Name);
                Message.AppendString(BotData.Motto);
                Message.AppendString(BotData.Look.ToLower() + ((PetData.HaveSaddle) ? "3 2 -1 1 3 -1 1 4 9 0" : "2 2 -1 1 3 -1 1"));
                Message.AppendInt32(VirtualId);
                Message.AppendInt32(X);
                Message.AppendInt32(Y);
                Message.AppendString(TextHandling.GetString(Z));
                Message.AppendInt32(0);
                Message.AppendInt32((BotData.AiType == AIType.Pet) ? 2 : 3);
                if (BotData.AiType == AIType.Pet)
                {
                    Message.AppendUInt(PetData.Type);
                    Message.AppendUInt(PetData.OwnerId);     // userid
                    Message.AppendString(PetData.OwnerName); // username
                    Message.AppendInt32(1);


                    Message.AppendBoolean(PetData.HaveSaddle);


                    Message.AppendBoolean(isMounted);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    Message.AppendString("");
                }
            }
            else if (!IsBot && GetClient() != null && GetClient().GetHabbo() != null)
            {
                Users.Habbo User = GetClient().GetHabbo();
                Message.AppendUInt(User.Id);
                Message.AppendString(User.Username);
                Message.AppendString(User.Motto);
                Message.AppendString(User.Look);
                Message.AppendInt32(VirtualId);
                Message.AppendInt32(X);
                Message.AppendInt32(Y);
                Message.AppendString(TextHandling.GetString(Z));
                Message.AppendInt32(0);
                Message.AppendInt32(1);
                Message.AppendString(User.Gender.ToLower());

                Message.AppendInt32(0);   // group ID
                Message.AppendInt32(0);   // Looks like unused
                Message.AppendString(""); // groupName

                Message.AppendString(""); // botFigure
                Message.AppendInt32(User.AchievementPoints);
            }
        }
コード例 #9
0
        internal void Chat(GameClient Session, string Message, bool Shout)
        {
            if (Session != null)
            {
                if (Session.GetHabbo().Rank < 5)
                {
                    if (GetRoom().RoomMuted)
                    {
                        return;
                    }
                }
            }

            Unidle();

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

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

                            if (handler.WasExecuted())
                            {
                                //Logging.LogMessage(string.Format("User {0} issued command {1}", GetUsername(), Message));
                                if (Session.GetHabbo().Rank > 5)
                                {
                                    FirewindEnvironment.GetGame().GetModerationTool().LogStaffEntry(Session.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()); }
                    }
                    if (FirewindEnvironment.IsHabin)
                    {
                        bool result;
                        using (IQueryAdapter dbClient = FirewindEnvironment.GetDatabaseManager().getQueryreactor())
                        {
                            dbClient.setQuery("SELECT id FROM users WHERE (hpo = '1' OR hpo = '1' OR hds = '1' OR hmg = '1' OR hmb = '1' OR ele = '1' OR lar = '1') AND username = @name");
                            dbClient.addParameter("name", Session.GetHabbo().Username);
                            result = dbClient.findsResult();
                            string command = parsedCommand[0].Substring(1);
                            // F**k this command system, we make our own!
                            switch (command)
                            {
                            case "relationship":
                                if (!result)
                                {
                                    Session.SendMOTD("Du må være medlem av Mafia eller Police for å ha kommandoene til forhold.");
                                    break;
                                }
                                dbClient.setQuery("SELECT sender_id FROM users_relationships WHERE (recipent_id = @myid OR sender_id = @myid) AND accepted = '0'");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                if (dbClient.findsResult())
                                {
                                    Session.SendMOTD("Du har allerede spurt om et forhold med denne personen, vennligst vent på et svar.");
                                    return;
                                }
                                dbClient.setQuery("SELECT id FROM users WHERE username = @name");
                                dbClient.addParameter("name", parsedCommand[1]);
                                int id = dbClient.getInteger();

                                dbClient.setQuery("INSERT IGNORE INTO users_relationships(sender_id,recipent_id) VALUES(@myid,@hisid)");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                dbClient.addParameter("hisid", id);
                                dbClient.runQuery();

                                Session.SendMOTD("Du har sendt en forespørsel til " + parsedCommand[1]);
                                return;

                            case "mystatus":
                                if (!result)
                                {
                                    Session.SendMOTD("Du må være medlem av Mafia eller Police for å ha kommandoene til forhold.");
                                    break;
                                }
                                if (false)
                                {
                                    Session.SendMOTD("Du er i et forhold med {0}, vil du avslutte forholdet skriv :remove {0}");
                                    return;
                                }
                                StringBuilder statusMessage = new StringBuilder();
                                statusMessage.AppendLine("Du har følgende forespørsler:");
                                dbClient.setQuery("SELECT sender_id FROM users_relationships WHERE accepted = '0' AND recipent_id = @myid LIMIT 6");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                DataTable table = dbClient.getTable();
                                foreach (DataRow row in table.Rows)
                                {
                                    statusMessage.AppendLine(FirewindEnvironment.getHabboForId(Convert.ToUInt32(row[0])).Username);
                                }
                                statusMessage.AppendLine("Du kan maks ha 6 forespørsler på en gang.");
                                statusMessage.AppendLine("Skriv :accept navn for å akseptere en forespørsel.");
                                Session.SendMOTD(statusMessage.ToString());
                                return;

                            case "accept":
                                if (!result)
                                {
                                    Session.SendMOTD("Du må være medlem av Mafia eller Police for å ha kommandoene til forhold.");
                                    break;
                                }
                                dbClient.setQuery("SELECT sender_id FROM users_relationships WHERE (recipent_id = @myid OR sender_id = @myid) AND accepted = '1'");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                if (dbClient.findsResult())
                                {
                                    Session.SendMOTD("Du er allerede i et forhold!");
                                    return;
                                }
                                dbClient.setQuery("UPDATE users_relationships SET accepted = '1' WHERE sender_id = @sid AND recipent_id = @myid LIMIT 1");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                dbClient.addParameter("sid", FirewindEnvironment.getHabboForName(parsedCommand[1]).Id);
                                dbClient.runQuery();
                                Session.SendMOTD("Du er nå i et forhold med " + parsedCommand[1]);
                                return;

                            case "decline":
                                if (!result)
                                {
                                    Session.SendMOTD("Du må være medlem av Mafia eller Police for å ha kommandoene til forhold.");
                                    break;
                                }
                                dbClient.setQuery("DELETE FROM users_relationships WHERE sender_id = @sid AND recipent_id = @myid AND accepted = '0' LIMIT 1");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                dbClient.addParameter("sid", FirewindEnvironment.getHabboForName(parsedCommand[1]).Id);
                                dbClient.runQuery();
                                Session.SendMOTD("Du har avslått " + parsedCommand[1]);
                                return;

                            case "declineall":
                                if (!result)
                                {
                                    Session.SendMOTD("Du må være medlem av Mafia eller Police for å ha kommandoene til forhold.");
                                    break;
                                }
                                dbClient.setQuery("DELETE FROM users_relationships WHERE recipent_id = @myid AND accepted = '0' LIMIT 1");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                dbClient.runQuery();
                                Session.SendMOTD("Du har avslått alle.");
                                return;

                            case "status":
                                uint userID = FirewindEnvironment.getHabboForName(parsedCommand[1]).Id;
                                dbClient.setQuery("SELECT sender_id,recipent_id FROM users_relationships WHERE (recipent_id = @userid OR sender_id = @userid) AND accepted = '1' LIMIT 1");
                                dbClient.addParameter("userid", userID);
                                DataRow resultRow = dbClient.getRow();

                                if (resultRow == null)
                                {
                                    Session.SendMOTD(parsedCommand[1] + " er singel.");
                                }
                                else
                                {
                                    bool isSender = Convert.ToUInt32(resultRow[0]) == userID;
                                    Session.SendMOTD(parsedCommand[1] + " er i et forhold med " + (isSender ? FirewindEnvironment.getHabboForId(Convert.ToUInt32(resultRow[1])).Username : FirewindEnvironment.getHabboForId(Convert.ToUInt32(resultRow[0])).Username));
                                }
                                return;

                            case "removerelationship":
                                if (!result)
                                {
                                    Session.SendMOTD("Du må være medlem av Mafia eller Police for å ha kommandoene til forhold.");
                                    break;
                                }
                                dbClient.setQuery("DELETE FROM users_relationships WHERE accepted = '1' AND (recipent_id = @myid OR sender_id = @myid) LIMIT 1");
                                dbClient.addParameter("myid", Session.GetHabbo().Id);
                                dbClient.runQuery();
                                Session.SendMOTD("Du er ikke lenger i noen forhold.");
                                return;
                            }
                        }
                    }
                }


                uint rank = 1;
                Message = LanguageLocale.FilterSwearwords(Message);
                if (Session != null && Session.GetHabbo() != null)
                {
                    rank = Session.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(Session.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(Session, HabboHotel.Quests.QuestType.SOCIAL_CHAT);

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

            InvokedChatMessage message = new InvokedChatMessage(this, Message, Shout);

            GetRoom().QueueChatMessage(message);
        }
コード例 #10
0
 public int GetNeedd(uint AchievementId, int AchLevel, Users.Habbo Habbo)
 {
     return(GetNeed(AchievementId, AchLevel, Habbo));
 }
コード例 #11
0
 public int GetHavee(uint AchievementId, Users.Habbo Habbo)
 {
     return(GetHave(AchievementId, Habbo));
 }