NPC/Trainer

* add support for https://github.com/TrinityCore/TrinityCore/commit/bf3ab6d9c43
 * fixed some bugs causing conditions to not be displayed
 * fixed some trainer not being displayed for most skills
This commit is contained in:
Sarjuuk
2020-02-23 16:05:24 +01:00
parent d4c0c0535a
commit 16bd59e0cc
12 changed files with 70 additions and 127 deletions

View File

@@ -61,38 +61,6 @@ class Game
) )
); );
public static $trainerTemplates = array( // TYPE => Id => templateList
TYPE_CLASS => array(
1 => [-200001, -200002], // Warrior
2 => [-200003, -200004, -200020, -200021], // Paladin
3 => [-200013, -200014], // Hunter
4 => [-200015, -200016], // Rogue
5 => [-200011, -200012], // Priest
6 => [-200019], // DK
7 => [-200017, -200018], // Shaman (HighlevelAlly Id missing..?)
8 => [-200007, -200008], // Mage
9 => [-200009, -200010], // Warlock
11 => [-200005, -200006] // Druid
),
TYPE_SKILL => array(
171 => [-201001, -201002, -201003], // Alchemy
164 => [-201004, -201005, -201006, -201007, -201008],// Blacksmithing
333 => [-201009, -201010, -201011], // Enchanting
202 => [-201012, -201013, -201014, -201015, -201016, -201017], // Engineering
182 => [-201018, -201019, -201020], // Herbalism
773 => [-201021, -201022, -201023], // Inscription
755 => [-201024, -201025, -201026], // Jewelcrafting
165 => [-201027, -201028, -201029, -201030, -201031, -201032], // Leatherworking
186 => [-201033, -201034, -201035], // Mining
393 => [-201036, -201037, -201038], // Skinning
197 => [-201039, -201040, -201041, -201042], // Tailoring
356 => [-202001, -202002, -202003], // Fishing
185 => [-202004, -202005, -202006], // Cooking
129 => [-202007, -202008, -202009], // First Aid
762 => [-202010, -202011, -202012] // Riding
)
);
public static $sockets = array( // jsStyle Strings public static $sockets = array( // jsStyle Strings
'meta', 'red', 'yellow', 'blue' 'meta', 'red', 'yellow', 'blue'
); );

View File

@@ -2640,9 +2640,9 @@ class SpellListFilter extends Filter
if (is_int($_)) // specific if (is_int($_)) // specific
return ['src.src'.$_, null, '!']; return ['src.src'.$_, null, '!'];
else if ($_) // any else if ($_) // any
return ['OR', ['src.src1', null, '!'], ['src.src2', null, '!'], ['src.src4', null, '!'], ['src.src5', null, '!'], ['src.src6', null, '!'], ['src.src7', null, '!'], ['src.src9', null, '!']]; return ['OR', ['src.src1', null, '!'], ['src.src2', null, '!'], ['src.src4', null, '!'], ['src.src5', null, '!'], ['src.src6', null, '!'], ['src.src7', null, '!'], ['src.src9', null, '!'], ['src.src10', null, '!']];
else if (!$_) // none else if (!$_) // none
return ['AND', ['src.src1', null], ['src.src2', null], ['src.src4', null], ['src.src5', null], ['src.src6', null], ['src.src7', null], ['src.src9', null]]; return ['AND', ['src.src1', null], ['src.src2', null], ['src.src4', null], ['src.src5', null], ['src.src6', null], ['src.src7', null], ['src.src9', null], ['src.src10', null]];
return false; return false;
} }

View File

@@ -213,7 +213,7 @@ class ClassPage extends GenericPage
$conditions = array( $conditions = array(
['npcflag', 0x30, '&'], // is trainer ['npcflag', 0x30, '&'], // is trainer
['trainerType', 0], // trains class spells ['trainerType', 0], // trains class spells
['trainerClass', $this->typeId] ['trainerRequirement', $this->typeId]
); );
$trainer = new CreatureList($conditions); $trainer = new CreatureList($conditions);

View File

