本文整理汇总了C++中Pet::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Pet::GetName方法的具体用法?C++ Pet::GetName怎么用?C++ Pet::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pet
的用法示例。
在下文中一共展示了Pet::GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SendStablePet
void WorldSession::SendStablePet(uint64 guid )
{
sLog.outDebug("WORLD: Recv MSG_LIST_STABLED_PETS Send.");
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
data << uint64 ( guid );
Pet *pet = _player->GetPet();
size_t wpos = data.wpos();
data << uint8(0); // place holder for slot show number
data << uint8(GetPlayer()->m_stableSlots);
uint8 num = 0; // counter for place holder
// not let move dead pet in slot
if(pet && pet->isAlive() && pet->getPetType()==HUNTER_PET)
{
data << uint32(pet->GetCharmInfo()->GetPetNumber());
data << uint32(pet->GetEntry());
data << uint32(pet->getLevel());
data << pet->GetName(); // petname
data << uint8(1); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show)
++num;
}
// 0 1 2 3 4
QueryResult* result = CharacterDatabase.PQuery("SELECT owner, id, entry, level, name FROM character_pet WHERE owner = '%u' AND slot >= '%u' AND slot <= '%u' ORDER BY slot",
_player->GetGUIDLow(),PET_SAVE_FIRST_STABLE_SLOT,PET_SAVE_LAST_STABLE_SLOT);
if(result)
{
do
{
Field *fields = result->Fetch();
data << uint32(fields[1].GetUInt32()); // petnumber
data << uint32(fields[2].GetUInt32()); // creature entry
data << uint32(fields[3].GetUInt32()); // level
data << fields[4].GetString(); // name
data << uint8(2); // 1 = current, 2/3 = in stable (any from 4,5,... create problems with proper show)
++num;
}while( result->NextRow() );
delete result;
}
data.put<uint8>(wpos, num); // set real data to placeholder
SendPacket(&data);
}
示例2: SendStablePetCallback
void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid)
{
if (!GetPlayer())
return;
TC_LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS Send.");
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
data << uint64 (guid);
Pet* pet = _player->GetPet();
size_t wpos = data.wpos();
data << uint8(0); // place holder for slot show number
data << uint8(GetPlayer()->m_stableSlots);
uint8 num = 0; // counter for place holder
// not let move dead pet in slot
if (pet && pet->IsAlive() && pet->getPetType() == HUNTER_PET)
{
data << uint32(pet->GetCharmInfo()->GetPetNumber());
data << uint32(pet->GetEntry());
data << uint32(pet->getLevel());
data << pet->GetName(); // petname
data << uint8(1); // 1 = current, 2/3 = in stable (any from 4, 5, ... create problems with proper show)
++num;
}
if (result)
{
do
{
Field* fields = result->Fetch();
data << uint32(fields[1].GetUInt32()); // petnumber
data << uint32(fields[2].GetUInt32()); // creature entry
data << uint32(fields[3].GetUInt16()); // level
data << fields[4].GetString(); // name
data << uint8(2); // 1 = current, 2/3 = in stable (any from 4, 5, ... create problems with proper show)
++num;
}
while (result->NextRow());
}
data.put<uint8>(wpos, num); // set real data to placeholder
SendPacket(&data);
}
示例3: SendStablePetCallback
void WorldSession::SendStablePetCallback(ObjectGuid guid, PreparedQueryResult result)
{
if (!GetPlayer())
return;
WorldPackets::Pet::PetStableList packet;
packet.StableMaster = guid;
Pet* pet = _player->GetPet();
int32 petSlot = 0;
// not let move dead pet in slot
if (pet && pet->IsAlive() && pet->getPetType() == HUNTER_PET)
{
WorldPackets::Pet::PetStableInfo stableEntry;
stableEntry.PetSlot = petSlot;
stableEntry.PetNumber = pet->GetCharmInfo()->GetPetNumber();
stableEntry.CreatureID = pet->GetEntry();
stableEntry.DisplayID = pet->GetDisplayId();
stableEntry.ExperienceLevel = pet->getLevel();
stableEntry.PetFlags = PET_STABLE_ACTIVE;
stableEntry.PetName = pet->GetName();
++petSlot;
packet.Pets.push_back(stableEntry);
}
if (result)
{
do
{
Field* fields = result->Fetch();
WorldPackets::Pet::PetStableInfo stableEntry;
stableEntry.PetSlot = petSlot;
stableEntry.PetNumber = fields[1].GetUInt32(); // petnumber
stableEntry.CreatureID = fields[2].GetUInt32(); // creature entry
stableEntry.DisplayID = fields[5].GetUInt32(); // creature displayid
stableEntry.ExperienceLevel = fields[3].GetUInt16(); // level
stableEntry.PetFlags = PET_STABLE_INACTIVE;
stableEntry.PetName = fields[4].GetString(); // Name
++petSlot;
packet.Pets.push_back(stableEntry);
}
while (result->NextRow());
}
SendPacket(packet.Write());
}
示例4: SendStablePet
void WorldSession::SendStablePet(uint64 guid)
{
sLog->outDebug("WORLD: Recv MSG_LIST_STABLED_PETS Send.");
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
data << uint64 (guid);
Pet *pet = _player->GetPet();
data << uint8(0); // place holder for slot show number
data << uint8(GetPlayer()->m_stableSlots);
uint8 num = 0; // counter for place holder
// not let move dead pet in slot
if (pet && pet->isAlive() && pet->getPetType() == HUNTER_PET)
{
data << uint32(pet->GetCharmInfo()->GetPetNumber());
data << uint32(pet->GetEntry());
data << uint32(pet->getLevel());
data << pet->GetName(); // petname
data << uint32(pet->GetLoyaltyLevel()); // loyalty
data << uint8(0x01); // client slot 1 == current pet (0)
++num;
}
// 0 1 2 3 4 5 6
QueryResult_AutoPtr result = CharacterDatabase.PQuery("SELECT owner, slot, id, entry, level, loyalty, name FROM character_pet WHERE owner = '%u' AND slot > 0 AND slot < 3", _player->GetGUIDLow());
if (result)
{
do
{
Field *fields = result->Fetch();
data << uint32(fields[2].GetUInt32()); // petnumber
data << uint32(fields[3].GetUInt32()); // creature entry
data << uint32(fields[4].GetUInt32()); // level
data << fields[6].GetString(); // name
data << uint32(fields[5].GetUInt32()); // loyalty
data << uint8(fields[1].GetUInt32()+1); // slot
++num;
}while (result->NextRow());
}
data.put<uint8>(8, num); // set real data to placeholder
SendPacket(&data);
}
示例5: HandleRequestPartyMemberStatsOpcode
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
{
DEBUG_LOG("WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
ObjectGuid guid;
recv_data >> guid;
Player *player = sObjectMgr.GetPlayer(guid);
if(!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data << guid.WriteAsPacked();
data << uint32(GROUP_UPDATE_FLAG_STATUS);
data << uint16(MEMBER_STATUS_OFFLINE);
SendPacket(&data);
return;
}
Pet *pet = player->GetPet();
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data << player->GetPackGUID();
uint32 mask1 = 0x00040BFF; // common mask, real flags used 0x000040BFF
if(pet)
mask1 = 0x7FFFFFFF; // for hunters and other classes with pets
Powers powerType = player->getPowerType();
data << uint32(mask1); // group update mask
data << uint16(MEMBER_STATUS_ONLINE); // member's online status
data << uint32(player->GetHealth()); // GROUP_UPDATE_FLAG_CUR_HP
data << uint32(player->GetMaxHealth()); // GROUP_UPDATE_FLAG_MAX_HP
data << uint8(powerType); // GROUP_UPDATE_FLAG_POWER_TYPE
data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER
data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER
data << uint16(player->getLevel()); // GROUP_UPDATE_FLAG_LEVEL
data << uint16(player->GetZoneId()); // GROUP_UPDATE_FLAG_ZONE
data << uint16(player->GetPositionX()); // GROUP_UPDATE_FLAG_POSITION
data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION
uint64 auramask = 0;
size_t maskPos = data.wpos();
data << uint64(auramask); // placeholder
for(uint8 i = 0; i < MAX_AURAS; ++i)
{
if(uint32 aura = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << uint32(aura);
data << uint8(1);
}
}
data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS
if(pet)
{
Powers petpowertype = pet->getPowerType();
data << pet->GetObjectGuid(); // GROUP_UPDATE_FLAG_PET_GUID
data << pet->GetName(); // GROUP_UPDATE_FLAG_PET_NAME
data << uint16(pet->GetDisplayId()); // GROUP_UPDATE_FLAG_PET_MODEL_ID
data << uint32(pet->GetHealth()); // GROUP_UPDATE_FLAG_PET_CUR_HP
data << uint32(pet->GetMaxHealth()); // GROUP_UPDATE_FLAG_PET_MAX_HP
data << uint8(petpowertype); // GROUP_UPDATE_FLAG_PET_POWER_TYPE
data << uint16(pet->GetPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_CUR_POWER
data << uint16(pet->GetMaxPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_MAX_POWER
uint64 petauramask = 0;
size_t petMaskPos = data.wpos();
data << uint64(petauramask); // placeholder
for(uint8 i = 0; i < MAX_AURAS; ++i)
{
if(uint32 petaura = pet->GetVisibleAura(i))
{
petauramask |= (uint64(1) << i);
data << uint32(petaura);
data << uint8(1);
}
}
data.put<uint64>(petMaskPos, petauramask); // GROUP_UPDATE_FLAG_PET_AURAS
}
else
{
data << uint8(0); // GROUP_UPDATE_FLAG_PET_NAME
data << uint64(0); // GROUP_UPDATE_FLAG_PET_AURAS
}
SendPacket(&data);
}
示例6: BuildPartyMemberStatsChangedPacket
void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data)
{
uint32 mask = player->GetGroupUpdateFlag();
if (mask == GROUP_UPDATE_FLAG_NONE)
return;
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
mask |= (GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER);
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) // same for pets
mask |= (GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER);
uint32 byteCount = 0;
for (int i = 1; i < GROUP_UPDATE_FLAGS_COUNT; ++i)
if (mask & (1 << i))
byteCount += GroupUpdateLength[i];
data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount);
*data << player->GetPackGUID();
*data << uint32(mask);
if (mask & GROUP_UPDATE_FLAG_STATUS)
{
uint16 playerStatus = MEMBER_STATUS_ONLINE;
if (player->IsPvP())
playerStatus |= MEMBER_STATUS_PVP;
if (!player->IsAlive())
{
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
playerStatus |= MEMBER_STATUS_GHOST;
else
playerStatus |= MEMBER_STATUS_DEAD;
}
if (player->IsFFAPvP())
playerStatus |= MEMBER_STATUS_PVP_FFA;
if (player->isAFK())
playerStatus |= MEMBER_STATUS_AFK;
if (player->isDND())
playerStatus |= MEMBER_STATUS_DND;
*data << uint16(playerStatus);
}
if (mask & GROUP_UPDATE_FLAG_CUR_HP)
*data << uint32(player->GetHealth());
if (mask & GROUP_UPDATE_FLAG_MAX_HP)
*data << uint32(player->GetMaxHealth());
Powers powerType = player->getPowerType();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE)
*data << uint8(powerType);
if (mask & GROUP_UPDATE_FLAG_CUR_POWER)
*data << uint16(player->GetPower(powerType));
if (mask & GROUP_UPDATE_FLAG_MAX_POWER)
*data << uint16(player->GetMaxPower(powerType));
if (mask & GROUP_UPDATE_FLAG_LEVEL)
*data << uint16(player->getLevel());
if (mask & GROUP_UPDATE_FLAG_ZONE)
*data << uint16(player->GetZoneId());
if (mask & GROUP_UPDATE_FLAG_POSITION)
{
*data << uint16(player->GetPositionX());
*data << uint16(player->GetPositionY());
}
if (mask & GROUP_UPDATE_FLAG_AURAS)
{
uint64 auramask = player->GetAuraUpdateMaskForRaid();
*data << uint64(auramask);
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
if (auramask & (uint64(1) << i))
{
AuraApplication const* aurApp = player->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
*data << uint8(1);
}
}
}
Pet* pet = player->GetPet();
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
{
if (pet)
*data << (uint64) pet->GetGUID();
else
*data << (uint64) 0;
}
//.........这里部分代码省略.........
示例7: BuildPartyMemberStatsChangedPacket
void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data)
{
uint32 mask = player->GetGroupUpdateFlag();
if (mask == GROUP_UPDATE_FLAG_NONE)
return;
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
mask |= (GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER);
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) // same for pets
mask |= (GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER);
uint32 byteCount = 0;
for (int i = 1; i < GROUP_UPDATE_FLAGS_COUNT; ++i)
if (mask & (1 << i))
byteCount += GroupUpdateLength[i];
data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount);
*data << player->GetPackGUID();
*data << uint32(mask);
if (mask & GROUP_UPDATE_FLAG_STATUS)
{
if (player)
{
if (player->IsPvP())
*data << (uint16) (MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP);
else
*data << (uint16) MEMBER_STATUS_ONLINE;
}
else
*data << (uint16) MEMBER_STATUS_OFFLINE;
}
if (mask & GROUP_UPDATE_FLAG_CUR_HP)
*data << (uint16) player->GetHealth();
if (mask & GROUP_UPDATE_FLAG_MAX_HP)
*data << (uint16) player->GetMaxHealth();
Powers powerType = player->getPowerType();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE)
*data << (uint8) powerType;
if (mask & GROUP_UPDATE_FLAG_CUR_POWER)
*data << (uint16) player->GetPower(powerType);
if (mask & GROUP_UPDATE_FLAG_MAX_POWER)
*data << (uint16) player->GetMaxPower(powerType);
if (mask & GROUP_UPDATE_FLAG_LEVEL)
*data << (uint16) player->getLevel();
if (mask & GROUP_UPDATE_FLAG_ZONE)
*data << (uint16) player->GetZoneId();
if (mask & GROUP_UPDATE_FLAG_POSITION)
*data << (uint16) player->GetPositionX() << (uint16) player->GetPositionY();
if (mask & GROUP_UPDATE_FLAG_AURAS)
{
uint64 auramask = player->GetAuraUpdateMask();
*data << uint64(auramask);
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
if (auramask & (uint64(1) << i))
{
uint32 updatedAura=player->GetUInt32Value(uint16(UNIT_FIELD_AURA + i));
*data << uint16(updatedAura);
*data << uint8(1);
}
}
}
Pet *pet = player->GetPet();
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
{
if (pet)
*data << (uint64) pet->GetGUID();
else
*data << (uint64) 0;
}
if (mask & GROUP_UPDATE_FLAG_PET_NAME)
{
if (pet)
*data << pet->GetName();
else
*data << (uint8) 0;
}
if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID)
{
if (pet)
*data << (uint16) pet->GetDisplayId();
else
*data << (uint16) 0;
}
//.........这里部分代码省略.........
示例8: BuildPartyMemberStatsChangedPacket
void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data)
{
uint32 mask = player->GetGroupUpdateFlag();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
mask |= (GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER);
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) // same for pets
mask |= (GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER);
uint32 byteCount = 0;
for (int i = 1; i < GROUP_UPDATE_FLAGS_COUNT; ++i)
{
if (mask & (1 << i))
byteCount += GroupUpdateLength[i];
}
data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount);
*data << player->GetPackGUID();
*data << uint32(mask);
if (mask & GROUP_UPDATE_FLAG_STATUS)
{
uint16 playerStatus = MEMBER_STATUS_ONLINE;
if (player->IsPvP())
playerStatus |= MEMBER_STATUS_PVP;
if (!player->isAlive())
{
if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
playerStatus |= MEMBER_STATUS_GHOST;
else
playerStatus |= MEMBER_STATUS_DEAD;
}
if (player->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
playerStatus |= MEMBER_STATUS_PVP_FFA;
if (player->isAFK())
playerStatus |= MEMBER_STATUS_AFK;
if (player->isDND())
playerStatus |= MEMBER_STATUS_DND;
*data << uint16(playerStatus);
}
if (mask & GROUP_UPDATE_FLAG_CUR_HP)
*data << uint32(player->GetHealth());
if (mask & GROUP_UPDATE_FLAG_MAX_HP)
*data << uint32(player->GetMaxHealth());
Powers powerType = player->getPowerType();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE)
*data << uint8(powerType);
if (mask & GROUP_UPDATE_FLAG_CUR_POWER)
*data << uint16(player->GetPower(powerType));
if (mask & GROUP_UPDATE_FLAG_MAX_POWER)
*data << uint16(player->GetMaxPower(powerType));
if (mask & GROUP_UPDATE_FLAG_LEVEL)
*data << uint16(player->getLevel());
if (mask & GROUP_UPDATE_FLAG_ZONE)
*data << uint16(player->GetZoneId());
if (mask & GROUP_UPDATE_FLAG_POSITION)
*data << uint16(player->GetPositionX()) << uint16(player->GetPositionY());
if (mask & GROUP_UPDATE_FLAG_AURAS)
{
const uint64& auraMask = player->GetAuraUpdateMask();
*data << uint64(auraMask);
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
if (auraMask & (uint64(1) << i))
{
SpellAuraHolderPtr holder = player->GetVisibleAura(i);
*data << uint32(holder ? holder->GetId() : 0);
*data << uint8(holder ? holder->GetAuraFlags() : 0);
}
}
}
Pet* pet = player->GetPet();
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
*data << (pet ? pet->GetObjectGuid() : ObjectGuid());
if (mask & GROUP_UPDATE_FLAG_PET_NAME)
*data << (pet ? pet->GetName() : uint8(0));
if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID)
*data << uint16(pet ? pet->GetDisplayId() : 0);
//.........这里部分代码省略.........
示例9: HandleRequestPartyMemberStatsOpcode
//.........这里部分代码省略.........
// GROUP_UPDATE_FLAG_AURAS
data << uint8(1);
uint64 auramask = 0;
size_t maskPos = data.wpos();
data << uint64(auramask); // placeholder
data << uint32(MAX_AURAS); // count
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if (AuraApplication const* aurApp = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << uint32(aurApp->GetBase()->GetId());
data << uint16(aurApp->GetFlags());
if (aurApp->GetFlags() & AFLAG_ANY_EFFECT_AMOUNT_SENT)
{
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(i))
data << int32(eff->GetAmount());
else
data << int32(0);
}
}
}
}
data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS
if (updateFlags & GROUP_UPDATE_FLAG_PET_GUID)
data << uint64(pet->GetGUID());
data << std::string(pet ? pet->GetName() : ""); // GROUP_UPDATE_FLAG_PET_NAME
data << uint16(pet ? pet->GetDisplayId() : 0); // GROUP_UPDATE_FLAG_PET_MODEL_ID
if (updateFlags & GROUP_UPDATE_FLAG_PET_CUR_HP)
data << uint32(pet->GetHealth());
if (updateFlags & GROUP_UPDATE_FLAG_PET_MAX_HP)
data << uint32(pet->GetMaxHealth());
if (updateFlags & GROUP_UPDATE_FLAG_PET_POWER_TYPE)
data << (uint8)pet->getPowerType();
if (updateFlags & GROUP_UPDATE_FLAG_PET_CUR_POWER)
data << uint16(pet->GetPower(pet->getPowerType()));
if (updateFlags & GROUP_UPDATE_FLAG_PET_MAX_POWER)
data << uint16(pet->GetMaxPower(pet->getPowerType()));
uint64 petAuraMask = 0;
maskPos = data.wpos();
data << uint64(petAuraMask); // placeholder
if (pet)
{
// GROUP_UPDATE_FLAG_PET_AURAS
data << uint8(1);
uint64 petauramask = 0;
size_t petMaskPos = data.wpos();
data << uint64(petauramask); // placeholder
data << uint32(MAX_AURAS); // count
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if (AuraApplication const* aurApp = pet->GetVisibleAura(i))
示例10: HandleRequestPartyMemberStatsOpcode
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
{
DEBUG_LOG("WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
ObjectGuid guid;
recv_data >> guid;
Player * player = HashMapHolder<Player>::Find(guid);
if(!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data << guid.WriteAsPacked();
data << uint32(GROUP_UPDATE_FLAG_STATUS);
data << uint16(MEMBER_STATUS_OFFLINE);
SendPacket(&data);
return;
}
Pet *pet = player->GetPet();
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data << player->GetPackGUID();
uint32 mask1 = 0x00040BFF; // common mask, real flags used 0x000040BFF
if(pet)
mask1 = 0x7FFFFFFF; // for hunters and other classes with pets
uint16 online_status = MEMBER_STATUS_ONLINE;
Powers powerType = player->getPowerType();
data << uint32(mask1); // group update mask
data << uint16(online_status); // member's online status
data << uint32(player->GetHealth()); // GROUP_UPDATE_FLAG_CUR_HP
data << uint32(player->GetMaxHealth()); // GROUP_UPDATE_FLAG_MAX_HP
data << uint8(powerType); // GROUP_UPDATE_FLAG_POWER_TYPE
data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER
data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER
data << uint16(player->getLevel()); // GROUP_UPDATE_FLAG_LEVEL
//verify player coordinates and zoneid to send to teammates
uint16 iZoneId = 0;
uint16 iCoordX = 0;
uint16 iCoordY = 0;
if (player->IsInWorld())
{
iZoneId = player->GetZoneId();
iCoordX = player->GetPositionX();
iCoordY = player->GetPositionY();
}
else if (player->IsBeingTeleported()) // Player is in teleportation
{
WorldLocation& loc = player->GetTeleportDest(); // So take teleportation destination
iZoneId = sTerrainMgr.GetZoneId(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z);
iCoordX = loc.coord_x;
iCoordY = loc.coord_y;
}
else
{
//unknown player status.
}
data << uint16(iZoneId); // GROUP_UPDATE_FLAG_ZONE
data << uint16(iCoordX); // GROUP_UPDATE_FLAG_POSITION
data << uint16(iCoordY); // GROUP_UPDATE_FLAG_POSITION
uint64 auramask = 0;
size_t maskPos = data.wpos();
data << uint64(auramask); // placeholder
for(uint8 i = 0; i < MAX_AURAS; ++i)
{
MAPLOCK_READ(player,MAP_LOCK_TYPE_AURAS);
if(uint32 aura = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << uint32(aura);
data << uint8(1);
}
}
data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS
if(pet)
{
Powers petpowertype = pet->getPowerType();
data << pet->GetObjectGuid(); // GROUP_UPDATE_FLAG_PET_GUID
data << pet->GetName(); // GROUP_UPDATE_FLAG_PET_NAME
data << uint16(pet->GetDisplayId()); // GROUP_UPDATE_FLAG_PET_MODEL_ID
data << uint32(pet->GetHealth()); // GROUP_UPDATE_FLAG_PET_CUR_HP
data << uint32(pet->GetMaxHealth()); // GROUP_UPDATE_FLAG_PET_MAX_HP
data << uint8(petpowertype); // GROUP_UPDATE_FLAG_PET_POWER_TYPE
data << uint16(pet->GetPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_CUR_POWER
data << uint16(pet->GetMaxPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_MAX_POWER
uint64 petauramask = 0;
size_t petMaskPos = data.wpos();
data << uint64(petauramask); // placeholder
for(uint8 i = 0; i < MAX_AURAS; ++i)
{
//.........这里部分代码省略.........
示例11: BuildPartyMemberStatsChangedPacket
//.........这里部分代码省略.........
size_t pos = dataBuffer.wpos();
uint8 amount_count = 0;
dataBuffer << uint8(0);
for (uint32 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
if (!(auraEffectMask & (1 << j)))
continue;
if (constAuraEffectPtr eff = aurApp->GetBase()->GetEffect(j)) // NULL if effect flag not set
dataBuffer << float(eff->GetAmount());
else
dataBuffer << float(0.0f);
++amount_count;
}
dataBuffer.put(pos, amount_count);
}
}
}
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
{
if (pet)
dataBuffer << uint64(pet->GetGUID());
else
dataBuffer << uint64(0);
}
if (mask & GROUP_UPDATE_FLAG_PET_NAME)
{
if (pet)
dataBuffer << pet->GetName();
else
dataBuffer << uint8(0);
}
if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID)
{
if (pet)
dataBuffer << uint16(pet->GetDisplayId());
else
dataBuffer << uint16(0);
}
if (mask & GROUP_UPDATE_FLAG_PET_CUR_HP)
{
if (pet)
dataBuffer << uint32(pet->GetHealth());
else
dataBuffer << uint32(0);
}
if (mask & GROUP_UPDATE_FLAG_PET_MAX_HP)
{
if (pet)
dataBuffer << uint32(pet->GetMaxHealth());
else
dataBuffer << uint32(0);
}
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE)
{
if (pet)
dataBuffer << uint8(pet->getPowerType());
示例12: HandleRequestPartyMemberStatsOpcode
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
uint64 Guid;
recvData >> Guid;
Player* player = HashMapHolder<Player>::Find(Guid);
if (!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data.appendPackGUID(Guid);
data << uint32(GROUP_UPDATE_FLAG_STATUS);
data << uint16(MEMBER_STATUS_OFFLINE);
SendPacket(&data);
return;
}
Pet* pet = player->GetPet();
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data.append(player->GetPackGUID());
uint32 mask1 = GROUP_UPDATE_FULL; // common mask, real flags used 0x000040BFF
if (!pet)
mask1 &= ~GROUP_UPDATE_PET; // for hunters and other classes with pets, real flags used 0x7FFFFFFF
Powers powerType = player->getPowerType();
data << uint32(mask1); // group update mask
data << uint16(MEMBER_STATUS_ONLINE); // member's online status, GROUP_UPDATE_FLAG_STATUS
data << uint32(player->GetHealth()); // GROUP_UPDATE_FLAG_CUR_HP
data << uint32(player->GetMaxHealth()); // GROUP_UPDATE_FLAG_MAX_HP
data << uint8 (powerType); // GROUP_UPDATE_FLAG_POWER_TYPE
data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER
data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER
data << uint16(player->getLevel()); // GROUP_UPDATE_FLAG_LEVEL
data << uint16(player->GetZoneId()); // GROUP_UPDATE_FLAG_ZONE
data << uint16(player->GetPositionX()); // GROUP_UPDATE_FLAG_POSITION
data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION
uint64 auramask = 0;
// GROUP_UPDATE_FLAG_AURAS
// if true client clears auras that are not covered by auramask
// TODO: looks like now client requires all active auras to be in the beginning of the auramask
// e.g. if you have holes in the aura mask the values after are ignored.
data << uint8(0);
size_t maskPos = data.wpos();
data << uint64(auramask); // placeholder
data << uint32(MAX_AURAS); // if true client clears auras that are not covered by auramask
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if (AuraApplication const* aurApp = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << uint32(aurApp->GetBase()->GetId());
data << uint16(aurApp->GetFlags());
if (aurApp->GetFlags() & AFLAG_ANY_EFFECT_AMOUNT_SENT)
{
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(i))
data << int32(eff->GetAmount());
else
data << int32(0);
}
}
}
}
data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS
if (pet)
{
Powers petpowertype = pet->getPowerType();
data << uint64(pet->GetGUID()); // GROUP_UPDATE_FLAG_PET_GUID
data << pet->GetName(); // GROUP_UPDATE_FLAG_PET_NAME
data << uint16(pet->GetDisplayId()); // GROUP_UPDATE_FLAG_PET_MODEL_ID
data << uint32(pet->GetHealth()); // GROUP_UPDATE_FLAG_PET_CUR_HP
data << uint32(pet->GetMaxHealth()); // GROUP_UPDATE_FLAG_PET_MAX_HP
data << uint8 (petpowertype); // GROUP_UPDATE_FLAG_PET_POWER_TYPE
data << uint16(pet->GetPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_CUR_POWER
data << uint16(pet->GetMaxPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_MAX_POWER
uint64 petauramask = 0;
// GROUP_UPDATE_FLAG_PET_AURAS
// if true client clears auras that are not covered by auramask
// TODO: looks like now client requires all active auras to be in the beginning of the auramask
// e.g. if you have holes in the aura mask the values after are ignored.
data << uint8(0);
size_t petMaskPos = data.wpos();
data << uint64(petauramask); // placeholder
data << uint32(MAX_AURAS); // client reads (64) Bits from auramask
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if (AuraApplication const* aurApp = pet->GetVisibleAura(i))
{
//.........这里部分代码省略.........
示例13: BuildPartyMemberStatsChangedPacket
void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data)
{
uint32 mask = player->GetGroupUpdateFlag();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
mask |= (GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER);
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) // same for pets
mask |= (GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER);
uint32 byteCount = 0;
for (int i = 1; i < GROUP_UPDATE_FLAGS_COUNT; ++i)
if (mask & (1 << i))
byteCount += GroupUpdateLength[i];
data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount);
*data << player->GetPackGUID();
*data << uint32(mask);
if (mask & GROUP_UPDATE_FLAG_STATUS)
{
if (player->IsPvP())
*data << uint16(MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP);
else
*data << uint16(MEMBER_STATUS_ONLINE);
}
if (mask & GROUP_UPDATE_FLAG_CUR_HP)
*data << uint32(player->GetHealth());
if (mask & GROUP_UPDATE_FLAG_MAX_HP)
*data << uint32(player->GetMaxHealth());
Powers powerType = player->getPowerType();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE)
*data << uint8(powerType);
if (mask & GROUP_UPDATE_FLAG_CUR_POWER)
*data << uint16(player->GetPower(powerType));
if (mask & GROUP_UPDATE_FLAG_MAX_POWER)
*data << uint16(player->GetMaxPower(powerType));
if (mask & GROUP_UPDATE_FLAG_LEVEL)
*data << uint16(player->getLevel());
if (mask & GROUP_UPDATE_FLAG_ZONE)
*data << uint16(player->GetZoneId());
if (mask & GROUP_UPDATE_FLAG_UNK)
*data << uint16(0);
if (mask & GROUP_UPDATE_FLAG_POSITION)
*data << uint16(player->GetPositionX()) << uint16(player->GetPositionY()) << uint16(player->GetPositionZ());
if (mask & GROUP_UPDATE_FLAG_AURAS)
{
*data << uint8(0); // if true, client clears all auras that are not in auramask and whose index is lower amount sent below
const uint64& auramask = player->GetAuraUpdateMask();
*data << uint64(auramask);
*data << uint32(MAX_AURAS); // server sends here number of visible auras, but client checks
// if aura is in auramask, so it seems no difference if there will be MAX_AURAS
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
if (auramask & (uint64(1) << i))
{
if (SpellAuraHolder* holder = player->GetVisibleAura(i))
{
*data << uint32(holder->GetId());
*data << uint16(holder->GetAuraFlags());
if (holder->GetAuraFlags() & AFLAG_EFFECT_AMOUNT_SEND)
for (uint32 i = 0; i < MAX_EFFECT_INDEX; ++i)
if (Aura* aura = holder->GetAuraByEffectIndex(SpellEffectIndex(i)))
*data << int32(aura->GetModifier()->m_amount);
else
*data << int32(0);
}
else
{
*data << uint32(0);
*data << uint16(0);
}
}
}
}
Pet* pet = player->GetPet();
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
*data << (pet ? pet->GetObjectGuid() : ObjectGuid());
if (mask & GROUP_UPDATE_FLAG_PET_NAME)
{
if (pet)
*data << pet->GetName();
else
*data << uint8(0);
}
if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID)
{
//.........这里部分代码省略.........
示例14: BuildPartyMemberStatsChangedPacket
void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data)
{
uint32 mask = player->GetGroupUpdateFlag();
if (mask == GROUP_UPDATE_FLAG_NONE)
return;
mask = mask &~ (GROUP_UPDATE_FLAG_AURAS | GROUP_UPDATE_FLAG_PET_AURAS);
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) // if update power type, update current/max power also
mask |= (GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER);
if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) // same for pets
mask |= (GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER);
data->Initialize(SMSG_PARTY_MEMBER_STATS, 80); // average value
data->append(player->GetPackGUID());
*data << uint32(mask);
if (mask & GROUP_UPDATE_FLAG_STATUS)
{
if (player)
{
if (player->IsPvP())
*data << uint16(MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP);
else
*data << uint16(MEMBER_STATUS_ONLINE);
}
else
*data << uint16(MEMBER_STATUS_OFFLINE);
}
if (mask & GROUP_UPDATE_FLAG_CUR_HP)
*data << uint32(player->GetHealth());
if (mask & GROUP_UPDATE_FLAG_MAX_HP)
*data << uint32(player->GetMaxHealth());
Powers powerType = player->getPowerType();
if (mask & GROUP_UPDATE_FLAG_POWER_TYPE)
*data << uint8(powerType);
if (mask & GROUP_UPDATE_FLAG_CUR_POWER)
*data << uint16(player->GetPower(powerType));
if (mask & GROUP_UPDATE_FLAG_MAX_POWER)
*data << uint16(player->GetMaxPower(powerType));
if (mask & GROUP_UPDATE_FLAG_LEVEL)
*data << uint16(player->getLevel());
if (mask & GROUP_UPDATE_FLAG_ZONE)
*data << uint16(player->GetZoneId());
if (mask & GROUP_UPDATE_FLAG_UNK100)
*data << uint16(0);
if (mask & GROUP_UPDATE_FLAG_POSITION)
*data << uint16(player->GetPositionX()) << uint16(player->GetPositionY()) << uint16(player->GetPositionZ());
if (mask & GROUP_UPDATE_FLAG_AURAS)
{
*data << uint8(0);
uint64 auramask = player->GetAuraUpdateMaskForRaid();
*data << uint64(auramask);
*data << uint32(MAX_AURAS); // count
for (uint32 i = 0; i < MAX_AURAS; ++i)
{
if (auramask & (uint64(1) << i))
{
AuraApplication const* aurApp = player->GetVisibleAura(i);
if (!aurApp)
{
*data << uint32(0);
*data << uint16(0);
continue;
}
*data << uint32(aurApp->GetBase()->GetId());
*data << uint16(aurApp->GetFlags());
if (aurApp->GetFlags() & AFLAG_ANY_EFFECT_AMOUNT_SENT)
{
size_t pos = data->wpos();
uint8 count = 0;
*data << uint8(0);
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (constAuraEffectPtr eff = aurApp->GetBase()->GetEffect(i)) // NULL if effect flag not set
{
*data << float(eff->GetAmount());
count++;
}
}
data->put(pos, count);
}
}
}
}
//.........这里部分代码省略.........
示例15: HandleRequestPartyMemberStatsOpcode
/*this procedure handles clients CMSG_REQUEST_PARTY_MEMBER_STATS request*/
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
uint64 guid;
recvData >> guid;
Player* player = HashMapHolder<Player>::Find(guid);
if (!player)
{
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data.appendPackGUID(guid);
data << (uint32) GROUP_UPDATE_FLAG_STATUS;
data << (uint16) MEMBER_STATUS_OFFLINE;
SendPacket(&data);
return;
}
Pet* pet = player->GetPet();
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8);
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
data.append(player->GetPackGUID());
uint32 mask1 = GROUP_UPDATE_FULL;
if (!pet)
mask1 &= ~GROUP_UPDATE_PET;
Powers powerType = player->getPowerType();
data << uint32(mask1); // group update mask
data << uint16(MEMBER_STATUS_ONLINE); // member's online status, GROUP_UPDATE_FLAG_STATUS
data << uint32(player->GetHealth()); // GROUP_UPDATE_FLAG_CUR_HP
data << uint32(player->GetMaxHealth()); // GROUP_UPDATE_FLAG_MAX_HP
data << uint8 (powerType); // GROUP_UPDATE_FLAG_POWER_TYPE
data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER
data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER
data << uint16(player->getLevel()); // GROUP_UPDATE_FLAG_LEVEL
data << uint16(player->GetZoneId()); // GROUP_UPDATE_FLAG_ZONE
data << uint16(player->GetPositionX()); // GROUP_UPDATE_FLAG_POSITION
data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION
data << uint16(player->GetPositionZ()); // GROUP_UPDATE_FLAG_POSITION
// GROUP_UPDATE_FLAG_AURAS
data << uint8(1);
uint64 auramask = 0;
size_t maskPos = data.wpos();
data << uint64(auramask); // placeholder
data << uint32(MAX_AURAS); // count
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if (AuraApplication const* aurApp = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << uint32(aurApp->GetBase()->GetId());
data << uint16(aurApp->GetFlags());
if (aurApp->GetFlags() & AFLAG_ANY_EFFECT_AMOUNT_SENT)
{
for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect const* eff = aurApp->GetBase()->GetEffect(i))
data << int32(eff->GetAmount());
else
data << int32(0);
}
}
}
}
data.put<uint64>(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS
if (pet)
{
Powers petpowertype = pet->getPowerType();
data << uint64(pet->GetGUID()); // GROUP_UPDATE_FLAG_PET_GUID
data << pet->GetName(); // GROUP_UPDATE_FLAG_PET_NAME
data << uint16(pet->GetDisplayId()); // GROUP_UPDATE_FLAG_PET_MODEL_ID
data << uint32(pet->GetHealth()); // GROUP_UPDATE_FLAG_PET_CUR_HP
data << uint32(pet->GetMaxHealth()); // GROUP_UPDATE_FLAG_PET_MAX_HP
data << uint8 (petpowertype); // GROUP_UPDATE_FLAG_PET_POWER_TYPE
data << uint16(pet->GetPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_CUR_POWER
data << uint16(pet->GetMaxPower(petpowertype)); // GROUP_UPDATE_FLAG_PET_MAX_POWER
// GROUP_UPDATE_FLAG_PET_AURAS
data << uint8(1);
uint64 petauramask = 0;
size_t petMaskPos = data.wpos();
data << uint64(petauramask); // placeholder
data << uint32(MAX_AURAS); // count
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if (AuraApplication const* aurApp = pet->GetVisibleAura(i))
{
petauramask |= (uint64(1) << i);
data << uint32(aurApp->GetBase()->GetId());
data << uint16(aurApp->GetFlags());
//.........这里部分代码省略.........