本文整理汇总了C++中Pet::GetGuidStr方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::GetGuidStr方法的具体用法?C++ Pet::GetGuidStr怎么用?C++ Pet::GetGuidStr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::GetGuidStr方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandlePetUnlearnOpcode
void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
{
DETAIL_LOG("CMSG_PET_UNLEARN");
ObjectGuid guid;
recvPacket >> guid; // Pet guid
Pet* pet = _player->GetPet();
if (!pet || guid != pet->GetObjectGuid())
{
sLog.outError("HandlePetUnlearnOpcode. %s isn't pet of %s .", guid.GetString().c_str(), GetPlayer()->GetGuidStr().c_str());
return;
}
if (pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0)
return;
CharmInfo *charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
sLog.outError("WorldSession::HandlePetUnlearnOpcode: %s is considered pet-like but doesn't have a charminfo!", pet->GetGuidStr().c_str());
return;
}
pet->resetTalents();
_player->SendTalentsInfoData(true);
}
示例2: HandlePetUnlearnOpcode
void WorldSession::HandlePetUnlearnOpcode(WorldPacket& recvPacket)
{
DETAIL_LOG("CMSG_PET_UNLEARN");
ObjectGuid guid;
recvPacket >> guid; // Pet guid
Pet* pet = _player->GetPet();
if (!pet || guid != pet->GetObjectGuid())
{
sLog.outError("HandlePetUnlearnOpcode. %s isn't pet of %s .", guid.GetString().c_str(), _player->GetGuidStr().c_str());
return;
}
if (pet->getPetType() != HUNTER_PET || pet->m_spells.size() <= 1)
return;
CharmInfo* charmInfo = pet->GetCharmInfo();
if (!charmInfo)
{
sLog.outError("WorldSession::HandlePetUnlearnOpcode: %s is considered pet-like but doesn't have a charminfo!", pet->GetGuidStr().c_str());
return;
}
uint32 cost = pet->resetTalentsCost();
if (_player->GetMoney() < cost)
{
_player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, 0, 0, 0);
return;
}
for (PetSpellMap::iterator itr = pet->m_spells.begin(); itr != pet->m_spells.end();)
{
uint32 spell_id = itr->first; // Pet::removeSpell can invalidate iterator at erase NEW spell
++itr;
pet->unlearnSpell(spell_id, false);
}
pet->SetTP(pet->getLevel() * (pet->GetLoyaltyLevel() - 1));
for (int i = 0; i < MAX_UNIT_ACTION_BAR_INDEX; ++i)
if (UnitActionBarEntry const* ab = charmInfo->GetActionBarEntry(i))
if (ab->GetAction() && ab->IsActionBarForSpell())
charmInfo->SetActionBar(i, 0, ACT_DISABLED);
// relearn pet passives
pet->LearnPetPassives();
pet->m_resetTalentsTime = time(nullptr);
pet->m_resetTalentsCost = cost;
_player->ModifyMoney(-(int32)cost);
_player->PetSpellInitialize();
}