public static Character Create(CMSG_CHAR_CREATE request) { var position = GetStartingPosition(request.Race, request.Class); // GetInitialItems var spells = GetInitialSpells(request.Race, request.Class); var skills = GetInitialSkills(request.Race, request.Class); var actionBar = GetInitialActionBar(request.Race, request.Class); return(new Character { ActionBar = actionBar, Class = request.Class, Face = request.Face, FacialHair = request.FacialHair, Gender = request.Gender, HairColor = request.HairColor, HairStyle = request.HairStyle, Level = 1, Name = request.Name, OutfitId = request.OutfitId, Position = position, Race = request.Race, Skills = skills, Skin = request.Skin, Spells = spells, }); }
internal static void Handler(RealmServerSession session, CMSG_CHAR_CREATE handler) { session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_SUCCESS)); try { // If limit character reached if (Characters.GetCharacters(session.Users.username).Count >= Config.Instance.LimitCharacterRealm) { session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_SERVER_LIMIT)); return; } // check if name in use if (Characters.FindCharacaterByName(handler.Name) != null) { session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_NAME_IN_USE)); return; } Characters.Create(handler, session.Users); session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_SUCCESS)); } catch (Exception) { session.SendPacket(new SMSG_CHAR_CREATE(LoginErrorCode.CHAR_CREATE_ERROR)); } }
public async Task HandleCharCreate(CMSG_CHAR_CREATE create) { if (!IsAuthedRealmSession()) { return; } await Account.CreatePlayer(create); }
public static async Task OnCharacterCreate(WorldClient client, byte[] data) { var character = CMSG_CHAR_CREATE.RequestAsCharacter(data); client.User.Characters.Add(character); await client.SendPacket(SMSG_CHAR_CREATE.Success()); }
public static PacketProcessResult HandleCharCreate(PacketProcessor p) { CMSG_CHAR_CREATE create = new CMSG_CHAR_CREATE(); create.Read(p.CurrentPacket); p.ClientConnection.CurrentSession.HandleCharCreate(create); return(PacketProcessResult.Processed); }
internal static void Create(CMSG_CHAR_CREATE handler, Users users) { using (var scope = new DataAccessScope()) { // DONE: Save Char var Char = Model.Characters.Create(); Char.user = users; // DONE: Make name capitalized as on official Char.name = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(handler.Name); Char.race = (Races)handler.Race; Char.classe = (Classes)handler.Classe; Char.gender = (Genders)handler.Gender; Char.level = 1; Char.money = 0; /// Char.MapId = 0; Char.MapZone = 12; Char.MapX = -8949.95f; Char.MapY = -132.493f; Char.MapZ = 83.5312f; Char.MapO = 1.0f; Char.char_skin = handler.Skin; Char.char_face = handler.Face; Char.char_hairStyle = handler.HairStyle; Char.char_hairColor = handler.HairColor; Char.char_facialHair = handler.FacialHair; Char.created_at = DateTime.Now; Char.watched_faction = 255; // Set Another status // Set Taxi Zones // tutorial Flags // Map Explored // Set Honor // Query Access Level and Account ID // Char.level scope.Complete(); } }
public async Task CreatePlayer(CMSG_CHAR_CREATE create) { IDataStoreManager datastore = GrainFactory.GetGrain <IDataStoreManager>(0); var createinfo = await datastore.GetPlayerCreateInfo(create.Class, create.Race); if (createinfo == null) { await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_ERROR); return; } var plrnameindex = GrainFactory.GetGrain <IPlayerByNameIndex>(create.Name); var guidnameindex = await plrnameindex.GetPlayerGUID(); if (guidnameindex != 0) { await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_NAME_IN_USE); return; } var chrclass = await datastore.GetChrClasses(create.Class); var chrrace = await datastore.GetChrRaces(create.Race); if (chrclass == null || chrrace == null) { await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_ERROR); return; } var chars = GetCharacters(RealmSessionRealmID); if (chars != null && chars.Length >= 10) //todo: add max { await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_SERVER_LIMIT); return; } var creator = GrainFactory.GetGrain <ICreator>(0); //OK LETS CREATE PlayerCreateData info = new PlayerCreateData(); info.CreateData = create; info.RealmID = RealmSessionRealmID; info.AccountName = this.GetPrimaryKeyString(); var create_response = await creator.CreatePlayer(info); if (create_response.Item1 != LoginErrorCode.CHAR_CREATE_SUCCESS) { await SendCharCreateReply(create_response.Item1); return; } await plrnameindex.SetPlayer(create_response.Item2); await SendCharCreateReply(LoginErrorCode.CHAR_CREATE_SUCCESS); await CreateCharacterListEntryForPlayer(info, create_response.Item2); }