public void Handle(GameClient Session, ClientMessage Event)
        {
            uint   num  = Event.PopWiredUInt();
            string text = HabboIM.FilterString(Event.PopFixedString());

            if (Session != null && Session.GetHabbo() != null && Session.GetHabbo().GetMessenger() != null)
            {
                if (num == 0u && Session.GetHabbo().HasFuse("cmd_sa"))
                {
                    ServerMessage Message = new ServerMessage(134u);
                    Message.AppendUInt(0u);
                    Message.AppendString(Session.GetHabbo().Username + ": " + text);
                    HabboIM.GetGame().GetClientManager().method_17(Session, Message);
                }
                else
                {
                    if (num == 0u)
                    {
                        ServerMessage Message2 = new ServerMessage(261u);
                        Message2.AppendInt32(4);
                        Message2.AppendUInt(0u);
                        Session.SendMessage(Message2);
                    }
                    else
                    {
                        if (Session != null && Session.GetHabbo() != null)
                        {
                            Session.GetHabbo().GetMessenger().method_18(num, text);
                        }
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string text = HabboIM.FilterString(Event.PopFixedString());

            if (text.Length >= 1)
            {
                Session.SendMessage(HabboIM.GetGame().GetHelpTool().method_10(text));
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string text = HabboIM.FilterString(Event.PopFixedString());

            if (text.Length <= 50 && !(text != ChatCommandHandler.smethod_4(text)) && !(text == Session.GetHabbo().Motto))
            {
                Session.GetHabbo().Motto = text;
                using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
                {
                    @class.AddParamWithValue("motto", text);
                    @class.ExecuteQuery("UPDATE users SET motto = @motto WHERE Id = '" + Session.GetHabbo().Id + "' LIMIT 1");
                }
                if (Session.GetHabbo().CurrentQuestId > 0 && HabboIM.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHANGEMOTTO")
                {
                    HabboIM.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
                }
                ServerMessage Message = new ServerMessage(484u);
                Message.AppendInt32(-1);
                Message.AppendStringWithBreak(Session.GetHabbo().Motto);
                Session.SendMessage(Message);
                if (Session.GetHabbo().InRoom)
                {
                    Room class14_ = Session.GetHabbo().CurrentRoom;
                    if (class14_ == null)
                    {
                        return;
                    }
                    RoomUser class2 = class14_.GetRoomUserByHabbo(Session.GetHabbo().Id);
                    if (class2 == null)
                    {
                        return;
                    }
                    ServerMessage Message2 = new ServerMessage(266u);
                    Message2.AppendInt32(class2.VirtualId);
                    Message2.AppendStringWithBreak(Session.GetHabbo().Figure);
                    Message2.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                    Message2.AppendStringWithBreak(Session.GetHabbo().Motto);
                    Message2.AppendInt32(Session.GetHabbo().AchievementScore);
                    Message2.AppendStringWithBreak("");
                    class14_.SendMessage(Message2, null);
                }

                Session.GetHabbo().MottoAchievementsCompleted();

                if (Session.GetHabbo().FriendStreamEnabled)
                {
                    using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                    {
                        class2.AddParamWithValue("motto", text);
                        string look = HabboIM.FilterString(Session.GetHabbo().Figure);
                        class2.AddParamWithValue("look", look);
                        class2.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`) VALUES (NULL, '3', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), @motto);");
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            int    int_     = Event.PopWiredInt32();
            uint   uint_    = Event.PopWiredUInt();
            string string_  = Event.PopFixedString();
            string string_2 = HabboIM.FilterString(Event.PopFixedString());
            string string_3 = HabboIM.FilterString(Event.PopFixedString());

            HabboIM.GetGame().GetCatalog().method_6(Session, int_, uint_, string_, true, string_2, string_3, true);
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null)
            {
                RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                if (class2 != null)
                {
                    class2.HandleSpeech(Session, HabboIM.FilterString(Event.PopFixedString()), true);
                }
            }
        }
Пример #6
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && !Session.GetHabbo().list_4.Contains(@class.Id) && [email protected](Session, true))
            {
                switch (Event.PopWiredInt32())
                {
                case -1:
                    @class.Score--;
                    break;

                case 0:
                    return;

                case 1:
                    @class.Score++;
                    if (Session.GetHabbo().FriendStreamEnabled)
                    {
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            string look = HabboIM.FilterString(Session.GetHabbo().Figure);
                            class2.AddParamWithValue("look", look);
                            class2.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`) VALUES (NULL, '1', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), '" + Session.GetHabbo().CurrentRoomId + "');");
                        }
                    }
                    break;

                default:
                    return;
                }
                using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                {
                    class2.ExecuteQuery(string.Concat(new object[]
                    {
                        "UPDATE rooms SET score = '",
                        @class.Score,
                        "' WHERE Id = '",
                        @class.Id,
                        "' LIMIT 1"
                    }));
                }
                Session.GetHabbo().list_4.Add(@class.Id);
                ServerMessage Message = new ServerMessage(345u);
                Message.AppendInt32(@class.Score);
                Session.SendMessage(Message);
            }
        }
Пример #7
0
        public ServerMessage method_10(string string_0)
        {
            DataTable dataTable = null;

            using (DatabaseClient @class = HabboIM.GetDatabase().GetClient())
            {
                string_0 = HabboIM.FilterString(string_0.ToLower()).Trim();
                if (string_0.Length > 0)
                {
                    if (string_0.StartsWith("owner:"))
                    {
                        string_0 = string_0.Replace(" ", "");
                        @class.AddParamWithValue("query", string_0.Substring(6));
                        dataTable = @class.ReadDataTable("SELECT * FROM rooms WHERE owner = @query AND roomtype = 'private' ORDER BY users_now DESC LIMIT " + ServerConfiguration.RoomUserLimit);
                    }
                    else
                    {
                        string_0 = string_0.Replace("%", "\\%");
                        string_0 = string_0.Replace("_", "\\_");
                        @class.AddParamWithValue("query", string_0 + "%");
                        @class.AddParamWithValue("tags_query", "%" + string_0 + "%");
                        dataTable = @class.ReadDataTable("SELECT * FROM rooms WHERE caption LIKE @query AND roomtype = 'private' OR owner LIKE @query AND roomtype = 'private' ORDER BY users_now DESC LIMIT 40");
                    }
                }
            }
            List <RoomData> list = new List <RoomData>();

            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    RoomData item = HabboIM.GetGame().GetRoomManager().method_17((uint)dataRow["Id"], dataRow);
                    list.Add(item);
                }
            }
            ServerMessage Message = new ServerMessage(451u);

            Message.AppendInt32(1);
            Message.AppendInt32(9);
            Message.AppendStringWithBreak(string_0);
            Message.AppendInt32(list.Count);
            foreach (RoomData current in list)
            {
                current.method_3(Message, false, false);
            }
            return(Message);
        }
Пример #8
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            if (Session != null && Session.GetHabbo() != null)
            {
                Room room = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                if (room != null)
                {
                    RoomUser user = room.GetRoomUserByHabbo(Session.GetHabbo().Id);

                    if (user != null)
                    {
                        user.HandleSpeech(Session, HabboIM.FilterString(Event.PopFixedString()), false);
                    }
                }
            }
        }
 public void Handle(GameClient Session, ClientMessage Event)
 {
     if (Session.GetHabbo().OwnedRooms.Count <= ServerConfiguration.RoomUserLimit)
     {
         string string_  = HabboIM.FilterString(Event.PopFixedString());
         string string_2 = Event.PopFixedString();
         Event.PopFixedString();
         RoomData @class = HabboIM.GetGame().GetRoomManager().method_20(Session, string_, string_2);
         if (@class != null)
         {
             ServerMessage Message = new ServerMessage(59u);
             Message.AppendUInt(@class.Id);
             Message.AppendStringWithBreak(@class.Name);
             Session.SendMessage(Message);
         }
     }
 }
