diff options
5 files changed, 30 insertions, 18 deletions
diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 3fcfab81c73..c4aa3ef4481 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1522,21 +1522,33 @@ void Battleground::DoorOpen(uint32 type) type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); } -GameObject* Battleground::GetBGObject(uint32 type) +GameObject* Battleground::GetBGObject(uint32 type, bool logError) { GameObject* obj = GetBgMap()->GetGameObject(BgObjects[type]); if (!obj) - TC_LOG_ERROR("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + { + if (logError) + TC_LOG_ERROR("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + else + TC_LOG_INFO("bg.battleground", "Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + type, GUID_LOPART(BgObjects[type]), m_MapId, m_InstanceID); + } return obj; } -Creature* Battleground::GetBGCreature(uint32 type) +Creature* Battleground::GetBGCreature(uint32 type, bool logError) { Creature* creature = GetBgMap()->GetCreature(BgCreatures[type]); if (!creature) - TC_LOG_ERROR("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", - type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); + { + if (logError) + TC_LOG_ERROR("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); + else + TC_LOG_INFO("bg.battleground", "Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", + type, GUID_LOPART(BgCreatures[type]), m_MapId, m_InstanceID); + } return creature; } diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index a866f09639a..5e2aa4b2316 100644 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -382,8 +382,8 @@ class Battleground void StartBattleground(); - GameObject* GetBGObject(uint32 type); - Creature* GetBGCreature(uint32 type); + GameObject* GetBGObject(uint32 type, bool logError = true); + Creature* GetBGCreature(uint32 type, bool logError = true); // Location void SetMapId(uint32 MapID) { m_MapId = MapID; } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 6256f53f07b..610e0bcecc7 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -790,7 +790,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node) if (node >= BG_AV_NODES_MAX)//fail safe return; - Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures + Creature* trigger = GetBGCreature(node + 302, false);//0-302 other creatures if (!trigger) { trigger = AddCreature(WORLD_TRIGGER, diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index be2684631df..bc684aed176 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -780,7 +780,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player* player, uint32 Point) if (Point >= EY_POINTS_MAX) return; - Creature* trigger = GetBGCreature(Point + 6);//0-5 spirit guides + Creature* trigger = GetBGCreature(Point + 6, false);//0-5 spirit guides if (!trigger) trigger = AddCreature(WORLD_TRIGGER, Point+6, Team, BG_EY_TriggerPositions[Point][0], BG_EY_TriggerPositions[Point][1], BG_EY_TriggerPositions[Point][2], BG_EY_TriggerPositions[Point][3]); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 590a07541fe..fc3f839ae76 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -658,7 +658,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) // we must del opposing faction vehicles when the node is captured (unused ones) for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_H : BG_IC_NPC_GLAIVE_THROWER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_2_H : BG_IC_NPC_GLAIVE_THROWER_2_A); ++i) { - if (Creature* glaiveThrower = GetBGCreature(i)) + if (Creature* glaiveThrower = GetBGCreature(i, false)) { if (Vehicle* vehicleGlaive = glaiveThrower->GetVehicleKit()) { @@ -670,7 +670,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_H : BG_IC_NPC_CATAPULT_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_4_H : BG_IC_NPC_CATAPULT_4_A); ++i) { - if (Creature* catapult = GetBGCreature(i)) + if (Creature* catapult = GetBGCreature(i, false)) { if (Vehicle* vehicleGlaive = catapult->GetVehicleKit()) { @@ -685,7 +685,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) { uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+i; - if (GetBGCreature(type) && GetBGCreature(type)->IsAlive()) + if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive()) continue; if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type, nodePoint->faction, @@ -700,7 +700,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) { uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+i; - if (GetBGCreature(type) && GetBGCreature(type)->IsAlive()) + if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive()) continue; if (AddCreature(NPC_CATAPULT, type, nodePoint->faction, @@ -720,7 +720,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) // we must del opposing faction vehicles when the node is captured (unused ones) for (uint8 i = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_H : BG_IC_NPC_DEMOLISHER_1_A); i < (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_4_H : BG_IC_NPC_DEMOLISHER_4_A); ++i) { - if (Creature* demolisher = GetBGCreature(i)) + if (Creature* demolisher = GetBGCreature(i, false)) { if (Vehicle* vehicleDemolisher = demolisher->GetVehicleKit()) { @@ -735,7 +735,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) { uint8 type = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+i; - if (GetBGCreature(type) && GetBGCreature(type)->IsAlive()) + if (GetBGCreature(type, false) && GetBGCreature(type)->IsAlive()) continue; if (AddCreature(NPC_DEMOLISHER, type, nodePoint->faction, @@ -748,7 +748,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) // we check if the opossing siege engine is in use int8 enemySiege = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_H : BG_IC_NPC_SIEGE_ENGINE_A); - if (Creature* siegeEngine = GetBGCreature(enemySiege)) + if (Creature* siegeEngine = GetBGCreature(enemySiege, false)) { if (Vehicle* vehicleSiege = siegeEngine->GetVehicleKit()) { @@ -759,7 +759,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture) } uint8 siegeType = (nodePoint->faction == TEAM_ALLIANCE ? BG_IC_NPC_SIEGE_ENGINE_A : BG_IC_NPC_SIEGE_ENGINE_H); - if (!GetBGCreature(siegeType) || !GetBGCreature(siegeType)->IsAlive()) + if (!GetBGCreature(siegeType, false) || !GetBGCreature(siegeType)->IsAlive()) { AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType, nodePoint->faction, BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), |