Beispiel #1
0
int AuthConfig::Run()
{
	ReadFromFile();
	ShowMainMenu();

	while (true)
	{
		std::cout << "> ";

		char key = (char)_getch();
		std::cout << key << std::endl;
		if (key == '9')
			break;

		else if (key == '1')
			ListRealms();
		else if (key == '2')
			AddRealm();
		else if (key == '3')
			RemoveRealm();
		else if (key == '4')
			ListUsers();
		else if (key == '5')
			AddUser();
		else if (key == '6')
			RemoveUser();
		else if (key == '7')
			ChangeUserRealm();
		else if (key == '8')
			ChangeUserPassword();
		else if (key == '?')
			ShowMainMenu();
		else
			UnrecognizedCmd();
	}

	return 0;
}
Beispiel #2
0
void InformationCore::LoadStaticRealms()
{
	Realm* realm = NULL;
	QueryResult* result = sLogonSQL->Query("SELECT * FROM static_realms");
	if(result != NULL)
	{
		do
		{
			Field* field = result->Fetch();
			realm = new Realm;

			realm->Name = field[0].GetString();
			realm->Address = format("%s:%u", field[1].GetString(), field[2].GetUInt32());
			realm->Colour = 0;
			realm->Icon = field[3].GetUInt8();
			realm->WorldRegion = field[4].GetUInt16();
			realm->Population = field[5].GetFloat();
			realm->staticrealm = true;
			AddRealm(GenerateRealmID(), realm);
		}while(result->NextRow());
		delete result;
	}
}
Beispiel #3
0
int RealmList::GetAndAddRealms(std::string dbstring)
{
    int count = 0;
    //QueryResult *result = dbRealmServer.PQuery( "SELECT `name`,`address`,`icon`,`color`,`timezone`, `dbstring` FROM `realmlist` ORDER BY `name`" );
    QueryResult *result = dbRealmServer.Query( "SELECT `id`, `name`,`address`,`icon`,`color`,`timezone` FROM `realmlist` ORDER BY `name`" );
    if(result)
    {
        do
        {
            Field *fields = result->Fetch();
                                                            //, fields[5].GetString());
            AddRealm(fields[0].GetUInt32(), fields[1].GetString(),fields[2].GetString(),fields[3].GetUInt8(), fields[4].GetUInt8(), fields[5].GetUInt8());
            count++;
        } while( result->NextRow() );
        delete result;
    }
    //if (_realms.size() == 0)
    //{
    //    sLog.outString( "Realm:***There are no valid realms specified in the database!  Working in localhost mode!***" );
    //    //AddRealm("localhost","127.0.0.1",1,0,1,dbstring.c_str());
    //    AddRealm("localhost","127.0.0.1",1,0,1);
    //}
    return count;
}