本文整理汇总了C++中Pet::CastPetAuras方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::CastPetAuras方法的具体用法?C++ Pet::CastPetAuras怎么用?C++ Pet::CastPetAuras使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::CastPetAuras方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UpdateStats
bool Player::UpdateStats(Stats stat)
{
if(stat > STAT_SPIRIT)
return false;
// value = ((base_value * base_pct) + total_value) * total_pct
float value = GetTotalStatValue(stat);
SetStat(stat, int32(value));
//DK ghoul benefit from owner strength
if(stat == STAT_STAMINA || stat == STAT_INTELLECT || stat == STAT_STRENGTH)
{
Pet *pet = GetPet();
if(pet)
{
pet->UpdateStats(stat);
if (getClass() == CLASS_DEATH_KNIGHT && pet->getPetType() == SUMMON_PET)
{
pet->RemoveAllAuras();
pet->CastPetAuras(true);
}
}
}
switch(stat)
{
case STAT_STRENGTH:
UpdateShieldBlockValue();
break;
case STAT_AGILITY:
UpdateArmor();
UpdateAllCritPercentages();
UpdateDodgePercentage();
break;
case STAT_STAMINA: UpdateMaxHealth(); break;
case STAT_INTELLECT:
UpdateMaxPower(POWER_MANA);
UpdateAllSpellCritChances();
UpdateArmor(); //SPELL_AURA_MOD_RESISTANCE_OF_INTELLECT_PERCENT, only armor currently
break;
case STAT_SPIRIT:
break;
default:
break;
}
// Need update (exist AP from stat auras)
UpdateAttackPowerAndDamage();
UpdateAttackPowerAndDamage(true);
UpdateSpellDamageAndHealingBonus();
UpdateManaRegen();
// Update ratings in exist SPELL_AURA_MOD_RATING_FROM_STAT and only depends from stat
uint32 mask = 0;
AuraList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
for(AuraList::const_iterator i = modRatingFromStat.begin();i != modRatingFromStat.end(); ++i)
if (Stats((*i)->GetMiscBValue()) == stat)
mask |= (*i)->GetMiscValue();
if (mask)
{
for (uint32 rating = 0; rating < MAX_COMBAT_RATING; ++rating)
if (mask & (1 << rating))
ApplyRatingMod(CombatRating(rating), 0, true);
}
return true;
}
示例2: HandleLoadPetFromDBSecondCallback
void WorldSession::HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder* holder)
{
if (!GetPlayer())
return;
Player* owner = GetPlayer();
Pet* pet = owner->GetPet();
if (!pet)
return;
pet->_LoadAuras(holder->GetPreparedResult(PET_LOAD_QUERY_LOADAURAS), holder->GetDiffTime());
bool current = holder->GetCurrent();
uint32 summon_spell_id = pet->GetUInt32Value(UNIT_CREATED_BY_SPELL);
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summon_spell_id); // CANT BE NULL
bool is_temporary_summoned = spellInfo && spellInfo->GetDuration() > 0;
// load action bar, if data broken will fill later by default spells.
if (!is_temporary_summoned)
{
pet->_LoadSpells(holder->GetPreparedResult(PET_LOAD_QUERY_LOADSPELLS));
pet->InitTalentForLevel(); // re-init to check talent count
pet->_LoadSpellCooldowns(holder->GetPreparedResult(PET_LOAD_QUERY_LOADSPELLCOOLDOWN));
pet->LearnPetPassives();
pet->InitLevelupSpellsForLevel();
pet->CastPetAuras(current);
pet->GetCharmInfo()->LoadPetActionBar(holder->GetActionBar()); // action bar stored in already read string
}
pet->CleanupActionBar(); // remove unknown spells from action bar after load
owner->PetSpellInitialize();
owner->SendTalentsInfoData(true);
if (owner->GetGroup())
owner->SetGroupUpdateFlag(GROUP_UPDATE_PET);
//set last used pet number (for use in BG's)
if (owner->GetTypeId() == TYPEID_PLAYER && pet->isControlled() && !pet->isTemporarySummoned() && (pet->getPetType() == SUMMON_PET || pet->getPetType() == HUNTER_PET))
{
owner->ToPlayer()->SetLastPetNumber(holder->GetPetNumber());
owner->SetLastPetSpell(pet->GetUInt32Value(UNIT_CREATED_BY_SPELL));
}
if (pet->getPetType() == SUMMON_PET && !current) //all (?) summon pets come with full health when called, but not when they are current
{
pet->SetPower(POWER_MANA, pet->GetMaxPower(POWER_MANA));
pet->SetHealth(pet->GetMaxHealth());
}
else
{
if (!holder->GetSavedHealth() && pet->getPetType() == HUNTER_PET && pet->GetAsynchLoadType() != PET_LOAD_SUMMON_DEAD_PET)
pet->setDeathState(JUST_DIED);
else
{
pet->SetHealth(holder->GetSavedHealth() > pet->GetMaxHealth() ? pet->GetMaxHealth() : holder->GetSavedHealth());
pet->SetPower(POWER_MANA, holder->GetSavedMana() > pet->GetMaxPower(POWER_MANA) ? pet->GetMaxPower(POWER_MANA) : holder->GetSavedMana());
}
}
pet->SetLoading(false);
owner->SetTemporaryUnsummonedPetNumber(0); // clear this only if pet is loaded successfuly
// current
if (current && owner->IsPetNeedBeTemporaryUnsummoned())
{
owner->UnsummonPetTemporaryIfAny();
return;
}
pet->HandleAsynchLoadSucceed();
return;
}