本文整理汇总了C++中Pet::AIM_Initialize方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::AIM_Initialize方法的具体用法?C++ Pet::AIM_Initialize怎么用?C++ Pet::AIM_Initialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::AIM_Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreatePet
void CPlayer::CreatePet(uint32 entry, bool classcheck)
{
if (classcheck && getClass() != CLASS_HUNTER)
return;
CreatureInfo const *cinfo = sObjectMgr.GetCreatureTemplate(entry);
if (!cinfo)
{
BoxChat << MSG_COLOR_WHITE << " This pet doesn't exist in our database. Please report that creature " << entry << " is missing." << std::endl;
return;
}
CreatureCreatePos pos(GetSession()->GetPlayer(), GetOrientation());
Creature* pCreature = new Creature;
// used guids from specially reserved range (can be 0 if no free values)
uint32 lowguid = sObjectMgr.GenerateStaticCreatureLowGuid();
if (!lowguid)
return;
if (!pCreature->Create(lowguid, pos, cinfo))
{
delete pCreature;
return;
}
//--------------------------------------------------
if (GetPetGuid())
UnsummonPetTemporaryIfAny();
Pet* pet = new Pet(HUNTER_PET);
if (!pet->CreateBaseAtCreature(pCreature))
{
delete pet;
return;
}
pet->SetOwnerGuid(GetObjectGuid());
pet->SetCreatorGuid(GetObjectGuid());
pet->setFaction(getFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, 13481);
if (IsPvP())
pet->SetPvP(true);
if (!pet->InitStatsForLevel(pCreature->getLevel()))
{
sLog.outError("Pet::InitStatsForLevel() failed for creature (Entry: %u)!", pCreature->GetEntry());
delete pet;
return;
}
pet->GetCharmInfo()->SetPetNumber(sObjectMgr.GeneratePetNumber(), true);
// this enables pet details window (Shift+P)
pet->AIM_Initialize();
pet->InitPetCreateSpells();
pet->SetHealth(pet->GetMaxHealth());
// add to world
pet->GetMap()->Add((Creature*)pet);
// visual effect for levelup
pet->SetUInt32Value(UNIT_FIELD_LEVEL, 70);
for (auto x = 0; x < 6; x++)
{
pet->SetPower(POWER_HAPPINESS, 66600000);
pet->ModifyLoyalty(150000);
pet->TickLoyaltyChange();
pet->SetTP(350);
}
// caster have pet now
SetPet(pet);
pet->SavePetToDB(PET_SAVE_AS_CURRENT);
PetSpellInitialize();
pet->learnSpell(27052);
pet->learnSpell(35698);
pet->learnSpell(25076);
pet->learnSpell(27048);
pet->learnSpell(27053);
pet->learnSpell(27054);
pet->learnSpell(27062);
pet->learnSpell(27047);
pet->learnSpell(24551);
delete pCreature;
}