Ejemplo n.º 1
0
        public static void CreateGameAccount(string[] args)
        {
            var email = Command.Read<string>(args, 0);
            var game = Command.Read<string>(args, 1);
            var index = Command.Read<byte>(args, 2);

            if (email != "" && game != "" && index != 0)
            {
                var account = DB.Auth.Single<Account>(a => a.Email == email);

                if (account != null)
                {
                    var exists = account.GameAccounts?.Any(ga => ga.Game == game && ga.Index == index) ?? false;

                    if (!exists)
                    {
                        var gameAccount = new GameAccount
                        {
                            AccountId = account.Id,
                            Game      = game,
                            Index     = index,
                            Region    = Region.XX,
                            Flags     = GameAccountFlags.None,
                            BoxLevel  = 5
                        };

                        if (DB.Auth.Add(gameAccount))
                            Log.Normal($"GameAccount '{game}{index}' for Account '{email}' successfully created.");
                        else
                            Log.Error($"GameAccount creation '{game}{index}' for Account '{email}' failed.");
                    }
                    else
                        Log.Error($"GameAccount '{game}{index}' for Account '{email}' already in database.");
                }
                else
                    Log.Error($"Account {email}' doesn't exist.");
            }
        }
Ejemplo n.º 2
0
        public static void CreateGameAccount(string[] args)
        {
            var accountId = Command.Read<int>(args, 0);
            var game = Command.Read<string>(args, 1);
            var index = Command.Read<byte>(args, 2);

            if (accountId != 0 && game != "" && index != 0)
            {
                var account = DB.Auth.Single<Account>(a => a.Id == accountId);

                if (account != null)
                {
                    var exists = account.GameAccounts != null ? account.GameAccounts.Any(ga => ga.Game == game && ga.Index == index) : false;

                    if (!exists)
                    {
                        var gameAccount = new GameAccount
                        {
                            AccountId = account.Id,
                            Game      = game,
                            Index     = index,
                            Region    = Regions.XX,
                            Flags     = GameAccountFlags.None,
                            BoxLevel  = 5
                        };

                        if (DB.Auth.Add(gameAccount))
                            Log.Message(LogType.Normal, "GameAccount '{0}{1}' for Account '{2}' successfully created.", game, index, accountId);
                    }
                    else
                        Log.Message(LogType.Error, "GameAccount '{0}{1}' for Account '{2}' already in database", game, index, accountId);
                }
                else
                    Log.Message(LogType.Error, "Account '{0}' doesn't exist.", accountId);
            }
        }
Ejemplo n.º 3
0
        public static void CreateGameAccount(string[] args)
        {
            var accountId = Command.Read<int>(args, 0);
            var game = Command.Read<string>(args, 1);
            var index = Command.Read<byte>(args, 2);

            if (accountId != 0 && game != "" && index != 0)
            {
                var account = DB.Auth.Accounts.SingleOrDefault(a => a.Id.Equals(accountId));

                if (account != null)
                {
                    var exists = account.GameAccounts != null ? account.GameAccounts.Any(ga => ga.Game == game && ga.Index == index) : false;

                    if (!exists)
                    {
                        var gameAccount = new GameAccount
                        {
                            AccountId = account.Id,
                            Game      = game,
                            Index     = index,
                            Region    = Regions.XX,
                            Flags     = GameAccountFlags.None,
                            BoxLevel  = 5
                        };

                        if (DB.Auth.Add(gameAccount))
                        {
                            // Default class/expansion data (sent in AuthResponse)
                            var defaultAllowedClasses = new byte[,] { { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 }, { 5, 0 }, { 6, 2 },
                                                                    { 7, 0 }, { 8, 0 }, { 9, 0 }, { 10, 4 }, { 11, 0 } };

                            // Default race/expansion data (sent in AuthResponse)
                            var defaultAllowedRaces = new byte[,] { { 1, 0 }, { 2, 0 }, { 3, 0 }, { 4, 0 }, { 5, 0 }, { 6, 0 },
                                                                  { 7, 0 }, { 8, 0 }, { 9, 3 }, { 10, 1 }, { 11, 1 }, { 22, 3 },
                                                                  { 24, 4 }, { 25, 4 }, { 26, 4 }};

                            for (int i = 0; i < defaultAllowedClasses.Length / 2; i++)
                            {
                                DB.Auth.Add(new AllowedClass
                                {
                                    AccountId = gameAccount.Id,
                                    Class     = defaultAllowedClasses[i, 0],
                                    Expansion = defaultAllowedClasses[i, 1]
                                });
                            }

                            for (int i = 0; i < defaultAllowedRaces.Length / 2; i++)
                            {
                                DB.Auth.Add(new AllowedRace
                                {
                                    AccountId = gameAccount.Id,
                                    Race      = defaultAllowedRaces[i, 0],
                                    Expansion = defaultAllowedRaces[i, 1]
                                });
                            }

                            Log.Message(LogType.Normal, "GameAccount '{0}{1}' for Account '{2}' successfully created.", game, index, accountId);
                        }
                    }
                }
                else
                    Log.Message(LogType.Error, "Account '{0}' doesn't exist.", accountId);
            }
        }