Example #1
0
        public void CloseAll()
        {
            foreach (var client in GetClients.ToList())
            {
                if (client == null)
                {
                    continue;
                }

                if (client.GetHabbo() != null)
                {
                    try
                    {
                        using (var dbClient = Program.DatabaseManager.GetQueryReactor())
                        {
                            dbClient.RunQuery(client.GetHabbo().GetQueryString);
                        }
                        Console.Clear();
                        Logger.Trace("<<- SERVER SHUTDOWN ->> IVNENTORY IS SAVING");
                    }
                    catch
                    {
                    }
                }
            }

            Logger.Trace("Done saving users inventory!");
            Logger.Trace("Closing server connections...");
            try
            {
                foreach (var client in GetClients.ToList())
                {
                    if (client == null || client.GetConnection() == null)
                    {
                        continue;
                    }

                    try
                    {
                        client.GetConnection().Dispose();
                    }
                    catch { }

                    Console.Clear();
                    Logger.Trace("<<- SERVER SHUTDOWN ->> CLOSING CONNECTIONS");
                }
            }
            catch (Exception e)
            {
                Logger.Error(e);
            }

            if (_clients.Count > 0)
            {
                _clients.Clear();
            }

            Logger.Trace("Connections closed!");
        }
        public void CloseAll()
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null)
                {
                    continue;
                }

                if (client.GetHabbo() != null)
                {
                    try
                    {
                        using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery(client.GetHabbo().GetQueryString);
                        }
                        Console.Clear();
                        log.Info("<<- SERVER SHUTDOWN ->> GUARDANDO INVENTARIO");
                    }
                    catch
                    {
                    }
                }
            }

            log.Info("Guardando los datos de los usuarios!");
            log.Info("Cerrando todas las conexiones.");
            try
            {
                foreach (GameClient client in GetClients.ToList())
                {
                    if (client == null || client.GetConnection() == null)
                    {
                        continue;
                    }

                    try
                    {
                        client.GetConnection().Dispose();
                    }
                    catch { }

                    Console.Clear();
                    log.Info("<<- SERVER SHUTDOWN ->> CERRANDO CONEXIONES");
                }
            }
            catch (Exception e)
            {
                Logging.LogCriticalException(e.ToString());
            }

            if (_clients.Count > 0)
            {
                _clients.Clear();
            }

            log.Info("Cerrando Conexion!");
        }
Example #3
0
        public void CloseAll()
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null)
                {
                    continue;
                }

                if (client.Habbo != null)
                {
                    try
                    {
                        using (IQueryAdapter dbClient = PlusEnvironment.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.RunQuery(client.Habbo.GetQueryString);
                        }
                        Console.Clear();
                        Log.Info("<<- SERVER SHUTDOWN ->> IVNENTORY IS SAVING");
                    }
                    catch
                    {
                    }
                }
            }

            Log.Info("Done saving users inventory!");
            Log.Info("Closing server connections...");
            try
            {
                foreach (GameClient client in GetClients.ToList())
                {
                    if (client == null || client.GetConnection() == null)
                    {
                        continue;
                    }

                    try
                    {
                        client.GetConnection().Dispose();
                    }
                    catch { }

                    Console.Clear();
                    Log.Info("<<- SERVER SHUTDOWN ->> CLOSING CONNECTIONS");
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }

            if (_clients.Count > 0)
            {
                _clients.Clear();
            }

            Log.Info("Connections closed!");
        }
