Beispiel #1
0
        public static bool ShowYesNo(string title, string msg)
        {
            CancelReasonEventArgs args = new CancelReasonEventArgs(msg, title);

            YesNoRequired?.Invoke(null, args);
            return(!args.Cancel);
        }
Beispiel #2
0
        private void IncomingConnectedAccepted(AsyncResultEventArgs <ServerChildTcpSocket> args)
        {
            if (args.Error != null)
            {
                // TODO: Die safely?
                CoreManager.ServerCore.StandardOut.Error("Game Socket Manager", "Incoming connection failed!!");

                // TODO: Pretty exception reporting
                Console.WriteLine();
                Console.WriteLine(args.Error.Message);
                Console.WriteLine(args.Error.StackTrace);

                _listeningSocket.AcceptAsync();
                return;
            }

            ServerChildTcpSocket internalSocket = args.Result;
            GameSocket           socket         = new GameSocket(internalSocket, Protocol);

            CancelReasonEventArgs connectionEventArgs = new CancelReasonEventArgs();

            CoreManager.ServerCore.OfficalEventFirer.Fire("incoming_game_connection", EventPriority.Before, socket, connectionEventArgs);
            if (connectionEventArgs.Cancel)
            {
                socket.Disconnect("Connection rejected from " + internalSocket.RemoteEndPoint + "(" + connectionEventArgs.CancelReason + ")");
                return;
            }

            socket.Start();

            CoreManager.ServerCore.OfficalEventFirer.Fire("incoming_game_connection", EventPriority.After, socket, connectionEventArgs);
            CoreManager.ServerCore.StandardOut.Notice("Game Socket Manager", "Incoming connection accepted: " + internalSocket.RemoteEndPoint);

            _listeningSocket.AcceptAsync();
        }
Beispiel #3
0
        private static void EnforceLoginPermission(object sender, EventArgs eventArgs)
        {
            Habbo habbo = (Habbo)sender;
            CancelReasonEventArgs cancelReasonEventArgs = (CancelReasonEventArgs)eventArgs;

            if (!habbo.HasPermission("habbo_login"))
            {
                cancelReasonEventArgs.Cancel       = true;
                cancelReasonEventArgs.CancelReason = "Permission \"habbo_login\" missing!";
            }
        }
Beispiel #4
0
        private static void LoginMerge(Habbo fullHabbo, Habbo connectionHabbo)
        {
            CancelReasonEventArgs eventArgs = new CancelReasonEventArgs();
            CoreManager.ServerCore.EventManager.Fire("habbo_login", EventPriority.Before, fullHabbo, eventArgs);

            if (eventArgs.Cancel)
            {
                if (connectionHabbo.Socket != null)
                    connectionHabbo.Socket.Disconnect(eventArgs.CancelReason);
                return;
            }

            connectionHabbo.Socket.Habbo = fullHabbo;
            fullHabbo.Socket = connectionHabbo.Socket;

            fullHabbo.LastAccess = DateTime.Now;
            CoreManager.ServerCore.EventManager.Fire("habbo_login", EventPriority.After, fullHabbo, eventArgs);
        }
Beispiel #5
0
        private static void LoginMerge(Habbo fullHabbo, Habbo connectionHabbo)
        {
            CancelReasonEventArgs eventArgs = new CancelReasonEventArgs();

            CoreManager.ServerCore.EventManager.Fire("habbo_login", EventPriority.Before, fullHabbo, eventArgs);

            if (eventArgs.Cancel)
            {
                if (connectionHabbo.Socket != null)
                {
                    connectionHabbo.Socket.Disconnect(eventArgs.CancelReason);
                }
                return;
            }

            connectionHabbo.Socket.Habbo = fullHabbo;
            fullHabbo.Socket             = connectionHabbo.Socket;

            fullHabbo.LastAccess = DateTime.Now;
            CoreManager.ServerCore.EventManager.Fire("habbo_login", EventPriority.After, fullHabbo, eventArgs);
        }