[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

@ -1826,22 +1826,23 @@ void Creature::GetRespawnCoord( float &x, float &y, float &z, float* ori, float*
x = data->posX;
y = data->posY;
z = data->posZ;
if(ori)
if (ori)
*ori = data->orientation;
if(dist)
if (dist)
*dist = data->spawndist;
return;
}
}
x = GetPositionX();
y = GetPositionY();
z = GetPositionZ();
if(ori)
*ori = GetOrientation();
if(dist)
*dist = 0;
float orient;
GetSummonPoint(x, y, z, orient);
if (ori)
*ori = orient;
if (dist)
*dist = GetRespawnRadius();
}
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 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; }
void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; }
@ -629,6 +632,12 @@ class MANGOS_DLL_SPEC Creature : public Unit
float CombatStartX;
float CombatStartY;
float CombatStartZ;
float m_summonXpoint;
float m_summonYpoint;
float m_summonZpoint;
float m_summonOrientation;
private:
GridReference<Creature> m_gridRef;
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());
pCreature->Relocate(x, y, z, ang);
pCreature->SetSummonPoint(x, y, z, ang);
if(!pCreature->IsPositionValid())
{

View file

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