fix(Core/Battlegrounds): log errors about creatures not found (#1587)

This commit is contained in:
Alan
2019-04-07 08:19:45 -03:00
committed by Francesco Borzì
parent 2014610723
commit 3b82a3d903
3 changed files with 11 additions and 14 deletions

View File

@@ -4295,6 +4295,8 @@ void SmartScript::OnUpdate(uint32 const diff)
void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at)
{
(void)at; // ensure that the variable is referenced even if extra logs are disabled in order to pass compiler checks
if (e.empty())
{
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
@@ -4326,10 +4328,6 @@ void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger c
}
mEvents.push_back((*i));//NOTE: 'world(0)' events still get processed in ANY instance mode
}
if (mEvents.empty() && obj)
sLog->outErrorDb("SmartScript: Entry %u has events but no events added to list because of instance flags.", obj->GetEntry());
if (mEvents.empty() && at)
sLog->outErrorDb("SmartScript: AreaTrigger %u has events but no events added to list because of instance flags. NOTE: triggers can not handle any instance flags.", at->entry);
}
void SmartScript::GetScript()

View File

@@ -782,7 +782,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 = GetBgMap()->GetCreature(BgCreatures[node + 302]);//0-302 other creatures
if (!trigger)
{
trigger = AddCreature(WORLD_TRIGGER,

View File

@@ -122,7 +122,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j;
if (Creature* catapult = GetBGCreature(type))
if (Creature* catapult = GetBgMap()->GetCreature(BgCreatures[type]))
if (!catapult->IsAlive())
{
// Check if creature respawn time is properly saved
@@ -140,7 +140,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j;
if (Creature* glaiveThrower = GetBGCreature(type))
if (Creature* glaiveThrower = GetBgMap()->GetCreature(BgCreatures[type]))
if (!glaiveThrower->IsAlive())
{
// Check if creature respawn time is properly saved
@@ -185,9 +185,8 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u;
if (Creature* demolisher = GetBGCreature(type))
if (Creature* demolisher = GetBgMap()->GetCreature(BgCreatures[type]))
if (!demolisher->IsAlive())
{
// Check if creature respawn time is properly saved
@@ -802,7 +801,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))
if (GetBgMap()->GetCreature(BgCreatures[type]))
continue;
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type,
@@ -817,7 +816,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))
if (GetBgMap()->GetCreature(BgCreatures[type]))
continue;
if (AddCreature(NPC_CATAPULT, type,
@@ -838,7 +837,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))
if (GetBgMap()->GetCreature(BgCreatures[type]))
continue;
if (AddCreature(NPC_DEMOLISHER, type,
@@ -849,7 +848,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))
if (!GetBgMap()->GetCreature(BgCreatures[siegeType]))
{
AddCreature((nodePoint->faction == TEAM_ALLIANCE ? NPC_SIEGE_ENGINE_A : NPC_SIEGE_ENGINE_H), siegeType,
BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
@@ -857,7 +856,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
RESPAWN_ONE_DAY);
}
if (Creature* siegeEngine = GetBGCreature(siegeType))
if (Creature* siegeEngine = GetBgMap()->GetCreature(BgCreatures[siegeType]))
{
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
siegeEngine->SetCorpseDelay(5*MINUTE);