Example #4
0
        public void CloseAll()
        {
            foreach (GameClient Client in GetClients.ToList())
            {
                if (Client == null)
                {
                    continue;
                }

                if (Client.GetHabbo() != null)
                {
                    try
                    {
                        using (IQueryAdapter DbClient = ProjectHub.GetDatabaseManager().GetQueryReactor())
                        {
                            DbClient.RunQuery(Client.GetHabbo().GetQueryString);
                        }

                        Console.Clear();
                    }
                    catch
                    {
                    }
                }
            }

            try
            {
                foreach (GameClient Client in GetClients.ToList())
                {
                    if (Client == null || Client.GetConnection() == null)
                    {
                        continue;
                    }

                    try
                    {
                        Client.GetConnection().Dispose();
                    }
                    catch { }

                    Console.Clear();
                }
            }
            catch (Exception e)
            {
                Logging.LogError(e.ToString());
            }

            if (Clients.Count > 0)
            {
                Clients.Clear();
            }
        }
        public void ModAlert(string Message)
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null || client.GetHabbo() == null)
                {
                    continue;
                }

                if (client.GetHabbo().GetPermissions().HasRight("mod_tool") && !client.GetHabbo().GetPermissions().HasRight("staff_ignore_mod_alert"))
                {
                    try { client.SendWhisper(Message, 5); }
                    catch { }
                }
            }
        }
        public void GuideAlert(ServerPacket Message, int Exclude = 0)
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null || client.GetHabbo() == null)
                {
                    continue;
                }

                if (client.GetHabbo()._guidelevel < 1 || client.GetHabbo().Id == Exclude)
                {
                    continue;
                }

                client.SendMessage(Message);
            }
        }
        public void GroupChatAlert(ServerPacket Message, Group Group, int Exclude = 0)
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null || client.GetHabbo() == null)
                {
                    continue;
                }

                if (!Group.IsMember(client.GetHabbo().Id) || client.GetHabbo().Id == Exclude)
                {
                    continue;
                }

                client.SendMessage(Message);
            }
        }
        public void StaffAlert3(string Message)
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null || client.GetHabbo() == null)
                {
                    continue;
                }

                if (client.GetHabbo().Rank < 4)
                {
                    continue;
                }

                client.SendWhisper(Message, 23);
            }
        }
        public void StaffAlert2(ServerPacket Message, int Exclude = 0)
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null || client.GetHabbo() == null)
                {
                    continue;
                }

                if (client.GetHabbo().Rank < 4 || client.GetHabbo().Id == Exclude || client.GetHabbo()._alerttype == "2")
                {
                    continue;
                }

                client.SendMessage(Message);
            }
        }
Example #10
0
        public void StaffAlert(ServerPacket message, int exclude = 0)
        {
            foreach (var client in GetClients.ToList())
            {
                if (client == null || client.GetHabbo() == null)
                {
                    continue;
                }

                if (client.GetHabbo().Rank < 2 || client.GetHabbo().Id == exclude)
                {
                    continue;
                }

                client.SendPacket(message);
            }
        }
Example #11
0
        public void StaffAlert(ServerPacket Message, int Exclude = 0)
        {
            foreach (GameClient Client in GetClients.ToList())
            {
                if (Client == null || Client.GetHabbo() == null)
                {
                    continue;
                }

                if (Client.GetHabbo().Rank < 2 || Client.GetHabbo().Id == Exclude)
                {
                    continue;
                }

                Client.SendMessage(Message);
            }
        }
        public void DoAdvertisingReport(GameClient Reporter, GameClient Target)
        {
            if (Reporter == null || Target == null || Reporter.GetHabbo() == null || Target.GetHabbo() == null)
            {
                return;
            }

            StringBuilder Builder = new StringBuilder();

            Builder.Append("Nuevo Informe!\r\r");
            Builder.Append("Reportador: " + Reporter.GetHabbo().Username + "\r");
            Builder.Append("Usuario Reportado: " + Target.GetHabbo().Username + "\r\r");
            Builder.Append(Target.GetHabbo().Username + "Ultimos 10 msj:\r\r");

            DataTable GetLogs = null;

            using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `message` FROM `chatlogs` WHERE `user_id` = '" + Target.GetHabbo().Id + "' ORDER BY `id` DESC LIMIT 10");
                GetLogs = dbClient.getTable();

                if (GetLogs != null)
                {
                    int Number = 11;
                    foreach (DataRow Log in GetLogs.Rows)
                    {
                        Number -= 1;
                        Builder.Append(Number + ": " + Convert.ToString(Log["message"]) + "\r");
                    }
                }
            }

            foreach (GameClient Client in GetClients.ToList())
            {
                if (Client == null || Client.GetHabbo() == null)
                {
                    continue;
                }

                if (Client.GetHabbo().GetPermissions().HasRight("mod_tool") && !Client.GetHabbo().GetPermissions().HasRight("staff_ignore_advertisement_reports"))
                {
                    Client.SendMessage(new MOTDNotificationComposer(Builder.ToString()));
                }
            }
        }
