Пример #1
0
 public void FetchChatInfo(GameClient client)
 {
     GSTask t = new GSTask();
     t.Type = (int)GSTask.GSTType.ChatBlockList_Fetch;
     t.Client = client;
     TaskProcessor.AddTask(t);
 }
Пример #2
0
        public void FetchChatInfo(GameClient client)
        {
            GSTask t = new GSTask();

            t.Type   = (int)GSTask.GSTType.ChatBlockList_Fetch;
            t.Client = client;
            TaskProcessor.AddTask(t);
        }
Пример #3
0
        void CredentialsRequestHandler(Task t)
        {
            GSTask task = (GSTask)t;
            // Forward credentials request onto the global server
            AccountRequestArgs args = (AccountRequestArgs)task.Args;

            _server.GlobalServer.RequestAccountInfo(task.Client.SessionKey, args.Email, args.Password, args.DisplayName, args.OAuthMode);
        }
Пример #4
0
        void ChatBlockListFetchHandler(Task t)
        {
            GSTask task = (GSTask)t;

            // Fetch the chat block list from the database
            task.Type = (int)GSTask.GSTType.ChatBlockList_Process;
            DBQuery query = AddDBQuery(string.Format("SELECT * FROM chat_blocks WHERE blocker={0};", task.Client.AccountId), task);
        }
Пример #5
0
        void client_OnCredentialsRequest(object sender, AccountRequestArgs e)
        {
            GSTask t = new GSTask();
            t.Type = (int)GSTask.GSTType.CredentialsRequest;
            t.Client = (GameClient)sender;
            t.Args = e;

            TaskProcessor.AddTask(t);
        }
Пример #6
0
        void SpendCoinsGlobalHandler(Task t)
        {
            GSTask task = (GSTask)t;

            int   amount        = (int)task.Args;
            ulong serverSpendID = (ulong)task.Query.Rows[0][0];

            _server.GlobalServer.SpendCoins(task.Client.AccountId, amount, serverSpendID);
        }
Пример #7
0
        void client_OnChatMessage(object sender, ChatMessageArgs e)
        {
            GSTask t = new GSTask();
            t.Type = (int)GSTask.GSTType.ChatMessage;
            t.Client = (GameClient)sender;
            t.Args = e;

            TaskProcessor.AddTask(t);
        }
Пример #8
0
        void client_OnChatMessage(object sender, ChatMessageArgs e)
        {
            GSTask t = new GSTask();

            t.Type   = (int)GSTask.GSTType.ChatMessage;
            t.Client = (GameClient)sender;
            t.Args   = e;

            TaskProcessor.AddTask(t);
        }
Пример #9
0
        void client_OnCredentialsRequest(object sender, AccountRequestArgs e)
        {
            GSTask t = new GSTask();

            t.Type   = (int)GSTask.GSTType.CredentialsRequest;
            t.Client = (GameClient)sender;
            t.Args   = e;

            TaskProcessor.AddTask(t);
        }
Пример #10
0
        private void _gs_OnCurrencyUpdate(object sender, CurrencyUpdateArgs e)
        {
            GSTask t = new GSTask();

            t.Type   = (int)GSTask.GSTType.CurrencyUpdate;
            t.Client = null;
            t.Args   = e;

            TaskProcessor.AddTask(t);
        }
Пример #11
0
        void _gs_OnAccountInfoResponse(AccountInfoResponseArgs e)
        {
            GSTask t = new GSTask();

            t.Type   = (int)GSTask.GSTType.AccountInfoResponse;
            t.Client = null;
            t.Args   = e;

            TaskProcessor.AddTask(t);
        }
Пример #12
0
        void ChatInfoProcessHandler(Task t)
        {
            GSTask task = (GSTask)t;

            DBQuery q = task.Query;

            if (q != null && q.Rows != null && q.Rows.Count > 0)
            {
                object[] row = q.Rows[0];
                task.Client.ChatChannels = (uint)row[1];
            }
            else
            {
                // No channels for this user, add them to the global channel by default
                task.Type = -1;     // Set this to less than zero so no task happens after the database query finishes
                task.Client.ChatChannels = 1;
                DBQuery query = AddDBQuery(string.Format("INSERT INTO chat_info SET account_id={0},channels={1};", task.Client.AccountId, task.Client.ChatChannels), task);
            }
            task.Client.SendChatChannels();
        }
