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


C++ P_CHAR::getRace方法代码示例

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


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

示例1: checkItemUsability

/*!
\brief wrap for check usability
\author Xanathar
\return bool
\param pc player trying using
\param pi pointer to item to be used
\param type type of usability
\remarks Luxor - Added REQSKILL command support, three bug fix applied 
*/
bool checkItemUsability(P_CHAR pc, P_ITEM pi, int type)
{
	g_nType = type;
	VALIDATEPIR(pi, false);
	VALIDATEPCR(pc, false);

	NXWSOCKET s = pc->getSocket();

	if( !pi->isNewbie() && ! pc->IsGM())
	{
		if ( pi->st > pc->getStrength() ) 
		{
			pc->sysmsg(TRANSLATE("You are not strong enough to use that."));
			return false;
		}
		if ( pi->dx > pc->dx )
		{
			pc->sysmsg(TRANSLATE("You are not quick enough to use that."));
			return false;
		}
		if ( pi->in > pc->in )
		{
			pc->sysmsg(TRANSLATE("You are not intelligent enough to use that."));
			return false;
		}
		//Luxor: REQSKILL command support
		if (pi->reqskill[0] > 0 && pi->reqskill[1] > 0 )
		{
			if (pi->reqskill[1] > pc->skill[pi->reqskill[0]]) {
				pc->sysmsg(TRANSLATE("You are not skilled enough to use that."));
				return false;
			}
		}
		if ( (pi->getGender() != INVALID && pi->getGender() != GENDER_NEUTRAL ) && pi->getGender() != pc->getGender() )
		{
			if ( pi->getGender() == 1 ) // it's a man item
				pc->sysmsg(TRANSLATE("Only males of your species may use that !"));
			else if ( pi->getGender() == 2 ) // it's a man item
				pc->sysmsg(TRANSLATE("Only females of your species may use that !"));
			else
				pc->sysmsg(TRANSLATE("You may not use that !")); // Damn, whats the political correct term for "Get some recreational extensions to your body"
			return false;
		}
		if ( Race::isRaceSystemActive() )
			if ( pi->getRace() != INVALID && pi->getRace() != pc->getRace() )
			{
				pc->sysmsg(TRANSLATE("Your race may not use this item!")); // Hope no one sues me because of racial discrimination in item use
				return false;
			}


	}

	if (s >-1 && s < now) //Luxor
	{
		
		if (pi->amxevents[EVENT_IONCHECKCANUSE]==NULL) return true;
		return (0!=pi->amxevents[EVENT_IONCHECKCANUSE]->Call(pi->getSerial32(), pc->getSerial32(), g_nType));
		/*
		AmxEvent* event = pi->getAmxEvent( EVENT_IONCHECKCANUSE );
		if ( !event ) return true;
		return ( 0 != event->Call(pi->getSerial32(), s, g_nType ) );
		*/
	}
	return true;
}
开发者ID:nox-wizard,项目名称:noxwizard,代码行数:75,代码来源:amxcback.cpp


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