Core/Entities:

- Rename creature_linked_respawn to linked_respawn
- Update functionality: add field ´linkType´.
** 0 = creature respawn dependant on creature (default)
** 1 = creature respawn dependant on gameobject
** 2 = gameobject respawn dependant on gameobject
** 3 = gameobject respawn dependant on creature

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-12-24 18:55:50 +01:00
parent e57866ac9a
commit c05ed659cb
8 changed files with 271 additions and 135 deletions
@@ -323,8 +323,21 @@ void GameObject::Update(uint32 diff)
{
if (m_respawnTime > 0) // timer on
{
if (m_respawnTime <= time(NULL)) // timer expired
time_t now = time(NULL);
if (m_respawnTime <= now) // timer expired
{
time_t linkedRespawntime = sObjectMgr->GetLinkedRespawnTime(GetGUID(), GetMap()->GetInstanceId());
if (linkedRespawntime) // Can't respawn, the master is dead
{
uint64 targetGuid = sObjectMgr->GetLinkedRespawnGuid(GetGUID());
if (targetGuid == GetGUID()) // if linking self, never respawn (check delayed to next day)
SetRespawnTime(DAY);
else
m_respawnTime = (now > linkedRespawntime ? now : linkedRespawntime)+urand(5,MINUTE); // else copy time from master and add a little
SaveRespawnTime(); // also save to DB immediately
return;
}
m_respawnTime = 0;
m_SkillupList.clear();
m_usetimes = 0;