@@ -473,14 +473,10 @@ class NpcPage extends GenericPage
if ($this->subject->getField('npcflag') & NPC_FLAG_TRAINER) if ($this->subject->getField('npcflag') & NPC_FLAG_TRAINER)
{ {
$teachQuery = ' $teachQuery = '
SELECT IFNULL(t2.SpellID, t1.SpellID) AS ARRAY_KEY, SELECT ts.SpellId AS ARRAY_KEY, ts.MoneyCost AS cost, ts.ReqSkillLine AS reqSkillId, ts.ReqSkillRank AS reqSkillValue, ts.ReqLevel AS reqLevel, ts.ReqAbility1 AS reqSpellId1, ts.reqAbility2 AS reqSpellId2
IFNULL(t2.MoneyCost, t1.MoneyCost) AS cost, FROM trainer_spell ts
IFNULL(t2.ReqSkillLine, t1.ReqSkillLine) AS reqSkillId, JOIN creature_default_trainer cdt ON cdt.TrainerId = ts.TrainerId
IFNULL(t2.ReqSkillRank, t1.ReqSkillRank) AS reqSkillValue, WHERE cdt.Creatureid = ?d
IFNULL(t2.ReqLevel, t1.ReqLevel) AS reqLevel
FROM npc_trainer t1
LEFT JOIN npc_trainer t2 ON t2.ID = IF(t1.SpellID < 0, -t1.SpellID, null)
WHERE t1.ID = ?d
'; ';
if ($tSpells = DB::World()->select($teachQuery, $this->typeId)) if ($tSpells = DB::World()->select($teachQuery, $this->typeId))
@@ -499,11 +495,26 @@ class NpcPage extends GenericPage
if ($_ = $train['reqSkillId']) if ($_ = $train['reqSkillId'])
{ {
$this->extendGlobalIds(TYPE_SKILL, $_); if (count($data[$sId]['skill']) == 1 && $_ != $data[$sId]['skill'][0])
if (!isset($extra[0])) {
$extra[0] = '$Listview.extraCols.condition'; $this->extendGlobalIds(TYPE_SKILL, $_);
if (!isset($extra[0]))
$extra[0] = '$Listview.extraCols.condition';
$data[$sId]['condition'][0][$this->typeId][] = [[CND_SKILL, $_, $train['reqSkillValue']]]; $data[$sId]['condition'][0][$this->typeId][] = [[CND_SKILL, $_, $train['reqSkillValue']]];
}
}
for ($i = 1; $i < 3; $i++)
{
if ($_ = $train['reqSpellId'.$i])
{
$this->extendGlobalIds(TYPE_SPELL, $_);
if (!isset($extra[0]))
$extra[0] = '$Listview.extraCols.condition';
$data[$sId]['condition'][0][$this->typeId][] = [[CND_SPELL, $_]];
}
} }
if ($_ = $train['reqLevel']) if ($_ = $train['reqLevel'])
@@ -526,7 +537,7 @@ class NpcPage extends GenericPage
); );
if ($extra) if ($extra)
$tabData['extraCols'] = $extra; $tabData['extraCols'] = array_values($extra);
$this->lvTabs[] = ['spell', $tabData]; $this->lvTabs[] = ['spell', $tabData];
} }

View File

