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


C++ PlayerPointer::Root方法代码示例

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


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

示例1: ToLegionHold

bool ToLegionHold(uint32 i, AuraPointer pAura, bool apply)
{
	if ( pAura == NULL || pAura->GetUnitCaster() == NULL || !pAura->GetUnitCaster()->IsPlayer() )
		return true;

	PlayerPointer pPlayer = TO_PLAYER( pAura->GetUnitCaster() );

	CreaturePointer pJovaanCheck = pPlayer->GetMapMgr()->GetInterface()->GetCreatureNearestCoords(-3310.743896f, 2951.929199f, 171.132538f, 21633);
	if ( pJovaanCheck != NULL )
		return true;

	QuestLogEntry *pQuest = pPlayer->GetQuestLogForEntry( 10563 );
	if ( pQuest == NULL )
	{
		pQuest = pPlayer->GetQuestLogForEntry( 10596 );
		if ( pQuest == NULL )
			return true;
	}

	if ( apply )
	{

		pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, 20366 );
		pPlayer->Root();
		CreaturePointer pJovaan = sEAS.SpawnCreature( pPlayer, 21633, -3310.743896f, 2951.929199f, 171.132538f, 5.054039f, 0 );	// Spawn Jovaan
		if ( pJovaan != NULL )
		{
			pJovaan->SetUInt64Value( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_2 );
			if ( pJovaan->GetAIInterface() != NULL )
			{
				pJovaan->GetAIInterface()->SetAllowedToEnterCombat( false );
			}
		}
		GameObjectPointer pGameObject = pPlayer->GetMapMgr()->GetInterface()->GetGameObjectNearestCoords(pPlayer->GetPositionX(), pPlayer->GetPositionY(), pPlayer->GetPositionZ(), 184834);
		if ( pGameObject != NULL )
		{
			pGameObject->Despawn(60000);
			pPlayer->UpdateNearbyGameObjects();
		}
	}
	else
	{
		if ( pQuest->GetMobCount( 2 ) < pQuest->GetQuest()->required_mobcount[2] )
		{
			pQuest->SetMobCount( 2, pQuest->GetMobCount( 2 ) + 1 );
			pQuest->SendUpdateAddKill( 2 );
			pQuest->UpdatePlayerFields();
		}
	
		pPlayer->SetUInt32Value( UNIT_FIELD_DISPLAYID, pPlayer->GetUInt32Value( UNIT_FIELD_NATIVEDISPLAYID ) );
		pPlayer->UnRoot();
	}

	return true;
}
开发者ID:Vanj-crew,项目名称:HearthStone-Emu,代码行数:55,代码来源:Shadowmoon.cpp

示例2: Finish

void Arena::Finish()
{
	m_ended = true;
	ArenaTeam * teams[2] = {NULL, NULL};
	if(rated_match)
	{
		teams[0] = objmgr.GetArenaTeamById(m_teams[0]);
		teams[1] = objmgr.GetArenaTeamById(m_teams[1]);
	}
	/* update arena team stats */
	if(rated_match && teams[0] && teams[1])
	{
		for (uint32 i = 0; i < 2; ++i) {
			uint32 j = i ? 0 : 1; // opposing side
			bool outcome = (i != m_losingteam);
			if (outcome) {
				teams[i]->m_stat_gameswonseason++;
				teams[i]->m_stat_gameswonweek++;
			}

			m_deltaRating[i] = CalcDeltaRating(teams[i]->m_stat_rating, teams[j]->m_stat_rating, outcome);
			teams[i]->m_stat_rating += m_deltaRating[i];
			if ((int32)teams[i]->m_stat_rating < 0) teams[i]->m_stat_rating = 0;

			for (int x=0; x<hashmap_length(m_players2[i]); x++) {
				uint32 key;
				if (MAP_OK == hashmap_get_index(m_players2[i], x, (int*)&key, (any_t*) NULL)) {
					PlayerInfo * info = objmgr.GetPlayerInfo(key);
					if (info) {
						ArenaTeamMember * tp = teams[i]->GetMember(info);

						if(tp != NULL) {
							tp->PersonalRating += CalcDeltaRating(tp->PersonalRating, teams[j]->m_stat_rating, outcome);
							if ((int32)tp->PersonalRating < 0) tp->PersonalRating = 0;

							if(outcome) {
								tp->Won_ThisWeek++;
								tp->Won_ThisSeason++;
							}
						}
					}
				}
			}
			
			teams[i]->SaveToDB();
			// send arena team stats update
			WorldPacket data(256);
			teams[i]->Stat(data);
			teams[i]->SendPacket(&data);
		}
		objmgr.UpdateArenaTeamRankings();
	}

	m_nextPvPUpdateTime = 0;
	UpdatePvPData();
	PlaySoundToAll(m_losingteam ? SOUND_ALLIANCEWINS : SOUND_HORDEWINS);

	sEventMgr.RemoveEvents(shared_from_this(), EVENT_BATTLEGROUND_CLOSE);
	sEventMgr.RemoveEvents(shared_from_this(), EVENT_ARENA_SHADOW_SIGHT);
	sEventMgr.AddEvent(TO_CBATTLEGROUND(shared_from_this()), &CBattleground::Close, EVENT_BATTLEGROUND_CLOSE, 120000, 1,0);

	for(int i = 0; i < 2; i++)
	{
		bool victorious = (i != m_losingteam);
		set<PlayerPointer  >::iterator itr = m_players[i].begin();
		for(; itr != m_players[i].end(); itr++)
		{
			PlayerPointer plr = (PlayerPointer )(*itr);
			plr->Root();

			if( plr->m_bgScore.DamageDone == 0 && plr->m_bgScore.HealingDone == 0 )
				continue;

			sHookInterface.OnArenaFinish(plr, m_arenateamtype, plr->m_playerInfo->arenaTeam[m_arenateamtype], victorious, rated_match);
		}
	}
}
开发者ID:CadeLaRen,项目名称:Xeon-MMORPG-Emulator,代码行数:77,代码来源:Arenas.cpp


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