Пример #10
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            if (Session.GetHabbo().GetMessenger() != null)
            {
                int num = Event.PopWiredInt32();
                for (int i = 0; i < num; i++)
                {
                    uint             uint_  = Event.PopWiredUInt();
                    MessengerRequest @class = Session.GetHabbo().GetMessenger().method_4(uint_);
                    if (@class != null)
                    {
                        if (@class.To != Session.GetHabbo().Id)
                        {
                            break;
                        }

                        if (!Session.GetHabbo().GetMessenger().method_9(@class.To, @class.From))
                        {
                            Session.GetHabbo().GetMessenger().method_12(@class.From);
                        }

                        Session.GetHabbo().GetMessenger().method_11(uint_);

                        if (Session.GetHabbo().FriendStreamEnabled)
                        {
                            using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                            {
                                string fromlook = HabboIM.FilterString(@class.SenderFigure);
                                string tolook   = HabboIM.FilterString(Session.GetHabbo().Figure);
                                class2.AddParamWithValue("fromusername", @class.senderUsername);
                                class2.AddParamWithValue("tousername", Session.GetHabbo().Username);
                                class2.AddParamWithValue("fromlook", fromlook);
                                class2.AddParamWithValue("tolook", tolook);
                                class2.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`, `data_extra`) VALUES (NULL, '0', '" + Session.GetHabbo().Id + "', '" + @class.SenderGender.ToUpper() + "', @fromlook, UNIX_TIMESTAMP(), '" + @class.From + "', @fromusername);");
                                class2.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`, `data_extra`) VALUES (NULL, '0', '" + @class.From + "', '" + Session.GetHabbo().Gender.ToUpper() + "', @tolook, UNIX_TIMESTAMP(), '" + Session.GetHabbo().Id + "', @tousername);");
                            }
                        }
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            bool flag = false;

            if (HabboIM.GetGame().GetModerationTool().method_9(Session.GetHabbo().Id))
            {
                flag = true;
            }
            if (!flag)
            {
                string string_ = HabboIM.FilterString(Event.PopFixedString());
                Event.PopWiredInt32();
                int  int_  = Event.PopWiredInt32();
                uint uint_ = Event.PopWiredUInt();
                HabboIM.GetGame().GetModerationTool().method_3(Session, int_, uint_, string_);
            }
            ServerMessage Message = new ServerMessage(321u);

            Message.AppendBoolean(flag);
            Session.SendMessage(Message);
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && @class.CheckRights(Session, true) && @class.Event != null)
            {
                int    int_     = Event.PopWiredInt32();
                string string_  = HabboIM.FilterString(Event.PopFixedString());
                string string_2 = HabboIM.FilterString(Event.PopFixedString());
                int    num      = Event.PopWiredInt32();
                @class.Event.Category    = int_;
                @class.Event.Name        = string_;
                @class.Event.Description = string_2;
                @class.Event.Tags        = new List <string>();
                for (int i = 0; i < num; i++)
                {
                    @class.Event.Tags.Add(HabboIM.FilterString(Event.PopFixedString()));
                }
                @class.SendMessage(@class.Event.Serialize(Session), null);
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && @class.CheckRights(Session, true) && @class.Event == null && @class.State == 0)
            {
                int    int_    = Event.PopWiredInt32();
                string text    = HabboIM.FilterString(Event.PopFixedString());
                string string_ = HabboIM.FilterString(Event.PopFixedString());
                int    num     = Event.PopWiredInt32();
                if (text.Length >= 1)
                {
                    @class.Event      = new RoomEvent(@class.Id, text, string_, int_, null);
                    @class.Event.Tags = new List <string>();
                    for (int i = 0; i < num; i++)
                    {
                        @class.Event.Tags.Add(HabboIM.FilterString(Event.PopFixedString()));
                    }
                    @class.SendMessage(@class.Event.Serialize(Session), null);
                }
            }
        }
Пример #14
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && @class.method_26(Session))
            {
                uint   num  = Event.PopWiredUInt();
                string a    = Event.PopFixedString().ToUpper();
                string text = HabboIM.FilterString(Event.PopFixedString());
                text  = text.Replace("hd-99999-99999", "");
                text += ".";
                RoomItem class2 = @class.Hashtable_0[num] as RoomItem;
                if (class2 != null)
                {
                    if (class2.ExtraData.Contains(','))
                    {
                        class2.string_2 = class2.ExtraData.Split(new char[]
                        {
                            ','
                        })[0];
                        class2.string_3 = class2.ExtraData.Split(new char[]
                        {
                            ','
                        })[1];
                    }
                    if (a == "M")
                    {
                        class2.string_2 = text;
                    }
                    else
                    {
                        class2.string_3 = text;
                    }
                    class2.ExtraData = class2.string_2 + "," + class2.string_3;
                    class2.UpdateState(true, true);
                }
            }
        }
Пример #15
0
        public RoomData method_20(GameClient Session, string string_0, string string_1)
        {
            string_0 = HabboIM.FilterString(string_0);
            RoomData result;

            if (!this.Models.ContainsKey(string_1))
            {
                Session.SendNotification("Sorry, this room model has not been added yet. Try again later.");
                result = null;
            }
            else if (this.Models[string_1].bool_0 && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club") && !Session.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_vip"))
            {
                Session.SendNotification("Du musst erst als Habbo Club Mitglied sein!");
                result = null;
            }
            else if (string_0.Length < 3)
            {
                Session.SendNotification("Der Name ist zu kurz!");
                result = null;
            }
            else
            {
                uint uint_ = 0u;
                using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                {
                    dbClient.AddParamWithValue("caption", string_0);
                    dbClient.AddParamWithValue("model", string_1);
                    dbClient.AddParamWithValue("username", Session.GetHabbo().Username);
                    dbClient.ExecuteQuery("INSERT INTO rooms (roomtype,caption,owner,model_name) VALUES ('private',@caption,@username,@model)", 30);
                    Session.GetHabbo().GetUserDataFactory().SetRooms(dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = @username ORDER BY Id ASC", 30));
                    uint_ = (uint)dbClient.ReadDataRow("SELECT Id FROM rooms WHERE owner = @username AND caption = @caption ORDER BY Id DESC", 30)[0];
                    Session.GetHabbo().method_1(dbClient);
                }
                result = this.method_12(uint_);
            }
            return(result);
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && @class.CheckRights(Session, true))
            {
                Event.PopWiredInt32();
                string text  = HabboIM.FilterString(Event.PopFixedString());
                string text2 = HabboIM.FilterString(Event.PopFixedString());
                if (text2.Length > 255)
                {
                    text2 = text2.Substring(0, 255);
                }
                int           num           = Event.PopWiredInt32();
                string        text3         = HabboIM.FilterString(Event.PopFixedString());
                int           num2          = Event.PopWiredInt32();
                int           num3          = Event.PopWiredInt32();
                int           num4          = Event.PopWiredInt32();
                List <string> list          = new List <string>();
                StringBuilder stringBuilder = new StringBuilder();
                for (int i = 0; i < num4; i++)
                {
                    if (i > 0)
                    {
                        stringBuilder.Append(",");
                    }
                    string text4 = HabboIM.FilterString(Event.PopFixedString().ToLower());
                    if (text4 == ChatCommandHandler.smethod_4(text4))
                    {
                        list.Add(text4);
                        stringBuilder.Append(text4);
                    }
                }
                if (stringBuilder.Length > 100)
                {
                    stringBuilder.Clear();
                    stringBuilder.Append("");
                }
                int    num5 = 0;
                int    num6 = 0;
                int    num7 = 0;
                int    num8 = 0;
                string a    = Event.PlainReadBytes(1)[0].ToString();
                Event.AdvancePointer(1);
                string a2 = Event.PlainReadBytes(1)[0].ToString();
                Event.AdvancePointer(1);
                string a3 = Event.PlainReadBytes(1)[0].ToString();
                Event.AdvancePointer(1);
                string a4 = Event.PlainReadBytes(1)[0].ToString();
                Event.AdvancePointer(1);
                int num9  = Event.PopWiredInt32();
                int num10 = Event.PopWiredInt32();
                if (!(text != ChatCommandHandler.smethod_4(text)) && !(text2 != ChatCommandHandler.smethod_4(text2)) && text.Length >= 1 && (num9 >= -2 && num9 <= 1 && num10 >= -2 && num10 <= 1))
                {
                    @class.Wallthick  = num9;
                    @class.Floorthick = num10;
                    if (num >= 0 && num <= 2 && (num2 == 10 || num2 == 15 || num2 == 20 || num2 == 25 || num2 == 30 || num2 == 35 || num2 == 40 || num2 == 45 || num2 == 50 || num2 == 55 || num2 == 60 || num2 == 65 || num2 == 70 || num2 == 75 || num2 == 80 || num2 == 85 || num2 == 90 || num2 == 95 || num2 == 100))
                    {
                        FlatCat class2 = HabboIM.GetGame().GetNavigator().method_2(num3);
                        if (class2 != null)
                        {
                            if ((long)class2.MinRank > (long)((ulong)Session.GetHabbo().Rank))
                            {
                                Session.SendNotification("You are not allowed to use this category. Your room has been moved to no category instead.");
                                num3 = 0;
                            }
                            if (num4 <= 2)
                            {
                                if (a == "65")
                                {
                                    num5            = 1;
                                    @class.AllowPet = true;
                                }
                                else
                                {
                                    @class.AllowPet = false;
                                }
                                if (a2 == "65")
                                {
                                    num6 = 1;
                                    @class.AllowPetsEating = true;
                                }
                                else
                                {
                                    @class.AllowPetsEating = false;
                                }
                                if (a3 == "65")
                                {
                                    num7 = 1;
                                    @class.AllowWalkthrough = true;
                                }
                                else
                                {
                                    @class.AllowWalkthrough = false;
                                }
                                @class.method_22();
                                if (a4 == "65")
                                {
                                    num8            = 1;
                                    @class.Hidewall = true;
                                }
                                else
                                {
                                    @class.Hidewall = false;
                                }
                                @class.Name        = text;
                                @class.State       = num;
                                @class.Description = text2;
                                @class.Category    = num3;
                                if (text3 != "")
                                {
                                    @class.Password = text3;
                                }
                                @class.Tags     = list;
                                @class.UsersMax = num2;
                                string text5 = "open";
                                if (@class.State == 1)
                                {
                                    text5 = "locked";
                                }
                                else
                                {
                                    if (@class.State > 1)
                                    {
                                        text5 = "password";
                                    }
                                }
                                using (DatabaseClient class3 = HabboIM.GetDatabase().GetClient())
                                {
                                    class3.AddParamWithValue("caption", @class.Name);
                                    class3.AddParamWithValue("description", @class.Description);
                                    class3.AddParamWithValue("password", @class.Password);
                                    class3.AddParamWithValue("tags", stringBuilder.ToString());
                                    class3.ExecuteQuery(string.Concat(new object[]
                                    {
                                        "UPDATE rooms SET caption = @caption, description = @description, password = @password, category = '",
                                        num3,
                                        "', state = '",
                                        text5,
                                        "', tags = @tags, users_max = '",
                                        num2,
                                        "', allow_pets = '",
                                        num5,
                                        "', allow_pets_eat = '",
                                        num6,
                                        "', allow_walkthrough = '",
                                        num7,
                                        "', allow_hidewall = '",
                                        num8,
                                        "', wallthick = '",
                                        num9,
                                        "', floorthick = '",
                                        num10,
                                        "'  WHERE Id = '",
                                        @class.Id,
                                        "' LIMIT 1;"
                                    }));
                                }
                                ServerMessage Message = new ServerMessage(467u);
                                Message.AppendUInt(@class.Id);
                                Session.SendMessage(Message);
                                ServerMessage Message2 = new ServerMessage(456u);
                                Message2.AppendUInt(@class.Id);
                                Session.SendMessage(Message2);
                                ServerMessage Message3 = new ServerMessage(472u);
                                Message3.AppendBoolean(@class.Hidewall);
                                Message3.AppendInt32(@class.Wallthick);
                                Message3.AppendInt32(@class.Floorthick);
                                @class.SendMessage(Message3, null);
                                ServerMessage Message4 = new ServerMessage(473u);
                                Message4.AppendBoolean(true);
                                Message4.AppendBoolean(true);
                                @class.SendMessage(Message4, null);
                                RoomData      class27_ = @class.RoomData;
                                ServerMessage Message5 = new ServerMessage(454u);
                                Message5.AppendBoolean(false);
                                class27_.method_3(Message5, false, false);
                                Session.SendMessage(Message5);
                            }
                        }
                    }
                }
            }
        }
Пример #17
0
        internal void method_6(string string_0)
        {
            try
            {
                UserDataFactory @class = new UserDataFactory(string_0, this.GetConnection().String_0, true);
                if (this.GetConnection().String_0 == "127.0.0.1" && [email protected])
                {
                    @class = new UserDataFactory(string_0, "::1", true);
                }
                if ([email protected])
                {
                    Console.ForegroundColor = ConsoleColor.Red;
                    string str = "";
                    if (ServerConfiguration.EnableSSO)
                    {
                        str = HabboIMEnvironment.GetExternalText("emu_sso_wrong_secure") + "(" + this.GetConnection().String_0 + ")";
                    }
                    ServerMessage Message = new ServerMessage(161u);
                    Message.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("emu_sso_wrong") + str);
                    this.GetConnection().SendMessage(Message);
                    Console.ForegroundColor = ConsoleColor.Gray;
                    this.method_12();
                    return;
                }
                Habbo class2 = Authenticator.CreateHabbo(string_0, this, @class, @class);
                HabboIM.GetGame().GetClientManager().method_25(class2.Id);
                this.Habbo = class2;
                this.Habbo.method_2(@class);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Logging login error because you are on alpha test!");
                Logging.LogException(ex.ToString());
                if (this != null)
                {
                    this.SendNotification(ex.ToString());
                    this.method_12();
                }
                return;
            }

            try
            {
                HabboIM.GetGame().GetBanManager().method_1(this);
            }
            catch (ModerationBanException gException)
            {
                this.NotifyBan(gException.Message);
                this.method_12();
                return;
            }

            ServerMessage Message2 = new ServerMessage(2u);

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

            if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes)
            {
                Message2.AppendInt32(2);
            }
            else
            {
                if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                {
                    Message2.AppendInt32(1);
                }
                else
                {
                    Message2.AppendInt32(0);
                }
            }
            if (this.GetHabbo().HasFuse("acc_anyroomowner"))
            {
                Message2.AppendInt32(7);
            }
            else
            {
                if (this.GetHabbo().HasFuse("acc_anyroomrights"))
                {
                    Message2.AppendInt32(5);
                }
                else
                {
                    if (this.GetHabbo().HasFuse("acc_supporttool"))
                    {
                        Message2.AppendInt32(4);
                    }
                    else
                    {
                        if (this.GetHabbo().IsVIP || ServerConfiguration.HabboClubForClothes || this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
                        {
                            Message2.AppendInt32(2);
                        }
                        else
                        {
                            Message2.AppendInt32(0);
                        }
                    }
                }
            }

            this.SendMessage(Message2);

            this.SendMessage(this.GetHabbo().GetEffectsInventoryComponent().method_6());

            ServerMessage Message3 = new ServerMessage(290u);

            Message3.AppendBoolean(true);
            Message3.AppendBoolean(false);
            this.SendMessage(Message3);

            ServerMessage Message5_ = new ServerMessage(3u);

            this.SendMessage(Message5_);

            if (this.GetHabbo().HasFuse("acc_supporttool"))
            {
                this.SendMessage(HabboIM.GetGame().GetModerationTool().method_0());
                HabboIM.GetGame().GetModerationTool().method_4(this);
            }


            ServerMessage UserLogging = new ServerMessage(517u);

            UserLogging.AppendBoolean(true);
            this.SendMessage(UserLogging);
            if (HabboIM.GetGame().GetPixelManager().method_2(this))
            {
                HabboIM.GetGame().GetPixelManager().method_3(this);
            }

            if (GetHabbo().Rank > 5u)
            {
                HabboIM.GetGame().GetClientManager().method_18ONLINE(GetHabbo().Username);
            }

            ServerMessage Message5 = new ServerMessage(455u);

            Message5.AppendUInt(this.GetHabbo().HomeRoomId);
            this.SendMessage(Message5);
            ServerMessage Message6 = new ServerMessage(458u);

            Message6.AppendInt32(30);
            Message6.AppendInt32(this.GetHabbo().list_1.Count);
            foreach (uint current in this.GetHabbo().list_1)
            {
                Message6.AppendUInt(current);
            }
            this.SendMessage(Message6);

            this.GetHabbo().CheckTotalTimeOnlineAchievements();
            this.GetHabbo().CheckHappyHourAchievements();
            this.GetHabbo().CheckTrueHabboAchievements();
            this.GetHabbo().CheckRegularVisitorAchievements();
            this.GetHabbo().CheckFootballGoalHostScoreAchievements();
            this.GetHabbo().CheckStaffPicksAchievement();

            try
            {
                if (HabboIM.UserAdType >= 0 && HabboIM.UserAdType <= 2 && HabboIM.UserAdMessage.Count > 0)
                {
                    if (!(int.Parse(HabboIM.GetConfig().data["ads.disable"]) == 1))
                    {
                        if (!(int.Parse(HabboIM.GetConfig().data["ads.allowedonlyrandomads"]) == 0))
                        {
                            int random = HabboIMEnvironment.GetRandomNumber(1, 100);

                            if (random <= 5)
                            {
                                if (HabboIM.UserAdType == 0)
                                {
                                    this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 0);
                                }
                                if (HabboIM.UserAdType == 1)
                                {
                                    this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 2);
                                }
                                else if (HabboIM.UserAdType == 2 && HabboIM.UserAdLink != "")
                                {
                                    ServerMessage Message = new ServerMessage(161u);
                                    Message.AppendStringWithBreak(string.Concat(new string[]
                                    {
                                        " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ",
                                        "\r\n",
                                        string.Join("\r\n", HabboIM.UserAdMessage),
                                    }));
                                    Message.AppendStringWithBreak(HabboIM.UserAdLink);
                                    this.SendMessage(Message);
                                }
                            }
                        }
                        else
                        {
                            if (HabboIM.UserAdType == 0)
                            {
                                this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 0);
                            }
                            if (HabboIM.UserAdType == 1)
                            {
                                this.SendNotification(string.Join("\r\n", HabboIM.UserAdMessage), 2);
                            }
                            else if (HabboIM.UserAdType == 2 && HabboIM.UserAdLink != "")
                            {
                                ServerMessage Message = new ServerMessage(161u);
                                Message.AppendStringWithBreak(string.Concat(new string[]
                                {
                                    " >>>>>>>>>>>>>>>>>> Ad <<<<<<<<<<<<<<<<<< ",
                                    "\r\n",
                                    string.Join("\r\n", HabboIM.UserAdMessage),
                                }));
                                Message.AppendStringWithBreak(HabboIM.UserAdLink);
                                this.SendMessage(Message);
                            }
                        }
                    }
                }
            }
            catch
            {
            }

            if (ServerConfiguration.MOTD != "")
            {
                this.SendNotification(ServerConfiguration.MOTD, 2);
            }
            for (uint num = (uint)HabboIM.GetGame().GetRoleManager().method_9(); num > 1u; num -= 1u)
            {
                if (HabboIM.GetGame().GetRoleManager().method_8(num).Length > 0)
                {
                    if (!this.GetHabbo().GetBadgeComponent().HasBadge(HabboIM.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank == num)
                    {
                        this.GetHabbo().GetBadgeComponent().SendBadge(this, HabboIM.GetGame().GetRoleManager().method_8(num), true);
                    }
                    else
                    {
                        if (this.GetHabbo().GetBadgeComponent().HasBadge(HabboIM.GetGame().GetRoleManager().method_8(num)) && this.GetHabbo().Rank < num)
                        {
                            this.GetHabbo().GetBadgeComponent().RemoveBadge(HabboIM.GetGame().GetRoleManager().method_8(num));
                        }
                    }
                }
            }

            if (this.GetHabbo().GetSubscriptionManager().HasSubscription("habbo_club"))
            {
                this.GetHabbo().CheckHCAchievements();
            }
            if (this.GetHabbo().IsVIP&& !this.GetHabbo().GetBadgeComponent().HasBadge("VIP"))
            {
                this.GetHabbo().GetBadgeComponent().SendBadge(this, "VIP", true);
            }
            else
            {
                if (!this.GetHabbo().IsVIP&& this.GetHabbo().GetBadgeComponent().HasBadge("VIP"))
                {
                    this.GetHabbo().GetBadgeComponent().RemoveBadge("VIP");
                }
            }
            if (this.GetHabbo().CurrentQuestId > 0u)
            {
                HabboIM.GetGame().GetQuestManager().method_7(this.GetHabbo().CurrentQuestId, this);
            }
            if (!Regex.IsMatch(this.GetHabbo().Username, "^[-a-zA-Z0-9._:,]+$"))
            {
                ServerMessage Message5_2 = new ServerMessage(573u);
                this.SendMessage(Message5_2);
            }
            this.GetHabbo().Motto = HabboIM.FilterString(this.GetHabbo().Motto);
            DataTable dataTable = null;

            using (DatabaseClient class3 = HabboIM.GetDatabase().GetClient())
            {
                dataTable = class3.ReadDataTable("SELECT achievement,achlevel FROM achievements_owed WHERE user = '******'");
            }
            if (dataTable != null)
            {
                foreach (DataRow dataRow in dataTable.Rows)
                {
                    HabboIM.GetGame().GetAchievementManager().addAchievement(this, (uint)dataRow["achievement"], (int)dataRow["achlevel"]);
                    using (DatabaseClient class3 = HabboIM.GetDatabase().GetClient())
                    {
                        class3.ExecuteQuery(string.Concat(new object[]
                        {
                            "DELETE FROM achievements_owed WHERE achievement = '",
                            (uint)dataRow["achievement"],
                            "' AND user = '******' LIMIT 1"
                        }));
                    }
                }
            }
        }
Пример #18
0
        public void ParsePacket(string data)
        {
            string text = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[0];
            string text2 = data.Split(new char[]
            {
                Convert.ToChar(1)
            })[1];
            GameClient client  = null;
            DataRow    dataRow = null;
            string     text3   = text.ToLower();

            if (text3 != null)
            {
                if (MusCommands.dictionary_0 == null)
                {
                    MusCommands.dictionary_0 = new Dictionary <string, int>(29)
                    {
                        {
                            "update_items",
                            0
                        },
                        {
                            "update_catalogue",
                            1
                        },
                        {
                            "update_catalog",
                            2
                        },
                        {
                            "updateusersrooms",
                            3
                        },
                        {
                            "senduser",
                            4
                        },
                        {
                            "updatevip",
                            5
                        },
                        {
                            "giftitem",
                            6
                        },
                        {
                            "giveitem",
                            7
                        },
                        {
                            "unloadroom",
                            8
                        },
                        {
                            "roomalert",
                            9
                        },
                        {
                            "updategroup",
                            10
                        },
                        {
                            "updateusersgroups",
                            11
                        },
                        {
                            "shutdown",
                            12
                        },
                        {
                            "update_filter",
                            13
                        },
                        {
                            "refresh_filter",
                            14
                        },
                        {
                            "updatecredits",
                            15
                        },
                        {
                            "updatesettings",
                            16
                        },
                        {
                            "updatepixels",
                            17
                        },
                        {
                            "updatepoints",
                            18
                        },
                        {
                            "reloadbans",
                            19
                        },
                        {
                            "update_bots",
                            20
                        },
                        {
                            "signout",
                            21
                        },
                        {
                            "exe",
                            22
                        },
                        {
                            "alert",
                            23
                        },
                        {
                            "sa",
                            24
                        },
                        {
                            "ha",
                            25
                        },
                        {
                            "hal",
                            26
                        },
                        {
                            "updatemotto",
                            27
                        },
                        {
                            "updatelook",
                            28
                        },
                        {
                            "infobuspoll",
                            29
                        },
                        {
                            "givebadge",
                            30
                        },
                        {
                            "addroom",
                            31
                        },
                        {
                            "updatescmd",
                            32
                        },
                        {
                            "whisperall",
                            33
                        }
                    };
                }
                int num;
                if (MusCommands.dictionary_0.TryGetValue(text3, out num))
                {
                    uint   uint_2;
                    string text5;
                    switch (num)
                    {
                    case 0:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().GetItemManager().method_0(class2);
                            goto IL_1379;
                        }
                        break;

                    case 1:
                    case 2:
                        break;

                    case 3:
                    {
                        Habbo class3 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                            {
                                class3.method_1(class2);
                            }
                        }
                        goto IL_1379;
                    }

                    case 4:
                    {
                        uint num2 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint num3 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[1]);
                        GameClient class4 = HabboIM.GetGame().GetClientManager().method_2(num2);
                        Room       class5 = HabboIM.GetGame().GetRoomManager().GetRoom(num3);
                        if (class4 != null)
                        {
                            ServerMessage Message7 = new ServerMessage(286u);
                            Message7.AppendBoolean(class5.IsPublic);
                            Message7.AppendUInt(num3);
                            class4.SendMessage(Message7);
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 5:
                    {
                        Habbo class3 = HabboIM.GetGame().GetClientManager().method_2(Convert.ToUInt32(text2)).GetHabbo();
                        if (class3 != null)
                        {
                            class3.UpdateRights();
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 6:
                    case 7:
                    {
                        uint num2 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        uint uint_ = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[1]);
                        int int_ = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[2]);
                        string string_ = text2.Substring(num2.ToString().Length + uint_.ToString().Length + int_.ToString().Length + 3);
                        HabboIM.GetGame().GetCatalog().method_7(string_, num2, uint_, int_);
                        goto IL_1379;
                    }

                    case 8:
                    {
                        uint_2 = uint.Parse(text2);
                        Room class5 = HabboIM.GetGame().GetRoomManager().GetRoom(uint_2);
                        HabboIM.GetGame().GetRoomManager().method_16(class5);
                        goto IL_1379;
                    }

                    case 9:
                    {
                        uint num3 = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        Room class5 = HabboIM.GetGame().GetRoomManager().GetRoom(num3);
                        if (class5 != null)
                        {
                            string string_2 = text2.Substring(num3.ToString().Length + 1);
                            for (int i = 0; i < class5.RoomUsers.Length; i++)
                            {
                                RoomUser class6 = class5.RoomUsers[i];
                                if (class6 != null)
                                {
                                    class6.GetClient().SendNotification(string_2);
                                }
                            }
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 10:
                    {
                        int int_2 = int.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            Groups.smethod_3(class2, int_2);
                            goto IL_1379;
                        }
                        goto IL_5BF;
                    }

                    case 11:
                        goto IL_5BF;

                    case 12:
                        goto IL_119A;

                    case 13:
                    case 14:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            ChatCommandHandler.InitWords(class2);
                            goto IL_1379;
                        }
                        goto IL_5F7;

                    case 15:
                        goto IL_5F7;

                    case 16:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().LoadServerSettings(class2);
                            goto IL_1379;
                        }
                        goto IL_62F;

                    case 17:
                        goto IL_62F;

                    case 18:
                        client = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2));
                        if (client != null)
                        {
                            client.GetHabbo().UpdateVipPoints(true, false);
                            goto IL_1379;
                        }
                        goto IL_1379;

                    case 19:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().GetBanManager().Initialise(class2);
                        }
                        HabboIM.GetGame().GetClientManager().method_28();
                        goto IL_1379;

                    case 20:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            HabboIM.GetGame().GetBotManager().method_0(class2);
                            goto IL_1379;
                        }
                        goto IL_6F1;

                    case 21:
                        goto IL_6F1;

                    case 22:
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(text2, 30);
                            goto IL_1379;
                        }
                        goto IL_727;

                    case 23:
                        goto IL_727;

                    case 24:
                    {
                        ServerMessage Message8 = new ServerMessage(134u);
                        Message8.AppendUInt(0u);
                        Message8.AppendString("System: " + text2);
                        HabboIM.GetGame().GetClientManager().method_16(Message8, Message8);
                        goto IL_1379;
                    }

                    case 25:
                    {
                        ServerMessage Message9 = new ServerMessage(808u);
                        Message9.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("mus_ha_title"));
                        Message9.AppendStringWithBreak(text2);
                        ServerMessage Message10 = new ServerMessage(161u);
                        Message10.AppendStringWithBreak(text2);
                        HabboIM.GetGame().GetClientManager().method_15(Message9, Message10);
                        goto IL_1379;
                    }

                    case 26:
                    {
                        string text4 = text2.Split(new char[]
                            {
                                ' '
                            })[0];
                        text5 = text2.Substring(text4.Length + 1);
                        ServerMessage Message11 = new ServerMessage(161u);
                        Message11.AppendStringWithBreak(string.Concat(new string[]
                            {
                                HabboIMEnvironment.GetExternalText("mus_hal_title"),
                                "\r\n",
                                text5,
                                "\r\n-",
                                HabboIMEnvironment.GetExternalText("mus_hal_tail")
                            }));
                        Message11.AppendStringWithBreak(text4);
                        HabboIM.GetGame().GetClientManager().BroadcastMessage(Message11);
                        goto IL_1379;
                    }

                    case 27:
                    case 28:
                    {
                        uint_2 = uint.Parse(text2);
                        client = HabboIM.GetGame().GetClientManager().method_2(uint_2);
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT look,gender,motto,mutant_penalty,block_newfriends FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30);
                        }
                        client.GetHabbo().Figure          = (string)dataRow["look"];
                        client.GetHabbo().Gender          = dataRow["gender"].ToString().ToLower();
                        client.GetHabbo().Motto           = HabboIM.FilterString((string)dataRow["motto"]);
                        client.GetHabbo().BlockNewFriends = HabboIM.StringToBoolean(dataRow["block_newfriends"].ToString());
                        ServerMessage Message12           = new ServerMessage(266u);
                        Message12.AppendInt32(-1);
                        Message12.AppendStringWithBreak(client.GetHabbo().Figure);
                        Message12.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                        Message12.AppendStringWithBreak(client.GetHabbo().Motto);
                        client.SendMessage(Message12);
                        if (client.GetHabbo().InRoom)
                        {
                            Room          class5    = HabboIM.GetGame().GetRoomManager().GetRoom(client.GetHabbo().CurrentRoomId);
                            RoomUser      class7    = class5.GetRoomUserByHabbo(client.GetHabbo().Id);
                            ServerMessage Message13 = new ServerMessage(266u);
                            Message13.AppendInt32(class7.VirtualId);
                            Message13.AppendStringWithBreak(client.GetHabbo().Figure);
                            Message13.AppendStringWithBreak(client.GetHabbo().Gender.ToLower());
                            Message13.AppendStringWithBreak(client.GetHabbo().Motto);
                            Message13.AppendInt32(client.GetHabbo().AchievementScore);
                            Message13.AppendStringWithBreak("");
                            class5.SendMessage(Message13, null);
                        }
                        text3 = text.ToLower();
                        if (text3 == null)
                        {
                            goto IL_1379;
                        }
                        if (text3 == "updatemotto")
                        {
                            client.GetHabbo().MottoAchievementsCompleted();
                            goto IL_1379;
                        }
                        if (text3 == "updatelook")
                        {
                            client.GetHabbo().AvatarLookAchievementsCompleted();
                            goto IL_1379;
                        }
                        goto IL_1379;
                    }

                    case 33:
                    {
                        HabboIM.GetGame().GetClientManager().method_WHISPER(text2);



                        goto IL_1379;
                    }

                    case 29:
                    {
                        int QuestionID = int.Parse(text2);
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            DataRow   QuestionRow  = dbClient.ReadDataRow("SELECT * FROM infobus_questions WHERE id='" + QuestionID + "' LIMIT 1", 30);
                            string    Question     = dbClient.ReadString("SELECT question FROM infobus_questions WHERE id = '" + QuestionID + "' LIMIT 1", 30);
                            DataTable AnswersTable = dbClient.ReadDataTable("SELECT * FROM infobus_answers WHERE question_id='" + QuestionID + "'", 30);
                            Room      PollRoom     = HabboIM.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString()).GetHabbo().CurrentRoom;
                            PollRoom.CurrentPollId = QuestionID;
                            GameClient TargetUser = HabboIM.GetGame().GetClientManager().GetClientByHabbo(QuestionRow["owner"].ToString());
                            if (PollRoom.Owner == QuestionRow["owner"].ToString())
                            {
                                ServerMessage InfobusQuestion = new ServerMessage(79u);
                                InfobusQuestion.AppendStringWithBreak(Question);
                                InfobusQuestion.AppendInt32(AnswersTable.Rows.Count);
                                if (AnswersTable != null)
                                {
                                    foreach (DataRow Row in AnswersTable.Rows)
                                    {
                                        InfobusQuestion.AppendInt32((int)Row["id"]);
                                        InfobusQuestion.AppendStringWithBreak((string)Row["answer_text"]);
                                    }
                                }
                                PollRoom.SendMessage(InfobusQuestion, null);
                                Thread Infobus = new Thread(delegate()
                                    {
                                        Room.ShowResults(PollRoom, QuestionID, TargetUser);
                                    });
                                Infobus.Start();
                            }
                        }
                        goto IL_1379;
                    }

                    case 30:
                    {
                        uint UserId = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        string BadgeCode = text2.Split(new char[]
                            {
                                ' '
                            })[1];
                        GameClient Session = HabboIM.GetGame().GetClientManager().GetClientByHabbo(HabboIM.GetGame().GetClientManager().GetNameById(UserId));
                        Session.GetHabbo().GetBadgeComponent().SendBadge(Session, BadgeCode, true);
                        goto IL_1379;
                    }

                    case 31:
                    {
                        uint UserId = uint.Parse(text2.Split(new char[]
                            {
                                ' '
                            })[0]);
                        string RoomModel = text2.Split(new char[]
                            {
                                ' '
                            })[1];
                        string Caption = text2.Split(new char[]
                            {
                                ' '
                            })[2];
                        GameClient Session = HabboIM.GetGame().GetClientManager().GetClientByHabbo(HabboIM.GetGame().GetClientManager().GetNameById(UserId));
                        uint       uint_   = 0u;
                        using (DatabaseClient dbClient = HabboIM.GetDatabase().GetClient())
                        {
                            dbClient.AddParamWithValue("caption", Caption);
                            dbClient.AddParamWithValue("model", RoomModel);
                            dbClient.AddParamWithValue("username", Session.GetHabbo().Username);
                            dbClient.ExecuteQuery("INSERT INTO rooms (roomtype,caption,owner,model_name) VALUES ('private',@caption,@username,@model)", 30);
                            Session.GetHabbo().GetUserDataFactory().SetRooms(dbClient.ReadDataTable("SELECT * FROM rooms WHERE owner = @username ORDER BY Id ASC", 30));
                            uint_ = (uint)dbClient.ReadDataRow("SELECT Id FROM rooms WHERE owner = @username AND caption = @caption ORDER BY Id DESC", 30)[0];
                            Session.GetHabbo().method_1(dbClient);
                        }
                        RoomData result = HabboIM.GetGame().GetRoomManager().method_12(uint_);
                        if (result != null)
                        {
                            ServerMessage Message8 = new ServerMessage(59u);
                            Message8.AppendUInt(result.Id);
                            Message8.AppendStringWithBreak(result.Name);
                            Session.SendMessage(Message8);
                        }
                        goto IL_1379;
                    }

                    case 32:
                        uint_2 = uint.Parse(text2);
                        client = HabboIM.GetGame().GetClientManager().method_2(uint_2);
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            dataRow = class2.ReadDataRow("SELECT gc,block_newfriends,accept_trading,raumalert,werbercmd,changename FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30);
                        }
                        client.GetHabbo().Raumalert       = HabboIM.StringToBoolean(dataRow["raumalert"].ToString());
                        client.GetHabbo().WerberCmd       = HabboIM.StringToBoolean(dataRow["werbercmd"].ToString());
                        client.GetHabbo().BlockNewFriends = HabboIM.StringToBoolean(dataRow["block_newfriends"].ToString());
                        client.GetHabbo().TradingDisabled = HabboIM.StringToBoolean(dataRow["accept_trading"].ToString());
                        client.GetHabbo().ChangeName      = HabboIM.StringToBoolean(dataRow["changename"].ToString());
                        client.GetHabbo().gc = (int)dataRow["gc"];
                        goto IL_1379;

                    default:
                        goto IL_1379;
                    }
                    using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                    {
                        HabboIM.GetGame().GetCatalog().method_0(class2);
                    }
                    HabboIM.GetGame().GetCatalog().method_1();
                    HabboIM.GetGame().GetClientManager().BroadcastMessage(new ServerMessage(441u));
                    goto IL_1379;
