本文整理汇总了C++中UnitPointer::getLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPointer::getLevel方法的具体用法?C++ UnitPointer::getLevel怎么用?C++ UnitPointer::getLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPointer
的用法示例。
在下文中一共展示了UnitPointer::getLevel方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
//.........这里部分代码省略.........