本文整理汇总了C++中Corpse::GetMapId方法的典型用法代码示例。如果您正苦于以下问题:C++ Corpse::GetMapId方法的具体用法?C++ Corpse::GetMapId怎么用?C++ Corpse::GetMapId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Corpse
的用法示例。
在下文中一共展示了Corpse::GetMapId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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);
}
示例3: 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);
}
示例4: 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);
}
示例5:
Corpse * ObjectAccessor::GetCorpse(WorldObject const &u, uint64 guid)
{
Corpse * tmp = HashMapHolder<Corpse>::Find(guid);
if (!tmp)
return NULL;
if (tmp->GetMapId() != u.GetMapId())
return NULL;
if (tmp->GetInstanceId() != u.GetInstanceId())
return NULL;
return tmp;
}
示例6: 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());
}
示例7: 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);
}
}
}
示例8: 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);
}
}
}
示例9: 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 = objmgr.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 = objmgr.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
//ObjectAccessor::UpdateVisibilityForPlayer(_player);
_player->SetToNotify();
}
// or update at original position
else
//ObjectAccessor::UpdateVisibilityForPlayer(_player);
_player->SetToNotify();
_player->SaveToDB();
}
示例10: HandleMoveWorldportAckOpcode
void WorldSession::HandleMoveWorldportAckOpcode()
{
// ignore unexpected far teleports
if (!GetPlayer()->IsBeingTeleportedFar())
return;
GetPlayer()->SetSemaphoreTeleportFar(0);
// get the teleport destination
WorldLocation const& loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if (!MapManager::IsValidMapCoord(loc))
{
KickPlayer();
return;
}
// get the destination map entry, not the current one, this will fix homebind and reset greeting
MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId());
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(loc.GetMapId());
Map* oldMap = GetPlayer()->GetMap();
if (GetPlayer()->IsInWorld())
{
sLog->outError("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId());
oldMap->RemovePlayerFromMap(GetPlayer(), false);
}
// reset instance validity, except if going to an instance inside an instance
if (GetPlayer()->m_InstanceValid == false && !mInstance)
{
GetPlayer()->m_InstanceValid = true;
// pussywizard: m_InstanceValid can be false only by leaving a group in an instance => so remove temp binds that could not be removed because player was still on the map!
if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty()))
sInstanceSaveMgr->PlayerUnbindInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty(), true);
}
// relocate the player to the teleport destination
Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer());
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if (!newMap || !newMap->CanEnter(GetPlayer()))
{
sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
GetPlayer()->Relocate(loc.GetPositionX(), loc.GetPositionY(), loc.GetPositionZ(), loc.GetOrientation());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(newMap);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
{
sLog->outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(oldMap);
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
oldMap->AfterPlayerUnlinkFromMap();
// pussywizard: transport teleport couldn't teleport us to the same map (some other teleport pending, reqs not met, etc.), but we still have transport set until player moves! clear it if map differs (crashfix)
if (Transport* t = _player->GetTransport())
if (!t->IsInMap(_player))
{
t->RemovePassenger(_player);
_player->m_transport = NULL;
_player->m_movementInfo.transport.Reset();
_player->m_movementInfo.RemoveMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
}
if (!_player->getHostileRefManager().isEmpty())
_player->getHostileRefManager().deleteReferences(); // pussywizard: multithreading crashfix
CellCoord pair(Trinity::ComputeCellCoord(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()));
Cell cell(pair);
if (!GridCoord(cell.GridX(), cell.GridY()).IsCoordValid())
{
KickPlayer();
return;
}
newMap->LoadGrid(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY());
// pussywizard: player supposed to enter bg map
if (_player->InBattleground())
{
// but landed on another map, cleanup data
if (!mEntry->IsBattlegroundOrArena())
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
// everything ok
else if (Battleground* bg = _player->GetBattleground())
{
if (_player->IsInvitedForBattlegroundInstance()) // GMs are not invited, so they are not added to participants
bg->AddPlayer(_player);
}
//.........这里部分代码省略.........
示例11: HandleMoveWorldportAckOpcode
void WorldSession::HandleMoveWorldportAckOpcode()
{
// ignore unexpected far teleports
if(!GetPlayer()->IsBeingTeleportedFar())
return;
if (_player->GetVehicleKit())
_player->GetVehicleKit()->RemoveAllPassengers();
// get the teleport destination
WorldLocation &loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if(!MapManager::IsValidMapCoord(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation))
{
sLog.outError("WorldSession::HandleMoveWorldportAckOpcode: player %s (%d) was teleported far to a not valid location. (map:%u, x:%f, y:%f, "
"z:%f) We port him to his homebind instead..", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z);
// stop teleportation else we would try this again and again in LogoutPlayer...
GetPlayer()->SetSemaphoreTeleportFar(false);
// and teleport the player to a valid place
GetPlayer()->TeleportToHomebind();
return;
}
// get the destination map entry, not the current one, this will fix homebind and reset greeting
MapEntry const* mEntry = sMapStore.LookupEntry(loc.mapid);
InstanceTemplate const* mInstance = ObjectMgr::GetInstanceTemplate(loc.mapid);
// reset instance validity, except if going to an instance inside an instance
if(GetPlayer()->m_InstanceValid == false && !mInstance)
GetPlayer()->m_InstanceValid = true;
GetPlayer()->SetSemaphoreTeleportFar(false);
// relocate the player to the teleport destination
GetPlayer()->SetMap(sMapMgr.CreateMap(loc.mapid, GetPlayer()));
GetPlayer()->Relocate(loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation);
GetPlayer()->m_anti_TeleTime=time(NULL);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if(!GetPlayer()->GetMap()->Add(GetPlayer()))
{
//if player wasn't added to map, reset his map pointer!
GetPlayer()->ResetMap();
sLog.outError("WorldSession::HandleMoveWorldportAckOpcode: player %s (%d) was teleported far but couldn't be added to map. (map:%u, x:%f, y:%f, "
"z:%f) We port him to his homebind instead..", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z);
// teleport the player home
GetPlayer()->TeleportToHomebind();
return;
}
// battleground state prepare (in case join to BG), at relogin/tele player not invited
// only add to bg group and object, if the player was invited (else he entered through command)
if(_player->InBattleGround())
{
// cleanup setting if outdated
if(!mEntry->IsBattleGroundOrArena())
{
// We're not in BG
_player->SetBattleGroundId(0, BATTLEGROUND_TYPE_NONE);
// reset destination bg team
_player->SetBGTeam(0);
}
// join to bg case
else if(BattleGround *bg = _player->GetBattleGround())
{
if(_player->IsInvitedForBattleGroundInstance(_player->GetBattleGroundId()))
bg->AddPlayer(_player);
}
}
GetPlayer()->SendInitialPacketsAfterAddToMap();
// flight fast teleport case
if(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
if(!_player->InBattleGround())
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
flight->Reset(*GetPlayer());
return;
}
// battleground state prepare, stop flight
GetPlayer()->GetMotionMaster()->MovementExpired();
GetPlayer()->m_taxi.ClearTaxiDestinations();
}
// resurrect character at enter into instance where his corpse exist after add to map
Corpse *corpse = GetPlayer()->GetCorpse();
if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId())
{
if( mEntry->IsDungeon() )
{
GetPlayer()->ResurrectPlayer(0.5f);
GetPlayer()->SpawnCorpseBones();
//.........这里部分代码省略.........
示例12: HandleMoveWorldportAckOpcode
void WorldSession::HandleMoveWorldportAckOpcode( WorldPacket & /*recv_data*/ )
{
sLog.outDebug( "WORLD: got MSG_MOVE_WORLDPORT_ACK." );
MapEntry const* mEntry = sMapStore.LookupEntry(GetPlayer()->GetMapId());
if(!mEntry || !MaNGOS::IsValidMapCoord(GetPlayer()->GetPositionX(),GetPlayer()->GetPositionY()))
{
LogoutPlayer(false);
return;
}
// reset instance validity
GetPlayer()->m_InstanceValid = true;
GetPlayer()->SetSemaphoreTeleport(false);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
MapManager::Instance().GetMap(GetPlayer()->GetMapId(), GetPlayer())->Add(GetPlayer());
GetPlayer()->SendInitialPacketsAfterAddToMap();
// flight fast teleport case
if(GetPlayer()->GetMotionMaster()->top()->GetMovementGeneratorType()==FLIGHT_MOTION_TYPE)
{
if(!_player->InBattleGround())
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
flight->Initialize(*GetPlayer());
SendPath(flight->GetPath(),flight->GetCurrentNode(),flight->GetPathAtMapEnd());
GetPlayer()->SetDontMove(false);
return;
}
// battleground state prepre, stop flight
GetPlayer()->GetMotionMaster()->MovementExpired();
GetPlayer()->FlightComplete();
GetPlayer()->ClearTaxiDestinations();
GetPlayer()->StopMoving();
}
// resurrect character at enter into instance where his corpse exist after add to map
Corpse *corpse = GetPlayer()->GetCorpse();
if (corpse && corpse->GetType() == CORPSE_RESURRECTABLE && corpse->GetMapId() == GetPlayer()->GetMapId())
{
if( mEntry && (mEntry->map_type == MAP_INSTANCE || mEntry->map_type == MAP_RAID) )
{
GetPlayer()->ResurrectPlayer(0.5f,false);
GetPlayer()->SpawnCorpseBones();
GetPlayer()->SaveToDB();
}
}
// mount allow check
if(!_player->GetBaseMap()->IsMountAllowed())
_player->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED);
// battleground state preper
if(_player->InBattleGround())
{
BattleGround *bg = _player->GetBattleGround();
if(bg)
{
if(bg->GetMapId() == _player->GetMapId()) // we teleported to bg
{
if(!bg->GetBgRaid(_player->GetTeam())) // first player joined
{
Group *group = new Group;
bg->SetBgRaid(_player->GetTeam(), group);
group->ConvertToRaid();
group->AddMember(_player->GetGUID(), _player->GetName());
group->ChangeLeader(_player->GetGUID());
}
else // raid already exist
{
bg->GetBgRaid(_player->GetTeam())->AddMember(_player->GetGUID(), _player->GetName());
}
}
}
}
// honorless target
if(GetPlayer()->pvpInfo.inHostileArea)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
// resummon pet
if(GetPlayer()->m_oldpetnumber)
{
Pet* NewPet = new Pet(GetPlayer());
if(!NewPet->LoadPetFromDB(GetPlayer(), 0, GetPlayer()->m_oldpetnumber, true))
delete NewPet;
GetPlayer()->m_oldpetnumber = 0;
}
GetPlayer()->SetDontMove(false);
}
示例13: 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->GetTeamId());
// 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->GetTeamId());
if (corpseGrave != ghostGrave)
_player->TeleportTo(corpseGrave->map_id, corpseGrave->x, corpseGrave->y, corpseGrave->z, _player->GetOrientation());
// or update at original position
//else
// _player->UpdateObjectVisibility(); // xinef: not needed, called in ResurrectPlayer
}
// or update at original position
//else
// _player->UpdateObjectVisibility(); // xinef: not needed, called in ResurrectPlayer
}
示例14: HandleMoveWorldportAckOpcode
void WorldSession::HandleMoveWorldportAckOpcode()
{
// ignore unexpected far teleports
if (!GetPlayer()->IsBeingTeleportedFar())
return;
GetPlayer()->SetSemaphoreTeleportFar(false);
// get the teleport destination
WorldLocation &loc = GetPlayer()->GetTeleportDest();
// possible errors in the coordinate validity check
if (!MapManager::IsValidMapCoord(loc))
{
LogoutPlayer(false);
return;
}
// get the destination map entry, not the current one, this will fix homebind and reset greeting
MapEntry const* mEntry = sMapStore.LookupEntry(loc.GetMapId());
InstanceTemplate const* mInstance = sObjectMgr->GetInstanceTemplate(loc.GetMapId());
// reset instance validity, except if going to an instance inside an instance
if (GetPlayer()->m_InstanceValid == false && !mInstance)
GetPlayer()->m_InstanceValid = true;
Map * oldMap = GetPlayer()->GetMap();
ASSERT(oldMap);
if (GetPlayer()->IsInWorld())
{
sLog->outCrash("Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName(), oldMap->GetId(), loc.GetMapId());
oldMap->Remove(GetPlayer(), false);
}
// relocate the player to the teleport destination
Map * newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer(), 0);
// the CanEnter checks are done in TeleporTo but conditions may change
// while the player is in transit, for example the map may get full
if (!newMap || !newMap->CanEnter(GetPlayer()))
{
sLog->outError("Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
else
GetPlayer()->Relocate(&loc);
GetPlayer()->ResetMap();
GetPlayer()->SetMap(newMap);
GetPlayer()->SendInitialPacketsBeforeAddToMap();
if (!GetPlayer()->GetMap()->Add(GetPlayer()))
{
sLog->outError("WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
GetPlayer()->ResetMap();
GetPlayer()->SetMap(oldMap);
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
return;
}
// battleground state prepare (in case join to BG), at relogin/tele player not invited
// only add to bg group and object, if the player was invited (else he entered through command)
if (_player->InBattleground())
{
// cleanup setting if outdated
if (!mEntry->IsBattlegroundOrArena())
{
// We're not in BG
_player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE);
// reset destination bg team
_player->SetBGTeam(0);
}
// join to bg case
else if (Battleground *bg = _player->GetBattleground())
{
if (_player->IsInvitedForBattlegroundInstance(_player->GetBattlegroundId()))
bg->AddPlayer(_player);
}
}
GetPlayer()->SendInitialPacketsAfterAddToMap();
// flight fast teleport case
if (GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
if (!_player->InBattleground())
{
// short preparations to continue flight
FlightPathMovementGenerator* flight = (FlightPathMovementGenerator*)(GetPlayer()->GetMotionMaster()->top());
flight->Initialize(*GetPlayer());
return;
}
// battleground state prepare, stop flight
GetPlayer()->GetMotionMaster()->MovementExpired();
GetPlayer()->CleanupAfterTaxiFlight();
}
// resurrect character at enter into instance where his corpse exist after add to map
Corpse *corpse = GetPlayer()->GetCorpse();
//.........这里部分代码省略.........
示例15: HandleAreaTriggerOpcode
//.........这里部分代码省略.........
sLog.outDebug("Player %s failed areatrigger prereq - %s", GetPlayer()->GetName(), failed_reason.c_str());
return;
}
switch(pAreaTrigger->Type)
{
case ATTYPE_INSTANCE:
{
if(GetPlayer()->GetPlayerStatus() != TRANSFER_PENDING) //only ports if player is out of pendings
{
GetPlayer()->SaveEntryPoint();
//death system check.
Corpse *pCorpse = NULL;
CorpseData *pCorpseData = NULL;
MapInfo *pMapinfo = NULL;
pMapinfo = sWorld.GetMapInformation(pAreaTrigger->Mapid);
if(pMapinfo && !pMapinfo->HasFlag(WMI_INSTANCE_ENABLED))
{
WorldPacket msg;
msg.Initialize(SMSG_AREA_TRIGGER_MESSAGE);
msg << uint32(0) << "This instance is currently unavailable." << uint8(0) << uint8(0);
SendPacket(&msg);
return;
}
if(pMapinfo && pMapinfo->HasFlag(WMI_INSTANCE_XPACK_01) && !HasFlag(ACCOUNT_FLAG_XPACK_01))
{
WorldPacket msg;
msg.Initialize(SMSG_BROADCAST_MSG);
msg << uint32(3) << "You must have The Burning Crusade Expansion to access this content." << uint8(0);
SendPacket(&msg);
return;
}
if(!GetPlayer()->isAlive())
{
pCorpse = objmgr.GetCorpseByOwner(GetPlayer());
if(pCorpse)
{
pMapinfo = sWorld.GetMapInformation(pCorpse->GetMapId());
if(pMapinfo)
{
if(pMapinfo->type != INSTANCE_NULL && pMapinfo->type != INSTANCE_PVP && pMapinfo->type != INSTANCE_NONRAID && GetPlayer()->GetMapId() != pCorpse->GetMapId() && pCorpse->GetMapId() == pAreaTrigger->Mapid && !GetPlayer()->InGroup())
{
GetPlayer()->ResurrectPlayer();
return;
}
else if(pMapinfo->type != INSTANCE_NONRAID)
{
GetPlayer()->RepopAtGraveyard(GetPlayer()->GetPositionX(),GetPlayer()->GetPositionY(),GetPlayer()->GetPositionZ(), GetPlayer()->GetMapId());
return;
}
}
}
else
{
GetPlayer()->RepopAtGraveyard(GetPlayer()->GetPositionX(),GetPlayer()->GetPositionY(),GetPlayer()->GetPositionZ(),GetPlayer()->GetMapId());
return;
}
}
sWorldCreator.CheckInstanceForObject(static_cast<Object*>(_player), pMapinfo);
_player->SaveEntryPoint();
_player->SafeTeleport(pAreaTrigger->Mapid, 0, LocationVector(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z, pAreaTrigger->o));
}
}break;
case ATTYPE_QUESTTRIGGER:
{
}break;
case ATTYPE_INN:
{
// Inn
if (!GetPlayer()->m_isResting) GetPlayer()->ApplyPlayerRestState(true);
}break;
case ATTYPE_TELEPORT:
{
if(GetPlayer()->GetPlayerStatus() != TRANSFER_PENDING) //only ports if player is out of pendings
{
_player->SaveEntryPoint();
_player->SafeTeleport(pAreaTrigger->Mapid, 0, LocationVector(pAreaTrigger->x, pAreaTrigger->y, pAreaTrigger->z, pAreaTrigger->o));
}
}break;
case ATTYPE_NULL:
{
MapInfo *pMapinfo = NULL;
pMapinfo = sWorld.GetMapInformation(pAreaTrigger->Mapid);
if(pMapinfo && pMapinfo->HasFlag(WMI_INSTANCE_XPACK_01) && !HasFlag(ACCOUNT_FLAG_XPACK_01))
{
WorldPacket msg;
msg.Initialize(SMSG_BROADCAST_MSG);
msg << uint32(3) << "You must have The Burning Crusade Expansion to access this content." << uint8(0);
SendPacket(&msg);
return;
}
}
default:break;
}
}
}