diff options
-rw-r--r-- | sql/updates/world/2014_10_04_00_world.sql | 3 | ||||
-rw-r--r-- | src/server/game/AI/SmartScripts/SmartScriptMgr.cpp | 34 |
2 files changed, 34 insertions, 3 deletions
diff --git a/sql/updates/world/2014_10_04_00_world.sql b/sql/updates/world/2014_10_04_00_world.sql new file mode 100644 index 00000000000..bea00c30620 --- /dev/null +++ b/sql/updates/world/2014_10_04_00_world.sql @@ -0,0 +1,3 @@ +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid`=184312 AND `source_type`=1 AND `id`=7; +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid`=184311 AND `source_type`=1 AND `id`=8; +UPDATE `smart_scripts` SET `link`=0 WHERE `entryorguid` IN(177964,174713,174712,174709,174708,174686,174608,174607,174605,174604,174602,174603,174596,173324,171939,173284,174601,174684,164885,164888,174599,174594,164887,174600,174598,164886,173327,174595,171942,174606,174597) AND `source_type`=1 AND `id`=0; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 5cb8c1c4ef0..2a7fd1369e2 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -144,20 +144,34 @@ void SmartAIMgr::LoadSmartAIFromDB() { case SMART_SCRIPT_TYPE_CREATURE: { - if (!sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid)) + CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate((uint32)temp.entryOrGuid); + if (!creatureInfo) { TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } + + if (creatureInfo->AIName != "SmartAI") + { + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) is not using SmartAI, skipped loading.", uint32(temp.entryOrGuid)); + continue; + } break; } case SMART_SCRIPT_TYPE_GAMEOBJECT: { - if (!sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid)) + GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate((uint32)temp.entryOrGuid); + if (!gameObjectInfo) { TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); continue; } + + if (gameObjectInfo->AIName != "SmartGameObjectAI") + { + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: GameObject entry (%u) is not using SmartGameObjectAI, skipped loading.", uint32(temp.entryOrGuid)); + continue; + } break; } case SMART_SCRIPT_TYPE_AREATRIGGER: @@ -178,11 +192,25 @@ void SmartAIMgr::LoadSmartAIFromDB() } else { - if (!sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid)))) + CreatureData const* creature = sObjectMgr->GetCreatureData(uint32(abs(temp.entryOrGuid))); + if (!creature) { TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature guid (%u) does not exist, skipped loading.", uint32(abs(temp.entryOrGuid))); continue; } + + CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creature->id); + if (!creatureInfo) + { + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) does not exist, skipped loading.", uint32(temp.entryOrGuid)); + continue; + } + + if (creatureInfo->AIName != "SmartAI") + { + TC_LOG_ERROR("sql.sql", "SmartAIMgr::LoadSmartAIFromDB: Creature entry (%u) is not using SmartAI, skipped loading.", uint32(temp.entryOrGuid)); + continue; + } } temp.source_type = source_type; |