@@ -249,32 +249,19 @@ class SkillPage extends GenericPage
// tab: trainers [npcs] // tab: trainers [npcs]
if (in_array($this->cat, [-5, 6, 7, 8, 9, 11])) if (in_array($this->cat, [-5, 6, 7, 8, 9, 11]))
{ {
$list = []; $mask = 0;
if (!empty(Game::$trainerTemplates[TYPE_SKILL][$this->typeId])) foreach (Game::$skillLineMask[-3] as $idx => $pair)
$list = DB::World()->selectCol('SELECT DISTINCT ID FROM npc_trainer WHERE SpellID IN (?a) AND ID < 200000', Game::$trainerTemplates[TYPE_SKILL][$this->typeId]); if ($pair[1] == $this->typeId)
else $mask |= 1 << $idx;
{
$mask = 0;
foreach (Game::$skillLineMask[-3] as $idx => $pair)
if ($pair[1] == $this->typeId)
$mask |= 1 << $idx;
$spellIds = DB::Aowow()->selectCol( $spellIds = DB::Aowow()->selectCol(
'SELECT id FROM ?_spell WHERE typeCat IN (-11, 9) AND (skillLine1 = ?d OR (skillLine1 > 0 AND skillLine2OrMask = ?d) {OR (skillLine1 = -3 AND skillLine2OrMask = ?d)})', 'SELECT id FROM ?_spell WHERE (skillLine1 = ?d OR (skillLine1 > 0 AND skillLine2OrMask = ?d) {OR (skillLine1 = -3 AND skillLine2OrMask = ?d)})',
$this->typeId, $this->typeId,
$this->typeId, $this->typeId,
$mask ?: DBSIMPLE_SKIP $mask ?: DBSIMPLE_SKIP
); );
$list = $spellIds ? DB::World()->selectCol('
SELECT IF(t1.ID > 200000, t2.ID, t1.ID)
FROM npc_trainer t1
LEFT JOIN npc_trainer t2 ON t2.SpellID = -t1.ID
WHERE t1.SpellID IN (?a)',
$spellIds
) : [];
}
$list = $spellIds ? DB::World()->selectCol('SELECT cdt.CreatureId FROM creature_default_trainer cdt JOIN trainer_spell ts ON ts.TrainerId = cdt.TrainerId WHERE ts.SpellID IN (?a)', $spellIds) : [];
if ($list) if ($list)
{ {
$this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']); $this->addJS('?data=zones&locale='.User::$localeId.'&t='.$_SESSION['dataKey']);

View File

@@ -1036,10 +1036,10 @@ class SpellPage extends GenericPage
if (count($src) == 1 && $src[0] == 1) // multiple trainer if (count($src) == 1 && $src[0] == 1) // multiple trainer
{ {
$list = DB::World()->selectCol(' $list = DB::World()->selectCol('
SELECT IF(t1.ID > 200000, t2.ID, t1.ID) SELECT cdt.CreatureId
FROM npc_trainer t1 FROM creature_default_trainer cdt
LEFT JOIN npc_trainer t2 ON t2.SpellID = -t1.ID JOIN trainer_spell ts ON ts.TrainerId = cdt.TrainerId
WHERE t1.SpellID = ?d', WHERE ts.SpellId = ?d',
$this->typeId $this->typeId
); );
} }

View File

@@ -535,9 +535,7 @@ CREATE TABLE `aowow_creature` (
`dynamicFlags` int(10) unsigned NOT NULL DEFAULT 0, `dynamicFlags` int(10) unsigned NOT NULL DEFAULT 0,
`family` tinyint(4) NOT NULL DEFAULT 0, `family` tinyint(4) NOT NULL DEFAULT 0,
`trainerType` tinyint(4) NOT NULL DEFAULT 0, `trainerType` tinyint(4) NOT NULL DEFAULT 0,
`trainerSpell` mediumint(8) unsigned NOT NULL DEFAULT 0, `trainerRequirement` smallint(5) unsigned NOT NULL DEFAULT 0,
`trainerClass` tinyint(3) unsigned NOT NULL DEFAULT 0,
`trainerRace` tinyint(3) unsigned NOT NULL DEFAULT 0,
`dmgMin` float unsigned NOT NULL DEFAULT 0, `dmgMin` float unsigned NOT NULL DEFAULT 0,
`dmgMax` float unsigned NOT NULL DEFAULT 0, `dmgMax` float unsigned NOT NULL DEFAULT 0,
`mleAtkPwrMin` smallint(5) unsigned NOT NULL DEFAULT 0, `mleAtkPwrMin` smallint(5) unsigned NOT NULL DEFAULT 0,
@@ -3120,7 +3118,7 @@ UNLOCK TABLES;
LOCK TABLES `aowow_dbversion` WRITE; LOCK TABLES `aowow_dbversion` WRITE;
/*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */; /*!40000 ALTER TABLE `aowow_dbversion` DISABLE KEYS */;
INSERT INTO `aowow_dbversion` VALUES (1582485391,0,NULL,NULL); INSERT INTO `aowow_dbversion` VALUES (1582486388,0,NULL,NULL);
/*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */; /*!40000 ALTER TABLE `aowow_dbversion` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;

View File

@@ -43,17 +43,15 @@ SqlGen::register(new class extends SetupScript
unit_class, unit_class,
unit_flags, unit_flags2, dynamicflags, unit_flags, unit_flags2, dynamicflags,
family, family,
trainer_type, IFNULL(t.Type, 0),
trainer_spell, IFNULL(t.Requirement, 0),
trainer_class,
trainer_race,
(CASE ct.exp WHEN 0 THEN min.damage_base WHEN 1 THEN min.damage_exp1 ELSE min.damage_exp2 END) AS dmgMin, (CASE ct.exp WHEN 0 THEN min.damage_base WHEN 1 THEN min.damage_exp1 ELSE min.damage_exp2 END) AS dmgMin,
(CASE ct.exp WHEN 0 THEN max.damage_base WHEN 1 THEN max.damage_exp1 ELSE max.damage_exp2 END) AS dmgMax, (CASE ct.exp WHEN 0 THEN max.damage_base WHEN 1 THEN max.damage_exp1 ELSE max.damage_exp2 END) AS dmgMax,
min.attackpower AS mleAtkPwrMin, min.attackpower AS mleAtkPwrMin,
max.attackpower AS mleAtkPwrMax, max.attackpower AS mleAtkPwrMax,
min.rangedattackpower AS rmgAtkPwrMin, min.rangedattackpower AS rmgAtkPwrMin,
max.rangedattackpower AS rmgAtkPwrMax, max.rangedattackpower AS rmgAtkPwrMax,
type, ct.type,
type_flags, type_flags,
lootid, pickpocketloot, skinloot, lootid, pickpocketloot, skinloot,
IFNULL(cts0.Spell, 0), IFNULL(cts1.Spell, 0), IFNULL(cts2.Spell, 0), IFNULL(cts3.Spell, 0), IFNULL(cts4.Spell, 0), IFNULL(cts5.Spell, 0), IFNULL(cts6.Spell, 0), IFNULL(cts7.Spell, 0), IFNULL(cts0.Spell, 0), IFNULL(cts1.Spell, 0), IFNULL(cts2.Spell, 0), IFNULL(cts3.Spell, 0), IFNULL(cts4.Spell, 0), IFNULL(cts5.Spell, 0), IFNULL(cts6.Spell, 0), IFNULL(cts7.Spell, 0),
@@ -77,6 +75,10 @@ SqlGen::register(new class extends SetupScript
creature_classlevelstats min ON ct.unit_class = min.class AND ct.minlevel = min.level creature_classlevelstats min ON ct.unit_class = min.class AND ct.minlevel = min.level
JOIN JOIN
creature_classlevelstats max ON ct.unit_class = max.class AND ct.maxlevel = max.level creature_classlevelstats max ON ct.unit_class = max.class AND ct.maxlevel = max.level
LEFT JOIN
creature_default_trainer cdt ON cdt.CreatureId = ct.entry
LEFT JOIN
trainer t ON t.Id = cdt.TrainerId
LEFT JOIN LEFT JOIN
creature_template_locale ctl2 ON ct.entry = ctl2.entry AND ctl2.`locale` = "frFR" creature_template_locale ctl2 ON ct.entry = ctl2.entry AND ctl2.`locale` = "frFR"
LEFT JOIN LEFT JOIN

View File

@@ -12,7 +12,7 @@ SqlGen::register(new class extends SetupScript
protected $command = 'source'; protected $command = 'source';
protected $tblDependancyAowow = ['spell', 'achievement']; protected $tblDependancyAowow = ['spell', 'achievement'];
protected $tblDependancyTC = ['playercreateinfo_skills', 'playercreateinfo_item', 'skill_discovery_template', 'achievement_reward', 'skill_perfect_item_template', 'item_template', 'gameobject_template', 'quest_template', 'quest_template_addon', 'creature_template', 'creature', 'npc_trainer', 'npc_vendor', 'game_event_npc_vendor', 'reference_loot_template', 'item_loot_template', 'creature_loot_template', 'gameobject_loot_template', 'mail_loot_template', 'disenchant_loot_template', 'fishing_loot_template', 'skinning_loot_template', 'milling_loot_template', 'prospecting_loot_template', 'pickpocketing_loot_template']; protected $tblDependancyTC = ['playercreateinfo_skills', 'playercreateinfo_item', 'skill_discovery_template', 'achievement_reward', 'skill_perfect_item_template', 'item_template', 'gameobject_template', 'quest_template', 'quest_template_addon', 'creature_template', 'creature', 'trainer_spell', 'npc_vendor', 'game_event_npc_vendor', 'reference_loot_template', 'item_loot_template', 'creature_loot_template', 'gameobject_loot_template', 'mail_loot_template', 'disenchant_loot_template', 'fishing_loot_template', 'skinning_loot_template', 'milling_loot_template', 'prospecting_loot_template', 'pickpocketing_loot_template'];
protected $dbcSourceFiles = ['charstartoutfit', 'talent', 'spell', 'skilllineability', 'itemextendedcost', 'lock']; protected $dbcSourceFiles = ['charstartoutfit', 'talent', 'spell', 'skilllineability', 'itemextendedcost', 'lock'];
private function queryfy(array $data, string $query) : string private function queryfy(array $data, string $query) : string
@@ -1043,22 +1043,16 @@ SqlGen::register(new class extends SetupScript
$buff = []; $buff = [];
foreach ($qSpells as $sId => $spell) foreach ($qSpells as $sId => $spell)
{
for ($i = 1; $i <= 3; $i++) for ($i = 1; $i <= 3; $i++)
{ if ($spell['effect'.$i.'Id'] == 36) // effect: learnSpell
if ($spell['effect'.$i.'Id'] != 36) // effect: learnSpell $this->pushBuffer($buff, TYPE_SPELL, $spell['effect'.$i.'TriggerSpell'], $quests[$sId]['qty'] > 1 ? 0 : TYPE_QUEST, $quests[$sId]['qty'] > 1 ? 0 : $quests[$sId]['id'], $quests[$sId]['side']);
continue;
$this->pushBuffer($buff, TYPE_SPELL, $spell['effect'.$i.'TriggerSpell'], $quests[$sId]['qty'] > 1 ? 0 : TYPE_QUEST, $quests[$sId]['qty'] > 1 ? 0 : $quests[$sId]['id'], $quests[$sId]['side']);
}
}
DB::Aowow()->query($this->queryfy($buff, $insMore), 4, 4, 4); DB::Aowow()->query($this->queryfy($buff, $insMore), 4, 4, 4);
} }
# 6: Trainer # 6: Trainer
CLI::write(' * #6 Trainer'); CLI::write(' * #6 Trainer');
if ($tNpcs = DB::World()->select('SELECT SpellID AS ARRAY_KEY, ID AS entry, COUNT(1) AS qty FROM npc_trainer WHERE SpellID > 0 GROUP BY ARRAY_KEY')) if ($tNpcs = DB::World()->select('SELECT SpellID AS ARRAY_KEY, cdt.CreatureId AS entry, COUNT(1) AS qty FROM `trainer_spell` ts JOIN `creature_default_trainer` cdt ON cdt.TrainerId = ts.TrainerId GROUP BY ARRAY_KEY'))
{ {
$tSpells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($tNpcs)); $tSpells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($tNpcs));
$buff = []; $buff = [];
@@ -1070,20 +1064,13 @@ SqlGen::register(new class extends SetupScript
continue; continue;
$effects = $tSpells[$spellId]; $effects = $tSpells[$spellId];
$trainerId = $npc['entry'] > 200000 || $npc['qty'] > 1 ? 0 : $npc['entry']; $trainerId = $npc['qty'] > 1 ? 0 : $npc['entry'];
$triggered = false;
for ($i = 1; $i <= 3; $i++) for ($i = 1; $i <= 3; $i++)
{ if ($effects['effect'.$i.'Id'] == 36) // effect: learnSpell
if ($effects['effect'.$i.'Id'] != 36) // effect: learnSpell $this->pushBuffer($buff, TYPE_SPELL, $effects['effect'.$i.'TriggerSpell'], $trainerId ? TYPE_NPC : 0, $trainerId);
continue;
$triggered = true; $this->pushBuffer($buff, TYPE_SPELL, $spellId, $trainerId ? TYPE_NPC : 0, $trainerId);
$this->pushBuffer($buff, TYPE_SPELL, $effects['effect'.$i.'TriggerSpell'], $trainerId ? TYPE_NPC : 0, $trainerId);
}
if (!$triggered)
$this->pushBuffer($buff, TYPE_SPELL, $spellId, $trainerId ? TYPE_NPC : 0, $trainerId);
} }
DB::Aowow()->query($this->queryfy($buff, $insMore), 6, 6, 6); DB::Aowow()->query($this->queryfy($buff, $insMore), 6, 6, 6);

View File

@@ -12,7 +12,7 @@ SqlGen::register(new class extends SetupScript
protected $command = 'spell'; protected $command = 'spell';
protected $tblDependancyAowow = ['icons']; protected $tblDependancyAowow = ['icons'];
protected $tblDependancyTC = ['item_template', 'creature_template', 'creature_template_addon', 'smart_scripts', 'npc_trainer', 'disables', 'spell_ranks', 'spell_dbc', 'skill_discovery_template']; protected $tblDependancyTC = ['item_template', 'creature_template', 'creature_template_addon', 'smart_scripts', 'trainer_spell', 'disables', 'spell_ranks', 'spell_dbc', 'skill_discovery_template'];
protected $dbcSourceFiles = ['spell', 'spellradius', 'spellduration', 'spellrunecost', 'spellcasttimes', 'skillline', 'skilllineability', 'skillraceclassinfo', 'talent', 'talenttab', 'glyphproperties', 'spellicon']; protected $dbcSourceFiles = ['spell', 'spellradius', 'spellduration', 'spellrunecost', 'spellcasttimes', 'skillline', 'skilllineability', 'skillraceclassinfo', 'talent', 'talenttab', 'glyphproperties', 'spellicon'];
public function generate(array $ids = []) : bool public function generate(array $ids = []) : bool
@@ -346,7 +346,7 @@ SqlGen::register(new class extends SetupScript
} }
// fill learnedAt, trainingCost from trainer // fill learnedAt, trainingCost from trainer
if ($trainer = DB::World()->select('SELECT SpellID AS ARRAY_KEY, MIN(ReqSkillRank) AS reqSkill, MIN(MoneyCost) AS cost, COUNT(*) AS count FROM npc_trainer GROUP BY SpellID')) if ($trainer = DB::World()->select('SELECT SpellID AS ARRAY_KEY, MIN(ReqSkillRank) AS reqSkill, MIN(MoneyCost) AS cost, ReqAbility1 AS reqSpellId, COUNT(*) AS count FROM trainer_spell GROUP BY SpellID'))
{ {
$spells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($trainer)); $spells = DB::Aowow()->select('SELECT id AS ARRAY_KEY, effect1Id, effect2Id, effect3Id, effect1TriggerSpell, effect2TriggerSpell, effect3TriggerSpell FROM dbc_spell WHERE id IN (?a)', array_keys($trainer));
$links = []; $links = [];
@@ -370,7 +370,7 @@ SqlGen::register(new class extends SetupScript
$l = &$links[$effects['effect'.$i.'TriggerSpell']]; $l = &$links[$effects['effect'.$i.'TriggerSpell']];
if (!isset($l)) if (!isset($l))
$l = [$tData['reqSkill'], $tData['cost']]; $l = [$tData['reqSkill'], $tData['cost'], $tData['reqSpellId']];
if ($tData['reqSkill'] < $l[0]) if ($tData['reqSkill'] < $l[0])
$l[0] = $tData['reqSkill']; $l[0] = $tData['reqSkill'];
@@ -384,7 +384,7 @@ SqlGen::register(new class extends SetupScript
$l = &$links[$spell]; $l = &$links[$spell];
if (!isset($l)) if (!isset($l))
$l = [$tData['reqSkill'], $tData['cost']]; $l = [$tData['reqSkill'], $tData['cost'], $tData['reqSpellId']];
if ($tData['reqSkill'] < $l[0]) if ($tData['reqSkill'] < $l[0])
$l[0] = $tData['reqSkill']; $l[0] = $tData['reqSkill'];
@@ -483,26 +483,10 @@ SqlGen::register(new class extends SetupScript
if (isset($itemInfo[$itemId])) if (isset($itemInfo[$itemId]))
DB::Aowow()->query('UPDATE ?_spell s, ?_icons ic, dbc_spellicon si SET s.iconIdAlt = ?d, s.cuFlags = s.cuFlags | ?d WHERE s.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1)) AND s.id = ?d', -$itemInfo[$itemId]['d'], ((7 - $itemInfo[$itemId]['q']) << 8), $sId); DB::Aowow()->query('UPDATE ?_spell s, ?_icons ic, dbc_spellicon si SET s.iconIdAlt = ?d, s.cuFlags = s.cuFlags | ?d WHERE s.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1)) AND s.id = ?d', -$itemInfo[$itemId]['d'], ((7 - $itemInfo[$itemId]['q']) << 8), $sId);
// apply specializations [trainerTemplate => reqSpell]
$specs = array(
201007 => 9788,
201008 => 9787,
201015 => 20222,
201016 => 20219,
201030 => 10660,
201031 => 10656,
201032 => 10658
);
foreach ($specs as $tt => $req)
if ($spells = DB::World()->selectCol('SELECT SpellID FROM npc_trainer WHERE ID = ?d', $tt))
DB::Aowow()->query('UPDATE ?_spell SET reqSpellId = ?d WHERE id IN (?a)', $req, $spells);
$itemReqs = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, requiredSpell FROM item_template WHERE requiredSpell NOT IN (?a)', [0, 34090, 34091]); // not riding $itemReqs = DB::World()->selectCol('SELECT entry AS ARRAY_KEY, requiredSpell FROM item_template WHERE requiredSpell NOT IN (?a)', [0, 34090, 34091]); // not riding
foreach ($itemReqs AS $itemId => $req) foreach ($itemReqs AS $itemId => $req)
DB::Aowow()->query('UPDATE ?_spell SET reqSpellId = ?d WHERE skillLine1 IN (?a) AND effect1CreateItemId = ?d', $req, [164, 165, 197, 202], $itemId); DB::Aowow()->query('UPDATE ?_spell SET reqSpellId = ?d WHERE skillLine1 IN (?a) AND effect1CreateItemId = ?d', $req, [164, 165, 197, 202], $itemId);
DB::Aowow()->query('UPDATE ?_spell SET reqSpellId = id WHERE id IN (?a)', [9788, 9787, 20222, 20219, 10660, 10656, 10658, 26797, 26798, 26801, 17039, 17040, 17041]);
// setting icons // setting icons
DB::Aowow()->query('UPDATE ?_spell s, ?_icons ic, dbc_spellicon si SET s.iconId = ic.id WHERE s.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1))'); DB::Aowow()->query('UPDATE ?_spell s, ?_icons ic, dbc_spellicon si SET s.iconId = ic.id WHERE s.iconIdBak = si.id AND ic.name = LOWER(SUBSTRING_INDEX(si.iconPath, "\\\\", -1))');

View File

@@ -0,0 +1,6 @@
ALTER TABLE `aowow_creature`
CHANGE COLUMN `trainerSpell` `trainerRequirement` SMALLINT UNSIGNED NOT NULL DEFAULT '0' AFTER `trainerType`,
DROP COLUMN `trainerClass`,
DROP COLUMN `trainerRace`;
UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' spell, source, creature');

View File

@@ -23074,7 +23074,7 @@ var ConditionList = new function() {
} }
} }
return rows.length > 1 ? '[ul][li]' + rows.join('[/li][li]') + '[/li][/ul]' : rows[0]; return rows.length > 1 ? rows.join('[br]') : rows[0];
} }
} }