mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Profiler/Completion
* apply factions from player_factionchange_spells to all spells * filter companion pets without suitable item source
This commit is contained in:
@@ -832,6 +832,9 @@ define('ITEM_MOD_SHADOW_POWER', 60);
|
|||||||
define('ITEM_MOD_NATURE_POWER', 61);
|
define('ITEM_MOD_NATURE_POWER', 61);
|
||||||
define('ITEM_MOD_ARCANE_POWER', 62);
|
define('ITEM_MOD_ARCANE_POWER', 62);
|
||||||
|
|
||||||
|
// learn trigger spells on items - 483: learn recipe; 55884: learn mount/pet
|
||||||
|
define('LEARN_SPELLS', [483, 55884]);
|
||||||
|
|
||||||
// Spell Attributes definitions
|
// Spell Attributes definitions
|
||||||
define('SPELL_ATTR0_CU_ENCHANT_PROC', 0x00000001); //
|
define('SPELL_ATTR0_CU_ENCHANT_PROC', 0x00000001); //
|
||||||
define('SPELL_ATTR0_CU_CONE_BACK', 0x00000002); //
|
define('SPELL_ATTR0_CU_CONE_BACK', 0x00000002); //
|
||||||
|
|||||||
@@ -1386,8 +1386,7 @@ class ItemList extends BaseType
|
|||||||
|
|
||||||
private function canTeachSpell()
|
private function canTeachSpell()
|
||||||
{
|
{
|
||||||
// 483: learn recipe; 55884: learn mount/pet
|
if (!in_array($this->curTpl['spellId1'], LEARN_SPELLS))
|
||||||
if (!in_array($this->curTpl['spellId1'], [483, 55884]))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// needs learnable spell
|
// needs learnable spell
|
||||||
@@ -1990,7 +1989,7 @@ class ItemListFilter extends Filter
|
|||||||
163 => [FILTER_CR_CALLBACK, 'cbDisenchantsInto', null, null ], // disenchantsinto [disenchanting]
|
163 => [FILTER_CR_CALLBACK, 'cbDisenchantsInto', null, null ], // disenchantsinto [disenchanting]
|
||||||
165 => [FILTER_CR_NUMERIC, 'repairPrice', NUM_CAST_INT, true ], // repaircost
|
165 => [FILTER_CR_NUMERIC, 'repairPrice', NUM_CAST_INT, true ], // repaircost
|
||||||
167 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
|
167 => [FILTER_CR_FLAG, 'cuFlags', CUSTOM_HAS_VIDEO ], // hasvideos
|
||||||
168 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'spellId1', [483, 55884] ], // teachesspell [yn] - 483: learn recipe; 55884: learn mount/pet
|
168 => [FILTER_CR_CALLBACK, 'cbFieldHasVal', 'spellId1', LEARN_SPELLS ], // teachesspell [yn]
|
||||||
169 => [FILTER_CR_ENUM, 'e.holidayId' ], // requiresevent
|
169 => [FILTER_CR_ENUM, 'e.holidayId' ], // requiresevent
|
||||||
171 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otredemption [yn]
|
171 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // otredemption [yn]
|
||||||
172 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // rewardedbyachievement [yn]
|
172 => [FILTER_CR_CALLBACK, 'cbObtainedBy', null, null ], // rewardedbyachievement [yn]
|
||||||
|
|||||||
@@ -467,7 +467,7 @@ class Lang
|
|||||||
switch ($fmt)
|
switch ($fmt)
|
||||||
{
|
{
|
||||||
case self::FMT_HTML:
|
case self::FMT_HTML:
|
||||||
$base = '<a href="?race=%1$d" class="c%1$d">%2$s</a>';
|
$base = '<a href="?race=%1$d" class="q1">%2$s</a>';
|
||||||
$br = '';
|
$br = '';
|
||||||
break;
|
break;
|
||||||
case self::FMT_MARKUP:
|
case self::FMT_MARKUP:
|
||||||
|
|||||||
@@ -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 */
|
/* Quests */
|
||||||
/**********/
|
/**********/
|
||||||
@@ -187,7 +189,7 @@ if (!CLI)
|
|||||||
/**********/
|
/**********/
|
||||||
/* Mounts */
|
/* Mounts */
|
||||||
/**********/
|
/**********/
|
||||||
$scripts[] = function() use ($exAdd)
|
$scripts[] = function() use ($exAdd, $spellFactions)
|
||||||
{
|
{
|
||||||
$success = true;
|
$success = true;
|
||||||
$condition = array(
|
$condition = array(
|
||||||
@@ -198,8 +200,6 @@ if (!CLI)
|
|||||||
);
|
);
|
||||||
$mountz = new SpellList($condition);
|
$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());
|
$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
|
// get mounts for exclusion
|
||||||
@@ -227,15 +227,9 @@ if (!CLI)
|
|||||||
else if ($id == 54729) // Winged Steed of the Ebon Blade
|
else if ($id == 54729) // Winged Steed of the Ebon Blade
|
||||||
$data['reqclass'] = CLASS_DEATHKNIGHT;
|
$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
|
rsort($data['skill']); // riding (777) expected at pos 0
|
||||||
|
|
||||||
|
$data['side'] = $spellFactions[$id] ?? SIDE_BOTH;
|
||||||
$data['quality'] = $data['name'][0];
|
$data['quality'] = $data['name'][0];
|
||||||
$data['name'] = mb_substr($data['name'], 1);
|
$data['name'] = mb_substr($data['name'], 1);
|
||||||
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
|
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
|
||||||
@@ -251,7 +245,7 @@ if (!CLI)
|
|||||||
/**************/
|
/**************/
|
||||||
/* Companions */
|
/* Companions */
|
||||||
/**************/
|
/**************/
|
||||||
$scripts[] = function() use ($exAdd)
|
$scripts[] = function() use ($exAdd, $spellFactions)
|
||||||
{
|
{
|
||||||
$success = true;
|
$success = true;
|
||||||
$condition = array(
|
$condition = array(
|
||||||
@@ -260,6 +254,7 @@ if (!CLI)
|
|||||||
['typeCat', -6]
|
['typeCat', -6]
|
||||||
);
|
);
|
||||||
$companionz = new SpellList($condition);
|
$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)
|
foreach (CLISetup::$localeIds as $l)
|
||||||
{
|
{
|
||||||
@@ -271,6 +266,10 @@ if (!CLI)
|
|||||||
$buff = "var _ = g_spells;\n";
|
$buff = "var _ = g_spells;\n";
|
||||||
foreach ($companionz->getListviewData(ITEMINFO_MODEL) as $id => $data)
|
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['quality'] = $data['name'][0];
|
||||||
$data['name'] = mb_substr($data['name'], 1);
|
$data['name'] = mb_substr($data['name'], 1);
|
||||||
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
|
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
|
||||||
@@ -318,7 +317,7 @@ if (!CLI)
|
|||||||
/***********/
|
/***********/
|
||||||
/* Recipes */
|
/* 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
|
// 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]];
|
$skills = [171, 164, 333, 202, 182, 773, 755, 165, 186, 393, 197, [185, 129, 356]];
|
||||||
@@ -355,7 +354,10 @@ if (!CLI)
|
|||||||
|
|
||||||
$buff = '';
|
$buff = '';
|
||||||
foreach ($recipez->getListviewData() as $id => $data)
|
foreach ($recipez->getListviewData() as $id => $data)
|
||||||
|
{
|
||||||
|
$data['side'] = $spellFactions[$id] ?? SIDE_BOTH;
|
||||||
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
|
$buff .= '_['.$id.'] = '.Util::toJSON($data).";\n";
|
||||||
|
}
|
||||||
|
|
||||||
if (!$buff)
|
if (!$buff)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ SqlGen::register(new class extends SetupScript
|
|||||||
// filter misc(class:15) junk(subclass:0) to appropriate categories
|
// filter misc(class:15) junk(subclass:0) to appropriate categories
|
||||||
|
|
||||||
// assign pets and mounts to category
|
// 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)
|
// 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');
|
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');
|
||||||
|
|||||||
@@ -50,18 +50,17 @@ SqlGen::register(new class extends SetupScript
|
|||||||
private function taughtSpell(array $item) : int
|
private function taughtSpell(array $item) : int
|
||||||
{
|
{
|
||||||
# spelltrigger_X (0: onUse; 6: onLearnSpell)
|
# spelltrigger_X (0: onUse; 6: onLearnSpell)
|
||||||
# spell: 483 & 55884 are learn spells
|
|
||||||
|
|
||||||
// should not be able to teach spells (recipe || mount || vanityPet)
|
// 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)))
|
if ($item['class'] != ITEM_CLASS_RECIPE && ($item['class'] != ITEM_CLASS_MISC || ($item['subclass'] != 2 && $item['subclass'] != 5)))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// wotlk system
|
// 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'];
|
return $item['spellid_2'];
|
||||||
|
|
||||||
// deprecated system
|
// 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 $item['spellid_1'];
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
1
setup/updates/1683928829_01.sql
Normal file
1
setup/updates/1683928829_01.sql
Normal file
@@ -0,0 +1 @@
|
|||||||
|
UPDATE `aowow_dbversion` SET `build` = CONCAT(IFNULL(`build`, ''), ' profiler');
|
||||||
Reference in New Issue
Block a user