[9113] Add helper functions to set/getSummonLocation

This should help the poor homeless that does not have a database defined home at evade (such as "wild summon" without owner).

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2010-01-05 19:55:43 +01:00
parent 9bc219a312
commit 7e1d55c38e
4 changed files with 21 additions and 10 deletions

View file

@ -1835,13 +1835,14 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
} }
} }
x = GetPositionX(); float orient;
y = GetPositionY();
z = GetPositionZ(); GetSummonPoint(x, y, z, orient);
if (ori) if (ori)
*ori = GetOrientation(); *ori = orient;
if (dist) if (dist)
*dist = 0; *dist = GetRespawnRadius();
} }
void Creature::AllLootRemovedFromCorpse() void Creature::AllLootRemovedFromCorpse()

View file

@ -576,6 +576,9 @@ class MANGOS_DLL_SPEC Creature : public Unit
void SetCombatStartPosition(float x, float y, float z) { CombatStartX = x; CombatStartY = y; CombatStartZ = z; } void SetCombatStartPosition(float x, float y, float z) { CombatStartX = x; CombatStartY = y; CombatStartZ = z; }
void GetCombatStartPosition(float &x, float &y, float &z) { x = CombatStartX; y = CombatStartY; z = CombatStartZ; } void GetCombatStartPosition(float &x, float &y, float &z) { x = CombatStartX; y = CombatStartY; z = CombatStartZ; }
void SetSummonPoint(float fX, float fY, float fZ, float fOrient) { m_summonXpoint = fX; m_summonYpoint = fY; m_summonZpoint = fZ; m_summonOrientation = fOrient; }
void GetSummonPoint(float &fX, float &fY, float &fZ, float &fOrient) const { fX = m_summonXpoint; fY = m_summonYpoint; fZ = m_summonZpoint; fOrient = m_summonOrientation; }
uint32 GetGlobalCooldown() const { return m_GlobalCooldown; } uint32 GetGlobalCooldown() const { return m_GlobalCooldown; }
void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; } void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; }
@ -629,6 +632,12 @@ class MANGOS_DLL_SPEC Creature : public Unit
float CombatStartX; float CombatStartX;
float CombatStartY; float CombatStartY;
float CombatStartZ; float CombatStartZ;
float m_summonXpoint;
float m_summonYpoint;
float m_summonZpoint;
float m_summonOrientation;
private: private:
GridReference<Creature> m_gridRef; GridReference<Creature> m_gridRef;
CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjMgr::GetCreatureTemplate(GetEntry()) CreatureInfo const* m_creatureInfo; // in difficulty mode > 0 can different from ObjMgr::GetCreatureTemplate(GetEntry())

View file

@ -1687,6 +1687,7 @@ Creature* WorldObject::SummonCreature(uint32 id, float x, float y, float z, floa
GetClosePoint(x, y, z, pCreature->GetObjectSize()); GetClosePoint(x, y, z, pCreature->GetObjectSize());
pCreature->Relocate(x, y, z, ang); pCreature->Relocate(x, y, z, ang);
pCreature->SetSummonPoint(x, y, z, ang);
if(!pCreature->IsPositionValid()) if(!pCreature->IsPositionValid())
{ {

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9112" #define REVISION_NR "9113"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__