Spells/Auras (#379)
* get auras from creature_template_addon for tabs - npc: abilities - spell: used by npc
This commit is contained in:
parent
8ab8eee1f4
commit
2210c0c4c5
2 changed files with 16 additions and 5 deletions
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue