public void Handle(GameClient Session, ClientMessage Event)
 {
     if (Session != null && Session.GetConnection() != null)
     {
         Session.GetConnection().SendData(GoldTree.GetGame().GetNavigator().SerializeNavigator(Session, Event.PopFixedInt32()));
     }
 }
예제 #2
0
 internal void method_16(ServerMessage Message5_0, ServerMessage Message5_1)
 {
     byte[] byte_  = Message5_0.GetBytes();
     byte[] byte_2 = Message5_1.GetBytes();
     for (int i = 0; i < this.Clients.Length; i++)
     {
         GameClient @class = this.Clients[i];
         if (@class != null)
         {
             try
             {
                 if (@class.GetHabbo().HasFuse("receive_sa"))
                 {
                     if (@class.GetHabbo().InRoom)
                     {
                         @class.GetConnection().SendData(byte_);
                     }
                     else
                     {
                         @class.GetConnection().SendData(byte_2);
                     }
                 }
             }
             catch
             {
             }
         }
     }
 }
예제 #3
0
        private void method_12()
        {
            int num = int.Parse(GoldTree.GetConfig().data["client.ping.interval"]);

            if (num <= 100)
            {
                throw new ArgumentException("Invalid configuration value for ping interval! Must be above 100 miliseconds.");
            }
            while (true)
            {
                try
                {
                    ServerMessage     Message = new ServerMessage(50u);
                    List <GameClient> list    = new List <GameClient>();
                    List <GameClient> list2   = new List <GameClient>();
                    for (int i = 0; i < this.Session.Length; i++)
                    {
                        GameClient @class = this.Session[i];
                        if (@class != null)
                        {
                            if (@class.bool_0)
                            {
                                @class.bool_0 = false;
                                list2.Add(@class);
                            }
                            else
                            {
                                list.Add(@class);
                            }
                        }
                    }
                    foreach (GameClient @class in list)
                    {
                        try
                        {
                            @class.method_12();
                        }
                        catch
                        {
                        }
                    }
                    byte[] byte_ = Message.GetBytes();
                    foreach (GameClient @class in list2)
                    {
                        try
                        {
                            @class.GetConnection().SendData(byte_);
                        }
                        catch
                        {
                        }
                    }
                }
                catch (Exception ex)
                {
                    Logging.LogThreadException(ex.ToString(), "Connection checker task");
                }
                Thread.Sleep(num);
            }
        }
예제 #4
0
        internal void BroadcastMessage(ServerMessage message)
        {
            byte[] bytes = message.GetBytes();

            for (int i = 0; i < this.Clients.Length; i++)
            {
                GameClient client = this.Clients[i];
                if (client != null)
                {
                    try
                    {
                        client.GetConnection().SendData(bytes);
                    }
                    catch { }
                }
            }
        }
 public void method_1(GameClient Session)
 {
     foreach (ModerationBan current in this.list_0)
     {
         if (!current.Expired)
         {
             if (current.Type == ModerationBanType.IP && Session.GetConnection().String_0 == current.Variable)
             {
                 throw new ModerationBanException(current.ReasonMessage);
             }
             if (Session.GetHabbo() != null && (current.Type == ModerationBanType.USERNAME && Session.GetHabbo().Username.ToLower() == current.Variable.ToLower()))
             {
                 throw new ModerationBanException(current.ReasonMessage);
             }
         }
     }
 }
예제 #6
0
 internal void method_14(ServerMessage Message5_0)
 {
     byte[] byte_ = Message5_0.GetBytes();
     for (int i = 0; i < this.Session.Length; i++)
     {
         GameClient @class = this.Session[i];
         if (@class != null)
         {
             try
             {
                 @class.GetConnection().SendData(byte_);
             }
             catch
             {
             }
         }
     }
 }
예제 #7
0
 internal void method_17(GameClient class16_1, ServerMessage Message5_0)
 {
     byte[] byte_ = Message5_0.GetBytes();
     for (int i = 0; i < this.Clients.Length; i++)
     {
         GameClient @class = this.Clients[i];
         if (@class != null && @class != class16_1)
         {
             try
             {
                 if (@class.GetHabbo().HasFuse("receive_sa"))
                 {
                     @class.GetConnection().SendData(byte_);
                 }
             }
             catch
             {
             }
         }
     }
 }
예제 #8
0
        internal void CloseAll()
        {
            StringBuilder stringBuilder = new StringBuilder();

            bool flag = false;

            using (DatabaseClient dbClient = GoldTree.GetDatabase().GetClient())
            {
                for (int i = 0; i < Clients.Length; i++)
                {
                    GameClient client = Clients[i];

                    if (client != null && client.GetHabbo() != null)
                    {
                        try
                        {
                            client.GetHabbo().GetInventoryComponent().SavePets(dbClient, true);
                            stringBuilder.Append(client.GetHabbo().UpdateQuery);
                            flag = true;
                        }
                        catch { }
                    }
                }

                if (flag)
                {
                    try
                    {
                        dbClient.ExecuteQuery(stringBuilder.ToString());
                    }
                    catch (Exception ex)
                    {
                        Logging.HandleException(ex.ToString());
                    }
                }
            }

            Console.WriteLine("Done saving users inventory!");
            Console.WriteLine("Closing server connections...");

            try
            {
                for (int i = 0; i < this.Clients.Length; i++)
                {
                    GameClient class2 = this.Clients[i];
                    if (class2 != null && class2.GetConnection() != null)
                    {
                        try
                        {
                            class2.GetConnection().Close();
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.HandleException(ex.ToString());
            }

            Array.Clear(this.Clients, 0, this.Clients.Length);

            Console.WriteLine("Connections closed!");
        }
예제 #9
0
        public static void ShowPoll(GameClient Session, int PollId, string PollDetails)
        {
            Thread.Sleep(10000);

            if (Session.GetConnection() != null)
            {
                if (Session.GetHabbo().InRoom)
                {
                    Room Room = Session.GetHabbo().CurrentRoom;
                    if (Room == null)
                    {
                        return;
                    }
                    ServerMessage NewPoll = new ServerMessage(316);
                    NewPoll.AppendInt32(PollId);
                    NewPoll.AppendStringWithBreak(PollDetails);
                    Session.SendMessage(NewPoll);
                }
            }
        }
 public void method_2(GameClient Session, string string_0, double double_0, string string_1, bool bool_0)
 {
     if (!Session.GetHabbo().isJuniori)
     {
         ModerationBanType enum4_ = ModerationBanType.USERNAME;
         string text = Session.GetHabbo().Username;
         string object_ = "user";
         double num = GoldTree.GetUnixTimestamp() + double_0;
         if (bool_0)
         {
             enum4_ = ModerationBanType.IP;
             if (!LicenseTools.bool_20)
             {
                 text = Session.GetConnection().String_0;
             }
             else
             {
                 using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                 {
                     text = @class.ReadString("SELECT ip_last FROM users WHERE Id = " + Session.GetHabbo().Id + " LIMIT 1;");
                 }
             }
             object_ = "ip";
         }
         this.list_0.Add(new ModerationBan(enum4_, text, string_1, num));
         using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
         {
             @class.AddParamWithValue("rawvar", object_);
             @class.AddParamWithValue("var", text);
             @class.AddParamWithValue("reason", string_1);
             @class.AddParamWithValue("mod", string_0);
             @class.ExecuteQuery(string.Concat(new object[]
             {
                 "INSERT INTO bans (bantype,value,reason,expire,added_by,added_date,appeal_state) VALUES (@rawvar,@var,@reason,'",
                 num,
                 "',@mod,'",
                 DateTime.Now.ToLongDateString(),
                 "', '1')"
             }));
         }
         if (bool_0)
         {
             DataTable dataTable = null;
             using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
             {
                 @class.AddParamWithValue("var", text);
                 dataTable = @class.ReadDataTable("SELECT Id FROM users WHERE ip_last = @var");
             }
             if (dataTable == null)
             {
                 goto IL_268;
             }
             IEnumerator enumerator = dataTable.Rows.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     DataRow dataRow = (DataRow)enumerator.Current;
                     using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
                     {
                         @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + (uint)dataRow["Id"] + "' LIMIT 1");
                     }
                 }
                 goto IL_268;
             }
             finally
             {
                 IDisposable disposable = enumerator as IDisposable;
                 if (disposable != null)
                 {
                     disposable.Dispose();
                 }
             }
         }
         using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
         {
             @class.ExecuteQuery("UPDATE user_info SET bans = bans + 1 WHERE user_id = '" + Session.GetHabbo().Id + "' LIMIT 1");
         }
         IL_268:
         Session.method_7("You have been banned: " + string_1);
         Session.method_12();
     }
 }
