Skip to content

Commit

Permalink
[12041] Refactor Npc Summoning code
Browse files Browse the repository at this point in the history
* Do positions handling in one place for all npc summon spell types
* Handle a bunch of shared post-summoning processing also in a shared place
* Ensure that summon positions have proper z, thx to Reamer for this part
  • Loading branch information
Schmoozerd committed Jul 15, 2012
1 parent 4f95962 commit 2561cc1
Show file tree
Hide file tree
Showing 3 changed files with 449 additions and 452 deletions.
28 changes: 22 additions & 6 deletions src/game/Spell.h
Expand Up @@ -231,8 +231,8 @@ class Spell
friend struct MaNGOS::SpellNotifierPlayer;
friend struct MaNGOS::SpellNotifierCreatureAndPlayer;
friend void Unit::SetCurrentCastedSpell( Spell * pSpell );
public:

public:
void EffectEmpty(SpellEffectIndex eff_idx);
void EffectNULL(SpellEffectIndex eff_idx);
void EffectUnused(SpellEffectIndex eff_idx);
Expand Down Expand Up @@ -393,11 +393,6 @@ class Spell
void setState(uint32 state) { m_spellState = state; }

void DoCreateItem(SpellEffectIndex eff_idx, uint32 itemtype);
void DoSummonPet(SpellEffectIndex eff_idx);
void DoSummonWild(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
void DoSummonGuardian(SpellEffectIndex eff_idx, uint32 forceFaction = 0);
void DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc = 0);
void DoSummonCritter(SpellEffectIndex eff_idx, uint32 forceFaction = 0);

void WriteSpellGoTargets(WorldPacket* data);
void WriteAmmoToPacket(WorldPacket* data);
Expand Down Expand Up @@ -648,6 +643,27 @@ class Spell
// we can't store original aura link to prevent access to deleted auras
// and in same time need aura data and after aura deleting.
SpellEntry const* m_triggeredByAuraSpell;

private:
// NPC Summonings
struct CreaturePosition
{
CreaturePosition() :
x(0.0f), y(0.0f), z(0.0f),
creature(NULL)
{}

float x, y, z;
Creature* creature;
};
typedef std::vector<CreaturePosition> CreatureSummonPositions;

// return true IFF further processing required
bool DoSummonPet(SpellEffectIndex eff_idx);
bool DoSummonTotem(SpellEffectIndex eff_idx, uint8 slot_dbc = 0);
bool DoSummonWild(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level);
bool DoSummonCritter(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level);
bool DoSummonGuardian(CreatureSummonPositions& list, SummonPropertiesEntry const* prop, SpellEffectIndex effIdx, uint32 level);
};

enum ReplenishType
Expand Down

0 comments on commit 2561cc1

Please sign in to comment.