mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[8142] Remade precast spell system to be more similar to trigger spell system.
* Removed runtime allocation of list * Methods and defines from precast spell system and trigger system moved closer to each other Signed-off-by: ApoC <apoc@nymfe.net>
This commit is contained in:
parent
42300153ce
commit
5d4b581009
3 changed files with 9 additions and 17 deletions
|
|
@ -395,6 +395,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
|
||||||
|
|
||||||
m_castPositionX = m_castPositionY = m_castPositionZ = 0;
|
m_castPositionX = m_castPositionY = m_castPositionZ = 0;
|
||||||
m_TriggerSpells.clear();
|
m_TriggerSpells.clear();
|
||||||
|
m_preCastSpells.clear();
|
||||||
m_IsTriggeredSpell = triggered;
|
m_IsTriggeredSpell = triggered;
|
||||||
//m_AreaAura = false;
|
//m_AreaAura = false;
|
||||||
m_CastItem = NULL;
|
m_CastItem = NULL;
|
||||||
|
|
@ -405,7 +406,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
|
||||||
focusObject = NULL;
|
focusObject = NULL;
|
||||||
m_cast_count = 0;
|
m_cast_count = 0;
|
||||||
m_glyphIndex = 0;
|
m_glyphIndex = 0;
|
||||||
m_preCastSpells = NULL;
|
|
||||||
m_triggeredByAuraSpell = NULL;
|
m_triggeredByAuraSpell = NULL;
|
||||||
|
|
||||||
//Auto Shot & Shoot (wand)
|
//Auto Shot & Shoot (wand)
|
||||||
|
|
@ -445,7 +445,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
|
||||||
|
|
||||||
Spell::~Spell()
|
Spell::~Spell()
|
||||||
{
|
{
|
||||||
delete m_preCastSpells;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
@ -1239,12 +1238,11 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||||
unit->IncrDiminishing(m_diminishGroup);
|
unit->IncrDiminishing(m_diminishGroup);
|
||||||
|
|
||||||
// Apply additional spell effects to target
|
// Apply additional spell effects to target
|
||||||
if (m_preCastSpells)
|
while (!m_preCastSpells.empty())
|
||||||
{
|
{
|
||||||
for (SpellPrecasts::const_iterator i = m_preCastSpells->begin(); i != m_preCastSpells->end(); ++i)
|
uint32 spellId = *m_preCastSpells.begin();
|
||||||
m_caster->CastSpell(unit, *i, true, m_CastItem);
|
m_caster->CastSpell(unit, spellId, true, m_CastItem);
|
||||||
delete m_preCastSpells;
|
m_preCastSpells.erase(m_preCastSpells.begin());
|
||||||
m_preCastSpells = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber)
|
for(uint32 effectNumber = 0; effectNumber < 3; ++effectNumber)
|
||||||
|
|
|
||||||
|
|
@ -204,7 +204,6 @@ enum SpellTargets
|
||||||
#define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS)
|
#define SPELL_SPELL_CHANNEL_UPDATE_INTERVAL (1*IN_MILISECONDS)
|
||||||
|
|
||||||
typedef std::multimap<uint64, uint64> SpellTargetTimeMap;
|
typedef std::multimap<uint64, uint64> SpellTargetTimeMap;
|
||||||
typedef std::list<uint32> SpellPrecasts;
|
|
||||||
|
|
||||||
class Spell
|
class Spell
|
||||||
{
|
{
|
||||||
|
|
@ -336,13 +335,6 @@ class Spell
|
||||||
void TakeCastItem();
|
void TakeCastItem();
|
||||||
void TriggerSpell();
|
void TriggerSpell();
|
||||||
|
|
||||||
void AddPrecastSpell(uint32 spellId)
|
|
||||||
{
|
|
||||||
if (!m_preCastSpells)
|
|
||||||
m_preCastSpells = new SpellPrecasts();
|
|
||||||
m_preCastSpells->push_back(spellId);
|
|
||||||
}
|
|
||||||
|
|
||||||
SpellCastResult CheckCast(bool strict);
|
SpellCastResult CheckCast(bool strict);
|
||||||
SpellCastResult CheckPetCast(Unit* target);
|
SpellCastResult CheckPetCast(Unit* target);
|
||||||
|
|
||||||
|
|
@ -407,7 +399,6 @@ class Spell
|
||||||
Item* m_CastItem;
|
Item* m_CastItem;
|
||||||
uint8 m_cast_count;
|
uint8 m_cast_count;
|
||||||
uint32 m_glyphIndex;
|
uint32 m_glyphIndex;
|
||||||
SpellPrecasts *m_preCastSpells;
|
|
||||||
SpellCastTargets m_targets;
|
SpellCastTargets m_targets;
|
||||||
|
|
||||||
int32 GetCastTime() const { return m_casttime; }
|
int32 GetCastTime() const { return m_casttime; }
|
||||||
|
|
@ -448,6 +439,7 @@ class Spell
|
||||||
bool CheckTargetCreatureType(Unit* target) const;
|
bool CheckTargetCreatureType(Unit* target) const;
|
||||||
|
|
||||||
void AddTriggeredSpell(SpellEntry const* spell) { m_TriggerSpells.push_back(spell); }
|
void AddTriggeredSpell(SpellEntry const* spell) { m_TriggerSpells.push_back(spell); }
|
||||||
|
void AddPrecastSpell(uint32 spellId) { m_preCastSpells.push_back(spellId); }
|
||||||
|
|
||||||
void CleanupTargetList();
|
void CleanupTargetList();
|
||||||
protected:
|
protected:
|
||||||
|
|
@ -567,7 +559,9 @@ class Spell
|
||||||
|
|
||||||
//List For Triggered Spells
|
//List For Triggered Spells
|
||||||
typedef std::list<SpellEntry const*> TriggerSpells;
|
typedef std::list<SpellEntry const*> TriggerSpells;
|
||||||
|
typedef std::list<uint32> SpellPrecasts;
|
||||||
TriggerSpells m_TriggerSpells;
|
TriggerSpells m_TriggerSpells;
|
||||||
|
SpellPrecasts m_preCastSpells;
|
||||||
|
|
||||||
uint32 m_spellState;
|
uint32 m_spellState;
|
||||||
uint32 m_timer;
|
uint32 m_timer;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8141"
|
#define REVISION_NR "8142"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue