fix(Core/Battlegrounds): Fix Siege Engine being destroyed after spawn, fix demolishers not being destroyed after flag contest (#24461)
This commit is contained in:
@@ -179,7 +179,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||||||
if (siegeEngineWorkshopTimer <= diff)
|
if (siegeEngineWorkshopTimer <= diff)
|
||||||
{
|
{
|
||||||
uint8 siegeType = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
|
uint8 siegeType = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
|
||||||
if (Creature* siege = GetBGCreature(siegeType)) // this always should be true
|
if (Creature* siege = GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
||||||
if (!siege->IsAlive())
|
if (!siege->IsAlive())
|
||||||
{
|
{
|
||||||
// Check if creature respawn time is properly saved
|
// Check if creature respawn time is properly saved
|
||||||
@@ -749,6 +749,37 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
|
|||||||
{
|
{
|
||||||
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_1);
|
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_1);
|
||||||
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_2);
|
DelObject(BG_IC_GO_SEAFORIUM_BOMBS_2);
|
||||||
|
|
||||||
|
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
|
||||||
|
{
|
||||||
|
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A) + i;
|
||||||
|
if (BgCreatures[type] && GetBgMap()->GetCreature(BgCreatures[type]))
|
||||||
|
{
|
||||||
|
if (Creature* demolisher = GetBgMap()->GetCreature(BgCreatures[type]))
|
||||||
|
{
|
||||||
|
if (Vehicle* veh = demolisher->GetVehicleKit())
|
||||||
|
if (!veh->IsVehicleInUse())
|
||||||
|
{
|
||||||
|
respawnMap.erase(demolisher->GetGUID());
|
||||||
|
DelCreature(type);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
|
||||||
|
if (BgCreatures[siegeType] && GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
||||||
|
{
|
||||||
|
if (Creature* siege = GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
||||||
|
{
|
||||||
|
if (Vehicle* veh = siege->GetVehicleKit())
|
||||||
|
if (!veh->IsVehicleInUse())
|
||||||
|
{
|
||||||
|
respawnMap.erase(siege->GetGUID());
|
||||||
|
DelCreature(siegeType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -865,43 +896,45 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||||||
if (siegeEngineWorkshopTimer < WORKSHOP_UPDATE_TIME)
|
if (siegeEngineWorkshopTimer < WORKSHOP_UPDATE_TIME)
|
||||||
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
|
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
|
||||||
|
|
||||||
if (!recapture)
|
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
|
||||||
{
|
{
|
||||||
for (uint8 i = 0; i < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++i)
|
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H) + i;
|
||||||
{
|
|
||||||
uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H) + i;
|
|
||||||
|
|
||||||
if (GetBgMap()->GetCreature(BgCreatures[type]))
|
if (GetBgMap()->GetCreature(BgCreatures[type]))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (AddCreature(NPC_DEMOLISHER, type,
|
if (AddCreature(NPC_DEMOLISHER, type,
|
||||||
BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
|
BG_IC_WorkshopVehicles[i].GetPositionX(), BG_IC_WorkshopVehicles[i].GetPositionY(),
|
||||||
BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
|
BG_IC_WorkshopVehicles[i].GetPositionZ(), BG_IC_WorkshopVehicles[i].GetOrientation(),
|
||||||
RESPAWN_ONE_DAY))
|
RESPAWN_ONE_DAY))
|
||||||
GetBGCreature(type)->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)]);
|
GetBGCreature(type)->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
|
uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H);
|
||||||
if (!GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
uint8 oppositeSiegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A);
|
||||||
{
|
|
||||||
AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
|
|
||||||
BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
|
|
||||||
BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(),
|
|
||||||
RESPAWN_ONE_DAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Creature* siegeEngine = GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
if (Creature* oppositeSiege = GetBgMap()->GetCreature(BgCreatures[oppositeSiegeType]))
|
||||||
{
|
{
|
||||||
siegeEngine->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)]);
|
if (oppositeSiege->IsAlive())
|
||||||
siegeEngine->SetCorpseDelay(5 * MINUTE);
|
if (Vehicle* siegeVehicle = oppositeSiege->GetVehicleKit())
|
||||||
|
if (!siegeVehicle->IsVehicleInUse())
|
||||||
|
Unit::Kill(oppositeSiege, oppositeSiege);
|
||||||
|
}
|
||||||
|
|
||||||
if (siegeEngine->IsAlive())
|
if (!GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
||||||
if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit())
|
{
|
||||||
if (!siegeVehicle->IsVehicleInUse())
|
AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
|
||||||
Unit::Kill(siegeEngine, siegeEngine);
|
BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
|
||||||
|
BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation(),
|
||||||
|
RESPAWN_ONE_DAY);
|
||||||
|
}
|
||||||
|
|
||||||
respawnMap[siegeEngine->GetGUID()] = GameTime::GetGameTime().count() + VEHICLE_RESPAWN_TIME;
|
if (Creature* siegeEngine = GetBgMap()->GetCreature(BgCreatures[siegeType]))
|
||||||
}
|
{
|
||||||
|
siegeEngine->SetFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? TEAM_ALLIANCE : TEAM_HORDE)]);
|
||||||
|
siegeEngine->SetCorpseDelay(5 * MINUTE);
|
||||||
|
|
||||||
|
respawnMap[siegeEngine->GetGUID()] = GameTime::GetGameTime().count() + VEHICLE_RESPAWN_TIME;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; ++i)
|
for (uint8 i = 0; i < MAX_WORKSHOP_BOMBS_SPAWNS_PER_FACTION; ++i)
|
||||||
|
|||||||
Reference in New Issue
Block a user