Skip to content

Commit

Permalink
Wintergrasp Fix Collision Wall work: Open / Close collision wall when…
Browse files Browse the repository at this point in the history
… battle started/ended (#22342)

* Open / Close collision wall when battle started/ended
  • Loading branch information
chaosua authored and jackpoz committed Sep 25, 2018
1 parent 0dd3f04 commit c4e561e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/server/game/Battlefield/Zones/BattlefieldWG.cpp
Expand Up @@ -652,6 +652,12 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
relic->RemoveFromWorld();
m_titansRelicGUID.Clear();

// change collision wall state closed
for (BfWGGameObjectBuilding* building : BuildingsInZone)
{
building->RebuildGate();
}

// successful defense
if (endByTimer)
UpdateData(GetDefenderTeam() == TEAM_HORDE ? BATTLEFIELD_WG_DATA_DEF_H : BATTLEFIELD_WG_DATA_DEF_A, 1);
Expand Down Expand Up @@ -1429,7 +1435,7 @@ void BfWGGameObjectBuilding::Rebuild()
build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, nullptr, true);
if (build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f))
go->SetGoState(GO_STATE_READY);
go->SetGoState(GO_STATE_ACTIVE);

// Update worldstate
_state = WintergraspGameObjectState(BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (_teamControl * 3));
Expand All @@ -1440,6 +1446,18 @@ void BfWGGameObjectBuilding::Rebuild()
}
}

void BfWGGameObjectBuilding::RebuildGate()
{
if (GameObject* build = _wg->GetGameObject(_buildGUID))
{
if (build->IsDestructibleBuilding() && build->GetEntry() == GO_WINTERGRASP_VAULT_GATE)
{
if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f))
go->SetGoState(GO_STATE_READY); //not GO_STATE_ACTIVE
}
}
}

void BfWGGameObjectBuilding::Damaged()
{
// Update worldstate
Expand Down
1 change: 1 addition & 0 deletions src/server/game/Battlefield/Zones/BattlefieldWG.h
Expand Up @@ -572,6 +572,7 @@ struct TC_GAME_API BfWGGameObjectBuilding
ObjectGuid const& GetGUID() const { return _buildGUID; }

void Rebuild();
void RebuildGate();

// Called when associated gameobject is damaged
void Damaged();
Expand Down

1 comment on commit c4e561e

@chaosua
Copy link
Contributor Author

@chaosua chaosua commented on c4e561e Oct 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#8661 (comment)
and next comment
#8661 (comment)
there is somthing to be implemented

Please sign in to comment.