mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Spells/Misc
* try to handle bogus data from creature_template_addon.auras
This commit is contained in:
@@ -426,7 +426,10 @@ class NpcPage extends GenericPage
|
||||
$genSpells = $smartSpells;
|
||||
|
||||
if ($auras = DB::World()->selectCell('SELECT auras FROM creature_template_addon WHERE entry = ?d', $this->typeId))
|
||||
{
|
||||
$auras = preg_replace('/[^\d ]/', ' ', $auras); // remove erronous chars from string
|
||||
$genSpells = array_merge($genSpells, array_filter(explode(' ', $auras)));
|
||||
}
|
||||
|
||||
if ($genSpells)
|
||||
$conditions[] = ['id', $genSpells];
|
||||
|
||||
@@ -852,10 +852,8 @@ 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)];
|
||||
|
||||
if ($auras = DB::World()->selectCol('SELECT `entry` FROM creature_template_addon WHERE `auras` REGEXP ?', '\\b'.$this->typeId.'\\b'))
|
||||
$conditions[] = ['id', $auras];
|
||||
|
||||
$ubCreature = new CreatureList($conditions);
|
||||
if (!$ubCreature->error)
|
||||
|
||||
@@ -617,12 +617,18 @@ SqlGen::register(new class extends SetupScript
|
||||
SELECT cts.Spell FROM creature_template_spell cts'
|
||||
);
|
||||
|
||||
$auras = DB::World()->selectCol('SELECT cta.auras FROM creature_template_addon cta WHERE auras <> ""');
|
||||
foreach ($auras as $a)
|
||||
foreach (explode(' ', $a ) as $spell)
|
||||
$world[] = $spell;
|
||||
$auras = DB::World()->selectCol('SELECT `entry` AS ARRAY_KEY, cta.auras FROM creature_template_addon cta WHERE auras <> ""');
|
||||
foreach ($auras as $e => $aur)
|
||||
{
|
||||
// people keep trying to seperate auras with commas
|
||||
$a = preg_replace('/[^\d ]/', ' ', $aur, -1, $nErrors);
|
||||
if ($nErrors > 0)
|
||||
CLI::write('creature_template_addon entry #' . CLI::bold($e) . ' has invalid chars in auras string "'. CLI::bold($aur).'"', CLI::LOG_WARN);
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_spell s SET s.typeCat = -8 WHERE s.typeCat = 0 AND s.id In (?a)', $world);
|
||||
$world = array_merge($world, array_filter(explode(' ', $a)));
|
||||
}
|
||||
|
||||
DB::Aowow()->query('UPDATE ?_spell s SET s.typeCat = -8 WHERE s.typeCat = 0 AND s.id IN (?a)', $world);
|
||||
|
||||
|
||||
/**********/
|
||||
|
||||
Reference in New Issue
Block a user