Example #1
0
 public override async Task <IEnumerable <ResponseContent> > HandleIncomingRequestAsync(RequestContent request)
 {
     if (lobbyChatService.TryFindLobby(request.Client, out var rm))
     {
         await rm.UpdateLobbyStatusAsync(request.Data, request.Client.ClientIndex);
     }
     return(await base.HandleIncomingRequestAsync(request));
 }
 public override async Task <IEnumerable <ResponseContent> > HandleIncomingRequestAsync(RequestContent request)
 {
     if (lobbyChatService.TryFindLobby(request.Client, out var lobby))
     {
         await lobbyChatService.AnnounceRoomDeparture(lobby, (uint)request.Client.ClientIndex);
     }
     return(await base.HandleIncomingRequestAsync(request));
 }
Example #3
0
 public override async Task <IEnumerable <ResponseContent> > HandleIncomingRequestAsync(RequestContent request)
 {
     if (_lobbyChatService.TryFindLobby(request.Client, out var lcr))
     {
         await lcr.SendPublicMessageAsync(request.Data, request.Client.ClientIndex);
     }
     return(await base.HandleIncomingRequestAsync(request));
 }
        public override async Task <IEnumerable <ResponseContent> > HandleIncomingRequestAsync(RequestContent request)
        {
            var destid = BitConverter.ToUInt16(request.Data, 2).Swap();

            if (_lobbyChatService.TryFindLobby(request.Client, out var p))
            {
                await p.SendDirectMessageAsync(request.Data, request.Client.ClientIndex, destid);
            }

            return(await base.HandleIncomingRequestAsync(request));
        }
 private void Client_OnGameClientDisconnected(object sender, EventArgs e)
 {
     if (!(sender is GameClientAsync client))
     {
         return;
     }
     RemoveClient(client);
     if (client.PlayerID != 0)
     {
         DBAccess.getInstance().setPlayerAsOffline(client.PlayerID);
     }
     if (!client.IsAreaServer && lobbyChatService.TryFindLobby(client, out var lobby))
     {
         lobbyChatService.AnnounceRoomDeparture(lobby, (uint)client.ClientIndex);
     }
     client.OnGameClientDisconnected -= Client_OnGameClientDisconnected;
 }
        public async Task <IEnumerable <ResponseContent> > HandleIncomingRequestAsync(RequestContent request)
        {
            var u = BitConverter.ToUInt16(request.Data, 0).Swap();

            // This is probably only possible in the MAIN lobby so
            if (_lobbyChatService.TryFindLobby(request.Client, out var lobby))
            {
                await lobby.InviteClientToGuildAsync(request.Data, request.Client.ClientIndex, u, request.Client._guildID);


                return(new[]
                {
                    request.CreateResponse(0x772D, new byte[] { 0x00, 0x00 })
                });//send to confirm that the player accepted the invite
            }
            return(new[]
            {
                ResponseContent.Empty
            });// failed to find lobby ???
        }