[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

@ -45,14 +45,16 @@
enum TempSummonType
{
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time OR when the creature disappears
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN = 2, // despawns after a specified time OR when the creature dies
TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time
TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat
TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death
TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death
TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears
TEMPSUMMON_MANUAL_DESPAWN = 8 // despawns when UnSummon() is called
TEMPSUMMON_MANUAL_DESPAWN = 0, // despawns when UnSummon() is called
TEMPSUMMON_DEAD_DESPAWN = 1, // despawns when the creature disappears
TEMPSUMMON_CORPSE_DESPAWN = 2, // despawns instantly after death
TEMPSUMMON_CORPSE_TIMED_DESPAWN = 3, // despawns after a specified time after death (or when the creature disappears)
TEMPSUMMON_TIMED_DESPAWN = 4, // despawns after a specified time
TEMPSUMMON_TIMED_OOC_DESPAWN = 5, // despawns after a specified time after the creature is out of combat
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 6, // despawns after a specified time OR when the creature disappears
TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN = 7, // despawns after a specified time OR when the creature dies
TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN = 8, // despawns after a specified time (OOC) OR when the creature disappears
TEMPSUMMON_TIMED_OOC_OR_CORPSE_DESPAWN = 9, // despawns after a specified time (OOC) OR when the creature dies
};
enum PhaseMasks
@ -96,7 +98,6 @@ struct WorldLocation
: mapid(loc.mapid), coord_x(loc.coord_x), coord_y(loc.coord_y), coord_z(loc.coord_z), orientation(NormalizeOrientation(loc.orientation)) {}
};
// use this class to measure time between world update ticks
// essential for units updating their spells after cells become active
class WorldUpdateCounter
@ -355,8 +356,6 @@ class MANGOS_DLL_SPEC Object
uint16 GetValuesCount() const { return m_valuesCount; }
void InitValues() { _InitValues(); }
virtual bool HasQuest(uint32 /* quest_id */) const { return false; }
virtual bool HasInvolvedQuest(uint32 /* quest_id */) const { return false; }
@ -386,7 +385,7 @@ class MANGOS_DLL_SPEC Object
float* m_floatValues;
};
uint32* m_uint32Values_mirror;
std::vector<bool> m_changedValues;
uint16 m_valuesCount;

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);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "12609"
#define REVISION_NR "12610"
#endif // __REVISION_NR_H__