Beispiel #1
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowPlayerAlreadyHasPendingInvite()
        {
            // Arrange
            var command = new InvitePlayerCommand {
                TeamId = 1, UserName = "******"
            };

            this.dbContext.TeamInvites.Add(new TeamInvite {
                PlayerId = "Foo5", TeamId = 1
            });
            this.dbContext.SaveChanges();

            var playersRepository     = new EfDeletableEntityRepository <Player>(this.dbContext);
            var teamInvitesRepository = new EfDeletableEntityRepository <TeamInvite>(this.dbContext);

            var sut = new InvitePlayerCommandHandler(
                this.deletableEntityRepository,
                playersRepository,
                teamInvitesRepository,
                It.IsAny <IMediator>(),
                It.IsAny <IUserAccessor>());

            // Act & Assert
            await Should.ThrowAsync <PlayerAlreadyHasPendingInvite>(sut.Handle(command, It.IsAny <CancellationToken>()));
        }
Beispiel #2
0
        public async Task Handle_GivenValidRequest_ShouldCreateInvite()
        {
            // Arrange
            var command = new InvitePlayerCommand {
                TeamId = 1, UserName = "******"
            };

            var playersRepository     = new EfDeletableEntityRepository <Player>(this.dbContext);
            var teamInvitesRepository = new EfDeletableEntityRepository <TeamInvite>(this.dbContext);
            var userAccessorMock      = new Mock <IUserAccessor>();

            userAccessorMock.Setup(x => x.UserId).Returns("Foo1");

            var sut = new InvitePlayerCommandHandler(this.deletableEntityRepository, playersRepository, teamInvitesRepository, this.mediatorMock.Object, userAccessorMock.Object);

            // Act
            var rowsAffected = await sut.Handle(command, It.IsAny <CancellationToken>());

            // Assert
            rowsAffected.ShouldBeGreaterThan(0);

            var createdInvite = teamInvitesRepository.AllAsNoTracking().FirstOrDefault(x => x.PlayerId == "Foo5");

            createdInvite.ShouldNotBeNull();
            createdInvite.TeamName.ShouldBe("FooTeam1");
        }
Beispiel #3
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowTeamIsFullException()
        {
            // Arrange
            var command = new InvitePlayerCommand {
                TeamId = 1, UserName = "******"
            };

            for (int i = 0; i < 10; i++)
            {
                var player = new Player {
                    UserName = $"Placeholder{i}", Email = "foomail.bg",
                };
                this.dbContext.Add(player);
                this.dbContext.PlayerTeams.Add(new PlayerTeam {
                    TeamId = 1, PlayerId = player.Id
                });
                this.dbContext.SaveChanges();
            }

            var playersRepository = new EfDeletableEntityRepository <Player>(this.dbContext);

            var sut = new InvitePlayerCommandHandler(
                this.deletableEntityRepository,
                playersRepository,
                It.IsAny <IDeletableEntityRepository <TeamInvite> >(),
                It.IsAny <IMediator>(),
                It.IsAny <IUserAccessor>());

            // Act & Assert
            await Should.ThrowAsync <TeamIsFullException>(sut.Handle(command, It.IsAny <CancellationToken>()));
        }
Beispiel #4
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowPlayerIsVacBannedException()
        {
            // Arrange
            var command = new InvitePlayerCommand {
                TeamId = 1, UserName = "******"
            };
            var playersRepository = new EfDeletableEntityRepository <Player>(this.dbContext);

            var desiredPlayer = this.dbContext.Players.SingleOrDefault(x => x.UserName == "FooP5");

            desiredPlayer.Claims.Add(new Microsoft.AspNetCore.Identity.IdentityUserClaim <string>()
            {
                ClaimType = IS_VAC_BANNED_CLAIM_TYPE, ClaimValue = "Yes"
            });
            this.dbContext.SaveChanges();

            var sut = new InvitePlayerCommandHandler(
                It.IsAny <IDeletableEntityRepository <Team> >(),
                playersRepository,
                It.IsAny <IDeletableEntityRepository <TeamInvite> >(),
                It.IsAny <IMediator>(),
                It.IsAny <IUserAccessor>());

            // Act & Assert
            await Should.ThrowAsync <PlayerIsVacBannedException>(sut.Handle(command, It.IsAny <CancellationToken>()));
        }
