Skip to content

chore(#26636): extend logging for GetClosestGraveyard() #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/server/game/Battlegrounds/Battleground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1795,7 +1795,7 @@ void Battleground::SetBgRaid(uint32 TeamID, Group* bg_raid)

WorldSafeLocsEntry const* Battleground::GetClosestGraveyard(Player* player)
{
return sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
return sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam(), player->GetGUID());
}

void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Entities/Player/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4862,7 +4862,7 @@ void Player::RepopAtGraveyard()
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
ClosestGrave = bf->GetClosestGraveyard(this);
else
ClosestGrave = sObjectMgr->GetClosestGraveyard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam());
ClosestGrave = sObjectMgr->GetClosestGraveyard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam(), GetGUID());
}

// stop countdown until repop
Expand Down Expand Up @@ -22084,7 +22084,7 @@ void Player::SetBattlegroundEntryPoint()
// If map is dungeon find linked graveyard
if (GetMap()->IsDungeon())
{
if (WorldSafeLocsEntry const* entry = sObjectMgr->GetClosestGraveyard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()))
if (WorldSafeLocsEntry const* entry = sObjectMgr->GetClosestGraveyard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam(), GetGUID()))
m_bgData.joinPos = WorldLocation(entry->Continent, entry->Loc.X, entry->Loc.Y, entry->Loc.Z, 0.0f);
else
TC_LOG_ERROR("entities.player", "Player::SetBattlegroundEntryPoint: Dungeon (MapID: {}) has no linked graveyard, setting home location as entry point.", GetMapId());
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Globals/ObjectMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7019,7 +7019,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveyard(uint32 team) const
else return nullptr;
}

WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(float x, float y, float z, uint32 MapId, uint32 team) const
WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(float x, float y, float z, uint32 MapId, uint32 team, ObjectGuid playerGuid) const
{
// search for zone associated closest graveyard
uint32 zoneId = sMapMgr->GetZoneId(PHASEMASK_NORMAL, MapId, x, y, z);
Expand All @@ -7028,7 +7028,7 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveyard(float x, float y, float
{
if (z > -500)
{
TC_LOG_ERROR("misc", "ZoneId not found for map {} coords ({}, {}, {})", MapId, x, y, z);
TC_LOG_ERROR("misc", "ZoneId not found for map {} coords ({}, {}, {}), player GUID: {}", MapId, x, y, z, playerGuid.GetRawValue());
return GetDefaultGraveyard(team);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Globals/ObjectMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -1059,7 +1059,7 @@ class TC_GAME_API ObjectMgr
QuestGreeting const* GetQuestGreeting(ObjectGuid guid) const;

WorldSafeLocsEntry const* GetDefaultGraveyard(uint32 team) const;
WorldSafeLocsEntry const* GetClosestGraveyard(float x, float y, float z, uint32 MapId, uint32 team) const;
WorldSafeLocsEntry const* GetClosestGraveyard(float x, float y, float z, uint32 MapId, uint32 team, ObjectGuid playerGuid) const;
bool AddGraveyardLink(uint32 id, uint32 zoneId, uint32 team, bool persist = true);
void RemoveGraveyardLink(uint32 id, uint32 zoneId, uint32 team, bool persist = false);
void LoadGraveyardZones();
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Groups/Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2241,7 +2241,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo)
TC_LOG_DEBUG("root", "Instance entrance not found for maps {}", map->GetId());
else
{
WorldSafeLocsEntry const * graveyardLocation = sObjectMgr->GetClosestGraveyard(instanceEntrance->target_X, instanceEntrance->target_Y, instanceEntrance->target_Z, instanceEntrance->target_mapId, SendMsgTo->GetTeam());
WorldSafeLocsEntry const * graveyardLocation = sObjectMgr->GetClosestGraveyard(instanceEntrance->target_X, instanceEntrance->target_Y, instanceEntrance->target_Z, instanceEntrance->target_mapId, SendMsgTo->GetTeam(), SendMsgTo->GetGUID());
uint32 const zoneId = sMapMgr->GetZoneId(PHASEMASK_NORMAL, graveyardLocation->Continent, graveyardLocation->Loc.X, graveyardLocation->Loc.Y, graveyardLocation->Loc.Z);

for (MemberSlot const& member : GetMemberSlots())
Expand Down
4 changes: 2 additions & 2 deletions src/server/game/Handlers/NPCHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ void WorldSession::SendSpiritResurrect()
{
WorldLocation const& corpseLocation = _player->GetCorpseLocation();
corpseGrave = sObjectMgr->GetClosestGraveyard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(),
corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeam());
corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeam(), _player->GetGUID());
}

// now can spawn bones
Expand All @@ -232,7 +232,7 @@ void WorldSession::SendSpiritResurrect()
if (corpseGrave)
{
WorldSafeLocsEntry const* ghostGrave = sObjectMgr->GetClosestGraveyard(
_player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam());
_player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam(), _player->GetGUID());

if (corpseGrave != ghostGrave)
_player->TeleportTo(corpseGrave->Continent, corpseGrave->Loc.X, corpseGrave->Loc.Y, corpseGrave->Loc.Z, _player->GetOrientation());
Expand Down
2 changes: 1 addition & 1 deletion src/server/scripts/Commands/cs_debug.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1534,7 +1534,7 @@ class debug_commandscript : public CommandScript
if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(player->GetZoneId()))
nearestLoc = bf->GetClosestGraveyard(player);
else
nearestLoc = sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam());
nearestLoc = sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), player->GetTeam(), player->GetGUID());
}
}
else
Expand Down
2 changes: 1 addition & 1 deletion src/server/scripts/Commands/cs_misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ class misc_commandscript : public CommandScript
Player* player = handler->GetSession()->GetPlayer();
uint32 zone_id = player->GetZoneId();

WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team);
WorldSafeLocsEntry const* graveyard = sObjectMgr->GetClosestGraveyard(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), team, player->GetGUID());
if (graveyard)
{
uint32 graveyardId = graveyard->ID;
Expand Down