Core/GameObject: added possibilty for gameobjects to contain money loot

This commit is contained in:
Aokromes committed 2016-11-02 05:47:52 +01:00
1 parent 335a1a3a7a
commit 6d49df2635
9 files changed
+152 -36

No files matched your search

@@ -52,6 +52,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
m_prevGoState = GO_STATE_ACTIVE;
m_goInfo = nullptr;
m_goData = nullptr;
m_goTemplateAddon = nullptr;
m_packedRotation = 0;
m_spawnId = 0;
@@ -217,6 +218,7 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
Object::_Create(guidlow, goinfo->entry, HighGuid::GameObject);
m_goInfo = goinfo;
m_goTemplateAddon = sObjectMgr->GetGameObjectTemplateAddon(name_id);
if (goinfo->type >= MAX_GAMEOBJECT_TYPE)
{
@@ -236,8 +238,11 @@ bool GameObject::Create(ObjectGuid::LowType guidlow, uint32 name_id, Map* map, u
SetObjectScale(goinfo->size);
SetUInt32Value(GAMEOBJECT_FACTION, goinfo->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, goinfo->flags);
if (m_goTemplateAddon)
{
SetUInt32Value(GAMEOBJECT_FACTION, m_goTemplateAddon->faction);
SetUInt32Value(GAMEOBJECT_FLAGS, m_goTemplateAddon->flags);
}
SetEntry(goinfo->entry);
@@ -676,8 +681,9 @@ void GameObject::Update(uint32 diff)
SetGoState(GO_STATE_READY);
//any return here in case battleground traps
if (GetGOInfo()->flags & GO_FLAG_NODESPAWN)
return;
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
if (addon->flags & GO_FLAG_NODESPAWN)
return;
}
loot.clear();
@@ -698,7 +704,8 @@ void GameObject::Update(uint32 diff)
{
SendObjectDeSpawnAnim(GetGUID());
//reset flags
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
}
if (!m_respawnDelayTime)
@@ -749,7 +756,9 @@ void GameObject::Delete()
SendObjectDeSpawnAnim(GetGUID());
SetGoState(GO_STATE_READY);
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
if (GameObjectTemplateAddon const* addon = GetTemplateAddon())
SetUInt32Value(GAMEOBJECT_FLAGS, addon->flags);
uint32 poolid = GetSpawnId() ? sPoolMgr->IsPartOfAPool<GameObject>(GetSpawnId()) : 0;
if (poolid)