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


C++ Transporter::RemovePlayer方法代码示例

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


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

示例1: HandleSummonCommand

bool ChatHandler::HandleSummonCommand(const char* args, WorldSession *m_session)
{
	if(!*args)
		return false;

	sGMLog.writefromsession(m_session, "summoned %s on map %u, %f %f %f", args, m_session->GetPlayer()->GetMapId(),m_session->GetPlayer()->GetPositionX(),m_session->GetPlayer()->GetPositionY(),m_session->GetPlayer()->GetPositionZ());

	Player * plr = m_session->GetPlayer();
	Player *chr = objmgr.GetPlayer(args, false);
	if( chr && chr->m_isGmInvisible < 2 )
	{
		// send message to user
		char buf[256];
		char buf0[256];
		if( chr->IsBeingTeleported() == true )
		{
			snprintf((char*)buf,256, "%s is already being teleported.", chr->GetName());
			SystemMessage(m_session, buf);
			return true;
		}
		if(!chr->RemoveTransporterStatus())
		{
			char buff[256];
			snprintf((char*)buf,256, "%s already being teleported.", chr->GetName());
			SystemMessage(m_session, buff);
			return true;
		}
		if( plr->RS_getAccess() < chr->RS_getAccess() || chr->m_isGmInvisible > INVIS_NONE )
		{
			snprintf((char*)buf,256, "%s is attempting to summon you!", plr->GetName());
			SystemMessageToPlr(chr, buf);
			chr->SummonRequest(plr->GetLowGUID(), plr->GetZoneId(), plr->GetMapId(), plr->GetInstanceID(), plr->GetPosition());
			snprintf((char*)buf0,256, "Summon request sent.", chr->GetName());
			SystemMessage(m_session, buf0);
			return true;
		}
		snprintf((char*)buf,256, "You are summoning %s.", chr->GetName());
		SystemMessage(m_session, buf);

		if(!(plr->m_isGmInvisible && chr->RS_getAccess() >= RS_SCRIPTER))
		{
			// send message to player
			snprintf((char*)buf0,256, "You are being summoned by %s.", m_session->GetPlayer()->GetName());
			SystemMessageToPlr(chr, buf0);
		}

		if(chr->GetTaxiState())
		{
			sEventMgr.RemoveEvents(chr, EVENT_PLAYER_TAXI_DISMOUNT);
			sEventMgr.RemoveEvents(chr, EVENT_PLAYER_TAXI_INTERPOLATE);
			chr->SetTaxiState(false);
			chr->SetTaxiPath(NULL);
			chr->UnSetTaxiPos();
			chr->m_taxi_ride_time = 0;
			chr->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID , 0);
			chr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNTED_TAXI);
			chr->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOCK_PLAYER);
			chr->SetPlayerSpeed(RUN, chr->m_runSpeed);
		}
		if(chr->m_TransporterGUID)
		{
			Transporter * pTrans = objmgr.GetTransporter(GUID_LOPART(chr->m_TransporterGUID));
			if(pTrans)
			{
				if(chr->m_lockTransportVariables == true)
				{
					char buff[256];
					snprintf((char*)buf,256, "%s is already being teleported.", chr->GetName());
					SystemMessage(m_session, buff);
					return true;
				}
				pTrans->RemovePlayer(chr);
				chr->m_CurrentTransporter = NULL;
				chr->m_TransporterGUID = 0;
			}
		}

		if( plr->GetMapMgr() == chr->GetMapMgr() )
		{
			chr->_Relocate(plr->GetMapId(),plr->GetPosition(),false,false,plr->GetInstanceID());
		}
		else
		{
			sEventMgr.AddEvent(chr,&Player::EventPortToGM,plr,0,1,1,0);
		}
	}
	else
	{
		PlayerInfo * pinfo = objmgr.GetPlayerInfoByName(args);
		if(!pinfo)
		{
			char buf[256];
			snprintf((char*)buf,256,"Player (%s) does not exist.", args);
			SystemMessage(m_session, buf);
		}
		else
		{
			Player * pPlayer = m_session->GetPlayer();
			char query[512];
			snprintf((char*) &query,512, "UPDATE characters SET mapId = %u, positionX = %f, positionY = %f, positionZ = %f, zoneId = %u WHERE guid = %u;",	pPlayer->GetMapId(), pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), pPlayer->GetZoneId(), pinfo->guid);
//.........这里部分代码省略.........
开发者ID:pfchrono,项目名称:rs-ascent,代码行数:101,代码来源:Level1.cpp


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