IL_5BF:
                    uint_2 = uint.Parse(text2);
                    using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                    {
                        HabboIM.GetGame().GetClientManager().method_2(uint_2).GetHabbo().method_0(class2);
                        goto IL_1379;
                    }
                    goto IL_119A;
IL_5F7:
                    client = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_3 = 0;
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            int_3 = (int)class2.ReadDataRow("SELECT credits FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30)[0];
                        }
                        client.GetHabbo().Credits = int_3;
                        client.GetHabbo().UpdateCredits(false);
                        goto IL_1379;
                    }
                    goto IL_1379;
IL_62F:
                    client = HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2));
                    if (client != null)
                    {
                        int int_4 = 0;
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            int_4 = (int)class2.ReadDataRow("SELECT activity_points FROM users WHERE id = '" + client.GetHabbo().Id + "' LIMIT 1", 30)[0];
                        }
                        client.GetHabbo().ActivityPoints = int_4;
                        client.GetHabbo().UpdateActivityPoints(false);
                        goto IL_1379;
                    }
                    goto IL_1379;
IL_6F1:
                    HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text2)).method_12();
                    goto IL_1379;
IL_727:
                    string text6 = text2.Split(new char[]
                    {
                        ' '
                    })[0];
                    text5 = text2.Substring(text6.Length + 1);
                    ServerMessage Message14 = new ServerMessage(808u);
                    Message14.AppendStringWithBreak(HabboIMEnvironment.GetExternalText("mus_alert_title"));
                    Message14.AppendStringWithBreak(text5);
                    HabboIM.GetGame().GetClientManager().method_2(uint.Parse(text6)).SendMessage(Message14);
                    goto IL_1378;