Example #13
0
        public void DoAdvertisingReport(Player reporter, Player target)
        {
            if (reporter == null || target == null || reporter.GetHabbo() == null || target.GetHabbo() == null)
            {
                return;
            }

            var builder = new StringBuilder();

            builder.Append("New report submitted!\r\r");
            builder.Append("Reporter: " + reporter.GetHabbo().Username + "\r");
            builder.Append("Reported User: "******"\r\r");
            builder.Append(target.GetHabbo().Username + "s last 10 messages:\r\r");

            using (var dbClient = Program.DatabaseManager.GetQueryReactor())
            {
                dbClient.SetQuery("SELECT `message` FROM `chatlogs` WHERE `user_id` = '" + target.GetHabbo().Id + "' ORDER BY `id` DESC LIMIT 10");
                var logs = dbClient.GetTable();

                if (logs != null)
                {
                    var number = 11;
                    foreach (DataRow log in logs.Rows)
                    {
                        number -= 1;
                        builder.Append(number + ": " + Convert.ToString(log["message"]) + "\r");
                    }
                }
            }

            foreach (var client in GetClients.ToList())
            {
                if (client == null || client.GetHabbo() == null)
                {
                    continue;
                }

                if (client.GetHabbo().GetPermissions().HasRight("mod_tool") && !client.GetHabbo().GetPermissions().HasRight("staff_ignore_advertisement_reports"))
                {
                    client.SendPacket(new MotdNotificationComposer(builder.ToString()));
                }
            }
        }
Example #14
0
        public void CloseAll()
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null)
                {
                    continue;
                }

                if (client.GetHabbo() != null)
                {
                    try
                    {
                        using (IQueryAdapter dbClient = CloudServer.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.runFastQuery(client.GetHabbo().GetQueryString);
                        }
                        Console.Clear();
                        log.Info("<<- APAGANDO SERVIDOR ->> GUARDANDO INVENTARIOS");
                    }
                    catch
                    {
                    }
                }
            }

            log.Info("Listo, inventario de los users guardado!");
            log.Info("Cerrando las conexiones del servidor...");
            try
            {
                foreach (GameClient client in GetClients.ToList())
                {
                    if (client == null || client.GetConnection() == null)
                    {
                        continue;
                    }

                    try
                    {
                        CloudServer.GetConnectionManager().Destroy();
                        client.GetConnection().Dispose();
                    }
                    catch (Exception e)
                    {
                        ExceptionLogger.LogException(e);
                    }

                    Console.Clear();
                    log.Info("<<- APAGANDO SERVIDOR ->> Cerrando Conexiones");
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }

            if (_clients.Count > 0)
            {
                _clients.Clear();
            }

            log.Info("Conexiones Cerradas!");
        }
        public void CloseAll()
        {
            foreach (GameClient client in GetClients.ToList())
            {
                if (client == null)
                {
                    continue;
                }

                if (client.GetHabbo() != null)
                {
                    try
                    {
                        using (IQueryAdapter dbClient = BiosEmuThiago.GetDatabaseManager().GetQueryReactor())
                        {
                            dbClient.runFastQuery(client.GetHabbo().GetQueryString);
                        }
                        Console.Clear();
                        log.Info("<<- DESLIGANDO SERVIDOR ->> GUARDANDO INVENTARIOS");
                    }
                    catch
                    {
                    }
                }
            }

            log.Info("Pronto, economizou o inventário dos usuários!");
            log.Info("Fechando as conexões do servidor ...");
            try
            {
                foreach (GameClient client in GetClients.ToList())
                {
                    if (client == null || client.GetConnection() == null)
                    {
                        continue;
                    }

                    try
                    {
                        BiosEmuThiago.GetConnectionManager().Destroy();
                        client.GetConnection().Dispose();
                    }
                    catch (Exception e)
                    {
                        ExceptionLogger.LogException(e);
                    }

                    Console.Clear();
                    log.Info("<<- APAGANDO SERVIDOR ->> Conexões de fechamento");
                }
            }
            catch (Exception e)
            {
                ExceptionLogger.LogException(e);
            }

            if (_clients.Count > 0)
            {
                _clients.Clear();
            }

            log.Info("Conexões fechadas!");
        }