本文整理汇总了C++中UnitPointer::IsPet方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPointer::IsPet方法的具体用法?C++ UnitPointer::IsPet怎么用?C++ UnitPointer::IsPet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPointer
的用法示例。
在下文中一共展示了UnitPointer::IsPet方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDied
void OnDied( UnitPointer pKiller )
{
PlayerPointer QuestHolder = NULLPLR;
if ( pKiller->IsPlayer() )
QuestHolder = TO_PLAYER( pKiller );
else if ( pKiller->IsPet() && TO_PET( pKiller )->GetPetOwner() != NULLPLR )
QuestHolder = TO_PET( pKiller )->GetPetOwner();
if ( QuestHolder == NULLPLR )
return;
// M4ksiu: I don't think the method is correct, but it can stay the way it was until someone gives proper infos
QuestLogEntry* Quest = QuestHolder->GetQuestLogForEntry( 9670 );
CreaturePointer RandomCreature = NULLCREATURE;
if ( Quest == NULL )
{
// Creatures from Bloodmyst Isle
uint32 Id[ 51 ] = { 17681, 17887, 17550, 17323, 17338, 17341, 17333, 17340, 17353, 17320, 17339, 17337, 17715, 17322, 17494, 17654, 17342, 17328, 17331, 17325, 17321, 17330, 17522, 17329, 17524, 17327, 17661, 17352, 17334, 17326, 17324, 17673, 17336, 17346, 17589, 17609, 17608, 17345, 17527, 17344, 17347, 17525, 17713, 17523, 17348, 17606, 17604, 17607, 17610, 17358, 17588 };
RandomCreature = _unit->GetMapMgr()->GetInterface()->SpawnCreature( Id[ RandomUInt( 50 ) ], _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), _unit->GetOrientation(), true, false, 0, 0 );
if ( RandomCreature != NULLCREATURE )
{
RandomCreature->m_noRespawn = true;
RandomCreature->Despawn( 60000, 0 );
};
return;
}
else
{
uint32 Id[ 8 ] = { 17681, 17321, 17330, 17522, 17673, 17336, 17346, 17589 };
RandomCreature = _unit->GetMapMgr()->GetInterface()->SpawnCreature( Id[ RandomUInt( 7 ) ], _unit->GetPositionX(), _unit->GetPositionY(), _unit->GetPositionZ(), _unit->GetOrientation(), true, false, 0, 0 );
if ( RandomCreature != NULLCREATURE )
{
RandomCreature->m_noRespawn = true;
RandomCreature->Despawn( 60000, 0 );
if ( RandomCreature->GetEntry() == 17681 && Quest->GetMobCount( 0 ) < Quest->GetQuest()->required_mobcount[ 0 ] )
{
Quest->SetMobCount( 0, Quest->GetMobCount( 0 ) + 1 );
Quest->SendUpdateAddKill( 0 );
Quest->UpdatePlayerFields();
};
};
};
};
示例2: CalculateXpToGive
uint32 CalculateXpToGive(UnitPointer pVictim, UnitPointer pAttacker)
{
if(pVictim->IsPlayer())
return 0;
if( TO_CREATURE(pVictim)->IsTotem())
return 0;
CreatureInfo *victimI;
victimI = TO_CREATURE(pVictim)->GetCreatureInfo();
if(victimI)
if(victimI->Type == CRITTER)
return 0;
uint32 VictimLvl = pVictim->getLevel();
uint32 AttackerLvl = pAttacker->getLevel();
if( pAttacker->IsPet() && TO_PET(pAttacker)->GetPetOwner() )
{
// based on: http://www.wowwiki.com/Talk:Formulas:Mob_XP#Hunter.27s_pet_XP (2008/01/12)
uint32 ownerLvl = TO_PET( pAttacker )->GetPetOwner()->getLevel();
VictimLvl += ownerLvl - AttackerLvl;
AttackerLvl = ownerLvl;
}
else if( (int32)VictimLvl - (int32)AttackerLvl > 10 ) //not wowwikilike but more balanced
return 0;
// Partha: this screws things up for pets and groups
// No need for it here - it does this later in Player::GiveXP
/*
uint32 max_level = 70;
if(pAttacker->IsPlayer())
max_level = pAttacker->GetUInt32Value(PLAYER_FIELD_MAX_LEVEL);
else if(pAttacker->IsPet())
max_level = TO_PET( pAttacker )->GetPetOwner()->GetUInt32Value(PLAYER_FIELD_MAX_LEVEL);
if(pAttacker->getLevel() >= max_level)
return 0;
*/
/*if(VictimLvl+7>AttackerLvl)
VictimLvl = AttackerLvl + 7;*/
float zd = 5;
float g = 5;
// get zero diff
// get grey diff
if(AttackerLvl >= 70)
{
zd = 19;
g = 15;
}
else if(AttackerLvl >= 65)
{
zd = 18;
g = 13;
}
else if(AttackerLvl >= 60)
{
zd = 17;
g = 14;
}
else if(AttackerLvl >= 55)
{
zd = 16;
g = 12;
}
else if(AttackerLvl >= 50)
{
zd = 15;
g = 11;
}
else if(AttackerLvl >= 45)
{
zd = 14;
g = 10;
}
else if(AttackerLvl >= 40)
{
zd = 13;
g = 9;
}
else if(AttackerLvl >= 30)
{
zd = 12;
g = 8;
}
else if(AttackerLvl >= 20)
{
zd = 11;
g = 7;
}
else if(AttackerLvl >= 16)
{
zd = 9;
g = 6;
}
//.........这里部分代码省略.........