当前位置: 首页>>代码示例>>C++>>正文


C++ Account::SetGMFlags方法代码示例

本文整理汇总了C++中Account::SetGMFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ Account::SetGMFlags方法的具体用法?C++ Account::SetGMFlags怎么用?C++ Account::SetGMFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Account的用法示例。


在下文中一共展示了Account::SetGMFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: AddAccount

void AccountMgr::AddAccount()
{
	Account* acct = new Account;
	Sha1Hash hash;
	string Username = "test";
	string Password = "test";
	acct->AccountId				= 1;
	acct->AccountFlags			= 1;
	acct->Banned				= 1;
	if((uint32)UNIXTIME > acct->Banned && acct->Banned != 0 && acct->Banned != 1)   //1 = perm ban?
	{
		//Accounts should be unbanned once the date is past their set expiry date.
		acct->Banned = 0;
		//me go boom :(
		//printf("Account %s's ban has expired.\n",acct->UsernamePtr->c_str());
		//sLogonSQL->Execute("UPDATE accounts SET banned = 0 WHERE acct=%u", acct->AccountId);
	}
	acct->SetGMFlags("test");
	acct->Locale[0] = 'e';
	acct->Locale[1] = 'n';
	acct->Locale[2] = 'U';
	acct->Locale[3] = 'S';
	acct->forcedLocale = false;

	acct->Muted = 1;
	if((uint32)UNIXTIME > acct->Muted && acct->Muted != 0 && acct->Muted != 1)   //1 = perm ban?
	{
		//Accounts should be unbanned once the date is past their set expiry date.
		acct->Muted = 0;
		//LOG_DEBUG("Account %s's mute has expired.",acct->UsernamePtr->c_str());
		//sLogonSQL->Execute("UPDATE accounts SET muted = 0 WHERE acct=%u", acct->AccountId);
	}
	// Convert username/password to uppercase. this is needed ;)
	mnet_TOUPPER(Username);
	mnet_TOUPPER(Password);

	// prefer encrypted passwords over nonencrypted
	// Prehash the I value.
	hash.UpdateData((Username + ":" + Password));
	hash.Finalize();
	memcpy(acct->SrpHash, hash.GetDigest(), 20);
	AccountDatabase[Username] = acct;
}
开发者ID:edolphin-ydf,项目名称:hydzhengtu,代码行数:43,代码来源:InfoCore.cpp

示例2: AddAccount

