Example #1
0
        //TODO: Simplify method body
        public override async Task RunImpl()
        {
            if (!await IsValidChar())
            {
                return;
            }

            PcTemplate template = CharTemplateTable.GetTemplate(_classId);

            L2Player player = new L2Player(template, _idFactory.NextId())
            {
                Name          = _name,
                Account       = _client.Account,
                Sex           = (Gender)_sex,
                HairStyleId   = (HairStyleId)_hairStyle,
                HairColor     = (HairColor)_hairColor,
                Face          = (Face)_face,
                CharacterSlot = _client.AccountCharacters.Count
            };

            _characterService.CreatePlayer(player);
            _client.AccountCharacters.Add(player);
            _client.SendPacketAsync(new CharCreateOk());
            _client.SendPacketAsync(new CharList(_client, _client.SessionKey.PlayOkId1));
        }