[7657] Implement function for access to gameobject owned by unit and created by some spell. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
+12
-3
@@ -3300,7 +3300,7 @@ void Unit::_UpdateSpells( uint32 time )
|
|||||||
|
|
||||||
if(!m_gameObj.empty())
|
if(!m_gameObj.empty())
|
||||||
{
|
{
|
||||||
std::list<GameObject*>::iterator ite1, dnext1;
|
GameObjectList::iterator ite1, dnext1;
|
||||||
for (ite1 = m_gameObj.begin(); ite1 != m_gameObj.end(); ite1 = dnext1)
|
for (ite1 = m_gameObj.begin(); ite1 != m_gameObj.end(); ite1 = dnext1)
|
||||||
{
|
{
|
||||||
dnext1 = ite1;
|
dnext1 = ite1;
|
||||||
@@ -4375,6 +4375,15 @@ DynamicObject * Unit::GetDynObject(uint32 spellId)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameObject* Unit::GetGameObject(uint32 spellId) const
|
||||||
|
{
|
||||||
|
for (GameObjectList::const_iterator i = m_gameObj.begin(); i != m_gameObj.end();)
|
||||||
|
if ((*i)->GetSpellId() == spellId)
|
||||||
|
return *i;
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::AddGameObject(GameObject* gameObj)
|
void Unit::AddGameObject(GameObject* gameObj)
|
||||||
{
|
{
|
||||||
assert(gameObj && gameObj->GetOwnerGUID()==0);
|
assert(gameObj && gameObj->GetOwnerGUID()==0);
|
||||||
@@ -4425,7 +4434,7 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
|
|||||||
{
|
{
|
||||||
if(m_gameObj.empty())
|
if(m_gameObj.empty())
|
||||||
return;
|
return;
|
||||||
std::list<GameObject*>::iterator i, next;
|
GameObjectList::iterator i, next;
|
||||||
for (i = m_gameObj.begin(); i != m_gameObj.end(); i = next)
|
for (i = m_gameObj.begin(); i != m_gameObj.end(); i = next)
|
||||||
{
|
{
|
||||||
next = i;
|
next = i;
|
||||||
@@ -4448,7 +4457,7 @@ void Unit::RemoveGameObject(uint32 spellid, bool del)
|
|||||||
void Unit::RemoveAllGameObjects()
|
void Unit::RemoveAllGameObjects()
|
||||||
{
|
{
|
||||||
// remove references to unit
|
// remove references to unit
|
||||||
for(std::list<GameObject*>::iterator i = m_gameObj.begin(); i != m_gameObj.end();)
|
for(GameObjectList::iterator i = m_gameObj.begin(); i != m_gameObj.end();)
|
||||||
{
|
{
|
||||||
(*i)->SetOwnerGUID(0);
|
(*i)->SetOwnerGUID(0);
|
||||||
(*i)->SetRespawnTime(0);
|
(*i)->SetRespawnTime(0);
|
||||||
|
|||||||
+8
-3
@@ -1430,16 +1430,20 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); }
|
void SetNativeDisplayId(uint32 modelId) { SetUInt32Value(UNIT_FIELD_NATIVEDISPLAYID, modelId); }
|
||||||
void setTransForm(uint32 spellid) { m_transform = spellid;}
|
void setTransForm(uint32 spellid) { m_transform = spellid;}
|
||||||
uint32 getTransForm() const { return m_transform;}
|
uint32 getTransForm() const { return m_transform;}
|
||||||
|
|
||||||
|
DynamicObject* GetDynObject(uint32 spellId, uint32 effIndex);
|
||||||
|
DynamicObject* GetDynObject(uint32 spellId);
|
||||||
void AddDynObject(DynamicObject* dynObj);
|
void AddDynObject(DynamicObject* dynObj);
|
||||||
void RemoveDynObject(uint32 spellid);
|
void RemoveDynObject(uint32 spellid);
|
||||||
void RemoveDynObjectWithGUID(uint64 guid) { m_dynObjGUIDs.remove(guid); }
|
void RemoveDynObjectWithGUID(uint64 guid) { m_dynObjGUIDs.remove(guid); }
|
||||||
void RemoveAllDynObjects();
|
void RemoveAllDynObjects();
|
||||||
|
|
||||||
|
GameObject* GetGameObject(uint32 spellId) const;
|
||||||
void AddGameObject(GameObject* gameObj);
|
void AddGameObject(GameObject* gameObj);
|
||||||
void RemoveGameObject(GameObject* gameObj, bool del);
|
void RemoveGameObject(GameObject* gameObj, bool del);
|
||||||
void RemoveGameObject(uint32 spellid, bool del);
|
void RemoveGameObject(uint32 spellid, bool del);
|
||||||
void RemoveAllGameObjects();
|
void RemoveAllGameObjects();
|
||||||
DynamicObject *GetDynObject(uint32 spellId, uint32 effIndex);
|
|
||||||
DynamicObject *GetDynObject(uint32 spellId);
|
|
||||||
uint32 CalculateDamage(WeaponAttackType attType, bool normalized);
|
uint32 CalculateDamage(WeaponAttackType attType, bool normalized);
|
||||||
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
|
float GetAPMultiplier(WeaponAttackType attType, bool normalized);
|
||||||
void ModifyAuraState(AuraState flag, bool apply);
|
void ModifyAuraState(AuraState flag, bool apply);
|
||||||
@@ -1582,7 +1586,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
typedef std::list<uint64> DynObjectGUIDs;
|
typedef std::list<uint64> DynObjectGUIDs;
|
||||||
DynObjectGUIDs m_dynObjGUIDs;
|
DynObjectGUIDs m_dynObjGUIDs;
|
||||||
|
|
||||||
std::list<GameObject*> m_gameObj;
|
typedef std::list<GameObject*> GameObjectList;
|
||||||
|
GameObjectList m_gameObj;
|
||||||
bool m_isSorted;
|
bool m_isSorted;
|
||||||
uint32 m_transform;
|
uint32 m_transform;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user