diff --git a/pages/npc.php b/pages/npc.php index 178272be..2b3d8788 100644 --- a/pages/npc.php +++ b/pages/npc.php @@ -410,9 +410,9 @@ class NpcPage extends GenericPage /**************/ // tab: abilities / tab_controlledabilities (dep: VehicleId) - $tplSpells = []; - $smartSpells = []; - $conditions = ['OR']; + $tplSpells = []; + $genSpells = []; + $conditions = ['OR']; for ($i = 1; $i < 9; $i++) if ($_ = $this->subject->getField('spell'.$i)) @@ -422,7 +422,13 @@ class NpcPage extends GenericPage $conditions[] = ['id', $tplSpells]; if ($smartSpells = SmartAI::getSpellCastsForOwner($this->typeId, SAI_SRC_TYPE_CREATURE)) - $conditions[] = ['id', $smartSpells]; + $genSpells = $smartSpells; + + if ($auras = DB::World()->selectCell('SELECT auras FROM creature_template_addon WHERE entry = ?d', $this->typeId)) + $genSpells = array_merge($genSpells, array_filter(explode(' ', $auras))); + + if ($genSpells) + $conditions[] = ['id', $genSpells]; // Pet-Abilities if ($_typeFlags & 0x1 && ($_ = $this->subject->getField('family'))) @@ -461,7 +467,7 @@ class NpcPage extends GenericPage foreach ($controled as $id => $values) { - if (in_array($id, $smartSpells)) + if (in_array($id, $genSpells)) { $normal[$id] = $values; if (!in_array($id, $tplSpells)) diff --git a/pages/spell.php b/pages/spell.php index 9c393f9e..3a0a2133 100644 --- a/pages/spell.php +++ b/pages/spell.php @@ -852,6 +852,11 @@ class SpellPage extends GenericPage if (!empty($ubSAI[Type::NPC])) $conditions[] = ['id', $ubSAI[Type::NPC]]; + if ($auras = DB::World()->selectCol('SELECT `entry` AS ARRAY_KEY, auras FROM creature_template_addon WHERE `auras` LIKE ?', '%'.$this->typeId.'%')) + if ($auras = array_filter($auras, function($x) { return preg_match('/\b'.$this->typeId.'\b/', $x); })) + $conditions[] = ['id', array_keys($auras)]; + + $ubCreature = new CreatureList($conditions); if (!$ubCreature->error) {