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


C++ CAccount::SetPassword方法代码示例

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


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

示例1: Player_OnVerb

bool CChar::Player_OnVerb( CScript &s, CTextConsole * pSrc ) // Execute command from script
{
	ADDTOCALLSTACK("CChar::Player_OnVerb");
	if ( !m_pPlayer )
		return false;

	LPCTSTR pszKey = s.GetKey();
	int cpVerb = FindTableSorted( pszKey, CCharPlayer::sm_szVerbKeys, COUNTOF(CCharPlayer::sm_szVerbKeys)-1 );

	if ( cpVerb <= -1 )
	{
		if ( ( !strnicmp(pszKey, "GUILD", 5) ) || ( !strnicmp(pszKey, "TOWN", 4) ) )
		{
			bool bIsGuild = !strnicmp(pszKey, "GUILD", 5);
			pszKey += bIsGuild ? 5 : 4;
			if ( *pszKey == '.' )
			{
				pszKey += 1;
				CItemStone *pMyGuild = Guild_Find(bIsGuild ? MEMORY_GUILD : MEMORY_TOWN);
                if ( pMyGuild )
                {
                        CScript sToParse(pszKey, s.GetArgRaw());
                        return pMyGuild->r_Verb(sToParse, pSrc);
                }
			}
			return false;
		}
	}

	switch ( cpVerb )
	{
		case CPV_KICK: // "KICK" = kick and block the account
			return (IsClient() && GetClient()->addKick(pSrc));

		case CPV_PASSWORD:	// "PASSWORD"
		{
			// Set/Clear the password
			if ( pSrc != this )
			{
				if ( pSrc->GetPrivLevel() <= GetPrivLevel() || pSrc->GetPrivLevel() < PLEVEL_Admin )
				{
					pSrc->SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_PRIV));
					return false;
				}
			}

			CAccount * pAccount = m_pPlayer->GetAccount();
			ASSERT(pAccount != NULL);

			if ( !s.HasArgs() )
			{
				pAccount->ClearPassword();
				SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_PASSCLEAR));
				SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_PASSCLEAR_RELOG));
				g_Log.Event(LOGM_ACCOUNTS|LOGL_EVENT, "Account '%s', password cleared\n", pAccount->GetName());
			}
			else
			{
				if ( pAccount->SetPassword(s.GetArgStr()) )
				{
					SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_ACCEPTPASS));
					g_Log.Event(LOGM_ACCOUNTS|LOGL_EVENT, "Account '%s', password set to '%s'\n", pAccount->GetName(), s.GetArgStr());
					return true;
				}

				SysMessage(g_Cfg.GetDefaultMsg(DEFMSG_MSG_ACC_INVALIDPASS));
			}
			break;
		}

		default:
			return false;
	}

	return true;
}
开发者ID:zolter,项目名称:Source,代码行数:76,代码来源:CCharNPC.cpp


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