diff --git a/endpoints/npc/npc.php b/endpoints/npc/npc.php index ef314118..2ba63bbb 100644 --- a/endpoints/npc/npc.php +++ b/endpoints/npc/npc.php @@ -318,6 +318,7 @@ class NpcBaseResponse extends TemplateResponse implements ICache // tab: abilities / tab_controlledabilities (dep: VehicleId) $tplSpells = []; $genSpells = []; + $spellClick = []; $conditions = ['OR']; for ($i = 1; $i < 9; $i++) @@ -339,6 +340,12 @@ class NpcBaseResponse extends TemplateResponse implements ICache if ($genSpells) $conditions[] = ['id', $genSpells]; + if ($spellClick = DB::World()->select('SELECT `spell_id` AS ARRAY_KEY, `cast_flags` AS "0", `user_type` AS "1" FROM npc_spellclick_spells WHERE `npc_entry` = ?d', $this->typeId)) + { + $genSpells = array_merge($genSpells, array_keys($spellClick)); + $conditions[] = ['id', array_keys($spellClick)]; + } + // Pet-Abilities if (($_typeFlags & NPC_TYPEFLAG_TAMEABLE) && ($_ = $this->subject->getField('family'))) { @@ -376,6 +383,9 @@ class NpcBaseResponse extends TemplateResponse implements ICache foreach ($controled as $id => $values) { + if (isset($spellClick[$id])) + $values['spellclick'] = $spellClick[$id]; + if (in_array($id, $genSpells)) { $normal[$id] = $values; diff --git a/endpoints/spell/spell.php b/endpoints/spell/spell.php index 321e508b..f0d8f8e1 100644 --- a/endpoints/spell/spell.php +++ b/endpoints/spell/spell.php @@ -835,6 +835,9 @@ class SpellBaseResponse extends TemplateResponse implements ICache if ($auras = DB::World()->selectCol('SELECT `entry` FROM creature_template_addon WHERE `auras` REGEXP ?', '\\b'.$this->typeId.'\\b')) $conditions[] = ['id', $auras]; + if ($spellClick = DB::World()->selectCol('SELECT `npc_entry` FROM npc_spellclick_spells WHERE `spell_id` = ?d', $this->typeId)) + $conditions[] = ['id', $spellClick]; + $ubCreature = new CreatureList($conditions); if (!$ubCreature->error) { diff --git a/setup/sql/updates/1763760598_01.sql b/setup/sql/updates/1763760598_01.sql new file mode 100644 index 00000000..6ec5e09b --- /dev/null +++ b/setup/sql/updates/1763760598_01.sql @@ -0,0 +1,2 @@ +UPDATE `aowow_dbversion` SET `build` = CONCAT(IFNULL(`build`, ''), ' globaljs'); +UPDATE `aowow_dbversion` SET `sql` = CONCAT(IFNULL(`sql`, ''), ' spell'); diff --git a/setup/tools/filegen/templates/global.js/listview_templates.js b/setup/tools/filegen/templates/global.js/listview_templates.js index 4f3b1d92..a5c98629 100644 --- a/setup/tools/filegen/templates/global.js/listview_templates.js +++ b/setup/tools/filegen/templates/global.js/listview_templates.js @@ -2635,6 +2635,30 @@ Listview.templates = { } $WH.ae(wrapper, d); } + else if (spell.spellclick) { + td.style.position = 'relative'; + + [flags, who] = spell.spellclick; + + let buff = 'onClick'; + if (who == 1) // Friendly + buff += $WH.sprintf(LANG.qty, g_reputation_standings[4]); + else if (who == 2) // Raid + buff += $WH.sprintf(LANG.qty, g_quest_types[62]); + else if (who == 3) // Party + buff += $WH.sprintf(LANG.qty, g_quest_types[1]); + + buff += LANG.colon + ''; + buff += flags & 0x2 ? g_world_object_types[4] : g_pageInfo.name; + + $(td).append($('