void AccountMgr::AddAccount(Field* field)
{
	Account * acct = new Account;
	Sha1Hash hash;
	string Username     = field[1].GetString();
	string Password	    = field[2].GetString();
	//string EncryptedPassword = field[3].GetString();
	string GMFlags		= field[3].GetString();

	acct->AccountId				= field[0].GetUInt32();
	acct->AccountFlags			= field[4].GetUInt8();
	acct->Banned				= field[5].GetUInt32();
	if ( (uint32)UNIXTIME > acct->Banned && acct->Banned != 0 && acct->Banned != 1) //1 = perm ban?
	{
		//Accounts should be unbanned once the date is past their set expiry date.
		acct->Banned = 0;
		//me go boom :(
		//printf("Account %s's ban has expired.\n",acct->UsernamePtr->c_str());
		sLogonSQL->Execute("UPDATE accounts SET banned = 0 WHERE acct=%u",acct->AccountId);
	}
	acct->SetGMFlags(GMFlags.c_str());
	acct->Locale[0] = 'e';
	acct->Locale[1] = 'n';
	acct->Locale[2] = 'U';
	acct->Locale[3] = 'S';
	if(strcmp(field[6].GetString(), "enUS"))
	{
		// non-standard language forced
		memcpy(acct->Locale, field[6].GetString(), 4);
		acct->forcedLocale = true;
	}
	else
		acct->forcedLocale = false;

    acct->Muted = field[7].GetUInt32();
	if ( (uint32)UNIXTIME > acct->Muted && acct->Muted != 0 && acct->Muted != 1) //1 = perm ban?
	{
		//Accounts should be unbanned once the date is past their set expiry date.
		acct->Muted= 0;
		DEBUG_LOG("AccountMgr","Account %s's mute has expired.", Username.c_str());
		sLogonSQL->Execute("UPDATE accounts SET muted = 0 WHERE acct=%u",acct->AccountId);
	}
	// Convert username/password to uppercase. this is needed ;)
	HEARTHSTONE_TOUPPER(Username);
	HEARTHSTONE_TOUPPER(Password);
	
	if( m_encryptedPasswords )
	{
		// prefer encrypted passwords over nonencrypted
		BigNumber bn;
		bn.SetHexStr( Password.c_str() );
		if( bn.GetNumBytes() != 20 )
		{
			// Someone probably has non-encrypted passwords in a server that's set to encrypted pws.
			hash.UpdateData((Username + ":" + Password));
			hash.Finalize();
			memcpy(acct->SrpHash, hash.GetDigest(), 20);
			// Make sure this doesn't happen again.
			BigNumber cnSave;
			cnSave.SetBinary( acct->SrpHash, 20);
			string hash = cnSave.AsHexStr();
			DEBUG_LOG("AccountMgr", "Found account %s [%u] with invalid password format. Converting to encrypted password.", Username.c_str(), acct->AccountId);
			sLogonSQL->Execute("UPDATE accounts SET password = SHA1(CONCAT(UPPER(login), ':', UPPER(password))) WHERE acct = %u", acct->AccountId);
		}
		else
		{
			if ( Password.size() == 40 )
			{
				if( bn.GetNumBytes() < 20 )
				{
					memcpy(acct->SrpHash, bn.AsByteArray(), bn.GetNumBytes());
					for (int n=bn.GetNumBytes(); n<=19; n++)
						acct->SrpHash[n] = (uint8)0;
					reverse_array(acct->SrpHash, 20);
				}
				else
				{
					memcpy(acct->SrpHash, bn.AsByteArray(), 20);
					reverse_array(acct->SrpHash, 20);
				}
			}
		}
	}
	else
	{
		// Prehash the I value.
		hash.UpdateData((Username + ":" + Password));
		hash.Finalize();
		memcpy(acct->SrpHash, hash.GetDigest(), 20);
	}

	AccountDatabase[Username] = acct;
}
开发者ID:SkyFire,项目名称:sandshroud,代码行数:93,代码来源:AccountCache.cpp

示例3: AddAccount

void AccountMgr::AddAccount(Field* field)
{
    Account* acct = new Account;
    Sha1Hash hash;
    std::string Username = field[1].GetString();
    std::string EncryptedPassword = field[2].GetString();
    std::string GMFlags = field[3].GetString();

    acct->AccountId = field[0].GetUInt32();
    acct->AccountFlags = field[4].GetUInt8();
    acct->Banned = field[5].GetUInt32();
    if ((uint32)UNIXTIME > acct->Banned && acct->Banned != 0 && acct->Banned != 1)   //1 = perm ban?
    {
        //Accounts should be unbanned once the date is past their set expiry date.
        acct->Banned = 0;
        //me go boom :(
        //printf("Account %s's ban has expired.\n",acct->UsernamePtr->c_str());
        sLogonSQL->Execute("UPDATE accounts SET banned = 0 WHERE acct=%u", acct->AccountId);
    }
    acct->SetGMFlags(GMFlags.c_str());
    acct->Locale[0] = 'e';
    acct->Locale[1] = 'n';
    acct->Locale[2] = 'U';
    acct->Locale[3] = 'S';
    if (strcmp(field[6].GetString(), "enUS"))
    {
        // non-standard language forced
        memcpy(acct->Locale, field[6].GetString(), 4);
        acct->forcedLocale = true;
    }
    else
        acct->forcedLocale = false;

    acct->Muted = field[7].GetUInt32();
    if ((uint32)UNIXTIME > acct->Muted && acct->Muted != 0 && acct->Muted != 1)   //1 = perm ban?
    {
        //Accounts should be unbanned once the date is past their set expiry date.
        acct->Muted = 0;
        //LOG_DEBUG("Account %s's mute has expired.",acct->UsernamePtr->c_str());
        sLogonSQL->Execute("UPDATE accounts SET muted = 0 WHERE acct=%u", acct->AccountId);
    }
    // Convert username to uppercase. this is needed ;)
    arcemu_TOUPPER(Username);

    // prefer encrypted passwords over nonencrypted
    if (EncryptedPassword.size() > 0)
    {
        if (EncryptedPassword.size() == 40)
        {
            BigNumber bn;
            bn.SetHexStr(EncryptedPassword.c_str());
            if (bn.GetNumBytes() < 20)
            {
                // Hacky fix
                memcpy(acct->SrpHash, bn.AsByteArray(), bn.GetNumBytes());
                for (int n = bn.GetNumBytes(); n <= 19; n++)
                    acct->SrpHash[n] = (uint8)0;
                reverse_array(acct->SrpHash, 20);
            }
            else
            {
                memcpy(acct->SrpHash, bn.AsByteArray(), 20);
                reverse_array(acct->SrpHash, 20);
            }
        }
        else
        {
            LOG_ERROR("Account `%s` has incorrect number of bytes in encrypted password! Disabling.", Username.c_str());
            memset(acct->SrpHash, 0, 20);
        }
    }
    else
    {
        // This should never happen...
        LOG_ERROR("Account `%s` has no encrypted password!", Username.c_str());
    }

    AccountDatabase[Username] = acct;
}
开发者ID:AriDEV,项目名称:AscEmu,代码行数:79,代码来源:AccountCache.cpp