IL_119A:
                    HabboIM.Close();
                }
                IL_1378 :;
            }
            IL_1379 :
            ServerMessage Message15 = new ServerMessage(1u);

            Message15.AppendString("Hallo Housekeeping :)");
            this.ClientSocket.Send(Message15.GetBytes());
        }
Пример #19
0
        public void Handle(GameClient Session, ClientMessage Event)
        {
            string text  = Event.PopFixedString().ToUpper();
            string text2 = HabboIM.FilterString(Event.PopFixedString());

            if (AntiMutant.ValidateLook(text2, text))
            {
                if (Session.GetHabbo().CurrentQuestId > 0 && HabboIM.GetGame().GetQuestManager().GetQuestAction(Session.GetHabbo().CurrentQuestId) == "CHANGE_FIGURE")
                {
                    HabboIM.GetGame().GetQuestManager().ProgressUserQuest(Session.GetHabbo().CurrentQuestId, Session);
                }
                Session.GetHabbo().Figure = text2;
                Session.GetHabbo().Gender = text.ToLower();
                using (DatabaseClient client = HabboIM.GetDatabase().GetClient())
                {
                    client.AddParamWithValue("look", text2);
                    client.AddParamWithValue("gender", text);
                    client.ExecuteQuery("UPDATE users SET look = @look, gender = @gender WHERE id = " + Session.GetHabbo().Id + " LIMIT 1;");
                }
                HabboIM.GetGame().GetAchievementManager().addAchievement(Session, 1u, 1);
                ServerMessage serverMessage = new ServerMessage(266u);
                serverMessage.AppendInt32(-1);
                serverMessage.AppendStringWithBreak(Session.GetHabbo().Figure);
                serverMessage.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                serverMessage.AppendStringWithBreak(Session.GetHabbo().Motto);
                serverMessage.AppendInt32(Session.GetHabbo().AchievementScore);
                serverMessage.AppendStringWithBreak("");
                Session.SendMessage(serverMessage);
                if (Session.GetHabbo().InRoom)
                {
                    Room currentRoom = Session.GetHabbo().CurrentRoom;
                    if (currentRoom != null)
                    {
                        RoomUser roomUserByHabbo = currentRoom.GetRoomUserByHabbo(Session.GetHabbo().Id);
                        if (roomUserByHabbo != null)
                        {
                            roomUserByHabbo.string_0 = "";
                            if (Session.GetHabbo().method_4() > 0)
                            {
                                TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                                if (timeSpan.Seconds > 4)
                                {
                                    Session.GetHabbo().int_23 = 0;
                                }
                                if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5)
                                {
                                    ServerMessage serverMessage2 = new ServerMessage(27u);
                                    serverMessage2.AppendInt32(Session.GetHabbo().method_4());
                                    Session.SendMessage(serverMessage2);
                                    return;
                                }
                                Session.GetHabbo().dateTime_0 = DateTime.Now;
                                Session.GetHabbo().int_23++;
                            }
                            ServerMessage serverMessage3 = new ServerMessage(266u);
                            serverMessage3.AppendInt32(roomUserByHabbo.VirtualId);
                            serverMessage3.AppendStringWithBreak(Session.GetHabbo().Figure);
                            serverMessage3.AppendStringWithBreak(Session.GetHabbo().Gender.ToLower());
                            serverMessage3.AppendStringWithBreak(Session.GetHabbo().Motto);
                            serverMessage3.AppendInt32(Session.GetHabbo().AchievementScore);
                            serverMessage3.AppendStringWithBreak("");
                            currentRoom.SendMessage(serverMessage3, null);
                            Session.GetHabbo().Whisper("Wow, siehst du Toll aus!");
                        }
                    }
                }
            }
        }
        public void Handle(GameClient Session, ClientMessage Event)
        {
            Room @class = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

            if (@class != null && Session != null)
            {
                if (Session.GetHabbo().IsMuted)
                {
                    Session.SendNotification(HabboIMEnvironment.GetExternalText("error_muted"));
                }
                else if (Session.GetHabbo().HasFuse("ignore_roommute") || [email protected]_4)
                {
                    string text  = HabboIM.FilterString(Event.PopFixedString());
                    string text2 = text.Split(new char[]
                    {
                        ' '
                    })[0];
                    string text3           = text.Substring(text2.Length + 1);
                    string antiweberstring = text3;
                    text3 = ChatCommandHandler.smethod_4(text3);
                    RoomUser class2 = @class.GetRoomUserByHabbo(Session.GetHabbo().Id);
                    RoomUser class3 = @class.method_56(text2);
                    if (Session.GetHabbo().method_4() > 0)
                    {
                        TimeSpan timeSpan = DateTime.Now - Session.GetHabbo().dateTime_0;
                        if (timeSpan.Seconds > 4)
                        {
                            Session.GetHabbo().int_23 = 0;
                        }
                        if (timeSpan.Seconds < 4 && Session.GetHabbo().int_23 > 5 && !class2.IsBot)
                        {
                            ServerMessage Message = new ServerMessage(27u);
                            Message.AppendInt32(Session.GetHabbo().method_4());
                            Session.SendMessage(Message);
                            Session.GetHabbo().IsMuted = true;
                            Session.GetHabbo().int_4   = Session.GetHabbo().method_4();
                            return;
                        }
                        Session.GetHabbo().dateTime_0 = DateTime.Now;
                        Session.GetHabbo().int_23++;
                    }
                    ServerMessage Message2 = new ServerMessage(25u);
                    Message2.AppendInt32(class2.VirtualId);
                    Message2.AppendStringWithBreak(text3);
                    Message2.AppendBoolean(false);
                    if (class2 != null && !class2.IsBot)
                    {
                        class2.GetClient().SendMessage(Message2);
                        try {
                            var class266 = HabboIM.GetGame().GetRoomManager().GetRoom(Session.GetHabbo().CurrentRoomId);

                            for (int i = 0; i < class266.RoomUsers.Length; i++)
                            {
                                try {
                                    RoomUser class5 = class266.RoomUsers[i];
                                    if (class5 != null && class3 != null)
                                    {
                                        if (class5.GetClient().GetHabbo().whisperlog == true && class5.GetClient().GetHabbo().Rank >= 6 && class5.GetClient().GetHabbo().Id != Session.GetHabbo().Id&& class5.GetClient().GetHabbo().Id != class3.GetClient().GetHabbo().Id)
                                        {
                                            class5.GetClient().GetHabbo().Whisper(" < " + Session.GetHabbo().Username + " flüstert zu " + class3.GetClient().GetHabbo().Username + " > " + text.Substring(text2.Length + 1));
                                        }
                                    }
                                } catch { }
                            }
                        }  catch { }
                        //HabboIM.GetGame().GetClientManager().method_StaffWhisper("<" + Session.GetHabbo().Username + " flüstert zu " + class3.GetClient().GetHabbo().Username + "> " + text3);
                    }
                    class2.Unidle();
                    if (class3 != null && !class3.IsBot && (class3.GetClient().GetHabbo().list_2.Count <= 0 || !class3.GetClient().GetHabbo().list_2.Contains(Session.GetHabbo().Id)))
                    {
                        class3.GetClient().SendMessage(Message2);
                        if (ServerConfiguration.EnableChatlog)
                        {
                            using (DatabaseClient class4 = HabboIM.GetDatabase().GetClient())
                            {
                                class4.AddParamWithValue("message", "<Whisper to " + class3.GetClient().GetHabbo().Username + ">: " + text3);
                                class4.ExecuteQuery(string.Concat(new object[]
                                {
                                    "INSERT INTO chatlogs (user_id,room_id,hour,minute,timestamp,message,user_name,full_date) VALUES ('",
                                    Session.GetHabbo().Id,
                                    "','",
                                    @class.Id,
                                    "','",
                                    DateTime.Now.Hour,
                                    "','",
                                    DateTime.Now.Minute,
                                    "',UNIX_TIMESTAMP(),@message,'",
                                    Session.GetHabbo().Username,
                                    "','",
                                    DateTime.Now.ToLongDateString(),
                                    "')"
                                }), 30);
                            }
                        }
                        if (HabboIM.GetGame().AntiWerberStatus)
                        {
                            string textaw = ChatCommandHandler.smethod_4b(Session, antiweberstring, "Raum");
                        }
                    }
                }
            }
        }