Пример #13
0
        void ChatMessageHandler(Task t)
        {
            GSTask task = (GSTask)t;

            ChatMessageArgs args = (ChatMessageArgs)task.Args;

            // Fetch client list
            Connection[] clients = _server.InputThread.Clients;

            // Send message to clients
            foreach (GameClient gc in clients)
            {
                if (gc.IsInChannel(args.Channel))
                {
                    if (!gc.IsChatBlocked(task.Client.AccountId))
                    {
                        gc.SendChat(args.Channel, args.Message, task.Client.DisplayName);
                    }
                }
            }
        }
Пример #14
0
        void ChatBlockListProcessHandler(Task t)
        {
            GSTask task = (GSTask)t;

            // Add all blocked users to the block list
            task.Client.BlockList.Clear();
            DBQuery q = task.Query;

            if (q != null && q.Rows != null && q.Rows.Count > 0)
            {
                foreach (object[] row in q.Rows)
                {
                    uint blocked = (uint)row[2];
                    task.Client.BlockList.Add(blocked);
                }
            }

            // Fetch the chat channel info
            task.Type = (int)GSTask.GSTType.ChatInfo_Process;
            DBQuery query = AddDBQuery(string.Format("SELECT * FROM chat_info WHERE account_id={0};", task.Client.AccountId), task);
        }
Пример #15
0
        void AccountInfoResponseHandler(Task t)
        {
            GSTask task = (GSTask)t;
            AccountInfoResponseArgs args = (AccountInfoResponseArgs)task.Args;
            GameClient client            = (GameClient)_server.InputThread.FindClient(args.ClientKey);

            if (args.AccountId < 0)
            {
                // Account doesnt exist
                client.SendAccountResponse(-1, null);
            }
            else if (args.DisplayName == null || args.DisplayName.Length <= 0)
            {
                // Account exists but password is wrong
                client.SendAccountResponse(args.AccountId, null);
            }
            else if (client.PendingAuthTask != null)
            {
                // Cache this auth string for later
                _server.AuthManager.RegisterAuthString(args.AuthString, args.AccountId, args.HardCurrency, args.Vip, args.DisplayName);

                // Add the task to process this
                GSTask authTask = (GSTask)client.PendingAuthTask;

                AddTask(authTask);
            }
            else
            {
                // Store stuff
                client.AccountId    = args.AccountId;
                client.HardCurrency = args.HardCurrency;
                client.Vip          = args.Vip;
                client.DisplayName  = args.DisplayName;
                client.AuthString   = args.AuthString;

                // Let the server do new client stuff
                _server.NewAuthorizedClient(client);
            }
        }
Пример #16
0
        void CourseCompleted_Validate_Handler(Task t)
        {
            FFTask task = (FFTask)t;

            CourseFinishedArgs args = (CourseFinishedArgs)task.Args;
            CourseInfo ci = _courseInfo[args.CourseID];
            if (!ci.Validate(args))
            {
                // log the error
                LogInterface.Log(string.Format("Invalid course completed info from account {0}", task.Client.AccountId), LogInterface.LogMessageType.Security, true);

                // Flag the account
                GSTask flagTask = new GSTask();
                flagTask.Type = (int)GSTask.GSTType.FlagAccount;
                flagTask.Client = task.Client;
                AddTask(flagTask);

                // Use good values instead
                args.ObstacleScore = 0;                 // 0 Obstacle score
                args.LootMarkers = 0;                   // 0 Loot Markers
                args.TimeMS = ci.ParTime + 5;           // ParTime + 5 seconds
            }

            task.Type = (int)FFTask.FFTaskType.CourseCompleted_GenerateLoot;
            AddTask(task);
        }
Пример #17
0
 public PendingQuery(QueryType type, GSTask task)
 {
     _type = type;
     _task = task;
 }
Пример #18
0
        void _gs_OnAccountInfoResponse(object sender, AccountInfoResponseArgs e)
        {
            GSTask t = new GSTask();
            t.Type = (int)GSTask.GSTType.AccountInfoResponse;
            t.Client = null;
            t.Args = e;

            TaskProcessor.AddTask(t);
        }
Пример #19
0
        private void _gs_OnCurrencyUpdate(object sender, CurrencyUpdateArgs e)
        {
            GSTask t = new GSTask();
            t.Type = (int)GSTask.GSTType.CurrencyUpdate;
            t.Client = null;
            t.Args = e;

            TaskProcessor.AddTask(t);
        }