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


C++ P_PLAYER::callEventHandler方法代码示例

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


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

示例1: Snooping

void cSkills::Snooping( P_PLAYER player, P_ITEM container )
{
	P_CHAR owner = container->getOutmostChar();

	if ( !owner )
		return; // Snooping into something thats not equipped?!

	PyObject *args = Py_BuildValue( "(NNN)", owner->getPyObject(), container->getPyObject(), player->getPyObject() );

	// Event prfen
	if ( player->canHandleEvent( EVENT_SNOOPING ) )
	{
		if ( player->callEventHandler( EVENT_SNOOPING, args ) )
		{
			Py_DECREF( args );
			return;
		}
	}

	if ( owner->canHandleEvent( EVENT_SNOOPING ) )
	{
		if ( owner->callEventHandler( EVENT_SNOOPING, args ) )
		{
			Py_DECREF( args );
			return;
		}
	}

	Py_DECREF( args );

	cUOSocket* socket = player->socket();

	if ( !socket )
		return;

	P_CHAR pc_owner = container->getOutmostChar();
	P_PLAYER pp_owner = dynamic_cast<P_PLAYER>( pc_owner );

	if ( pp_owner && pp_owner->isGMorCounselor() )
	{
		pp_owner->message( tr( "%1 is trying to snoop in your pack" ).arg( player->name() ) );
		socket->sysMessage( 500209 ); // You can not peek into the container.
		return;
	}
	else if ( player->checkSkill( SNOOPING, 0, 1000 ) )
	{
		socket->sendContainer( container );
		socket->sysMessage( tr( "You successfully peek into that container." ) );
	}
	else
	{
		socket->sysMessage( 500210 ); // You failed to peek into the container.

		if ( !pp_owner ) // is NPC ?
		{
			if ( pc_owner )
			{
				pc_owner->talk( tr( "Art thou attempting to disturb my privacy?" ) );
			}
		}
		else
		{
			pp_owner->message( tr( "You notice %1 trying to peek into your pack!" ).arg( player->name() ) );
		}
	}



	//	SetTimerSec(player->objectdelay(), Config::instance()->objectDelay()+Config::instance()->snoopdelay());
	player->setObjectDelay( Server::instance()->time() + ( Config::instance()->objectDelay() + Config::instance()->snoopdelay() ) * MY_CLOCKS_PER_SEC );
}
开发者ID:BackupTheBerlios,项目名称:wolfpack-svn,代码行数:71,代码来源:skills.cpp


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