Пример #21
0
        public void addAchievement(GameClient Session, uint uint_0, int int_0)
        {
            if (!AchievementManager.dictionary_0.ContainsKey(uint_0))
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("AchievementID: " + uint_0 + " does not exist in our database!");
                Console.ForegroundColor = ConsoleColor.White;
            }
            else
            {
                Achievement @class = AchievementManager.dictionary_0[uint_0];
                if (@class != null && !this.method_1(Session, @class.Id, int_0) && int_0 >= 1 && int_0 <= @class.Levels)
                {
                    int num  = AchievementManager.smethod_2(@class.Dynamic_badgelevel, @class.PixelMultiplier, int_0);
                    int num2 = AchievementManager.smethod_2(@class.ScoreBase, @class.PixelMultiplier, int_0);
                    using (TimedLock.Lock(Session.GetHabbo().GetBadgeComponent().GetBadges()))
                    {
                        List <string> list = new List <string>();
                        foreach (Badge current in Session.GetHabbo().GetBadgeComponent().GetBadges())
                        {
                            if (current.Code.StartsWith(@class.BadgeCode))
                            {
                                list.Add(current.Code);
                            }
                        }
                        foreach (string current2 in list)
                        {
                            Session.GetHabbo().GetBadgeComponent().RemoveBadge(current2);
                        }
                    }
                    Session.GetHabbo().GetBadgeComponent().SendBadge(Session, AchievementManager.smethod_3(@class.BadgeCode, int_0, @class.DynamicBadgeLevel), true);
                    if (Session.GetHabbo().dictionary_0.ContainsKey(@class.Id))
                    {
                        Session.GetHabbo().dictionary_0[@class.Id] = int_0;
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            class2.ExecuteQuery(string.Concat(new object[]
                            {
                                "UPDATE user_achievements SET achievement_level = '",
                                int_0,
                                "' WHERE user_id = '",
                                Session.GetHabbo().Id,
                                "' AND achievement_id = '",
                                @class.Id,
                                "' LIMIT 1; UPDATE user_stats SET AchievementScore = AchievementScore + ",
                                num2,
                                " WHERE Id = '",
                                Session.GetHabbo().Id,
                                "' LIMIT 1; "
                            }));
                            goto IL_346;
                        }
                    }
                    Session.GetHabbo().dictionary_0.Add(@class.Id, int_0);
                    using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                    {
                        class2.ExecuteQuery(string.Concat(new object[]
                        {
                            "INSERT INTO user_achievements (user_id,achievement_id,achievement_level) VALUES ('",
                            Session.GetHabbo().Id,
                            "','",
                            @class.Id,
                            "','",
                            int_0,
                            "'); UPDATE user_stats SET AchievementScore = AchievementScore + ",
                            num2,
                            " WHERE Id = '",
                            Session.GetHabbo().Id,
                            "' LIMIT 1; "
                        }));
                    }
IL_346:
                    ServerMessage Message = new ServerMessage(437u);
                    Message.AppendUInt(@class.Id);
                    Message.AppendInt32(int_0);
                    Message.AppendInt32(1337);
                    Message.AppendStringWithBreak(AchievementManager.smethod_3(@class.BadgeCode, int_0, @class.DynamicBadgeLevel));
                    Message.AppendInt32(num2);
                    Message.AppendInt32(num);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    Message.AppendInt32(0);
                    if (int_0 > 1)
                    {
                        Message.AppendStringWithBreak(AchievementManager.smethod_3(@class.BadgeCode, int_0 - 1, @class.DynamicBadgeLevel));
                    }
                    else
                    {
                        Message.AppendStringWithBreak("");
                    }
                    Message.AppendStringWithBreak(@class.Type);
                    Session.SendMessage(Message);
                    Session.GetHabbo().AchievementScore += num2;
                    Session.GetHabbo().ActivityPoints   += num;
                    Session.GetHabbo().method_16(num);

                    if (Session.GetHabbo().FriendStreamEnabled)
                    {
                        using (DatabaseClient class2 = HabboIM.GetDatabase().GetClient())
                        {
                            string BadgeCode = "";
                            if (@class.DynamicBadgeLevel)
                            {
                                BadgeCode = @class.BadgeCode + int_0.ToString();
                            }
                            else
                            {
                                BadgeCode = @class.BadgeCode;
                            }

                            if (!string.IsNullOrEmpty(BadgeCode))
                            {
                                string look = HabboIM.FilterString(Session.GetHabbo().Figure);
                                class2.AddParamWithValue("look", look);
                                class2.ExecuteQuery("INSERT INTO `friend_stream` (`id`, `type`, `userid`, `gender`, `look`, `time`, `data`) VALUES (NULL, '2', '" + Session.GetHabbo().Id + "', '" + Session.GetHabbo().Gender + "', @look, UNIX_TIMESTAMP(), '" + BadgeCode + "');");
                            }
                        }
                    }
                }
            }
        }