Core/Player: Teleport the player to a default graveyard (Crossroads/Wesfall) when a zone has no info about graveyards

This commit is contained in:
Nay
2011-08-06 17:23:33 +01:00
parent a39ea8f3e5
commit 548f8ba095
2 changed files with 20 additions and 2 deletions
+19 -2
View File
@@ -5738,6 +5738,21 @@ void ObjectMgr::LoadGraveyardZones()
sLog->outString();
}
WorldSafeLocsEntry const *ObjectMgr::GetDefaultGraveYard(uint32 team)
{
enum DefaultGraveyard
{
HORDE_GRAVEYARD = 10, // Crossroads
ALLIANCE_GRAVEYARD = 4, // Westfall
};
if (team == HORDE)
return sWorldSafeLocsStore.LookupEntry(HORDE_GRAVEYARD);
else if (team == ALLIANCE)
return sWorldSafeLocsStore.LookupEntry(ALLIANCE_GRAVEYARD);
else return NULL;
}
WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team)
{
// search for zone associated closest graveyard
@@ -5746,8 +5761,10 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
if (!zoneId)
{
if (z > -500)
{
sLog->outError("ZoneId not found for map %u coords (%f, %f, %f)", MapId, x, y, z);
return NULL;
return GetDefaultGraveYard(team);
}
}
// Simulate std. algorithm:
@@ -5765,7 +5782,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float
if (graveLow == graveUp && !map->IsBattleArena())
{
sLog->outErrorDb("Table `game_graveyard_zone` incomplete: Zone %u Team %u does not have a linked graveyard.", zoneId, team);
return NULL;
return GetDefaultGraveYard(team);
}
// at corpse map
+1
View File
@@ -704,6 +704,7 @@ class ObjectMgr
GossipText const* GetGossipText(uint32 Text_ID) const;
WorldSafeLocsEntry const *GetDefaultGraveYard(uint32 team);
WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team);
bool AddGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = true);
void RemoveGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = false);