示例4: AddAccount

void AccountMgr::AddAccount(Field* field)
{
	Account * acct = new Account;
	Sha1Hash hash;
	string Username     = field[1].GetString();
	string Password	    = field[2].GetString();
	string EncryptedPassword = field[3].GetString();
	string GMFlags		= field[4].GetString();

	acct->AccountId				= field[0].GetUInt32();
	acct->AccountFlags			= field[5].GetUInt8();
	acct->Banned				= field[6].GetUInt32();
	if ( (uint32)UNIXTIME > acct->Banned && acct->Banned != 0 && acct->Banned != 1) //1 = perm ban?
	{
		//Accounts should be unbanned once the date is past their set expiry date.
		acct->Banned = 0;
		//me go boom :(
		//printf("Account %s's ban has expired.\n",acct->UsernamePtr->c_str());
		sLogonSQL->Execute("UPDATE accounts SET banned = 0 WHERE acct=%u",acct->AccountId);
	}
	acct->SetGMFlags(GMFlags.c_str());
	acct->Locale[0] = 'e';
	acct->Locale[1] = 'n';
	acct->Locale[2] = 'U';
	acct->Locale[3] = 'S';
	if(strcmp(field[7].GetString(), "enUS"))
	{
		// non-standard language forced
		memcpy(acct->Locale, field[7].GetString(), 4);
		acct->forcedLocale = true;
	}
	else
		acct->forcedLocale = false;

    acct->Muted = field[8].GetUInt32();
	if ( (uint32)UNIXTIME > acct->Muted && acct->Muted != 0 && acct->Muted != 1) //1 = perm ban?
	{
		//Accounts should be unbanned once the date is past their set expiry date.
		acct->Muted= 0;
		//sLog.outDebug("Account %s's mute has expired.",acct->UsernamePtr->c_str());
		sLogonSQL->Execute("UPDATE accounts SET muted = 0 WHERE acct=%u",acct->AccountId);
	}
	// Convert username/password to uppercase. this is needed ;)
	ASCENT_TOUPPER(Username);
	ASCENT_TOUPPER(Password);
	
	if( EncryptedPassword.size() > 0 )
	{
		// prefer encrypted passwords over nonencrypted
		BigNumber bn;
		bn.SetHexStr( EncryptedPassword.c_str() );
		if( bn.GetNumBytes() != 20 )
		{
			printf("Account `%s` has incorrect number of bytes (%u) in encrypted password! Disabling.\n", Username.c_str(), bn.GetNumBytes());
			memset(acct->SrpHash, 0, 20);
		}
		else
		{
			memcpy(acct->SrpHash, bn.AsByteArray(), 20);
			reverse_array(acct->SrpHash, 20);
		}
	}
	else
	{
		// Prehash the I value.
		hash.UpdateData((Username + ":" + Password));
		hash.Finalize();
		memcpy(acct->SrpHash, hash.GetDigest(), 20);
	}

	AccountDatabase[Username] = acct;
}
开发者ID:AwkwardDev,项目名称:ascent_classic,代码行数:72,代码来源:AccountCache.cpp


注:本文中的Account::SetGMFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。