本文整理汇总了C++中Pet::GetPositionY方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::GetPositionY方法的具体用法?C++ Pet::GetPositionY怎么用?C++ Pet::GetPositionY使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::GetPositionY方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleLoadPetFromDBFirstCallback
uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result, uint8 asynchLoadType)
{
if (!GetPlayer() || GetPlayer()->GetPet() || GetPlayer()->GetVehicle() || GetPlayer()->IsSpectator())
return PET_LOAD_ERROR;
if (!result)
return PET_LOAD_NO_RESULT;
Field* fields = result->Fetch();
// Xinef: this can happen if fetch is called twice, impossibru.
if (!fields)
return PET_LOAD_ERROR;
Player* owner = GetPlayer();
// update for case of current pet "slot = 0"
uint32 petentry = fields[1].GetUInt32();
if (!petentry)
return PET_LOAD_NO_RESULT;
uint8 petSlot = fields[7].GetUInt8();
bool current = petSlot == PET_SAVE_AS_CURRENT;
uint32 summon_spell_id = fields[15].GetUInt32();
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(summon_spell_id); // CANT BE NULL
bool is_temporary_summoned = spellInfo && spellInfo->GetDuration() > 0;
uint32 pet_number = fields[0].GetUInt32();
uint32 savedhealth = fields[10].GetUInt32();
uint32 savedmana = fields[11].GetUInt32();
PetType pet_type = PetType(fields[16].GetUInt8());
// xinef: BG resurrect, overwrite saved value
if (asynchLoadType == PET_LOAD_BG_RESURRECT)
savedhealth = 1;
if (pet_type == HUNTER_PET && savedhealth == 0 && asynchLoadType != PET_LOAD_SUMMON_DEAD_PET)
{
WorldPacket data(SMSG_CAST_FAILED, 1+4+1+4);
data << uint8(0);
data << uint32(883);
data << uint8(SPELL_FAILED_TARGETS_DEAD);
SendPacket(&data);
owner->RemoveSpellCooldown(883, false);
return PET_LOAD_ERROR;
}
// check temporary summoned pets like mage water elemental
if (current && is_temporary_summoned)
return PET_LOAD_ERROR;
if (pet_type == HUNTER_PET)
{
CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(petentry);
if (!creatureInfo || !creatureInfo->IsTameable(owner->CanTameExoticPets()))
return PET_LOAD_ERROR;
}
Map* map = owner->GetMap();
uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
Pet* pet = new Pet(owner, pet_type);
LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(time(NULL) - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana);
if (!pet->Create(guid, map, owner->GetPhaseMask(), petentry, pet_number) || !holder->Initialize())
{
delete pet;
delete holder;
return PET_LOAD_ERROR;
}
float px, py, pz;
owner->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle());
if (!pet->IsPositionValid())
{
sLog->outError("Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
delete pet;
delete holder;
return PET_LOAD_ERROR;
}
pet->SetLoading(true);
pet->Relocate(px, py, pz, owner->GetOrientation());
pet->setPetType(pet_type);
pet->setFaction(owner->getFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
if (pet->IsCritter())
{
map->AddToMap(pet->ToCreature(), true);
pet->SetLoading(false); // xinef, mine
delete holder;
return PET_LOAD_OK;
}
pet->GetCharmInfo()->SetPetNumber(pet_number, pet->IsPermanentPetFor(owner));
pet->SetDisplayId(fields[3].GetUInt32());
pet->SetNativeDisplayId(fields[3].GetUInt32());
uint32 petlevel = fields[4].GetUInt8();
pet->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
pet->SetName(fields[8].GetString());
//.........这里部分代码省略.........