Core/GameObjects: Destructible gameobjects now read display info from dbc files

This commit is contained in:
Shauren committed 2011-04-09 22:04:56 +02:00
1 parent 3bc45e121f
commit 6a9fa42a60
5 files changed
+141 -103

No files matched your search

@@ -1702,9 +1702,14 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
if (!m_goValue->building.health)
{
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->building.destroyedDisplayId);
uint32 modelId = m_goInfo->building.destroyedDisplayId;
if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData))
if (modelData->DestroyedDisplayId)
modelId = modelData->DestroyedDisplayId;
SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId);
EventInform(m_goInfo->building.destroyedEvent);
if (pwho)
if (Battleground* bg = pwho->GetBattleground())
@@ -1730,7 +1735,13 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
m_goValue->building.health = 1;
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->building.damagedDisplayId);
uint32 modelId = m_goInfo->building.damagedDisplayId;
if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->building.destructibleData))
if (modelData->DamagedDisplayId)
modelId = modelData->DamagedDisplayId;
SetUInt32Value(GAMEOBJECT_DISPLAYID, modelId);
EventInform(m_goInfo->building.damagedEvent);
sScriptMgr->OnGameObjectDamaged(this, pwho, m_goInfo->building.damagedEvent);
hitType = BG_OBJECT_DMG_HIT_TYPE_JUST_HIGH_DAMAGED;
@@ -1744,7 +1755,7 @@ void GameObject::TakenDamage(uint32 damage, Unit *who)
void GameObject::Rebuild()
{
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED + GO_FLAG_DESTROYED);
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED | GO_FLAG_DESTROYED);
SetUInt32Value(GAMEOBJECT_DISPLAYID, m_goInfo->displayId);
m_goValue->building.health = m_goInfo->building.intactNumHits + m_goInfo->building.damagedNumHits;
EventInform(m_goInfo->building.rebuildingEvent);