Core/Maps: Implemented getting area id from gameobject spawns

Yes, you can now spawn LK platform anywhere and it will treat you as inside Icecrown Citadel
This commit is contained in:
Shauren
2018-03-28 22:01:22 +02:00
parent 95615a4b0d
commit 42f9deb21e
16 changed files with 161 additions and 45 deletions

View File

@@ -2203,8 +2203,8 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
uint32 modelId = m_goInfo->displayId;
if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->destructibleBuilding.DestructibleModelRec))
if (modelData->State0Wmo)
modelId = modelData->State0Wmo;
if (modelData->State1Wmo)
modelId = modelData->State1Wmo;
SetDisplayId(modelId);
if (setHealth)
@@ -2231,8 +2231,8 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
uint32 modelId = m_goInfo->displayId;
if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->destructibleBuilding.DestructibleModelRec))
if (modelData->State1Wmo)
modelId = modelData->State1Wmo;
if (modelData->State2Wmo)
modelId = modelData->State2Wmo;
SetDisplayId(modelId);
if (setHealth)
@@ -2250,8 +2250,8 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
uint32 modelId = m_goInfo->displayId;
if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->destructibleBuilding.DestructibleModelRec))
if (modelData->State2Wmo)
modelId = modelData->State2Wmo;
if (modelData->State3Wmo)
modelId = modelData->State3Wmo;
SetDisplayId(modelId);
// restores to full health
@@ -2348,6 +2348,39 @@ void GameObject::SetDisplayId(uint32 displayid)
UpdateModel();
}
uint8 GameObject::GetNameSetId() const
{
switch (GetGoType())
{
case GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING:
if (DestructibleModelDataEntry const* modelData = sDestructibleModelDataStore.LookupEntry(m_goInfo->destructibleBuilding.DestructibleModelRec))
{
switch (GetDestructibleState())
{
case GO_DESTRUCTIBLE_INTACT:
return modelData->State0NameSet;
case GO_DESTRUCTIBLE_DAMAGED:
return modelData->State1NameSet;
case GO_DESTRUCTIBLE_DESTROYED:
return modelData->State2NameSet;
case GO_DESTRUCTIBLE_REBUILDING:
return modelData->State3NameSet;
default:
break;
}
}
break;
case GAMEOBJECT_TYPE_GARRISON_BUILDING:
case GAMEOBJECT_TYPE_GARRISON_PLOT:
case GAMEOBJECT_TYPE_PHASEABLE_MO:
return GetByteValue(GAMEOBJECT_FLAGS, 1) & 0xF;
default:
break;
}
return 0;
}
void GameObject::EnableCollision(bool enable)
{
if (!m_model)
@@ -2615,13 +2648,14 @@ public:
explicit GameObjectModelOwnerImpl(GameObject const* owner) : _owner(owner) { }
virtual ~GameObjectModelOwnerImpl() = default;
virtual bool IsSpawned() const override { return _owner->isSpawned(); }
virtual uint32 GetDisplayId() const override { return _owner->GetDisplayId(); }
virtual bool IsInPhase(PhaseShift const& phaseShift) const override { return _owner->GetPhaseShift().CanSee(phaseShift); }
virtual G3D::Vector3 GetPosition() const override { return G3D::Vector3(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); }
virtual float GetOrientation() const override { return _owner->GetOrientation(); }
virtual float GetScale() const override { return _owner->GetObjectScale(); }
virtual void DebugVisualizeCorner(G3D::Vector3 const& corner) const override { _owner->SummonCreature(1, corner.x, corner.y, corner.z, 0, TEMPSUMMON_MANUAL_DESPAWN); }
bool IsSpawned() const override { return _owner->isSpawned(); }
uint32 GetDisplayId() const override { return _owner->GetDisplayId(); }
uint8 GetNameSetId() const override { return _owner->GetNameSetId(); }
bool IsInPhase(PhaseShift const& phaseShift) const override { return _owner->GetPhaseShift().CanSee(phaseShift); }
G3D::Vector3 GetPosition() const override { return G3D::Vector3(_owner->GetPositionX(), _owner->GetPositionY(), _owner->GetPositionZ()); }
float GetOrientation() const override { return _owner->GetOrientation(); }
float GetScale() const override { return _owner->GetObjectScale(); }
void DebugVisualizeCorner(G3D::Vector3 const& corner) const override { _owner->SummonCreature(1, corner.x, corner.y, corner.z, 0, TEMPSUMMON_MANUAL_DESPAWN); }
private:
GameObject const* _owner;