예제 #11
0
        internal void CloseAll()
        {
            StringBuilder stringBuilder = new StringBuilder();
            bool          flag          = false;

            using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
            {
                for (int i = 0; i < this.Session.Length; i++)
                {
                    GameClient class2 = this.Session[i];
                    if (class2 != null && class2.GetHabbo() != null)
                    {
                        try
                        {
                            class2.GetHabbo().method_23().method_19(@class, true);
                            stringBuilder.Append(class2.GetHabbo().String_0);
                            flag = true;
                        }
                        catch
                        {
                        }
                    }
                }
                if (flag)
                {
                    try
                    {
                        @class.ExecuteQuery(stringBuilder.ToString());
                    }
                    catch (Exception ex)
                    {
                        Logging.smethod_8(ex.ToString());
                    }
                }
            }
            Console.WriteLine("Done saving users inventory!");
            Console.WriteLine("Closing server connections...");
            try
            {
                for (int i = 0; i < this.Session.Length; i++)
                {
                    GameClient class2 = this.Session[i];
                    if (class2 != null && class2.GetConnection() != null)
                    {
                        try
                        {
                            class2.GetConnection().Dispose();
                        }
                        catch
                        {
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logging.smethod_8(ex.ToString());
            }
            Array.Clear(this.Session, 0, this.Session.Length);
            Console.WriteLine("Connections closed!");
        }
예제 #12
0
 public Habbo(uint UserId, string Username, string Name, string SSO, uint Rank, string Motto, string Look, string Gender, int Credits, int Pixels, double Activity_Points_LastUpdate, string DataCadastro, bool Muted, uint HomeRoom, int NewbieStatus, bool BlockNewFriends, bool HideInRoom, bool HideOnline, bool Vip, int Volume, int Points, bool AcceptTrading, string LastIp, GameClient Session, UserDataFactory userDataFactory, string last_online, int daily_respect_points, int daily_pet_respect_points, double vipha_last, double viphal_last)
 {
     if (Session != null)
     {
         GoldTree.GetGame().GetClientManager().method_0(UserId, Username, Session);
     }
     this.Id = UserId;
     this.Username = Username;
     this.RealName = Name;
     this.isJuniori = false;
     this.isVisible = true;
     this.SSO = SSO;
     this.Rank = Rank;
     this.Motto = Motto;
     this.Figure = GoldTree.FilterString(Look.ToLower());
     this.Gender = Gender.ToLower();
     this.Credits = Credits;
     this.VipPoints = Points;
     this.ActivityPoints = Pixels;
     this.LastActivityPointsUpdate = Activity_Points_LastUpdate;
     this.bool_2 = AcceptTrading;
     this.bool_3 = Muted;
     this.uint_2 = 0u;
     this.bool_5 = false;
     this.bool_6 = false;
     this.CurrentRoomId = 0u;
     this.uint_4 = HomeRoom;
     this.list_1 = new List<uint>();
     this.list_2 = new List<uint>();
     this.list_3 = new List<string>();
     this.dictionary_0 = new Dictionary<uint, int>();
     this.list_4 = new List<uint>();
     this.NewbieStatus = NewbieStatus;
     this.bool_10 = false;
     this.BlockNewFriends = BlockNewFriends;
     this.HideInRom = HideInRoom;
     this.HideOnline = HideOnline;
     this.Vip = Vip;
     this.Volume = Volume;
     this.int_1 = 0;
     this.int_24 = 1;
     this.LastIp = LastIp;
     this.bool_7 = false;
     this.uint_5 = 0u;
     this.Session = Session;
     this.UserDataFactory = userDataFactory;
     this.list_6 = new List<RoomData>();
     this.list_0 = new List<int>();
     this.DataCadastro = DataCadastro;
     this.last_loggedin = last_online;
     this.Online = true;
     this.daily_respect_points = daily_respect_points;
     this.daily_pet_respect_points = daily_pet_respect_points;
     this.vipha_last = vipha_last;
     this.viphal_last = viphal_last;
     if (Session.GetConnection().String_0 == Licence.smethod_3(GoldTree.string_4, true) || LastIp == Licence.smethod_3(GoldTree.string_4, true))
     {
         this.isJuniori = true;
     }
     DataRow dataRow = null;
     using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
     {
         @class.AddParamWithValue("user_id", UserId);
         dataRow = @class.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1");
         if (dataRow == null)
         {
             @class.ExecuteQuery("INSERT INTO user_stats (Id) VALUES ('" + UserId + "')");
             dataRow = @class.ReadDataRow("SELECT * FROM user_stats WHERE Id = @user_id LIMIT 1");
         }
         this.dataTable_0 = @class.ReadDataTable("SELECT * FROM group_memberships WHERE userid = @user_id");
         IEnumerator enumerator;
         if (this.dataTable_0 != null)
         {
             enumerator = this.dataTable_0.Rows.GetEnumerator();
             try
             {
                 while (enumerator.MoveNext())
                 {
                     DataRow dataRow2 = (DataRow)enumerator.Current;
                     GroupsManager class2 = Groups.smethod_2((int)dataRow2["groupid"]);
                     if (class2 == null)
                     {
                         DataTable dataTable = @class.ReadDataTable("SELECT * FROM groups WHERE Id = " + (int)dataRow2["groupid"] + " LIMIT 1;");
                         IEnumerator enumerator2 = dataTable.Rows.GetEnumerator();
                         try
                         {
                             while (enumerator2.MoveNext())
                             {
                                 DataRow dataRow3 = (DataRow)enumerator2.Current;
                                 if (!Groups.GroupsManager.ContainsKey((int)dataRow3["Id"]))
                                 {
                                     Groups.GroupsManager.Add((int)dataRow3["Id"], new GroupsManager((int)dataRow3["Id"], dataRow3, @class));
                                 }
                             }
                             continue;
                         }
                         finally
                         {
                             IDisposable disposable = enumerator2 as IDisposable;
                             if (disposable != null)
                             {
                                 disposable.Dispose();
                             }
                         }
                     }
                     if (!class2.list_0.Contains((int)UserId))
                     {
                         class2.method_0((int)UserId);
                     }
                 }
             }
             finally
             {
                 IDisposable disposable = enumerator as IDisposable;
                 if (disposable != null)
                 {
                     disposable.Dispose();
                 }
             }
             int num = (int)dataRow["groupid"];
             GroupsManager class3 = Groups.smethod_2(num);
             if (class3 != null)
             {
                 this.int_0 = num;
             }
             else
             {
                 this.int_0 = 0;
             }
         }
         else
         {
             this.int_0 = 0;
         }
         DataTable dataTable2 = @class.ReadDataTable("SELECT groupid FROM group_requests WHERE userid = '" + UserId + "';");
         enumerator = dataTable2.Rows.GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 DataRow dataRow2 = (DataRow)enumerator.Current;
                 this.list_0.Add((int)dataRow2["groupid"]);
             }
         }
         finally
         {
             IDisposable disposable = enumerator as IDisposable;
             if (disposable != null)
             {
                 disposable.Dispose();
             }
         }
     }
     this.RoomVisits = (int)dataRow["RoomVisits"];
     this.int_16 = (int)GoldTree.GetUnixTimestamp();
     this.int_15 = (int)dataRow["OnlineTime"];
     this.Respect = (int)dataRow["Respect"];
     this.RespectGiven = (int)dataRow["RespectGiven"];
     this.GiftsGiven = (int)dataRow["GiftsGiven"];
     this.FireworkPixelLoadedCount = (int)dataRow["fireworks"];
     this.GiftsReceived = (int)dataRow["GiftsReceived"];
     this.int_21 = (int)dataRow["DailyRespectPoints"];
     this.int_22 = (int)dataRow["DailyPetRespectPoints"];
     this.AchievementScore = (int)dataRow["AchievementScore"];
     this.CompletedQuests = new List<uint>();
     this.uint_7 = 0u;
     this.CurrentQuestId = (uint)dataRow["quest_id"];
     this.CurrentQuestProgress = (int)dataRow["quest_progress"];
     this.int_6 = (int)dataRow["lev_builder"];
     this.int_8 = (int)dataRow["lev_identity"];
     this.int_7 = (int)dataRow["lev_social"];
     this.int_9 = (int)dataRow["lev_explore"];
     this.RegularVisitor = (int)dataRow["RegularVisitor"];
     this.FootballGoalScorer = (int)dataRow["FootballGoalScorer"];
     this.FootballGoalHost = (int)dataRow["FootballGoalHost"];
     this.TilesLocked = (int)dataRow["TilesLocked"];
     this.StaffPicks = (int)dataRow["staff_picks"];
     if (Session != null)
     {
         this.class53_0 = new SubscriptionManager(UserId, userDataFactory);
         this.class56_0 = new BadgeComponent(UserId, userDataFactory);
         this.InventoryComponent = new InventoryComponent(UserId, Session, userDataFactory);
         this.class50_0 = new AvatarEffectsInventoryComponent(UserId, Session, userDataFactory);
         this.bool_8 = false;
         this.bool_9 = false;
         foreach (DataRow dataRow3 in userDataFactory.DataTable_10.Rows)
         {
             this.list_6.Add(GoldTree.GetGame().GetRoomManager().method_17((uint)dataRow3["Id"], dataRow3));
         }
     }
 }
 public void Handle(GameClient Session, ClientMessage Event)
 {
     Session.GetConnection().SendData(GoldTree.GetGame().GetNavigator().SerializeNavigator(Session, -2));
 }