Profiler/Completion

* apply factions from player_factionchange_spells to all spells
 * filter companion pets without suitable item source
This commit is contained in:
Sarjuuk
2023-05-12 22:30:28 +02:00
parent d16d685b70
commit 1c5e43d378
7 changed files with 24 additions and 20 deletions

View File

@@ -52,6 +52,8 @@ if (!CLI)
};
$spellFactions = DB::World()->selectCol('SELECT `alliance_id` AS ARRAY_KEY, 1 FROM player_factionchange_spells UNION SELECT `horde_id` AS ARRAY_KEY, 2 FROM player_factionchange_spells');
/**********/
/* Quests */
/**********/
@@ -187,7 +189,7 @@ if (!CLI)
/**********/
/* Mounts */
/**********/
$scripts[] = function() use ($exAdd)
$scripts[] = function() use ($exAdd, $spellFactions)
{
$success = true;
$condition = array(
@@ -198,8 +200,6 @@ if (!CLI)
);
$mountz = new SpellList($condition);
// we COULD go into aowow_sources to get the faction of the source and apply it to the spell. .. Or we could keep our sanity and assume TC did nothing wrong. haHA! no!
$factionSet = DB::World()->selectCol('SELECT alliance_id AS ARRAY_KEY, horde_id FROM player_factionchange_spells WHERE alliance_id IN (?a) OR horde_id IN (?a)', $mountz->getFoundIDs(), $mountz->getFoundIDs());
$conditionSet = DB::World()->selectCol('SELECT SourceEntry AS ARRAY_KEY, ConditionValue1 FROM conditions WHERE SourceTypeOrReferenceId = ?d AND ConditionTypeOrReference = ?d AND SourceEntry IN (?a)', CND_SRC_SPELL, CND_SKILL, $mountz->getFoundIDs());
// get mounts for exclusion
@@ -227,15 +227,9 @@ if (!CLI)
else if ($id == 54729) // Winged Steed of the Ebon Blade
$data['reqclass'] = CLASS_DEATHKNIGHT;
if (isset($factionSet[$id])) // alliance owned
$data['side'] = SIDE_ALLIANCE;
else if (in_array($id, $factionSet)) // horde owned
$data['side'] = SIDE_HORDE;
else
$data['side'] = SIDE_BOTH;
rsort($data['skill']); // riding (777) expected at pos 0
$data['side'] = $spellFactions[$id] ?? SIDE_BOTH;
$data['quality'] = $data['name'][0];
$data['name'] = mb_substr($data['name'], 1);
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
@@ -251,7 +245,7 @@ if (!CLI)
/**************/
/* Companions */
/**************/
$scripts[] = function() use ($exAdd)
$scripts[] = function() use ($exAdd, $spellFactions)
{
$success = true;
$condition = array(
@@ -260,6 +254,7 @@ if (!CLI)
['typeCat', -6]
);
$companionz = new SpellList($condition);
$legit = DB::Aowow()->selectCol('SELECT `spellId2` FROM ?_items WHERE `class` = ?d AND `subClass` = ?d AND `spellId1` IN (?a) AND `spellId2` IN (?a)', ITEM_CLASS_MISC, 2, LEARN_SPELLS, $companionz->getFoundIDs());
foreach (CLISetup::$localeIds as $l)
{
@@ -271,6 +266,10 @@ if (!CLI)
$buff = "var _ = g_spells;\n";
foreach ($companionz->getListviewData(ITEMINFO_MODEL) as $id => $data)
{
if (!in_array($id, $legit))
continue;
$data['side'] = $spellFactions[$id] ?? SIDE_BOTH;
$data['quality'] = $data['name'][0];
$data['name'] = mb_substr($data['name'], 1);
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
@@ -318,7 +317,7 @@ if (!CLI)
/***********/
/* Recipes */
/***********/
$scripts[] = function() use ($exAdd)
$scripts[] = function() use ($exAdd, $spellFactions)
{
// special case: secondary skills are always requested, so put them in one single file (185, 129, 356); it also contains g_skill_order
$skills = [171, 164, 333, 202, 182, 773, 755, 165, 186, 393, 197, [185, 129, 356]];
@@ -355,7 +354,10 @@ if (!CLI)
$buff = '';
foreach ($recipez->getListviewData() as $id => $data)
{
$data['side'] = $spellFactions[$id] ?? SIDE_BOTH;
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
}
if (!$buff)
{

View File

@@ -185,7 +185,7 @@ SqlGen::register(new class extends SetupScript
// filter misc(class:15) junk(subclass:0) to appropriate categories
// assign pets and mounts to category
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET subClass = IF(effect1AuraId <> 78, 2, IF(effect2AuraId = 207 OR effect3AuraId = 207 OR (s.id <> 65917 AND effect2AuraId = 4 AND effect3Id = 77), -7, 5)) WHERE s.id = spellId2 AND class = 15 AND spellId1 IN (483, 55884)');
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET subClass = IF(effect1AuraId <> 78, 2, IF(effect2AuraId = 207 OR effect3AuraId = 207 OR (s.id <> 65917 AND effect2AuraId = 4 AND effect3Id = 77), -7, 5)) WHERE s.id = spellId2 AND class = 15 AND spellId1 IN (?a)', LEARN_SPELLS);
// more corner cases (mounts that are not actualy learned)
DB::Aowow()->query('UPDATE ?_items i, dbc_spell s SET i.subClass = -7 WHERE (effect1Id = 64 OR (effect1AuraId = 78 AND effect2AuraId = 4 AND effect3Id = 77) OR effect1AuraId = 207 OR effect2AuraId = 207 OR effect3AuraId = 207) AND s.id = i.spellId1 AND i.class = 15 AND i.subClass = 5');

View File

@@ -50,18 +50,17 @@ SqlGen::register(new class extends SetupScript
private function taughtSpell(array $item) : int
{
# spelltrigger_X (0: onUse; 6: onLearnSpell)
# spell: 483 & 55884 are learn spells
// should not be able to teach spells (recipe || mount || vanityPet)
if ($item['class'] != ITEM_CLASS_RECIPE && ($item['class'] != ITEM_CLASS_MISC || ($item['subclass'] != 2 && $item['subclass'] != 5)))
return 0;
// wotlk system
if (($item['spellid_1'] == 483 || $item['spellid_1'] == 55884) && $item['spelltrigger_1'] == 0 && $item['spellid_2'] > 0 && $item['spelltrigger_2'] == 6)
if (in_array($item['spellid_1'], LEARN_SPELLS) && $item['spelltrigger_1'] == 0 && $item['spellid_2'] > 0 && $item['spelltrigger_2'] == 6)
return $item['spellid_2'];
// deprecated system
if ($item['spellid_1'] != 483 && $item['spellid_1'] != 55884 && $item['spellid_1'] > 0 && $item['spelltrigger_1'] == 0)
if (!in_array($item['spellid_1'], LEARN_SPELLS) && $item['spellid_1'] > 0 && $item['spelltrigger_1'] == 0)
return $item['spellid_1'];
return 0;

View File

@@ -0,0 +1 @@
UPDATE `aowow_dbversion` SET `build` = CONCAT(IFNULL(`build`, ''), ' profiler');