public long AddCharacter(Character Char)
        {
            long CharacterId = System.Threading.Interlocked.Increment(ref MaxCharacterId);

            Log.Success("AddCharacter", "Creating New Character : " + CharacterId + ", Name = " + Char.CharacterName);

            Char.CharacterId = CharacterId;
            Char.Info.CharacterId = CharacterId;

            CharactersDB.AddObject(Char);
            CharactersDB.AddObject(Char.Info);

            return CharacterId;
        }
        public bool Build(Character Char)
        {
            if (Char == null)
                return false;

            if (Field1 == null)
                Field1 = new List<ISerializablePacket>();

            GUID = Char.CharacterId;
            Field4 = 1001;

            ISerializablePacket UnkPck = new ISerializablePacket();
            UnkPck.Opcode = 0x0259;
            UnkPck.AddField(3, EPacketFieldType.Raw4Bytes, (float)50.0f);

            SetCharacterInformation(Char);
            SetCharacterStats(Char);
            SetPosition(Char.Info.MapID, Char.Info.MapName, Char.Info.Position);

            AddPacketToList(0x026B);
            AddPacketToList(0x025A);
            AddPacketToList(0x026E);
            AddPacketToList(0x0272);
            AddPacketToList(0x0289);
            AddPacketToList(0x028A);

            // Another Social Junk ?
            ISerializablePacket UnkPck5 = new ISerializablePacket();
            UnkPck5.Opcode = 0x028F;
            ISerializablePacket UnkPck5Pck = new ISerializablePacket();
            UnkPck5Pck.Opcode = 0x0354;
            UnkPck5Pck.AddField(0, EPacketFieldType.Unsigned7BitEncoded, (long)2);
            UnkPck5.AddField(4, EPacketFieldType.Packet, UnkPck5Pck);
            Field1.Add(UnkPck5);

            AddPacketToList(0x033A);
            AddPacketToList(0x08A2);
            AddPacketToList(0x08FC);
            AddPacketToList(0x0F41);
            AddPacketToList(0x0F45);

            return true;
        }
        public override void OnRead(RiftClient From)
        {
            if (From.Acct == null || From.Rm == null)
                return;

            CharactersMgr Mgr = From.Rm.GetObject<CharactersMgr>();
            if (Mgr.GetCharactersCount(From.Acct.Id) >= 6)
            {
                From.Disconnect();
                return;
            }

            ISerializablePacket Response = new ISerializablePacket();
            Response.Opcode = (int)Opcodes.LobbyCharacterCreateResponse;
            if (Mgr.CharacterExist(Name))
                Response.AddField(0, EPacketFieldType.Unsigned7BitEncoded, (long)CharacterCreateResponses.INVALID_NAME);
            else
            {
                Character Char = new Character();
                Char.AccountId = From.Acct.Id;
                Char.CharacterName = Name;
                Char.Email = From.Acct.Email;

                Char.Info = new CharacterInfo();
                Char.Info.Class = Class;
                Char.Info.CustomPacket = this.CharacterCustom;
                Char.Info.Level = Mgr.StartingLevel;
                Char.Info.Race = Race;
                Char.Info.Sex = Sex;

                long CharacterID = Mgr.AddCharacter(Char);

                Response.AddField(0, EPacketFieldType.Unsigned7BitEncoded, (long)CharacterCreateResponses.CREATE_OK);
                From.JustCreatedCharacter = CharacterID;
            }

            From.SendSerialized(Response);
        }
 public void SetCharacterStats(Character Char)
 {
     ISerializablePacket Packet = GetPacketOnList(0x0294);
     Packet.AddField(11, EPacketFieldType.Dictionary, new Dictionary<long, ISerializablePacket>());
 }
 public void SetCharacterInformation(Character Char)
 {
     ISerializablePacket CharacterInformation = GetPacketOnList((long)Opcodes.WorldCharacterInformation);
     CharacterInformation.AddField(12, EPacketFieldType.ByteArray, Char.CharacterName);
     CharacterInformation.AddField(54, EPacketFieldType.Unsigned7BitEncoded, MapServer.Rm.RiftId);
     CharacterInformation.AddField(56, EPacketFieldType.Packet, Char.Info.CustomPacket);
 }