public string Add(string[] @params, MooNetClient invokerClient) { if (@params.Count() < 3) { return("Invalid arguments. Type 'help account add' to get help."); } var email = @params[0]; var password = @params[1]; var battleTagName = @params[2]; var userLevel = Account.UserLevels.User; if (@params.Count() == 4) { var level = @params[3].ToLower(); switch (level) { case "owner": userLevel = Account.UserLevels.Owner; break; case "admin": userLevel = Account.UserLevels.Admin; break; case "gm": userLevel = Account.UserLevels.GM; break; case "user": userLevel = Account.UserLevels.User; break; default: return(level + " is not a valid user level."); } } if (!email.Contains('@')) { return(string.Format("'{0}' is not a valid email address.", email)); } if (battleTagName.Contains('#')) { return("BattleTag must not contain '#' or HashCode."); } if (password.Length < 8 || password.Length > 16) { return("Password should be a minimum of 8 and a maximum of 16 characters."); } if (AccountManager.GetAccountByEmail(email) != null) { return(string.Format("An account already exists for email address {0}.", email)); } var account = AccountManager.CreateAccount(email, password, battleTagName, userLevel); var gameAccount = GameAccountManager.CreateGameAccount(account); return(string.Format("Created new account {0} [user-level: {1}] Full BattleTag: {2}.", account.Email, account.UserLevel, account.BattleTag)); }
/// <summary> /// Existing GameAccount /// </summary> /// <param name="persistentId"></param> /// <param name="accountId"></param> public GameAccount(ulong persistentId, ulong accountId) : base(persistentId) { this.SetField(AccountManager.GetAccountByPersistentID(accountId)); }