本文整理汇总了C++中UnitPointer::getClass方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPointer::getClass方法的具体用法?C++ UnitPointer::getClass怎么用?C++ UnitPointer::getClass使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPointer
的用法示例。
在下文中一共展示了UnitPointer::getClass方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnPlayerKilledUnit
void HonorHandler::OnPlayerKilledUnit( PlayerPointer pPlayer, UnitPointer pVictim )
{
if( pVictim == NULL || pPlayer == NULL || !pVictim->IsPlayer() || !pPlayer->IsPlayer() )
return;
if( TO_PLAYER( pVictim )->m_honorless )
return;
if( pVictim->IsPlayer() )
{
if( pPlayer->m_bg )
{
if( TO_PLAYER( pVictim )->m_bgTeam == pPlayer->m_bgTeam )
return;
// patch 2.4, players killed >50 times in battlegrounds won't be worth honor for the rest of that bg
if( TO_PLAYER(pVictim)->m_bgScore.Deaths >= 50 )
return;
}
else
{
if( pPlayer->GetTeam() == TO_PLAYER( pVictim )->GetTeam() )
return;
}
}
// Calculate points
int32 Points = CalculateHonorPointsForKill(pPlayer, pVictim);
if( Points > 0 )
{
if( pPlayer->m_bg )
{
// hackfix for battlegrounds (since the gorups there are disabled, we need to do this manually)
vector<PlayerPointer > toadd;
uint32 t = pPlayer->m_bgTeam;
toadd.reserve(15); // shouldnt have more than this
pPlayer->m_bg->Lock();
set<PlayerPointer > * s = &pPlayer->m_bg->m_players[t];
for(set<PlayerPointer >::iterator itr = s->begin(); itr != s->end(); ++itr)
{
if((*itr) == pPlayer || (*itr)->isInRange(pPlayer,40.0f))
toadd.push_back(*itr);
}
if( toadd.size() > 0 )
{
uint32 pts = Points / (uint32)toadd.size();
for(vector<PlayerPointer >::iterator vtr = toadd.begin(); vtr != toadd.end(); ++vtr)
{
AddHonorPointsToPlayer(*vtr, pts);
(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKill();
(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillClass( pVictim->getClass() );
(*vtr)->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillRace( pVictim->getRace() );
(*vtr)->m_killsToday++;
(*vtr)->m_killsLifetime++;
pPlayer->m_bg->HookOnHK(*vtr);
if(pVictim)
{
// Send PVP credit
WorldPacket data(SMSG_PVP_CREDIT, 12);
uint32 pvppoints = pts * 10;
data << pvppoints << pVictim->GetGUID() << uint32(TO_PLAYER(pVictim)->GetPVPRank());
(*vtr)->GetSession()->SendPacket(&data);
}
}
}
pPlayer->m_bg->Unlock();
}
else if(pPlayer->GetGroup())
{
Group *pGroup = pPlayer->GetGroup();
PlayerPointer gPlayer = NULLPLR;
int32 GroupPoints;
pGroup->Lock();
GroupPoints = (Points / (pGroup->MemberCount() ? pGroup->MemberCount() : 1));
GroupMembersSet::iterator gitr;
for(uint32 k = 0; k < pGroup->GetSubGroupCount(); k++)
{
for(gitr = pGroup->GetSubGroup(k)->GetGroupMembersBegin(); gitr != pGroup->GetSubGroup(k)->GetGroupMembersEnd(); ++gitr)
{
gPlayer = (*gitr)->m_loggedInPlayer;
if(gPlayer && (gPlayer == pPlayer || gPlayer->isInRange(pPlayer,100.0f))) // visible range
{
gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKill();
gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillClass( pVictim->getClass() );
gPlayer->GetAchievementInterface()->HandleAchievementCriteriaHonorableKillRace( pVictim->getRace() );
gPlayer->m_killsToday++;
gPlayer->m_killsLifetime++;
if(gPlayer->m_bg)
gPlayer->m_bg->HookOnHK(gPlayer);
sHookInterface.OnHonorableKill(gPlayer, TO_PLAYER(pVictim));
AddHonorPointsToPlayer(gPlayer, GroupPoints);
if(pVictim)
//.........这里部分代码省略.........