#pragma warning disable CS1998
        public async Task <IViewComponentResult> InvokeAsync(int teamId)
        {
            var viewModel = new InvitePlayerCommand {
                TeamId = teamId
            };

            return(this.View(viewModel));
        }
Beispiel #6
0
        public async Task <IActionResult> Invite(InvitePlayerCommand command)
        {
            await this.Mediator.Send(command);

            return(this.RedirectToAction(nameof(Modify), new ModifyTeamQuery {
                Id = command.TeamId
            }));
        }
Beispiel #7
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowPlayerDoesNotExistException()
        {
            // Arrange
            var command = new InvitePlayerCommand {
                TeamId = 1, UserName = "******"
            };
            var playersRepository = new EfDeletableEntityRepository <Player>(this.dbContext);

            var sut = new InvitePlayerCommandHandler(
                It.IsAny <IDeletableEntityRepository <Team> >(),
                playersRepository,
                It.IsAny <IDeletableEntityRepository <TeamInvite> >(),
                It.IsAny <IMediator>(),
                It.IsAny <IUserAccessor>());

            // Act & Assert
            await Should.ThrowAsync <PlayerDoesNotExistException>(sut.Handle(command, It.IsAny <CancellationToken>()));
        }
Beispiel #8
0
        public async Task Handle_GivenInvalidRequest_ShouldThrowPlayerCannotBeAMemeberOfMultipleTeamsWithTheSameFormatException()
        {
            // Arrange
            var command = new InvitePlayerCommand {
                TeamId = 1, UserName = "******"
            };

            this.dbContext.PlayerTeams.Add(new PlayerTeam {
                PlayerId = "Foo5", TeamId = 2
            });
            this.dbContext.SaveChanges();

            var playersRepository = new EfDeletableEntityRepository <Player>(this.dbContext);

            var sut = new InvitePlayerCommandHandler(
                this.deletableEntityRepository,
                playersRepository,
                It.IsAny <IDeletableEntityRepository <TeamInvite> >(),
                It.IsAny <IMediator>(),
                It.IsAny <IUserAccessor>());

            // Act & Assert
            await Should.ThrowAsync <PlayerCannotBeAMemeberOfMultipleTeamsWithTheSameFormatException>(sut.Handle(command, It.IsAny <CancellationToken>()));
        }
