mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 08:55:32 +01:00
*Store creatureData and goData for creatures and gos.
--HG-- branch : trunk
This commit is contained in:
@@ -140,6 +140,7 @@ m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_A
|
||||
m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL),
|
||||
m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL), m_summonMask(SUMMON_MASK_NONE)
|
||||
, m_AlreadySearchedAssistance(false)
|
||||
, m_creatureData(NULL)
|
||||
{
|
||||
m_regenTimer = 200;
|
||||
m_valuesCount = UNIT_END;
|
||||
@@ -1532,8 +1533,7 @@ bool Creature::LoadFromDB(uint32 guid, Map *map)
|
||||
// checked at creature_template loading
|
||||
m_defaultMovementType = MovementGeneratorType(data->movementType);
|
||||
|
||||
if(!data->dbData)
|
||||
SetInternallyAdded();
|
||||
m_creatureData = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -2082,7 +2082,7 @@ bool Creature::CanAssistTo(const Unit* u, const Unit* enemy, bool checkfaction /
|
||||
|
||||
void Creature::SaveRespawnTime()
|
||||
{
|
||||
if(isSummon() || !m_DBTableGuid || m_isInternallyAdded)
|
||||
if(isSummon() || !m_DBTableGuid || m_creatureData && !m_creatureData->dbData)
|
||||
return;
|
||||
|
||||
if(m_respawnTime > time(NULL)) // dead (no corpse)
|
||||
|
||||
@@ -579,6 +579,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
||||
TrainerSpellData const* GetTrainerSpells() const;
|
||||
|
||||
CreatureInfo const *GetCreatureInfo() const { return m_creatureInfo; }
|
||||
CreatureData const *GetCreatureData() const { return m_creatureData; }
|
||||
CreatureDataAddon const* GetCreatureAddon() const;
|
||||
|
||||
std::string GetAIName() const;
|
||||
@@ -777,6 +778,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
||||
|
||||
GridReference<Creature> m_gridRef;
|
||||
CreatureInfo const* m_creatureInfo; // in heroic mode can different from ObjMgr::GetCreatureTemplate(GetEntry())
|
||||
CreatureData const* m_creatureData;
|
||||
};
|
||||
|
||||
class AssistDelayEvent : public BasicEvent
|
||||
|
||||
@@ -57,6 +57,7 @@ GameObject::GameObject() : WorldObject(), m_goValue(new GameObjectValue)
|
||||
m_charges = 5;
|
||||
m_cooldownTime = 0;
|
||||
m_goInfo = NULL;
|
||||
m_goData = NULL;
|
||||
|
||||
m_DBTableGuid = 0;
|
||||
}
|
||||
@@ -628,8 +629,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
|
||||
}
|
||||
}
|
||||
|
||||
if(!data->dbData)
|
||||
SetInternallyAdded();
|
||||
m_goData = data;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -647,11 +647,6 @@ GameObject* GameObject::GetGameObject(WorldObject& object, uint64 guid)
|
||||
return object.GetMap()->GetGameObject(guid);
|
||||
}
|
||||
|
||||
GameObjectInfo const *GameObject::GetGOInfo() const
|
||||
{
|
||||
return m_goInfo;
|
||||
}
|
||||
|
||||
uint32 GameObject::GetLootId(GameObjectInfo const* ginfo)
|
||||
{
|
||||
if (!ginfo)
|
||||
@@ -710,7 +705,7 @@ Unit* GameObject::GetOwner() const
|
||||
|
||||
void GameObject::SaveRespawnTime()
|
||||
{
|
||||
if(!m_isInternallyAdded && m_respawnTime > time(NULL) && m_spawnedByDefault)
|
||||
if(m_goData && m_goData->dbData && m_respawnTime > time(NULL) && m_spawnedByDefault)
|
||||
objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime);
|
||||
}
|
||||
|
||||
|
||||
@@ -471,7 +471,8 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 ArtKit = 0);
|
||||
void Update(uint32 p_time);
|
||||
static GameObject* GetGameObject(WorldObject& object, uint64 guid);
|
||||
GameObjectInfo const* GetGOInfo() const;
|
||||
GameObjectInfo const* GetGOInfo() const { return m_goInfo; }
|
||||
GameObjectData const* GetGOData() const { return m_goData; }
|
||||
|
||||
bool IsTransport() const;
|
||||
|
||||
@@ -663,6 +664,7 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
|
||||
|
||||
uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
|
||||
GameObjectInfo const* m_goInfo;
|
||||
GameObjectData const* m_goData;
|
||||
GameObjectValue * const m_goValue;
|
||||
private:
|
||||
void SwitchDoorOrButton(bool activate, bool alternative = false);
|
||||
|
||||
@@ -1070,7 +1070,6 @@ WorldObject::WorldObject()
|
||||
m_positionX(0.0f), m_positionY(0.0f), m_positionZ(0.0f), m_orientation(0.0f)
|
||||
, m_map(NULL), m_zoneScript(NULL)
|
||||
, m_isActive(false), IsTempWorldObject(false)
|
||||
, m_isInternallyAdded(false)
|
||||
, m_name("")
|
||||
{
|
||||
}
|
||||
|
||||
@@ -548,7 +548,6 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
||||
|
||||
bool isActiveObject() const { return m_isActive; }
|
||||
void setActive(bool isActiveObject);
|
||||
void SetInternallyAdded() { m_isInternallyAdded = true; }
|
||||
void SetWorldObject(bool apply);
|
||||
template<class NOTIFIER> void VisitNearbyObject(const float &radius, NOTIFIER ¬ifier) const { GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); }
|
||||
template<class NOTIFIER> void VisitNearbyGridObject(const float &radius, NOTIFIER ¬ifier) const { GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); }
|
||||
@@ -567,7 +566,6 @@ class TRINITY_DLL_SPEC WorldObject : public Object
|
||||
explicit WorldObject();
|
||||
std::string m_name;
|
||||
bool m_isActive;
|
||||
bool m_isInternallyAdded;
|
||||
ZoneScript *m_zoneScript;
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user