Core/Entities: Fix guid lookup for linked respawn system

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-12-25 02:22:35 +01:00
parent 95eb430dc0
commit 06955a1113
2 changed files with 5 additions and 3 deletions
@@ -464,7 +464,8 @@ void Creature::Update(uint32 diff)
if (!allowed) // Will be rechecked on next Update call
break;
time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(GetGUID(), GetMap()->GetInstanceId());
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_UNIT);
time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(dbtableHighGuid, GetMap()->GetInstanceId());
if (!linkedRespawntime) // Can respawn
Respawn();
else // the master is dead
@@ -326,10 +326,11 @@ void GameObject::Update(uint32 diff)
time_t now = time(NULL);
if (m_respawnTime <= now) // timer expired
{
time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(GetGUID(), GetMap()->GetInstanceId());
uint64 dbtableHighGuid = MAKE_NEW_GUID(m_DBTableGuid, GetEntry(), HIGHGUID_GAMEOBJECT);
time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(dbtableHighGuid, GetMap()->GetInstanceId());
if (linkedRespawntime) // Can't respawn, the master is dead
{
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(GetGUID());
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(dbtableHighGuid);
if (targetGuid == GetGUID()) // if linking self, never respawn (check delayed to next day)
SetRespawnTime(DAY);
else