本文整理汇总了C++中ObjectGuid::IsVehicle方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectGuid::IsVehicle方法的具体用法?C++ ObjectGuid::IsVehicle怎么用?C++ ObjectGuid::IsVehicle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectGuid
的用法示例。
在下文中一共展示了ObjectGuid::IsVehicle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleSpellClick
void WorldSession::HandleSpellClick( WorldPacket & recv_data )
{
ObjectGuid guid;
recv_data >> guid;
Creature *unit = _player->GetMap()->GetAnyTypeCreature(guid);
if (!unit)
return;
if (_player->isInCombat() && !guid.IsVehicle()) // client prevent click and set different icon at combat state
return;
if(guid.IsVehicle() && _player->GetVehicleKit())
_player->RemoveVehicleKit();
SpellClickInfoMapBounds clickPair = sObjectMgr.GetSpellClickInfoMapBounds(unit->GetEntry());
for(SpellClickInfoMap::const_iterator itr = clickPair.first; itr != clickPair.second; ++itr)
{
if (itr->second.IsFitToRequirements(_player))
{
Unit *caster = (itr->second.castFlags & 0x1) ? (Unit*)_player : (Unit*)unit;
Unit *target = (itr->second.castFlags & 0x2) ? (Unit*)_player : (Unit*)unit;
if(itr->second.castFlags & 0x4)
{
unit->SetDeathState(JUST_DIED);
unit->RemoveCorpse();
unit->SetHealth(0);
}
caster->CastSpell(target, itr->second.spellId, true, NULL, NULL,caster->GetObjectGuid());
}
}
if (unit->GetObjectGuid().IsVehicle())
{
_player->EnterVehicle(unit->GetVehicleKit());
}
}
示例2: SendPetNameQuery
void WorldSession::SendPetNameQuery( ObjectGuid petguid, uint32 petnumber)
{
//Client asks for data before add to map (or we have wrong teleport sequence), so we cant use GetCreatureOrPetOrVehicle()
Creature* pet = NULL;
if(_player->IsBeingTeleported())
{
Map *map = sMapMgr.FindMap(_player->GetTeleportDest().mapid);
if(map)
{
if (petguid.IsPet())
pet = map->GetPet(petguid);
else if(petguid.IsVehicle())
pet = (Creature*)map->GetVehicle(petguid);
else
pet = map->GetCreature(petguid);
}
}
else
pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
if (!pet || !pet->GetCharmInfo() || pet->GetCharmInfo()->GetPetNumber() != petnumber)
{
std::string name = "NoPetName";
WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+name.size()+1));
data << uint32(petnumber);
data << name.c_str();
data << uint32(time(0));
data << uint8(0);
_player->GetSession()->SendPacket(&data);
// looking for errors
/* if (!pet)
sLog.outError("SendPetNameQuery:: Pet not found, not exist or not in world"); <-------
else if (!pet->GetCharmInfo())
sLog.outError("SendPetNameQuery:: Pet CharmInfo() not found");
else if (pet->GetCharmInfo()->GetPetNumber() != petnumber)
sLog.outError("SendPetNameQuery:: Pet number is not equal to requested petnumber"); */
return;
}
std::string name = pet->GetName();
WorldPacket data(SMSG_PET_NAME_QUERY_RESPONSE, (4+4+name.size()+1));
data << uint32(petnumber);
data << name.c_str();
data << uint32(pet->GetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP));
if ( pet->isPet() && ((Pet*)pet)->GetDeclinedNames() )
{
data << uint8(1);
for(int i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
data << ((Pet*)pet)->GetDeclinedNames()->name[i];
}
else
data << uint8(0);
_player->GetSession()->SendPacket(&data);
}