Beispiel #9
0
        protected override void OnReceived(byte[] body)
        {
            ByteArrayArrayStream stream = new ByteArrayArrayStream(body);

            ByteArrayStreamReader reader = new ByteArrayStreamReader(stream);

            try
            {
                if (Adler32.Generate(body, 4) == reader.ReadUInt())
                {
                    if (Keys == null)
                    {
                        Rsa.DecryptAndReplace(body, 9);
                    }
                    else
                    {
                        Xtea.DecryptAndReplace(body, 4, 32, Keys);

                        stream.Seek(Origin.Current, 2);
                    }

                    Command command = null;

                    switch (reader.ReadByte())
                    {
                    case 0x0A:
                    {
                        var packet = server.PacketsFactory.Create <SelectedCharacterIncomingPacket>(reader);

                        command = new LogInCommand(this, packet);
                    }
                    break;

                    case 0x14:

                        command = new LogOutCommand(Client.Player);

                        break;

                    case 0x1E:

                        command = new PongCommand(Client.Player);

                        break;

                    case 0x64:
                    {
                        var packet = server.PacketsFactory.Create <WalkToIncomingPacket>(reader);

                        command = new WalkToKnownPathCommand(Client.Player, packet.MoveDirections);
                    }
                    break;

                    case 0x65:

                        command = new WalkCommand(Client.Player, MoveDirection.North);

                        break;

                    case 0x66:

                        command = new WalkCommand(Client.Player, MoveDirection.East);

                        break;

                    case 0x67:

                        command = new WalkCommand(Client.Player, MoveDirection.South);

                        break;

                    case 0x68:

                        command = new WalkCommand(Client.Player, MoveDirection.West);

                        break;

                    case 0x69:

                        command = new StopWalkCommand(Client.Player);

                        break;

                    case 0x6A:

                        command = new WalkCommand(Client.Player, MoveDirection.NorthEast);

                        break;

                    case 0x6B:

                        command = new WalkCommand(Client.Player, MoveDirection.SouthEast);

                        break;

                    case 0x6C:

                        command = new WalkCommand(Client.Player, MoveDirection.SouthWest);

                        break;

                    case 0x6D:

                        command = new WalkCommand(Client.Player, MoveDirection.NorthWest);

                        break;

                    case 0x6F:

                        command = new TurnCommand(Client.Player, Direction.North);

                        break;

                    case 0x70:

                        command = new TurnCommand(Client.Player, Direction.East);

                        break;

                    case 0x71:

                        command = new TurnCommand(Client.Player, Direction.South);

                        break;

                    case 0x72:

                        command = new TurnCommand(Client.Player, Direction.West);

                        break;

                    case 0x78:
                    {
                        var packet = server.PacketsFactory.Create <MoveItemIncomingPacket>(reader);

                        Position fromPosition = new Position(packet.FromX, packet.FromY, packet.FromZ);

                        Position toPosition = new Position(packet.ToX, packet.ToY, packet.ToZ);

                        if (fromPosition.IsContainer)
                        {
                            if (toPosition.IsContainer)
                            {
                                command = new MoveItemFromContainerToContainerCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.FromItemId, toPosition.ContainerId, toPosition.ContainerIndex, packet.Count);
                            }
                            else if (toPosition.IsInventory)
                            {
                                command = new MoveItemFromContainerToInventoryCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.FromItemId, toPosition.InventoryIndex, packet.Count);
                            }
                            else
                            {
                                command = new MoveItemFromContainerToTileCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.FromItemId, toPosition, packet.Count);
                            }
                        }
                        else if (fromPosition.IsInventory)
                        {
                            if (toPosition.IsContainer)
                            {
                                command = new MoveItemFromInventoryToContainerCommand(Client.Player, fromPosition.InventoryIndex, packet.FromItemId, toPosition.ContainerId, toPosition.ContainerIndex, packet.Count);
                            }
                            else if (toPosition.IsInventory)
                            {
                                command = new MoveItemFromInventoryToInventoryCommand(Client.Player, fromPosition.InventoryIndex, packet.FromItemId, toPosition.InventoryIndex, packet.Count);
                            }
                            else
                            {
                                command = new MoveItemFromInventoryToTileCommand(Client.Player, fromPosition.InventoryIndex, packet.FromItemId, toPosition, packet.Count);
                            }
                        }
                        else
                        {
                            if (toPosition.IsContainer)
                            {
                                command = new MoveItemFromTileToContainerCommand(Client.Player, fromPosition, packet.FromIndex, packet.FromItemId, toPosition.ContainerId, toPosition.ContainerIndex, packet.Count);
                            }
                            else if (toPosition.IsInventory)
                            {
                                command = new MoveItemFromTileToInventoryCommand(Client.Player, fromPosition, packet.FromIndex, packet.FromItemId, toPosition.InventoryIndex, packet.Count);
                            }
                            else
                            {
                                command = new MoveItemFromTileToTileCommand(Client.Player, fromPosition, packet.FromIndex, packet.FromItemId, toPosition, packet.Count);
                            }
                        }
                    }
                    break;

                    case 0x79:
                    {
                        var packet = server.PacketsFactory.Create <LookItemNpcTradeIncommingPacket>(reader);

                        command = new LookFromNpcTradeCommand(Client.Player, packet.ItemId, packet.Type);
                    }
                    break;

                    case 0x7A:
                    {
                        var packet = server.PacketsFactory.Create <BuyNpcTradeIncommingPacket>(reader);

                        command = new BuyNpcTradeCommand(Client.Player, packet);
                    }
                    break;

                    case 0x7B:
                    {
                        var packet = server.PacketsFactory.Create <SellNpcTradeIncommingPacket>(reader);

                        command = new SellNpcTradeCommand(Client.Player, packet);
                    }
                    break;

                    case 0x7C:

                        command = new CloseNpcTradeCommand(Client.Player);

                        break;

                    case 0x7D:
                    {
                        var packet = server.PacketsFactory.Create <TradeWithIncommingPacket>(reader);

                        Position fromPosition = new Position(packet.X, packet.Y, packet.Z);

                        if (fromPosition.IsContainer)
                        {
                            command = new TradeWithFromContainerCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.ItemId, packet.CreatureId);
                        }
                        else if (fromPosition.IsInventory)
                        {
                            command = new TradeWithFromInventoryCommand(Client.Player, fromPosition.InventoryIndex, packet.ItemId, packet.CreatureId);
                        }
                        else
                        {
                            command = new TradeWithFromTileCommand(Client.Player, fromPosition, packet.Index, packet.ItemId, packet.CreatureId);
                        }
                    }
                    break;

                    case 0x7E:
                    {
                        var packet = server.PacketsFactory.Create <LookItemTradeIncommingPacket>(reader);

                        command = new LookFromTradeCommand(Client.Player, packet.WindowId, packet.Index);
                    }
                    break;

                    case 0x7F:

                        command = new AcceptTradeCommand(Client.Player);

                        break;

                    case 0x80:

                        command = new CancelTradeCommand(Client.Player);

                        break;

                    case 0x82:
                    {
                        var packet = server.PacketsFactory.Create <UseItemIncomingPacket>(reader);

                        Position fromPosition = new Position(packet.X, packet.Y, packet.Z);

                        if (fromPosition.IsContainer)
                        {
                            command = new UseItemFromContainerCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.ItemId, packet.ContainerId);
                        }
                        else if (fromPosition.IsInventory)
                        {
                            command = new UseItemFromInventoryCommand(Client.Player, fromPosition.InventoryIndex, packet.ItemId);
                        }
                        else
                        {
                            command = new UseItemFromTileCommand(Client.Player, fromPosition, packet.Index, packet.ItemId);
                        }
                    }
                    break;

                    case 0x83:
                    {
                        var packet = server.PacketsFactory.Create <UseItemWithItemIncomingPacket>(reader);

                        Position fromPosition = new Position(packet.FromX, packet.FromY, packet.FromZ);

                        Position toPosition = new Position(packet.ToX, packet.ToY, packet.ToZ);

                        if (fromPosition.IsContainer)
                        {
                            if (toPosition.IsContainer)
                            {
                                command = new UseItemWithItemFromContainerToContainerCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.FromItemId, toPosition.ContainerId, toPosition.ContainerIndex, packet.ToItemId);
                            }
                            else if (toPosition.IsInventory)
                            {
                                command = new UseItemWithItemFromContainerToInventoryCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.FromItemId, toPosition.InventoryIndex, packet.ToItemId);
                            }
                            else
                            {
                                command = new UseItemWithItemFromContainerToTileCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.FromItemId, toPosition, packet.ToIndex, packet.ToItemId);
                            }
                        }
                        else if (fromPosition.IsInventory)
                        {
                            if (toPosition.IsContainer)
                            {
                                command = new UseItemWithItemFromInventoryToContainerCommand(Client.Player, fromPosition.InventoryIndex, packet.FromItemId, toPosition.ContainerId, toPosition.ContainerIndex, packet.ToItemId);
                            }
                            else if (toPosition.IsInventory)
                            {
                                command = new UseItemWithItemFromInventoryToInventoryCommand(Client.Player, fromPosition.InventoryIndex, packet.FromItemId, toPosition.InventoryIndex, packet.ToItemId);
                            }
                            else
                            {
                                command = new UseItemWithItemFromInventoryToTileCommand(Client.Player, fromPosition.InventoryIndex, packet.FromItemId, toPosition, packet.ToIndex, packet.ToItemId);
                            }
                        }
                        else
                        {
                            if (toPosition.IsContainer)
                            {
                                command = new UseItemWithItemFromTileToContainerCommand(Client.Player, fromPosition, packet.FromIndex, packet.FromItemId, toPosition.ContainerId, toPosition.ContainerIndex, packet.ToItemId);
                            }
                            else if (toPosition.IsInventory)
                            {
                                command = new UseItemWithItemFromTileToInventoryCommand(Client.Player, fromPosition, packet.FromIndex, packet.FromItemId, toPosition.InventoryIndex, packet.ToItemId);
                            }
                            else
                            {
                                command = new UseItemWithItemFromTileToTileCommand(Client.Player, fromPosition, packet.FromIndex, packet.FromItemId, toPosition, packet.ToIndex, packet.ToItemId);
                            }
                        }
                    }
                    break;

                    case 0x84:
                    {
                        var packet = server.PacketsFactory.Create <UseItemWithCreatureIncomingPacket>(reader);

                        Position fromPosition = new Position(packet.X, packet.Y, packet.Z);

                        if (fromPosition.IsContainer)
                        {
                            command = new UseItemWithCreatureFromContainerCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.ItemId, packet.CreatureId);
                        }
                        else if (fromPosition.IsInventory)
                        {
                            command = new UseItemWithCreatureFromInventoryCommand(Client.Player, fromPosition.InventoryIndex, packet.ItemId, packet.CreatureId);
                        }
                        else
                        {
                            command = new UseItemWithCreatureFromTileCommand(Client.Player, fromPosition, packet.Index, packet.ItemId, packet.CreatureId);
                        }
                    }
                    break;

                    case 0x85:
                    {
                        var packet = server.PacketsFactory.Create <RotateItemIncomingPacket>(reader);

                        var fromPosition = new Position(packet.X, packet.Y, packet.Z);

                        if (fromPosition.IsContainer)
                        {
                            command = new RotateItemFromContainerCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.ItemId);
                        }
                        else if (fromPosition.IsInventory)
                        {
                            command = new RotateItemFromInventoryCommand(Client.Player, fromPosition.InventoryIndex, packet.ItemId);
                        }
                        else
                        {
                            command = new RotateItemFromTileCommand(Client.Player, fromPosition, packet.Index, packet.ItemId);
                        }
                    }
                    break;

                    case 0x87:
                    {
                        var packet = server.PacketsFactory.Create <CloseContainerIncommingPacket>(reader);

                        command = new CloseContainerCommand(Client.Player, packet.ContainerId);
                    }
                    break;

                    case 0x88:
                    {
                        var packet = server.PacketsFactory.Create <OpenParentIncommingPacket>(reader);

                        command = new OpenParentContainerCommand(Client.Player, packet.ContainerId);
                    }
                    break;

                    case 0x8C:
                    {
                        var packet = server.PacketsFactory.Create <LookIncomingPacket>(reader);

                        var fromPosition = new Position(packet.X, packet.Y, packet.Z);

                        if (fromPosition.IsContainer)
                        {
                            command = new LookFromContainerCommand(Client.Player, fromPosition.ContainerId, fromPosition.ContainerIndex, packet.ItemId);
                        }
                        else if (fromPosition.IsInventory)
                        {
                            command = new LookFromInventoryCommand(Client.Player, fromPosition.InventoryIndex, packet.ItemId);
                        }
                        else
                        {
                            command = new LookFromTileCommand(Client.Player, fromPosition, packet.Index, packet.ItemId);
                        }
                    }
                    break;

                    case 0x96:
                    {
                        var packet = server.PacketsFactory.Create <TalkIncommingPacket>(reader);

                        switch (packet.TalkType)
                        {
                        case TalkType.Say:

                            command = new SayCommand(Client.Player, packet.Message);

                            break;

                        case TalkType.Whisper:

                            command = new WhisperCommand(Client.Player, packet.Message);

                            break;

                        case TalkType.Yell:

                            command = new YellCommand(Client.Player, packet.Message);

                            break;

                        case TalkType.Private:

                            command = new SendMessageToPlayerCommand(Client.Player, packet.Name, packet.Message);

                            break;

                        case TalkType.ChannelYellow:

                            command = new SendMessageToChannel(Client.Player, packet.ChannelId, packet.Message);

                            break;

                        case TalkType.ReportRuleViolationOpen:

                            command = new CreateReportRuleViolationCommand(Client.Player, packet.Message);

                            break;

                        case TalkType.ReportRuleViolationAnswer:

                            command = new AnswerInReportRuleViolationChannelCommand(Client.Player, packet.Name, packet.Message);

                            break;

                        case TalkType.ReportRuleViolationQuestion:

                            command = new AskInReportRuleViolationChannelCommand(Client.Player, packet.Message);

                            break;

                        case TalkType.Broadcast:

                            command = new BroadcastMessageCommand(Client.Player, packet.Message);

                            break;
                        }
                    }
                    break;

                    case 0x97:

                        command = new OpenNewChannelCommand(Client.Player);

                        break;

                    case 0x98:
                    {
                        var packet = server.PacketsFactory.Create <OpenedNewChannelIncomingPacket>(reader);

                        command = new OpenedNewChannelCommand(Client.Player, packet.ChannelId);
                    }
                    break;

                    case 0x99:
                    {
                        var packet = server.PacketsFactory.Create <CloseChannelIncommingPacket>(reader);

                        command = new CloseChannelCommand(Client.Player, packet.ChannelId);
                    }
                    break;

                    case 0x9A:
                    {
                        var packet = server.PacketsFactory.Create <OpenedPrivateChannelIncomingPacket>(reader);

                        command = new OpenedPrivateChannelCommand(Client.Player, packet.Name);
                    }
                    break;

                    case 0x9B:
                    {
                        var packet = server.PacketsFactory.Create <ProcessReportRuleViolationIncommingPacket>(reader);

                        command = new ProcessReportRuleViolationCommand(Client.Player, packet.Name);
                    }
                    break;

                    case 0x9C:
                    {
                        var packet = server.PacketsFactory.Create <CloseReportRuleViolationChannelAnswerIncommingPacket>(reader);

                        command = new CloseReportRuleViolationChannelAnswerCommand(Client.Player, packet.Name);
                    }
                    break;

                    case 0x9D:

                        command = new CloseReportRuleViolationChannelQuestionCommand(Client.Player);

                        break;

                    case 0x9E:

                        command = new CloseNpcsChannelCommand(Client.Player);

                        break;

                    case 0xA0:
                    {
                        var packet = server.PacketsFactory.Create <CombatControlsIncommingPacket>(reader);

                        command = new CombatControlsCommand(Client.Player, packet.FightMode, packet.ChaseMode, packet.SafeMode);
                    }
                    break;

                    case 0xA1:
                    {
                        var packet = server.PacketsFactory.Create <AttackIncommingPacket>(reader);

                        if (packet.CreatureId == 0)
                        {
                            command = new StopAttackCommand(Client.Player);
                        }
                        else
                        {
                            command = new StartAttackCommand(Client.Player, packet.CreatureId, packet.Nonce);
                        }
                    }
                    break;

                    case 0xA2:
                    {
                        var packet = server.PacketsFactory.Create <FollowIncommingPacket>(reader);

                        if (packet.CreatureId == 0)
                        {
                            command = new StopFollowCommand(Client.Player);
                        }
                        else
                        {
                            command = new StartFollowCommand(Client.Player, packet.CreatureId, packet.Nonce);
                        }
                    }
                    break;

                    case 0xA3:
                    {
                        var packet = server.PacketsFactory.Create <InviteToPartyIncomingPacket>(reader);

                        command = new InviteToPartyCommand(Client.Player, packet.CreatureId);
                    }
                    break;

                    case 0xA4:
                    {
                        var packet = server.PacketsFactory.Create <JoinPartyIncomingPacket>(reader);

                        command = new JoinPartyCommand(Client.Player, packet.CreatureId);
                    }
                    break;

                    case 0xA5:
                    {
                        var packet = server.PacketsFactory.Create <RevokePartyIncomingPacket>(reader);

                        command = new RevokePartyCommand(Client.Player, packet.CreatureId);
                    }
                    break;

                    case 0xA6:
                    {
                        var packet = server.PacketsFactory.Create <PassLeadershipToIncomingPacket>(reader);

                        command = new PassLeaderShipToCommand(Client.Player, packet.CreatureId);
                    }
                    break;

                    case 0xA7:

                        command = new LeavePartyCommand(Client.Player);

                        break;

                    case 0xA8:
                    {
                        var packet = server.PacketsFactory.Create <SharedExperienceIncomingPacket>(reader);

                        command = new SharedExperienceCommand(Client.Player, packet.Enabled);
                    }
                    break;

                    case 0xAA:

                        command = new OpenedMyPrivateChannelCommand(Client.Player);

                        break;

                    case 0xAB:
                    {
                        var packet = server.PacketsFactory.Create <InvitePlayerIncommingPacket>(reader);

                        command = new InvitePlayerCommand(Client.Player, packet.Name);
                    }
                    break;

                    case 0xAC:
                    {
                        var packet = server.PacketsFactory.Create <ExcludePlayerIncommingPacket>(reader);

                        command = new ExcludePlayerCommand(Client.Player, packet.Name);
                    }
                    break;

                    case 0xBE:

                        command = new StopCommand(Client.Player);

                        break;

                    case 0xD2:

                        command = new SelectOutfitCommand(Client.Player);

                        break;

                    case 0xD3:
                    {
                        var packet = server.PacketsFactory.Create <SelectedOutfitIncomingPacket>(reader);

                        command = new SelectedOutfitCommand(Client.Player, packet.Outfit);
                    }
                    break;

                    case 0xDC:
                    {
                        var packet = server.PacketsFactory.Create <AddVipIncommingPacket>(reader);

                        command = new AddVipCommand(Client.Player, packet.Name);
                    }
                    break;

                    case 0xDD:
                    {
                        var packet = server.PacketsFactory.Create <RemoveVipIncommingPacket>(reader);

                        command = new RemoveVipCommand(Client.Player, packet.CreatureId);
                    }
                    break;

                    case 0xE6:
                    {
                        var packet = server.PacketsFactory.Create <ReportBugIncomingPacket>(reader);

                        command = new ReportBugCommand(Client.Player, packet.Message);
                    }
                    break;

                    case 0xF0:

                        command = new OpenQuestsCommand(Client.Player);

                        break;

                    case 0xF1:
                    {
                        var packet = server.PacketsFactory.Create <OpenQuestIncomingPacket>(reader);

                        command = new OpenQuestCommand(Client.Player, packet.QuestId);
                    }
                    break;
                    }

                    if (command != null)
                    {
                        server.QueueForExecution(command);
                    }
                }
            }
            catch (Exception ex)
            {
                server.Logger.WriteLine(ex.ToString());
            }

            base.OnReceived(body);
        }