private static void RemoveAccount(NetState state, PacketReader pvSrc)
{
if (state.Account.AccessLevel < AccessLevel.Administrator)
{
state.Send(new MessageBoxMessage("You do not have permission to delete accounts.", "Account Access Exception"));
return;
}
IAccount a = Accounts.GetAccount(pvSrc.ReadString());
if (a == null)
{
state.Send(new MessageBoxMessage("The account could not be found (and thus was not deleted).", "Account Not Found"));
}
else if (!CanAccessAccount(state.Account, a))
{
state.Send(new MessageBoxMessage("You cannot delete an account with an access level greater than or equal to your own.", "Account Access Exception"));
}
else if (a == state.Account)
{
state.Send(new MessageBoxMessage("You may not delete your own account.", "Not Allowed"));
}
else
{
RemoteAdminLogging.WriteLine(state, "Deleted Account {0}", a);
a.Delete();
state.Send(new MessageBoxMessage("The requested account (and all it's characters) has been deleted.", "Account Deleted"));
}
}