Exemple #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));
        }
Exemple #2
0
        public static L2Player ToPlayer(this CharacterContract characterContract)
        {
            L2Player player = new L2Player(CharTemplateTable.GetTemplate(characterContract.ClassId), characterContract.CharacterId)
            {
                ObjectId              = characterContract.CharacterId,
                Name                  = characterContract.Name,
                Title                 = characterContract.Title,
                Level                 = (byte)characterContract.Level,
                Face                  = (Face)characterContract.Face,
                HairStyleId           = (HairStyleId)characterContract.HairStyle,
                HairColor             = (HairColor)characterContract.HairColor,
                Sex                   = (Gender)characterContract.Sex,
                X                     = characterContract.X,
                Y                     = characterContract.Y,
                Z                     = characterContract.Z,
                Heading               = characterContract.Heading,
                Experience            = characterContract.Exp,
                ExpOnDeath            = characterContract.ExpBeforeDeath,
                Sp                    = characterContract.Sp,
                Karma                 = characterContract.Karma,
                PvpKills              = characterContract.PvpKills,
                PkKills               = characterContract.PkKills,
                BaseClass             = CharTemplateTable.GetTemplate(characterContract.BaseClass),
                ActiveClass           = CharTemplateTable.GetTemplate(characterContract.ClassId),
                RecomendationsLeft    = characterContract.RecLeft,
                RecomandationsHave    = characterContract.RecHave,
                CharacterSlot         = characterContract.CharSlot,
                DeleteTime            = characterContract.DeleteTime,
                LastAccess            = characterContract.LastAccess,
                CanCraft              = characterContract.CanCraft,
                AccessLevel           = characterContract.AccessLevel,
                OnlineTime            = characterContract.OnlineTime,
                PunishLevel           = characterContract.PunishLevel,
                PunishTime            = characterContract.PunishTime,
                PowerGrade            = characterContract.PowerGrade,
                Nobless               = characterContract.Nobless,
                Hero                  = characterContract.Hero,
                LastRecomendationDate = characterContract.LastRecomDate
            };

            player.CharStatus.SetCurrentCp(characterContract.CurCp,
                                           false);                          //player.CharStatus.CurrentCp = playerContract.CurCp; //???after repairing the broadcast, return it back???
            player.CharStatus.SetCurrentHp(characterContract.CurHp, false); //player.CharStatus.CurrentHp = playerContract.CurHp;
            player.CharStatus.SetCurrentMp(characterContract.CurMp, false); //player.CharStatus.CurrentMp = playerContract.CurMp;

            return(player);
        }