mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-09 08:17:56 +00:00
fix(Core/Battlegrounds): log errors about creatures not found (#1587)
This commit is contained in:
@@ -4295,6 +4295,8 @@ void SmartScript::OnUpdate(uint32 const diff)
|
|||||||
|
|
||||||
void SmartScript::FillScript(SmartAIEventList e, WorldObject* obj, AreaTrigger const* at)
|
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 (e.empty())
|
||||||
{
|
{
|
||||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
#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
|
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()
|
void SmartScript::GetScript()
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
|
|||||||
|
|
||||||
if (node >= BG_AV_NODES_MAX)//fail safe
|
if (node >= BG_AV_NODES_MAX)//fail safe
|
||||||
return;
|
return;
|
||||||
Creature* trigger = GetBGCreature(node + 302);//0-302 other creatures
|
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[node + 302]);//0-302 other creatures
|
||||||
if (!trigger)
|
if (!trigger)
|
||||||
{
|
{
|
||||||
trigger = AddCreature(WORLD_TRIGGER,
|
trigger = AddCreature(WORLD_TRIGGER,
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
|
|||||||
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
|
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;
|
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())
|
if (!catapult->IsAlive())
|
||||||
{
|
{
|
||||||
// Check if creature respawn time is properly saved
|
// 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)
|
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;
|
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())
|
if (!glaiveThrower->IsAlive())
|
||||||
{
|
{
|
||||||
// Check if creature respawn time is properly saved
|
// 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
|
// 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)
|
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;
|
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())
|
if (!demolisher->IsAlive())
|
||||||
{
|
{
|
||||||
// Check if creature respawn time is properly saved
|
// 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;
|
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;
|
continue;
|
||||||
|
|
||||||
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_GLAIVE_THROWER_A : NPC_GLAIVE_THROWER_H, type,
|
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;
|
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;
|
continue;
|
||||||
|
|
||||||
if (AddCreature(NPC_CATAPULT, type,
|
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;
|
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;
|
continue;
|
||||||
|
|
||||||
if (AddCreature(NPC_DEMOLISHER, type,
|
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);
|
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,
|
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].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(),
|
||||||
@@ -857,7 +856,7 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
|
|||||||
RESPAWN_ONE_DAY);
|
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->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
|
||||||
siegeEngine->SetCorpseDelay(5*MINUTE);
|
siegeEngine->SetCorpseDelay(5*MINUTE);
|
||||||
|
|||||||
Reference in New Issue
Block a user