fix(Core/Battlegrounds): Delay a little bit relocation of dead players. (#9302)

Fixes #8958
This commit is contained in:
UltraNix
2021-12-08 22:10:26 +01:00
committed by GitHub
parent 6c1846ad8f
commit 85abfafb2b
6 changed files with 84 additions and 43 deletions

View File

@@ -790,15 +790,22 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
trigger->CastSpell(trigger, SPELL_HONORABLE_DEFENDER_25Y, false);
}
}
void BattlegroundAV::DePopulateNode(BG_AV_Nodes node)
void BattlegroundAV::DePopulateNode(BG_AV_Nodes node, bool ignoreSpiritGuide)
{
uint32 c_place = AV_CPLACE_DEFENSE_STORM_AID + (4 * node);
for (uint8 i = 0; i < 4; i++)
{
if (BgCreatures[c_place + i])
{
DelCreature(c_place + i);
}
}
//spiritguide
if (!IsTower(node) && BgCreatures[node])
if (!ignoreSpiritGuide && !IsTower(node))
{
DelCreature(node);
}
//remove bonus honor aura trigger creature when node is lost
if (node < BG_AV_NODES_MAX)//fail safe
@@ -1031,6 +1038,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
SpawnBGObject(object - 22, RESPAWN_IMMEDIATELY);
else
SpawnBGObject(object + 22, RESPAWN_IMMEDIATELY);
bool ignoreSpiritGuide = false;
if (IsTower(node))
{
//spawning/despawning of bigflag+aura
@@ -1045,9 +1054,18 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
SpawnBGObject(BG_AV_OBJECT_AURA_N_FIRSTAID_STATION + 3 * node, RESPAWN_IMMEDIATELY); //neutral aura spawn
SpawnBGObject(static_cast<uint8>(BG_AV_OBJECT_AURA_A_FIRSTAID_STATION) + prevOwnerId + 3 * node, RESPAWN_ONE_DAY); //teeamaura despawn
RelocateDeadPlayers(BgCreatures[node]);
ignoreSpiritGuide = true;
_reviveEvents.AddEventAtOffset([this, node]()
{
RelocateDeadPlayers(BgCreatures[node]);
if (!IsTower(node))
DelCreature(node); // Delete spirit healer
}, 500ms);
}
DePopulateNode(node);
DePopulateNode(node, ignoreSpiritGuide);
}
SpawnBGObject(object, RESPAWN_ONE_DAY); //delete old banner