本文整理汇总了C++中Corpse::GetPositionZ方法的典型用法代码示例。如果您正苦于以下问题:C++ Corpse::GetPositionZ方法的具体用法?C++ Corpse::GetPositionZ怎么用?C++ Corpse::GetPositionZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corpse
的用法示例。
在下文中一共展示了Corpse::GetPositionZ方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleCorpseQueryOpcode
//////////////////////////////////////////////////////////////
/// This function handles MSG_CORPSE_QUERY:
//////////////////////////////////////////////////////////////
void WorldSession::HandleCorpseQueryOpcode(WorldPacket &recv_data)
{
CHECK_INWORLD_RETURN
LOG_DETAIL("WORLD: Received MSG_CORPSE_QUERY");
Corpse *pCorpse;
WorldPacket data(MSG_CORPSE_QUERY, 25);
MapInfo *pMapinfo;
pCorpse = objmgr.GetCorpseByOwner(GetPlayer()->GetLowGUID());
if(pCorpse)
{
pMapinfo = WorldMapInfoStorage.LookupEntry(pCorpse->GetMapId());
if(pMapinfo)
{
if(pMapinfo->type == INSTANCE_NULL || pMapinfo->type == INSTANCE_BATTLEGROUND)
{
data << uint8(0x01); //show ?
data << pCorpse->GetMapId(); // mapid (that tombstones shown on)
data << pCorpse->GetPositionX();
data << pCorpse->GetPositionY();
data << pCorpse->GetPositionZ();
data << pCorpse->GetMapId(); //instance mapid (needs to be same as mapid to be able to recover corpse)
data << uint32(0);
SendPacket(&data);
}
else
{
data << uint8(0x01); //show ?
data << pMapinfo->repopmapid; // mapid (that tombstones shown on)
data << pMapinfo->repopx;
data << pMapinfo->repopy;
data << pMapinfo->repopz;
data << pCorpse->GetMapId(); //instance mapid (needs to be same as mapid to be able to recover corpse)
data << uint32(0);
SendPacket(&data);
}
}
else
{
data << uint8(0x01); //show ?
data << pCorpse->GetMapId(); // mapid (that tombstones shown on)
data << pCorpse->GetPositionX();
data << pCorpse->GetPositionY();
data << pCorpse->GetPositionZ();
data << pCorpse->GetMapId(); //instance mapid (needs to be same as mapid to be able to recover corpse)
data << uint32(0);
SendPacket(&data);
}
}
}
示例2: HandleCorpseQueryOpcode
//////////////////////////////////////////////////////////////
/// This function handles MSG_CORPSE_QUERY:
//////////////////////////////////////////////////////////////
void WorldSession::HandleCorpseQueryOpcode(WorldPacket &recv_data)
{
OUT_DEBUG("WORLD: Received MSG_CORPSE_QUERY");
Corpse *pCorpse;
//WorldPacket data(MSG_CORPSE_QUERY, 21);
uint8 databuffer[100];
StackPacket data(MSG_CORPSE_QUERY, databuffer, 100);
MapInfo *pMapinfo;
pCorpse = objmgr.GetCorpseByOwner(GetPlayer()->GetLowGUID());
if(pCorpse)
{
pMapinfo = WorldMapInfoStorage.LookupEntry(pCorpse->GetMapId());
if(pMapinfo)
{
if(pMapinfo->type == INSTANCE_NULL || pMapinfo->type == INSTANCE_PVP)
{
data << uint8(0x01); //show ?
data << pCorpse->GetMapId(); // mapid (that tombstones shown on)
data << pCorpse->GetPositionX();
data << pCorpse->GetPositionY();
data << pCorpse->GetPositionZ();
data << pCorpse->GetMapId(); //instance mapid (needs to be same as mapid to be able to recover corpse)
SendPacket(&data);
}
else
{
data << uint8(0x01); //show ?
data << pMapinfo->repopmapid; // mapid (that tombstones shown on)
data << pMapinfo->repopx;
data << pMapinfo->repopy;
data << pMapinfo->repopz;
data << pCorpse->GetMapId(); //instance mapid (needs to be same as mapid to be able to recover corpse)
data << uint32(0); // 3.2.2
SendPacket(&data);
}
}
else
{
data.Initialize(MSG_CORPSE_QUERY);
data << uint8(0x01); //show ?
data << pCorpse->GetMapId(); // mapid (that tombstones shown on)
data << pCorpse->GetPositionX();
data << pCorpse->GetPositionY();
data << pCorpse->GetPositionZ();
data << pCorpse->GetMapId(); //instance mapid (needs to be same as mapid to be able to recover corpse)
data << uint32(0); // 3.2.2
SendPacket(&data);
}
}
}
示例3: SendSpiritResurrect
void WorldSession::SendSpiritResurrect()
{
_player->ResurrectPlayer(0.5f, true);
_player->DurabilityLossAll(0.25f, true);
// get corpse nearest graveyard
WorldSafeLocsEntry const* corpseGrave = NULL;
Corpse* corpse = _player->GetCorpse();
if (corpse)
corpseGrave = sObjectMgr->GetClosestGraveYard(
corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam());
// now can spawn bones
_player->SpawnCorpseBones();
// teleport to nearest from corpse graveyard, if different from nearest to player ghost
if (corpseGrave)
{
WorldSafeLocsEntry const* ghostGrave = sObjectMgr->GetClosestGraveYard(
_player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam());
if (corpseGrave != ghostGrave)
_player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation());
// or update at original position
else
_player->UpdateObjectVisibility();
}
// or update at original position
else
_player->UpdateObjectVisibility();
}
示例4: HandleCorpseQueryOpcode
void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recv_data*/)
{
DETAIL_LOG("WORLD: Received opcode MSG_CORPSE_QUERY");
Corpse* corpse = GetPlayer()->GetCorpse();
if (!corpse)
{
WorldPacket data(MSG_CORPSE_QUERY, 1);
data << uint8(0); // corpse not found
SendPacket(&data);
return;
}
uint32 corpsemapid = corpse->GetMapId();
float x = corpse->GetPositionX();
float y = corpse->GetPositionY();
float z = corpse->GetPositionZ();
int32 mapid = corpsemapid;
// if corpse at different map
if (corpsemapid != _player->GetMapId())
{
// search entrance map for proper show entrance
if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(corpsemapid))
{
if (corpseMapEntry->IsDungeon() && corpseMapEntry->ghost_entrance_map >= 0)
{
// if corpse map have entrance
if (TerrainInfo const* entranceMap = sTerrainMgr.LoadTerrain(corpseMapEntry->ghost_entrance_map))
{
mapid = corpseMapEntry->ghost_entrance_map;
x = corpseMapEntry->ghost_entrance_x;
y = corpseMapEntry->ghost_entrance_y;
z = entranceMap->GetHeightStatic(x, y, MAX_HEIGHT);
}
}
}
}
WorldPacket data(MSG_CORPSE_QUERY, 1 + (6 * 4));
data << uint8(1); // corpse found
data << int32(mapid);
data << float(x);
data << float(y);
data << float(z);
data << uint32(corpsemapid);
data << uint32(0); // unknown
SendPacket(&data);
}
示例5: HandleCorpseQueryOpcode
void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received MSG_CORPSE_QUERY");
Corpse* corpse = GetPlayer()->GetCorpse();
if (!corpse)
{
WorldPacket data(MSG_CORPSE_QUERY, 1);
data << uint8(0); // corpse not found
SendPacket(&data);
return;
}
uint32 mapid = corpse->GetMapId();
float x = corpse->GetPositionX();
float y = corpse->GetPositionY();
float z = corpse->GetPositionZ();
uint32 corpsemapid = mapid;
// if corpse at different map
if (mapid != _player->GetMapId())
{
// search entrance map for proper show entrance
if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapid))
{
if (corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
{
// if corpse map have entrance
if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->entrance_map))
{
mapid = corpseMapEntry->entrance_map;
x = corpseMapEntry->entrance_x;
y = corpseMapEntry->entrance_y;
z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT);
}
}
}
}
WorldPacket data(MSG_CORPSE_QUERY, 1+(6*4));
data << uint8(1); // corpse found
data << int32(mapid);
data << float(x);
data << float(y);
data << float(z);
data << int32(corpsemapid);
data << uint32(0); // unknown
SendPacket(&data);
}
示例6: HandleCorpseQueryOpcode
void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/)
{
DETAIL_LOG("WORLD: Received MSG_CORPSE_QUERY");
Corpse *corpse = GetPlayer()->GetCorpse();
if(!corpse)
{
WorldPacket data(MSG_CORPSE_QUERY, 1);
data << uint8(0); // corpse not found
SendPacket(&data);
return;
}
uint32 corpsemapid = corpse->GetMapId();
float x = corpse->GetPositionX();
float y = corpse->GetPositionY();
float z = corpse->GetPositionZ();
int32 mapid = corpsemapid;
// if corpse at different map
if (corpsemapid != _player->GetMapId())
{
// search entrance map for proper show entrance
if (InstanceTemplate const* temp = sObjectMgr.GetInstanceTemplate(mapid))
{
if (temp->ghostEntranceMap >= 0)
{
// if corpse map have entrance
if(TerrainInfo const* entranceMap = sTerrainMgr.LoadTerrain(temp->ghostEntranceMap))
{
mapid = temp->ghostEntranceMap;
x = temp->ghostEntranceX;
y = temp->ghostEntranceY;
z = entranceMap->GetHeight(x, y, MAX_HEIGHT);
}
}
}
}
WorldPacket data(MSG_CORPSE_QUERY, 1+(5*4));
data << uint8(1); // corpse found
data << int32(mapid);
data << float(x);
data << float(y);
data << float(z);
data << uint32(corpsemapid);
SendPacket(&data);
}
示例7: HandleQueryCorpseLocation
void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLocationFromClient& /*packet*/)
{
TC_LOG_DEBUG("network", "WORLD: Received CMSG_QUERY_CORPSE_LOCATION_FROM_CLIENT");
Corpse* corpse = GetPlayer()->GetCorpse();
if (!corpse)
{
WorldPackets::Query::CorpseLocation packet;
packet.Valid = false; // corpse not found
SendPacket(packet.Write());
return;
}
uint32 mapID = corpse->GetMapId();
float x = corpse->GetPositionX();
float y = corpse->GetPositionY();
float z = corpse->GetPositionZ();
uint32 corpseMapID = mapID;
// if corpse at different map
if (mapID != _player->GetMapId())
{
// search entrance map for proper show entrance
if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapID))
{
if (corpseMapEntry->IsDungeon() && corpseMapEntry->CorpseMapID >= 0)
{
// if corpse map have entrance
if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->CorpseMapID))
{
mapID = corpseMapEntry->CorpseMapID;
x = corpseMapEntry->CorpsePos.X;
y = corpseMapEntry->CorpsePos.Y;
z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT);
}
}
}
}
WorldPackets::Query::CorpseLocation packet;
packet.Valid = true;
packet.MapID = corpseMapID;
packet.ActualMapID = mapID;
packet.Position = G3D::Vector3(x, y, z);
packet.Transport = corpse->GetTransGUID();
SendPacket(packet.Write());
}
示例8: HandleCorpseQueryOpcode
//////////////////////////////////////////////////////////////
/// This function handles MSG_CORPSE_QUERY:
//////////////////////////////////////////////////////////////
void WorldSession::HandleCorpseQueryOpcode(WorldPacket &recv_data)
{
DEBUG_LOG("WORLD","HandleCorpseQueryOpcode Received MSG_CORPSE_QUERY");
Corpse* pCorpse;
WorldPacket data(MSG_CORPSE_QUERY, 18);
if(_player->isDead())
_player->BuildPlayerRepop();
pCorpse = objmgr.GetCorpseByOwner(_player->GetLowGUID());
if(pCorpse)
{
MapInfo *pPMapinfo = NULL;
pPMapinfo = WorldMapInfoStorage.LookupEntry(pCorpse->GetMapId());
if(pPMapinfo == NULL)
data.Initialize(MSG_CORPSE_QUERY);
data << uint8(0x01); //show ?
if(pPMapinfo != NULL && !(pPMapinfo->type == INSTANCE_NULL || pPMapinfo->type == INSTANCE_PVP))
{
data << pPMapinfo->repopmapid; // mapid (that tombstones shown on)
data << pPMapinfo->repopx;
data << pPMapinfo->repopy;
data << pPMapinfo->repopz;
}
else
{
data << pCorpse->GetMapId(); // mapid (that tombstones shown on)
data << pCorpse->GetPositionX();
data << pCorpse->GetPositionY();
data << pCorpse->GetPositionZ();
}
data << pCorpse->GetMapId(); //instance mapid (needs to be same as mapid to be able to recover corpse)
SendPacket(&data);
}
}
示例9: ConvertCorpseForPlayer
Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia /*=false*/)
{
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
if (!corpse)
{
//in fact this function is called from several places
//even when player doesn't have a corpse, not an error
return NULL;
}
TC_LOG_DEBUG("misc", "Deleting Corpse and spawned bones.");
// Map can be NULL
Map* map = corpse->FindMap();
// remove corpse from player_guid -> corpse map and from current map
RemoveCorpse(corpse);
// remove corpse from DB
SQLTransaction trans = CharacterDatabase.BeginTransaction();
corpse->DeleteFromDB(trans);
CharacterDatabase.CommitTransaction(trans);
Corpse* bones = nullptr;
// create the bones only if the map and the grid is loaded at the corpse's location
// ignore bones creating option in case insignia
if (map && (insignia ||
(map->IsBattlegroundOrArena() ? sWorld->getBoolConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld->getBoolConfig(CONFIG_DEATH_BONES_WORLD))) &&
!map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
{
// Create bones, don't change Corpse
bones = new Corpse;
bones->Create(corpse->GetGUIDLow(), map);
for (uint8 i = OBJECT_FIELD_TYPE + 1; i < CORPSE_END; ++i) // don't overwrite guid and object type
bones->SetUInt32Value(i, corpse->GetUInt32Value(i));
bones->SetGridCoord(corpse->GetGridCoord());
// bones->m_time = m_time; // don't overwrite time
// bones->m_type = m_type; // don't overwrite type
bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
bones->CopyPhaseFrom(corpse);
bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES);
bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0);
for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
}
// add bones in grid store if grid loaded where corpse placed
map->AddToMap(bones);
}
// all references to the corpse should be removed at this point
delete corpse;
return bones;
}
示例10: ConvertCorpseForPlayer
Corpse* ObjectAccessor::ConvertCorpseForPlayer(uint64 player_guid, bool insignia)
{
Corpse* corpse = GetCorpseForPlayerGUID(player_guid);
if (!corpse)
{
//in fact this function is called from several places
//even when player doesn't have a corpse, not an error
//sLog->outError("Try remove corpse that not in map for GUID %ul", player_guid);
return NULL;
}
sLog->outDebug("Deleting Corpse and spawned bones.");
Map *map = corpse->FindMap();
// remove corpse from player_guid -> corpse map
RemoveCorpse(corpse);
// done in removecorpse
// remove resurrectable corpse from grid object registry (loaded state checked into call)
// do not load the map if it's not loaded
//Map *map = sMapMgr->FindMap(corpse->GetMapId(), corpse->GetInstanceId());
//if (map)
// map->Remove(corpse, false);
// remove corpse from DB
corpse->DeleteFromDB();
Corpse* bones = NULL;
// create the bones only if the map and the grid is loaded at the corpse's location
// ignore bones creating option in case insignia
if (map && (insignia ||
(map->IsBattleGroundOrArena() ? sWorld->getConfig(CONFIG_DEATH_BONES_BG_OR_ARENA) : sWorld->getConfig(CONFIG_DEATH_BONES_WORLD))) &&
!map->IsRemovalGrid(corpse->GetPositionX(), corpse->GetPositionY()))
{
// Create bones, don't change Corpse
bones = new Corpse;
bones->Create(corpse->GetGUIDLow(), map);
for (int i = 3; i < CORPSE_END; ++i) // don't overwrite guid and object type
bones->SetUInt32Value(i, corpse->GetUInt32Value(i));
bones->SetGrid(corpse->GetGrid());
// bones->m_time = m_time; // don't overwrite time
// bones->m_inWorld = m_inWorld; // don't overwrite in-world state
// bones->m_type = m_type; // don't overwrite type
bones->Relocate(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetOrientation());
bones->SetUInt32Value(CORPSE_FIELD_FLAGS, CORPSE_FLAG_UNK2 | CORPSE_FLAG_BONES);
bones->SetUInt64Value(CORPSE_FIELD_OWNER, 0);
for (int i = 0; i < EQUIPMENT_SLOT_END; ++i)
{
if (corpse->GetUInt32Value(CORPSE_FIELD_ITEM + i))
bones->SetUInt32Value(CORPSE_FIELD_ITEM + i, 0);
}
// add bones in grid store if grid loaded where corpse placed
map->Add(bones);
}
// all references to the corpse should be removed at this point
delete corpse;
return bones;
}