Esempio n. 1
0
        public static void HandleCreateCharacterReq(CharacterSession session, ClientCreateCharacterReq createCharacterReq)
        {
            if (session.GetCharacterByIndex(createCharacterReq.Character.Index) != null)
            {
                return;
            }

            // TODO: validate character appearance

            CharacterInfo info      = createCharacterReq.Character;
            var           character = new CharacterModel
            {
                AccountId  = session.Account.Id,
                Index      = info.Index,
                Name       = info.Base.Name,
                Class      = info.Base.Class,
                Level      = info.Level,
                Appearance = info.Base.Appearance,

                // hardcoded for the time being
                MapId = 10003,
                X     = 10444.9951f,
                Y     = 10179.7461f,
                Z     = 100.325394f
            };

            try
            {
                session.CreateCharacter(character);
            }
            catch (Exception exception)
            {
                // TODO: send some error
            }
        }