public static AccountComponent GetAccountComponent(Database.Account account) { AccountComponent accountComponent = new AccountComponent() { AppliedEntitlements = new Dictionary <string, int>(), DailyQuestsAvailable = Config.ConfigManager.DailyQuestsAvailable, DisplayDevTag = false, FactionCompetitionData = new Dictionary <int, PlayerFactionCompetitionData>(), FreeRotationCharacters = new CharacterType[] { }, LastCharacter = account.LastCharacter, SelectedBackgroundBannerID = account.BannerID, SelectedForegroundBannerID = account.EmblemID, SelectedRibbonID = account.RibbonID, SelectedTitleID = account.TitleID, UnlockedBannerIDs = InventoryManager.GetUnlockedBannerIDs(account.AccountId), UIStates = new Dictionary <AccountComponent.UIStateIdentifier, int> { { AccountComponent.UIStateIdentifier.HasViewedFluxHighlight, 1 }, { AccountComponent.UIStateIdentifier.HasViewedGGHighlight, 1 } }, UnlockedEmojiIDs = InventoryManager.GetUnlockedEmojiIDs(account.AccountId), UnlockedLoadingScreenBackgroundIdsToActivatedState = InventoryManager.GetActivatedLoadingScreenBackgroundIds(account.AccountId), UnlockedOverconIDs = InventoryManager.GetUnlockedOverconIDs(account.AccountId), UnlockedTitleIDs = InventoryManager.GetUnlockedTitleIDs(account.AccountId), UnlockedRibbonIDs = InventoryManager.GetUnlockedRibbonIDs(account.AccountId) }; return(accountComponent); }
public async Task <Model.Models.Customer> Insert(CustomerInsertRequest request) { if (request.Password != request.PasswordConfirm) { throw new UserException("Lozinke moraju biti iste"); } var salt = AccountService.GenerateSalt(); var hash = AccountService.GenerateHash(salt, request.Password); // Adding account for customer Database.Account customerAccount = new Database.Account() { DateCreated = DateTime.Now, Email = request.Email, PasswordSalt = salt, PasswordHash = hash, PhoneNumber = request.PhoneNumber, Username = request.Username }; await _context.Account.AddAsync(customerAccount); await _context.SaveChangesAsync(); // Adding customer var result = await _context.Account .Where(x => x.PasswordSalt == salt) .SingleOrDefaultAsync(); var accountId = result.Id; Database.Customer customer = new Database.Customer() { AccountId = accountId, Address = request.Address, AreaId = request.AreaId, CompanyName = request.CompanyName }; _context.Customer.Add(customer); _context.SaveChanges(); return(_mapper.Map <Model.Models.Customer>(customer)); }
public static LobbyPlayerInfo OnPlayerConnect(LobbyServerProtocol client, RegisterGameClientRequest clientRequest) { long sessionToken = GeneratedSessionToken++; Database.Account user = Database.Account.GetByUserName(clientRequest.AuthInfo.Handle); client.AccountId = user.AccountId; client.SessionToken = sessionToken; client.UserName = user.UserName; client.SelectedGameType = user.LastSelectedGameType; client.SelectedSubTypeMask = 0; LobbyPlayerInfo playerInfo = new LobbyPlayerInfo { AccountId = user.AccountId, BannerID = user.BannerID, BotCanTaunt = false, BotsMasqueradeAsHumans = false, CharacterInfo = CharacterManager.GetCharacterInfo(user.AccountId, user.LastCharacter), ControllingPlayerId = 0, EffectiveClientAccessLevel = ClientAccessLevel.Full, EmblemID = user.EmblemID, Handle = user.UserName, IsGameOwner = true, IsLoadTestBot = false, IsNPCBot = false, PlayerId = 0, ReadyState = ReadyState.Unknown, ReplacedWithBots = false, RibbonID = user.RibbonID, TitleID = user.TitleID, TitleLevel = 1 }; ActivePlayers.Add(user.AccountId, playerInfo); SessionTokenAccountIDCache.Add(sessionToken, playerInfo.AccountId); ActiveConnections.Add(user.AccountId, client); return(playerInfo); }
public static PersistedAccountData GetPersistedAccountData(long accountId) { Database.Account account = Database.Account.GetByAccountId(accountId); PersistedAccountData accountData = new PersistedAccountData() { AccountComponent = GetAccountComponent(account), AccountId = accountId, BankComponent = Bank.GetBankComponent(account.AccountId), CharacterData = CharacterManager.GetPersistedCharacterData(account.AccountId), Handle = account.UserName, InventoryComponent = InventoryManager.GetInventoryComponent(accountId), QuestComponent = new QuestComponent() { ActiveSeason = 9 }, SchemaVersion = new SchemaVersion <AccountSchemaChange>(0x1FFFF), UserName = account.UserName }; return(accountData); }