Beispiel #1
0
        public async Task HandleAsync(
            ISession session,
            IClientPacket clientPacket)
        {
            string category = clientPacket.ReadString();
            string data     = clientPacket.ReadString();

            //Send the categories..
            if (string.IsNullOrEmpty(data))
            {
                IList <INavigatorCategory> categories =
                    await _navigatorController.GetNavigatorCategoriesAsync();

                IList <INavigatorCategory> categoriesToSend = new List <INavigatorCategory>();

                foreach (INavigatorCategory navCategory in categories)
                {
                    if (navCategory.Category == category)
                    {
                        categoriesToSend.Add(navCategory);
                    }
                }

                await session.WriteAndFlushAsync(
                    new NavigatorSearchResultSetComposer(category, data, categoriesToSend));
            }
        }
        public async Task HandleAsync(ISession session, IClientPacket clientPacket)
        {
            string rawData = clientPacket.ReadString();

            string[] data = rawData.Split(' ');

            uint itemId = uint.Parse(data[0]);

            IRoom room = session.CurrentRoom;

            if (session.Inventory.Items.TryGetValue(itemId, out IItem item))
            {
                //It's a floor item.
                if (item.ItemTemplate.Type == "s")
                {
                    int  x   = int.Parse(data[1]);
                    int  y   = int.Parse(data[2]);
                    uint rot = uint.Parse(data[3]);

                    item.ItemData.Position.X = x;
                    item.ItemData.Position.Y = y;
                    item.ItemData.Rotation   = rot;

                    session.Inventory.Items.Remove(itemId);
                    await session.WriteAndFlushAsync(new ObjectAddComposer(item, session.Player.Username));
                }
                else
                {
                }
            }
        }
        public async Task HandleAsync(ISession session, IClientPacket clientPacket)
        {
            int    roomId   = clientPacket.ReadInt();
            string password = clientPacket.ReadString();

            IRoom room = await _roomController.GetRoomByIdAndPassword(roomId, password);

            if (room != null)
            {
                await session.WriteAndFlushAsync(new OpenConnectionComposer());

                await session.WriteAndFlushAsync(new RoomReadyComposer(room.RoomData.ModelName, room.RoomData.Id));

                await session.WriteAndFlushAsync(new RoomRatingComposer(room.RoomData.Score));

                if (!room.CycleActive)
                {
                    room.SetupRoomCycle();
                }

                session.CurrentRoom = room;
            }
            else
            {
                await session.WriteAndFlushAsync(new CloseConnectionComposer());
            }
        }
        public async Task HandleAsync(
            ISession session,
            IClientPacket clientPacket)
        {
            string text = clientPacket.ReadString();

            string[]             splitText    = text.Split(',');
            IList <IHallOfFamer> hallOfFamers = await _landingController.GetHallOfFamersAsync();

            if (string.IsNullOrEmpty(text) || splitText.Length < 2)
            {
                await session.WriteAndFlushAsync(new CampaignComposer("", ""));

                await session.WriteAndFlushAsync(new HallOfFameComposer(hallOfFamers, ""));

                return;
            }

            if (splitText[1] == "gamesmaker")
            {
                return;
            }

            await session.WriteAndFlushAsync(new CampaignComposer(text, splitText[1]));

            await session.WriteAndFlushAsync(new HallOfFameComposer(hallOfFamers, ""));
        }
        public async Task HandleAsync(
            ISession session,
            IClientPacket clientPacket)
        {
            string uniqueId = clientPacket.ReadString();

            session.UniqueId = uniqueId;
            await session.WriteAndFlushAsync(new SetUniqueIdComposer(uniqueId));
        }
Beispiel #6
0
        public async Task HandleAsync(
            ISession session,
            IClientPacket clientPacket)
        {
            string  ssoTicket = clientPacket.ReadString();
            IPlayer player    = await _playerController.GetPlayerBySsoAsync(ssoTicket);

            if (player != null)
            {
                session.Player = player;
                IPlayerSettings playerSettings =
                    await _playerController.GetPlayerSettingsByIdAsync(player.Id);

                if (playerSettings != null)
                {
                    session.PlayerSettings = playerSettings;
                }
                else
                {
                    await _playerController.AddPlayerSettingsAsync(player.Id);

                    session.PlayerSettings =
                        await _playerController.GetPlayerSettingsByIdAsync(player.Id);
                }

                await session.WriteAndFlushAsync(new AuthenticationOkComposer());

                await session.WriteAndFlushAsync(new HomeRoomComposer(1));

                await session.WriteAndFlushAsync(new FavouriteRoomsComposer());

                await session.WriteAndFlushAsync(new FigureSetIdsComposer());

                await session.WriteAndFlushAsync(new UserRightsComposer(session.Player.Rank));

                await session.WriteAndFlushAsync(new AvailabilityStatusComposer());

                await session.WriteAndFlushAsync(new BuildersClubMembershipComposer());

                await session.WriteAndFlushAsync(new CfhTopicsInitComposer());

                await session.WriteAndFlushAsync(new BadgeDefinitionsComposer());

                await session.WriteAndFlushAsync(new PlayerSettingsComposer());
            }
        }
        public Task HandleAsync(ISession session, IClientPacket clientPacket)
        {
            string release = clientPacket.ReadString();

            return(Task.CompletedTask);
        }