[c12610] Implement new TempSummon types

This commit is contained in:
Schmoozerd 2013-05-31 11:56:11 +01:00 committed by Antz
parent 207359612d
commit 662d4ac061
3 changed files with 53 additions and 17 deletions

View file

@ -21,7 +21,7 @@
#include "CreatureAI.h"
TemporarySummon::TemporarySummon(ObjectGuid summoner) :
Creature(CREATURE_SUBTYPE_TEMPORARY_SUMMON), m_type(TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN), m_timer(0), m_lifetime(0), m_summoner(summoner)
Creature(CREATURE_SUBTYPE_TEMPORARY_SUMMON), m_type(TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN), m_timer(0), m_lifetime(0), m_summoner(summoner)
{
}
@ -42,7 +42,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
m_timer -= update_diff;
break;
}
case TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT:
case TEMPSUMMON_TIMED_OOC_DESPAWN:
{
if (!isInCombat())
{
@ -72,6 +72,11 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
m_timer -= update_diff;
}
if (IsDespawned())
{
UnSummon();
return;
}
break;
}
case TEMPSUMMON_CORPSE_DESPAWN:
@ -94,7 +99,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
}
break;
}
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
case TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (isDead())
@ -117,7 +122,7 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
m_timer = m_lifetime;
break;
}
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (IsDespawned())
@ -140,6 +145,38 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
m_timer = m_lifetime;
break;
}
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (isDead())
{
UnSummon();
return;
}
if (m_timer <= update_diff)
{
UnSummon();
return;
}
m_timer -= update_diff;
break;
}
case TEMPSUMMON_TIMED_OR_DEAD_DESPAWN:
{
// if m_deathState is DEAD, CORPSE was skipped
if (IsDespawned())
{
UnSummon();
return;
}
if (m_timer <= update_diff)
{
UnSummon();
return;
}
m_timer -= update_diff;
break;
}
default:
UnSummon();
sLog.outError("Temporary summoned creature (entry: %u) have unknown type %u of ", GetEntry(), m_type);